- auto rejoin the user when she gets disconnected from the voice conference without
explicitly requesting to leave the voice conference. SIDE EFFECT: This "feature" make kicking the user from the voice conference a "broken feature" as the user get rejoined when kicked from the voice conference. We'll ahve to figure out how to detect that a user was disconnected because he was ejected by the moderator.
This commit is contained in:
parent
77b443299b
commit
05140aeb90
@ -17,8 +17,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package org.bigbluebutton.modules.phone.managers {
|
||||
|
||||
package org.bigbluebutton.modules.phone.managers {
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import flash.events.AsyncErrorEvent;
|
||||
import flash.events.Event;
|
||||
|
@ -35,6 +35,13 @@ package org.bigbluebutton.modules.phone.managers {
|
||||
private var onCall:Boolean = false;
|
||||
private var attributes:Object;
|
||||
private var phoneOptions:PhoneOptions;
|
||||
// If we are joining with microphone or not
|
||||
private var withMic:Boolean = false;
|
||||
// If we are auto-rejoining the conference because we got disconnected.
|
||||
private var rejoining:Boolean = false;
|
||||
// User has requested to leave the voice conference.
|
||||
private var userHangup:Boolean = false;
|
||||
|
||||
|
||||
public function PhoneManager() {
|
||||
connectionManager = new ConnectionManager();
|
||||
@ -71,7 +78,8 @@ package org.bigbluebutton.modules.phone.managers {
|
||||
}
|
||||
|
||||
private function setupMic(useMic:Boolean):void {
|
||||
if (useMic)
|
||||
withMic = useMic;
|
||||
if (withMic)
|
||||
streamManager.initMicrophone();
|
||||
else
|
||||
streamManager.initWithNoMicrophone();
|
||||
@ -82,11 +90,21 @@ package org.bigbluebutton.modules.phone.managers {
|
||||
}
|
||||
|
||||
public function joinVoice(autoJoin:Boolean):void {
|
||||
userHangup = false;
|
||||
setupMic(autoJoin);
|
||||
var uid:String = String(Math.floor(new Date().getTime()));
|
||||
var uname:String = encodeURIComponent(UserManager.getInstance().getConference().getMyUserId() + "-" + attributes.username);
|
||||
connectionManager.connect(uid, attributes.externUserID, uname , attributes.room, attributes.uri);
|
||||
}
|
||||
|
||||
public function rejoin():void {
|
||||
if (!rejoining && !userHangup) {
|
||||
// We got disconnected and it's not because the user requested it. Let's rejoin the conference.
|
||||
LogUtil.debug("Rejoining the conference");
|
||||
rejoining = true;
|
||||
joinVoice(withMic);
|
||||
}
|
||||
}
|
||||
|
||||
public function dialConference():void {
|
||||
connectionManager.doCall(attributes.webvoiceconf);
|
||||
@ -96,6 +114,15 @@ package org.bigbluebutton.modules.phone.managers {
|
||||
setupConnection();
|
||||
streamManager.callConnected(event.playStreamName, event.publishStreamName, event.codec);
|
||||
onCall = true;
|
||||
// We have joined the conference. Reset so that if and when we get disconnected, we
|
||||
// can rejoin automatically.
|
||||
rejoining = false;
|
||||
}
|
||||
|
||||
public function userRequestedHangup():void {
|
||||
LogUtil.debug("User has requested to hangup and leave the conference");
|
||||
userHangup = true;
|
||||
hangup();
|
||||
}
|
||||
|
||||
public function hangup():void {
|
||||
|
@ -18,18 +18,18 @@
|
||||
*/
|
||||
|
||||
package org.bigbluebutton.modules.phone.managers {
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import flash.events.ActivityEvent;
|
||||
import flash.events.AsyncErrorEvent;
|
||||
import flash.events.IEventDispatcher;
|
||||
import flash.events.NetStatusEvent;
|
||||
import flash.events.StatusEvent;
|
||||
import flash.media.Microphone;
|
||||
import flash.media.MicrophoneEnhancedMode;
|
||||
import flash.media.MicrophoneEnhancedOptions;
|
||||
import flash.media.SoundCodec;
|
||||
import flash.net.NetConnection;
|
||||
import flash.net.NetStream;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import flash.events.ActivityEvent;
|
||||
import flash.events.AsyncErrorEvent;
|
||||
import flash.events.IEventDispatcher;
|
||||
import flash.events.NetStatusEvent;
|
||||
import flash.events.StatusEvent;
|
||||
import flash.media.Microphone;
|
||||
import flash.media.MicrophoneEnhancedMode;
|
||||
import flash.media.MicrophoneEnhancedOptions;
|
||||
import flash.media.SoundCodec;
|
||||
import flash.net.NetConnection;
|
||||
import flash.net.NetStream;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
|
@ -67,7 +67,7 @@
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="LEAVE_VOICE_CONFERENCE_EVENT">
|
||||
<MethodInvoker generator="{PhoneManager}" method="hangup"/>
|
||||
<MethodInvoker generator="{PhoneManager}" method="userRequestedHangup"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="JOIN_VOICE_CONFERENCE_EVENT">
|
||||
@ -82,6 +82,7 @@
|
||||
<EventHandlers type="{CallDisconnectedEvent.CALL_DISCONNECTED_EVENT}">
|
||||
<MethodInvoker generator="{PhoneManager}" method="hangup" />
|
||||
<MethodInvoker generator="{PhoneEventMapDelegate}" method="enableToolbarButton" />
|
||||
<MethodInvoker generator="{PhoneManager}" method="rejoin" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ConnectionStatusEvent.CONNECTION_STATUS_EVENT}">
|
||||
|
@ -71,10 +71,12 @@ package org.bigbluebutton.modules.phone.maps
|
||||
|
||||
public function disableToolbarButton():void {
|
||||
phoneButton.selected = true;
|
||||
phoneButton.enabled = true;
|
||||
}
|
||||
|
||||
public function enableToolbarButton():void {
|
||||
phoneButton.selected = false;
|
||||
phoneButton.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -20,16 +20,14 @@
|
||||
$Id: $
|
||||
-->
|
||||
|
||||
<mx:Button xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
<mx:Button xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:mate="http://mate.asfusion.com/"
|
||||
icon="{phoneIcon}" click="startPhone()"
|
||||
xmlns:mate="http://mate.asfusion.com/"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.toolbar.phone.toolTip')}"
|
||||
implements="org.bigbluebutton.common.IBbbToolbarComponent">
|
||||
|
||||
<mate:Listener type="{CallDisconnectedEvent.CALL_DISCONNECTED_EVENT}" method="handleCallDisconnectedEvent"/>
|
||||
<mate:Listener type="{BBBEvent.JOIN_VOICE_CONFERENCE}" method="handleBBBJoinConferenceEvent"/>
|
||||
<mate:Listener type="MIC_SETTINGS_CLOSED" method="handleMicSettingsClosedEvent"/>
|
||||
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
@ -50,7 +48,11 @@
|
||||
[Bindable] public var phoneIcon:Class = images.headset_icon;
|
||||
|
||||
private function startPhone():void {
|
||||
if (this.selected) {
|
||||
// Disable the button right away to prevent the user from clicking
|
||||
// multiple times.
|
||||
this.enabled = false;
|
||||
|
||||
if (this.selected) {
|
||||
var vxml:XML = BBB.getConfigForModule("PhoneModule");
|
||||
var phoneOptions:PhoneOptions = new PhoneOptions();
|
||||
if (vxml != null) {
|
||||
@ -58,10 +60,12 @@
|
||||
phoneOptions.autoJoin = (vxml.@autoJoin.toString().toUpperCase() == "TRUE") ? true : false;
|
||||
phoneOptions.skipCheck = (vxml.@skipCheck.toString().toUpperCase() == "TRUE") ? true : false;
|
||||
}
|
||||
this.enabled = false;
|
||||
|
||||
if (phoneOptions.skipCheck || noMicrophone()) {
|
||||
/*
|
||||
* If the user had no mic, let her join but she'll just be listening.
|
||||
* We should indicate a warning that the user is joining without mic
|
||||
* so that he will know that others won't be able to hear him.
|
||||
*/
|
||||
var joinEvent:BBBEvent = new BBBEvent("JOIN_VOICE_CONFERENCE_EVENT");
|
||||
joinEvent.payload['useMicrophone'] = true;
|
||||
@ -70,27 +74,20 @@
|
||||
dispatcher.dispatchEvent(new BBBEvent("SHOW_MIC_SETTINGS"));
|
||||
}
|
||||
} else {
|
||||
dispatcher.dispatchEvent(new BBBEvent("LEAVE_VOICE_CONFERENCE_EVENT"));
|
||||
var leaveEvent:BBBEvent = new BBBEvent("LEAVE_VOICE_CONFERENCE_EVENT");
|
||||
leaveEvent.payload["userRequested"] = true;
|
||||
dispatcher.dispatchEvent(leaveEvent);
|
||||
}
|
||||
|
||||
|
||||
var t:Timer = new Timer(3000, 1);
|
||||
t.addEventListener(TimerEvent.TIMER, onTimer);
|
||||
t.start();
|
||||
}
|
||||
|
||||
private function noMicrophone():Boolean {
|
||||
return ((Microphone.getMicrophone() == null) || (Microphone.names.length == 0)
|
||||
|| ((Microphone.names.length == 1) && (Microphone.names[0] == "Unknown Microphone")));
|
||||
}
|
||||
|
||||
private function onTimer(e:TimerEvent):void{
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
private function handleCallDisconnectedEvent(event:CallDisconnectedEvent):void {
|
||||
this.selected = false;
|
||||
}
|
||||
|
||||
// private function handleCallDisconnectedEvent(event:CallDisconnectedEvent):void {
|
||||
// this.selected = false;
|
||||
// }
|
||||
|
||||
private function handleMicSettingsClosedEvent(event:BBBEvent):void {
|
||||
this.selected = false;
|
||||
|
Loading…
Reference in New Issue
Block a user