[Freeswitch-svn] [commit] r13904 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Tue Jun 23 06:40:07 PDT 2009


Author: anthm
Date: Tue Jun 23 08:40:07 2009
New Revision: 13904

Log:
set sound path in say app

Modified:
   freeswitch/trunk/src/switch_ivr.c

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Tue Jun 23 08:40:07 2009
@@ -2009,7 +2009,33 @@
 											   const char *say_method, switch_input_args_t *args)
 {
 	switch_say_interface_t *si;
+	switch_channel_t *channel;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	const char *save_path = NULL, *chan_lang = NULL, *lang = NULL;
+	
+	switch_assert(session);
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel);
+
+	lang = switch_channel_get_variable(channel, "language");
+
+	if (!lang) {
+		chan_lang = switch_channel_get_variable(channel, "default_language");
+		if (!chan_lang) {
+			chan_lang = "en";
+		}
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang);
+	} else {
+		chan_lang = lang;
+	}
+
+	save_path = switch_channel_get_variable(channel, "sound_prefix");
+
+	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))) {
 		/* should go back and proto all the say mods to const.... */
@@ -2019,6 +2045,8 @@
 		status = SWITCH_STATUS_FALSE;
 	}
 
+	switch_channel_set_variable(channel, "sound_prefix", save_path);
+	
 	return status;
 }
 



More information about the Freeswitch-svn mailing list