]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 257146 via svnmerge from
authorMatthew Nicholson <mnicholson@digium.com>
Tue, 13 Apr 2010 19:44:49 +0000 (19:44 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Tue, 13 Apr 2010 19:44:49 +0000 (19:44 +0000)
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/
  ........
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@257218 65c4cc65-6c06-0410-ace0-fbb531ad65f3

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

index 0fd4ccbaa6076a311f46edefb5787321ece86fb9..79c1ba82e59449506f858869f57eec20e582058c 100644 (file)
@@ -56,6 +56,10 @@ bindaddr = 0.0.0.0
 ;
 ;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]
index ae5299e439bba03e74cae7544283e692878005cb..aa42b5c3ed021c9f24fce11ea41e6efff2ecbc03 100644 (file)
@@ -122,6 +122,7 @@ static int displayconnects = 1;
 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;
 
@@ -1607,15 +1608,36 @@ static char mandescr_events[] =
 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;
 }
 
@@ -3920,6 +3942,8 @@ static int __init_manager(int reload)
                                ast_log(LOG_WARNING, "Invalid address '%s' specified, using 0.0.0.0\n", val);
                                memset(&ami_desc.sin.sin_addr, 0, sizeof(ami_desc.sin.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")) {