more event code

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@154 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2005-12-14 22:58:19 +00:00
parent 230c5012a6
commit 6630e372c0
1 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,8 @@
#include "pablio.h"
#include <string.h>
#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;