diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as index 7a35f55972..120a59b91e 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/ConnectionManager.as @@ -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; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as index ffec32cdaf..5b194b4194 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/PhoneManager.as @@ -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 { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as index d33f116d88..4fe58a6abb 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/managers/StreamManager.as @@ -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; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMap.mxml index 2daa11066b..a27559fa9d 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMap.mxml @@ -67,7 +67,7 @@ - + @@ -82,6 +82,7 @@ + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMapDelegate.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMapDelegate.as index 099cb0daea..f3262d8613 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMapDelegate.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/maps/PhoneEventMapDelegate.as @@ -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; } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/views/components/ToolbarButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/views/components/ToolbarButton.mxml index e588bd39c9..d645d9c63e 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/views/components/ToolbarButton.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/views/components/ToolbarButton.mxml @@ -20,16 +20,14 @@ $Id: $ --> - - - +