add sip_liberal_dtmf chanvar and liberal-dtmf profile param to use the maximum methods of DTMF avoiding sticking to the spec which leads to incompatability

This commit is contained in:
Anthony Minessale 2011-06-23 17:57:10 -05:00
parent 982b7614b0
commit bc7cb400c0
4 changed files with 29 additions and 3 deletions

View File

@ -43,6 +43,11 @@
<!-- <param name="shutdown-on-fail" value="true"/> --> <!-- <param name="shutdown-on-fail" value="true"/> -->
<param name="sip-trace" value="no"/> <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 Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop
responding. These options allow you to enable and control a watchdog responding. These options allow you to enable and control a watchdog

View File

@ -245,6 +245,7 @@ typedef enum {
PFLAG_RENEG_ON_HOLD, PFLAG_RENEG_ON_HOLD,
PFLAG_RENEG_ON_REINVITE, PFLAG_RENEG_ON_REINVITE,
PFLAG_RTP_NOTIMER_DURING_BRIDGE, PFLAG_RTP_NOTIMER_DURING_BRIDGE,
PFLAG_LIBERAL_DTMF,
/* No new flags below this line */ /* No new flags below this line */
PFLAG_MAX PFLAG_MAX
} PFLAGS; } PFLAGS;
@ -308,6 +309,7 @@ typedef enum {
TFLAG_JB_PAUSED, TFLAG_JB_PAUSED,
TFLAG_3PCC_INVITE, TFLAG_3PCC_INVITE,
TFLAG_NOREPLY, TFLAG_NOREPLY,
TFLAG_LIBERAL_DTMF,
/* No new flags below this line */ /* No new flags below this line */
TFLAG_MAX TFLAG_MAX
} TFLAGS; } TFLAGS;

View File

@ -2624,6 +2624,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else { } else {
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); 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")) { } else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) {
if (switch_true(val)) { if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY);
@ -3310,6 +3316,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else { } else {
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); 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")) { } else if (!strcasecmp(var, "watchdog-enabled")) {
profile->watchdog_enabled = switch_true(val); profile->watchdog_enabled = switch_true(val);
} else if (!strcasecmp(var, "watchdog-step-timeout")) { } 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; 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 */ /* queue it up */
switch_channel_queue_dtmf(channel, &dtmf); switch_channel_queue_dtmf(channel, &dtmf);

View 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); 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); 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) { 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); 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)) { if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
goto end; goto end;