Setting vosk to timeout if no audio detected
elmogp opened this issue · 1 comments
Hello
I've got vosk-asterisk configured and it's working really well, thank you @nshmyrev - this is a fantastically useful tool for Asterisk!. My issue is, if there's no incoming sound, I can't figure out how to achieve a timeout from the vosk-server (https://github.com/alphacep/vosk-server).
In the dial plan, It's possible to set something like:
exten => 5000,n,SpeechBackground(silence-5.gsm,15)
This will set speechbackground to end after 15 seconds, but it's a hard limit and will cut off the audio stream to the vosk-server, even if mid sentence.
Looking at the Kaldi documentation here (https://github.com/kaldi-asr/kaldi/blob/e1dd07b13c7f14c4f8f5532a281a044819e838c0/src/online2/online-endpoint.h#L46), there's five rules. Rule 1 reads:
/// rule1 times out after 5 seconds of silence, even if we decoded nothing.
OnlineEndpointRule rule1;
This rule should be set by default (I'm using vosk-model-en-us-0.42-gigaspeech), but if I make a call and mute it, vosk keeps returning empty partial results to Astrerisk after 5 seconds. In model.conf, I've tried various settings in model.conf, such as:
--endpoint.rule1.must-contain-nonsilence=false
--endpoint.rule1.min-trailing-silence=5.0
--endpoint.rule1.min-utterance-length=5.0
However, these seems to have no effect.
My understanding is Rule 1 by default should end the vosk process after five seconds, even if no incoming sound was detected. Is this actually the case? (Or is there, perhaps, a better way to achieve the desired effect? I can use AMD in the dial plan to wait for audio to begin, but it will cut off the beginning of the utterance.)
Thanks in advance.
Asterisk Version: 19.8.0
FreePBX version: 16.0.40.3
Vosk Server: Ubuntu 22.04.1 LTS