- enforce lock settings when user joins voice conf
- make sure liten only user is muted when they join voice conf
This commit is contained in:
parent
ace413b319
commit
bcc14792ea
@ -7,31 +7,30 @@ import org.bigbluebutton.core2.{ MeetingStatus2x }
|
|||||||
|
|
||||||
object LockSettingsUtil {
|
object LockSettingsUtil {
|
||||||
|
|
||||||
|
def muteUserInVoiceConf(liveMeeting: LiveMeeting, outGW: OutMsgRouter, vu: VoiceUserState, mute: Boolean): Unit = {
|
||||||
|
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, vu.intId)
|
||||||
|
val envelope = BbbCoreEnvelope(MuteUserInVoiceConfSysMsg.NAME, routing)
|
||||||
|
val header = BbbCoreHeaderWithMeetingId(MuteUserInVoiceConfSysMsg.NAME, liveMeeting.props.meetingProp.intId)
|
||||||
|
|
||||||
|
val body = MuteUserInVoiceConfSysMsgBody(liveMeeting.props.voiceProp.voiceConf, vu.voiceUserId, mute)
|
||||||
|
val event = MuteUserInVoiceConfSysMsg(header, body)
|
||||||
|
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||||
|
|
||||||
|
outGW.send(msgEvent)
|
||||||
|
}
|
||||||
|
|
||||||
def applyMutingOfUsers(mute: Boolean, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
|
def applyMutingOfUsers(mute: Boolean, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
|
||||||
|
|
||||||
def muteUserInVoiceConf(vu: VoiceUserState, mute: Boolean): Unit = {
|
|
||||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, vu.intId)
|
|
||||||
val envelope = BbbCoreEnvelope(MuteUserInVoiceConfSysMsg.NAME, routing)
|
|
||||||
val header = BbbCoreHeaderWithMeetingId(MuteUserInVoiceConfSysMsg.NAME, liveMeeting.props.meetingProp.intId)
|
|
||||||
|
|
||||||
val body = MuteUserInVoiceConfSysMsgBody(liveMeeting.props.voiceProp.voiceConf, vu.voiceUserId, mute)
|
|
||||||
val event = MuteUserInVoiceConfSysMsg(header, body)
|
|
||||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
|
||||||
|
|
||||||
outGW.send(msgEvent)
|
|
||||||
}
|
|
||||||
|
|
||||||
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu =>
|
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu =>
|
||||||
Users2x.findWithIntId(liveMeeting.users2x, vu.intId).foreach { user =>
|
Users2x.findWithIntId(liveMeeting.users2x, vu.intId).foreach { user =>
|
||||||
if (user.role == Roles.VIEWER_ROLE) {
|
if (user.role == Roles.VIEWER_ROLE) {
|
||||||
if (mute) {
|
if (mute) {
|
||||||
// Mute everyone. We also mute listenOnly users as sledgehammer to make sure
|
// Mute everyone. We also mute listenOnly users as sledgehammer to make sure
|
||||||
// audio can't be transmitted. (ralam dec 6, 2019)
|
// audio can't be transmitted. (ralam dec 6, 2019)
|
||||||
muteUserInVoiceConf(vu, mute)
|
muteUserInVoiceConf(liveMeeting, outGW, vu, mute)
|
||||||
} else {
|
} else {
|
||||||
// Only unmute viewers and non-listenOnly users.
|
// Only unmute viewers and non-listenOnly users.
|
||||||
if (!vu.listenOnly) {
|
if (!vu.listenOnly) {
|
||||||
muteUserInVoiceConf(vu, mute)
|
muteUserInVoiceConf(liveMeeting, outGW, vu, mute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,9 +38,36 @@ object LockSettingsUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def enforceLockSettingsForVoice(liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
|
def enforceLockSettingsForAllVoiceUsers(liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
|
||||||
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
|
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
|
||||||
applyMutingOfUsers(permissions.disableMic, liveMeeting, outGW)
|
applyMutingOfUsers(permissions.disableMic, liveMeeting, outGW)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def enforceLockSettingsForVoiceUser(intUserId: String, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
|
||||||
|
val permissions = MeetingStatus2x.getPermissions(liveMeeting.status)
|
||||||
|
if (permissions.disableMic) {
|
||||||
|
Users2x.findWithIntId(liveMeeting.users2x, intUserId).foreach { user =>
|
||||||
|
if (user.role == Roles.VIEWER_ROLE) {
|
||||||
|
val voiceUser = VoiceUsers.findWithIntId(liveMeeting.voiceUsers, intUserId)
|
||||||
|
voiceUser.foreach { vu =>
|
||||||
|
// Make sure that user is muted when lock settings has mic disabled. (ralam dec 6, 2019
|
||||||
|
if (!vu.muted) {
|
||||||
|
muteUserInVoiceConf(liveMeeting, outGW, vu, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def enforceListenOnlyUserIsMuted(intUserId: String, liveMeeting: LiveMeeting, outGW: OutMsgRouter): Unit = {
|
||||||
|
val voiceUser = VoiceUsers.findWithIntId(liveMeeting.voiceUsers, intUserId)
|
||||||
|
voiceUser.foreach { vu =>
|
||||||
|
// Make sure that listen only user is muted. (ralam dec 6, 2019
|
||||||
|
if (vu.listenOnly && !vu.muted) {
|
||||||
|
muteUserInVoiceConf(liveMeeting, outGW, vu, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ trait ChangeLockSettingsInMeetingCmdMsgHdlr extends RightsManagementTrait {
|
|||||||
|
|
||||||
MeetingStatus2x.setPermissions(liveMeeting.status, settings)
|
MeetingStatus2x.setPermissions(liveMeeting.status, settings)
|
||||||
|
|
||||||
LockSettingsUtil.enforceLockSettingsForVoice(liveMeeting, outGW)
|
LockSettingsUtil.enforceLockSettingsForAllVoiceUsers(liveMeeting, outGW)
|
||||||
|
|
||||||
val routing = Routing.addMsgToClientRouting(
|
val routing = Routing.addMsgToClientRouting(
|
||||||
MessageTypes.BROADCAST_TO_MEETING,
|
MessageTypes.BROADCAST_TO_MEETING,
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package org.bigbluebutton.core.apps.voice
|
package org.bigbluebutton.core.apps.voice
|
||||||
|
|
||||||
import org.bigbluebutton.common2.msgs.{ BbbClientMsgHeader, BbbCommonEnvCoreMsg, BbbCoreEnvelope, ConfVoiceUser, MessageTypes, Routing, UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody, UserLeftVoiceConfToClientEvtMsg, UserLeftVoiceConfToClientEvtMsgBody, UserMutedVoiceEvtMsg, UserMutedVoiceEvtMsgBody }
|
import org.bigbluebutton.LockSettingsUtil
|
||||||
|
import org.bigbluebutton.common2.msgs.{BbbClientMsgHeader, BbbCommonEnvCoreMsg, BbbCoreEnvelope, ConfVoiceUser, MessageTypes, Routing, UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody, UserLeftVoiceConfToClientEvtMsg, UserLeftVoiceConfToClientEvtMsgBody, UserMutedVoiceEvtMsg, UserMutedVoiceEvtMsgBody}
|
||||||
import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
|
import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
|
||||||
import org.bigbluebutton.core.bus.InternalEventBus
|
import org.bigbluebutton.core.bus.InternalEventBus
|
||||||
import org.bigbluebutton.core.models.{ VoiceUserState, VoiceUsers }
|
import org.bigbluebutton.core.models.{VoiceUserState, VoiceUsers}
|
||||||
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
|
import org.bigbluebutton.core.running.{LiveMeeting, OutMsgRouter}
|
||||||
import org.bigbluebutton.core2.MeetingStatus2x
|
import org.bigbluebutton.core2.MeetingStatus2x
|
||||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||||
|
|
||||||
@ -250,6 +251,12 @@ object VoiceApp {
|
|||||||
)
|
)
|
||||||
outGW.send(event)
|
outGW.send(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LockSettingsUtil.enforceListenOnlyUserIsMuted(intId,
|
||||||
|
liveMeeting,
|
||||||
|
outGW)
|
||||||
|
|
||||||
|
LockSettingsUtil.enforceLockSettingsForVoiceUser(intId, liveMeeting, outGW)
|
||||||
}
|
}
|
||||||
|
|
||||||
def handleUserLeftVoiceConfEvtMsg(
|
def handleUserLeftVoiceConfEvtMsg(
|
||||||
|
Loading…
Reference in New Issue
Block a user