[sr-dev] git:master:e3cfb250: nathelper: added alias_name parameter

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 31 19:33:05 CET 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-01-31T19:28:09+01:00

nathelper: added alias_name parameter

- allows to set the name of the parmeter used for alias

---

Modified: src/modules/nathelper/nathelper.c

---

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

---

diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
index 3fdbc0332a..2d9e4ee6b7 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -201,6 +201,7 @@ static int nh_filter_srvid = 0;
 /*0-> disabled, 1 ->enabled*/
 unsigned int *natping_state = NULL;
 
+static str nh_alias_name = str_init("");
 
 /* clang-format off */
 static cmd_export_t cmds[] = {
@@ -275,6 +276,7 @@ static param_export_t params[] = {
 	{"append_sdp_oldmediaip", INT_PARAM, &sdp_oldmediaip        },
 	{"filter_server_id",      INT_PARAM, &nh_filter_srvid },
 	{"nat_addr_mode",         INT_PARAM, &nh_nat_addr_mode },
+	{"alias_name",            PARAM_STR, &nh_alias_name    },
 
 	{0, 0, 0}
 };
@@ -449,6 +451,12 @@ static int mod_init(void)
 		LM_ERR("failed to register RPC commands\n");
 		return -1;
 	}
+	if(nh_alias_name.s != NULL && nh_alias_name.len > 0) {
+		if(ksr_contact_alias_set_name(&nh_alias_name) < 0) {
+			LM_ERR("failed to set contact alias parameter name\n");
+			return -1;
+		}
+	}
 
 	if(rcv_avp_param && *rcv_avp_param) {
 		s.s = rcv_avp_param;




More information about the sr-dev mailing list