diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/GetGlobalAudioPermissionReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/GetGlobalAudioPermissionReqMsgHdlr.scala new file mode 100755 index 0000000000000000000000000000000000000000..9137364097817df36e645e1917f49acb3ee7e235 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/GetGlobalAudioPermissionReqMsgHdlr.scala @@ -0,0 +1,52 @@ +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) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index 91dbac6f96e626e2cb0f37dfee8c1cd453a0fa67..e82ad4bab6bf4282aff276cd69934256627aa752 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -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 => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index b5b2fb22df505c8952a8a335d6769b68782c8800..6c6b41d76f05128104feebff0b581edcd0b1782f 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -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) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala index 4d92363940c0385590b99bdfbfa52981819b17e5..5efef06c8a7119f8f1a270985268744feaf04c67 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala @@ -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 +)