Skip to content
Snippets Groups Projects
Commit c226d954 authored by prlanzarin's avatar prlanzarin
Browse files

akka-apps: add global audio permission check messages

Used by bbb-webrtc-sfu to enrich its validation on whether a user is allowed to subscribe to the global audio bridge via listen only or not
parent 705ea991
No related branches found
No related tags found
No related merge requests found
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter }
import org.bigbluebutton.core.models.Users2x
trait GetGlobalAudioPermissionReqMsgHdlr {
this: MeetingActor =>
val outGW: OutMsgRouter
def build(
meetingId: String,
voiceConf: String,
userId: String,
sfuSessionId: String,
allowed: Boolean
): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
val envelope = BbbCoreEnvelope(GetGlobalAudioPermissionRespMsg.NAME, routing)
val header = BbbClientMsgHeader(GetGlobalAudioPermissionRespMsg.NAME, meetingId, userId)
val body = GetGlobalAudioPermissionRespMsgBody(meetingId, voiceConf, userId, sfuSessionId, allowed)
val event = GetGlobalAudioPermissionRespMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def handleGetGlobalAudioPermissionReqMsg(msg: GetGlobalAudioPermissionReqMsg) {
var allowed = false
for {
user <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
} yield {
if (!user.userLeftFlag.left
&& user.authed
&& liveMeeting.props.meetingProp.intId == msg.body.meetingId
&& liveMeeting.props.voiceProp.voiceConf == msg.body.voiceConf) {
allowed = true
}
}
val event = build(
liveMeeting.props.meetingProp.intId,
liveMeeting.props.voiceProp.voiceConf,
msg.body.userId,
msg.body.sfuSessionId,
allowed
)
outGW.send(event)
}
}
......@@ -154,6 +154,8 @@ class ReceivedJsonMsgHandlerActor(
routeVoiceMsg[UserStatusVoiceConfEvtMsg](envelope, jsonNode)
case VoiceConfCallStateEvtMsg.NAME =>
routeVoiceMsg[VoiceConfCallStateEvtMsg](envelope, jsonNode)
case GetGlobalAudioPermissionReqMsg.NAME =>
routeGenericMsg[GetGlobalAudioPermissionReqMsg](envelope, jsonNode)
// Breakout rooms
case BreakoutRoomsListMsg.NAME =>
......
......@@ -74,6 +74,7 @@ class MeetingActor(
with MuteAllExceptPresentersCmdMsgHdlr
with MuteMeetingCmdMsgHdlr
with IsMeetingMutedReqMsgHdlr
with GetGlobalAudioPermissionReqMsgHdlr
with EjectUserFromVoiceCmdMsgHdlr
with EndMeetingSysCmdMsgHdlr
......@@ -405,6 +406,8 @@ class MeetingActor(
handleCheckRunningAndRecordingVoiceConfEvtMsg(m)
case m: UserStatusVoiceConfEvtMsg =>
handleUserStatusVoiceConfEvtMsg(m)
case m: GetGlobalAudioPermissionReqMsg =>
handleGetGlobalAudioPermissionReqMsg(m)
// Layout
case m: GetCurrentLayoutReqMsg => handleGetCurrentLayoutReqMsg(m)
......
......@@ -469,4 +469,32 @@ case class VoiceCallStateEvtMsgBody(
userId: String,
callerName: String,
callState: String
)
\ No newline at end of file
)
/* Sent by bbb-webrtc-sfu to ask permission for adding a listener to the global
* audio bridge
*/
object GetGlobalAudioPermissionReqMsg { val NAME = "GetGlobalAudioPermissionReqMsg" }
case class GetGlobalAudioPermissionReqMsg(
header: BbbClientMsgHeader,
body: GetGlobalAudioPermissionReqMsgBody
) extends StandardMsg
case class GetGlobalAudioPermissionReqMsgBody(
meetingId: String,
voiceConf: String,
userId: String,
sfuSessionId: String
)
object GetGlobalAudioPermissionRespMsg { val NAME = "GetGlobalAudioPermissionRespMsg" }
case class GetGlobalAudioPermissionRespMsg(
header: BbbClientMsgHeader,
body: GetGlobalAudioPermissionRespMsgBody
) extends StandardMsg
case class GetGlobalAudioPermissionRespMsgBody(
meetingId: String,
voiceConf: String,
userId: String,
sfuSessionId: String,
allowed: Boolean
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment