From e10bc0a9656bcf5f44bf4f8ffd80da2c0937c0fb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 26 Oct 2010 15:43:14 -0500 Subject: [PATCH] allow {dtmf_type=none} to work in oubound dial strings --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 +++ src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia_glue.c | 30 ++++++++++++++---------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 702875465a..577887bdeb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -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); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3cb2ddb50f..baff8e95e2 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -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); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index ddeb0e48f1..c9b384b3e8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -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);