From 3c3dfa81d31e508290b92eac82020ff65f41248c Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Mon, 19 Jan 2026 16:42:43 -0500 Subject: [PATCH] fix issue where call hangs up and actionhook delay triggered (#1497) --- lib/utils/action-hook-delay.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/utils/action-hook-delay.js b/lib/utils/action-hook-delay.js index 4b18ae3c..254c24a7 100644 --- a/lib/utils/action-hook-delay.js +++ b/lib/utils/action-hook-delay.js @@ -118,6 +118,13 @@ class ActionHookDelayProcessor extends Emitter { this.logger.debug('ActionHookDelayProcessor#_onNoResponseTimer'); this._noResponseTimer = null; + /* check if endpoint is still available (call may have ended) */ + if (!this.ep) { + this.logger.debug('ActionHookDelayProcessor#_onNoResponseTimer: endpoint is null, call may have ended'); + this._active = false; + return; + } + /* get the next play or say action */ const verb = this.actions[this._retryCount % this.actions.length]; @@ -129,8 +136,8 @@ class ActionHookDelayProcessor extends Emitter { this._taskInProgress.exec(this.cs, {ep: this.ep}).catch((err) => { this.logger.info(`ActionHookDelayProcessor#_onNoResponseTimer: error playing file: ${err.message}`); this._taskInProgress = null; - this.ep.removeAllListeners('playback-start'); - this.ep.removeAllListeners('playback-stop'); + this.ep?.removeAllListeners('playback-start'); + this.ep?.removeAllListeners('playback-stop'); }); } catch (err) { this.logger.info(err, 'ActionHookDelayProcessor#_onNoResponseTimer: error starting action');