mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-16 11:52:01 +00:00
fixing minor issues observed during load testing
This commit is contained in:
parent
9c35f46edd
commit
3424380630
@ -21,6 +21,7 @@ void get_peer_xml_buffer(char* prntBuf, MgPeerSta* cfm);
|
|||||||
void megaco_cli_print_usage(switch_stream_handle_t *stream);
|
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_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_stats(switch_stream_handle_t *stream, megaco_profile_t* mg_profile);
|
||||||
|
switch_status_t handle_show_stack_mem(switch_stream_handle_t *stream);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@ -194,6 +195,7 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||||||
}else if (!strcmp(argv[2], "show")) {
|
}else if (!strcmp(argv[2], "show")) {
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
/* mg <mg-profile> show activecalls*/
|
/* mg <mg-profile> show activecalls*/
|
||||||
|
|
||||||
if(zstr(argv[3])) {
|
if(zstr(argv[3])) {
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
@ -228,7 +230,7 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||||||
}else if(!strcasecmp(argv[3], "stackmem")){
|
}else if(!strcasecmp(argv[3], "stackmem")){
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
megaco_profile_release(profile);
|
megaco_profile_release(profile);
|
||||||
sng_mg_reg_info_show();
|
handle_show_stack_mem(stream);
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
#ifdef LEAK_TEST
|
#ifdef LEAK_TEST
|
||||||
}else if(!strcasecmp(argv[3], "leak-report")){
|
}else if(!strcasecmp(argv[3], "leak-report")){
|
||||||
@ -305,6 +307,7 @@ void megaco_cli_print_usage(switch_stream_handle_t *stream)
|
|||||||
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, "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, "Usage: Logging \n");
|
||||||
stream->write_function(stream, "mg logging enable \n");
|
stream->write_function(stream, "mg logging enable \n");
|
||||||
@ -913,6 +916,20 @@ switch_status_t handle_show_stats(switch_stream_handle_t *stream, megaco_profile
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -595,16 +595,19 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
mg_context_t* mg_ctxt;
|
mg_context_t* mg_ctxt;
|
||||||
int mediaId;
|
int mediaId;
|
||||||
MgMgcoLocalDesc *local = NULL;
|
MgMgcoLocalDesc *local = NULL;
|
||||||
|
char term_name[128];
|
||||||
/*CmSdpInfoSet *psdp = NULL;*/
|
/*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;
|
inc_med_desc = &cmd->dl.descs[0]->u.media;
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
ctxtId = &inc_cmd->contextId;
|
ctxtId = &inc_cmd->contextId;
|
||||||
termLst = mg_get_term_id_list(inc_cmd);
|
termLst = mg_get_term_id_list(inc_cmd);
|
||||||
termId = termLst->terms[0];
|
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 *******************************************/
|
/* Validating ADD request *******************************************/
|
||||||
@ -683,13 +686,13 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
|
|||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
}else{ /* Physical termination */
|
}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++;
|
mg_profile->mg_stats->total_num_of_phy_add_recvd++;
|
||||||
|
|
||||||
if(NULL == term){
|
if(NULL == term){
|
||||||
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
|
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_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 ");
|
mg_util_set_err_string(&errTxt, " Resource Failure ");
|
||||||
err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR;
|
err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR;
|
||||||
goto error;
|
goto error;
|
||||||
@ -904,12 +907,16 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
|
|||||||
int mediaId;
|
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;
|
||||||
|
char term_name[128];
|
||||||
|
|
||||||
|
memset(&term_name,0,sizeof(term_name));
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
ctxtId = &inc_cmd->contextId;
|
ctxtId = &inc_cmd->contextId;
|
||||||
termLst = mg_get_term_id_list(inc_cmd);
|
termLst = mg_get_term_id_list(inc_cmd);
|
||||||
termId = termLst->terms[0];
|
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 *******************************************/
|
/* Validation *******************************************/
|
||||||
@ -964,7 +971,7 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
|
|||||||
termId->name.lcl.val, ctxtId->type.val, ctxtId->val.val);
|
termId->name.lcl.val, ctxtId->type.val, ctxtId->val.val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
term = megaco_find_termination(mg_profile, (char*)termId->name.lcl.val);
|
term = megaco_find_termination(mg_profile, term_name);
|
||||||
|
|
||||||
if(NULL == term){
|
if(NULL == term){
|
||||||
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
|
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
|
||||||
@ -1200,7 +1207,9 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
|
|||||||
mg_context_t* mg_ctxt = NULL;
|
mg_context_t* mg_ctxt = NULL;
|
||||||
mg_termination_t* term = NULL;
|
mg_termination_t* term = NULL;
|
||||||
uint8_t wild = 0x00;
|
uint8_t wild = 0x00;
|
||||||
|
char term_name[128];
|
||||||
|
|
||||||
|
memset(&term_name,0,sizeof(term_name));
|
||||||
wild = inc_cmd->u.mgCmdReq[0]->wild.pres;
|
wild = inc_cmd->u.mgCmdReq[0]->wild.pres;
|
||||||
|
|
||||||
|
|
||||||
@ -1208,6 +1217,7 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
|
|||||||
ctxtId = &inc_cmd->contextId;
|
ctxtId = &inc_cmd->contextId;
|
||||||
termLst = mg_get_term_id_list(inc_cmd);
|
termLst = mg_get_term_id_list(inc_cmd);
|
||||||
termId = termLst->terms[0];
|
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++;
|
mg_profile->mg_stats->total_num_of_sub_recvd++;
|
||||||
|
|
||||||
@ -1277,14 +1287,14 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
|
|||||||
|
|
||||||
}else if(MGT_TERMID_OTHER == termId->type.val){
|
}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){
|
if(NULL == term){
|
||||||
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
|
mg_profile->mg_stats->total_num_of_find_term_failed_error++;
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_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);
|
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;
|
||||||
|
@ -86,12 +86,18 @@ switch_status_t mg_stack_termination_is_in_service(megaco_profile_t* mg_profile,
|
|||||||
mg_termination_t* term = NULL;
|
mg_termination_t* term = NULL;
|
||||||
term = megaco_find_termination(mg_profile, term_str);
|
term = megaco_find_termination(mg_profile, term_str);
|
||||||
|
|
||||||
|
|
||||||
if(term && MG_TERM_RTP == term->type) {
|
if(term && MG_TERM_RTP == term->type) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}else if(term && (MG_TERM_TDM == term->type) &&
|
}else if(term && (MG_TERM_TDM == term->type)){
|
||||||
switch_test_flag(term, MG_IN_SERVICE)){
|
if(switch_test_flag(term, MG_IN_SERVICE)){
|
||||||
return SWITCH_STATUS_SUCCESS;
|
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 {
|
} 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;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,8 +556,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
|
|||||||
if ((CH_CMD_TYPE_IND == cmd->cmdType.val) &&
|
if ((CH_CMD_TYPE_IND == cmd->cmdType.val) &&
|
||||||
(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)){
|
|
||||||
MG_MEM_COPY(&prnt_buf, termId->name.lcl.val, sizeof(U8) * termId->name.lcl.len);
|
MG_MEM_COPY(&prnt_buf, termId->name.lcl.val, sizeof(U8) * termId->name.lcl.len);
|
||||||
|
if(SWITCH_STATUS_FALSE == mg_stack_termination_is_in_service(mg_profile, prnt_buf, strlen(prnt_buf))){
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Termination[%s] not in service \n",(strlen(prnt_buf))?prnt_buf:"NULL");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Termination[%s] not in service \n",(strlen(prnt_buf))?prnt_buf:"NULL");
|
||||||
mg_profile->mg_stats->total_num_of_term_not_in_service_error++;
|
mg_profile->mg_stats->total_num_of_term_not_in_service_error++;
|
||||||
mg_util_set_term_string(&errTxt, termId);
|
mg_util_set_term_string(&errTxt, termId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user