mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 22:38:38 +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:
1 parent
7ddaffbcd4
commit
9e85723e3f
8 files changed
+293
-75
No files matched your search
@@ -92,6 +92,26 @@ static void ivrtest_function(switch_core_session *session, char *data)
|
||||
}
|
||||
|
||||
|
||||
static switch_status my_on_hangup(switch_core_session *session)
|
||||
{
|
||||
switch_channel *channel;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "I globally hooked to [%s] on the hangup event\n", switch_channel_get_name(channel));
|
||||
|
||||
}
|
||||
|
||||
static const switch_state_handler_table state_handlers = {
|
||||
/*.on_init */ NULL,
|
||||
/*.on_ring */ NULL,
|
||||
/*.on_execute */ NULL,
|
||||
/*.on_hangup */ my_on_hangup,
|
||||
/*.on_loopback */ NULL,
|
||||
/*.on_transmit */ NULL
|
||||
};
|
||||
|
||||
static const switch_application_interface ivrtest_application_interface = {
|
||||
/*.interface_name */ "ivrtest",
|
||||
/*.application_function */ ivrtest_function
|
||||
@@ -112,6 +132,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*interface = &mod_ivrtest_module_interface;
|
||||
|
||||
/* test global state handlers */
|
||||
switch_core_add_state_handler(&state_handlers);
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
Reference in new issue
Block a user