- update last status in one spot

This commit is contained in:
Richard Alam 2019-10-24 15:28:16 -07:00
parent 5d52c15456
commit 4f62e0ea79
7 changed files with 109 additions and 133 deletions

View File

@ -32,17 +32,31 @@ trait MuteUserCmdMsgHdlr extends RightsManagementTrait {
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
for {
requester <- Users2x.findWithIntId(liveMeeting.users2x, msg.header.userId)
u <- VoiceUsers.findWithIntId(liveMeeting.voiceUsers, msg.body.userId)
requester <- Users2x.findWithIntId(
liveMeeting.users2x,
msg.header.userId
)
u <- VoiceUsers.findWithIntId(
liveMeeting.voiceUsers,
msg.body.userId
)
} yield {
if (requester.role != Roles.MODERATOR_ROLE && permissions.disableMic && requester.locked && u.muted &&
if (requester.role != Roles.MODERATOR_ROLE
&& permissions.disableMic
&& requester.locked
&& u.muted &&
msg.body.userId == msg.header.userId) {
// unmuting self while not moderator and mic disabled. Do not allow.
} else {
if (u.muted != msg.body.mute) {
log.info("Send mute user request. meetingId=" + meetingId + " userId=" + u.intId + " user=" + u)
val event = MsgBuilder.buildMuteUserInVoiceConfSysMsg(meetingId, voiceConf,
u.voiceUserId, msg.body.mute)
val event = MsgBuilder.buildMuteUserInVoiceConfSysMsg(
meetingId,
voiceConf,
u.voiceUserId,
msg.body.mute
)
outGW.send(event)
}
}

View File

@ -1,40 +1,26 @@
package org.bigbluebutton.core.apps.voice
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.models.{ VoiceUserState, VoiceUsers }
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting, OutMsgRouter }
import org.bigbluebutton.core.models.{ VoiceUsers }
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
trait UserMutedInVoiceConfEvtMsgHdlr {
this: BaseMeetingActor =>
this: MeetingActor =>
val liveMeeting: LiveMeeting
val outGW: OutMsgRouter
def handleUserMutedInVoiceConfEvtMsg(msg: UserMutedInVoiceConfEvtMsg): Unit = {
def broadcastEvent(vu: VoiceUserState): Unit = {
val routing = Routing.addMsgToClientRouting(
MessageTypes.BROADCAST_TO_MEETING,
liveMeeting.props.meetingProp.intId,
vu.intId
)
val envelope = BbbCoreEnvelope(UserMutedVoiceEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(
UserMutedVoiceEvtMsg.NAME,
liveMeeting.props.meetingProp.intId, vu.intId
)
val body = UserMutedVoiceEvtMsgBody(voiceConf = msg.header.voiceConf, intId = vu.intId, voiceUserId = vu.intId, vu.muted)
val event = UserMutedVoiceEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
for {
mutedUser <- VoiceUsers.userMuted(liveMeeting.voiceUsers, msg.body.voiceUserId, msg.body.muted)
vu <- VoiceUsers.findWithVoiceUserId(liveMeeting.voiceUsers, msg.body.voiceUserId)
} yield {
broadcastEvent(mutedUser)
VoiceApp.handleUserMutedInVoiceConfEvtMsg(
liveMeeting,
outGW,
msg.body.voiceUserId,
msg.body.muted
)
}
}
}

View File

@ -17,6 +17,5 @@ trait UserStatusVoiceConfEvtMsgHdlr {
eventBus,
msg.body.confUsers
)
}
}

View File

@ -32,9 +32,9 @@ trait UserTalkingInVoiceConfEvtMsgHdlr {
}
for {
mutedUser <- VoiceUsers.userTalking(liveMeeting.voiceUsers, msg.body.voiceUserId, msg.body.talking)
talkingUser <- VoiceUsers.userTalking(liveMeeting.voiceUsers, msg.body.voiceUserId, msg.body.talking)
} yield {
broadcastEvent(mutedUser)
broadcastEvent(talkingUser)
}
}
}

View File

@ -95,45 +95,38 @@ object VoiceApp {
eventBus: InternalEventBus,
users: Vector[ConfVoiceUser]
): Unit = {
users foreach { u =>
users foreach { cvu =>
VoiceUsers.findWithVoiceUserId(
liveMeeting.voiceUsers,
u.voiceUserId
cvu.voiceUserId
) match {
case Some(vu) =>
if (vu.muted != u.muted) {
if (vu.muted != cvu.muted) {
handleUserMutedInVoiceConfEvtMsg(
liveMeeting,
outGW,
u.voiceUserId,
u.muted
cvu.voiceUserId,
cvu.muted
)
} else {
// Update the user status to indicate they are still in the voice conference.
VoiceUsers.setLastStatusUpdate(liveMeeting.voiceUsers, vu)
}
// Update the user status to indicate they are stll in the voice conference.
VoiceUsers.setLastStatusUpdate(liveMeeting.voiceUsers, vu)
case None =>
handleUserJoinedVoiceConfEvtMsg(
liveMeeting,
outGW,
eventBus,
liveMeeting.props.voiceProp.voiceConf,
u.intId,
u.voiceUserId,
u.callingWith,
u.callerIdName,
u.callerIdNum,
u.muted,
u.talking,
u.calledInto
cvu.intId,
cvu.voiceUserId,
cvu.callingWith,
cvu.callerIdName,
cvu.callerIdNum,
cvu.muted,
cvu.talking,
cvu.calledInto
)
// Update this new users status time.
for {
vu <- VoiceUsers.findWithVoiceUserId(liveMeeting.voiceUsers, u.voiceUserId)
} yield {
VoiceUsers.setLastStatusUpdate(liveMeeting.voiceUsers, vu)
}
}
}

View File

@ -39,39 +39,19 @@ object VoiceUsers {
} yield {
val vu = u.modify(_.muted).setTo(muted)
.modify(_.talking).setTo(false)
.modify(_.lastStatusUpdateOn).setTo(System.currentTimeMillis())
users.save(vu)
vu
}
}
def userTalking(users: VoiceUsers, voiceUserId: String, talkng: Boolean): Option[VoiceUserState] = {
def userTalking(users: VoiceUsers, voiceUserId: String, talking: Boolean): Option[VoiceUserState] = {
for {
u <- findWithVoiceUserId(users, voiceUserId)
} yield {
val vu = u.modify(_.muted).setTo(false)
.modify(_.talking).setTo(talkng)
users.save(vu)
vu
}
}
def joinedVoiceListenOnly(users: VoiceUsers, userId: String): Option[VoiceUserState] = {
for {
u <- findWIthIntId(users, userId)
} yield {
val vu = u.modify(_.muted).setTo(true)
.modify(_.talking).setTo(false)
users.save(vu)
vu
}
}
def leftVoiceListenOnly(users: VoiceUsers, userId: String): Option[VoiceUserState] = {
for {
u <- findWIthIntId(users, userId)
} yield {
val vu = u.modify(_.muted).setTo(false)
.modify(_.talking).setTo(false)
.modify(_.talking).setTo(talking)
.modify(_.lastStatusUpdateOn).setTo(System.currentTimeMillis())
users.save(vu)
vu
}

View File

@ -30,65 +30,69 @@ class AnalyticsActor extends Actor with ActorLogging {
def handleBbbCommonEnvCoreMsg(msg: BbbCommonEnvCoreMsg): Unit = {
msg.core match {
case m: GetAllMeetingsReqMsg => logMessage(msg)
case m: GetAllMeetingsReqMsg => logMessage(msg)
case m: RegisterUserReqMsg => logMessage(msg)
case m: RegisteredUserJoinTimeoutMsg => logMessage(msg)
case m: UserRegisteredRespMsg => logMessage(msg)
case m: DisconnectAllClientsSysMsg => logMessage(msg)
case m: DisconnectClientSysMsg => logMessage(msg)
case m: MeetingEndingEvtMsg => logMessage(msg)
case m: MeetingCreatedEvtMsg => logMessage(msg)
case m: LogoutAndEndMeetingCmdMsg => logMessage(msg)
case m: ValidateAuthTokenRespMsg => logMessage(msg)
case m: UserJoinedMeetingEvtMsg => logMessage(msg)
case m: RecordingStatusChangedEvtMsg => logMessage(msg)
case m: WebcamsOnlyForModeratorChangedEvtMsg => logMessage(msg)
case m: UserLeftMeetingEvtMsg => logMessage(msg)
case m: PresenterUnassignedEvtMsg => logMessage(msg)
case m: PresenterAssignedEvtMsg => logMessage(msg)
case m: MeetingIsActiveEvtMsg => logMessage(msg)
case m: UserEjectedFromMeetingEvtMsg => logMessage(msg)
case m: EjectUserFromVoiceConfSysMsg => logMessage(msg)
case m: CreateBreakoutRoomSysCmdMsg => logMessage(msg)
case m: RequestBreakoutJoinURLReqMsg => logMessage(msg)
case m: EndAllBreakoutRoomsMsg => logMessage(msg)
case m: TransferUserToMeetingRequestMsg => logMessage(msg)
case m: UserLeftVoiceConfToClientEvtMsg => logMessage(msg)
case m: UserLeftVoiceConfEvtMsg => logMessage(msg)
case m: RecordingStartedVoiceConfEvtMsg => logMessage(msg)
case m: MuteUserCmdMsg => logMessage(msg)
case m: MuteUserInVoiceConfSysMsg => logMessage(msg)
case m: MuteAllExceptPresentersCmdMsg => logMessage(msg)
case m: EjectUserFromVoiceCmdMsg => logMessage(msg)
case m: MuteMeetingCmdMsg => logMessage(msg)
case m: UserConnectedToGlobalAudioMsg => logMessage(msg)
case m: UserJoinedVoiceConfToClientEvtMsg => logMessage(msg)
case m: UserDisconnectedFromGlobalAudioMsg => logMessage(msg)
case m: AssignPresenterReqMsg => logMessage(msg)
case m: ScreenshareStartedVoiceConfEvtMsg => logMessage(msg)
case m: ScreenshareStoppedVoiceConfEvtMsg => logMessage(msg)
case m: RegisterUserReqMsg => logMessage(msg)
case m: RegisteredUserJoinTimeoutMsg => logMessage(msg)
case m: UserRegisteredRespMsg => logMessage(msg)
case m: DisconnectAllClientsSysMsg => logMessage(msg)
case m: DisconnectClientSysMsg => logMessage(msg)
case m: MeetingEndingEvtMsg => logMessage(msg)
case m: MeetingCreatedEvtMsg => logMessage(msg)
case m: LogoutAndEndMeetingCmdMsg => logMessage(msg)
case m: ValidateAuthTokenRespMsg => logMessage(msg)
case m: UserJoinedMeetingEvtMsg => logMessage(msg)
case m: RecordingStatusChangedEvtMsg => logMessage(msg)
case m: WebcamsOnlyForModeratorChangedEvtMsg => logMessage(msg)
case m: UserLeftMeetingEvtMsg => logMessage(msg)
case m: PresenterUnassignedEvtMsg => logMessage(msg)
case m: PresenterAssignedEvtMsg => logMessage(msg)
case m: MeetingIsActiveEvtMsg => logMessage(msg)
case m: UserEjectedFromMeetingEvtMsg => logMessage(msg)
case m: EjectUserFromVoiceConfSysMsg => logMessage(msg)
case m: CreateBreakoutRoomSysCmdMsg => logMessage(msg)
case m: RequestBreakoutJoinURLReqMsg => logMessage(msg)
case m: EndAllBreakoutRoomsMsg => logMessage(msg)
case m: TransferUserToMeetingRequestMsg => logMessage(msg)
case m: UserLeftVoiceConfToClientEvtMsg => logMessage(msg)
case m: UserLeftVoiceConfEvtMsg => logMessage(msg)
case m: RecordingStartedVoiceConfEvtMsg => logMessage(msg)
case m: MuteUserCmdMsg => logMessage(msg)
case m: MuteUserInVoiceConfSysMsg => logMessage(msg)
case m: MuteAllExceptPresentersCmdMsg => logMessage(msg)
case m: EjectUserFromVoiceCmdMsg => logMessage(msg)
case m: MuteMeetingCmdMsg => logMessage(msg)
case m: UserConnectedToGlobalAudioMsg => logMessage(msg)
case m: UserJoinedVoiceConfToClientEvtMsg => logMessage(msg)
case m: UserDisconnectedFromGlobalAudioMsg => logMessage(msg)
case m: AssignPresenterReqMsg => logMessage(msg)
case m: ScreenshareStartedVoiceConfEvtMsg => logMessage(msg)
case m: ScreenshareStoppedVoiceConfEvtMsg => logMessage(msg)
case m: ScreenshareRtmpBroadcastStartedVoiceConfEvtMsg => logMessage(msg)
case m: ScreenshareRtmpBroadcastStoppedVoiceConfEvtMsg => logMessage(msg)
case m: ScreenshareStartRtmpBroadcastVoiceConfMsg => logMessage(msg)
case m: ScreenshareStopRtmpBroadcastVoiceConfMsg => logMessage(msg)
case m: ScreenshareRtmpBroadcastStartedEvtMsg => logMessage(msg)
case m: ScreenshareRtmpBroadcastStoppedEvtMsg => logMessage(msg)
case m: MeetingInactivityWarningEvtMsg => logMessage(msg)
case m: StartRecordingVoiceConfSysMsg => logMessage(msg)
case m: StopRecordingVoiceConfSysMsg => logMessage(msg)
case m: ScreenshareStartRtmpBroadcastVoiceConfMsg => logMessage(msg)
case m: ScreenshareStopRtmpBroadcastVoiceConfMsg => logMessage(msg)
case m: ScreenshareRtmpBroadcastStartedEvtMsg => logMessage(msg)
case m: ScreenshareRtmpBroadcastStoppedEvtMsg => logMessage(msg)
case m: MeetingInactivityWarningEvtMsg => logMessage(msg)
case m: StartRecordingVoiceConfSysMsg => logMessage(msg)
case m: StopRecordingVoiceConfSysMsg => logMessage(msg)
//case m: UpdateRecordingTimerEvtMsg => logMessage(msg)
case m: RecordAndClearPreviousMarkersCmdMsg => logMessage(msg)
case m: TransferUserToVoiceConfSysMsg => logMessage(msg)
case m: UserBroadcastCamStartMsg => logMessage(msg)
case m: UserBroadcastCamStopMsg => logMessage(msg)
case m: UserBroadcastCamStoppedEvtMsg => logMessage(msg)
case m: UserBroadcastCamStartedEvtMsg => logMessage(msg)
case m: EjectUserFromMeetingSysMsg => logMessage(msg)
case m: UserActivitySignCmdMsg => logMessage(msg)
case m: UserInactivityInspectMsg => logMessage(msg)
case m: RecordAndClearPreviousMarkersCmdMsg => logMessage(msg)
case m: TransferUserToVoiceConfSysMsg => logMessage(msg)
case m: UserBroadcastCamStartMsg => logMessage(msg)
case m: UserBroadcastCamStopMsg => logMessage(msg)
case m: UserBroadcastCamStoppedEvtMsg => logMessage(msg)
case m: UserBroadcastCamStartedEvtMsg => logMessage(msg)
case m: EjectUserFromMeetingSysMsg => logMessage(msg)
case m: UserActivitySignCmdMsg => logMessage(msg)
case m: UserInactivityInspectMsg => logMessage(msg)
case m: ChangeUserRoleCmdMsg => logMessage(msg)
case m: ChangeUserRoleCmdMsg => logMessage(msg)
// Voice
case m: UserMutedVoiceEvtMsg =>
logMessage(msg)
// Breakout
case m: BreakoutRoomEndedEvtMsg => logMessage(msg)