From f7134d8fe7ddc9a364ad02b3f731a0d0fcb6545a Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 10 May 2024 14:12:34 -0400 Subject: [PATCH] more logging on restart of transcribing during gather --- lib/tasks/gather.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 2b7af70a..9bb270d1 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -171,6 +171,7 @@ class TaskGather extends SttTask { this.logger.info('Gather:exec - task was quickly killed so do not transcribe'); return; } + this.logger.debug('Gather:exec - going to start transcribing (startListening)'); this._startTranscribing(ep); return updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid); } catch (e) { @@ -235,6 +236,7 @@ class TaskGather extends SttTask { if (this.input.includes('speech') && this.listenDuringPrompt) { await this._setSpeechHandlers(cs, ep); + this.logger.debug('Gather:exec - going to start transcribing (listenDuringPrompt)'); this._startTranscribing(ep); updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid) .catch(() => {/*already logged error */}); @@ -793,14 +795,21 @@ class TaskGather extends SttTask { this._startAsrTimer(); /* some STT engines will keep listening after a final response, so no need to restart */ - if (!['soniox', 'aws', 'microsoft', 'deepgram'].includes(this.vendor)) this._startTranscribing(ep); + if (!['soniox', 'aws', 'microsoft', 'deepgram'].includes(this.vendor)) { + this.logger.debug('Gather:_onTranscription - going to start transcribing again (continuous asr)'); + this._startTranscribing(ep); + } } else { if (this.bargein && (words + bufferedWords) < this.minBargeinWordCount) { this.logger.debug({evt, words, bufferedWords}, 'TaskGather:_onTranscription - final transcript but < min barge words'); this._bufferedTranscripts.push(evt); - if (!['soniox', 'aws', 'microsoft', 'deepgram'].includes(this.vendor)) this._startTranscribing(ep); + if (!['soniox', 'aws', 'microsoft', 'deepgram'].includes(this.vendor)) { + this.logger.debug( + `Gather:_onTranscription - start transcribing again (min bargein words=${this.minBargeinWordCount}`); + this._startTranscribing(ep); + } return; } else { @@ -881,6 +890,7 @@ class TaskGather extends SttTask { * since we dont have a final transcript yet. */ if (!this.resolved && !this.killed && !this._bufferedTranscripts.length && this.wantsSingleUtterance) { + this.logger.debug('Gather:_onEndOfUtterance - start transcribing again (end of utterance/wantsSingleUtterance)'); this._startTranscribing(ep); } } @@ -906,6 +916,7 @@ class TaskGather extends SttTask { try { await this._fallback(); await this._initSpeech(cs, ep); + this.logger.debug('Gather:_onJambonzError - going to start transcribing again (jambonz error)'); this._startTranscribing(ep); updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid); return; @@ -955,7 +966,7 @@ class TaskGather extends SttTask { this.logger.debug('TaskGather:_onNoSpeechDetected for old gather, ignoring'); } else { - this.logger.debug('TaskGather:_onNoSpeechDetected - listen again'); + this.logger.debug('Gather:_onNoSpeechDetected - going to start transcribing again'); this._startTranscribing(ep); } return;