From 2d1a0c7692dc7ee895fbfbd296ad0ab46ace93c1 Mon Sep 17 00:00:00 2001 From: Quan HL Date: Fri, 13 Dec 2024 16:02:20 +0700 Subject: [PATCH] attach reason when endpoint is hanguped --- lib/endpoint.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/endpoint.js b/lib/endpoint.js index 71e4c83..62c65b6 100644 --- a/lib/endpoint.js +++ b/lib/endpoint.js @@ -1670,7 +1670,8 @@ class Endpoint extends Emitter { if ('HANGUP' === channelCallState && State.CONNECTED === this.state) { debug(`Endpoint#_onChannelCallState ${this.uuid}: got BYE from Freeswitch end of call`); this.state = State.DISCONNECTED; - this.emit('destroy'); + const reason = evt.getHeader('Hangup-Cause') ; + this.emit('destroy', {reason}); } this.emit('channelCallState', {state: channelCallState});