freetdm: set conf and mod directory in runtime

This commit is contained in:
Moises Silva 2010-09-21 13:56:11 -04:00
parent c296179535
commit 5e60c62e08
3 changed files with 26 additions and 2 deletions

View File

@ -4074,6 +4074,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load)
ftdm_global_set_logger(ftdm_logger);
ftdm_global_set_mod_directory(SWITCH_GLOBAL_dirs.mod_dir);
ftdm_global_set_config_directory(SWITCH_GLOBAL_dirs.conf_dir);
ftdm_cpu_monitor_disable();
if (ftdm_global_init() != FTDM_SUCCESS) {

View File

@ -41,8 +41,22 @@
#define FTDM_MOD_DIR "."
#endif
static char g_ftdm_config_dir[] = FTDM_CONFIG_DIR;
static char g_ftdm_mod_dir[] = FTDM_MOD_DIR;
#define FTDM_MAX_CONF_DIR 512
static char g_ftdm_config_dir[FTDM_MAX_CONF_DIR] = FTDM_CONFIG_DIR;
static char g_ftdm_mod_dir[FTDM_MAX_CONF_DIR] = FTDM_MOD_DIR;
FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path)
{
snprintf(g_ftdm_mod_dir, sizeof(g_ftdm_mod_dir), "%s", path);
ftdm_log(FTDM_LOG_DEBUG, "New mod directory: %s\n", g_ftdm_mod_dir);
}
FT_DECLARE(void) ftdm_global_set_config_directory(const char *path)
{
snprintf(g_ftdm_config_dir, sizeof(g_ftdm_config_dir), "%s", path);
ftdm_log(FTDM_LOG_DEBUG, "New config directory: %s\n", g_ftdm_config_dir);
}
int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path)
{

View File

@ -1301,6 +1301,12 @@ FT_DECLARE(void) ftdm_global_set_logger(ftdm_logger_t logger);
/*! \brief Set the default logger level */
FT_DECLARE(void) ftdm_global_set_default_logger(int level);
/*! \brief Set the directory to look for modules */
FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path);
/*! \brief Set the directory to look for configs */
FT_DECLARE(void) ftdm_global_set_config_directory(const char *path);
/*! \brief Check if the FTDM library is initialized and running */
FT_DECLARE(ftdm_bool_t) ftdm_running(void);