From 5e9407ff4e1024af43b3d572390a8883930fa4dd Mon Sep 17 00:00:00 2001 From: akirilyuk <45361199+akirilyuk@users.noreply.github.com> Date: Tue, 14 Jun 2022 14:20:55 +0200 Subject: [PATCH] add defaults to rest call payload (#115) Co-authored-by: akirilyuk --- lib/tasks/rest_dial.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/tasks/rest_dial.js b/lib/tasks/rest_dial.js index 7704687e..9af788fe 100644 --- a/lib/tasks/rest_dial.js +++ b/lib/tasks/rest_dial.js @@ -50,7 +50,22 @@ class TaskRestDial extends Task { try { const b3 = this.getTracingPropagation(); const httpHeaders = b3 && {b3}; - const tasks = await cs.requestor.request('session:new', this.call_hook, cs.callInfo, httpHeaders); + const params = { + ...cs.callInfo, + defaults: { + synthesizer: { + vendor: cs.speechSynthesisVendor, + language: cs.speechSynthesisLanguage, + voice: cs.speechSynthesisVoice + }, + recognizer: { + vendor: cs.speechRecognizerVendor, + language: cs.speechRecognizerLanguage + } + } + }; + + const tasks = await cs.requestor.request('session:new', this.call_hook, params, httpHeaders); if (tasks && Array.isArray(tasks)) { this.logger.debug({tasks: tasks}, `TaskRestDial: replacing application with ${tasks.length} tasks`); cs.replaceApplication(normalizeJambones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata)));