提交 56247106 authored 作者: Michael Jerris's avatar Michael Jerris

Don't load module interfaces without a name. We use that name for reference in…

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
上级 1ec6bad0
...@@ -99,16 +99,23 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable ...@@ -99,16 +99,23 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
if (new_module->module_interface->endpoint_interface) { if (new_module->module_interface->endpoint_interface) {
const switch_endpoint_interface_t *ptr; const switch_endpoint_interface_t *ptr;
for (ptr = new_module->module_interface->endpoint_interface; ptr; ptr = ptr->next) { 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_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); switch_core_hash_insert(loadable_modules.endpoint_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->codec_interface) { if (new_module->module_interface->codec_interface) {
const switch_codec_implementation_t *impl; const switch_codec_implementation_t *impl;
const switch_codec_interface_t *ptr; const switch_codec_interface_t *ptr;
for (ptr = new_module->module_interface->codec_interface; ptr; ptr = ptr->next) { 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) { for (impl = ptr->implementations; impl; impl = impl->next) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
"Adding Codec '%s' (%s) %dhz %dms\n", "Adding Codec '%s' (%s) %dhz %dms\n",
...@@ -127,11 +134,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable ...@@ -127,11 +134,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
} }
} }
}
if (new_module->module_interface->dialplan_interface) { if (new_module->module_interface->dialplan_interface) {
const switch_dialplan_interface_t *ptr; const switch_dialplan_interface_t *ptr;
for (ptr = new_module->module_interface->dialplan_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "dialplan"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.dialplan_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->timer_interface) { if (new_module->module_interface->timer_interface) {
const switch_timer_interface_t *ptr; const switch_timer_interface_t *ptr;
for (ptr = new_module->module_interface->timer_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "timer"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.timer_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->application_interface) { if (new_module->module_interface->application_interface) {
const switch_application_interface_t *ptr; const switch_application_interface_t *ptr;
for (ptr = new_module->module_interface->application_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "application"); 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 ...@@ -172,11 +191,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
(char *) ptr->interface_name, (void *) ptr); (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->api_interface) { if (new_module->module_interface->api_interface) {
const switch_api_interface_t *ptr; const switch_api_interface_t *ptr;
for (ptr = new_module->module_interface->api_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "api"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.api_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->file_interface) { if (new_module->module_interface->file_interface) {
const switch_file_interface_t *ptr; const switch_file_interface_t *ptr;
for (ptr = new_module->module_interface->file_interface; ptr; ptr = ptr->next) { 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; int i;
for (i = 0; ptr->extens[i]; 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]); 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 ...@@ -205,11 +232,15 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
} }
} }
} }
}
if (new_module->module_interface->speech_interface) { if (new_module->module_interface->speech_interface) {
const switch_speech_interface_t *ptr; const switch_speech_interface_t *ptr;
for (ptr = new_module->module_interface->speech_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "speech"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.speech_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->asr_interface) { if (new_module->module_interface->asr_interface) {
const switch_asr_interface_t *ptr; const switch_asr_interface_t *ptr;
for (ptr = new_module->module_interface->asr_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "asr"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.asr_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->directory_interface) { if (new_module->module_interface->directory_interface) {
const switch_directory_interface_t *ptr; const switch_directory_interface_t *ptr;
for (ptr = new_module->module_interface->directory_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "directory"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.directory_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->chat_interface) { if (new_module->module_interface->chat_interface) {
const switch_chat_interface_t *ptr; const switch_chat_interface_t *ptr;
for (ptr = new_module->module_interface->chat_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "chat"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.chat_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
if (new_module->module_interface->say_interface) { if (new_module->module_interface->say_interface) {
const switch_say_interface_t *ptr; const switch_say_interface_t *ptr;
for (ptr = new_module->module_interface->say_interface; ptr; ptr = ptr->next) { 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); 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) { if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "say"); 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 ...@@ -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); switch_core_hash_insert(loadable_modules.say_hash, (char *) ptr->interface_name, (void *) ptr);
} }
} }
}
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论