void megaco_cli_print_usage(switch_stream_handle_t *stream);
switch_status_t handle_show_activecalls_cli_cmd(switch_stream_handle_t *stream, megaco_profile_t* mg_profile);
switch_status_t handle_show_stats(switch_stream_handle_t *stream, megaco_profile_t* mg_profile);
+switch_status_t handle_show_stack_mem(switch_stream_handle_t *stream);
/******************************************************************************/
}else if (!strcmp(argv[2], "show")) {
/**********************************************************************************/
/* mg <mg-profile> show activecalls*/
+
if(zstr(argv[3])) {
goto usage;
}
}else if(!strcasecmp(argv[3], "stackmem")){
/*******************************************************************/
megaco_profile_release(profile);
- sng_mg_reg_info_show();
+ handle_show_stack_mem(stream);
/*******************************************************************/
#ifdef LEAK_TEST
}else if(!strcasecmp(argv[3], "leak-report")){
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 stackmem \n");
+ stream->write_function(stream, "mg profile <profile-name> show stats \n");
stream->write_function(stream, "Usage: Logging \n");
stream->write_function(stream, "mg logging enable \n");
+ return SWITCH_STATUS_SUCCESS;
+}
+/******************************************************************************/
+switch_status_t handle_show_stack_mem(switch_stream_handle_t *stream)
+{
+ U32 availMem = 0;
+ char buffer[4098];
+
+ memset(buffer,0,sizeof(buffer));
+
+ SGetMemInfoBuffer(S_REG, &availMem, buffer);
+
+ stream->write_function(stream, "%s",buffer);
+
return SWITCH_STATUS_SUCCESS;
}
/******************************************************************************/
mg_context_t* mg_ctxt;
int mediaId;
MgMgcoLocalDesc *local = NULL;
+ char term_name[128];
/*CmSdpInfoSet *psdp = NULL;*/
- /* TODO - Kapil dummy line , will need to add with proper code */
+ memset(&term_name,0,sizeof(term_name));
+
inc_med_desc = &cmd->dl.descs[0]->u.media;
/********************************************************************/
ctxtId = &inc_cmd->contextId;
termLst = mg_get_term_id_list(inc_cmd);
termId = termLst->terms[0];
- /* For Matt - termId->name.lcl.val - to get the termination id name */
+ MG_MEM_COPY(&term_name, termId->name.lcl.val, sizeof(U8) * termId->name.lcl.len);
+
/********************************************************************/
/* Validating ADD request *******************************************/
/********************************************************************/
}else{ /* Physical termination */
- term = megaco_find_termination(mg_profile, (char*)termId->name.lcl.val);
+ term = megaco_find_termination(mg_profile, term_name);
mg_profile->mg_stats->total_num_of_phy_add_recvd++;
if(NULL == term){
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- " megaco_find_termination failed for term-id[%s] \n",(char*)termId->name.lcl.val);
+ " megaco_find_termination failed for term-id[%s] \n", term_name);
mg_util_set_err_string(&errTxt, " Resource Failure ");
err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR;
goto error;
int mediaId;
/*MgMgcoAmmReq *cmd = &inc_cmd->u.mgCmdInd[0]->cmd.u.mod;*/
U32 txn_id = inc_cmd->transId.val;
+ char term_name[128];
+
+ memset(&term_name,0,sizeof(term_name));
/********************************************************************/
ctxtId = &inc_cmd->contextId;
termLst = mg_get_term_id_list(inc_cmd);
termId = termLst->terms[0];
- /* For Matt - termId->name.lcl.val - to get the termination id name */
+
+ MG_MEM_COPY(&term_name, termId->name.lcl.val, sizeof(U8) * termId->name.lcl.len);
/********************************************************************/
/* Validation *******************************************/
termId->name.lcl.val, ctxtId->type.val, ctxtId->val.val);
#endif
- term = megaco_find_termination(mg_profile, (char*)termId->name.lcl.val);
+ term = megaco_find_termination(mg_profile, term_name);
if(NULL == term){
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
mg_context_t* mg_ctxt = NULL;
mg_termination_t* term = NULL;
uint8_t wild = 0x00;
+ char term_name[128];
+ memset(&term_name,0,sizeof(term_name));
wild = inc_cmd->u.mgCmdReq[0]->wild.pres;
ctxtId = &inc_cmd->contextId;
termLst = mg_get_term_id_list(inc_cmd);
termId = termLst->terms[0];
+ MG_MEM_COPY(&term_name, termId->name.lcl.val, sizeof(U8) * termId->name.lcl.len);
mg_profile->mg_stats->total_num_of_sub_recvd++;
}else if(MGT_TERMID_OTHER == termId->type.val){
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," SUB Request for termination[%s] \n", (char*)termId->name.lcl.val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," SUB Request for termination[%s] \n", term_name);
- term = megaco_find_termination(mg_profile, (char*)termId->name.lcl.val);
+ term = megaco_find_termination(mg_profile, term_name);
if(NULL == term){
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "Subtract request Failed, no termination found for input term string[%s] \n", (char*)termId->name.lcl.val);
+ "Subtract request Failed, no termination found for input term string[%s] \n", term_name);
mg_util_set_term_string(&errTxt,termId);
err_code = MGT_MGCO_RSP_CODE_UNKNOWN_TERM_ID;
goto error;
mg_termination_t* term = NULL;
term = megaco_find_termination(mg_profile, term_str);
+
if(term && MG_TERM_RTP == term->type) {
return SWITCH_STATUS_SUCCESS;
- }else if(term && (MG_TERM_TDM == term->type) &&
- switch_test_flag(term, MG_IN_SERVICE)){
- return SWITCH_STATUS_SUCCESS;
+ }else if(term && (MG_TERM_TDM == term->type)){
+ if(switch_test_flag(term, MG_IN_SERVICE)){
+ return SWITCH_STATUS_SUCCESS;
+ }else{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " Term[%s] not in service\n", term_str);
+ return SWITCH_STATUS_FALSE;
+ }
} else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Failed to find term for term string[%s]\n", term_str);
return SWITCH_STATUS_FALSE;
}
}