diff options
-rw-r--r-- | UPGRADE.txt | 9 | ||||
-rw-r--r-- | main/manager.c | 27 |
2 files changed, 22 insertions, 14 deletions
diff --git a/UPGRADE.txt b/UPGRADE.txt index fc63210cb..89826a4b5 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -117,6 +117,15 @@ AMI: - Removed the undocumented manager.conf block-sockets option. It interferes with TCP/TLS inactivity timeouts. + - The response to the PresenceState AMI action has historically contained two + Message keys. The first of these is used as an informative message regarding + the success/failure of the action; the second contains a Presence state + specific message. Having two keys with the same unique name in an AMI + message is cumbersome for some client; hence, the Presence specific Message + has been deprecated. The message will now contain a PresenceMessage key + for the presence specific information; the Message key containing presence + information will be removed in the next major version of AMI. + CDRs: - The "endbeforehexten" setting now defaults to "yes", instead of "no". When set to "no", yhis setting will cause a new CDR to be generated when a 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; } |