From ec6d7b3f42f926444e10911cfc31e9e48ff1958c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 28 Jun 2024 08:33:10 -0400 Subject: [PATCH] persistent connection for custom stt vendors in transcribe (#794) --- lib/tasks/transcribe.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tasks/transcribe.js b/lib/tasks/transcribe.js index 8001c569..5dcd40d0 100644 --- a/lib/tasks/transcribe.js +++ b/lib/tasks/transcribe.js @@ -429,9 +429,13 @@ class TaskTranscribe extends SttTask { /* here is where we return a final transcript */ this.logger.debug({evt}, 'TaskTranscribe:_onTranscription - sending final transcript'); this._resolve(channel, evt); + /* some STT engines will keep listening after a final response, so no need to restart */ - if (!['soniox', 'aws', 'microsoft', 'deepgram', 'google'] - .includes(this.vendor)) this._startTranscribing(cs, ep, channel); + if (!['soniox', 'aws', 'microsoft', 'deepgram', 'google'].includes(this.vendor) && + !this.vendor.startsWith('custom:')) { + this.logger.debug('TaskTranscribe:_onTranscription - restarting transcribe'); + this._startTranscribing(cs, ep, channel); + } } } else {