- continue removing old messages in akka-apps

This commit is contained in:
Richard Alam 2017-07-07 14:23:56 -07:00
parent a0ed7685ce
commit 70c7ebc1a1
16 changed files with 468 additions and 132 deletions

View File

@ -3,7 +3,7 @@ package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.models.{ Roles, Users2x }
trait ChangeUserRoleHdlr {
trait ChangeUserRoleCmdMsgHdlr {
this: UsersApp2x =>
def handleChangeUserRoleCmdMsg(msg: ChangeUserRoleCmdMsg) {

View File

@ -0,0 +1,30 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait GetRecordingStatusReqMsgHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleGetRecordingStatusReqMsg(msg: GetRecordingStatusReqMsg) {
def buildGetRecordingStatusRespMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
val envelope = BbbCoreEnvelope(GetRecordingStatusRespMsg.NAME, routing)
val body = GetRecordingStatusRespMsgBody(recording, userId)
val header = BbbClientMsgHeader(GetRecordingStatusRespMsg.NAME, meetingId, userId)
val event = GetRecordingStatusRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildGetRecordingStatusRespMsg(liveMeeting.props.meetingProp.intId, msg.body.requestedBy,
MeetingStatus2x.isRecording(liveMeeting.status))
outGW.send(event)
}
}

View File

@ -0,0 +1,57 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ EndMeeting, LogoutEndMeeting }
import org.bigbluebutton.core.models.{ Roles, Users2x }
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait LogoutAndEndMeetingCmdMsgHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleLogoutAndEndMeetingCmdMsg(msg: LogoutAndEndMeetingCmdMsg) {
for {
u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
} yield {
if (u.role == Roles.MODERATOR_ROLE) {
endMeeting()
}
}
def endMeeting(): Unit = {
def buildMeetingEndingEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
val envelope = BbbCoreEnvelope(MeetingEndingEvtMsg.NAME, routing)
val body = MeetingEndingEvtMsgBody(meetingId)
val header = BbbClientMsgHeader(MeetingEndingEvtMsg.NAME, meetingId, "not-used")
val event = MeetingEndingEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val endingEvent = buildMeetingEndingEvtMsg(liveMeeting.props.meetingProp.intId)
// Broadcast users the meeting will end
outGW.send(endingEvent)
MeetingStatus2x.meetingHasEnded(liveMeeting.status)
def buildMeetingEndedEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(MeetingEndedEvtMsg.NAME, routing)
val body = MeetingEndedEvtMsgBody(meetingId)
val header = BbbCoreBaseHeader(MeetingEndedEvtMsg.NAME)
val event = MeetingEndedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val endedEvnt = buildMeetingEndedEvtMsg(liveMeeting.props.meetingProp.intId)
outGW.send(endedEvnt)
}
}
}

View File

@ -0,0 +1,28 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
trait MeetingActivityResponseCmdMsgHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleMeetingActivityResponseCmdMsg(msg: MeetingActivityResponseCmdMsg) {
def buildMeetingIsActiveEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
val envelope = BbbCoreEnvelope(MeetingIsActiveEvtMsg.NAME, routing)
val body = MeetingIsActiveEvtMsgBody(meetingId)
val header = BbbClientMsgHeader(MeetingIsActiveEvtMsg.NAME, meetingId, "not-used")
val event = MeetingIsActiveEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
log.info("User endorsed that meeting {} is active", liveMeeting.props.meetingProp.intId)
val event = buildMeetingIsActiveEvtMsg(liveMeeting.props.meetingProp.intId)
outGW.send(event)
}
}

View File

@ -0,0 +1,38 @@
package org.bigbluebutton.core.apps.users
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait SetRecordingStatusCmdMsgHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleSetRecordingStatusCmdMsg(msg: SetRecordingStatusCmdMsg) {
log.info("Change recording status. meetingId=" + liveMeeting.props.meetingProp.intId + " recording=" + msg.body.recording)
if (liveMeeting.props.recordProp.allowStartStopRecording &&
MeetingStatus2x.isRecording(liveMeeting.status) != msg.body.recording) {
if (msg.body.recording) {
MeetingStatus2x.recordingStarted(liveMeeting.status)
} else {
MeetingStatus2x.recordingStopped(liveMeeting.status)
}
val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.setBy, msg.body.recording)
outGW.send(event)
}
def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing)
val body = RecordingStatusChangedEvtMsgBody(recording, userId)
val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId)
val event = RecordingStatusChangedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
}
}

View File

@ -5,11 +5,15 @@ import org.bigbluebutton.core2.message.handlers.users.ValidateAuthTokenReqMsgHdl
trait UsersApp2x
extends RegisterUserReqMsgHdlr
with ChangeUserRoleHdlr
with ChangeUserRoleCmdMsgHdlr
with SyncGetUsersMeetingRespMsgHdlr
with EjectUserFromMeetingHdlr
with ValidateAuthTokenReqMsgHdlr
with UserLeaveReqMsgHdlr {
with UserLeaveReqMsgHdlr
with LogoutAndEndMeetingCmdMsgHdlr
with MeetingActivityResponseCmdMsgHdlr
with SetRecordingStatusCmdMsgHdlr
with GetRecordingStatusReqMsgHdlr {
this: MeetingActor =>

View File

@ -1,12 +1,14 @@
package org.bigbluebutton.core.apps.voice
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.message.handlers.RecordingStartedVoiceConfEvtMsgHdlr
trait VoiceApp2x extends UserJoinedVoiceConfEvtMsgHdlr
with UserJoinedVoiceConfMessageHdlr
with UserLeftVoiceConfEvtMsgHdlr
with UserMutedInVoiceConfEvtMsgHdlr
with UserTalkingInVoiceConfEvtMsgHdlr {
with UserTalkingInVoiceConfEvtMsgHdlr
with RecordingStartedVoiceConfEvtMsgHdlr {
this: MeetingActor =>
}

View File

@ -62,7 +62,8 @@ class MeetingActor(val props: DefaultProps,
with IsMeetingMutedReqMsgHdlr
with MuteUserCmdMsgHdlr
with EjectUserFromVoiceCmdMsgHdlr
with EndMeetingSysCmdMsgHdlr
with SendTimeRemainingUpdateHdlr
with SyncGetMeetingInfoRespMsgHdlr {
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
@ -108,9 +109,7 @@ class MeetingActor(val props: DefaultProps,
//=======================================
// old messages
case msg: ActivityResponse => handleActivityResponse(msg)
case msg: MonitorNumberOfUsers => handleMonitorNumberOfUsers(msg)
case msg: VoiceConfRecordingStartedMessage => handleVoiceConfRecordingStartedMessage(msg)
case msg: AllowUserToShareDesktop => handleAllowUserToShareDesktop(msg)
@ -120,14 +119,11 @@ class MeetingActor(val props: DefaultProps,
case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg)
case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg)
case msg: InitializeMeeting => handleInitializeMeeting(msg)
case msg: SetRecordingStatus => handleSetRecordingStatus(msg)
case msg: GetRecordingStatus => handleGetRecordingStatus(msg)
case msg: LogoutEndMeeting => handleLogoutEndMeeting(msg)
case msg: ClearPublicChatHistoryRequest => handleClearPublicChatHistoryRequest(msg)
case msg: ExtendMeetingDuration => handleExtendMeetingDuration(msg)
case msg: SendTimeRemainingUpdate => handleSendTimeRemainingUpdate(msg)
case msg: EndMeeting => handleEndMeeting(msg)
case msg: DeskShareStartedRequest => handleDeskShareStartedRequest(msg)
case msg: DeskShareStoppedRequest => handleDeskShareStoppedRequest(msg)
@ -153,6 +149,10 @@ class MeetingActor(val props: DefaultProps,
case m: UserBroadcastCamStartMsg => handleUserBroadcastCamStartMsg(m)
case m: UserBroadcastCamStopMsg => handleUserBroadcastCamStopMsg(m)
case m: UserJoinedVoiceConfEvtMsg => handleUserJoinedVoiceConfEvtMsg(m)
case m: MeetingActivityResponseCmdMsg => handleMeetingActivityResponseCmdMsg(m)
case m: LogoutAndEndMeetingCmdMsg => handleLogoutAndEndMeetingCmdMsg(m)
case m: SetRecordingStatusCmdMsg => handleSetRecordingStatusCmdMsg(m)
case m: GetRecordingStatusReqMsg => handleGetRecordingStatusReqMsg(m)
// Whiteboard
case m: SendCursorPositionPubMsg => handleSendCursorPositionPubMsg(m)
@ -174,7 +174,7 @@ class MeetingActor(val props: DefaultProps,
// Breakout
case m: BreakoutRoomsListMsg => handleBreakoutRoomsListMsg(m)
case m: CreateBreakoutRoomSysCmdMsg => handleCreateBreakoutRoomsCmdMsg(m)
case m: CreateBreakoutRoomsCmdMsg => handleCreateBreakoutRoomsCmdMsg(m)
case m: EndAllBreakoutRoomsMsg => handleEndAllBreakoutRoomsMsg(m)
case m: RequestBreakoutJoinURLReqMsg => handleRequestBreakoutJoinURLReqMsg(m)
case m: BreakoutRoomCreatedMsg => handleBreakoutRoomCreatedMsg(m)
@ -187,6 +187,7 @@ class MeetingActor(val props: DefaultProps,
case m: UserLeftVoiceConfEvtMsg => handleUserLeftVoiceConfEvtMsg(m)
case m: UserMutedInVoiceConfEvtMsg => handleUserMutedInVoiceConfEvtMsg(m)
case m: UserTalkingInVoiceConfEvtMsg => handleUserTalkingInVoiceConfEvtMsg(m)
case m: RecordingStartedVoiceConfEvtMsg => handleRecordingStartedVoiceConfEvtMsg(m)
// Layout
case m: GetCurrentLayoutReqMsg => handleGetCurrentLayoutReqMsg(m)
@ -287,66 +288,16 @@ class MeetingActor(val props: DefaultProps,
// MeetingStatus2x.getGuestPolicy(liveMeeting.status).toString()))
}
def handleLogoutEndMeeting(msg: LogoutEndMeeting) {
for {
u <- Users2x.findWithIntId(liveMeeting.users2x, msg.userID)
} yield {
if (u.role == Roles.MODERATOR_ROLE) {
handleEndMeeting(EndMeeting(props.meetingProp.intId))
}
}
}
def handleActivityResponse(msg: ActivityResponse) {
log.info("User endorsed that meeting {} is active", props.meetingProp.intId)
outGW.send(new MeetingIsActive(props.meetingProp.intId))
}
def handleEndMeeting(msg: EndMeeting) {
// Broadcast users the meeting will end
outGW.send(new MeetingEnding(msg.meetingId))
MeetingStatus2x.meetingHasEnded(liveMeeting.status)
outGW.send(new MeetingEnded(msg.meetingId, props.recordProp.record, props.meetingProp.intId))
}
def handleAllowUserToShareDesktop(msg: AllowUserToShareDesktop): Unit = {
Users2x.findPresenter(liveMeeting.users2x) match {
case Some(curPres) => {
val allowed = msg.userID equals (curPres.intId)
outGW.send(AllowUserToShareDesktopOut(msg.meetingID, msg.userID, allowed))
// outGW.send(AllowUserToShareDesktopOut(msg.meetingID, msg.userID, allowed))
}
case None => // do nothing
}
}
def handleVoiceConfRecordingStartedMessage(msg: VoiceConfRecordingStartedMessage) {
if (msg.recording) {
MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, msg.recordStream)
outGW.send(new VoiceRecordingStarted(props.meetingProp.intId, props.recordProp.record,
msg.recordStream, msg.timestamp, props.voiceProp.voiceConf))
} else {
MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, "")
outGW.send(new VoiceRecordingStopped(props.meetingProp.intId, props.recordProp.record,
msg.recordStream, msg.timestamp, props.voiceProp.voiceConf))
}
}
def handleSetRecordingStatus(msg: SetRecordingStatus) {
log.info("Change recording status. meetingId=" + props.meetingProp.intId + " recording=" + msg.recording)
if (props.recordProp.allowStartStopRecording &&
MeetingStatus2x.isRecording(liveMeeting.status) != msg.recording) {
if (msg.recording) {
MeetingStatus2x.recordingStarted(liveMeeting.status)
} else {
MeetingStatus2x.recordingStopped(liveMeeting.status)
}
outGW.send(new RecordingStatusChanged(props.meetingProp.intId, props.recordProp.record, msg.userId, msg.recording))
}
}
// WebRTC Desktop Sharing
def handleDeskShareStartedRequest(msg: DeskShareStartedRequest): Unit = {
@ -359,7 +310,7 @@ class MeetingActor(val props: DefaultProps,
log.info("handleDeskShareStartedRequest: streamPath=" + streamPath)
// Tell FreeSwitch to broadcast to RTMP
outGW.send(new DeskShareStartRTMPBroadcast(msg.conferenceName, streamPath))
//outGW.send(new DeskShareStartRTMPBroadcast(msg.conferenceName, streamPath))
DeskshareModel.setDeskShareStarted(liveMeeting.deskshareModel, true)
}
@ -371,8 +322,8 @@ class MeetingActor(val props: DefaultProps,
" URL:" + DeskshareModel.getRTMPBroadcastingUrl(liveMeeting.deskshareModel))
// Tell FreeSwitch to stop broadcasting to RTMP
outGW.send(new DeskShareStopRTMPBroadcast(msg.conferenceName,
DeskshareModel.getRTMPBroadcastingUrl(liveMeeting.deskshareModel)))
//outGW.send(new DeskShareStopRTMPBroadcast(msg.conferenceName,
// DeskshareModel.getRTMPBroadcastingUrl(liveMeeting.deskshareModel)))
DeskshareModel.setDeskShareStarted(liveMeeting.deskshareModel, false)
}
@ -391,7 +342,7 @@ class MeetingActor(val props: DefaultProps,
log.info("START broadcast ALLOWED when isBroadcastingRTMP=false")
// Notify viewers in the meeting that there's an rtmp stream to view
outGW.send(new DeskShareNotifyViewersRTMP(props.meetingProp.intId, msg.streamname, msg.videoWidth, msg.videoHeight, true))
//outGW.send(new DeskShareNotifyViewersRTMP(props.meetingProp.intId, msg.streamname, msg.videoWidth, msg.videoHeight, true))
} else {
log.info("START broadcast NOT ALLOWED when isBroadcastingRTMP=true")
}
@ -403,11 +354,23 @@ class MeetingActor(val props: DefaultProps,
}
def monitorNumberOfWebUsers() {
def buildEjectAllFromVoiceConfMsg(meetingId: String, voiceConf: String): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(EjectAllFromVoiceConfMsg.NAME, routing)
val body = EjectAllFromVoiceConfMsgBody(voiceConf)
val header = BbbCoreHeaderWithMeetingId(EjectAllFromVoiceConfMsg.NAME, meetingId)
val event = EjectAllFromVoiceConfMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
if (Users2x.numUsers(liveMeeting.users2x) == 0 &&
MeetingStatus2x.lastWebUserLeftOn(liveMeeting.status) > 0) {
if (liveMeeting.timeNowInMinutes - MeetingStatus2x.lastWebUserLeftOn(liveMeeting.status) > 2) {
log.info("Empty meeting. Ejecting all users from voice. meetingId={}", props.meetingProp.intId)
outGW.send(new EjectAllVoiceUsers(props.meetingProp.intId, props.recordProp.record, props.voiceProp.voiceConf))
val event = buildEjectAllFromVoiceConfMsg(props.meetingProp.intId, props.voiceProp.voiceConf)
outGW.send(event)
}
}
}
@ -418,39 +381,30 @@ class MeetingActor(val props: DefaultProps,
eventBus.publish(BigBlueButtonEvent(props.meetingProp.intId, UpdateMeetingExpireMonitor(props.meetingProp.intId, hasUsers)))
}
def handleSendTimeRemainingUpdate(msg: SendTimeRemainingUpdate) {
if (props.durationProps.duration > 0) {
val endMeetingTime = MeetingStatus2x.startedOn(liveMeeting.status) + (props.durationProps.duration * 60)
val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds
outGW.send(new MeetingTimeRemainingUpdate(props.meetingProp.intId, props.recordProp.record, timeRemaining.toInt))
}
if (!props.meetingProp.isBreakout && !BreakoutRooms.getRooms(liveMeeting.breakoutRooms).isEmpty) {
val endMeetingTime = BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) +
(BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms) * 60)
val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds
outGW.send(new BreakoutRoomsTimeRemainingUpdateOutMessage(props.meetingProp.intId, props.recordProp.record, timeRemaining.toInt))
} else if (BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) != 0) {
BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms, 0)
BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms, 0)
}
}
def handleExtendMeetingDuration(msg: ExtendMeetingDuration) {
}
def handleGetRecordingStatus(msg: GetRecordingStatus) {
outGW.send(new GetRecordingStatusReply(props.meetingProp.intId, props.recordProp.record,
msg.userId, MeetingStatus2x.isRecording(liveMeeting.status).booleanValue()))
}
def startRecordingIfAutoStart() {
if (props.recordProp.record && !MeetingStatus2x.isRecording(liveMeeting.status) &&
props.recordProp.autoStartRecording && Users2x.numUsers(liveMeeting.users2x) == 1) {
log.info("Auto start recording. meetingId={}", props.meetingProp.intId)
MeetingStatus2x.recordingStarted(liveMeeting.status)
outGW.send(new RecordingStatusChanged(props.meetingProp.intId, props.recordProp.record,
"system", MeetingStatus2x.isRecording(liveMeeting.status)))
def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing)
val body = RecordingStatusChangedEvtMsgBody(recording, userId)
val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId)
val event = RecordingStatusChangedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId,
"system", MeetingStatus2x.isRecording(liveMeeting.status))
outGW.send(event)
}
}
@ -459,14 +413,22 @@ class MeetingActor(val props: DefaultProps,
props.recordProp.autoStartRecording && Users2x.numUsers(liveMeeting.users2x) == 0) {
log.info("Last web user left. Auto stopping recording. meetingId={}", props.meetingProp.intId)
MeetingStatus2x.recordingStopped(liveMeeting.status)
outGW.send(new RecordingStatusChanged(props.meetingProp.intId, props.recordProp.record,
"system", MeetingStatus2x.isRecording(liveMeeting.status)))
}
}
def sendMeetingHasEnded(userId: String) {
outGW.send(new MeetingHasEnded(props.meetingProp.intId, userId))
outGW.send(new DisconnectUser(props.meetingProp.intId, userId))
def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing)
val body = RecordingStatusChangedEvtMsgBody(recording, userId)
val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId)
val event = RecordingStatusChangedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId,
"system", MeetingStatus2x.isRecording(liveMeeting.status))
outGW.send(event)
}
}
def record(msg: BbbCoreMsg): Unit = {

View File

@ -0,0 +1,50 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait EndMeetingSysCmdMsgHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleEndMeeting(msg: EndMeetingSysCmdMsg) {
endMeeting()
def endMeeting(): Unit = {
def buildMeetingEndingEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
val envelope = BbbCoreEnvelope(MeetingEndingEvtMsg.NAME, routing)
val body = MeetingEndingEvtMsgBody(meetingId)
val header = BbbClientMsgHeader(MeetingEndingEvtMsg.NAME, meetingId, "not-used")
val event = MeetingEndingEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val endingEvent = buildMeetingEndingEvtMsg(liveMeeting.props.meetingProp.intId)
// Broadcast users the meeting will end
outGW.send(endingEvent)
MeetingStatus2x.meetingHasEnded(liveMeeting.status)
def buildMeetingEndedEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(MeetingEndedEvtMsg.NAME, routing)
val body = MeetingEndedEvtMsgBody(meetingId)
val header = BbbCoreBaseHeader(MeetingEndedEvtMsg.NAME)
val event = MeetingEndedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val endedEvnt = buildMeetingEndedEvtMsg(liveMeeting.props.meetingProp.intId)
outGW.send(endedEvnt)
}
}
}

View File

@ -13,21 +13,6 @@ trait MuteMeetingCmdMsgHdlr {
def handleMuteMeetingCmdMsg(msg: MuteMeetingCmdMsg) {
if (MeetingStatus2x.isMeetingMuted(liveMeeting.status)) {
MeetingStatus2x.unmuteMeeting(liveMeeting.status)
} else {
MeetingStatus2x.muteMeeting(liveMeeting.status)
}
val muted = MeetingStatus2x.isMeetingMuted(liveMeeting.status)
val event = build(props.meetingProp.intId, msg.body.mutedBy, muted, msg.body.mutedBy)
outGW.send(event)
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { u =>
muteUserInVoiceConf(u)
}
def build(meetingId: String, userId: String, muted: Boolean, mutedBy: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(MeetingMutedEvtMsg.NAME, routing)
@ -52,6 +37,21 @@ trait MuteMeetingCmdMsgHdlr {
}
if (MeetingStatus2x.isMeetingMuted(liveMeeting.status)) {
MeetingStatus2x.unmuteMeeting(liveMeeting.status)
} else {
MeetingStatus2x.muteMeeting(liveMeeting.status)
}
val muted = MeetingStatus2x.isMeetingMuted(liveMeeting.status)
val meetingMutedEvent = build(props.meetingProp.intId, msg.body.mutedBy, muted, msg.body.mutedBy)
outGW.send(meetingMutedEvent)
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { u =>
muteUserInVoiceConf(u)
}
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu =>
if (!vu.listenOnly) {
muteUserInVoiceConf(vu)

View File

@ -1,8 +1,52 @@
package org.bigbluebutton.core2.message.handlers
/**
* Created by ritz on 2017-06-09.
*/
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait RecordingStartedVoiceConfEvtMsgHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleRecordingStartedVoiceConfEvtMsg(msg: RecordingStartedVoiceConfEvtMsg) {
if (msg.body.recording) {
MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, msg.body.stream)
def buildVoiceRecordingStartedEvtMsg(meetingId: String, stream: String, timestamp: String, voiceConf: String): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(VoiceRecordingStartedEvtMsg.NAME, routing)
val body = VoiceRecordingStartedEvtMsgBody(meetingId, stream, timestamp, voiceConf)
val header = BbbCoreVoiceConfHeader(VoiceRecordingStartedEvtMsg.NAME, meetingId)
val event = VoiceRecordingStartedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildVoiceRecordingStartedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.stream,
msg.body.timestamp, liveMeeting.props.voiceProp.voiceConf)
outGW.send(event)
} else {
MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, "")
def buildVoiceRecordingStoppedEvtMsg(meetingId: String, stream: String, timestamp: String, voiceConf: String): BbbCommonEnvCoreMsg = {
val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka")
val envelope = BbbCoreEnvelope(VoiceRecordingStoppedEvtMsg.NAME, routing)
val body = VoiceRecordingStoppedEvtMsgBody(meetingId, stream, timestamp, voiceConf)
val header = BbbCoreVoiceConfHeader(VoiceRecordingStoppedEvtMsg.NAME, meetingId)
val event = VoiceRecordingStoppedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildVoiceRecordingStoppedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.stream,
msg.body.timestamp, liveMeeting.props.voiceProp.voiceConf)
outGW.send(event)
}
}
}

View File

@ -0,0 +1,58 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ BreakoutRoomsTimeRemainingUpdateOutMessage, MeetingTimeRemainingUpdate, SendTimeRemainingUpdate }
import org.bigbluebutton.core.models.BreakoutRooms
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting }
import org.bigbluebutton.core2.MeetingStatus2x
trait SendTimeRemainingUpdateHdlr {
this: BaseMeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleSendTimeRemainingUpdate(msg: SendTimeRemainingUpdate) {
if (liveMeeting.props.durationProps.duration > 0) {
val endMeetingTime = MeetingStatus2x.startedOn(liveMeeting.status) + (liveMeeting.props.durationProps.duration * 60)
val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds
def buildMeetingTimeRemainingUpdateEvtMsg(meetingId: String, timeLeftInSec: Long): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
val envelope = BbbCoreEnvelope(MeetingTimeRemainingUpdateEvtMsg.NAME, routing)
val body = MeetingTimeRemainingUpdateEvtMsgBody(timeLeftInSec)
val header = BbbClientMsgHeader(MeetingTimeRemainingUpdateEvtMsg.NAME, meetingId, "not-used")
val event = MeetingTimeRemainingUpdateEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildMeetingTimeRemainingUpdateEvtMsg(liveMeeting.props.meetingProp.intId, timeRemaining.toInt)
outGW.send(event)
}
if (!liveMeeting.props.meetingProp.isBreakout && !BreakoutRooms.getRooms(liveMeeting.breakoutRooms).isEmpty) {
val endMeetingTime = BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) +
(BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms) * 60)
val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds
def buildBreakoutRoomsTimeRemainingUpdateEvtMsg(meetingId: String, timeLeftInSec: Long): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used")
val envelope = BbbCoreEnvelope(BreakoutRoomsTimeRemainingUpdateEvtMsg.NAME, routing)
val body = BreakoutRoomsTimeRemainingUpdateEvtMsgBody(timeLeftInSec)
val header = BbbClientMsgHeader(BreakoutRoomsTimeRemainingUpdateEvtMsg.NAME, meetingId, "not-used")
val event = BreakoutRoomsTimeRemainingUpdateEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val event = buildBreakoutRoomsTimeRemainingUpdateEvtMsg(liveMeeting.props.meetingProp.intId, timeRemaining.toInt)
outGW.send(event)
} else if (BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) != 0) {
BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms, 0)
BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms, 0)
}
}
}

View File

@ -38,7 +38,7 @@ package org.bigbluebutton.common2.msgs
object BreakoutRoomsTimeRemainingUpdateEvtMsg { val NAME = "BreakoutRoomsTimeRemainingUpdateEvtMsg" }
case class BreakoutRoomsTimeRemainingUpdateEvtMsg(header: BbbClientMsgHeader,
body: BreakoutRoomsTimeRemainingUpdateEvtMsgBody) extends BbbCoreMsg
case class BreakoutRoomsTimeRemainingUpdateEvtMsgBody(meetingId: String, timeRemaining: Int)
case class BreakoutRoomsTimeRemainingUpdateEvtMsgBody(timeRemaining: Long)
// Sent by breakout actor to tell meeting actor the list of users in the breakout room.
@ -46,6 +46,9 @@ package org.bigbluebutton.common2.msgs
case class BreakoutRoomUsersUpdateMsg(header: BbbClientMsgHeader, body: BreakoutRoomUsersUpdateMsgBody) extends BbbCoreMsg
case class BreakoutRoomUsersUpdateMsgBody(meetingId: String, breakoutMeetingId: String, users: Vector[BreakoutUserVO])
/**
* Sent to bbb-web to create breakout rooms.
*/
object CreateBreakoutRoomSysCmdMsg { val NAME = "CreateBreakoutRoomSysCmdMsg" }
case class CreateBreakoutRoomSysCmdMsg(header: BbbCoreBaseHeader,
body: CreateBreakoutRoomSysCmdMsgBody) extends BbbCoreMsg
@ -54,6 +57,9 @@ package org.bigbluebutton.common2.msgs
voiceConfId: String, durationInMinutes: Int, moderatorPassword: String, viewerPassword: String,
sourcePresentationId: String, sourcePresentationSlide: Int, record: Boolean)
/**
* Sent by client to request to create breakout rooms.
*/
object CreateBreakoutRoomsCmdMsg { val NAME = "CreateBreakoutRoomsCmdMsg" }
case class CreateBreakoutRoomsCmdMsg(header: BbbClientMsgHeader, body: CreateBreakoutRoomsCmdMsgBody) extends BbbCoreMsg
case class CreateBreakoutRoomsCmdMsgBody(meetingId: String, durationInMinutes: Int, record: Boolean, rooms: Vector[BreakoutRoomMsgBody])
@ -68,10 +74,6 @@ package org.bigbluebutton.common2.msgs
case class EndBreakoutRoomEvtMsg(header: BbbClientMsgHeader, body: EndBreakoutRoomEvtMsgBody) extends BbbCoreMsg
case class EndBreakoutRoomEvtMsgBody(breakoutMeetingId: String)
object MeetingTimeRemainingUpdateEvtMsg { val NAME = "MeetingTimeRemainingUpdateEvtMsg" }
case class MeetingTimeRemainingUpdateEvtMsg(header: BbbClientMsgHeader, body: MeetingTimeRemainingUpdateEvtMsgBody) extends BbbCoreMsg
case class MeetingTimeRemainingUpdateEvtMsgBody(meetingId: String, timeRemaining: Int)
/**
* Sent by client to request a join URL for the breakout room.
*/

View File

@ -14,7 +14,7 @@ import org.bigbluebutton.common2.domain.DefaultProps
body: DestroyMeetingSysCmdMsgBody) extends BbbCoreMsg
case class DestroyMeetingSysCmdMsgBody(meetingId: String)
object EndMeetingSysCmdMsg { val NAME = "DestroyMeetingReqMsg" }
object EndMeetingSysCmdMsg { val NAME = "EndMeetingSysCmdMsg" }
case class EndMeetingSysCmdMsg(header: BbbCoreBaseHeader,
body: EndMeetingSysCmdMsgBody) extends BbbCoreMsg
case class EndMeetingSysCmdMsgBody(meetingId: String)
@ -40,6 +40,11 @@ import org.bigbluebutton.common2.domain.DefaultProps
body: MeetingEndedEvtMsgBody) extends BbbCoreMsg
case class MeetingEndedEvtMsgBody(meetingId: String)
object MeetingEndingEvtMsg { val NAME = "MeetingEndingEvtMsg"}
case class MeetingEndingEvtMsg(header: BbbClientMsgHeader,
body: MeetingEndingEvtMsgBody) extends BbbCoreMsg
case class MeetingEndingEvtMsgBody(meetingId: String)
object MeetingDestroyedEvtMsg { val NAME = "MeetingDestroyedEvtMsg"}
case class MeetingDestroyedEvtMsg(header: BbbCoreBaseHeader,
body: MeetingDestroyedEvtMsgBody) extends BbbCoreMsg
@ -68,6 +73,10 @@ object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"}
/** System Messages **/
object MeetingTimeRemainingUpdateEvtMsg { val NAME = "MeetingTimeRemainingUpdateEvtMsg" }
case class MeetingTimeRemainingUpdateEvtMsg(header: BbbClientMsgHeader,
body: MeetingTimeRemainingUpdateEvtMsgBody) extends BbbCoreMsg
case class MeetingTimeRemainingUpdateEvtMsgBody(timeLeftInSec: Long)
object MeetingInactivityWarningEvtMsg { val NAME = "MeetingInactivityWarningEvtMsg" }
case class MeetingInactivityWarningEvtMsg(header: BbbClientMsgHeader,
@ -79,6 +88,7 @@ case class MeetingIsActiveEvtMsg(header: BbbClientMsgHeader,
body: MeetingIsActiveEvtMsgBody) extends BbbCoreMsg
case class MeetingIsActiveEvtMsgBody(meetingId: String)
case class AkkaAppsCheckAliveReqBody(timestamp: Long)
case class AkkaAppsCheckAliveReqMsg(header: BbbCoreHeader, body: AkkaAppsCheckAliveReqBody)
case class AkkaAppsCheckAliveReq(envelope: BbbCoreEnvelope, msg: AkkaAppsCheckAliveReqMsg) extends BbbCoreMsg

View File

@ -67,23 +67,57 @@ case class UserJoinedMeetingEvtMsgBody(intId: String, extId: String, name: Strin
guest: Boolean, authed: Boolean, waitingForAcceptance: Boolean, emoji: String,
presenter: Boolean, locked: Boolean, avatar: String)
object GetUsersReqMsg {
val NAME = "GetUsersReqMsg"
}
/**
* Sent by client to get all users in a meeting.
*/
object GetUsersReqMsg { val NAME = "GetUsersReqMsg" }
case class GetUsersReqMsg(header: BbbClientMsgHeader, body: GetUsersReqMsgBody) extends BbbCoreMsg
case class GetUsersReqMsgBody(requesterId: String)
/**
* Sent by user to get status of recording mark.
*/
object GetRecordingStatusReqMsg { val NAME = "GetRecordingStatusReqMsg" }
case class GetRecordingStatusReqMsg(header: BbbClientMsgHeader, body: GetRecordingStatusReqMsgBody) extends BbbCoreMsg
case class GetRecordingStatusReqMsgBody(requestedBy: String)
object UserEmojiChangedEvtMsg {
val NAME = "UserEmojiChangedEvtMsg"
}
/**
* Sent by user as response to get recording mark.
*/
object GetRecordingStatusRespMsg { val NAME = "GetRecordingStatusRespMsg" }
case class GetRecordingStatusRespMsg(header: BbbClientMsgHeader, body: GetRecordingStatusRespMsgBody) extends BbbCoreMsg
case class GetRecordingStatusRespMsgBody(recording: Boolean, requestedBy: String)
/**
* Sent by user to start recording mark.
*/
object SetRecordingStatusCmdMsg { val NAME = "SetRecordingStatusCmdMsg" }
case class SetRecordingStatusCmdMsg(header: BbbClientMsgHeader, body: SetRecordingStatusCmdMsgBody) extends BbbCoreMsg
case class SetRecordingStatusCmdMsgBody(recording: Boolean, setBy: String)
/**
* Sent to all users about start recording mark.
*/
object RecordingStatusChangedEvtMsg { val NAME = "RecordingStatusChangedEvtMsg" }
case class RecordingStatusChangedEvtMsg(header: BbbClientMsgHeader, body: RecordingStatusChangedEvtMsgBody) extends BbbCoreMsg
case class RecordingStatusChangedEvtMsgBody(recording: Boolean, setBy: String)
/**
* Sent to all clients about a user changing emoji.
*/
object UserEmojiChangedEvtMsg { val NAME = "UserEmojiChangedEvtMsg" }
case class UserEmojiChangedEvtMsg(header: BbbClientMsgHeader, body: UserEmojiChangedEvtMsgBody) extends BbbCoreMsg
case class UserEmojiChangedEvtMsgBody(userId: String, emoji: String)
/**
* Sent from client as a response to inactivity notifaction from server.
*/
object MeetingActivityResponseCmdMsg { val NAME = "MeetingActivityResponseCmdMsg" }
case class MeetingActivityResponseCmdMsg(header: BbbClientMsgHeader, body: MeetingActivityResponseCmdMsgBody) extends BbbCoreMsg
case class MeetingActivityResponseCmdMsgBody(respondedBy: String)
/**
* Sent from client to change the rolr of the user the user in the meeting.
*/
@ -109,6 +143,13 @@ object LockUserInMeetingCmdMsg { val NAME = "LockUserInMeetingCmdMsg" }
case class LockUserInMeetingCmdMsg(header: BbbClientMsgHeader, body: LockUserInMeetingCmdMsgBody) extends BbbCoreMsg
case class LockUserInMeetingCmdMsgBody(userId: String, lock: Boolean, lockedBy: String)
/**
* Sent from client to logout and end meeting.
*/
object LogoutAndEndMeetingCmdMsg { val NAME = "LogoutAndEndMeetingCmdMsg" }
case class LogoutAndEndMeetingCmdMsg(header: BbbClientMsgHeader, body: LogoutAndEndMeetingCmdMsgBody) extends BbbCoreMsg
case class LogoutAndEndMeetingCmdMsgBody(userId: String)
/**
* Send to client that user has been locked.
*/

View File

@ -230,4 +230,14 @@ case class MeetingMutedEvtMsgBody(muted: Boolean, mutedBy: String)
case class UserTalkingInVoiceConfEvtMsgBody(voiceConf: String, voiceUserId: String, talking: Boolean)
object VoiceRecordingStartedEvtMsg { val NAME = "VoiceRecordingStartedEvtMsg" }
case class VoiceRecordingStartedEvtMsg(header: BbbCoreVoiceConfHeader,
body: VoiceRecordingStartedEvtMsgBody) extends BbbCoreMsg
case class VoiceRecordingStartedEvtMsgBody(meetingId: String, stream: String, timestamp: String, voiceConf: String)
object VoiceRecordingStoppedEvtMsg { val NAME = "VoiceRecordingStoppedEvtMsg" }
case class VoiceRecordingStoppedEvtMsg(header: BbbCoreVoiceConfHeader,
body: VoiceRecordingStoppedEvtMsgBody) extends BbbCoreMsg
case class VoiceRecordingStoppedEvtMsgBody(meetingId: String, stream: String, timestamp: String, voiceConf: String)