From a11822609f5525cf6046a6e288a788230277532d Mon Sep 17 00:00:00 2001 From: akirilyuk Date: Tue, 8 Feb 2022 12:22:37 +0100 Subject: [PATCH] fix say task --- lib/tasks/cognigy/index.js | 3 --- lib/tasks/say.js | 14 ++++++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/tasks/cognigy/index.js b/lib/tasks/cognigy/index.js index 5f1fe30a..a06e2eb5 100644 --- a/lib/tasks/cognigy/index.js +++ b/lib/tasks/cognigy/index.js @@ -253,9 +253,6 @@ class Cognigy extends Task { /* if we need to interrupt the currently-running say task(s), call this */ _killSayTasks(ep) { - // this will also remove all other upcoming tasks after the say task - // maybe we need a flow to kill only one say tasks and keep others executitng need to discuss this further - // this.taskQueue.end(); if (ep && ep.connected) { ep.api('uuid_break', this.ep.uuid) .catch((err) => this.logger.info({err}, 'Cognigy:_killSayTasks - error killing audio for current say task')); diff --git a/lib/tasks/say.js b/lib/tasks/say.js index 691e98e1..4001a562 100644 --- a/lib/tasks/say.js +++ b/lib/tasks/say.js @@ -21,14 +21,20 @@ class TaskSay extends Task { const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, srf); const {writeAlerts, AlertType, stats} = srf.locals; const {synthAudio} = srf.locals.dbHelpers; - const vendor = this.synthesizer.vendor !== 'default' ? this.synthesizer.vendor : cs.speechSynthesisVendor; - const language = this.synthesizer.language !== 'default' ? this.synthesizer.language : cs.speechSynthesisLanguage ; - const voice = this.synthesizer.voice !== 'default' ? this.synthesizer.voice : cs.speechSynthesisVoice; + const vendor = this.synthesizer.vendor && this.synthesizer.vendor !== 'default' ? this.synthesizer.vendor : cs.speechSynthesisVendor; + const language = this.synthesizer.language && this.synthesizer.language !== 'default' ? this.synthesizer.language : cs.speechSynthesisLanguage ; + const voice = this.synthesizer.voice && this.synthesizer.voice !== 'default' ? this.synthesizer.voice : cs.speechSynthesisVoice; const engine = this.synthesizer.engine || 'standard'; const salt = cs.callSid; const credentials = cs.getSpeechCredentials(vendor, 'tts'); - this.logger.info({language, voice}, `Task:say - using vendor: ${vendor}`); + this.logger.info({language, + voice, + localSynthesizer: this.synthesizer, + speechSynthesisVendor: cs.speechSynthesisVendor, + speechSynthesisLanguage: cs.speechSynthesisLanguage, + speechSynthesisVoice: cs.speechSynthesisVoice + }, `Task:say - using vendor: ${vendor}`); this.ep = ep; try { if (!credentials) {