FS-8190 #resolve [When using nixevent, freeswitch stops sending us certain custom event that were NOT part of the nixevent command]

This commit is contained in:
Anthony Minessale 2015-09-21 18:00:14 -05:00 committed by Brian West
parent bdc6c3b810
commit f8b19b7485
22 changed files with 442 additions and 13 deletions

View 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

View File

@ -216,6 +216,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,
@ -322,6 +329,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

View 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;
}

View File

@ -3421,6 +3421,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;
@ -3495,6 +3501,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;

View 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;
}

View File

@ -1334,6 +1334,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cv_load)
switch_application_interface_t *app_interface;
switch_api_interface_t *api_interface;
if (switch_event_reserve_subclass(MY_EVENT_VIDEO_DETECT) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_VIDEO_DETECT);
return SWITCH_STATUS_TERM;
}
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
MODULE_INTERFACE = *module_interface;
@ -1354,7 +1359,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cv_load)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cv_shutdown)
{
return SWITCH_STATUS_UNLOAD;
switch_event_free_subclass(MY_EVENT_VIDEO_DETECT);
return SWITCH_STATUS_UNLOAD;
}

View File

@ -5909,6 +5909,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);
@ -5926,6 +5931,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);

View File

@ -609,6 +609,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");
@ -640,6 +644,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;
}

View 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;
}

View 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)

View 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;

View File

@ -42,16 +42,6 @@
#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
*****************************************************************************/

View File

@ -508,6 +508,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);
@ -599,6 +605,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;

View 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();

View File

@ -1206,6 +1206,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 */
@ -1223,6 +1229,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;
}

View File

@ -1979,6 +1979,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);
@ -2070,6 +2110,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;

View File

@ -5749,6 +5749,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;
@ -5957,6 +6053,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");

View File

@ -5605,6 +5605,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
@ -5695,6 +5711,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);

View File

@ -1650,6 +1650,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;
@ -2450,6 +2479,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;
@ -2481,7 +2517,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++) {

View 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");
@ -5267,6 +5274,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
*/
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rayo_shutdown)
{
switch_event_free_subclass("rayo::cpa");
switch_status_t result = do_shutdown();
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Module shutdown\n");
return result;

View 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();

View 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)
{