diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway.c b/src/mod/endpoints/mod_media_gateway/media_gateway.c index 4272e414af..1a1bba5475 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway.c @@ -244,6 +244,10 @@ switch_status_t megaco_tdm_term_dtmf_removal(mg_termination_t *term, int enable) sprintf(buf,"%s",(1 == enable)?"enable":"disable"); + if(enable){ + switch_set_flag(term, MG_DTMF_REMOVAL_ENABLE); + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Sending DTMF Removal Event[%s] for MG Term[%s], TDM span[%s] channel[%d]\n", buf,tdm_term->name, tdm_term->u.tdm.span_name, tdm_term->u.tdm.channel); @@ -441,6 +445,11 @@ void megaco_termination_destroy(mg_termination_t *term) switch_clear_flag(term, MGT_ALLOCATED); switch_clear_flag(term, MGT_ACTIVE); switch_clear_flag(term, MG_FAX_NOTIFIED); + + if(switch_test_flag(term, MG_DTMF_REMOVAL_ENABLE)){ + switch_clear_flag(term, MG_DTMF_REMOVAL_ENABLE); + megaco_tdm_term_dtmf_removal(term,0x00); + } if (term->type == MG_TERM_RTP) { switch_core_hash_delete_wrlock(term->profile->terminations, term->name, term->profile->terminations_rwlock); diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c b/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c index cc393d8ff8..fe99a25b8d 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c @@ -747,8 +747,6 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i tdm_term = megaco_context_get_peer_term(mg_ctxt, term); if(term->u.rtp.rfc2833_pt){ megaco_tdm_term_dtmf_removal(tdm_term,0x01); - }else{ - megaco_tdm_term_dtmf_removal(tdm_term,0x00); } } diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_xml.c b/src/mod/endpoints/mod_media_gateway/media_gateway_xml.c index 3bfe075c80..3f3e2c01c5 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_xml.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_xml.c @@ -264,6 +264,10 @@ void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char term->name, term->u.tdm.span_name, term->u.tdm.channel); megaco_prepare_tdm_termination(term); + /* by-default : DTMF removal disable + * by default do not modify in-band audio stream*/ + megaco_tdm_term_dtmf_removal(term,0x00); + profile->total_cfg_term++; } /****************************************************************************************************************************/ diff --git a/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h b/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h index 95d738d559..640b22d7e0 100644 --- a/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h +++ b/src/mod/endpoints/mod_media_gateway/mod_media_gateway.h @@ -120,6 +120,7 @@ enum { MG_IN_SERVICE = (1 << 2), MG_OUT_OF_SERVICE = (1 << 3), MG_FAX_NOTIFIED = (1 << 4), + MG_DTMF_REMOVAL_ENABLE = (1 << 5), } mg_termination_flags;