Module: kamailio
Branch: master
Commit: bd0ce126109f40f5217053f20e687b93b2268164
URL: 
https://github.com/kamailio/kamailio/commit/bd0ce126109f40f5217053f20e687b93b2268164

Author: Richard Fuchs <rfu...@sipwise.com>
Committer: Richard Fuchs <rfu...@sipwise.com>
Date: 2023-02-15T08:49:01-05:00

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

---

Modified: src/modules/rtpengine/rtpengine.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/bd0ce126109f40f5217053f20e687b93b2268164.diff
Patch: 
https://github.com/kamailio/kamailio/commit/bd0ce126109f40f5217053f20e687b93b2268164.patch

---

diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index 5444b0d461..46640a5d3d 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -3378,6 +3378,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

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to