fix default gather input is digits and gather dtmf should not require speech

This commit is contained in:
Quan HL
2024-01-31 11:46:29 +07:00
parent 0491c5ce25
commit 5b607693dc
2 changed files with 10 additions and 1 deletions

View File

@@ -30,6 +30,10 @@ class TaskGather extends SttTask {
'speechTimeout', 'timeout', 'say', 'play' 'speechTimeout', 'timeout', 'say', 'play'
].forEach((k) => this[k] = this.data[k]); ].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 */ /* when collecting dtmf, bargein on dtmf is true unless explicitly set to false */
if (this.dtmfBargein !== false && this.input.includes('digits')) this.dtmfBargein = true; 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; 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 { try {
this.sttCredentials = await this._initSpeechCredentials(this.cs, this.vendor, this.label); this.sttCredentials = await this._initSpeechCredentials(this.cs, this.vendor, this.label);
} catch (error) { } catch (error) {