prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout);
}
-#define SAY_SYNTAX "<module_name> <say_type> <say_method> [<say_gender>] <text>"
+#define SAY_SYNTAX "<module_name>:<lang> <say_type> <say_method> [<say_gender>] <text>"
SWITCH_STANDARD_APP(say_function)
{
char *argv[5] = { 0 };
const char *save_path = NULL, *chan_lang = NULL, *lang = NULL, *lname = NULL, *sound_path = NULL;
switch_event_t *hint_data;
switch_xml_t cfg, xml = NULL, language, macros;
-
+ char *p;
switch_assert(session);
channel = switch_core_session_get_channel(session);
switch_assert(channel);
- lang = switch_channel_get_variable(channel, "language");
+ if (zstr(module_name)) {
+ module_name = "en";
+ }
- if (!lang) {
- chan_lang = switch_channel_get_variable(channel, "default_language");
- if (!chan_lang) {
- chan_lang = "en";
+ if (module_name) {
+ p = switch_core_session_strdup(session, module_name);
+ module_name = p;
+
+ if ((p = strchr(module_name, ':'))) {
+ *p++ = '\0';
+ chan_lang = p;
+ }
+ }
+
+ if (!chan_lang) {
+ lang = switch_channel_get_variable(channel, "language");
+
+ if (!lang) {
+ chan_lang = switch_channel_get_variable(channel, "default_language");
+ if (!chan_lang) {
+ chan_lang = module_name;
+ }
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang);
+ } else {
+ chan_lang = lang;
}
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang);
- } else {
- chan_lang = lang;
}
switch_event_create(&hint_data, SWITCH_EVENT_REQUEST_PARAMS);
if (sound_path) {
switch_channel_set_variable(channel, "sound_prefix", sound_path);
+ p = switch_core_session_strdup(session, sound_path);
+ sound_path = p;
}
+ if (xml) {
+ switch_xml_free(xml);
+ }
+
if ((si = switch_loadable_module_get_say_interface(module_name))) {
/* should go back and proto all the say mods to const.... */
switch_say_args_t say_args = {0};
if (save_path) {
switch_channel_set_variable(channel, "sound_prefix", save_path);
}
-
- if (xml) {
- switch_xml_free(xml);
- }
-
+
return status;
}