]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add soundsdir configure var and sounds_dir global freeswitch var
authorMichael Jerris <mike@jerris.com>
Mon, 11 Jan 2010 16:32:35 +0000 (16:32 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 11 Jan 2010 16:32:35 +0000 (16:32 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16241 d0543943-73ff-0310-b7d9-9358b9ac24b2

Makefile.am
conf/autoload_configs/conference.conf.xml
conf/autoload_configs/local_stream.conf.xml
conf/lang/en/en.xml
conf/lang/ru/ru.xml
conf/vars.xml
configure.in
src/include/switch_types.h
src/mod/applications/mod_snapshot/mod_snapshot.c
src/switch_core.c
src/switch_ivr.c

index 9a3b442f64073b225ec24bdbebb985fd43602103..c85df6145ae982ca3109f7fc843ce3aa2a678d91 100644 (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
index 1f49e22696f79f46a840f39f66a5260791830d1c..cab0578a5723edfc119912e6aed9243d50224517 100644 (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 -->
       <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"/>
       <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"/>
       <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"/>
index a1948483d09f2c3cba66870e4a21241a70232a44..94a566539222731bb11c471b2544ce4f1c15c9ad 100755 (executable)
@@ -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"/>
index 1b3215f96cf6f71436e19eb9ccd1c69d1b2641f2..6bd5a7d5fbde5ac4dabe3a2ab07b5a93e66eab38 100644 (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 -->
index df2fc7849e719645a8c2907af9fd1089dafc0dc6..25d63b611012964106a09cf666eb6f6589cbea68 100644 (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 -->
index 3ea2c308b8a098de775b4c35fb2319d425e414a4..8edff0346598d65f74f1592b826b506536d42307 100644 (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.
       
index 5db3b82b90b1f7e89b691c324f9a64e7e3373f72..42232f44963fff5c0a1e1503d1f0a698166423ad 100644 (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])
index 02bdb5abe937581800a7ccac93c61a0da4a47e8c..fb00af9314ea2a7feb18f469374a810ad908f6d7 100644 (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;
index 35917ecbfa3a59fd13cb48473e75926d3ebeef44..a73e846d0fa807a40a61f2a7d87597b3696056a0 100644 (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;
index 30dc569209f8ae2fb68e20c74f426daba373be23..bbf016feee26767e7787fc601759082b6875b659 100644 (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);
index a4a1ee653543e15f9e022748f3241776fa1b77e1..da64244646117d933c4d06adeed0f23ed1e13b7d 100644 (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))) {