]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add supress-cng param and supress_cng variable
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 12 Nov 2007 20:36:00 +0000 (20:36 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 12 Nov 2007 20:36:00 +0000 (20:36 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6222 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index 92a587836f9be9154b2127b9d7ba92fb9631d5a6..00d4c0a2d4b216c22a7ebcf387352056662b2450 100644 (file)
@@ -114,7 +114,8 @@ typedef enum {
        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;
 
 
index cac857186f5dde0d47690f702fd45d97fdc37735..030e4fc98eb8a44bcb33f3d019f94a1ae215a36b 100644 (file)
@@ -907,6 +907,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                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;
index 7a7e7129891a4fe945bd0eeee86c5df9a7372778..0bbb2cce477572296216735df716be19e87b6532 100644 (file)
@@ -44,6 +44,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
        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 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
        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 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
        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);