Merge pull request #9230 from ritzalam/track-ejected-dialin-users
Keep track of banned dial-in callers
This commit is contained in:
commit
43d9c3da98
@ -2,7 +2,9 @@ package org.bigbluebutton.core.apps.voice
|
||||
|
||||
import org.bigbluebutton.SystemConfiguration
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.models.VoiceUsers
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
|
||||
trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration {
|
||||
this: MeetingActor =>
|
||||
@ -13,19 +15,29 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration {
|
||||
def handleUserJoinedVoiceConfEvtMsg(msg: UserJoinedVoiceConfEvtMsg): Unit = {
|
||||
log.info("Received user joined voice conference " + msg)
|
||||
|
||||
VoiceApp.handleUserJoinedVoiceConfEvtMsg(
|
||||
liveMeeting,
|
||||
outGW,
|
||||
eventBus,
|
||||
msg.body.voiceConf,
|
||||
msg.body.intId,
|
||||
msg.body.voiceUserId,
|
||||
msg.body.callingWith,
|
||||
msg.body.callerIdName,
|
||||
msg.body.callerIdNum,
|
||||
msg.body.muted,
|
||||
msg.body.talking,
|
||||
"freeswitch"
|
||||
)
|
||||
if (VoiceUsers.isCallerBanned(msg.body.callerIdNum, liveMeeting.voiceUsers)) {
|
||||
log.info("Ejecting banned voice user " + msg)
|
||||
val event = MsgBuilder.buildEjectUserFromVoiceConfSysMsg(
|
||||
props.meetingProp.intId,
|
||||
props.voiceProp.voiceConf,
|
||||
msg.body.voiceUserId
|
||||
)
|
||||
outGW.send(event)
|
||||
} else {
|
||||
VoiceApp.handleUserJoinedVoiceConfEvtMsg(
|
||||
liveMeeting,
|
||||
outGW,
|
||||
eventBus,
|
||||
msg.body.voiceConf,
|
||||
msg.body.intId,
|
||||
msg.body.voiceUserId,
|
||||
msg.body.callingWith,
|
||||
msg.body.callerIdName,
|
||||
msg.body.callerIdNum,
|
||||
msg.body.muted,
|
||||
msg.body.talking,
|
||||
"freeswitch"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,16 @@ object VoiceUsers {
|
||||
def findAllFreeswitchCallers(users: VoiceUsers): Vector[VoiceUserState] = users.toVector.filter(u => u.calledInto == "freeswitch")
|
||||
def findAllKurentoCallers(users: VoiceUsers): Vector[VoiceUserState] = users.toVector.filter(u => u.calledInto == "kms")
|
||||
|
||||
def findAllBannedCallers(users: VoiceUsers): Vector[VoiceUserState] = users.bannedUsers.values.toVector
|
||||
|
||||
def isCallerBanned(callerIdNum: String, users: VoiceUsers): Boolean = {
|
||||
users.bannedUsers.contains(callerIdNum)
|
||||
}
|
||||
|
||||
def ban(users: VoiceUsers, user: VoiceUserState): Unit = {
|
||||
users.ban(user)
|
||||
}
|
||||
|
||||
def add(users: VoiceUsers, user: VoiceUserState): Unit = {
|
||||
users.save(user)
|
||||
}
|
||||
@ -67,12 +77,21 @@ object VoiceUsers {
|
||||
class VoiceUsers {
|
||||
private var users: collection.immutable.HashMap[String, VoiceUserState] = new collection.immutable.HashMap[String, VoiceUserState]
|
||||
|
||||
// Keep track of ejected voice users to prevent them from rejoining.
|
||||
// ralam april 23, 2020
|
||||
private var bannedUsers: collection.immutable.HashMap[String, VoiceUserState] = new collection.immutable.HashMap[String, VoiceUserState]
|
||||
|
||||
// Collection of users that left the meeting. We keep a cache of the old users state to recover in case
|
||||
// the user reconnected by refreshing the client. (ralam june 13, 2017)
|
||||
private var usersCache: collection.immutable.HashMap[String, VoiceUserState] = new collection.immutable.HashMap[String, VoiceUserState]
|
||||
|
||||
private def toVector: Vector[VoiceUserState] = users.values.toVector
|
||||
|
||||
private def ban(user: VoiceUserState): VoiceUserState = {
|
||||
bannedUsers += user.callerNum -> user
|
||||
user
|
||||
}
|
||||
|
||||
private def save(user: VoiceUserState): VoiceUserState = {
|
||||
users += user.intId -> user
|
||||
user
|
||||
@ -134,4 +153,4 @@ case class VoiceUserState(
|
||||
listenOnly: Boolean,
|
||||
calledInto: String,
|
||||
lastStatusUpdateOn: Long
|
||||
)
|
||||
)
|
||||
|
@ -23,6 +23,7 @@ trait EjectUserFromVoiceCmdMsgHdlr extends RightsManagementTrait {
|
||||
u <- VoiceUsers.findWithIntId(liveMeeting.voiceUsers, msg.body.userId)
|
||||
} yield {
|
||||
log.info("Ejecting user from voice. meetingId=" + props.meetingProp.intId + " userId=" + u.intId)
|
||||
VoiceUsers.ban(liveMeeting.voiceUsers, u)
|
||||
val event = MsgBuilder.buildEjectUserFromVoiceConfSysMsg(props.meetingProp.intId, props.voiceProp.voiceConf, u.voiceUserId)
|
||||
outGW.send(event)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user