From 44304f4962f3e1552f813428f35b93c47c06807c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 19:44:29 -0500 Subject: [PATCH] the intent for having the module and lang separate is for things where the same module can use different sets of sounds like en module and en-male or en-female lang (sound dirs) there was indeed a disconnect in the dialplan version of this app. Originally say was only available in phrase macros so I change the syntax of the say app so you can specify both the module and the lang absolte from the dp with something like he:he as the module name. BTW: Going forward can you attach the patch or give me instructions on how to get it in raw format or merge it to our local git, I don't really have the time to figure it out just to pull in a patch...... --- .../applications/mod_dptools/mod_dptools.c | 2 +- src/switch_ivr.c | 46 +++++++++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 85bd718345..42c1203380 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2078,7 +2078,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout); } -#define SAY_SYNTAX " [] " +#define SAY_SYNTAX ": [] " SWITCH_STANDARD_APP(say_function) { char *argv[5] = { 0 }; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index b6dac4d71d..07c341a580 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2330,22 +2330,38 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, 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); @@ -2399,8 +2415,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, 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}; @@ -2424,11 +2446,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, if (save_path) { switch_channel_set_variable(channel, "sound_prefix", save_path); } - - if (xml) { - switch_xml_free(xml); - } - + return status; }