summaryrefslogtreecommitdiff
path: root/main/manager.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-07-15 23:12:33 +0000
committerMatthew Jordan <mjordan@digium.com>2014-07-15 23:12:33 +0000
commit96cbaa187a36a767872997a664040278d61007c8 (patch)
tree3075d2da3e61676b82bcf64f161416b04410019e /main/manager.c
parentca587079c011df171c8b0597af1d997845281dbd (diff)
manager: Return ActionID on nominal responses to PresenceState action
When the PresenceState action is executed, the nominal path fails to include the ActionID in the successful response. This patch adds a call to astman_start_ack, which guarantees that an ActionID (if provided) will be sent back to the AMI client. Unlike the Asterisk 11 and 12 patches, this patch also deprecates the duplicate Message key in the response to the action, replacing it with the key 'PresenceMessage'. Review: https://reviewboard.asterisk.org/r/3776/ ASTERISK-23985 #close ........ Merged revisions 418713 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 418714 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/manager.c')
-rw-r--r--main/manager.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/main/manager.c b/main/manager.c
index 63e08631a..75811886f 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -5032,8 +5032,6 @@ static int action_presencestate(struct mansession *s, const struct message *m)
enum ast_presence_state state;
char *subtype;
char *message;
- char subtype_header[256] = "";
- char message_header[256] = "";
if (ast_strlen_zero(provider)) {
astman_send_error(s, m, "No provider specified");
@@ -5046,24 +5044,25 @@ static int action_presencestate(struct mansession *s, const struct message *m)
return 0;
}
+ astman_start_ack(s, m);
+ astman_append(s, "Message: Presence State\r\n"
+ "State: %s\r\n", ast_presence_state2str(state));
+
if (!ast_strlen_zero(subtype)) {
- snprintf(subtype_header, sizeof(subtype_header),
- "Subtype: %s\r\n", subtype);
+ astman_append(s, "Subtype: %s\r\n", subtype);
}
if (!ast_strlen_zero(message)) {
- snprintf(message_header, sizeof(message_header),
- "Message: %s\r\n", message);
+ /* XXX The Message header here is deprecated as it
+ * duplicates the action response header 'Message'.
+ * Remove it in the next major revision of AMI.
+ */
+ astman_append(s, "Message: %s\r\n"
+ "PresenceMessage: %s\r\n",
+ message, message);
}
+ astman_append(s, "\r\n");
- astman_append(s, "Message: Presence State\r\n"
- "State: %s\r\n"
- "%s"
- "%s"
- "\r\n",
- ast_presence_state2str(state),
- subtype_header,
- message_header);
return 0;
}