]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add sip_liberal_dtmf chanvar and liberal-dtmf profile param to use the maximum method...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 23 Jun 2011 22:57:10 +0000 (17:57 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 23 Jun 2011 22:57:10 +0000 (17:57 -0500)
conf/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index b803bcea6d0467542676b304d290ee6fad539a36..2dd094a656017f34c42abce80ec71edd0c5cf932 100644 (file)
        <!-- <param name="shutdown-on-fail" value="true"/> -->
     <param name="sip-trace" value="no"/>
 
+
+    <!-- Don't be picky about negotiated DTMF just always offer 2833 and accept both 2833 and INFO -->
+    <!--<param name="liberal-dtmf" value="true"/>-->
+
+
     <!-- 
         Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop
         responding. These options allow you to enable and control a watchdog
index 6542bae61520ed79b49e588f972cc5478d84974d..cc77b818fbf58db58e407b4fe58943e8bd1e18b7 100644 (file)
@@ -245,6 +245,7 @@ typedef enum {
        PFLAG_RENEG_ON_HOLD,
        PFLAG_RENEG_ON_REINVITE,
        PFLAG_RTP_NOTIMER_DURING_BRIDGE,
+       PFLAG_LIBERAL_DTMF,
        /* No new flags below this line */
        PFLAG_MAX
 } PFLAGS;
@@ -308,6 +309,7 @@ typedef enum {
        TFLAG_JB_PAUSED,
        TFLAG_3PCC_INVITE,
        TFLAG_NOREPLY,
+       TFLAG_LIBERAL_DTMF,
        /* No new flags below this line */
        TFLAG_MAX
 } TFLAGS;
index 17cb9f718308c7af5540b8584807305823b5623c..c8dc34966dbd8d8547b92d13ee184e57a320bd31 100644 (file)
@@ -2624,6 +2624,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
                                                }
+                                       } else if (!strcasecmp(var, "liberal-dtmf")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_LIBERAL_DTMF);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_LIBERAL_DTMF);
+                                               }
                                        } else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) {
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
@@ -3310,6 +3316,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
                                                }
+                                       } else if (!strcasecmp(var, "liberal-dtmf")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_LIBERAL_DTMF);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_LIBERAL_DTMF);
+                                               }
                                        } else if (!strcasecmp(var, "watchdog-enabled")) {
                                                profile->watchdog_enabled = switch_true(val);
                                        } else if (!strcasecmp(var, "watchdog-step-timeout")) {
@@ -6604,7 +6616,8 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
                                goto end;
                        }
 
-                       if (dtmf.digit && tech_pvt->dtmf_type == DTMF_INFO) {
+                       if (dtmf.digit && (tech_pvt->dtmf_type == DTMF_INFO || 
+                                                          sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF))) {
                                /* queue it up */
                                switch_channel_queue_dtmf(channel, &dtmf);
 
index 767558c0451a0d9d3156b71da7be830f26506b44..dce54efb2adf2e3fd94f7638cb13d8794ac3bd04 100644 (file)
@@ -308,7 +308,8 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
        }
 
 
-       if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
+       if ((tech_pvt->dtmf_type == DTMF_2833 || sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF)) 
+               && tech_pvt->te > 95) {
                switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
        }
 
@@ -510,7 +511,8 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch
                }
 
 
-               if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
+               if ((tech_pvt->dtmf_type == DTMF_2833 || sofia_test_pflag(tech_pvt->profile, PFLAG_LIBERAL_DTMF) || sofia_test_flag(tech_pvt, TFLAG_LIBERAL_DTMF))
+                       && 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 (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
@@ -2960,6 +2962,10 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
                sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
        }
 
+       if ((var = switch_channel_get_variable(tech_pvt->channel, "sip_liberal_dtmf")) && switch_true(var)) {
+               sofia_set_flag_locked(tech_pvt, TFLAG_LIBERAL_DTMF);
+       }
+
        if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
                status = SWITCH_STATUS_SUCCESS;
                goto end;