Browse code

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

- bit 2 has to be set for xavp_dst_mode modparam

Daniel-Constantin Mierla authored on 15/11/2019 19:52:02
Showing 3 changed files
... ...
@@ -1925,6 +1925,17 @@ int ds_add_xavp_record(ds_set_t *dsidx, int pos, int set, int alg,
1925 1925
 			LM_ERR("failed to add destination sock xavp field\n");
1926 1926
 			return -1;
1927 1927
 		}
1928
+		if((ds_xavp_dst_mode & DS_XAVP_DST_ADD_SOCKSTR)
1929
+				&& (dsidx->dlist[pos].attrs.socket.len > 0)) {
1930
+			memset(&nxval, 0, sizeof(sr_xval_t));
1931
+			nxval.type = SR_XTYPE_STR;
1932
+			nxval.v.s = dsidx->dlist[pos].attrs.socket;
1933
+			if(xavp_add_value(&ds_xavp_dst_socket, &nxval, &nxavp)==NULL) {
1934
+				xavp_destroy_list(&nxavp);
1935
+				LM_ERR("failed to add destination attrs xavp field\n");
1936
+				return -1;
1937
+			}
1938
+		}
1928 1939
 	}
1929 1940
 
1930 1941
 	if(alg == DS_ALG_CALLLOAD) {
... ...
@@ -67,6 +67,7 @@
67 67
 #define DS_USE_NEXT			1
68 68
 
69 69
 #define DS_XAVP_DST_SKIP_ATTRS	1
70
+#define DS_XAVP_DST_ADD_SOCKSTR	(1<<1)
70 71
 
71 72
 #define DS_XAVP_CTX_SKIP_CNT	1
72 73
 
... ...
@@ -95,6 +96,7 @@ extern str ds_xavp_dst_grp;
95 96
 extern str ds_xavp_dst_dstid;
96 97
 extern str ds_xavp_dst_attrs;
97 98
 extern str ds_xavp_dst_sock;
99
+extern str ds_xavp_dst_socket;
98 100
 
99 101
 extern str ds_xavp_ctx_cnt;
100 102
 
... ...
@@ -85,6 +85,7 @@ str ds_xavp_dst_grp = str_init("grp");
85 85
 str ds_xavp_dst_dstid = str_init("dstid");
86 86
 str ds_xavp_dst_attrs = str_init("attrs");
87 87
 str ds_xavp_dst_sock = str_init("sock");
88
+str ds_xavp_dst_socket = str_init("socket");
88 89
 
89 90
 str ds_xavp_ctx_cnt = str_init("cnt");
90 91