[asterisk-commits] oej: branch oej/rana-manager-debug-1.4 r335257 - /team/oej/rana-manager-debug...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 12 04:27:08 CDT 2011


Author: oej
Date: Mon Sep 12 04:27:04 2011
New Revision: 335257

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=335257
Log:
Add CLI command to turn on/off manager action debug (thanks Leifmadsen for the feedback)

Modified:
    team/oej/rana-manager-debug-1.4/main/manager.c

Modified: team/oej/rana-manager-debug-1.4/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/rana-manager-debug-1.4/main/manager.c?view=diff&rev=335257&r1=335256&r2=335257
==============================================================================
--- team/oej/rana-manager-debug-1.4/main/manager.c (original)
+++ team/oej/rana-manager-debug-1.4/main/manager.c Mon Sep 12 04:27:04 2011
@@ -571,6 +571,30 @@
 	ast_mutex_unlock(&s->session->__lock);
 }
 
+static int handle_debug_on(int fd, int argc, char *argv[])
+{
+
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+	
+	ast_cli(fd, "AMI Action Debugging %senabled\n", debug_actions ? "re-" : "");
+
+	debug_actions = 1;
+
+	return RESULT_SUCCESS;
+}
+
+static int handle_debug_off(int fd, int argc, char *argv[])
+{
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+	
+	debug_actions = 0;
+	ast_cli(fd, "AMI Action Debugging disabled\n");
+
+	return RESULT_SUCCESS;
+}
+
 static int handle_showmancmd(int fd, int argc, char *argv[])
 {
 	struct manager_action *cur;
@@ -725,6 +749,10 @@
 "Usage: manager show commands\n"
 "	Prints a listing of all the available Asterisk manager interface commands.\n";
 
+static char man_debug_help[] = 
+"Usage: manager debug on|off\n"
+"	Turns on or off manager action output in the Asterisk CLI.\n";
+
 static char showmanconn_help[] = 
 "Usage: manager show connected\n"
 "	Prints a listing of the users that are currently connected to the\n"
@@ -765,9 +793,13 @@
 	NULL };
 
 static struct ast_cli_entry cli_manager[] = {
-	{ { "manager", "show", "command", NULL },
-	handle_showmancmd, "Show a manager interface command",
-	showmancmd_help, complete_show_mancmd, &cli_show_manager_command_deprecated },
+	{ { "manager", "debug", "on", NULL },
+	handle_debug_on, "Turn manager debug output in the CLI on",
+	man_debug_help, NULL, NULL },
+
+	{ { "manager", "debug", "off", NULL },
+	handle_debug_off, "Turn manager debug output in the CLI off",
+	man_debug_help, NULL, NULL },
 
 	{ { "manager", "show", "commands", NULL },
 	handle_showmancmds, "List manager interface commands",




More information about the asterisk-commits mailing list