Merge major changes to the way device state is passed around Asterisk. The two

places that cared about device states were app_queue and the hint code in pbx.c.
The changes include converting it to use the Asterisk event system, as well as
other efficiency improvements.
 * app_queue: This module used to register a callback into devicestate.c to
   monitor device state changes.  Now, it is just a subscriber to Asterisk
   events with the type, device state.
 * pbx.c hints: Previously, the device state processing thread in devicestate.c
   would call ast_hint_state_changed() each time the state of a device changed.
   Then, that code would go looking for all the hints that monitor that device,
   and call their callbacks.  All of this blocked the device state processing
   thread.  Now, the hint code is a subscriber of Asterisk events with the
   type, device state.  Furthermore, when this code receives a device state
   change event, it queues it up to be processed by another thread so that it
   doesn't block one of the event processing threads.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@66958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2007-06-01 23:34:43 +00:00
parent c9cf12b675
commit 605368649e
8 changed files with 174 additions and 90 deletions

View File

@@ -37,13 +37,15 @@ enum ast_event_type {
unique to the event itself, not necessarily across all events. */
AST_EVENT_CUSTOM = 0x01,
/*! Voicemail message waiting indication */
AST_EVENT_MWI = 0x02,
AST_EVENT_MWI = 0x02,
/*! Someone has subscribed to events */
AST_EVENT_SUB = 0x03,
AST_EVENT_SUB = 0x03,
/*! Someone has unsubscribed from events */
AST_EVENT_UNSUB = 0x04,
AST_EVENT_UNSUB = 0x04,
/*! The state of a device has changed */
AST_EVENT_DEVICE_STATE = 0x05,
/*! Number of event types. This should be the last event type + 1 */
AST_EVENT_TOTAL = 0x05,
AST_EVENT_TOTAL = 0x06,
};
/*! \brief Event Information Element types */
@@ -82,11 +84,25 @@ enum ast_event_ie_type {
*/
AST_EVENT_IE_EVENTTYPE = 0x05,
/*!
* \brief Hint that someone cares than an IE exists
* \brief Hint that someone cares that an IE exists
* Used by: AST_EVENT_SUB
* Payload type: UINT (ast_event_ie_type)
*/
AST_EVENT_IE_EXISTS = 0x06,
/*!
* \brief Device Name
* Used by AST_EVENT_DEVICE_STATE
* Payload type: STR
*/
AST_EVENT_IE_DEVICE = 0x07,
/*!
* \brief Generic State IE
* Used by AST_EVENT_DEVICE_STATE
* Payload type: UINT
* The actual state values depend on the event which
* this IE is a part of.
*/
AST_EVENT_IE_STATE = 0x08,
};
/*!