summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/manager.conf.sample4
-rw-r--r--main/manager.c27
2 files changed, 30 insertions, 1 deletions
diff --git a/configs/manager.conf.sample b/configs/manager.conf.sample
index 078d17932..7db675119 100644
--- a/configs/manager.conf.sample
+++ b/configs/manager.conf.sample
@@ -57,6 +57,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'.
+
;
; Display certain channel variables every time a channel-oriented
; event is emitted:
diff --git a/main/manager.c b/main/manager.c
index 0456990b4..376123fbf 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -744,6 +744,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;
@@ -2694,15 +2695,36 @@ static int action_listcommands(struct mansession *s, const struct message *m)
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;
}
@@ -5597,6 +5619,7 @@ static int __init_manager(int reload)
}
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;
@@ -5645,6 +5668,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.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")) {