Module: kamailio
Branch: 6.0
Commit: ded36e28198cb518bfb64ffb0e2cc659a35af9ac
URL: 
https://github.com/kamailio/kamailio/commit/ded36e28198cb518bfb64ffb0e2cc659a35af9ac

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-01-29T08:07:19+01:00

dispatcher: copy over the ocdata structure for records kept by rpc add/remove 
record

(cherry picked from commit 77eaba17916109ef5656a276e3f469b29415d6f5)

---

Modified: src/modules/dispatcher/dispatch.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index b404ede384b..ca1636edbd2 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2866,14 +2866,16 @@ int ds_update_dst(struct sip_msg *msg, int upos, int 
mode)
 void ds_add_dest_cb(ds_set_t *node, int i, void *arg)
 {
        int setn;
+       ds_dest_t *ndst = NULL;
 
-       if(add_dest2list(node->id, node->dlist[i].uri, node->dlist[i].flags,
-                          node->dlist[i].priority, &node->dlist[i].attrs.body,
-                          *ds_next_idx, &setn, node->dlist[i].dload,
-                          &node->dlist[i].latency_stats)
-                       == NULL) {
+       ndst = add_dest2list(node->id, node->dlist[i].uri, node->dlist[i].flags,
+                       node->dlist[i].priority, &node->dlist[i].attrs.body, 
*ds_next_idx,
+                       &setn, node->dlist[i].dload, 
&node->dlist[i].latency_stats);
+       if(ndst == NULL) {
                LM_WARN("failed to add destination in group %d - %.*s\n", 
node->id,
                                node->dlist[i].uri.len, node->dlist[i].uri.s);
+       } else {
+               memcpy(&ndst->ocdata, &node->dlist[i].ocdata, 
sizeof(ds_ocdata_t));
        }
        return;
 }
@@ -2922,7 +2924,10 @@ int ds_add_dst(int group, str *address, int flags, int 
priority, str *attrs)
 /* callback for removing nodes based on setid & address */
 void ds_filter_dest_cb(ds_set_t *node, int i, void *arg)
 {
-       struct ds_filter_dest_cb_arg *filter_arg = (typeof(filter_arg))arg;
+       ds_dest_t *ndst = NULL;
+       struct ds_filter_dest_cb_arg *filter_arg;
+
+       filter_arg = (typeof(filter_arg))arg;
 
        if(node->id == filter_arg->setid
                        && node->dlist[i].uri.len == filter_arg->dest->uri.len
@@ -2931,13 +2936,16 @@ void ds_filter_dest_cb(ds_set_t *node, int i, void *arg)
                                           == 0)
                return;
 
-       if(add_dest2list(node->id, node->dlist[i].uri, node->dlist[i].flags,
-                          node->dlist[i].priority, &node->dlist[i].attrs.body,
-                          *ds_next_idx, filter_arg->setn, node->dlist[i].dload,
-                          &node->dlist[i].latency_stats)
-                       == NULL) {
+       ndst = add_dest2list(node->id, node->dlist[i].uri, node->dlist[i].flags,
+                       node->dlist[i].priority, &node->dlist[i].attrs.body, 
*ds_next_idx,
+                       filter_arg->setn, node->dlist[i].dload,
+                       &node->dlist[i].latency_stats);
+
+       if(ndst == NULL) {
                LM_WARN("failed to add destination in group %d - %.*s\n", 
node->id,
                                node->dlist[i].uri.len, node->dlist[i].uri.s);
+       } else {
+               memcpy(&ndst->ocdata, &node->dlist[i].ocdata, 
sizeof(ds_ocdata_t));
        }
        return;
 }

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to