From 5b607693dcc8143c7e47ced559a2918b366b4a12 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Wed, 31 Jan 2024 11:46:29 +0700 Subject: [PATCH] fix default gather input is digits and gather dtmf should not require speech --- lib/tasks/gather.js | 4 ++++ lib/tasks/stt-task.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 4ff63210..7ab58ec7 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -30,6 +30,10 @@ class TaskGather extends SttTask { 'speechTimeout', 'timeout', 'say', 'play' ].forEach((k) => this[k] = this.data[k]); + // gather default input is digits + if (!this.input) { + this.input = ['digits']; + } /* when collecting dtmf, bargein on dtmf is true unless explicitly set to false */ if (this.dtmfBargein !== false && this.input.includes('digits')) this.dtmfBargein = true; diff --git a/lib/tasks/stt-task.js b/lib/tasks/stt-task.js index 44f742d4..2af27664 100644 --- a/lib/tasks/stt-task.js +++ b/lib/tasks/stt-task.js @@ -110,7 +110,12 @@ class SttTask extends Task { this.data.recognizer.model = cs.speechRecognizerLanguage; } - if (!this.sttCredentials) { + if ( + // not gather task, such as transcribe + (!this.input || + // gather task with speech + this.input.includes('speech')) && + !this.sttCredentials) { try { this.sttCredentials = await this._initSpeechCredentials(this.cs, this.vendor, this.label); } catch (error) {