From fc4365c8a53677d890ad48b45a5c278a94d5fbea Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Mon, 10 Sep 2012 11:09:28 -0400 Subject: [PATCH] fixing issue of applying tdm dtmf removal --- .../media_gateway_cmd_handler.c | 14 ++------------ .../mod_media_gateway/media_gateway_stack.h | 1 + .../mod_media_gateway/media_gateway_utils.c | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 12 deletions(-) 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 9d0f19295a..754bebece9 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 @@ -741,19 +741,8 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i goto error; } - if(is_rtp){ - mg_termination_t* tdm_term = NULL; - /* disable dtmf removal */ - if(NULL != (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); - } - } - } + mg_apply_tdm_dtmf_removal(term, mg_ctxt); - mg_print_t38_attributes(term); /********************************************************************/ @@ -1069,6 +1058,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand term->u.rtp.term_id); } + mg_apply_tdm_dtmf_removal(term, mg_ctxt); mg_print_t38_attributes(term); diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h b/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h index 4b1c80c220..6dfe9d2434 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h @@ -248,6 +248,7 @@ switch_status_t mg_activate_ito_timer(megaco_profile_t* profile); void mg_restart_inactivity_timer(megaco_profile_t* profile); switch_status_t mgco_process_mgc_failure(SuId suId); +void mg_apply_tdm_dtmf_removal(mg_termination_t* term, mg_context_t *mg_ctxt); /****************************************************************************************************************/ diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_utils.c b/src/mod/endpoints/mod_media_gateway/media_gateway_utils.c index 8594e41d97..b3de32b0fe 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_utils.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_utils.c @@ -2354,3 +2354,22 @@ void mg_print_t38_attributes(mg_termination_t* term) } } + +/*****************************************************************************************************************************/ +void mg_apply_tdm_dtmf_removal(mg_termination_t* term, mg_context_t *mg_ctxt) +{ + mg_termination_t* tdm_term = NULL; + + if(NULL == term) return ; + + if((MG_TERM_RTP == term->type)){ + if(NULL != (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); + } + } + } +} +/*****************************************************************************************************************************/