[asterisk-commits] rmudgett: trunk r427137 - in /trunk: ./ configs/samples/ res/ res/res_pjsip/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 3 12:23:09 CST 2014


Author: rmudgett
Date: Mon Nov  3 12:22:59 2014
New Revision: 427137

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=427137
Log:
res_pjsip: Add disable_tcp_switch option.

When a packet exceeds the MTU, pjproject will switch from UDP to TCP.  In
some circumstances (on some networks), this can cause some issues with
messages not getting sent to the correct destination - and can also cause
connections to get dropped due to quirks in pjproject deciding to
terminate TCP connections with no messages.

While fixing the routing/messaging issues is important, having a
configuration option in Asterisk that tells pjproject to not switch over
to TCP would be useful.  That way, if some glitch is discovered on some
other network/site, we can at least disable the behavior until a fix is
put into place.

AFS-197 #close

Review: https://reviewboard.asterisk.org/r/4137/
........

Merged revisions 427129 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 427130 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/CHANGES
    trunk/configs/samples/pjsip.conf.sample
    trunk/res/res_pjsip.c
    trunk/res/res_pjsip/config_system.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=427137&r1=427136&r2=427137
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Nov  3 12:22:59 2014
@@ -27,6 +27,9 @@
    to the request URI and From URI if the user is determined to be a phone number.
  * New 'moh_passthrough' endpoint setting. This will pass hold and unhold requests
    through using SIP re-invites with sendonly and sendrecv accordingly.
+ * Added the pjsip.conf system type disable_tcp_switch option.  The option
+   allows the user to disable switching from UDP to TCP transports described
+   by RFC 3261 section 18.1.1.
 
 Functions
 ------------------

Modified: trunk/configs/samples/pjsip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/samples/pjsip.conf.sample?view=diff&rev=427137&r1=427136&r2=427137
==============================================================================
--- trunk/configs/samples/pjsip.conf.sample (original)
+++ trunk/configs/samples/pjsip.conf.sample Mon Nov  3 12:22:59 2014
@@ -830,6 +830,10 @@
                                 ; should be disposed of (default: "60")
 ;threadpool_max_size=0  ; Maximum number of threads in the res_pjsip threadpool
                         ; A value of 0 indicates no maximum (default: "0")
+;disable_tcp_switch=no  ; Disable automatic switching from UDP to TCP transports
+                        ; if outgoing request is too large.
+                        ; See RFC 3261 section 18.1.1.
+                        ; (default: "no")
 ;type=  ; Must be of type system (default: "")
 
 ;==========================GLOBAL SECTION OPTIONS=========================

Modified: trunk/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip.c?view=diff&rev=427137&r1=427136&r2=427137
==============================================================================
--- trunk/res/res_pjsip.c (original)
+++ trunk/res/res_pjsip.c Mon Nov  3 12:22:59 2014
@@ -1142,6 +1142,13 @@
 				<configOption name="threadpool_max_size" default="0">
 					<synopsis>Maximum number of threads in the res_pjsip threadpool.
 					A value of 0 indicates no maximum.</synopsis>
+				</configOption>
+				<configOption name="disable_tcp_switch" default="no">
+					<synopsis>Disable automatic switching from UDP to TCP transports.</synopsis>
+					<description><para>
+						Disable automatic switching from UDP to TCP transports if outgoing
+						request is too large.  See RFC 3261 section 18.1.1.
+					</para></description>
 				</configOption>
 				<configOption name="type">
 					<synopsis>Must be of type 'system'.</synopsis>

Modified: trunk/res/res_pjsip/config_system.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/config_system.c?view=diff&rev=427137&r1=427136&r2=427137
==============================================================================
--- trunk/res/res_pjsip/config_system.c (original)
+++ trunk/res/res_pjsip/config_system.c Mon Nov  3 12:22:59 2014
@@ -49,6 +49,8 @@
 		/*! Maxumum number of threads in the threadpool */
 		int max_size;
 	} threadpool;
+	/*! Nonzero to disable switching from UDP to TCP transport */
+	unsigned int disable_tcp_switch;
 };
 
 static struct ast_threadpool_options sip_threadpool_options = {
@@ -95,6 +97,7 @@
 
 	if (system->compactheaders) {
 		extern pj_bool_t pjsip_use_compact_form;
+
 		pjsip_use_compact_form = PJ_TRUE;
 	}
 
@@ -102,6 +105,9 @@
 	sip_threadpool_options.auto_increment = system->threadpool.auto_increment;
 	sip_threadpool_options.idle_timeout = system->threadpool.idle_timeout;
 	sip_threadpool_options.max_size = system->threadpool.max_size;
+
+	pjsip_cfg()->endpt.disable_tcp_switch =
+		system->disable_tcp_switch ? PJ_TRUE : PJ_FALSE;
 
 	return 0;
 }
@@ -141,6 +147,8 @@
 			OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.idle_timeout));
 	ast_sorcery_object_field_register(system_sorcery, "system", "threadpool_max_size", "0",
 			OPT_UINT_T, 0, FLDSET(struct system_config, threadpool.max_size));
+	ast_sorcery_object_field_register(system_sorcery, "system", "disable_tcp_switch", "no",
+			OPT_BOOL_T, 1, FLDSET(struct system_config, disable_tcp_switch));
 
 	ast_sorcery_load(system_sorcery);
 




More information about the asterisk-commits mailing list