[asterisk-commits] oej: branch oej/rana-manager-debug-1.8 r334684 - in /team/oej/rana-manager-de...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 7 08:44:50 CDT 2011


Author: oej
Date: Wed Sep  7 08:44:46 2011
New Revision: 334684

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334684
Log:
Patch to add "manager debug" to get manager actions in the console

With this patch we can actually have a chance of understanding what's going on in our dear
little sweet PBX.
--Denna och nedanstående rader kommer inte med i loggmeddelandet--

M    main/manager.c
M    configs/manager.conf.sample

Modified:
    team/oej/rana-manager-debug-1.8/configs/manager.conf.sample
    team/oej/rana-manager-debug-1.8/main/manager.c

Modified: team/oej/rana-manager-debug-1.8/configs/manager.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/rana-manager-debug-1.8/configs/manager.conf.sample?view=diff&rev=334684&r1=334683&r2=334684
==============================================================================
--- team/oej/rana-manager-debug-1.8/configs/manager.conf.sample (original)
+++ team/oej/rana-manager-debug-1.8/configs/manager.conf.sample Wed Sep  7 08:44:46 2011
@@ -45,7 +45,10 @@
 ;                               ; The default is yes.
 ;
 ;displayconnects = yes
-;
+
+; Show manager Actions received in the Asterisk CLI. Defaults to off.
+;debugactions = yes
+
 ; Add a Unix epoch timestamp to events (not action responses)
 ;
 ;timestampevents = yes

Modified: team/oej/rana-manager-debug-1.8/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/rana-manager-debug-1.8/main/manager.c?view=diff&rev=334684&r1=334683&r2=334684
==============================================================================
--- team/oej/rana-manager-debug-1.8/main/manager.c (original)
+++ team/oej/rana-manager-debug-1.8/main/manager.c Wed Sep  7 08:44:46 2011
@@ -870,6 +870,7 @@
 static const int DEFAULT_TIMESTAMPEVENTS	= 0;	/*!< Default setting for timestampevents */	
 static const int DEFAULT_HTTPTIMEOUT 		= 60;	/*!< Default manager http timeout */
 static const int DEFAULT_BROKENEVENTSACTION	= 0;	/*!< Default setting for brokeneventsaction */
+static const int DEFAULT_DEBUG_ACTIONS          = 0;    /*!< Default setting for action debugging in the CLI */
 static const int DEFAULT_AUTHTIMEOUT		= 30;	/*!< Default setting for authtimeout */
 static const int DEFAULT_AUTHLIMIT		= 50;	/*!< Default setting for authlimit */
 
@@ -883,6 +884,7 @@
 static int authtimeout;
 static int authlimit;
 static char *manager_channelvars;
+static int debug_actions;
 
 #define DEFAULT_REALM		"asterisk"
 static char global_realm[MAXHOSTNAMELEN];	/*!< Default realm */
@@ -4467,6 +4469,20 @@
  * the appropriate handler.
  */
 
+/*! \brief Output manager actions to the CLI */
+static void manager_debug_action(struct mansession *s, const struct message *m)
+{
+	int x;
+
+	ast_verbose(VERBOSE_PREFIX_2 "%sManager '%s': Received action from IP(%s)\n", 
+			(s->session->sessiontimeout ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
+	for (x = 0; x < m->hdrcount; x++) {
+		ast_verbose("        %s\n", m->headers[x]);
+	}
+	ast_verbose("\n");
+}
+
+
 /*
  * Process an AMI message, performing desired action.
  * Return 0 on success, -1 on error that require the session to be destroyed.
@@ -4524,6 +4540,9 @@
 	AST_RWLIST_UNLOCK(&actions);
 
 	if (tmp) {
+		if (debug_actions) {
+			manager_debug_action(s, m);
+		}
 		if (call_func) {
 			/* Call our AMI function after we unlock our actions lists */
 			ast_debug(1, "Running action '%s'\n", tmp->action);
@@ -6289,6 +6308,7 @@
 	manager_enabled = DEFAULT_ENABLED;
 	webmanager_enabled = DEFAULT_WEBENABLED;
 	displayconnects = DEFAULT_DISPLAYCONNECTS;
+	debug_actions = DEFAULT_DEBUG_ACTIONS;
 	broken_events_action = DEFAULT_BROKENEVENTSACTION;
 	block_sockets = DEFAULT_BLOCKSOCKETS;
 	timestampevents = DEFAULT_TIMESTAMPEVENTS;
@@ -6351,6 +6371,8 @@
 			allowmultiplelogin = ast_true(val);
 		} else if (!strcasecmp(var->name, "displayconnects")) {
 			displayconnects = ast_true(val);
+		} else if (!strcasecmp(var->name, "debugactions")) {
+			debug_actions = ast_true(val);
 		} else if (!strcasecmp(var->name, "timestampevents")) {
 			timestampevents = ast_true(val);
 		} else if (!strcasecmp(var->name, "debug")) {




More information about the asterisk-commits mailing list