From cc33ac1d51261ed876ac2158bf1216c1b8af6608 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:32:07 +0700 Subject: [PATCH] fix conference end is not sent when moderator leave conference (#825) * fix conference end is not sent when moderator leave conference * wip * fix review comment --- lib/session/call-session.js | 3 +++ lib/tasks/conference.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index ac81dc8f..71bc7d79 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -2067,6 +2067,9 @@ Duration=${duration} ` this.logger.error('CallSession:replaceEndpoint cannot be called without stable dlg'); return; } + // When this call kicked out from conference, session need to replace endpoint + // but this.ms might be undefined/null at this case. + this.ms = this.ms || this.getMS(); this.ep = await this.ms.createEndpoint({remoteSdp: this.dlg.remote.sdp}); this._configMsEndpoint(); diff --git a/lib/tasks/conference.js b/lib/tasks/conference.js index 6692a874..7fe451fb 100644 --- a/lib/tasks/conference.js +++ b/lib/tasks/conference.js @@ -604,7 +604,7 @@ class Conference extends Task { * when we hang up as the last member, the current member count = 1 * when we are kicked out of the call when the moderator leaves, the member count = 0 */ - if (this.participantCount === 0) { + if (this.participantCount === 0 || this.endConferenceOnExit) { const {deleteKey} = cs.srf.locals.dbHelpers; try { this._notifyConferenceEvent(cs, 'end'); @@ -612,7 +612,8 @@ class Conference extends Task { this.logger.info(`conf ${this.confName} deprovisioned: ${removed ? 'success' : 'failure'}`); } catch (err) { - this.logger.error(err, `Error deprovisioning conference ${this.confName}`); + this.logger.error(err, `Error deprovisioning conference ${this.confName}, + might be the conference already cleaned by another moderator`); } } }