[Freeswitch-svn] [commit] r9622 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Tue Sep 23 09:54:07 EDT 2008


Author: anthm
Date: Tue Sep 23 09:54:06 2008
New Revision: 9622

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Log:
patch for FSCORE-191

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	Tue Sep 23 09:54:06 2008
@@ -1132,7 +1132,7 @@
 						}
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
-					} else if (!strcasecmp(var, "cng-pt")) {
+					} else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
 						profile->cng_pt = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "vad")) {
 						if (!strcasecmp(val, "in")) {
@@ -1166,6 +1166,7 @@
 					} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_SUPPRESS_CNG;
+							profile->cng_pt = 0;
 						} else {
 							profile->pflags &= ~PFLAG_SUPPRESS_CNG;
 						}
@@ -1489,7 +1490,7 @@
 						}
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
-					} else if (!strcasecmp(var, "cng-pt")) {
+					} else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
 						profile->cng_pt = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "sip-port")) {
 						profile->sip_port = atoi(val);
@@ -1621,6 +1622,7 @@
 					} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_SUPPRESS_CNG;
+							profile->cng_pt = 0;
 						}
 					} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
 						if (switch_true(val)) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Tue Sep 23 09:54:06 2008
@@ -127,7 +127,7 @@
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
 	}
 
-	if (tech_pvt->cng_pt && use_cng) {
+	if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
 	}
 
@@ -174,7 +174,7 @@
 	if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
 	}
-	if (tech_pvt->cng_pt && use_cng) {
+	if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
 		if (!tech_pvt->rm_encoding) {
 			tech_pvt->cng_pt = 0;
@@ -413,10 +413,12 @@
 
 	tech_pvt->dtmf_type = profile->dtmf_type;
 
-	if (tech_pvt->bcng_pt) {
-		tech_pvt->cng_pt = tech_pvt->bcng_pt;
-	} else if (!tech_pvt->cng_pt) {
-		tech_pvt->cng_pt = profile->cng_pt;
+	if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+		if (tech_pvt->bcng_pt) {
+			tech_pvt->cng_pt = tech_pvt->bcng_pt;
+		} else if (!tech_pvt->cng_pt) {
+			tech_pvt->cng_pt = profile->cng_pt;
+		}
 	}
 
 	tech_pvt->session = session;
@@ -1744,7 +1746,9 @@
 		flags |= SWITCH_RTP_FLAG_RAW_WRITE;
 	}
 
-	if (tech_pvt->cng_pt) {
+	if (tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) {
+		tech_pvt->cng_pt = 0;
+	} else if (tech_pvt->cng_pt) {
 		flags |= SWITCH_RTP_FLAG_AUTO_CNG;
 	}
 
@@ -1927,7 +1931,7 @@
 		if (tech_pvt->te) {
 			switch_rtp_set_telephony_event(tech_pvt->rtp_session, tech_pvt->te);
 		}
-		if (tech_pvt->cng_pt) {
+		if (tech_pvt->cng_pt && !(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", tech_pvt->cng_pt);
 			switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
 		}
@@ -2295,7 +2299,7 @@
 					}
 				}
 
-				if (!cng_pt && !strcasecmp(rm_encoding, "CN")) {
+				if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
 					cng_pt = tech_pvt->cng_pt = (switch_payload_t) map->rm_pt;
 					if (tech_pvt->rtp_session) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", cng_pt);



More information about the Freeswitch-svn mailing list