2005-07-08 21:15:41 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2005-07-08 21:15:41 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
|
|
|
*
|
|
|
|
* Mark Spencer <markster@digium.com>
|
|
|
|
*
|
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
2005-07-08 21:15:41 +00:00
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
2005-08-30 18:32:10 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
|
|
|
* \brief Device state management
|
2006-11-30 20:34:23 +00:00
|
|
|
*
|
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
2007-06-01 23:34:43 +00:00
|
|
|
* To subscribe to device state changes, use the generic ast_event_subscribe
|
|
|
|
* method. For an example, see apps/app_queue.c.
|
|
|
|
*
|
|
|
|
* \todo Currently, when the state of a device changes, the device state provider
|
2009-03-09 20:58:17 +00:00
|
|
|
* calls one of the functions defined here to queue an object to say that the
|
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
2007-06-01 23:34:43 +00:00
|
|
|
* state of a device has changed. However, this does not include the new state.
|
|
|
|
* Another thread processes these device state change objects and calls the
|
|
|
|
* device state provider's callback to figure out what the new state is. It
|
|
|
|
* would make a lot more sense for the new state to be included in the original
|
|
|
|
* function call that says the state of a device has changed. However, it
|
|
|
|
* will take a lot of work to change this.
|
|
|
|
*
|
2006-11-30 20:34:23 +00:00
|
|
|
* \arg See \ref AstExtState
|
2005-07-08 21:15:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASTERISK_DEVICESTATE_H
|
|
|
|
#define _ASTERISK_DEVICESTATE_H
|
|
|
|
|
Merge Call completion support into trunk.
From Reviewboard:
CCSS stands for Call Completion Supplementary Services. An admittedly out-of-date
overview of the architecture can be found in the file doc/CCSS_architecture.pdf
in the CCSS branch. Off the top of my head, the big differences between what is
implemented and what is in the document are as follows:
1. We did not end up modifying the Hangup application at all.
2. The document states that a single call completion monitor may be used across
multiple calls to the same device. This proved to not be such a good idea
when implementing protocol-specific monitors, and so we ended up using one
monitor per-device per-call.
3. There are some configuration options which were conceived after the document
was written. These are documented in the ccss.conf.sample that is on this
review request.
For some basic understanding of terminology used throughout this code, see the
ccss.tex document that is on this review.
This implements CCBS and CCNR in several flavors.
First up is a "generic" implementation, which can work over any channel technology
provided that the channel technology can accurately report device state. Call
completion is requested using the dialplan application CallCompletionRequest and can
be canceled using CallCompletionCancel. Device state subscriptions are used in order
to monitor the state of called parties.
Next, there is a SIP-specific implementation of call completion. This method uses the
methods outlined in draft-ietf-bliss-call-completion-06 to implement call completion
using SIP signaling. There are a few things to note here:
* The agent/monitor terminology used throughout Asterisk sometimes is the reverse of
what is defined in the referenced draft.
* Implementation of the draft required support for SIP PUBLISH. I attempted to write
this in a generic-enough fashion such that if someone were to want to write PUBLISH
support for other event packages, such as dialog-state or presence, most of the effort
would be in writing callbacks specific to the event package.
* A subportion of supporting PUBLISH reception was that we had to implement a PIDF
parser. The PIDF support added is a bit minimal. I first wrote a validation
routine to ensure that the PIDF document is formatted properly. The rest of the
PIDF reading is done in-line in the call-completion-specific PUBLISH-handling
code. In other words, while there is PIDF support here, it is not in any state
where it could easily be applied to other event packages as is.
Finally, there are a variety of ISDN-related call completion protocols supported. These
were written by Richard Mudgett, and as such I can't really say much about their
implementation. There are notes in the CHANGES file that indicate the ISDN protocols
over which call completion is supported.
Review: https://reviewboard.asterisk.org/r/523
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 15:31:32 +00:00
|
|
|
#include "asterisk/channelstate.h"
|
Improve performance of the ast_event cache functionality.
This code comes from svn/asterisk/team/russell/event_performance/.
Here is a summary of the changes that have been made, in order of both
invasiveness and performance impact, from smallest to largest.
1) Asterisk 1.6.1 introduces some additional logic to be able to handle
distributed device state. This functionality comes at a cost.
One relatively minor change in this patch is that the extra processing
required for distributed device state is now completely bypassed if
it's not needed.
2) One of the things that I noticed when profiling this code was that a
_lot_ of time was spent doing string comparisons. I changed the way
strings are represented in an event to include a hash value at the front.
So, before doing a string comparison, we do an integer comparison on the
hash.
3) Finally, the code that handles the event cache has been re-written.
I tried to do this in a such a way that it had minimal impact on the API.
I did have to change one API call, though - ast_event_queue_and_cache().
However, the way it works now is nicer, IMO. Each type of event that
can be cached (MWI, device state) has its own hash table and rules for
hashing and comparing objects. This by far made the biggest impact on
performance.
For additional details regarding this code and how it was tested, please see the
review request.
(closes issue #14738)
Reported by: russell
Review: http://reviewboard.digium.com/r/205/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-25 21:57:19 +00:00
|
|
|
|
2005-07-08 21:15:41 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2007-02-13 22:02:20 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*! \brief Device States
|
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
2007-06-01 23:34:43 +00:00
|
|
|
* \note The order of these states may not change because they are included
|
|
|
|
* in Asterisk events which may be transmitted across the network to
|
|
|
|
* other servers.
|
|
|
|
*/
|
2007-02-13 22:02:20 +00:00
|
|
|
enum ast_device_state {
|
|
|
|
AST_DEVICE_UNKNOWN, /*!< Device is valid but channel didn't know state */
|
|
|
|
AST_DEVICE_NOT_INUSE, /*!< Device is not used */
|
|
|
|
AST_DEVICE_INUSE, /*!< Device is in use */
|
|
|
|
AST_DEVICE_BUSY, /*!< Device is busy */
|
|
|
|
AST_DEVICE_INVALID, /*!< Device is invalid */
|
|
|
|
AST_DEVICE_UNAVAILABLE, /*!< Device is unavailable */
|
|
|
|
AST_DEVICE_RINGING, /*!< Device is ringing */
|
|
|
|
AST_DEVICE_RINGINUSE, /*!< Device is ringing *and* in use */
|
|
|
|
AST_DEVICE_ONHOLD, /*!< Device is on hold */
|
2009-07-02 16:03:44 +00:00
|
|
|
AST_DEVICE_TOTAL, /*/ Total num of device states, used for testing */
|
2007-02-13 22:02:20 +00:00
|
|
|
};
|
2005-07-08 21:15:41 +00:00
|
|
|
|
2007-08-10 16:24:11 +00:00
|
|
|
/*! \brief Devicestate provider call back */
|
2007-02-13 22:02:20 +00:00
|
|
|
typedef enum ast_device_state (*ast_devstate_prov_cb_type)(const char *data);
|
METERMAIDS:
-----------
- Adding devicestate providers, a new architecture to add non-channel related
device state information, like parking lots, queues, meetmes, vending machines
and Windows 98 reboots (lots of blinking on those lights)
- Adding provider for parking lots, so you can subscribe to the status of a
parking lot
- Adding provider for meetme, so you can have a blinking lamp for a meetme
( Example: exten => edvina,hint,meetme:1234 )
- Adding support for directed parking - set the PARKINGEXTEN before you manually
call Park() and you will be parked on that space. If it's occupied, dialplan
execution will continue.
This work was sponsored by Voop A/S - www.voop.com
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-26 16:43:21 +00:00
|
|
|
|
2008-07-25 21:20:03 +00:00
|
|
|
/*!
|
|
|
|
* \brief Convert channel state to devicestate
|
|
|
|
*
|
|
|
|
* \param chanstate Current channel state
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-07-25 21:20:03 +00:00
|
|
|
*/
|
|
|
|
enum ast_device_state ast_state_chan2dev(enum ast_channel_state chanstate);
|
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief Convert device state to text string for output
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \param devstate Current device state
|
2005-10-24 20:12:06 +00:00
|
|
|
*/
|
2008-11-29 17:57:39 +00:00
|
|
|
const char *devstate2str(enum ast_device_state devstate) attribute_pure __attribute__((deprecated));
|
2008-11-04 18:47:20 +00:00
|
|
|
const char *ast_devstate2str(enum ast_device_state devstate) attribute_pure;
|
2007-02-13 22:02:20 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief Convert device state to text string that is easier to parse
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \param devstate Current device state
|
2007-02-13 22:02:20 +00:00
|
|
|
*/
|
2008-11-04 18:47:20 +00:00
|
|
|
const char *ast_devstate_str(enum ast_device_state devstate) attribute_pure;
|
2007-02-13 22:02:20 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
2007-08-10 16:24:11 +00:00
|
|
|
* \brief Convert device state from text to integer value
|
|
|
|
*
|
2007-06-07 23:07:25 +00:00
|
|
|
* \param val The text representing the device state. Valid values are anything
|
2007-02-13 22:02:20 +00:00
|
|
|
* that comes after AST_DEVICE_ in one of the defined values.
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2007-02-13 22:02:20 +00:00
|
|
|
* \return The AST_DEVICE_ integer value
|
|
|
|
*/
|
|
|
|
enum ast_device_state ast_devstate_val(const char *val);
|
2005-07-20 00:34:01 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
2007-07-16 02:51:56 +00:00
|
|
|
* \brief Search the Channels by Name
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \param device like a dial string
|
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* Search the Device in active channels by compare the channel name against
|
2007-08-10 16:24:11 +00:00
|
|
|
* the device name. Compared are only the first chars to the first '-' char.
|
|
|
|
*
|
|
|
|
* \retval AST_DEVICE_UNKNOWN if no channel found
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval AST_DEVICE_INUSE if a channel is found
|
2005-07-08 21:15:41 +00:00
|
|
|
*/
|
2007-02-13 22:02:20 +00:00
|
|
|
enum ast_device_state ast_parse_device_state(const char *device);
|
2005-07-08 21:15:41 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
2007-07-16 02:51:56 +00:00
|
|
|
* \brief Asks a channel for device state
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \param device like a dial string
|
|
|
|
*
|
|
|
|
* Asks a channel for device state, data is normally a number from a dial string
|
2005-07-08 21:15:41 +00:00
|
|
|
* used by the low level module
|
2007-08-10 16:24:11 +00:00
|
|
|
* Tries the channel device state callback if not supported search in the
|
2005-07-08 21:15:41 +00:00
|
|
|
* active channels list for the device.
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \retval an AST_DEVICE_??? state
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval -1 on failure
|
2005-07-08 21:15:41 +00:00
|
|
|
*/
|
2007-02-13 22:02:20 +00:00
|
|
|
enum ast_device_state ast_device_state(const char *device);
|
2005-07-08 21:15:41 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
2007-07-16 02:51:56 +00:00
|
|
|
* \brief Tells Asterisk the State for Device is changed
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \param state the new state of the device
|
|
|
|
* \param fmt device name like a dial string with format parameters
|
|
|
|
*
|
|
|
|
* The new state of the device will be sent off to any subscribers
|
|
|
|
* of device states. It will also be stored in the internal event
|
|
|
|
* cache.
|
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \retval 0 on success
|
2007-08-10 16:24:11 +00:00
|
|
|
* \retval -1 on failure
|
|
|
|
*/
|
|
|
|
int ast_devstate_changed(enum ast_device_state state, const char *fmt, ...)
|
2008-11-29 17:57:39 +00:00
|
|
|
__attribute__((format(printf, 2, 3)));
|
2007-08-10 16:24:11 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
2007-08-10 16:24:11 +00:00
|
|
|
* \brief Tells Asterisk the State for Device is changed
|
|
|
|
*
|
|
|
|
* \param state the new state of the device
|
2007-09-05 16:31:39 +00:00
|
|
|
* \param device device name like a dial string with format parameters
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* The new state of the device will be sent off to any subscribers
|
|
|
|
* of device states. It will also be stored in the internal event
|
|
|
|
* cache.
|
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \retval 0 on success
|
2007-08-10 16:24:11 +00:00
|
|
|
* \retval -1 on failure
|
|
|
|
*/
|
|
|
|
int ast_devstate_changed_literal(enum ast_device_state state, const char *device);
|
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief Tells Asterisk the State for Device is changed.
|
|
|
|
* (Accept change notification, add it to change queue.)
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \param fmt device name like a dial string with format parameters
|
|
|
|
*
|
|
|
|
* Asterisk polls the new extension states and calls the registered
|
2005-07-08 21:15:41 +00:00
|
|
|
* callbacks for the changed extensions
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \retval 0 on success
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval -1 on failure
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \note This is deprecated in favor of ast_devstate_changed()
|
2009-03-09 20:58:17 +00:00
|
|
|
* \version 1.6.1 deprecated
|
2005-07-08 21:15:41 +00:00
|
|
|
*/
|
|
|
|
int ast_device_state_changed(const char *fmt, ...)
|
2008-11-29 17:57:39 +00:00
|
|
|
__attribute__((deprecated,format(printf, 1, 2)));
|
2005-07-08 21:15:41 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief Tells Asterisk the State for Device is changed
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \param device device name like a dial string
|
|
|
|
*
|
|
|
|
* Asterisk polls the new extension states and calls the registered
|
2005-10-17 15:41:55 +00:00
|
|
|
* callbacks for the changed extensions
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \retval 0 on success
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval -1 on failure
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
|
|
|
* \note This is deprecated in favor of ast_devstate_changed_literal()
|
2009-03-09 20:58:17 +00:00
|
|
|
* \version 1.6.1 deprecated
|
2005-10-17 15:41:55 +00:00
|
|
|
*/
|
2008-07-25 21:20:03 +00:00
|
|
|
int ast_device_state_changed_literal(const char *device)
|
2008-11-29 17:57:39 +00:00
|
|
|
__attribute__((deprecated));
|
2005-10-17 15:41:55 +00:00
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief Add device state provider
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
METERMAIDS:
-----------
- Adding devicestate providers, a new architecture to add non-channel related
device state information, like parking lots, queues, meetmes, vending machines
and Windows 98 reboots (lots of blinking on those lights)
- Adding provider for parking lots, so you can subscribe to the status of a
parking lot
- Adding provider for meetme, so you can have a blinking lamp for a meetme
( Example: exten => edvina,hint,meetme:1234 )
- Adding support for directed parking - set the PARKINGEXTEN before you manually
call Park() and you will be parked on that space. If it's occupied, dialplan
execution will continue.
This work was sponsored by Voop A/S - www.voop.com
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-26 16:43:21 +00:00
|
|
|
* \param label to use in hint, like label:object
|
|
|
|
* \param callback Callback
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2007-02-13 20:57:41 +00:00
|
|
|
* \retval 0 success
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval -1 failure
|
2009-03-09 20:58:17 +00:00
|
|
|
*/
|
METERMAIDS:
-----------
- Adding devicestate providers, a new architecture to add non-channel related
device state information, like parking lots, queues, meetmes, vending machines
and Windows 98 reboots (lots of blinking on those lights)
- Adding provider for parking lots, so you can subscribe to the status of a
parking lot
- Adding provider for meetme, so you can have a blinking lamp for a meetme
( Example: exten => edvina,hint,meetme:1234 )
- Adding support for directed parking - set the PARKINGEXTEN before you manually
call Park() and you will be parked on that space. If it's occupied, dialplan
execution will continue.
This work was sponsored by Voop A/S - www.voop.com
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-26 16:43:21 +00:00
|
|
|
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback);
|
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief Remove device state provider
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
METERMAIDS:
-----------
- Adding devicestate providers, a new architecture to add non-channel related
device state information, like parking lots, queues, meetmes, vending machines
and Windows 98 reboots (lots of blinking on those lights)
- Adding provider for parking lots, so you can subscribe to the status of a
parking lot
- Adding provider for meetme, so you can have a blinking lamp for a meetme
( Example: exten => edvina,hint,meetme:1234 )
- Adding support for directed parking - set the PARKINGEXTEN before you manually
call Park() and you will be parked on that space. If it's occupied, dialplan
execution will continue.
This work was sponsored by Voop A/S - www.voop.com
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-26 16:43:21 +00:00
|
|
|
* \param label to use in hint, like label:object
|
2007-08-10 16:24:11 +00:00
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \retval -1 on failure
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval 0 on success
|
2009-03-09 20:58:17 +00:00
|
|
|
*/
|
2007-02-13 22:02:20 +00:00
|
|
|
int ast_devstate_prov_del(const char *label);
|
METERMAIDS:
-----------
- Adding devicestate providers, a new architecture to add non-channel related
device state information, like parking lots, queues, meetmes, vending machines
and Windows 98 reboots (lots of blinking on those lights)
- Adding provider for parking lots, so you can subscribe to the status of a
parking lot
- Adding provider for meetme, so you can have a blinking lamp for a meetme
( Example: exten => edvina,hint,meetme:1234 )
- Adding support for directed parking - set the PARKINGEXTEN before you manually
call Park() and you will be parked on that space. If it's occupied, dialplan
execution will continue.
This work was sponsored by Voop A/S - www.voop.com
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-26 16:43:21 +00:00
|
|
|
|
2008-06-10 14:06:29 +00:00
|
|
|
/*!
|
|
|
|
* \brief An object to hold state when calculating aggregate device state
|
|
|
|
*/
|
|
|
|
struct ast_devstate_aggregate;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Initialize aggregate device state
|
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \param[in] agg the state object
|
2008-06-10 14:06:29 +00:00
|
|
|
*
|
|
|
|
* \return nothing
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-06-10 14:06:29 +00:00
|
|
|
*/
|
|
|
|
void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Add a device state to the aggregate device state
|
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \param[in] agg the state object
|
|
|
|
* \param[in] state the state to add
|
2008-06-10 14:06:29 +00:00
|
|
|
*
|
|
|
|
* \return nothing
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-06-10 14:06:29 +00:00
|
|
|
*/
|
|
|
|
void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get the aggregate device state result
|
|
|
|
*
|
2009-03-09 20:58:17 +00:00
|
|
|
* \param[in] agg the state object
|
2008-06-10 14:06:29 +00:00
|
|
|
*
|
|
|
|
* \return the aggregate device state after adding some number of device states.
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-06-10 14:06:29 +00:00
|
|
|
*/
|
|
|
|
enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg);
|
|
|
|
|
2009-03-09 20:58:17 +00:00
|
|
|
/*!
|
|
|
|
* \brief You shouldn't care about the contents of this struct
|
2008-06-10 14:06:29 +00:00
|
|
|
*
|
|
|
|
* This struct is only here so that it can be easily declared on the stack.
|
|
|
|
*/
|
|
|
|
struct ast_devstate_aggregate {
|
2012-03-13 20:06:57 +00:00
|
|
|
unsigned int ringing:1;
|
|
|
|
unsigned int inuse:1;
|
|
|
|
enum ast_device_state state;
|
2008-06-10 14:06:29 +00:00
|
|
|
};
|
|
|
|
|
Improve performance of the ast_event cache functionality.
This code comes from svn/asterisk/team/russell/event_performance/.
Here is a summary of the changes that have been made, in order of both
invasiveness and performance impact, from smallest to largest.
1) Asterisk 1.6.1 introduces some additional logic to be able to handle
distributed device state. This functionality comes at a cost.
One relatively minor change in this patch is that the extra processing
required for distributed device state is now completely bypassed if
it's not needed.
2) One of the things that I noticed when profiling this code was that a
_lot_ of time was spent doing string comparisons. I changed the way
strings are represented in an event to include a hash value at the front.
So, before doing a string comparison, we do an integer comparison on the
hash.
3) Finally, the code that handles the event cache has been re-written.
I tried to do this in a such a way that it had minimal impact on the API.
I did have to change one API call, though - ast_event_queue_and_cache().
However, the way it works now is nicer, IMO. Each type of event that
can be cached (MWI, device state) has its own hash table and rules for
hashing and comparing objects. This by far made the biggest impact on
performance.
For additional details regarding this code and how it was tested, please see the
review request.
(closes issue #14738)
Reported by: russell
Review: http://reviewboard.digium.com/r/205/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@184339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-25 21:57:19 +00:00
|
|
|
/*!
|
|
|
|
* \brief Enable distributed device state processing.
|
|
|
|
*
|
|
|
|
* \details
|
|
|
|
* By default, Asterisk assumes that device state change events will only be
|
|
|
|
* originating from one instance. If a module gets loaded and configured such
|
|
|
|
* that multiple instances of Asterisk will be sharing device state, this
|
|
|
|
* function should be called to enable distributed device state processing.
|
|
|
|
* It is off by default to save on unnecessary processing.
|
|
|
|
*
|
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 failure
|
|
|
|
*/
|
|
|
|
int ast_enable_distributed_devstate(void);
|
|
|
|
|
2005-07-08 21:15:41 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _ASTERISK_DEVICESTATE_H */
|