diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js index 2cce3322ab..86260d0784 100644 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js @@ -24,30 +24,26 @@ export default class SIPBridge extends BaseAudioBridge { // Periodically check the status of the WebRTC call, when a call has been established attempt to // hangup, retry if a call is in progress, send the leave voice conference message to BBB - exitAudio(afterExitCall = () => {}) { - // To be called when the hangup is initiated + exitAudio(isListenOnly, afterExitCall = () => {}) { + // To be called when the hangup is confirmed const hangupCallback = function () { - console.log('Exiting Voice Conference'); + console.log('Exited Voice Conference, listenOnly=' + isListenOnly); + + // notify BBB-apps we are leaving the call if we are in listen only mode + if (isListenOnly) { + callServer('listenOnlyToggle', false); + } }; - // Checks periodically until a call is established so we can successfully end the call - // clean state + // Checks periodically until a call is established so we can successfully end the call clean state triedHangup = false; // function to initiate call const checkToHangupCall = ((context, afterExitCall = () => {}) => { - // if an attempt to hang up the call is made when the current session is not yet finished, - // the request has no effect - // keep track in the session if we haven't tried a hangup + // the request has no effect keep track in the session if we haven't tried a hangup if (window.getCallStatus() != null && !triedHangup) { console.log('Attempting to hangup on WebRTC call'); - - // notify BBB-apps we are leaving the call call if we are listen only - if (this.userData.listenOnly) { - callServer('listenOnlyToggle', false); - } - window.webrtc_hangup(hangupCallback); // we have hung up, prevent retries diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/verto.js b/bigbluebutton-html5/imports/api/audio/client/bridge/verto.js index 2b1936062d..63e299b703 100644 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/verto.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/verto.js @@ -13,7 +13,7 @@ export default class VertoBridge extends BaseAudioBridge { this.vertoUsername = 'FreeSWITCH User - ' + encodeURIComponent(username); } - exitAudio() { + exitAudio(listenOnly) { window.vertoExitAudio(); } diff --git a/bigbluebutton-html5/imports/api/audio/client/manager/index.js b/bigbluebutton-html5/imports/api/audio/client/manager/index.js index fb83859cff..fa9b020e32 100644 --- a/bigbluebutton-html5/imports/api/audio/client/manager/index.js +++ b/bigbluebutton-html5/imports/api/audio/client/manager/index.js @@ -1,4 +1,3 @@ -import { callServer } from '/imports/ui/services/api'; import BaseAudioBridge from '../bridge/base'; import VertoBridge from '../bridge/verto'; import SIPBridge from '../bridge/sip'; @@ -13,15 +12,16 @@ export default class AudioManager { } this.bridge = audioBridge; + this.isListenOnly = false; } exitAudio () { - this.bridge.exitAudio(); + this.bridge.exitAudio(this.isListenOnly); } joinAudio(listenOnly) { if (listenOnly) { - callServer('listenOnlyToggle', true); + this.isListenOnly = true; this.bridge.joinListenOnly(); } else { this.bridge.joinMicrophone(); diff --git a/bigbluebutton-html5/imports/ui/components/audio/service.js b/bigbluebutton-html5/imports/ui/components/audio/service.js index 7ea0cf0ac8..971069b92d 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/service.js +++ b/bigbluebutton-html5/imports/ui/components/audio/service.js @@ -17,7 +17,6 @@ const init = () => { const userId = Auth.userID; const User = Users.findOne({ userId }); const username = User.user.name; - const listenOnly = User.user.listenOnly; const Meeting = Meetings.findOne(); //TODO test this with Breakouts const turns = Meeting.turns; @@ -27,7 +26,6 @@ const init = () => { const userData = { userId, username, - listenOnly, turns, stuns, voiceBridge,