[Freeswitch-branches] [commit] r11434 - in freeswitch/branches/1.0: conf/sip_profiles src/mod/endpoints/mod_sofia

FreeSWITCH SVN mikej at freeswitch.org
Thu Jan 22 15:23:46 PST 2009


Author: mikej
Date: Thu Jan 22 17:23:46 2009
New Revision: 11434

Log:
mod_sofia: add auto-rtp-bugs profile option to make rtp bug compensation configurable  (r :11146-11147)

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

Modified: freeswitch/branches/1.0/conf/sip_profiles/internal.xml
==============================================================================
--- freeswitch/branches/1.0/conf/sip_profiles/internal.xml	(original)
+++ freeswitch/branches/1.0/conf/sip_profiles/internal.xml	Thu Jan 22 17:23:46 2009
@@ -180,6 +180,17 @@
     <!--<param name="inbound-use-callid-as-uuid" value="true"/>-->
     <!-- on outbound calls set the callid to match the uuid of the session -->
     <!--<param name="outbound-use-uuid-as-callid" value="true"/>-->
+
+    <!-- clear clears them all or supply the name to add or the name prefixed with ~ to remove
+	 valid values:
+
+	 clear
+	 CISCO_SKIP_MARK_BIT_2833
+	 SONUS_SEND_INVALID_TIMESTAMP_2833
+
+    -->
+    <!--<param name="auto-rtp-bugs" data="clear"/>-->
+    
   </settings>
 </profile>
 

Modified: freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/mod_sofia.h	Thu Jan 22 17:23:46 2009
@@ -433,6 +433,7 @@
 	sofia_presence_type_t pres_type;
 	sofia_media_options_t media_options;
 	uint32_t force_subscription_expires;
+	switch_rtp_bug_flag_t auto_rtp_bugs;
 };
 
 struct private_object {

Modified: freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/sofia.c	Thu Jan 22 17:23:46 2009
@@ -1208,6 +1208,31 @@
 	}
 }
 
+static void parse_rtp_bugs(sofia_profile_t *profile, const char *str)
+{
+	if (switch_stristr("clear", str)) {
+		profile->auto_rtp_bugs = 0;
+	}
+
+	if (switch_stristr("CISCO_SKIP_MARK_BIT_2833", str)) {
+		profile->auto_rtp_bugs |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833;
+	}
+
+	if (switch_stristr("~CISCO_SKIP_MARK_BIT_2833", str)) {
+		profile->auto_rtp_bugs &= ~RTP_BUG_CISCO_SKIP_MARK_BIT_2833;
+	}
+	
+	if (switch_stristr("SONUS_SEND_INVALID_TIMESTAMP_2833", str)) {
+		profile->auto_rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
+	}
+
+	if (switch_stristr("~SONUS_SEND_INVALID_TIMESTAMP_2833", str)) {
+		profile->auto_rtp_bugs &= ~RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
+	}
+
+
+}
+
 switch_status_t reconfig_sofia(sofia_profile_t *profile)
 {
 	switch_xml_t cfg, xml = NULL, xprofile, profiles, gateways_tag, domain_tag, domains_tag, aliases_tag, alias_tag, settings, param;
@@ -1250,6 +1275,8 @@
 					char *val = (char *) switch_xml_attr_soft(param, "value");
 					if (!strcasecmp(var, "debug")) {
 						profile->debug = atoi(val);
+					} else if (!strcasecmp(var, "auto-rtp-bugs")) {
+						parse_rtp_bugs(profile, val);
 					} else if (!strcasecmp(var, "user-agent-string")) { 
 						profile->user_agent = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "dtmf-type")) {
@@ -1639,6 +1666,8 @@
 					goto done;
 				}
 
+				profile->auto_rtp_bugs = RTP_BUG_CISCO_SKIP_MARK_BIT_2833 | RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
+
 				profile->pool = pool;
 				profile->user_agent = SOFIA_USER_AGENT;
 
@@ -1694,6 +1723,8 @@
 						if (switch_true(val)) {
 							profile->rport_level = 2;
 						}
+					} else if (!strcasecmp(var, "auto-rtp-bugs")) {
+						parse_rtp_bugs(profile, val);
 					} else if (!strcasecmp(var, "dbname")) {
 						profile->dbname = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "presence-hosts")) {

Modified: freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/branches/1.0/src/mod/endpoints/mod_sofia/sofia_glue.c	Thu Jan 22 17:23:46 2009
@@ -2275,19 +2275,25 @@
 	}
 
 	if ((tech_pvt->origin = switch_core_session_strdup(session, (char *) sdp->sdp_origin->o_username))) {
-		if (strstr(tech_pvt->origin, "CiscoSystemsSIP-GW-UserAgent")) {
-			tech_pvt->rtp_bugs |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833;
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Buggy RFC2833 Mode!\n");
-		}
 
-		if (strstr(tech_pvt->origin, "Sonus_UAC")) {
-			tech_pvt->rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-							  "Hello,\nI see you have a Sonus!\n"
-							  "FYI, Sonus cannot follow the RFC on the proper way to send DTMF.\n"
-							  "Sadly, my creator had to spend several hours figuring this out so I thought you'd like to know that!\n"
-							  "Don't worry, DTMF will work but you may want to ask them to fix it......\n"
-							  );
+		if (tech_pvt->profile->auto_rtp_bugs & RTP_BUG_CISCO_SKIP_MARK_BIT_2833) {
+
+			if (strstr(tech_pvt->origin, "CiscoSystemsSIP-GW-UserAgent")) {
+				tech_pvt->rtp_bugs |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833;
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Buggy RFC2833 Mode!\n");
+			}
+		}
+		
+		if (tech_pvt->profile->auto_rtp_bugs & RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833) {
+			if (strstr(tech_pvt->origin, "Sonus_UAC")) {
+				tech_pvt->rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+								  "Hello,\nI see you have a Sonus!\n"
+								  "FYI, Sonus cannot follow the RFC on the proper way to send DTMF.\n"
+								  "Sadly, my creator had to spend several hours figuring this out so I thought you'd like to know that!\n"
+								  "Don't worry, DTMF will work but you may want to ask them to fix it......\n"
+								  );
+			}
 		}
 	}
 



More information about the Freeswitch-branches mailing list