diff --git a/conf/modules.conf b/conf/modules.conf index d9fd14eb61..fb67358a63 100644 --- a/conf/modules.conf +++ b/conf/modules.conf @@ -3,39 +3,42 @@ ; If this option is the first one the rest of them will be ignored ;load => all +; Extension will be chosen automaticly if not specified (.dll for windows, .so for UNIX) +; Full paths will be taken "as is" (eg /some/dir/mymod.so) + ; Event Handlers -load => mod_zeroconf.so -load => mod_xmpp_event.so +load => mod_zeroconf +load => mod_xmpp_event ; Directory Interfaces -load => mod_ldap.so +load => mod_ldap ; Endpoints -load => mod_exosip.so -load => mod_iax.so -load => mod_woomera.so +load => mod_exosip +load => mod_iax +load => mod_woomera ; Applications -load => mod_bridgecall.so -load => mod_ivrtest.so -load => mod_playback.so +load => mod_bridgecall +load => mod_ivrtest +load => mod_playback ; Dialplan Interfaces -load => mod_dialplan_demo.so -load => mod_dialplan_directory.so -load => mod_pcre.so +load => mod_dialplan_demo +load => mod_dialplan_directory +load => mod_pcre ; Codec Interfaces -load => mod_g711.so -load => mod_gsm.so -load => mod_l16.so -load => mod_speex.so +load => mod_g711 +load => mod_gsm +load => mod_l16 +load => mod_speex ; File Format Interfaces -load => mod_sndfile.so +load => mod_sndfile ; Timers -load => mod_softtimer.so +load => mod_softtimer diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index a584a51d53..d4a1448ea7 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -194,6 +194,13 @@ static void process_module_file(char *dir, char *fname) char *file; switch_loadable_module *new_module = NULL; +#ifdef WIN32 + const char *ext = ".dll"; +#else + const char *ext = ".so"; +#endif + + if (!(file = switch_core_strdup(loadable_modules.pool, fname))) { return; } @@ -201,9 +208,15 @@ static void process_module_file(char *dir, char *fname) if (*file == '/') { path = switch_core_strdup(loadable_modules.pool, file); } else { - len = strlen(dir) + strlen(file) + 3; - path = (char *) switch_core_alloc(loadable_modules.pool, len); - snprintf(path, len, "%s/%s", dir, file); + if (strchr(file, '.')) { + len = strlen(dir) + strlen(file) + 3; + path = (char *) switch_core_alloc(loadable_modules.pool, len); + snprintf(path, len, "%s/%s", dir, file); + } else { + len = strlen(dir) + strlen(file) + 7; + path = (char *) switch_core_alloc(loadable_modules.pool, len); + snprintf(path, len, "%s/%s%s", dir, file, ext); + } } if (switch_loadable_module_load_file(path, loadable_modules.pool, &new_module) == SWITCH_STATUS_SUCCESS) { @@ -354,7 +367,8 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init() switch_console_printf(SWITCH_CHANNEL_CONSOLE, "This option must be the first one to work."); } } else { - if (!strstr(val, ext) && !strstr(val, EXT)) { + if (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) { + switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid extension for %s\n", val); continue; } process_module_file((char *) SWITCH_MOD_DIR, (char *) val);