allow {dtmf_type=none} to work in oubound dial strings

This commit is contained in:
Anthony Minessale 2010-10-26 15:43:14 -05:00
parent 08d2ea9d96
commit e10bc0a965
3 changed files with 22 additions and 12 deletions

View File

@ -80,6 +80,9 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
switch_mutex_lock(tech_pvt->sofia_mutex);
sofia_glue_check_dtmf_type(tech_pvt);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel));
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
sofia_glue_tech_absorb_sdp(tech_pvt);

View File

@ -1029,3 +1029,4 @@ void sofia_glue_global_watchdog(switch_bool_t on);
void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp);
switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt);
void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl);
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);

View File

@ -336,6 +336,23 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
}
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt)
{
const char *val;
if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) {
if (!strcasecmp(val, "rfc2833")) {
tech_pvt->dtmf_type = DTMF_2833;
} else if (!strcasecmp(val, "info")) {
tech_pvt->dtmf_type = DTMF_INFO;
} else if (!strcasecmp(val, "none")) {
tech_pvt->dtmf_type = DTMF_NONE;
} else {
tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type;
}
}
}
void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force)
{
@ -357,6 +374,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
switch_event_t *map = NULL, *ptmap = NULL;
const char *b_sdp = NULL;
sofia_glue_check_dtmf_type(tech_pvt);
if (!tech_pvt->payload_space) {
int i;
@ -797,8 +815,6 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
tech_pvt->recv_te = tech_pvt->te = profile->te;
}
tech_pvt->dtmf_type = profile->dtmf_type;
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
if (tech_pvt->bcng_pt) {
tech_pvt->cng_pt = tech_pvt->bcng_pt;
@ -2904,16 +2920,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT);
}
if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) {
if (!strcasecmp(val, "rfc2833")) {
tech_pvt->dtmf_type = DTMF_2833;
} else if (!strcasecmp(val, "info")) {
tech_pvt->dtmf_type = DTMF_INFO;
} else {
tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type;
}
}
if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833)
|| ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
sofia_set_flag(tech_pvt, TFLAG_PASS_RFC2833);