- keep track of last user status update
This commit is contained in:
parent
9dd44ad84b
commit
7752808f47
@ -30,8 +30,19 @@ trait UserConnectedToGlobalAudioMsgHdlr {
|
||||
user <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
|
||||
} yield {
|
||||
|
||||
val vu = VoiceUserState(intId = user.intId, voiceUserId = user.intId, callingWith = "flash", callerName = user.name,
|
||||
callerNum = user.name, muted = true, talking = false, listenOnly = true)
|
||||
val vu = VoiceUserState(
|
||||
intId = user.intId,
|
||||
voiceUserId = user.intId,
|
||||
callingWith = "flash",
|
||||
callerName = user.name,
|
||||
callerNum = user.name,
|
||||
muted = true,
|
||||
talking = false,
|
||||
listenOnly = true,
|
||||
"kms",
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
|
||||
VoiceUsers.add(liveMeeting.voiceUsers, vu)
|
||||
|
||||
broadcastEvent(vu)
|
||||
|
@ -17,35 +17,84 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends BreakoutHdlrHelpers with SystemConfi
|
||||
def handleUserJoinedVoiceConfEvtMsg(msg: UserJoinedVoiceConfEvtMsg): Unit = {
|
||||
log.info("Received user joined voice conference " + msg)
|
||||
|
||||
handleUserJoinedVoiceConfEvtMsg(msg.body.voiceConf, msg.body.intId, msg.body.voiceUserId,
|
||||
msg.body.callingWith, msg.body.callerIdName, msg.body.callerIdNum, msg.body.muted, msg.body.talking)
|
||||
handleUserJoinedVoiceConfEvtMsg(
|
||||
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"
|
||||
)
|
||||
}
|
||||
|
||||
def handleUserJoinedVoiceConfEvtMsg(voiceConf: String, intId: String, voiceUserId: String, callingWith: String,
|
||||
callerIdName: String, callerIdNum: String, muted: Boolean, talking: Boolean): Unit = {
|
||||
def handleUserJoinedVoiceConfEvtMsg(
|
||||
voiceConf: String,
|
||||
intId: String,
|
||||
voiceUserId: String,
|
||||
callingWith: String,
|
||||
callerIdName: String,
|
||||
callerIdNum: String,
|
||||
muted: Boolean,
|
||||
talking: Boolean,
|
||||
callingInto: String
|
||||
): Unit = {
|
||||
|
||||
def broadcastEvent(voiceUserState: VoiceUserState): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(
|
||||
MessageTypes.BROADCAST_TO_MEETING,
|
||||
liveMeeting.props.meetingProp.intId, voiceUserState.intId
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
voiceUserState.intId
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(
|
||||
UserJoinedVoiceConfToClientEvtMsg.NAME,
|
||||
routing
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(UserJoinedVoiceConfToClientEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(
|
||||
UserJoinedVoiceConfToClientEvtMsg.NAME,
|
||||
liveMeeting.props.meetingProp.intId, voiceUserState.intId
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
voiceUserState.intId
|
||||
)
|
||||
|
||||
val body = UserJoinedVoiceConfToClientEvtMsgBody(voiceConf, voiceUserState.intId, voiceUserState.voiceUserId,
|
||||
voiceUserState.callerName, voiceUserState.callerNum, voiceUserState.muted, voiceUserState.talking,
|
||||
voiceUserState.callingWith, voiceUserState.listenOnly)
|
||||
val body = UserJoinedVoiceConfToClientEvtMsgBody(
|
||||
voiceConf,
|
||||
voiceUserState.intId,
|
||||
voiceUserState.voiceUserId,
|
||||
voiceUserState.callerName,
|
||||
voiceUserState.callerNum,
|
||||
voiceUserState.muted,
|
||||
voiceUserState.talking,
|
||||
voiceUserState.callingWith,
|
||||
voiceUserState.listenOnly
|
||||
)
|
||||
|
||||
val event = UserJoinedVoiceConfToClientEvtMsg(header, body)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||
val event = UserJoinedVoiceConfToClientEvtMsg(
|
||||
header,
|
||||
body
|
||||
)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(
|
||||
envelope,
|
||||
event
|
||||
)
|
||||
outGW.send(msgEvent)
|
||||
}
|
||||
|
||||
val isListenOnly = if (callerIdName.startsWith("LISTENONLY")) true else false
|
||||
|
||||
val voiceUserState = VoiceUserState(intId, voiceUserId, callingWith, callerIdName, callerIdNum, muted, talking, listenOnly = isListenOnly)
|
||||
val voiceUserState = VoiceUserState(
|
||||
intId,
|
||||
voiceUserId,
|
||||
callingWith,
|
||||
callerIdName,
|
||||
callerIdNum,
|
||||
muted,
|
||||
talking,
|
||||
listenOnly = isListenOnly,
|
||||
callingInto,
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
VoiceUsers.add(liveMeeting.voiceUsers, voiceUserState)
|
||||
|
||||
broadcastEvent(voiceUserState)
|
||||
@ -55,8 +104,14 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends BreakoutHdlrHelpers with SystemConfi
|
||||
}
|
||||
|
||||
// if the meeting is muted tell freeswitch to mute the new person
|
||||
if (!isListenOnly && MeetingStatus2x.isMeetingMuted(liveMeeting.status)) {
|
||||
val event = MsgBuilder.buildMuteUserInVoiceConfSysMsg(liveMeeting.props.meetingProp.intId, voiceConf, voiceUserId, true)
|
||||
if (!isListenOnly
|
||||
&& MeetingStatus2x.isMeetingMuted(liveMeeting.status)) {
|
||||
val event = MsgBuilder.buildMuteUserInVoiceConfSysMsg(
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
voiceConf,
|
||||
voiceUserId,
|
||||
true
|
||||
)
|
||||
outGW.send(event)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.bigbluebutton.core.apps.voice
|
||||
|
||||
import org.bigbluebutton.common2.msgs.UserStatusVoiceConfEvtMsg
|
||||
import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting, OutMsgRouter }
|
||||
|
||||
trait UserStatusVoiceConfEvtMsgHdlr {
|
||||
this: BaseMeetingActor =>
|
||||
|
||||
val liveMeeting: LiveMeeting
|
||||
val outGW: OutMsgRouter
|
||||
|
||||
def handleUserStatusVoiceConfEvtMsg(msg: UserStatusVoiceConfEvtMsg): Unit = {
|
||||
println("************* RECEIVED UserStatusVoiceConfEvtMsg *************")
|
||||
msg.body.confUsers foreach { cm =>
|
||||
println("user " + cm.callerIdName)
|
||||
}
|
||||
|
||||
msg.body.confRecordings foreach { cr =>
|
||||
println("rec = " + cr.recordPath)
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,8 @@ trait VoiceApp2x extends UserJoinedVoiceConfEvtMsgHdlr
|
||||
with UserTalkingInVoiceConfEvtMsgHdlr
|
||||
with RecordingStartedVoiceConfEvtMsgHdlr
|
||||
with VoiceConfRunningEvtMsgHdlr
|
||||
with SyncGetVoiceUsersMsgHdlr {
|
||||
with SyncGetVoiceUsersMsgHdlr
|
||||
with UserStatusVoiceConfEvtMsgHdlr {
|
||||
|
||||
this: MeetingActor =>
|
||||
}
|
||||
|
@ -100,11 +100,15 @@ class VoiceUsers {
|
||||
}
|
||||
}
|
||||
|
||||
private def saveToCache(user: VoiceUserState): Unit = {
|
||||
private def saveToCache(
|
||||
user: VoiceUserState
|
||||
): Unit = {
|
||||
usersCache += user.intId -> user
|
||||
}
|
||||
|
||||
private def removeFromCache(intId: String): Option[VoiceUserState] = {
|
||||
private def removeFromCache(
|
||||
intId: String
|
||||
): Option[VoiceUserState] = {
|
||||
for {
|
||||
user <- usersCache.get(intId)
|
||||
} yield {
|
||||
@ -114,10 +118,32 @@ class VoiceUsers {
|
||||
}
|
||||
}
|
||||
|
||||
case class VoiceUser2x(intId: String, voiceUserId: String)
|
||||
case class VoiceUserVO2x(intId: String, voiceUserId: String, callerName: String,
|
||||
callerNum: String, joined: Boolean, locked: Boolean, muted: Boolean,
|
||||
talking: Boolean, callingWith: String, listenOnly: Boolean)
|
||||
case class VoiceUser2x(
|
||||
intId: String,
|
||||
voiceUserId: String
|
||||
)
|
||||
case class VoiceUserVO2x(
|
||||
intId: String,
|
||||
voiceUserId: String,
|
||||
callerName: String,
|
||||
callerNum: String,
|
||||
joined: Boolean,
|
||||
locked: Boolean,
|
||||
muted: Boolean,
|
||||
talking: Boolean,
|
||||
callingWith: String,
|
||||
listenOnly: Boolean
|
||||
)
|
||||
|
||||
case class VoiceUserState(intId: String, voiceUserId: String, callingWith: String, callerName: String,
|
||||
callerNum: String, muted: Boolean, talking: Boolean, listenOnly: Boolean /**, calledInto: String**/ )
|
||||
case class VoiceUserState(
|
||||
intId: String,
|
||||
voiceUserId: String,
|
||||
callingWith: String,
|
||||
callerName: String,
|
||||
callerNum: String,
|
||||
muted: Boolean,
|
||||
talking: Boolean,
|
||||
listenOnly: Boolean,
|
||||
calledInto: String,
|
||||
lastStatusUpdateOn: Long
|
||||
)
|
@ -745,12 +745,18 @@ class MeetingActor(
|
||||
}
|
||||
|
||||
def handleCheckRunningAndRecordingVoiceConfEvtMsg(msg: CheckRunningAndRecordingVoiceConfEvtMsg): Unit = {
|
||||
//msg.body.confRecordings foreach { cr =>
|
||||
// println("rec = " + cr.recordPath)
|
||||
//}
|
||||
|
||||
if (liveMeeting.props.recordProp.record &&
|
||||
msg.body.isRunning &&
|
||||
!msg.body.isRecording) {
|
||||
// Voice conference is running but not recording. We should start recording.
|
||||
// But first, see if we have recording streams and stop those.
|
||||
VoiceApp.stopRecordingVoiceConference(liveMeeting, outGW)
|
||||
// Remove recording streams that have stopped so we should only have
|
||||
// one active recording stream.
|
||||
|
||||
// Let us start recording.
|
||||
val meetingId = liveMeeting.props.meetingProp.intId
|
||||
@ -761,14 +767,4 @@ class MeetingActor(
|
||||
}
|
||||
}
|
||||
|
||||
def handleUserStatusVoiceConfEvtMsg(msg: UserStatusVoiceConfEvtMsg): Unit = {
|
||||
println("************* RECEIVED UserStatusVoiceConfEvtMsg *************")
|
||||
msg.body.confUsers foreach { cm =>
|
||||
println("user " + cm.callerIdName)
|
||||
}
|
||||
|
||||
msg.body.confRecordings foreach { cr =>
|
||||
println("rec = " + cr.recordPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ class AnalyticsActor extends Actor with ActorLogging {
|
||||
def handleBbbCommonEnvCoreMsg(msg: BbbCommonEnvCoreMsg): Unit = {
|
||||
|
||||
msg.core match {
|
||||
case m: GetAllMeetingsReqMsg => logMessage(msg)
|
||||
|
||||
case m: RegisterUserReqMsg => logMessage(msg)
|
||||
case m: RegisteredUserJoinTimeoutMsg => logMessage(msg)
|
||||
case m: UserRegisteredRespMsg => logMessage(msg)
|
||||
|
@ -63,7 +63,7 @@ object FakeUserGenerator {
|
||||
listenOnly: Boolean): VoiceUserState = {
|
||||
val voiceUserId = RandomStringGenerator.randomAlphanumericString(8)
|
||||
VoiceUserState(intId = user.id, voiceUserId = voiceUserId, callingWith, callerName = user.name,
|
||||
callerNum = user.name, muted, talking, listenOnly)
|
||||
callerNum = user.name, muted, talking, listenOnly, "freeswitch", System.currentTimeMillis())
|
||||
}
|
||||
|
||||
def createFakeVoiceOnlyUser(callingWith: String, muted: Boolean, talking: Boolean,
|
||||
@ -72,7 +72,7 @@ object FakeUserGenerator {
|
||||
val intId = "v_" + RandomStringGenerator.randomAlphanumericString(16)
|
||||
val name = getRandomElement(firstNames, random) + " " + getRandomElement(lastNames, random)
|
||||
VoiceUserState(intId, voiceUserId = voiceUserId, callingWith, callerName = name,
|
||||
callerNum = name, muted, talking, listenOnly)
|
||||
callerNum = name, muted, talking, listenOnly, "freeswitch", System.currentTimeMillis())
|
||||
}
|
||||
|
||||
def createFakeWebcamStreamFor(userId: String, viewers: Set[String]): WebcamStream = {
|
||||
|
Loading…
Reference in New Issue
Block a user