Module: kamailio Branch: 5.6 Commit: ea782be2cc29589f4dd55f0d91c11049b5280fe0 URL: https://github.com/kamailio/kamailio/commit/ea782be2cc29589f4dd55f0d91c11049...
Author: Richard Fuchs rfuchs@sipwise.com Committer: Henning Westerholt hw@gilawa.com Date: 2023-02-16T11:09:42Z
rtpengine: avoid repeated queries to same node
If we know which node handles a particular call from the hash table, only query that node once and then return error if it's dead, instead of going into a pointless loop looking for other nodes to query which don't exist.
closes #3370
(cherry picked from commit bd0ce126109f40f5217053f20e687b93b2268164)
---
Modified: src/modules/rtpengine/rtpengine.c
---
Diff: https://github.com/kamailio/kamailio/commit/ea782be2cc29589f4dd55f0d91c11049... Patch: https://github.com/kamailio/kamailio/commit/ea782be2cc29589f4dd55f0d91c11049...
---
diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index ab6920c01d6..1b1f8b0ca92 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -3349,6 +3349,12 @@ select_rtpp_node(str callid, str viabranch, int do_test, struct rtpp_node **quer // lookup node node = select_rtpp_node_old(callid, viabranch, do_test, op);
+ if (node && is_queried_node(node, queried_nodes_ptr, queried_nodes)) { + LM_ERR("rtpengine node for callid=%.*s is known (%.*s) but it has already been queried, therefore not returning it\n", + callid.len, callid.s, node->rn_url.len, node->rn_url.s); + return NULL; + } + // check node if (!node || (node_in_set(node, active_rtpp_set) == 0)) { // run the selection algorithm