diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-26 21:09:58 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-26 21:09:58 +0000 |
commit | 688dbc7fa761b7ac61393a0da9049465a84ded78 (patch) | |
tree | a23b63f95f89d44e282e7b0cda08095a2309b884 | |
parent | 9d1803e2f7d3bbbdc768bd59a0b0b53a006191ff (diff) |
add support for event suppression for AMI-over-HTTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@159629 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | CHANGES | 15 | ||||
-rw-r--r-- | main/manager.c | 11 |
2 files changed, 24 insertions, 2 deletions
@@ -78,6 +78,21 @@ Miscellaneous * All deprecated CLI commands are removed from the sourcecode. They are now handled by the new clialiases module. See cli_aliases.conf.sample file. +Asterisk Manager Interface +-------------------------- + * When using the AMI over HTTP, you can now include a 'SuppressEvents' header (with + a non-empty value) in your request. If you do this, any pending AMI events will + *not* be included in the response to your request as they would normally, but + will be left in the event queue for the next request you make to retrieve. For + some applications, this will allow you to guarantee that you will only see + events in responses to 'WaitEvent' actions, and can better know when to expect them. + To know whether the Asterisk server supports this header or not, your client can + inspect the first response back from the server to see if it includes this header: + + Pragma: SuppressEvents + + If this is included, the server supports event suppression. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 1.6.0 to Asterisk 1.6.1 ------------- ------------------------------------------------------------------------------ diff --git a/main/manager.c b/main/manager.c index d2a76bd02..077fb013e 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2974,8 +2974,14 @@ static int process_message(struct mansession *s, const struct message *m) } if (ret) return ret; - /* Once done with our message, deliver any pending events */ - return process_events(s); + /* Once done with our message, deliver any pending events unless the + requester doesn't want them as part of this response. + */ + if (ast_strlen_zero(astman_get_header(m, "SuppressEvents"))) { + return process_events(s); + } else { + return ret; + } } /*! @@ -3796,6 +3802,7 @@ static struct ast_str *generic_http_callback(enum output_format format, "Content-type: text/%s\r\n" "Cache-Control: no-cache;\r\n" "Set-Cookie: mansession_id=\"%08x\"; Version=\"1\"; Max-Age=%d\r\n" + "Pragma: SuppressEvents\r\n" "\r\n", contenttype[format], s->managerid, httptimeout); |