From 6630e372c06dc5d0f369ec3aee96dd9be30a1267 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 14 Dec 2005 22:58:19 +0000 Subject: [PATCH] more event code git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@154 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/mod_portaudio/mod_portaudio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mod/mod_portaudio/mod_portaudio.c b/src/mod/mod_portaudio/mod_portaudio.c index 12248d6efe..7ea4c7a7bf 100644 --- a/src/mod/mod_portaudio/mod_portaudio.c +++ b/src/mod/mod_portaudio/mod_portaudio.c @@ -37,6 +37,8 @@ #include "pablio.h" #include +#define MY_EVENT_RINGING 100 + static const char modname[] = "mod_portaudio"; static switch_memory_pool *module_pool; @@ -244,6 +246,9 @@ static switch_status channel_on_transmit(switch_core_session *session) engage_device(tech_pvt); while(switch_channel_get_state(channel) == CS_TRANSMIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) { + char buf[512]; + snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id); + switch_event_fire_subclass(SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING, buf); if (switch_time_now() - last >= waitsec) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id); last = switch_time_now(); @@ -487,6 +492,8 @@ static const switch_loadable_module_interface channel_module_interface = { }; + + SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename) { if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) { @@ -501,6 +508,11 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul dump_info(); + if (switch_event_reserve_subclass(MY_EVENT_RINGING, "SoundCard Ringing") != SWITCH_STATUS_SUCCESS) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!"); + return SWITCH_STATUS_GENERR; + } + /* connect my internal structure to the blank pointer passed to me */ *interface = &channel_module_interface;