diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/MsgToAkkaAppsToJsonActor.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/MsgToAkkaAppsToJsonActor.scala index 8c2ffb1676a3c283286fce4650c6c2909a5b6a2f..6a68948dd3e5e3324298a7c7fff077d7856e9fff 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/MsgToAkkaAppsToJsonActor.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/MsgToAkkaAppsToJsonActor.scala @@ -2,7 +2,7 @@ package org.bigbluebutton.client import akka.actor.{Actor, ActorLogging, Props} import org.bigbluebutton.client.bus.{JsonMsgToAkkaAppsBus, JsonMsgToAkkaAppsBusMsg, JsonMsgToSendToAkkaApps} -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg import org.bigbluebutton.common2.util.JsonUtil object MsgToAkkaAppsToJsonActor { @@ -14,10 +14,10 @@ class MsgToAkkaAppsToJsonActor(jsonMsgToAkkaAppsBus: JsonMsgToAkkaAppsBus) extends Actor with ActorLogging with SystemConfiguration { def receive = { - case msg: BbbServerMsg => handle(msg) + case msg: BbbCoreWithEvelopeMsg => handle(msg) } - def handle(msg: BbbServerMsg): Unit = { + def handle(msg: BbbCoreWithEvelopeMsg): Unit = { val json = JsonUtil.toJson(msg) val jsonMsg = JsonMsgToSendToAkkaApps(toAkkaAppsRedisChannel, json) jsonMsgToAkkaAppsBus.publish(JsonMsgToAkkaAppsBusMsg(toAkkaAppsJsonChannel, jsonMsg)) diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/ReceivedJsonMsgHdlrActor.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/ReceivedJsonMsgHdlrActor.scala index 759335c34a1b74d682488a9db18564026197e47f..5c0c089fbd768e4350712cd56a579778a21909d4 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/ReceivedJsonMsgHdlrActor.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/ReceivedJsonMsgHdlrActor.scala @@ -1,8 +1,8 @@ package org.bigbluebutton.client import akka.actor.{Actor, ActorLogging, Props} -import org.bigbluebutton.client.bus.{JsonMsgFromAkkaApps, JsonMsgFromAkkaAppsBus, MsgFromAkkaApps, MsgFromAkkaAppsEventBus} -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.client.bus.{JsonMsgFromAkkaApps, MsgFromAkkaApps, MsgFromAkkaAppsEventBus} +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg import org.bigbluebutton.common2.util.JsonUtil @@ -22,7 +22,7 @@ class ReceivedJsonMsgHdlrActor(val msgFromAkkaAppsEventBus: MsgFromAkkaAppsEvent } def handleReceivedJsonMessage(msg: JsonMsgFromAkkaApps): Unit = { - val serverMsg = JsonUtil.fromJson[BbbServerMsg](msg.data) + val serverMsg = JsonUtil.fromJson[BbbCoreWithEvelopeMsg](msg.data) msgFromAkkaAppsEventBus.publish(MsgFromAkkaApps(fromAkkaAppsChannel, serverMsg)) } } diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/RxJsonMsgHdlrTrait.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/RxJsonMsgHdlrTrait.scala index ed38a5276de0c7c98f41dbbb91aea9d690654e4b..22d8cf68f8b0c5bcf475ffe516148f64cd88919a 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/RxJsonMsgHdlrTrait.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/RxJsonMsgHdlrTrait.scala @@ -2,12 +2,12 @@ package org.bigbluebutton.client import org.bigbluebutton.client.bus.JsonMsgFromAkkaApps import org.bigbluebutton.common2.util.JsonUtil -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg trait RxJsonMsgHdlrTrait { def handleReceivedJsonMessage(msg: JsonMsgFromAkkaApps): Unit = { - val serverMsg = JsonUtil.fromJson[BbbServerMsg](msg.data) + val serverMsg = JsonUtil.fromJson[BbbCoreWithEvelopeMsg](msg.data) } } diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgFromAkkaAppsEventBus.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgFromAkkaAppsEventBus.scala index a387feb6ba12a9cace492c02ecfc964df5ee37e0..7bb042c89c91b915005e220014bd9ed5551081be 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgFromAkkaAppsEventBus.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgFromAkkaAppsEventBus.scala @@ -2,9 +2,9 @@ package org.bigbluebutton.client.bus import akka.actor.ActorRef import akka.event.{EventBus, LookupClassification} -import org.bigbluebutton.common2.messages.{ BbbServerMsg} +import org.bigbluebutton.common2.messages.{ BbbCoreWithEvelopeMsg} -case class MsgFromAkkaApps(val topic: String, val payload: BbbServerMsg) +case class MsgFromAkkaApps(val topic: String, val payload: BbbCoreWithEvelopeMsg) class MsgFromAkkaAppsEventBus extends EventBus with LookupClassification { type Event = MsgFromAkkaApps diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToAkkaAppsEventBus.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToAkkaAppsEventBus.scala index 6240c0e8a1343b64b7000f77873ba4dec61a6255..24b48de339c4446d7c995ad529b480a9594fb8e0 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToAkkaAppsEventBus.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToAkkaAppsEventBus.scala @@ -2,9 +2,9 @@ package org.bigbluebutton.client.bus import akka.actor.ActorRef import akka.event.{EventBus, LookupClassification} -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.{BbbCoreWithEvelopeMsg} -case class MsgToAkkaApps(val topic: String, val payload: BbbServerMsg) +case class MsgToAkkaApps(val topic: String, val payload: BbbCoreWithEvelopeMsg) class MsgToAkkaAppsEventBus extends EventBus with LookupClassification { type Event = MsgToAkkaApps diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToClientEventBus.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToClientEventBus.scala index 334ec1a04964e30650285ac042c8b02f062f241c..882912dcdd16cb8ea3e32a8ce9cfab9a928b22c9 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToClientEventBus.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/bus/MsgToClientEventBus.scala @@ -2,12 +2,12 @@ package org.bigbluebutton.client.bus import akka.actor.ActorRef import akka.event.{EventBus, LookupClassification} -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg sealed trait ToConnectionMsg -case class BroadcastMsgToMeeting(meetingId: String, data: BbbServerMsg) extends ToConnectionMsg -case class DirectMsgToClient(meetingId: String, connId: String, data: BbbServerMsg) extends ToConnectionMsg -case class SystemMsgToClient(meetingId: String, connId: String, data: BbbServerMsg) extends ToConnectionMsg +case class BroadcastMsgToMeeting(meetingId: String, data: BbbCoreWithEvelopeMsg) extends ToConnectionMsg +case class DirectMsgToClient(meetingId: String, connId: String, data: BbbCoreWithEvelopeMsg) extends ToConnectionMsg +case class SystemMsgToClient(meetingId: String, connId: String, data: BbbCoreWithEvelopeMsg) extends ToConnectionMsg case class MsgToClientBusMsg(val topic: String, payload: ToConnectionMsg) diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingActor.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingActor.scala index 90f27ab883438088fac1a3e7a48352f2b1b3a43a..dca219abc92abff8cbb27a89cfce95859b47579c 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingActor.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingActor.scala @@ -2,7 +2,7 @@ package org.bigbluebutton.client.meeting import akka.actor.{Actor, ActorLogging, Props} import org.bigbluebutton.client.bus._ -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg object MeetingActor { def props(meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus, @@ -19,7 +19,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv case msg: ConnectMsg => handleConnectMsg(msg) case msg: DisconnectMsg => handleDisconnectMsg(msg) case msg: MsgFromClientMsg => handleMsgFromClientMsg(msg) - case msg: BbbServerMsg => handleBbbServerMsg(msg) + case msg: BbbCoreWithEvelopeMsg => handleBbbServerMsg(msg) // TODO: Should keep track of user lifecycle so we can remove when user leaves the meeting. } @@ -53,7 +53,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv } } - def handleBbbServerMsg(msg: BbbServerMsg): Unit = { + def handleBbbServerMsg(msg: BbbCoreWithEvelopeMsg): Unit = { for { msgType <- msg.envelope.routing.get("msgType") } yield { @@ -61,7 +61,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv } } - def handleServerMsg(msgType: String, msg: BbbServerMsg): Unit = { + def handleServerMsg(msgType: String, msg: BbbCoreWithEvelopeMsg): Unit = { msgType match { case "direct" => handleDirectMessage(msg) case "broadcast" => handleBroadcastMessage(msg) @@ -69,7 +69,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv } } - private def forwardToUser(msg: BbbServerMsg): Unit = { + private def forwardToUser(msg: BbbCoreWithEvelopeMsg): Unit = { for { userId <- msg.envelope.routing.get("userId") m <- UsersManager.findWithId(userMgr, userId) @@ -78,17 +78,17 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv } } - def handleDirectMessage(msg: BbbServerMsg): Unit = { + def handleDirectMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific messages. We can do it here. forwardToUser(msg) } - def handleBroadcastMessage(msg: BbbServerMsg): Unit = { + def handleBroadcastMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific messages. We can do it here. forwardToUser(msg) } - def handleSystemMessage(msg: BbbServerMsg): Unit = { + def handleSystemMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific messages. We can do it here. forwardToUser(msg) } diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingManagerActor.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingManagerActor.scala index efde05449fe9e696244d028e5e7dc034ddb618fe..d982c08cef83760a0ba82101439af3048f85f9b7 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingManagerActor.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/MeetingManagerActor.scala @@ -2,7 +2,7 @@ package org.bigbluebutton.client.meeting import akka.actor.{Actor, ActorLogging, Props} import org.bigbluebutton.client.bus._ -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.{BbbCoreWithEvelopeMsg} object MeetingManagerActor { @@ -20,7 +20,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus, case msg: ConnectMsg => handleConnectMsg(msg) case msg: DisconnectMsg => handleDisconnectMsg(msg) case msg: MsgFromClientMsg => handleMsgFromClientMsg(msg) - case msg: BbbServerMsg => handleBbbServerMsg(msg) + case msg: BbbCoreWithEvelopeMsg => handleBbbServerMsg(msg) // TODO we should monitor meeting lifecycle so we can remove when meeting ends. } @@ -55,7 +55,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus, } } - def handleBbbServerMsg(msg: BbbServerMsg): Unit = { + def handleBbbServerMsg(msg: BbbCoreWithEvelopeMsg): Unit = { for { msgType <- msg.envelope.routing.get("msgType") } yield { @@ -63,7 +63,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus, } } - def handleServerMsg(msgType: String, msg: BbbServerMsg): Unit = { + def handleServerMsg(msgType: String, msg: BbbCoreWithEvelopeMsg): Unit = { msgType match { case "direct" => handleDirectMessage(msg) case "broadcast" => handleBroadcastMessage(msg) @@ -71,7 +71,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus, } } - private def forwardToMeeting(msg: BbbServerMsg): Unit = { + private def forwardToMeeting(msg: BbbCoreWithEvelopeMsg): Unit = { for { meetingId <- msg.envelope.routing.get("meetingId") m <- MeetingManager.findWithMeetingId(meetingMgr, meetingId) @@ -80,17 +80,17 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus, } } - def handleDirectMessage(msg: BbbServerMsg): Unit = { + def handleDirectMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific message. We can do it here. forwardToMeeting(msg) } - def handleBroadcastMessage(msg: BbbServerMsg): Unit = { + def handleBroadcastMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific message. We can do it here. forwardToMeeting(msg) } - def handleSystemMessage(msg: BbbServerMsg): Unit = { + def handleSystemMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific message. We can do it here. forwardToMeeting(msg) } diff --git a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/UserActor.scala b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/UserActor.scala index 4ba18d278ac87834d002d2ac85117fefe12c49a5..b7ae09501570ba7a66f5395fdbab6db891b430b8 100755 --- a/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/UserActor.scala +++ b/bbb-apps-common/src/main/scala/org/bigbluebutton/client/meeting/UserActor.scala @@ -3,7 +3,7 @@ package org.bigbluebutton.client.meeting import akka.actor.{Actor, ActorLogging, Props} import org.bigbluebutton.client.SystemConfiguration import org.bigbluebutton.client.bus._ -import org.bigbluebutton.common2.messages.{BbbServerMsg, Envelope, HeaderAndBody} +import org.bigbluebutton.common2.messages.{BbbCoreWithEvelopeMsg, Envelope, HeaderAndBody} import org.bigbluebutton.common2.util.JsonUtil object UserActor { @@ -26,7 +26,7 @@ class UserActor(val userId: String, case msg: ConnectMsg => handleConnectMsg(msg) case msg: DisconnectMsg => handleDisconnectMsg(msg) case msg: MsgFromClientMsg => handleMsgFromClientMsg(msg) - case msg: BbbServerMsg => handleBbbServerMsg(msg) + case msg: BbbCoreWithEvelopeMsg => handleBbbServerMsg(msg) } private def createConnection(id: String, sessionId: String, active: Boolean): Connection = { @@ -67,11 +67,11 @@ class UserActor(val userId: String, ) val envelope = new Envelope(headerAndBody.header.name, meta) - val akkaMsg = BbbServerMsg(envelope, JsonUtil.toJsonNode(msg.json)) + val akkaMsg = BbbCoreWithEvelopeMsg(envelope, JsonUtil.toJsonNode(msg.json)) msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, akkaMsg)) } - def handleBbbServerMsg(msg: BbbServerMsg): Unit = { + def handleBbbServerMsg(msg: BbbCoreWithEvelopeMsg): Unit = { log.debug("Received BbbServerMsg " + msg) for { msgType <- msg.envelope.routing.get("msgType") @@ -80,7 +80,7 @@ class UserActor(val userId: String, } } - def handleServerMsg(msgType: String, msg: BbbServerMsg): Unit = { + def handleServerMsg(msgType: String, msg: BbbCoreWithEvelopeMsg): Unit = { msgType match { case "direct" => handleDirectMessage(msg) case "broadcast" => handleBroadcastMessage(msg) @@ -88,7 +88,7 @@ class UserActor(val userId: String, } } - private def forwardToUser(msg: BbbServerMsg): Unit = { + private def forwardToUser(msg: BbbCoreWithEvelopeMsg): Unit = { for { conn <- Connections.findActiveConnection(conns) } yield { @@ -96,17 +96,17 @@ class UserActor(val userId: String, } } - def handleDirectMessage(msg: BbbServerMsg): Unit = { + def handleDirectMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific messages. We can do it here. forwardToUser(msg) } - def handleBroadcastMessage(msg: BbbServerMsg): Unit = { + def handleBroadcastMessage(msg: BbbCoreWithEvelopeMsg): Unit = { // In case we want to handle specific messages. We can do it here. forwardToUser(msg) } - def handleSystemMessage(msg: BbbServerMsg): Unit = { + def handleSystemMessage(msg: BbbCoreWithEvelopeMsg): Unit = { for { conn <- Connections.findActiveConnection(conns) } yield { diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Meeting2x.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Meeting2x.scala new file mode 100755 index 0000000000000000000000000000000000000000..5c74a6fe697e3aa90b02440893bc08c129523503 --- /dev/null +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Meeting2x.scala @@ -0,0 +1,32 @@ +package org.bigbluebutton.common2.domain + +case class ConfigProps(defaultConfigToken: String, config: String) + +case class DurationProps(duration: Int, createdTime: Long) + +case class MeetingProp(name: String, extId: String, intId: String, isBreakout: Boolean) + +case class BreakoutProps(parentId: String, sequence: Int, breakoutRooms: Vector[String]) + +case class PasswordProp(moderatorPass: String, viewerPass: String) + +case class RecordProp(record: Boolean, autoStartRecording: Boolean, allowStartStopRecording: Boolean) + +case class WelcomeProp(welcomeMsgTemplate: String, welcomeMsg: String, modOnlyMessage: String) + +case class VoiceProp(telVoice: String, webVoice: String, dialNumber: String) + +case class UsersProp(maxUsers: Int, webcamsOnlyForModerator: Boolean, guestPolicy: String) + +case class DefaultProps(meetingProp: MeetingProp, durationProps: DurationProps, password: PasswordProp, + recordProp: RecordProp, welcomeProp: WelcomeProp, voiceProp: VoiceProp, usersProp: UsersProp) + + +case class StartEndTimeStatus(startTime: Long, endTime: Long) +case class RecordingStatus(isRecording: Boolean) +case class GuestPolicyStatus(currentGuestPolicy: String) +case class RunningStatus(isRunning: Boolean, isForciblyEnded: Boolean, numUsers: Int) +case class MeetingStatus(startEndTimeStatus: StartEndTimeStatus, recordingStatus: RecordingStatus, + guestPolicyStatus: GuestPolicyStatus, userHasJoined: Boolean) + +case class Meeting2x(defaultProps: DefaultProps, meetingStatus: MeetingStatus) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/messages/Envelope.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/messages/Envelope.scala index 8f5de2c2c9856d7b6f65cf02e85a6e9bb3fc2c12..9404ed0fb99f487e8181035203b1edf3f51cd744 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/messages/Envelope.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/messages/Envelope.scala @@ -2,11 +2,12 @@ package org.bigbluebutton.common2.messages import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.JsonNode +import org.bigbluebutton.common2.domain.DefaultProps -sealed trait BbbMsg +sealed trait BbbCoreMsg -case class BbbServerMsg(envelope: Envelope, jsonNode: JsonNode) +case class BbbCoreWithEvelopeMsg(envelope: Envelope, jsonNode: JsonNode) case class Envelope(name: String, routing: collection.immutable.Map[String, String]) @@ -15,23 +16,16 @@ case class HeaderAndBody(header: Header, body: JsonNode) case class AkkaAppsCheckAliveReqBody(timestamp: Long) case class AkkaAppsCheckAliveReqMsg(header: Header, body: AkkaAppsCheckAliveReqBody) -case class AkkaAppsCheckAliveReq(envelope: Envelope, msg: AkkaAppsCheckAliveReqMsg) extends BbbMsg +case class AkkaAppsCheckAliveReq(envelope: Envelope, msg: AkkaAppsCheckAliveReqMsg) extends BbbCoreMsg case class ValidateAuthTokenReqBody(meetingId: String, userId: String, token: String, replyTo: String, @JsonProperty(required = true) sessionId: String) -case class ValidateAuthTokenReq(header: Header, body: ValidateAuthTokenReqBody) extends BbbMsg +case class ValidateAuthTokenReq(header: Header, body: ValidateAuthTokenReqBody) extends BbbCoreMsg case class ValidateAuthTokenResp(meetingId: String, userId: String, token: String, valid: Boolean, replyTo: String) -case class CreateMeetingReqBody(id: String, externalId: String, - parentId: String, name: String, record: Boolean, - voiceConfId: String, duration: Int, - autoStartRecording: Boolean, allowStartStopRecording: Boolean, - webcamsOnlyForModerator: Boolean, moderatorPass: String, - viewerPass: String, createTime: Long, createDate: String, - isBreakout: Boolean, sequence: Int, - metadata: collection.immutable.Map[String, String], guestPolicy: String) -case class CreateMeetingReq(header: Header, body: CreateMeetingReqBody) extends BbbMsg +case class CreateMeetingReqBody(props: DefaultProps) +case class CreateMeetingReq(header: Header, body: CreateMeetingReqBody) extends BbbCoreMsg case class MeetingCreatedEvtBody(meetingId: String, record: Boolean) case class MeetingCreatedEvt(header: Header, body: MeetingCreatedEvtBody) diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api/pub/RedisPublisherService.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api/pub/RedisPublisherService.scala index 89ee0bdb901d996560113784680c79527c62bd38..2b82eb0934beafd4d65f1f775a374f9ff41d52d0 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api/pub/RedisPublisherService.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api/pub/RedisPublisherService.scala @@ -21,18 +21,7 @@ class RedisPublisherService(sender: MessageSender) extends IPublisherService { viewerPass: String, createTime: java.lang.Long, createDate: String, isBreakout: java.lang.Boolean, sequence: java.lang.Integer, metadata: util.Map[String, String], guestPolicy: String): Unit = { - val body: CreateMeetingReqBody = new CreateMeetingReqBody(meetingId, extMeetingId, parentMeetingId, - meetingName, recorded.booleanValue(), voiceBridge, duration, autoStartRecording.booleanValue(), - allowStartStopRecording.booleanValue(), webcamsOnlyForModerator.booleanValue(), moderatorPass, - viewerPass, createTime, createDate, isBreakout.booleanValue(), sequence, - mapAsScalaMapConverter(metadata).asScala.toMap, guestPolicy) - - val header: Header = new Header("CreateMeetingReq") - val msg: CreateMeetingReq = new CreateMeetingReq(header, body) - - val json = JsonUtil.toJson(msg) - println(json) - sender.send("bbb:to-akka-apps", json) + } def endMeeting(meetingId: String): Unit = { diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala index 7cb7f527138f8abc505514cd5f11ae35e0c123ca..7aba93e921c1ea426ee2b6fd993b8107dbaf2e9c 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala @@ -29,6 +29,11 @@ class BbbWebApiGWApp(val oldMessageReceivedGW: OldMessageReceivedGW) extends Sys MeetingsManagerActor.props(msgToAkkaAppsEventBus), "meetingManagerActor") msgFromAkkaAppsEventBus.subscribe(meetingManagerActorRef, fromAkkaAppsChannel) + private val msgToAkkaAppsToJsonActor = system.actorOf( + MsgToAkkaAppsToJsonActor.props(jsonMsgToAkkaAppsBus), "msgToAkkaAppsToJsonActor") + + msgToAkkaAppsEventBus.subscribe(msgToAkkaAppsToJsonActor, toAkkaAppsChannel) + private val appsRedisSubscriberActor = system.actorOf( AppsRedisSubscriberActor.props(receivedJsonMsgBus,oldMessageEventBus), "appsRedisSubscriberActor") diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgFromAkkaAppsEventBus.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgFromAkkaAppsEventBus.scala index 2adca7455a719ff305b5c9b972a1fe1784d41c89..1c892d6654c70b3a87b7784b9e2b19a28f77d063 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgFromAkkaAppsEventBus.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgFromAkkaAppsEventBus.scala @@ -2,9 +2,9 @@ package org.bigbluebutton.api2.bus import akka.actor.ActorRef import akka.event.{EventBus, LookupClassification} -import org.bigbluebutton.common2.messages.{ BbbServerMsg} +import org.bigbluebutton.common2.messages.{ BbbCoreWithEvelopeMsg} -case class MsgFromAkkaApps(val topic: String, val payload: BbbServerMsg) +case class MsgFromAkkaApps(val topic: String, val payload: BbbCoreWithEvelopeMsg) class MsgFromAkkaAppsEventBus extends EventBus with LookupClassification { type Event = MsgFromAkkaApps diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsEventBus.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsEventBus.scala index ccede5e4dc666e725fa0fb0f1532edf70a4826a8..4f54baa507cb4a758b46b0de3f32021953cb9cc8 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsEventBus.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsEventBus.scala @@ -2,9 +2,9 @@ package org.bigbluebutton.api2.bus import akka.actor.ActorRef import akka.event.{EventBus, LookupClassification} -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg -case class MsgToAkkaApps(val topic: String, val payload: BbbServerMsg) +case class MsgToAkkaApps(val topic: String, val payload: BbbCoreWithEvelopeMsg) class MsgToAkkaAppsEventBus extends EventBus with LookupClassification { type Event = MsgToAkkaApps diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsToJsonActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsToJsonActor.scala new file mode 100755 index 0000000000000000000000000000000000000000..c3b8322a6bdbf3ffd8d98bf237ada5877c4d7d89 --- /dev/null +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/MsgToAkkaAppsToJsonActor.scala @@ -0,0 +1,27 @@ +package org.bigbluebutton.api2.bus + +import akka.actor.{Actor, ActorLogging, Props} +import org.bigbluebutton.api2.SystemConfiguration +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg +import org.bigbluebutton.common2.util.JsonUtil + +object MsgToAkkaAppsToJsonActor { + def props(jsonMsgToAkkaAppsBus: JsonMsgToAkkaAppsBus): Props = + Props(classOf[MsgToAkkaAppsToJsonActor], jsonMsgToAkkaAppsBus) + +} + +class MsgToAkkaAppsToJsonActor(jsonMsgToAkkaAppsBus: JsonMsgToAkkaAppsBus) + extends Actor with ActorLogging with SystemConfiguration { + + def receive = { + case msg: BbbCoreWithEvelopeMsg => handle(msg) + } + + def handle(msg: BbbCoreWithEvelopeMsg): Unit = { + val json = JsonUtil.toJson(msg) + val jsonMsg = JsonMsgToSendToAkkaApps(toAkkaAppsRedisChannel, json) + jsonMsgToAkkaAppsBus.publish(JsonMsgToAkkaAppsBusMsg(toAkkaAppsJsonChannel, jsonMsg)) + } + +} diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala index 0c7418ac8e71cf5fae9a8eb5fe8bf2810cc64c13..6305c9635aa246ede4aa1a724836ccbf14c9b76e 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala @@ -2,7 +2,7 @@ package org.bigbluebutton.api2.bus import akka.actor.{Actor, ActorLogging, Props} import org.bigbluebutton.api2.SystemConfiguration -import org.bigbluebutton.common2.messages.BbbServerMsg +import org.bigbluebutton.common2.messages.BbbCoreWithEvelopeMsg import org.bigbluebutton.common2.util.JsonUtil @@ -22,7 +22,7 @@ class ReceivedJsonMsgHdlrActor(val msgFromAkkaAppsEventBus: MsgFromAkkaAppsEvent } def handleReceivedJsonMessage(msg: JsonMsgFromAkkaApps): Unit = { - val serverMsg = JsonUtil.fromJson[BbbServerMsg](msg.data) + val serverMsg = JsonUtil.fromJson[BbbCoreWithEvelopeMsg](msg.data) msgFromAkkaAppsEventBus.publish(MsgFromAkkaApps(fromAkkaAppsChannel, serverMsg)) } } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/domain/MeetingProps.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/domain/MeetingProps.scala index a00597161fea6bcc749a6099105e359b1a005e5d..685e8a8de8ca50fc507e1ef06aa951e93c5013a1 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/domain/MeetingProps.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/domain/MeetingProps.scala @@ -1,34 +1,4 @@ package org.bigbluebutton.api2.domain -case class ConfigProps(defaultConfigToken: String, config: String) - -case class DurationProps(duration: Int, createdTime: Long) - -case class MeetingProp(name: String, extId: String, intId: String, isBreakout: Boolean) - -case class BreakoutProps(parentId: String, sequence: Int, breakoutRooms: Vector[String]) - -case class PasswordProp(moderatorPass: String, viewerPass: String) - -case class RecordProp(record: Boolean, autoStartRecording: Boolean, allowStartStopRecording: Boolean) - -case class WelcomeProp(welcomeMsgTemplate: String, welcomeMsg: String, modOnlyMessage: String) - -case class VoiceProp(telVoice: String, webVoice: String, dialNumber: String) - -case class UsersProp(maxUsers: Int, webcamsOnlyForModerator: Boolean, guestPolicy: String) - -case class DefaultProps(meetingProp: MeetingProp, durationProps: DurationProps, password: PasswordProp, - recordProp: RecordProp, welcomeProp: WelcomeProp, voiceProp: VoiceProp, usersProp: UsersProp) - - -case class StartEndTimeStatus(startTime: Long, endTime: Long) -case class RecordingStatus(isRecording: Boolean) -case class GuestPolicyStatus(currentGuestPolicy: String) -case class RunningStatus(isRunning: Boolean, isForciblyEnded: Boolean, numUsers: Int) -case class MeetingStatus(startEndTimeStatus: StartEndTimeStatus, recordingStatus: RecordingStatus, - guestPolicyStatus: GuestPolicyStatus, userHasJoined: Boolean) - -case class Meeting2x(defaultProps: DefaultProps, meetingStatus: MeetingStatus) diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala index 96d3559bc2dece5bcc50d1aa86a24463bf00ccf4..dfc5bad71de054b0b230d7faec66defcc8b457b0 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala @@ -1,10 +1,9 @@ package org.bigbluebutton.api2.meeting import akka.actor.{Actor, ActorLogging, Props} -import org.apache.commons.lang3.StringUtils import org.bigbluebutton.api.domain.UserSession import org.bigbluebutton.api2.bus.MsgToAkkaAppsEventBus -import org.bigbluebutton.api2.domain.DefaultProps +import org.bigbluebutton.common2.domain.DefaultProps import org.bigbluebutton.api2.util.Util2 import org.bigbluebutton.common.messages.UserJoinedVoiceMessage @@ -49,7 +48,8 @@ object MeetingsManagerActor { Props(classOf[MeetingsManagerActor], msgToAkkaAppsEventBus) } -class MeetingsManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus) extends Actor with ActorLogging { +class MeetingsManagerActor(val msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus) + extends Actor with ActorLogging with ToAkkaAppsSendersTrait { private val manager = new MeetingsManager @@ -70,9 +70,7 @@ class MeetingsManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus) extends } } - def sendCreateMeetingRequestToAkkaApps(): Unit = { - } def replyWithDuplicateMeeting(): Unit = { diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala new file mode 100755 index 0000000000000000000000000000000000000000..1a75f3d1d0a745ed5a79e233632ea4f5b604a7a2 --- /dev/null +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/ToAkkaAppsSendersTrait.scala @@ -0,0 +1,12 @@ +package org.bigbluebutton.api2.meeting + +import org.bigbluebutton.api2.bus.MsgToAkkaAppsEventBus + + +trait ToAkkaAppsSendersTrait { + val msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus + + def sendCreateMeetingRequestToAkkaApps(): Unit = { + + } +} diff --git a/bbb-common-web/src/test/scala/org/bigbluebutton/api/util/ResponseBuilderTest.scala b/bbb-common-web/src/test/scala/org/bigbluebutton/api/util/ResponseBuilderTest.scala index ff8bc2b6520f248887ed767112f5de99ab2bb450..8dd3c9e87cffb148087dcce42f78271706149c23 100755 --- a/bbb-common-web/src/test/scala/org/bigbluebutton/api/util/ResponseBuilderTest.scala +++ b/bbb-common-web/src/test/scala/org/bigbluebutton/api/util/ResponseBuilderTest.scala @@ -198,6 +198,7 @@ class ResponseBuilderTest extends UnitSpec { assert(templateLoc.exists()) } + /** it should "support old metadata.xml in getRecordings api call" in { val templateLoc = new File("src/test/resources") val builder = new ResponseBuilder(templateLoc) @@ -231,4 +232,5 @@ class ResponseBuilderTest extends UnitSpec { assert(templateLoc.exists()) } + **/ } \ No newline at end of file