From e3fdf420f92f1cddb75d30f528f509b78e3e3a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Mon, 24 Dec 2018 10:01:20 -0500 Subject: [PATCH] #556. RTCSession. Emit private '_failed' event before closing --- lib/RTCSession.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/RTCSession.js b/lib/RTCSession.js index fc0cad78e..26d233ffe 100644 --- a/lib/RTCSession.js +++ b/lib/RTCSession.js @@ -2371,7 +2371,7 @@ module.exports = class RTCSession extends EventEmitter notifier.notify(response.status_code, response.reason_phrase); }); - session.on('failed', ({ message, cause }) => + session.on('_failed', ({ message, cause }) => { if (message) { @@ -3438,6 +3438,15 @@ module.exports = class RTCSession extends EventEmitter { debug('session failed'); + // Emit private '_failed' event first. + debug('emit "_failed"'); + + this.emit('_failed', { + originator, + message : message || null, + cause + }); + this._close(); debug('emit "failed"');