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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2020-08-24T12:28:07+02:00

dmq_usrloc: do not replicate socket if the field is not set:

- GH #2451

---

Modified: src/modules/dmq_usrloc/usrloc_sync.c

---

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

---

diff --git a/src/modules/dmq_usrloc/usrloc_sync.c 
b/src/modules/dmq_usrloc/usrloc_sync.c
index d52ddd4932..728c3c53cb 100644
--- a/src/modules/dmq_usrloc/usrloc_sync.c
+++ b/src/modules/dmq_usrloc/usrloc_sync.c
@@ -745,8 +745,9 @@ int usrloc_dmq_send_contact(ucontact_t* ptr, str aor, int 
action, dmq_node_t* no
        srjson_AddStrToObject(&jdoc, jdoc.root, "ruid", ptr->ruid.s, 
ptr->ruid.len);
        srjson_AddStrToObject(&jdoc, jdoc.root, "c", ptr->c.s, ptr->c.len);
        srjson_AddStrToObject(&jdoc, jdoc.root, "received", ptr->received.s, 
ptr->received.len);
-       if (_dmq_usrloc_replicate_socket_info==1)
+       if (_dmq_usrloc_replicate_socket_info==1 && ptr->sock!=NULL) {
                srjson_AddStrToObject(&jdoc, jdoc.root, "sock", 
ptr->sock->sock_str.s, ptr->sock->sock_str.len);
+       }
        srjson_AddStrToObject(&jdoc, jdoc.root, "path", ptr->path.s, 
ptr->path.len);
        srjson_AddStrToObject(&jdoc, jdoc.root, "callid", ptr->callid.s, 
ptr->callid.len);
        srjson_AddStrToObject(&jdoc, jdoc.root, "user_agent", 
ptr->user_agent.s, ptr->user_agent.len);
@@ -759,7 +760,7 @@ int usrloc_dmq_send_contact(ucontact_t* ptr, str aor, int 
action, dmq_node_t* no
        srjson_AddNumberToObject(&jdoc, jdoc.root, "last_modified", 
ptr->last_modified);
        srjson_AddNumberToObject(&jdoc, jdoc.root, "methods", ptr->methods);
        srjson_AddNumberToObject(&jdoc, jdoc.root, "reg_id", ptr->reg_id);
-        srjson_AddNumberToObject(&jdoc, jdoc.root, "server_id", 
ptr->server_id);
+       srjson_AddNumberToObject(&jdoc, jdoc.root, "server_id", ptr->server_id);
 
        jdoc.buf.s = srjson_PrintUnformatted(&jdoc, jdoc.root);
        if(jdoc.buf.s==NULL) {


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to