]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8190: [mod_event_socket] When using nixevent, freeswitch stops sending us certain...
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 21 Sep 2015 23:00:14 +0000 (18:00 -0500)
committerMichael Jerris <mike@jerris.com>
Tue, 29 Sep 2015 15:19:25 +0000 (11:19 -0400)
21 files changed:
src/include/switch_event.h
src/mod/applications/mod_avmd/mod_avmd.c
src/mod/applications/mod_bert/mod_bert.c
src/mod/applications/mod_callcenter/mod_callcenter.c
src/mod/applications/mod_curl/mod_curl.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_sms/mod_sms.c
src/mod/applications/mod_sonar/mod_sonar.c
src/mod/applications/mod_spandsp/mod_spandsp.c
src/mod/applications/mod_spandsp/mod_spandsp.h
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/mod/applications/mod_vmd/mod_vmd.c
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
src/mod/endpoints/mod_loopback/mod_loopback.c
src/mod/endpoints/mod_rtmp/mod_rtmp.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_verto/mod_verto.c
src/mod/event_handlers/mod_event_socket/mod_event_socket.c
src/mod/event_handlers/mod_rayo/mod_rayo.c
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
src/switch_event.c

index 12f18a9b94e6ce0d3b9def25fc278b35ec7decf3..d13af7d4715bafd0a873d0e32db805617d9d111b 100644 (file)
@@ -254,6 +254,8 @@ SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, c
 SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name, switch_event_callback_t callback,
                                                                                                  void *user_data);
 
+SWITCH_DECLARE(switch_status_t) switch_event_get_custom_events(switch_console_callback_match_t **matches);
+
 /*!
   \brief Bind an event callback to a specific event
   \param id an identifier token of the binder
index 6d03322c68bc2910af6ce97c3c1f11a9a7d0d099..bc1caf1fa07cc34782af21dcfe47f3d99dd879d9 100644 (file)
@@ -221,6 +221,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
+
+       if (switch_event_reserve_subclass(AVMD_EVENT_BEEP) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", AVMD_EVENT_BEEP);
+               return SWITCH_STATUS_TERM;
+       }
+
+       
        switch_log_printf(
                SWITCH_CHANNEL_LOG,
                SWITCH_LOG_NOTICE,
@@ -327,6 +334,8 @@ SWITCH_STANDARD_APP(avmd_start_function)
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown)
 {
 
+       switch_event_free_subclass(AVMD_EVENT_BEEP);
+       
 #ifdef FASTMATH
        destroy_fast_acosf();
 #endif
index ca861cb25a935afff1fc00eb9485455df5a14828..f3b158578228bd07fbbded657b6e25cdccbbe597 100644 (file)
@@ -377,6 +377,24 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_bert_load)
 {
        switch_application_interface_t *app_interface = NULL;
 
+       if (switch_event_reserve_subclass(BERT_EVENT_TIMEOUT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_TIMEOUT);
+               return SWITCH_STATUS_TERM;
+       }
+       
+
+       if (switch_event_reserve_subclass(BERT_EVENT_LOST_SYNC) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_LOST_SYNC);
+               return SWITCH_STATUS_TERM;
+       }
+       
+       
+       if (switch_event_reserve_subclass(BERT_EVENT_IN_SYNC) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", BERT_EVENT_IN_SYNC);
+               return SWITCH_STATUS_TERM;
+       }
+       
+       
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
        SWITCH_ADD_APP(app_interface, "bert_test", "Start BERT Test", "Start BERT Test", bert_test_function, "", SAF_NONE); 
@@ -385,6 +403,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_bert_load)
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_bert_shutdown)
 {
+       switch_event_free_subclass(BERT_EVENT_TIMEOUT);
+       switch_event_free_subclass(BERT_EVENT_LOST_SYNC);
+       switch_event_free_subclass(BERT_EVENT_IN_SYNC);
+       
        return SWITCH_STATUS_UNLOAD;
 }
 
index 75c802b461b807333f855f8c6ac511560f73317e..ab0cda8b5ab9274a24138dbefa78bc5c67fd6cf3 100644 (file)
@@ -3345,6 +3345,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
        switch_api_interface_t *api_interface;
        switch_status_t status;
 
+
+       if (switch_event_reserve_subclass(CALLCENTER_EVENT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", CALLCENTER_EVENT);
+               return SWITCH_STATUS_TERM;
+       }
+
        memset(&globals, 0, sizeof(globals));
        globals.pool = pool;
 
@@ -3419,6 +3425,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown)
        switch_ssize_t keylen;
        int sanity = 0;
 
+
+       switch_event_free_subclass(CALLCENTER_EVENT);
+       
        switch_mutex_lock(globals.mutex);
        if (globals.running == 1) {
                globals.running = 0;
index 9b9c7cc12bccc22e9daf97b4d6d583196acc4bf8..4499fe4cea5071e4bb1dbaaf4e0b3a6ee6a7452a 100644 (file)
@@ -1014,6 +1014,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
 {
        switch_api_interface_t *api_interface;
        switch_application_interface_t *app_interface;
+
+       if (switch_event_reserve_subclass(HTTP_SENDFILE_ACK_EVENT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", HTTP_SENDFILE_ACK_EVENT);
+               return SWITCH_STATUS_TERM;
+       }
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -1037,6 +1043,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
   Macro expands to: switch_status_t mod_cidlookup_shutdown() */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown)
 {
+
+       switch_event_free_subclass(HTTP_SENDFILE_ACK_EVENT);
+       
        /* Cleanup dynamically allocated config settings */
        return SWITCH_STATUS_SUCCESS;
 }
index 0695b7e7c0c3665ab66690af62d01d46689068bb..d169936c2be251cf8cb87ca045b1e053aa08b47c 100644 (file)
@@ -5828,6 +5828,11 @@ SWITCH_STANDARD_APP(deduplicate_dtmf_app_function)
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dptools_shutdown)
 {
+
+       switch_event_free_subclass(FILE_STRING_CLOSE);
+       switch_event_free_subclass(FILE_STRING_FAIL);
+       switch_event_free_subclass(FILE_STRING_OPEN);
+
        switch_event_unbind_callback(pickup_pres_event_handler);
        switch_mutex_destroy(globals.pickup_mutex);
        switch_core_hash_destroy(&globals.pickup_hash);
@@ -5845,6 +5850,21 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        switch_chat_interface_t *chat_interface;
        switch_file_interface_t *file_interface;
 
+       if (switch_event_reserve_subclass(FILE_STRING_CLOSE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", FILE_STRING_CLOSE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(FILE_STRING_FAIL) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", FILE_STRING_FAIL);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(FILE_STRING_OPEN) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", FILE_STRING_OPEN);
+               return SWITCH_STATUS_TERM;
+       }
+
        globals.pool = pool;
        switch_core_hash_init(&globals.pickup_hash);
        switch_mutex_init(&globals.pickup_mutex, SWITCH_MUTEX_NESTED, globals.pool);
index 2283e5d3a28d3a29c2a99fc62bf9f7c87bb1350d..2f926e671bf85a04b16e958f11c453c2e17db16a 100644 (file)
@@ -577,6 +577,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load)
        switch_chat_interface_t *chat_interface;
        switch_chat_application_interface_t *chat_app_interface;
 
+       if (switch_event_reserve_subclass(MY_EVENT_DELIVERY_REPORT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_DELIVERY_REPORT);
+               return SWITCH_STATUS_TERM;
+       }
 
        if (switch_event_bind(modname, SWITCH_EVENT_CUSTOM, MY_EVENT_SEND_MESSAGE, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
@@ -608,6 +612,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sms_shutdown)
 {
        switch_event_unbind_callback(event_handler);
 
+       switch_event_free_subclass(MY_EVENT_DELIVERY_REPORT);
+       
        return SWITCH_STATUS_SUCCESS;
 }
 
index 2457703b55e5fabcfbc095af5749890c3001a1df..ebf641a351bab34358aced99c6dbb5e5d8451924 100644 (file)
@@ -218,6 +218,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load)
 {
        switch_application_interface_t *app_interface;
 
+       if (switch_event_reserve_subclass("sonar::ping") != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", "sonar::ping");
+               return SWITCH_STATUS_TERM;
+       }
+
+       
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -233,6 +239,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load)
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown)
 {
 
+       switch_event_free_subclass("sonar::ping");
+       
        return SWITCH_STATUS_SUCCESS;
 }
 
index 115802621576d9da91972c3806cedc9038f77cea..1fadb2f95d73844a72c7d455857aedd2fab8a233 100644 (file)
@@ -772,6 +772,42 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init)
        switch_application_interface_t *app_interface;
        switch_api_interface_t *api_interface;
 
+
+       if (switch_event_reserve_subclass(MY_EVENT_TDD_RECV_MESSAGE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_TDD_RECV_MESSAGE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(SPANDSP_EVENT_TXFAXNEGOCIATERESULT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_TXFAXNEGOCIATERESULT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(SPANDSP_EVENT_RXFAXNEGOCIATERESULT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_RXFAXNEGOCIATERESULT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(SPANDSP_EVENT_TXFAXPAGERESULT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_TXFAXPAGERESULT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(SPANDSP_EVENT_RXFAXPAGERESULT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_RXFAXPAGERESULT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(SPANDSP_EVENT_TXFAXRESULT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_TXFAXRESULT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(SPANDSP_EVENT_RXFAXRESULT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SPANDSP_EVENT_RXFAXRESULT);
+               return SWITCH_STATUS_TERM;
+       }
+       
        memset(&spandsp_globals, 0, sizeof(spandsp_globals));
        spandsp_globals.pool = pool;
 
@@ -855,7 +891,14 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spandsp_shutdown)
        switch_event_unbind_callback(event_handler);
        switch_event_unbind_callback(tdd_event_handler);
 
-
+       switch_event_free_subclass(MY_EVENT_TDD_RECV_MESSAGE);
+       switch_event_free_subclass(SPANDSP_EVENT_TXFAXNEGOCIATERESULT);
+       switch_event_free_subclass(SPANDSP_EVENT_RXFAXNEGOCIATERESULT);
+       switch_event_free_subclass(SPANDSP_EVENT_TXFAXPAGERESULT);
+       switch_event_free_subclass(SPANDSP_EVENT_RXFAXPAGERESULT);
+       switch_event_free_subclass(SPANDSP_EVENT_TXFAXRESULT);
+       switch_event_free_subclass(SPANDSP_EVENT_RXFAXRESULT);
+       
        mod_spandsp_fax_shutdown();
        mod_spandsp_dsp_shutdown();
 #if defined(MODEM_SUPPORT)
index 7f2f5d04a3e55abb3d46fdedf8d2b3ae2a7de58c..4c70103c287ea2c4cb8c131b432805c4d8193eec 100644 (file)
@@ -49,6 +49,17 @@ typedef int zap_socket_t;
 #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
 #include <spandsp.h>
 
+#define SPANDSP_EVENT_TXFAXRESULT "spandsp::txfaxresult"
+#define SPANDSP_EVENT_RXFAXRESULT "spandsp::rxfaxresult"
+
+#define SPANDSP_EVENT_TXFAXPAGERESULT "spandsp::txfaxpageresult"
+#define SPANDSP_EVENT_RXFAXPAGERESULT "spandsp::rxfaxpageresult"
+
+#define SPANDSP_EVENT_TXFAXNEGOCIATERESULT "spandsp::txfaxnegociateresult"
+#define SPANDSP_EVENT_RXFAXNEGOCIATERESULT "spandsp::rxfaxnegociateresult"
+
+
+
 /* The global stuff */
 struct spandsp_globals {
        switch_memory_pool_t *pool;
index 4a75b803ee8c39aef4fa34cb8726c908293bebd0..64758256b3825aa7f8c37148e5a0917338f3ba5f 100644 (file)
 #define DEFAULT_FEC_ENTRIES         3
 #define DEFAULT_FEC_SPAN            3
 
-#define SPANDSP_EVENT_TXFAXRESULT "spandsp::txfaxresult"
-#define SPANDSP_EVENT_RXFAXRESULT "spandsp::rxfaxresult"
-
-#define SPANDSP_EVENT_TXFAXPAGERESULT "spandsp::txfaxpageresult"
-#define SPANDSP_EVENT_RXFAXPAGERESULT "spandsp::rxfaxpageresult"
-
-#define SPANDSP_EVENT_TXFAXNEGOCIATERESULT "spandsp::txfaxnegociateresult"
-#define SPANDSP_EVENT_RXFAXNEGOCIATERESULT "spandsp::rxfaxnegociateresult"
-
-
 /*****************************************************************************
        OUR DEFINES AND STRUCTS
 *****************************************************************************/
index f50e090a0c849db841d3053e570eb82846a32219..eeffca20d6c027831bcc9ffa955a60480601ae05 100644 (file)
@@ -516,6 +516,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_vmd_load)
 {
        switch_application_interface_t *app_interface;
        switch_api_interface_t *api_interface;
+
+       if (switch_event_reserve_subclass(VMD_EVENT_BEEP) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", VMD_EVENT_BEEP);
+               return SWITCH_STATUS_TERM;
+       }
+
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -607,6 +613,8 @@ SWITCH_STANDARD_APP(vmd_start_function)
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_vmd_shutdown)
 {
+
+       switch_event_free_subclass(VMD_EVENT_BEEP);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Voicemail detection disabled\n");
 
        return SWITCH_STATUS_SUCCESS;
index e349ddfaa9f45147625b491b15b051c409a97dae..ea563869fb0bf4b0b1b653cf4ca16c25a6d0ae01 100644 (file)
@@ -4393,6 +4393,21 @@ static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool)
  */
 SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load)
 {
+       if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CREATE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CREATE);
+               return SWITCH_STATUS_TERM;
+       }
+       
+       if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CLOSE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CLOSE);
+               return SWITCH_STATUS_TERM;
+       }
+       
+       if (switch_event_reserve_subclass(MY_EVENT_PROFILE_OPEN) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_OPEN);
+               return SWITCH_STATUS_TERM;
+       }
+       
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -4449,6 +4464,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load)
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown)
 {
+
+       switch_event_free_subclass(MY_EVENT_PROFILE_CREATE);
+       switch_event_free_subclass(MY_EVENT_PROFILE_CLOSE);
+       switch_event_free_subclass(MY_EVENT_PROFILE_OPEN);
+       
        synth_shutdown();
        recog_shutdown();
 
index b0cde67f07d2bd236de23650ad3c5c53aac01de4..ebc5da76e3a77dbf32d266b83f3a2138c58b081f 100644 (file)
@@ -1195,6 +1195,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
 {
        switch_application_interface_t *app_interface;
 
+       if (switch_event_reserve_subclass("loopback::bowout") != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", "loopback::bowout");
+               return SWITCH_STATUS_TERM;
+       }
+
+       
        memset(&globals, 0, sizeof(globals));
 
        /* connect my internal structure to the blank pointer passed to me */
@@ -1212,6 +1218,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_loopback_shutdown)
 {
+
+       switch_event_free_subclass("loopback::bowout");
+       
        return SWITCH_STATUS_SUCCESS;
 }
 
index 2ec48628ae2a4973be38900cfb3df889705bcc95..d442a68afc4dc1855b03d5dc9b85a4d58bc7d45b 100644 (file)
@@ -1835,6 +1835,46 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rtmp_load)
        switch_api_interface_t *api_interface;
        rtmp_globals.pool = pool;
 
+       if (switch_event_reserve_subclass(RTMP_EVENT_CONNECT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_CONNECT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_DISCONNECT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_DISCONNECT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_REGISTER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_REGISTER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_UNREGISTER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_UNREGISTER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_LOGIN) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_LOGIN);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_LOGOUT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_LOGOUT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_DETACH) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_DETACH);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(RTMP_EVENT_ATTACH) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", RTMP_EVENT_ATTACH);
+               return SWITCH_STATUS_TERM;
+       }
+       
        memset(&rtmp_globals, 0, sizeof(rtmp_globals));
 
        switch_mutex_init(&rtmp_globals.mutex, SWITCH_MUTEX_NESTED, pool);
@@ -1925,6 +1965,15 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rtmp_shutdown)
 {
        switch_hash_index_t *hi = NULL;
 
+       switch_event_free_subclass(RTMP_EVENT_CONNECT);
+       switch_event_free_subclass(RTMP_EVENT_DISCONNECT);
+       switch_event_free_subclass(RTMP_EVENT_REGISTER);
+       switch_event_free_subclass(RTMP_EVENT_UNREGISTER);
+       switch_event_free_subclass(RTMP_EVENT_LOGIN);
+       switch_event_free_subclass(RTMP_EVENT_LOGOUT);
+       switch_event_free_subclass(RTMP_EVENT_DETACH);
+       switch_event_free_subclass(RTMP_EVENT_ATTACH);
+       
        switch_mutex_lock(rtmp_globals.mutex);
        while ((hi = switch_core_hash_first_iter( rtmp_globals.profile_hash, hi))) {
                void *val;      
index 53d7baa31c21e21cbff5f64530af95119454d701..8429cf917b65917024d3ef608fccc3b16f3f9660 100644 (file)
@@ -5690,6 +5690,102 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
        switch_application_interface_t *app_interface;
        struct in_addr in;
 
+
+       if (switch_event_reserve_subclass(MY_EVENT_NOTIFY_REFER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_NOTIFY_REFER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_NOTIFY_WATCHED_HEADER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_NOTIFY_WATCHED_HEADER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_UNREGISTER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_UNREGISTER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_PROFILE_START) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_START);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_REINVITE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_REINVITE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_REPLACED) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_REPLACED);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_TRANSFEROR) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_TRANSFEROR);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_TRANSFEREE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_TRANSFEREE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_ERROR) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_ERROR);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_INTERCEPTED) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_INTERCEPTED);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_GATEWAY_STATE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_GATEWAY_STATE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_SIP_USER_STATE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_SIP_USER_STATE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_GATEWAY_DEL) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_GATEWAY_DEL);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_EXPIRE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_EXPIRE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_REGISTER_ATTEMPT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_REGISTER_ATTEMPT);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_REGISTER_FAILURE) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_REGISTER_FAILURE);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_PRE_REGISTER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PRE_REGISTER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_REGISTER) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_REGISTER);
+               return SWITCH_STATUS_TERM;
+       }
+
+       if (switch_event_reserve_subclass(MY_EVENT_GATEWAY_ADD) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_GATEWAY_ADD);
+               return SWITCH_STATUS_TERM;
+       }
+       
        memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
        mod_sofia_globals.destroy_private.destroy_nh = 1;
        mod_sofia_globals.destroy_private.is_static = 1;
@@ -5898,6 +5994,26 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
        int i;
        switch_status_t st;
 
+       switch_event_free_subclass(MY_EVENT_NOTIFY_REFER);
+       switch_event_free_subclass(MY_EVENT_NOTIFY_WATCHED_HEADER);
+       switch_event_free_subclass(MY_EVENT_UNREGISTER);
+       switch_event_free_subclass(MY_EVENT_PROFILE_START);
+       switch_event_free_subclass(MY_EVENT_REINVITE);
+       switch_event_free_subclass(MY_EVENT_REPLACED);
+       switch_event_free_subclass(MY_EVENT_TRANSFEROR);
+       switch_event_free_subclass(MY_EVENT_TRANSFEREE);
+       switch_event_free_subclass(MY_EVENT_ERROR);
+       switch_event_free_subclass(MY_EVENT_INTERCEPTED);
+       switch_event_free_subclass(MY_EVENT_GATEWAY_STATE);
+       switch_event_free_subclass(MY_EVENT_SIP_USER_STATE);
+       switch_event_free_subclass(MY_EVENT_GATEWAY_DEL);
+       switch_event_free_subclass(MY_EVENT_EXPIRE);
+       switch_event_free_subclass(MY_EVENT_REGISTER_ATTEMPT);
+       switch_event_free_subclass(MY_EVENT_REGISTER_FAILURE);
+       switch_event_free_subclass(MY_EVENT_PRE_REGISTER);
+       switch_event_free_subclass(MY_EVENT_REGISTER);
+       switch_event_free_subclass(MY_EVENT_GATEWAY_ADD);
+       
        switch_console_del_complete_func("::sofia::list_profiles");
        switch_console_set_complete("del sofia");
 
index d392f130b35f8750dbb7ff08bbf114ff6bbb759c..2c105250ed7df88ff49d281df6acac42ae84d849 100644 (file)
@@ -5411,6 +5411,22 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
        switch_cache_db_handle_t *dbh;
        //switch_application_interface_t *app_interface = NULL;
 
+
+       if (switch_event_reserve_subclass(MY_EVENT_LOGIN) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_LOGIN);
+               return SWITCH_STATUS_TERM;
+       }
+       
+       if (switch_event_reserve_subclass(MY_EVENT_CLIENT_DISCONNECT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_CLIENT_DISCONNECT);
+               return SWITCH_STATUS_TERM;
+       }
+       
+       if (switch_event_reserve_subclass(MY_EVENT_CLIENT_CONNECT) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_CLIENT_CONNECT);
+               return SWITCH_STATUS_TERM;
+       }
+       
        memset(&globals, 0, sizeof(globals));
        globals.pool = pool;
 #ifndef WIN32
@@ -5501,6 +5517,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
   Macro expands to: switch_status_t mod_verto_shutdown() */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_verto_shutdown)
 {
+
+       switch_event_free_subclass(MY_EVENT_LOGIN);
+       switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT);
+       switch_event_free_subclass(MY_EVENT_CLIENT_CONNECT);
+       
        json_cleanup();
        switch_core_hash_destroy(&json_GLOBALS.store_hash);
 
index ae64880216c4ffc86bc34eb5b329e413e7305957..9e6cb7b93873afe531b279809bd58ef3d9176415 100644 (file)
@@ -1635,6 +1635,35 @@ static switch_bool_t auth_api_command(listener_t *listener, const char *api_cmd,
 
 }
 
+static void set_all_custom(listener_t *listener)
+{
+       switch_console_callback_match_t *events = NULL;
+       switch_console_callback_match_node_t *m;
+
+       if (switch_event_get_custom_events(&events) == SWITCH_STATUS_SUCCESS) {
+               for (m = events->head; m; m = m->next) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "ADDING CUSTOM EVENT: %s\n", m->val);
+                       switch_core_hash_insert(listener->event_hash, m->val, MARKER);
+               }
+               
+               switch_console_free_matches(&events);
+       }
+}
+
+static void set_allowed_custom(listener_t *listener)
+{
+       switch_hash_index_t *hi = NULL;
+       const void *var;
+       void *val;
+
+       switch_assert(listener->allowed_event_hash);
+       
+       for (hi = switch_core_hash_first(listener->allowed_event_hash); hi; hi = switch_core_hash_next(&hi)) {
+               switch_core_hash_this(hi, &var, NULL, &val);
+               switch_core_hash_insert(listener->event_hash, (char *)var, MARKER);
+       }
+}
+
 static switch_status_t parse_command(listener_t *listener, switch_event_t **event, char *reply, uint32_t reply_len)
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -2435,6 +2464,13 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                                                for (x = 0; x < SWITCH_EVENT_ALL; x++) {
                                                        listener->event_list[x] = 1;
                                                }
+
+                                               if (!listener->allowed_event_hash) {
+                                                       set_all_custom(listener);
+                                               } else {
+                                                       set_allowed_custom(listener);
+                                               }
+
                                        }
                                        if (type <= SWITCH_EVENT_ALL) {
                                                listener->event_list[type] = 1;
@@ -2466,7 +2502,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                uint8_t custom = 0;
 
                strip_cr(cmd);
-               cur = cmd + 5;
+               cur = cmd + 8;
 
                if (cur && (cur = strchr(cur, ' '))) {
                        for (cur++; cur; count++) {
index 4a008e9b8487a5668803eefb8b07bd85c280fe55..11828ce32832e99c3e1205edf1f994f5cb6251fb 100644 (file)
@@ -5158,6 +5158,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
        switch_api_interface_t *api_interface;
        switch_application_interface_t *app_interface;
 
+
+       if (switch_event_reserve_subclass("rayo::cpa") != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", "rayo::cpa");
+               return SWITCH_STATUS_TERM;
+       }
+
+       
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading module\n");
@@ -5266,8 +5273,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
  * Shutdown module.  Notifies threads to stop.
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rayo_shutdown)
-{
-       switch_status_t result = do_shutdown();
+{      
+       switch_status_t result;
+
+       switch_event_free_subclass("rayo::cpa");
+       result = do_shutdown();
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Module shutdown\n");
        return result;
 }
index c271ffb359381275dea9d40b391e1214f5c1fed2..c0d0f55cc9f21d0c64194dc1f6fb8cdf2b238366 100644 (file)
@@ -160,6 +160,12 @@ static switch_status_t do_config(void)
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load)
 {
+
+       if (switch_event_reserve_subclass("websocket::stophook") != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", "websocket::stophook");
+               return SWITCH_STATUS_TERM;
+       }
+       
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -1268,6 +1274,8 @@ void stop_all_websockets()
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown)
 {
 
+       switch_event_free_subclass("websocket::stophook");
+       
        /* Cann't find a way to stop the websockets, use this for a workaround before finding the real one that works */
        stop_all_websockets();
 
index 1ac6433bdec6322863ec1efd5adea04de7d88dce..423c751ebc05cafc26d7b0b0337ca34ceb852a38 100644 (file)
@@ -1993,6 +1993,22 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con
        return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_event_get_custom_events(switch_console_callback_match_t **matches)
+{
+       switch_hash_index_t *hi = NULL;
+       const void *var;
+       void *val;
+       int x = 0;
+       
+       for (hi = switch_core_hash_first(CUSTOM_HASH); hi; hi = switch_core_hash_next(&hi)) {
+               switch_core_hash_this(hi, &var, NULL, &val);
+               switch_console_push_match(matches, (const char *) var);
+               x++;
+       }
+
+       return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name,
                                                                                                                        switch_event_callback_t callback, void *user_data, switch_event_node_t **node)
 {