fixing channel mapping issue and removing unwanted prints

This commit is contained in:
root 2012-08-07 09:57:51 -04:00
parent 3b0290b616
commit 6046698b29
5 changed files with 16 additions and 11 deletions

View File

@ -63,7 +63,7 @@ megaco_profile_t* megaco_get_profile_by_suId(SuId suId)
switch_hash_this(hi, &var, NULL, &val); switch_hash_this(hi, &var, NULL, &val);
profile = (megaco_profile_t *) val; profile = (megaco_profile_t *) val;
if (profile->idx == suId) { 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; found = 0x01;
break; break;
} }

View File

@ -1563,6 +1563,7 @@ switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoCont
ctxt.cmdStatus.pres = PRSNT_NODEF; ctxt.cmdStatus.pres = PRSNT_NODEF;
ctxt.cmdStatus.val = CH_CMD_STATUS_END_OF_AXN; ctxt.cmdStatus.val = CH_CMD_STATUS_END_OF_AXN;
#if 0
#ifdef BIT_64 #ifdef BIT_64
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, 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", "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", "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); transId->val, peerId->val, PRNT_MG_CTXT_TYPE(ctxtId->type.val), ctxtId->val.val);
#endif
#endif #endif
ret = sng_mgco_send_axn_req(suId, &ctxt); ret = sng_mgco_send_axn_req(suId, &ctxt);

View File

@ -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 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 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); 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); void mg_util_set_cmd_name_string (MgStr *errTxt, MgMgcoCommand *cmd);
switch_status_t mgco_init_ins_service_change(SuId suId); switch_status_t mgco_init_ins_service_change(SuId suId);

View File

@ -103,14 +103,14 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
startchan = atoi(chanmap[0]); startchan = atoi(chanmap[0]);
endchan = atoi(chanmap[1]); endchan = atoi(chanmap[1]);
for (j = startchan; j <= endchan; j++) { 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{ }else{
/* case (i) */ /* case (i) */
p = channel_map_dup; p = channel_map_dup;
startchan = endchan = atoi(p); 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 }else
{ {
@ -123,7 +123,10 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
endchan = atoi(p); endchan = atoi(p);
for (j = startchan; j <= endchan; j++) { 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; mg_termination_t *term;
switch_memory_pool_t *pool; 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->tech = switch_core_strdup(pool, tech);
term->active_events = NULL; term->active_events = NULL;
term->name = switch_core_sprintf(pool, "%s%d", prefix, chan_num); 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); term->u.tdm.span_name = switch_core_strdup(pool, channel_prefix);
switch_set_flag(term, MG_OUT_OF_SERVICE); switch_set_flag(term, MG_OUT_OF_SERVICE);

View File

@ -526,8 +526,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
inc_context = &cmd->contextId; inc_context = &cmd->contextId;
memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId)); memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"%s: Received Command Type[%s] \n", __PRETTY_FUNCTION__, PRNT_MG_CMD_TYPE(cmd->cmdType.val)); "%s: Received Command Type[%s] \n", __PRETTY_FUNCTION__, PRNT_MG_CMD_TYPE(cmd->cmdType.val));*/
/*get mg profile associated with SuId */ /*get mg profile associated with SuId */
if(NULL == (mg_profile = megaco_get_profile_by_suId(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, /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Termination-Id received..value[%s] type[%d] \n", termId->name.lcl.val, termId->type.val); "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 */ /*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 */ /* check is only if command is not AUDIT */