- query for guest wait status

This commit is contained in:
Richard Alam 2018-02-26 10:51:02 -08:00
parent 7b2d2279f9
commit e981a874c3
7 changed files with 51 additions and 22 deletions

View File

@ -1303,7 +1303,7 @@ class ApiController {
boolean reject = false;
if (StringUtils.isEmpty(params.sessionToken)) {
println("SessionToken is missing.")
log.debug("SessionToken is missing.")
}
String sessionToken = StringUtils.strip(params.sessionToken)
@ -1312,16 +1312,19 @@ class ApiController {
Meeting meeting = null;
UserSession userSession = null;
if (meetingService.getUserSessionWithAuthToken(sessionToken) == null)
if (meetingService.getUserSessionWithAuthToken(sessionToken) == null) {
log.debug("No user with session token.")
reject = true;
else {
} else {
us = meetingService.getUserSessionWithAuthToken(sessionToken);
meeting = meetingService.getMeeting(us.meetingID);
if (meeting == null || meeting.isForciblyEnded()) {
log.debug("Meeting not found.")
reject = true
}
userSession = meetingService.getUserSessionWithAuthToken(sessionToken)
if (userSession == null) {
log.debug("Session with user not found.")
reject = true
}
@ -1352,10 +1355,11 @@ class ApiController {
//check if exists the param redirect
boolean redirectClient = true;
String clientURL = paramsProcessorUtil.getDefaultClientUrl();
log.info("redirect = ." + redirectClient)
if(! StringUtils.isEmpty(params.redirect)) {
try{
redirectClient = Boolean.parseBoolean(params.redirect);
log.info("redirect 2 = ." + redirectClient)
}catch(Exception e){
redirectClient = true;
}

View File

@ -43,11 +43,16 @@ package org.bigbluebutton.air.main.commands {
joinSubservice.successSignal.add(joinSuccess);
joinSubservice.failureSignal.add(joinFailure);
joinSubservice.guestWaitSignal.add(onGuestWaitSignal);
guestWaitService.guestAccessAllowedSignal.add(joinSuccess);
joinSubservice.join(url);
}
protected function onGuestWaitSignal(urlRequest:URLRequest, responseUrl:String, sessionToken:String):void {
protected function onGuestWaitSignal(waitUrl: String, urlRequest:URLRequest, responseUrl:String, sessionToken:String):void {
trace("GUEST WAIT URL = " + waitUrl);
guestWaitService.wait(waitUrl, urlRequest, responseUrl, sessionToken);
}
protected function joinSuccess(urlRequest:URLRequest, responseUrl:String, sessionToken:String):void {

View File

@ -6,8 +6,9 @@ package org.bigbluebutton.air.main.services {
import flash.net.URLRequest;
import org.bigbluebutton.lib.common.utils.URLFetcher;
import org.bigbluebutton.lib.common.utils.URLParser;
import org.osflash.signals.ISignal;
import org.osflash.signals.Signal;
import org.osflash.signals.Signal;
public class JoinService {
protected var _successSignal:Signal = new Signal();
@ -102,14 +103,15 @@ package org.bigbluebutton.air.main.services {
onFailure(xml.messageKey);
break;
case XML_RETURN_CODE_SUCCESS:
sessionToken = xml.auth_token.toString();
sessionToken = xml.session_token.toString();
if (xml.hasOwnProperty("guestStatus")) {
var guestStatus:String = xml.guestStatus.toString();
var waitUrl:String = xml.url.toString();
trace("******************** GUEST STATUS = " + guestStatus + " waitUrl=" + waitUrl);
trace("******************** responseUrl = " + responseUrl);
trace("******************** urlRequest = " + urlRequest);
guestWaitSignal.dispatch(waitUrl, urlRequest, responseUrl, sessionToken);
//trace("******************** responseUrl = " + responseUrl);
trace("******************** sessionToken = " + sessionToken);
var waitUrlTrim:String = getServerUrl(waitUrl);
guestWaitSignal.dispatch(waitUrlTrim, urlRequest, responseUrl, sessionToken);
} else {
successSignal.dispatch(urlRequest, responseUrl, sessionToken);
}
@ -142,6 +144,12 @@ package org.bigbluebutton.air.main.services {
}
}
protected function getServerUrl(url:String):String {
var pattern:RegExp = /(?P<protocol>.+):\/\/(?P<server>.+)\/client\/guest-wait.html(?P<app>.+)/;
var result:Array = pattern.exec(url);
return result.protocol + "://" + result.server + "/bigbluebutton/api/guestWait";
}
protected function onFailure(reason:String):void {
failureSignal.dispatch(reason);
}

View File

@ -40,7 +40,7 @@ package org.bigbluebutton.air.main.views {
// If we are in the Flash Builder debugger the InvokeEvent will never be fired
if (Capabilities.isDebugger) {
//var url:String = "bigbluebutton://test-install.blindsidenetworks.com/bigbluebutton/api/join?fullName=AIR&meetingID=Demo+Meeting&password=mp&redirect=false&checksum=3fdf56e9915c1031c3ea012b4ec8823cedd7c272";
var reqUrl:String = "192.168.246.131/bigbluebutton/api/join?auth=true&fullName=Guest&guest=true&meetingID=guest-wait-mobile&password=ap&redirect=false&checksum=017c3ef7064276381f7a3bf3d7203df4ae6151d2";
var reqUrl:String = "ritz-ss.blindside-dev.com/bigbluebutton/api/join?auth=true&bannerColor=%23FFFF00&bannerText=FOOOOBAAARR&fullName=Viewer&guest=true&meetingID=guest-access&password=ap&redirect=false&checksum=03338ebd8094dc29f851c6591aceaedbeaaf21fc";
var url:String = "bigbluebutton://" + reqUrl;
joinRoom(url);
}

View File

@ -69,7 +69,7 @@ package org.bigbluebutton.lib.common.utils
private function httpResponseStatusHandler(e:HTTPStatusEvent):void {
_responseURL = e.responseURL;
trace("Redirected to " + _responseURL);
trace("httpResponseStatusHandler Redirected to " + _responseURL);
}
private function httpStatusHandler(e:HTTPStatusEvent):void {
@ -77,6 +77,7 @@ package org.bigbluebutton.lib.common.utils
}
private function handleComplete(e:Event):void {
trace("httpResponseStatusHandler Redirected to " + _responseURL);
successSignal.dispatch(e.target.data, _responseURL, _urlRequest);
}

View File

@ -2,6 +2,7 @@ package org.bigbluebutton.lib.main.services
{
import flash.events.TimerEvent;
import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.utils.Timer;
import org.bigbluebutton.lib.common.utils.GuestWaitURLFetcher;
@ -28,6 +29,7 @@ package org.bigbluebutton.lib.main.services
private static const TOKEN_QUERY_PARAM:String = "sessionToken=";
protected var _urlRequest:URLRequest = null;
protected var _guestWaitUrl: String = null;
protected var _guestAccessAllowedSignal:Signal = new Signal();
protected var _guestAccessDeniedSignal:Signal = new Signal();
@ -57,10 +59,13 @@ package org.bigbluebutton.lib.main.services
//TODO: show message to user saying that the meeting identifier is invalid
}
public function wait(urlRequest:URLRequest, url:String, sessionToken:String):void {
public function wait(guestWaitUrl: String, urlRequest:URLRequest, url:String, sessionToken:String):void {
_urlRequest = urlRequest;
this.sessionToken = sessionToken;
_guestWaitUrl = guestWaitUrl;
fetch();
}
private function fetch():void {
@ -68,7 +73,11 @@ package org.bigbluebutton.lib.main.services
fetcher.successSignal.add(onSuccess);
fetcher.failureSignal.add(onFailure);
fetcher.fetch(guestWaitUrl, null, null);
var reqVars:URLVariables = new URLVariables();
reqVars.sessionToken = sessionToken;
reqVars.redirect = "false";
fetcher.fetch(_guestWaitUrl, null, reqVars);
}
private function queueFetch():void {
@ -78,18 +87,20 @@ package org.bigbluebutton.lib.main.services
}
public function connectionTimeout (e:TimerEvent) : void {
trace("Timedout connecting to " + guestWaitUrl);
trace("Timedout connecting to " + _guestWaitUrl);
fetch();
}
protected function onSuccess(data:Object, responseUrl:String, urlRequest:URLRequest, httpStatusCode:Number = 200):void {
trace(JSON.stringify(data));
if (httpStatusCode == 200) {
var result:Object = JSON.parse(data as String);
if (result.guestStatus == "WAIT") {
var guestStatus: String = result.response.guestStatus;
if (guestStatus == "WAIT") {
queueFetch();
} else if(result.guestStatus == "ALLOW") {
// signal allowed
} else if (result.guestStatus == "DENIED") {
} else if(guestStatus == "ALLOW") {
guestAccessAllowedSignal.dispatch(urlRequest, responseUrl, sessionToken);
} else if (guestStatus == "DENIED") {
// signal denied
}
} else {

View File

@ -10,8 +10,8 @@ package org.bigbluebutton.lib.main.services
function get guestAccessDeniedSignal():ISignal;
function get loginFailureSignal():ISignal;
function get failureSignal():ISignal;
function wait(urlRequest:URLRequest, url:String, sessionToken:String):void;
function wait(guestWaitUrl: String, urlRequest:URLRequest, url:String, sessionToken:String):void;
}
}