adding enable/disable MEGACO stack looging CLI command
This commit is contained in:
parent
0a9f34aa09
commit
743e91569e
|
@ -99,12 +99,35 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||
/**********************************************************************************/
|
||||
goto usage;
|
||||
}
|
||||
/**********************************************************************************/
|
||||
}else if (!strcmp(argv[0], "logging")) {
|
||||
/**********************************************************************************/
|
||||
if (zstr(argv[1])) {
|
||||
goto usage;
|
||||
}
|
||||
/******************************************************************/
|
||||
if(!strcasecmp(argv[1], "enable")){
|
||||
mg_enable_logging();
|
||||
/******************************************************************/
|
||||
}else if(!strcasecmp(argv[1], "disable")){
|
||||
/******************************************************************/
|
||||
mg_disable_logging();
|
||||
/******************************************************************/
|
||||
} else {
|
||||
/******************************************************************/
|
||||
goto usage;
|
||||
}
|
||||
/**********************************************************************************/
|
||||
}else {
|
||||
/**********************************************************************************/
|
||||
goto usage;
|
||||
}
|
||||
/**********************************************************************************/
|
||||
|
||||
goto done;
|
||||
|
||||
usage:
|
||||
stream->write_function(stream, "-ERR Usage: "MEGACO_FUNCTION_SYNTAX"\n");
|
||||
stream->write_function(stream, "-ERR Usage: \n""\t"MEGACO_CLI_SYNTAX" \n \t"MEGACO_FUNCTION_SYNTAX"\n \t" MEGACO_LOGGING_CLI_SYNTAX "\n");
|
||||
|
||||
done:
|
||||
switch_safe_free(dup);
|
||||
|
|
|
@ -19,7 +19,6 @@ int mgco_mu_gen_config(void);
|
|||
int mgco_tucl_gen_config(void);
|
||||
int mgco_mu_ssap_config(int idx);
|
||||
int mgco_mg_tsap_config(megaco_profile_t* profile);
|
||||
int mgco_mg_enble_debug(void);
|
||||
int mgco_mg_ssap_config(megaco_profile_t* profile);
|
||||
int mgco_mg_peer_config(megaco_profile_t* profile);
|
||||
int mgco_mg_tpt_server_config(megaco_profile_t* profile);
|
||||
|
@ -571,7 +570,7 @@ int mgco_mg_ssap_cntrl(int idx)
|
|||
}
|
||||
/******************************************************************************/
|
||||
|
||||
int mgco_mg_enble_debug()
|
||||
int mg_enable_logging()
|
||||
{
|
||||
MgMngmt mgMngmt;
|
||||
Pst pst; /* Post for layer manager */
|
||||
|
@ -597,6 +596,33 @@ int mgco_mg_enble_debug()
|
|||
return(sng_cntrl_mg(&pst, &mgMngmt));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int mg_disable_logging()
|
||||
{
|
||||
MgMngmt mgMngmt;
|
||||
Pst pst; /* Post for layer manager */
|
||||
MgCntrl* cntrl;
|
||||
|
||||
memset(&mgMngmt, 0, sizeof(mgMngmt));
|
||||
cntrl = &mgMngmt.t.cntrl;
|
||||
|
||||
/* initalize the post structure */
|
||||
smPstInit(&pst);
|
||||
|
||||
/* insert the destination Entity */
|
||||
pst.dstEnt = ENTMG;
|
||||
mgMngmt.hdr.msgType = TCFG;
|
||||
mgMngmt.hdr.entId.ent = ENTHI;
|
||||
mgMngmt.hdr.entId.inst = S_INST;
|
||||
mgMngmt.hdr.elmId.elmnt = STGEN;
|
||||
|
||||
cntrl->action = ADISIMM;
|
||||
cntrl->subAction = SADBG;
|
||||
cntrl->s.dbg.genDbgMask = 0xfffffdff;
|
||||
|
||||
return(sng_cntrl_mg(&pst, &mgMngmt));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int mgco_tucl_gen_config(void)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,8 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg);
|
|||
void handle_mgco_audit_cfm(Pst *pst, SuId suId, MgMgtAudit* audit, Reason reason);
|
||||
void handle_mg_alarm(Pst *pst, MgMngmt *sta);
|
||||
void handle_tucl_alarm(Pst *pst, HiMngmt *sta);
|
||||
int mg_enable_logging(void);
|
||||
int mg_disable_logging(void);
|
||||
|
||||
|
||||
switch_status_t sng_mgco_cfg(megaco_profile_t* profile);
|
||||
|
|
|
@ -73,6 +73,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_media_gateway_load)
|
|||
switch_console_set_complete("add megaco profile ::megaco::list_profiles status");
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles xmlstatus");
|
||||
switch_console_set_complete("add megaco profile ::megaco::list_profiles peerxmlstatus");
|
||||
switch_console_set_complete("add megaco logging ::megaco::list_profiles enable");
|
||||
switch_console_set_complete("add megaco logging ::megaco::list_profiles disable");
|
||||
switch_console_add_complete_func("::megaco::list_profiles", list_profiles);
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#define MG_MAX_PEERS 5
|
||||
|
||||
#define MEGACO_CLI_SYNTAX "profile|logging"
|
||||
#define MEGACO_LOGGING_CLI_SYNTAX "logging [enable|disable]"
|
||||
#define MEGACO_FUNCTION_SYNTAX "profile [name] [start | stop] [status] [xmlstatus] [peerxmlstatus]"
|
||||
|
||||
struct megaco_globals {
|
||||
|
|
Loading…
Reference in New Issue