queue device state changes and handle them serially in a background thread

optimize device state related functions
add ast_get_channel_by_name_prefix to allow searching for matching channels in O(1) operation


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-07-08 21:14:34 +00:00
parent 0111a38e4b
commit c13d601fb4
12 changed files with 125 additions and 279 deletions

View File

@@ -444,21 +444,6 @@ struct outgoing_helper {
/*! Do not transmit voice data */
#define AST_STATE_MUTE (1 << 16)
/*! Device is valid but channel didn't know state */
#define AST_DEVICE_UNKNOWN 0
/*! Device is not used */
#define AST_DEVICE_NOT_INUSE 1
/*! Device is in use */
#define AST_DEVICE_INUSE 2
/*! Device is busy */
#define AST_DEVICE_BUSY 3
/*! Device is invalid */
#define AST_DEVICE_INVALID 4
/*! Device is unavailable */
#define AST_DEVICE_UNAVAILABLE 5
/*! Device is ringing */
#define AST_DEVICE_RINGING 6
/*! Create a channel structure */
/*! Returns NULL on failure to allocate. New channels are
by default set to the "default" context and
@@ -494,27 +479,6 @@ void ast_channel_free(struct ast_channel *);
*/
struct ast_channel *ast_request(const char *type, int format, void *data, int *status);
/*! Search the Channels by Name */
/*!
* \param device like a dialstring
* Search the Device in active channels by compare the channelname against
* the devicename. Compared are only the first chars to the first '-' char.
* Returns an AST_DEVICE_UNKNOWN if no channel found or
* AST_DEVICE_INUSE if a channel is found
*/
int ast_parse_device_state(char *device);
/*! Asks a channel for device state */
/*!
* \param device like a dialstring
* Asks a channel for device state, data is normaly a number from dialstring
* used by the low level module
* Trys the channel devicestate callback if not supported search in the
* active channels list for the device.
* Returns an AST_DEVICE_??? state -1 on failure
*/
int ast_device_state(char *device);
/*!
* \param type type of channel to request
* \param format requested channel format
@@ -545,6 +509,12 @@ int ast_channel_register(const struct ast_channel_tech *tech);
*/
void ast_channel_unregister(const struct ast_channel_tech *tech);
/*! Get a channel technology structure by name
* \param name name of technology to find
* \return a pointer to the structure, or NULL if no matching technology found
*/
const struct ast_channel_tech *ast_get_channel_tech(const char *name);
/*! Hang up a channel */
/*!
* \param chan channel to hang up
@@ -759,6 +729,9 @@ struct ast_channel *ast_channel_walk_locked(const struct ast_channel *prev);
/*! Get channel by name (locks channel) */
struct ast_channel *ast_get_channel_by_name_locked(const char *chan);
/*! Get channel by name prefix (locks channel) */
struct ast_channel *ast_get_channel_by_name_prefix_locked(const char *name, const int namelen);
/*! Waits for a digit */
/*!
* \param c channel to wait for a digit on