more logging on restart of transcribing during gather

This commit is contained in:
Dave Horton
2024-05-10 14:12:34 -04:00
parent a23dc50c20
commit f7134d8fe7

View File

@@ -171,6 +171,7 @@ class TaskGather extends SttTask {
this.logger.info('Gather:exec - task was quickly killed so do not transcribe'); this.logger.info('Gather:exec - task was quickly killed so do not transcribe');
return; return;
} }
this.logger.debug('Gather:exec - going to start transcribing (startListening)');
this._startTranscribing(ep); this._startTranscribing(ep);
return updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid); return updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid);
} catch (e) { } catch (e) {
@@ -235,6 +236,7 @@ class TaskGather extends SttTask {
if (this.input.includes('speech') && this.listenDuringPrompt) { if (this.input.includes('speech') && this.listenDuringPrompt) {
await this._setSpeechHandlers(cs, ep); await this._setSpeechHandlers(cs, ep);
this.logger.debug('Gather:exec - going to start transcribing (listenDuringPrompt)');
this._startTranscribing(ep); this._startTranscribing(ep);
updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid) updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid)
.catch(() => {/*already logged error */}); .catch(() => {/*already logged error */});
@@ -793,14 +795,21 @@ class TaskGather extends SttTask {
this._startAsrTimer(); this._startAsrTimer();
/* some STT engines will keep listening after a final response, so no need to restart */ /* 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 { else {
if (this.bargein && (words + bufferedWords) < this.minBargeinWordCount) { if (this.bargein && (words + bufferedWords) < this.minBargeinWordCount) {
this.logger.debug({evt, words, bufferedWords}, this.logger.debug({evt, words, bufferedWords},
'TaskGather:_onTranscription - final transcript but < min barge words'); 'TaskGather:_onTranscription - final transcript but < min barge words');
this._bufferedTranscripts.push(evt); 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; return;
} }
else { else {
@@ -881,6 +890,7 @@ class TaskGather extends SttTask {
* since we dont have a final transcript yet. * since we dont have a final transcript yet.
*/ */
if (!this.resolved && !this.killed && !this._bufferedTranscripts.length && this.wantsSingleUtterance) { 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); this._startTranscribing(ep);
} }
} }
@@ -906,6 +916,7 @@ class TaskGather extends SttTask {
try { try {
await this._fallback(); await this._fallback();
await this._initSpeech(cs, ep); await this._initSpeech(cs, ep);
this.logger.debug('Gather:_onJambonzError - going to start transcribing again (jambonz error)');
this._startTranscribing(ep); this._startTranscribing(ep);
updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid); updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid);
return; return;
@@ -955,7 +966,7 @@ class TaskGather extends SttTask {
this.logger.debug('TaskGather:_onNoSpeechDetected for old gather, ignoring'); this.logger.debug('TaskGather:_onNoSpeechDetected for old gather, ignoring');
} }
else { else {
this.logger.debug('TaskGather:_onNoSpeechDetected - listen again'); this.logger.debug('Gather:_onNoSpeechDetected - going to start transcribing again');
this._startTranscribing(ep); this._startTranscribing(ep);
} }
return; return;