[svn-commits] mjordan: trunk r418717 - in /trunk: ./ UPGRADE.txt main/manager.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 15 18:12:36 CDT 2014


Author: mjordan
Date: Tue Jul 15 18:12:33 2014
New Revision: 418717

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418717
Log:
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

Modified:
    trunk/   (props changed)
    trunk/UPGRADE.txt
    trunk/main/manager.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/UPGRADE.txt?view=diff&rev=418717&r1=418716&r2=418717
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Tue Jul 15 18:12:33 2014
@@ -117,6 +117,15 @@
  - 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

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=418717&r1=418716&r2=418717
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Jul 15 18:12:33 2014
@@ -5032,8 +5032,6 @@
 	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 @@
 		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);
-	}
-
-	astman_append(s, "Message: Presence State\r\n"
-			"State: %s\r\n"
-			"%s"
-			"%s"
-			"\r\n",
-			ast_presence_state2str(state),
-			subtype_header,
-			message_header);
+		/* 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");
+
 	return 0;
 }
 




More information about the svn-commits mailing list