[sr-dev] git:master:684059ca: dmq_usrloc: include server_id in replicated contacts

Charles Chance charles.chance at sipcentric.com
Mon Nov 6 16:40:48 CET 2017


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

Author: Charles Chance <charles.chance at sipcentric.com>
Committer: Charles Chance <charles.chance at sipcentric.com>
Date: 2017-11-06T15:39:41Z

dmq_usrloc: include server_id in replicated contacts

---

Modified: src/modules/dmq_usrloc/usrloc_sync.c

---

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

---

diff --git a/src/modules/dmq_usrloc/usrloc_sync.c b/src/modules/dmq_usrloc/usrloc_sync.c
index de01bc2062..1a7eef0ab8 100644
--- a/src/modules/dmq_usrloc/usrloc_sync.c
+++ b/src/modules/dmq_usrloc/usrloc_sync.c
@@ -323,12 +323,12 @@ static int usrloc_dmq_execute_action(srjson_t *jdoc_action, dmq_node_t* node) {
 	static ucontact_info_t ci;
 	srjson_t *it = NULL;
 	unsigned int action, expires, cseq, flags, cflags, q, last_modified,
-				 methods, reg_id;
+				 methods, reg_id, server_id;
 	str aor=STR_NULL, ruid=STR_NULL, received=STR_NULL, instance=STR_NULL;
 	static str c=STR_NULL, callid=STR_NULL, path=STR_NULL, user_agent=STR_NULL;
 
 	action = expires = cseq = flags = cflags = q = last_modified
-		= methods = reg_id = 0;
+		= methods = reg_id = server_id = 0;
 
 	for(it=jdoc_action; it; it = it->next) {
 		if (it->string == NULL) continue;
@@ -375,6 +375,8 @@ static int usrloc_dmq_execute_action(srjson_t *jdoc_action, dmq_node_t* node) {
 			methods = SRJSON_GET_UINT(it);
 		} else if (strcmp(it->string, "reg_id")==0) {
 			reg_id = SRJSON_GET_UINT(it);
+                } else if (strcmp(it->string, "server_id")==0) {
+                        server_id = SRJSON_GET_UINT(it);
 		} else {
 			LM_ERR("unrecognized field in json object\n");
 		}
@@ -394,6 +396,7 @@ static int usrloc_dmq_execute_action(srjson_t *jdoc_action, dmq_node_t* node) {
 	ci.methods = methods;
 	ci.instance = instance;
 	ci.reg_id = reg_id;
+	ci.server_id = server_id;
 	ci.tcpconn_id = -1;
 	ci.last_modified = last_modified;
 
@@ -646,7 +649,7 @@ int usrloc_dmq_send_multi_contact(ucontact_t* ptr, str aor, int action, dmq_node
 		return -1;
 	}
 	LM_DBG("group size[%d]\n", jdoc_contact_group.size);
-	jdoc_contact_group.size += 188; // json overhead ("":{"action":,"aor":"","ruid":"","c":""...)
+	jdoc_contact_group.size += 201; // json overhead ("":{"action":,"aor":"","ruid":"","c":""...)
 
 	srjson_AddNumberToObject(jdoc, jdoc_contact, "action", action);
 	jdoc_contact_group.size += snprintf(NULL,0,"%d", action);
@@ -683,6 +686,8 @@ int usrloc_dmq_send_multi_contact(ucontact_t* ptr, str aor, int action, dmq_node
 	jdoc_contact_group.size += snprintf(NULL,0,"%u", ptr->methods);
 	srjson_AddNumberToObject(jdoc, jdoc_contact, "reg_id", ptr->reg_id);
 	jdoc_contact_group.size += snprintf(NULL,0,"%d", ptr->reg_id);
+        srjson_AddNumberToObject(jdoc, jdoc_contact, "server_id", ptr->server_id);
+        jdoc_contact_group.size += snprintf(NULL,0,"%d", ptr->server_id);
 
 	char idx[5];
 	jdoc_contact_group.count++;
@@ -729,6 +734,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);
 
 	jdoc.buf.s = srjson_PrintUnformatted(&jdoc, jdoc.root);
 	if(jdoc.buf.s==NULL) {




More information about the sr-dev mailing list