From e981a874c303b71da995c38dd9312ed31a5f174a Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Mon, 26 Feb 2018 10:51:02 -0800 Subject: [PATCH] - query for guest wait status --- .../web/controllers/ApiController.groovy | 12 ++++++--- .../main/commands/JoinMeetingCommandAIR.as | 7 ++++- .../air/main/services/JoinService.as | 18 +++++++++---- .../air/main/views/LoadingScreenMediator.as | 2 +- .../lib/common/utils/GuestWaitURLFetcher.as | 3 ++- .../lib/main/services/GuestWaitPageService.as | 27 +++++++++++++------ .../main/services/IGuestWaitPageService.as | 4 +-- 7 files changed, 51 insertions(+), 22 deletions(-) diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index d7af7e259e..669ace6ad1 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -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; } diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/main/commands/JoinMeetingCommandAIR.as b/clients/flash/air-client/src/org/bigbluebutton/air/main/commands/JoinMeetingCommandAIR.as index b8e6a234cb..23cadf73dc 100755 --- a/clients/flash/air-client/src/org/bigbluebutton/air/main/commands/JoinMeetingCommandAIR.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/main/commands/JoinMeetingCommandAIR.as @@ -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 { diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/main/services/JoinService.as b/clients/flash/air-client/src/org/bigbluebutton/air/main/services/JoinService.as index 00e53e3739..3b70be8d3f 100755 --- a/clients/flash/air-client/src/org/bigbluebutton/air/main/services/JoinService.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/main/services/JoinService.as @@ -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.+):\/\/(?P.+)\/client\/guest-wait.html(?P.+)/; + var result:Array = pattern.exec(url); + return result.protocol + "://" + result.server + "/bigbluebutton/api/guestWait"; + } + protected function onFailure(reason:String):void { failureSignal.dispatch(reason); } diff --git a/clients/flash/air-client/src/org/bigbluebutton/air/main/views/LoadingScreenMediator.as b/clients/flash/air-client/src/org/bigbluebutton/air/main/views/LoadingScreenMediator.as index bfea0f3a27..f5e98e319a 100755 --- a/clients/flash/air-client/src/org/bigbluebutton/air/main/views/LoadingScreenMediator.as +++ b/clients/flash/air-client/src/org/bigbluebutton/air/main/views/LoadingScreenMediator.as @@ -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); } diff --git a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/common/utils/GuestWaitURLFetcher.as b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/common/utils/GuestWaitURLFetcher.as index a28634abd1..d503364911 100755 --- a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/common/utils/GuestWaitURLFetcher.as +++ b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/common/utils/GuestWaitURLFetcher.as @@ -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); } diff --git a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/GuestWaitPageService.as b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/GuestWaitPageService.as index 7714f8f769..ad560ae04d 100755 --- a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/GuestWaitPageService.as +++ b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/GuestWaitPageService.as @@ -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 { diff --git a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/IGuestWaitPageService.as b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/IGuestWaitPageService.as index 5136175561..bfeb76d2ba 100755 --- a/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/IGuestWaitPageService.as +++ b/clients/flash/common-library/src/main/actionscript/org/bigbluebutton/lib/main/services/IGuestWaitPageService.as @@ -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; } } \ No newline at end of file