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......

This commit is contained in:
Anthony Minessale 2011-03-31 19:44:29 -05:00
parent cdcd36337a
commit 44304f4962
2 changed files with 33 additions and 15 deletions

View File

@ -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 "<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 };

View File

@ -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;
}