diff --git a/Makefile.am b/Makefile.am
index b91dc14a4f..b190d93d79 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -320,6 +320,7 @@ install-data-local:
@for x in mod db log log/xml_cdr bin scripts grammar recordings ; do \
$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
done
+ $(mkinstalldirs) $(DESTDIR)@recordingsdir@
$(mkinstalldirs) $(DESTDIR)@modinstdir@
test -d $(DESTDIR)@confdir@ || $(MAKE) samples-conf
test -d $(DESTDIR)$(prefix)/htdocs || $(MAKE) samples-htdocs
diff --git a/conf/autoload_configs/conference.conf.xml b/conf/autoload_configs/conference.conf.xml
index 68315e2b2e..1f49e22696 100644
--- a/conf/autoload_configs/conference.conf.xml
+++ b/conf/autoload_configs/conference.conf.xml
@@ -97,7 +97,7 @@
diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml
index e2eaba3458..57897ac237 100644
--- a/conf/dialplan/default.xml
+++ b/conf/dialplan/default.xml
@@ -247,7 +247,7 @@
-
+
diff --git a/conf/sip_profiles/internal-ipv6.xml b/conf/sip_profiles/internal-ipv6.xml
index 519d143192..755e172dbf 100644
--- a/conf/sip_profiles/internal-ipv6.xml
+++ b/conf/sip_profiles/internal-ipv6.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml
index 6c435b04f9..13cd3fd3ec 100644
--- a/conf/sip_profiles/internal.xml
+++ b/conf/sip_profiles/internal.xml
@@ -79,7 +79,7 @@
-
+
diff --git a/configure.in b/configure.in
index 725b4a378e..e282429878 100644
--- a/configure.in
+++ b/configure.in
@@ -46,6 +46,10 @@ AC_ARG_WITH([rundir],
AC_SUBST(rundir)
AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${rundir}",[where to put pidfile to])
+recordingsdir="${prefix}/recordings"
+AC_SUBST(recordingsdir)
+AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
+
if test "$sysconfdir" = "\${prefix}/etc" ; then
confdir="$prefix/conf"
else
diff --git a/src/mod/endpoints/mod_skypiax/configs/default.xml b/src/mod/endpoints/mod_skypiax/configs/default.xml
index 64b41650da..3a8ca4d017 100644
--- a/src/mod/endpoints/mod_skypiax/configs/default.xml
+++ b/src/mod/endpoints/mod_skypiax/configs/default.xml
@@ -195,7 +195,7 @@
-
+
diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c
index 2d8bbca0ae..ea58353e46 100644
--- a/src/mod/endpoints/mod_sofia/sofia.c
+++ b/src/mod/endpoints/mod_sofia/sofia.c
@@ -5144,7 +5144,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
if (!strcasecmp(rec_header, "on")) {
char *file = NULL, *tmp = NULL;
- tmp = switch_mprintf("%s%s%s", profile->record_path ? profile->record_path : "${base_dir}/recordings",
+ tmp = switch_mprintf("%s%s%s", profile->record_path ? profile->record_path : "${recordings_dir}",
SWITCH_PATH_SEPARATOR, profile->record_template);
file = switch_channel_expand_variables(channel, tmp);
switch_ivr_record_session(session, file, 0, NULL);
diff --git a/src/switch_core.c b/src/switch_core.c
index e1960a7355..288cc227e7 100644
--- a/src/switch_core.c
+++ b/src/switch_core.c
@@ -458,6 +458,14 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
#endif
}
+ if (!SWITCH_GLOBAL_dirs.recordings_dir && (SWITCH_GLOBAL_dirs.recordings_dir = (char *) malloc(BUFSIZE))) {
+#ifdef SWITCH_RECORDINGS_DIR
+ switch_snprintf(SWITCH_GLOBAL_dirs.recordings_dir, BUFSIZE, "%s", SWITCH_RECORDINGS_DIR);
+#else
+ switch_snprintf(SWITCH_GLOBAL_dirs.recordings_dir, BUFSIZE, "%s%srecordings", base_dir, SWITCH_PATH_SEPARATOR);
+#endif
+ }
+
if (!SWITCH_GLOBAL_dirs.storage_dir && (SWITCH_GLOBAL_dirs.storage_dir = (char *) malloc(BUFSIZE))) {
#ifdef SWITCH_STORAGE_DIR
switch_snprintf(SWITCH_GLOBAL_dirs.storage_dir, BUFSIZE, "%s", SWITCH_STORAGE_DIR);
@@ -520,6 +528,7 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
switch_assert(SWITCH_GLOBAL_dirs.script_dir);
switch_assert(SWITCH_GLOBAL_dirs.htdocs_dir);
switch_assert(SWITCH_GLOBAL_dirs.grammar_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.recordings_dir);
switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
}
@@ -1219,6 +1228,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.script_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.htdocs_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+ switch_dir_make_recursive(SWITCH_GLOBAL_dirs.recordings_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_mutex_init(&runtime.uuid_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
@@ -1253,6 +1263,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET6);
switch_core_set_variable("local_ip_v6", guess_ip);
switch_core_set_variable("base_dir", SWITCH_GLOBAL_dirs.base_dir);
+ switch_core_set_variable("recordings_dir", SWITCH_GLOBAL_dirs.recordings_dir);
switch_core_set_serial();
switch_console_init(runtime.memory_pool);
@@ -1791,6 +1802,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_safe_free(SWITCH_GLOBAL_dirs.script_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
+ switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
switch_core_hash_destroy(&runtime.global_vars);