update phrase interface
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3901 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
57c0d4bdc9
commit
6aaedb918c
|
@ -678,57 +678,89 @@
|
|||
<language name="en" sound_path="/snds" tts_engine="cepstral" tts_voice="david">
|
||||
<macro name="msgcount">
|
||||
<input pattern="(.*)">
|
||||
<action function="execute" data="sleep(1000)"/>
|
||||
<action function="play-file" data="vm-youhave.wav"/>
|
||||
<action function="say" data="$1" method="pronounced" type="items"/>
|
||||
<action function="play-file" data="vm-messages.wav"/>
|
||||
<!-- or -->
|
||||
<!--<action function="speak-text" data="you have $1 messages"/>-->
|
||||
<match>
|
||||
<action function="execute" data="sleep(1000)"/>
|
||||
<action function="play-file" data="vm-youhave.wav"/>
|
||||
<action function="say" data="$1" method="pronounced" type="items"/>
|
||||
<action function="play-file" data="vm-messages.wav"/>
|
||||
<!-- or -->
|
||||
<!--<action function="speak-text" data="you have $1 messages"/>-->
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="saydate">
|
||||
<input pattern="(.*)">
|
||||
<action function="say" data="$1" method="pronounced" type="current_date_time"/>
|
||||
<match>
|
||||
<action function="say" data="$1" method="pronounced" type="current_date_time"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="timespec">
|
||||
<input pattern="(.*)">
|
||||
<action function="say" data="$1" method="pronounced" type="time_measurement"/>
|
||||
<match>
|
||||
<action function="say" data="$1" method="pronounced" type="time_measurement"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="ip-addr">
|
||||
<input pattern="(.*)">
|
||||
<action function="say" data="$1" method="iterated" type="ip_address"/>
|
||||
<action function="say" data="$1" method="pronounced" type="ip_address"/>
|
||||
<match>
|
||||
<action function="say" data="$1" method="iterated" type="ip_address"/>
|
||||
<action function="say" data="$1" method="pronounced" type="ip_address"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="spell">
|
||||
<input pattern="(.*)">
|
||||
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
|
||||
<match>
|
||||
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="spell-phonetic">
|
||||
<input pattern="(.*)">
|
||||
<action function="say" data="$1" method="pronounced" type="name_phonetic"/>
|
||||
<match>
|
||||
<action function="say" data="$1" method="pronounced" type="name_phonetic"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="tts-timeleft">
|
||||
<!-- The parser will visit each <input> tag and execute the actions in <match> or <nomatch> depending on the pattern param -->
|
||||
<!-- If the function "break" is encountered all parsing will cease -->
|
||||
<input pattern="(\d+):(\d+)">
|
||||
<action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
|
||||
<match>
|
||||
<action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
|
||||
<action function="break"/>
|
||||
</match>
|
||||
<nomatch>
|
||||
<action function="speak-text" data="That input was invalid."/>
|
||||
</nomatch>
|
||||
</input>
|
||||
<input pattern="(\d+) min (\d+) sec">
|
||||
<match>
|
||||
<action function="speak-text" data="You have $1 minutes, $2 seconds remaining $strftime(%Y-%m-%d)"/>
|
||||
</match>
|
||||
<nomatch>
|
||||
<action function="speak-text" data="That input was invalid."/>
|
||||
</nomatch>
|
||||
</input>
|
||||
</macro>
|
||||
</language>
|
||||
<language name="fr" sound_path="/var/sounds/lang/fr/jean" tts_engine="cepstral" tts_voice="jean-pierre">
|
||||
<macro name="msgcount">
|
||||
<input pattern="(.*)">
|
||||
<action function="play-file" data="tuas.wav"/>
|
||||
<action function="say" data="$1" method="pronounced" type="items"/>
|
||||
<action function="play-file" data="messages.wav"/>
|
||||
<match>
|
||||
<action function="play-file" data="tuas.wav"/>
|
||||
<action function="say" data="$1" method="pronounced" type="items"/>
|
||||
<action function="play-file" data="messages.wav"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
<macro name="timeleft">
|
||||
<input pattern="(\d+):(\d+)">
|
||||
<action function="speak-text" data="il y a $1 minutes et de $2 secondes de restant"/>
|
||||
<match>
|
||||
<action function="speak-text" data="il y a $1 minutes et de $2 secondes de restant"/>
|
||||
</match>
|
||||
</input>
|
||||
</macro>
|
||||
</language>
|
||||
|
|
|
@ -4414,6 +4414,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||
switch_status_t status = SWITCH_STATUS_GENERR;
|
||||
char *old_sound_prefix, *sound_path = NULL, *tts_engine = NULL, *tts_voice = NULL;
|
||||
switch_channel_t *channel;
|
||||
uint8_t done = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
@ -4479,7 +4480,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||
|
||||
switch_channel_pre_answer(channel);
|
||||
|
||||
while(input) {
|
||||
while(input && !done) {
|
||||
char *pattern = (char *) switch_xml_attr(input, "pattern");
|
||||
|
||||
if (pattern) {
|
||||
|
@ -4489,9 +4490,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||
uint32_t len = 0;
|
||||
char *odata = NULL;
|
||||
char *expanded = NULL;
|
||||
switch_xml_t match = NULL;
|
||||
|
||||
if ((proceed = switch_perform_regex(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
|
||||
for (action = switch_xml_child(input, "action"); action; action = action->next) {
|
||||
match = switch_xml_child(input, "match");
|
||||
} else {
|
||||
match = switch_xml_child(input, "nomatch");
|
||||
}
|
||||
|
||||
if (match) {
|
||||
for (action = switch_xml_child(match, "action"); action; action = action->next) {
|
||||
char *adata = (char *) switch_xml_attr_soft(action, "data");
|
||||
char *func = (char *) switch_xml_attr_soft(action, "function");
|
||||
|
||||
|
@ -4522,6 +4530,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||
|
||||
if (!strcasecmp(func, "play-file")) {
|
||||
switch_ivr_play_file(session, NULL, odata, args);
|
||||
} else if (!strcasecmp(func, "break")) {
|
||||
done = 1;
|
||||
break;
|
||||
} else if (!strcasecmp(func, "execute")) {
|
||||
const switch_application_interface_t *application_interface;
|
||||
char *app_name = NULL;
|
||||
|
@ -4568,7 +4579,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_clean_re(re);
|
||||
switch_safe_free(expanded);
|
||||
switch_safe_free(substituted);
|
||||
|
|
Loading…
Reference in New Issue