[Freeswitch-svn] [commit] r13249 - in freeswitch/trunk: conf/sip_profiles src/mod/endpoints/mod_sofia

FreeSWITCH SVN anthm at freeswitch.org
Thu May 7 08:07:04 PDT 2009


Author: anthm
Date: Thu May  7 10:07:04 2009
New Revision: 13249

Log:
add rtp-autoflush-during-bridge param

Modified:
   freeswitch/trunk/conf/sip_profiles/internal.xml
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Modified: freeswitch/trunk/conf/sip_profiles/internal.xml
==============================================================================
--- freeswitch/trunk/conf/sip_profiles/internal.xml	(original)
+++ freeswitch/trunk/conf/sip_profiles/internal.xml	Thu May  7 10:07:04 2009
@@ -92,6 +92,10 @@
     <param name="tls-cert-dir" value="$${internal_ssl_dir}"/>
     <!-- TLS version ("sslv23" (default), "tlsv1"). NOTE: Phones may not work with TLSv1 -->
     <param name="tls-version" value="$${sip_tls_version}"/>
+
+    <!-- turn on auto-flush during bridge (skip timer sleep when the socket already has data) 
+	 (reduces delay on latent connections but may cause audio hiccups ) -->
+    <!--<param name="rtp-autoflush-during-bridge" value="true"/>-->
     
     <!--If you don't want to pass through timestamps from 1 RTP call to another (on a per call basis with rtp_rewrite_timestamps chanvar)-->
     <!--<param name="rtp-rewrite-timestamps" value="true"/>-->

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Thu May  7 10:07:04 2009
@@ -1024,21 +1024,49 @@
 
 	case SWITCH_MESSAGE_INDICATE_BRIDGE:
 		if (switch_rtp_ready(tech_pvt->rtp_session)) {
+			const char *val;
+			int ok = 0;
+
 			if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) && switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
 				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s activate passthru 2833 mode.\n", switch_channel_get_name(channel));
 			}
+
+			if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
+				ok = switch_true(val);
+			} else {
+				ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+			}
 			
-			rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+			if (ok) {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
+			} else {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+			}
 		}
 		goto end;
 	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
 		if (switch_rtp_ready(tech_pvt->rtp_session)) {
+			const char *val;
+			int ok = 0;
+
 			if (switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n", switch_channel_get_name(channel));
 				switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
 			}
-			rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+
+			if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
+				ok = switch_true(val);
+			} else {
+				ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+			}
+			
+			if (ok) {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
+			} else {
+				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+			}
+
 		}
 		goto end;
 	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Thu May  7 10:07:04 2009
@@ -189,6 +189,7 @@
 	PFLAG_NAT_OPTIONS_PING,
 	PFLAG_AUTOFIX_TIMING,
 	PFLAG_MESSAGE_QUERY_ON_REGISTER,
+	PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE,
 	/* No new flags below this line */
 	PFLAG_MAX
 } PFLAGS;

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Thu May  7 10:07:04 2009
@@ -1557,6 +1557,12 @@
 						} else {
 							sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
 						}
+					} else if (!strcasecmp(var, "rtp-autoflush-during-bridge")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						}
 					} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
 						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
@@ -2059,6 +2065,12 @@
 						sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
 					} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
 						sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+					} else if (!strcasecmp(var, "rtp-autoflush-during-bridge")) {
+						if (switch_true(val)) {
+							sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						} else {
+							sofia_clear_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+						}
 					} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
 						sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
 					} else if (!strcasecmp(var, "force-subscription-expires")) {



More information about the Freeswitch-svn mailing list