]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
more event code
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 14 Dec 2005 22:58:19 +0000 (22:58 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 14 Dec 2005 22:58:19 +0000 (22:58 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@154 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/mod_portaudio/mod_portaudio.c

index 12248d6efe5f60c8590a41faa148113fb6709a1a..7ea4c7a7bf5d93993a8a099bb1ecb5177572ded2 100644 (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;