bugfix #41: error was thrown about missing speech creds when speech was not enabled

This commit is contained in:
Dave Horton
2021-11-16 19:42:16 -05:00
parent db78ffffed
commit 2262973f43

View File

@@ -46,6 +46,8 @@ class TaskGather extends Task {
get name() { return TaskName.Gather; } get name() { return TaskName.Gather; }
get needsStt() { return this.input.includes('speech'); }
get earlyMedia() { get earlyMedia() {
return (this.sayTask && this.sayTask.earlyMedia) || return (this.sayTask && this.sayTask.earlyMedia) ||
(this.playTask && this.playTask.earlyMedia); (this.playTask && this.playTask.earlyMedia);
@@ -59,7 +61,7 @@ class TaskGather extends Task {
if ('default' === this.vendor || !this.vendor) this.vendor = cs.speechRecognizerVendor; if ('default' === this.vendor || !this.vendor) this.vendor = cs.speechRecognizerVendor;
if ('default' === this.language || !this.language) this.language = cs.speechRecognizerLanguage; if ('default' === this.language || !this.language) this.language = cs.speechRecognizerLanguage;
this.sttCredentials = cs.getSpeechCredentials(this.vendor, 'stt'); this.sttCredentials = cs.getSpeechCredentials(this.vendor, 'stt');
if (!this.sttCredentials) { if (this.needsStt && !this.sttCredentials) {
const {writeAlerts, AlertType} = cs.srf.locals; const {writeAlerts, AlertType} = cs.srf.locals;
this.logger.info(`TaskGather:exec - ERROR stt using ${this.vendor} requested but not creds supplied`); this.logger.info(`TaskGather:exec - ERROR stt using ${this.vendor} requested but not creds supplied`);
writeAlerts({ writeAlerts({