Updated RequestBreakoutJoinURL to return two join urls, the first with redirection enable and the second without redirection.

This commit is contained in:
Ghazi Triki 2016-11-21 18:01:22 +01:00
parent e644576063
commit 59a0f4665d
15 changed files with 70 additions and 67 deletions

View File

@ -107,7 +107,7 @@ class JsonMessageSenderActor(val service: MessageSender)
def handleBreakoutRoomJoinURL(msg: BreakoutRoomJoinURLOutMessage) {
val payload = new BreakoutRoomJoinURLPayload(msg.parentMeetingId,
msg.breakoutMeetingId, msg.userId, msg.joinURL)
msg.breakoutMeetingId, msg.userId, msg.redirectJoinURL, msg.noRedirectJoinURL)
val request = new BreakoutRoomJoinURL(payload)
service.send(MessagingConstants.FROM_MEETING_CHANNEL, request.toJson)
}

View File

@ -25,9 +25,9 @@ object UserMessagesProtocol extends DefaultJsonProtocol {
}
implicit val breakoutRoomInPayloadFormat = jsonFormat3(BreakoutRoomInPayload)
implicit val createBreakoutRoomsFormat = jsonFormat5(CreateBreakoutRooms)
implicit val createBreakoutRoomsFormat = jsonFormat4(CreateBreakoutRooms)
implicit val breakoutRoomsListMessageFormat = jsonFormat1(BreakoutRoomsListMessage)
implicit val requestBreakoutJoinURLInMessageFormat = jsonFormat4(RequestBreakoutJoinURLInMessage)
implicit val requestBreakoutJoinURLInMessageFormat = jsonFormat3(RequestBreakoutJoinURLInMessage)
implicit val transferUserToMeetingRequestFormat = jsonFormat3(TransferUserToMeetingRequest)
implicit val endBreakoutRoomsFormat = jsonFormat1(EndAllBreakoutRooms)
implicit val inMsgHeaderFormat = jsonFormat1(InMessageHeader)

View File

@ -42,10 +42,10 @@ case class LockSetting(meetingID: String, locked: Boolean, settings: Map[String,
// Sent by user to request the breakout rooms list of a room
case class BreakoutRoomsListMessage(meetingId: String) extends InMessage
// Sent by user to request creation of breakout rooms
case class CreateBreakoutRooms(meetingId: String, durationInMinutes: Int, record: Boolean, redirectOnJoin: Boolean, rooms: Vector[BreakoutRoomInPayload]) extends InMessage
case class CreateBreakoutRooms(meetingId: String, durationInMinutes: Int, record: Boolean, rooms: Vector[BreakoutRoomInPayload]) extends InMessage
case class BreakoutRoomInPayload(name: String, sequence: Int, users: Vector[String])
// Sent by user to request for a join URL in order to be able to join a breakout room
case class RequestBreakoutJoinURLInMessage(meetingId: String, breakoutMeetingId: String, userId: String, redirect: Boolean) extends InMessage
case class RequestBreakoutJoinURLInMessage(meetingId: String, breakoutMeetingId: String, userId: String) extends InMessage
// Sent by breakout actor to tell meeting actor that breakout room has been created.
case class BreakoutRoomCreated(meetingId: String, breakoutRoomId: String) extends InMessage
// Sent by breakout actor to tell meeting actor the list of users in the breakout room.

View File

@ -34,7 +34,7 @@ case class EndBreakoutRoom(breakoutMeetingId: String) extends IOutMessage
case class BreakoutRoomOutPayload(breakoutMeetingId: String, name: String, parentId: String, sequence: Integer,
voiceConfId: String, durationInMinutes: Int, moderatorPassword: String, viewerPassword: String,
sourcePresentationId: String, sourcePresentationSlide: Int, record: Boolean)
case class BreakoutRoomJoinURLOutMessage(parentMeetingId: String, recorded: Boolean, breakoutMeetingId: String, userId: String, joinURL: String) extends IOutMessage
case class BreakoutRoomJoinURLOutMessage(parentMeetingId: String, recorded: Boolean, breakoutMeetingId: String, userId: String, redirectJoinURL: String, noRedirectJoinURL: String) extends IOutMessage
case class BreakoutRoomStartedOutMessage(parentMeetingId: String, recorded: Boolean, breakout: BreakoutRoomBody) extends IOutMessage
case class BreakoutRoomBody(name: String, externalMeetingId: String, meetingId: String, sequence: Int)
case class UpdateBreakoutUsersOutMessage(parentMeetingId: String, recorded: Boolean, breakoutMeetingId: String, users: Vector[BreakoutUser]) extends IOutMessage

View File

@ -1,18 +1,17 @@
package org.bigbluebutton.core.apps
import org.bigbluebutton.core.api._
import scala.collection.mutable.ArrayBuffer
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.SystemConfiguration
import org.apache.commons.codec.digest.DigestUtils
import scala.collection._
import scala.collection.SortedSet
import org.apache.commons.lang3.StringUtils
import java.net.URLEncoder
import scala.collection.immutable.StringOps
import scala.collection.SortedSet
import scala.collection.mutable
import org.apache.commons.codec.digest.DigestUtils
import org.bigbluebutton.SystemConfiguration
import org.bigbluebutton.core.LiveMeeting
import org.bigbluebutton.core.bus.IncomingEventBus
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api._
import org.bigbluebutton.core.bus.BigBlueButtonEvent
import org.bigbluebutton.core.bus.IncomingEventBus
trait BreakoutRoomApp extends SystemConfiguration {
this: LiveMeeting =>
@ -44,7 +43,6 @@ trait BreakoutRoomApp extends SystemConfiguration {
val sourcePresentationId = if (!presModel.getCurrentPresentation().isEmpty) presModel.getCurrentPresentation().get.id else "blank"
val sourcePresentationSlide = if (!presModel.getCurrentPage().isEmpty) presModel.getCurrentPage().get.num else 0
breakoutModel.pendingRoomsNumber = msg.rooms.length;
breakoutModel.redirectOnJoin = msg.redirectOnJoin;
for (room <- msg.rooms) {
i += 1
@ -61,20 +59,25 @@ trait BreakoutRoomApp extends SystemConfiguration {
meetingModel.breakoutRoomsStartedOn = timeNowInSeconds;
}
def sendJoinURL(userId: String, externalMeetingId: String, redirect: Boolean) {
log.debug("Sending breakout meeting {} Join URL for user: {}", externalMeetingId, userId);
def sendJoinURL(userId: String, externalMeetingId: String, roomSequence: String) {
log.debug("Sending breakout meeting {} Join URL for user: {}", externalMeetingId, userId)
for {
user <- usersModel.getUser(userId)
apiCall = "join"
params = BreakoutRoomsUtil.joinParams(user.name, userId, true, externalMeetingId, mProps.moderatorPass, redirect)
baseString = BreakoutRoomsUtil.createBaseString(params)
checksum = BreakoutRoomsUtil.calculateChecksum(apiCall, baseString, bbbWebSharedSecret)
joinURL = BreakoutRoomsUtil.createJoinURL(bbbWebAPI, apiCall, baseString, checksum)
} yield outGW.send(new BreakoutRoomJoinURLOutMessage(mProps.meetingID, mProps.recorded, externalMeetingId, userId, joinURL))
params = BreakoutRoomsUtil.joinParams(user.name, userId + "-" + roomSequence, true, externalMeetingId, mProps.moderatorPass)
// We generate a first url with redirect -> true
redirectBaseString = BreakoutRoomsUtil.createBaseString(params._1)
redirectJoinURL = BreakoutRoomsUtil.createJoinURL(bbbWebAPI, apiCall, redirectBaseString, BreakoutRoomsUtil.calculateChecksum(apiCall, redirectBaseString, bbbWebSharedSecret))
// We generate a second url with redirect -> false
noRedirectBaseString = BreakoutRoomsUtil.createBaseString(params._2)
noRedirectJoinURL = BreakoutRoomsUtil.createJoinURL(bbbWebAPI, apiCall, noRedirectBaseString, BreakoutRoomsUtil.calculateChecksum(apiCall, noRedirectBaseString, bbbWebSharedSecret))
} yield outGW.send(new BreakoutRoomJoinURLOutMessage(mProps.meetingID, mProps.recorded, externalMeetingId, userId, redirectJoinURL, noRedirectJoinURL))
}
def handleRequestBreakoutJoinURL(msg: RequestBreakoutJoinURLInMessage) {
sendJoinURL(msg.userId, msg.breakoutMeetingId, msg.redirect)
for {
breakoutRoom <- breakoutModel.getRoomWithExternalId(msg.breakoutMeetingId)
} yield sendJoinURL(msg.userId, msg.breakoutMeetingId, breakoutRoom.sequence.toString())
}
def handleBreakoutRoomCreated(msg: BreakoutRoomCreated) {
@ -91,7 +94,7 @@ trait BreakoutRoomApp extends SystemConfiguration {
breakoutModel.getAssignedUsers(room.id) foreach { users =>
users.foreach { u =>
log.debug("Sending Join URL for users");
sendJoinURL(u, room.externalMeetingId, breakoutModel.redirectOnJoin)
sendJoinURL(u, room.externalMeetingId, room.sequence.toString())
}
}
}
@ -187,16 +190,15 @@ object BreakoutRoomsUtil {
}
def joinParams(username: String, userId: String, isBreakout: Boolean, breakoutMeetingId: String,
password: String, redirect: Boolean): mutable.Map[String, String] = {
val params = new collection.mutable.HashMap[String, String]
params += "fullName" -> urlEncode(username)
params += "userID" -> urlEncode(userId + "-" + breakoutMeetingId.substring(breakoutMeetingId.lastIndexOf("-") + 1));
params += "isBreakout" -> urlEncode(isBreakout.toString())
params += "meetingID" -> urlEncode(breakoutMeetingId)
params += "password" -> urlEncode(password)
params += "redirect" -> urlEncode(redirect.toString())
password: String): (mutable.Map[String, String], mutable.Map[String, String]) = {
val params = collection.mutable.HashMap(
"fullName" -> urlEncode(username),
"userID" -> urlEncode(userId),
"isBreakout" -> urlEncode(isBreakout.toString()),
"meetingID" -> urlEncode(breakoutMeetingId),
"password" -> urlEncode(password))
params
(params += "redirect" -> urlEncode("true"), mutable.Map[String, String]() ++= params += "redirect" -> urlEncode("false"))
}
def sortParams(params: mutable.Map[String, String]): SortedSet[String] = {

View File

@ -10,7 +10,6 @@ class BreakoutRoomModel {
private var rooms = new collection.immutable.HashMap[String, BreakoutRoom]
var pendingRoomsNumber: Integer = 0
var redirectOnJoin: Boolean = false
def add(room: BreakoutRoom): BreakoutRoom = {
rooms += room.id -> room
@ -31,6 +30,10 @@ class BreakoutRoomModel {
rooms.get(id)
}
def getRoomWithExternalId(externalId: String): Option[BreakoutRoom] = {
rooms.values find (r => r.externalMeetingId == externalId)
}
def getRooms(): Array[BreakoutRoom] = {
rooms.values.toArray
}

View File

@ -171,7 +171,8 @@ object MeetingMessageToJsonConverter {
payload.put("parentMeetingId", msg.parentMeetingId)
payload.put("breakoutMeetingId", msg.breakoutMeetingId)
payload.put("userId", msg.userId)
payload.put("joinURL", msg.joinURL)
payload.put("redirectJoinURL", msg.redirectJoinURL)
payload.put("noRedirectJoinURL", msg.noRedirectJoinURL)
val header = Util.buildHeader(BreakoutRoomJoinURL.NAME, None)
Util.buildJson(header, payload)

View File

@ -23,12 +23,16 @@ public class BreakoutRoomJoinURLPayload {
public final String parentMeetingId;
public final String breakoutMeetingId;
public final String userId;
public final String joinURL;
public final String redirectJoinURL;
public final String noRedirectJoinURL;
public BreakoutRoomJoinURLPayload(String parentMeetingId, String breakoutMeetingId, String userId, String joinURL) {
public BreakoutRoomJoinURLPayload(String parentMeetingId,
String breakoutMeetingId, String userId, String redirectJoinURL,
String noRedirectJoinURL) {
this.parentMeetingId = parentMeetingId;
this.breakoutMeetingId = breakoutMeetingId;
this.userId = userId;
this.joinURL = joinURL;
this.redirectJoinURL = redirectJoinURL;
this.noRedirectJoinURL = noRedirectJoinURL;
}
}

View File

@ -11,16 +11,13 @@ public class CreateBreakoutRoomsRequestPayload {
public final Integer durationInMinutes;
// Breakout rooms recording option
public final Boolean record;
// Creates join URL with redirect value true or false
public final Boolean redirectOnJoin;
public CreateBreakoutRoomsRequestPayload(String meetingId,
ArrayList<BreakoutRoomRequestPayload> breakoutRooms,
Integer duration, Boolean record, Boolean redirectOnJoin) {
Integer duration, Boolean record) {
this.meetingId = meetingId;
this.rooms = breakoutRooms;
this.durationInMinutes = duration;
this.record = record;
this.redirectOnJoin = redirectOnJoin;
}
}

View File

@ -5,13 +5,11 @@ public class RequestBreakoutJoinURLPayload {
public final String meetingId;
public final String breakoutMeetingId;
public final String userId;
public final Boolean redirect;
public RequestBreakoutJoinURLPayload(String meetingId,
String breakoutMeetingId, String userId, Boolean redirect) {
String breakoutMeetingId, String userId) {
this.meetingId = meetingId;
this.breakoutMeetingId = breakoutMeetingId;
this.userId = userId;
this.redirect = redirect;
}
}

View File

@ -1,6 +1,7 @@
package org.bigbluebutton.messages;
import java.util.ArrayList;
import org.bigbluebutton.messages.payload.BreakoutRoomRequestPayload;
import org.bigbluebutton.messages.payload.CreateBreakoutRoomsRequestPayload;
import org.junit.Assert;
@ -15,7 +16,6 @@ public class CreateBreakoutRoomsRequestTest {
String meetingId = "abc123";
Integer durationInMinutes = 20;
Boolean record = true;
Boolean redirectOnJoin = false;
ArrayList<String> room1Users = new ArrayList<String>();
room1Users.add("Tidora"); room1Users.add("Nidora"); room1Users.add("Tinidora");
@ -32,7 +32,7 @@ public class CreateBreakoutRoomsRequestTest {
ArrayList<BreakoutRoomRequestPayload> rooms = new ArrayList<BreakoutRoomRequestPayload>();
rooms.add(room1); rooms.add(room2); rooms.add(room3);
CreateBreakoutRoomsRequestPayload payload = new CreateBreakoutRoomsRequestPayload(meetingId, rooms, durationInMinutes, record, redirectOnJoin);
CreateBreakoutRoomsRequestPayload payload = new CreateBreakoutRoomsRequestPayload(meetingId, rooms, durationInMinutes, record);
CreateBreakoutRoomsRequest msg = new CreateBreakoutRoomsRequest(payload);
Gson gson = new Gson();
String json = gson.toJson(msg);

View File

@ -545,7 +545,8 @@ public class UserClientMessageSender {
args.put("parentMeetingId", msg.payload.parentMeetingId);
args.put("breakoutMeetingId", msg.payload.breakoutMeetingId);
args.put("userId", msg.payload.userId);
args.put("joinURL", msg.payload.joinURL);
args.put("redirectJoinURL", msg.payload.redirectJoinURL);
args.put("noRedirectJoinURL", msg.payload.noRedirectJoinURL);
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();

View File

@ -199,11 +199,11 @@ package org.bigbluebutton.main.model.users
}
public function createBreakoutRooms(e:BreakoutRoomEvent):void{
sender.createBreakoutRooms(_conferenceParameters.meetingID, e.rooms, e.durationInMinutes, e.record, true);
sender.createBreakoutRooms(_conferenceParameters.meetingID, e.rooms, e.durationInMinutes, e.record);
}
public function requestBreakoutJoinUrl(e:BreakoutRoomEvent):void{
sender.requestBreakoutJoinUrl(_conferenceParameters.meetingID, e.breakoutMeetingId, e.userId, true);
sender.requestBreakoutJoinUrl(_conferenceParameters.meetingID, e.breakoutMeetingId, e.userId);
}
public function listenInOnBreakout(e:BreakoutRoomEvent):void {

View File

@ -639,7 +639,7 @@ package org.bigbluebutton.modules.users.services
private function handleBreakoutRoomJoinURL(msg:Object):void{
var map:Object = JSON.parse(msg.msg);
var event : BreakoutRoomEvent = new BreakoutRoomEvent(BreakoutRoomEvent.BREAKOUT_JOIN_URL);
event.joinURL = map.joinURL;
event.joinURL = map.redirectJoinURL;
var externalMeetingId : String = StringUtils.substringBetween(event.joinURL, "meetingID=", "&");
event.breakoutMeetingSequence = UserManager.getInstance().getConference().getBreakoutRoomByExternalId(externalMeetingId).sequence;
dispatcher.dispatchEvent(event);

View File

@ -23,7 +23,6 @@ package org.bigbluebutton.modules.users.services
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.managers.ConnectionManager;
import org.bigbluebutton.main.api.JSLog;
public class MessageSender {
private static const LOGGER:ILogger = getClassLogger(MessageSender);
@ -102,13 +101,12 @@ package org.bigbluebutton.modules.users.services
);
}
public function createBreakoutRooms(meetingId:String, rooms:Array, durationInMinutes:int, record:Boolean, redirectOnJoin:Boolean):void {
public function createBreakoutRooms(meetingId:String, rooms:Array, durationInMinutes:int, record:Boolean):void {
var message:Object = new Object();
message["meetingId"] = meetingId;
message["rooms"] = rooms;
message["durationInMinutes"] = durationInMinutes;
message["record"] = record;
message["redirectOnJoin"] = redirectOnJoin;
var jsonMsg:String = JSON.stringify(message);
var _nc:ConnectionManager = BBB.initConnectionManager();
@ -126,12 +124,11 @@ package org.bigbluebutton.modules.users.services
);
}
public function requestBreakoutJoinUrl(parentMeetingId:String, breakoutMeetingId:String, userId:String, redirect:Boolean):void {
public function requestBreakoutJoinUrl(parentMeetingId:String, breakoutMeetingId:String, userId:String):void {
var message:Object = new Object();
message["meetingId"] = parentMeetingId;
message["breakoutMeetingId"] = breakoutMeetingId;
message["userId"] = userId;
message["redirect"] = redirect;
var jsonMsg:String = JSON.stringify(message);