diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index a73b0809..12755e85 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -10,7 +10,7 @@ const { const makeTask = require('./make_task'); const assert = require('assert'); -const GATHER_STABILITY_THRESHOLD = Number(process.env.JAMBONZ_GATHER_STABILITY_THRESHOLD || 0.7); +const GATHER_STABILITY_THRESHOLD = Number(process.env.JAMBONZ_GATHER_STABILITY_THRESHOLD || 0.7); class TaskGather extends Task { constructor(logger, opts, parentTask) { @@ -54,10 +54,10 @@ class TaskGather extends Task { if (this.say) this.sayTask = makeTask(this.logger, {say: this.say}, this); if (this.play) this.playTask = makeTask(this.logger, {play: this.play}, this); - if(this.sayTask || this.playTask){ - // this is specially for barge in where we want to make a bargebale promt - // to a user without listening after the say task has finished - this.listenAfterSpeech = typeof this.data.listenAfterSpeech === "boolean" ? this.data.listenAfterSpeech : true; + if (this.sayTask || this.playTask) { + // this is specially for barge in where we want to make a bargebale promt + // to a user without listening after the say task has finished + this.listenAfterSpeech = typeof this.data.listenAfterSpeech === 'boolean' ? this.data.listenAfterSpeech : true; } this.parentTask = parentTask; @@ -326,11 +326,11 @@ class TaskGather extends Task { if (evt.is_final) this._resolve('speech', evt); else { const recognizeSuccess = evt.stability > GATHER_STABILITY_THRESHOLD; - /* - we need to make sure to only send something on barge in if we have + /* + we need to make sure to only send something on barge in if we have something valid therefore we need to check the recognition stability, which applies to GOOGLE - for MS we will have a final event, meaning we will not run into + for MS we will have a final event, meaning we will not run into the current if else branch. For AWS we still need more testing diff --git a/lib/tasks/say.js b/lib/tasks/say.js index 4001a562..5f640720 100644 --- a/lib/tasks/say.js +++ b/lib/tasks/say.js @@ -21,15 +21,21 @@ 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 && 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 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, + this.logger.info({language, + voice, localSynthesizer: this.synthesizer, speechSynthesisVendor: cs.speechSynthesisVendor, speechSynthesisLanguage: cs.speechSynthesisLanguage,