From c395109966c18f23f5d7ed913555f4312d3af5f1 Mon Sep 17 00:00:00 2001 From: akirilyuk Date: Tue, 1 Feb 2022 14:30:27 +0100 Subject: [PATCH] add more logs --- lib/tasks/cognigy/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/tasks/cognigy/index.js b/lib/tasks/cognigy/index.js index 146e75e3..6e26be39 100644 --- a/lib/tasks/cognigy/index.js +++ b/lib/tasks/cognigy/index.js @@ -68,14 +68,17 @@ class Cognigy extends Task { rejector = reject; }); this.taskQueue.push(async(cb) => { + this.logger.info("EXECUTING SAY TASK"); try { - const result = await task.bind(this)(); + const result = await task(); resolver(result); cb(result); } catch (err) { + this.logger.error({err}, "could not execute task in task queue"); rejector(err); cb(err); } + this.logger.info("SAY TASK EXECUTED"); }); this.taskQueue.lastPromise = taskPromise; return taskPromise; @@ -253,9 +256,10 @@ class Cognigy extends Task { const text = parseBotText(evt); if (evt.data) this.config.update(evt.data); if (text) { - await this._enqueueTask(async() => { + this.logger.info({text}, "received text"); + await this._enqueueTask((async() => { await this._makeSayTask(text); - }); + }).bind(this)); } @@ -263,13 +267,13 @@ class Cognigy extends Task { try { switch (evt.data.type) { case 'hangup': - await this._enqueueTask(async() => { + await this._enqueueTask((async() => { await this._makeHangupTask(evt.data.reason); this.performAction({cognigyResult: 'hangup Succeeded'}); this.reportedFinalAction = true; this.notifyTaskDone(); this.kill(cs); - }); + }).bind(this)); return; case 'refer':