fix issue with listenOnly not hanging up
This commit is contained in:
parent
d3bf2ab0b7
commit
c80827ee20
@ -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
|
||||
|
@ -13,7 +13,7 @@ export default class VertoBridge extends BaseAudioBridge {
|
||||
this.vertoUsername = 'FreeSWITCH User - ' + encodeURIComponent(username);
|
||||
}
|
||||
|
||||
exitAudio() {
|
||||
exitAudio(listenOnly) {
|
||||
window.vertoExitAudio();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user