[Asterisk-code-review] res_pjsip.c: Added disable_rport option for pjsip.conf (asterisk[master])

sungtae kim asteriskteam at digium.com
Tue Jun 23 18:33:46 CDT 2020


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14572 )


Change subject: res_pjsip.c: Added disable_rport option for pjsip.conf
......................................................................

res_pjsip.c: Added disable_rport option for pjsip.conf

Currently when the pjsip making an outgoing request, it keep adding the
rport parameter in a request message as a default.

This causes unexpected rport handle at the other end.

Added option for disable this behaviour in the pjsip.conf.

ASTERISK-28959

Change-Id: I9596675e52a742774738b5aad5d1fec32f477abc
---
M configs/samples/pjsip.conf.sample
M res/res_pjsip.c
M res/res_pjsip/config_system.c
3 files changed, 13 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/72/14572/1

diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample
index 93fb701..a559dfa 100644
--- a/configs/samples/pjsip.conf.sample
+++ b/configs/samples/pjsip.conf.sample
@@ -1089,6 +1089,7 @@
                            ; This option must also be enabled on endpoints that
                            ; require this functionality.
                            ; (default: no)
+;disable_rport=no ; Disable the use of "rport" in outgoing requests.
 ;type=  ; Must be of type system (default: "")
 
 ;==========================GLOBAL SECTION OPTIONS=========================
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index a1b1e00..32907e3 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -1831,6 +1831,12 @@
 						</para></note>
 					</description>
 				</configOption>
+				<configOption name="disable_rport" default="no">
+					<synopsis>Disable the use of rport in outgoing requests.</synopsis>
+					<description><para>
+						Remove "rport" parameter from the outgoing requests.
+					</para></description>
+				</configOption>
 				<configOption name="type">
 					<synopsis>Must be of type 'system' UNLESS the object name is 'system'.</synopsis>
 				</configOption>
diff --git a/res/res_pjsip/config_system.c b/res/res_pjsip/config_system.c
index 716a6da..e16738f 100644
--- a/res/res_pjsip/config_system.c
+++ b/res/res_pjsip/config_system.c
@@ -59,6 +59,8 @@
 	 */
 	unsigned int follow_early_media_fork;
 	unsigned int accept_multiple_sdp_answers;
+	/*! Disable the use of rport in outgoing requests */
+	unsigned int disable_rport;
 };
 
 static struct ast_threadpool_options sip_threadpool_options = {
@@ -131,6 +133,8 @@
 	pjsip_cfg()->endpt.disable_tcp_switch =
 		system->disable_tcp_switch ? PJ_TRUE : PJ_FALSE;
 
+	pjsip_cfg()->endpt.disable_rport = system->disable_rport ? PJ_TRUE : PJ_FALSE;
+
 	return 0;
 }
 
@@ -209,6 +213,8 @@
 			OPT_BOOL_T, 1, FLDSET(struct system_config, follow_early_media_fork));
 	ast_sorcery_object_field_register(system_sorcery, "system", "accept_multiple_sdp_answers", "no",
 			OPT_BOOL_T, 1, FLDSET(struct system_config, accept_multiple_sdp_answers));
+	ast_sorcery_object_field_register(system_sorcery, "system", "disable_rport", "no",
+			OPT_BOOL_T, 1, FLDSET(struct system_config, disable_rport));
 
 	ast_sorcery_load(system_sorcery);
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14572
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I9596675e52a742774738b5aad5d1fec32f477abc
Gerrit-Change-Number: 14572
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200623/85c8171e/attachment.html>


More information about the asterisk-code-review mailing list