提交 743e9156 authored 作者: kapil's avatar kapil

adding enable/disable MEGACO stack looging CLI command

上级 0a9f34aa
...@@ -99,12 +99,35 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre ...@@ -99,12 +99,35 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
/**********************************************************************************/ /**********************************************************************************/
goto usage; 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; goto done;
usage: 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: done:
switch_safe_free(dup); switch_safe_free(dup);
......
...@@ -19,7 +19,6 @@ int mgco_mu_gen_config(void); ...@@ -19,7 +19,6 @@ int mgco_mu_gen_config(void);
int mgco_tucl_gen_config(void); int mgco_tucl_gen_config(void);
int mgco_mu_ssap_config(int idx); int mgco_mu_ssap_config(int idx);
int mgco_mg_tsap_config(megaco_profile_t* profile); 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_ssap_config(megaco_profile_t* profile);
int mgco_mg_peer_config(megaco_profile_t* profile); int mgco_mg_peer_config(megaco_profile_t* profile);
int mgco_mg_tpt_server_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) ...@@ -571,7 +570,7 @@ int mgco_mg_ssap_cntrl(int idx)
} }
/******************************************************************************/ /******************************************************************************/
int mgco_mg_enble_debug() int mg_enable_logging()
{ {
MgMngmt mgMngmt; MgMngmt mgMngmt;
Pst pst; /* Post for layer manager */ Pst pst; /* Post for layer manager */
...@@ -597,6 +596,33 @@ int mgco_mg_enble_debug() ...@@ -597,6 +596,33 @@ int mgco_mg_enble_debug()
return(sng_cntrl_mg(&pst, &mgMngmt)); 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) int mgco_tucl_gen_config(void)
{ {
......
...@@ -53,6 +53,8 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg); ...@@ -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_mgco_audit_cfm(Pst *pst, SuId suId, MgMgtAudit* audit, Reason reason);
void handle_mg_alarm(Pst *pst, MgMngmt *sta); void handle_mg_alarm(Pst *pst, MgMngmt *sta);
void handle_tucl_alarm(Pst *pst, HiMngmt *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); switch_status_t sng_mgco_cfg(megaco_profile_t* profile);
......
...@@ -73,6 +73,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_media_gateway_load) ...@@ -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 status");
switch_console_set_complete("add megaco profile ::megaco::list_profiles xmlstatus"); 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 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); switch_console_add_complete_func("::megaco::list_profiles", list_profiles);
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#define MG_MAX_PEERS 5 #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]" #define MEGACO_FUNCTION_SYNTAX "profile [name] [start | stop] [status] [xmlstatus] [peerxmlstatus]"
struct megaco_globals { struct megaco_globals {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论