mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-04 22:47:59 +00:00
Don't load module interfaces without a name. We use that name for reference in the hash, it is required.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4372 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1ec6bad02c
commit
562471068e
@ -99,16 +99,23 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
if (new_module->module_interface->endpoint_interface) {
|
||||
const switch_endpoint_interface_t *ptr;
|
||||
for (ptr = new_module->module_interface->endpoint_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load endpoint interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Endpoint '%s'\n", ptr->interface_name);
|
||||
switch_core_hash_insert(loadable_modules.endpoint_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->codec_interface) {
|
||||
const switch_codec_implementation_t *impl;
|
||||
const switch_codec_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->codec_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load codec interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
for (impl = ptr->implementations; impl; impl = impl->next) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
|
||||
"Adding Codec '%s' (%s) %dhz %dms\n",
|
||||
@ -127,11 +134,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->dialplan_interface) {
|
||||
const switch_dialplan_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->dialplan_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load dialplan interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Dialplan '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "dialplan");
|
||||
@ -141,11 +152,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.dialplan_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->timer_interface) {
|
||||
const switch_timer_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->timer_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load timer interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Timer '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "timer");
|
||||
@ -155,11 +170,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.timer_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->application_interface) {
|
||||
const switch_application_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->application_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load application interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Application '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "application");
|
||||
@ -172,11 +191,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
(char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->api_interface) {
|
||||
const switch_api_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->api_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load api interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding API Function '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "api");
|
||||
@ -188,11 +211,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.api_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->file_interface) {
|
||||
const switch_file_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->file_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load file interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; ptr->extens[i]; i++) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding File Format '%s'\n", ptr->extens[i]);
|
||||
@ -205,11 +232,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->speech_interface) {
|
||||
const switch_speech_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->speech_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load speech interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Speech interface '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "speech");
|
||||
@ -219,11 +250,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.speech_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->asr_interface) {
|
||||
const switch_asr_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->asr_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load asr interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Asr interface '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "asr");
|
||||
@ -233,11 +268,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.asr_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->directory_interface) {
|
||||
const switch_directory_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->directory_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load directory interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Directory interface '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "directory");
|
||||
@ -247,11 +286,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.directory_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->chat_interface) {
|
||||
const switch_chat_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->chat_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load chat interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Chat interface '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "chat");
|
||||
@ -261,11 +304,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.chat_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_module->module_interface->say_interface) {
|
||||
const switch_say_interface_t *ptr;
|
||||
|
||||
for (ptr = new_module->module_interface->say_interface; ptr; ptr = ptr->next) {
|
||||
if (!ptr->interface_name) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load say interface from %s due to no interface name.\n", key);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Say interface '%s'\n", ptr->interface_name);
|
||||
if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "say");
|
||||
@ -275,6 +322,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
||||
switch_core_hash_insert(loadable_modules.say_hash, (char *) ptr->interface_name, (void *) ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user