[asterisk-commits] mnicholson: branch 1.6.2 r257184 - in /branches/1.6.2: ./ configs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 13 13:43:17 CDT 2010


Author: mnicholson
Date: Tue Apr 13 13:43:13 2010
New Revision: 257184

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257184
Log:
Merged revisions 257146 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r257146 | mnicholson | 2010-04-13 13:10:30 -0500 (Tue, 13 Apr 2010) | 16 lines
  
  Merged revisions 257070 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r257070 | mnicholson | 2010-04-13 11:46:30 -0500 (Tue, 13 Apr 2010) | 9 lines
    
    Add an option to restore past broken behavor of the Events manager action
    
    Before r238915, certain values for the EventMask parameter of the Events action would result in no response being returned.  This patch adds an option to restore that broken behavior.  Also while fixing this bug I discovered that passing an empty EventMasks parameter would also result in no response being returned, this has been fixed as well while being preserved when the broken behavior is requested.
    
    (closes issue #17023)
    Reported by: nblasgen
    
    Review: https://reviewboard.asterisk.org/r/602/
  ........
................

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/configs/manager.conf.sample
    branches/1.6.2/main/manager.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/configs/manager.conf.sample
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/configs/manager.conf.sample?view=diff&rev=257184&r1=257183&r2=257184
==============================================================================
--- branches/1.6.2/configs/manager.conf.sample (original)
+++ branches/1.6.2/configs/manager.conf.sample Tue Apr 13 13:43:13 2010
@@ -56,6 +56,10 @@
 ;
 ;timestampevents = yes
 
+;brokeneventsaction = yes   ; Restore previous behavior that caused the events
+                            ; action to not return a response in certain
+                            ; circumstances.  Defaults to 'no'.
+
 ; debug = on	; enable some debugging info in AMI messages (default off).
 		; Also accessible through the "manager debug" CLI command.
 ;[mark]

Modified: branches/1.6.2/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/manager.c?view=diff&rev=257184&r1=257183&r2=257184
==============================================================================
--- branches/1.6.2/main/manager.c (original)
+++ branches/1.6.2/main/manager.c Tue Apr 13 13:43:13 2010
@@ -123,6 +123,7 @@
 static int allowmultiplelogin = 1;
 static int timestampevents;
 static int httptimeout = 60;
+static int broken_events_action = 0;
 static int manager_enabled = 0;
 static int webmanager_enabled = 0;
 
@@ -1715,15 +1716,36 @@
 static int action_events(struct mansession *s, const struct message *m)
 {
 	const char *mask = astman_get_header(m, "EventMask");
-	int res;
+	int res, x;
 
 	res = set_eventmask(s, mask);
+	if (broken_events_action) {
+		/* if this option is set we should not return a response on
+		 * error, or when all events are set */
+
+		if (res > 0) {
+			for (x = 0; x < ARRAY_LEN(perms); x++) {
+				if (!strcasecmp(perms[x].label, "all") && res == perms[x].num) {
+					return 0;
+				}
+			}
+			astman_append(s, "Response: Success\r\n"
+					 "Events: On\r\n\r\n");
+		} else if (res == 0)
+			astman_append(s, "Response: Success\r\n"
+					 "Events: Off\r\n\r\n");
+		return 0;
+	}
+
 	if (res > 0)
 		astman_append(s, "Response: Success\r\n"
 				 "Events: On\r\n\r\n");
 	else if (res == 0)
 		astman_append(s, "Response: Success\r\n"
 				 "Events: Off\r\n\r\n");
+	else
+		astman_send_error(s, m, "Invalid event mask");
+
 	return 0;
 }
 
@@ -4118,6 +4140,7 @@
 		return 0;
 
 	displayconnects = 1;
+	broken_events_action = 0;
 	if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
 		ast_log(LOG_NOTICE, "Unable to open AMI configuration manager.conf, or configuration is invalid. Asterisk management interface (AMI) disabled.\n");
 		return 0;
@@ -4169,6 +4192,8 @@
 				ast_log(LOG_WARNING, "Invalid address '%s' specified, using 0.0.0.0\n", val);
 				memset(&ami_desc.local_address.sin_addr, 0, sizeof(ami_desc.local_address.sin_addr));
 			}
+		} else if (!strcasecmp(var->name, "brokeneventsaction")) {
+			broken_events_action = ast_true(val);
 		} else if (!strcasecmp(var->name, "allowmultiplelogin")) { 
 			allowmultiplelogin = ast_true(val);
 		} else if (!strcasecmp(var->name, "displayconnects")) {




More information about the asterisk-commits mailing list