Module: kamailio
Branch: 5.4
Commit: ef86ec4afefdb1c235e0815c76ce17c63f2d20b6
URL:
https://github.com/kamailio/kamailio/commit/ef86ec4afefdb1c235e0815c76ce17c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-08-24T12:29:29+02:00
dmq_usrloc: do not replicate socket if the field is not set:
- GH #2451
(cherry picked from commit 8891b656f5d3650b83e4f877ca43068d5d6f7ff7)
---
Modified: src/modules/dmq_usrloc/usrloc_sync.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ef86ec4afefdb1c235e0815c76ce17c…
Patch:
https://github.com/kamailio/kamailio/commit/ef86ec4afefdb1c235e0815c76ce17c…
---
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) {