[Freeswitch-svn] [commit] r8054 - in freeswitch/trunk: conf/autoload_configs src src/include
Freeswitch SVN
anthm at freeswitch.org
Mon Apr 7 16:22:38 EDT 2008
Author: anthm
Date: Mon Apr 7 16:22:38 2008
New Revision: 8054
Modified:
freeswitch/trunk/conf/autoload_configs/ivr.conf.xml
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/switch_core_asr.c
freeswitch/trunk/src/switch_ivr_menu.c
freeswitch/trunk/src/switch_ivr_play_say.c
Log:
less is more
Modified: freeswitch/trunk/conf/autoload_configs/ivr.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/ivr.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/ivr.conf.xml Mon Apr 7 16:22:38 2008
@@ -4,12 +4,12 @@
<!-- demo IVR, Main Menu -->
<menu name="demo_ivr"
greet-long="phrase:demo_ivr_main_menu"
- greet-short="phrase:demo_ivr_main_menu_short""
+ greet-short="phrase:demo_ivr_main_menu_short"
invalid-sound="voicemail/vm-hello.wav"
exit-sound="voicemail/vm-goodbye.wav"
timeout ="15"
max-failures="3">
- <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888 at conference.freeswtich.org"/>
+ <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888 at conference.freeswitch.org"/>
<entry action="menu-call-transfer" digits="2" param="9996"/> <!-- FS echo -->
<entry action="menu-call-transfer" digits="3" param="9999"/> <!-- MOH -->
<entry action="menu-sub" digits="4" param="demo_ivr_submenu"/> <!-- demo sub menu -->
@@ -37,11 +37,13 @@
greet-short="say:Press 1 to join the conference, Press 2 to join the other conference"
invalid-sound="say:invalid extension"
exit-sound="say:exit sound" timeout ="15"
- max-failures="3"
- tts-voice="callie" tts-engine="cepstral">
+ max-failures="3">
<entry action="menu-exit" digits="*"/>
- <entry action="menu-say-text" digits="1" param="You pressed 1"/>
- <entry action="menu-call-transfer" digits="2" param="1000"/>
+ <entry action="menu-playback" digits="1" param="say:You pressed 1"/>
+ <entry action="menu-call-transfer" digits="2" param=
+
+
+"1000"/>
<entry action="menu-call-transfer" digits="3" param="1001"/>
</menu>
-->
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Mon Apr 7 16:22:38 2008
@@ -618,11 +618,8 @@
SWITCH_IVR_ACTION_EXECMENU, /* Goto another menu in the stack. */
SWITCH_IVR_ACTION_EXECAPP, /* Execute an application. */
SWITCH_IVR_ACTION_PLAYSOUND, /* Play a sound. */
- SWITCH_IVR_ACTION_SAYTEXT, /* say text. */
- SWITCH_IVR_ACTION_SAYPHRASE, /* say a phrase macro. */
SWITCH_IVR_ACTION_BACK, /* Go back 1 menu. */
SWITCH_IVR_ACTION_TOMAIN, /* Go back to the top level menu. */
- SWITCH_IVR_ACTION_TRANSFER, /* Transfer caller to another ext. */
SWITCH_IVR_ACTION_NOOP /* No operation */
} switch_ivr_action_t;
struct switch_ivr_menu;
@@ -640,9 +637,6 @@
*\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops.
*\param exit_sound Optional pointer to a sound to play upon exiting the menu.
*\param invalid_sound Optional pointer to a sound to play after invalid input.
- *\param tts_engine Text To Speech engine name.
- *\param tts_voice Text To Speech engine voice name.
- *\param phrase_lang the language to use for the phrase macros.
*\param timeout A number of milliseconds to pause before looping.
*\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
*\param pool memory pool (NULL to create one).
@@ -655,9 +649,9 @@
const char *short_greeting_sound,
const char *exit_sound,
const char *invalid_sound,
- const char *tts_engine,
- const char *tts_voice,
- const char *phrase_lang, int timeout, int max_failures, switch_memory_pool_t *pool);
+ int timeout,
+ int max_failures,
+ switch_memory_pool_t *pool);
/*!
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
Modified: freeswitch/trunk/src/switch_core_asr.c
==============================================================================
--- freeswitch/trunk/src/switch_core_asr.c (original)
+++ freeswitch/trunk/src/switch_core_asr.c Mon Apr 7 16:22:38 2008
@@ -47,9 +47,9 @@
char buf[256] = "";
char *param = NULL;
- if (strchr(module_name, ':')) {
+ if (strchr(module_name, '@')) {
switch_set_string(buf, module_name);
- if ((param = strchr(buf, ':'))) {
+ if ((param = strchr(buf, '@'))) {
*param++ = '\0';
module_name = buf;
}
Modified: freeswitch/trunk/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_menu.c (original)
+++ freeswitch/trunk/src/switch_ivr_menu.c Mon Apr 7 16:22:38 2008
@@ -40,9 +40,6 @@
char *short_greeting_sound;
char *invalid_sound;
char *exit_sound;
- char *tts_engine;
- char *tts_voice;
- char *phrase_lang;
char *buf;
char *ptr;
int max_failures;
@@ -93,8 +90,7 @@
const char *short_greeting_sound,
const char *invalid_sound,
const char *exit_sound,
- const char *tts_engine,
- const char *tts_voice, const char *phrase_lang, int timeout, int max_failures,
+ int timeout, int max_failures,
switch_memory_pool_t *pool)
{
switch_ivr_menu_t *menu;
@@ -138,18 +134,6 @@
menu->exit_sound = switch_core_strdup(menu->pool, exit_sound);
}
- if (!switch_strlen_zero(tts_engine)) {
- menu->tts_engine = switch_core_strdup(menu->pool, tts_engine);
- }
-
- if (!switch_strlen_zero(tts_voice)) {
- menu->tts_voice = switch_core_strdup(menu->pool, tts_voice);
- }
-
- if (!switch_strlen_zero(phrase_lang)) {
- menu->phrase_lang = switch_core_strdup(menu->pool, phrase_lang);
- }
-
menu->max_failures = max_failures;
menu->timeout = timeout;
@@ -259,17 +243,8 @@
args.buf = ptr;
args.buflen = len;
- if (strlen(sound) > 4 && strncasecmp(sound, "say:", 4) == 0) {
- if (menu->tts_engine && menu->tts_voice) {
- status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, sound + 4, &args);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No TTS engine to play sound\n");
- }
- } else if (strlen(sound) > 7 && strncasecmp(sound, "phrase:", 7) == 0) {
- status = switch_ivr_phrase_macro(session, sound + 7, "", menu->phrase_lang, &args);
- } else {
- status = switch_ivr_play_file(session, NULL, sound, &args);
- }
+ status = switch_ivr_play_file(session, NULL, sound, &args);
+
if (need) {
menu->ptr += strlen(menu->buf);
@@ -360,16 +335,6 @@
case SWITCH_IVR_ACTION_PLAYSOUND:
status = switch_ivr_play_file(session, NULL, aptr, NULL);
break;
- case SWITCH_IVR_ACTION_SAYTEXT:
- status = switch_ivr_speak_text(session, menu->tts_engine, menu->tts_voice, aptr, NULL);
- break;
- case SWITCH_IVR_ACTION_SAYPHRASE:
- status = switch_ivr_phrase_macro(session, aptr, "", menu->phrase_lang, NULL);
- break;
- case SWITCH_IVR_ACTION_TRANSFER:
- switch_ivr_session_transfer(session, aptr, NULL, NULL);
- running = 0;
- break;
case SWITCH_IVR_ACTION_EXECMENU:
reps = -1;
status = switch_ivr_menu_execute(session, stack, aptr, obj);
@@ -523,11 +488,8 @@
{ "menu-sub", SWITCH_IVR_ACTION_EXECMENU},
{ "menu-exec-app", SWITCH_IVR_ACTION_EXECAPP},
{ "menu-play-sound", SWITCH_IVR_ACTION_PLAYSOUND},
- { "menu-say-text", SWITCH_IVR_ACTION_SAYTEXT},
- { "menu-say-phrase", SWITCH_IVR_ACTION_SAYPHRASE},
{ "menu-back", SWITCH_IVR_ACTION_BACK},
{ "menu-top", SWITCH_IVR_ACTION_TOMAIN},
- { "menu-call-transfer", SWITCH_IVR_ACTION_TRANSFER},
{ NULL, 0}
};
@@ -604,9 +566,6 @@
const char *greet_short = switch_xml_attr(xml_menu, "greet-short"); // if the attr doesn't exist, return NULL
const char *invalid_sound = switch_xml_attr(xml_menu, "invalid-sound"); // if the attr doesn't exist, return NULL
const char *exit_sound = switch_xml_attr(xml_menu, "exit-sound"); // if the attr doesn't exist, return NULL
- const char *tts_engine = switch_xml_attr(xml_menu, "tts-engine"); // if the attr doesn't exist, return NULL
- const char *tts_voice = switch_xml_attr(xml_menu, "tts-voice"); // if the attr doesn't exist, return NULL
- const char *phrase_lang = switch_xml_attr(xml_menu, "phrase-lang"); // if the attr doesn't exist, return NULL
const char *timeout = switch_xml_attr_soft(xml_menu, "timeout"); // if the attr doesn't exist, return ""
const char *max_failures = switch_xml_attr_soft(xml_menu, "max-failures"); // if the attr doesn't exist, return ""
switch_ivr_menu_t *menu = NULL;
@@ -618,7 +577,7 @@
greet_long,
greet_short,
invalid_sound,
- exit_sound, tts_engine, tts_voice, phrase_lang, atoi(timeout) * 1000, atoi(max_failures), xml_menu_ctx->pool);
+ exit_sound, atoi(timeout) * 1000, atoi(max_failures), xml_menu_ctx->pool);
// set the menu_stack for the caller
if (status == SWITCH_STATUS_SUCCESS && *menu_stack == NULL) {
*menu_stack = menu;
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Mon Apr 7 16:22:38 2008
@@ -706,15 +706,12 @@
if (!strncasecmp(file, "phrase:", 7)) {
char *arg = NULL;
- char *lang = NULL;
+ const char *lang = switch_channel_get_variable(channel, "language");
alt = file + 7;
dup = switch_core_session_strdup(session, alt);
- if ((lang = strchr(dup, ':'))) {
- *lang++ = '\0';
- if ((arg = strchr(lang, ':'))) {
- *arg++ = '\0';
- }
+ if ((arg = strchr(dup, ':'))) {
+ *arg++ = '\0';
}
if (dup) {
@@ -736,7 +733,14 @@
}
}
if (engine && voice && text) {
- return switch_ivr_speak_text(session, engine, voice, dup, args);
+ return switch_ivr_speak_text(session, engine, voice, text, args);
+ } else if (engine && !(voice && text)) {
+ text = engine;
+ engine = (char *)switch_channel_get_variable(channel, "tts_engine");
+ voice = (char *)switch_channel_get_variable(channel, "tts_voice");
+ if (engine && text) {
+ return switch_ivr_speak_text(session, engine, voice, text, args);
+ }
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
return SWITCH_STATUS_FALSE;
More information about the Freeswitch-svn
mailing list