[sr-dev] git:master:8507efe8: dispatcher: option to set add socket as string in the dst xavp

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 15 21:00:15 CET 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-11-15T20:52:02+01:00

dispatcher: option to set add socket as string in the dst xavp

- bit 2 has to be set for xavp_dst_mode modparam

---

Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
Modified: src/modules/dispatcher/dispatcher.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 75b3b56f3a..67cbce1feb 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -1925,6 +1925,17 @@ int ds_add_xavp_record(ds_set_t *dsidx, int pos, int set, int alg,
 			LM_ERR("failed to add destination sock xavp field\n");
 			return -1;
 		}
+		if((ds_xavp_dst_mode & DS_XAVP_DST_ADD_SOCKSTR)
+				&& (dsidx->dlist[pos].attrs.socket.len > 0)) {
+			memset(&nxval, 0, sizeof(sr_xval_t));
+			nxval.type = SR_XTYPE_STR;
+			nxval.v.s = dsidx->dlist[pos].attrs.socket;
+			if(xavp_add_value(&ds_xavp_dst_socket, &nxval, &nxavp)==NULL) {
+				xavp_destroy_list(&nxavp);
+				LM_ERR("failed to add destination attrs xavp field\n");
+				return -1;
+			}
+		}
 	}
 
 	if(alg == DS_ALG_CALLLOAD) {
diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h
index e4a54944aa..24ebeeeea3 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -67,6 +67,7 @@
 #define DS_USE_NEXT			1
 
 #define DS_XAVP_DST_SKIP_ATTRS	1
+#define DS_XAVP_DST_ADD_SOCKSTR	(1<<1)
 
 #define DS_XAVP_CTX_SKIP_CNT	1
 
@@ -95,6 +96,7 @@ extern str ds_xavp_dst_grp;
 extern str ds_xavp_dst_dstid;
 extern str ds_xavp_dst_attrs;
 extern str ds_xavp_dst_sock;
+extern str ds_xavp_dst_socket;
 
 extern str ds_xavp_ctx_cnt;
 
diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index 0be0968ac2..06d1081ff1 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -85,6 +85,7 @@ str ds_xavp_dst_grp = str_init("grp");
 str ds_xavp_dst_dstid = str_init("dstid");
 str ds_xavp_dst_attrs = str_init("attrs");
 str ds_xavp_dst_sock = str_init("sock");
+str ds_xavp_dst_socket = str_init("socket");
 
 str ds_xavp_ctx_cnt = str_init("cnt");
 




More information about the sr-dev mailing list