mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
Fresh updates (Beware... all coded today)
*) Rename *event_handler* to state_handler to avoid confusion with newer eventing engine. *) Allow application level of state_handler to be layered/stacked (up to 30) *) Add new core global state_handler stack (also up to 30.. seems reasonable, constant in switch_types.h) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@554 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -192,18 +192,20 @@ SWITCH_DECLARE(switch_status) switch_channel_clear_flag(switch_channel *channel,
|
||||
SWITCH_DECLARE(switch_status) switch_channel_answer(switch_channel *channel);
|
||||
|
||||
/*!
|
||||
\brief Assign an event handler table to a given channel
|
||||
\param channel channel on which to assign the event handler table
|
||||
\param event_handlers table of event handler functions
|
||||
\brief add an event handler table to a given channel
|
||||
\param channel channel on which to add the event handler table
|
||||
\param state_handler table of event handler functions
|
||||
\return the index number/priority of the table negative value indicates failure
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_event_handlers(switch_channel *channel, const struct switch_event_handler_table *event_handlers);
|
||||
SWITCH_DECLARE(int) switch_channel_add_state_handler(switch_channel *channel, const switch_state_handler_table *state_handler);
|
||||
|
||||
/*!
|
||||
\brief Retrieve an event handler tablefrom a given channel
|
||||
\brief Retrieve an event handler tablefrom a given channel at given index level
|
||||
\param channel channel from which to retrieve the event handler table
|
||||
\return given channel's event handler table
|
||||
\param index the index of the event handler table (start from 0)
|
||||
\return given channel's event handler table at given index or NULL if requested index does not exist.
|
||||
*/
|
||||
SWITCH_DECLARE(const struct switch_event_handler_table *) switch_channel_get_event_handlers(switch_channel *channel);
|
||||
SWITCH_DECLARE(const switch_state_handler_table *) switch_channel_get_state_handler(switch_channel *channel, int index);
|
||||
|
||||
/*!
|
||||
\brief Set private data on channel
|
||||
|
||||
@@ -115,6 +115,26 @@ SWITCH_DECLARE(switch_status) switch_core_destroy(void);
|
||||
///\}
|
||||
|
||||
|
||||
|
||||
///\defgroup sh State Handlers
|
||||
///\ingroup core1
|
||||
///\{
|
||||
/*!
|
||||
\brief Add a global state handler
|
||||
\param state_handler a state handler to add
|
||||
\return the current index/priority of this handler
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_core_add_state_handler(const switch_state_handler_table *state_handler);
|
||||
|
||||
/*!
|
||||
\brief Access a state handler
|
||||
\param index the desired index to access
|
||||
\return the desired state handler table or NULL when it does not exist.
|
||||
*/
|
||||
SWITCH_DECLARE(const switch_state_handler_table *) switch_core_get_state_handler(int index);
|
||||
///\}
|
||||
|
||||
|
||||
///\defgroup memp Memory Pooling/Allocation
|
||||
///\ingroup core1
|
||||
///\{
|
||||
|
||||
@@ -47,19 +47,19 @@ extern "C" {
|
||||
|
||||
/*! \brief A table of functions to execute at various states
|
||||
*/
|
||||
struct switch_event_handler_table {
|
||||
struct switch_state_handler_table {
|
||||
/*! executed when the state changes to init */
|
||||
switch_event_handler on_init;
|
||||
switch_state_handler on_init;
|
||||
/*! executed when the state changes to ring */
|
||||
switch_event_handler on_ring;
|
||||
switch_state_handler on_ring;
|
||||
/*! executed when the state changes to execute */
|
||||
switch_event_handler on_execute;
|
||||
switch_state_handler on_execute;
|
||||
/*! executed when the state changes to hangup */
|
||||
switch_event_handler on_hangup;
|
||||
switch_state_handler on_hangup;
|
||||
/*! executed when the state changes to loopback*/
|
||||
switch_event_handler on_loopback;
|
||||
switch_state_handler on_loopback;
|
||||
/*! executed when the state changes to transmit*/
|
||||
switch_event_handler on_transmit;
|
||||
switch_state_handler on_transmit;
|
||||
};
|
||||
|
||||
/*! \brief Node in which to store custom outgoing channel callback hooks */
|
||||
@@ -183,7 +183,7 @@ struct switch_endpoint_interface {
|
||||
const switch_io_routines *io_routines;
|
||||
|
||||
/*! state machine methods */
|
||||
const switch_event_handler_table *event_handlers;
|
||||
const switch_state_handler_table *state_handler;
|
||||
|
||||
/*! private information */
|
||||
void *private;
|
||||
|
||||
@@ -43,7 +43,7 @@ extern "C" {
|
||||
|
||||
#define SWITCH_RECCOMMENDED_BUFFER_SIZE 131072
|
||||
#define SWITCH_MAX_CODECS 30
|
||||
|
||||
#define SWITCH_MAX_STATE_HANDLERS 30
|
||||
|
||||
/*!
|
||||
\enum switch_ivr_option_t
|
||||
@@ -359,7 +359,7 @@ typedef struct switch_caller_profile switch_caller_profile;
|
||||
typedef struct switch_caller_step switch_caller_step;
|
||||
typedef struct switch_caller_extension switch_caller_extension;
|
||||
typedef struct switch_caller_application switch_caller_application;
|
||||
typedef struct switch_event_handler_table switch_event_handler_table;
|
||||
typedef struct switch_state_handler_table switch_state_handler_table;
|
||||
typedef struct switch_timer switch_timer;
|
||||
typedef struct switch_codec switch_codec;
|
||||
typedef struct switch_core_thread_session switch_core_thread_session;
|
||||
@@ -383,7 +383,7 @@ typedef struct switch_speech_interface switch_speech_interface;
|
||||
typedef void (*switch_application_function)(switch_core_session *, char *);
|
||||
typedef void (*switch_event_callback_t)(switch_event *);
|
||||
typedef switch_caller_extension *(*switch_dialplan_hunt_function)(switch_core_session *);
|
||||
typedef switch_status (*switch_event_handler)(switch_core_session *);
|
||||
typedef switch_status (*switch_state_handler)(switch_core_session *);
|
||||
typedef switch_status (*switch_outgoing_channel_hook)(switch_core_session *, switch_caller_profile *, switch_core_session *);
|
||||
typedef switch_status (*switch_answer_channel_hook)(switch_core_session *);
|
||||
typedef switch_status (*switch_receive_message_hook)(switch_core_session *, switch_core_session_message *);
|
||||
|
||||
Reference in New Issue
Block a user