From d04606fb091fc97a9dc00b5a2a91b0e619be9a2e Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Wed, 8 Aug 2012 14:43:55 -0400 Subject: [PATCH] updating rfc2833 variable code --- .../mod_media_gateway/media_gateway.c | 4 +- .../mod_media_gateway/media_gateway_utils.c | 52 +++++++++++++------ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway.c b/src/mod/endpoints/mod_media_gateway/media_gateway.c index ca973e10a9..9df5e2a2e0 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway.c @@ -85,7 +85,7 @@ static switch_status_t mg_on_dtmf(switch_core_session_t *session, const switch_d { switch_channel_t *channel = switch_core_session_get_channel(session); mg_termination_t *term = switch_channel_get_private(channel, "_mg_term_"); - char digit[2] = { dtmf->digit }; + //char digit[2] = { dtmf->digit }; if (!term) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find termination structure for session [%s]\n", switch_core_session_get_uuid(session)); @@ -94,7 +94,7 @@ static switch_status_t mg_on_dtmf(switch_core_session_t *session, const switch_d //switch_status_t mg_send_dtmf_notify(megaco_profile_t* mg_profile, const char* term_name, char* digits, int num_of_collected_digits); //mg_send_dtmf_notify(term->profile, term->name, digit, 1); - switch_log_printf("NOT Sending notify to MGC for dtmf: %c\n", dtmf->digit); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MEGACO DTMF Signaling NOT Sending notify to MGC for dtmf:%c\n",dtmf->digit); return SWITCH_STATUS_SUCCESS; } 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 3801ade93b..11d68f026c 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_utils.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_utils.c @@ -528,7 +528,7 @@ void mgco_handle_sdp_attr_set(CmSdpAttrSet *s, mg_termination_t* term) CmSdpAttrFmtp* f = &a->u.fmtp; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t CM_SDP_ATTR_FMTP: \n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Format Type = %d \n",(NOTPRSNT == f->type.pres)?f->type.val:-1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Format Type = %d \n",(NOTPRSNT != f->type.pres)?f->type.val:-1); break; } @@ -540,30 +540,47 @@ void mgco_handle_sdp_attr_set(CmSdpAttrSet *s, mg_termination_t* term) if(NOTPRSNT != r->pres.pres){ /* payload type */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Payload Type = %d \n", - (NOTPRSNT != r->pay.type.pres)?r->pay.type.val:-1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Payload Type = %d \n", + (NOTPRSNT != r->pay.type.pres)?r->pay.type.val:-1); /* payload value */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Payload Value = %d \n", - (NOTPRSNT != r->pay.val.pres)?r->pay.val.val:-1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Payload Value = %d \n", + (NOTPRSNT != r->pay.val.pres)?r->pay.val.val:-1); /* encoding name */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Encoding Name value = %d \n", - (NOTPRSNT != r->enc.val.pres)?r->enc.val.val:-1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Encoding Name value = %d \n", + (NOTPRSNT != r->enc.val.pres)?r->enc.val.val:-1); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Encoding Name name = %s \n", - (NOTPRSNT != r->enc.name.pres)?(char*)r->enc.name.val:"Not Present"); + if((NOTPRSNT != r->enc.val.pres ) && + (CM_SDP_ENC_TELEPHONE_EVENT == r->enc.val.val)){ + + term->u.rtp.rfc2833_pt=r->pay.val.val; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + " Updating rfc2833_pt to [%d] \n", term->u.rtp.rfc2833_pt); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Encoding Name name = %s \n", + (NOTPRSNT != r->enc.name.pres)? + (char*)r->enc.name.val:"Not Present"); #ifdef BIT_64 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Clock Rate = %d \n", - (NOTPRSNT != r->clk.pres)?r->clk.val:-1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Clock Rate = %d \n", + (NOTPRSNT != r->clk.pres)?r->clk.val:-1); #else - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Clock Rate = %ld \n", - (NOTPRSNT != r->clk.pres)?r->clk.val:-1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Clock Rate = %ld \n", + (NOTPRSNT != r->clk.pres)?r->clk.val:-1); #endif - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\t Encoding Parameters = %s \n", - (NOTPRSNT != r->parms.pres)?(char*)r->parms.val:"Not Present"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "\t Encoding Parameters = %s \n", + (NOTPRSNT != r->parms.pres)? + (char*)r->parms.val:"Not Present"); } break; } @@ -1832,8 +1849,11 @@ switch_status_t mg_rem_unsupported_codecs (megaco_profile_t* mg_profile, mg_term /* see if received codec is present in our codec supported list */ for (id = 0; codecs[id] && id < codec_count; id++) { int pt = codecs[id]->ianacode; - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "Matching recv codec[%d] with supported codec[%d] \n", fmt->val.val, pt); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, + "Matching recv codec[%d] with supported codec[%d] \n", fmt->val.val, pt); //const char *name = codecs[id]->iananame; + /* anything > 96 is dymanic we should skip codec match */ + if(fmt->val.val >= 96) {foundCodec = 0x01; break;} if(pt == fmt->val.val){ foundCodec = 0x01; break;