[asterisk-commits] qwell: trunk r404280 - in /trunk: ./ main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 18 17:00:06 CST 2013


Author: qwell
Date: Wed Dec 18 17:00:03 2013
New Revision: 404280

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404280
Log:
Add AMI event for presence state.

Review: https://reviewboard.asterisk.org/r/3039/
........

Merged revisions 404275 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 404279 from http://svn.asterisk.org/svn/asterisk/branches/12

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

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Wed Dec 18 17:00:03 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403290,403292-403778,403781-404006,404027,404029,404042,404046,404048,404050,404099,404137,404184,404204,404237,404261,404263
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403290,403292-403778,403781-404006,404027,404029,404042,404046,404048,404050,404099,404137,404184,404204,404237,404261,404263,404279

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=404280&r1=404279&r2=404280
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Wed Dec 18 17:00:03 2013
@@ -6077,20 +6077,47 @@
 {
 	/* Notify managers of change */
 	char hint[512];
-	int state = info->exten_state;
-
-	/* only interested in device state for this right now */
-	if (info->reason !=  AST_HINT_UPDATE_DEVICE) {
-		return 0;
-	}
 
 	ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, context, exten);
-	/*** DOCUMENTATION
-		<managerEventInstance>
-			<synopsis>Raised when an extension state has changed.</synopsis>
-		</managerEventInstance>
-	***/
-	manager_event(EVENT_FLAG_CALL, "ExtensionStatus", "Exten: %s\r\nContext: %s\r\nHint: %s\r\nStatus: %d\r\n", exten, context, hint, state);
+
+	switch(info->reason) {
+	case AST_HINT_UPDATE_DEVICE:
+		/*** DOCUMENTATION
+			<managerEventInstance>
+				<synopsis>Raised when an extension state has changed.</synopsis>
+			</managerEventInstance>
+		***/
+		manager_event(EVENT_FLAG_CALL, "ExtensionStatus",
+			"Exten: %s\r\n"
+			"Context: %s\r\n"
+			"Hint: %s\r\n"
+			"Status: %d\r\n",
+			exten,
+			context,
+			hint,
+			info->exten_state);
+		break;
+	case AST_HINT_UPDATE_PRESENCE:
+		/*** DOCUMENTATION
+			<managerEventInstance>
+				<synopsis>Raised when a presence state has changed.</synopsis>
+			</managerEventInstance>
+		***/
+		manager_event(EVENT_FLAG_CALL, "PresenceStatus",
+			"Exten: %s\r\n"
+			"Context: %s\r\n"
+			"Hint: %s\r\n"
+			"Status: %s\r\n"
+			"Subtype: %s\r\n"
+			"Message: %s\r\n",
+			exten,
+			context,
+			hint,
+			ast_presence_state2str(info->presence_state),
+			info->presence_subtype,
+			info->presence_message);
+		break;
+	}
 	return 0;
 }
 




More information about the asterisk-commits mailing list