[asterisk-speech-rec] DTMF response time improved during speech recog. instances
John Todd
jtodd at loligo.com
Tue Jun 19 16:05:26 CDT 2007
I ran into a problem a few days ago with speech recognition in
generic conversion of DTMF-based applications. We have several apps
here which rely upon single keypresses in order to take some action,
like most IVR apps. The problem was that the existing method by
which Asterisk was handing off DTMF was a bit on the sluggish side
for entries made on the DTMF keypad - there was around a 5 second
delay between a keypress and an action being returned to the
dialplan. This was a drastic performance cut from our existing apps,
so voice-enabling them wasn't possible until that bug was fixed.
I'm pleased to say a quick response by Lumenvox (StephenKeller) and
Digium (file) added an as-yet undocumented repair variable to solve
the problem. It was repaired and added to 1.4 on June 15th 2007, and
patches cleanly to other versions (it's only about 5 lines in
app_speech_utils.c)
You can now set a variable called "SPEECH_DTMF_MAXLEN" from within
the dialplan which indicates the maximum number if DTMF digits your
grammar is expecting. In our case, where menus were all
single-keypress to start with, we set the value to "1" and it returns
back the values immediately. I also created .gram files for
single-digit keypresses for both voice and DTMF, though I'm uncertain
if this is required now with this patch. Interestingly, if you
specify "2" as the length of digits, but your DTMF grammar only
indicates a single digit, the grammar is ignored and the number of
digits you enter with DTMF is returned. If you speak more than two
digits, the system acts properly according to the grammar and only
the first digit is returned. I've been told this is because Asterisk
is handling the DTMF (and is being instructed what to do with
SPEECH_DTMF_MAXLEN) and the voice recognition portion is using the
grammar.
Note: I've not been able to get "#" and "*" to work yet with the DTMF
signalling, but I've been talking with Lumenvox about if this is a
syntax problem with my attempts, or a deeper bug.
Examples below.
JT
[root at blah grammars]# more digit.gram
#ABNF 1.0 UTF-8;
language en-US;
mode voice;
tag-format <lumenvox/1.0>;
$Digit = (ONE:"1" |
TWO:"2" |
THREE:"3" |
FOUR:"4" |
FIVE:"5" |
SIX:"6" |
SEVEN:"7" |
EIGHT:"8" |
NINE:"9" |
(ZERO | O):"0" );
[root at blah grammars]#
[root at blah grammars]# more digit-dtmf.gram
#ABNF 1.0 UTF-8;
language en-US;
mode dtmf;
tag-format <lumenvox/1.0>;
root $Digit;
$Digit = (1:"1" |
2:"2" |
3:"3" |
4:"4" |
5:"5" |
6:"6" |
7:"7" |
8:"8" |
9:"9" |
0:"0");
[root at blah grammars]#
[test]
exten => s,1,SpeechCreate
exten => s,n,Set(THRESHOLD=500)
exten => s,n,Set(SPEECH_DTMF_MAXLEN=1)
exten => s,n,SpeechActivateGrammar(digit)
exten => s,n,SpeechActivateGrammar(digit-dtmf)
exten => s,n,SpeechStart
exten => s,n,SpeechBackground(tt-monkeys)
exten => s,n,NoOp(The value in SPEECH_TEXT is ${SPEECH_TEXT(0)})
exten => s,n,SayDigits(${SPEECH_TEXT(0)})
exten => s,n,Hangup
exten => i,1,Playback(tt-somethingwrong)
exten => i,n,Hangup
More information about the asterisk-speech-rec
mailing list