fixing modify resp issue
This commit is contained in:
parent
d46b6cd48b
commit
f6e5cae7c5
|
@ -1073,7 +1073,11 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
|
||||||
MgMgcoTermIdLst* termLst;
|
MgMgcoTermIdLst* termLst;
|
||||||
mg_termination_t* term = NULL;
|
mg_termination_t* term = NULL;
|
||||||
switch_status_t ret;
|
switch_status_t ret;
|
||||||
|
MgMgcoAudRetParm *desc;
|
||||||
|
MgMgcoMediaDesc* inc_med_desc = NULL;
|
||||||
|
MgMgcoLocalDesc *local = NULL;
|
||||||
int err_code;
|
int err_code;
|
||||||
|
int mediaId;
|
||||||
/*MgMgcoAmmReq *cmd = &inc_cmd->u.mgCmdInd[0]->cmd.u.mod;*/
|
/*MgMgcoAmmReq *cmd = &inc_cmd->u.mgCmdInd[0]->cmd.u.mod;*/
|
||||||
U32 txn_id = inc_cmd->transId.val;
|
U32 txn_id = inc_cmd->transId.val;
|
||||||
|
|
||||||
|
@ -1267,6 +1271,49 @@ response:
|
||||||
#endif
|
#endif
|
||||||
/*mg_fill_mgco_termid(termId, (char*)"term1",&req->u.mgCmdRsp[0]->memCp);*/
|
/*mg_fill_mgco_termid(termId, (char*)"term1",&req->u.mgCmdRsp[0]->memCp);*/
|
||||||
|
|
||||||
|
if((MG_TERM_RTP == term->type) &&
|
||||||
|
((NOTPRSNT != inc_cmd->u.mgCmdInd[0]->cmd.u.mod.dl.num.pres) &&
|
||||||
|
(0 != inc_cmd->u.mgCmdInd[0]->cmd.u.mod.dl.num.val))) {
|
||||||
|
/* Whatever Media descriptor we have received, we can copy that and then
|
||||||
|
* whatever we want we can modify the fields */
|
||||||
|
/* Kapil - TODO - will see if there is any problem of coping the
|
||||||
|
* descriptor */
|
||||||
|
|
||||||
|
inc_med_desc = &inc_cmd->u.mgCmdInd[0]->cmd.u.mod.dl.descs[0]->u.media;
|
||||||
|
|
||||||
|
if (mgUtlGrowList((void ***)&rsp.u.mgCmdRsp[0]->u.mod.audit.parms, sizeof(MgMgcoAudRetParm),
|
||||||
|
&rsp.u.mgCmdRsp[0]->u.mod.audit.num, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
|
||||||
|
{
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy media descriptor */
|
||||||
|
desc = rsp.u.mgCmdRsp[0]->u.mod.audit.parms[rsp.u.mgCmdRsp[0]->u.mod.audit.num.val-1];
|
||||||
|
desc->type.pres = PRSNT_NODEF;
|
||||||
|
desc->type.val = MGT_MEDIADESC;
|
||||||
|
mgUtlCpyMgMgcoMediaDesc(&desc->u.media, inc_med_desc, &rsp.u.mgCmdRsp[0]->memCp);
|
||||||
|
/* see if we have received local descriptor */
|
||||||
|
if((NOTPRSNT != desc->u.media.num.pres) &&
|
||||||
|
(0 != desc->u.media.num.val))
|
||||||
|
{
|
||||||
|
for(mediaId=0; mediaId<desc->u.media.num.val; mediaId++) {
|
||||||
|
if(MGT_MEDIAPAR_LOCAL == desc->u.media.parms[mediaId]->type.val) {
|
||||||
|
local = &desc->u.media.parms[mediaId]->u.local;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* only for RTP */
|
||||||
|
if(SWITCH_STATUS_FALSE == mg_build_sdp(&desc->u.media, inc_med_desc, mg_profile, term, &rsp.u.mgCmdRsp[0]->memCp)) {
|
||||||
|
if(term->mg_error_code && (*term->mg_error_code == MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT)){
|
||||||
|
mg_util_set_err_string(&errTxt, " Unsupported Codec ");
|
||||||
|
err_code = MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We will always send one command at a time..*/
|
/* We will always send one command at a time..*/
|
||||||
rsp.cmdStatus.pres = PRSNT_NODEF;
|
rsp.cmdStatus.pres = PRSNT_NODEF;
|
||||||
rsp.cmdStatus.val = CH_CMD_STATUS_END_OF_CMD;
|
rsp.cmdStatus.val = CH_CMD_STATUS_END_OF_CMD;
|
||||||
|
|
|
@ -71,7 +71,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
||||||
for (mg_term = switch_xml_child(mg_phys_terms, "map"); mg_term; mg_term = mg_term->next) {
|
for (mg_term = switch_xml_child(mg_phys_terms, "map"); mg_term; mg_term = mg_term->next) {
|
||||||
// <map termination-id-prefix="Term1/" termination-id-base="1" tech="freetdm" channel-prefix="wp2" channel-map"1-15,17-31"/>
|
// <map termination-id-prefix="Term1/" termination-id-base="1" tech="freetdm" channel-prefix="wp2" channel-map"1-15,17-31"/>
|
||||||
const char *prefix = switch_xml_attr(mg_term, "termination-id-prefix");
|
const char *prefix = switch_xml_attr(mg_term, "termination-id-prefix");
|
||||||
//const char *sztermination_id_base = switch_xml_attr(mg_term, "termination-id-base");
|
const char *sztermination_id_base = switch_xml_attr(mg_term, "termination-id-base");
|
||||||
const char *tech = switch_xml_attr(mg_term, "tech");
|
const char *tech = switch_xml_attr(mg_term, "tech");
|
||||||
const char *channel_prefix = switch_xml_attr(mg_term, "channel-prefix");
|
const char *channel_prefix = switch_xml_attr(mg_term, "channel-prefix");
|
||||||
const char *channel_map = switch_xml_attr(mg_term, "channel-map");
|
const char *channel_map = switch_xml_attr(mg_term, "channel-map");
|
||||||
|
@ -84,6 +84,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
||||||
int chanmap_count = 0;
|
int chanmap_count = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int startchan, endchan, j;
|
int startchan, endchan, j;
|
||||||
|
int mg_term_idx = (sztermination_id_base)?atoi(sztermination_id_base):1;
|
||||||
|
|
||||||
/* we can have following combinations *
|
/* we can have following combinations *
|
||||||
* i) only one channel i.e. channel-map="1"
|
* i) only one channel i.e. channel-map="1"
|
||||||
|
@ -103,14 +104,15 @@ 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, j);
|
mg_create_tdm_term(profile, tech, channel_prefix, prefix, mg_term_idx, j);
|
||||||
|
mg_term_idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}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, startchan);
|
mg_create_tdm_term(profile, tech, channel_prefix, prefix, mg_term_idx, startchan);
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
@ -124,9 +126,10 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
|
||||||
|
|
||||||
for (j = startchan; j <= endchan; j++) {
|
for (j = startchan; j <= endchan; j++) {
|
||||||
if (0 == i)
|
if (0 == i)
|
||||||
mg_create_tdm_term(profile, tech, channel_prefix, prefix, j, j);
|
mg_create_tdm_term(profile, tech, channel_prefix, prefix, mg_term_idx, j);
|
||||||
else
|
else
|
||||||
mg_create_tdm_term(profile, tech, channel_prefix, prefix, j, j-1);
|
mg_create_tdm_term(profile, tech, channel_prefix, prefix, mg_term_idx, j-1);
|
||||||
|
mg_term_idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue