diff --git a/lib/session/call-session.js b/lib/session/call-session.js index 584b1aac..b7b2e814 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -313,14 +313,14 @@ class CallSession extends Emitter { this.logger.error(err, `Error executing task #${stackNum}:${taskNum}: ${task.name}`); break; } + } - if (0 === this.tasks.length && this.hasStableDialog && this.requestor instanceof WsRequestor) { - try { - await this._awaitCommandsOrHangup(); - } catch (err) { - this.logger.info(err, 'CallSession:exec - error waiting for new commands'); - break; - } + if (0 === this.tasks.length && this.hasStableDialog && this.requestor instanceof WsRequestor) { + try { + await this._awaitCommandsOrHangup(); + } catch (err) { + this.logger.info(err, 'CallSession:exec - error waiting for new commands'); + break; } } }