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

Freeswitch SVN anthm at freeswitch.org
Mon Nov 12 15:36:01 EST 2007


Author: anthm
Date: Mon Nov 12 15:36:00 2007
New Revision: 6222

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

Log:
add supress-cng param and supress_cng variable

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	Mon Nov 12 15:36:00 2007
@@ -114,7 +114,8 @@
 	PFLAG_RUNNING = (1 << 8),
 	PFLAG_RESPAWN = (1 << 9),
 	PFLAG_GREEDY = (1 << 10),
-	PFLAG_MULTIREG = (1 << 11)
+	PFLAG_MULTIREG = (1 << 11),
+	PFLAG_SUPRESS_CNG = (1 << 12)
 } 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	Mon Nov 12 15:36:00 2007
@@ -907,6 +907,10 @@
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_MULTIREG;
 						}
+					} else if (!strcasecmp(var, "supress-cng")) {
+						if (switch_true(val)) {
+							profile->pflags |= PFLAG_SUPRESS_CNG;
+						}
 					} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
 						if (switch_true(val)) {
 							profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;

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	Mon Nov 12 15:36:00 2007
@@ -44,6 +44,13 @@
 	int ptime = 0;
 	uint32_t rate = 0;
 	uint32_t v_port;
+	int use_cng = 1;
+	const char *val;
+
+	if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) || 
+		((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
+		use_cng = 0;
+	}
 
 	if (!force && !ip && !sr && switch_channel_test_flag(tech_pvt->channel, CF_BYPASS_MEDIA)) {
 		return;
@@ -113,8 +120,8 @@
 	if (tech_pvt->te > 95) {
 		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
 	}
-
-	if (tech_pvt->cng_pt) {
+	
+	if (tech_pvt->cng_pt && use_cng) {
 		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
 	}
 
@@ -163,11 +170,13 @@
 	if (tech_pvt->te > 95) {
 		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) {
+	if (tech_pvt->cng_pt && use_cng) {
 		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;
 		}
+	} else {
+		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
 	}
 	if (ptime) {
 		snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);



More information about the Freeswitch-svn mailing list