mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-14 22:08:28 +00:00
Merge hint patch, add new variables, and misc. PBX cleanups
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -233,6 +233,19 @@ struct chanmon;
|
||||
/*! 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
|
||||
|
||||
//! Requests a channel
|
||||
/*!
|
||||
* \param type type of channel to request
|
||||
@@ -244,6 +257,27 @@ struct chanmon;
|
||||
*/
|
||||
struct ast_channel *ast_request(char *type, int format, void *data);
|
||||
|
||||
//! 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
|
||||
@@ -271,6 +305,11 @@ struct ast_channel *ast_request_and_dial(char *type, int format, void *data, int
|
||||
int ast_channel_register(char *type, char *description, int capabilities,
|
||||
struct ast_channel* (*requester)(char *type, int format, void *data));
|
||||
|
||||
/* Same like the upper function but with support for devicestate */
|
||||
int ast_channel_register_ex(char *type, char *description, int capabilities,
|
||||
struct ast_channel *(*requester)(char *type, int format, void *data),
|
||||
int (*devicestate)(void *data));
|
||||
|
||||
//! Unregister a channel class
|
||||
/*
|
||||
* \param type the character string that corresponds to the channel you wish to unregister
|
||||
|
||||
@@ -29,12 +29,27 @@ extern "C" {
|
||||
//! Special return values from applications to the PBX
|
||||
#define AST_PBX_KEEPALIVE 10 /* Destroy the thread, but don't hang up the channel */
|
||||
|
||||
//! Special Priority for an hint
|
||||
#define PRIORITY_HINT -1
|
||||
|
||||
//! Extension states
|
||||
//! No device INUSE or BUSY
|
||||
#define AST_EXTENSION_NOT_INUSE 0
|
||||
//! One or more devices INUSE
|
||||
#define AST_EXTENSION_INUSE 1
|
||||
//! All devices BUSY
|
||||
#define AST_EXTENSION_BUSY 2
|
||||
//! All devices UNAVAILABLE/UNREGISTERED
|
||||
#define AST_EXTENSION_UNAVAILABLE 3
|
||||
|
||||
struct ast_context;
|
||||
struct ast_exten;
|
||||
struct ast_include;
|
||||
struct ast_ignorepat;
|
||||
struct ast_sw;
|
||||
|
||||
typedef int (*ast_notify_cb_type)(char *context, char* id, int state, void *data);
|
||||
|
||||
//! Data structure associated with an asterisk switch
|
||||
struct ast_switch {
|
||||
/*! NULL */
|
||||
@@ -189,6 +204,57 @@ int ast_register_application(char *app, int (*execute)(struct ast_channel *, voi
|
||||
*/
|
||||
int ast_unregister_application(char *app);
|
||||
|
||||
//! Uses hint and devicestate callback to get the state of an extension
|
||||
/*!
|
||||
* \param c this is not important
|
||||
* \param context which context to look in
|
||||
* \param exten which extension to get state
|
||||
* Returns extension state !! = AST_EXTENSION_???
|
||||
*/
|
||||
int ast_extension_state(struct ast_channel *c, char *context, char *exten);
|
||||
|
||||
//! Tells Asterisk the State for Device is changed
|
||||
/*!
|
||||
* \param device devicename like a dialstring
|
||||
* Asterisk polls the new extensionstates and calls the registered
|
||||
* callbacks for the changed extensions
|
||||
* Returns 0 on success, -1 on failure
|
||||
*/
|
||||
int ast_device_state_changed(char *device);
|
||||
|
||||
//! Registers a state change callback
|
||||
/*!
|
||||
* \param context which context to look in
|
||||
* \param exten which extension to get state
|
||||
* \param callback callback to call if state changed
|
||||
* \param data to pass to callback
|
||||
* The callback is called if the state for extension is changed
|
||||
* Return -1 on failure, ID on success
|
||||
*/
|
||||
int ast_extension_state_add(char *context, char *exten,
|
||||
ast_notify_cb_type callback, void *data);
|
||||
|
||||
//! Deletes a registered state change callback by ID
|
||||
/*!
|
||||
* \param id of the callback to delete
|
||||
* Removes the callback from list of callbacks
|
||||
* Return 0 on success, -1 on failure
|
||||
*/
|
||||
int ast_extension_state_del(int id);
|
||||
|
||||
//! If an extension exists, return non-zero
|
||||
/*!
|
||||
* \param hint buffer for hint
|
||||
* \param maxlen size of hint buffer
|
||||
* \param c this is not important
|
||||
* \param context which context to look in
|
||||
* \param exten which extension to search for
|
||||
* If an extension within the given context with the priority PRIORITY_HINT
|
||||
* is found a non zero value will be returned.
|
||||
* Otherwise, 0 is returned.
|
||||
*/
|
||||
int ast_get_hint(char *hint, int maxlen, struct ast_channel *c, char *context, char *exten);
|
||||
|
||||
//! If an extension exists, return non-zero
|
||||
// work
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user