diff --git a/lib/tasks/dialogflow/index.js b/lib/tasks/dialogflow/index.js index 4ed2ccf7..f74504c2 100644 --- a/lib/tasks/dialogflow/index.js +++ b/lib/tasks/dialogflow/index.js @@ -133,7 +133,7 @@ class Dialogflow extends Task { this.fallbackVoice = cs.fallbackSpeechSynthesisVoice; this.fallbackLabel = cs.fallbackSpeechSynthesisLabel; } - this.ttsCredentials = cs.getSpeechCredentials(this.vendor, 'tts',this.speechSynthesisLabel); + this.ttsCredentials = cs.getSpeechCredentials(this.vendor, 'tts', this.speechSynthesisLabel); this.ep.addCustomEventListener('dialogflow::intent', this._onIntent.bind(this, ep, cs)); this.ep.addCustomEventListener('dialogflow::transcription', this._onTranscription.bind(this, ep, cs)); @@ -235,7 +235,7 @@ class Dialogflow extends Task { } try { - const {filePath, servedFromCache} = await this.fallbackSynthAudio(cs, intent, stats); + const {filePath, servedFromCache} = await this.fallbackSynthAudio(cs, intent, stats, synthAudio); if (filePath) cs.trackTmpFile(filePath); if (!this.ttsCredentials && !servedFromCache) cs.billForTts(intent.fulfillmentText.length); @@ -281,7 +281,7 @@ class Dialogflow extends Task { } } - async fallbackSynthAudio(cs, intent, stats) { + async fallbackSynthAudio(cs, intent, stats, synthAudio) { try { const obj = { account_sid: cs.accountSid, @@ -299,7 +299,7 @@ class Dialogflow extends Task { this.logger.info({error}, 'Failed to synthesize audio from primary vendor'); try { - if(this.fallbackVendor) { + if (this.fallbackVendor) { const credentials = cs.getSpeechCredentials(this.fallbackVendor, 'tts', this.fallbackLabel); const obj = { account_sid: cs.accountSid, @@ -313,7 +313,7 @@ class Dialogflow extends Task { this.logger.debug({obj}, 'Dialogflow:_onIntent - playing message via fallback tts'); return await synthAudio(stats, obj); } - } catch(err) { + } catch (err) { this.logger.info({err}, 'Failed to synthesize audio from falllback vendor'); throw err; } diff --git a/lib/tasks/lex.js b/lib/tasks/lex.js index 3e33ecb9..7b3000a9 100644 --- a/lib/tasks/lex.js +++ b/lib/tasks/lex.js @@ -210,7 +210,7 @@ class Lex extends Task { credentials: credential }); return filePath; - } catch(err) { + } catch (err) { this.logger.info({err}, 'failed to synth audio from fallback vendor'); } } diff --git a/lib/tasks/say.js b/lib/tasks/say.js index cb82731e..1c255686 100644 --- a/lib/tasks/say.js +++ b/lib/tasks/say.js @@ -60,23 +60,23 @@ class TaskSay extends Task { this.synthesizer.vendor : cs.speechSynthesisVendor; const fallbackVendor = this.synthesizer.fallbackVendor && this.synthesizer.fallbackVendor !== 'default' ? - this.synthesizer.fallbackVendor : - cs.fallbackSpeechSynthesisVendor; + this.synthesizer.fallbackVendor : + cs.fallbackSpeechSynthesisVendor; const language = this.synthesizer.language && this.synthesizer.language !== 'default' ? this.synthesizer.language : cs.speechSynthesisLanguage ; const fallbackLanguage = this.synthesizer.fallbackLanguage && this.synthesizer.fallbackLanguage !== 'default' ? - this.synthesizer.fallbackLanguage : - cs.fallbackSpeechSynthesisLanguage ; + this.synthesizer.fallbackLanguage : + cs.fallbackSpeechSynthesisLanguage ; let voice = this.synthesizer.voice && this.synthesizer.voice !== 'default' ? this.synthesizer.voice : cs.speechSynthesisVoice; const fallbackVoice = this.synthesizer.fallbackVoice && this.synthesizer.fallbackVoice !== 'default' ? - this.synthesizer.fallbackVoice : - cs.fallbackSpeechSynthesisVoice; + this.synthesizer.fallbackVoice : + cs.fallbackSpeechSynthesisVoice; const fallbackLabel = this.synthesizer.fallbackLabel && this.synthesizer.fallbackLabel !== 'default' ? - this.synthesizer.fallbackLabel : - cs.fallbackSpeechSynthesisLabel; + this.synthesizer.fallbackLabel : + cs.fallbackSpeechSynthesisLabel; const engine = this.synthesizer.engine || 'standard'; const salt = cs.callSid; let credentials = cs.getSpeechCredentials(vendor, 'tts', this.data.synthesizer ? @@ -164,7 +164,7 @@ class TaskSay extends Task { } catch (error) { if (fallbackVendor) { - const fallbackcredentials = cs.getSpeechCredentials(fallbackVendor, 'tts', fallbackLabel); + const fallbackcredentials = cs.getSpeechCredentials(fallbackVendor, 'tts', fallbackLabel); const {span: fallbackSpan} = this.startChildSpan('fallback-tts-generation', { 'tts.vendor': fallbackVendor, 'tts.language': fallbackLanguage, @@ -200,7 +200,7 @@ class TaskSay extends Task { executedVendor = fallbackVendor; executedLanguage = fallbackLanguage; - } catch (err){ + } catch (err) { this.logger.info({err}, 'fallback Speech failed to synthesize audio'); fallbackSpan.end(); writeAlerts({