From b79781ea5c90dd071fd83f51cce55bb0f2718121 Mon Sep 17 00:00:00 2001 From: Mario Jr Date: Tue, 21 Sep 2021 11:22:05 -0300 Subject: [PATCH 1/2] fix(audio): audio controls crash when ending call during brekout audio transfer Restored the old behavior when ending breakout rooms while user is in the breakout audio transfer, which is to the trigger the reconnection to the audio in the main room. This behavior could be improved by (instead of reconnecting) transfering user back to the main room, but this requires some changes in akka-apps/fsesl which can be treated in a different issue. Closes #13242 --- .../imports/api/audio/client/bridge/sip.js | 39 ++++++++++++++++++- .../ui/services/audio-manager/index.js | 8 ++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js index f6c3e3ec43..d5f95879fd 100755 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js @@ -98,6 +98,7 @@ class SIPSession { this._hangupFlag = false; this._reconnecting = false; this._currentSessionState = null; + this._ignoreCallState = false; } get inputStream() { @@ -226,6 +227,24 @@ class SIPSession { this._outputDeviceId = deviceId; } + /** + * This _ignoreCallState flag is set to true when we want to ignore SIP's + * call state retrieved directly from FreeSWITCH ESL, when doing some checks + * (for example , when checking if call stopped). + * We need to ignore this , for example, when moderator is in + * breakout audio transfer ("Join Audio" button in breakout panel): in this + * case , we will monitor moderator's lifecycle in audio conference by + * using the SIP state taken from SIP.js only (ignoring the ESL's call state). + * @param {boolean} value true to ignore call state, false otherwise. + */ + set ignoreCallState(value) { + this._ignoreCallState = value; + } + + get ignoreCallState() { + return this._ignoreCallState; + } + joinAudio({ isListenOnly, extension, @@ -236,6 +255,8 @@ class SIPSession { return new Promise((resolve, reject) => { const callExtension = extension ? `${extension}${this.userData.voiceBridge}` : this.userData.voiceBridge; + this.ignoreCallState = false; + const callback = (message) => { // There will sometimes we erroneous errors put out like timeouts and improper shutdowns, // but only the first error ever matters @@ -1068,7 +1089,9 @@ class SIPSession { }; const checkIfCallStopped = (message) => { - if (fsReady || !sessionTerminated) return null; + if ((!this._ignoreCallState && fsReady) || !sessionTerminated) { + return null; + } if (!message && !!this.userRequestedHangup) { return this.callback({ @@ -1350,6 +1373,20 @@ export default class SIPBridge extends BaseAudioBridge { return this.activeSession ? this.activeSession.inputStream : null; } + /** + * Wrapper for SIPSession's ignoreCallState flag + * @param {boolean} value + */ + set ignoreCallState(value) { + if (this.activeSession) { + this.activeSession.ignoreCallState = value; + } + } + + get ignoreCallState() { + return this.activeSession ? this.activeSession.ignoreCallState : false; + } + joinAudio({ isListenOnly, extension, validIceCandidates }, managerCallback) { const hasFallbackDomain = typeof IPV4_FALLBACK_DOMAIN === 'string' && IPV4_FALLBACK_DOMAIN !== ''; diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js index 88032c3c8f..4d02f873c8 100755 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js @@ -631,6 +631,14 @@ class AudioManager { if (typeof status === 'string') { currentStatus.status = status; + + if (this.bridge && !this.isListenOnly) { + if (status !== BREAKOUT_AUDIO_TRANSFER_STATES.CONNECTED) { + this.bridge.ignoreCallState = false; + } else { + this.bridge.ignoreCallState = true; + } + } } } From 19f4e9e6aca944592e59943957b561ccbfa806f8 Mon Sep 17 00:00:00 2001 From: Mario Jr Date: Fri, 24 Sep 2021 14:48:22 -0300 Subject: [PATCH 2/2] update(audio): adjust reference to ignoreCallState flag --- bigbluebutton-html5/imports/api/audio/client/bridge/sip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js index d5f95879fd..13ab823561 100755 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js @@ -1089,7 +1089,7 @@ class SIPSession { }; const checkIfCallStopped = (message) => { - if ((!this._ignoreCallState && fsReady) || !sessionTerminated) { + if ((!this.ignoreCallState && fsReady) || !sessionTerminated) { return null; }