[sr-dev] git:master:d2120dae: nathelper: support to use variable for flags param of add_rcv_param()

Daniel-Constantin Mierla miconda at gmail.com
Sat Nov 18 16:27:29 CET 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-11-18T16:07:19+01:00

nathelper: support to use variable for flags param of add_rcv_param()

---

Modified: src/modules/nathelper/nathelper.c

---

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

---

diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
index b333d8d7ef..d34d807408 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -216,7 +216,7 @@ static cmd_export_t cmds[] = {
 		0, 0,
 		REQUEST_ROUTE },
 	{"add_rcv_param",      (cmd_function)add_rcv_param_f,        1,
-		fixup_uint_null, 0,
+		fixup_igp_null, 0,
 		REQUEST_ROUTE },
 	{"is_rfc1918",         (cmd_function)is_rfc1918_f,           1,
 		fixup_spve_null, 0,
@@ -2098,9 +2098,14 @@ static int add_rcv_param_f(struct sip_msg *msg, char *str1, char *str2)
 	struct lump *anchor;
 	char *param;
 	str uri;
-	int hdr_param;
+	int hdr_param = 0;
 
-	hdr_param = str1 ? 0 : 1;
+	if(str1) {
+		if(fixup_get_ivalue(msg, (gparam_t*))str1, &hdr_param)<0) {
+			LM_ERR("failed to get falgs parameter\n");
+			return -1;
+		}
+	}
 
 	if(create_rcv_uri(&uri, msg) < 0) {
 		return -1;




More information about the sr-dev mailing list