[asterisk-commits] qwell: branch 11 r404275 - /branches/11/main/manager.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 18 16:34:27 CST 2013
Author: qwell
Date: Wed Dec 18 16:34:21 2013
New Revision: 404275
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404275
Log:
Add AMI event for presence state.
Review: https://reviewboard.asterisk.org/r/3039/
Modified:
branches/11/main/manager.c
Modified: branches/11/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/manager.c?view=diff&rev=404275&r1=404274&r2=404275
==============================================================================
--- branches/11/main/manager.c (original)
+++ branches/11/main/manager.c Wed Dec 18 16:34:21 2013
@@ -5775,20 +5775,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