Voice Recognition with Lumenvox
Because of Booty Dialer work, I haven’t had time to really flesh out the Echo and Narcissus project I had in mind, but I did begin playing with Lumenvox, the voice-recognition engine that we’ve got installed on the ITP Asterisk server. It’s a pretty robust system, as long as you can pre-define the kind of input you’re expecting. The workflow involves creating a grammar file, which defines what user input the system should be looking for, and then adding that grammar to the dialplan, where you can use the Gotoif() function to take action depending on what Lumenvox determines the user has said.
For testing, I setup a grammar that replicates the menu of the applications I’ve got in my dialplan right now - the Echo test and The Invention of Murder game service.
Here’s the contents of my grammar file:
#ABNF 1.0;
language en-US;
mode voice; //use spoken words instead of DTFM
tag-format
root $menu;
$echo = echo;
$murder = ([invention][of] murder):”murder”;
$menu = ($echo|$murder);
Here’s the dialplan logic to navigate to either my Echo example from last week, or The Invention of Murder game service.
[redial_ajs292]
exten => s,1,GoTo(ajs292_narcissus,s,1)
[ajs292_narcissus]
exten => s,1,SpeechCreate
exten => s,n,SpeechLoadGrammar(ajs292_menu|/home/ajs292/asterisk_conf/ajs292_menu.gram)
exten => s,n,SpeechActivateGrammar(ajs292_menu)
exten => s,n,SpeechBackground(beep,10)
exten => s,n,Verbose(1,Result was ${SPEECH_TEXT(0)})
exten => s,n,Verbose(1,Confidence was ${SPEECH_SCORE(0)})
exten => s,n,GotoIf($["${SPEECH_TEXT(0)}" = "echo"]?ajs292_echo,s,1)
exten => s,n,GotoIf($["${SPEECH_TEXT(0)}" = "murder"]?ajs292_cigargirl,s,1)
exten => s,n,SpeechDeactivateGrammar(ajs292_menu)
[ajs292_echo]
exten => s,1,System(/usr/bin/text2wave -F 8000 -o /home/ajs292/asterisk_sounds/echo_sable.wav /home/ajs292/echo.sable)
exten => s,n,Playback(/home/ajs292/asterisk_sounds/echo_sable)
exten => s,n,Hangup()
[ajs292_cigargirl]
exten => s,1(start),Background(/home/ajs292/asterisk_sounds/cigargirl/evidence_or_accusation)
exten => s,n,WaitExten(15)
exten => 1,1,AGI(/home/ajs292/asterisk_agi/ajs292_cigargirl_check.php)
exten => 2,1,AGI(/home/ajs292/asterisk_agi/ajs292_cigargirl_accuse.php)
exten => 3854,1,GoTo(ajs292_cigargirl_admin,s,1)
exten => i,1,GoTo(s,start)
Activity