Selaa lähdekoodia

path: new param sockname_mode

- if set to 1, socket name is added to Path URI in 'sn' param
Daniel-Constantin Mierla 5 vuotta sitten
vanhempi
commit
31d9281467
2 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 6 2
      src/modules/path/path.c
  2. 2 0
      src/modules/path/path_mod.c

+ 6 - 2
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;

+ 2 - 0
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 }
 };