diff --git a/conf/vanilla/autoload_configs/blacklist.conf.xml b/conf/vanilla/autoload_configs/blacklist.conf.xml
index a981ebbdb0..9995febd83 100644
--- a/conf/vanilla/autoload_configs/blacklist.conf.xml
+++ b/conf/vanilla/autoload_configs/blacklist.conf.xml
@@ -5,7 +5,7 @@
NOTE: make sure the file exists and is readable by FreeSWITCH.
-
+
-->
diff --git a/conf/vanilla/autoload_configs/callcenter.conf.xml b/conf/vanilla/autoload_configs/callcenter.conf.xml
index a069413ac6..fbc02c4a10 100644
--- a/conf/vanilla/autoload_configs/callcenter.conf.xml
+++ b/conf/vanilla/autoload_configs/callcenter.conf.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/cdr_pg_csv.conf.xml b/conf/vanilla/autoload_configs/cdr_pg_csv.conf.xml
index 4fec817b45..9891455f8a 100644
--- a/conf/vanilla/autoload_configs/cdr_pg_csv.conf.xml
+++ b/conf/vanilla/autoload_configs/cdr_pg_csv.conf.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/erlang_event.conf.xml b/conf/vanilla/autoload_configs/erlang_event.conf.xml
index 62deb84f67..7f627668ef 100644
--- a/conf/vanilla/autoload_configs/erlang_event.conf.xml
+++ b/conf/vanilla/autoload_configs/erlang_event.conf.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/fax.conf.xml b/conf/vanilla/autoload_configs/fax.conf.xml
index c7d825665e..d6a5ff734b 100644
--- a/conf/vanilla/autoload_configs/fax.conf.xml
+++ b/conf/vanilla/autoload_configs/fax.conf.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/format_cdr.conf.xml b/conf/vanilla/autoload_configs/format_cdr.conf.xml
index 227bcb4722..0c42e78b40 100644
--- a/conf/vanilla/autoload_configs/format_cdr.conf.xml
+++ b/conf/vanilla/autoload_configs/format_cdr.conf.xml
@@ -46,7 +46,7 @@
-
+
@@ -63,21 +63,21 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
-
-
+
+
-
+
-
+
diff --git a/conf/vanilla/autoload_configs/httapi.conf.xml b/conf/vanilla/autoload_configs/httapi.conf.xml
index 50bbe78f40..d0b357d0fe 100644
--- a/conf/vanilla/autoload_configs/httapi.conf.xml
+++ b/conf/vanilla/autoload_configs/httapi.conf.xml
@@ -100,8 +100,8 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
-
-
+
+
@@ -109,14 +109,14 @@
-
+
-
+
diff --git a/conf/vanilla/autoload_configs/http_cache.conf.xml b/conf/vanilla/autoload_configs/http_cache.conf.xml
index 5d0294c662..cd6ec119b4 100644
--- a/conf/vanilla/autoload_configs/http_cache.conf.xml
+++ b/conf/vanilla/autoload_configs/http_cache.conf.xml
@@ -3,12 +3,12 @@
-
+
-
+
diff --git a/conf/vanilla/autoload_configs/java.conf.xml b/conf/vanilla/autoload_configs/java.conf.xml
index 5f71553e30..1da38f487f 100644
--- a/conf/vanilla/autoload_configs/java.conf.xml
+++ b/conf/vanilla/autoload_configs/java.conf.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/lua.conf.xml b/conf/vanilla/autoload_configs/lua.conf.xml
index f50307ea89..fafd336169 100644
--- a/conf/vanilla/autoload_configs/lua.conf.xml
+++ b/conf/vanilla/autoload_configs/lua.conf.xml
@@ -13,7 +13,7 @@
These entries will be pre-pended to the LUA_PATH environment variable
-->
-
+
diff --git a/conf/vanilla/autoload_configs/perl.conf.xml b/conf/vanilla/autoload_configs/perl.conf.xml
index b2435000ff..0249119230 100644
--- a/conf/vanilla/autoload_configs/perl.conf.xml
+++ b/conf/vanilla/autoload_configs/perl.conf.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/conf/vanilla/autoload_configs/voicemail.conf.xml b/conf/vanilla/autoload_configs/voicemail.conf.xml
index 9e5e67ffa3..8052d611f1 100644
--- a/conf/vanilla/autoload_configs/voicemail.conf.xml
+++ b/conf/vanilla/autoload_configs/voicemail.conf.xml
@@ -64,7 +64,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/xml_cdr.conf.xml b/conf/vanilla/autoload_configs/xml_cdr.conf.xml
index ac9b1f94d3..d4c4bea8d9 100644
--- a/conf/vanilla/autoload_configs/xml_cdr.conf.xml
+++ b/conf/vanilla/autoload_configs/xml_cdr.conf.xml
@@ -35,7 +35,7 @@
-
+
@@ -52,20 +52,20 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
-
-
+
+
-
+
-
+
diff --git a/conf/vanilla/autoload_configs/xml_curl.conf.xml b/conf/vanilla/autoload_configs/xml_curl.conf.xml
index 30951d83c8..de0de0293a 100644
--- a/conf/vanilla/autoload_configs/xml_curl.conf.xml
+++ b/conf/vanilla/autoload_configs/xml_curl.conf.xml
@@ -24,8 +24,8 @@
Specify your public key with 'ssl-cert-path' and the private key with
'ssl-key-path'. If your private key has a password, specify it with
'ssl-key-password'. -->
-
-
+
+
@@ -33,14 +33,14 @@
-
+
-
+
diff --git a/conf/vanilla/dialplan/default.xml b/conf/vanilla/dialplan/default.xml
index 8c4a1f0312..8971939ec2 100644
--- a/conf/vanilla/dialplan/default.xml
+++ b/conf/vanilla/dialplan/default.xml
@@ -129,7 +129,7 @@
-
+
@@ -598,14 +598,14 @@
-
+
-
+
@@ -675,14 +675,14 @@
-
+
-
+
@@ -710,7 +710,7 @@
-
+
diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml
index 583db26db3..9e6a93ae2a 100644
--- a/conf/vanilla/sip_profiles/internal.xml
+++ b/conf/vanilla/sip_profiles/internal.xml
@@ -307,7 +307,7 @@
-
+
diff --git a/conf/vanilla/vars.xml b/conf/vanilla/vars.xml
index 20016cd85f..0b161854ff 100644
--- a/conf/vanilla/vars.xml
+++ b/conf/vanilla/vars.xml
@@ -28,6 +28,18 @@
recordings_dir
sound_prefix
sounds_dir
+ conf_dir
+ log_dir
+ run_dir
+ db_dir
+ mod_dir
+ htdocs_dir
+ script_dir
+ temp_dir
+ grammar_dir
+ certs_dir
+ storage
+ cache_dir
core_uuid
zrtp_enabled
nat_public_addr
@@ -117,7 +129,7 @@
false - implies forbidden
true - implies mandatory
- default if not set is accept SAVP inbound if offered.
+ default if not set is accept SAVP inbound if offered.
rtp_secure_media_inbound | rtp_secure_media_outbound
diff --git a/configure.ac b/configure.ac
index 8b0a47e478..02b5e7159c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,6 +84,7 @@ default_runtimedir="$rundir"
default_scriptdir="$prefix/scripts"
default_soundsdir="$prefix/sounds"
default_storagedir="$prefix/storage"
+default_cachedir="$prefix/cache"
if test "$enable_fhs" = yes; then
prefix="/usr" exec_prefix="$prefix"
@@ -102,6 +103,7 @@ if test "$enable_fhs" = yes; then
default_scriptdir="/usr/share/freeswitch/scripts"
default_soundsdir="/usr/share/freeswitch/sounds"
default_storagedir="/var/lib/freeswitch/storage"
+ default_cachedir="/var/cache/freeswitch"
fi
# Where to install the modules
@@ -161,6 +163,11 @@ AC_ARG_WITH([storagedir],
AC_SUBST(storagedir)
AC_DEFINE_UNQUOTED([SWITCH_STORAGE_DIR],"${storagedir}",[where to put storage files])
+AC_ARG_WITH([cachedir],
+ [AS_HELP_STRING([--with-cachedir=DIR], [Put cache files into this location (default: $prefix/cache)])], [cachedir="$withval"], [cachedir="${default_cachedir}"])
+AC_SUBST(cachedir)
+AC_DEFINE_UNQUOTED([SWITCH_CACHE_DIR],"${cachedir}",[where to put cache files])
+
if test "$sysconfdir" = "\${prefix}/etc" ; then
confdir="$prefix/conf"
else
@@ -1748,5 +1755,6 @@ echo " runtimedir: ${runtimedir}"
echo " scriptdir: ${scriptdir}"
echo " soundsdir: ${soundsdir}"
echo " storagedir: ${storagedir}"
+echo " cachedir: ${cachedir}"
echo ""
echo "------------------------------------------------------------------------------"
diff --git a/src/include/switch_types.h b/src/include/switch_types.h
index 55f1bd1614..988cd13e63 100644
--- a/src/include/switch_types.h
+++ b/src/include/switch_types.h
@@ -510,6 +510,7 @@ struct switch_directories {
char *htdocs_dir;
char *grammar_dir;
char *storage_dir;
+ char *cache_dir;
char *recordings_dir;
char *sounds_dir;
char *lib_dir;
diff --git a/src/switch.c b/src/switch.c
index c0d3a84f7a..2433535152 100644
--- a/src/switch.c
+++ b/src/switch.c
@@ -478,6 +478,7 @@ static const char usage[] =
"\t-certs [directory] -- alternate directory for certificates\n"
"\t-recordings [directory] -- alternate directory for recordings\n"
"\t-storage [directory] -- alternate directory for voicemail storage\n"
+ "\t-cache [directory] -- alternate directory for cache files\n"
"\t-sounds [directory] -- alternate directory for sound files\n";
@@ -929,6 +930,21 @@ int main(int argc, char *argv[])
strcpy(SWITCH_GLOBAL_dirs.storage_dir, local_argv[x]);
}
+ else if (!strcmp(local_argv[x], "-cache")) {
+ x++;
+ if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
+ fprintf(stderr, "When using -cache you must specify a cache directory\n");
+ return 255;
+ }
+
+ SWITCH_GLOBAL_dirs.cache_dir = (char *) malloc(strlen(local_argv[x]) + 1);
+ if (!SWITCH_GLOBAL_dirs.cache_dir) {
+ fprintf(stderr, "Allocation error\n");
+ return 255;
+ }
+ strcpy(SWITCH_GLOBAL_dirs.cache_dir, local_argv[x]);
+ }
+
else if (!strcmp(local_argv[x], "-recordings")) {
x++;
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
diff --git a/src/switch_core.c b/src/switch_core.c
index b2b05e8b7a..7d5af36c28 100644
--- a/src/switch_core.c
+++ b/src/switch_core.c
@@ -726,6 +726,17 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
#endif
}
+ if (!SWITCH_GLOBAL_dirs.cache_dir && (SWITCH_GLOBAL_dirs.cache_dir = (char *) malloc(BUFSIZE))) {
+ if (SWITCH_GLOBAL_dirs.base_dir)
+ switch_snprintf(SWITCH_GLOBAL_dirs.cache_dir, BUFSIZE, "%s%scache", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
+ else
+#ifdef SWITCH_CACHE_DIR
+ switch_snprintf(SWITCH_GLOBAL_dirs.cache_dir, BUFSIZE, "%s", SWITCH_CACHE_DIR);
+#else
+ switch_snprintf(SWITCH_GLOBAL_dirs.cache_dir, BUFSIZE, "%s%scache", base_dir, SWITCH_PATH_SEPARATOR);
+#endif
+ }
+
if (!SWITCH_GLOBAL_dirs.db_dir && (SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(BUFSIZE))) {
if (SWITCH_GLOBAL_dirs.base_dir)
switch_snprintf(SWITCH_GLOBAL_dirs.db_dir, BUFSIZE, "%s%sdb", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
@@ -1717,6 +1728,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_core_set_variable("recordings_dir", SWITCH_GLOBAL_dirs.recordings_dir);
switch_core_set_variable("sound_prefix", SWITCH_GLOBAL_dirs.sounds_dir);
switch_core_set_variable("sounds_dir", SWITCH_GLOBAL_dirs.sounds_dir);
+ switch_core_set_variable("conf_dir", SWITCH_GLOBAL_dirs.conf_dir);
+ switch_core_set_variable("log_dir", SWITCH_GLOBAL_dirs.log_dir);
+ switch_core_set_variable("run_dir", SWITCH_GLOBAL_dirs.run_dir);
+ switch_core_set_variable("db_dir", SWITCH_GLOBAL_dirs.db_dir);
+ switch_core_set_variable("mod_dir", SWITCH_GLOBAL_dirs.mod_dir);
+ switch_core_set_variable("htdocs_dir", SWITCH_GLOBAL_dirs.htdocs_dir);
+ switch_core_set_variable("script_dir", SWITCH_GLOBAL_dirs.script_dir);
+ switch_core_set_variable("temp_dir", SWITCH_GLOBAL_dirs.temp_dir);
+ switch_core_set_variable("grammar_dir", SWITCH_GLOBAL_dirs.grammar_dir);
+ switch_core_set_variable("certs_dir", SWITCH_GLOBAL_dirs.certs_dir);
+ switch_core_set_variable("storage", SWITCH_GLOBAL_dirs.storage_dir);
+ switch_core_set_variable("cache_dir", SWITCH_GLOBAL_dirs.cache_dir);
switch_core_set_serial();
switch_console_init(runtime.memory_pool);
@@ -2702,6 +2725,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.storage_dir);
+ switch_safe_free(SWITCH_GLOBAL_dirs.cache_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.run_dir);