diff --git a/lib/tasks/cognigy/speech-config.js b/lib/tasks/cognigy/speech-config.js index fe448963..a513d400 100644 --- a/lib/tasks/cognigy/speech-config.js +++ b/lib/tasks/cognigy/speech-config.js @@ -51,13 +51,23 @@ class SpeechConfig extends Emitter { const minBargeinWordCount = speechBargein ? (bargein.minWordCount || 1) : 0; const {interDigitTimeout = 0, maxDigits, minDigits = 1, submitDigit} = (opts.dtmf || {}); const {noInputTimeout, noInputRetries, noInputSpeech, noInputUrl} = (opts.user || {}); - const sayConfig = { - text: textPrompt, - synthesizer: opts.synthesizer - }; - const playConfig = { - url: urlPrompt - }; + + let sayConfig; + let playConfig; + + if (textPrompt) { + sayConfig = { + text: textPrompt, + synthesizer: opts.synthesizer + }; + } + + if (urlPrompt) { + playConfig = { + url: urlPrompt + }; + } + const config = { input, listenDuringPrompt: speechBargein,