Merge branch 'webrtc-timeout' into v0.9.0-release
Conflicts: bigbluebutton-client/resources/prod/lib/bbb_webrtc_bridge_sip.js bigbluebutton-client/src/org/bigbluebutton/main/views/WebRTCEchoTest.mxml
This commit is contained in:
commit
b555c579a8
@ -165,6 +165,7 @@ function createUAWithStuns(username, server, callback, stunsConfig, makeCallFunc
|
||||
traceSip: true,
|
||||
autostart: false,
|
||||
userAgentString: "BigBlueButton",
|
||||
iceGatheringTimeout: 5000,
|
||||
stunServers: stunsConfig['stunServers'],
|
||||
turnServers: stunsConfig['turnServers']
|
||||
};
|
||||
@ -354,6 +355,17 @@ function make_call(username, voiceBridge, server, callback, recall) {
|
||||
console.log('bye event already received');
|
||||
}
|
||||
});
|
||||
currentSession.on('cancel', function(request){
|
||||
callActive = false;
|
||||
|
||||
if (currentSession) {
|
||||
console.log('call canceled');
|
||||
clearTimeout(callTimeout);
|
||||
currentSession = null;
|
||||
} else {
|
||||
console.log('cancel event already received');
|
||||
}
|
||||
});
|
||||
currentSession.on('accepted', function(data){
|
||||
callActive = true;
|
||||
console.log('BigBlueButton call accepted');
|
||||
@ -410,7 +422,12 @@ function webrtc_hangup(callback) {
|
||||
if (callback) {
|
||||
currentSession.on('bye', callback);
|
||||
}
|
||||
try {
|
||||
currentSession.bye();
|
||||
} catch (err) {
|
||||
console.log("Forcing to cancel current session");
|
||||
currentSession.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
function isWebRTCAvailable() {
|
||||
|
@ -8884,6 +8884,7 @@ UA.prototype.loadConfig = function(configuration) {
|
||||
userAgentString: SIP.C.USER_AGENT,
|
||||
|
||||
// Session parameters
|
||||
iceGatheringTimeout: 5000,
|
||||
noAnswerTimeout: 60,
|
||||
stunServers: ['stun:stun.l.google.com:19302'],
|
||||
turnServers: [],
|
||||
@ -9107,6 +9108,7 @@ UA.configuration_skeleton = (function() {
|
||||
"hackViaTcp", // false.
|
||||
"hackIpInContact", //false
|
||||
"hackWssInTransport", //false
|
||||
"iceGatheringTimeout",
|
||||
"instanceId",
|
||||
"noAnswerTimeout", // 30 seconds.
|
||||
"password",
|
||||
@ -9288,6 +9290,15 @@ UA.configuration_check = {
|
||||
}
|
||||
},
|
||||
|
||||
iceGatheringTimeout: function(iceGatheringTimeout) {
|
||||
if(SIP.Utils.isDecimal(iceGatheringTimeout)) {
|
||||
if (iceGatheringTimeout < 500) {
|
||||
return 5000;
|
||||
}
|
||||
return iceGatheringTimeout;
|
||||
}
|
||||
},
|
||||
|
||||
instanceId: function(instanceId) {
|
||||
if(typeof instanceId !== 'string') {
|
||||
return;
|
||||
@ -10330,11 +10341,22 @@ var MediaHandler = function(session, options) {
|
||||
};
|
||||
|
||||
this.peerConnection.onicecandidate = function(e) {
|
||||
if (self.iceGatheringTimer === undefined) {
|
||||
self.iceGatheringTimer = SIP.Timers.setTimeout(function() {
|
||||
self.logger.log('RTCIceGathering Timeout Triggered after '+config.iceGatheringTimeout+' micro seconds');
|
||||
self.onIceCompleted.resolve(this);
|
||||
}.bind(this), config.iceGatheringTimeout);
|
||||
}
|
||||
|
||||
if (e.candidate) {
|
||||
self.logger.log('ICE candidate received: '+ (e.candidate.candidate === null ? null : e.candidate.candidate.trim()));
|
||||
} else {
|
||||
if (self.iceGatheringTimer) {
|
||||
SIP.Timers.clearTimeout(self.iceGatheringTimer);
|
||||
self.iceGatheringTimer = null;
|
||||
self.onIceCompleted.resolve(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.peerConnection.onicegatheringstatechange = function () {
|
||||
|
@ -58,7 +58,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private static const LOG:String = "Phone::WebRTCEchoTest - ";
|
||||
private static var DEFAULT_HELP_URL:String = "http://www.bigbluebutton.org/content/videos";
|
||||
|
||||
private static const TIMEOUT:Number = 60;
|
||||
private static const CANCEL_BUTTON:Number = 55;
|
||||
|
||||
private var dotTimer:Timer;
|
||||
|
||||
private var cancelTimer:Timer;
|
||||
private var countdown:Number;
|
||||
|
||||
[Bindable]
|
||||
private var cancelButtonLabel:String = ResourceUtil.getInstance().getString('bbb.micSettings.cancel');
|
||||
|
||||
private var userClosed:Boolean = false;
|
||||
|
||||
override public function move(x:Number, y:Number):void {
|
||||
@ -67,7 +77,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
private function onCancelClicked():void {
|
||||
|
||||
if (dotTimer) dotTimer.stop();
|
||||
stopTimers();
|
||||
PopUpManager.removePopUp(this);
|
||||
}
|
||||
|
||||
@ -80,11 +90,49 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
lblConnectMessage.text = lblConnectMessageMock.text = ResourceUtil.getInstance().getString('bbb.micSettings.webrtc.connecting');
|
||||
dotTimer = new Timer(200, 0);
|
||||
dotTimer.addEventListener(TimerEvent.TIMER, dotAnimate);
|
||||
dotTimer.start();
|
||||
|
||||
cancelTimer = new Timer(1000, 0);
|
||||
cancelTimer.addEventListener(TimerEvent.TIMER, timeout);
|
||||
|
||||
startTimers();
|
||||
|
||||
var testState:String = PhoneModel.getInstance().webRTCModel.state;
|
||||
if (testState == Constants.DO_ECHO_TEST) {
|
||||
webRTCEchoTestStarted();
|
||||
}
|
||||
|
||||
cancelButton.width = cancelButton.measureText(genCancelButtonLabel(TIMEOUT)).width
|
||||
+ cancelButton.getStyle("paddingRight")
|
||||
+ cancelButton.getStyle("paddingLeft")
|
||||
+ 8; // 8 is magic number
|
||||
}
|
||||
|
||||
private function startTimers():void {
|
||||
cancelButton.visible = false;
|
||||
if (!dotTimer.running) dotTimer.start();
|
||||
if (!cancelTimer.running) {
|
||||
countdown = TIMEOUT;
|
||||
cancelTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private function stopTimers():void {
|
||||
if (dotTimer.running) dotTimer.stop();
|
||||
if (cancelTimer.running) cancelTimer.stop();
|
||||
}
|
||||
|
||||
private function genCancelButtonLabel(countdown:Number):String {
|
||||
return cancelButtonLabel + " (" + countdown.toString() + ")";
|
||||
}
|
||||
|
||||
private function timeout(e:TimerEvent):void {
|
||||
if (countdown > 0) {
|
||||
if (!cancelButton.visible && countdown < CANCEL_BUTTON)
|
||||
cancelButton.visible = true;
|
||||
cancelButton.label = genCancelButtonLabel(countdown);
|
||||
countdown--;
|
||||
} else {
|
||||
noButtonClicked();
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +180,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
private function webRTCEchoTestStarted():void {
|
||||
setCurrentState("started");
|
||||
dotTimer.stop();
|
||||
stopTimers();
|
||||
}
|
||||
|
||||
private function handleWebRTCEchoTestEndedEvent(e:WebRTCEchoTestEvent):void {
|
||||
@ -142,7 +190,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function webRTCEchoTestEnded():void {
|
||||
setCurrentState("connecting");
|
||||
lblConnectMessage.text = lblConnectMessageMock.text = ResourceUtil.getInstance().getString('bbb.micSettings.webrtc.endedecho');
|
||||
if (!dotTimer.running) dotTimer.start();
|
||||
startTimers();
|
||||
|
||||
if (!userClosed) {
|
||||
onCancelClicked();
|
||||
@ -158,19 +206,19 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function handleWebRTCEchoTestWaitingForICEEvent(e:WebRTCEchoTestEvent):void {
|
||||
setCurrentState("connecting");
|
||||
lblConnectMessage.text = lblConnectMessageMock.text = ResourceUtil.getInstance().getString('bbb.micSettings.webrtc.waitingforice');
|
||||
if (!dotTimer.running) dotTimer.start();
|
||||
startTimers();
|
||||
}
|
||||
|
||||
private function handleWebRTCEchoTestTransferringEvent(e:WebRTCEchoTestEvent):void {
|
||||
setCurrentState("connecting");
|
||||
lblConnectMessage.text = lblConnectMessageMock.text = ResourceUtil.getInstance().getString('bbb.micSettings.webrtc.transferring');
|
||||
if (!dotTimer.running) dotTimer.start();
|
||||
startTimers();
|
||||
}
|
||||
|
||||
private function handleWebRTCCallConnectingEvent(e:WebRTCCallEvent):void {
|
||||
setCurrentState("connecting");
|
||||
lblConnectMessage.text = lblConnectMessageMock.text = ResourceUtil.getInstance().getString('bbb.micSettings.webrtc.connecting');
|
||||
if (!dotTimer.running) dotTimer.start();
|
||||
startTimers();
|
||||
}
|
||||
|
||||
private function handleWebRTCCallFailedEvent(e:WebRTCCallEvent):void {
|
||||
@ -180,7 +228,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function handleWebRTCCallWaitingForICEEvent(e:WebRTCCallEvent):void {
|
||||
setCurrentState("connecting");
|
||||
lblConnectMessage.text = lblConnectMessageMock.text = ResourceUtil.getInstance().getString('bbb.micSettings.webrtc.waitingforice');
|
||||
if (!dotTimer.running) dotTimer.start();
|
||||
startTimers();
|
||||
}
|
||||
|
||||
private function webRTCCallStarted():void {
|
||||
@ -226,13 +274,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<mx:states>
|
||||
<mx:State name="connecting">
|
||||
<mx:AddChild relativeTo="cnvTitle" position="after">
|
||||
<mx:VBox width="100%" height="100%" verticalAlign="middle">
|
||||
<mx:HBox width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">
|
||||
<mx:TextArea id="lblConnectMessage" editable="false" textAlign="right" borderSkin="{null}"
|
||||
width="{lblConnectMessageMock.width + 4}" height="{lblConnectDots.height}"
|
||||
width="{lblConnectMessageMock.width + 10}" height="{lblConnectDots.height}"
|
||||
styleName="micSettingsWindowSpeakIntoMicLabelStyle" />
|
||||
<mx:Text id="lblConnectMessageMock" visible="false" includeInLayout="false" />
|
||||
<mx:Label id="lblConnectDots" width="20" textAlign="left" styleName="micSettingsWindowSpeakIntoMicLabelStyle" text="" />
|
||||
</mx:HBox>
|
||||
<mx:HBox width="100%" verticalAlign="bottom" horizontalAlign="right">
|
||||
<mx:Button id="cancelButton"
|
||||
label="{cancelButtonLabel}"
|
||||
styleName="micSettingsWindowPlaySoundButtonStyle"
|
||||
click="noButtonClicked()"
|
||||
toolTip="" />
|
||||
</mx:HBox>
|
||||
</mx:VBox>
|
||||
</mx:AddChild>
|
||||
</mx:State>
|
||||
|
||||
|
@ -197,6 +197,19 @@
|
||||
}
|
||||
|
||||
public function initialize():void {
|
||||
JSLog.debug(LOG + "Initializing FlashCallManager, current state: " + state);
|
||||
trace(LOG + "Initializing FlashCallManager, current state: " + state);
|
||||
switch (state) {
|
||||
case STOP_ECHO_THEN_JOIN_CONF:
|
||||
// if we initialize usingFlash here, we won't be able to hang up from
|
||||
// the flash connection
|
||||
JSLog.debug(LOG + "Invalid state for initialize, aborting...");
|
||||
trace(LOG + "Invalid state for initialize, aborting...");
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
printMics();
|
||||
options = new PhoneOptions();
|
||||
if (options.useWebRTCIfAvailable && isWebRTCSupported()) {
|
||||
|
@ -100,6 +100,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{JoinVoiceConferenceCommand.JOIN_VOICE_CONF}">
|
||||
<MethodInvoker generator="{FlashCallManager}" method="initialize"/>
|
||||
<MethodInvoker generator="{FlashCallManager}" method="handleJoinVoiceConferenceCommand" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user