add soundsdir configure var and sounds_dir global freeswitch var

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16241 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2010-01-11 16:32:35 +00:00
parent 146c7f8daa
commit d1c60899de
11 changed files with 32 additions and 26 deletions

View File

@ -25,7 +25,7 @@ DEFAULT_SOUNDS=en-us-callie-8000
echo $$full_sound_dir | grep music >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
if test "$$target_prefix" = "sounds"; then \
if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)@soundsdir@/; else $(GETSOUNDS) $$soundfile ; fi; \
else \
cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
fi

View File

@ -53,7 +53,7 @@
<!-- If TTS is enabled all audio-file params beginning with -->
<!-- 'say:' will be considered text to say with TTS -->
<!-- Set a default path here so you can use relative paths in the other sound params-->
<param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
<!-- File to play to acknowledge succees -->
<!--<param name="ack-sound" value="beep.wav"/>-->
<!-- File to play to acknowledge failure -->
@ -106,7 +106,7 @@
<param name="rate" value="16000"/>
<param name="interval" value="20"/>
<param name="energy-level" value="300"/>
<param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
<param name="alone-sound" value="conference/conf-alone.wav"/>
@ -131,7 +131,7 @@
<param name="rate" value="32000"/>
<param name="interval" value="20"/>
<param name="energy-level" value="300"/>
<param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
<param name="alone-sound" value="conference/conf-alone.wav"/>
@ -156,7 +156,7 @@
<param name="rate" value="48000"/>
<param name="interval" value="10"/>
<param name="energy-level" value="300"/>
<param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
<param name="alone-sound" value="conference/conf-alone.wav"/>

View File

@ -1,6 +1,6 @@
<configuration name="local_stream.conf" description="stream files from local dir">
<!-- fallback to default if requested moh class isn't found -->
<directory name="default" path="$${base_dir}/sounds/music/8000">
<directory name="default" path="$${sounds_dir}/music/8000">
<param name="rate" value="8000"/>
<param name="shuffle" value="true"/>
<param name="channels" value="1"/>
@ -14,7 +14,7 @@
<!--<param name="chime-max" value="500"/>-->
</directory>
<directory name="moh/8000" path="$${base_dir}/sounds/music/8000">
<directory name="moh/8000" path="$${sounds_dir}/music/8000">
<param name="rate" value="8000"/>
<param name="shuffle" value="true"/>
<param name="channels" value="1"/>
@ -22,7 +22,7 @@
<param name="timer-name" value="soft"/>
</directory>
<directory name="moh/16000" path="$${base_dir}/sounds/music/16000">
<directory name="moh/16000" path="$${sounds_dir}/music/16000">
<param name="rate" value="16000"/>
<param name="shuffle" value="true"/>
<param name="channels" value="1"/>
@ -30,7 +30,7 @@
<param name="timer-name" value="soft"/>
</directory>
<directory name="moh/32000" path="$${base_dir}/sounds/music/32000">
<directory name="moh/32000" path="$${sounds_dir}/music/32000">
<param name="rate" value="32000"/>
<param name="shuffle" value="true"/>
<param name="channels" value="1"/>
@ -38,7 +38,7 @@
<param name="timer-name" value="soft"/>
</directory>
<!--
<directory name="moh/48000" path="$${base_dir}/sounds/music/48000">
<directory name="moh/48000" path="$${sounds_dir}/music/48000">
<param name="rate" value="48000"/>
<param name="shuffle" value="true"/>
<param name="channels" value="1"/>

View File

@ -1,5 +1,5 @@
<include>
<language name="en" sound-path="$${base_dir}/sounds/en/us/callie" tts-engine="cepstral" tts-voice="callie">
<language name="en" sound-path="$${sounds_dir}/en/us/callie" tts-engine="cepstral" tts-voice="callie">
<X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
<!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/> <!-- vm/tts.xml if you want to use tts and have cepstral -->

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--тестовые файлы Вы звуковые файлы можно взять тут svn co http://svn.freeswitch.ru/bbv/mod_say_ru/ru/ -->
<include>
<language name="ru" sound-path="$${base_dir}/sounds/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
<language name="ru" sound-path="$${sounds_dir}/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
<X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
<!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/> <!-- vm/tts.xml if you want to use tts and have cepstral -->

View File

@ -15,7 +15,6 @@
<X-PRE-PROCESS cmd="set" data="default_password=1234"/>
<!-- Did you change it yet? -->
<X-PRE-PROCESS cmd="set" data="sound_prefix=$${base_dir}/sounds/en/us/callie"/>
<!--
This setting is what sets the default domain FreeSWITCH will use if all else fails.

View File

@ -56,6 +56,10 @@ htdocsdir="${prefix}/htdocs"
AC_SUBST(htdocsdir)
AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
soundsdir="${prefix}/sounds"
AC_SUBST(soundsdir)
AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
grammardir="${prefix}/grammar"
AC_SUBST(grammardir)
AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])

View File

@ -377,6 +377,7 @@ struct switch_directories {
char *grammar_dir;
char *storage_dir;
char *recordings_dir;
char *sounds_dir;
};
typedef struct switch_directories switch_directories;

View File

@ -159,8 +159,8 @@ static switch_status_t do_snap(switch_core_session_t *session)
switch_time_exp_lt(&tm, switch_time_make(switch_epoch_time_now(NULL), 0));
switch_strftime(date, &retsize, sizeof(date), "%Y_%m_%d_%H_%M_%S", &tm);
file = switch_core_session_sprintf(session, "%s%ssounds%s%s_%s.wav", SWITCH_GLOBAL_dirs.base_dir,
SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, cb->base, date);
file = switch_core_session_sprintf(session, "%s%s%s_%s.wav", SWITCH_GLOBAL_dirs.sounds_dir,
SWITCH_PATH_SEPARATOR, cb->base, date);
switch_core_session_get_read_impl(session, &read_impl);
fh.channels = 0;

View File

@ -466,6 +466,14 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
#endif
}
if (!SWITCH_GLOBAL_dirs.sounds_dir && (SWITCH_GLOBAL_dirs.sounds_dir = (char *) malloc(BUFSIZE))) {
#ifdef SWITCH_SOUNDS_DIR
switch_snprintf(SWITCH_GLOBAL_dirs.sounds_dir, BUFSIZE, "%s", SWITCH_SOUNDS_DIR);
#else
switch_snprintf(SWITCH_GLOBAL_dirs.sounds_dir, BUFSIZE, "%s%ssounds", 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);
@ -529,6 +537,7 @@ SWITCH_DECLARE(void) switch_core_set_globals(void)
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.sounds_dir);
switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
}
@ -1178,7 +1187,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
{
switch_uuid_t uuid;
char guess_ip[256];
char *dir_path;
int mask = 0;
struct in_addr in;
char hostname[256] = "";
@ -1215,10 +1223,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
}
switch_assert(runtime.memory_pool != NULL);
dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_safe_free(dir_path);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.base_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.mod_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.conf_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
@ -1229,6 +1233,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
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.sounds_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);
@ -1264,6 +1269,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
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_variable("sound_prefix", SWITCH_GLOBAL_dirs.sounds_dir);
switch_core_set_variable("sounds_dir", SWITCH_GLOBAL_dirs.sounds_dir);
switch_core_set_serial();
switch_console_init(runtime.memory_pool);
@ -1803,6 +1810,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.recordings_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
switch_core_hash_destroy(&runtime.global_vars);

View File

@ -2136,12 +2136,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, c
if (sound_path) {
switch_channel_set_variable(channel, "sound_prefix", sound_path);
} else {
switch_channel_set_variable_printf(channel, "sound_prefix", "%s%ssounds%s%s",
SWITCH_GLOBAL_dirs.base_dir,
SWITCH_PATH_SEPARATOR,
SWITCH_PATH_SEPARATOR,
chan_lang);
}
if ((si = switch_loadable_module_get_say_interface(module_name))) {