Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting vosk to timeout if no audio detected #38

Open
elmogp opened this issue May 26, 2023 · 1 comment
Open

Setting vosk to timeout if no audio detected #38

elmogp opened this issue May 26, 2023 · 1 comment

Comments

@elmogp
Copy link

elmogp commented May 26, 2023

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

@elmogp elmogp changed the title Setting vosk to timout if no audio deteced Setting vosk to timeout if no audio deteced May 26, 2023
@elmogp elmogp changed the title Setting vosk to timeout if no audio deteced Setting vosk to timeout if no audio detected May 26, 2023
@chrsmj
Copy link
Contributor

chrsmj commented Feb 1, 2024

Here is potential work-around to get partial results from Vosk in Asterisk: asterisk/asterisk#574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants