...
This is pretty cheeky in that it does not confirmation of results. As well the way the grammar is written it returns the person's extension instead of their name so we can just do a Goto based on the result text.
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
#ABNF 1.0; language en-US; mode voice; tag-format <lumenvox/1.0>; root $company_directory; $josh = ((Joshua | Josh) [Colp]):"6066"; $mark = (Mark [Spencer] | Markster):"4569"; $kevin = (Kevin [Fleming]):"2567"; $company_directory = ($josh | $mark | $kevin) { $ = $$ }; |
Dialplan logic
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
[dial-by-name] exten => s,1,SpeechCreate() exten => s,2,SpeechActivateGrammar(company-directory) exten => s,3,SpeechStart() exten => s,4,SpeechBackground(who-would-you-like-to-dial) exten => s,5,SpeechDeactivateGrammar(company-directory) exten => s,6,Goto(internal-extensions-${SPEECH_TEXT(0)}) |
...
A simple macro that can be used for confirm of a result. Requires some sound files. ARG1 is equal to the file to play back after "I heard..." is played.
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
[macro-speech-confirm] exten => s,1,SpeechActivateGrammar(yes_no) exten => s,2,Set(OLDTEXT0=${SPEECH_TEXT(0)}) exten => s,3,Playback(heard) exten => s,4,Playback(${ARG1}) exten => s,5,SpeechStart() exten => s,6,SpeechBackground(correct) exten => s,7,Set(CONFIRM=${SPEECH_TEXT(0)}) exten => s,8,GotoIf($["${SPEECH_TEXT(0)}" = "1"]?9:10) exten => s,9,Set(CONFIRM=yes) exten => s,10,Set(CONFIRMED=${OLDTEXT0}) exten => s,11,SpeechDeactivateGrammar(yes_no) |
...