Merge pull request #632 from jambonz/fix/issue_631

fix default gather input is digits and gather dtmf should not require speech
This commit is contained in:
Hoan Luu Huu
2024-01-31 12:01:36 +07:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -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;

View File

@@ -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) {