summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild_tools/make_defaults_h36
-rw-r--r--main/asterisk.c29
2 files changed, 34 insertions, 31 deletions
diff --git a/build_tools/make_defaults_h b/build_tools/make_defaults_h
index dfd3bc2a6..0aae60804 100755
--- a/build_tools/make_defaults_h
+++ b/build_tools/make_defaults_h
@@ -2,25 +2,27 @@
cat << END
/*
* defaults.h
- * Automatically generated
+ * Automatically generated from build options,
+ * only used in main/asterisk.c
*/
-#define AST_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
-#define AST_RUN_DIR "${INSTALL_PATH}${ASTVARRUNDIR}"
-#define AST_SOCKET "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.ctl"
-#define AST_PID "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
-#define AST_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
-#define AST_SPOOL_DIR "${INSTALL_PATH}${ASTSPOOLDIR}"
-#define AST_VAR_DIR "${INSTALL_PATH}${ASTVARLIBDIR}"
-#define AST_DATA_DIR "${INSTALL_PATH}${ASTDATADIR}"
-#define AST_LOG_DIR "${INSTALL_PATH}${ASTLOGDIR}"
-#define AST_AGI_DIR "${INSTALL_PATH}${AGI_DIR}"
-#define AST_KEY_DIR "${INSTALL_PATH}${ASTDATADIR}/keys"
-#define AST_DB "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
-#define AST_TMP_DIR "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
+#define DEFAULT_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
-#define AST_CONFIG_FILE "${INSTALL_PATH}${ASTCONFPATH}"
+#define DEFAULT_CONFIG_DIR "${INSTALL_PATH}${ASTETCDIR}"
+#define DEFAULT_MODULE_DIR "${INSTALL_PATH}${MODULES_DIR}"
+#define DEFAULT_AGI_DIR "${INSTALL_PATH}${AGI_DIR}"
+#define DEFAULT_LOG_DIR "${INSTALL_PATH}${ASTLOGDIR}"
-#define AST_SOUNDS "${INSTALL_PATH}${ASTDATADIR}/sounds"
-#define AST_IMAGES "${INSTALL_PATH}${ASTDATADIR}/images"
+#define DEFAULT_RUN_DIR "${INSTALL_PATH}${ASTVARRUNDIR}"
+#define DEFAULT_SOCKET "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.ctl"
+#define DEFAULT_PID "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
+
+#define DEFAULT_VAR_DIR "${INSTALL_PATH}${ASTVARLIBDIR}"
+#define DEFAULT_DB "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
+
+#define DEFAULT_DATA_DIR "${INSTALL_PATH}${ASTDATADIR}"
+#define DEFAULT_KEY_DIR "${INSTALL_PATH}${ASTDATADIR}/keys"
+
+#define DEFAULT_SPOOL_DIR "${INSTALL_PATH}${ASTSPOOLDIR}"
+#define DEFAULT_TMP_DIR "${INSTALL_PATH}${ASTSPOOLDIR}/tmp"
END
diff --git a/main/asterisk.c b/main/asterisk.c
index dbc44387d..05813e18d 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -164,7 +164,8 @@ long option_minmemfree; /*!< Minimum amount of free system memory - stop acce
/*! @} */
-char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
+/* XXX tmpdir is a subdir of the spool directory, and no way to remap it */
+char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR;
static int ast_socket = -1; /*!< UNIX Socket for allowing remote control */
static int ast_consock = -1; /*!< UNIX Socket for controlling another asterisk */
@@ -2402,7 +2403,7 @@ static void ast_readconfig(void)
{
struct ast_config *cfg;
struct ast_variable *v;
- char *config = AST_CONFIG_FILE;
+ char *config = DEFAULT_CONFIG_FILE;
char hostname[MAXHOSTNAMELEN] = "";
struct ast_flags config_flags = { 0 };
struct {
@@ -2418,19 +2419,19 @@ static void ast_readconfig(void)
cfg = ast_config_load(config, config_flags);
/* init with buildtime config */
- ast_copy_string(ast_config_AST_CONFIG_DIR, AST_CONFIG_DIR, sizeof(ast_config_AST_CONFIG_DIR));
- ast_copy_string(ast_config_AST_SPOOL_DIR, AST_SPOOL_DIR, sizeof(ast_config_AST_SPOOL_DIR));
- ast_copy_string(ast_config_AST_MODULE_DIR, AST_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
+ ast_copy_string(ast_config_AST_CONFIG_DIR, DEFAULT_CONFIG_DIR, sizeof(ast_config_AST_CONFIG_DIR));
+ ast_copy_string(ast_config_AST_SPOOL_DIR, DEFAULT_SPOOL_DIR, sizeof(ast_config_AST_SPOOL_DIR));
+ ast_copy_string(ast_config_AST_MODULE_DIR, DEFAULT_MODULE_DIR, sizeof(ast_config_AST_MODULE_DIR));
snprintf(ast_config_AST_MONITOR_DIR, sizeof(ast_config_AST_MONITOR_DIR) - 1, "%s/monitor", ast_config_AST_SPOOL_DIR);
- ast_copy_string(ast_config_AST_VAR_DIR, AST_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
- ast_copy_string(ast_config_AST_DATA_DIR, AST_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
- ast_copy_string(ast_config_AST_LOG_DIR, AST_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
- ast_copy_string(ast_config_AST_AGI_DIR, AST_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
- ast_copy_string(ast_config_AST_DB, AST_DB, sizeof(ast_config_AST_DB));
- ast_copy_string(ast_config_AST_KEY_DIR, AST_KEY_DIR, sizeof(ast_config_AST_KEY_DIR));
- ast_copy_string(ast_config_AST_PID, AST_PID, sizeof(ast_config_AST_PID));
- ast_copy_string(ast_config_AST_SOCKET, AST_SOCKET, sizeof(ast_config_AST_SOCKET));
- ast_copy_string(ast_config_AST_RUN_DIR, AST_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
+ ast_copy_string(ast_config_AST_VAR_DIR, DEFAULT_VAR_DIR, sizeof(ast_config_AST_VAR_DIR));
+ ast_copy_string(ast_config_AST_DATA_DIR, DEFAULT_DATA_DIR, sizeof(ast_config_AST_DATA_DIR));
+ ast_copy_string(ast_config_AST_LOG_DIR, DEFAULT_LOG_DIR, sizeof(ast_config_AST_LOG_DIR));
+ ast_copy_string(ast_config_AST_AGI_DIR, DEFAULT_AGI_DIR, sizeof(ast_config_AST_AGI_DIR));
+ ast_copy_string(ast_config_AST_DB, DEFAULT_DB, sizeof(ast_config_AST_DB));
+ ast_copy_string(ast_config_AST_KEY_DIR, DEFAULT_KEY_DIR, sizeof(ast_config_AST_KEY_DIR));
+ ast_copy_string(ast_config_AST_PID, DEFAULT_PID, sizeof(ast_config_AST_PID));
+ ast_copy_string(ast_config_AST_SOCKET, DEFAULT_SOCKET, sizeof(ast_config_AST_SOCKET));
+ ast_copy_string(ast_config_AST_RUN_DIR, DEFAULT_RUN_DIR, sizeof(ast_config_AST_RUN_DIR));
/* no asterisk.conf? no problem, use buildtime config! */
if (!cfg) {