mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-02 11:19:28 +00:00
fixing memory leak issues
This commit is contained in:
parent
e3e07569e2
commit
b0a823851b
@ -207,6 +207,7 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* mg <mg-profile> show alltermstatus */
|
/* mg <mg-profile> show alltermstatus */
|
||||||
handle_all_term_status_cli_cmd(stream, profile);
|
handle_all_term_status_cli_cmd(stream, profile);
|
||||||
|
/*******************************************************************/
|
||||||
}else if(!strcasecmp(argv[3], "termstatus")){
|
}else if(!strcasecmp(argv[3], "termstatus")){
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* mg <mg-profile> show termstatus <term-id> */
|
/* mg <mg-profile> show termstatus <term-id> */
|
||||||
@ -214,6 +215,17 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
handle_term_status_cli_cmd(stream, profile, argv[4]);
|
handle_term_status_cli_cmd(stream, profile, argv[4]);
|
||||||
|
/*******************************************************************/
|
||||||
|
}else if(!strcasecmp(argv[3], "stackmem")){
|
||||||
|
/*******************************************************************/
|
||||||
|
sng_mg_reg_info_show();
|
||||||
|
/*******************************************************************/
|
||||||
|
#ifdef LEAK_TEST
|
||||||
|
}else if(!strcasecmp(argv[3], "leak-report")){
|
||||||
|
/*******************************************************************/
|
||||||
|
mgPrntLeakReport();
|
||||||
|
/*******************************************************************/
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
stream->write_function(stream, "-ERR No such profile\n");
|
stream->write_function(stream, "-ERR No such profile\n");
|
||||||
@ -280,6 +292,7 @@ void megaco_cli_print_usage(switch_stream_handle_t *stream)
|
|||||||
stream->write_function(stream, "mg profile <profile-name> show activecalls \n");
|
stream->write_function(stream, "mg profile <profile-name> show activecalls \n");
|
||||||
stream->write_function(stream, "mg profile <profile-name> show termstatus <term-id> \n");
|
stream->write_function(stream, "mg profile <profile-name> show termstatus <term-id> \n");
|
||||||
stream->write_function(stream, "mg profile <profile-name> show alltermstatus \n");
|
stream->write_function(stream, "mg profile <profile-name> show alltermstatus \n");
|
||||||
|
stream->write_function(stream, "mg profile <profile-name> show stackmem \n");
|
||||||
|
|
||||||
stream->write_function(stream, "Usage: Logging \n");
|
stream->write_function(stream, "Usage: Logging \n");
|
||||||
stream->write_function(stream, "mg logging enable \n");
|
stream->write_function(stream, "mg logging enable \n");
|
||||||
|
@ -307,7 +307,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"descriptors[%d] found in-coming megaco request \n", desc->dl.num.val);
|
//switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"descriptors[%d] found in-coming megaco request \n", desc->dl.num.val);
|
||||||
|
|
||||||
if(NOTPRSNT == desc->dl.num.pres){
|
if(NOTPRSNT == desc->dl.num.pres){
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"No descriptor found in-coming megaco request \n");
|
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"No descriptor found in-coming megaco request \n");
|
||||||
@ -316,7 +316,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
|
|
||||||
|
|
||||||
for (descId = 0; descId < desc->dl.num.val; descId++) {
|
for (descId = 0; descId < desc->dl.num.val; descId++) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"descriptors[%d] type in-coming megaco request \n", desc->dl.descs[descId]->type.val);
|
//switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"descriptors[%d] type in-coming megaco request \n", desc->dl.descs[descId]->type.val);
|
||||||
switch (desc->dl.descs[descId]->type.val) {
|
switch (desc->dl.descs[descId]->type.val) {
|
||||||
case MGT_MEDIADESC:
|
case MGT_MEDIADESC:
|
||||||
{
|
{
|
||||||
@ -381,26 +381,26 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
case MGT_LCLCTL_MODE:
|
case MGT_LCLCTL_MODE:
|
||||||
{
|
{
|
||||||
/* Mode Property */
|
/* Mode Property */
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_MODE - Mode value [%d]\n", lclParm->u.mode.val);
|
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_MODE - Mode value [%d]\n", lclParm->u.mode.val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MGT_LCLCTL_RESVAL:
|
case MGT_LCLCTL_RESVAL:
|
||||||
{
|
{
|
||||||
/* Reserve Value */
|
/* Reserve Value */
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESVAL: Reserve Value[%d] \n", lclParm->u.resVal.val);
|
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESVAL: Reserve Value[%d] \n", lclParm->u.resVal.val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MGT_LCLCTL_RESGRP:
|
case MGT_LCLCTL_RESGRP:
|
||||||
{
|
{
|
||||||
/* Reserve group */
|
/* Reserve group */
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESGRP: Reserve Group[%d]\n", lclParm->u.resGrp.val);
|
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESGRP: Reserve Group[%d]\n", lclParm->u.resGrp.val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MGT_LCLCTL_PROPPARM:
|
case MGT_LCLCTL_PROPPARM:
|
||||||
{
|
{
|
||||||
/* Properties (of a termination) */
|
/* Properties (of a termination) */
|
||||||
/* Matt - See how we can apply this to a termination */
|
/* Matt - See how we can apply this to a termination */
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_PROPPARM: \n");
|
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_PROPPARM: \n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -597,7 +597,6 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
MgMgcoLocalDesc *local = NULL;
|
MgMgcoLocalDesc *local = NULL;
|
||||||
/*CmSdpInfoSet *psdp = NULL;*/
|
/*CmSdpInfoSet *psdp = NULL;*/
|
||||||
|
|
||||||
|
|
||||||
/* TODO - Kapil dummy line , will need to add with proper code */
|
/* TODO - Kapil dummy line , will need to add with proper code */
|
||||||
inc_med_desc = &cmd->dl.descs[0]->u.media;
|
inc_med_desc = &cmd->dl.descs[0]->u.media;
|
||||||
|
|
||||||
@ -771,6 +770,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
}else{
|
}else{
|
||||||
/* ADD request is for RTP term we need to create termination */
|
/* ADD request is for RTP term we need to create termination */
|
||||||
|
|
||||||
|
|
||||||
/* Grow the list of reply parameters */
|
/* Grow the list of reply parameters */
|
||||||
if (mgUtlGrowList((void ***)&rsp.u.mgCmdRsp[0]->u.add.termIdLst.terms, sizeof(MgMgcoTermId),
|
if (mgUtlGrowList((void ***)&rsp.u.mgCmdRsp[0]->u.add.termIdLst.terms, sizeof(MgMgcoTermId),
|
||||||
&rsp.u.mgCmdRsp[0]->u.add.termIdLst.num, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
|
&rsp.u.mgCmdRsp[0]->u.add.termIdLst.num, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
|
||||||
@ -781,6 +781,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
|
|
||||||
out_termId = rsp.u.mgCmdRsp[0]->u.add.termIdLst.terms[rsp.u.mgCmdRsp[0]->u.add.termIdLst.num.val-1];
|
out_termId = rsp.u.mgCmdRsp[0]->u.add.termIdLst.terms[rsp.u.mgCmdRsp[0]->u.add.termIdLst.num.val-1];
|
||||||
mg_fill_mgco_termid(out_termId, (char*)term->name, strlen((char*)term->name), &rsp.u.mgCmdRsp[0]->memCp);
|
mg_fill_mgco_termid(out_termId, (char*)term->name, strlen((char*)term->name), &rsp.u.mgCmdRsp[0]->memCp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_rtp){
|
if(is_rtp){
|
||||||
@ -796,6 +797,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* copy media descriptor */
|
/* copy media descriptor */
|
||||||
desc = rsp.u.mgCmdRsp[0]->u.add.audit.parms[rsp.u.mgCmdRsp[0]->u.add.audit.num.val-1];
|
desc = rsp.u.mgCmdRsp[0]->u.add.audit.parms[rsp.u.mgCmdRsp[0]->u.add.audit.num.val-1];
|
||||||
desc->type.pres = PRSNT_NODEF;
|
desc->type.pres = PRSNT_NODEF;
|
||||||
@ -812,6 +814,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* only for RTP */
|
/* 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(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)){
|
if(term->mg_error_code && (*term->mg_error_code == MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT)){
|
||||||
@ -821,6 +824,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(is_rtp){
|
if(is_rtp){
|
||||||
mg_build_sdp(desc, inc_med_desc, mg_profile, term, &rsp.u.mgCmdRsp[0]->memCp);
|
mg_build_sdp(desc, inc_med_desc, mg_profile, term, &rsp.u.mgCmdRsp[0]->memCp);
|
||||||
@ -1026,7 +1030,6 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
ret = sng_mgco_send_cmd( mg_profile->idx, &rsp);
|
ret = sng_mgco_send_cmd( mg_profile->idx, &rsp);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
/* sample resp code -- end */
|
/* sample resp code -- end */
|
||||||
/*************************************************************************************************************************/
|
/*************************************************************************************************************************/
|
||||||
@ -1038,7 +1041,6 @@ error:
|
|||||||
mg_build_mgco_err_request(&mgErr, txn_id, ctxtId, err_code, &errTxt)) {
|
mg_build_mgco_err_request(&mgErr, txn_id, ctxtId, err_code, &errTxt)) {
|
||||||
sng_mgco_send_err(mg_profile->idx, mgErr);
|
sng_mgco_send_err(mg_profile->idx, mgErr);
|
||||||
}
|
}
|
||||||
mg_free_cmd(inc_cmd);
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR," ADD Request failed..releasing context/termination(if allocated) \n");
|
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR," ADD Request failed..releasing context/termination(if allocated) \n");
|
||||||
if(mg_ctxt){
|
if(mg_ctxt){
|
||||||
megaco_release_context(mg_ctxt);
|
megaco_release_context(mg_ctxt);
|
||||||
@ -1322,7 +1324,6 @@ error:
|
|||||||
mg_build_mgco_err_request(&mgErr, txn_id, ctxtId, err_code, &errTxt)) {
|
mg_build_mgco_err_request(&mgErr, txn_id, ctxtId, err_code, &errTxt)) {
|
||||||
sng_mgco_send_err(mg_profile->idx, mgErr);
|
sng_mgco_send_err(mg_profile->idx, mgErr);
|
||||||
}
|
}
|
||||||
mg_free_cmd(inc_cmd);
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR," Modify Request failed..releasing context/termination \n");
|
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR," Modify Request failed..releasing context/termination \n");
|
||||||
if(mg_ctxt){
|
if(mg_ctxt){
|
||||||
@ -1538,7 +1539,6 @@ error:
|
|||||||
mg_build_mgco_err_request(&mgErr, txn_id, ctxtId, err_code, &errTxt)) {
|
mg_build_mgco_err_request(&mgErr, txn_id, ctxtId, err_code, &errTxt)) {
|
||||||
sng_mgco_send_err(mg_profile->idx, mgErr);
|
sng_mgco_send_err(mg_profile->idx, mgErr);
|
||||||
}
|
}
|
||||||
mg_free_cmd(inc_cmd);
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1973,8 +1973,6 @@ error:
|
|||||||
sng_mgco_send_err(mg_profile->idx, mgErr);
|
sng_mgco_send_err(mg_profile->idx, mgErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deallocate the msg */
|
|
||||||
mg_free_cmd(auditReq);
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2588,7 +2586,7 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_
|
|||||||
|
|
||||||
svc = &request.u.mgCmdReq[0]->cmd.u.svc;
|
svc = &request.u.mgCmdReq[0]->cmd.u.svc;
|
||||||
|
|
||||||
if(SWITCH_STATUS_FALSE == (ret = mg_fill_svc_change(&svc->parm, method, mg_service_change_reason[reason]))){
|
if(SWITCH_STATUS_FALSE == (ret = mg_fill_svc_change(&svc->parm, method, mg_service_change_reason[reason], &request.u.mgCmdReq[0]->memCp))){
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ switch_status_t handle_pkg_audit( SuId suId, MgMgcoCommand *auditReq);
|
|||||||
switch_status_t mg_build_pkg_desc(MgMgcoPkgsDesc* pkg);
|
switch_status_t mg_build_pkg_desc(MgMgcoPkgsDesc* pkg);
|
||||||
switch_status_t mg_send_heartbeat_audit_rsp( SuId suId, MgMgcoCommand *auditReq);
|
switch_status_t mg_send_heartbeat_audit_rsp( SuId suId, MgMgcoCommand *auditReq);
|
||||||
void mg_get_time_stamp(MgMgcoTimeStamp *timeStamp);
|
void mg_get_time_stamp(MgMgcoTimeStamp *timeStamp);
|
||||||
switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, const char *reason);
|
switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, const char *reason,CmMemListCp *memCp);
|
||||||
void mg_fill_null_context(MgMgcoContextId* ctxt);
|
void mg_fill_null_context(MgMgcoContextId* ctxt);
|
||||||
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason,uint8_t wild);
|
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason,uint8_t wild);
|
||||||
switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType);
|
switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType);
|
||||||
|
@ -218,6 +218,7 @@ void handle_mg_alarm(Pst *pst, MgMngmt *usta)
|
|||||||
case LMG_EVENT_PEER_ENABLED:
|
case LMG_EVENT_PEER_ENABLED:
|
||||||
{
|
{
|
||||||
len = len + sprintf(prBuf+len, "gateway enabled");
|
len = len + sprintf(prBuf+len, "gateway enabled");
|
||||||
|
|
||||||
/* gateway enabled now we can send termination service change for all terminations */
|
/* gateway enabled now we can send termination service change for all terminations */
|
||||||
mgco_init_ins_service_change( usta->t.usta.alarmInfo.sapId );
|
mgco_init_ins_service_change( usta->t.usta.alarmInfo.sapId );
|
||||||
break;
|
break;
|
||||||
|
@ -15,8 +15,8 @@ switch_status_t mg_stack_alloc_mem( Ptr* _memPtr, Size _memSize )
|
|||||||
{
|
{
|
||||||
Mem sMem;
|
Mem sMem;
|
||||||
|
|
||||||
sMem.region = 0;
|
sMem.region = S_REG;
|
||||||
sMem.pool = 0;
|
sMem.pool = S_POOL;
|
||||||
|
|
||||||
if ( _memSize <= 0 )
|
if ( _memSize <= 0 )
|
||||||
{
|
{
|
||||||
@ -119,8 +119,8 @@ S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, C
|
|||||||
termId->name.pres.pres = PRSNT_NODEF;
|
termId->name.pres.pres = PRSNT_NODEF;
|
||||||
termId->name.lcl.pres = PRSNT_NODEF;
|
termId->name.lcl.pres = PRSNT_NODEF;
|
||||||
termId->name.lcl.len = term_len;
|
termId->name.lcl.len = term_len;
|
||||||
/*MG_GETMEM(termId->name.lcl.val, termId->name.lcl.len , memCp, ret);*/
|
MG_GETMEM(termId->name.lcl.val, termId->name.lcl.len , memCp, ret);
|
||||||
ret = mg_stack_alloc_mem((Ptr*)&termId->name.lcl.val,term_len);
|
//ret = mg_stack_alloc_mem((Ptr*)&termId->name.lcl.val,term_len);
|
||||||
|
|
||||||
if( ret != ROK)
|
if( ret != ROK)
|
||||||
RETVALUE(ret);
|
RETVALUE(ret);
|
||||||
@ -1554,8 +1554,9 @@ MgMgcoMediaDesc* get_default_media_desc(megaco_profile_t* mg_profile, MgMgcoTerm
|
|||||||
}
|
}
|
||||||
/*****************************************************************************************************************************/
|
/*****************************************************************************************************************************/
|
||||||
|
|
||||||
switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, const char *reason)
|
switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, const char *reason, CmMemListCp *memCp)
|
||||||
{
|
{
|
||||||
|
S16 ret = ROK;
|
||||||
MG_SET_TKN_VAL_PRES(&srvPar->pres, 0, PRSNT_NODEF);
|
MG_SET_TKN_VAL_PRES(&srvPar->pres, 0, PRSNT_NODEF);
|
||||||
MG_SET_TKN_VAL_PRES(&srvPar->meth.pres, 0, PRSNT_NODEF);
|
MG_SET_TKN_VAL_PRES(&srvPar->meth.pres, 0, PRSNT_NODEF);
|
||||||
MG_SET_TKN_VAL_PRES(&srvPar->meth.type, method, PRSNT_NODEF);
|
MG_SET_TKN_VAL_PRES(&srvPar->meth.type, method, PRSNT_NODEF);
|
||||||
@ -1564,7 +1565,7 @@ switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, c
|
|||||||
srvPar->reason.pres = PRSNT_NODEF;
|
srvPar->reason.pres = PRSNT_NODEF;
|
||||||
srvPar->reason.len = cmStrlen((const U8 *)reason);
|
srvPar->reason.len = cmStrlen((const U8 *)reason);
|
||||||
|
|
||||||
mg_stack_alloc_mem((Ptr*)&srvPar->reason.val, srvPar->reason.len);
|
MG_GETMEM(srvPar->reason.val, srvPar->reason.len , memCp, ret);
|
||||||
if (NULL == srvPar->reason.val)
|
if (NULL == srvPar->reason.val)
|
||||||
{
|
{
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "failed, memory alloc\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "failed, memory alloc\n");
|
||||||
|
@ -475,8 +475,10 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
|
|||||||
int count;
|
int count;
|
||||||
int err_code;
|
int err_code;
|
||||||
megaco_profile_t* mg_profile;
|
megaco_profile_t* mg_profile;
|
||||||
|
char prnt_buf[128];
|
||||||
|
|
||||||
memset(&out_ctxt,0,sizeof(out_ctxt));
|
memset(&out_ctxt,0,sizeof(out_ctxt));
|
||||||
|
memset(&prnt_buf,0,sizeof(prnt_buf));
|
||||||
|
|
||||||
inc_context = &cmd->contextId;
|
inc_context = &cmd->contextId;
|
||||||
memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId));
|
memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId));
|
||||||
@ -486,7 +488,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
|
|||||||
|
|
||||||
/*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))){
|
||||||
goto error1;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* first thing - restart ito timer */
|
/* first thing - restart ito timer */
|
||||||
@ -555,7 +557,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
|
|||||||
(MGT_TERMID_OTHER == termId->type.val) &&
|
(MGT_TERMID_OTHER == termId->type.val) &&
|
||||||
(MGT_AUDITVAL != cmd->u.mgCmdInd[0]->cmd.type.val)){
|
(MGT_AUDITVAL != cmd->u.mgCmdInd[0]->cmd.type.val)){
|
||||||
if(SWITCH_STATUS_FALSE == mg_stack_termination_is_in_service(mg_profile, (char*)termId->name.lcl.val, termId->name.lcl.len)){
|
if(SWITCH_STATUS_FALSE == mg_stack_termination_is_in_service(mg_profile, (char*)termId->name.lcl.val, termId->name.lcl.len)){
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Termination[%s] not in service \n", (char*)termId->name.lcl.val);
|
snprintf(prnt_buf,termId->name.lcl.len,"%s",(char*)termId->name.lcl.val);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Termination[%s] not in service \n",(strlen(prnt_buf))?prnt_buf:"NULL");
|
||||||
mg_util_set_term_string(&errTxt, termId);
|
mg_util_set_term_string(&errTxt, termId);
|
||||||
err_code = MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID;
|
err_code = MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID;
|
||||||
goto error;
|
goto error;
|
||||||
@ -591,7 +594,6 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
|
|||||||
|
|
||||||
/*mgAccEvntPrntMgMgcoCommand(cmd, stdout);*/
|
/*mgAccEvntPrntMgMgcoCommand(cmd, stdout);*/
|
||||||
|
|
||||||
|
|
||||||
switch(cmd->cmdType.val)
|
switch(cmd->cmdType.val)
|
||||||
{
|
{
|
||||||
case CH_CMD_TYPE_IND:
|
case CH_CMD_TYPE_IND:
|
||||||
@ -789,7 +791,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
|
|||||||
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
|
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
goto done;
|
||||||
|
|
||||||
ctxt_error:
|
ctxt_error:
|
||||||
err_code = MGT_MGCO_RSP_CODE_UNKNOWN_CTXT;
|
err_code = MGT_MGCO_RSP_CODE_UNKNOWN_CTXT;
|
||||||
@ -802,8 +804,12 @@ error:
|
|||||||
if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val){
|
if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val){
|
||||||
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
|
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
|
||||||
}
|
}
|
||||||
error1:
|
done:
|
||||||
mg_free_cmd(cmd);
|
if(CH_CMD_TYPE_IND == cmd->cmdType.val){
|
||||||
|
mg_free_cmd(cmd->u.mgCmdReq[0]);
|
||||||
|
}else if(CH_CMD_TYPE_CFM == cmd->cmdType.val){
|
||||||
|
mg_free_cmd(cmd->u.mgCmdCfm[0]);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,6 +828,8 @@ void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* txn_sta_ind)
|
|||||||
|
|
||||||
/*dump information*/
|
/*dump information*/
|
||||||
mgAccEvntPrntMgMgcoInd(txn_sta_ind, stdout);
|
mgAccEvntPrntMgMgcoInd(txn_sta_ind, stdout);
|
||||||
|
|
||||||
|
mg_free_cmd(txn_sta_ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************************************************************/
|
/*****************************************************************************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user