bugfix: vad was not enabled on config verb, restart STT on empty transcript in gather

This commit is contained in:
Dave Horton
2022-03-31 14:18:09 -04:00
parent 43564502f7
commit a8646548cd
3 changed files with 9 additions and 2 deletions

View File

@@ -236,7 +236,6 @@ class CallSession extends Emitter {
async enableBotMode(gather, autoEnable) {
try {
gather.timeout = 0; // background gathers should not timeout
const t = normalizeJambones(this.logger, [gather]);
this.backgroundGatherTask = makeTask(this.logger, t[0]);
this.backgroundGatherTask

View File

@@ -75,6 +75,7 @@ class TaskConfig extends Task {
cs.speechRecognizerLanguage = this.recognizer.language !== 'default'
? this.recognizer.language
: cs.speechRecognizerLanguage;
this.gatherOpts.recognizer = this.recognizer;
this.logger.info({recognizer: this.recognizer}, 'Config: updated recognizer');
}
if (this.hasBargeIn) {

View File

@@ -283,6 +283,7 @@ class TaskGather extends Task {
if (this.profanityOption && this.profanityOption !== 'raw') opts.AZURE_PROFANITY_OPTION = this.profanityOption;
if (this.azureServiceEndpoint) opts.AZURE_SERVICE_ENDPOINT = this.azureServiceEndpoint;
if (this.initialSpeechTimeoutMs > 0) opts.AZURE_INITIAL_SPEECH_TIMEOUT_MS = this.initialSpeechTimeoutMs;
else if (this.timeout === 0) opts.AZURE_INITIAL_SPEECH_TIMEOUT_MS = 120000; // lengthy
opts.AZURE_USE_OUTPUT_FORMAT_DETAILED = 1;
ep.addCustomEventListener(AzureTranscriptionEvents.Transcription, this._onTranscription.bind(this, cs, ep));
@@ -382,7 +383,13 @@ class TaskGather extends Task {
};
}
}
if (evt.is_final) this._resolve('speech', evt);
if (evt.is_final) {
if (evt.alternatives[0].transcript === '') {
this.logger.info({evt}, 'TaskGather:_onTranscription - got empty transcript, listen again');
this._startTranscribing(ep);
}
this._resolve('speech', evt);
}
else {
/* google has a measure of stability:
https://cloud.google.com/speech-to-text/docs/basics#streaming_responses