Merged revisions 317425 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Thu, 5 May 2011 21:54:17 +0000 (21:54 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 5 May 2011 21:54:17 +0000 (21:54 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r317425 | russell | 2011-05-05 16:53:13 -0500 (Thu, 05 May 2011) | 7 lines

  Add missing ActioID handling to Events action.

  (closes issue #18949)
  Reported by: edersohe
  Patches:
        0018949.patch uploaded by edersohe (license 1228)
........

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

main/manager.c

index 7ce8bba..9180b00 100644 (file)
@@ -2880,6 +2880,14 @@ static int action_events(struct mansession *s, const struct message *m)
 {
        const char *mask = astman_get_header(m, "EventMask");
        int res, x;
 {
        const char *mask = astman_get_header(m, "EventMask");
        int res, x;
+       const char *id = astman_get_header(m, "ActionID");
+       char id_text[256];
+
+       if (!ast_strlen_zero(id)) {
+               snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", id);
+       } else {
+               id_text[0] = '\0';
+       }
 
        res = set_eventmask(s, mask);
        if (broken_events_action) {
 
        res = set_eventmask(s, mask);
        if (broken_events_action) {
@@ -2892,20 +2900,20 @@ static int action_events(struct mansession *s, const struct message *m)
                                        return 0;
                                }
                        }
                                        return 0;
                                }
                        }
-                       astman_append(s, "Response: Success\r\n"
-                                        "Events: On\r\n\r\n");
+                       astman_append(s, "Response: Success\r\n%s"
+                                        "Events: On\r\n\r\n", id_text);
                } else if (res == 0)
                } else if (res == 0)
-                       astman_append(s, "Response: Success\r\n"
-                                        "Events: Off\r\n\r\n");
+                       astman_append(s, "Response: Success\r\n%s"
+                                        "Events: Off\r\n\r\n", id_text);
                return 0;
        }
 
        if (res > 0)
                return 0;
        }
 
        if (res > 0)
-               astman_append(s, "Response: Success\r\n"
-                                "Events: On\r\n\r\n");
+               astman_append(s, "Response: Success\r\n%s"
+                                "Events: On\r\n\r\n", id_text);
        else if (res == 0)
        else if (res == 0)
-               astman_append(s, "Response: Success\r\n"
-                                "Events: Off\r\n\r\n");
+               astman_append(s, "Response: Success\r\n%s"
+                                "Events: Off\r\n\r\n", id_text);
        else
                astman_send_error(s, m, "Invalid event mask");
 
        else
                astman_send_error(s, m, "Invalid event mask");