Module: kamailio
Branch: master
Commit: 31d92814679fdeca96d7f90bb85938eb9894a4e4
URL:
https://github.com/kamailio/kamailio/commit/31d92814679fdeca96d7f90bb85938e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-04-02T14:17:36+02:00
path: new param sockname_mode
- if set to 1, socket name is added to Path URI in 'sn' param
---
Modified: src/modules/path/path.c
Modified: src/modules/path/path_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/31d92814679fdeca96d7f90bb85938e…
Patch:
https://github.com/kamailio/kamailio/commit/31d92814679fdeca96d7f90bb85938e…
---
diff --git a/src/modules/path/path.c b/src/modules/path/path.c
index f95d68ab70..55cd859c90 100644
--- a/src/modules/path/path.c
+++ b/src/modules/path/path.c
@@ -56,6 +56,8 @@ const static char *proto_strings[] = {
[PROTO_WSS] = "%3Btransport%3Dws",
};
+extern int path_sockname_mode;
+
static char *path_strzdup(char *src, int len)
{
char *res;
@@ -187,7 +189,8 @@ static int prepend_path(sip_msg_t* _m, str *user, path_param_t param,
l = insert_new_lump_before(l, prefix, prefix_len, 0);
if (!l) goto out3;
- l = insert_subst_lump_before(l, SUBST_SND_ALL, 0);
+ l = insert_subst_lump_before(l,
+ (path_sockname_mode)?SUBST_SND_ALL_EX:SUBST_SND_ALL, 0);
if (!l) goto out2;
l = insert_new_lump_before(l, suffix, cp - suffix, 0);
if (!l) goto out2;
@@ -197,7 +200,8 @@ static int prepend_path(sip_msg_t* _m, str *user, path_param_t param,
if(dp==NULL) goto out1;
l = insert_new_lump_before(l, dp, prefix_len, 0);
if (!l) goto out1;
- l = insert_subst_lump_before(l, SUBST_RCV_ALL, 0);
+ l = insert_subst_lump_before(l,
+ (path_sockname_mode)?SUBST_RCV_ALL_EX:SUBST_RCV_ALL, 0);
if (!l) goto out1;
dp = path_strzdup(suffix, cp - suffix);
if(dp==NULL) goto out1;
diff --git a/src/modules/path/path_mod.c b/src/modules/path/path_mod.c
index 21f1a256df..cc27d1a457 100644
--- a/src/modules/path/path_mod.c
+++ b/src/modules/path/path_mod.c
@@ -68,6 +68,7 @@ int path_use_received = 0;
int path_received_format = 0;
int path_enable_r2 = 0;
+int path_sockname_mode = 0;
/*! \brief
* Module initialization function prototype
@@ -111,6 +112,7 @@ static param_export_t params[] = {
{"use_received", INT_PARAM, &path_use_received },
{"received_format", INT_PARAM, &path_received_format },
{"enable_r2", INT_PARAM, &path_enable_r2 },
+ {"sockname_mode", INT_PARAM, &path_sockname_mode },
{ 0, 0, 0 }
};