]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding enable/disable MEGACO stack looging CLI command
authorkapil <kgupta@sangoma.com>
Tue, 19 Jun 2012 11:30:39 +0000 (17:00 +0530)
committerkapil <kgupta@sangoma.com>
Tue, 19 Jun 2012 11:30:39 +0000 (17:00 +0530)
src/mod/endpoints/mod_media_gateway/media_gateway_cli.c
src/mod/endpoints/mod_media_gateway/media_gateway_stack.c
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h
src/mod/endpoints/mod_media_gateway/mod_media_gateway.c
src/mod/endpoints/mod_media_gateway/mod_media_gateway.h

index db50feaa57971449bc21cc7ecee1ecead708dfb6..720032673c1d843a53be5df3d9ed7dc577413bc2 100644 (file)
@@ -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);
index abe46a5837e23b69602ac69892c5ce79f175ec5f..d4717501ce457047315f6604ce6a1b46c8521734 100644 (file)
@@ -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)
 {
index ac5b911f9bf925939c13de2c12ffa15648a0dd14..9bbe90b7df9d1ad075c626618f43bdd43528e128 100644 (file)
@@ -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);
index 58a8794fad22c5bd4cccb6f28090d8fd12789be4..322dbd422114c20da3e43b717916ba88a1312ac8 100644 (file)
@@ -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);
 
 
index c55bb6744f92375039051df956e3141393512efe..2e0db8cb62e892d9714ce0c6c3f8ea6ed4f3f40f 100644 (file)
@@ -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 {