- 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
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package org.bigbluebutton.modules.phone.managers {
|
package org.bigbluebutton.modules.phone.managers {
|
||||||
|
|
||||||
import com.asfusion.mate.events.Dispatcher;
|
import com.asfusion.mate.events.Dispatcher;
|
||||||
import flash.events.AsyncErrorEvent;
|
import flash.events.AsyncErrorEvent;
|
||||||
import flash.events.Event;
|
import flash.events.Event;
|
||||||
|
@ -35,6 +35,13 @@ package org.bigbluebutton.modules.phone.managers {
|
|||||||
private var onCall:Boolean = false;
|
private var onCall:Boolean = false;
|
||||||
private var attributes:Object;
|
private var attributes:Object;
|
||||||
private var phoneOptions:PhoneOptions;
|
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() {
|
public function PhoneManager() {
|
||||||
connectionManager = new ConnectionManager();
|
connectionManager = new ConnectionManager();
|
||||||
@ -71,7 +78,8 @@ package org.bigbluebutton.modules.phone.managers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function setupMic(useMic:Boolean):void {
|
private function setupMic(useMic:Boolean):void {
|
||||||
if (useMic)
|
withMic = useMic;
|
||||||
|
if (withMic)
|
||||||
streamManager.initMicrophone();
|
streamManager.initMicrophone();
|
||||||
else
|
else
|
||||||
streamManager.initWithNoMicrophone();
|
streamManager.initWithNoMicrophone();
|
||||||
@ -82,12 +90,22 @@ package org.bigbluebutton.modules.phone.managers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function joinVoice(autoJoin:Boolean):void {
|
public function joinVoice(autoJoin:Boolean):void {
|
||||||
|
userHangup = false;
|
||||||
setupMic(autoJoin);
|
setupMic(autoJoin);
|
||||||
var uid:String = String(Math.floor(new Date().getTime()));
|
var uid:String = String(Math.floor(new Date().getTime()));
|
||||||
var uname:String = encodeURIComponent(UserManager.getInstance().getConference().getMyUserId() + "-" + attributes.username);
|
var uname:String = encodeURIComponent(UserManager.getInstance().getConference().getMyUserId() + "-" + attributes.username);
|
||||||
connectionManager.connect(uid, attributes.externUserID, uname , attributes.room, attributes.uri);
|
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 {
|
public function dialConference():void {
|
||||||
connectionManager.doCall(attributes.webvoiceconf);
|
connectionManager.doCall(attributes.webvoiceconf);
|
||||||
}
|
}
|
||||||
@ -96,6 +114,15 @@ package org.bigbluebutton.modules.phone.managers {
|
|||||||
setupConnection();
|
setupConnection();
|
||||||
streamManager.callConnected(event.playStreamName, event.publishStreamName, event.codec);
|
streamManager.callConnected(event.playStreamName, event.publishStreamName, event.codec);
|
||||||
onCall = true;
|
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 {
|
public function hangup():void {
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
</EventHandlers>
|
</EventHandlers>
|
||||||
|
|
||||||
<EventHandlers type="LEAVE_VOICE_CONFERENCE_EVENT">
|
<EventHandlers type="LEAVE_VOICE_CONFERENCE_EVENT">
|
||||||
<MethodInvoker generator="{PhoneManager}" method="hangup"/>
|
<MethodInvoker generator="{PhoneManager}" method="userRequestedHangup"/>
|
||||||
</EventHandlers>
|
</EventHandlers>
|
||||||
|
|
||||||
<EventHandlers type="JOIN_VOICE_CONFERENCE_EVENT">
|
<EventHandlers type="JOIN_VOICE_CONFERENCE_EVENT">
|
||||||
@ -82,6 +82,7 @@
|
|||||||
<EventHandlers type="{CallDisconnectedEvent.CALL_DISCONNECTED_EVENT}">
|
<EventHandlers type="{CallDisconnectedEvent.CALL_DISCONNECTED_EVENT}">
|
||||||
<MethodInvoker generator="{PhoneManager}" method="hangup" />
|
<MethodInvoker generator="{PhoneManager}" method="hangup" />
|
||||||
<MethodInvoker generator="{PhoneEventMapDelegate}" method="enableToolbarButton" />
|
<MethodInvoker generator="{PhoneEventMapDelegate}" method="enableToolbarButton" />
|
||||||
|
<MethodInvoker generator="{PhoneManager}" method="rejoin" />
|
||||||
</EventHandlers>
|
</EventHandlers>
|
||||||
|
|
||||||
<EventHandlers type="{ConnectionStatusEvent.CONNECTION_STATUS_EVENT}">
|
<EventHandlers type="{ConnectionStatusEvent.CONNECTION_STATUS_EVENT}">
|
||||||
|
@ -71,10 +71,12 @@ package org.bigbluebutton.modules.phone.maps
|
|||||||
|
|
||||||
public function disableToolbarButton():void {
|
public function disableToolbarButton():void {
|
||||||
phoneButton.selected = true;
|
phoneButton.selected = true;
|
||||||
|
phoneButton.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enableToolbarButton():void {
|
public function enableToolbarButton():void {
|
||||||
phoneButton.selected = false;
|
phoneButton.selected = false;
|
||||||
|
phoneButton.enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,13 +20,11 @@
|
|||||||
$Id: $
|
$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()"
|
icon="{phoneIcon}" click="startPhone()"
|
||||||
xmlns:mate="http://mate.asfusion.com/"
|
|
||||||
toolTip="{ResourceUtil.getInstance().getString('bbb.toolbar.phone.toolTip')}"
|
toolTip="{ResourceUtil.getInstance().getString('bbb.toolbar.phone.toolTip')}"
|
||||||
implements="org.bigbluebutton.common.IBbbToolbarComponent">
|
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="{BBBEvent.JOIN_VOICE_CONFERENCE}" method="handleBBBJoinConferenceEvent"/>
|
||||||
<mate:Listener type="MIC_SETTINGS_CLOSED" method="handleMicSettingsClosedEvent"/>
|
<mate:Listener type="MIC_SETTINGS_CLOSED" method="handleMicSettingsClosedEvent"/>
|
||||||
|
|
||||||
@ -50,6 +48,10 @@
|
|||||||
[Bindable] public var phoneIcon:Class = images.headset_icon;
|
[Bindable] public var phoneIcon:Class = images.headset_icon;
|
||||||
|
|
||||||
private function startPhone():void {
|
private function startPhone():void {
|
||||||
|
// Disable the button right away to prevent the user from clicking
|
||||||
|
// multiple times.
|
||||||
|
this.enabled = false;
|
||||||
|
|
||||||
if (this.selected) {
|
if (this.selected) {
|
||||||
var vxml:XML = BBB.getConfigForModule("PhoneModule");
|
var vxml:XML = BBB.getConfigForModule("PhoneModule");
|
||||||
var phoneOptions:PhoneOptions = new PhoneOptions();
|
var phoneOptions:PhoneOptions = new PhoneOptions();
|
||||||
@ -58,10 +60,12 @@
|
|||||||
phoneOptions.autoJoin = (vxml.@autoJoin.toString().toUpperCase() == "TRUE") ? true : false;
|
phoneOptions.autoJoin = (vxml.@autoJoin.toString().toUpperCase() == "TRUE") ? true : false;
|
||||||
phoneOptions.skipCheck = (vxml.@skipCheck.toString().toUpperCase() == "TRUE") ? true : false;
|
phoneOptions.skipCheck = (vxml.@skipCheck.toString().toUpperCase() == "TRUE") ? true : false;
|
||||||
}
|
}
|
||||||
this.enabled = false;
|
|
||||||
if (phoneOptions.skipCheck || noMicrophone()) {
|
if (phoneOptions.skipCheck || noMicrophone()) {
|
||||||
/*
|
/*
|
||||||
* If the user had no mic, let her join but she'll just be listening.
|
* 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");
|
var joinEvent:BBBEvent = new BBBEvent("JOIN_VOICE_CONFERENCE_EVENT");
|
||||||
joinEvent.payload['useMicrophone'] = true;
|
joinEvent.payload['useMicrophone'] = true;
|
||||||
@ -70,13 +74,10 @@
|
|||||||
dispatcher.dispatchEvent(new BBBEvent("SHOW_MIC_SETTINGS"));
|
dispatcher.dispatchEvent(new BBBEvent("SHOW_MIC_SETTINGS"));
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
private function noMicrophone():Boolean {
|
||||||
@ -84,13 +85,9 @@
|
|||||||
|| ((Microphone.names.length == 1) && (Microphone.names[0] == "Unknown Microphone")));
|
|| ((Microphone.names.length == 1) && (Microphone.names[0] == "Unknown Microphone")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onTimer(e:TimerEvent):void{
|
// private function handleCallDisconnectedEvent(event:CallDisconnectedEvent):void {
|
||||||
this.enabled = true;
|
// this.selected = false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function handleCallDisconnectedEvent(event:CallDisconnectedEvent):void {
|
|
||||||
this.selected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function handleMicSettingsClosedEvent(event:BBBEvent):void {
|
private function handleMicSettingsClosedEvent(event:BBBEvent):void {
|
||||||
this.selected = false;
|
this.selected = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user