From 6046698b290864abd89553ec36c2ecd8894f5496 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 Aug 2012 09:57:51 -0400 Subject: [PATCH] fixing channel mapping issue and removing unwanted prints --- src/mod/endpoints/mod_media_gateway/media_gateway.c | 2 +- .../mod_media_gateway/media_gateway_cmd_handler.c | 2 ++ .../mod_media_gateway/media_gateway_stack.h | 2 +- .../endpoints/mod_media_gateway/media_gateway_xml.c | 13 ++++++++----- .../endpoints/mod_media_gateway/mod_media_gateway.c | 8 ++++---- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway.c b/src/mod/endpoints/mod_media_gateway/media_gateway.c index 20e72d1c18..52081dbc12 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway.c @@ -63,7 +63,7 @@ megaco_profile_t* megaco_get_profile_by_suId(SuId suId) switch_hash_this(hi, &var, NULL, &val); profile = (megaco_profile_t *) val; if (profile->idx == suId) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got profile[%s] associated with suId[%d]\n",profile->name, suId); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got profile[%s] associated with suId[%d]\n",profile->name, suId); found = 0x01; break; } 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 61896ce9b9..b3661f75e8 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 @@ -1563,6 +1563,7 @@ switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoCont ctxt.cmdStatus.pres = PRSNT_NODEF; ctxt.cmdStatus.val = CH_CMD_STATUS_END_OF_AXN; +#if 0 #ifdef BIT_64 switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "mg_send_end_of_axn: Sending END_OF_AXN for transId[%d], peerId[%d], context[type = %s, value = %d]\n", @@ -1572,6 +1573,7 @@ switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoCont "mg_send_end_of_axn: Sending END_OF_AXN for transId[%lu], peerId[%lu], context[type = %s, value = %lu]\n", transId->val, peerId->val, PRNT_MG_CTXT_TYPE(ctxtId->type.val), ctxtId->val.val); +#endif #endif ret = sng_mgco_send_axn_req(suId, &ctxt); 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 28ff0c2c03..1c7e8c614c 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h @@ -193,7 +193,7 @@ switch_status_t mg_build_mgco_err_request(MgMgcoInd **errcmd,U32 trans_id, MgM switch_status_t mg_send_audit_rsp(SuId suId, MgMgcoCommand *req); switch_status_t handle_mg_audit_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *auditReq); switch_status_t mg_stack_termination_is_in_service(megaco_profile_t* mg_profile, char* term_str, int len); -void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char *channel_prefix, const char *prefix, int j); +void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char *channel_prefix, const char *prefix, int j, int k); void mg_util_set_cmd_name_string (MgStr *errTxt, MgMgcoCommand *cmd); switch_status_t mgco_init_ins_service_change(SuId suId); 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 44c716152a..4b242a6b9b 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_xml.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_xml.c @@ -103,14 +103,14 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload) startchan = atoi(chanmap[0]); endchan = atoi(chanmap[1]); for (j = startchan; j <= endchan; j++) { - mg_create_tdm_term(profile, tech, channel_prefix, prefix, j); + mg_create_tdm_term(profile, tech, channel_prefix, prefix, j, j); } } }else{ /* case (i) */ p = channel_map_dup; startchan = endchan = atoi(p); - mg_create_tdm_term(profile, tech, channel_prefix, prefix, startchan); + mg_create_tdm_term(profile, tech, channel_prefix, prefix, startchan, startchan); } }else { @@ -123,7 +123,10 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload) endchan = atoi(p); for (j = startchan; j <= endchan; j++) { - mg_create_tdm_term(profile, tech, channel_prefix, prefix, j); +if (0 == i) + mg_create_tdm_term(profile, tech, channel_prefix, prefix, j, j); +else + mg_create_tdm_term(profile, tech, channel_prefix, prefix, j, j-1); } } } @@ -197,7 +200,7 @@ done: } /****************************************************************************************************************************/ -void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char *channel_prefix, const char *prefix, int chan_num) +void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char *channel_prefix, const char *prefix, int chan_num, int tdm_chan_num) { mg_termination_t *term; switch_memory_pool_t *pool; @@ -211,7 +214,7 @@ void mg_create_tdm_term(megaco_profile_t *profile, const char *tech, const char term->tech = switch_core_strdup(pool, tech); term->active_events = NULL; term->name = switch_core_sprintf(pool, "%s%d", prefix, chan_num); - term->u.tdm.channel = chan_num; + term->u.tdm.channel = tdm_chan_num; term->u.tdm.span_name = switch_core_strdup(pool, channel_prefix); switch_set_flag(term, MG_OUT_OF_SERVICE); diff --git a/src/mod/endpoints/mod_media_gateway/mod_media_gateway.c b/src/mod/endpoints/mod_media_gateway/mod_media_gateway.c index 698efc0798..771732d680 100644 --- a/src/mod/endpoints/mod_media_gateway/mod_media_gateway.c +++ b/src/mod/endpoints/mod_media_gateway/mod_media_gateway.c @@ -526,8 +526,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) inc_context = &cmd->contextId; memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "%s: Received Command Type[%s] \n", __PRETTY_FUNCTION__, PRNT_MG_CMD_TYPE(cmd->cmdType.val)); + /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "%s: Received Command Type[%s] \n", __PRETTY_FUNCTION__, PRNT_MG_CMD_TYPE(cmd->cmdType.val));*/ /*get mg profile associated with SuId */ if(NULL == (mg_profile = megaco_get_profile_by_suId(suId))){ @@ -591,8 +591,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Termination-Id received..value[%s] type[%d] \n", termId->name.lcl.val, termId->type.val); + /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "Termination-Id received..value[%s] type[%d] \n", termId->name.lcl.val, termId->type.val);*/ /*If term type is other then check if that term is configured with us..for term type CHOOSE/ALL , no need to check */ /* check is only if command is not AUDIT */