diff --git a/lib/tasks/dial.js b/lib/tasks/dial.js index d4f2e133..693dfc89 100644 --- a/lib/tasks/dial.js +++ b/lib/tasks/dial.js @@ -252,7 +252,12 @@ class TaskDial extends Task { this.logger.debug({callSid: this.cs.callSid}, 'Dial:exec task is done, sending actionHook if any'); if (this.actionHook) hookAttempted = true; else this._endSessionUnlessHandedOff(cs, 'dial completed with no actionHook'); - await this.performAction(this.results, this.killReason !== KillReason.Replaced); + const gotVerbs = await this.performAction(this.results, this.killReason !== KillReason.Replaced); + /* hook answered but with nothing usable: empty array, a non-array body, or a + non-json content-type, none of which throw */ + if (hookAttempted && gotVerbs === false) { + this._endSessionUnlessHandedOff(cs, 'dial actionHook returned no verbs'); + } this._removeDtmfDetection(cs.dlg); this._removeDtmfDetection(this.dlg); this._removeSipIndialogRequestListener(this.dlg);