Browse code

pv: new variable $rsi - return status code for replies and 0 for requests

Daniel-Constantin Mierla authored on 16/11/2021 08:10:38
Showing 1 changed files
... ...
@@ -379,6 +379,9 @@ static pv_export_t mod_pvs[] = {
379 379
 	{{"rs", (sizeof("rs")-1)}, /* */
380 380
 		PVT_OTHER, pv_get_status, 0,
381 381
 		0, 0, 0, 0},
382
+	{{"rsi", (sizeof("rsi")-1)}, /* */
383
+		PVT_OTHER, pv_get_statusi, 0,
384
+		0, 0, 0, 0},
382 385
 	{{"rt", (sizeof("rt")-1)}, /* */
383 386
 		PVT_OTHER, pv_get_refer_to, 0,
384 387
 		0, 0, 0, 0},
Browse code

pv: added functions for xavu params explode/implode

Daniel-Constantin Mierla authored on 24/09/2021 06:32:31
Showing 1 changed files
... ...
@@ -579,6 +579,8 @@ static int w_xavp_copy_dst(sip_msg_t *msg, char *src_name, char *src_idx,
579 579
 		char *dst_name, char *dst_idx);
580 580
 static int w_xavp_params_explode(sip_msg_t *msg, char *pparams, char *pxname);
581 581
 static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname);
582
+static int w_xavu_params_explode(sip_msg_t *msg, char *pparams, char *pxname);
583
+static int w_xavu_params_implode(sip_msg_t *msg, char *pxname, char *pvname);
582 584
 static int w_xavp_slist_explode(sip_msg_t *msg, char *pslist, char *psep,
583 585
 		char *pmode, char *pxname);
584 586
 static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
... ...
@@ -633,17 +635,23 @@ static cmd_export_t cmds[]={
633 635
 	{"not_empty", (cmd_function)pv_not_empty, 1, fixup_pvar_null,
634 636
 		fixup_free_pvar_null,
635 637
 		ANY_ROUTE},
638
+	{"xavp_copy", (cmd_function)w_xavp_copy, 3, pv_xavp_copy_fixup, 0,
639
+		ANY_ROUTE},
640
+	{"xavp_copy", (cmd_function)w_xavp_copy_dst, 4, pv_xavp_copy_fixup, 0,
641
+		ANY_ROUTE},
636 642
 	{"xavp_slist_explode", (cmd_function)w_xavp_slist_explode,
637 643
 		4, fixup_spve_all, fixup_free_spve_all,
638 644
 		ANY_ROUTE},
639 645
 	{"xavp_params_explode", (cmd_function)w_xavp_params_explode,
640 646
 		2, fixup_spve_spve, fixup_free_spve_spve,
641 647
 		ANY_ROUTE},
642
-	{"xavp_copy", (cmd_function)w_xavp_copy, 3, pv_xavp_copy_fixup, 0,
648
+	{"xavp_params_implode", (cmd_function)w_xavp_params_implode,
649
+		2, fixup_spve_str, fixup_free_spve_str,
643 650
 		ANY_ROUTE},
644
-	{"xavp_copy", (cmd_function)w_xavp_copy_dst, 4, pv_xavp_copy_fixup, 0,
651
+	{"xavu_params_explode", (cmd_function)w_xavu_params_explode,
652
+		2, fixup_spve_spve, fixup_free_spve_spve,
645 653
 		ANY_ROUTE},
646
-	{"xavp_params_implode", (cmd_function)w_xavp_params_implode,
654
+	{"xavu_params_implode", (cmd_function)w_xavu_params_implode,
647 655
 		2, fixup_spve_str, fixup_free_spve_str,
648 656
 		ANY_ROUTE},
649 657
 	{"xavp_child_seti", (cmd_function)w_xavp_child_seti,
... ...
@@ -1083,6 +1091,40 @@ static int ki_xavp_params_explode(sip_msg_t *msg, str *sparams, str *sxname)
1083 1091
 	return 1;
1084 1092
 }
1085 1093
 
1094
+/**
1095
+ *
1096
+ */
1097
+static int w_xavu_params_explode(sip_msg_t *msg, char *pparams, char *pxname)
1098
+{
1099
+	str sparams;
1100
+	str sxname;
1101
+
1102
+	if(fixup_get_svalue(msg, (gparam_t*)pparams, &sparams)!=0) {
1103
+		LM_ERR("cannot get the params\n");
1104
+		return -1;
1105
+	}
1106
+	if(fixup_get_svalue(msg, (gparam_t*)pxname, &sxname)!=0) {
1107
+		LM_ERR("cannot get the xavp name\n");
1108
+		return -1;
1109
+	}
1110
+
1111
+	if(xavu_params_explode(&sparams, &sxname)<0)
1112
+		return -1;
1113
+
1114
+	return 1;
1115
+}
1116
+
1117
+/**
1118
+ *
1119
+ */
1120
+static int ki_xavu_params_explode(sip_msg_t *msg, str *sparams, str *sxname)
1121
+{
1122
+	if(xavu_params_explode(sparams, sxname)<0)
1123
+		return -1;
1124
+
1125
+	return 1;
1126
+}
1127
+
1086 1128
 /**
1087 1129
  *
1088 1130
  */
... ...
@@ -1140,6 +1182,63 @@ static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname)
1140 1182
 	return ki_xavp_params_implode(msg, &sxname, (str*)pvname);
1141 1183
 }
1142 1184
 
1185
+/**
1186
+ *
1187
+ */
1188
+static int ki_xavu_params_implode(sip_msg_t *msg, str *sxname, str *svname)
1189
+{
1190
+	pv_spec_t *vspec=NULL;
1191
+	pv_value_t val;
1192
+
1193
+	if(sxname==NULL || sxname->s==NULL || sxname->len<=0) {
1194
+		LM_ERR("invalid xavp name\n");
1195
+		return -1;
1196
+	}
1197
+	if(svname==NULL || svname->s==NULL || svname->len<=0) {
1198
+		LM_ERR("invalid output var name\n");
1199
+		return -1;
1200
+	}
1201
+
1202
+	vspec = pv_cache_get(svname);
1203
+	if(vspec==NULL) {
1204
+		LM_ERR("cannot get pv spec for [%.*s]\n", svname->len, svname->s);
1205
+		return -1;
1206
+	}
1207
+	if(vspec->setf==NULL) {
1208
+		LM_ERR("read only output variable [%.*s]\n", svname->len, svname->s);
1209
+		return -1;
1210
+	}
1211
+
1212
+	val.rs.s = pv_get_buffer();
1213
+	val.rs.len = xavu_serialize_fields(sxname, val.rs.s, pv_get_buffer_size());
1214
+	if(val.rs.len<=0) {
1215
+		return -1;
1216
+	}
1217
+
1218
+	val.flags = PV_VAL_STR;
1219
+	if(vspec->setf(msg, &vspec->pvp, EQ_T, &val)<0) {
1220
+		LM_ERR("setting PV failed [%.*s]\n", svname->len, svname->s);
1221
+		return -1;
1222
+	}
1223
+
1224
+	return 1;
1225
+}
1226
+
1227
+/**
1228
+ *
1229
+ */
1230
+static int w_xavu_params_implode(sip_msg_t *msg, char *pxname, char *pvname)
1231
+{
1232
+	str sxname;
1233
+
1234
+	if(fixup_get_svalue(msg, (gparam_t*)pxname, &sxname)!=0) {
1235
+		LM_ERR("cannot get the xavp name\n");
1236
+		return -1;
1237
+	}
1238
+
1239
+	return ki_xavu_params_implode(msg, &sxname, (str*)pvname);
1240
+}
1241
+
1143 1242
 /**
1144 1243
  *
1145 1244
  */
... ...
@@ -2763,6 +2862,16 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
2763 2862
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
2764 2863
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
2765 2864
 	},
2865
+	{ str_init("pvx"), str_init("xavu_params_explode"),
2866
+		SR_KEMIP_INT, ki_xavu_params_explode,
2867
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
2868
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
2869
+	},
2870
+	{ str_init("pvx"), str_init("xavu_params_implode"),
2871
+		SR_KEMIP_INT, ki_xavu_params_implode,
2872
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
2873
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
2874
+	},
2766 2875
 	{ str_init("pvx"), str_init("xavp_slist_explode"),
2767 2876
 		SR_KEMIP_INT, ki_xavp_slist_explode,
2768 2877
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
Browse code

pv: added variable $msgbuf(index)

- get/set the character at the position index in the message buffer

Daniel-Constantin Mierla authored on 27/07/2021 13:44:38
Showing 1 changed files
... ...
@@ -552,6 +552,8 @@ static pv_export_t mod_pvs[] = {
552 552
 		pv_parse_via_name, 0, 0, 0},
553 553
 	{{"viaZ", (sizeof("viaZ")-1)}, PVT_OTHER, pv_get_viaZ, 0,
554 554
 		pv_parse_via_name, 0, 0, 0},
555
+	{{"msgbuf", (sizeof("msgbuf")-1)}, PVT_OTHER, pv_get_msgbuf, pv_set_msgbuf,
556
+		pv_parse_msgbuf_name, 0, 0, 0},
555 557
 
556 558
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
557 559
 };
Browse code

pv: added $via1(...) - return attributes of 2nd via

Daniel-Constantin Mierla authored on 13/07/2021 07:12:17
Showing 1 changed files
... ...
@@ -548,6 +548,8 @@ static pv_export_t mod_pvs[] = {
548 548
 		pv_parse_ccp_attrs_name, 0, 0, 0},
549 549
 	{{"via0", (sizeof("via0")-1)}, PVT_OTHER, pv_get_via0, 0,
550 550
 		pv_parse_via_name, 0, 0, 0},
551
+	{{"via1", (sizeof("via1")-1)}, PVT_OTHER, pv_get_via1, 0,
552
+		pv_parse_via_name, 0, 0, 0},
551 553
 	{{"viaZ", (sizeof("viaZ")-1)}, PVT_OTHER, pv_get_viaZ, 0,
552 554
 		pv_parse_via_name, 0, 0, 0},
553 555
 
Browse code

pv: added $viaZ(attr) - get the attributes of last via header

Daniel-Constantin Mierla authored on 03/07/2021 08:54:10
Showing 1 changed files
... ...
@@ -548,6 +548,8 @@ static pv_export_t mod_pvs[] = {
548 548
 		pv_parse_ccp_attrs_name, 0, 0, 0},
549 549
 	{{"via0", (sizeof("via0")-1)}, PVT_OTHER, pv_get_via0, 0,
550 550
 		pv_parse_via_name, 0, 0, 0},
551
+	{{"viaZ", (sizeof("viaZ")-1)}, PVT_OTHER, pv_get_viaZ, 0,
552
+		pv_parse_via_name, 0, 0, 0},
551 553
 
552 554
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
553 555
 };
Browse code

vp: new variable $via0(attr)

- get the attributes of first Via

Daniel-Constantin Mierla authored on 02/07/2021 14:18:55
Showing 1 changed files
... ...
@@ -546,6 +546,8 @@ static pv_export_t mod_pvs[] = {
546 546
 		pv_parse_rpl_attrs_name, 0, 0, 0},
547 547
 	{{"ccp", (sizeof("ccp")-1)}, PVT_OTHER, pv_get_ccp_attrs, pv_set_ccp_attrs,
548 548
 		pv_parse_ccp_attrs_name, 0, 0, 0},
549
+	{{"via0", (sizeof("via0")-1)}, PVT_OTHER, pv_get_via0, 0,
550
+		pv_parse_via_name, 0, 0, 0},
549 551
 
550 552
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
551 553
 };
Browse code

pv: new variable $hflc(hname)

- return the number of bodies for known headers that can also be as a comma
separated list
- supported now is Via header

Daniel-Constantin Mierla authored on 08/06/2021 11:25:54
Showing 1 changed files
... ...
@@ -110,6 +110,8 @@ static pv_export_t mod_pvs[] = {
110 110
 		0, 0, 0},
111 111
 	{{"hfl", (sizeof("hfl")-1)}, PVT_HDR, pv_get_hfl, 0, pv_parse_hfl_name,
112 112
 		pv_parse_index, 0, 0},
113
+	{{"hflc", (sizeof("hflc")-1)}, PVT_HDRC, pv_get_hflc, 0, pv_parse_hfl_name,
114
+		0, 0, 0},
113 115
 	{{"var", (sizeof("var")-1)}, PVT_SCRIPTVAR, pv_get_scriptvar,
114 116
 		pv_set_scriptvar, pv_parse_scriptvar_name, 0, 0, 0},
115 117
 	{{"vz", (sizeof("vz")-1)}, PVT_SCRIPTVAR, pv_get_scriptvar,
Browse code

pv: new variables $hfl(name)

- similar to $hdr(name), but for some of the standard headers that can
have many bodies serialized in the same header field is able to return the
individual body values
- so far implemented for Via
- for the rest of the headers works like $hdr(name)

Daniel-Constantin Mierla authored on 27/05/2021 13:18:46
Showing 1 changed files
... ...
@@ -108,6 +108,8 @@ static pv_export_t mod_pvs[] = {
108 108
 		pv_parse_index, 0, 0},
109 109
 	{{"hdrc", (sizeof("hdrc")-1)}, PVT_HDRC, pv_get_hdrc, 0, pv_parse_hdr_name,
110 110
 		0, 0, 0},
111
+	{{"hfl", (sizeof("hfl")-1)}, PVT_HDR, pv_get_hfl, 0, pv_parse_hfl_name,
112
+		pv_parse_index, 0, 0},
111 113
 	{{"var", (sizeof("var")-1)}, PVT_SCRIPTVAR, pv_get_scriptvar,
112 114
 		pv_set_scriptvar, pv_parse_scriptvar_name, 0, 0, 0},
113 115
 	{{"vz", (sizeof("vz")-1)}, PVT_SCRIPTVAR, pv_get_scriptvar,
Browse code

pv: added function to set the value for $ccp(key)

Daniel-Constantin Mierla authored on 16/05/2021 10:23:02
Showing 1 changed files
... ...
@@ -540,7 +540,7 @@ static pv_export_t mod_pvs[] = {
540 540
 		pv_parse_ksr_attrs_name, 0, 0, 0 },
541 541
 	{{"rpl", (sizeof("rpl")-1)}, PVT_OTHER, pv_get_rpl_attrs, 0,
542 542
 		pv_parse_rpl_attrs_name, 0, 0, 0},
543
-	{{"ccp", (sizeof("ccp")-1)}, PVT_OTHER, pv_get_ccp_attrs, 0,
543
+	{{"ccp", (sizeof("ccp")-1)}, PVT_OTHER, pv_get_ccp_attrs, pv_set_ccp_attrs,
544 544
 		pv_parse_ccp_attrs_name, 0, 0, 0},
545 545
 
546 546
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
Browse code

pv: added $ccp(gname.vname) variable

- get the config custom parameter value
- direct access without running through select variable

Daniel-Constantin Mierla authored on 14/05/2021 08:41:29
Showing 1 changed files
... ...
@@ -540,6 +540,8 @@ static pv_export_t mod_pvs[] = {
540 540
 		pv_parse_ksr_attrs_name, 0, 0, 0 },
541 541
 	{{"rpl", (sizeof("rpl")-1)}, PVT_OTHER, pv_get_rpl_attrs, 0,
542 542
 		pv_parse_rpl_attrs_name, 0, 0, 0},
543
+	{{"ccp", (sizeof("ccp")-1)}, PVT_OTHER, pv_get_ccp_attrs, 0,
544
+		pv_parse_ccp_attrs_name, 0, 0, 0},
543 545
 
544 546
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
545 547
 };
... ...
@@ -692,6 +694,10 @@ static int mod_init(void)
692 694
 		LM_ERR("failed to register RPC commands\n");
693 695
 		return -1;
694 696
 	}
697
+	if(pv_ccp_ctx_init()!=0) {
698
+		LM_ERR("failed to initialize var ccp context\n");
699
+		return -1;
700
+	}
695 701
 	pv_init_sbranch();
696 702
 
697 703
 	return 0;
Browse code

pv: added $rpl(key) variable

- return attributes of the sip reply that is processed at that moment
- the key can be:
- duri - SIP URI corresponding to the destination address where the
reply is going to be sent based on 2nd via
- dhost - host part of duri
- dport - port part of duri
- dproto - proto of duri
- dprotoid - proto id of duri
- cntvia - number of via header bodies

Daniel-Constantin Mierla authored on 12/05/2021 11:11:26
Showing 1 changed files
... ...
@@ -538,6 +538,8 @@ static pv_export_t mod_pvs[] = {
538 538
 		pv_parse_msg_attrs_name, 0, 0, 0 },
539 539
 	{ {"ksr", (sizeof("ksr")-1)}, PVT_OTHER, pv_get_ksr_attrs, 0,
540 540
 		pv_parse_ksr_attrs_name, 0, 0, 0 },
541
+	{{"rpl", (sizeof("rpl")-1)}, PVT_OTHER, pv_get_rpl_attrs, 0,
542
+		pv_parse_rpl_attrs_name, 0, 0, 0},
541 543
 
542 544
 	{ {0, 0}, 0, 0, 0, 0, 0, 0, 0 }
543 545
 };
Browse code

pv: new transformation class - urialias

- encode/decode uri alias values (addr~port~proto)

Daniel-Constantin Mierla authored on 30/03/2021 09:29:26
Showing 1 changed files
... ...
@@ -59,6 +59,8 @@ static tr_export_t mod_trans[] = {
59 59
 		tr_parse_tobody },
60 60
 	{ {"line", sizeof("line")-1}, /* line class */
61 61
 		tr_parse_line },
62
+	{ {"urialias", sizeof("urialias")-1}, /* uri alias class */
63
+		tr_parse_urialias },
62 64
 
63 65
 	{ { 0, 0 }, 0 }
64 66
 };
Browse code

pv: $fsp - return send socket port, or 0 if $fs not set

Daniel-Constantin Mierla authored on 05/01/2021 15:52:32
Showing 1 changed files
... ...
@@ -253,6 +253,9 @@ static pv_export_t mod_pvs[] = {
253 253
 	{{"fsn", (sizeof("fsn")-1)}, /* */
254 254
 		PVT_OTHER, pv_get_force_sock_name, pv_set_force_sock_name,
255 255
 		0, 0, 0, 0},
256
+	{{"fsp", (sizeof("fsp")-1)}, /* */
257
+		PVT_OTHER, pv_get_force_sock_port, 0,
258
+		0, 0, 0, 0},
256 259
 	{{"ft", (sizeof("ft")-1)}, /* */
257 260
 		PVT_OTHER, pv_get_from_attr, 0,
258 261
 		0, 0, pv_init_iname, 4},
Browse code

pv: removed code relocared to core

Daniel-Constantin Mierla authored on 27/12/2020 17:20:59
Showing 1 changed files
... ...
@@ -196,10 +196,6 @@ static pv_export_t mod_pvs[] = {
196 196
 	{{"dd", (sizeof("dd")-1)}, /* */
197 197
 		PVT_OTHER, pv_get_dsturi_attr, 0,
198 198
 		0, 0, pv_init_iname, 1},
199
-	{{"def", (sizeof("def")-1)}, PVT_OTHER, pv_get_def, 0,
200
-		pv_parse_def_name, 0, 0, 0},
201
-	{{"defn", (sizeof("defn")-1)}, PVT_OTHER, pv_get_defn, 0,
202
-		pv_parse_defn_name, 0, 0, 0},
203 199
 	{{"di", (sizeof("di")-1)}, /* */
204 200
 		PVT_OTHER, pv_get_diversion, 0,
205 201
 		0, 0, pv_init_iname, 1},
Browse code

pv: removed implementation of $env(name)

Daniel-Constantin Mierla authored on 22/12/2020 18:44:47
Showing 1 changed files
... ...
@@ -227,8 +227,6 @@ static pv_export_t mod_pvs[] = {
227 227
 	{{"duri", (sizeof("duri")-1)}, /* */
228 228
 		PVT_DSTURI, pv_get_dsturi, pv_set_dsturi,
229 229
 		0, 0, 0, 0},
230
-	{{"env", (sizeof("env")-1)}, PVT_OTHER, pv_get_env, 0,
231
-		pv_parse_env_name, 0, 0, 0},
232 230
 	{{"err.class", (sizeof("err.class")-1)}, /* */
233 231
 		PVT_OTHER, pv_get_errinfo_attr, 0,
234 232
 		0, 0, 0, 0},
Browse code

pv: new var $defn(name)

- return the value of a define converted to numbaer (signed int)

Daniel-Constantin Mierla authored on 11/12/2020 13:21:53
Showing 1 changed files
... ...
@@ -196,8 +196,10 @@ static pv_export_t mod_pvs[] = {
196 196
 	{{"dd", (sizeof("dd")-1)}, /* */
197 197
 		PVT_OTHER, pv_get_dsturi_attr, 0,
198 198
 		0, 0, pv_init_iname, 1},
199
-	{{"def", (sizeof("env")-1)}, PVT_OTHER, pv_get_def, 0,
199
+	{{"def", (sizeof("def")-1)}, PVT_OTHER, pv_get_def, 0,
200 200
 		pv_parse_def_name, 0, 0, 0},
201
+	{{"defn", (sizeof("defn")-1)}, PVT_OTHER, pv_get_defn, 0,
202
+		pv_parse_defn_name, 0, 0, 0},
201 203
 	{{"di", (sizeof("di")-1)}, /* */
202 204
 		PVT_OTHER, pv_get_diversion, 0,
203 205
 		0, 0, pv_init_iname, 1},
Browse code

pv: new variable $Rn - return receiving socket name

Daniel-Constantin Mierla authored on 23/11/2020 06:44:09
Showing 1 changed files
... ...
@@ -410,6 +410,9 @@ static pv_export_t mod_pvs[] = {
410 410
 	{{"Rut", (sizeof("Rut")-1)}, /* */
411 411
 		PVT_OTHER, pv_get_rcvaddr_uri_full, 0,
412 412
 		0, 0, 0, 0},
413
+	{{"Rn", (sizeof("Rn")-1)}, /* */
414
+		PVT_OTHER, pv_get_rcvsname, 0,
415
+		0, 0, 0, 0},
413 416
 	{{"RAi", (sizeof("RAi")-1)}, /* */
414 417
 		PVT_OTHER, pv_get_rcv_advertised_ip, 0,
415 418
 		0, 0, 0, 0},
Browse code

pv: exported xavp_slist_explode() to kemi

Daniel-Constantin Mierla authored on 14/10/2020 14:15:09
Showing 1 changed files
... ...
@@ -2739,6 +2739,11 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
2739 2739
 		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
2740 2740
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
2741 2741
 	},
2742
+	{ str_init("pvx"), str_init("xavp_slist_explode"),
2743
+		SR_KEMIP_INT, ki_xavp_slist_explode,
2744
+		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
2745
+			SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
2746
+	},
2742 2747
 	{ str_init("pvx"), str_init("xavp_seti"),
2743 2748
 		SR_KEMIP_INT, ki_xavp_seti,
2744 2749
 		{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,
Browse code

pv: new function xavp_slist_explode("slist", "sep", "mode", "xname")

- break a string in tokens by separators, storing them in xavp

Daniel-Constantin Mierla authored on 14/10/2020 13:45:08
Showing 1 changed files
... ...
@@ -559,6 +559,8 @@ static int w_xavp_copy_dst(sip_msg_t *msg, char *src_name, char *src_idx,
559 559
 		char *dst_name, char *dst_idx);
560 560
 static int w_xavp_params_explode(sip_msg_t *msg, char *pparams, char *pxname);
561 561
 static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname);
562
+static int w_xavp_slist_explode(sip_msg_t *msg, char *pslist, char *psep,
563
+		char *pmode, char *pxname);
562 564
 static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
563 565
 		char *pval);
564 566
 static int w_xavp_child_sets(sip_msg_t *msg, char *prname, char *pcname,
... ...
@@ -611,6 +613,9 @@ static cmd_export_t cmds[]={
611 613
 	{"not_empty", (cmd_function)pv_not_empty, 1, fixup_pvar_null,
612 614
 		fixup_free_pvar_null,
613 615
 		ANY_ROUTE},
616
+	{"xavp_slist_explode", (cmd_function)w_xavp_slist_explode,
617
+		4, fixup_spve_all, fixup_free_spve_all,
618
+		ANY_ROUTE},
614 619
 	{"xavp_params_explode", (cmd_function)w_xavp_params_explode,
615 620
 		2, fixup_spve_spve, fixup_free_spve_spve,
616 621
 		ANY_ROUTE},
... ...
@@ -1111,6 +1116,53 @@ static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname)
1111 1116
 	return ki_xavp_params_implode(msg, &sxname, (str*)pvname);
1112 1117
 }
1113 1118
 
1119
+/**
1120
+ *
1121
+ */
1122
+static int w_xavp_slist_explode(sip_msg_t *msg, char *pslist, char *psep,
1123
+		char *pmode, char *pxname)
1124
+{
1125
+	str slist;
1126
+	str sep;
1127
+	str smode;
1128
+	str sxname;
1129
+
1130
+	if(fixup_get_svalue(msg, (gparam_t*)pslist, &slist)!=0) {
1131
+		LM_ERR("cannot get the params\n");
1132
+		return -1;
1133
+	}
1134
+	if(fixup_get_svalue(msg, (gparam_t*)psep, &sep)!=0) {
1135
+		LM_ERR("cannot get the params\n");
1136
+		return -1;
1137
+	}
1138
+	if(fixup_get_svalue(msg, (gparam_t*)pmode, &smode)!=0) {
1139
+		LM_ERR("cannot get the params\n");
1140
+		return -1;
1141
+	}
1142
+	if(fixup_get_svalue(msg, (gparam_t*)pxname, &sxname)!=0) {
1143
+		LM_ERR("cannot get the xavp name\n");
1144
+		return -1;
1145
+	}
1146
+
1147
+	if(xavp_slist_explode(&slist, &sep, &smode, &sxname)<0)
1148
+		return -1;
1149
+
1150
+	return 1;
1151
+}
1152
+
1153
+/**
1154
+ *
1155
+ */
1156
+static int ki_xavp_slist_explode(sip_msg_t *msg, str *slist, str *sep, str *mode,
1157
+		str *sxname)
1158
+{
1159
+	if(xavp_slist_explode(slist, sep, mode, sxname)<0)
1160
+		return -1;
1161
+
1162
+	return 1;
1163
+}
1164
+
1165
+
1114 1166
 /**
1115 1167
  *
1116 1168
  */
Browse code

pv: use the corresponding functions for parsing names of xavu and xavi

Daniel-Constantin Mierla authored on 29/09/2020 05:25:46
Showing 1 changed files
... ...
@@ -96,10 +96,10 @@ static pv_export_t mod_pvs[] = {
96 96
 		pv_parse_xavp_name, 0, 0, 0 },
97 97
 	{ {"xavu", sizeof("xavu")-1}, /* xavu */
98 98
 		PVT_XAVU, pv_get_xavu, pv_set_xavu,
99
-		pv_parse_xavp_name, 0, 0, 0 },
99
+		pv_parse_xavu_name, 0, 0, 0 },
100 100
 	{ {"xavi", sizeof("xavi")-1}, /* xavi */
101 101
 		PVT_XAVI, pv_get_xavi, pv_set_xavi,
102
-		pv_parse_xavp_name, 0, 0, 0 },
102
+		pv_parse_xavi_name, 0, 0, 0 },
103 103
 	{{"avp", (sizeof("avp")-1)}, PVT_AVP, pv_get_avp, pv_set_avp,
104 104
 		pv_parse_avp_name, pv_parse_index, 0, 0},
105 105
 	{{"hdr", (sizeof("hdr")-1)}, PVT_HDR, pv_get_hdr, 0, pv_parse_hdr_name,
... ...
@@ -1221,7 +1221,7 @@ static int w_xav_child_seti(sip_msg_t *msg, char *prname, char *pcname,
1221 1221
 		return -1;
1222 1222
 	}
1223 1223
 
1224
- 	return ki_xav_child_seti(msg, &rname, &cname, ival, _case);
1224
+	return ki_xav_child_seti(msg, &rname, &cname, ival, _case);
1225 1225
 }
1226 1226
 
1227 1227
 static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
Browse code

pv: vars to get the length for o-uri/r-uri/f-uri/t-uri username

- $oUl, $rUl, $fUl. $tUl
- the length is already available in the str value, optimizing a bit by
no longer having to use {s.len}

Daniel-Constantin Mierla authored on 05/06/2020 07:37:53
Showing 1 changed files
... ...
@@ -272,6 +272,9 @@ static pv_export_t mod_pvs[] = {
272 272
 	{{"from.user", (sizeof("from.user")-1)}, /* */
273 273
 		PVT_OTHER, pv_get_from_attr, pv_set_from_username,
274 274
 		0, 0, pv_init_iname, 2},
275
+	{{"fUl", (sizeof("fUl")-1)}, /* */
276
+		PVT_OTHER, pv_get_from_attr, 0,
277
+		0, 0, pv_init_iname, 6},
275 278
 	{{"mb", (sizeof("mb")-1)}, /* */
276 279
 		PVT_OTHER, pv_get_msg_buf, 0,
277 280
 		0, 0, 0, 0},
... ...
@@ -314,6 +317,9 @@ static pv_export_t mod_pvs[] = {
314 317
 	{{"oU", (sizeof("oU")-1)}, /* */
315 318
 		PVT_OTHER, pv_get_ouri_attr, 0,
316 319
 		0, 0, pv_init_iname, 1},
320
+	{{"oUl", (sizeof("oUl")-1)}, /* */
321
+		PVT_OTHER, pv_get_ouri_attr, 0,
322
+		0, 0, pv_init_iname, 6},
317 323
 	{{"pd", (sizeof("pd")-1)}, /* */
318 324
 		PVT_OTHER, pv_get_ppi_attr, 0,
319 325
 		0, pv_parse_index, pv_init_iname, 3},
... ...
@@ -383,6 +389,9 @@ static pv_export_t mod_pvs[] = {
383 389
 	{{"ruri.user", (sizeof("ruri.user")-1)}, /* */
384 390
 		PVT_RURI_USERNAME, pv_get_ruri_attr, pv_set_ruri_user,
385 391
 		0, 0, pv_init_iname, 1},
392
+	{{"rUl", (sizeof("rUl")-1)}, /* */
393
+		PVT_RURI_USERNAME, pv_get_ruri_attr, 0,
394
+		0, 0, pv_init_iname, 6},
386 395
 	{{"rv", (sizeof("rv")-1)}, /* */
387 396
 		PVT_OTHER, pv_get_version, 0,
388 397
 		0, 0, 0, 0},
... ...
@@ -470,6 +479,9 @@ static pv_export_t mod_pvs[] = {
470 479
 	{{"to.user", (sizeof("to.user")-1)}, /* */
471 480
 		PVT_OTHER, pv_get_to_attr, pv_set_to_username,
472 481
 		0, 0, pv_init_iname, 2},
482
+	{{"tUl", (sizeof("tUl")-1)}, /* */
483
+		PVT_OTHER, pv_get_to_attr, pv_set_to_username,
484
+		0, 0, pv_init_iname, 6},
473 485
 	{{"true", (sizeof("true")-1)}, /* */
474 486
 		PVT_OTHER, pv_get_true, 0,
475 487
 		0, 0, 0, 0},
Browse code

pv: new var $mts - return msg type as string

- rq - for request
- rp - for response

Daniel-Constantin Mierla authored on 31/05/2020 09:21:25
Showing 1 changed files
... ...
@@ -293,6 +293,9 @@ static pv_export_t mod_pvs[] = {
293 293
 	{{"mt", (sizeof("mt")-1)}, /* */
294 294
 		PVT_OTHER, pv_get_msgtype, 0,
295 295
 		0, 0, 0, 0},
296
+	{{"mts", (sizeof("mts")-1)}, /* */
297
+		PVT_OTHER, pv_get_msgtypes, 0,
298
+		0, 0, 0, 0},
296 299
 	{{"od", (sizeof("od")-1)}, /* */
297 300
 		PVT_OTHER, pv_get_ouri_attr, 0,
298 301
 		0, 0, pv_init_iname, 2},
Browse code

pv: removed commented code for retcode var - exported from core

Daniel-Constantin Mierla authored on 31/05/2020 07:29:39
Showing 1 changed files
... ...
@@ -338,12 +338,6 @@ static pv_export_t mod_pvs[] = {
338 338
 	{{"rb", (sizeof("rb")-1)}, /* */
339 339
 		PVT_MSG_BODY, pv_get_msg_body, 0,
340 340
 		0, 0, 0, 0},
341
-	/* {{"rc", (sizeof("rc")-1)},
342
-		PVT_OTHER, pv_get_return_code, 0,
343
-		0, 0, 0, 0},
344
-	{{"retcode", (sizeof("retcode")-1)},
345
-		PVT_OTHER, pv_get_return_code, 0,
346
-		0, 0, 0, 0}, */
347 341
 	{{"rd", (sizeof("rd")-1)}, /* */
348 342
 		PVT_RURI_DOMAIN, pv_get_ruri_attr, pv_set_ruri_host,
349 343
 		0, 0, pv_init_iname, 2},
Browse code

pv: $xavi(...) config variables implementation

same as $xavp but case insensitive for keys

Victor Seva authored on 26/05/2020 10:05:40
Showing 1 changed files
... ...
@@ -31,6 +31,7 @@
31 31
 #include "../../core/kemi.h"
32 32
 #include "../../core/rpc.h"
33 33
 #include "../../core/rpc_lookup.h"
34
+#include "../../core/strutils.h"
34 35
 
35 36
 
36 37
 #include "pv_branch.h"
... ...
@@ -96,6 +97,9 @@ static pv_export_t mod_pvs[] = {
96 97
 	{ {"xavu", sizeof("xavu")-1}, /* xavu */
97 98
 		PVT_XAVU, pv_get_xavu, pv_set_xavu,
98 99
 		pv_parse_xavp_name, 0, 0, 0 },
100
+	{ {"xavi", sizeof("xavi")-1}, /* xavi */
101
+		PVT_XAVI, pv_get_xavi, pv_set_xavi,
102
+		pv_parse_xavp_name, 0, 0, 0 },
99 103
 	{{"avp", (sizeof("avp")-1)}, PVT_AVP, pv_get_avp, pv_set_avp,
100 104
 		pv_parse_avp_name, pv_parse_index, 0, 0},
101 105
 	{{"hdr", (sizeof("hdr")-1)}, PVT_HDR, pv_get_hdr, 0, pv_parse_hdr_name,
... ...
@@ -558,6 +562,13 @@ static int w_sbranch_reset(sip_msg_t *msg, char p1, char *p2);
558 562
 static int w_var_to_xavp(sip_msg_t *msg, char *p1, char *p2);
559 563
 static int w_xavp_to_var(sip_msg_t *msg, char *p1);
560 564
 
565
+static int w_xavi_child_seti(sip_msg_t *msg, char *prname, char *pcname,
566
+		char *pval);
567
+static int w_xavi_child_sets(sip_msg_t *msg, char *prname, char *pcname,
568
+		char *pval);
569
+static int w_xavi_rm(sip_msg_t *msg, char *prname, char *p2);
570
+static int w_xavi_child_rm(sip_msg_t *msg, char *prname, char *pcname);
571
+
561 572
 int pv_xavp_copy_fixup(void** param, int param_no);
562 573
 int pv_evalx_fixup(void** param, int param_no);
563 574
 int w_pv_evalx(struct sip_msg *msg, char *dst, str *fmt);
... ...
@@ -577,6 +588,8 @@ static cmd_export_t cmds[]={
577 588
 		ANY_ROUTE },
578 589
 	{"pv_xavu_print",  (cmd_function)pv_xavu_print,  0, 0, 0,
579 590
 		ANY_ROUTE },
591
+	{"pv_xavi_print",  (cmd_function)pv_xavi_print,  0, 0, 0,
592
+		ANY_ROUTE },
580 593
 	{"pv_var_to_xavp",  (cmd_function)w_var_to_xavp, 2, fixup_spve_spve,
581 594
 		fixup_free_spve_spve, ANY_ROUTE },
582 595
 	{"pv_xavp_to_var",  (cmd_function)w_xavp_to_var, 1, fixup_spve_null,
... ...
@@ -611,6 +624,18 @@ static cmd_export_t cmds[]={
611 624
 	{"xavp_child_rm", (cmd_function)w_xavp_child_rm,
612 625
 		2, fixup_spve_spve, fixup_free_spve_spve,
613 626
 		ANY_ROUTE},
627
+	{"xavi_child_seti", (cmd_function)w_xavi_child_seti,
628
+		3, fixup_xavp_child_seti, fixup_free_xavp_child_seti,
629
+		ANY_ROUTE},
630
+	{"xavi_child_sets", (cmd_function)w_xavi_child_sets,
631
+		3, fixup_spve_all, fixup_free_spve_all,
632
+		ANY_ROUTE},
633
+	{"xavi_rm", (cmd_function)w_xavi_rm,
634
+		1, fixup_spve_null, fixup_free_spve_null,
635
+		ANY_ROUTE},
636
+	{"xavi_child_rm", (cmd_function)w_xavi_child_rm,
637
+		2, fixup_spve_spve, fixup_free_spve_spve,
638
+		ANY_ROUTE},
614 639
 	{"sbranch_set_ruri",  (cmd_function)w_sbranch_set_ruri,  0, 0, 0,
615 640
 		ANY_ROUTE },
616 641
 	{"sbranch_append",    (cmd_function)w_sbranch_append,    0, 0, 0,
... ...
@@ -833,6 +858,12 @@ static int ki_xavu_print(sip_msg_t* msg)
833 858
 	return 1;
834 859
 }
835 860
 
861
+static int ki_xavi_print(sip_msg_t* msg)
862
+{
863
+	xavi_print_list(NULL);
864
+	return 1;
865
+}
866
+
836 867
 /**
837 868
  *
838 869
  */
... ...
@@ -1074,7 +1105,7 @@ static int w_xavp_params_implode(sip_msg_t *msg, char *pxname, char *pvname)
1074 1105
 /**
1075 1106
  *
1076 1107
  */
1077
-static int ki_xavp_seti(sip_msg_t *msg, str *rname, int ival)
1108
+static int ki_xav_seti(sip_msg_t *msg, str *rname, int ival, int _case)
1078 1109
 {
1079 1110
 	sr_xavp_t *xavp = NULL;
1080 1111
 	sr_xval_t xval;
... ...
@@ -1083,15 +1114,28 @@ static int ki_xavp_seti(sip_msg_t *msg, str *rname, int ival)
1083 1114
 	xval.type = SR_XTYPE_INT;
1084 1115
 	xval.v.i = ival;
1085 1116
 
1086
-	xavp = xavp_add_value(rname, &xval, NULL);
1087
-
1117
+	if(_case) {
1118
+		xavp = xavi_add_value(rname, &xval, NULL);
1119
+	} else {
1120
+		xavp = xavp_add_value(rname, &xval, NULL);
1121
+	}
1088 1122
 	return (xavp!=NULL)?1:-1;
1089 1123
 }
1090 1124
 
1125
+static int ki_xavp_seti(sip_msg_t *msg, str *rname, int ival)
1126
+{
1127
+	return ki_xav_seti(msg, rname, ival, 0);
1128
+}
1129
+
1130
+static int ki_xavi_seti(sip_msg_t *msg, str *rname, int ival)
1131
+{
1132
+	return ki_xav_seti(msg, rname, ival, 1);
1133
+}
1134
+
1091 1135
 /**
1092 1136
  *
1093 1137
  */
1094
-static int ki_xavp_sets(sip_msg_t *msg, str *rname, str *sval)
1138
+static int ki_xav_sets(sip_msg_t *msg, str *rname, str *sval, int _case)
1095 1139
 {
1096 1140
 	sr_xavp_t *xavp = NULL;
1097 1141
 	sr_xval_t xval;
... ...
@@ -1100,29 +1144,56 @@ static int ki_xavp_sets(sip_msg_t *msg, str *rname, str *sval)
1100 1144
 	xval.type = SR_XTYPE_STR;
1101 1145
 	xval.v.s = *sval;
1102 1146
 
1103
-	xavp = xavp_add_value(rname, &xval, NULL);
1104
-
1147
+	if(_case) {
1148
+		xavp = xavi_add_value(rname, &xval, NULL);
1149
+	} else {
1150
+		xavp = xavp_add_value(rname, &xval, NULL);
1151
+	}
1105 1152
 	return (xavp!=NULL)?1:-1;
1106 1153
 }
1107 1154
 
1155
+static int ki_xavp_sets(sip_msg_t *msg, str *rname, str *sval)
1156
+{
1157
+	return ki_xav_sets(msg, rname, sval, 0);
1158
+}
1159
+
1160
+static int ki_xavi_sets(sip_msg_t *msg, str *rname, str *sval)
1161
+{
1162
+	return ki_xav_sets(msg, rname, sval, 1);
1163
+}
1164
+
1108 1165
 /**
1109 1166
  *
1110 1167
  */
1111
-static int ki_xavp_child_seti(sip_msg_t *msg, str *rname, str *cname,
1112
-		int ival)
1168
+static int ki_xav_child_seti(sip_msg_t *msg, str *rname, str *cname,
1169
+		int ival, int _case)
1113 1170
 {
1114 1171
 	int ret;
1172
+	if(_case) {
1173
+		ret = xavi_set_child_ival(rname, cname, ival);
1174
+	} else {
1175
+		ret = xavp_set_child_ival(rname, cname, ival);
1176
+	}
1177
+	return (ret<0)?ret:1;
1178
+}
1115 1179
 
1116
-	ret = xavp_set_child_ival(rname, cname, ival);
1180
+static int ki_xavp_child_seti(sip_msg_t *msg, str *rname, str *cname,
1181
+		int ival)
1182
+{
1183
+	return ki_xav_child_seti(msg, rname, cname, ival, 0);
1184
+}
1117 1185
 
1118
-	return (ret<0)?ret:1;
1186
+static int ki_xavi_child_seti(sip_msg_t *msg, str *rname, str *cname,
1187
+		int ival)
1188
+{
1189
+	return ki_xav_child_seti(msg, rname, cname, ival, 1);
1119 1190
 }
1120 1191
 
1121 1192
 /**
1122 1193
  *
1123 1194
  */
1124
-static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
1125
-		char *pval)
1195
+static int w_xav_child_seti(sip_msg_t *msg, char *prname, char *pcname,
1196
+		char *pval, int _case)
1126 1197
 {
1127 1198
 	str rname = STR_NULL;
1128 1199
 	str cname = STR_NULL;
... ...
@@ -1141,27 +1212,53 @@ static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
1141 1212
 		return -1;
1142 1213
 	}
1143 1214
 
1144
-	return ki_xavp_child_seti(msg, &rname, &cname, ival);
1215
+ 	return ki_xav_child_seti(msg, &rname, &cname, ival, _case);
1216
+}
1217
+
1218
+static int w_xavp_child_seti(sip_msg_t *msg, char *prname, char *pcname,
1219
+		char *pval)
1220
+{
1221
+	return w_xav_child_seti(msg, prname, pcname, pval, 0);
1222
+}
1223
+
1224
+static int w_xavi_child_seti(sip_msg_t *msg, char *prname, char *pcname,
1225
+		char *pval)
1226
+{
1227
+	return w_xav_child_seti(msg, prname, pcname, pval, 1);
1145 1228
 }
1146 1229
 
1147 1230
 /**
1148 1231
  *
1149 1232
  */
1150
-static int ki_xavp_child_sets(sip_msg_t *msg, str *rname, str *cname,
1151
-		str *sval)
1233
+static int ki_xav_child_sets(sip_msg_t *msg, str *rname, str *cname,
1234
+		str *sval, int _case)
1152 1235
 {
1153 1236
 	int ret;
1237
+	if(_case) {
1238
+		ret = xavi_set_child_sval(rname, cname, sval);
1239
+	} else {
1240
+		ret = xavp_set_child_sval(rname, cname, sval);
1241
+	}
1242
+	return (ret<0)?ret:1;
1243
+}
1154 1244
 
1155
-	ret = xavp_set_child_sval(rname, cname, sval);
1245
+static int ki_xavp_child_sets(sip_msg_t *msg, str *rname, str *cname,
1246
+		str *sval)
1247
+{
1248
+	return ki_xav_child_sets(msg, rname, cname, sval, 0);
1249
+}
1156 1250
 
1157
-	return (ret<0)?ret:1;
1251
+static int ki_xavi_child_sets(sip_msg_t *msg, str *rname, str *cname,
1252
+		str *sval)
1253
+{
1254
+	return ki_xav_child_sets(msg, rname, cname, sval, 1);
1158 1255
 }
1159 1256
 
1160 1257
 /**
1161 1258
  *
1162 1259
  */
1163
-static int w_xavp_child_sets(sip_msg_t *msg, char *prname, char *pcname,
1164
-		char *pval)
1260
+static int w_xav_child_sets(sip_msg_t *msg, char *prname, char *pcname,
1261
+		char *pval, int _case)
1165 1262
 {
1166 1263
 	str rname;
1167 1264
 	str cname;
... ...
@@ -1180,7 +1277,17 @@ static int w_xavp_child_sets(sip_msg_t *msg, char *prname, char *pcname,
1180 1277
 		return -1;
1181 1278
 	}
1182 1279
 
1183
-	return ki_xavp_child_sets(msg, &rname, &cname, &sval);
1280
+	return ki_xav_child_sets(msg, &rname, &cname, &sval, _case);
1281
+}
1282
+
1283
+static int w_xavp_child_sets(sip_msg_t *msg, char *prname, char *pcname,
1284
+		char *pval) {
1285
+	return w_xav_child_sets(msg, prname, pcname, pval, 0);
1286
+}
1287
+
1288
+static int w_xavi_child_sets(sip_msg_t *msg, char *prname, char *pcname,
1289
+		char *pval) {
1290
+	return w_xav_child_sets(msg, prname, pcname, pval, 1);
1184 1291
 }
1185 1292
 
1186 1293
 /**
... ...
@@ -1211,19 +1318,32 @@ static int fixup_free_xavp_child_seti(void** param, int param_no)
1211 1318
 /**
1212 1319
  *
1213 1320
  */
1214
-static int ki_xavp_rm(sip_msg_t *msg, str *rname)
1321
+static int ki_xav_rm(sip_msg_t *msg, str *rname, int _case)
1215 1322
 {
1216 1323
 	int ret;
1217
-
1218
-	ret = xavp_rm_by_index(rname, 0, NULL);
1324
+	if(_case) {
1325
+		ret = xavi_rm_by_index(rname, 0, NULL);
1326
+	} else {
1327
+		ret = xavp_rm_by_index(rname, 0, NULL);
1328
+	}
1219 1329
 
1220 1330
 	return (ret==0)?1:ret;
1221 1331
 }
1222 1332
 
1333
+static int ki_xavp_rm(sip_msg_t *msg, str *rname)
1334
+{
1335
+	return ki_xav_rm(msg, rname, 0);
1336
+}
1337
+
1338
+static int ki_xavi_rm(sip_msg_t *msg, str *rname)
1339
+{
1340
+	return ki_xav_rm(msg, rname, 1);
1341
+}
1342
+
1223 1343
 /**
1224 1344
  *
1225 1345
  */
1226
-static int w_xavp_rm(sip_msg_t *msg, char *prname, char *p2)
1346
+static int w_xav_rm(sip_msg_t *msg, char *prname, char *p2, int _case)
1227 1347
 {
1228 1348
 	str rname;
1229 1349
 
... ...
@@ -1232,25 +1352,45 @@ static int w_xavp_rm(sip_msg_t *msg, char *prname, char *p2)
1232 1352
 		return -1;
1233 1353
 	}
1234 1354
 
1235
-	return ki_xavp_rm(msg, &rname);
1355
+	return ki_xav_rm(msg, &rname, _case);
1356
+}
1357
+
1358
+static int w_xavp_rm(sip_msg_t *msg, char *prname, char *p2) {
1359
+	return w_xav_rm(msg, prname, p2, 0);
1360
+}
1361
+
1362
+static int w_xavi_rm(sip_msg_t *msg, char *prname, char *p2) {
1363
+	return w_xav_rm(msg, prname, p2, 1);
1236 1364
 }
1237 1365
 
1238 1366
 /**
1239 1367
  *
1240 1368
  */
1241
-static int ki_xavp_child_rm(sip_msg_t *msg, str *rname, str *cname)
1369
+static int ki_xav_child_rm(sip_msg_t *msg, str *rname, str *cname, int _case)
1242 1370
 {
1243 1371
 	int ret;
1372
+	if(_case) {
1373
+		ret = xavi_rm_child_by_index(rname, cname, 0);
1374
+	} else {
1375
+		ret = xavp_rm_child_by_index(rname, cname, 0);
1376
+	}
1377
+	return (ret==0)?1:ret;
1378
+}
1244 1379
 
1245
-	ret = xavp_rm_child_by_index(rname, cname, 0);
1380
+static int ki_xavp_child_rm(sip_msg_t *msg, str *rname, str *cname)
1381
+{
1382
+	return ki_xav_child_rm(msg, rname, cname, 0);
1383
+}
1246 1384
 
1247
-	return (ret==0)?1:ret;
1385
+static int ki_xavi_child_rm(sip_msg_t *msg, str *rname, str *cname)
1386
+{
1387
+	return ki_xav_child_rm(msg, rname, cname, 1);
1248 1388
 }
1249 1389
 
1250 1390
 /**
1251 1391
  *
1252 1392
  */
1253
-static int w_xavp_child_rm(sip_msg_t *msg, char *prname, char *pcname)
1393
+static int w_xav_child_rm(sip_msg_t *msg, char *prname, char *pcname, int _case)
1254 1394
 {
1255 1395
 	str rname;
1256 1396
 	str cname;
... ...
@@ -1264,17 +1404,28 @@ static int w_xavp_child_rm(sip_msg_t *msg, char *prname, char *pcname)
1264 1404
 		return -1;
1265 1405
 	}
1266 1406
 
1267
-	return ki_xavp_child_rm(msg, &rname, &cname);
1407
+	return ki_xav_child_rm(msg, &rname, &cname, _case);
1408
+}
1409
+
1410
+static int w_xavp_child_rm(sip_msg_t *msg, char *prname, char *pcname) {
1411
+	return w_xav_child_rm(msg, prname, pcname, 0);
1412
+}
1413
+
1414
+static int w_xavi_child_rm(sip_msg_t *msg, char *prname, char *pcname) {
1415
+	return w_xav_child_rm(msg, prname, pcname, 1);
1268 1416
 }
1269 1417
 
1270 1418
 /**
1271 1419
  *
1272 1420
  */
1273
-static int ki_xavp_is_null(sip_msg_t *msg, str *rname)
1421
+static int ki_xav_is_null(sip_msg_t *msg, str *rname, int _case)
1274 1422
 {
1275 1423
 	sr_xavp_t *xavp=NULL;
1276
-
1277
-	xavp = xavp_get_by_index(rname, 0, NULL);
1424
+	if(_case) {
1425
+		xavp = xavi_get_by_index(rname, 0, NULL);
1426
+	} else {
1427
+		xavp = xavp_get_by_index(rname, 0, NULL);
1428
+	}
1278 1429
 	if(xavp==NULL) {
1279 1430
 		return 1;
1280 1431
 	}
... ...
@@ -1284,6 +1435,13 @@ static int ki_xavp_is_null(sip_msg_t *msg, str *rname)
1284 1435
 	return -1;
1285 1436
 }
1286 1437
 
1438
+static int ki_xavp_is_null(sip_msg_t *msg, str *rname) {
1439
+	return ki_xav_is_null(msg, rname, 0);
1440
+}
1441
+
1442
+static int ki_xavi_is_null(sip_msg_t *msg, str *rname) {
1443
+	return ki_xav_is_null(msg, rname, 1);
1444
+}
1287 1445
 /**
1288 1446
  *
1289 1447
  */
... ...
@@ -1355,13 +1513,17 @@ static sr_kemi_xval_t* ki_xavp_get_xval(sr_xavp_t *xavp, int rmode)
1355 1513
 /**
1356