From e91d2bd4bf1b68f17a6d6d9f5e571e7b2a394027 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Wed, 13 May 2015 20:23:49 +0000 Subject: [PATCH 01/30] - standalone bbb-apps now compiles --- labs/bbb-apps/build.sbt | 47 +- labs/bbb-apps/project/build.properties | 2 +- labs/bbb-apps/project/plugins.sbt | 6 +- .../redis/MeetingMessageHandler.java | 112 + .../conference/service/chat/ChatKeyUtil.java | 13 + .../service/chat/ChatMessageListener.java | 78 + .../service/layout/LayoutApplication.java | 45 + .../service/messaging/Constants.java | 96 + .../messaging/CreateMeetingMessage.java | 37 + .../messaging/DestroyMeetingMessage.java | 12 + .../service/messaging/EndMeetingMessage.java | 12 + .../messaging/GetAllMeetingsRequest.java | 12 + .../service/messaging/IMessage.java | 5 + .../service/messaging/KeepAliveMessage.java | 12 + .../service/messaging/MessageBuilder.java | 36 + .../messaging/MessageFromJsonConverter.java | 89 + .../service/messaging/MessagingConstants.java | 59 + .../service/messaging/MessagingService.java | 27 + .../messaging/RegisterUserMessage.java | 73 + .../messaging/UserConnectedToGlobalAudio.java | 59 + .../UserDisconnectedFromGlobalAudio.java | 56 + .../messaging/ValidateAuthTokenMessage.java | 20 + .../messaging/redis/MessageDistributor.java | 25 + .../messaging/redis/MessageHandler.java | 23 + .../messaging/redis/MessageReceiver.java | 85 + .../messaging/redis/MessageSender.java | 70 + .../messaging/redis/MessageToSend.java | 19 + .../messaging/redis/ReceivedMessage.java | 28 + .../redis/ReceivedMessageHandler.java | 68 + .../ConversionUpdatesProcessor.java | 56 + .../PresentationMessageListener.java | 147 ++ .../presentation/PreuploadedPresentation.java | 12 + .../PreuploadedPresentationsUtil.java | 55 + .../GenericObjectPoolConfigWrapper.java | 142 ++ .../service/recorder/RecordEvent.java | 85 + .../conference/service/recorder/Recorder.java | 35 + .../service/recorder/RecorderApplication.java | 105 + .../service/recorder/RedisDispatcher.java | 53 + .../chat/AbstractChatRecordEvent.java | 28 + .../recorder/chat/PublicChatRecordEvent.java | 43 + .../AbstractParticipantRecordEvent.java | 28 + .../AssignPresenterRecordEvent.java | 39 + .../ParticipantEndAndKickAllRecordEvent.java | 27 + .../ParticipantJoinRecordEvent.java | 47 + .../ParticipantLeftRecordEvent.java | 32 + .../ParticipantStatusChangeRecordEvent.java | 39 + .../participants/RecordStatusRecordEvent.java | 35 + .../polling/AbstractPollRecordEvent.java | 29 + .../polling/PollClearedRecordEvent.java | 35 + .../polling/PollCreatedRecordEvent.java | 66 + .../polling/PollRemovedRecordEvent.java | 37 + .../polling/PollStartedRecordEvent.java | 35 + .../polling/PollStoppedRecordEvent.java | 35 + .../polling/PollUpdatedRecordEvent.java | 60 + .../AbstractPresentationRecordEvent.java | 28 + ...rsionCompletedPresentationRecordEvent.java | 40 + .../presentation/CursorUpdateRecordEvent.java | 36 + .../GenerateSlidePresentationRecordEvent.java | 40 + .../GotoSlidePresentationRecordEvent.java | 81 + ...vePresentationPresentationRecordEvent.java | 33 + ...zeAndMoveSlidePresentationRecordEvent.java | 72 + ...rePresentationPresentationRecordEvent.java | 40 + .../service/voice/VoiceKeyUtil.java | 6 + .../service/voice/VoiceMessageListener.java | 50 + .../service/whiteboard/WhiteboardKeyUtil.java | 16 + .../whiteboard/WhiteboardListener.java | 51 + .../redis/AbstractWhiteboardRecordEvent.java | 46 + .../redis/AddShapeWhiteboardRecordEvent.java | 69 + .../redis/AddTextWhiteboardRecordEvent.java | 54 + .../redis/ClearPageWhiteboardRecordEvent.java | 28 + .../ModifyTextWhiteboardRecordEvent.java | 53 + .../ToggleGridWhiteboardRecordEvent.java | 33 + .../redis/UndoShapeWhiteboardRecordEvent.java | 32 + .../core/api/IBigBlueButtonInGW.java | 119 + .../bigbluebutton/core/api/IDispatcher.java | 6 + .../bigbluebutton/core/api/IOutMessage.java | 5 + .../core/api/MessageOutGateway.java | 21 + .../core/api/OutMessageListener2.java | 6 + .../core/api/RedisLpushDispatcher.java | 66 + .../service/recording/RecordMessage.java | 5 + .../service/recording/RedisListRecorder.java | 73 + .../voice/AbstractVoiceRecordEvent.java | 32 + .../voice/ConferenceServerListener.java | 26 + .../voice/ConferenceServiceProvider.java | 28 + .../FreeswitchConferenceEventListener.java | 115 + .../voice/IVoiceConferenceService.java | 13 + .../ParticipantJoinedVoiceRecordEvent.java | 51 + .../ParticipantLeftVoiceRecordEvent.java | 31 + .../ParticipantLockedVoiceRecordEvent.java | 35 + .../ParticipantMutedVoiceRecordEvent.java | 35 + .../ParticipantTalkingVoiceRecordEvent.java | 36 + .../voice/StartRecordingVoiceRecordEvent.java | 38 + .../voice/VoiceEventRecorder.java | 141 ++ .../voice/commands/ConferenceCommand.java | 40 + .../commands/ConferenceCommandResult.java | 56 + .../commands/EjectParticipantCommand.java | 34 + .../commands/GetParticipantsCommand.java | 27 + .../commands/MuteParticipantCommand.java | 40 + .../voice/events/ConferenceEventListener.java | 25 + .../voice/events/UnknownConferenceEvent.java | 27 + .../voice/events/VoiceConferenceEvent.java | 32 + .../events/VoiceStartRecordingEvent.java | 51 + .../voice/events/VoiceUserJoinedEvent.java | 70 + .../voice/events/VoiceUserLeftEvent.java | 33 + .../voice/events/VoiceUserLockedEvent.java | 40 + .../voice/events/VoiceUserMutedEvent.java | 40 + .../voice/events/VoiceUserTalkingEvent.java | 40 + .../voice/freeswitch/ConnectionManager.java | 154 ++ .../voice/freeswitch/ESLEventListener.java | 204 ++ .../freeswitch/FreeswitchApplication.java | 202 ++ .../actions/BroadcastConferenceCommand.java | 50 + .../actions/EjectAllUsersCommand.java | 31 + .../actions/EjectParticipantCommand.java | 34 + .../freeswitch/actions/FreeswitchCommand.java | 45 + .../actions/MuteParticipantCommand.java | 40 + .../actions/PopulateRoomCommand.java | 116 + .../actions/RecordConferenceCommand.java | 50 + .../freeswitch/response/ConferenceMember.java | 88 + .../response/ConferenceMemberFlags.java | 54 + .../XMLResponseConferenceListParser.java | 160 ++ .../BigBlueButtonAppsMainActor.scala | 5 +- .../main/scala/org/bigbluebutton/Boot.scala | 26 +- .../org/bigbluebutton/SystemConfig.scala | 4 +- .../scala/org/bigbluebutton/apps/Data.scala | 22 +- .../bigbluebutton/apps/MeetingManager.scala | 120 - .../bigbluebutton/apps/MeetingMessage.scala | 10 +- .../bigbluebutton/apps/RunningMeeting.scala | 20 - .../apps/RunningMeetingActor.scala | 81 - .../scala/org/bigbluebutton/apps/Util.scala | 14 +- .../org/bigbluebutton/apps/chat/ChatApp.scala | 24 +- .../apps/chat/ChatAppHandler.scala | 40 - .../bigbluebutton/apps/chat/data/Data.scala | 19 +- .../apps/chat/messages/Messages.scala | 29 +- .../bigbluebutton/apps/layout/LayoutApp.scala | 32 +- .../apps/layout/LayoutAppHandler.scala | 39 - .../bigbluebutton/apps/layout/data/Data.scala | 2 +- .../apps/layout/messages/Messages.scala | 14 +- .../apps/presentation/PresentationApp.scala | 78 +- .../presentation/PresentationAppHandler.scala | 63 - .../apps/presentation/data/Data.scala | 7 +- .../apps/presentation/messages/Messages.scala | 84 +- .../apps/protocol/InMessage.scala | 23 +- .../bigbluebutton/apps/protocol/Message.scala | 20 +- .../apps/protocol/OutMessages.scala | 13 +- .../apps/protocol/Protocol.scala | 35 +- .../bigbluebutton/apps/users/UsersApp.scala | 176 +- .../apps/users/UsersAppHandler.scala | 154 -- .../bigbluebutton/apps/users/data/Model.scala | 30 +- .../apps/users/messages/Messages.scala | 74 +- .../users/protocol/UsersMessageHandler.scala | 46 +- .../protocol/UsersMessageMarshalling.scala | 43 +- .../protocol/UsersMessageUnmarshalling.scala | 52 +- .../apps/utils/RandomStringGenerator.scala | 32 +- .../apps/whiteboard/WhiteboardApp.scala | 16 +- .../whiteboard/WhiteboardAppHandler.scala | 44 - .../apps/whiteboard/data/Model.scala | 76 +- .../apps/whiteboard/messages/Messages.scala | 40 +- .../core/BigBlueButtonActor.scala | 181 ++ .../core/BigBlueButtonGateway.scala | 23 + .../core/BigBlueButtonInGW.scala | 479 ++++ .../bigbluebutton/core/CollectorActor.scala | 2160 +++++++++++++++++ .../bigbluebutton/core/CollectorGateway.scala | 22 + .../org/bigbluebutton/core/MeetingActor.scala | 265 ++ .../bigbluebutton/core/RunningMeeting.scala | 35 + .../core/SystemConfiguration.scala | 20 + .../scala/org/bigbluebutton/core/User.scala | 29 + .../core/api/ConsoleDispatcher.scala | 8 + .../bigbluebutton/core/api/Constants.scala | 96 + .../bigbluebutton/core/api/InMessages.scala | 447 ++++ .../bigbluebutton/core/api/MessageNames.scala | 164 ++ .../bigbluebutton/core/api/OutMessages.scala | 575 +++++ .../core/api/TimestampGenerator.scala | 14 + .../bigbluebutton/core/api/ValueObjects.scala | 105 + .../org/bigbluebutton/core/api/Versions.scala | 5 + .../core/apps/chat/ChatApp.scala | 31 + .../core/apps/chat/ChatInGateway.scala | 19 + .../chat/redis/ChatEventRedisPublisher.scala | 38 + .../chat/redis/ChatEventRedisRecorder.scala | 29 + .../redis/ChatMessageToJsonConverter.scala | 67 + .../core/apps/layout/LayoutApp.scala | 66 + .../core/apps/layout/LayoutInGateway.scala | 21 + .../bigbluebutton/core/apps/poll/Poll.scala | 140 ++ .../core/apps/poll/PollApp.scala | 123 + .../core/apps/poll/PollInGateway.scala | 56 + .../core/apps/poll/PollMessageConverter.scala | 190 ++ .../core/apps/poll/PollModel.scala | 237 ++ .../core/apps/poll/QuestionType.scala | 7 + .../poll/redis/PollEventRedisPublisher.scala | 114 + .../poll/redis/PollEventRedisRecorder.scala | 114 + .../apps/presentation/PresentationApp.scala | 154 ++ .../apps/presentation/PresentationModel.scala | 127 + .../PesentationMessageToJsonConverter.scala | 281 +++ .../PresentationEventRedisPublisher.scala | 111 + .../PresentationEventRedisRecorder.scala | 127 + .../bigbluebutton/core/apps/users/Users.scala | 133 + .../core/apps/users/UsersApp.scala | 447 ++++ .../core/apps/users/UsersModel.scala | 101 + .../redis/UsersEventRedisPublisher.scala | 188 ++ .../users/redis/UsersEventRedisRecorder.scala | 214 ++ .../redis/UsersMessageToJsonConverter.scala | 359 +++ .../core/apps/voice/VoiceApp.scala | 34 + .../core/apps/voice/VoiceInGateway.scala | 65 + .../core/apps/whiteboard/WhiteboardApp.scala | 100 + .../apps/whiteboard/WhiteboardInGateway.scala | 54 + .../apps/whiteboard/WhiteboardModel.scala | 87 + .../redis/WhiteboardEventRedisPublisher.scala | 56 + .../redis/WhiteboardEventRedisRecorder.scala | 92 + .../WhiteboardMessageToJsonConverter.scala | 94 + .../apps/whiteboard/vo/ValueObjects.scala | 3 + .../meeting/MeetingEventRedisPublisher.scala | 94 + .../MeetingMessageToJsonConverter.scala | 132 + .../bigbluebutton/core/messaging/Util.scala | 32 + .../bigbluebutton/core/models/Values.scala | 23 + .../core/util/RandomStringGenerator.scala | 17 + .../core/voice/VoiceConferenceActor.scala | 14 + .../endpoint/InMessageFormatters.scala | 44 +- .../endpoint/InMessageHandlerActor.scala | 24 +- .../endpoint/MessageFormats.scala | 96 +- .../endpoint/MessageMarshallingActor.scala | 16 +- .../endpoint/MessageNameConstants.scala | 83 +- .../endpoint/MessageUmarshallingActor.scala | 94 +- .../endpoint/OutMessageFormatters.scala | 12 +- .../endpoint/OutMsgBuilderActor.scala | 19 +- .../org/bigbluebutton/endpoint/Protocol.scala | 157 +- .../redis/AppsRedisPublisherActor.scala | 24 +- .../redis/AppsRedisSubscriberActor.scala | 26 +- .../endpoint/redis/RedisPubSubActor.scala | 4 +- .../endpoint/rest/MeetingMessageHandler.scala | 109 - .../endpoint/rest/RestEndpointService.scala | 80 - 229 files changed, 15803 insertions(+), 1615 deletions(-) mode change 100644 => 100755 labs/bbb-apps/build.sbt create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java create mode 100644 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java create mode 100755 labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java mode change 100644 => 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingManager.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeeting.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeetingActor.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatAppHandler.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutAppHandler.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationAppHandler.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersAppHandler.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardAppHandler.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala create mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala create mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala mode change 100644 => 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala mode change 100644 => 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala mode change 100644 => 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala delete mode 100755 labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/MeetingMessageHandler.scala delete mode 100644 labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/RestEndpointService.scala diff --git a/labs/bbb-apps/build.sbt b/labs/bbb-apps/build.sbt old mode 100644 new mode 100755 index 7d2c8a7a5f..2fbfbf15f9 --- a/labs/bbb-apps/build.sbt +++ b/labs/bbb-apps/build.sbt @@ -5,7 +5,7 @@ organization := "org.bigbluebutton" version := "0.1-SNAPSHOT" -scalaVersion := "2.10.2" +scalaVersion := "2.11.6" scalacOptions ++= Seq( "-unchecked", @@ -13,13 +13,14 @@ scalacOptions ++= Seq( "-Xlint", "-Ywarn-dead-code", "-language:_", - "-target:jvm-1.6", + "-target:jvm-1.7", "-encoding", "UTF-8" ) resolvers ++= Seq( "spray repo" at "http://repo.spray.io/", - "rediscala" at "https://github.com/etaty/rediscala-mvn/raw/master/releases/" + "rediscala" at "http://dl.bintray.com/etaty/maven", + "blindside-repos" at "http://blindside.googlecode.com/svn/repository/" ) publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/dev/repo/maven-repo/releases" )) ) @@ -34,29 +35,29 @@ testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "html", "console", testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-reports") libraryDependencies ++= { - val akkaVersion = "2.2.3" - val sprayVersion = "1.2-RC3" + val akkaVersion = "2.3.10" + val sprayVersion = "1.3.2" Seq( - "io.spray" % "spray-can" % sprayVersion, - "io.spray" % "spray-routing" % sprayVersion, - "io.spray" % "spray-testkit" % sprayVersion % "test", - "io.spray" %% "spray-json" % "1.2.5", - "com.github.sstone" %% "amqp-client" % "1.3-ML1", - "com.typesafe.akka" %% "akka-camel" % akkaVersion, - "com.typesafe.akka" %% "akka-actor" % akkaVersion, - "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test", - "org.specs2" %% "specs2" % "2.2.3" % "test", - "org.scalatest" % "scalatest_2.10" % "2.0" % "test", - "com.typesafe.akka" %% "akka-slf4j" % akkaVersion, - "ch.qos.logback" % "logback-classic" % "1.0.3", - "org.pegdown" % "pegdown" % "1.4.0", - "junit" % "junit" % "4.11", - "com.etaty.rediscala" %% "rediscala" % "1.3", - "commons-codec" % "commons-codec" % "1.8", - "joda-time" % "joda-time" % "2.3", - "net.virtual-void" %% "json-lenses" % "0.5.4" + "io.spray" %% "spray-json" % sprayVersion, + "io.spray" %% "spray-routing" % sprayVersion, + "com.typesafe.akka" %% "akka-actor" % akkaVersion, + "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test", + "com.typesafe.akka" %% "akka-slf4j" % akkaVersion, + "ch.qos.logback" % "logback-classic" % "1.0.3", + "org.pegdown" % "pegdown" % "1.4.0", + "junit" % "junit" % "4.11", + "com.etaty.rediscala" %% "rediscala" % "1.4.0", + "commons-codec" % "commons-codec" % "1.8", + "joda-time" % "joda-time" % "2.3", + "net.virtual-void" %% "json-lenses" % "0.5.4", + "com.google.code.gson" % "gson" % "1.7.1", + "redis.clients" % "jedis" % "2.1.0", + "org.jboss.netty" % "netty" % "3.2.1.Final", + "org.apache.commons" % "commons-lang3" % "3.2" )} +libraryDependencies += "org.freeswitch" % "fs-esl-client" % "0.8.2" from "http://blindside.googlecode.com/svn/repository/org/freeswitch/fs-esl-client/0.8.2/fs-esl-client-0.8.2.jar" seq(Revolver.settings: _*) +scalariformSettings diff --git a/labs/bbb-apps/project/build.properties b/labs/bbb-apps/project/build.properties index 9b860e23c5..a6e117b610 100755 --- a/labs/bbb-apps/project/build.properties +++ b/labs/bbb-apps/project/build.properties @@ -1 +1 @@ -sbt.version=0.12.3 +sbt.version=0.13.8 diff --git a/labs/bbb-apps/project/plugins.sbt b/labs/bbb-apps/project/plugins.sbt index da832d1b63..425fa8ab29 100755 --- a/labs/bbb-apps/project/plugins.sbt +++ b/labs/bbb-apps/project/plugins.sbt @@ -1,7 +1,5 @@ -addSbtPlugin("io.spray" % "sbt-revolver" % "0.6.2") +addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2") -addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.0.1") - -addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.4.0") +addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0") diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java new file mode 100755 index 0000000000..a98e4f430c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java @@ -0,0 +1,112 @@ +package org.bigbluebutton.conference.meeting.messaging.redis; + +import java.util.HashMap; +import java.util.Map; +import org.bigbluebutton.conference.service.messaging.CreateMeetingMessage; +import org.bigbluebutton.conference.service.messaging.DestroyMeetingMessage; +import org.bigbluebutton.conference.service.messaging.EndMeetingMessage; +import org.bigbluebutton.conference.service.messaging.IMessage; +import org.bigbluebutton.conference.service.messaging.KeepAliveMessage; +import org.bigbluebutton.conference.service.messaging.MessageFromJsonConverter; +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.RegisterUserMessage; +import org.bigbluebutton.conference.service.messaging.UserConnectedToGlobalAudio; +import org.bigbluebutton.conference.service.messaging.UserDisconnectedFromGlobalAudio; +import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage; +import org.bigbluebutton.conference.service.messaging.GetAllMeetingsRequest; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.Gson; + +public class MeetingMessageHandler implements MessageHandler { + + private IBigBlueButtonInGW bbbGW; + + @Override + public void handleMessage(String pattern, String channel, String message) { +// System.out.println("Checking message: " + pattern + " " + channel + " " + message); + if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { +// System.out.println("Meeting message: " + channel + " " + message); + IMessage msg = MessageFromJsonConverter.convert(message); + + if (msg != null) { + if (msg instanceof EndMeetingMessage) { + EndMeetingMessage emm = (EndMeetingMessage) msg; +// log.info("Received end meeting request. Meeting id [{}]", emm.meetingId); + bbbGW.endMeeting(emm.meetingId); + } else if (msg instanceof CreateMeetingMessage) { + CreateMeetingMessage emm = (CreateMeetingMessage) msg; +// log.info("Received create meeting request. Meeting id [{}]", emm.id); + bbbGW.createMeeting2(emm.id, emm.externalId, emm.name, emm.record, emm.voiceBridge, + emm.duration, emm.autoStartRecording, emm.allowStartStopRecording, + emm.moderatorPass, emm.viewerPass, emm.createTime, emm.createDate); + } else if (msg instanceof RegisterUserMessage) { + RegisterUserMessage emm = (RegisterUserMessage) msg; +// log.info("Received register user request. Meeting id [{}], userid=[{}], token=[{}]", emm.meetingID, emm.internalUserId, emm.authToken); + bbbGW.registerUser(emm.meetingID, emm.internalUserId, emm.fullname, emm.role, emm.externUserID, emm.authToken); + } else if (msg instanceof DestroyMeetingMessage) { + DestroyMeetingMessage emm = (DestroyMeetingMessage) msg; +// log.info("Received destroy meeting request. Meeting id [{}]", emm.meetingId); + bbbGW.destroyMeeting(emm.meetingId); + } else if (msg instanceof ValidateAuthTokenMessage) { + ValidateAuthTokenMessage emm = (ValidateAuthTokenMessage) msg; +// log.info("Received ValidateAuthTokenMessage token request. Meeting id [{}]", emm.meetingId); +// log.warn("TODO: Need to pass sessionId on ValidateAuthTokenMessage message."); + String sessionId = "tobeimplemented"; + bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo, sessionId); + } else if (msg instanceof UserConnectedToGlobalAudio) { + UserConnectedToGlobalAudio emm = (UserConnectedToGlobalAudio) msg; + + Map logData = new HashMap(); + logData.put("voiceConf", emm.voiceConf); + logData.put("userId", emm.userid); + logData.put("username", emm.name); + logData.put("event", "user_connected_to_global_audio"); + logData.put("description", "User connected to global audio."); + + Gson gson = new Gson(); + String logStr = gson.toJson(logData); + +// log.info("User connected to global audio: data={}", logStr); + + bbbGW.userConnectedToGlobalAudio(emm.voiceConf, emm.userid, emm.name); + } else if (msg instanceof UserDisconnectedFromGlobalAudio) { + UserDisconnectedFromGlobalAudio emm = (UserDisconnectedFromGlobalAudio) msg; + + Map logData = new HashMap(); + logData.put("voiceConf", emm.voiceConf); + logData.put("userId", emm.userid); + logData.put("username", emm.name); + logData.put("event", "user_disconnected_from_global_audio"); + logData.put("description", "User disconnected from global audio."); + + Gson gson = new Gson(); + String logStr = gson.toJson(logData); + +// log.info("User disconnected from global audio: data={}", logStr); + bbbGW.userDisconnectedFromGlobalAudio(emm.voiceConf, emm.userid, emm.name); + } + else if (msg instanceof GetAllMeetingsRequest) { + GetAllMeetingsRequest emm = (GetAllMeetingsRequest) msg; +// log.info("Received GetAllMeetingsRequest"); + bbbGW.getAllMeetings("no_need_of_a_meeting_id"); + } + } + } else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) { + IMessage msg = MessageFromJsonConverter.convert(message); + + if (msg != null) { + if (msg instanceof KeepAliveMessage) { + KeepAliveMessage emm = (KeepAliveMessage) msg; +// log.debug("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId); + bbbGW.isAliveAudit(emm.keepAliveId); + } + } + } + } + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java new file mode 100755 index 0000000000..babdde091d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java @@ -0,0 +1,13 @@ +package org.bigbluebutton.conference.service.chat; + +public class ChatKeyUtil { + public static final String CHAT_TYPE = "chatType"; + public static final String FROM_USERID = "fromUserID"; + public static final String FROM_USERNAME = "fromUsername"; + public static final String FROM_COLOR = "fromColor"; + public static final String FROM_TIME = "fromTime"; + public static final String FROM_TZ_OFFSET = "fromTimezoneOffset"; + public static final String TO_USERID = "toUserID"; + public static final String TO_USERNAME = "toUsername"; + public static final String MESSAGE = "message"; +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java new file mode 100755 index 0000000000..6c0b78acb1 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java @@ -0,0 +1,78 @@ +package org.bigbluebutton.conference.service.chat; + +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +import java.util.Map; +import java.util.HashMap; + +import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +public class ChatMessageListener implements MessageHandler{ + + private IBigBlueButtonInGW bbbGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_CHANNEL)) { + + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + JsonObject headerObject = (JsonObject) obj.get("header"); + JsonObject payloadObject = (JsonObject) obj.get("payload"); + JsonObject messageObject = (JsonObject) payloadObject.get("message"); + + String eventName = headerObject.get("name").toString(); + eventName = eventName.replace("\"", ""); + + if (eventName.equalsIgnoreCase(MessagingConstants.SEND_PUBLIC_CHAT_MESSAGE_REQUEST) || + eventName.equalsIgnoreCase(MessagingConstants.SEND_PRIVATE_CHAT_MESSAGE_REQUEST)){ + + String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); + String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); + + //case getChatHistory + if(eventName.equalsIgnoreCase("get_chat_history")) { + String replyTo = meetingID + "/" + requesterID; + bbbGW.getChatHistory(meetingID, requesterID, replyTo); + } + else { + String chatType = messageObject.get("chat_type").toString().replace("\"", ""); + String fromUserID = messageObject.get("from_userid").toString().replace("\"", ""); + String fromUsername = messageObject.get("from_username").toString().replace("\"", ""); + String fromColor = messageObject.get("from_color").toString().replace("\"", ""); + String fromTime = messageObject.get("from_time").toString().replace("\"", ""); + String fromTimezoneOffset = messageObject.get("from_tz_offset").toString().replace("\"", ""); + String toUserID = messageObject.get("to_userid").toString().replace("\"", ""); + String toUsername = messageObject.get("to_username").toString().replace("\"", ""); + String tempChat = messageObject.get("message").toString(); + String chatText = tempChat.substring(1, tempChat.length() - 1).replace("\\\"", "\""); + + Map map = new HashMap(); + map.put(ChatKeyUtil.CHAT_TYPE, chatType); + map.put(ChatKeyUtil.FROM_USERID, fromUserID); + map.put(ChatKeyUtil.FROM_USERNAME, fromUsername); + map.put(ChatKeyUtil.FROM_COLOR, fromColor); + map.put(ChatKeyUtil.FROM_TIME, fromTime); + map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset); + map.put(ChatKeyUtil.TO_USERID, toUserID); + map.put(ChatKeyUtil.TO_USERNAME, toUsername); + map.put(ChatKeyUtil.MESSAGE, chatText); + + if(eventName.equalsIgnoreCase(MessagingConstants.SEND_PUBLIC_CHAT_MESSAGE_REQUEST)) { + bbbGW.sendPublicMessage(meetingID, requesterID, map); + } + else if(eventName.equalsIgnoreCase(MessagingConstants.SEND_PRIVATE_CHAT_MESSAGE_REQUEST)) { + bbbGW.sendPrivateMessage(meetingID, requesterID, map); + } + } + } + } + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java new file mode 100644 index 0000000000..ea62ccfee6 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java @@ -0,0 +1,45 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.layout; + +import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +import scala.Option; + +public class LayoutApplication { + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } + + public void broadcastLayout(String meetingID, String requesterID, String layout) { + bbbInGW.broadcastLayout(meetingID, requesterID, layout); + } + + public void lockLayout(String meetingId, String setById, + Boolean lock, Boolean viewersOnly, + Option layout) { + bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout); + } + + public void getCurrentLayout(String meetingID, String requesterID) { + bbbInGW.getCurrentLayout(meetingID, requesterID); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java new file mode 100644 index 0000000000..8b324b248c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java @@ -0,0 +1,96 @@ +package org.bigbluebutton.conference.service.messaging; + +public class Constants { + public static final String NAME = "name"; + public static final String HEADER = "header"; + public static final String PAYLOAD = "payload"; + public static final String MEETING_ID = "meeting_id"; + public static final String EXTERNAL_MEETING_ID = "external_meeting_id"; + public static final String TIMESTAMP = "timestamp"; + public static final String USER_ID = "userid"; + public static final String RECORDED = "recorded"; + public static final String MEETING_NAME = "meeting_name"; + public static final String VOICE_CONF = "voice_conf"; + public static final String DURATION = "duration"; + public static final String AUTH_TOKEN = "auth_token"; + public static final String ROLE = "role"; + public static final String EXT_USER_ID = "external_user_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String REPLY_TO = "reply_to"; + public static final String LOWERED_BY = "lowered_by"; + public static final String STREAM = "stream"; + public static final String LOCKED = "locked"; + public static final String SETTINGS = "settings"; + public static final String LOCK = "lock"; + public static final String EXCEPT_USERS = "except_users"; + public static final String STATUS = "status"; + public static final String VALUE = "value"; + public static final String NEW_PRESENTER_ID = "new_presenter_id"; + public static final String NEW_PRESENTER_NAME = "new_presenter_name"; + public static final String ASSIGNED_BY = "assigned_by"; + public static final String RECORDING = "recording"; + public static final String AUTO_START_RECORDING = "auto_start_recording"; + public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording"; + public static final String LAYOUT_ID = "layout_id"; + public static final String POLL = "poll"; + public static final String POLL_ID = "poll_id"; + public static final String FORCE = "force"; + public static final String RESPONSE = "response"; + public static final String PRESENTATION_ID = "presentation_id"; + public static final String X_OFFSET = "x_offset"; + public static final String Y_OFFSET = "y_offset"; + public static final String WIDTH_RATIO = "width_ratio"; + public static final String HEIGHT_RATIO = "height_ratio"; + public static final String PAGE = "page"; + public static final String SHARE = "share"; + public static final String PRESENTATIONS = "presentations"; + public static final String MESSAGE_KEY = "message_key"; + public static final String CODE = "code"; + public static final String PRESENTATION_NAME = "presentation_name"; + public static final String NUM_PAGES = "num_pages"; + public static final String MAX_NUM_PAGES = "max_num_pages"; + public static final String PAGES_COMPLETED = "pages_completed"; + public static final String MUTE = "mute"; + public static final String CALLER_ID_NUM = "caller_id_num"; + public static final String CALLER_ID_NAME = "caller_id_name"; + public static final String TALKING = "talking"; + public static final String USER = "user"; + public static final String MUTED = "muted"; + public static final String VOICE_USER = "voice_user"; + public static final String RECORDING_FILE = "recording_file"; + public static final String ANNOTATION = "annotation"; + public static final String WHITEBOARD_ID = "whiteboard_id"; + public static final String ENABLE = "enable"; + public static final String PRESENTER = "presenter"; + public static final String USERS = "users"; + public static final String RAISE_HAND = "raise_hand"; + public static final String HAS_STREAM = "has_stream"; + public static final String WEBCAM_STREAM = "webcam_stream"; + public static final String PHONE_USER = "phone_user"; + public static final String PERMISSIONS = "permissions"; + public static final String VALID = "valid"; + public static final String CHAT_HISTORY = "chat_history"; + public static final String MESSAGE = "message"; + public static final String SET_BY_USER_ID = "set_by_user_id"; + public static final String POLLS = "polls"; + public static final String REASON = "reason"; + public static final String RESPONDER = "responder"; + public static final String PRESENTATION_INFO = "presentation_info"; + public static final String SHAPES = "shapes"; + public static final String SHAPE = "shape"; + public static final String SHAPE_ID = "shape_id"; + public static final String PRESENTATION = "presentation"; + public static final String ID = "id"; + public static final String CURRENT = "current"; + public static final String PAGES = "pages"; + public static final String WEB_USER_ID = "web_user_id"; + public static final String JOINED = "joined"; + public static final String X_PERCENT = "x_percent"; + public static final String Y_PERCENT = "y_percent"; + public static final String KEEP_ALIVE_ID = "keep_alive_id"; + public static final String INTERNAL_USER_ID = "internal_user_id"; + public static final String MODERATOR_PASS = "moderator_pass"; + public static final String VIEWER_PASS = "viewer_pass"; + public static final String CREATE_TIME = "create_time"; + public static final String CREATE_DATE = "create_date"; +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java new file mode 100644 index 0000000000..4db244c13d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java @@ -0,0 +1,37 @@ +package org.bigbluebutton.conference.service.messaging; + +public class CreateMeetingMessage implements IMessage { + public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; + public static final String VERSION = "0.0.1"; + + public final String id; + public final String externalId; + public final String name; + public final Boolean record; + public final String voiceBridge; + public final Long duration; + public final Boolean autoStartRecording; + public final Boolean allowStartStopRecording; + public final String moderatorPass; + public final String viewerPass; + public final Long createTime; + public final String createDate; + + public CreateMeetingMessage(String id, String externalId, String name, Boolean record, String voiceBridge, + Long duration, Boolean autoStartRecording, + Boolean allowStartStopRecording, String moderatorPass, + String viewerPass, Long createTime, String createDate) { + this.id = id; + this.externalId = externalId; + this.name = name; + this.record = record; + this.voiceBridge = voiceBridge; + this.duration = duration; + this.autoStartRecording = autoStartRecording; + this.allowStartStopRecording = allowStartStopRecording; + this.moderatorPass = moderatorPass; + this.viewerPass = viewerPass; + this.createTime = createTime; + this.createDate = createDate; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java new file mode 100755 index 0000000000..01106c1730 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class DestroyMeetingMessage implements IMessage { + public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public DestroyMeetingMessage(String meetingId) { + this.meetingId = meetingId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java new file mode 100755 index 0000000000..3a02401421 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class EndMeetingMessage implements IMessage { + public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public EndMeetingMessage(String meetingId) { + this.meetingId = meetingId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java new file mode 100644 index 0000000000..baa1cd4099 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class GetAllMeetingsRequest implements IMessage { + public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public GetAllMeetingsRequest(String meetingId) { + this.meetingId = meetingId; + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java new file mode 100755 index 0000000000..2414f55a30 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.conference.service.messaging; + +public interface IMessage { + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java new file mode 100644 index 0000000000..6cebf71a4a --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class KeepAliveMessage implements IMessage { + public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; + public static final String VERSION = "0.0.1"; + + public final String keepAliveId; + + public KeepAliveMessage(String keepAliveId) { + this.keepAliveId = keepAliveId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java new file mode 100755 index 0000000000..2137a063b5 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java @@ -0,0 +1,36 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.concurrent.TimeUnit; + +import com.google.gson.Gson; + +public class MessageBuilder { + public final static String VERSION = "version"; + + public static long generateTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public static java.util.HashMap buildHeader(String name, String version, String replyTo) { + java.util.HashMap header = new java.util.HashMap(); + header.put(Constants.NAME, name); + header.put(VERSION, version); + header.put(Constants.TIMESTAMP, generateTimestamp()); + if (replyTo != null && replyTo != "") + header.put(Constants.REPLY_TO, replyTo); + + return header; + } + + + public static String buildJson(java.util.HashMap header, + java.util.HashMap payload) { + + java.util.HashMap> message = new java.util.HashMap>(); + message.put(Constants.HEADER, header); + message.put(Constants.PAYLOAD, payload); + + Gson gson = new Gson(); + return gson.toJson(message); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java new file mode 100755 index 0000000000..4efc79d5dc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java @@ -0,0 +1,89 @@ +package org.bigbluebutton.conference.service.messaging; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MessageFromJsonConverter { + + public static IMessage convert(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + switch (messageName) { + case CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT: + return processCreateMeeting(payload); + case DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT: + return processDestroyMeeting(payload); + case EndMeetingMessage.END_MEETING_REQUEST_EVENT: + return processEndMeetingMessage(payload); + case KeepAliveMessage.KEEP_ALIVE_REQUEST: + return processKeepAlive(payload); + case RegisterUserMessage.REGISTER_USER: + System.out.println("Registering a user"); + return RegisterUserMessage.fromJson(message); + case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN: + return processValidateAuthTokenMessage(header, payload); + case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO: + return UserConnectedToGlobalAudio.fromJson(message); + case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO: + return UserDisconnectedFromGlobalAudio.fromJson(message); + case GetAllMeetingsRequest.GET_ALL_MEETINGS_REQUEST_EVENT: + return new GetAllMeetingsRequest("the_string_is_not_used_anywhere"); + } + } + } + return null; + } + + private static IMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + String replyTo = header.get(Constants.REPLY_TO).getAsString(); + String sessionId = "tobeimplemented"; + return new ValidateAuthTokenMessage(id, userid, authToken, replyTo, + sessionId); + } + + private static IMessage processCreateMeeting(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + Boolean record = payload.get(Constants.RECORDED).getAsBoolean(); + String voiceBridge = payload.get(Constants.VOICE_CONF).getAsString(); + Long duration = payload.get(Constants.DURATION).getAsLong(); + Boolean autoStartRecording = payload.get(Constants.AUTO_START_RECORDING).getAsBoolean(); + Boolean allowStartStopRecording = payload.get(Constants.ALLOW_START_STOP_RECORDING).getAsBoolean(); + String moderatorPassword = payload.get(Constants.MODERATOR_PASS).getAsString(); + String viewerPassword = payload.get(Constants.VIEWER_PASS).getAsString(); + Long createTime = payload.get(Constants.CREATE_TIME).getAsLong(); + String createDate = payload.get(Constants.CREATE_DATE).getAsString(); + + return new CreateMeetingMessage(id, externalId, name, record, voiceBridge, + duration, autoStartRecording, allowStartStopRecording, + moderatorPassword, viewerPassword, createTime, createDate); + } + + private static IMessage processDestroyMeeting(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + return new DestroyMeetingMessage(id); + } + + private static IMessage processEndMeetingMessage(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + return new EndMeetingMessage(id); + } + + private static IMessage processKeepAlive(JsonObject payload) { + String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString(); + return new KeepAliveMessage(id); + } + + //private static IMessage processGetAllMeetings(JsonObject) +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java new file mode 100644 index 0000000000..7e6a0258b9 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java @@ -0,0 +1,59 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.messaging; + +public class MessagingConstants { + + public static final String FROM_BBB_APPS_CHANNEL = "bigbluebutton:from-bbb-apps"; + public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*"; + public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system"; + public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting"; + public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation"; + public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling"; + public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users"; + public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat"; + public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard"; + + public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps"; + public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*"; + public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting"; + public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system"; + public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation"; + public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling"; + public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users"; + public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat"; + public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; + public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; + + public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent"; + public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent"; + public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent"; + public static final String MEETING_STARTED_EVENT = "meeting_created_message"; + public static final String MEETING_ENDED_EVENT = "meeting_ended_event"; + public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event"; + public static final String USER_JOINED_EVENT = "UserJoinedEvent"; + public static final String USER_LEFT_EVENT = "UserLeftEvent"; + public static final String USER_LEFT_VOICE_REQUEST = "user_left_voice_request"; + public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; + public static final String SEND_POLLS_EVENT = "SendPollsEvent"; + public static final String RECORD_STATUS_EVENT = "RecordStatusEvent"; + public static final String SEND_PUBLIC_CHAT_MESSAGE_REQUEST = "send_public_chat_message_request"; + public static final String SEND_PRIVATE_CHAT_MESSAGE_REQUEST = "send_private_chat_message_request"; + public static final String MUTE_USER_REQUEST = "mute_user_request"; +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java new file mode 100755 index 0000000000..8721b188ca --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.messaging; + +import redis.clients.jedis.Jedis; + +public interface MessagingService { + public void send(String channel, String message); + public Jedis createRedisClient(); + public void dropRedisClient(Jedis jedis); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java new file mode 100644 index 0000000000..9e7dfe5259 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java @@ -0,0 +1,73 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class RegisterUserMessage implements IMessage { + public static final String REGISTER_USER = "register_user_request"; + public final String VERSION = "0.0.1"; + + public final String meetingID; + public final String internalUserId; + public final String fullname; + public final String role; + public final String externUserID; + public final String authToken; + + public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) { + this.meetingID = meetingID; + this.internalUserId = internalUserId; + this.fullname = fullname; + this.role = role; + this.externUserID = externUserID; + this.authToken = authToken; + } + + public String toJson() { + HashMap payload = new HashMap(); + + payload.put(Constants.MEETING_ID, meetingID); + payload.put(Constants.INTERNAL_USER_ID, internalUserId); + payload.put(Constants.NAME, fullname); + payload.put(Constants.ROLE, role); + payload.put(Constants.EXT_USER_ID, externUserID); + payload.put(Constants.AUTH_TOKEN, authToken); + + java.util.HashMap header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static RegisterUserMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (REGISTER_USER.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.NAME) + && payload.has(Constants.ROLE) + && payload.has(Constants.EXT_USER_ID) + && payload.has(Constants.AUTH_TOKEN)) { + + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String fullname = payload.get(Constants.NAME).getAsString(); + String role = payload.get(Constants.ROLE).getAsString(); + String externUserID = payload.get(Constants.EXT_USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + + //use externalUserId twice - once for external, once for internal + return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken); + } + } + } + } + System.out.println("Failed to parse RegisterUserMessage"); + return null; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java new file mode 100644 index 0000000000..3ae49d0faf --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserConnectedToGlobalAudio implements IMessage { + public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio"; + public static final String VERSION = "0.0.1"; + + public final String voiceConf; + public final String name; + public final String userid; + + + + public UserConnectedToGlobalAudio(String voiceConf, String userid, String name) { + this.voiceConf = voiceConf; + this.userid = userid; + this.name = name; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.VOICE_CONF, voiceConf); + payload.put(Constants.USER_ID, userid); + payload.put(Constants.NAME, name); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_CONNECTED_TO_GLOBAL_AUDIO, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserConnectedToGlobalAudio fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_CONNECTED_TO_GLOBAL_AUDIO.equals(messageName)) { + if (payload.has(Constants.VOICE_CONF) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NAME)) { + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + return new UserConnectedToGlobalAudio(voiceConf, userid, name); + } + } + } + } + return null; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java new file mode 100755 index 0000000000..314e0a798d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserDisconnectedFromGlobalAudio implements IMessage { + public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio"; + public static final String VERSION = "0.0.1"; + + public final String voiceConf; + public final String name; + public final String userid; + + public UserDisconnectedFromGlobalAudio(String voiceConf, String userid, String name) { + this.voiceConf = voiceConf; + this.userid = userid; + this.name = name; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.VOICE_CONF, voiceConf); + payload.put(Constants.USER_ID, userid); + payload.put(Constants.NAME, name); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_DISCONNECTED_FROM_GLOBAL_AUDIO, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserDisconnectedFromGlobalAudio fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_DISCONNECTED_FROM_GLOBAL_AUDIO.equals(messageName)) { + if (payload.has(Constants.VOICE_CONF) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NAME)) { + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + return new UserDisconnectedFromGlobalAudio(voiceConf, userid, name); + } + } + } + } + return null; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java new file mode 100755 index 0000000000..3f036d96dc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java @@ -0,0 +1,20 @@ +package org.bigbluebutton.conference.service.messaging; + +public class ValidateAuthTokenMessage implements IMessage { + public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String token; + public final String replyTo; + public final String sessionId; + + public ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo, String sessionId) { + this.meetingId = meetingId; + this.userId = userId; + this.token = token; + this.replyTo = replyTo; + this.sessionId = sessionId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java new file mode 100755 index 0000000000..d8518438ea --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java @@ -0,0 +1,25 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.Set; + +public class MessageDistributor { + private ReceivedMessageHandler handler; + private Set listeners; + + public void setMessageListeners(Set listeners) { + this.listeners = listeners; + } + + public void setMessageHandler(ReceivedMessageHandler handler) { + this.handler = handler; + if (handler != null) { + handler.setMessageDistributor(this); + } + } + + public void notifyListeners(String pattern, String channel, String message) { + for (MessageHandler listener : listeners) { + listener.handleMessage(pattern, channel, message); + } + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java new file mode 100755 index 0000000000..64e25cb510 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java @@ -0,0 +1,23 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.messaging.redis; + +public interface MessageHandler { + void handleMessage(String pattern, String channel, String message); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java new file mode 100755 index 0000000000..b051b9e86b --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java @@ -0,0 +1,85 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPubSub; + +public class MessageReceiver { + private ReceivedMessageHandler handler; + + private JedisPool redisPool; + private volatile boolean receiveMessage = false; + + private final Executor msgReceiverExec = Executors.newSingleThreadExecutor(); + + public void stop() { + receiveMessage = false; + } + + public void start() { +// log.info("Ready to receive messages from Redis pubsub."); + try { + receiveMessage = true; + final Jedis jedis = redisPool.getResource(); + + Runnable messageReceiver = new Runnable() { + public void run() { + if (receiveMessage) { + jedis.psubscribe(new PubSubListener(), MessagingConstants.TO_BBB_APPS_PATTERN); + } + } + }; + msgReceiverExec.execute(messageReceiver); + } catch (Exception e) { +// log.error("Error subscribing to channels: " + e.getMessage()); + } + } + + public void setRedisPool(JedisPool redisPool){ + this.redisPool = redisPool; + } + + public void setMessageHandler(ReceivedMessageHandler handler) { + this.handler = handler; + } + + private class PubSubListener extends JedisPubSub { + + public PubSubListener() { + super(); + } + + @Override + public void onMessage(String channel, String message) { + // Not used. + } + + @Override + public void onPMessage(String pattern, String channel, String message) { + handler.handleMessage(pattern, channel, message); + } + + @Override + public void onPSubscribe(String pattern, int subscribedChannels) { +// log.debug("Subscribed to the pattern: " + pattern); + } + + @Override + public void onPUnsubscribe(String pattern, int subscribedChannels) { + // Not used. + } + + @Override + public void onSubscribe(String channel, int subscribedChannels) { + // Not used. + } + + @Override + public void onUnsubscribe(String channel, int subscribedChannels) { + // Not used. + } + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java new file mode 100755 index 0000000000..477c1165fa --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java @@ -0,0 +1,70 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class MessageSender { + private JedisPool redisPool; + private volatile boolean sendMessage = false; + + private final Executor msgSenderExec = Executors.newSingleThreadExecutor(); + private final Executor runExec = Executors.newSingleThreadExecutor(); + private BlockingQueue messages = new LinkedBlockingQueue(); + + public void stop() { + sendMessage = false; + } + + public void start() { +// log.info("Redis message publisher starting!"); + try { + sendMessage = true; + + Runnable messageSender = new Runnable() { + public void run() { + while (sendMessage) { + try { + MessageToSend msg = messages.take(); + publish(msg.getChannel(), msg.getMessage()); + } catch (InterruptedException e) { +// log.warn("Failed to get message from queue."); + } + } + } + }; + msgSenderExec.execute(messageSender); + } catch (Exception e) { +// log.error("Error subscribing to channels: " + e.getMessage()); + } + } + + public void send(String channel, String message) { + MessageToSend msg = new MessageToSend(channel, message); + messages.add(msg); + } + + private void publish(final String channel, final String message) { + Runnable task = new Runnable() { + public void run() { + Jedis jedis = redisPool.getResource(); + try { + jedis.publish(channel, message); + } catch(Exception e){ +// log.warn("Cannot publish the message to redis", e); + } finally { + redisPool.returnResource(jedis); + } + } + }; + + runExec.execute(task); + } + + public void setRedisPool(JedisPool redisPool){ + this.redisPool = redisPool; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java new file mode 100755 index 0000000000..e01dfc84e1 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java @@ -0,0 +1,19 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +public class MessageToSend { + private final String channel; + private final String message; + + public MessageToSend(String channel, String message) { + this.channel = channel; + this.message = message; + } + + public String getChannel() { + return channel; + } + + public String getMessage() { + return message; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java new file mode 100755 index 0000000000..9319407276 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java @@ -0,0 +1,28 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +public class ReceivedMessage { + + private final String pattern; + private final String channel; + private final String message; + + public ReceivedMessage(String pattern, String channel, String message) { + this.pattern = pattern; + this.channel = channel; + this.message = message; + } + + public String getPattern() { + return pattern; + } + + public String getChannel() { + return channel; + } + + public String getMessage() { + return message; + } + + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java new file mode 100755 index 0000000000..6350be0fc9 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java @@ -0,0 +1,68 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; + +public class ReceivedMessageHandler { + + private BlockingQueue receivedMessages = new LinkedBlockingQueue(); + + private volatile boolean processMessage = false; + + private final Executor msgProcessorExec = Executors.newSingleThreadExecutor(); + private final Executor runExec = Executors.newSingleThreadExecutor(); + + private MessageDistributor handler; + + public void stop() { + processMessage = false; + } + + public void start() { +// log.info("Ready to handle messages from Redis pubsub!"); + + try { + processMessage = true; + + Runnable messageProcessor = new Runnable() { + public void run() { + while (processMessage) { + try { + ReceivedMessage msg = receivedMessages.take(); + processMessage(msg); + } catch (InterruptedException e) { +// log.warn("Error while taking received message from queue."); + } + } + } + }; + msgProcessorExec.execute(messageProcessor); + } catch (Exception e) { +// log.error("Error subscribing to channels: " + e.getMessage()); + } + } + + private void processMessage(final ReceivedMessage msg) { + Runnable task = new Runnable() { + public void run() { + if (handler != null) { + handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage()); + } else { +// log.info("No listeners interested in messages from Redis!"); + } + } + }; + runExec.execute(task); + } + + public void handleMessage(String pattern, String channel, String message) { + ReceivedMessage rm = new ReceivedMessage(pattern, channel, message); + receivedMessages.add(rm); + } + + public void setMessageDistributor(MessageDistributor h) { + this.handler = h; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java new file mode 100755 index 0000000000..c808b00502 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java @@ -0,0 +1,56 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.presentation; + +public class ConversionUpdatesProcessor { + +// private PresentationApplication presentationApplication; + + public void sendConversionUpdate(String messageKey, String conference, + String code, String presId, String presName) { +// presentationApplication.sendConversionUpdate(messageKey, conference, +// code, presId, presName); + } + + public void sendPageCountError(String messageKey, String conference, + String code, String presId, int numberOfPages, + int maxNumberPages, String presName) { +// presentationApplication.sendPageCountError(messageKey, conference, +// code, presId, numberOfPages, +// maxNumberPages, presName); + } + + public void sendSlideGenerated(String messageKey, String conference, + String code, String presId, int numberOfPages, + int pagesCompleted, String presName) { +// presentationApplication.sendSlideGenerated(messageKey, conference, +// code, presId, numberOfPages, pagesCompleted, presName); + } + + public void sendConversionCompleted(String messageKey, String conference, + String code, String presId, Integer numberOfPages, String presName, + String presBaseUrl) { +// presentationApplication.sendConversionCompleted(messageKey, conference, +// code, presId, numberOfPages, presName, presBaseUrl); + } + +// public void setPresentationApplication(PresentationApplication a) { +// presentationApplication = a; +// } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java new file mode 100755 index 0000000000..457bb69895 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java @@ -0,0 +1,147 @@ +package org.bigbluebutton.conference.service.presentation; + +import java.util.HashMap; +import java.util.Map; +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +public class PresentationMessageListener implements MessageHandler { + + public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS"; + public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED"; + public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT"; + public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT"; + public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED"; + public static final String PAGE_COUNT_EXCEEDED_KEY = "PAGE_COUNT_EXCEEDED"; + public static final String GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; + public static final String GENERATING_THUMBNAIL_KEY = "GENERATING_THUMBNAIL"; + public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL"; + public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; + + private ConversionUpdatesProcessor conversionUpdatesProcessor; + private IBigBlueButtonInGW bbbInGW; + + public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) { + conversionUpdatesProcessor = p; + } + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } + + private void sendConversionUpdate(String messageKey, String conference, + String code, String presId, String filename) { + + conversionUpdatesProcessor.sendConversionUpdate(messageKey, conference, + code, presId, filename); + } + + public void sendPageCountError(String messageKey, String conference, + String code, String presId, Integer numberOfPages, + Integer maxNumberPages, String filename) { + + conversionUpdatesProcessor.sendPageCountError(messageKey, conference, + code, presId, numberOfPages, + maxNumberPages, filename); + } + + private void sendSlideGenerated(String messageKey, String conference, + String code, String presId, Integer numberOfPages, + Integer pagesCompleted, String filename) { + + conversionUpdatesProcessor.sendSlideGenerated(messageKey, conference, + code, presId, numberOfPages, + pagesCompleted, filename); + } + + private void sendConversionCompleted(String messageKey, String conference, + String code, String presId, Integer numberOfPages, + String filename, String presBaseUrl) { + + conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference, + code, presId, numberOfPages, filename, presBaseUrl); + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + + if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) { + + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if(obj.has("payload") && obj.has("header")) { + + JsonObject headerObject = (JsonObject) obj.get("header"); + JsonObject payloadObject = (JsonObject) obj.get("payload"); + + String eventName = headerObject.get("name").toString().replace("\"", ""); + + if(eventName.equalsIgnoreCase("presentation_page_changed_message") || + eventName.equalsIgnoreCase("presentation_page_resized_message")) { + + JsonObject pageObject = (JsonObject) payloadObject.get("page"); + String roomName = payloadObject.get("meeting_id").toString().replace("\"", ""); + + if(eventName.equalsIgnoreCase("presentation_page_changed_message")) { + String pageId = pageObject.get("id").toString().replace("\"", ""); + bbbInGW.gotoSlide(roomName, pageId); + } else if(eventName.equalsIgnoreCase("presentation_page_resized_message")) { + String xOffset = pageObject.get("x_offset").toString().replace("\"", ""); + String yOffset = pageObject.get("y_offset").toString().replace("\"", ""); + String widthRatio = pageObject.get("width_ratio").toString().replace("\"", ""); + String heightRatio = pageObject.get("height_ratio").toString().replace("\"", ""); + bbbInGW.resizeAndMoveSlide(roomName, Double.parseDouble(xOffset), Double.parseDouble(yOffset), Double.parseDouble(widthRatio), Double.parseDouble(heightRatio)); + } + } + } + else { + Gson gson = new Gson(); + HashMap map = gson.fromJson(message, new TypeToken>() {}.getType()); + + String code = (String) map.get("returnCode"); + String presId = (String) map.get("presentationId"); + String filename = (String) map.get("filename"); + String conference = (String) map.get("conference"); + String messageKey = (String) map.get("messageKey"); + + if (messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_SUCCESS_KEY) || + messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_FAILED_KEY) || + messageKey.equalsIgnoreCase(SUPPORTED_DOCUMENT_KEY) || + messageKey.equalsIgnoreCase(UNSUPPORTED_DOCUMENT_KEY) || + messageKey.equalsIgnoreCase(GENERATING_THUMBNAIL_KEY) || + messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY) || + messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){ + + sendConversionUpdate(messageKey, conference, code, presId, filename); + + } else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + Integer maxNumberPages = new Integer((String) map.get("maxNumberPages")); + + sendPageCountError(messageKey, conference, code, + presId, numberOfPages, maxNumberPages, filename); + + } else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + Integer pagesCompleted = new Integer((String) map.get("pagesCompleted")); + + sendSlideGenerated(messageKey, conference, code, + presId, numberOfPages, pagesCompleted, filename); + + } else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + String presBaseUrl = (String) map.get("presentationBaseUrl"); + + sendConversionCompleted(messageKey, conference, code, + presId, numberOfPages, filename, presBaseUrl); + } + } + } + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java new file mode 100755 index 0000000000..0c05f23f20 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.presentation; + +public class PreuploadedPresentation { + + public final String id; + public final int numPages; + + public PreuploadedPresentation(String id, int numPages) { + this.id = id; + this.numPages = numPages; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java new file mode 100644 index 0000000000..94266c37f1 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java @@ -0,0 +1,55 @@ +package org.bigbluebutton.conference.service.presentation; + +import java.io.File; +import java.io.FileFilter; +import java.io.FilenameFilter; +import java.util.ArrayList; + +public class PreuploadedPresentationsUtil { + + private String bbbDir = "/var/bigbluebutton/"; + + public ArrayList getPreuploadedPresentations(String meetingID) { + ArrayList preuploadedPresentations = new ArrayList(); + + try { + // TODO: this is hard-coded, and not really a great abstraction. need to fix this up later + String folderPath = bbbDir + meetingID + "/" + meetingID; + File folder = new File(folderPath); + //log.debug("folder: {} - exists: {} - isDir: {}", folder.getAbsolutePath(), folder.exists(), folder.isDirectory()); + if (folder.exists() && folder.isDirectory()) { + File[] presentations = folder.listFiles(new FileFilter() { + public boolean accept(File path) { + return path.isDirectory(); + } + }); + for (File presFile : presentations) { + int numPages = getNumPages(presFile); + PreuploadedPresentation p = new PreuploadedPresentation(presFile.getName(), numPages); + preuploadedPresentations.add(p); + } + } + } catch (Exception ex) { + + } + + return preuploadedPresentations; + } + + private int getNumPages(File presDir) { + File[] files = presDir.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.toLowerCase().endsWith(".swf"); + } + }); + + return files.length; + } + + public void setBigBlueButtonDirectory(String dir) { + if (dir.endsWith("/")) bbbDir = dir; + else bbbDir = dir + "/"; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java new file mode 100755 index 0000000000..416b341293 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java @@ -0,0 +1,142 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import org.apache.commons.pool.impl.GenericObjectPool; + +public class GenericObjectPoolConfigWrapper { + + private final GenericObjectPool.Config config; + + public GenericObjectPoolConfigWrapper() { + this.config = new GenericObjectPool.Config(); + } + + public GenericObjectPool.Config getConfig() { + return config; + } + + public int getMaxIdle() { + return this.config.maxIdle; + } + + public void setMaxIdle(int maxIdle) { + this.config.maxIdle = maxIdle; + } + + public int getMinIdle() { + return this.config.minIdle; + } + + public void setMinIdle(int minIdle) { + this.config.minIdle = minIdle; + } + + public int getMaxActive() { + return this.config.maxActive; + } + + public void setMaxActive(int maxActive) { + this.config.maxActive = maxActive; + } + + public long getMaxWait() { + return this.config.maxWait; + } + + public void setMaxWait(long maxWait) { + this.config.maxWait = maxWait; + } + + public byte getWhenExhaustedAction() { + return this.config.whenExhaustedAction; + } + + public void setWhenExhaustedAction(byte whenExhaustedAction) { + this.config.whenExhaustedAction = whenExhaustedAction; + } + + public boolean isTestOnBorrow() { + return this.config.testOnBorrow; + } + + public void setTestOnBorrow(boolean testOnBorrow) { + this.config.testOnBorrow = testOnBorrow; + } + + public boolean isTestOnReturn() { + return this.config.testOnReturn; + } + + public void setTestOnReturn(boolean testOnReturn) { + this.config.testOnReturn = testOnReturn; + } + + public boolean isTestWhileIdle() { + return this.config.testWhileIdle; + } + + public void setTestWhileIdle(boolean testWhileIdle) { + this.config.testWhileIdle = testWhileIdle; + } + + public long getTimeBetweenEvictionRunsMillis() { + return this.config.timeBetweenEvictionRunsMillis; + } + + public void setTimeBetweenEvictionRunsMillis( + long timeBetweenEvictionRunsMillis) { + this.config.timeBetweenEvictionRunsMillis = + timeBetweenEvictionRunsMillis; + } + + public int getNumTestsPerEvictionRun() { + return this.config.numTestsPerEvictionRun; + } + + public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { + this.config.numTestsPerEvictionRun = numTestsPerEvictionRun; + } + + public long getMinEvictableIdleTimeMillis() { + return this.config.minEvictableIdleTimeMillis; + } + + public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { + this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public long getSoftMinEvictableIdleTimeMillis() { + return this.config.softMinEvictableIdleTimeMillis; + } + + public void setSoftMinEvictableIdleTimeMillis( + long softMinEvictableIdleTimeMillis) { + this.config.softMinEvictableIdleTimeMillis = + softMinEvictableIdleTimeMillis; + } + + public boolean isLifo() { + return this.config.lifo; + } + + public void setLifo(boolean lifo) { + this.config.lifo = lifo; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java new file mode 100755 index 0000000000..a8cf016b6e --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java @@ -0,0 +1,85 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import java.util.HashMap; + +/** + * Abstract class for all events that need to be recorded. + * @author Richard Alam + * + */ +public abstract class RecordEvent { + protected final HashMap eventMap = new HashMap(); + + protected final static String MODULE = "module"; + protected final static String TIMESTAMP = "timestamp"; + protected final static String MEETING = "meetingId"; + protected final static String EVENT = "eventName"; + + public final String getMeetingID() { + return eventMap.get(MEETING); + } + + /** + * Set the module that generated the event. + * @param module + */ + public final void setModule(String module) { + eventMap.put(MODULE, module); + } + + /** + * Set the timestamp of the event. + * @param timestamp + */ + public final void setTimestamp(long timestamp) { + eventMap.put(TIMESTAMP, Long.toString(timestamp)); + } + + /** + * Set the meetingId for this particular event. + * @param meetingId + */ + public final void setMeetingId(String meetingId) { + eventMap.put(MEETING, meetingId); + } + + /** + * Set the name of the event. + * @param event + */ + public final void setEvent(String event) { + eventMap.put(EVENT, event); + } + + + /** + * Convert the event into a Map to be recorded. + * @return + */ + public final HashMap toMap() { + return eventMap; + } + + @Override + public String toString() { + return eventMap.get(MODULE) + " " + eventMap.get(EVENT); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java new file mode 100755 index 0000000000..f5a24578ba --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +/** + * + * The IRecorder interface define all the neccesary methods to implement for + * dispatch events to a JMS queue + * + * */ +public interface Recorder { + /** + * Receive the messages from the bigbluebutton modules and send + * them to a queue. These messages are the events generated in a conference. + * @param message a JSON String message with the attributes of an event + */ + public void record(String session, RecordEvent event); + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java new file mode 100755 index 0000000000..b645a0c0e6 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java @@ -0,0 +1,105 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import org.bigbluebutton.service.recording.RedisListRecorder; + + +/** + * + * The RecorderApplication class is used for setting the record module + * in BigBlueButton for send events messages to a JMS queue. + * The class follows the same standard as the others modules of BigBlueButton Apps. + */ +public class RecorderApplication { + + private static final int NTHREADS = 1; + private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); + + private BlockingQueue messages; + private volatile boolean recordEvents = false; + + private RedisListRecorder redisListRecorder; + + private Recorder recorder; + + public RecorderApplication() { + messages = new LinkedBlockingQueue(); + } + + public void start() { + recordEvents = true; + Runnable sender = new Runnable() { + public void run() { + while (recordEvents) { + RecordEvent message; + try { + message = messages.take(); + recordEvent(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + exec.execute(sender); + } + + public void stop() { + recordEvents = false; + } + + public void destroyRecordSession(String meetingID) { +// recordingSessions.remove(meetingID); + } + + public void createRecordSession(String meetingID) { +// recordingSessions.put(meetingID, meetingID); + } + + public void record(String meetingID, RecordEvent message) { + messages.offer(message); + } + + private void recordEvent(final RecordEvent message) { + Runnable task = new Runnable() { + public void run() { + recorder.record(message.getMeetingID(), message); + } + }; + runExec.execute(task); + } + + public void setRecorder(Recorder recorder) { + this.recorder = recorder; +// log.debug("setting recorder"); + } + + public void setRedisListRecorder(RedisListRecorder rec) { + redisListRecorder = rec; + } +} + diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java new file mode 100755 index 0000000000..fc268e6b3b --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java @@ -0,0 +1,53 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class RedisDispatcher implements Recorder { + private static final String COLON=":"; + JedisPool redisPool; + + public RedisDispatcher() { + super(); + } + + @Override + public void record(String session, RecordEvent message) { + Jedis jedis = redisPool.getResource(); + try { + Long msgid = jedis.incr("global:nextRecordedMsgId"); + jedis.hmset("recording" + COLON + session + COLON + msgid, message.toMap()); + jedis.rpush("meeting" + COLON + session + COLON + "recordings", msgid.toString()); + } finally { + redisPool.returnResource(jedis); + } + } + + public JedisPool getRedisPool() { + return redisPool; + } + + public void setRedisPool(JedisPool redisPool) { + this.redisPool = redisPool; + } + + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java new file mode 100755 index 0000000000..f07a52713c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.chat; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractChatRecordEvent extends RecordEvent { + + public AbstractChatRecordEvent() { + setModule("CHAT"); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java new file mode 100755 index 0000000000..d3db884a58 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java @@ -0,0 +1,43 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.chat; + + +public class PublicChatRecordEvent extends AbstractChatRecordEvent { + private static final String SENDER = "sender"; + private static final String MESSAGE = "message"; + private static final String COLOR = "color"; + + public PublicChatRecordEvent() { + super(); + setEvent("PublicChatEvent"); + } + + public void setSender(String sender) { + eventMap.put(SENDER, sender); + } + + public void setMessage(String message) { + eventMap.put(MESSAGE, message); + } + + public void setColor(String color) { + eventMap.put(COLOR, color); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java new file mode 100755 index 0000000000..48c735b0a4 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractParticipantRecordEvent extends RecordEvent { + + public AbstractParticipantRecordEvent() { + setModule("PARTICIPANT"); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java new file mode 100755 index 0000000000..f23c441914 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java @@ -0,0 +1,39 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent { + + public AssignPresenterRecordEvent() { + super(); + setEvent("AssignPresenterEvent"); + } + + public void setUserId(String userid) { + eventMap.put("userid", userid); + } + + public void setName(String name) { + eventMap.put("name", name); + } + + public void setAssignedBy(String by) { + eventMap.put("assignedBy", by); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java new file mode 100755 index 0000000000..46de9dd422 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantEndAndKickAllRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantEndAndKickAllRecordEvent() { + super(); + setEvent("EndAndKickAllEvent"); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java new file mode 100755 index 0000000000..fe22c8c7d2 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java @@ -0,0 +1,47 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantJoinRecordEvent() { + super(); + setEvent("ParticipantJoinEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + + public void setName(String name){ + eventMap.put("name",name); + } + + /** + * Sets the role of the user as MODERATOR or VIEWER + * @param role + */ + public void setRole(String role) { + eventMap.put("role", role); + } + + public void setStatus(String status) { + eventMap.put("status", status); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java new file mode 100755 index 0000000000..90812dd22d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantLeftRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantLeftRecordEvent() { + super(); + setEvent("ParticipantLeftEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java new file mode 100755 index 0000000000..e8c6e9048b --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java @@ -0,0 +1,39 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantStatusChangeRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantStatusChangeRecordEvent() { + super(); + setEvent("ParticipantStatusChangeEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + + public void setStatus(String status) { + eventMap.put("status", status); + } + + public void setValue(String value) { + eventMap.put("value", value); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java new file mode 100644 index 0000000000..a00e60fafc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class RecordStatusRecordEvent extends AbstractParticipantRecordEvent { + + public RecordStatusRecordEvent() { + super(); + setEvent("RecordStatusEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + + public void setRecordingStatus(String status) { + eventMap.put("status", status); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java new file mode 100755 index 0000000000..b95e18e37a --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java @@ -0,0 +1,29 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractPollRecordEvent extends RecordEvent { + + public AbstractPollRecordEvent() { + setModule("POLL"); + } +} + diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java new file mode 100755 index 0000000000..3eb9b25730 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollClearedRecordEvent extends AbstractPollRecordEvent { + + private static final String POLL_ID = "pollID"; + + public PollClearedRecordEvent(){ + super(); + setEvent("PollClearedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java new file mode 100755 index 0000000000..d1003abdef --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java @@ -0,0 +1,66 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollCreatedRecordEvent extends AbstractPollRecordEvent { + + private static final String POLL_ID = "pollID"; + private static final String TITLE = "title"; + + private static final String QUESTION_PATTERN = "question"; + private static final String QUESTION_TEXT = "text"; + private static final String QUESTION_MULTIRESPONSE = "multiresponse"; + + private static final String RESPONSE_PATTERN = "response"; + private static final String RESPONSE_TEXT = "text"; + + private static final String RESPONDER_PATTERN = "responder"; + private static final String RESPONDER_USER = "user"; + + private static final String SEPARATOR = "-"; + + + public PollCreatedRecordEvent() { + super(); + setEvent("PollCreatedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + + public void setTitle(String title) { + eventMap.put(TITLE, title); + } + + public void addQuestion(String id, String question, Boolean multiresponse) { + eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question); + eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString()); + } + + public void addResponse(String questionID, String responseID, String response) { + eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); + } + + /*public void addResponder(String questionID, String responseID, String responderID, String userID) { + eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); + }*/ + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java new file mode 100755 index 0000000000..2b4b445d34 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java @@ -0,0 +1,37 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollRemovedRecordEvent extends AbstractPollRecordEvent { + + private static final String POLL_ID = "pollID"; + + public PollRemovedRecordEvent(){ + super(); + setEvent("PollRemovedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + +} + + diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java new file mode 100755 index 0000000000..b86592ee5a --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollStartedRecordEvent extends AbstractPollRecordEvent { + + private static final String POLL_ID = "pollID"; + + public PollStartedRecordEvent(){ + super(); + setEvent("PollStartedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java new file mode 100755 index 0000000000..efe04ba4de --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollStoppedRecordEvent extends AbstractPollRecordEvent { + + private static final String POLL_ID = "pollID"; + + public PollStoppedRecordEvent(){ + super(); + setEvent("PollStoppedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java new file mode 100755 index 0000000000..f26b1eef8e --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java @@ -0,0 +1,60 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.polling; + + +public class PollUpdatedRecordEvent extends AbstractPollRecordEvent { + private static final String POLL_ID = "pollID"; + private static final String TITLE = "title"; + + private static final String QUESTION_PATTERN = "question"; + private static final String QUESTION_TEXT = "text"; + private static final String QUESTION_MULTIRESPONSE = "multiresponse"; + + private static final String RESPONSE_PATTERN = "response"; + private static final String RESPONSE_TEXT = "text"; + + private static final String RESPONDER_PATTERN = "responder"; + private static final String RESPONDER_USER = "user"; + + private static final String SEPARATOR = "-"; + + public PollUpdatedRecordEvent(){ + super(); + setEvent("PollUpdatedEvent"); + } + + public void setPollID(String pollID) { + eventMap.put(POLL_ID, pollID); + } + + public void setTitle(String title) { + eventMap.put(TITLE, title); + } + + public void addQuestion(String id, String question, Boolean multiresponse) { + eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question); + eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString()); + } + + public void addResponse(String questionID, String responseID, String response) { + eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java new file mode 100755 index 0000000000..fc26c2243e --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractPresentationRecordEvent extends RecordEvent { + + public AbstractPresentationRecordEvent() { + setModule("PRESENTATION"); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java new file mode 100755 index 0000000000..a134d7e4c1 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class ConversionCompletedPresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public ConversionCompletedPresentationRecordEvent() { + super(); + setEvent("ConversionCompletedEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + + public void setOriginalFilename(String name) { + eventMap.put("originalFilename", name); + } + + public void setSlidesInfo(String slidesInfo) { + eventMap.put("slidesInfo", slidesInfo); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java new file mode 100755 index 0000000000..9964bbf617 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java @@ -0,0 +1,36 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class CursorUpdateRecordEvent extends AbstractPresentationRecordEvent{ + + public CursorUpdateRecordEvent() { + super(); + setEvent("CursorMoveEvent"); + } + + public void setXPercent(double percent) { + eventMap.put("xOffset", Double.toString(percent)); + } + + public void setYPercent(double percent) { + eventMap.put("yOffset", Double.toString(percent)); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java new file mode 100755 index 0000000000..171fdb9a09 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class GenerateSlidePresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public GenerateSlidePresentationRecordEvent() { + super(); + setEvent("GenerateSlideEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + + public void setNumberOfPages(int numPages) { + eventMap.put("numberOfPages", Integer.toString(numPages)); + } + + public void setPagesCompleted(int pagesCompleted) { + eventMap.put("pagesCompleted", Integer.toString(pagesCompleted)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java new file mode 100644 index 0000000000..a58f2d3b1a --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java @@ -0,0 +1,81 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class GotoSlidePresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public GotoSlidePresentationRecordEvent() { + super(); + setEvent("GotoSlideEvent"); + } + + public void setSlide(int slide) { + /** + * Subtract 1 from the page number to be zero-based to be + * compatible with 0.81 and earlier. (ralam Sept 2, 2014) + */ + eventMap.put("slide", Integer.toString(slide - 1)); + } + + public void setId(String id) { + eventMap.put("id", id); + } + + public void setNum(int num) { + + eventMap.put("num", Integer.toString(num)); + } + + public void setCurrent(boolean current) { + eventMap.put("current", Boolean.toString(current)); + } + + public void setThumbUri(String thumbUri) { + eventMap.put("thumbUri", thumbUri); + } + + public void setSwfUri(String swfUri) { + eventMap.put("swfUri", swfUri); + } + + public void setTxtUri(String txtUri) { + eventMap.put("txtUri", txtUri); + } + + public void setPngUri(String pngUri) { + eventMap.put("pngUri", pngUri); + } + + public void setXOffset(double offset) { + eventMap.put("xOffset", Double.toString(offset)); + } + + public void setYOffset(double offset) { + eventMap.put("yOffset", Double.toString(offset)); + } + + public void setWidthRatio(double ratio) { + eventMap.put("widthRatio", Double.toString(ratio)); + } + + public void setHeightRatio(double ratio) { + eventMap.put("heightRatio", Double.toString(ratio)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java new file mode 100755 index 0000000000..01d371cc7d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class RemovePresentationPresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public RemovePresentationPresentationRecordEvent() { + super(); + setEvent("RemovePresentationEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java new file mode 100644 index 0000000000..bf55a97ce2 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java @@ -0,0 +1,72 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class ResizeAndMoveSlidePresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public ResizeAndMoveSlidePresentationRecordEvent() { + super(); + setEvent("ResizeAndMoveSlideEvent"); + } + + public void setId(String id) { + eventMap.put("id", id); + } + + public void setNum(int num) { + eventMap.put("num", Integer.toString(num)); + } + + public void setCurrent(boolean current) { + eventMap.put("current", Boolean.toString(current)); + } + + public void setThumbUri(String thumbUri) { + eventMap.put("thumbUri", thumbUri); + } + + public void setSwfUri(String swfUri) { + eventMap.put("swfUri", swfUri); + } + + public void setTxtUri(String txtUri) { + eventMap.put("txtUri", txtUri); + } + + public void setPngUri(String pngUri) { + eventMap.put("pngUri", pngUri); + } + + public void setXOffset(double offset) { + eventMap.put("xOffset", Double.toString(offset)); + } + + public void setYOffset(double offset) { + eventMap.put("yOffset", Double.toString(offset)); + } + + public void setWidthRatio(double ratio) { + eventMap.put("widthRatio", Double.toString(ratio)); + } + + public void setHeightRatio(double ratio) { + eventMap.put("heightRatio", Double.toString(ratio)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java new file mode 100755 index 0000000000..0efd6273fc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class SharePresentationPresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public SharePresentationPresentationRecordEvent() { + super(); + setEvent("SharePresentationEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + + public void setOriginalFilename(String name) { + eventMap.put("originalFilename", name); + } + + public void setShare(boolean share) { + eventMap.put("share", Boolean.toString(share)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java new file mode 100644 index 0000000000..9bc1fd75bc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.conference.service.voice; + +public class VoiceKeyUtil { + public static final String MUTE = "mute"; + public static final String USERID = "userId"; +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java new file mode 100644 index 0000000000..35be1ab2f4 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java @@ -0,0 +1,50 @@ +package org.bigbluebutton.conference.service.voice; + +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class VoiceMessageListener implements MessageHandler{ + + private IBigBlueButtonInGW bbbGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_VOICE_CHANNEL)) { + + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + JsonObject headerObject = (JsonObject) obj.get("header"); + JsonObject payloadObject = (JsonObject) obj.get("payload"); + + String eventName = headerObject.get("name").toString().replace("\"", ""); + + if (eventName.equalsIgnoreCase(MessagingConstants.MUTE_USER_REQUEST)){ + + String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); + String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); + String userID = payloadObject.get("userid").toString().replace("\"", ""); + String muteString = payloadObject.get(VoiceKeyUtil.MUTE).toString().replace("\"", ""); + Boolean mute = Boolean.valueOf(muteString); + + System.out.println("handling mute_user_request"); + bbbGW.muteUser(meetingID, requesterID, userID, mute); + } + else if (eventName.equalsIgnoreCase(MessagingConstants.USER_LEFT_VOICE_REQUEST)){ + + String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); + String userID = payloadObject.get("userid").toString().replace("\"", ""); + + System.out.println("handling user_left_voice_request"); + bbbGW.voiceUserLeft(meetingID, userID); + } + } + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java new file mode 100755 index 0000000000..7d635ba285 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java @@ -0,0 +1,16 @@ +package org.bigbluebutton.conference.service.whiteboard; + +public class WhiteboardKeyUtil { + + public static final String TEXT_TYPE = "text"; + public static final String PENCIL_TYPE = "pencil"; + public static final String RECTANGLE_TYPE = "rectangle"; + public static final String ELLIPSE_TYPE = "ellipse"; + public static final String TRIANGLE_TYPE = "triangle"; + public static final String LINE_TYPE = "line"; + + public static final String TEXT_CREATED_STATUS = "textCreated"; + public static final String DRAW_START_STATUS = "DRAW_START"; + public static final String DRAW_END_STATUS = "DRAW_END"; + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java new file mode 100644 index 0000000000..8f80bdb8bd --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java @@ -0,0 +1,51 @@ + +package org.bigbluebutton.conference.service.whiteboard; + + +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; + +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +public class WhiteboardListener implements MessageHandler{ + + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) { + this.bbbInGW = bbbInGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_WHITEBOARD_CHANNEL)) { + + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + JsonObject headerObject = (JsonObject) obj.get("header"); + JsonObject payloadObject = (JsonObject) obj.get("payload"); + + String eventName = headerObject.get("name").toString().replace("\"", ""); + + if(eventName.equalsIgnoreCase("get_whiteboard_shapes_request")){ + //more cases to follow + + String roomName = payloadObject.get("meeting_id").toString().replace("\"", ""); + + if(eventName.equalsIgnoreCase("get_whiteboard_shapes_request")){ + String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); + if(payloadObject.get("whiteboard_id") != null){ + String whiteboardID = payloadObject.get("whiteboard_id").toString().replace("\"", ""); + System.out.println("\n FOUND A whiteboardID:" + whiteboardID + "\n"); + bbbInGW.requestWhiteboardAnnotationHistory(roomName, requesterID, whiteboardID, requesterID); + } + else { + System.out.println("\n DID NOT FIND A whiteboardID \n"); + } + System.out.println("\n user<" + requesterID + "> requested the shapes.\n"); + } + } + } + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java new file mode 100644 index 0000000000..aed2b1c94b --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java @@ -0,0 +1,46 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractWhiteboardRecordEvent extends RecordEvent { + + public AbstractWhiteboardRecordEvent() { + setModule("WHITEBOARD"); + } + + public void setPresentation(String name) { + eventMap.put("presentation", name); + } + + public void setPageNumber(String page) { + /** + * Subtract 1 from the page number to be zero-based to be + * compatible with 0.81 and earlier. (ralam Sept 2, 2014) + */ + Integer num = new Integer(page); +// System.out.println("WB Page Number real pagenum=[" + num + "] rec pagenum=[" + (num - 1) + "]"); + eventMap.put("pageNumber", new Integer(num - 1).toString()); + } + + public void setWhiteboardId(String id) { + eventMap.put("whiteboardId", id); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java new file mode 100755 index 0000000000..fa667798c6 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java @@ -0,0 +1,69 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import java.util.ArrayList; +import java.util.Map; + +public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { + + public AddShapeWhiteboardRecordEvent() { + super(); + setEvent("AddShapeEvent"); + } + + public void addAnnotation(Map annotation) { + for (Map.Entry entry : annotation.entrySet()) { + String key = entry.getKey(); + + if (key.equals("points")) { + eventMap.put("dataPoints", pointsToString((ArrayList)entry.getValue())); + } else { + Object value = entry.getValue(); + eventMap.put(key, value.toString()); + } + } + } + + private String pointsToString(ArrayList points){ + String datapoints = ""; + for (int i = 0; i < points.size(); i++) { + datapoints += (points.get(i)).toString() + ","; + } + // Trim the trailing comma + return datapoints.substring(0, datapoints.length() - 1); + } + + public void setFillColor(int fillColor) { + eventMap.put("fillColor", Integer.toString(fillColor)); + } + + public void setThickness(int thickness) { + eventMap.put("thickness", Integer.toString(thickness)); + } + + public void setFill(boolean fill) { + eventMap.put("fill", Boolean.toString(fill)); + } + + public void setTransparent(boolean transparent) { + eventMap.put("transparent", Boolean.toString(transparent)); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java new file mode 100755 index 0000000000..fc3c0b4fcf --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java @@ -0,0 +1,54 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import java.util.ArrayList; +import java.util.Map; + +public class AddTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { + + public AddTextWhiteboardRecordEvent() { + super(); + setEvent("AddTextEvent"); + } + + public void addAnnotation(Map annotation) { + for (Map.Entry entry : annotation.entrySet()) { + String key = entry.getKey(); + + if (key.equals("points")) { + ArrayList value = (ArrayList)entry.getValue(); + eventMap.put("dataPoints", pointsToString(value)); + } else { + Object value = entry.getValue(); + eventMap.put(key, value.toString()); + } + } + } + + private String pointsToString(ArrayList points){ + String datapoints = ""; + for (Double i : points) { + datapoints += i + ","; + } + // Trim the trailing comma + return datapoints.substring(0, datapoints.length() - 1); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java new file mode 100755 index 0000000000..583d374470 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +public class ClearPageWhiteboardRecordEvent extends + AbstractWhiteboardRecordEvent { + + public ClearPageWhiteboardRecordEvent() { + super(); + setEvent("ClearPageEvent"); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java new file mode 100755 index 0000000000..ca6f398f3b --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java @@ -0,0 +1,53 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import java.util.ArrayList; +import java.util.Map; + +public class ModifyTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { + + public ModifyTextWhiteboardRecordEvent() { + super(); + setEvent("ModifyTextEvent"); + } + + public void addAnnotation(Map annotation) { + for (Map.Entry entry : annotation.entrySet()) { + String key = entry.getKey(); + + if (key.equals("points")) { + ArrayList value = (ArrayList)entry.getValue(); + eventMap.put("dataPoints", pointsToString(value)); + } else { + Object value = entry.getValue(); + eventMap.put(key, value.toString()); + } + } + } + + private String pointsToString(ArrayList points){ + String datapoints = ""; + for (Double i : points) { + datapoints += i + ","; + } + // Trim the trailing comma + return datapoints.substring(0, datapoints.length() - 1); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java new file mode 100755 index 0000000000..1b68d43f7a --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +public class ToggleGridWhiteboardRecordEvent extends + AbstractWhiteboardRecordEvent { + + public ToggleGridWhiteboardRecordEvent() { + super(); + setEvent("ToggleGridEvent"); + } + + public void setGridEnabled(boolean enabled) { + eventMap.put("gridEnabled", Boolean.toString(enabled)); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java new file mode 100755 index 0000000000..0d9cbd4ef6 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +public class UndoShapeWhiteboardRecordEvent extends + AbstractWhiteboardRecordEvent { + + public UndoShapeWhiteboardRecordEvent() { + super(); + setEvent("UndoShapeEvent"); + } + + public void setShapeId(String id) { + eventMap.put("shapeId", id); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java new file mode 100755 index 0000000000..8dd2dbb26c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -0,0 +1,119 @@ +package org.bigbluebutton.core.api; + +import java.util.Map; + + +public interface IBigBlueButtonInGW { + + void isAliveAudit(String aliveID); + void statusMeetingAudit(String meetingID); + void endMeeting(String meetingID); + void endAllMeetings(); + void createMeeting2(String meetingID, String externalMeetingID, String meetingName, boolean recorded, + String voiceBridge, long duration, boolean autoStartRecording, + boolean allowStartStopRecording, String moderatorPass, String viewerPass, + long createTime, String createDate); + void destroyMeeting(String meetingID); + void getAllMeetings(String meetingID); + void lockSettings(String meetingID, Boolean locked, Map lockSettigs); + + + // Lock + void initLockSettings(String meetingID, Map settings); + void sendLockSettings(String meetingID, String userId, Map settings); + void getLockSettings(String meetingId, String userId); + void lockUser(String meetingId, String requesterID, boolean lock, String internalUserID); + + + // Users + void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId); + void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken); + void userRaiseHand(String meetingId, String userId); + void lowerHand(String meetingId, String userId, String loweredBy); + void shareWebcam(String meetingId, String userId, String stream); + void unshareWebcam(String meetingId, String userId, String stream); + void setUserStatus(String meetingID, String userID, String status, Object value); + void getUsers(String meetingID, String requesterID); + void userLeft(String meetingID, String userID, String sessionId); + void userJoin(String meetingID, String userID, String authToken); + void getCurrentPresenter(String meetingID, String requesterID); + void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy); + void setRecordingStatus(String meetingId, String userId, Boolean recording); + void getRecordingStatus(String meetingId, String userId); + void userConnectedToGlobalAudio(String voiceConf, String userid, String name); + void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name); + + // Voice + void initAudioSettings(String meetingID, String requesterID, Boolean muted); + void muteAllExceptPresenter(String meetingID, String requesterID, Boolean mute); + void muteAllUsers(String meetingID, String requesterID, Boolean mute); + void isMeetingMuted(String meetingID, String requesterID); + void muteUser(String meetingID, String requesterID, String userID, Boolean mute); + void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock); + void ejectUserFromVoice(String meetingID, String userId, String ejectedBy); + void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy); + void voiceUserJoined(String meetingId, String userId, String webUserId, String conference, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking); + void voiceUserLeft(String meetingId, String userId); + void voiceUserLocked(String meetingId, String userId, Boolean locked); + void voiceUserMuted(String meetingId, String userId, Boolean muted); + void voiceUserTalking(String meetingId, String userId, Boolean talking); + void voiceRecording(String meetingId, String recordingFile, + String timestamp, Boolean recording); + + // Presentation + void clear(String meetingID); + void removePresentation(String meetingID, String presentationID); + void getPresentationInfo(String meetingID, String requesterID, String replyTo); + void sendCursorUpdate(String meetingID, double xPercent, double yPercent); + void resizeAndMoveSlide(String meetingID, double xOffset, double yOffset, double widthRatio, double heightRatio); + void gotoSlide(String meetingID, String page); + void sharePresentation(String meetingID, String presentationID, boolean share); + void getSlideInfo(String meetingID, String requesterID, String replyTo); + + void sendConversionUpdate(String messageKey, String meetingId, + String code, String presId, String presName); + + void sendPageCountError(String messageKey, String meetingId, + String code, String presId, int numberOfPages, + int maxNumberPages, String presName); + + void sendSlideGenerated(String messageKey, String meetingId, + String code, String presId, int numberOfPages, + int pagesCompleted, String presName); + + void sendConversionCompleted(String messageKey, String meetingId, + String code, String presId, int numPages, String presName, String presBaseUrl); + + // Polling + void getPolls(String meetingID, String requesterID); + void createPoll(String meetingID, String requesterID, String msg); + void updatePoll(String meetingID, String requesterID, String msg); + void startPoll(String meetingID, String requesterID, String msg); + void stopPoll(String meetingID, String requesterID, String msg); + void removePoll(String meetingID, String requesterID, String msg); + void respondPoll(String meetingID, String requesterID, String msg); + void preCreatedPoll(String meetingID, String msg); + + // Layout + void getCurrentLayout(String meetingID, String requesterID); + void broadcastLayout(String meetingID, String requesterID, String layout); + void lockLayout(String meetingID, String setById, + boolean lock, boolean viewersOnly, + scala.Option layout); + + // Chat + void getChatHistory(String meetingID, String requesterID, String replyTo); + void sendPublicMessage(String meetingID, String requesterID, Map message); + void sendPrivateMessage(String meetingID, String requesterID, Map message); + + // Whiteboard + void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map annotation); + void requestWhiteboardAnnotationHistory(String meetingID, String requesterID, String whiteboardId, String replyTo); + void clearWhiteboard(String meetingID, String requesterID, String whiteboardId); + void undoWhiteboard(String meetingID, String requesterID, String whiteboardId); + void enableWhiteboard(String meetingID, String requesterID, Boolean enable); + void isWhiteboardEnabled(String meetingID, String requesterID, String replyTo); + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java new file mode 100755 index 0000000000..fa1b97c3c6 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.core.api; + +public interface IDispatcher { + + void dispatch(String jsonMessage); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java new file mode 100755 index 0000000000..94939235e2 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.api; + +public interface IOutMessage { + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java new file mode 100755 index 0000000000..93573a265e --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java @@ -0,0 +1,21 @@ +package org.bigbluebutton.core.api; + +import java.util.Set; + + +public class MessageOutGateway { + + private Set listeners; + + public void send(IOutMessage msg) { +// log.debug("before listeners send. check message:" + msg); + for (OutMessageListener2 l : listeners) { +// log.debug("listener " + l); + l.handleMessage(msg); + } + } + + public void setListeners(Set listeners) { + this.listeners = listeners; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java new file mode 100755 index 0000000000..ec6d099a45 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.core.api; + +public interface OutMessageListener2 { + + void handleMessage(IOutMessage msg); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java new file mode 100755 index 0000000000..68ed47975d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.core.api; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class RedisLpushDispatcher implements IDispatcher { + private static final int NTHREADS = 1; + private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); + + private static final String BBBMESSAGES = "bbb:meeting:messages"; + + private BlockingQueue messages; + private volatile boolean dispatchEvents = false; + + private JedisPool redisPool; + + public RedisLpushDispatcher() { + messages = new LinkedBlockingQueue(); + } + + @Override + public void dispatch(String jsonMessage) { + messages.offer(jsonMessage); + } + + private void saveMessage(String msg) { + Jedis jedis = redisPool.getResource(); + try { + jedis.lpush(BBBMESSAGES, msg); + } finally { + redisPool.returnResource(jedis); + } + } + + public void start() { + dispatchEvents = true; + Runnable sender = new Runnable() { + public void run() { + while (dispatchEvents) { + String message; + try { + message = messages.take(); + saveMessage(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + exec.execute(sender); + } + + public void stop() { + dispatchEvents = false; + } + + public void setRedisPool(JedisPool redisPool) { + this.redisPool = redisPool; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java new file mode 100755 index 0000000000..e8bf93bee4 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.service.recording; + +public class RecordMessage { + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java new file mode 100755 index 0000000000..80ca642a18 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java @@ -0,0 +1,73 @@ +package org.bigbluebutton.service.recording; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import org.bigbluebutton.conference.service.recorder.RecordEvent; +import com.google.gson.Gson; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class RedisListRecorder { + + private static final int NTHREADS = 1; + private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + private volatile boolean recordEvents = false; + + JedisPool redisPool; + + public void start() { + recordEvents = true; + Runnable sender = new Runnable() { + public void run() { + while (recordEvents) { + RecordEvent message; + try { + message = messages.take(); + recordEvent(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + exec.execute(sender); + } + + public void stop() { + recordEvents = false; + } + + private void recordEvent(final RecordEvent message) { + Runnable task = new Runnable() { + public void run() { + Jedis jedis = redisPool.getResource(); + try { + String key = "bbb:recording:" + message.getMeetingID(); + Gson gson= new Gson(); + jedis.rpush(key, gson.toJson(message.toMap())); + } finally { + redisPool.returnResource(jedis); + } + } + }; + runExec.execute(task); + } + + public void record(RecordEvent message) { + messages.offer(message); + } + + public JedisPool getRedisPool() { + return redisPool; + } + + public void setRedisPool(JedisPool redisPool) { + this.redisPool = redisPool; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java new file mode 100755 index 0000000000..9f03321ce0 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractVoiceRecordEvent extends RecordEvent { + + public AbstractVoiceRecordEvent() { + setModule("VOICE"); + } + + public void setBridge(String bridge) { + eventMap.put("bridge", bridge); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java new file mode 100755 index 0000000000..1e4616ef56 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java @@ -0,0 +1,26 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public interface ConferenceServerListener { + public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); + public void left(String room, Integer participant); + public void muted(String room, Integer participant, Boolean muted); + public void talking(String room, Integer participant, Boolean talking); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java new file mode 100755 index 0000000000..ffebb366ee --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public interface ConferenceServiceProvider { + public void populateRoom(String room); + public void mute(String room, String participant, Boolean mute); + public void eject(String room, String participant); + public void ejectAll(String room); + public void record(String room, String meetingid); + public void broadcast(String room, String meetingid); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java new file mode 100644 index 0000000000..f24a4de2e5 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java @@ -0,0 +1,115 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +public class FreeswitchConferenceEventListener implements ConferenceEventListener { + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + + private volatile boolean sendMessages = false; + private IVoiceConferenceService vcs; + + public void setVoiceConferenceService(IVoiceConferenceService vcs) { + this.vcs = vcs; + } + + private void queueMessage(VoiceConferenceEvent event) { + try { + messages.offer(event, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { + Runnable task = new Runnable() { + public void run() { + if (event instanceof VoiceUserJoinedEvent) { + System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); + VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; + vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), + evt.getCallerIdNum(), evt.getCallerIdName(), + evt.getMuted(), evt.getSpeaking()); + } else if (event instanceof VoiceUserLeftEvent) { + System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); + VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; + vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); + } else if (event instanceof VoiceUserMutedEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); + VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; + vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); + } else if (event instanceof VoiceUserTalkingEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); + VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; + vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); + } else if (event instanceof VoiceStartRecordingEvent) { + VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; + System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); + vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + VoiceConferenceEvent message; + try { + message = messages.take(); + sendMessageToBigBlueButton(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } + + public void handleConferenceEvent(VoiceConferenceEvent event) { + queueMessage(event); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java new file mode 100755 index 0000000000..f26f38b458 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java @@ -0,0 +1,13 @@ +package org.bigbluebutton.webconference.voice; + +public interface IVoiceConferenceService { + void voiceUserJoined(String userId, String webUserId, String conference, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking); + void voiceUserLeft(String meetingId, String userId); + void voiceUserLocked(String meetingId, String userId, Boolean locked); + void voiceUserMuted(String meetingId, String userId, Boolean muted); + void voiceUserTalking(String meetingId, String userId, Boolean talking); + void voiceStartedRecording(String conference, String recordingFile, + String timestamp, Boolean recording); +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java new file mode 100755 index 0000000000..7417a522af --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java @@ -0,0 +1,51 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantJoinedVoiceRecordEvent() { + super(); + setEvent("ParticipantJoinedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setCallerName(String name) { + eventMap.put("callername", name); + } + + public void setCallerNumber(String name) { + eventMap.put("callernumber", name); + } + + public void setMuted(boolean muted) { + eventMap.put("muted", Boolean.toString(muted)); + } + + public void setTalking(boolean talking) { + eventMap.put("talking", Boolean.toString(talking)); + } + + public void setLocked(boolean locked) { + eventMap.put("locked", Boolean.toString(locked)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java new file mode 100755 index 0000000000..0b3bfaa25c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java @@ -0,0 +1,31 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantLeftVoiceRecordEvent() { + super(); + setEvent("ParticipantLeftEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java new file mode 100755 index 0000000000..ff7be6cbd5 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantLockedVoiceRecordEvent() { + super(); + setEvent("ParticipantLockedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setLocked(boolean locked) { + eventMap.put("locked", Boolean.toString(locked)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java new file mode 100755 index 0000000000..eb23d6bc70 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantMutedVoiceRecordEvent() { + super(); + setEvent("ParticipantMutedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setMuted(boolean muted) { + eventMap.put("muted", Boolean.toString(muted)); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java new file mode 100755 index 0000000000..e0b2814349 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java @@ -0,0 +1,36 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantTalkingVoiceRecordEvent() { + super(); + setEvent("ParticipantTalkingEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setTalking(boolean talking) { + eventMap.put("talking", Boolean.toString(talking)); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java new file mode 100755 index 0000000000..7c46b0f0bf --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java @@ -0,0 +1,38 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public StartRecordingVoiceRecordEvent(boolean record) { + super(); + if (record) + setEvent("StartRecordingEvent"); + else + setEvent("StopRecordingEvent"); + } + + public void setRecordingTimestamp(String timestamp) { + eventMap.put("recordingTimestamp", timestamp); + } + + public void setFilename(String filename) { + eventMap.put("filename", filename); + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java new file mode 100755 index 0000000000..310d5392cd --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java @@ -0,0 +1,141 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import java.util.concurrent.TimeUnit; + +import org.bigbluebutton.conference.service.recorder.RecorderApplication; +import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +public class VoiceEventRecorder { + + private RecorderApplication recorder; + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public void recordConferenceEvent(VoiceConferenceEvent event, String room) { + if (event instanceof VoiceUserJoinedEvent) { + recordParticipantJoinedEvent(event, room); + } else if (event instanceof VoiceUserLeftEvent) { + recordParticipantLeftEvent(event, room); + } else if (event instanceof VoiceUserMutedEvent) { + recordParticipantMutedEvent(event, room); + } else if (event instanceof VoiceUserTalkingEvent) { + recordParticipantTalkingEvent(event, room); + } else if (event instanceof VoiceUserLockedEvent) { + recordParticipantLockedEvent(event, room); + } else if (event instanceof VoiceStartRecordingEvent) { + recordStartRecordingEvent(event, room); + } else { +// log.debug("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() ); + } + } + + private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) { + VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event; + StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord()); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setRecordingTimestamp(sre.getTimestamp()); + evt.setFilename(sre.getRecordingFilename()); + System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename")); + recorder.record(room, evt); + } + + private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) { + VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event; + + ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(pje.getUserId().toString()); + evt.setCallerName(pje.getCallerIdName()); + evt.setCallerNumber(pje.getCallerIdName()); + evt.setMuted(pje.getMuted()); + evt.setTalking(pje.getSpeaking()); + + recorder.record(room, evt); + } + + private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) { + + ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + + + evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString()); + + recorder.record(room, evt); + } + + private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) { + VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event; + + ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString()); + evt.setMuted(pme.isMuted()); + + recorder.record(room, evt); + } + + private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) { + VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event; + + ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString()); + evt.setTalking(pte.isTalking()); + + recorder.record(room, evt); + } + + private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) { + VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event; + + ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString()); + evt.setLocked(ple.isLocked()); + + recorder.record(room, evt); + } + + public void setRecorderApplication(RecorderApplication recorder) { + this.recorder = recorder; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java new file mode 100755 index 0000000000..d0402213cc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public abstract class ConferenceCommand { + + private final String room; + private final Integer requesterId; + + public ConferenceCommand(String room, Integer requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public String getRoom() { + return room; + } + + public Integer getRequesterId() { + return requesterId; + } + + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java new file mode 100755 index 0000000000..e9b6c0f3be --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java @@ -0,0 +1,56 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class ConferenceCommandResult { + + private final String room; + private final Integer requesterId; + private boolean success = false; + private String message = ""; + + public ConferenceCommandResult(String room, Integer requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getRoom() { + return room; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Integer getRequesterId() { + return requesterId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java new file mode 100755 index 0000000000..140b26a75f --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java @@ -0,0 +1,34 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class EjectParticipantCommand extends ConferenceCommand { + + private final Integer participantId; + + public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { + super(room, requesterId); + this.participantId = participantId; + } + + public Integer getParticipantId() { + return participantId; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java new file mode 100755 index 0000000000..ff774f702d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class GetParticipantsCommand extends ConferenceCommand { + + public GetParticipantsCommand(String room, Integer requesterId) { + super(room, requesterId); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java new file mode 100755 index 0000000000..789a355cde --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class MuteParticipantCommand extends ConferenceCommand { + + private final Integer participantId; + private final boolean mute; + + public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { + super(room, requesterId); + this.participantId = participantId; + this.mute = mute; + } + + public Integer getParticipantId() { + return participantId; + } + + public boolean isMute() { + return mute; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java new file mode 100755 index 0000000000..15800e757d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java @@ -0,0 +1,25 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + + +public interface ConferenceEventListener { + public void handleConferenceEvent(VoiceConferenceEvent event); + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java new file mode 100755 index 0000000000..735180a415 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class UnknownConferenceEvent extends VoiceConferenceEvent { + + public UnknownConferenceEvent(String participantId, String room) { + super(room); + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java new file mode 100755 index 0000000000..d1ee12a966 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public abstract class VoiceConferenceEvent { + private final String room; + + public VoiceConferenceEvent(String room) { + this.room = room; + } + + public String getRoom() { + return room; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java new file mode 100755 index 0000000000..0e2b8bcc90 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java @@ -0,0 +1,51 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceStartRecordingEvent extends VoiceConferenceEvent { + + private String timestamp; + private String filename; + private boolean record; + + public VoiceStartRecordingEvent(String room, boolean record) { + super(room); + this.record = record; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public void setRecordingFilename(String filename) { + this.filename = filename; + } + + public String getTimestamp() { + return timestamp; + } + + public String getRecordingFilename() { + return filename; + } + + public boolean startRecord() { + return record; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java new file mode 100755 index 0000000000..1a721c5015 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java @@ -0,0 +1,70 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserJoinedEvent extends VoiceConferenceEvent { + + private final String voiceUserId; + private final String callerIdNum; + private final String callerIdName; + private final Boolean muted; + private final Boolean speaking; + private final Boolean locked = false; + private final String userId; + + public VoiceUserJoinedEvent(String userId, String voiceUserId, String room, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking) { + super(room); + this.userId = userId; + this.voiceUserId = voiceUserId; + this.callerIdName = callerIdName; + this.callerIdNum = callerIdNum; + this.muted = muted; + this.speaking = speaking; + } + + public String getUserId() { + return userId; + } + + public String getVoiceUserId() { + return voiceUserId; + } + + public String getCallerIdNum() { + return callerIdNum; + } + + public String getCallerIdName() { + return callerIdName; + } + + public Boolean getMuted() { + return muted; + } + + public Boolean getSpeaking() { + return speaking; + } + + public Boolean isLocked() { + return locked; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java new file mode 100755 index 0000000000..f5371e5620 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserLeftEvent extends VoiceConferenceEvent { + + private final String userId; + + public VoiceUserLeftEvent(String userId, String room) { + super(room); + this.userId = userId; + } + + public String getUserId() { + return userId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java new file mode 100755 index 0000000000..414be991c6 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserLockedEvent extends VoiceConferenceEvent { + + private final boolean locked; + private final String userId; + + public VoiceUserLockedEvent(String userId, String room, boolean locked) { + super(room); + this.locked = locked; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isLocked() { + return locked; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java new file mode 100755 index 0000000000..203e93743c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserMutedEvent extends VoiceConferenceEvent { + + private final boolean muted; + private final String userId; + + public VoiceUserMutedEvent(String userId, String room, boolean muted) { + super(room); + this.muted = muted; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isMuted() { + return muted; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java new file mode 100755 index 0000000000..3ecd6759e4 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserTalkingEvent extends VoiceConferenceEvent { + + private final boolean talking; + private final String userId; + + public VoiceUserTalkingEvent(String userId, String room, boolean talking) { + super(room); + this.talking = talking; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isTalking() { + return talking; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java new file mode 100755 index 0000000000..f3dcd0fc59 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java @@ -0,0 +1,154 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; +import org.freeswitch.esl.client.inbound.Client; +import org.freeswitch.esl.client.inbound.InboundConnectionFailure; +import org.freeswitch.esl.client.manager.ManagerConnection; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class ConnectionManager { + private static final String EVENT_NAME = "Event-Name"; + + private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); + + private ManagerConnection manager; + private ScheduledFuture connectTask; + + private volatile boolean subscribed = false; + + private ConferenceEventListener conferenceEventListener; + private ESLEventListener eslEventListener; + + private void connect() { + try { + Client c = manager.getESLClient(); + if (! c.canSend()) { +// log.info("Attempting to connect to FreeSWITCH ESL"); + subscribed = false; + manager.connect(); + } else { + if (!subscribed) { +// log.info("Subscribing for ESL events."); + c.cancelEventSubscriptions(); + c.addEventListener(eslEventListener); + c.setEventSubscriptions( "plain", "all" ); + c.addEventFilter( EVENT_NAME, "heartbeat" ); + c.addEventFilter( EVENT_NAME, "custom" ); + c.addEventFilter( EVENT_NAME, "background_job" ); + subscribed = true; + } + } + } catch (InboundConnectionFailure e) { + System.out.println("Failed to connect to ESL"); +// log.error("Failed to connect to ESL"); + } + } + + public void start() { +// log.info("Starting FreeSWITCH ESL connection manager."); + System.out.println("***************** Starting FreeSWITCH ESL connection manager."); + ConnectThread connector = new ConnectThread(); + connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); + } + + public void stop() { + if (connectTask != null) { + connectTask.cancel(true); + } + } + + private class ConnectThread implements Runnable { + public void run() { + connect(); + } + } + + + public void broadcast(BroadcastConferenceCommand rcc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); + rcc.handleResponse(response, conferenceEventListener); + } + } + + public void getUsers(PopulateRoomCommand prc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); + prc.handleResponse(response, conferenceEventListener); + } + } + + public void mute(MuteParticipantCommand mpc) { + System.out.println("Got mute request from FSApplication."); + Client c = manager.getESLClient(); + if (c.canSend()) { + System.out.println("Issuing command to FS ESL."); + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void eject(EjectParticipantCommand mpc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void ejectAll(EjectAllUsersCommand mpc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void record(RecordConferenceCommand rcc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); + rcc.handleResponse(response, conferenceEventListener); + } + } + + public void setManagerConnection(ManagerConnection manager) { + this.manager = manager; + } + + public void setESLEventListener(ESLEventListener listener) { + this.eslEventListener = listener; + } + + public void setConferenceEventListener(ConferenceEventListener listener) { + this.conferenceEventListener = listener; + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java new file mode 100755 index 0000000000..3f627965c3 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java @@ -0,0 +1,204 @@ +package org.bigbluebutton.webconference.voice.freeswitch; + + +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.freeswitch.esl.client.IEslEventListener; +import org.freeswitch.esl.client.transport.event.EslEvent; +import org.jboss.netty.channel.ExceptionEvent; + +public class ESLEventListener implements IEslEventListener { + + private static final String START_TALKING_EVENT = "start-talking"; + private static final String STOP_TALKING_EVENT = "stop-talking"; + private static final String START_RECORDING_EVENT = "start-recording"; + private static final String STOP_RECORDING_EVENT = "stop-recording"; + + private ConferenceEventListener conferenceEventListener; + + @Override + public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { + //Ignored, Noop + } + + @Override + public void backgroundJobResultReceived(EslEvent event) { +// log.debug( "Background job result received [{}]", event ); + } + + @Override + public void exceptionCaught(ExceptionEvent e) { +// setChanged(); +// notifyObservers(e); + } + + private static final Pattern GLOBAL_AUDION_PATTERN = Pattern.compile("(GLOBAL_AUDIO)_(.*)$"); + private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); + + @Override + public void conferenceEventJoin(String uniqueId, String confName, int confSize, EslEvent event) { + + Integer memberId = this.getMemberIdFromEvent(event); + Map headers = event.getEventHeaders(); + String callerId = this.getCallerIdFromEvent(event); + String callerIdName = this.getCallerIdNameFromEvent(event); + boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue + boolean speaking = headers.get("Talking").equals("true") ? true : false; + + String voiceUserId = callerIdName; + +// log.info("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); + + Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); + if (gapMatcher.matches()) { +// log.debug("Ignoring GLOBAL AUDIO USER [{}]", callerIdName); + return; + } + + Matcher matcher = CALLERNAME_PATTERN.matcher(callerIdName); + if (matcher.matches()) { + voiceUserId = matcher.group(1).trim(); + callerIdName = matcher.group(2).trim(); + } + + VoiceUserJoinedEvent pj = new VoiceUserJoinedEvent(voiceUserId, memberId.toString(), confName, callerId, callerIdName, muted, speaking); + conferenceEventListener.handleConferenceEvent(pj); + } + + @Override + public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); +// log.info("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); + conferenceEventListener.handleConferenceEvent(pl); + } + + @Override + public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); +// log.info("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); + conferenceEventListener.handleConferenceEvent(pm); + } + + @Override + public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); +// log.info("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); + conferenceEventListener.handleConferenceEvent(pm); + } + + @Override + public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + VoiceUserTalkingEvent pt; + + System.out.println("******************** Receive conference Action [" + action + "]"); + + if (action == null) { + return; + } + + if (action.equals(START_TALKING_EVENT)) { + pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); + conferenceEventListener.handleConferenceEvent(pt); + } else if (action.equals(STOP_TALKING_EVENT)) { + pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); + conferenceEventListener.handleConferenceEvent(pt); + } else { +// log.debug("Unknown conference Action [{}]", action); + System.out.println("Unknown conference Action [" + action + "]"); + } + } + + @Override + public void conferenceEventTransfer(String uniqueId, String confName, int confSize, EslEvent event) { + //Ignored, Noop + } + + @Override + public void conferenceEventThreadRun(String uniqueId, String confName, int confSize, EslEvent event) { + + } + + //@Override + public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) { + String action = event.getEventHeaders().get("Action"); + + if(action == null) { + return; + } + + // if (log.isDebugEnabled()) + // log.debug("Handling conferenceEventRecord " + action); + + if (action.equals(START_RECORDING_EVENT)) { + VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); + sre.setRecordingFilename(getRecordFilenameFromEvent(event)); + sre.setTimestamp(genTimestamp().toString()); + +// log.info("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + + conferenceEventListener.handleConferenceEvent(sre); + } else if (action.equals(STOP_RECORDING_EVENT)) { + VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false); + srev.setRecordingFilename(getRecordFilenameFromEvent(event)); + srev.setTimestamp(genTimestamp().toString()); + +// log.info("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + conferenceEventListener.handleConferenceEvent(srev); + } else { +// if (log.isDebugEnabled()) +// log.warn("Processing UNKNOWN conference Action {}", action); + } + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + @Override + public void eventReceived(EslEvent event) { + System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]"); +// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) { +//// setChanged(); +// notifyObservers(event); +// return; +// } + } + + private Integer getMemberIdFromEvent(EslEvent e) { + return new Integer(e.getEventHeaders().get("Member-ID")); + } + + private String getCallerIdFromEvent(EslEvent e) { + return e.getEventHeaders().get("Caller-Caller-ID-Number"); + } + + private String getCallerIdNameFromEvent(EslEvent e) { + return e.getEventHeaders().get("Caller-Caller-ID-Name"); + } + + private String getRecordFilenameFromEvent(EslEvent e) { + return e.getEventHeaders().get("Path"); + } + + /*private String getRecordTimestampFromEvent(EslEvent e) { + return e.getEventHeaders().get("Event-Date-Timestamp"); + }*/ + + public void setConferenceEventListener(ConferenceEventListener listener) { + this.conferenceEventListener = listener; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java new file mode 100755 index 0000000000..d0abdcc759 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java @@ -0,0 +1,202 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch; + +import java.io.File; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; +import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +public class FreeswitchApplication implements ConferenceServiceProvider { + + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + private ConnectionManager manager; + + private String icecastProtocol = "shout"; + private String icecastHost = "localhost"; + private int icecastPort = 8000; + private String icecastUsername = "source"; + private String icecastPassword = "hackme"; + private String icecastStreamExtension = ".mp3"; + private Boolean icecastBroadcast = false; + + private final String USER = "0"; /* not used for now */ + + private volatile boolean sendMessages = false; + + private void queueMessage(FreeswitchCommand command) { + try { + messages.offer(command, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void populateRoom(String room) { + PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); + queueMessage(prc); + } + + public void mute(String room, String participant, Boolean mute) { + MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); + queueMessage(mpc); + } + + public void eject(String room, String participant) { + EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); + queueMessage(mpc); + } + + @Override + public void ejectAll(String room) { + EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); + queueMessage(mpc); + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + @Override + public void record(String room, String meetingid){ + String RECORD_DIR = "/var/freeswitch/meetings"; + String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; + + RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); + queueMessage(rcc); + } + + @Override + public void broadcast(String room, String meetingid) { + if (icecastBroadcast) { + broadcastToIcecast(room, meetingid); + } + } + + private void broadcastToIcecast(String room, String meetingid) { + String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort + + File.separatorChar + meetingid + "." + icecastStreamExtension; + + BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); + queueMessage(rcc); + } + + public void setConnectionManager(ConnectionManager manager) { + this.manager = manager; + } + + public void setIcecastProtocol(String protocol) { + icecastProtocol = protocol; + } + + public void setIcecastHost(String host) { + icecastHost = host; + } + + public void setIcecastPort(int port) { + icecastPort = port; + } + + public void setIcecastUsername(String username) { + icecastUsername = username; + } + + public void setIcecastPassword(String password) { + icecastPassword = password; + } + + public void setIcecastBroadcast(Boolean broadcast) { + icecastBroadcast = broadcast; + } + + public void setIcecastStreamExtension(String ext) { + icecastStreamExtension = ext; + } + + private void sendMessageToFreeswitch(final FreeswitchCommand command) { + Runnable task = new Runnable() { + public void run() { + if (command instanceof PopulateRoomCommand) { + PopulateRoomCommand cmd = (PopulateRoomCommand) command; +// log.debug("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); + manager.getUsers(cmd); + } else if (command instanceof MuteParticipantCommand) { + MuteParticipantCommand cmd = (MuteParticipantCommand) command; +// log.debug("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.mute(cmd); + } else if (command instanceof EjectParticipantCommand) { + EjectParticipantCommand cmd = (EjectParticipantCommand) command; +// log.debug("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.eject(cmd); + } else if (command instanceof EjectAllUsersCommand) { + EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; +// log.debug("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); + manager.ejectAll(cmd); + } else if (command instanceof RecordConferenceCommand) { + manager.record((RecordConferenceCommand) command); + } else if (command instanceof BroadcastConferenceCommand) { + manager.broadcast((BroadcastConferenceCommand) command); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + FreeswitchCommand message; + try { + message = messages.take(); + sendMessageToFreeswitch(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java new file mode 100755 index 0000000000..c0aa4d35b3 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java @@ -0,0 +1,50 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class BroadcastConferenceCommand extends FreeswitchCommand { + private boolean record; + private String icecastPath; + + public BroadcastConferenceCommand(String room, String requesterId, boolean record, String icecastPath){ + super(room, requesterId); + this.record = record; + this.icecastPath = icecastPath; + } + + + @Override + public String getCommandArgs() { + String action = "norecord"; + if (record) + action = "record"; + + return SPACE + getRoom() + SPACE + action + SPACE + icecastPath; + } + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java new file mode 100755 index 0000000000..e4826d72ea --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java @@ -0,0 +1,31 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class EjectAllUsersCommand extends FreeswitchCommand { + + public EjectAllUsersCommand(String room, String requesterId) { + super(room, requesterId); + } + + @Override + public String getCommandArgs() { + return room + " kick all"; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java new file mode 100755 index 0000000000..0924b164eb --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java @@ -0,0 +1,34 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class EjectParticipantCommand extends FreeswitchCommand { + + private final String participant; + + public EjectParticipantCommand(String room, String participant, String requesterId) { + super(room, requesterId); + this.participant = participant; + } + + @Override + public String getCommandArgs() { + return room + " kick " + participant; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java new file mode 100755 index 0000000000..db9800fa93 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java @@ -0,0 +1,45 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public abstract class FreeswitchCommand { + public static final String SPACE = " "; + + protected final String room; + protected final String requesterId; + + public FreeswitchCommand(String room, String requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public String getCommand() { + return "conference"; //conference is default, override if needed. + } + + public abstract String getCommandArgs(); + + public String getRoom() { + return room; + } + + public String getRequesterId() { + return requesterId; + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java new file mode 100755 index 0000000000..a54ab6dacc --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class MuteParticipantCommand extends FreeswitchCommand { + + private final String participant; + private final Boolean mute; + + public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { + super(room, requesterId); + this.participant = participant; + this.mute = mute; + } + + @Override + public String getCommandArgs() { + String action = "unmute"; + if (mute) action = "mute"; + + return room + SPACE + action + SPACE + participant; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java new file mode 100755 index 0000000000..0697ac610c --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java @@ -0,0 +1,116 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.freeswitch.esl.client.transport.message.EslMessage; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; +import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.SAXException; + +public class PopulateRoomCommand extends FreeswitchCommand { + + public PopulateRoomCommand(String room, String requesterId) { + super(room, requesterId); + } + + @Override + public String getCommandArgs() { + return getRoom() + SPACE + "xml_list"; + } + + private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + String firstLine = response.getBodyLines().get(0); + + //E.g. Conference 85115 not found + + if(!firstLine.startsWith(". +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.freeswitch.esl.client.transport.message.EslMessage; +import org.slf4j.Logger; + +public class RecordConferenceCommand extends FreeswitchCommand { + private boolean record; + private String recordPath; + + public RecordConferenceCommand(String room, String requesterId, boolean record, String recordPath){ + super(room, requesterId); + this.record = record; + this.recordPath = recordPath; + } + + + @Override + public String getCommandArgs() { + String action = "norecord"; + if (record) + action = "record"; + + return SPACE + getRoom() + SPACE + action + SPACE + recordPath; + } + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + } +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java new file mode 100755 index 0000000000..4e6caf9050 --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java @@ -0,0 +1,88 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.webconference.voice.freeswitch.response; + +/** + * + * @author leif + */ +public class ConferenceMember { + + protected Integer memberId; + protected ConferenceMemberFlags flags; + protected String uuid; + protected String callerIdName; + protected String callerId; + protected Integer joinTime; + protected Integer lastTalking; + + public Integer getId() { + return memberId; + } + + public ConferenceMemberFlags getFlags() { + return flags; + } + + public String getCallerId() { + return callerId; + } + + public String getCallerIdName() { + return callerIdName; + } + + public boolean getMuted() { + return flags.getIsMuted(); + } + + public boolean getSpeaking() { + return flags.getIsSpeaking(); + } + + public void setFlags(ConferenceMemberFlags flags) { + this.flags = flags; + } + + public void setId(int parseInt) { + memberId = parseInt; + } + + public void setUUID(String tempVal) { + this.uuid = tempVal; + } + + public void setCallerIdName(String tempVal) { + this.callerIdName = tempVal; + } + + public void setCallerId(String tempVal) { + this.callerId = tempVal; + } + + public void setJoinTime(int parseInt) { + this.joinTime = parseInt; + } + + void setLastTalking(int parseInt) { + this.lastTalking = parseInt; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java new file mode 100755 index 0000000000..be507e2c0d --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java @@ -0,0 +1,54 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.webconference.voice.freeswitch.response; + +/** + * + * @author leif + */ +public class ConferenceMemberFlags { + //private boolean canHear = false; + private boolean canSpeak = false; + private boolean talking = false; + //private boolean hasVideo = false; + //private boolean hasFloor = false; + //private boolean isModerator = false; + //private boolean endConference = false; + + boolean getIsSpeaking() { + return talking; + } + + boolean getIsMuted() { + if(canSpeak == true) { + return false; + } + return true; + } + + void setCanSpeak(String tempVal) { + canSpeak = tempVal.equals("true") ? true : false; + } + + void setTalking(String tempVal) { + talking = tempVal.equals("true") ? true : false; + } + +} diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java new file mode 100755 index 0000000000..0411d85d5e --- /dev/null +++ b/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java @@ -0,0 +1,160 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.response; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.slf4j.Logger; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * + * @author leif + */ +public class XMLResponseConferenceListParser extends DefaultHandler { + private List myConfrenceMembers; + private String tempVal; + private ConferenceMember tempMember; + private ConferenceMemberFlags tempFlags; + private String room; + private boolean inFlags = false; + + public XMLResponseConferenceListParser() { + myConfrenceMembers = new ArrayList(); + } + + public String getConferenceRoom() { + return room; + } + + public void printConferneceMemebers() { +// log.info("Number of Members found in room [{}] was ({}).", room, myConfrenceMembers.size()); + Iterator it = myConfrenceMembers.iterator(); + while(it.hasNext()) { + // log.info("room [{}] member: [{}]", room, it.next().toString()); + } + } + + public List getConferenceList() { + return myConfrenceMembers; + } + + /* + + + + + + 6 + + true + true + false + false + true + false + false + + 3a16f061-0df6-45d5-b401-d8e977e08a5c + 1001 + 1001 + 65 + 4 + + + + + + */ + + + //SAX Event Handlers + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + //reset + inFlags = false; + tempVal = ""; + if(qName.equalsIgnoreCase("member")) { + //create a new instance of ConferenceMember + tempMember = new ConferenceMember(); + } + + if(qName.equalsIgnoreCase("flags")) { + //create a new instance of ConferenceMember + tempFlags = new ConferenceMemberFlags(); + inFlags = true; + } + + if(qName.equalsIgnoreCase("conference")) { + room = attributes.getValue("name"); + } + } + + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + tempVal = new String(ch,start,length); + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + + if(qName.equalsIgnoreCase("member")) { + //add it to the list + myConfrenceMembers.add(tempMember); + }else if(qName.equalsIgnoreCase("flags")) { + tempMember.setFlags(tempFlags); + inFlags = false; + }else if(inFlags) { + if (qName.equalsIgnoreCase("can_speak")) { + tempFlags.setCanSpeak(tempVal); + }else if (qName.equalsIgnoreCase("talking")) { + tempFlags.setTalking(tempVal); + } + }else if (qName.equalsIgnoreCase("id")) { + try { + tempMember.setId(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { +// log.error("cannot set ConferenceMember Id value [{}] NFE.", tempVal); + } + }else if (qName.equalsIgnoreCase("uuid")) { + tempMember.setUUID(tempVal); + }else if (qName.equalsIgnoreCase("caller_id_name")) { + tempMember.setCallerIdName(tempVal); + }else if (qName.equalsIgnoreCase("caller_id_number")) { + tempMember.setCallerId(tempVal); + }else if (qName.equalsIgnoreCase("join_time")) { + try { + tempMember.setJoinTime(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { +// log.debug("cannot set setJoinTime value [{}] NFE.", tempVal); + } + }else if (qName.equalsIgnoreCase("last_talking")) { + try { + tempMember.setLastTalking(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { +// log.debug("cannot set setLastTalking value [{}] NFE.", tempVal); + } + } + + } +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala index 2282c6e50b..0ae0562756 100755 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala @@ -3,10 +3,9 @@ package org.bigbluebutton import akka.actor.Props import akka.actor.Actor - object BigBlueButtonAppsMainActor { - def props(name: String): Props = - Props(classOf[BigBlueButtonAppsMainActor]) + def props(name: String): Props = + Props(classOf[BigBlueButtonAppsMainActor]) } class BigBlueButtonAppsMainActor extends Actor { diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala old mode 100644 new mode 100755 index b2aa994313..245ccd7ffc --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala @@ -1,31 +1,21 @@ package org.bigbluebutton import akka.actor.{ ActorSystem, Props } -import akka.io.IO -import akka.util.Timeout -import spray.can.Http import scala.concurrent.duration._ import redis.RedisClient -import scala.concurrent.{Future, Await} +import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global -import org.bigbluebutton.apps.MeetingManager +//import org.bigbluebutton.apps.MeetingManager import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor -import org.bigbluebutton.endpoint.rest.RestEndpointServiceActor object Boot extends App with SystemConfiguration { implicit val system = ActorSystem("bigbluebutton-apps-system") - - val redisPublisherActor = system.actorOf( - AppsRedisPublisherActor.props(system), - "redis-publisher") - - val meetingManager = system.actorOf(MeetingManager.props(redisPublisherActor), "meeting-manager") - - // create and start our service actor - val service = system.actorOf(Props(classOf[RestEndpointServiceActor], meetingManager), "rest-service") - // start a new HTTP server on port 8080 with our service actor as the handler - IO(Http) ! Http.Bind(service, interface = serviceHost, port = servicePort) - + val redisPublisherActor = system.actorOf( + AppsRedisPublisherActor.props(system), + "redis-publisher") + + // val meetingManager = system.actorOf(MeetingManager.props(redisPublisherActor), "meeting-manager") + } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala index 7de1967a7d..3fbdbc4b52 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala @@ -12,9 +12,9 @@ trait SystemConfiguration { lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") - + lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) - + lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala index 6ab16528ae..b12c308a37 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala @@ -1,22 +1,22 @@ package org.bigbluebutton.apps object Role extends Enumeration { - type RoleType = Value - val MODERATOR = Value("MODERATOR") - val VIEWER = Value("VIEWER") + type RoleType = Value + val MODERATOR = Value("MODERATOR") + val VIEWER = Value("VIEWER") } case class Duration(lengthInMinutes: Int, allowExtend: Boolean, maxDuration: Int) case class VoiceConference(pin: Int, number: Int) case class PhoneNumber(number: String, description: String) -case class MeetingDescriptor(id: String, name: String, - record: Boolean, welcomeMessage: String, - logoutUrl: String, avatarUrl: String, - numUsers: Int, duration: Duration, - voiceConf: VoiceConference, phoneNumbers: Seq[PhoneNumber], - metadata: Map[String, String]) - -case class MeetingIdAndName(id: String, name: String) +case class MeetingDescriptor(id: String, name: String, + record: Boolean, welcomeMessage: String, + logoutUrl: String, avatarUrl: String, + numUsers: Int, duration: Duration, + voiceConf: VoiceConference, phoneNumbers: Seq[PhoneNumber], + metadata: Map[String, String]) + +case class MeetingIdAndName(id: String, name: String) case class Session(id: String, meeting: MeetingIdAndName) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingManager.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingManager.scala deleted file mode 100644 index 5bf93cb149..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingManager.scala +++ /dev/null @@ -1,120 +0,0 @@ -package org.bigbluebutton.apps - -import akka.actor.{Actor, ActorRef, ActorLogging, Props} -import org.bigbluebutton.apps._ -import org.bigbluebutton.apps.users.messages._ - -object MeetingManager { - def props(pubsub: ActorRef): Props = Props(classOf[MeetingManager], pubsub) -} - -class MeetingManager private (val pubsub: ActorRef) extends Actor with ActorLogging { - /** - * Holds our currently running meetings. - */ - private var meetings = new collection.immutable.HashMap[String, RunningMeeting] - - def receive = { - case createMeetingRequest: CreateMeeting => - handleCreateMeetingRequest(createMeetingRequest) - case msg:RegisterUserRequest => handleRegisterUserRequest(msg) - - case meetingMessage: MeetingMessage => handleMeetingMessage(meetingMessage) - -// case registerUser : RegisterUserRequest => -// handleRegisterUser(registerUser) - case "test" => {sender ! "test"; pubsub ! "test"} - case _ => None - } - - /** - * Returns true if a meeting with the passed id exist. - */ - def meetingExist(internalMeetingId: String): Boolean = { - (meetings.keys find {k => k.startsWith(internalMeetingId)}) != None - } - - /** - * Creates an internal id out of the external id. - */ - def getValidSession(internalId: String): String = { - internalId + "-" + System.currentTimeMillis() - } - - def createMeeting(config: MeetingDescriptor, internalId: String):RunningMeeting = { - val sessionId = getValidSession(internalId) - val session = createSession(config.name, config.id, sessionId) - val runningMeeting = RunningMeeting(session, pubsub, config) - storeMeeting(session.id, runningMeeting) - runningMeeting - } - - def storeMeeting(session: String, meeting: RunningMeeting) = { - meetings += (session -> meeting) - } - - def getSessionFor(internalId: String):Option[String] = { - meetings.keys find {key => key.startsWith(internalId)} - } - - def getMeeting(internalId: String):Option[RunningMeeting] = { - for { - session <- getSessionFor(internalId) - meeting <- meetings.get(session) - } yield meeting - } - - def createSession(name: String, externalId: String, sessionId: String):Session = { - Session(sessionId, MeetingIdAndName(externalId, name)) - } - - def getMeetingUsingSessionId(sessionId: String):Option[RunningMeeting] = { - for { meeting <- meetings.get(sessionId) } yield meeting - } - - def handleRegisterUserRequest(msg: RegisterUserRequest) = { - val internalId = Util.toInternalMeetingId(msg.session.meeting.id) - val meeting = for { - meeting <- getMeeting(internalId) - } yield meeting - - meeting.map {m => m.actorRef forward msg} - } - - def handleMeetingMessage(msg: MeetingMessage) = { - val meeting = for { - meeting <- getMeetingUsingSessionId(msg.session.id) - } yield meeting - - meeting.map {m => m.actorRef forward msg} - } - - /** - * Handle the CreateMeetingRequest message. - */ - def handleCreateMeetingRequest(msg: CreateMeeting) = { - val descriptor = msg.descriptor - val meetingId = descriptor.id - val name = descriptor.name - - log.debug("Received create meeting request for [{}] : [{}]", meetingId, name) - - val internalId = Util.toInternalMeetingId(meetingId) - - getMeeting(internalId) match { - case Some(runningMeeting) => { - log.info("Meeting [{}] : [{}] is already running.", meetingId, name) - sender ! CreateMeetingResponse(true, descriptor, "Meeting already exists.", runningMeeting.session) - } - case None => { - log.info("Creating meeting [{}] : [{}]", meetingId, name) - val runningMeeting = createMeeting(descriptor, internalId) - - log.debug("Replying to create meeting request. [{}] : [{}]", meetingId, name) - - sender ! CreateMeetingResponse(true, descriptor, "Meeting successfully created.", runningMeeting.session) - pubsub ! MeetingCreated(runningMeeting.session, descriptor) - } - } - } -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala index 8eb2a3dd8d..10e277ab0b 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala @@ -1,9 +1,9 @@ package org.bigbluebutton.apps case class CreateMeeting(descriptor: MeetingDescriptor) -case class CreateMeetingResponse(success: Boolean, - descriptor: MeetingDescriptor, - message: String, - session: Session) - +case class CreateMeetingResponse(success: Boolean, + descriptor: MeetingDescriptor, + message: String, + session: Session) + case class MeetingCreated(session: Session, meeting: MeetingDescriptor) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeeting.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeeting.scala deleted file mode 100644 index 72b70672ef..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeeting.scala +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.apps - -import akka.actor.ActorRef -import akka.actor.ActorContext - -object RunningMeeting { - def apply(session: Session, pubsub: ActorRef, config: MeetingDescriptor) - (implicit context: ActorContext) = - new RunningMeeting(session, pubsub, config)(context) -} - -class RunningMeeting (val session: Session, - val pubsub: ActorRef, - val config: MeetingDescriptor) - (implicit val context: ActorContext) { - - val actorRef = context.actorOf(RunningMeetingActor.props(pubsub, session, config), session.id) - - val configs = new collection.immutable.HashMap[String, String]() -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeetingActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeetingActor.scala deleted file mode 100644 index f194043a79..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/RunningMeetingActor.scala +++ /dev/null @@ -1,81 +0,0 @@ -package org.bigbluebutton.apps - -import akka.actor.Actor -import akka.actor.ActorRef -import akka.actor.ActorLogging -import akka.actor.Props -import org.bigbluebutton.apps.users.UsersApp -import org.bigbluebutton.apps.protocol.CreateMeetingRequestReply -import org.bigbluebutton.apps.users.UsersAppHandler -import org.bigbluebutton.apps.users._ -import org.bigbluebutton.apps.users.messages._ -import org.bigbluebutton.apps.chat.ChatAppHandler -import org.bigbluebutton.apps.chat.messages._ -import org.bigbluebutton.apps.layout.messages._ -import org.bigbluebutton.apps.layout.LayoutAppHandler -import org.bigbluebutton.apps.presentation.messages._ -import org.bigbluebutton.apps.presentation.PresentationAppHandler -import org.bigbluebutton.apps.whiteboard.messages._ -import org.bigbluebutton.apps.whiteboard.WhiteboardAppHandler - -object RunningMeetingActor { - def props(pubsub: ActorRef, session: Session, - meeting: MeetingDescriptor): Props = - Props(classOf[RunningMeetingActor], pubsub, session, meeting) -} - -class RunningMeetingActor (val pubsub: ActorRef, val session: Session, - val meeting: MeetingDescriptor) extends Actor with ActorLogging - with UsersAppHandler with ChatAppHandler - with LayoutAppHandler with PresentationAppHandler - with WhiteboardAppHandler { - - def receive = { - /** Users **/ - case msg: RegisterUserRequest => handleRegisterUser(msg) - case msg: UserJoinRequest => handleUserJoinRequest(msg) - case msg: UserLeave => handleUserLeave(msg) - case msg: GetUsersRequest => handleGetUsersRequest(msg) - case msg: AssignPresenter => handleAssignPresenter(msg) - case msg: RaiseHand => handleRaiseHand(msg) - case msg: LowerHand => handleLowerHand(msg) - case msg: VoiceUserJoin => handleVoiceUserJoin(msg) - case msg: MuteUser => handleMuteUser(msg) - case msg: UserMuted => handleUserMuted(msg) - - /** Chat **/ - case msg: NewPrivateChatMessage => handlePrivateChatMessage(msg) - case msg: NewPublicChatMessage => handlePublicChatMessage(msg) - case msg: GetPublicChatHistory => handleGetPublicChatHistory(msg) - - /** Layout **/ - case msg: NewLayout => handleNewLayout(msg) - case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: SetLayoutRequest => handleSetLayoutRequest(msg) - case msg: LockLayoutRequest => handleLockLayoutRequest(msg) - - /** Presentation **/ - case msg: ClearPresentation => handleClearPresentation(msg) - case msg: RemovePresentation => handleRemovePresentation(msg) - case msg: SendCursorUpdate => handleSendCursorUpdate(msg) - case msg: ResizeAndMovePage => handleResizeAndMoveSlide(msg) - case msg: DisplayPage => handleDisplayPage(msg) - case msg: SharePresentation => handleSharePresentation(msg) - case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) - case msg: PresentationConverted => handlePresentationConverted(msg) - - /** Whiteboard **/ - case msg: NewWhiteboardShape => handleNewWhiteboardShape(msg) - case msg: UpdateWhiteboardShape => handleUpdateWhiteboardShape(msg) - case msg: DeleteWhiteboardShape => handleDeleteWhiteboardShape(msg) - case msg: GetWhiteboardShapes => handleGetWhiteboardShapes(msg) - case msg: ClearWhiteboardShapes => handleClearWhiteboardShapes(msg) - case msg: DeleteWhiteboard => handleDeleteWhiteboard(msg) - case msg: GetWhiteboardOptions => handleGetWhiteboardOptions(msg) - - - case unknown => log.error("Unhandled message: [{}", unknown) - } - - -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala index fe8fe9ee59..67b64dd847 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala @@ -7,21 +7,21 @@ import java.text.SimpleDateFormat import java.util.Date /** - * Some utilities. + * Some utilities. */ object Util { /** * Convert the external meeting id passed from 3rd-party applications - * into an internal meeting id. + * into an internal meeting id. */ - def toInternalMeetingId(externalMeetingId: String) = + def toInternalMeetingId(externalMeetingId: String) = DigestUtils.sha1Hex(externalMeetingId) - - def generateTimestamp():String = { + + def generateTimestamp(): String = { val tz: TimeZone = TimeZone.getTimeZone("UTC"); - val df:DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); + val df: DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); df.setTimeZone(tz); - df.format(new Date()); + df.format(new Date()); } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala index 2f8f3ee423..695453d0ad 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala @@ -10,26 +10,26 @@ object ChatApp { class ChatApp { private var privateChats = new collection.immutable.HashMap[String, PrivateChatConversation]() private var publicChat = new PublicChatConversation(Seq()) - + private var counter = 0 - - def generateMessageId():String = { + + def generateMessageId(): String = { counter += 1 "msg".concat(counter.toString) } - + def savePrivateChat(conv: PrivateChatConversation) = { privateChats += conv.id -> conv } - + def getConversionId(msg: PrivateMessage): String = { val from = new collection.immutable.StringOps(msg.from.id) val to = new collection.immutable.StringOps(msg.to.id) - + if (from < to) from.concat("-").concat(to) else to.concat("-").concat(from) - + } - + def newPrivateChatMessage(msg: PrivateMessage) = { val convId = getConversionId(msg) val conversation = privateChats.get(convId) @@ -45,12 +45,12 @@ class ChatApp { } } } - + def newPublicChatMessages(msg: PublicMessage) = { - publicChat = publicChat.copy(messages = (publicChat.messages :+ msg)) + publicChat = publicChat.copy(messages = (publicChat.messages :+ msg)) } - - def getPublicChatHistory():Array[PublicMessage] = { + + def getPublicChatHistory(): Array[PublicMessage] = { publicChat.messages.toArray } } diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatAppHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatAppHandler.scala deleted file mode 100644 index 72a91dd664..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatAppHandler.scala +++ /dev/null @@ -1,40 +0,0 @@ -package org.bigbluebutton.apps.chat - -import akka.actor.{ActorRef, actorRef2Scala} -import akka.event.LoggingAdapter -import org.bigbluebutton.apps.RunningMeetingActor -import org.bigbluebutton.apps.chat.messages._ -import org.bigbluebutton.apps.chat.data._ -import org.bigbluebutton.apps.chat.messages.SendPrivateChatMessage -import org.bigbluebutton.apps.chat.messages.SendPublicChatMessage -import org.bigbluebutton.apps.chat.messages.GetPublicChatHistory - -trait ChatAppHandler { - this : RunningMeetingActor => - - val pubsub: ActorRef - val log: LoggingAdapter - val chatApp = new ChatApp() - - def handlePrivateChatMessage(msg: NewPrivateChatMessage) = { - val msgId = chatApp.generateMessageId - val ts = System.currentTimeMillis() - val m = PrivateMessage(msgId, ts, msg.from, msg.to, msg.font, msg.text) - chatApp.newPrivateChatMessage(m) - - pubsub ! SendPrivateChatMessage(session, m) - } - - def handlePublicChatMessage(msg: NewPublicChatMessage) = { - val msgId = chatApp.generateMessageId - val ts = System.currentTimeMillis() - val m = PublicMessage(msgId, ts, msg.from, msg.font, msg.text) - chatApp.newPublicChatMessages(m) - - pubsub ! SendPublicChatMessage(session, m) - } - - def handleGetPublicChatHistory(msg: GetPublicChatHistory) = { - pubsub ! GetPublicChatHistoryResponse(session, msg.requester, chatApp.getPublicChatHistory) - } -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala index 8af3671070..08e52b83c0 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala @@ -2,20 +2,19 @@ package org.bigbluebutton.apps.chat.data import org.bigbluebutton.apps.users.data.UserIdAndName - -case class Text(lang: String, text: String) +case class Text(lang: String, text: String) case class TextFont(color: Int, size: Int, fontType: String) case class Translation(lang: String, text: String) -case class PrivateMessage(id: String, timestamp: Long, from: UserIdAndName, - to: UserIdAndName, - font: TextFont, text: Text, - translations: Option[Seq[Translation]] = None) -case class PublicMessage(id: String, timestamp: Long, from: UserIdAndName, - font: TextFont, text: Text, - translations: Option[Seq[Translation]] = None) +case class PrivateMessage(id: String, timestamp: Long, from: UserIdAndName, + to: UserIdAndName, + font: TextFont, text: Text, + translations: Option[Seq[Translation]] = None) +case class PublicMessage(id: String, timestamp: Long, from: UserIdAndName, + font: TextFont, text: Text, + translations: Option[Seq[Translation]] = None) -case class PublicChatConversation(messages: Seq[PublicMessage]) +case class PublicChatConversation(messages: Seq[PublicMessage]) case class PrivateChatConversation(id: String, messages: Seq[PrivateMessage]) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala index c92222b7a2..2ca062a874 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala @@ -5,21 +5,20 @@ import org.bigbluebutton.apps.Session import org.bigbluebutton.apps.users.data.UserIdAndName import org.bigbluebutton.apps.chat.data._ +case class GetPublicChatHistory(session: Session, requester: UserIdAndName) +case class GetPublicChatHistoryResponse(session: Session, + requester: UserIdAndName, + messages: Seq[PublicMessage]) -case class GetPublicChatHistory(session: Session, requester: UserIdAndName) -case class GetPublicChatHistoryResponse(session: Session, - requester: UserIdAndName, - messages: Seq[PublicMessage]) +case class NewPrivateChatMessage(session: Session, + from: UserIdAndName, + font: TextFont, text: Text, + to: UserIdAndName) + +case class SendPrivateChatMessage(session: Session, message: PrivateMessage) -case class NewPrivateChatMessage(session: Session, - from: UserIdAndName, - font: TextFont, text: Text, - to: UserIdAndName) - -case class SendPrivateChatMessage(session: Session, message: PrivateMessage) - case class NewPublicChatMessage(session: Session, - from: UserIdAndName, - font: TextFont, text: Text) - -case class SendPublicChatMessage(session: Session, message: PublicMessage) \ No newline at end of file + from: UserIdAndName, + font: TextFont, text: Text) + +case class SendPublicChatMessage(session: Session, message: PublicMessage) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala index 072180d887..f202b7da0c 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala @@ -4,40 +4,40 @@ import org.bigbluebutton.apps.layout.data.Layout class LayoutApp { private var layouts = new collection.immutable.HashMap[String, Layout]() - + private var layoutLocked = false - + private def saveLayout(layout: Layout) = { - layouts += layout.id -> layout + layouts += layout.id -> layout } - - def currentLayout():Option[Layout] = { - layouts.values find {l => l.current} + + def currentLayout(): Option[Layout] = { + layouts.values find { l => l.current } } - - def newLayout(id: String, layout: String, default: Boolean):Layout = { + + def newLayout(id: String, layout: String, default: Boolean): Layout = { val lout = Layout(id, layout, default) saveLayout(lout) lout } - + def deactivateCurrentLayout() = { - currentLayout foreach {cl => - saveLayout(cl.copy(current = false)) + currentLayout foreach { cl => + saveLayout(cl.copy(current = false)) } } - - def lockLayout(id: String, lock: Boolean):Option[Layout] = { + + def lockLayout(id: String, lock: Boolean): Option[Layout] = { layouts.get(id) match { case Some(lout) => { layoutLocked = lock Some(lout) } case None => None - } + } } - - def setLayout(id: String):Option[Layout] = { + + def setLayout(id: String): Option[Layout] = { layouts.get(id) match { case Some(lout) => { val l = lout.copy(current = true) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutAppHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutAppHandler.scala deleted file mode 100644 index 4659042afd..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutAppHandler.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.bigbluebutton.apps.layout - -import akka.actor.{ActorRef, actorRef2Scala} -import akka.event.LoggingAdapter -import org.bigbluebutton.apps.RunningMeetingActor -import org.bigbluebutton.apps.layout.messages._ - -trait LayoutAppHandler { - this : RunningMeetingActor => - - val pubsub: ActorRef - val log: LoggingAdapter - - val layoutApp = new LayoutApp() - - def handleNewLayout(msg: NewLayout) = { - val lout = layoutApp.newLayout(msg.layoutId, msg.layout, msg.default) - } - - def handleSetLayoutRequest(msg: SetLayoutRequest) = { - val layout = layoutApp.setLayout(msg.layoutId) - - layout foreach { l => - pubsub ! SetLayout(session, msg.requester, l.id) - } - } - - def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) = { - layoutApp.currentLayout foreach { l => - pubsub ! GetCurrentLayoutResponse(session, msg.requester, l.id) - } - } - - def handleLockLayoutRequest(msg: LockLayoutRequest) = { - layoutApp.lockLayout(msg.layoutId, msg.lock) foreach { l => - pubsub ! LockedLayout(session, msg.requester, msg.lock, l.id) - } - } -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala index 5726b6a4fd..a154f3f688 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala @@ -1,4 +1,4 @@ package org.bigbluebutton.apps.layout.data case class Layout(id: String, layout: String, default: Boolean = false, - current: Boolean = false) \ No newline at end of file + current: Boolean = false) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala index 4444c9b5ab..7ad22a09e9 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala @@ -3,15 +3,15 @@ package org.bigbluebutton.apps.layout.messages import org.bigbluebutton.apps.Session import org.bigbluebutton.apps.users.data.UserIdAndName -case class NewLayout(session: Session, layoutId: String, - layout: String, default: Boolean = false) +case class NewLayout(session: Session, layoutId: String, + layout: String, default: Boolean = false) case class GetCurrentLayoutRequest(session: Session, requester: UserIdAndName) case class SetLayoutRequest(session: Session, requester: UserIdAndName, layoutId: String) -case class LockLayoutRequest(session: Session, requester: UserIdAndName, - lock: Boolean, layoutId: String) +case class LockLayoutRequest(session: Session, requester: UserIdAndName, + lock: Boolean, layoutId: String) -case class GetCurrentLayoutResponse(session: Session, - requester: UserIdAndName, - layoutId: String) +case class GetCurrentLayoutResponse(session: Session, + requester: UserIdAndName, + layoutId: String) case class SetLayout(session: Session, requester: UserIdAndName, layoutId: String) case class LockedLayout(session: Session, requester: UserIdAndName, lock: Boolean, layoutId: String) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala index 9a8b953913..0fe51111aa 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala @@ -4,76 +4,76 @@ import org.bigbluebutton.apps.presentation.data._ class PresentationApp { private var presentations = new collection.immutable.HashMap[String, Presentation]() - - private var currentPresentation:Option[Presentation] = None - + + private var currentPresentation: Option[Presentation] = None + private def savePresentation(p: Presentation) = { presentations += p.id -> p } - + def clearPresentation(id: String) = { - currentPresentation foreach { cp => - if (cp.id == id) currentPresentation = None - } + currentPresentation foreach { cp => + if (cp.id == id) currentPresentation = None + } } - - private def getPresentation(id: String):Option[Presentation] = { + + private def getPresentation(id: String): Option[Presentation] = { presentations.get(id) } - - private def getPage(pres: Presentation, page: Int):Option[Page] = { - pres.pages find { x => x.num == page} + + private def getPage(pres: Presentation, page: Int): Option[Page] = { + pres.pages find { x => x.num == page } } - + private def remove(id: String) = { presentations -= id } - - def removePresentation(id: String):Option[Presentation] = { + + def removePresentation(id: String): Option[Presentation] = { val pres = getPresentation(id) remove(id) pres } - + def newPresentation(pres: Presentation) = { savePresentation(pres) } - - def sharePresentation(id: String):Option[Presentation] = { - val pres = presentations.get(id) - pres foreach { p => currentPresentation = Some(p) } + + def sharePresentation(id: String): Option[Presentation] = { + val pres = presentations.get(id) + pres foreach { p => currentPresentation = Some(p) } pres } - - def setCurrentPageForPresentation(pres: Presentation, page: Page):Option[Presentation] = { + + def setCurrentPageForPresentation(pres: Presentation, page: Page): Option[Presentation] = { val newPres = pres.copy(currentPage = page.num) savePresentation(newPres) Some(newPres) } - - def displayPage(presentation: String, num: Int):Option[Page] = { - for { - pres <- getPresentation(presentation) - page <- getPage(pres, num) + + def displayPage(presentation: String, num: Int): Option[Page] = { + for { + pres <- getPresentation(presentation) + page <- getPage(pres, num) newpres <- setCurrentPageForPresentation(pres, page) - } yield page + } yield page } - - private def changePagePosition(pres: Presentation, page: Page, - position: Position):Page = { + + private def changePagePosition(pres: Presentation, page: Page, + position: Position): Page = { val newPage = page.copy(position = position) - val otherPages = pres.pages filterNot {op => op.num == page.num} + val otherPages = pres.pages filterNot { op => op.num == page.num } val newPages = otherPages :+ newPage val newPres = pres.copy(pages = newPages) newPage } - - def resizeAndMovePage(id: String, pageNum: Int, - position: Position):Option[Page] = { - for { - pres <- getPresentation(id) - page <- getPage(pres, pageNum) + + def resizeAndMovePage(id: String, pageNum: Int, + position: Position): Option[Page] = { + for { + pres <- getPresentation(id) + page <- getPage(pres, pageNum) newPage = changePagePosition(pres, page, position) - } yield newPage + } yield newPage } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationAppHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationAppHandler.scala deleted file mode 100644 index 79845ffd16..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationAppHandler.scala +++ /dev/null @@ -1,63 +0,0 @@ -package org.bigbluebutton.apps.presentation - -import akka.actor.{ActorRef, actorRef2Scala} -import akka.event.LoggingAdapter -import org.bigbluebutton.apps.RunningMeetingActor -import org.bigbluebutton.apps.presentation.messages._ - -trait PresentationAppHandler { - this : RunningMeetingActor => - - val pubsub: ActorRef - val log: LoggingAdapter - - val presApp = new PresentationApp() - - def handleClearPresentation(msg: ClearPresentation) = { - presApp.clearPresentation(msg.presentation.id) - - pubsub ! PresentationCleared(session, msg.presentation, msg.clearedBy) - } - - def handleRemovePresentation(msg : RemovePresentation) = { - val pres = presApp.removePresentation(msg.presentation.id) - pubsub ! PresentationRemoved(session, msg.presentation, msg.removedBy) - } - - def handleSendCursorUpdate(msg: SendCursorUpdate) = { - pubsub ! UpdateCursorPosition(session, msg.xPercent, msg.yPercent) - } - - def handleResizeAndMoveSlide(msg: ResizeAndMovePage) = { - val page = presApp.resizeAndMovePage(msg.presentation.id, - msg.page, msg.position) - page foreach { p => - pubsub ! PageMoved(session, msg.presentation, p) - } - } - - def handleDisplayPage(msg: DisplayPage) = { - val page = presApp.displayPage(msg.presentation.id, msg.page) - page foreach { p => - pubsub ! PageDisplayed(session, msg.presentation, p) - } - } - - def handleSharePresentation(msg: SharePresentation) = { - val presentation = presApp.sharePresentation(msg.presentation.id) - presentation foreach {pres => - pubsub ! PresentationShared(session, pres) - - self ! DisplayPage(session, msg.presentation, 1) - } - } - - def handlePreuploadedPresentations(msg: PreuploadedPresentations) = { - msg.presentations foreach {p => presApp.newPresentation(p)} - } - - def handlePresentationConverted(msg: PresentationConverted) = { - presApp.newPresentation(msg.presentation) - } - -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala index 7fd32a19fe..1a3f130e4e 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala @@ -1,10 +1,9 @@ package org.bigbluebutton.apps.presentation.data - -case class Position(xOffset: Double = 0, yOffset: Double = 0, - widthRatio: Double = 100, heightRatio: Double = 100) +case class Position(xOffset: Double = 0, yOffset: Double = 0, + widthRatio: Double = 100, heightRatio: Double = 100) case class Page(num: Int, location: String, position: Position) case class PresentationIdAndName(id: String, name: String) case class Presentation(id: String, name: String, currentPage: Int = 1, - pages: Seq[Page]) + pages: Seq[Page]) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala index aa6ffad15f..545025e031 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala @@ -4,54 +4,54 @@ import org.bigbluebutton.apps.Session import org.bigbluebutton.apps.users.data.UserIdAndName import org.bigbluebutton.apps.presentation.data._ -case class ClearPresentation(session: Session, - presentation: PresentationIdAndName, - clearedBy: UserIdAndName) +case class ClearPresentation(session: Session, + presentation: PresentationIdAndName, + clearedBy: UserIdAndName) case class PresentationCleared(session: Session, - presentation: PresentationIdAndName, - clearedBy: UserIdAndName) - -case class RemovePresentation(session: Session, - presentation: PresentationIdAndName, - removedBy: UserIdAndName) + presentation: PresentationIdAndName, + clearedBy: UserIdAndName) -case class PresentationRemoved(session: Session, - presentation: PresentationIdAndName, - removedBy: UserIdAndName) - -case class SendCursorUpdate(session: Session, - xPercent: Double, yPercent: Double) -case class UpdateCursorPosition(session: Session, - xPercent: Double, yPercent: Double) - -case class ResizeAndMovePage(session: Session, - presentation: PresentationIdAndName, - page: Int, - position: Position) -case class PageMoved(session: Session, - presentation: PresentationIdAndName, - page: Page) - -case class DisplayPage(session: Session, - presentation: PresentationIdAndName, - page: Int) +case class RemovePresentation(session: Session, + presentation: PresentationIdAndName, + removedBy: UserIdAndName) -case class PageDisplayed(session: Session, - presentation: PresentationIdAndName, - page: Page) - -case class SharePresentation(session: Session, - presentation: PresentationIdAndName) +case class PresentationRemoved(session: Session, + presentation: PresentationIdAndName, + removedBy: UserIdAndName) + +case class SendCursorUpdate(session: Session, + xPercent: Double, yPercent: Double) +case class UpdateCursorPosition(session: Session, + xPercent: Double, yPercent: Double) + +case class ResizeAndMovePage(session: Session, + presentation: PresentationIdAndName, + page: Int, + position: Position) +case class PageMoved(session: Session, + presentation: PresentationIdAndName, + page: Page) + +case class DisplayPage(session: Session, + presentation: PresentationIdAndName, + page: Int) + +case class PageDisplayed(session: Session, + presentation: PresentationIdAndName, + page: Page) + +case class SharePresentation(session: Session, + presentation: PresentationIdAndName) case class PresentationShared(session: Session, presentation: Presentation) -case class PreuploadedPresentations(session: Session, - presentations: Seq[Presentation]) - -case class PresentationConverted(session: Session, - presentation: Presentation) +case class PreuploadedPresentations(session: Session, + presentations: Seq[Presentation]) + +case class PresentationConverted(session: Session, + presentation: Presentation) case class PresentationConversionUpdate(meetingID: String, msg: Map[String, Object]) -case class GetPresentationInfo(meetingID: String, requesterID: String) -case class GetSlideInfo(meetingID: String, requesterID: String) +case class GetPresentationInfo(meetingID: String, requesterID: String) +case class GetSlideInfo(meetingID: String, requesterID: String) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala index 4b3db55835..c00384aaea 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala @@ -2,10 +2,8 @@ package org.bigbluebutton.apps.protocol import org.bigbluebutton.apps.users.data.UserIdAndName - trait InMessage - // Poll Messages case class PreCreatedPoll(meetingID: String, poll: PollVO) extends InMessage case class CreatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage @@ -16,16 +14,16 @@ case class RemovePoll(meetingID: String, requesterID: String, pollID: String) ex case class SharePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage case class ShowPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage case class HidePollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class StopPoll(meetingID:String, requesterID: String, pollID: String) extends InMessage -case class StartPoll(meetingID:String, requesterID: String, pollID: String) extends InMessage -case class ClearPoll(meetingID: String, requesterID: String, pollID: String, force: Boolean=false) extends InMessage -case class GetPollResult(meetingID:String, requesterID: String, pollID: String) extends InMessage +case class StopPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class StartPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class ClearPoll(meetingID: String, requesterID: String, pollID: String, force: Boolean = false) extends InMessage +case class GetPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage case class RespondToPoll(meetingID: String, requesterID: String, response: PollResponseVO) extends InMessage case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) -case class QuestionResponsesVO(val questionID:String, val responseIDs:Array[String]) +case class QuestionResponsesVO(val questionID: String, val responseIDs: Array[String]) case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) case class ResponderVO(responseID: String, user: Responder) case class Responder(val userID: String, name: String) @@ -36,9 +34,9 @@ case class IsMeetingMutedRequest(meetingID: String, requesterID: String) extends case class MuteUserRequest(meetingID: String, requesterID: String, userID: String, mute: Boolean) extends InMessage case class LockUserRequest(meetingID: String, requesterID: String, userID: String, lock: Boolean) extends InMessage case class EjectUserRequest(meetingID: String, requesterID: String, userID: String) extends InMessage -case class VoiceUserJoinedMessage(meetingID: String, user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, - muted: Boolean, talking: Boolean) extends InMessage - +case class VoiceUserJoinedMessage(meetingID: String, user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, + muted: Boolean, talking: Boolean) extends InMessage + case class VoiceUserLeftMessage(meetingID: String, user: String, voiceConfId: String) extends InMessage case class VoiceUserMutedMessage(meetingID: String, user: String, voiceConfId: String, muted: Boolean) extends InMessage case class VoiceUserTalkingMessage(meetingID: String, user: String, voiceConfId: String, talking: Boolean) extends InMessage @@ -48,12 +46,9 @@ case class VoiceStartedRecordingMessage(meetingID: String, voiceConfId: String, // our messages from FreeSWITCH doesn't have it. trait VoiceMessage case class VoiceUserJoined(user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, muted: Boolean, speaking: Boolean) extends VoiceMessage - + case class VoiceUserLeft(user: String, voiceConfId: String) extends VoiceMessage case class VoiceUserMuted(user: String, voiceConfId: String, muted: Boolean) extends VoiceMessage case class VoiceUserTalking(user: String, voiceConfId: String, talking: Boolean) extends VoiceMessage case class VoiceStartedRecording(voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends VoiceMessage - - - diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala index 34207a0c2e..8ccd7dbb65 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala @@ -9,9 +9,9 @@ import Message._ import org.parboiled.errors.ParsingException object Message { - case class Meeting(id: String, name: String, session: String) - case class MessageHeader(name: String, timestamp: Long, meeting: Meeting) - case class MessageEvent(header: MessageHeader, payload: JsValue) + case class Meeting(id: String, name: String, session: String) + case class MessageHeader(name: String, timestamp: Long, meeting: Meeting) + case class MessageEvent(header: MessageHeader, payload: JsValue) } object MessageHeaderJsonProtocol extends DefaultJsonProtocol { @@ -31,11 +31,11 @@ object MessageHandler { case None => None } } - + def extractPayload(msg: JsObject): Option[JsValue] = { - msg.fields.get("payload") + msg.fields.get("payload") } - + def processMessage(msg: String): Option[JsObject] = { try { val msgObject = JsonParser(msg).asJsObject @@ -44,9 +44,9 @@ object MessageHandler { case e: ParsingException => None } } - + def forwardMessage(header: MessageHeader, payload: JsValue) { - + } def handleMessage(jsonMsg: String) { @@ -55,10 +55,10 @@ object MessageHandler { val msgObj = jsonObj get val header = extractMessageHeader(msgObj) val payload = extractPayload(msgObj) - + if (header != None && payload != None) { forwardMessage(header get, payload get) } } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala index c5d5deece4..c7060c6fd1 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala @@ -20,13 +20,12 @@ object MyJsonProtocol extends DefaultJsonProtocol { */ case class CreateMeetingRequestReply(created: Boolean, message: String, session: Session) - case class MeetingHeader(name: String, externalId: String, session: String) case class UserRegistered(meeting: MeetingHeader, user: RegisteredUser) -case class EndAndKickAll(meeting: MeetingHeader) -case class GetUsersReply(meeting: MeetingHeader, users: Seq[JoinedUser]) -case class PresenterAssigned(meeting: MeetingHeader, newPresenter: UserIdAndName, assignedBy: UserIdAndName) -case class UserJoined(meeting: MeetingHeader, user: JoinedUser) -case class UserLeft(meeting: MeetingHeader, user: UserIdAndName) -case class UserStatusChange(meeting: MeetingHeader, user: UserIdAndName, status: String, value: Object) \ No newline at end of file +case class EndAndKickAll(meeting: MeetingHeader) +case class GetUsersReply(meeting: MeetingHeader, users: Seq[JoinedUser]) +case class PresenterAssigned(meeting: MeetingHeader, newPresenter: UserIdAndName, assignedBy: UserIdAndName) +case class UserJoined(meeting: MeetingHeader, user: JoinedUser) +case class UserLeft(meeting: MeetingHeader, user: UserIdAndName) +case class UserStatusChange(meeting: MeetingHeader, user: UserIdAndName, status: String, value: Object) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala index 5d3ad74b29..9d01448b6b 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala @@ -1,40 +1,39 @@ package org.bigbluebutton.apps.protocol import spray.json.JsValue -import org.bigbluebutton.apps.users.data.{RegisterUser, JoinedUser} +import org.bigbluebutton.apps.users.data.{ RegisterUser, JoinedUser } import spray.json.DefaultJsonProtocol import spray.httpx.SprayJsonSupport case class Destination(to: String, correlation_id: Option[String]) case class ReplyDestination(to: String, correlation_id: String) -case class Header(destination: Destination, name: String, - timestamp: String, source: String, - reply: Option[ReplyDestination]) - +case class Header(destination: Destination, name: String, + timestamp: String, source: String, + reply: Option[ReplyDestination]) + case class HeaderMeeting(name: String, id: String, session: Option[String]) case class HeaderAndJsonMessage(header: Header, jsonMessage: String) case class ReplyStatus(status: String, message: String, error: Option[Int]) - + case class StatusCode(code: Int, message: String) case class ErrorCode(code: Int, message: String, details: Option[String] = None) case class Response(status: StatusCode, errors: Option[Seq[ErrorCode]] = None) - + case class ResponsePayload(response: Response) case class JsonResponse(header: Header, payload: Option[ResponsePayload] = None) - -case class MessageProcessException(message: String) extends Exception(message) +case class MessageProcessException(message: String) extends Exception(message) -object HeaderAndPayloadJsonSupport extends DefaultJsonProtocol with SprayJsonSupport { - implicit val statusCodeFormat = jsonFormat2(StatusCode) +object HeaderAndPayloadJsonSupport extends DefaultJsonProtocol with SprayJsonSupport { + implicit val statusCodeFormat = jsonFormat2(StatusCode) implicit val errorCodeFormat = jsonFormat3(ErrorCode) implicit val responseFormat = jsonFormat2(Response) implicit val headerDestinationFormat = jsonFormat2(Destination) implicit val headerMeetingFormat = jsonFormat3(HeaderMeeting) implicit val replyDestinationFormat = jsonFormat2(ReplyDestination) - implicit val headerFormat = jsonFormat5(Header) + implicit val headerFormat = jsonFormat5(Header) implicit val headerAndPayloadFormat = jsonFormat2(HeaderAndJsonMessage) implicit val responsePayloadFormat = jsonFormat1(ResponsePayload) implicit val jsonResponseFormat = jsonFormat2(JsonResponse) @@ -42,10 +41,10 @@ object HeaderAndPayloadJsonSupport extends DefaultJsonProtocol with SprayJsonSup object StatusCodes extends Enumeration { type StatusCodeType = Value - + val OK = Value(200, "OK") val NOT_MODIFIED = Value(304, "Not Modified") - val BAD_REQUEST = Value(400, "Bad Request") + val BAD_REQUEST = Value(400, "Bad Request") val UNAUTHORIZED = Value(401, "Unauthorized") val FORBIDDEN = Value(403, "Forbidden") val NOT_FOUND = Value(404, "Not Found") @@ -56,21 +55,21 @@ object StatusCodes extends Enumeration { } object StatusCodeBuilder { - def buildStatus(codeType: StatusCodes.StatusCodeType):StatusCode = { + def buildStatus(codeType: StatusCodes.StatusCodeType): StatusCode = { StatusCode(codeType.id, codeType.toString()) } } object ErrorCodes extends Enumeration { type ErrorCodeType = Value - + val INVALID_TOKEN = Value(1, "Invalid or expired token") val INVALID_MESSAGE = Value(2, "Invalid message") - + } object ErrorCodeBuilder { - def buildError(codeType: ErrorCodes.ErrorCodeType, details: String):ErrorCode = { + def buildError(codeType: ErrorCodes.ErrorCodeType, details: String): ErrorCode = { ErrorCode(codeType.id, codeType.toString(), Some(details)) } } diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala index 556d1c8344..4a6a3427e2 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala @@ -5,50 +5,50 @@ import org.bigbluebutton.apps.Role import org.bigbluebutton.apps.users.data._ import org.bigbluebutton.apps.MeetingDescriptor -object UsersApp { +object UsersApp { def apply() = new UsersApp() } class UsersApp private { import UsersApp._ - - private var registeredUsers = - new collection.immutable.HashMap[String, RegisteredUser] - - private var joinedUsers = - new collection.immutable.HashMap[String, JoinedUser] - + + private var registeredUsers = + new collection.immutable.HashMap[String, RegisteredUser] + + private var joinedUsers = + new collection.immutable.HashMap[String, JoinedUser] + private var presenterAssignedBy = SystemUser - - def registered:Array[RegisteredUser] = registeredUsers.values toArray - - def joined:Array[JoinedUser] = joinedUsers.values toArray - + + def registered: Array[RegisteredUser] = registeredUsers.values toArray + + def joined: Array[JoinedUser] = joinedUsers.values toArray + def isRegistered(token: String) = registeredUsers.get(token) != None - + def getRegisteredUser(token: String) = registeredUsers.get(token) - + private def add(user: RegisteredUser) = registeredUsers += user.token -> user - - private def add(token: String, ruser: RegisterUser):JoinedUser = { + + private def add(token: String, ruser: RegisterUser): JoinedUser = { val userId = generateValidUserId val webIdent = WebIdentity() - val voceIdent = VoiceIdentity(callerId = CallerId(ruser.name, ruser.name), - muted = true, - locked = false, - talking = false, - metadata = Map("name" -> ruser.name)) - + val voceIdent = VoiceIdentity(callerId = CallerId(ruser.name, ruser.name), + muted = true, + locked = false, + talking = false, + metadata = Map("name" -> ruser.name)) + val user = JoinedUser(userId, token, ruser, false, webIdent, voceIdent) - + addJoinedUser(user) user } - - private def addJoinedUser(user:JoinedUser) = joinedUsers += (user.id -> user) + + private def addJoinedUser(user: JoinedUser) = joinedUsers += (user.id -> user) private def save(user: JoinedUser) = joinedUsers += (user.id -> user) - - private def remove(id: String):Option[JoinedUser] = { + + private def remove(id: String): Option[JoinedUser] = { joinedUsers get (id) match { case Some(user) => { joinedUsers -= id @@ -57,121 +57,121 @@ class UsersApp private { case None => None } } - - def exist(id: String):Boolean = joinedUsers.get(id) != None - + + def exist(id: String): Boolean = joinedUsers.get(id) != None + private def generateValidToken: String = { val token = RandomStringGenerator.randomAlphanumericString(12) - if (! isRegistered(token)) token else generateValidToken + if (!isRegistered(token)) token else generateValidToken } - + private def generateValidUserId: String = { val userId = RandomStringGenerator.randomAlphanumericString(6) - if (! exist(userId)) userId else generateValidUserId + if (!exist(userId)) userId else generateValidUserId } - - def register(user: RegisterUser):RegisteredUser = { - val token = generateValidToken + + def register(user: RegisterUser): RegisteredUser = { + val token = generateValidToken val u = RegisteredUser(token, user) add(u) u } - - def join(token: String):Option[JoinedUser] = { + + def join(token: String): Option[JoinedUser] = { for { ruser <- getRegisteredUser(token) - user = add(token, ruser.user) + user = add(token, ruser.user) } yield user } - + def makeAllUsersViewer() = { joined foreach { u => makeViewer(u) } } - - def makePresenter(user:JoinedUser) = { + + def makePresenter(user: JoinedUser) = { val u = user.copy(isPresenter = true) - joinedUsers += (user.id -> user) + joinedUsers += (user.id -> user) } - - def makeViewer(user:JoinedUser) = { + + def makeViewer(user: JoinedUser) = { val u = user.copy(isPresenter = false) - joinedUsers += (user.id -> user) + joinedUsers += (user.id -> user) } - - def moderators:Array[JoinedUser] = - joinedUsers.values filter(p => p.user.role == Role.MODERATOR) toArray - - def viewers:Array[JoinedUser] = - joinedUsers.values filter (p => p.user.role == Role.VIEWER) toArray - - def hasPresenter():Boolean = { + + def moderators: Array[JoinedUser] = + joinedUsers.values filter (p => p.user.role == Role.MODERATOR) toArray + + def viewers: Array[JoinedUser] = + joinedUsers.values filter (p => p.user.role == Role.VIEWER) toArray + + def hasPresenter(): Boolean = { currentPresenter match { case None => false case Some(p) => true } } - - def currentPresenter:Option[JoinedUser] = - joinedUsers.values find (p => p.isPresenter) - - def getJoinedUser(id: String):Option[JoinedUser] = joinedUsers.get(id) - def left(id: String):Option[JoinedUser] = { + def currentPresenter: Option[JoinedUser] = + joinedUsers.values find (p => p.isPresenter) + + def getJoinedUser(id: String): Option[JoinedUser] = joinedUsers.get(id) + + def left(id: String): Option[JoinedUser] = { remove(id) } - - def findAModerator:Option[JoinedUser] = + + def findAModerator: Option[JoinedUser] = joinedUsers.values find (m => m.user.role == Role.MODERATOR) - - private def raiseHand(user:JoinedUser, raised: Boolean):JoinedUser = { + + private def raiseHand(user: JoinedUser, raised: Boolean): JoinedUser = { val juser = user.copy(webIdentity = user.webIdentity.copy(handRaised = raised)) addJoinedUser(juser) - juser + juser } - - def raiseHand(id: String, raise: Boolean):Option[JoinedUser] = { + + def raiseHand(id: String, raise: Boolean): Option[JoinedUser] = { for { u <- getJoinedUser(id) juser = raiseHand(u, raise) - } yield juser + } yield juser } - - def joinVoiceUser(userId: String, voiceIdent: VoiceIdentity, - meeting: MeetingDescriptor):JoinedUser = { - + + def joinVoiceUser(userId: String, voiceIdent: VoiceIdentity, + meeting: MeetingDescriptor): JoinedUser = { + getJoinedUser(userId) match { case Some(u) => { val juser = u.copy(voiceIdentity = voiceIdent) - addJoinedUser(juser) - juser + addJoinedUser(juser) + juser } case None => { val uid = generateValidUserId val token = generateValidToken - val usr = RegisterUser(uid, voiceIdent.callerId.name, Role.VIEWER, - meeting.voiceConf.pin, meeting.welcomeMessage, - meeting.logoutUrl, meeting.avatarUrl) - - val webIdent = WebIdentity() - val juser = JoinedUser(uid, token, usr, false, webIdent, voiceIdent) - addJoinedUser(juser) - juser + val usr = RegisterUser(uid, voiceIdent.callerId.name, Role.VIEWER, + meeting.voiceConf.pin, meeting.welcomeMessage, + meeting.logoutUrl, meeting.avatarUrl) + + val webIdent = WebIdentity() + val juser = JoinedUser(uid, token, usr, false, webIdent, voiceIdent) + addJoinedUser(juser) + juser } } } - - private def muteUser(user: JoinedUser, muted: Boolean):JoinedUser = { + + private def muteUser(user: JoinedUser, muted: Boolean): JoinedUser = { val juser = user.copy(voiceIdentity = user.voiceIdentity.copy(muted = muted)) addJoinedUser(juser) juser } - - def userMuted(userId: String, muted: Boolean):Option[JoinedUser] = { + + def userMuted(userId: String, muted: Boolean): Option[JoinedUser] = { for { u <- getJoinedUser(userId) juser = muteUser(u, muted) - } yield juser + } yield juser } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersAppHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersAppHandler.scala deleted file mode 100644 index b5c9f43ae8..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersAppHandler.scala +++ /dev/null @@ -1,154 +0,0 @@ -package org.bigbluebutton.apps.users - -import akka.actor.{ActorRef, actorRef2Scala} -import akka.event.LoggingAdapter -import org.bigbluebutton.apps.Role -import org.bigbluebutton.apps.RunningMeetingActor -import org.bigbluebutton.apps.protocol.StatusCodes -import org.bigbluebutton.apps.protocol.ErrorCodes -import org.bigbluebutton.apps.users._ -import org.bigbluebutton.apps.users.messages._ -import org.bigbluebutton.apps.users.data._ - - -/** - * Users app for meeting - */ -trait UsersAppHandler { - this : RunningMeetingActor => - - val pubsub: ActorRef - val log: LoggingAdapter - val usersApp = UsersApp() - - /** - * Handle a register user request from 3rd-party. - */ - def handleRegisterUser(msg: RegisterUserRequest) = { - val user = usersApp.register(msg.user) - val response = Result(true, "User has been registered.") - sender ! RegisterUserResponse(msg.session, response, - user.token, msg.user) - } - - /** - * Handle an assign presenter request from client. - */ - def handleAssignPresenter(msg: AssignPresenter) = { - usersApp.getJoinedUser(msg.presenter.presenter.id) match { - case Some(e) => { - - // Make all users viewer and tell the clients to switch to - // viewer mode. - usersApp.makeAllUsersViewer() - pubsub ! BecomeViewer(msg.session) - - // Make the user presenter and tell the clients that a user - // has become presenter. The new presenter's client should - // switch to presenter more while others stay as viewer mode. - usersApp.makePresenter(e) - pubsub ! BecomePresenter(msg.session, msg.presenter) - } - - case None => log.info("Making an unknown user presenter.") - } - } - - /** - * Handle a user join request from 3rd-party. - */ - def handleUserJoinRequest(msg: UserJoinRequest) = { - val token = msg.token - usersApp.join(token) match { - case Some(juser) => { - - val response = Result(true, "Successfully joined the user.") - val jur = UserJoinResponse(msg.session, response, Some(juser)) - sender ! jur - - // Broadcast that a user has joined. - pubsub ! UserJoined(msg.session, token, juser) - - if (! usersApp.hasPresenter && juser.user.role == Role.MODERATOR) { - val moderator = usersApp.findAModerator - moderator foreach { m => - usersApp.makePresenter(m) - val presenter = UserIdAndName(m.id, m.user.name) - val assignedBy = SystemUser - val newPresenter = Presenter(presenter, assignedBy) - pubsub ! BecomePresenter(msg.session, newPresenter) - } - } - } - case None => { - val response = Result(false, "Invalid token.") - val jur = UserJoinResponse(msg.session, response, None) - sender ! jur - } - } - } - - /** - * Handle user leaving message. - */ - def handleUserLeave(msg: UserLeave) = { - val user = usersApp.left(msg.userId) - user foreach { u => pubsub ! UserLeft(msg.session, u) } - } - - /** - * Handle get users request message. - */ - def handleGetUsersRequest(gur: GetUsersRequest) = { - pubsub ! GetUsersResponse(gur.session, gur.requesterId, usersApp.joined) - } - - /** - * Handle user raise hand request. - */ - def handleRaiseHand(msg: RaiseHand) = { - val user = usersApp.raiseHand(msg.user.id, true) - pubsub ! HandRaised(session, msg.user) - } - - /** - * Handle user lower hand request. - */ - def handleLowerHand(msg: LowerHand) = { - val user = usersApp.raiseHand(msg.user.id, false) - pubsub ! HandLowered(session, msg.user, msg.loweredBy) - } - - /** - * Handle user joining voice conf message. - */ - def handleVoiceUserJoin(msg: VoiceUserJoin) = { - val vid = VoiceIdentity(callerId = msg.callerId, muted = msg.muted, - locked = msg.locked, talking = msg.talking, - metadata = msg.metadata) - - val joinedUser = usersApp.joinVoiceUser(msg.userId, vid, meeting) - - // Send a UserJoined message just like the user joined through the - // web because the user might have just called in from the phone. - pubsub ! UserJoined(session, joinedUser.token, joinedUser) - } - - def handleMuteUser(msg: MuteUser) = { - val user = usersApp.getJoinedUser(msg.user.id) - user foreach { u => - // Tell the voice conference to mute the user. - pubsub ! UserMuteRequest(session, msg.user, msg.mute, u.voiceIdentity.metadata) - - // Tell interested parties that the user is being muted. - pubsub ! MuteUserRequest(session, msg.user, msg.mute, msg.mutedBy) - } - } - - def handleUserMuted(msg: UserMuted) = { - val user = usersApp.userMuted(msg.userId, msg.muted) - user foreach { u => - pubsub ! UserHasBeenMuted(session, UserIdAndName(u.id, u.user.name), msg.muted) - } - } -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala index d05b5f5667..9533527b83 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala @@ -4,24 +4,24 @@ import org.bigbluebutton.apps.Role case class WebIdentity(handRaised: Boolean = false) -case class CallerId(name: String, number: String) -case class VoiceIdentity(callerId: CallerId, muted: Boolean = false, - locked: Boolean = false, talking: Boolean = false, - metadata: Map[String, String]) - +case class CallerId(name: String, number: String) +case class VoiceIdentity(callerId: CallerId, muted: Boolean = false, + locked: Boolean = false, talking: Boolean = false, + metadata: Map[String, String]) + case class UserIdAndName(id: String, name: String) - + object SystemUser extends UserIdAndName(id = "system", name = "System") - + case class JoinedUser(id: String, token: String, user: RegisterUser, - isPresenter: Boolean = false, - webIdentity: WebIdentity, - voiceIdentity: VoiceIdentity) - + isPresenter: Boolean = false, + webIdentity: WebIdentity, + voiceIdentity: VoiceIdentity) + case class RegisteredUser(token: String, user: RegisterUser) - -case class RegisterUser(externalId: String, name: String, - role: Role.RoleType, pin: Int, welcomeMessage: String, - logoutUrl: String, avatarUrl: String) + +case class RegisterUser(externalId: String, name: String, + role: Role.RoleType, pin: Int, welcomeMessage: String, + logoutUrl: String, avatarUrl: String) case class Presenter(presenter: UserIdAndName, assignedBy: UserIdAndName) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala index 17401c1191..bee698b02d 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala @@ -7,125 +7,123 @@ import org.bigbluebutton.apps.users.data.JoinedUser import org.bigbluebutton.apps.users.data.UserIdAndName import org.bigbluebutton.apps.users.data.CallerId +trait MeetingMessage { def session: Session } -trait MeetingMessage{def session: Session} - -case class Result(success:Boolean, message: String) +case class Result(success: Boolean, message: String) /** - * Message from 3rd-party to register a user. + * Message from 3rd-party to register a user. */ case class RegisterUserRequest(session: Session, user: RegisterUser) extends MeetingMessage /** - * Reply message for the register user request. + * Reply message for the register user request. */ case class RegisterUserResponse(session: Session, result: Result, - token: String, user: RegisterUser) + token: String, user: RegisterUser) /** - * Message from 3rd-party for a user joining the meeting. - */ + * Message from 3rd-party for a user joining the meeting. + */ case class UserJoinRequest(session: Session, token: String) /** - * Reply to the join user request. + * Reply to the join user request. */ case class UserJoinResponse(session: Session, result: Result, - user: Option[JoinedUser]) + user: Option[JoinedUser]) /** - * Broadcast message to interested parties that a user has joined the meeting. + * Broadcast message to interested parties that a user has joined the meeting. */ case class UserJoined(session: Session, token: String, user: JoinedUser) /** - * Message that a user is leaving the meeting. + * Message that a user is leaving the meeting. */ case class UserLeave(session: Session, userId: String) /** - * Broadcast message to interested parties that a user has left the meeting. + * Broadcast message to interested parties that a user has left the meeting. */ case class UserLeft(session: Session, user: JoinedUser) /** - * Message toq uery for a list of users in a meeting. + * Message toq uery for a list of users in a meeting. */ case class GetUsersRequest(session: Session, requesterId: String) /** - * Reply to the get user request. + * Reply to the get user request. */ case class GetUsersResponse(session: Session, requesterId: String, users: Seq[JoinedUser]) - -/** - * Message to assign a presenter. - */ -case class AssignPresenter(session: Session, presenter: Presenter) /** - * Broadcast message to tell users that a new presenter has been assigned. + * Message to assign a presenter. + */ +case class AssignPresenter(session: Session, presenter: Presenter) + +/** + * Broadcast message to tell users that a new presenter has been assigned. */ case class BecomePresenter(session: Session, presenter: Presenter) /** - * Broadcast message to tell users to become viewer. + * Broadcast message to tell users to become viewer. */ case class BecomeViewer(session: Session) /** - * Message that a user raised hand. + * Message that a user raised hand. */ case class RaiseHand(session: Session, user: UserIdAndName) /** - * Broadcast message that a user has raised her hand. + * Broadcast message that a user has raised her hand. */ case class HandRaised(session: Session, user: UserIdAndName) /** - * Message that a user has lowered hand. + * Message that a user has lowered hand. */ case class LowerHand(session: Session, user: UserIdAndName, loweredBy: UserIdAndName) /** - * Broadcast that a user has lowered hand. + * Broadcast that a user has lowered hand. */ case class HandLowered(session: Session, user: UserIdAndName, loweredBy: UserIdAndName) /** - * Message that informs a user has joined the voice conference. + * Message that informs a user has joined the voice conference. */ -case class VoiceUserJoin(userId: String, voiceConfId: String, callerId: CallerId, - muted: Boolean, locked: Boolean, talking: Boolean, - metadata: Map[String, String]) +case class VoiceUserJoin(userId: String, voiceConfId: String, callerId: CallerId, + muted: Boolean, locked: Boolean, talking: Boolean, + metadata: Map[String, String]) /** - * Message to mute a user. + * Message to mute a user. */ case class MuteUser(session: Session, user: UserIdAndName, mute: Boolean, mutedBy: UserIdAndName) /** - * Broadcast message that a user will be muted. + * Broadcast message that a user will be muted. */ case class MuteUserRequest(session: Session, user: UserIdAndName, mute: Boolean, mutedBy: UserIdAndName) /** - * Message to voice conference server to mute the user. + * Message to voice conference server to mute the user. */ case class UserMuteRequest(session: Session, user: UserIdAndName, mute: Boolean, - metadata: Map[String, String]) - + metadata: Map[String, String]) + /** - * Message from voice conference server that the user has been muted. + * Message from voice conference server that the user has been muted. */ case class UserMuted(userId: String, muted: Boolean, metadata: Map[String, String]) - case class UserHasBeenMuted(session: Session, user: UserIdAndName, muted: Boolean) -case class LockUser(session: Session, user: UserIdAndName, lock:Boolean, lockedBy: UserIdAndName) +case class LockUser(session: Session, user: UserIdAndName, lock: Boolean, lockedBy: UserIdAndName) case class LockedUser(session: Session, user: UserIdAndName, lock: Boolean, lockedBy: UserIdAndName) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala index 3e50347957..5f200fccc1 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala @@ -1,8 +1,8 @@ package org.bigbluebutton.apps.users.protocol -import akka.actor.{Actor, Props, ActorRef, ActorLogging} +import akka.actor.{ Actor, Props, ActorRef, ActorLogging } import akka.event.LoggingAdapter -import akka.pattern.{ask, pipe} +import akka.pattern.{ ask, pipe } import org.bigbluebutton.endpoint.MessageHandlerActor import org.bigbluebutton.apps.Session @@ -20,35 +20,35 @@ import org.bigbluebutton.endpoint.UserJoinResponseMessage import org.bigbluebutton.endpoint.UserJoinRequestFormat trait UsersMessageHandler extends SystemConfiguration { - this : MessageHandlerActor => - + this: MessageHandlerActor => + val bbbAppsActor: ActorRef val messageMarshallingActor: ActorRef val log: LoggingAdapter - - + def handleUserJoinRequestMessage(msg: UserJoinRequestFormat) = { val session = Session(msg.payload.session, msg.payload.meeting) val replyDestination = msg.header.reply - + replyDestination foreach { replyTo => - val header = Header(Destination(replyTo.to, Some(replyTo.correlation_id)), - InMsgNameConst.UserJoinResponse, - Util.generateTimestamp, apiSourceName, None) - + val header = Header(Destination(replyTo.to, Some(replyTo.correlation_id)), + InMsgNameConst.UserJoinResponse, + Util.generateTimestamp, apiSourceName, None) + val userJoinRequest = UserJoinRequest(session, msg.payload.token) - val response = (bbbAppsActor ? userJoinRequest) - .mapTo[UserJoinResponse] - .map(response => { - UserJoinResponseMessage(header, response) - }) - .recover { case _ => - val result = Result(false, "Timeout waiting for response.") - val response = UserJoinResponse(session, result, None) - UserJoinResponseMessage(header, response) - } - - response pipeTo messageMarshallingActor + val response = (bbbAppsActor ? userJoinRequest) + .mapTo[UserJoinResponse] + .map(response => { + UserJoinResponseMessage(header, response) + }) + .recover { + case _ => + val result = Result(false, "Timeout waiting for response.") + val response = UserJoinResponse(session, result, None) + UserJoinResponseMessage(header, response) + } + + response pipeTo messageMarshallingActor } } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala index 4a9c92de4f..2efb888cc0 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala @@ -17,44 +17,43 @@ import org.bigbluebutton.endpoint.UserJoinResponseFormat import org.bigbluebutton.endpoint.UserFormat import org.bigbluebutton.endpoint.ResultFormat - trait UsersMessageMarshalling { - this : MessageMarshallingActor => - + this: MessageMarshallingActor => + val pubsubActor: ActorRef val log: LoggingAdapter - + private def publishUserJoinResponse(header: Header, payload: UserJoinResponseFormatPayload) = { import UserMessagesProtocol._ - - val jsonFormatMsg = UserJoinResponseFormat(header, payload).toJson + + val jsonFormatMsg = UserJoinResponseFormat(header, payload).toJson val jsonMsg = JsonMessage(header.destination.to, jsonFormatMsg.compactPrint) - pubsubActor ! jsonMsg + pubsubActor ! jsonMsg } - + def marshallUserJoinResponseMessage(msg: UserJoinResponseMessage) = { val result = ResultFormat(msg.response.result.success, - msg.response.result.message) + msg.response.result.message) msg.response.user match { case Some(usr) => { - val user = UserFormat(usr.id, usr.user.externalId, usr.user.name, - usr.user.role, usr.user.pin, - usr.user.welcomeMessage, - usr.user.logoutUrl, usr.user.avatarUrl) + val user = UserFormat(usr.id, usr.user.externalId, usr.user.name, + usr.user.role, usr.user.pin, + usr.user.welcomeMessage, + usr.user.logoutUrl, usr.user.avatarUrl) - val payload = UserJoinResponseFormatPayload( - msg.response.session.meeting, - msg.response.session.id, - result, Some(user)) - publishUserJoinResponse(msg.header, payload) + val payload = UserJoinResponseFormatPayload( + msg.response.session.meeting, + msg.response.session.id, + result, Some(user)) + publishUserJoinResponse(msg.header, payload) } case None => { val payload = UserJoinResponseFormatPayload( - msg.response.session.meeting, msg.response.session.id, - result, None) - publishUserJoinResponse(msg.header, payload) - } + msg.response.session.meeting, msg.response.session.id, + result, None) + publishUserJoinResponse(msg.header, payload) + } } } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala index aead46d4f6..e3e0630c09 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala @@ -19,88 +19,88 @@ import org.bigbluebutton.endpoint.GetUsersRequestMessage import org.bigbluebutton.endpoint.AssignPresenterMessage trait UsersMessageUnmarshalling { - this : MessageUnmarshallingActor => - + this: MessageUnmarshallingActor => + val messageHandlerActor: ActorRef val log: LoggingAdapter - + def handleUserJoin(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage):Option[UserJoinRequestFormat] = { + def message(msg: HeaderAndJsonMessage): Option[UserJoinRequestFormat] = { import UserMessagesProtocol._ try { Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[UserJoinRequestFormat]) - } catch { + } catch { case e: DeserializationException => { log.error("Failed to deserialize UserJoinRequestMessage: [{}]", msg.jsonMessage) None - } + } case e: ParsingException => { log.error("Invalid JSON Format : [{}]", msg) None } } } - + message(msg) foreach { ujm => messageHandlerActor ! ujm } } - - def handleUserLeave(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage):Option[UserLeaveMessage] = { + + def handleUserLeave(msg: HeaderAndJsonMessage) = { + def message(msg: HeaderAndJsonMessage): Option[UserLeaveMessage] = { import UserMessagesProtocol._ try { Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[UserLeaveMessage]) - } catch { + } catch { case e: DeserializationException => { log.error("Failed to deserialize UserLeaveMessage: [{}]", msg.jsonMessage) None - } + } case e: ParsingException => { log.error("Invalid JSON Format : [{}]", msg) None } } - } + } - message(msg) foreach { ulm => messageHandlerActor ! ulm } + message(msg) foreach { ulm => messageHandlerActor ! ulm } } - + def handleGetUsers(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage):Option[GetUsersRequestMessage] = { + def message(msg: HeaderAndJsonMessage): Option[GetUsersRequestMessage] = { import UserMessagesProtocol._ try { Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[GetUsersRequestMessage]) - } catch { + } catch { case e: DeserializationException => { log.error("Failed to deserialize GetUsersRequestMessage: [{}]", msg.jsonMessage) None - } + } case e: ParsingException => { log.error("Invalid JSON Format : [{}]", msg) None } } - } + } - message(msg) foreach { gum => messageHandlerActor ! gum } + message(msg) foreach { gum => messageHandlerActor ! gum } } - + def handleAssignPresenter(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage):Option[AssignPresenterMessage] = { + def message(msg: HeaderAndJsonMessage): Option[AssignPresenterMessage] = { import UserMessagesProtocol._ try { Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[AssignPresenterMessage]) - } catch { + } catch { case e: DeserializationException => { log.error("Failed to deserialize AssignPresenterMessage: [{}]", msg.jsonMessage) None - } + } case e: ParsingException => { log.error("Invalid JSON Format : [{}]", msg) None } } - } + } - message(msg) foreach { apm => messageHandlerActor ! apm } + message(msg) foreach { apm => messageHandlerActor ! apm } } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala index 2ca592edf4..3d2c05f11c 100755 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala @@ -2,23 +2,23 @@ package org.bigbluebutton.apps.utils /** * Utility to generate random strings. - * + * * From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ - * + * */ object RandomStringGenerator { - - val random = new scala.util.Random - - /** - * Generate a random string of length n from the given alphabet - */ - def randomString(alphabet: String)(n: Int): String = - Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString - - /** - * Generate a random alphanumeric string of length n - */ - def randomAlphanumericString(n: Int) = - randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) + + val random = new scala.util.Random + + /** + * Generate a random string of length n from the given alphabet + */ + def randomString(alphabet: String)(n: Int): String = + Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString + + /** + * Generate a random alphanumeric string of length n + */ + def randomAlphanumericString(n: Int) = + randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala index 77a2d31495..3435ef5f9c 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala @@ -5,13 +5,13 @@ import org.bigbluebutton.apps.whiteboard.data._ class WhiteboardApp { private var whiteboards = new collection.immutable.HashMap[String, Whiteboard]() - def addNewShape(descriptor: ShapeDescriptor, shape: WhiteboardShape):Shape = { - whiteboards get(descriptor.whiteboardId) match { - case Some(wb) => wb.newShape(descriptor, shape) - case None => { - val wb = new Whiteboard(descriptor.whiteboardId) - wb.newShape(descriptor, shape) - } - } + def addNewShape(descriptor: ShapeDescriptor, shape: WhiteboardShape): Shape = { + whiteboards get (descriptor.whiteboardId) match { + case Some(wb) => wb.newShape(descriptor, shape) + case None => { + val wb = new Whiteboard(descriptor.whiteboardId) + wb.newShape(descriptor, shape) + } + } } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardAppHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardAppHandler.scala deleted file mode 100644 index 2cf766c38f..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardAppHandler.scala +++ /dev/null @@ -1,44 +0,0 @@ -package org.bigbluebutton.apps.whiteboard - -import akka.actor.{ActorRef, actorRef2Scala} -import akka.event.LoggingAdapter -import org.bigbluebutton.apps.RunningMeetingActor -import org.bigbluebutton.apps.whiteboard.messages._ - -trait WhiteboardAppHandler { - this : RunningMeetingActor => - - val pubsub: ActorRef - val log: LoggingAdapter - - val wbApp = new WhiteboardApp() - - def handleNewWhiteboardShape(msg: NewWhiteboardShape) = { - val shape = wbApp.addNewShape(msg.descriptor, msg.shape) - - } - - def handleUpdateWhiteboardShape(msg: UpdateWhiteboardShape) = { - - } - - def handleDeleteWhiteboardShape(msg: DeleteWhiteboardShape) = { - - } - - def handleGetWhiteboardShapes(msg: GetWhiteboardShapes) = { - - } - - def handleClearWhiteboardShapes(msg: ClearWhiteboardShapes) = { - - } - - def handleDeleteWhiteboard(msg: DeleteWhiteboard) = { - - } - - def handleGetWhiteboardOptions(msg: GetWhiteboardOptions) = { - - } -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala index fdca8659d3..d810002d2f 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala @@ -2,44 +2,42 @@ package org.bigbluebutton.apps.whiteboard.data import org.bigbluebutton.apps.users.data.UserIdAndName - - object ShapeTypes extends Enumeration { - type ShapeType = Value - val LINE = Value("LINE") - val SCRIBBLE = Value("SCRIBBLE") - val TEXT = Value("TEXT") - val RECTANGLE = Value("RECTANGLE") - val ELLIPSE = Value("ELLIPSE") - val TRIANGLE = Value("TRIANGLE") + type ShapeType = Value + val LINE = Value("LINE") + val SCRIBBLE = Value("SCRIBBLE") + val TEXT = Value("TEXT") + val RECTANGLE = Value("RECTANGLE") + val ELLIPSE = Value("ELLIPSE") + val TRIANGLE = Value("TRIANGLE") } object LineTypes extends Enumeration { - type LineType = Value - val SOLID = Value("SOLID") - val DASH = Value("DASHED") - val DOT = Value("DOTTED") - val DASHDOT = Value("DASHEDOT") + type LineType = Value + val SOLID = Value("SOLID") + val DASH = Value("DASHED") + val DOT = Value("DOTTED") + val DASHDOT = Value("DASHEDOT") } -case class ShapeDescriptor(whiteboardId: String, shapeId: String, - shapeType: ShapeTypes.ShapeType, - by: UserIdAndName) - -case class Shape(descriptor: ShapeDescriptor, - shape: WhiteboardShape, zorder: Int) +case class ShapeDescriptor(whiteboardId: String, shapeId: String, + shapeType: ShapeTypes.ShapeType, + by: UserIdAndName) + +case class Shape(descriptor: ShapeDescriptor, + shape: WhiteboardShape, zorder: Int) sealed trait WhiteboardShape -class Container(coordinate: Coordinate, background: Background, - border: LineDescriptor) +class Container(coordinate: Coordinate, background: Background, + border: LineDescriptor) case class Point(x: Double, y: Double) case class Line(line: LineDescriptor, point1: Point, point2: Point) - extends WhiteboardShape -case class Scribble(line: LineDescriptor, points: Seq[Point]) - extends WhiteboardShape + extends WhiteboardShape +case class Scribble(line: LineDescriptor, points: Seq[Point]) + extends WhiteboardShape case class Background(visible: Boolean, color: Int, alpha: Int) @@ -48,35 +46,35 @@ case class LineDescriptor(weight: Int, color: Int, lineType: LineTypes.LineType) case class Coordinate(first: Point, last: Point) case class Font(style: String, color: Int, size: Int) case class Text(container: Container, font: Font, text: String) extends WhiteboardShape - -case class Rectangle(container: Container, square: Boolean) extends WhiteboardShape -case class Ellipse(container: Container, circle: Boolean) extends WhiteboardShape + +case class Rectangle(container: Container, square: Boolean) extends WhiteboardShape +case class Ellipse(container: Container, circle: Boolean) extends WhiteboardShape case class Triangle(container: Container) extends WhiteboardShape class Whiteboard(id: String) { private var shapes = Seq[Shape]() - + private var orderCount = 0 - - private def getOrder():Int = { + + private def getOrder(): Int = { val order = orderCount + 1 orderCount = order order } - - def getShapes:Seq[Shape] = shapes.toSeq - + + def getShapes: Seq[Shape] = shapes.toSeq + private def saveShape(s: Shape) = { shapes :+ s } - - def newShape(d: ShapeDescriptor, s: WhiteboardShape):Shape = { + + def newShape(d: ShapeDescriptor, s: WhiteboardShape): Shape = { val order = getOrder() val shape = Shape(d, s, order) saveShape(shape) shape } - - // def removeShape() - + + // def removeShape() + } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala index 3921728029..0bf2665db9 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala @@ -4,30 +4,30 @@ import org.bigbluebutton.apps.Session import org.bigbluebutton.apps.whiteboard.data._ import org.bigbluebutton.apps.users.data.UserIdAndName -case class NewWhiteboardShape(session: Session, descriptor: ShapeDescriptor, - shape: WhiteboardShape) +case class NewWhiteboardShape(session: Session, descriptor: ShapeDescriptor, + shape: WhiteboardShape) case class WhiteboardShapeCreated(session: Session, shape: Shape) -case class UpdateWhiteboardShape(session: Session, descriptor: ShapeDescriptor, - shape: WhiteboardShape) -case class WhiteboardShapeUpdated(session: Session, descriptor: ShapeDescriptor, - shape: WhiteboardShape) - -case class DeleteWhiteboardShape(session: Session, whiteboardId: String, - shapeId: String, deletedBy: UserIdAndName) - -case class GetWhiteboardShapes(session: Session, requester: UserIdAndName, - whiteboardId: String) -case class GetWhiteboardShapesResponse(session: Session, requester: UserIdAndName, - whiteboardId: String, shapes: Seq[Shape]) - +case class UpdateWhiteboardShape(session: Session, descriptor: ShapeDescriptor, + shape: WhiteboardShape) +case class WhiteboardShapeUpdated(session: Session, descriptor: ShapeDescriptor, + shape: WhiteboardShape) + +case class DeleteWhiteboardShape(session: Session, whiteboardId: String, + shapeId: String, deletedBy: UserIdAndName) + +case class GetWhiteboardShapes(session: Session, requester: UserIdAndName, + whiteboardId: String) +case class GetWhiteboardShapesResponse(session: Session, requester: UserIdAndName, + whiteboardId: String, shapes: Seq[Shape]) + case class ClearWhiteboardShapes(session: Session, requester: UserIdAndName, - whiteboardIds: Seq[String]) + whiteboardIds: Seq[String]) case class DeleteWhiteboard(session: Session, requester: UserIdAndName, - whiteboardIds: Seq[String]) - -case class GetWhiteboardOptions(session: Session, requester: UserIdAndName) + whiteboardIds: Seq[String]) + +case class GetWhiteboardOptions(session: Session, requester: UserIdAndName) case class SendWhiteboardOptions(session: Session, requester: UserIdAndName, - options: Map[String, String]) + options: Map[String, String]) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala new file mode 100755 index 0000000000..4acef993fc --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -0,0 +1,181 @@ +package org.bigbluebutton.core + +import akka.actor._ +import akka.actor.ActorLogging +import akka.pattern.{ ask, pipe } +import akka.util.Timeout +import scala.concurrent.duration._ +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.util._ +import org.bigbluebutton.core.api.ValidateAuthTokenTimedOut +import scala.util.Success +import scala.util.Failure + +object BigBlueButtonActor extends SystemConfiguration { + def props(system: ActorSystem, outGW: MessageOutGateway): Props = + Props(classOf[BigBlueButtonActor], system, outGW) +} + +class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) extends Actor with ActorLogging { + def actorRefFactory = context + implicit def executionContext = actorRefFactory.dispatcher + implicit val timeout = Timeout(5 seconds) + + private var meetings = new collection.immutable.HashMap[String, RunningMeeting] + + def receive = { + case msg: CreateMeeting => handleCreateMeeting(msg) + case msg: DestroyMeeting => handleDestroyMeeting(msg) + case msg: KeepAliveMessage => handleKeepAliveMessage(msg) + case msg: ValidateAuthToken => handleValidateAuthToken(msg) + case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) + case msg: InMessage => handleMeetingMessage(msg) + case _ => // do nothing + } + + private def handleValidateAuthToken(msg: ValidateAuthToken) { + meetings.get(msg.meetingID) foreach { m => + val future = m.actorRef.ask(msg)(5 seconds) + + future onComplete { + case Success(result) => { + log.debug("Got response from meeting=" + msg.meetingID + "].") + /** + * Received a reply from MeetingActor which means hasn't hung! + * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple + * audit to check whether the actor is still alive. (ralam feb 25, 2015) + */ + } + case Failure(failure) => { + log.warning("Failed to get response to from meeting=" + msg.meetingID + "]. Meeting has probably hung.") + outGW.send(new ValidateAuthTokenTimedOut(msg.meetingID, msg.userId, msg.token, false, msg.correlationId, msg.sessionId)) + } + } + } + } + + private def handleMeetingMessage(msg: InMessage): Unit = { + msg match { + case ucm: UserConnectedToGlobalAudio => { + val m = meetings.values.find(m => m.voiceBridge == ucm.voiceConf) + m foreach { mActor => mActor.actorRef ! ucm } + } + case udm: UserDisconnectedFromGlobalAudio => { + val m = meetings.values.find(m => m.voiceBridge == udm.voiceConf) + m foreach { mActor => mActor.actorRef ! udm } + } + case allOthers => { + meetings.get(allOthers.meetingID) match { + case None => handleMeetingNotFound(allOthers) + case Some(m) => { + // log.debug("Forwarding message [{}] to meeting [{}]", msg.meetingID) + m.actorRef ! allOthers + } + } + } + } + } + + private def handleMeetingNotFound(msg: InMessage) { + msg match { + case vat: ValidateAuthToken => { + log.info("No meeting [" + vat.meetingID + "] for auth token [" + vat.token + "]") + outGW.send(new ValidateAuthTokenReply(vat.meetingID, vat.userId, vat.token, false, vat.correlationId, vat.sessionId)) + } + case _ => { + log.info("No meeting [" + msg.meetingID + "] for message type [" + msg.getClass() + "]") + // do nothing + } + } + } + + private def handleKeepAliveMessage(msg: KeepAliveMessage): Unit = { + outGW.send(new KeepAliveMessageReply(msg.aliveID)) + } + + private def handleDestroyMeeting(msg: DestroyMeeting) { + log.info("BBBActor received DestroyMeeting message for meeting id [" + msg.meetingID + "]") + meetings.get(msg.meetingID) match { + case None => println("Could not find meeting id[" + msg.meetingID + "] to destroy.") + case Some(m) => { + m.actorRef ! StopMeetingActor + meetings -= msg.meetingID + log.info("Kick everyone out on meeting id[" + msg.meetingID + "].") + outGW.send(new EndAndKickAll(msg.meetingID, m.recorded)) + + log.info("Destroyed meeting id[" + msg.meetingID + "].") + outGW.send(new MeetingDestroyed(msg.meetingID)) + } + } + } + + private def handleCreateMeeting(msg: CreateMeeting): Unit = { + meetings.get(msg.meetingID) match { + case None => { + log.info("New meeting create request [" + msg.meetingName + "]") + var m = RunningMeeting(msg.meetingID, msg.externalMeetingID, msg.meetingName, msg.recorded, + msg.voiceBridge, msg.duration, + msg.autoStartRecording, msg.allowStartStopRecording, msg.moderatorPass, + msg.viewerPass, msg.createTime, msg.createDate, + outGW) + + meetings += m.meetingID -> m + outGW.send(new MeetingCreated(m.meetingID, m.externalMeetingID, m.recorded, m.meetingName, m.voiceBridge, msg.duration, + msg.moderatorPass, msg.viewerPass, msg.createTime, msg.createDate)) + + m.actorRef ! new InitializeMeeting(m.meetingID, m.recorded) + m.actorRef ! "StartTimer" + } + case Some(m) => { + log.info("Meeting already created [" + msg.meetingName + "]") + // do nothing + } + } + } + + private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { + + var len = meetings.keys.size + println("meetings.size=" + meetings.size) + println("len_=" + len) + + val set = meetings.keySet + val arr: Array[String] = new Array[String](len) + set.copyToArray(arr) + val resultArray: Array[MeetingInfo] = new Array[MeetingInfo](len) + + for (i <- 0 until arr.length) { + val id = arr(i) + val duration = meetings.get(arr(i)).head.duration + val name = meetings.get(arr(i)).head.meetingName + val recorded = meetings.get(arr(i)).head.recorded + val voiceBridge = meetings.get(arr(i)).head.voiceBridge + + var info = new MeetingInfo(id, name, recorded, voiceBridge, duration) + resultArray(i) = info + + //remove later + println("for a meeting:" + id) + println("Meeting Name = " + meetings.get(id).head.meetingName) + println("isRecorded = " + meetings.get(id).head.recorded) + println("voiceBridge = " + voiceBridge) + println("duration = " + duration) + + //send the users + self ! (new GetUsers(id, "nodeJSapp")) + + //send the presentation + self ! (new GetPresentationInfo(id, "nodeJSapp", "nodeJSapp")) + + //send chat history + self ! (new GetChatHistoryRequest(id, "nodeJSapp", "nodeJSapp")) + + //send lock settings + self ! (new GetLockSettings(id, "nodeJSapp")) + } + + outGW.send(new GetAllMeetingsReply(resultArray)) + } + +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala new file mode 100755 index 0000000000..d91834b215 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala @@ -0,0 +1,23 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api._ +import java.util.concurrent.CountDownLatch +import akka.actor.{ ActorSystem, Props } + +class BigBlueButtonGateway(outGW: MessageOutGateway) { + + implicit val system = ActorSystem("bigbluebutton-apps-system") + + val bbbActor = system.actorOf( + BigBlueButtonActor.props(system, outGW), + "bigbluebutton-actor") + + def accept(msg: InMessage): Unit = { + bbbActor ! msg + } + + def acceptKeepAlive(msg: KeepAliveMessage): Unit = { + bbbActor ! msg + } + +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala new file mode 100755 index 0000000000..eaf25f077a --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -0,0 +1,479 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.presentation.PreuploadedPresentationsUtil +import scala.collection.JavaConversions._ +import org.bigbluebutton.core.apps.poll.PollInGateway +import org.bigbluebutton.core.apps.layout.LayoutInGateway +import org.bigbluebutton.core.apps.chat.ChatInGateway +import scala.collection.JavaConversions._ +import org.bigbluebutton.core.apps.whiteboard.WhiteboardInGateway +import org.bigbluebutton.core.apps.voice.VoiceInGateway +import java.util.ArrayList +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.apps.presentation.Page +import org.bigbluebutton.core.apps.presentation.Presentation + +class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway, presUtil: PreuploadedPresentationsUtil) extends IBigBlueButtonInGW { + + // Meeting + def createMeeting2(meetingID: String, externalMeetingID: String, meetingName: String, record: Boolean, + voiceBridge: String, duration: Long, autoStartRecording: Boolean, + allowStartStopRecording: Boolean, moderatorPass: String, viewerPass: String, + createTime: Long, createDate: String) { + // println("******************** CREATING MEETING [" + meetingID + "] ***************************** ") + bbbGW.accept(new CreateMeeting(meetingID, externalMeetingID, meetingName, record, + voiceBridge, duration, autoStartRecording, + allowStartStopRecording, moderatorPass, viewerPass, + createTime, createDate)) + } + + def destroyMeeting(meetingID: String) { + // println("******************** DESTROY MEETING [" + meetingID + "] ***************************** ") + bbbGW.accept(new DestroyMeeting(meetingID)) + } + + def getAllMeetings(meetingID: String) { + println("******************** GET ALL MEETINGS ***************************** ") + bbbGW.accept(new GetAllMeetingsRequest("meetingId")) + } + + def isAliveAudit(aliveId: String) { + bbbGW.acceptKeepAlive(new KeepAliveMessage(aliveId)); + } + + def lockSettings(meetingID: String, locked: java.lang.Boolean, + lockSettings: java.util.Map[String, java.lang.Boolean]) { + + } + + def statusMeetingAudit(meetingID: String) { + + } + + def endMeeting(meetingID: String) { + // println("******************** END MEETING [" + meetingID + "] ***************************** ") + bbbGW.accept(new EndMeeting(meetingID)) + } + + def endAllMeetings() { + + } + + /** + * *********************************************************** + * Message Interface for Users + * *********************************************************** + */ + def validateAuthToken(meetingId: String, userId: String, token: String, correlationId: String, sessionId: String) { + // println("******************** VALIDATE TOKEN [" + token + "] ***************************** ") + bbbGW.accept(new ValidateAuthToken(meetingId, userId, token, correlationId, sessionId)) + } + + def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String, authToken: String): Unit = { + val userRole = if (role == "MODERATOR") Role.MODERATOR else Role.VIEWER + bbbGW.accept(new RegisterUser(meetingID, userID, name, userRole, extUserID, authToken)) + } + + def sendLockSettings(meetingID: String, userId: String, settings: java.util.Map[String, java.lang.Boolean]) { + // Convert java.util.Map to scala.collection.immutable.Map + // settings.mapValues -> convaert java Map to scala mutable Map + // v => v.booleanValue() -> convert java Boolean to Scala Boolean + // toMap -> converts from scala mutable map to scala immutable map + val s = settings.mapValues(v => v.booleanValue() /* convert java Boolean to Scala Boolean */ ).toMap + val disableCam = s.getOrElse("disableCam", false) + val disableMic = s.getOrElse("disableMic", false) + val disablePrivChat = s.getOrElse("disablePrivateChat", false) + val disablePubChat = s.getOrElse("disablePublicChat", false) + val lockedLayout = s.getOrElse("lockedLayout", false) + var lockOnJoin = s.getOrElse("lockOnJoin", false) + var lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) + + val permissions = new Permissions(disableCam = disableCam, + disableMic = disableMic, + disablePrivChat = disablePrivChat, + disablePubChat = disablePubChat, + lockedLayout = lockedLayout, + lockOnJoin = lockOnJoin, + lockOnJoinConfigurable = lockOnJoinConfigurable) + + bbbGW.accept(new SetLockSettings(meetingID, userId, permissions)) + } + + def initLockSettings(meetingID: String, settings: java.util.Map[String, java.lang.Boolean]) { + // Convert java.util.Map to scala.collection.immutable.Map + // settings.mapValues -> convert java Map to scala mutable Map + // v => v.booleanValue() -> convert java Boolean to Scala Boolean + // toMap -> converts from scala mutable map to scala immutable map + val s = settings.mapValues(v => v.booleanValue() /* convert java Boolean to Scala Boolean */ ).toMap + val disableCam = s.getOrElse("disableCam", false) + val disableMic = s.getOrElse("disableMic", false) + val disablePrivChat = s.getOrElse("disablePrivateChat", false) + val disablePubChat = s.getOrElse("disablePublicChat", false) + val lockedLayout = s.getOrElse("lockedLayout", false) + val lockOnJoin = s.getOrElse("lockOnJoin", false) + val lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) + val permissions = new Permissions(disableCam = disableCam, + disableMic = disableMic, + disablePrivChat = disablePrivChat, + disablePubChat = disablePubChat, + lockedLayout = lockedLayout, + lockOnJoin = lockOnJoin, + lockOnJoinConfigurable = lockOnJoinConfigurable) + + bbbGW.accept(new InitLockSettings(meetingID, permissions)) + } + + def initAudioSettings(meetingID: String, requesterID: String, muted: java.lang.Boolean) { + bbbGW.accept(new InitAudioSettings(meetingID, requesterID, muted.booleanValue())) + } + + def getLockSettings(meetingId: String, userId: String) { + bbbGW.accept(new GetLockSettings(meetingId, userId)) + } + + def lockUser(meetingId: String, requesterID: String, lock: Boolean, userId: String) { + bbbGW.accept(new LockUserRequest(meetingId, requesterID, userId, lock)) + } + + def setRecordingStatus(meetingId: String, userId: String, recording: java.lang.Boolean) { + bbbGW.accept(new SetRecordingStatus(meetingId, userId, recording.booleanValue())) + } + + def getRecordingStatus(meetingId: String, userId: String) { + bbbGW.accept(new GetRecordingStatus(meetingId, userId)) + } + + // Users + def userRaiseHand(meetingId: String, userId: String) { + bbbGW.accept(new UserRaiseHand(meetingId, userId)) + } + + def lowerHand(meetingId: String, userId: String, loweredBy: String) { + bbbGW.accept(new UserLowerHand(meetingId, userId, loweredBy)) + } + + def ejectUserFromMeeting(meetingId: String, userId: String, ejectedBy: String) { + bbbGW.accept(new EjectUserFromMeeting(meetingId, userId, ejectedBy)) + } + + def shareWebcam(meetingId: String, userId: String, stream: String) { + bbbGW.accept(new UserShareWebcam(meetingId, userId, stream)) + } + + def unshareWebcam(meetingId: String, userId: String, stream: String) { + bbbGW.accept(new UserUnshareWebcam(meetingId, userId, stream)) + } + + def setUserStatus(meetingID: String, userID: String, status: String, value: Object): Unit = { + bbbGW.accept(new ChangeUserStatus(meetingID, userID, status, value)); + } + + def getUsers(meetingID: String, requesterID: String): Unit = { + bbbGW.accept(new GetUsers(meetingID, requesterID)) + } + + def userLeft(meetingID: String, userID: String, sessionId: String): Unit = { + bbbGW.accept(new UserLeaving(meetingID, userID, sessionId)) + } + + def userJoin(meetingID: String, userID: String, authToken: String): Unit = { + bbbGW.accept(new UserJoining(meetingID, userID, authToken)) + } + + def assignPresenter(meetingID: String, newPresenterID: String, newPresenterName: String, assignedBy: String): Unit = { + bbbGW.accept(new AssignPresenter(meetingID, newPresenterID, newPresenterName, assignedBy)) + } + + def getCurrentPresenter(meetingID: String, requesterID: String): Unit = { + // do nothing + } + + def userConnectedToGlobalAudio(voiceConf: String, userid: String, name: String) { + // we are required to pass the meeting_id as first parameter (just to satisfy trait) + // but it's not used anywhere. That's why we pass voiceConf twice instead + bbbGW.accept(new UserConnectedToGlobalAudio(voiceConf, voiceConf, userid, name)) + } + + def userDisconnectedFromGlobalAudio(voiceConf: String, userid: String, name: String) { + // we are required to pass the meeting_id as first parameter (just to satisfy trait) + // but it's not used anywhere. That's why we pass voiceConf twice instead + bbbGW.accept(new UserDisconnectedFromGlobalAudio(voiceConf, voiceConf, userid, name)) + } + + /** + * ************************************************************************************ + * Message Interface for Presentation + * ************************************************************************************ + */ + + def clear(meetingID: String) { + bbbGW.accept(new ClearPresentation(meetingID)) + } + + def sendConversionUpdate(messageKey: String, meetingId: String, + code: String, presentationId: String, presName: String) { + bbbGW.accept(new PresentationConversionUpdate(meetingId, messageKey, + code, presentationId, presName)) + } + + def sendPageCountError(messageKey: String, meetingId: String, + code: String, presentationId: String, numberOfPages: Int, + maxNumberPages: Int, presName: String) { + bbbGW.accept(new PresentationPageCountError(meetingId, messageKey, + code, presentationId, numberOfPages, maxNumberPages, presName)) + } + + def sendSlideGenerated(messageKey: String, meetingId: String, + code: String, presentationId: String, numberOfPages: Int, + pagesCompleted: Int, presName: String) { + bbbGW.accept(new PresentationSlideGenerated(meetingId, messageKey, + code, presentationId, numberOfPages, pagesCompleted, presName)) + } + + def generatePresentationPages(presId: String, numPages: Int, presBaseUrl: String): scala.collection.immutable.HashMap[String, Page] = { + var pages = new scala.collection.immutable.HashMap[String, Page] + val baseUrl = + for (i <- 1 to numPages) { + val id = presId + "/" + i + val num = i; + val current = if (i == 1) true else false + val thumbnail = presBaseUrl + "/thumbnail/" + i + val swfUri = presBaseUrl + "/slide/" + i + + val txtUri = presBaseUrl + "/textfiles/" + i + val pngUri = presBaseUrl + "/png/" + i + + val p = new Page(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri, + txtUri = txtUri, pngUri = pngUri, + current = current) + pages += (p.id -> p) + } + + pages + } + + def sendConversionCompleted(messageKey: String, meetingId: String, + code: String, presentationId: String, numPages: Int, + presName: String, presBaseUrl: String) { + // println("******************** PRESENTATION CONVERSION COMPLETED MESSAGE ***************************** ") + val pages = generatePresentationPages(presentationId, numPages, presBaseUrl) + + val presentation = new Presentation(id = presentationId, name = presName, pages = pages) + bbbGW.accept(new PresentationConversionCompleted(meetingId, messageKey, + code, presentation)) + + } + + def removePresentation(meetingID: String, presentationID: String) { + bbbGW.accept(new RemovePresentation(meetingID, presentationID)) + } + + def getPresentationInfo(meetingID: String, requesterID: String, replyTo: String) { + // println("**** Forwarding GetPresentationInfo for meeting[" + meetingID + "] ****") + bbbGW.accept(new GetPresentationInfo(meetingID, requesterID, replyTo)) + } + + def sendCursorUpdate(meetingID: String, xPercent: Double, yPercent: Double) { + bbbGW.accept(new SendCursorUpdate(meetingID, xPercent, yPercent)) + } + + def resizeAndMoveSlide(meetingID: String, xOffset: Double, yOffset: Double, widthRatio: Double, heightRatio: Double) { + bbbGW.accept(new ResizeAndMoveSlide(meetingID, xOffset, yOffset, widthRatio, heightRatio)) + } + + def gotoSlide(meetingID: String, pageId: String) { + // println("**** Forwarding GotoSlide for meeting[" + meetingID + "] ****") + bbbGW.accept(new GotoSlide(meetingID, pageId)) + } + + def sharePresentation(meetingID: String, presentationID: String, share: Boolean) { + bbbGW.accept(new SharePresentation(meetingID, presentationID, share)) + } + + def getSlideInfo(meetingID: String, requesterID: String, replyTo: String) { + bbbGW.accept(new GetSlideInfo(meetingID, requesterID, replyTo)) + } + + /** + * ************************************************************ + * Message Interface Polling + * ************************************************************ + */ + val pollGW = new PollInGateway(bbbGW) + + def getPolls(meetingID: String, requesterID: String) { + pollGW.getPolls(meetingID, requesterID) + } + + def preCreatedPoll(meetingID: String, msg: String) { + pollGW.preCreatedPoll(meetingID, msg) + } + + def createPoll(meetingID: String, requesterID: String, msg: String) { + pollGW.createPoll(meetingID, requesterID, msg) + } + + def updatePoll(meetingID: String, requesterID: String, msg: String) { + pollGW.updatePoll(meetingID, requesterID, msg) + } + + def startPoll(meetingID: String, requesterID: String, msg: String) { + pollGW.startPoll(meetingID, requesterID, msg) + } + + def stopPoll(meetingID: String, requesterID: String, msg: String) { + pollGW.stopPoll(meetingID, requesterID, msg) + } + + def removePoll(meetingID: String, requesterID: String, msg: String) { + pollGW.removePoll(meetingID, requesterID, msg) + } + + def respondPoll(meetingID: String, requesterID: String, msg: String) { + pollGW.respondPoll(meetingID, requesterID, msg) + } + + def showPollResult(meetingID: String, requesterID: String, msg: String) { + pollGW.showPollResult(meetingID, requesterID, msg) + } + + def hidePollResult(meetingID: String, requesterID: String, msg: String) { + pollGW.hidePollResult(meetingID, requesterID, msg) + } + + /** + * *********************************************************************** + * Message Interface for Layout + * ******************************************************************* + */ + val layoutGW = new LayoutInGateway(bbbGW) + + def getCurrentLayout(meetingID: String, requesterID: String) { + layoutGW.getCurrentLayout(meetingID, requesterID) + } + + def broadcastLayout(meetingID: String, requesterID: String, layout: String) { + layoutGW.broadcastLayout(meetingID, requesterID, layout) + } + + def lockLayout(meetingId: String, setById: String, + lock: Boolean, viewersOnly: Boolean, + layout: scala.Option[String]) { + layoutGW.lockLayout(meetingId, setById, lock, viewersOnly, layout) + } + + /** + * ******************************************************************* + * Message Interface for Chat + * ***************************************************************** + */ + val chatGW = new ChatInGateway(bbbGW) + + def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { + chatGW.getChatHistory(meetingID, requesterID, replyTo) + } + + def sendPublicMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { + // Convert java Map to Scala Map, then convert Mutable map to immutable map + chatGW.sendPublicMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) + } + + def sendPrivateMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { + chatGW.sendPrivateMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) + } + + /** + * ******************************************************************* + * Message Interface for Whiteboard + * ***************************************************************** + */ + val wbGW = new WhiteboardInGateway(bbbGW) + + def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) { + wbGW.sendWhiteboardAnnotation(meetingID, requesterID, mapAsScalaMap(annotation).toMap) + } + + def requestWhiteboardAnnotationHistory(meetingID: String, requestedID: String, whiteboardId: String, replyTo: String) { + wbGW.requestWhiteboardAnnotationHistory(meetingID, requestedID, whiteboardId, replyTo) + } + + def clearWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { + wbGW.clearWhiteboard(meetingID, requestedID, whiteboardId); + } + + def undoWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { + wbGW.undoWhiteboard(meetingID, requestedID, whiteboardId) + } + + def enableWhiteboard(meetingID: String, requestedID: String, enable: java.lang.Boolean) { + wbGW.enableWhiteboard(meetingID, requestedID, enable) + } + + def isWhiteboardEnabled(meetingID: String, requestedID: String, replyTo: String) { + wbGW.isWhiteboardEnabled(meetingID, requestedID, replyTo) + } + + /** + * ******************************************************************* + * Message Interface for Voice + * ***************************************************************** + */ + val voiceGW = new VoiceInGateway(bbbGW) + + def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: java.lang.Boolean) { + voiceGW.muteAllExceptPresenter(meetingID, requesterID, mute) + } + + def muteAllUsers(meetingID: String, requesterID: String, mute: java.lang.Boolean) { + voiceGW.muteAllUsers(meetingID, requesterID, mute) + } + + def isMeetingMuted(meetingID: String, requesterID: String) { + voiceGW.isMeetingMuted(meetingID, requesterID) + } + + def muteUser(meetingID: String, requesterID: String, userID: String, mute: java.lang.Boolean) { + voiceGW.muteUser(meetingID, requesterID, userID, mute) + } + + def lockMuteUser(meetingID: String, requesterID: String, userID: String, lock: java.lang.Boolean) { + voiceGW.lockUser(meetingID, requesterID, userID, lock) + } + + def ejectUserFromVoice(meetingId: String, userId: String, ejectedBy: String) { + voiceGW.ejectUserFromVoice(meetingId, userId, ejectedBy) + } + + def voiceUserJoined(meetingId: String, userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, + muted: java.lang.Boolean, speaking: java.lang.Boolean) { + + voiceGW.voiceUserJoined(meetingId, userId, webUserId, + conference, callerIdNum, + callerIdName, muted, speaking) + } + + def voiceUserLeft(meetingId: String, userId: String) { + voiceGW.voiceUserLeft(meetingId, userId) + } + + def voiceUserLocked(meetingId: String, userId: String, locked: java.lang.Boolean) { + voiceGW.voiceUserLocked(meetingId, userId, locked) + } + + def voiceUserMuted(meetingId: String, userId: String, muted: java.lang.Boolean) { + voiceGW.voiceUserMuted(meetingId, userId, muted) + } + + def voiceUserTalking(meetingId: String, userId: String, talking: java.lang.Boolean) { + voiceGW.voiceUserTalking(meetingId, userId, talking) + } + + def voiceRecording(meetingId: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + voiceGW.voiceRecording(meetingId, recordingFile, + timestamp, recording) + } +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala new file mode 100755 index 0000000000..42d6cd266e --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala @@ -0,0 +1,2160 @@ +package org.bigbluebutton.core + +import akka.actor._ +import akka.actor.ActorLogging +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.mutable.HashMap +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import java.util.ArrayList +import org.bigbluebutton.core.apps.poll.PollVO +import org.bigbluebutton.core.apps.presentation.Page +import org.bigbluebutton.core.apps.presentation.Presentation +import org.bigbluebutton.core.apps.chat.redis.ChatMessageToJsonConverter +import org.bigbluebutton.core.apps.presentation.redis.PesentationMessageToJsonConverter +import org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardMessageToJsonConverter +import org.bigbluebutton.core.meeting.MeetingMessageToJsonConverter +import org.bigbluebutton.core.apps.users.redis.UsersMessageToJsonConverter + +class CollectorActor(dispatcher: IDispatcher) extends Actor { + + def receive = { + //IN MESSAGES + case msg: CreateMeeting => handleCreateMeeting(msg) + case msg: InitializeMeeting => handleInitializeMeeting(msg) + case msg: DestroyMeeting => handleDestroyMeeting(msg) + case msg: StartMeeting => handleStartMeeting(msg) + case msg: EndMeeting => handleEndMeeting(msg) + case msg: LockSetting => handleLockSetting(msg) + case msg: LockUser => handleLockUser(msg) + case msg: InitLockSettings => handleInitLockSettings(msg) + case msg: InitAudioSettings => handleInitAudioSettings(msg) + case msg: SetLockSettings => handleSetLockSettings(msg) + case msg: GetLockSettings => handleGetLockSettings(msg) + case msg: ValidateAuthToken => handleValidateAuthToken(msg) + case msg: RegisterUser => handleRegisterUser(msg) + case msg: UserJoining => handleUserJoining(msg) + case msg: UserLeaving => handleUserLeaving(msg) + case msg: GetUsers => handleGetUsers(msg) + case msg: UserRaiseHand => handleUserRaiseHand(msg) + case msg: UserLowerHand => handleUserLowerHand(msg) + case msg: UserShareWebcam => handleUserShareWebcam(msg) + case msg: UserUnshareWebcam => handleUserUnshareWebcam(msg) + case msg: ChangeUserStatus => handleChangeUserStatus(msg) + case msg: AssignPresenter => handleAssignPresenter(msg) + case msg: SetRecordingStatus => handleSetRecordingStatus(msg) + case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) + case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) + case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) + case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) + case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) + case msg: PreCreatedPoll => handlePreCreatedPoll(msg) + case msg: CreatePoll => handleCreatePoll(msg) + case msg: UpdatePoll => handleUpdatePoll(msg) + case msg: GetPolls => handleGetPolls(msg) + case msg: DestroyPoll => handleDestroyPoll(msg) + case msg: RemovePoll => handleRemovePoll(msg) + case msg: SharePoll => handleSharePoll(msg) + case msg: ShowPollResult => handleShowPollResult(msg) + case msg: HidePollResult => handleHidePollResult(msg) + case msg: StopPoll => handleStopPoll(msg) + case msg: StartPoll => handleStartPoll(msg) + case msg: ClearPoll => handleClearPoll(msg) + case msg: GetPollResult => handleGetPollResult(msg) + case msg: RespondToPoll => handleRespondToPoll(msg) + case msg: ClearPresentation => handleClearPresentation(msg) + case msg: RemovePresentation => handleRemovePresentation(msg) + case msg: GetPresentationInfo => handleGetPresentationInfo(msg) + //case msg: SendCursorUpdate => handleSendCursorUpdate(msg) + case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) + case msg: GotoSlide => handleGotoSlide(msg) + case msg: SharePresentation => handleSharePresentation(msg) + case msg: GetSlideInfo => handleGetSlideInfo(msg) + case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) + case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) + case msg: PresentationPageCountError => handlePresentationPageCountError(msg) + case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) + case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) + case msg: SendVoiceUsersRequest => handleSendVoiceUsersRequest(msg) + case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) + case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) + case msg: MuteUserRequest => handleMuteUserRequest(msg) + case msg: LockUserRequest => handleLockUserRequest(msg) + case msg: EjectUserFromVoiceRequest => handleEjectUserFromVoiceRequest(msg) + case msg: VoiceUserJoinedMessage => handleVoiceUserJoinedMessage(msg) + case msg: VoiceUserJoined => handleVoiceUserJoined(msg) + case msg: VoiceUserLeft => handleVoiceUserLeft(msg) + case msg: VoiceUserLocked => handleVoiceUserLocked(msg) + case msg: VoiceUserMuted => handleVoiceUserMuted(msg) + case msg: VoiceUserTalking => handleVoiceUserTalking(msg) + case msg: VoiceRecording => handleVoiceRecording(msg) + case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) + case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) + case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) + case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) + case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) + case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) + case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) + + //OUT MESSAGES + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) + case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingHasEnded => handleMeetingHasEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) + case msg: DisconnectUser => handleDisconnectUser(msg) + case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) + case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) + case msg: UserLocked => handleUserLocked(msg) + case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) + case msg: UserRegistered => handleUserRegistered(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: PresenterAssigned => handlePresenterAssigned(msg) + case msg: EndAndKickAll => handleEndAndKickAll(msg) + case msg: GetUsersReply => handleGetUsersReply(msg) + case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserRaisedHand => handleUserRaisedHand(msg) + case msg: UserLoweredHand => handleUserLoweredHand(msg) + case msg: UserSharedWebcam => handleUserSharedWebcam(msg) + case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) + case msg: UserStatusChange => handleUserStatusChange(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: UserVoiceMuted => handleUserVoiceMuted(msg) + case msg: UserVoiceTalking => handleUserVoiceTalking(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) + case msg: StartRecording => handleStartRecording(msg) + case msg: StopRecording => handleStopRecording(msg) + case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) + case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) + case msg: GetCurrentLayoutReply => handleGetCurrentLayoutReply(msg) + case msg: BroadcastLayoutEvent => handleBroadcastLayoutEvent(msg) + case msg: GetPollResultReply => handleGetPollResultReply(msg) + case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) + case msg: ClearPollFailed => handleClearPollFailed(msg) + case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) + case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) + case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) + case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) + case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) + case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) + case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) + case msg: PollHideResultOutMsg => handlePollHideResultOutMsg(msg) + case msg: PollShowResultOutMsg => handlePollShowResultOutMsg(msg) + case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) + case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) + case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) + //case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) + case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) + case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) + case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) + case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) + case msg: GetPreuploadedPresentationsOutMsg => handleGetPreuploadedPresentationsOutMsg(msg) + case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) + case msg: PresentationConversionError => handlePresentationConversionError(msg) + case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) + case msg: PresentationConversionDone => handlePresentationConversionDone(msg) + case msg: PresentationChanged => handlePresentationChanged(msg) + case msg: GetPresentationStatusReply => handleGetPresentationStatusReply(msg) + case msg: PresentationRemoved => handlePresentationRemoved(msg) + case msg: PageChanged => handlePageChanged(msg) + case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) + case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) + case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) + case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) + case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) + case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) + case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) + + case _ => // do nothing + } + + private def buildUserHashMap(user: UserVO): java.util.HashMap[String, Object] = { + val vu = user.voiceUser + val vuser = new java.util.HashMap[String, Object]() + vuser.put(Constants.USER_ID, vu.userId) + vuser.put(Constants.WEB_USER_ID, vu.webUserId) + vuser.put(Constants.CALLER_ID_NAME, vu.callerName) + vuser.put(Constants.CALLER_ID_NUM, vu.callerNum) + vuser.put(Constants.JOINED, vu.joined: java.lang.Boolean) + vuser.put(Constants.LOCKED, vu.locked: java.lang.Boolean) + vuser.put(Constants.MUTED, vu.muted: java.lang.Boolean) + vuser.put(Constants.TALKING, vu.talking: java.lang.Boolean) + + val wuser = new java.util.HashMap[String, Object]() + wuser.put(Constants.USER_ID, user.userID) + wuser.put(Constants.EXT_USER_ID, user.externUserID) + wuser.put(Constants.NAME, user.name) + wuser.put(Constants.ROLE, user.role.toString()) + wuser.put(Constants.RAISE_HAND, user.raiseHand: java.lang.Boolean) + wuser.put(Constants.PRESENTER, user.presenter: java.lang.Boolean) + wuser.put(Constants.HAS_STREAM, user.hasStream: java.lang.Boolean) + wuser.put(Constants.LOCKED, user.locked: java.lang.Boolean) + wuser.put("webcamStream", user.webcamStreams mkString ("|")) + wuser.put(Constants.PHONE_USER, user.phoneUser: java.lang.Boolean) + wuser.put(Constants.VOICE_USER, vuser) + + wuser + } + + private def buildJson(header: java.util.HashMap[String, Any], + payload: java.util.HashMap[String, Any]): String = { + + val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() + message.put(Constants.HEADER, header) + message.put(Constants.PAYLOAD, payload) + + val gson = new Gson() + gson.toJson(message) + } + + // IN MESSAGES + private def handleCreateMeeting(msg: CreateMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) + payload.put(Constants.MEETING_NAME, msg.meetingName) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.VOICE_CONF, msg.voiceBridge) + payload.put(Constants.DURATION, msg.duration) + payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) + payload.put(Constants.VIEWER_PASS, msg.viewerPass) + payload.put(Constants.CREATE_TIME, msg.createTime) + payload.put(Constants.CREATE_DATE, msg.createDate) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CREATE_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CREATE MEETING *****************") + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleInitializeMeeting(msg: InitializeMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.INITIALIZE_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING INITIALIZE MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleDestroyMeeting(msg: DestroyMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DESTROY_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DESTROY MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStartMeeting(msg: StartMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.START_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING START MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEndMeeting(msg: EndMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING END MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockSetting(msg: LockSetting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.LOCKED, msg.locked) + + val settingsMap = new java.util.HashMap[String, Boolean]() + for ((key, value) <- msg.settings) { + settingsMap.put(key, value) + } + + payload.put("settings", settingsMap) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING LOCK SETTING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockUser(msg: LockUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCK, msg.lock) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING LOCK USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleInitLockSettings(msg: InitLockSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.settings.toString()) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.INIT_LOCK_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING INIT LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleInitAudioSettings(msg: InitAudioSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MUTED, msg.muted.toString()) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.INIT_AUDIO_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING INIT LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSetLockSettings(msg: SetLockSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.settings.toString()) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SET_LOCK_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SET LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetLockSettings(msg: GetLockSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_LOCK_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleValidateAuthToken(msg: ValidateAuthToken) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.AUTH_TOKEN, msg.token) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VALIDATE AUTH TOKEN *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleRegisterUser(msg: RegisterUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.NAME, msg.name) + payload.put(Constants.ROLE, msg.role.toString()) + payload.put(Constants.EXT_USER_ID, msg.extUserID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.REGISTER_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING REGISTER USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserJoining(msg: UserJoining) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_JOINING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HANDLE USER JOINING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLeaving(msg: UserLeaving) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LEAVING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HANDLE USER LEAVING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetUsers(msg: GetUsers) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_USERS) + + /** + * Let's temporarily have this convention as correlationId + */ + val replyTo = msg.meetingID + "/" + msg.requesterID + header.put(Constants.REPLY_TO, replyTo) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HANDLE GET USERS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserRaiseHand(msg: UserRaiseHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.RAISE_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER RAISE HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLowerHand(msg: UserLowerHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOWERED_BY, msg.loweredBy) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.LOWER_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LOWER HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserShareWebcam(msg: UserShareWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.STREAM, msg.stream) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_SHARE_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER SHARE WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserUnshareWebcam(msg: UserUnshareWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_UNSHARE_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER UNSHARE WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleChangeUserStatus(msg: ChangeUserStatus) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STATUS, msg.status) + payload.put(Constants.VALUE, msg.value) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CHANGE_USER_STATUS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CHANGE USER STATUS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleAssignPresenter(msg: AssignPresenter) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.NEW_PRESENTER_ID, msg.newPresenterID) + payload.put(Constants.NEW_PRESENTER_NAME, msg.newPresenterName) + payload.put(Constants.ASSIGNED_BY, msg.assignedBy) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.ASSIGN_PRESENTER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING ASSIGN PRESENTER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSetRecordingStatus(msg: SetRecordingStatus) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SET_RECORDING_STATUS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SET RECORDING STATUS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_CHAT_HISTORY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET CHAT HISTORY REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val messageMap = new java.util.HashMap[String, String]() + for ((key, value) <- msg.message) { + messageMap.put(key, value) + } + payload.put("message", messageMap) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_PUBLIC_MESSAGE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND PUBLIC MESSAGE REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val messageMap = new java.util.HashMap[String, String]() + for ((key, value) <- msg.message) { + messageMap.put(key, value) + } + payload.put("message", messageMap) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_PRIVATE_CHAT_MESSAGE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND PRIVATE MESSAGE REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET CURRENT LAYOUT REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.LAYOUT, msg.layout) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockLayoutRequest(msg: LockLayoutRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.setById) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.UNLOCK_LAYOUT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePreCreatedPoll(msg: PreCreatedPoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL, msg.poll) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRECREATED_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRE CREATED POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleCreatePoll(msg: CreatePoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL, msg.poll) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CREATE_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CREATE POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUpdatePoll(msg: UpdatePoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL, msg.poll) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.UPDATE_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING UPDATE POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPolls(msg: GetPolls) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_POLLS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET POLLS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleDestroyPoll(msg: DestroyPoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DESTROY_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DESTROY POLLS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleRemovePoll(msg: RemovePoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.REMOVE_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING REMOVE POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSharePoll(msg: SharePoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SHARE_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SHARE POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleShowPollResult(msg: ShowPollResult) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SHOW_POLL_RESULT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SHOW POLL RESULTS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleHidePollResult(msg: HidePollResult) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.HIDE_POLL_RESULT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HIDE POLL RESULTS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStopPoll(msg: StopPoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.STOP_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING STOP POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStartPoll(msg: StartPoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.START_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING START POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearPoll(msg: ClearPoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + payload.put(Constants.FORCE, msg.force) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CLEAR_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CLEAR POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPollResult(msg: GetPollResult) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_POLL_RESULT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET POLL RESULT *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleRespondToPoll(msg: RespondToPoll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.RESPONSE, msg.response) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.RESPONT_TO_POLL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING RESPOND TO POLL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearPresentation(msg: ClearPresentation) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CLEAR_PRESENTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CLEAR PRESENTATION *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleRemovePresentation(msg: RemovePresentation) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.REMOVE_PRESENTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING REMOVE PRESENTATION *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPresentationInfo(msg: GetPresentationInfo) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_PRESENTATION_INFO) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET PRESENTATION INFO *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + /*private def handleSendCursorUpdate(msg: SendCursorUpdate) { + var map = new java.util.HashMap[String, Any]() + map.put("meetingID", msg.meetingID) + map.put("xPercent", msg.xPercent) + map.put("yPercent", msg.yPercent) + map.put("timestamp", TimestampGenerator.generateTimestamp) + + println("***** DISPATCHING SEND CURSOR UPDATE *****************") + dispatcher.dispatch(buildJson(header, payload)) + }*/ + + private def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.X_OFFSET, msg.xOffset) + payload.put(Constants.Y_OFFSET, msg.yOffset) + payload.put(Constants.WIDTH_RATIO, msg.widthRatio) + payload.put(Constants.HEIGHT_RATIO, msg.heightRatio) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.RESIZE_AND_MOVE_SLIDE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING RESIZE AND MOVE SLIDE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGotoSlide(msg: GotoSlide) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, msg.page) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GO_TO_SLIDE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GO TO SLIDE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSharePresentation(msg: SharePresentation) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationID) + payload.put(Constants.SHARE, msg.share) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SHARE_PRESENTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SHARE PRESENTATION *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetSlideInfo(msg: GetSlideInfo) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_SLIDE_INFO) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET SLIDE INFO *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePreuploadedPresentations(msg: PreuploadedPresentations) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATIONS, msg.presentations.toString()) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PREUPLOADED_PRESENTATIONS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PREUPLOADED PRESENTATIONS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presName) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_UPDATE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION CONVERSION UPDATE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationPageCountError(msg: PresentationPageCountError) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_COUNT_ERROR) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION PAGE COUNT ERROR *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_GENERATED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION SLIDE GENERATED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentation) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_COMPLETED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION CONVERSION COMPLETED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendVoiceUsersRequest(msg: SendVoiceUsersRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_VOICE_USERS_REQUEST) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND VOICE USERS REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleMuteMeetingRequest(msg: MuteMeetingRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTE, msg.mute) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.MUTE_MEETING_REQUEST) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING MUTE MEETING REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING IS MEETING MUTED REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleMuteUserRequest(msg: MuteUserRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.MUTE, msg.mute) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.MUTE_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING MUTE USER REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockUserRequest(msg: LockUserRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LOCK, msg.lock) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.LOCK_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING LOCK USER REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEjectUserFromVoiceRequest(msg: EjectUserFromVoiceRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.ejectedBy) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.EJECT_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING EJECT USER REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserJoinedMessage(msg: VoiceUserJoinedMessage) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.voiceConfId) + payload.put(Constants.CALLER_ID_NUM, msg.callerIdNum) + payload.put(Constants.CALLER_ID_NAME, msg.callerIdName) + payload.put(Constants.MUTED, msg.muted) + payload.put(Constants.TALKING, msg.talking) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED_MESSAGE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER JOINED MESSAGE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserJoined(msg: VoiceUserJoined) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.VOICE_USER, msg.voiceUser) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER JOINED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserLeft(msg: VoiceUserLeft) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_LEFT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER LEFT *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserLocked(msg: VoiceUserLocked) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCKED, msg.locked) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_LOCKED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER LOCKED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserMuted(msg: VoiceUserMuted) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.MUTED, msg.muted) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_MUTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER MUTED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserTalking(msg: VoiceUserTalking) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.TALKING, msg.talking) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_TALKING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER TALKING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceRecording(msg: VoiceRecording) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDING_FILE, msg.recordingFile) + payload.put(Constants.TIMESTAMP, msg.timestamp) + payload.put(Constants.RECORDING, msg.recording) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_RECORDING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE RECORDING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ANNOTATION, msg.annotation) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_WHITEBOARD_ANNOTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND WHITEBOARD ANNOTATION REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_WHITEBOARD_SHAPES) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND WHITEBOARD SHAPES REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CLEAR_WHITEBOARD) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CLEAR WHITEBOARD REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.UNDO_WHITEBOARD) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING UNDO WHITEBOARD REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ENABLE, msg.enable) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.ENABLE_WHITEBOARD) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING ENABLE WHITEBOARD REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.IS_WHITEBOARD_ENABLED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING IS WHITEBOARD ENABLED REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { + println("***** DISPATCHING GET ALL MEETINGS REQUEST *****************") + } + + // OUT MESSAGES + private def handleMeetingCreated(msg: MeetingCreated) { + val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { + val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { + val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { + val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handleMeetingEnded(msg: MeetingEnded) { + val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleMeetingHasEnded(msg: MeetingHasEnded) { + val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DISCONNECT_ALL_USERS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DISCONNECT ALL USERS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleDisconnectUser(msg: DisconnectUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DISCONNECT_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DISCONNECT USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PERMISSION_SETTING_INITIALIZED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PERMISSIONS SETTING INIIALIZED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.NEW_PERMISSION_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING NEW PERMISSIONS SETTING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLocked(msg: UserLocked) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCKED, msg.lock) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LOCKED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LOCKED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_PERMISSION_SETTINGS_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserRegistered(msg: UserRegistered) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_REGISTERED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER REGISTERED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLeft(msg: UserLeft) { + val json = UsersMessageToJsonConverter.userLeftToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresenterAssigned(msg: PresenterAssigned) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); + payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); + payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTER_ASSIGNED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTER ASSIGNED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEndAndKickAll(msg: EndAndKickAll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_AND_KICK_ALL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING END AND KICK ALL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetUsersReply(msg: GetUsersReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val users = new ArrayList[java.util.HashMap[String, Object]]; + msg.users.foreach(uvo => { + users.add(buildUserHashMap(uvo)) + }) + + payload.put(Constants.USERS, users) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_USERS_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET USERS REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterId) + payload.put(Constants.AUTH_TOKEN, msg.token) + payload.put(Constants.VALID, msg.valid) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VALIDATE AUTH TOKEN REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserJoined(msg: UserJoined) { + val json = UsersMessageToJsonConverter.userJoinedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleUserRaisedHand(msg: UserRaisedHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_RAISED_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER RAISED HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLoweredHand(msg: UserLoweredHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LOWERED_BY, msg.loweredBy) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LOWERED_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LOWERED HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserSharedWebcam(msg: UserSharedWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_SHARED_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER SHARED WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_UNSHARED_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER UNSHARED WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserStatusChange(msg: UserStatusChange) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STATUS, msg.status) + payload.put(Constants.VALUE, msg.value) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_STATUS_CHANGED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER STATUS CHANGE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTE, msg.mute) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.MUTE_VOICE_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING MUTE VOICE USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserVoiceMuted(msg: UserVoiceMuted) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_VOICE_MUTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER VOICE MUTED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserVoiceTalking(msg: UserVoiceTalking) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_VOICE_TALKING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER VOICE TALKING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.EJECT_VOICE_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING EJECT VOICE USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_JOINED_VOICE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER JOINED VOICE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LEFT_VOICE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LEFT VOICE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTED, msg.meetingMuted) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING IS MEETING MUTED REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStartRecording(msg: StartRecording) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.START_RECORDING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING START RECORDING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStopRecording(msg: StopRecording) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.STOP_RECORDING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING STOP RECORDING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { + val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { + val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetCurrentLayoutReply(msg: GetCurrentLayoutReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.LAYOUT_ID, msg.layoutID) + payload.put(Constants.LOCKED, msg.locked) + payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET CURRENT LAYOUT REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleBroadcastLayoutEvent(msg: BroadcastLayoutEvent) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.LAYOUT_ID, msg.layoutID) + payload.put(Constants.LOCKED, msg.locked) + payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING BROADCAST LAYOUT EVENT *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPollResultReply(msg: GetPollResultReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.POLL, msg.pollVO) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_POLL_RESULT_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET POLL RESULT REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val collection = new ArrayList[PollVO](); + msg.polls.foreach(p => { + collection.add(p) + }) + + payload.put(Constants.POLLS, collection) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_POLLS_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET POLLS REPLY OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearPollFailed(msg: ClearPollFailed) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.REASON, msg.reason) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CLEAR_POLL_FAILED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CLEAR POLL FAILED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_CLEARED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL CLEARED OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_STARTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL STARTED OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_STOPPED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL STOPPED OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_REMOVED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL REMOVED OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + payload.put(Constants.POLL, msg.pollVO) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_UPDATED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL UPDATED OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + payload.put(Constants.POLL, msg.pollVO) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_CREATED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL CREATED OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RESPONDER, msg.responder) + payload.put(Constants.RESPONSE, msg.response) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_RESPONSE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL RESPONSE OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollHideResultOutMsg(msg: PollHideResultOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_HIDE_RESULT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL HIDE RESULT OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePollShowResultOutMsg(msg: PollShowResultOutMsg) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.POLL_ID, msg.pollID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.POLL_SHOW_RESULT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING POLL SHOW RESULT OUTMSG *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { + val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { + val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) + // Comment out as we don't want to store cursor updates (ralam may 7, 2014) + //dispatcher.dispatch(json) + } + + private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { + val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { + val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { + val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { + val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationConversionError(msg: PresentationConversionError) { + val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { + val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationConversionDone(msg: PresentationConversionDone) { + val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationChanged(msg: PresentationChanged) { + val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { + val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationRemoved(msg: PresentationRemoved) { + val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePageChanged(msg: PageChanged) { + val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { + val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { + val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { + val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { + val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) + dispatcher.dispatch(json) + } + private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { + val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) + println("***** DISPATCHING GET ALL MEETINGS REPLY OUTMSG *****************") + dispatcher.dispatch(json) + } +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala new file mode 100755 index 0000000000..c81112dd8e --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala @@ -0,0 +1,22 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api.IDispatcher +import org.bigbluebutton.core.api.InMessage +import org.bigbluebutton.core.api.IOutMessage +import org.bigbluebutton.core.api.OutMessageListener2 + +class CollectorGateway(dispatcher: IDispatcher) extends OutMessageListener2 { + + // FIXME + // private val collActor = new CollectorActor(dispatcher) + + // collActor.start + + def collectInMessage(msg: InMessage) { + // collActor ! msg + } + + def handleMessage(msg: IOutMessage) { + // collActor ! msg + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala new file mode 100755 index 0000000000..8ec787f108 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -0,0 +1,265 @@ +package org.bigbluebutton.core + +import akka.actor.Actor +import akka.actor.ActorRef +import akka.actor.ActorLogging +import akka.actor.Props +import akka.util.Timeout +import scala.concurrent.duration._ +import org.bigbluebutton.core.apps.poll.Poll +import org.bigbluebutton.core.apps.poll.PollApp +import org.bigbluebutton.core.apps.users.UsersApp +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.apps.presentation.PresentationApp +import org.bigbluebutton.core.apps.layout.LayoutApp +import org.bigbluebutton.core.apps.chat.ChatApp +import org.bigbluebutton.core.apps.whiteboard.WhiteboardApp +import java.util.concurrent.TimeUnit +import org.bigbluebutton.core.util._ +import akka.actor.ActorContext +import scala.concurrent.ExecutionContext.Implicits.global + +case object StopMeetingActor + +object MeetingActor { + def props(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, + voiceBridge: String, duration: Long, + autoStartRecording: Boolean, allowStartStopRecording: Boolean, + moderatorPass: String, viewerPass: String, + createTime: Long, createDate: String, + outGW: MessageOutGateway)(implicit context: ActorContext): Props = + Props(classOf[MeetingActor], meetingID, externalMeetingID, meetingName, recorded, + voiceBridge, duration, + autoStartRecording, allowStartStopRecording, + moderatorPass, viewerPass, + createTime, createDate, + outGW) +} + +class MeetingActor(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, + val voiceBridge: String, duration: Long, + val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, + val moderatorPass: String, val viewerPass: String, + val createTime: Long, val createDate: String, + val outGW: MessageOutGateway) + extends Actor with UsersApp with PresentationApp + with PollApp with LayoutApp with ChatApp + with WhiteboardApp with ActorLogging { + + var audioSettingsInited = false + var permissionsInited = false + var permissions = new Permissions() + var recording = false; + var muted = false; + var meetingEnded = false + + val TIMER_INTERVAL = 30000 + var hasLastWebUserLeft = false + var lastWebUserLeftOn: Long = 0 + + // FIXME + // class TimerActor(val timeout: Long, val who: Actor, val reply: String) extends Actor { + // def act { + // reactWithin(timeout) { + // case TIMEOUT => who ! reply + // } + // } + // } + + def receive = { + case "StartTimer" => handleStartTimer + case "Hello" => handleHello + case "MonitorNumberOfWebUsers" => handleMonitorNumberOfWebUsers() + case msg: ValidateAuthToken => handleValidateAuthToken(msg) + case msg: RegisterUser => handleRegisterUser(msg) + case msg: VoiceUserJoined => handleVoiceUserJoined(msg) + case msg: VoiceUserLeft => handleVoiceUserLeft(msg) + case msg: VoiceUserMuted => handleVoiceUserMuted(msg) + case msg: VoiceUserTalking => handleVoiceUserTalking(msg) + case msg: UserJoining => handleUserJoin(msg) + case msg: UserLeaving => handleUserLeft(msg) + case msg: AssignPresenter => handleAssignPresenter(msg) + case msg: GetUsers => handleGetUsers(msg) + case msg: ChangeUserStatus => handleChangeUserStatus(msg) + case msg: EjectUserFromMeeting => handleEjectUserFromMeeting(msg) + case msg: UserRaiseHand => handleUserRaiseHand(msg) + case msg: UserLowerHand => handleUserLowerHand(msg) + case msg: UserShareWebcam => handleUserShareWebcam(msg) + case msg: UserUnshareWebcam => handleUserunshareWebcam(msg) + case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) + case msg: MuteAllExceptPresenterRequest => handleMuteAllExceptPresenterRequest(msg) + case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) + case msg: MuteUserRequest => handleMuteUserRequest(msg) + case msg: EjectUserFromVoiceRequest => handleEjectUserRequest(msg) + case msg: SetLockSettings => handleSetLockSettings(msg) + case msg: GetLockSettings => handleGetLockSettings(msg) + case msg: LockUserRequest => handleLockUserRequest(msg) + case msg: InitLockSettings => handleInitLockSettings(msg) + case msg: InitAudioSettings => handleInitAudioSettings(msg) + case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) + case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) + case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) + case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) + case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) + case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) + case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) + case msg: InitializeMeeting => handleInitializeMeeting(msg) + case msg: ClearPresentation => handleClearPresentation(msg) + case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) + case msg: PresentationPageCountError => handlePresentationPageCountError(msg) + case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) + case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) + case msg: RemovePresentation => handleRemovePresentation(msg) + case msg: GetPresentationInfo => handleGetPresentationInfo(msg) + case msg: SendCursorUpdate => handleSendCursorUpdate(msg) + case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) + case msg: GotoSlide => handleGotoSlide(msg) + case msg: SharePresentation => handleSharePresentation(msg) + case msg: GetSlideInfo => handleGetSlideInfo(msg) + case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) + case msg: PreCreatedPoll => handlePreCreatedPoll(msg) + case msg: CreatePoll => handleCreatePoll(msg) + case msg: UpdatePoll => handleUpdatePoll(msg) + case msg: DestroyPoll => handleDestroyPoll(msg) + case msg: RemovePoll => handleRemovePoll(msg) + case msg: SharePoll => handleSharePoll(msg) + case msg: StopPoll => handleStopPoll(msg) + case msg: StartPoll => handleStartPoll(msg) + case msg: ClearPoll => handleClearPoll(msg) + case msg: GetPolls => handleGetPolls(msg) + case msg: RespondToPoll => handleRespondToPoll(msg) + case msg: HidePollResult => handleHidePollResult(msg) + case msg: ShowPollResult => handleShowPollResult(msg) + case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) + case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) + case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) + case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) + case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) + case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) + case msg: SetRecordingStatus => handleSetRecordingStatus(msg) + case msg: GetRecordingStatus => handleGetRecordingStatus(msg) + case msg: VoiceRecording => handleVoiceRecording(msg) + + case msg: EndMeeting => handleEndMeeting(msg) + case StopMeetingActor => //exit + case _ => // do nothing + } + + def hasMeetingEnded(): Boolean = { + meetingEnded + } + + private def handleStartTimer() { + // println("***************timer started******************") + // val timerActor = new TimerActor(2000, self, "Hello") + // timerActor.start + } + + private def handleHello() { + // println("***************hello received on [" + System.currentTimeMillis() + "]******************") + + // val timerActor = new TimerActor(2000, self, "Hello") + // timerActor.start + } + + def webUserJoined() { + if (users.numWebUsers > 0) { + lastWebUserLeftOn = 0 + } + } + + def startRecordingIfAutoStart() { + if (recorded && !recording && autoStartRecording && users.numWebUsers == 1) { + log.info("Auto start recording for meeting=[" + meetingID + "]") + recording = true + outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) + } + } + + def stopAutoStartedRecording() { + if (recorded && recording && autoStartRecording + && users.numWebUsers == 0) { + log.info("Last web user left. Auto stopping recording for meeting=[{}", meetingID) + recording = false + outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) + } + } + + def startCheckingIfWeNeedToEndVoiceConf() { + if (users.numWebUsers == 0) { + lastWebUserLeftOn = timeNowInMinutes + log.debug("MonitorNumberOfWebUsers started for meeting [" + meetingID + "]") + scheduleEndVoiceConference() + } + } + + def handleMonitorNumberOfWebUsers() { + if (users.numWebUsers == 0 && lastWebUserLeftOn > 0) { + if (timeNowInMinutes - lastWebUserLeftOn > 2) { + log.info("MonitorNumberOfWebUsers empty for meeting [" + meetingID + "]. Ejecting all users from voice.") + outGW.send(new EjectAllVoiceUsers(meetingID, recorded, voiceBridge)) + } else { + scheduleEndVoiceConference() + } + } + } + + private def scheduleEndVoiceConference() { + log.debug("MonitorNumberOfWebUsers continue for meeting [" + meetingID + "]") + // val timerActor = new TimerActor(TIMER_INTERVAL, self, "MonitorNumberOfWebUsers") + // timerActor.start + // context.system.scheduler.schedule(0 seconds, 2000 millis, self, "MonitorNumberOfWebUsers") + } + + def timeNowInMinutes(): Long = { + TimeUnit.NANOSECONDS.toMinutes(System.nanoTime()) + } + + def sendMeetingHasEnded(userId: String) { + outGW.send(new MeetingHasEnded(meetingID, userId)) + outGW.send(new DisconnectUser(meetingID, userId)) + } + + private def handleEndMeeting(msg: EndMeeting) { + meetingEnded = true + outGW.send(new MeetingEnded(msg.meetingID, recorded, voiceBridge)) + outGW.send(new DisconnectAllUsers(msg.meetingID)) + } + + private def handleVoiceRecording(msg: VoiceRecording) { + if (msg.recording) { + outGW.send(new VoiceRecordingStarted(meetingID, + recorded, msg.recordingFile, + msg.timestamp, voiceBridge)) + } else { + outGW.send(new VoiceRecordingStopped(meetingID, recorded, + msg.recordingFile, msg.timestamp, voiceBridge)) + } + } + + private def handleSetRecordingStatus(msg: SetRecordingStatus) { + log.debug("Change recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") + if (allowStartStopRecording && recording != msg.recording) { + recording = msg.recording + log.debug("Sending recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") + outGW.send(new RecordingStatusChanged(meetingID, recorded, msg.userId, msg.recording)) + } + } + + private def handleGetRecordingStatus(msg: GetRecordingStatus) { + outGW.send(new GetRecordingStatusReply(meetingID, recorded, msg.userId, recording.booleanValue())) + } + + def lockLayout(lock: Boolean) { + permissions = permissions.copy(lockedLayout = lock) + } + + def newPermissions(np: Permissions) { + permissions = np + } + + def permissionsEqual(other: Permissions): Boolean = { + permissions == other + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala new file mode 100755 index 0000000000..a20089f91b --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala @@ -0,0 +1,35 @@ +package org.bigbluebutton.core + +import akka.actor.ActorRef +import akka.actor.ActorContext +import org.bigbluebutton.core.api.MessageOutGateway + +object RunningMeeting { + def apply(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, + voiceBridge: String, duration: Long, + autoStartRecording: Boolean, allowStartStopRecording: Boolean, + moderatorPass: String, viewerPass: String, + createTime: Long, createDate: String, + outGW: MessageOutGateway)(implicit context: ActorContext) = + new RunningMeeting(meetingID, externalMeetingID, meetingName, recorded, + voiceBridge, duration, + autoStartRecording, allowStartStopRecording, + moderatorPass, viewerPass, + createTime, createDate, + outGW)(context) +} + +class RunningMeeting(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, + val voiceBridge: String, val duration: Long, + val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, + val moderatorPass: String, val viewerPass: String, + val createTime: Long, val createDate: String, + val outGW: MessageOutGateway)(implicit val context: ActorContext) { + + val actorRef = context.actorOf(MeetingActor.props(meetingID, externalMeetingID, meetingName, recorded, + voiceBridge, duration, + autoStartRecording, allowStartStopRecording, + moderatorPass, viewerPass, + createTime, createDate, + outGW), meetingID) +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala new file mode 100755 index 0000000000..66d8192f65 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala @@ -0,0 +1,20 @@ +package org.bigbluebutton.core + +import com.typesafe.config.ConfigFactory +import scala.util.Try + +trait SystemConfiguration { + + val config = ConfigFactory.load() + + lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") + + lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) + + lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") + + lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) + + lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") + lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala new file mode 100755 index 0000000000..d12357c29b --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala @@ -0,0 +1,29 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api.UserVO +import org.bigbluebutton.core.api.Role._ + +class User(val intUserID: String, val extUserID: String, val name: String, val role: Role) { + + private var presenter = false + private var handRaised = false + private var hasStream = false + private var voiceId: String = _ + private var muted = false + private var talking = false + private var locked = false + + def isPresenter(): Boolean = { + return presenter; + } + + def becomePresenter() { + presenter = true + } + + def unbecomePresenter() { + presenter = false + } +} + +case class VoiceUser(userId: String, muted: Boolean = false, talking: Boolean = false, locked: Boolean = false) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala new file mode 100755 index 0000000000..df46b038da --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala @@ -0,0 +1,8 @@ +package org.bigbluebutton.core.api + +class ConsoleDispatcher extends IDispatcher { + + def dispatch(jsonMessage: String) { + println(jsonMessage) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala new file mode 100644 index 0000000000..cdb6e62979 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala @@ -0,0 +1,96 @@ +package org.bigbluebutton.core.api + +object Constants { + val NAME = "name" + val HEADER = "header" + val PAYLOAD = "payload" + val MEETING_ID = "meeting_id" + val EXTERNAL_MEETING_ID = "external_meeting_id" + val TIMESTAMP = "timestamp" + val CURRENT_TIME = "current_time" + val USER_ID = "userid" + val RECORDED = "recorded" + val MEETING_NAME = "meeting_name" + val VOICE_CONF = "voice_conf" + val DURATION = "duration" + val AUTH_TOKEN = "auth_token" + val ROLE = "role" + val EXT_USER_ID = "external_user_id" + val REQUESTER_ID = "requester_id" + val REPLY_TO = "reply_to" + val LOWERED_BY = "lowered_by" + val STREAM = "stream" + val LOCKED = "locked" + val SETTINGS = "settings" + val LOCK = "lock" + val EXCEPT_USERS = "except_users" + val STATUS = "status" + val VALUE = "value" + val NEW_PRESENTER_ID = "new_presenter_id" + val NEW_PRESENTER_NAME = "new_presenter_name" + val ASSIGNED_BY = "assigned_by" + val RECORDING = "recording" + val LAYOUT_ID = "layout_id" + val LAYOUT = "layout" + val POLL = "poll" + val POLL_ID = "poll_id" + val FORCE = "force" + val RESPONSE = "response" + val PRESENTATION_ID = "presentation_id" + val X_OFFSET = "x_offset" + val Y_OFFSET = "y_offset" + val WIDTH_RATIO = "width_ratio" + val HEIGHT_RATIO = "height_ratio" + val PAGE = "page" + val SHARE = "share" + val PRESENTATIONS = "presentations" + val MESSAGE_KEY = "message_key" + val CODE = "code" + val PRESENTATION_NAME = "presentation_name" + val NUM_PAGES = "num_pages" + val MAX_NUM_PAGES = "max_num_pages" + val PAGES_COMPLETED = "pages_completed" + val MUTE = "mute" + val CALLER_ID_NUM = "caller_id_num" + val CALLER_ID_NAME = "caller_id_name" + val TALKING = "talking" + val USER = "user" + val MUTED = "muted" + val VOICE_USER = "voice_user" + val RECORDING_FILE = "recording_file" + val ANNOTATION = "annotation" + val WHITEBOARD_ID = "whiteboard_id" + val ENABLE = "enable" + val PRESENTER = "presenter" + val USERS = "users" + val RAISE_HAND = "raise_hand" + val HAS_STREAM = "has_stream" + val WEBCAM_STREAM = "webcam_stream" + val PHONE_USER = "phone_user" + val PERMISSIONS = "permissions" + val VALID = "valid" + val CHAT_HISTORY = "chat_history" + val MESSAGE = "message" + val SET_BY_USER_ID = "set_by_user_id" + val POLLS = "polls" + val REASON = "reason" + val RESPONDER = "responder" + val PRESENTATION_INFO = "presentation_info" + val SHAPES = "shapes" + val SHAPE = "shape" + val SHAPE_ID = "shape_id" + val PRESENTATION = "presentation" + val ID = "id" + val CURRENT = "current" + val PAGES = "pages" + val WEB_USER_ID = "web_user_id" + val JOINED = "joined" + val X_PERCENT = "x_percent" + val Y_PERCENT = "y_percent" + val KEEP_ALIVE_ID = "keep_alive_id" + val LISTEN_ONLY = "listen_only" + val MODERATOR_PASS = "moderator_pass" + val VIEWER_PASS = "viewer_pass" + val CREATE_TIME = "create_time" + val CREATE_DATE = "create_date" +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala new file mode 100755 index 0000000000..b9f9fd0036 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -0,0 +1,447 @@ +package org.bigbluebutton.core.api + +import org.bigbluebutton.core.api.Role._ +import org.bigbluebutton.core.apps.poll._ +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import org.bigbluebutton.core.apps.presentation.Presentation + +trait InMessage { val meetingID: String } + +case class IsMeetingActorAliveMessage( + meetingId: String) + +case class KeepAliveMessage( + aliveID: String) + +case class CreateMeeting( + meetingID: String, + externalMeetingID: String, + meetingName: String, + recorded: Boolean, + voiceBridge: String, + duration: Long, + autoStartRecording: Boolean, + allowStartStopRecording: Boolean, + moderatorPass: String, + viewerPass: String, + createTime: Long, + createDate: String) extends InMessage + +case class InitializeMeeting( + meetingID: String, + recorded: Boolean) extends InMessage + +case class DestroyMeeting( + meetingID: String) extends InMessage + +case class StartMeeting( + meetingID: String) extends InMessage + +case class EndMeeting( + meetingID: String) extends InMessage + +case class LockSetting( + meetingID: String, + locked: Boolean, + settings: Map[String, Boolean]) extends InMessage + +// Lock +case class LockUser( + meetingID: String, + userId: String, + lock: Boolean) extends InMessage + +case class InitLockSettings( + meetingID: String, + settings: Permissions) extends InMessage + +case class SetLockSettings( + meetingID: String, + setByUser: String, + settings: Permissions) extends InMessage + +case class GetLockSettings( + meetingID: String, + userId: String) extends InMessage + +// Users +case class ValidateAuthToken( + meetingID: String, + userId: String, + token: String, + correlationId: String, + sessionId: String) extends InMessage + +case class RegisterUser( + meetingID: String, + userID: String, + name: String, + role: Role, + extUserID: String, + authToken: String) extends InMessage + +case class UserJoining( + meetingID: String, + userID: String, + authToken: String) extends InMessage + +case class UserLeaving( + meetingID: String, + userID: String, + sessionId: String) extends InMessage + +case class GetUsers( + meetingID: String, + requesterID: String) extends InMessage + +case class UserRaiseHand( + meetingID: String, + userId: String) extends InMessage + +case class UserLowerHand( + meetingID: String, + userId: String, + loweredBy: String) extends InMessage + +case class EjectUserFromMeeting(meetingID: String, userId: String, ejectedBy: String) extends InMessage + +case class UserShareWebcam( + meetingID: String, + userId: String, + stream: String) extends InMessage + +case class UserUnshareWebcam( + meetingID: String, + userId: String, + stream: String) extends InMessage + +case class ChangeUserStatus( + meetingID: String, + userID: String, + status: String, + value: Object) extends InMessage + +case class AssignPresenter( + meetingID: String, + newPresenterID: String, + newPresenterName: String, + assignedBy: String) extends InMessage + +case class SetRecordingStatus( + meetingID: String, + userId: String, + recording: Boolean) extends InMessage + +case class GetRecordingStatus( + meetingID: String, + userId: String) extends InMessage + +// Chat +case class GetChatHistoryRequest( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class SendPublicMessageRequest( + meetingID: String, + requesterID: String, + message: Map[String, String]) extends InMessage + +case class SendPrivateMessageRequest( + meetingID: String, + requesterID: String, + message: Map[String, String]) extends InMessage + +case class UserConnectedToGlobalAudio( + meetingID: String, + /** Not used. Just to satisfy trait **/ + voiceConf: String, + userid: String, + name: String) extends InMessage + +case class UserDisconnectedFromGlobalAudio( + meetingID: String, + /** Not used. Just to satisfy trait **/ + voiceConf: String, + userid: String, + name: String) extends InMessage + +// Layout +case class GetCurrentLayoutRequest( + meetingID: String, + requesterID: String) extends InMessage + +case class SetLayoutRequest( + meetingID: String, + requesterID: String, + layoutID: String) extends InMessage + +case class LockLayoutRequest( + meetingID: String, + setById: String, + lock: Boolean, + viewersOnly: Boolean, + layout: Option[String]) extends InMessage + +case class BroadcastLayoutRequest( + meetingID: String, + requesterID: String, + layout: String) extends InMessage + +// Poll +case class PreCreatedPoll( + meetingID: String, + poll: PollVO) extends InMessage + +case class CreatePoll( + meetingID: String, + requesterID: String, + poll: PollVO) extends InMessage + +case class UpdatePoll( + meetingID: String, + requesterID: String, + poll: PollVO) extends InMessage + +case class GetPolls( + meetingID: String, + requesterID: String) extends InMessage + +case class DestroyPoll( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class RemovePoll( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class SharePoll( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class ShowPollResult( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class HidePollResult( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class StopPoll( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class StartPoll( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class ClearPoll( + meetingID: String, + requesterID: String, + pollID: String, + force: Boolean = false) extends InMessage + +case class GetPollResult( + meetingID: String, + requesterID: String, + pollID: String) extends InMessage + +case class RespondToPoll( + meetingID: String, + requesterID: String, + response: PollResponseVO) extends InMessage + +// Presentation +case class ClearPresentation( + meetingID: String) extends InMessage + +case class RemovePresentation( + meetingID: String, + presentationID: String) extends InMessage + +case class GetPresentationInfo( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class SendCursorUpdate( + meetingID: String, + xPercent: Double, + yPercent: Double) extends InMessage + +case class ResizeAndMoveSlide( + meetingID: String, + xOffset: Double, + yOffset: Double, + widthRatio: Double, + heightRatio: Double) extends InMessage + +case class GotoSlide( + meetingID: String, + page: String) extends InMessage + +case class SharePresentation( + meetingID: String, + presentationID: String, + share: Boolean) extends InMessage + +case class GetSlideInfo( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class PreuploadedPresentations( + meetingID: String, + presentations: Seq[Presentation]) extends InMessage + +case class PresentationConversionUpdate( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + presName: String) extends InMessage + +case class PresentationPageCountError( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + maxNumberPages: Int, + presName: String) extends InMessage + +case class PresentationSlideGenerated( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + pagesCompleted: Int, + presName: String) extends InMessage + +case class PresentationConversionCompleted( + meetingID: String, + messageKey: String, + code: String, + presentation: Presentation) extends InMessage + +// Voice +case class InitAudioSettings( + meetingID: String, + requesterID: String, + muted: Boolean) extends InMessage + +case class SendVoiceUsersRequest( + meetingID: String, + requesterID: String) extends InMessage + +case class MuteAllExceptPresenterRequest( + meetingID: String, + requesterID: String, + mute: Boolean) extends InMessage + +case class MuteMeetingRequest( + meetingID: String, + requesterID: String, + mute: Boolean) extends InMessage + +case class IsMeetingMutedRequest( + meetingID: String, + requesterID: String) extends InMessage + +case class MuteUserRequest( + meetingID: String, + requesterID: String, + userID: String, + mute: Boolean) extends InMessage + +case class LockUserRequest( + meetingID: String, + requesterID: String, + userID: String, + lock: Boolean) extends InMessage + +case class EjectUserFromVoiceRequest( + meetingID: String, + userId: String, + ejectedBy: String) extends InMessage + +case class VoiceUserJoinedMessage( + meetingID: String, + user: String, + voiceConfId: String, + callerIdNum: String, + callerIdName: String, + muted: Boolean, + talking: Boolean) extends InMessage + +case class VoiceUserJoined( + meetingID: String, + voiceUser: VoiceUser) extends InMessage + +case class VoiceUserLeft( + meetingID: String, + userId: String) extends InMessage + +case class VoiceUserLocked( + meetingID: String, + userId: String, + locked: Boolean) extends InMessage + +case class VoiceUserMuted( + meetingID: String, + userId: String, + muted: Boolean) extends InMessage + +case class VoiceUserTalking( + meetingID: String, + userId: String, + talking: Boolean) extends InMessage + +case class VoiceRecording( + meetingID: String, + recordingFile: String, + timestamp: String, + recording: Boolean) extends InMessage + +// Whiteboard +case class SendWhiteboardAnnotationRequest( + meetingID: String, + requesterID: String, + annotation: AnnotationVO) extends InMessage + +case class GetWhiteboardShapesRequest( + meetingID: String, + requesterID: String, + whiteboardId: String, + replyTo: String) extends InMessage + +case class ClearWhiteboardRequest( + meetingID: String, + requesterID: String, + whiteboardId: String) extends InMessage + +case class UndoWhiteboardRequest( + meetingID: String, + requesterID: String, + whiteboardId: String) extends InMessage + +case class EnableWhiteboardRequest( + meetingID: String, + requesterID: String, + enable: Boolean) extends InMessage + +case class IsWhiteboardEnabledRequest( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class GetAllMeetingsRequest( + meetingID: String /** Not used. Just to satisfy trait **/ ) extends InMessage diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala new file mode 100755 index 0000000000..6ae3769a3f --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala @@ -0,0 +1,164 @@ +package org.bigbluebutton.core.api + +object MessageNames { + val CREATE_MEETING = "create_meeting_request" + val INITIALIZE_MEETING = "initialize_meeting_request" + val DESTROY_MEETING = "destroy_meeting_request" + val START_MEETING = "start_meeting_request" + val END_MEETING = "end_meeting_request" + val LOCK_SETTING = "lock_setting_request" + val LOCK_USER = "lock_user_request" + val INIT_LOCK_SETTINGS = "init_lock_settings" + val INIT_AUDIO_SETTINGS = "init_audio_settings" + val SET_LOCK_SETTINGS = "set_lock_settings" + val GET_LOCK_SETTINGS = "get_lock_settings" + val IS_MEETING_LOCKED = "is_meeting_locked" + val VALIDATE_AUTH_TOKEN = "validate_auth_token_request" + val VALIDATE_AUTH_TOKEN_REPLY = "validate_auth_token_reply" + val REGISTER_USER = "register_user_request" + val USER_JOINING = "user_joining_request" + val USER_LEAVING = "user_leaving_request" + val GET_USERS = "get_users_request" + val RAISE_HAND = "user_raise_hand_request" + val LOWER_HAND = "user_lower_hand_request" + val USER_SHARE_WEBCAM = "user_share_webcam_request" + val USER_UNSHARE_WEBCAM = "user_unshare_webcam_request" + val CHANGE_USER_STATUS = "change_user_status_request" + val ASSIGN_PRESENTER = "assign_presenter_request" + val SET_RECORDING_STATUS = "set_recording_status_request" + val GET_CHAT_HISTORY = "get_chat_history_request" + val SEND_PUBLIC_MESSAGE = "send_public_chat_message_request" + val SEND_PRIVATE_MESSAGE = "send_private_chat_message_request" + val GET_CURRENT_LAYOUT = "get_current_layout_request" + val SET_LAYOUT = "set_layout_request" + val BROADCAST_LAYOUT = "broadcast_layout_request" + val UNLOCK_LAYOUT = "unlock_layout_request" + val PRECREATED_POLL = "precreated_poll_request" + val CREATE_POLL = "create_poll_request" + val UPDATE_POLL = "update_poll_request" + val GET_POLLS = "get_polls_request" + val DESTROY_POLL = "destroy_poll_request" + val REMOVE_POLL = "remove_poll_request" + val SHARE_POLL = "share_poll_request" + val SHOW_POLL_RESULT = "show_poll_result_request" + val HIDE_POLL_RESULT = "hide_poll_result_request" + val START_POLL = "start_poll_request" + val STOP_POLL = "stop_poll_request" + val CLEAR_POLL = "clear_poll_request" + val GET_POLL_RESULT = "get_poll_result_request" + val RESPONT_TO_POLL = "respond_to_poll_request" + val CLEAR_PRESENTATION = "clear_presentation_request" + val REMOVE_PRESENTATION = "remove_presentation_request" + val GET_PRESENTATION_INFO = "get_presentation_info_request" + val RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide_request" + val GO_TO_SLIDE = "go_to_slide_request" + val SHARE_PRESENTATION = "share_presentation_request" + val GET_SLIDE_INFO = "get_slide_info_request" + val GET_SLIDE_INFO_REPLY = "get_slide_info_reply" + val PREUPLOADED_PRESENTATIONS = "preuploaded_presentation_request" + val PRESENTATION_CONVERSION_UPDATE = "presentation_conversion_update_message" + val PRESENTATION_PAGE_COUNT_ERROR = "presentation_page_count_error_message" + val PRESENTATION_SLIDE_GENERATED = "presentation_slide_generated_message" + val PRESENTATION_CONVERSION_COMPLETED = "presentation_conversion_completed_message" + val PRESENTATION_CURSOR_UPDATED = "presentation_cursor_updated_message" + val SEND_VOICE_USERS_REQUEST = "send_voice_users_request" + val MUTE_MEETING_REQUEST = "mute_meeting_request" + val IS_MEETING_MUTED = "is_meeting_muted_request" + val MUTE_USER = "mute_user_request" + val EJECT_USER = "eject_user_request" + val VOICE_USER_JOINED_MESSAGE = "voice_user_joined_message" + val VOICE_USER_JOINED = "voice_user_joined" + val VOICE_USER_LEFT = "voice_user_left_message" + val VOICE_USER_LOCKED = "voice_user_locked_message" + val VOICE_USER_MUTED = "voice_user_muted_message" + val VOICE_USER_TALKING = "voice_user_talking_message" + val VOICE_RECORDING = "voice_recording_message" + val SEND_WHITEBOARD_ANNOTATION = "send_whiteboard_annotation_request" + val GET_WHITEBOARD_SHAPES = "get_whiteboard_shapes_request" + val CLEAR_WHITEBOARD = "clear_whiteboard_request" + val UNDO_WHITEBOARD = "undo_whiteboard_request" + val ENABLE_WHITEBOARD = "enable_whiteboard_request" + val IS_WHITEBOARD_ENABLED = "is_whiteboard_enabled_request" + val GET_ALL_MEETINGS_REQUEST = "get_all_meetings_request" + + // OUT MESSAGES + val MEETING_CREATED = "meeting_created_message" + val VOICE_RECORDING_STARTED = "voice_recording_started_message" + val VOICE_RECORDING_STOPPED = "voice_recording_stopped_message" + val RECORDING_STATUS_CHANGED = "recording_status_changed_message" + val GET_RECORDING_STATUS_REPLY = "get_recording_status_reply" + val MEETING_ENDED = "meeting_ended_message" + val MEETING_HAS_ENDED = "meeting_has_ended_message" + val MEETING_DESTROYED = "meeting_destroyed_message" + val DISCONNECT_ALL_USERS = "disconnect_all_users_message" + val DISCONNECT_USER = "disconnect_user_message" + val PERMISSION_SETTING_INITIALIZED = "permisssion_setting_initialized_message" + val NEW_PERMISSION_SETTINGS = "new_permission_settings" + val USER_LOCKED = "user_locked_message" + val USERS_LOCKED = "users_locked_message" + val GET_PERMISSION_SETTINGS_REPLY = "get_permissions_setting_reply" + val IS_MEETING_LOCKED_REPLY = "is_meeting_locked_reply" + val USER_REGISTERED = "user_registered_message" + val USER_LEFT = "user_left_message" + val PRESENTER_ASSIGNED = "presenter_assigned_message" + val END_AND_KICK_ALL = "end_and_kick_all_message" + val GET_USERS_REPLY = "get_users_reply" + val USER_JOINED = "user_joined_message" + val USER_RAISED_HAND = "user_raised_hand_message" + val USER_LOWERED_HAND = "user_lowered_hand_message" + val USER_SHARED_WEBCAM = "user_shared_webcam_message" + val USER_UNSHARED_WEBCAM = "user_unshared_webcam_message" + val USER_STATUS_CHANGED = "user_status_changed_message" + val MUTE_VOICE_USER = "mute_voice_user_request" + val USER_VOICE_MUTED = "user_voice_muted_message" + val USER_VOICE_TALKING = "user_voice_talking_message" + val EJECT_VOICE_USER = "eject_voice_user_message" + val USER_JOINED_VOICE = "user_joined_voice_message" + val USER_LEFT_VOICE = "user_left_voice_message" + val IS_MEETING_MUTED_REPLY = "is_meeting_muted_reply" + val START_RECORDING = "start_recording_message" + val STOP_RECORDING = "stop_recording_message" + val GET_CHAT_HISTORY_REPLY = "get_chat_history_reply" + val SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message" + val SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message" + val GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply" + val SET_LAYOUT_REPLY = "set_layout_reply" + val BROADCAST_LAYOUT_REPLY = "broadcast_layout_reply" + val UNLOCK_LAYOUT_REPLY = "unlock_layout_reply" + val GET_POLL_RESULT_REPLY = "get_poll_result_reply" + val POLL_CLEARED = "poll_cleared_message" + val GET_POLLS_REPLY = "get_polls_reply" + val CLEAR_POLL_FAILED = "clear_poll_failed" + val POLL_STARTED = "poll_started_message" + val POLL_STOPPED = "poll_stopped_message" + val POLL_REMOVED = "poll_removed" + val POLL_UPDATED = "poll_updated_message" + val POLL_CREATED = "poll_created_message" + val POLL_RESPONSE = "poll_response_message" + val POLL_HIDE_RESULT = "poll_hide_result_message" + val POLL_SHOW_RESULT = "poll_show_result_message" + val PRESENTATION_CLEARED = "presentation_cleared_message" + val PRESENTATION_REMOVED = "presentation_removed_message" + val GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply" + val PRESENTATION_PAGE_RESIZED = "presentation_page_resized_message" + val PRESENTATION_PAGE_CHANGED = "presentation_page_changed_message" + val PRESENTATION_SHARED = "presentation_shared_message" + val GET_PREUPLOADED_PRESENTATIONS = "get_preuploaded_presentations_message" + val PRESENTATION_CONVERSION_PROGRESS = "presentation_conversion_progress_message" + val PRESENTATION_CONVERSION_ERROR = "presentation_conversion_error_message" + val PRESENTATION_CONVERSION_DONE = "presentation_conversion_done_message" + val PRESENTATION_CHANGED = "presentation_changed_message" + val GET_PRESENTATION_STATUS_REPLY = "get_presentation_status_reply" + val PRESENTATION_REMOVED_MESSAGE = "presentation_removed_message" + val PRESENTATION_PAGE_GENERATED = "presentation_page_generated_message" + val GET_WHITEBOARD_SHAPES_REPLY = "get_whiteboard_shapes_reply" + val SEND_WHITEBOARD_SHAPE = "send_whiteboard_shape_message" + val UNDO_WHITEBOARD_MESSAGE = "undo_whiteboard_message" + val WHITEBOARD_ENABLED = "whiteboard_enabled_message" + val WHITEBOARD_CLEARED = "whiteboard_cleared_message" + val IS_WHITEBOARD_ENABLED_REPLY = "is_whiteboard_enabled_reply" + val MEETING_DESTROYED_EVENT = "meeting_destroyed_event" + val KEEP_ALIVE_REPLY = "keep_alive_reply" + val USER_LISTEN_ONLY = "user_listening_only" + val GET_ALL_MEETINGS_REPLY = "get_all_meetings_reply" +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala new file mode 100755 index 0000000000..57f3b6a144 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala @@ -0,0 +1,575 @@ +package org.bigbluebutton.core.api + +import org.bigbluebutton.core.apps.poll._ +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import org.bigbluebutton.core.apps.presentation.CurrentPresentationInfo +import org.bigbluebutton.core.apps.presentation.Presentation +import org.bigbluebutton.core.apps.presentation.Page + +abstract class OutMessage + +case class VoiceRecordingStarted( + meetingID: String, + recorded: Boolean, + recordingFile: String, + timestamp: String, + confNum: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class VoiceRecordingStopped( + meetingID: String, + recorded: Boolean, + recordingFile: String, + timestamp: String, + confNum: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class RecordingStatusChanged( + meetingID: String, + recorded: Boolean, + userId: String, + recording: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetRecordingStatusReply( + meetingID: String, + recorded: Boolean, + userId: String, + recording: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingCreated( + meetingID: String, + externalMeetingID: String, + recorded: Boolean, + name: String, + voiceBridge: String, + duration: Long, + moderatorPass: String, + viewerPass: String, + createTime: Long, + createDate: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingMuted( + meetingID: String, + recorded: Boolean, + meetingMuted: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingEnded( + meetingID: String, + recorded: Boolean, + voiceBridge: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingState( + meetingID: String, + recorded: Boolean, + userId: String, + permissions: Permissions, + meetingMuted: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingHasEnded( + meetingID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingDestroyed( + meetingID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class DisconnectAllUsers( + meetingID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class DisconnectUser( + meetingID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class KeepAliveMessageReply( + aliveID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case object IsAliveMessage extends IOutMessage + +// Permissions +case class PermissionsSettingInitialized( + meetingID: String, + permissions: Permissions, + applyTo: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class NewPermissionsSetting( + meetingID: String, + setByUser: String, + permissions: Permissions, + applyTo: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLocked( + meetingID: String, + userId: String, + lock: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPermissionsSettingReply( + meetingID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Users +case class UserRegistered( + meetingID: String, + recorded: Boolean, + user: RegisteredUser, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLeft( + meetingID: String, + recorded: Boolean, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserEjectedFromMeeting(meetingID: String, recorded: Boolean, userId: String, ejectedBy: String, version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresenterAssigned( + meetingID: String, + recorded: Boolean, + presenter: Presenter, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class EjectAllVoiceUsers( + meetingID: String, + recorded: Boolean, + voiceBridge: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class EndAndKickAll( + meetingID: String, + recorded: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetUsersReply( + meetingID: String, + requesterID: String, + users: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ValidateAuthTokenTimedOut( + meetingID: String, + requesterId: String, + token: String, + valid: Boolean, + correlationId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ValidateAuthTokenReply( + meetingID: String, + requesterId: String, + token: String, + valid: Boolean, + correlationId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserJoined( + meetingID: String, + recorded: Boolean, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserRaisedHand( + meetingID: String, + recorded: Boolean, + userID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLoweredHand( + meetingID: String, + recorded: Boolean, + userID: String, + loweredBy: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserListeningOnly( + meetingID: String, + recorded: Boolean, + userID: String, + listenOnly: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserSharedWebcam( + meetingID: String, + recorded: Boolean, + userID: String, + stream: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserUnsharedWebcam( + meetingID: String, + recorded: Boolean, + userID: String, + stream: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserStatusChange( + meetingID: String, + recorded: Boolean, + userID: String, + status: String, + value: Object, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MuteVoiceUser( + meetingID: String, + recorded: Boolean, + requesterID: String, + userId: String, + mute: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserVoiceMuted( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserVoiceTalking( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class EjectVoiceUser( + meetingID: String, + recorded: Boolean, + requesterID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserJoinedVoice( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLeftVoice( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Voice +case class IsMeetingMutedReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + meetingMuted: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class StartRecording( + meetingID: String, + recorded: Boolean, + requesterID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class StopRecording( + meetingID: String, + recorded: Boolean, + requesterID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Chat +case class GetChatHistoryReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + replyTo: String, + history: Array[Map[String, String]], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendPublicMessageEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + message: Map[String, String], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendPrivateMessageEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + message: Map[String, String], + version: String = Versions.V_0_0_1) extends IOutMessage + +// Layout +case class GetCurrentLayoutReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + layoutID: String, + locked: Boolean, + setByUserID: String) extends IOutMessage + +case class BroadcastLayoutEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + layoutID: String, + locked: Boolean, + setByUserID: String, + applyTo: Array[UserVO]) extends IOutMessage + +case class LockLayoutEvent( + meetingID: String, + recorded: Boolean, + setById: String, + locked: Boolean, + applyTo: Array[UserVO]) extends IOutMessage + +// Poll +case class GetPollResultReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + pollVO: PollVO) extends IOutMessage + +case class GetPollsReplyOutMsg( + meetingID: String, + recorded: Boolean, + requesterID: String, + polls: Array[PollVO]) extends IOutMessage + +case class ClearPollFailed( + meetingID: String, + pollID: String, + requesterID: String, + reason: String) extends IOutMessage + +case class PollClearedOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String) extends IOutMessage + +case class PollStartedOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String) extends IOutMessage + +case class PollStoppedOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String) extends IOutMessage + +case class PollRemovedOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String) extends IOutMessage + +case class PollUpdatedOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String, + pollVO: PollVO) extends IOutMessage + +case class PollCreatedOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String, + pollVO: PollVO) extends IOutMessage + +case class PollResponseOutMsg( + meetingID: String, + recorded: Boolean, + responder: Responder, + response: PollResponseVO) extends IOutMessage + +case class PollHideResultOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String) extends IOutMessage + +case class PollShowResultOutMsg( + meetingID: String, + recorded: Boolean, + pollID: String) extends IOutMessage + +// Presentation +case class ClearPresentationOutMsg( + meetingID: String, + recorded: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class RemovePresentationOutMsg( + meetingID: String, + recorded: Boolean, + presentationID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPresentationInfoOutMsg( + meetingID: String, + recorded: Boolean, + requesterID: String, + info: CurrentPresentationInfo, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendCursorUpdateOutMsg( + meetingID: String, + recorded: Boolean, + xPercent: Double, + yPercent: Double, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ResizeAndMoveSlideOutMsg( + meetingID: String, + recorded: Boolean, + page: Page, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GotoSlideOutMsg( + meetingID: String, + recorded: Boolean, + page: Page, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SharePresentationOutMsg( + meetingID: String, + recorded: Boolean, + presentation: Presentation, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetSlideInfoOutMsg( + meetingID: String, + recorded: Boolean, + requesterID: String, + page: Page, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPreuploadedPresentationsOutMsg( + meetingID: String, + recorded: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationConversionProgress( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + presentationName: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationConversionError( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + maxNumberPages: Int, + presentationName: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationPageGenerated( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + pagesCompleted: Int, + presentationName: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationConversionDone( + meetingID: String, + recorded: Boolean, + messageKey: String, + code: String, + presentation: Presentation, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationChanged( + meetingID: String, + presentation: Presentation, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPresentationStatusReply( + meetingID: String, + presentations: Seq[Presentation], + current: Presentation, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationRemoved( + meetingID: String, + presentationId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PageChanged( + meetingID: String, + page: Page, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Whiteboard +case class GetWhiteboardShapesReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + shapes: Array[AnnotationVO], + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendWhiteboardAnnotationEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + shape: AnnotationVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ClearWhiteboardEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UndoWhiteboardEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + shapeId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class WhiteboardEnabledEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + enable: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class IsWhiteboardEnabledReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + enabled: Boolean, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetAllMeetingsReply( + meetings: Array[MeetingInfo], + version: String = Versions.V_0_0_1) extends IOutMessage + +// Value Objects +case class MeetingVO( + id: String, + recorded: Boolean) + diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala new file mode 100644 index 0000000000..ed55b373fe --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala @@ -0,0 +1,14 @@ +package org.bigbluebutton.core.api + +import java.util.concurrent.TimeUnit + +object TimestampGenerator { + + def generateTimestamp(): Long = { + TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) + } + + def getCurrentTime(): Long = { + System.currentTimeMillis(); + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala new file mode 100755 index 0000000000..82de5a8a5a --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala @@ -0,0 +1,105 @@ +package org.bigbluebutton.core.api + +import java.lang.Boolean + +object Role extends Enumeration { + type Role = Value + val MODERATOR = Value("MODERATOR") + val VIEWER = Value("VIEWER") +} + +case class Presenter( + presenterID: String, + presenterName: String, + assignedBy: String) + +case class User( + id: String, + externId: String, + name: String, + moderator: Boolean, + avatarUrl: String, + logoutUrl: String, + presenter: Boolean, + callerId: CallerId, + phoneCaller: Boolean, + handRaised: Boolean, + muted: Boolean, + talking: Boolean) + +case class CallerId( + name: String, + number: String) + +case class Permissions( + disableCam: Boolean = false, + disableMic: Boolean = false, + disablePrivChat: Boolean = false, + disablePubChat: Boolean = false, + lockedLayout: Boolean = false, + lockOnJoin: Boolean = false, + lockOnJoinConfigurable: Boolean = false) + +case class RegisteredUser( + id: String, + externId: String, + name: String, + role: Role.Role, + authToken: String) + +case class Voice( + id: String, + webId: String, + callId: CallerId, + phoningIn: Boolean, + joined: Boolean, + locked: Boolean, + muted: Boolean, + talking: Boolean) + +case class UserVO( + userID: String, + externUserID: String, + name: String, + role: Role.Role, + raiseHand: Boolean, + presenter: Boolean, + hasStream: Boolean, + locked: Boolean, + webcamStreams: Set[String], + phoneUser: Boolean, + voiceUser: VoiceUser, + listenOnly: Boolean) + +case class VoiceUser(userId: String, + webUserId: String, + callerName: String, + callerNum: String, + joined: Boolean, + locked: Boolean, + muted: Boolean, + talking: Boolean) + +case class MeetingConfig(name: String, + id: MeetingID, + passwords: MeetingPasswords, + welcomeMsg: String, + logoutUrl: String, + maxUsers: Int, + record: Boolean = false, + duration: MeetingDuration, + defaultAvatarURL: String, + defaultConfigToken: String) + +case class MeetingName(name: String) + +case class MeetingID(internal: String, external: String) + +case class VoiceConfig(telVoice: String, webVoice: String, dialNumber: String) + +case class MeetingPasswords(moderatorPass: String, viewerPass: String) + +case class MeetingDuration(duration: Int = 0, createdTime: Long = 0, + startTime: Long = 0, endTime: Long = 0) + +case class MeetingInfo(meetingID: String, meetingName: String, recorded: Boolean, voiceBridge: String, duration: Long) diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala new file mode 100755 index 0000000000..6fe5b194e8 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.api + +object Versions { + val V_0_0_1 = "0.0.1" +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala new file mode 100755 index 0000000000..ee1664f3b6 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala @@ -0,0 +1,31 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.api._ +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.MeetingActor + +trait ChatApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + val messages = new ArrayBuffer[Map[String, String]]() + + def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { + val history = new Array[Map[String, String]](messages.size) + messages.copyToArray(history) + outGW.send(new GetChatHistoryReply(meetingID, recorded, msg.requesterID, msg.replyTo, history)) + } + + def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { + messages append msg.message.toMap + val pubMsg = msg.message.toMap + + outGW.send(new SendPublicMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) + } + + def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { + val pubMsg = msg.message.toMap + outGW.send(new SendPrivateMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala new file mode 100755 index 0000000000..573b51c5fc --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala @@ -0,0 +1,19 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class ChatInGateway(bbbGW: BigBlueButtonGateway) { + + def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { + bbbGW.accept(new GetChatHistoryRequest(meetingID, requesterID, replyTo)) + } + + def sendPrivateMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { + bbbGW.accept(new SendPrivateMessageRequest(meetingID, requesterID, msg)) + } + + def sendPublicMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { + bbbGW.accept(new SendPublicMessageRequest(meetingID, requesterID, msg)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala new file mode 100755 index 0000000000..e9429e12be --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala @@ -0,0 +1,38 @@ +package org.bigbluebutton.core.apps.chat.redis + +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.mutable.HashMap +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import java.util.ArrayList +import org.bigbluebutton.conference.service.messaging.MessagingConstants +import org.bigbluebutton.core.messaging.Util + +class ChatEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + def handleMessage(msg: IOutMessage) { + msg match { + case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) + case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) + case _ => // do nothing + } + } + + private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { + val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) + service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) + } + + private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) + service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) + } + + private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { + val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) + service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala new file mode 100755 index 0000000000..c30ac8989a --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala @@ -0,0 +1,29 @@ +package org.bigbluebutton.core.apps.chat.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.recorder.chat.PublicChatRecordEvent +import scala.collection.JavaConversions._ + +class ChatEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + case _ => // do nothing + } + } + + private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + if (msg.recorded) { + val message = mapAsJavaMap(msg.message) + val ev = new PublicChatRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setMeetingId(msg.meetingID); + ev.setSender(message.get("fromUsername")); + ev.setMessage(message.get("message")); + ev.setColor(message.get("fromColor")); + recorder.record(msg.meetingID, ev); + } + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala new file mode 100755 index 0000000000..380e9a5d2a --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala @@ -0,0 +1,67 @@ +package org.bigbluebutton.core.apps.chat.redis + +import scala.collection.mutable.HashMap +import org.bigbluebutton.conference.service.chat.ChatKeyUtil +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.mutable.HashMap +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import java.util.ArrayList +import org.bigbluebutton.conference.service.messaging.MessagingConstants +import org.bigbluebutton.core.messaging.Util + +object ChatMessageToJsonConverter { + + val UNKNOWN = "unknown" + + private def chatMessageToMap(msg: Map[String, String]): HashMap[String, String] = { + val res = new HashMap[String, String] + res += "chat_type" -> msg.get(ChatKeyUtil.CHAT_TYPE).getOrElse(UNKNOWN) + res += "from_userid" -> msg.get(ChatKeyUtil.FROM_USERID).getOrElse(UNKNOWN) + res += "from_username" -> msg.get(ChatKeyUtil.FROM_USERNAME).getOrElse(UNKNOWN) + res += "from_color" -> msg.get(ChatKeyUtil.FROM_COLOR).getOrElse(UNKNOWN) + res += "from_time" -> msg.get(ChatKeyUtil.FROM_TIME).getOrElse(UNKNOWN) + res += "from_tz_offset" -> msg.get(ChatKeyUtil.FROM_TZ_OFFSET).getOrElse(UNKNOWN) + res += "to_userid" -> msg.get(ChatKeyUtil.TO_USERID).getOrElse(UNKNOWN) + res += "to_username" -> msg.get(ChatKeyUtil.TO_USERNAME).getOrElse(UNKNOWN) + res += "message" -> msg.get(ChatKeyUtil.MESSAGE).getOrElse(UNKNOWN) + + res + } + + def getChatHistoryReplyToJson(msg: GetChatHistoryReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val collection = new ArrayList[java.util.Map[String, String]](); + + msg.history.foreach(p => { + collection.add(mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(p))) + }) + + payload.put(Constants.CHAT_HISTORY, collection) + + val header = Util.buildHeader(MessageNames.GET_CHAT_HISTORY_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def sendPublicMessageEventToJson(msg: SendPublicMessageEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) + + val header = Util.buildHeader(MessageNames.SEND_PUBLIC_CHAT_MESSAGE, msg.version, None) + Util.buildJson(header, payload) + } + + def sendPrivateMessageEventToJson(msg: SendPrivateMessageEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) + + val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala new file mode 100755 index 0000000000..4bcfbfc4d3 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala @@ -0,0 +1,66 @@ +package org.bigbluebutton.core.apps.layout + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.MeetingActor +import scala.collection.mutable.ArrayBuffer + +trait LayoutApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private var setByUser: String = "system"; + private var currentLayout = ""; + private var layoutLocked = false + private var viewersOnly = true + + def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { + outGW.send(new GetCurrentLayoutReply(msg.meetingID, recorded, msg.requesterID, + currentLayout, permissions.lockedLayout, setByUser)) + } + + def handleLockLayoutRequest(msg: LockLayoutRequest) { + viewersOnly = msg.viewersOnly + lockLayout(msg.lock) + + outGW.send(new LockLayoutEvent(msg.meetingID, recorded, + msg.setById, msg.lock, affectedUsers)) + + msg.layout foreach { l => + currentLayout = l + broadcastSyncLayout(msg.meetingID, msg.setById) + } + } + + private def broadcastSyncLayout(meetingId: String, setById: String) { + outGW.send(new BroadcastLayoutEvent(meetingId, recorded, setById, + currentLayout, permissions.lockedLayout, setByUser, affectedUsers)) + } + + def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { + currentLayout = msg.layout + broadcastSyncLayout(msg.meetingID, msg.requesterID) + } + + def handleLockLayout(lock: Boolean, setById: String) { + outGW.send(new LockLayoutEvent(meetingID, recorded, setById, lock, affectedUsers)) + + broadcastSyncLayout(meetingID, setById) + } + + def affectedUsers(): Array[UserVO] = { + if (viewersOnly) { + val au = ArrayBuffer[UserVO]() + users.getUsers foreach { u => + if (!u.presenter && u.role != Role.MODERATOR) { + au += u + } + } + au.toArray + } else { + users.getUsers + } + + } + +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala new file mode 100644 index 0000000000..3e0c16d316 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala @@ -0,0 +1,21 @@ +package org.bigbluebutton.core.apps.layout + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class LayoutInGateway(bbbGW: BigBlueButtonGateway) { + + def getCurrentLayout(meetingID: String, requesterID: String) { + bbbGW.accept(new GetCurrentLayoutRequest(meetingID, requesterID)) + } + + def broadcastLayout(meetingID: String, requesterID: String, layout: String) { + bbbGW.accept(new BroadcastLayoutRequest(meetingID, requesterID, layout)) + } + + def lockLayout(meetingID: String, setById: String, + lock: Boolean, viewersOnly: Boolean, + layout: Option[String]) { + bbbGW.accept(new LockLayoutRequest(meetingID, setById, lock, viewersOnly, layout)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala new file mode 100755 index 0000000000..6d13a3bb45 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala @@ -0,0 +1,140 @@ +package org.bigbluebutton.core.apps.poll + +import scala.collection.mutable.HashMap +import scala.collection.mutable.ArrayBuffer + +case class QuestionResponsesVO(val questionID: String, val responseIDs: Array[String]) +case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) +case class ResponderVO(responseID: String, user: Responder) + +case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) +case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) +case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) + +case class Responder(val userID: String, name: String) + +case class ResponseOutVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) +case class QuestionOutVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseOutVO]) +case class PollOutVO(id: String, title: String, started: Boolean, stopped: Boolean, questions: Array[QuestionOutVO]) + +class Poll(val id: String, val title: String, val questions: Array[Question]) { + private var _started: Boolean = false + private var _stopped: Boolean = false + + private var _showResult: Boolean = false + + def showResult() { + _showResult = true + } + + def hideResult() { + _showResult = false + } + + def resultShown(): Boolean = { + _showResult + } + + def start() { + _started = true; + } + + def stop() { + _stopped = true; + } + + def isStarted(): Boolean = { + return _started + } + + def isStopped(): Boolean = { + return _stopped + } + + def clear() { + questions.foreach(q => { + q.clear + }) + + _started = false + _stopped = false + } + + def hasResponses(): Boolean = { + questions.foreach(q => { + if (q.hasResponders) return true + }) + + return false + } + + def respondToQuestion(questionID: String, responseID: String, responder: Responder) { + questions.foreach(q => { + if (q.id.equals(questionID)) { + q.respondToQuestion(responseID, responder) + } + }) + } + + def toPollVO(): PollVO = { + val qvos = new ArrayBuffer[QuestionVO] + questions.foreach(q => { + qvos += q.toQuestionVO + }) + + new PollVO(id, title, qvos.toArray, _started, _stopped) + } +} + +class Question(val id: String, val multiResponse: Boolean, val question: String, val responses: Array[Response]) { + + def clear() { + responses.foreach(r => r.clear) + } + + def hasResponders(): Boolean = { + responses.foreach(r => { + if (r.numResponders > 0) return true + }) + + return false + } + + def respondToQuestion(id: String, responder: Responder) { + responses.foreach(r => { + if (r.id == id) r.addResponder(responder) + }) + } + + def toQuestionVO(): QuestionVO = { + val rvos = new ArrayBuffer[ResponseVO] + responses.foreach(response => { + val r = new ResponseVO(response.id, response.response, response.getResponders) + rvos += r + }) + + new QuestionVO(id, multiResponse, question, rvos.toArray) + } +} + +class Response(val id: String, val response: String) { + + val responders = new ArrayBuffer[Responder]() + + def clear() { + responders.clear + } + def addResponder(responder: Responder) { + responders += responder + } + + def numResponders(): Int = { + responders.length; + } + + def getResponders(): Array[Responder] = { + var r = new Array[Responder](responders.length) + responders.copyToArray(r) + return r + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala new file mode 100755 index 0000000000..f8ac30d339 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala @@ -0,0 +1,123 @@ +package org.bigbluebutton.core.apps.poll + +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.api._ +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.MeetingActor + +trait PollApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private val pollModel = new PollModel + + def handleHidePollResult(msg: HidePollResult) { + val pollID = msg.pollID + + if (pollModel.hasPoll(pollID)) { + pollModel.hidePollResult(pollID) + outGW.send(new PollHideResultOutMsg(meetingID, recorded, pollID)) + } + } + + def handleShowPollResult(msg: ShowPollResult) { + val pollID = msg.pollID + + if (pollModel.hasPoll(pollID)) { + pollModel.showPollResult(pollID) + outGW.send(new PollShowResultOutMsg(meetingID, recorded, pollID)) + } + } + + def handleRespondToPoll(msg: RespondToPoll) { + val pollID = msg.response.pollID + + if (pollModel.hasPoll(pollID)) { + if (hasUser(msg.requesterID)) { + getUser(msg.requesterID) match { + case Some(user) => { + val responder = new Responder(user.userID, user.name) + msg.response.responses.foreach(question => { + question.responseIDs.foreach(response => { + pollModel.respondToQuestion(pollID, question.questionID, response, responder) + }) + }) + + pollModel.getPoll(msg.response.pollID) match { + case Some(poll) => outGW.send(new PollResponseOutMsg(meetingID, recorded, responder, msg.response)) + case None => // do nothing + } + } + case None => //do nothing + } + } + } + } + + def handleGetPolls(msg: GetPolls) { + var polls = pollModel.getPolls + outGW.send(new GetPollsReplyOutMsg(meetingID, recorded, msg.requesterID, polls)) + } + + def handleClearPoll(msg: ClearPoll) { + if (pollModel.clearPoll(msg.pollID)) { + outGW.send(new PollClearedOutMsg(meetingID, recorded, msg.pollID)) + } else { + print("PollApp:: handleClearPoll - " + msg.pollID + " not found") + } + } + + def handleStartPoll(msg: StartPoll) { + if (pollModel.hasPoll(msg.pollID)) { + pollModel.startPoll(msg.pollID) + outGW.send(new PollStartedOutMsg(meetingID, recorded, msg.pollID)) + } else { + print("PollApp:: handleStartPoll - " + msg.pollID + " not found") + } + } + + def handleStopPoll(msg: StopPoll) { + if (pollModel.hasPoll(msg.pollID)) { + pollModel.stopPoll(msg.pollID) + outGW.send(new PollStoppedOutMsg(meetingID, recorded, msg.pollID)) + } else { + print("PollApp:: handleStopPoll - " + msg.pollID + " not found") + } + } + + def handleSharePoll(msg: SharePoll) { + + } + + def handleRemovePoll(msg: RemovePoll) { + if (pollModel.hasPoll(msg.pollID)) { + pollModel.removePoll(msg.pollID) + outGW.send(new PollRemovedOutMsg(meetingID, recorded, msg.pollID)) + } else { + print("PollApp:: handleRemovePoll - " + msg.pollID + " not found") + } + } + + def handleDestroyPoll(msg: DestroyPoll) { + + } + + def handleUpdatePoll(msg: UpdatePoll) { + if (pollModel.updatePoll(msg.poll)) { + outGW.send(new PollUpdatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) + } else { + print("PollApp:: handleUpdatePoll - " + msg.poll.id + " not found") + } + } + + def handlePreCreatedPoll(msg: PreCreatedPoll) { + pollModel.createPoll(msg.poll) + outGW.send(new PollCreatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) + } + + def handleCreatePoll(msg: CreatePoll) { + pollModel.createPoll(msg.poll) + outGW.send(new PollCreatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala new file mode 100755 index 0000000000..47982f583c --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala @@ -0,0 +1,56 @@ +package org.bigbluebutton.core.apps.poll + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class PollInGateway(bbbGW: BigBlueButtonGateway) { + + val msgConverter = new PollMessageConverter + + def getPolls(meetingID: String, requesterID: String) { + bbbGW.accept(new GetPolls(meetingID, requesterID)) + } + + def preCreatedPoll(meetingID: String, msg: String) { + val pvo = msgConverter.convertPreCreatedPollMessage(msg) + bbbGW.accept(new PreCreatedPoll(meetingID, pvo)) + } + + def createPoll(meetingID: String, requesterID: String, msg: String) { + val pvo = msgConverter.convertCreatePollMessage(msg) + bbbGW.accept(new CreatePoll(meetingID, requesterID, pvo)) + } + + def updatePoll(meetingID: String, requesterID: String, msg: String) { + val pvo = msgConverter.convertUpdatePollMessage(msg) + bbbGW.accept(new UpdatePoll(meetingID, requesterID, pvo)) + } + + def startPoll(meetingID: String, requesterID: String, msg: String) { + val pollID = msgConverter.convertStartPollMessage(msg) + bbbGW.accept(new StartPoll(meetingID, requesterID, pollID)) + } + + def stopPoll(meetingID: String, requesterID: String, msg: String) { + val pollID = msgConverter.convertStopPollMessage(msg) + bbbGW.accept(new StopPoll(meetingID, requesterID, pollID)) + } + + def removePoll(meetingID: String, requesterID: String, msg: String) { + val pollID = msgConverter.convertRemovePollMessage(msg) + bbbGW.accept(new RemovePoll(meetingID, requesterID, pollID)) + } + + def respondPoll(meetingID: String, requesterID: String, msg: String) { + val pollResponse = msgConverter.convertTakePollMessage(msg) + bbbGW.accept(new RespondToPoll(meetingID, requesterID, pollResponse)) + } + + def showPollResult(meetingID: String, requesterID: String, pollID: String) { + bbbGW.accept(new ShowPollResult(meetingID, requesterID, pollID)) + } + + def hidePollResult(meetingID: String, requesterID: String, pollID: String) { + bbbGW.accept(new HidePollResult(meetingID, requesterID, pollID)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala new file mode 100755 index 0000000000..54b5232efa --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala @@ -0,0 +1,190 @@ +package org.bigbluebutton.core.apps.poll + +import com.google.gson.Gson +import com.google.gson.JsonParser +import org.bigbluebutton.core.util.RandomStringGenerator._ +import scala.collection.mutable.ArrayBuffer + +class PollMessageConverter { + + def convertPreCreatedPollMessage(msg: String): PollVO = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val title = gson.fromJson(obj.get("title"), classOf[String]); + + val question = gson.fromJson(obj.get("question"), classOf[String]); + val qType = gson.fromJson(obj.get("questionType"), classOf[String]) + + val cvoArray = ArrayBuffer[QuestionVO]() + + val responses = obj.get("answers").getAsJsonArray(); + + val rvoArray = ArrayBuffer[ResponseVO]() + + var j = 0 + val respIter = responses.iterator() + while (respIter.hasNext()) { + val response = gson.fromJson(respIter.next(), classOf[String]); + + rvoArray += new ResponseVO(j.toString, response) + + j += 1 + } + + val questionType = if (qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false + + cvoArray += new QuestionVO(0.toString, questionType, question, rvoArray.toArray) + + new PollVO(randomAlphanumericString(12), title, cvoArray.toArray) + + } + + def convertCreatePollMessage(msg: String): PollVO = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val title = gson.fromJson(obj.get("title"), classOf[String]); + + val questions = obj.get("questions").getAsJsonArray(); + val cvoArray = ArrayBuffer[QuestionVO]() + + val iter = questions.iterator() + var i = 0 + while (iter.hasNext()) { + val aquestion = iter.next().getAsJsonObject(); + val questionText = gson.fromJson(aquestion.get("question"), classOf[String]) + + val qType = gson.fromJson(aquestion.get("questionType"), classOf[String]) + + val responses = aquestion.get("responses").getAsJsonArray(); + + val rvoArray = ArrayBuffer[ResponseVO]() + + var j = 0 + val respIter = responses.iterator() + while (respIter.hasNext()) { + val response = gson.fromJson(respIter.next(), classOf[String]); + + rvoArray += new ResponseVO(j.toString, response) + + j += 1 + } + + val questionType = if (!qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false + + cvoArray += new QuestionVO(i.toString, questionType, questionText, rvoArray.toArray) + + i += 1 + } + + new PollVO(randomAlphanumericString(12), title, cvoArray.toArray) + + } + + def convertUpdatePollMessage(msg: String): PollVO = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val title = gson.fromJson(obj.get("title"), classOf[String]); + val pollID = gson.fromJson(obj.get("id"), classOf[String]); + + val questions = obj.get("questions").getAsJsonArray(); + + val cvoArray = ArrayBuffer[QuestionVO]() + + val iter = questions.iterator() + var i = 0 + while (iter.hasNext()) { + val aquestion = iter.next().getAsJsonObject(); + val questionText = gson.fromJson(aquestion.get("question"), classOf[String]) + + val responses = aquestion.get("responses").getAsJsonArray(); + + val rvoArray = ArrayBuffer[ResponseVO]() + + var j = 0 + val respIter = responses.iterator() + while (respIter.hasNext()) { + val response = respIter.next().getAsJsonObject() + + // Get the old response id + val oldRespID = gson.fromJson(response.get("id"), classOf[String]) + // if the old response id is empty, then this is a new answer, create a new id + val respID = if (oldRespID == "") j.toString() else oldRespID + val respText = gson.fromJson(response.get("response"), classOf[String]) + + rvoArray += new ResponseVO(respID, respText) + + j += 1 + } + + val qType = gson.fromJson(aquestion.get("questionType"), classOf[String]) + val qID = gson.fromJson(aquestion.get("id"), classOf[String]) + val questionType = if (qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false + + cvoArray += new QuestionVO(qID, questionType, questionText, rvoArray.toArray) + + i += 1 + } + + new PollVO(pollID, title, cvoArray.toArray) + } + + def convertStartPollMessage(msg: String): String = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); + + pollID + } + + def convertStopPollMessage(msg: String): String = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); + + pollID + } + + def convertRemovePollMessage(msg: String): String = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); + + pollID + } + + def convertTakePollMessage(msg: String): PollResponseVO = { + val gson = new Gson(); + val parser = new JsonParser(); + val obj = parser.parse(msg).getAsJsonObject(); + val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); + val questions = obj.get("questions").getAsJsonArray(); + + val qVO = ArrayBuffer[QuestionResponsesVO](); + + val iter = questions.iterator() + while (iter.hasNext()) { + val aquestion = iter.next().getAsJsonObject(); + val questionID = gson.fromJson(aquestion.get("questionID"), classOf[String]) + + val responses = aquestion.get("responseIDs").getAsJsonArray(); + + val rvoArray = ArrayBuffer[String]() + + val respIter = responses.iterator() + while (respIter.hasNext()) { + val response = gson.fromJson(respIter.next(), classOf[String]); + rvoArray += response + } + + qVO += new QuestionResponsesVO(questionID, rvoArray.toArray) + } + + new PollResponseVO(pollID, qVO.toArray) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala new file mode 100755 index 0000000000..227b21ec2c --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala @@ -0,0 +1,237 @@ +package org.bigbluebutton.core.apps.poll + +import scala.collection.mutable.ArrayBuffer +import scala.collection.mutable.HashMap + +class PollModel { + + private val polls = new HashMap[String, Poll]() + + /** + * * + * Uncomment to create sample polls for manual testing purposes + */ + //createSamplePoll + + def numPolls(): Int = { + polls.size + } + + def createPoll(pollVO: PollVO) { + val questions = new ArrayBuffer[Question] + pollVO.questions.foreach(qv => { + val responses = new ArrayBuffer[Response] + qv.responses.foreach(rv => { + val response = new Response(rv.id, rv.text) + responses += response + }) + questions += new Question(qv.id, qv.multiResponse, qv.question, responses.toArray) + }) + + val poll = new Poll(pollVO.id, pollVO.title, questions.toArray) + polls += poll.id -> poll + } + + def updatePoll(pollVO: PollVO): Boolean = { + var success = false + + polls.get(pollVO.id) match { + case Some(p) => { + val questions = new ArrayBuffer[Question] + pollVO.questions.foreach(qv => { + val responses = new ArrayBuffer[Response] + qv.responses.foreach(rv => { + val response = new Response(rv.id, rv.text) + responses += response + }) + questions += new Question(qv.id, qv.multiResponse, qv.question, responses.toArray) + }) + + val poll = new Poll(pollVO.id, pollVO.title, questions.toArray) + polls += poll.id -> poll + success = true + } + case None => success = false + } + + success + } + + def getPolls(): Array[PollVO] = { + val poll = new ArrayBuffer[PollVO] + polls.values.foreach(p => { + poll += p.toPollVO + }) + + poll.toArray + } + + def clearPoll(pollID: String): Boolean = { + var success = false + polls.get(pollID) match { + case Some(p) => { + p.clear + success = true + } + case None => success = false + } + + success + } + + def startPoll(pollID: String): Boolean = { + var success = false + polls.get(pollID) match { + case Some(p) => { + p.start + success = true + } + case None => success = false + } + + success + } + + def removePoll(pollID: String): Boolean = { + var success = false + polls.get(pollID) match { + case Some(p) => { + polls -= p.id + success = true + } + case None => success = false + } + + success + } + + def stopPoll(pollID: String): Boolean = { + var success = false + polls.get(pollID) match { + case Some(p) => { + p.stop + success = true + } + case None => success = false + } + + success + } + + def hasPoll(pollID: String): Boolean = { + var present = false + polls.get(pollID) match { + case Some(p) => { + present = true + } + case None => present = false + } + + present + } + + def getPoll(pollID: String): Option[PollVO] = { + var poll: Option[PollVO] = None + + polls.get(pollID) match { + case Some(p) => { + val questions = new ArrayBuffer[QuestionVO] + p.questions.foreach(q => { + val responses = new ArrayBuffer[ResponseVO] + q.responses.foreach(response => { + val r = new ResponseVO(response.id, response.response, response.getResponders) + responses += r + }) + + val quest = new QuestionVO(q.id, q.multiResponse, q.question, responses.toArray) + questions += quest + }) + poll = Some(new PollVO(p.id, p.title, questions.toArray)) + } + case None => poll = None + } + + poll + } + + def hidePollResult(pollID: String) { + polls.get(pollID) match { + case Some(p) => p.hideResult + case None => // do nothing + } + } + + def showPollResult(pollID: String) { + polls.get(pollID) match { + case Some(p) => p.showResult + case None => // do nothing + } + } + + def respondToQuestion(pollID: String, questionID: String, responseID: String, responder: Responder) { + polls.get(pollID) match { + case Some(p) => { + p.respondToQuestion(questionID, responseID, responder) + } + case None => + } + } + + /** + * ****************************************************** + * Some pre-created polls for testing and simulation so we don't have + * to manually generate polls when testing the UI. + */ + def createSamplePoll() { + addSamplePoll1() + addSamplePoll2() + addSamplePoll3() + } + + def addSamplePoll1() { + val r1 = new ResponseVO("0", "Visa") + val r2 = new ResponseVO("1", "MasterCard") + val r3 = new ResponseVO("2", "AmEx") + val r4 = new ResponseVO("3", "Diners Club") + + var q = new QuestionVO("q1", false, "What type of credit card do you prefer?", Array(r1, r2, r3, r4)) + val pvo = new PollVO("pollID-101", "Preferred Credit Card", Array(q)) + + createPoll(pvo) + + respondToQuestion("pollID-101", "q1", "1", new Responder("user1", "Juan Tamad")) + respondToQuestion("pollID-101", "q1", "0", new Responder("user2", "Asyong Aksaya")) + } + + def addSamplePoll2() { + val r1 = new ResponseVO("0", "Visa") + val r2 = new ResponseVO("1", "MasterCard") + val r3 = new ResponseVO("2", "AmEx") + val r4 = new ResponseVO("3", "Diners Club") + + var q = new QuestionVO("q1", true, "Which credit cards do you own?", Array(r1, r2, r3, r4)) + val pvo = new PollVO("pollID-102", "Owned Credit Cards", Array(q)) + + createPoll(pvo) + + respondToQuestion("pollID-102", "q1", "1", new Responder("user1", "Juan Tamad")) + respondToQuestion("pollID-102", "q1", "0", new Responder("user2", "Asyong Aksaya")) + } + + def addSamplePoll3() { + val r1 = new ResponseVO("0", "Dumaguete") + val r2 = new ResponseVO("1", "Cebu") + val r3 = new ResponseVO("2", "Zamboanga") + val r4 = new ResponseVO("3", "None of the above") + + var q = new QuestionVO("q1", true, "What is the capital of the Philippines?", Array(r1, r2, r3, r4)) + val pvo = new PollVO("pollID-103", "Philippine Capital", Array(q)) + + createPoll(pvo) + + respondToQuestion("pollID-103", "q1", "1", new Responder("user1", "Juan Tamad")) + respondToQuestion("pollID-103", "q1", "0", new Responder("user2", "Asyong")) + respondToQuestion("pollID-103", "q1", "2", new Responder("user3", "Pedro")) + respondToQuestion("pollID-103", "q1", "3", new Responder("user4", "Aksaya")) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala new file mode 100755 index 0000000000..24748b6665 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala @@ -0,0 +1,7 @@ +package org.bigbluebutton.core.apps.poll + +object QuestionType extends Enumeration { + type QuestionType = Value + val MULTI_CHOICE = Value("MULTI_CHOICE") + val MULTI_REPONSE = Value("MULTI_REPONSE") +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala new file mode 100755 index 0000000000..47bb7173e6 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala @@ -0,0 +1,114 @@ +package org.bigbluebutton.core.apps.poll.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import com.google.gson.Gson +import org.bigbluebutton.conference.service.messaging.MessagingConstants +import java.util.ArrayList +import org.bigbluebutton.core.apps.poll.PollVO + +class PollEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) + case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) + case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) + case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) + case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) + case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) + case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) + case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) + case _ => // do nothing + } + } + + private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { + val gson = new Gson(); + val map = new java.util.HashMap[String, Object]() + + map.put("meetingID", msg.meetingID) + map.put("event", "PollResponseEvent") + map.put("responder", msg.responder) + map.put("response", msg.response) + + service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); + } + + private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { + val gson = new Gson(); + val message = new java.util.HashMap[String, Object]() + + val collection = new ArrayList[PollVO](); + + msg.polls.foreach(p => { + collection.add(p) + }) + + message.put("msg", gson.toJson(collection)) + + // println("PollClientMessageSender - Handling GetPollsReplyOutMsg \n" + message.get("msg") + "\n") + + } + + private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { + // println("PollClientMessageSender - Handling PollClearedOutMsg") + } + + private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { + // println("PollClientMessageSender - Handling PollStartedOutMsg") + + val gson = new Gson(); + val map = new java.util.HashMap[String, Object]() + map.put("meetingID", msg.meetingID) + map.put("event", "PollStartedEvent") + map.put("pollID", msg.pollID) + service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); + + } + + private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { + // println("PollClientMessageSender - Handling PollStoppedOutMsg") + + val gson = new Gson(); + val map = new java.util.HashMap[String, Object]() + map.put("meetingID", msg.meetingID) + map.put("event", "PollStoppedEvent") + map.put("pollID", msg.pollID) + service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); + } + + private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { + // println("PollClientMessageSender - Handling PollRemovedOutMsg") + + val gson = new Gson(); + val map = new java.util.HashMap[String, Object]() + map.put("meetingID", msg.meetingID) + map.put("event", "PollRemovedEvent") + map.put("pollID", msg.pollID) + service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); + } + + private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { + // println("PollClientMessageSender - Handling PollUpdatedOutMsg") + val gson = new Gson(); + val map = new java.util.HashMap[String, Object]() + map.put("meetingID", msg.meetingID) + map.put("event", "PollUpdatedEvent") + map.put("msg", gson.toJson(msg.pollVO)) + + service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); + } + + private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { + // println("PollClientMessageSender - Handling PollCreatedOutMsg") + val gson = new Gson(); + + val map = new java.util.HashMap[String, Object]() + map.put("meetingID", msg.meetingID) + map.put("event", "PollCreatedEvent") + map.put("msg", gson.toJson(msg.pollVO)) + + service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala new file mode 100755 index 0000000000..1bf9615191 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala @@ -0,0 +1,114 @@ +package org.bigbluebutton.core.apps.poll.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.recorder.polling.PollCreatedRecordEvent +import org.bigbluebutton.conference.service.recorder.polling.PollUpdatedRecordEvent +import org.bigbluebutton.conference.service.recorder.polling.PollRemovedRecordEvent +import org.bigbluebutton.conference.service.recorder.polling.PollStoppedRecordEvent +import org.bigbluebutton.conference.service.recorder.polling.PollStartedRecordEvent +import org.bigbluebutton.conference.service.recorder.polling.PollClearedRecordEvent + +class PollEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: GetPollsReplyOutMsg => // do nothing? + case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) + case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) + case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) + case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) + case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) + case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) + case _ => // do nothing + } + } + + def handlePollCreatedOutMsg(msg: PollCreatedOutMsg): Unit = { + if (msg.recorded) { + val ev = new PollCreatedRecordEvent(); + ev.setPollID(msg.pollVO.id) + ev.setTitle(msg.pollVO.title) + + for (q <- msg.pollVO.questions) { + ev.addQuestion(q.id, q.question, q.multiResponse) + for (resp <- q.responses) { + ev.addResponse(q.id, resp.id, resp.text) + + /*for( responder <- resp.responders ){ + ev.addResponder(q.id, resp.id, responder.id, ) + }*/ + } + } + + ev.setTimestamp(TimestampGenerator.generateTimestamp) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + + } + + def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg): Unit = { + if (msg.recorded) { + val ev = new PollUpdatedRecordEvent(); + ev.setPollID(msg.pollVO.id) + ev.setTitle(msg.pollVO.title) + + for (q <- msg.pollVO.questions) { + ev.addQuestion(q.id, q.question, q.multiResponse) + for (resp <- q.responses) { + ev.addResponse(q.id, resp.id, resp.text) + + /*for( responder <- resp.responders ){ + ev.addResponder(q.id, resp.id, responder.id, ) + }*/ + } + } + + ev.setTimestamp(TimestampGenerator.generateTimestamp) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + } + + def handlePollRemovedOutMsg(msg: PollRemovedOutMsg): Unit = { + if (msg.recorded) { + val ev = new PollRemovedRecordEvent() + ev.setPollID(msg.pollID) + ev.setTimestamp(TimestampGenerator.generateTimestamp) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + } + + def handlePollStoppedOutMsg(msg: PollStoppedOutMsg): Unit = { + if (msg.recorded) { + val ev = new PollStoppedRecordEvent() + ev.setPollID(msg.pollID) + ev.setTimestamp(TimestampGenerator.generateTimestamp) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + } + + def handlePollStartedOutMsg(msg: PollStartedOutMsg): Unit = { + if (msg.recorded) { + val ev = new PollStartedRecordEvent() + ev.setPollID(msg.pollID) + ev.setTimestamp(System.currentTimeMillis()) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + } + + def handlePollClearedOutMsg(msg: PollClearedOutMsg): Unit = { + if (msg.recorded) { + val ev = new PollClearedRecordEvent() + ev.setPollID(msg.pollID) + ev.setTimestamp(TimestampGenerator.generateTimestamp) + ev.setMeetingId(msg.meetingID) + recorder.record(msg.meetingID, ev) + } + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala new file mode 100755 index 0000000000..d2179fa56b --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala @@ -0,0 +1,154 @@ +package org.bigbluebutton.core.apps.presentation + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.MeetingActor +import com.google.gson.Gson + +case class CurrentPresenter(userId: String, name: String, assignedBy: String) + +case class CurrentPresentationInfo(presenter: CurrentPresenter, + presentations: Seq[Presentation]) +case class CursorLocation(xPercent: Double = 0D, yPercent: Double = 0D) + +trait PresentationApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private var cursorLocation = new CursorLocation + private val presModel = new PresentationModel + + def handlePreuploadedPresentations(msg: PreuploadedPresentations) { + val pres = msg.presentations + + msg.presentations.foreach(presentation => { + presModel.addPresentation(presentation) + + sharePresentation(presentation.id, true) + }) + } + + def handleInitializeMeeting(msg: InitializeMeeting) { + + } + + def handleClearPresentation(msg: ClearPresentation) { + outGW.send(new ClearPresentationOutMsg(meetingID, recorded)) + } + + def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { + outGW.send(new PresentationConversionProgress(meetingID, msg.messageKey, + msg.code, msg.presentationId, msg.presName)) + } + + def handlePresentationPageCountError(msg: PresentationPageCountError) { + outGW.send(new PresentationConversionError(meetingID, msg.messageKey, + msg.code, msg.presentationId, + msg.numberOfPages, + msg.maxNumberPages, msg.presName)) + } + + def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { + outGW.send(new PresentationPageGenerated(meetingID, msg.messageKey, + msg.code, msg.presentationId, + msg.numberOfPages, + msg.pagesCompleted, msg.presName)) + } + + def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { + + presModel.addPresentation(msg.presentation) + + outGW.send(new PresentationConversionDone(meetingID, recorded, msg.messageKey, + msg.code, msg.presentation)) + + sharePresentation(msg.presentation.id, true) + } + + def handleRemovePresentation(msg: RemovePresentation) { + val curPres = presModel.getCurrentPresentation + + val removedPresentation = presModel.remove(msg.presentationID) + + curPres foreach (cp => { + if (cp.id == msg.presentationID) { + sharePresentation(msg.presentationID, false); + } + }) + + outGW.send(new RemovePresentationOutMsg(msg.meetingID, recorded, msg.presentationID)) + + } + + def handleGetPresentationInfo(msg: GetPresentationInfo) { + // println("PresentationApp : handleGetPresentationInfo GetPresentationInfo for meeting [" + msg.meetingID + "] [" + msg.requesterID + "]" ) + + val curPresenter = getCurrentPresenter; + val presenter = new CurrentPresenter(curPresenter.presenterID, + curPresenter.presenterName, + curPresenter.assignedBy) + val presentations = presModel.getPresentations + val presentationInfo = new CurrentPresentationInfo(presenter, presentations) + outGW.send(new GetPresentationInfoOutMsg(meetingID, recorded, msg.requesterID, presentationInfo, msg.replyTo)) + } + + def handleSendCursorUpdate(msg: SendCursorUpdate) { + cursorLocation = new CursorLocation(msg.xPercent, msg.yPercent) + outGW.send(new SendCursorUpdateOutMsg(meetingID, recorded, msg.xPercent, msg.yPercent)) + } + + def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { + val page = presModel.resizePage(msg.xOffset, msg.yOffset, + msg.widthRatio, msg.heightRatio); + page foreach (p => outGW.send(new ResizeAndMoveSlideOutMsg(meetingID, recorded, p))) + } + + def handleGotoSlide(msg: GotoSlide) { + // println("Received GotoSlide for meeting=[" + msg.meetingID + "] page=[" + msg.page + "]") + // println("*** Before change page ****") + // printPresentations + presModel.changePage(msg.page) foreach { page => + // println("Switching page for meeting=[" + msg.meetingID + "] page=[" + page.id + "]") + outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) + } + // println("*** After change page ****") + // printPresentations + } + + def handleSharePresentation(msg: SharePresentation) { + sharePresentation(msg.presentationID, msg.share) + } + + def sharePresentation(presentationID: String, share: Boolean) { + val pres = presModel.sharePresentation(presentationID) + + pres foreach { p => + outGW.send(new SharePresentationOutMsg(meetingID, recorded, p)) + + presModel.getCurrentPage(p) foreach { page => + outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) + } + } + + } + + def handleGetSlideInfo(msg: GetSlideInfo) { + presModel.getCurrentPresentation foreach { pres => + presModel.getCurrentPage(pres) foreach { page => + outGW.send(new GetSlideInfoOutMsg(meetingID, recorded, msg.requesterID, page, msg.replyTo)) + } + } + + } + + def printPresentations() { + presModel.getPresentations foreach { pres => + println("presentation id=[" + pres.id + "] current=[" + pres.current + "]") + pres.pages.values foreach { page => + println("page id=[" + page.id + "] current=[" + page.current + "]") + } + } + + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala new file mode 100755 index 0000000000..44a327a92f --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala @@ -0,0 +1,127 @@ +package org.bigbluebutton.core.apps.presentation + +case class Presentation(id: String, name: String, current: Boolean = false, + pages: scala.collection.immutable.HashMap[String, Page]) + +case class Page(id: String, num: Int, + thumbUri: String = "", + swfUri: String, + txtUri: String, + pngUri: String, + current: Boolean = false, + xOffset: Double = 0, yOffset: Double = 0, + widthRatio: Double = 100D, heightRatio: Double = 100D) + +class PresentationModel { + private var presentations = new scala.collection.immutable.HashMap[String, Presentation] + + def addPresentation(pres: Presentation) { + savePresentation(pres) + } + + def getPresentations(): Seq[Presentation] = { + presentations.values.toSeq + } + + def getCurrentPresentation(): Option[Presentation] = { + presentations.values find (p => p.current) + } + + def getCurrentPage(pres: Presentation): Option[Page] = { + pres.pages.values find (p => p.current) + } + + def remove(presId: String): Option[Presentation] = { + val pres = presentations.get(presId) + pres foreach (p => presentations -= p.id) + pres + } + + def sharePresentation(presId: String): Option[Presentation] = { + getCurrentPresentation foreach (curPres => { + if (curPres.id != presId) { + val newPres = curPres.copy(current = false) + savePresentation(newPres) + } + }) + + presentations.get(presId) match { + case Some(pres) => { + val cp = pres.copy(current = true) + savePresentation(cp) + Some(cp) + } + case None => None + } + } + + private def savePresentation(pres: Presentation) { + presentations += pres.id -> pres + } + + private def resizeCurrentPage(pres: Presentation, + xOffset: Double, yOffset: Double, + widthRatio: Double, + heightRatio: Double): Option[Page] = { + getCurrentPage(pres) match { + case Some(cp) => { + val page = cp.copy(xOffset = xOffset, yOffset = yOffset, + widthRatio = widthRatio, heightRatio = heightRatio) + val nPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = nPages) + savePresentation(newPres) + Some(page) + } + case None => None + } + } + + def resizePage(xOffset: Double, yOffset: Double, + widthRatio: Double, heightRatio: Double): Option[Page] = { + for { + curPres <- getCurrentPresentation + page <- resizeCurrentPage(curPres, xOffset, yOffset, widthRatio, heightRatio) + } yield page + } + + private def deactivateCurrentPage(pres: Presentation) { + getCurrentPage(pres) foreach { cp => + val page = cp.copy(current = false) + val nPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = nPages) + savePresentation(newPres) + // println("Making page[" + page.id + "] not current[" + page.current + "]") + // println("After deact page. presentation id=[" + newPres.id + "] current=[" + newPres.current + "]") + // newPres.pages.values foreach {page => + // println("page id=[" + page.id + "] current=[" + page.current + "]") + // } + } + } + + private def makePageCurrent(pres: Presentation, page: String): Option[Page] = { + pres.pages.values find (p => p.id == page) match { + case Some(newCurPage) => { + val page = newCurPage.copy(current = true) + val newPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = newPages) + savePresentation(newPres) + // println("Making page[" + page.id + "] current[" + page.current + "]") + Some(page) + } + case None => { + // println("Could not find page[" + page + "] in presentation [" + pres.id + "]") + None + } + } + } + + def changePage(pageId: String): Option[Page] = { + getCurrentPresentation foreach { pres => deactivateCurrentPage(pres) } + + for { + pres <- getCurrentPresentation + page <- makePageCurrent(pres, pageId) + } yield page + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala new file mode 100755 index 0000000000..2ab3d5794c --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala @@ -0,0 +1,281 @@ +package org.bigbluebutton.core.apps.presentation.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.messaging.Util +import org.bigbluebutton.core.apps.presentation.Page +import collection.JavaConverters._ +import scala.collection.JavaConversions._ + +object PesentationMessageToJsonConverter { + private def pageToMap(page: Page): java.util.Map[String, Any] = { + val res = new scala.collection.mutable.HashMap[String, Any] + res += "id" -> page.id + res += "num" -> page.num + res += "thumb_uri" -> page.thumbUri + res += "swf_uri" -> page.swfUri + res += "txt_uri" -> page.txtUri + res += "png_uri" -> page.pngUri + res += "current" -> page.current + res += "x_offset" -> page.xOffset + res += "y_offset" -> page.yOffset + res += "width_ratio" -> page.widthRatio + res += "height_ratio" -> page.heightRatio + + mapAsJavaMap(res) + } + + def clearPresentationOutMsgToJson(msg: ClearPresentationOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CLEARED, msg.version, None) + Util.buildJson(header, payload) + } + + def removePresentationOutMsgToJson(msg: RemovePresentationOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationID) + + val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) + Util.buildJson(header, payload) + } + + def getPresentationInfoOutMsgToJson(msg: GetPresentationInfoOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_INFO, msg.info) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val info = msg.info + + // Create a map for our current presenter + val presenter = new java.util.HashMap[String, String]() + presenter.put(Constants.USER_ID, info.presenter.userId) + presenter.put(Constants.NAME, info.presenter.name) + presenter.put(Constants.ASSIGNED_BY, info.presenter.assignedBy) + + payload.put(Constants.PRESENTER, presenter) + + // Create an array for our presentations + val presentations = new java.util.ArrayList[java.util.HashMap[String, Object]] + info.presentations.foreach { pres => + val presentation = new java.util.HashMap[String, Object]() + presentation.put(Constants.ID, pres.id) + presentation.put(Constants.NAME, pres.name) + presentation.put(Constants.CURRENT, pres.current: java.lang.Boolean) + + // Get the pages for a presentation + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + pres.pages.values foreach { p => + pages.add(pageToMap(p)) + } + // store the pages in the presentation + presentation.put(Constants.PAGES, pages) + + // add this presentation into our presentations list + presentations.add(presentation); + } + + // add the presentation to our map to complete our json + payload.put(Constants.PRESENTATIONS, presentations) + + val header = Util.buildHeader(MessageNames.GET_PRESENTATION_INFO_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def sendCursorUpdateOutMsgToJson(msg: SendCursorUpdateOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.X_PERCENT, msg.xPercent) + payload.put(Constants.Y_PERCENT, msg.yPercent) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CURSOR_UPDATED, msg.version, None) + Util.buildJson(header, payload) + } + + def resizeAndMoveSlideOutMsgToJson(msg: ResizeAndMoveSlideOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_RESIZED, msg.version, None) + Util.buildJson(header, payload) + } + + def gotoSlideOutMsgToJson(msg: GotoSlideOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def sharePresentationOutMsgToJson(msg: SharePresentationOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val presentation = new java.util.HashMap[String, Object](); + presentation.put(Constants.ID, msg.presentation.id) + presentation.put(Constants.NAME, msg.presentation.name) + presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) + + // Get the pages for a presentation + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.presentation.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + // store the pages in the presentation + presentation.put(Constants.PAGES, pages) + + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.PRESENTATION_SHARED, msg.version, None) + Util.buildJson(header, payload) + } + + def getSlideInfoOutMsgToJson(msg: GetSlideInfoOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.GET_SLIDE_INFO_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def getPreuploadedPresentationsOutMsgToJson(msg: GetPreuploadedPresentationsOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.GET_PREUPLOADED_PRESENTATIONS, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationConversionProgressToJson(msg: PresentationConversionProgress): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presentationName) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_PROGRESS, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationConversionErrorToJson(msg: PresentationConversionError): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presentationName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_ERROR, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationPageGenerated(msg: PresentationPageGenerated): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presentationName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_GENERATED, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationConversionDoneToJson(msg: PresentationConversionDone): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + + val presentation = new java.util.HashMap[String, Object](); + presentation.put(Constants.ID, msg.presentation.id) + presentation.put(Constants.NAME, msg.presentation.name) + presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) + + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.presentation.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + presentation.put(Constants.PAGES, pages) + + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_DONE, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationChangedToJson(msg: PresentationChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + val presentation = new java.util.HashMap[String, Object](); + presentation.put(Constants.ID, msg.presentation.id) + presentation.put(Constants.NAME, msg.presentation.name) + presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) + + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.presentation.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + presentation.put(Constants.PAGES, pages) + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.PRESENTATION_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def getPresentationStatusReplyToJson(msg: GetPresentationStatusReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + val presentation = new java.util.HashMap[String, Object](); + + presentation.put(Constants.ID, msg.current.id) + presentation.put(Constants.NAME, msg.current.name) + presentation.put(Constants.CURRENT, msg.current.current: java.lang.Boolean) + + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + + msg.current.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + presentation.put(Constants.PAGES, pages) + + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.GET_PRESENTATION_STATUS_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def presentationRemovedToJson(msg: PresentationRemoved): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + + val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) + Util.buildJson(header, payload) + } + + def pageChangedToJson(msg: PageChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala new file mode 100755 index 0000000000..93979ff098 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala @@ -0,0 +1,111 @@ +package org.bigbluebutton.core.apps.presentation.redis + +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.messaging.MessagingConstants + +class PresentationEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + def handleMessage(msg: IOutMessage) { + msg match { + case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) + case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) + case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) + case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) + case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) + case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) + case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) + case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) + case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) + case msg: PresentationConversionError => handlePresentationConversionError(msg) + case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) + case msg: PresentationConversionDone => handlePresentationConversionDone(msg) + case _ => // do nothing + } + } + + private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { + val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { + val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { + val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { + val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { + val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { + val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationConversionError(msg: PresentationConversionError) { + val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { + val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationConversionDone(msg: PresentationConversionDone) { + val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationChanged(msg: PresentationChanged) { + val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { + val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationRemoved(msg: PresentationRemoved) { + val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePageChanged(msg: PageChanged) { + val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala new file mode 100644 index 0000000000..e74ae53ae2 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala @@ -0,0 +1,127 @@ +package org.bigbluebutton.core.apps.presentation.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.core.api.IOutMessage +import org.bigbluebutton.conference.service.recorder.presentation.GenerateSlidePresentationRecordEvent +import org.bigbluebutton.conference.service.recorder.presentation.ConversionCompletedPresentationRecordEvent +import org.bigbluebutton.core.api.GotoSlideOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.GotoSlidePresentationRecordEvent +import org.bigbluebutton.core.api.ResizeAndMoveSlideOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.ResizeAndMoveSlidePresentationRecordEvent +import org.bigbluebutton.core.api.RemovePresentationOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.RemovePresentationPresentationRecordEvent +import org.bigbluebutton.core.api.SharePresentationOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.SharePresentationPresentationRecordEvent +import org.bigbluebutton.core.api.SendCursorUpdateOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.CursorUpdateRecordEvent +import org.bigbluebutton.core.api.ClearPresentationOutMsg +import org.bigbluebutton.core.api.PresentationConversionDone +import org.bigbluebutton.core.api.TimestampGenerator + +class PresentationEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + private val GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; + private val CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) + case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) + case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) + case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) + case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) + case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) + case _ => // do nothing + } + } + + private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { + + } + + private def handlePresentationConversionDone(msg: PresentationConversionDone) { + if (msg.recorded) { + val event = new ConversionCompletedPresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setPresentationName(msg.presentation.id); + event.setOriginalFilename(msg.presentation.name); + recorder.record(msg.meetingID, event); + } + + } + + private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { + if (msg.recorded) { + val event = new GotoSlidePresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setSlide(msg.page.num); + event.setId(msg.page.id); + event.setNum(msg.page.num); + event.setThumbUri(msg.page.thumbUri); + event.setSwfUri(msg.page.swfUri); + event.setTxtUri(msg.page.txtUri); + event.setPngUri(msg.page.pngUri); + event.setXOffset(msg.page.xOffset); + event.setYOffset(msg.page.yOffset); + event.setWidthRatio(msg.page.widthRatio); + event.setHeightRatio(msg.page.heightRatio); + recorder.record(msg.meetingID, event); + } + } + + private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { + if (msg.recorded) { + val event = new ResizeAndMoveSlidePresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setId(msg.page.id); + event.setNum(msg.page.num); + event.setThumbUri(msg.page.thumbUri); + event.setSwfUri(msg.page.swfUri); + event.setTxtUri(msg.page.txtUri); + event.setPngUri(msg.page.pngUri); + event.setXOffset(msg.page.xOffset); + event.setYOffset(msg.page.yOffset); + event.setWidthRatio(msg.page.widthRatio); + event.setHeightRatio(msg.page.heightRatio); + + recorder.record(msg.meetingID, event); + } + } + + private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { + if (msg.recorded) { + val event = new RemovePresentationPresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setPresentationName(msg.presentationID); + recorder.record(msg.meetingID, event); + } + } + + private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { + if (msg.recorded) { + val event = new SharePresentationPresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setPresentationName(msg.presentation.id); + event.setOriginalFilename(msg.presentation.name); + event.setShare(true); + recorder.record(msg.meetingID, event); + } + } + + private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { + if (msg.recorded) { + val event = new CursorUpdateRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setXPercent(msg.xPercent); + event.setYPercent(msg.yPercent); + + recorder.record(msg.meetingID, event); + } + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala new file mode 100755 index 0000000000..3c54a75328 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala @@ -0,0 +1,133 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.models.{ UserV, Voice } +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.api.Role._ + +class Users { + + private val users = collection.mutable.HashMap[String, UserV]() + + /** + * Add a new user. + */ + def add(user: UserV) = users += user.id -> user + + /** + * Returns the number of users. + */ + def count = users.size + + /** + * Removes a user. + */ + def remove(id: String) = users -= id + + /** + * Gets a user. + */ + def get(id: String): Option[UserV] = users.values.find(u => u.id == id) + + /** + * Get all users. + */ + def all(): Array[UserV] = users.values.toArray + + def getPresenter(): Option[UserV] = users.values.find(u => u.status.isPresenter) + + def makeEveryoneNotPresenter(): Unit = { + users.values map (u => { + val p = u.copy(status = u.status.copy(isPresenter = false)) + users += p.id -> p + }) + } + + def makePresenter(id: String): Option[UserV] = { + var newPresenter: Option[UserV] = None + get(id) match { + case Some(u) => { + val p = u.copy(status = u.status.copy(isPresenter = true)) + newPresenter = Some(p) + users += p.id -> p + } + case None => + } + newPresenter + } + + def moderatorCount: Int = users.values.filter(u => u.role == MODERATOR).size + + def getVoiceUser(id: String): Option[UserV] = users.values.find(u => u.voice.id == id) + + def mute(id: String): Option[UserV] = { + var user: Option[UserV] = None + getVoiceUser(id) match { + case Some(u) => { + val mutedUser = u.copy(voice = u.voice.copy(muted = true)) + users += mutedUser.id -> mutedUser + user = Some(mutedUser) + } + case None => + } + + user + } + + def unmute(id: String): Option[UserV] = { + var user: Option[UserV] = None + getVoiceUser(id) match { + case Some(u) => { + val unmutedUser = u.copy(voice = u.voice.copy(muted = false)) + users += unmutedUser.id -> unmutedUser + user = Some(unmutedUser) + } + case None => + } + + user + } + + def lockVoice(id: String, lock: Boolean): Option[UserV] = { + var user: Option[UserV] = None + get(id) match { + case Some(u) => { + val lockedUser = u.copy(voice = u.voice.copy(locked = lock)) + users += lockedUser.id -> lockedUser + user = Some(lockedUser) + } + case None => + } + + user + } + + def joinedVoice(id: String, voice: Voice): Option[UserV] = { + var user: Option[UserV] = None + get(id) match { + case Some(u) => { + val voiceUser = u.copy(voice = voice) + users += voiceUser.id -> voiceUser + user = Some(voiceUser) + } + case None => + } + + user + } + + def leftVoice(id: String): Option[UserV] = { + var user: Option[UserV] = None + getVoiceUser(id) match { + case Some(u) => { + val voiceUser = u.copy(voice = Voice()) + users += voiceUser.id -> voiceUser + user = Some(voiceUser) + } + case None => + } + + user + } + + def unlockedUsers(): Array[UserV] = users.values filter (u => !u.voice.locked) toArray +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala new file mode 100755 index 0000000000..59f7e84293 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala @@ -0,0 +1,447 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.api._ +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.User +import java.util.ArrayList +import org.bigbluebutton.core.MeetingActor +import scala.collection.mutable.ArrayBuffer +import scala.collection.immutable.ListSet + +trait UsersApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + val users = new UsersModel + private var regUsers = new collection.immutable.HashMap[String, RegisteredUser] + + private var locked = false + private var meetingMuted = false + + private var currentPresenter = new Presenter("system", "system", "system") + + def hasUser(userID: String): Boolean = { + users.hasUser(userID) + } + + def getUser(userID: String): Option[UserVO] = { + users.getUser(userID) + } + + def getCurrentPresenter: Presenter = { + currentPresenter + } + + def handleUserConnectedToGlobalAudio(msg: UserConnectedToGlobalAudio) { + val user = users.getUserWithExternalId(msg.userid) + user foreach { u => + val vu = u.voiceUser.copy(talking = false) + val uvo = u.copy(listenOnly = true, voiceUser = vu) + users.addUser(uvo) + log.info("UserConnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") + outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) + } + } + + def handleUserDisconnectedFromGlobalAudio(msg: UserDisconnectedFromGlobalAudio) { + val user = users.getUserWithExternalId(msg.userid) + user foreach { u => + val uvo = u.copy(listenOnly = false) + users.addUser(uvo) + log.info("UserDisconnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") + outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) + } + } + + def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { + meetingMuted = msg.mute + outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) + + usersWhoAreNotPresenter foreach { u => + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + } + } + + def handleMuteMeetingRequest(msg: MuteMeetingRequest) { + meetingMuted = msg.mute + outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) + users.getUsers foreach { u => + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + } + } + + def handleValidateAuthToken(msg: ValidateAuthToken) { + // println("*************** Got ValidateAuthToken message ********************" ) + regUsers.get(msg.token) match { + case Some(u) => + { + val replyTo = meetingID + '/' + msg.userId + + //send the reply + outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, true, msg.correlationId, msg.sessionId)) + + //join the user + handleUserJoin(new UserJoining(meetingID, msg.userId, msg.token)) + + //send the presentation + log.info("ValidateToken success: mid=[" + meetingID + "] uid=[" + msg.userId + "]") + } + case None => { + log.info("ValidateToken failed: mid=[" + meetingID + "] uid=[" + msg.userId + "]") + outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId)) + } + } + + /** + * Send a reply to BigBlueButtonActor to let it know this MeetingActor hasn't hung! + * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple + * audit to check whether the actor is still alive. (ralam feb 25, 2015) + */ + sender ! new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId) + } + + def handleRegisterUser(msg: RegisterUser) { + if (hasMeetingEnded) { + // Check first if the meeting has ended and the user refreshed the client to re-connect. + log.info("Register user failed: reason=[meeting has ended] mid=[" + meetingID + "] uid=[" + msg.userID + "]") + sendMeetingHasEnded(msg.userID) + } else { + val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken) + regUsers += msg.authToken -> regUser + log.info("Register user success: mid=[" + meetingID + "] uid=[" + msg.userID + "]") + outGW.send(new UserRegistered(meetingID, recorded, regUser)) + } + + } + + def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { + outGW.send(new IsMeetingMutedReply(meetingID, recorded, msg.requesterID, meetingMuted)) + } + + def handleMuteUserRequest(msg: MuteUserRequest) { + // println("Received mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") + users.getUser(msg.userID) match { + case Some(u) => { + // println("Sending mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") + log.info("Muting user: mid=[" + meetingID + "] uid=[" + u.userID + "]") + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + } + case None => { + log.info("Could not find user to mute: mid=[" + meetingID + "] uid=[" + msg.userID + "]") + // println("Could not find user to mute. uid=[" + msg.userID + "] mute=[" + msg.mute + "]") + } + } + } + + def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { + // println("Received eject user request uid=[" + msg.userID + "]") + users.getUser(msg.userId) match { + case Some(u) => { + if (u.voiceUser.joined) { + log.info("Ejecting user from voice: mid=[" + meetingID + "] uid=[" + u.userID + "]") + outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, u.userID)) + } + } + case None => // do nothing + } + } + + def handleGetLockSettings(msg: GetLockSettings) { + //println("*************** Reply with current lock settings ********************") + + //reusing the existing handle for NewPermissionsSettings to reply to the GetLockSettings request + outGW.send(new NewPermissionsSetting(meetingID, msg.userId, permissions, users.getUsers)) + } + + def handleSetLockSettings(msg: SetLockSettings) { + // println("*************** Received new lock settings ********************") + if (!permissionsEqual(msg.settings)) { + newPermissions(msg.settings) + outGW.send(new NewPermissionsSetting(meetingID, msg.setByUser, permissions, users.getUsers)) + + handleLockLayout(msg.settings.lockedLayout, msg.setByUser) + } + } + + def handleLockUserRequest(msg: LockUserRequest) { + users.getUser(msg.userID) match { + case Some(u) => { + val uvo = u.copy(locked = msg.lock) + users.addUser(uvo) + + log.info("Lock user: mid=[" + meetingID + "] uid=[" + u.userID + "] lock=[" + msg.lock + "]") + outGW.send(new UserLocked(meetingID, u.userID, msg.lock)) + } + case None => { + log.info("Could not find user to lock: mid=[" + meetingID + "] uid=[" + msg.userID + "] lock=[" + msg.lock + "]") + } + } + } + + def handleInitLockSettings(msg: InitLockSettings) { + if (!permissionsInited) { + permissionsInited = true + newPermissions(msg.settings) + outGW.send(new PermissionsSettingInitialized(msg.meetingID, msg.settings, users.getUsers)) + } + } + + def handleInitAudioSettings(msg: InitAudioSettings) { + if (!audioSettingsInited) { + audioSettingsInited = true + if (meetingMuted != msg.muted) { + handleMuteAllExceptPresenterRequest(new MuteAllExceptPresenterRequest(meetingID, msg.requesterID, msg.muted)); + } + } + } + + def usersWhoAreNotPresenter(): Array[UserVO] = { + val au = ArrayBuffer[UserVO]() + + users.getUsers foreach { u => + if (!u.presenter) { + au += u + } + } + au.toArray + } + + def handleUserRaiseHand(msg: UserRaiseHand) { + users.getUser(msg.userId) foreach { user => + val uvo = user.copy(raiseHand = true) + users.addUser(uvo) + outGW.send(new UserRaisedHand(meetingID, recorded, uvo.userID)) + } + } + + def handleUserLowerHand(msg: UserLowerHand) { + users.getUser(msg.userId) foreach { user => + val uvo = user.copy(raiseHand = false) + users.addUser(uvo) + outGW.send(new UserLoweredHand(meetingID, recorded, uvo.userID, msg.loweredBy)) + } + } + + def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) { + users.getUser(msg.userId) foreach { user => + if (user.voiceUser.joined) { + outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, msg.userId)) + } + + users.removeUser(msg.userId) + + log.info("Ejecting user from meeting: mid=[" + meetingID + "]uid=[" + msg.userId + "]") + outGW.send(new UserEjectedFromMeeting(meetingID, recorded, msg.userId, msg.ejectedBy)) + outGW.send(new DisconnectUser(meetingID, msg.userId)) + + outGW.send(new UserLeft(msg.meetingID, recorded, user)) + } + } + + def handleUserShareWebcam(msg: UserShareWebcam) { + users.getUser(msg.userId) foreach { user => + val streams = user.webcamStreams + msg.stream + val uvo = user.copy(hasStream = true, webcamStreams = streams) + users.addUser(uvo) + log.info("User shared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] sharedStream=[" + msg.stream + "] streams=[" + streams + "]") + outGW.send(new UserSharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) + } + } + + def handleUserunshareWebcam(msg: UserUnshareWebcam) { + users.getUser(msg.userId) foreach { user => + val streams = user.webcamStreams - msg.stream + val uvo = user.copy(hasStream = (!streams.isEmpty), webcamStreams = streams) + users.addUser(uvo) + log.info("User unshared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] unsharedStream=[" + msg.stream + "] streams=[" + streams + "]") + outGW.send(new UserUnsharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) + } + } + + def handleChangeUserStatus(msg: ChangeUserStatus): Unit = { + if (users.hasUser(msg.userID)) { + outGW.send(new UserStatusChange(meetingID, recorded, msg.userID, msg.status, msg.value)) + } + } + + def handleGetUsers(msg: GetUsers): Unit = { + outGW.send(new GetUsersReply(msg.meetingID, msg.requesterID, users.getUsers)) + } + + def handleUserJoin(msg: UserJoining): Unit = { + val regUser = regUsers.get(msg.authToken) + regUser foreach { ru => + val vu = new VoiceUser(msg.userID, msg.userID, ru.name, ru.name, + false, false, false, false) + val uvo = new UserVO(msg.userID, ru.externId, ru.name, + ru.role, raiseHand = false, presenter = false, + hasStream = false, locked = getInitialLockStatus(ru.role), + webcamStreams = new ListSet[String](), phoneUser = false, vu, listenOnly = false) + + users.addUser(uvo) + + log.info("User joined meeting: mid=[" + meetingID + "] uid=[" + uvo.userID + "] role=[" + uvo.role + "] locked=[" + uvo.locked + "] permissions.lockOnJoin=[" + permissions.lockOnJoin + "] permissions.lockOnJoinConfigurable=[" + permissions.lockOnJoinConfigurable + "]") + outGW.send(new UserJoined(meetingID, recorded, uvo)) + + outGW.send(new MeetingState(meetingID, recorded, uvo.userID, permissions, meetingMuted)) + + // Become presenter if the only moderator + if (users.numModerators == 1) { + if (ru.role == Role.MODERATOR) { + assignNewPresenter(msg.userID, ru.name, msg.userID) + } + } + webUserJoined + startRecordingIfAutoStart() + } + } + + def handleUserLeft(msg: UserLeaving): Unit = { + if (users.hasUser(msg.userID)) { + val user = users.removeUser(msg.userID) + user foreach { u => + log.info("User left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]") + outGW.send(new UserLeft(msg.meetingID, recorded, u)) + + if (u.presenter) { + /* The current presenter has left the meeting. Find a moderator and make + * him presenter. This way, if there is a moderator in the meeting, there + * will always be a presenter. + */ + val moderator = users.findAModerator() + moderator.foreach { mod => + log.info("Presenter left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]. Making user=[" + mod.userID + "] presenter.") + assignNewPresenter(mod.userID, mod.name, mod.userID) + } + } + } + + startCheckingIfWeNeedToEndVoiceConf() + stopAutoStartedRecording() + } + } + + def getInitialLockStatus(role: Role.Role): Boolean = { + permissions.lockOnJoin && !role.equals(Role.MODERATOR) + } + + def handleUserJoinedVoiceFromPhone(msg: VoiceUserJoined) = { + val user = users.getUserWithVoiceUserId(msg.voiceUser.userId) match { + case Some(user) => { + log.info("Voice user=[" + msg.voiceUser.userId + "] is already in conf=[" + voiceBridge + "]. Must be duplicate message.") + } + case None => { + // No current web user. This means that the user called in through + // the phone. We need to generate a new user as we are not able + // to match with a web user. + val webUserId = users.generateWebUserId + val vu = new VoiceUser(msg.voiceUser.userId, webUserId, + msg.voiceUser.callerName, msg.voiceUser.callerNum, + true, false, false, false) + + val sessionId = "PHONE-" + webUserId; + + val uvo = new UserVO(webUserId, webUserId, msg.voiceUser.callerName, + Role.VIEWER, raiseHand = false, presenter = false, + hasStream = false, locked = getInitialLockStatus(Role.VIEWER), webcamStreams = new ListSet[String](), + phoneUser = true, vu, listenOnly = false) + + users.addUser(uvo) + log.info("New user joined voice for user [" + uvo.name + "] userid=[" + msg.voiceUser.webUserId + "]") + outGW.send(new UserJoined(meetingID, recorded, uvo, sessionId)) + + outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, uvo)) + if (meetingMuted) + outGW.send(new MuteVoiceUser(meetingID, recorded, uvo.userID, uvo.userID, meetingMuted)) + + } + } + } + + def handleVoiceUserJoined(msg: VoiceUserJoined) = { + val user = users.getUser(msg.voiceUser.webUserId) match { + case Some(user) => { + val nu = user.copy(voiceUser = msg.voiceUser) + users.addUser(nu) + log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.voiceUser.webUserId + "]") + outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) + + if (meetingMuted) + outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, meetingMuted)) + } + case None => { + handleUserJoinedVoiceFromPhone(msg) + } + } + } + + def handleVoiceUserLeft(msg: VoiceUserLeft) { + users.getUser(msg.userId) foreach { user => + val vu = new VoiceUser(user.userID, user.userID, user.name, user.name, + false, false, false, false) + val nu = user.copy(voiceUser = vu) + users.addUser(nu) + + // println("Received voice user left =[" + user.name + "] wid=[" + msg.userId + "]" ) + log.info("Received user left voice for user [" + nu.name + "] userid=[" + msg.userId + "]") + outGW.send(new UserLeftVoice(meetingID, recorded, voiceBridge, nu)) + + if (user.phoneUser) { + if (users.hasUser(user.userID)) { + val userLeaving = users.removeUser(user.userID) + userLeaving foreach (u => outGW.send(new UserLeft(msg.meetingID, recorded, u))) + } + } + } + } + + def handleVoiceUserMuted(msg: VoiceUserMuted) { + users.getUser(msg.userId) foreach { user => + val talking: Boolean = if (msg.muted) false else user.voiceUser.talking + val nv = user.voiceUser.copy(muted = msg.muted, talking = talking) + val nu = user.copy(voiceUser = nv) + users.addUser(nu) + // println("Received voice muted=[" + msg.muted + "] wid=[" + msg.userId + "]" ) + outGW.send(new UserVoiceMuted(meetingID, recorded, voiceBridge, nu)) + } + } + + def handleVoiceUserTalking(msg: VoiceUserTalking) { + users.getUser(msg.userId) foreach { user => + val nv = user.voiceUser.copy(talking = msg.talking) + val nu = user.copy(voiceUser = nv) + users.addUser(nu) + // println("Received voice talking=[" + msg.talking + "] wid=[" + msg.userId + "]" ) + outGW.send(new UserVoiceTalking(meetingID, recorded, voiceBridge, nu)) + } + } + + def handleAssignPresenter(msg: AssignPresenter): Unit = { + assignNewPresenter(msg.newPresenterID, msg.newPresenterName, msg.assignedBy) + } + + def assignNewPresenter(newPresenterID: String, newPresenterName: String, assignedBy: String) { + if (users.hasUser(newPresenterID)) { + + users.getCurrentPresenter match { + case Some(curPres) => { + users.unbecomePresenter(curPres.userID) + outGW.send(new UserStatusChange(meetingID, recorded, curPres.userID, "presenter", false: java.lang.Boolean)) + } + case None => // do nothing + } + + users.getUser(newPresenterID) match { + case Some(newPres) => { + users.becomePresenter(newPres.userID) + currentPresenter = new Presenter(newPresenterID, newPresenterName, assignedBy) + outGW.send(new PresenterAssigned(meetingID, recorded, new Presenter(newPresenterID, newPresenterName, assignedBy))) + outGW.send(new UserStatusChange(meetingID, recorded, newPresenterID, "presenter", true: java.lang.Boolean)) + } + case None => // do nothing + } + + } + } +} diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala new file mode 100755 index 0000000000..b462192d8c --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala @@ -0,0 +1,101 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.User +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.api.UserVO +import org.bigbluebutton.core.api.Role._ +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.api.VoiceUser +import org.bigbluebutton.core.util.RandomStringGenerator + +class UsersModel { + private var uservos = new collection.immutable.HashMap[String, UserVO] + + def generateWebUserId: String = { + val webUserId = RandomStringGenerator.randomAlphanumericString(6) + if (!hasUser(webUserId)) webUserId else generateWebUserId + } + + def addUser(uvo: UserVO) { + uservos += uvo.userID -> uvo + } + + def removeUser(userId: String): Option[UserVO] = { + val user = uservos get (userId) + user foreach (u => uservos -= userId) + + user + } + + def hasSessionId(sessionId: String): Boolean = { + uservos.contains(sessionId) + } + + def hasUser(userID: String): Boolean = { + uservos.contains(userID) + } + + def numUsers(): Int = { + uservos.size + } + + def numWebUsers(): Int = { + uservos.values filter (u => u.phoneUser == false) size + } + + def getUserWithExternalId(userID: String): Option[UserVO] = { + uservos.values find (u => u.externUserID == userID) + } + + def getUserWithVoiceUserId(voiceUserId: String): Option[UserVO] = { + uservos.values find (u => u.voiceUser.userId == voiceUserId) + } + + def getUser(userID: String): Option[UserVO] = { + uservos.values find (u => u.userID == userID) + } + + def getUsers(): Array[UserVO] = { + uservos.values toArray + } + + def numModerators(): Int = { + getModerators.length + } + + def findAModerator(): Option[UserVO] = { + uservos.values find (u => u.role == MODERATOR) + } + + def getCurrentPresenter(): Option[UserVO] = { + uservos.values find (u => u.presenter == true) + } + + def unbecomePresenter(userID: String) = { + uservos.get(userID) match { + case Some(u) => { + val nu = u.copy(presenter = false) + uservos += nu.userID -> nu + } + case None => // do nothing + } + } + + def becomePresenter(userID: String) = { + uservos.get(userID) match { + case Some(u) => { + val nu = u.copy(presenter = true) + uservos += nu.userID -> nu + } + case None => // do nothing + } + } + + def getModerators(): Array[UserVO] = { + uservos.values filter (u => u.role == MODERATOR) toArray + } + + def getViewers(): Array[UserVO] = { + uservos.values filter (u => u.role == VIEWER) toArray + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala new file mode 100755 index 0000000000..ab693a8848 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala @@ -0,0 +1,188 @@ +package org.bigbluebutton.core.apps.users.redis + +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.messaging.MessagingConstants +import com.google.gson.Gson + +class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + + case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) + case msg: DisconnectUser => handleDisconnectUser(msg) + case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) + case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) + case msg: UserLocked => handleUserLocked(msg) + case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) + case msg: UserRegistered => handleUserRegistered(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: PresenterAssigned => handlePresenterAssigned(msg) + case msg: EndAndKickAll => handleEndAndKickAll(msg) + case msg: GetUsersReply => handleGetUsersReply(msg) + case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserRaisedHand => handleUserRaisedHand(msg) + case msg: UserLoweredHand => handleUserLoweredHand(msg) + case msg: UserSharedWebcam => handleUserSharedWebcam(msg) + case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) + case msg: UserStatusChange => handleUserStatusChange(msg) + case msg: UserVoiceMuted => handleUserVoiceMuted(msg) + case msg: UserVoiceTalking => handleUserVoiceTalking(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) + case msg: UserListeningOnly => handleUserListeningOnly(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { + val json = UsersMessageToJsonConverter.disconnectAllUsersToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleDisconnectUser(msg: DisconnectUser) { + val json = UsersMessageToJsonConverter.disconnectUserToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { + val json = UsersMessageToJsonConverter.permissionsSettingInitializedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { + val json = UsersMessageToJsonConverter.newPermissionsSettingToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleUserLocked(msg: UserLocked) { + val json = UsersMessageToJsonConverter.userLockedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { + val json = UsersMessageToJsonConverter.getPermissionsSettingReplyToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleUserRegistered(msg: UserRegistered) { + val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleUserStatusChange(msg: UserStatusChange) { + val json = UsersMessageToJsonConverter.userStatusChangeToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserRaisedHand(msg: UserRaisedHand) { + val json = UsersMessageToJsonConverter.userRaisedHandToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserLoweredHand(msg: UserLoweredHand) { + val json = UsersMessageToJsonConverter.userLoweredHandToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserSharedWebcam(msg: UserSharedWebcam) { + val json = UsersMessageToJsonConverter.userSharedWebcamToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { + val json = UsersMessageToJsonConverter.userUnsharedWebcamToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleGetUsersReply(msg: GetUsersReply) { + val json = UsersMessageToJsonConverter.getUsersReplyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + val json = UsersMessageToJsonConverter.userJoinedVoice(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserVoiceMuted(msg: UserVoiceMuted) { + val json = UsersMessageToJsonConverter.userVoiceMuted(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserVoiceTalking(msg: UserVoiceTalking) { + val json = UsersMessageToJsonConverter.userVoiceTalking(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + val json = UsersMessageToJsonConverter.muteVoiceUserToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + val json = UsersMessageToJsonConverter.ejectVoiceUserToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + val json = UsersMessageToJsonConverter.userLeftVoiceToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { + val json = UsersMessageToJsonConverter.isMeetingMutedReplyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + val json = UsersMessageToJsonConverter.recordingStatusChangedToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { + val json = UsersMessageToJsonConverter.getRecordingStatusReplyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { + val json = UsersMessageToJsonConverter.validateAuthTokenReplyToJson(msg) + // println("************** Publishing [" + json + "] *******************") + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserJoined(msg: UserJoined) { + val json = UsersMessageToJsonConverter.userJoinedToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleRegisteredUser(msg: UserRegistered) { + val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserLeft(msg: UserLeft) { + val json = UsersMessageToJsonConverter.userLeftToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handlePresenterAssigned(msg: PresenterAssigned) { + val json = UsersMessageToJsonConverter.presenterAssignedToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleEndAndKickAll(msg: EndAndKickAll) { + val json = UsersMessageToJsonConverter.endAndKickAllToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserListeningOnly(msg: UserListeningOnly) { + val json = UsersMessageToJsonConverter.userListeningOnlyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala new file mode 100755 index 0000000000..713a505691 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala @@ -0,0 +1,214 @@ +package org.bigbluebutton.core.apps.users.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.recorder.participants.ParticipantEndAndKickAllRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.AssignPresenterRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.ParticipantStatusChangeRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.ParticipantLeftRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.ParticipantJoinRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantMutedVoiceRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantTalkingVoiceRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantJoinedVoiceRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantLeftVoiceRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.RecordStatusRecordEvent +import org.bigbluebutton.webconference.voice.StartRecordingVoiceRecordEvent + +class UsersEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: EndAndKickAll => handleEndAndKickAll(msg) + case msg: PresenterAssigned => handleAssignPresenter(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: UserStatusChange => handleUserStatusChange(msg) + case msg: UserVoiceMuted => handleUserVoiceMuted(msg) + case msg: UserVoiceTalking => handleUserVoiceTalking(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: UserRaisedHand => handleUserRaisedHand(msg) + case msg: UserLoweredHand => handleUserLoweredHand(msg) + case msg: UserSharedWebcam => handleUserSharedWebcam(msg) + case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) + case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) + case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def handleEndAndKickAll(msg: EndAndKickAll): Unit = { + if (msg.recorded) { + val ev = new ParticipantEndAndKickAllRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setMeetingId(msg.meetingID); + recorder.record(msg.meetingID, ev); + } + } + + private def handleUserJoined(msg: UserJoined): Unit = { + if (msg.recorded) { + val ev = new ParticipantJoinRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setUserId(msg.user.userID); + ev.setName(msg.user.name); + ev.setMeetingId(msg.meetingID); + ev.setRole(msg.user.role.toString()); + + recorder.record(msg.meetingID, ev); + } + } + + def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { + if (msg.recorded) { + val evt = new StartRecordingVoiceRecordEvent(true); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setRecordingTimestamp(msg.timestamp); + evt.setFilename(msg.recordingFile); + recorder.record(msg.meetingID, evt); + } + } + + def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { + if (msg.recorded) { + val evt = new StartRecordingVoiceRecordEvent(false); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setRecordingTimestamp(msg.timestamp); + evt.setFilename(msg.recordingFile); + recorder.record(msg.meetingID, evt); + } + } + + def handleUserVoiceMuted(msg: UserVoiceMuted) { + if (msg.recorded) { + val ev = new ParticipantMutedVoiceRecordEvent() + ev.setMeetingId(msg.meetingID); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setBridge(msg.confNum); + ev.setParticipant(msg.user.voiceUser.userId); + ev.setMuted(msg.user.voiceUser.muted); + + recorder.record(msg.meetingID, ev); + } + } + + def handleUserVoiceTalking(msg: UserVoiceTalking) { + if (msg.recorded) { + val evt = new ParticipantTalkingVoiceRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setParticipant(msg.user.userID); + evt.setTalking(msg.user.voiceUser.talking); + + recorder.record(msg.meetingID, evt); + } + } + + def handleUserJoinedVoice(msg: UserJoinedVoice) { + if (msg.recorded) { + val evt = new ParticipantJoinedVoiceRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setParticipant(msg.user.voiceUser.userId); + evt.setCallerName(msg.user.voiceUser.callerName); + evt.setCallerNumber(msg.user.voiceUser.callerNum); + evt.setMuted(msg.user.voiceUser.muted); + evt.setTalking(msg.user.voiceUser.talking); + + recorder.record(msg.meetingID, evt) + } + } + + def handleUserLeftVoice(msg: UserLeftVoice) { + if (msg.recorded) { + val evt = new ParticipantLeftVoiceRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setParticipant(msg.user.voiceUser.userId); + recorder.record(msg.meetingID, evt); + } + } + + def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + if (msg.recorded) { + val evt = new RecordStatusRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setUserId(msg.userId); + evt.setRecordingStatus(msg.recording.toString); + + recorder.record(msg.meetingID, evt); + } + } + + private def handleUserLeft(msg: UserLeft): Unit = { + if (msg.recorded) { + val ev = new ParticipantLeftRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setUserId(msg.user.userID); + ev.setMeetingId(msg.meetingID); + + recorder.record(msg.meetingID, ev); + } + + } + + private def handleUserRaisedHand(msg: UserRaisedHand) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "raiseHand", true: java.lang.Boolean) + handleUserStatusChange(status) + } + + private def handleUserLoweredHand(msg: UserLoweredHand) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "raiseHand", false: java.lang.Boolean) + handleUserStatusChange(status) + } + + private def handleUserSharedWebcam(msg: UserSharedWebcam) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "hasStream", "true,stream=" + msg.stream) + handleUserStatusChange(status) + } + + private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "hasStream", "false,stream=" + msg.stream) + handleUserStatusChange(status) + } + + private def handleUserStatusChange(msg: UserStatusChange): Unit = { + if (msg.recorded) { + val ev = new ParticipantStatusChangeRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setUserId(msg.userID); + ev.setMeetingId(msg.meetingID); + ev.setStatus(msg.status); + ev.setValue(msg.value.toString()); + + recorder.record(msg.meetingID, ev); + } + } + + private def handleAssignPresenter(msg: PresenterAssigned): Unit = { + if (msg.recorded) { + val event = new AssignPresenterRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setUserId(msg.presenter.presenterID); + event.setName(msg.presenter.presenterName); + event.setAssignedBy(msg.presenter.assignedBy); + + recorder.record(msg.meetingID, event); + } + + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala new file mode 100644 index 0000000000..88caab071d --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala @@ -0,0 +1,359 @@ +package org.bigbluebutton.core.apps.users.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.messaging.MessagingConstants +import org.bigbluebutton.core.messaging.Util +import com.google.gson.Gson +import org.bigbluebutton.core.api.UserVO +import collection.JavaConverters._ +import scala.collection.JavaConversions._ + +object UsersMessageToJsonConverter { + private def userToMap(user: UserVO): java.util.Map[String, Any] = { + + val wuser = new scala.collection.mutable.HashMap[String, Any] + wuser += "userid" -> user.userID + wuser += "extern_userid" -> user.externUserID + wuser += "name" -> user.name + wuser += "role" -> user.role.toString() + wuser += "raise_hand" -> user.raiseHand + wuser += "presenter" -> user.presenter + wuser += "has_stream" -> user.hasStream + wuser += "locked" -> user.locked + wuser += "webcam_stream" -> user.webcamStreams + wuser += "phone_user" -> user.phoneUser + wuser += "listenOnly" -> user.listenOnly + + val vuser = new scala.collection.mutable.HashMap[String, Any] + vuser += "userid" -> user.voiceUser.userId + vuser += "web_userid" -> user.voiceUser.webUserId + vuser += "callername" -> user.voiceUser.callerName + vuser += "callernum" -> user.voiceUser.callerNum + vuser += "joined" -> user.voiceUser.joined + vuser += "locked" -> user.voiceUser.locked + vuser += "muted" -> user.voiceUser.muted + vuser += "talking" -> user.voiceUser.talking + + wuser.put("voiceUser", mapAsJavaMap(vuser)) + + mapAsJavaMap(wuser) + } + + private def registeredUserToMap(user: RegisteredUser): java.util.Map[String, Any] = { + val wuser = new scala.collection.mutable.HashMap[String, Any] + wuser += "userid" -> user.id + wuser += "extern_userid" -> user.externId + wuser += "name" -> user.name + wuser += "role" -> user.role.toString() + wuser += "authToken" -> user.authToken + + mapAsJavaMap(wuser) + } + + def disconnectAllUsersToJson(msg: DisconnectAllUsers): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.DISCONNECT_ALL_USERS, msg.version, None) + Util.buildJson(header, payload) + } + + def disconnectUserToJson(msg: DisconnectUser): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = Util.buildHeader(MessageNames.DISCONNECT_USER, msg.version, None) + Util.buildJson(header, payload) + } + + def permissionsSettingInitializedToJson(msg: PermissionsSettingInitialized): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested + + val header = Util.buildHeader(MessageNames.PERMISSION_SETTING_INITIALIZED, msg.version, None) + Util.buildJson(header, payload) + } + + def newPermissionsSettingToJson(msg: NewPermissionsSetting): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put("disableCam", msg.permissions.disableCam) + payload.put("disableMic", msg.permissions.disableMic) + payload.put("disablePrivChat", msg.permissions.disablePrivChat) + payload.put("disablePubChat", msg.permissions.disablePubChat) + payload.put("lockedLayout", msg.permissions.lockedLayout) + payload.put("lockOnJoin", msg.permissions.lockOnJoin) + payload.put("lockOnJoinConfigurable", msg.permissions.lockOnJoin) + + val users = new java.util.ArrayList[java.util.Map[String, Any]] + msg.applyTo.foreach(uvo => { + users.add(userToMap(uvo)) + }) + + payload.put("users", users) + + val header = Util.buildHeader(MessageNames.NEW_PERMISSION_SETTINGS, msg.version, None) + Util.buildJson(header, payload) + } + + def userLockedToJson(msg: UserLocked): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCKED, msg.lock) + + val header = Util.buildHeader(MessageNames.USER_LOCKED, msg.version, None) + Util.buildJson(header, payload) + } + + def getPermissionsSettingReplyToJson(msg: GetPermissionsSettingReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = Util.buildHeader(MessageNames.GET_PERMISSION_SETTINGS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def userRegisteredToJson(msg: UserRegistered): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER, registeredUserToMap(msg.user)) + payload.put(Constants.RECORDED, msg.recorded) + + val header = Util.buildHeader(MessageNames.USER_REGISTERED, msg.version, None) + Util.buildJson(header, payload) + } + + def userRaisedHandToJson(msg: UserRaisedHand): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + + val header = Util.buildHeader(MessageNames.USER_RAISED_HAND, msg.version, None) + Util.buildJson(header, payload) + } + + def userLoweredHandToJson(msg: UserLoweredHand): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LOWERED_BY, msg.loweredBy) + + val header = Util.buildHeader(MessageNames.USER_LOWERED_HAND, msg.version, None) + Util.buildJson(header, payload) + } + + def userStatusChangeToJson(msg: UserStatusChange): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STATUS, msg.status) + payload.put(Constants.VALUE, msg.value.toString) + + val header = Util.buildHeader(MessageNames.USER_STATUS_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def userSharedWebcamToJson(msg: UserSharedWebcam): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = Util.buildHeader(MessageNames.USER_SHARED_WEBCAM, msg.version, None) + Util.buildJson(header, payload) + } + + def userUnsharedWebcamToJson(msg: UserUnsharedWebcam): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = Util.buildHeader(MessageNames.USER_UNSHARED_WEBCAM, msg.version, None) + Util.buildJson(header, payload) + } + + def getUsersReplyToJson(msg: GetUsersReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val users = new java.util.ArrayList[java.util.Map[String, Any]]; + msg.users.foreach(uvo => { + users.add(userToMap(uvo)) + }) + + payload.put(Constants.USERS, users) + + val header = Util.buildHeader(MessageNames.GET_USERS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def userJoinedVoice(msg: UserJoinedVoice): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_JOINED_VOICE, msg.version, None) + Util.buildJson(header, payload) + } + + def userVoiceMuted(msg: UserVoiceMuted): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_VOICE_MUTED, msg.version, None) + Util.buildJson(header, payload) + } + + def userVoiceTalking(msg: UserVoiceTalking): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_VOICE_TALKING, msg.version, None) + Util.buildJson(header, payload) + } + + def muteVoiceUserToJson(msg: MuteVoiceUser): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MUTE, msg.mute) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) + Util.buildJson(header, payload) + } + + def ejectVoiceUserToJson(msg: EjectVoiceUser): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) + Util.buildJson(header, payload) + } + + def userLeftVoiceToJson(msg: UserLeftVoice): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_LEFT_VOICE, msg.version, None) + Util.buildJson(header, payload) + } + + def isMeetingMutedReplyToJson(msg: IsMeetingMutedReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTED, msg.meetingMuted) + + val header = Util.buildHeader(MessageNames.IS_MEETING_MUTED_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def recordingStatusChangedToJson(msg: RecordingStatusChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def validateAuthTokenReplyToJson(msg: ValidateAuthTokenReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.REPLY_TO, msg.correlationId) + payload.put(Constants.VALID, msg.valid.toString) + payload.put(Constants.USER_ID, msg.requesterId) + payload.put(Constants.AUTH_TOKEN, msg.token) + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.VALIDATE_AUTH_TOKEN_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def userJoinedToJson(msg: UserJoined): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put("user", userToMap(msg.user)) + + val header = Util.buildHeader(MessageNames.USER_JOINED, msg.version, None) + Util.buildJson(header, payload) + } + + def userLeftToJson(msg: UserLeft): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put("user", userToMap(msg.user)) + + val header = Util.buildHeader(MessageNames.USER_LEFT, msg.version, None) + Util.buildJson(header, payload) + } + + def presenterAssignedToJson(msg: PresenterAssigned): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); + payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); + payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); + payload.put(Constants.RECORDED, msg.recorded) + + val header = Util.buildHeader(MessageNames.PRESENTER_ASSIGNED, msg.version, None) + Util.buildJson(header, payload) + } + + def endAndKickAllToJson(msg: EndAndKickAll): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + + val header = Util.buildHeader(MessageNames.END_AND_KICK_ALL, msg.version, None) + Util.buildJson(header, payload) + } + + def userListeningOnlyToJson(msg: UserListeningOnly): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LISTEN_ONLY, msg.listenOnly) + + val header = Util.buildHeader(MessageNames.USER_LISTEN_ONLY, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala new file mode 100644 index 0000000000..f888c21f6e --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala @@ -0,0 +1,34 @@ +package org.bigbluebutton.core.apps.voice + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.MeetingActor + +trait VoiceApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { + + } + + def handleMuteMeetingRequest(msg: MuteMeetingRequest) { + + } + + def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { + + } + + def handleMuteUserRequest(msg: MuteUserRequest) { + + } + + def handleLockUserRequest(msg: LockUserRequest) { + + } + + def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { + + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala new file mode 100644 index 0000000000..f06efed41d --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala @@ -0,0 +1,65 @@ +package org.bigbluebutton.core.apps.voice + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class VoiceInGateway(bbbGW: BigBlueButtonGateway) { + + def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: Boolean) { + bbbGW.accept(new MuteAllExceptPresenterRequest(meetingID, requesterID, mute)) + } + + def muteAllUsers(meetingID: String, requesterID: String, mute: Boolean) { + bbbGW.accept(new MuteMeetingRequest(meetingID, requesterID, mute)) + } + + def isMeetingMuted(meetingID: String, requesterID: String) { + bbbGW.accept(new IsMeetingMutedRequest(meetingID, requesterID)) + } + + def muteUser(meetingID: String, requesterID: String, userID: String, mute: Boolean) { + bbbGW.accept(new MuteUserRequest(meetingID, requesterID, userID, mute)) + } + + def lockUser(meetingID: String, requesterID: String, userID: String, lock: Boolean) { + bbbGW.accept(new LockUserRequest(meetingID, requesterID, userID, lock)) + } + + def ejectUserFromVoice(meetingID: String, userId: String, ejectedBy: String) { + bbbGW.accept(new EjectUserFromVoiceRequest(meetingID, userId, ejectedBy)) + } + + def voiceUserJoined(meetingId: String, userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, + muted: Boolean, talking: Boolean) { + // println("VoiceInGateway: Got voiceUserJoined message for meeting [" + meetingId + "] user[" + callerIdName + "]") + val voiceUser = new VoiceUser(userId, webUserId, + callerIdName, callerIdNum, + true, false, muted, talking) + bbbGW.accept(new VoiceUserJoined(meetingId, voiceUser)) + } + + def voiceUserLeft(meetingId: String, userId: String) { + // println("VoiceInGateway: Got voiceUserLeft message for meeting [" + meetingId + "] user[" + userId + "]") + bbbGW.accept(new VoiceUserLeft(meetingId, userId)) + } + + def voiceUserLocked(meetingId: String, userId: String, locked: Boolean) { + bbbGW.accept(new VoiceUserLocked(meetingId, userId, locked)) + } + + def voiceUserMuted(meetingId: String, userId: String, muted: Boolean) { + bbbGW.accept(new VoiceUserMuted(meetingId, userId, muted)) + } + + def voiceUserTalking(meetingId: String, userId: String, talking: Boolean) { + bbbGW.accept(new VoiceUserTalking(meetingId, userId, talking)) + } + + def voiceRecording(meetingId: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + bbbGW.accept(new VoiceRecording(meetingId, recordingFile, + timestamp, recording)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala new file mode 100644 index 0000000000..68ffa83d20 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala @@ -0,0 +1,100 @@ +package org.bigbluebutton.core.apps.whiteboard + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil +import org.bigbluebutton.core.MeetingActor +import org.bigbluebutton.core.apps.whiteboard.vo._ + +case class Whiteboard(id: String, shapes: Seq[AnnotationVO]) + +trait WhiteboardApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private val wbModel = new WhiteboardModel + + def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { + val status = msg.annotation.status + val shapeType = msg.annotation.shapeType + val wbId = msg.annotation.wbId + val shape = msg.annotation + + initWhiteboard(wbId) + + // println("Received whiteboard shape. status=[" + status + "], shapeType=[" + shapeType + "]") + + if (WhiteboardKeyUtil.TEXT_CREATED_STATUS == status) { + // println("Received textcreated status") + wbModel.addAnnotation(wbId, shape) + } else if ((WhiteboardKeyUtil.PENCIL_TYPE == shapeType) + && (WhiteboardKeyUtil.DRAW_START_STATUS == status)) { + // println("Received pencil draw start status") + wbModel.addAnnotation(wbId, shape) + } else if ((WhiteboardKeyUtil.DRAW_END_STATUS == status) + && ((WhiteboardKeyUtil.RECTANGLE_TYPE == shapeType) + || (WhiteboardKeyUtil.ELLIPSE_TYPE == shapeType) + || (WhiteboardKeyUtil.TRIANGLE_TYPE == shapeType) + || (WhiteboardKeyUtil.LINE_TYPE == shapeType))) { + // println("Received [" + shapeType +"] draw end status") + wbModel.addAnnotation(wbId, shape) + } else if (WhiteboardKeyUtil.TEXT_TYPE == shapeType) { + // println("Received [" + shapeType +"] modify text status") + wbModel.modifyText(wbId, shape) + } else { + // println("Received UNKNOWN whiteboard shape!!!!. status=[" + status + "], shapeType=[" + shapeType + "]") + } + wbModel.getWhiteboard(wbId) foreach { wb => + // println("WhiteboardApp::handleSendWhiteboardAnnotationRequest - num shapes [" + wb.shapes.length + "]") + outGW.send(new SendWhiteboardAnnotationEvent(meetingID, recorded, + msg.requesterID, wbId, msg.annotation)) + } + + } + + private def initWhiteboard(wbId: String) { + if (!wbModel.hasWhiteboard(wbId)) { + wbModel.createWhiteboard(wbId) + } + } + + def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { + //println("WB: Received page history [" + msg.whiteboardId + "]") + wbModel.history(msg.whiteboardId) foreach { wb => + outGW.send(new GetWhiteboardShapesReply(meetingID, recorded, + msg.requesterID, wb.id, wb.shapes.toArray, msg.replyTo)) + } + } + + def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { + //println("WB: Received clear whiteboard") + wbModel.clearWhiteboard(msg.whiteboardId) + wbModel.getWhiteboard(msg.whiteboardId) foreach { wb => + outGW.send(new ClearWhiteboardEvent(meetingID, recorded, + msg.requesterID, wb.id)) + } + } + + def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { + // println("WB: Received undo whiteboard") + + wbModel.getWhiteboard(msg.whiteboardId) foreach { wb => + wbModel.undoWhiteboard(msg.whiteboardId) foreach { last => + outGW.send(new UndoWhiteboardEvent(meetingID, recorded, + msg.requesterID, wb.id, last.id)) + } + } + } + + def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { + wbModel.enableWhiteboard(msg.enable) + outGW.send(new WhiteboardEnabledEvent(meetingID, recorded, + msg.requesterID, msg.enable)) + } + + def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { + val enabled = wbModel.isWhiteboardEnabled() + outGW.send(new IsWhiteboardEnabledReply(meetingID, recorded, + msg.requesterID, enabled, msg.replyTo)) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala new file mode 100755 index 0000000000..87a8edead7 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala @@ -0,0 +1,54 @@ +package org.bigbluebutton.core.apps.whiteboard + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO + +class WhiteboardInGateway(bbbGW: BigBlueButtonGateway) { + + private def buildAnnotation(annotation: Map[String, Object]): Option[AnnotationVO] = { + var shape: Option[AnnotationVO] = None + + val id = annotation.getOrElse("id", null).asInstanceOf[String] + val shapeType = annotation.getOrElse("type", null).asInstanceOf[String] + val status = annotation.getOrElse("status", null).asInstanceOf[String] + val wbId = annotation.getOrElse("whiteboardId", null).asInstanceOf[String] + // println("** GOT ANNOTATION status[" + status + "] shape=[" + shapeType + "]"); + + if (id != null && shapeType != null && status != null && wbId != null) { + shape = Some(new AnnotationVO(id, status, shapeType, annotation.toMap, wbId)) + } + + shape + } + + def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: Map[String, Object]) { + buildAnnotation(annotation) match { + case Some(shape) => { + bbbGW.accept(new SendWhiteboardAnnotationRequest(meetingID, requesterID, shape)) + } + case None => // do nothing + } + } + + def requestWhiteboardAnnotationHistory(meetingID: String, requesterID: String, whiteboardId: String, replyTo: String) { + bbbGW.accept(new GetWhiteboardShapesRequest(meetingID, requesterID, whiteboardId, replyTo)) + } + + def clearWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { + bbbGW.accept(new ClearWhiteboardRequest(meetingID, requesterID, whiteboardId)) + } + + def undoWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { + bbbGW.accept(new UndoWhiteboardRequest(meetingID, requesterID, whiteboardId)) + } + + def enableWhiteboard(meetingID: String, requesterID: String, enable: Boolean) { + bbbGW.accept(new EnableWhiteboardRequest(meetingID, requesterID, enable)) + } + + def isWhiteboardEnabled(meetingID: String, requesterID: String, replyTo: String) { + bbbGW.accept(new IsWhiteboardEnabledRequest(meetingID, requesterID, replyTo)) + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala new file mode 100644 index 0000000000..831b7e9112 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala @@ -0,0 +1,87 @@ +package org.bigbluebutton.core.apps.whiteboard + +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import scala.collection.mutable.ArrayBuffer + +class WhiteboardModel { + private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]() + + private var _enabled = true + + private def saveWhiteboard(wb: Whiteboard) { + _whiteboards += wb.id -> wb + } + + def getWhiteboard(id: String): Option[Whiteboard] = { + _whiteboards.values.find(wb => wb.id == id) + } + + def hasWhiteboard(id: String): Boolean = { + _whiteboards.contains(id) + } + + def createWhiteboard(wbId: String) { + val vec = scala.collection.immutable.Vector.empty + val wb = new Whiteboard(wbId, vec) + saveWhiteboard(wb) + } + + def addAnnotationToShape(wb: Whiteboard, shape: AnnotationVO) = { + // println("Adding shape to wb [" + wb.id + "]. Before numShapes=[" + wb.shapes.length + "].") + val newWb = wb.copy(shapes = (wb.shapes :+ shape)) + // println("Adding shape to page [" + wb.id + "]. After numShapes=[" + newWb.shapes.length + "].") + saveWhiteboard(newWb) + } + + def addAnnotation(wbId: String, shape: AnnotationVO) { + getWhiteboard(wbId) foreach { wb => + addAnnotationToShape(wb, shape) + } + } + + private def modifyTextInPage(wb: Whiteboard, shape: AnnotationVO) = { + val removedLastText = wb.shapes.dropRight(1) + val addedNewText = removedLastText :+ shape + val newWb = wb.copy(shapes = addedNewText) + saveWhiteboard(newWb) + } + + def modifyText(wbId: String, shape: AnnotationVO) { + getWhiteboard(wbId) foreach { wb => + modifyTextInPage(wb, shape) + } + } + + def history(wbId: String): Option[Whiteboard] = { + getWhiteboard(wbId) + } + + def clearWhiteboard(wbId: String) { + getWhiteboard(wbId) foreach { wb => + val clearedShapes = wb.shapes.drop(wb.shapes.length) + val newWb = wb.copy(shapes = clearedShapes) + saveWhiteboard(newWb) + } + } + + def undoWhiteboard(wbId: String): Option[AnnotationVO] = { + var last: Option[AnnotationVO] = None + getWhiteboard(wbId) foreach { wb => + if (!wb.shapes.isEmpty) { + last = Some(wb.shapes.last) + val remaining = wb.shapes.dropRight(1) + val newWb = wb.copy(shapes = remaining) + saveWhiteboard(newWb) + } + } + last + } + + def enableWhiteboard(enable: Boolean) { + _enabled = enable + } + + def isWhiteboardEnabled(): Boolean = { + _enabled + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala new file mode 100755 index 0000000000..a51bc0765a --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala @@ -0,0 +1,56 @@ +package org.bigbluebutton.core.apps.whiteboard.redis + +import org.bigbluebutton.core.api._ +import scala.collection.JavaConversions._ +import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil +import scala.collection.immutable.StringOps +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.conference.service.messaging.MessagingConstants + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +class WhiteboardEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + def handleMessage(msg: IOutMessage) { + msg match { + case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) + case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) + case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) + case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) + case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) + case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { + val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { + val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { + val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { + val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala new file mode 100644 index 0000000000..6520e72e3b --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala @@ -0,0 +1,92 @@ +package org.bigbluebutton.core.apps.whiteboard.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.whiteboard.redis.AddShapeWhiteboardRecordEvent +import scala.collection.JavaConversions._ +import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil +import org.bigbluebutton.conference.service.whiteboard.redis.AddTextWhiteboardRecordEvent +import org.bigbluebutton.conference.service.whiteboard.redis.ClearPageWhiteboardRecordEvent +import org.bigbluebutton.conference.service.whiteboard.redis.UndoShapeWhiteboardRecordEvent +import org.bigbluebutton.conference.service.whiteboard.redis.ModifyTextWhiteboardRecordEvent +import scala.collection.immutable.StringOps + +class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) + case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) + case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def getPresentationId(whiteboardId: String): String = { + // Need to split the whiteboard id into presenation id and page num as the old + // recording expects them + val strId = new StringOps(whiteboardId) + val ids = strId.split('/') + var presId: String = "" + if (ids.length == 2) { + presId = ids(0) + } + + presId + } + + private def getPageNum(whiteboardId: String): String = { + val strId = new StringOps(whiteboardId) + val ids = strId.split('/') + var pageNum = "0" + if (ids.length == 2) { + pageNum = ids(1) + } + pageNum + } + + private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { + if ((msg.shape.shapeType == WhiteboardKeyUtil.TEXT_TYPE) && (msg.shape.status != WhiteboardKeyUtil.TEXT_CREATED_STATUS)) { + + val event = new ModifyTextWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId) + event.addAnnotation(mapAsJavaMap(msg.shape.shape)) + recorder.record(msg.meetingID, event) + } else { + val event = new AddShapeWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId); + event.addAnnotation(mapAsJavaMap(msg.shape.shape)) + recorder.record(msg.meetingID, event) + } + } + + private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { + val event = new ClearPageWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId) + recorder.record(msg.meetingID, event) + } + + private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { + val event = new UndoShapeWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId) + event.setShapeId(msg.shapeId); + recorder.record(msg.meetingID, event) + } + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala new file mode 100755 index 0000000000..6a9db85067 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala @@ -0,0 +1,94 @@ +package org.bigbluebutton.core.apps.whiteboard.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.messaging.Util +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import collection.JavaConverters._ +import scala.collection.JavaConversions._ + +object WhiteboardMessageToJsonConverter { + private def shapeToMap(shape: AnnotationVO): java.util.Map[String, Any] = { + val res = new scala.collection.mutable.HashMap[String, Any] + res += "id" -> shape.id + res += "status" -> shape.status + res += "shape_type" -> shape.shapeType + res += "wb_id" -> shape.wbId + + val shapeMap = new scala.collection.mutable.HashMap[String, Any]() + for ((key, value) <- shape.shape) { + shapeMap += key -> value + } + res += "shape" -> mapAsJavaMap(shapeMap) + + mapAsJavaMap(res) + } + + def getWhiteboardShapesReplyToJson(msg: GetWhiteboardShapesReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val shapes = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.shapes.foreach { shape => + shapes.add(shapeToMap(shape)) + } + + payload.put(Constants.SHAPES, shapes) + + val header = Util.buildHeader(MessageNames.GET_WHITEBOARD_SHAPES_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def sendWhiteboardAnnotationEventToJson(msg: SendWhiteboardAnnotationEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + payload.put(Constants.SHAPE, shapeToMap(msg.shape)) + + val header = Util.buildHeader(MessageNames.SEND_WHITEBOARD_SHAPE, msg.version, None) + Util.buildJson(header, payload) + } + + def clearWhiteboardEventToJson(msg: ClearWhiteboardEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = Util.buildHeader(MessageNames.WHITEBOARD_CLEARED, msg.version, None) + Util.buildJson(header, payload) + } + + def undoWhiteboardEventToJson(msg: UndoWhiteboardEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + payload.put(Constants.SHAPE_ID, msg.shapeId) + + val header = Util.buildHeader(MessageNames.UNDO_WHITEBOARD, msg.version, None) + Util.buildJson(header, payload) + } + + def whiteboardEnabledEventToJson(msg: WhiteboardEnabledEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ENABLE, msg.enable) + + val header = Util.buildHeader(MessageNames.WHITEBOARD_ENABLED, msg.version, None) + Util.buildJson(header, payload) + } + + def isWhiteboardEnabledReplyToJson(msg: IsWhiteboardEnabledReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ENABLE, msg.enabled) + + val header = Util.buildHeader(MessageNames.IS_WHITEBOARD_ENABLED_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala new file mode 100755 index 0000000000..8d373be551 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala @@ -0,0 +1,3 @@ +package org.bigbluebutton.core.apps.whiteboard.vo + +case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Object], wbId: String) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala new file mode 100755 index 0000000000..b34133b525 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala @@ -0,0 +1,94 @@ +package org.bigbluebutton.core.meeting + +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import scala.collection.immutable.HashMap +import com.google.gson.Gson +import scala.collection.JavaConverters._ +import org.bigbluebutton.conference.service.messaging.MessagingConstants + +class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + + private val KEEP_ALIVE_REPLY = "KEEP_ALIVE_REPLY" + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) + case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingHasEnded => handleMeetingHasEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: KeepAliveMessageReply => handleKeepAliveMessageReply(msg) + case msg: StartRecording => handleStartRecording(msg) + case msg: StopRecording => handleStopRecording(msg) + case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) + case _ => //println("Unhandled message in MeetingEventRedisPublisher") + } + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) + // System.out.println("****\n" + json) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply) { + val json = MeetingMessageToJsonConverter.keepAliveMessageReplyToJson(msg) + service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, json) + } + + private def handleMeetingCreated(msg: MeetingCreated) { + val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) + // System.out.println("****\n" + json) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingEnded(msg: MeetingEnded) { + val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) + // System.out.println("****\n" + json) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleStartRecording(msg: StartRecording) { + val json = MeetingMessageToJsonConverter.startRecordingToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleStopRecording(msg: StopRecording) { + val json = MeetingMessageToJsonConverter.stopRecordingToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { + val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { + val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { + val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingHasEnded(msg: MeetingHasEnded) { + val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { + val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala new file mode 100644 index 0000000000..2dba6e981f --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala @@ -0,0 +1,132 @@ +package org.bigbluebutton.core.meeting + +import org.bigbluebutton.core.messaging.Util +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.JavaConverters._ + +object MeetingMessageToJsonConverter { + def meetingDestroyedToJson(msg: MeetingDestroyed): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.MEETING_DESTROYED_EVENT, msg.version, None) + Util.buildJson(header, payload) + } + + def keepAliveMessageReplyToJson(msg: KeepAliveMessageReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.KEEP_ALIVE_ID, msg.aliveID) + + val header = Util.buildHeader(MessageNames.KEEP_ALIVE_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingCreatedToJson(msg: MeetingCreated): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) + payload.put(Constants.NAME, msg.name) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.VOICE_CONF, msg.voiceBridge) + payload.put(Constants.DURATION, msg.duration) + payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) + payload.put(Constants.VIEWER_PASS, msg.viewerPass) + payload.put(Constants.CREATE_TIME, msg.createTime) + payload.put(Constants.CREATE_DATE, msg.createDate) + + val header = Util.buildHeader(MessageNames.MEETING_CREATED, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingEndedToJson(msg: MeetingEnded): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) + Util.buildJson(header, payload) + } + + def voiceRecordingStartedToJson(msg: VoiceRecordingStarted): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.RECORDING_FILE, msg.recordingFile) + payload.put(Constants.VOICE_CONF, msg.confNum) + payload.put(Constants.TIMESTAMP, msg.timestamp) + + val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STARTED, msg.version, None) + Util.buildJson(header, payload) + } + + def voiceRecordingStoppedToJson(msg: VoiceRecordingStopped): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.RECORDING_FILE, msg.recordingFile) + payload.put(Constants.VOICE_CONF, msg.confNum) + payload.put(Constants.TIMESTAMP, msg.timestamp) + + val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STOPPED, msg.version, None) + Util.buildJson(header, payload) + } + + def recordingStatusChangedToJson(msg: RecordingStatusChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingHasEndedToJson(msg: MeetingHasEnded): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) + Util.buildJson(header, payload) + } + + def startRecordingToJson(msg: StartRecording): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.START_RECORDING, msg.version, None) + Util.buildJson(header, payload) + } + + def stopRecordingToJson(msg: StopRecording): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.STOP_RECORDING, msg.version, None) + Util.buildJson(header, payload) + } + + def getAllMeetingsReplyToJson(msg: GetAllMeetingsReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put("meetings", msg.meetings) + + val header = Util.buildHeader(MessageNames.GET_ALL_MEETINGS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala new file mode 100644 index 0000000000..3e3eb7337c --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala @@ -0,0 +1,32 @@ +package org.bigbluebutton.core.messaging + +import org.bigbluebutton.core.api._ +import com.google.gson.Gson + +object Util { + + val VERSION = "version" + + def buildHeader(name: String, version: String, + replyTo: Option[String]): java.util.HashMap[String, Any] = { + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, name) + header.put(VERSION, version) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + replyTo.foreach(rep => header.put(Constants.REPLY_TO, rep)) + + header + } + + def buildJson(header: java.util.HashMap[String, Any], + payload: java.util.HashMap[String, Any]): String = { + + val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() + message.put(Constants.HEADER, header) + message.put(Constants.PAYLOAD, payload) + + val gson = new Gson() + gson.toJson(message) + } +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala new file mode 100755 index 0000000000..14cf8bcbac --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala @@ -0,0 +1,23 @@ +package org.bigbluebutton.core.models + +import org.bigbluebutton.core.api.Role._ + +case class Status(isPresenter: Boolean = false, handRaised: Boolean = false) + +case class CallerId(num: String = "", name: String = "") + +case class Voice( + hasJoined: Boolean = false, + id: String = "", + callerId: CallerId = CallerId(), + muted: Boolean = false, + talking: Boolean = false, + locked: Boolean = false) + +case class UserV( + id: String, + extId: String, + name: String, + role: Role = VIEWER, + status: Status = Status(), + voice: Voice = Voice()) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala new file mode 100755 index 0000000000..b1b60cc715 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala @@ -0,0 +1,17 @@ +package org.bigbluebutton.core.util + +object RandomStringGenerator { + // From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ + + // Random generator + val random = new scala.util.Random + + // Generate a random string of length n from the given alphabet + def randomString(alphabet: String)(n: Int): String = + Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString + + // Generate a random alphabnumeric string of length n + def randomAlphanumericString(n: Int) = + randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) +} + diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala new file mode 100755 index 0000000000..81c8cc3513 --- /dev/null +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala @@ -0,0 +1,14 @@ +package org.bigbluebutton.core.voice + +import akka.actor._ +import akka.actor.ActorLogging + +case class MuteAllUsers(meetingId: String, except: Option[Seq[String]]) +case class MuteUser(meetingId: String, userId: String) +case class UnmuteUser(meetingId: String, userId: String) +case class EjectVoiceUser(meetingId: String, userId: String) + +class VoiceConferenceActor(val meetingId: String, + val voiceConf: String) { //extends Actor { + +} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala index 972a7538bb..e154a9c78b 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala @@ -7,31 +7,31 @@ import org.bigbluebutton.apps.users.data.UserIdAndName sealed abstract class InMsgFormatter case class CreateMeetingRequestFormat(header: Header, - payload: CreateMeetingRequestPayloadFormat) extends InMsgFormatter + payload: CreateMeetingRequestPayloadFormat) extends InMsgFormatter case class CreateMeetingResponseFormat(header: Header, - payload: CreateMeetingResponsePayloadFormat) extends InMsgFormatter - -case class RegisterUserRequestFormat(header: Header, - payload: RegisterUserRequestPayloadFormat) extends InMsgFormatter + payload: CreateMeetingResponsePayloadFormat) extends InMsgFormatter -case class RegisterUserResponseFormat(header: Header, - payload: RegisterUserResponsePayloadFormat) extends InMsgFormatter +case class RegisterUserRequestFormat(header: Header, + payload: RegisterUserRequestPayloadFormat) extends InMsgFormatter -case class UserRegisteredEventFormat(header: Header, - payload: UserRegisteredEventPayloadFormat) extends InMsgFormatter - -case class UserJoinRequestFormat(header: Header, - payload: UserJoinRequestPayloadFormat) extends InMsgFormatter +case class RegisterUserResponseFormat(header: Header, + payload: RegisterUserResponsePayloadFormat) extends InMsgFormatter -case class UserJoinedEventFormat(header: Header, - payload: UserJoinedEventPayloadFormat) extends InMsgFormatter - -case class UserLeaveMessage(header: Header, - payload: UserLeavePayload) extends InMsgFormatter +case class UserRegisteredEventFormat(header: Header, + payload: UserRegisteredEventPayloadFormat) extends InMsgFormatter -case class GetUsersRequestMessage(header: Header, - payload: GetUsersRequestPayload) extends InMsgFormatter - -case class AssignPresenterMessage(header: Header, - payload: AssignPresenterPayload) extends InMsgFormatter +case class UserJoinRequestFormat(header: Header, + payload: UserJoinRequestPayloadFormat) extends InMsgFormatter + +case class UserJoinedEventFormat(header: Header, + payload: UserJoinedEventPayloadFormat) extends InMsgFormatter + +case class UserLeaveMessage(header: Header, + payload: UserLeavePayload) extends InMsgFormatter + +case class GetUsersRequestMessage(header: Header, + payload: GetUsersRequestPayload) extends InMsgFormatter + +case class AssignPresenterMessage(header: Header, + payload: AssignPresenterPayload) extends InMsgFormatter diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala old mode 100644 new mode 100755 index 4865ac7c8a..3d1d31d76d --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala @@ -2,31 +2,31 @@ package org.bigbluebutton.endpoint import akka.util.Timeout import scala.concurrent.duration._ -import akka.actor.{Actor, ActorRef, ActorLogging, Props} +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } import org.bigbluebutton.apps.users.protocol.UsersMessageHandler /** - * This actor is responsible for handling messages from the pubsub. + * This actor is responsible for handling messages from the pubsub. */ object MessageHandlerActor { - def props(bbbAppsActor: ActorRef, messageMarshallingActor: ActorRef): Props = - Props(classOf[MessageHandlerActor], bbbAppsActor, messageMarshallingActor) + def props(bbbAppsActor: ActorRef, messageMarshallingActor: ActorRef): Props = + Props(classOf[MessageHandlerActor], bbbAppsActor, messageMarshallingActor) } -class MessageHandlerActor private (val bbbAppsActor: ActorRef, - val messageMarshallingActor: ActorRef) extends Actor - with ActorLogging with UsersMessageHandler { +class MessageHandlerActor private (val bbbAppsActor: ActorRef, + val messageMarshallingActor: ActorRef) extends Actor + with ActorLogging { /** RefFactory for actor request-response (ask pattern) **/ def actorRefFactory = context - /** Required for actor request-response (ask pattern) **/ + /** Required for actor request-response (ask pattern) **/ implicit def executionContext = actorRefFactory.dispatcher implicit val timeout = Timeout(5 seconds) - + def receive = { - case msg: UserJoinRequestFormat => handleUserJoinRequestMessage(msg) - - case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) + case msg: UserJoinRequestFormat => //handleUserJoinRequestMessage(msg) + + case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala index 4249513d17..bb36c3b1b2 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala @@ -11,80 +11,80 @@ import org.bigbluebutton.apps.users.messages.UserJoinResponse case class ResultFormat(success: Boolean, message: String) -case class UserFormat(id: String, external_id: String, name: String, - role: Role.RoleType, pin: Int, welcome_message: String, - logout_url: String, avatar_url: String) - +case class UserFormat(id: String, external_id: String, name: String, + role: Role.RoleType, pin: Int, welcome_message: String, + logout_url: String, avatar_url: String) + case class DurationFormat(length_in_minutes: Int, allow_extend: Boolean, max_minutes: Int) case class VoiceConferenceFormat(pin: Int, number: Int) case class PhoneNumberFormat(number: String, description: String) -case class MeetingDescriptorFormat(name: String, external_id: String, - record: Boolean, welcome_message: String, logout_url: String, - avatar_url: String, max_users: Int, duration: DurationFormat, - voice_conference: VoiceConferenceFormat, - phone_numbers: Seq[PhoneNumberFormat], - metadata: Map[String, String]) - +case class MeetingDescriptorFormat(name: String, external_id: String, + record: Boolean, welcome_message: String, logout_url: String, + avatar_url: String, max_users: Int, duration: DurationFormat, + voice_conference: VoiceConferenceFormat, + phone_numbers: Seq[PhoneNumberFormat], + metadata: Map[String, String]) + case class CreateMeetingRequestPayloadFormat(meeting_descriptor: MeetingDescriptorFormat) case class CreateMeetingResponsePayloadFormat(meeting: MeetingIdAndName, - session: Option[String], result: ResultFormat, - meeting_descriptor: MeetingDescriptorFormat) + session: Option[String], result: ResultFormat, + meeting_descriptor: MeetingDescriptorFormat) case class MeetingCreatedEventPayloadFormat(meeting: MeetingIdAndName, - session: String, meeting_descriptor: MeetingDescriptorFormat) + session: String, meeting_descriptor: MeetingDescriptorFormat) -case class UserDescriptorFormat(external_id: String, name: String, - role: Role.RoleType, pin: Int, - welcome_message: String, - logout_url: String, avatar_url: String, - metadata: Map[String, String]) +case class UserDescriptorFormat(external_id: String, name: String, + role: Role.RoleType, pin: Int, + welcome_message: String, + logout_url: String, avatar_url: String, + metadata: Map[String, String]) case class RegisterUserRequestPayloadFormat(meeting: MeetingIdAndName, - session: String, user_descriptor: UserDescriptorFormat) + session: String, user_descriptor: UserDescriptorFormat) case class RegisterUserResponsePayloadFormat(meeting: MeetingIdAndName, - session: String, user_token: Option[String], - result: ResultFormat, user_descriptor: UserDescriptorFormat) + session: String, user_token: Option[String], + result: ResultFormat, user_descriptor: UserDescriptorFormat) case class UserRegisteredEventPayloadFormat(meeting: MeetingIdAndName, - session: String, user_descriptor: UserDescriptorFormat) + session: String, user_descriptor: UserDescriptorFormat) case class StatusFormat(hand_raised: Boolean, muted: Boolean, - locked: Boolean, talking: Boolean) - + locked: Boolean, talking: Boolean) + case class CallerIdFormat(name: String, number: String) -case class MediaStreamFormat(media_type: String, uri: String, - metadata: Map[String, String]) +case class MediaStreamFormat(media_type: String, uri: String, + metadata: Map[String, String]) case class JoinedUserFormat(id: String, external_id: String, name: String, - role: Role.RoleType, pin: Int, welcome_message: String, - logout_url: String, avatar_url: String, is_presenter: Boolean, - status: StatusFormat, caller_id: CallerIdFormat, - media_streams: Seq[MediaStreamFormat]) - -case class UserJoinedEventPayloadFormat(meeting: MeetingIdAndName, - session: String, user: JoinedUserFormat) + role: Role.RoleType, pin: Int, welcome_message: String, + logout_url: String, avatar_url: String, is_presenter: Boolean, + status: StatusFormat, caller_id: CallerIdFormat, + media_streams: Seq[MediaStreamFormat]) + +case class UserJoinedEventPayloadFormat(meeting: MeetingIdAndName, + session: String, user: JoinedUserFormat) case class UserJoinResponseMessage(header: Header, response: UserJoinResponse) case class JoinUserResponse(response: Response, token: String, joinedUser: Option[JoinedUser]) -case class JoinUserReply(header: Header, payload: JoinUserResponse) - -case class UserJoinRequestPayloadFormat(meeting: MeetingIdAndName, - session: String, token: String) - -case class UserLeavePayload(meeting: MeetingIdAndName, - session: String, user: UserIdAndName) - -case class GetUsersRequestPayload(meeting: MeetingIdAndName, - session: String, requester: UserIdAndName) - -case class AssignPresenterPayload(meeting: MeetingIdAndName, - session: String, presenter: UserIdAndName, - assigned_by: UserIdAndName) \ No newline at end of file +case class JoinUserReply(header: Header, payload: JoinUserResponse) + +case class UserJoinRequestPayloadFormat(meeting: MeetingIdAndName, + session: String, token: String) + +case class UserLeavePayload(meeting: MeetingIdAndName, + session: String, user: UserIdAndName) + +case class GetUsersRequestPayload(meeting: MeetingIdAndName, + session: String, requester: UserIdAndName) + +case class AssignPresenterPayload(meeting: MeetingIdAndName, + session: String, presenter: UserIdAndName, + assigned_by: UserIdAndName) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala old mode 100644 new mode 100755 index 6108d416b4..d94d5c8e4c --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala @@ -1,23 +1,23 @@ package org.bigbluebutton.endpoint -import akka.actor.{Actor, ActorRef, ActorLogging, Props} +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } import org.bigbluebutton.apps.users.protocol.UsersMessageMarshalling /** * This Actor is responsible for converting messages into JSON string - * to be published into the pubsub. + * to be published into the pubsub. */ object MessageMarshallingActor { - def props(pubsubActor: ActorRef): Props = - Props(classOf[MessageMarshallingActor], pubsubActor) + def props(pubsubActor: ActorRef): Props = + Props(classOf[MessageMarshallingActor], pubsubActor) } -class MessageMarshallingActor private (val pubsubActor: ActorRef) extends Actor - with ActorLogging with UsersMessageMarshalling { +class MessageMarshallingActor private (val pubsubActor: ActorRef) extends Actor + with ActorLogging { def receive = { - case msg: UserJoinResponseMessage => marshallUserJoinResponseMessage(msg) - + case msg: UserJoinResponseMessage => //marshallUserJoinResponseMessage(msg) + case unknownMsg => log.error("Cannot marshall unknown message: [{}]", unknownMsg) } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala index 1a3b5be145..c3a29bb97b 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala @@ -1,48 +1,47 @@ package org.bigbluebutton.endpoint object InMsgNameConst { - val CreateMeetingRequest = "create_meeting_request" - val CreateMeetingResponse = "create_meeting_response" - val MeetingCreatedEvent = "meeting_created_event" - val EndMeetingRequest = "end_meeting_request" - val EndMeetingResponse = "end_meeting_response" - val EndMeetingWarningEvent = "end_meeting_warning_event" - val MeetingEndEvent = "meeting_end_event" - val MeetingEndedEvent = "meeting_ended_event" - val ExtendMeetingRequest = "extend_meeting_request" - val ExtendMeetingResponse = "extend_meeting_response" - val MeetingExtendedEvent = "meeting_extended_event" - - - val RegisterUserRequest = "register_user_request" - val RegisterUserResponse = "register_user_response" - val UserRegisteredEvent = "user_registered_event" - val UserJoinRequest = "user_join_request" - val UserJoinResponse = "user_join_response" - val UserJoinedEvent = "user_joined_event" - val UserLeaveEvent = "user_leave_event" - val UserLeftEvent = "user_left_event" - val GetUsersRequest = "get_users_request" - val GetUsersResponse = "get_users_response" - val RaiseUserHandRequest = "raise_user_hand_request" - val UserRaisedHandEvent = "user_raised_hand_event" - val AssignPresenterRequest = "assign_presenter_request" - val PresenterAssignedEvent = "presenter_assigned_event" - val MuteUserRequest = "mute_user_request" - val MuteUserRequestEvent = "mute_user_request_event" - val MuteVoiceUserRequest = "mute_voice_user_request" - val VoiceUserMutedEvent = "voice_user_muted_event" - val UserMutedEvent = "user_muted_event" - val EjectUserRequest = "eject_user_request" - val UserEjectedEvent = "user_ejected_event" + val CreateMeetingRequest = "create_meeting_request" + val CreateMeetingResponse = "create_meeting_response" + val MeetingCreatedEvent = "meeting_created_event" + val EndMeetingRequest = "end_meeting_request" + val EndMeetingResponse = "end_meeting_response" + val EndMeetingWarningEvent = "end_meeting_warning_event" + val MeetingEndEvent = "meeting_end_event" + val MeetingEndedEvent = "meeting_ended_event" + val ExtendMeetingRequest = "extend_meeting_request" + val ExtendMeetingResponse = "extend_meeting_response" + val MeetingExtendedEvent = "meeting_extended_event" + + val RegisterUserRequest = "register_user_request" + val RegisterUserResponse = "register_user_response" + val UserRegisteredEvent = "user_registered_event" + val UserJoinRequest = "user_join_request" + val UserJoinResponse = "user_join_response" + val UserJoinedEvent = "user_joined_event" + val UserLeaveEvent = "user_leave_event" + val UserLeftEvent = "user_left_event" + val GetUsersRequest = "get_users_request" + val GetUsersResponse = "get_users_response" + val RaiseUserHandRequest = "raise_user_hand_request" + val UserRaisedHandEvent = "user_raised_hand_event" + val AssignPresenterRequest = "assign_presenter_request" + val PresenterAssignedEvent = "presenter_assigned_event" + val MuteUserRequest = "mute_user_request" + val MuteUserRequestEvent = "mute_user_request_event" + val MuteVoiceUserRequest = "mute_voice_user_request" + val VoiceUserMutedEvent = "voice_user_muted_event" + val UserMutedEvent = "user_muted_event" + val EjectUserRequest = "eject_user_request" + val UserEjectedEvent = "user_ejected_event" val EjectUserFromVoiceRequest = "eject_user_from_voice_request" - val EjectVoiceUserRequest = "eject_voice_user_request" - val VoiceUserEjectedEvent = "voice_user_ejected_event" - val LockUserRequest = "lock_user_request" - val LockVoiceUserRequest = "lock_voice_user_request" - val VoiceUserLockedEvent = "voice_user_locked_event" - val UserLockedEvent = "user_locked_event" - val LockAllUsersRequest = "lock_all_users_request" - val AllUsersLockedEvent = "all_users_locked_event" + val EjectVoiceUserRequest = "eject_voice_user_request" + val VoiceUserEjectedEvent = "voice_user_ejected_event" + val LockUserRequest = "lock_user_request" + val LockVoiceUserRequest = "lock_voice_user_request" + val VoiceUserLockedEvent = "voice_user_locked_event" + val UserLockedEvent = "user_locked_event" + val LockAllUsersRequest = "lock_all_users_request" + val AllUsersLockedEvent = "all_users_locked_event" } diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala old mode 100644 new mode 100755 index d4df36fcbe..0e24e14a5a --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala @@ -1,26 +1,26 @@ package org.bigbluebutton.endpoint -import akka.actor.{Actor, ActorRef, ActorLogging, Props} -import spray.json.{JsObject, JsonParser, DeserializationException} +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } +import spray.json.{ JsObject, JsonParser, DeserializationException } import org.parboiled.errors.ParsingException import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport._ import org.bigbluebutton.apps.protocol._ -import scala.util.{Try, Success, Failure} +import scala.util.{ Try, Success, Failure } import org.bigbluebutton.apps.users.protocol.UsersMessageUnmarshalling object MessageUnmarshallingActor { - def props(messageHandlerActor: ActorRef): Props = - Props(classOf[MessageUnmarshallingActor], messageHandlerActor) + def props(messageHandlerActor: ActorRef): Props = + Props(classOf[MessageUnmarshallingActor], messageHandlerActor) } -class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) extends Actor - with ActorLogging with UsersMessageUnmarshalling { +class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) extends Actor + with ActorLogging { def receive = { case msg: String => handleMessage(msg) case badMsg => log.error("Unhandled message: [{}", badMsg) } - + def handleMessage(msg: String) = { unmarshall(msg) match { case Success(validMsg) => forwardMessage(validMsg) @@ -30,44 +30,44 @@ class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) exte def forwardMessage(msg: HeaderAndJsonMessage) = { msg.header.name match { - case InMsgNameConst.UserJoinRequest => - handleUserJoin(msg) - case InMsgNameConst.UserLeaveEvent => - handleUserLeave(msg) - case InMsgNameConst.GetUsersRequest => - handleGetUsers(msg) - case InMsgNameConst.AssignPresenterRequest => - handleAssignPresenter(msg) - - case _ => - log.error("Unknown message name: [{}]", msg.header.name) - } - } - - def header(msg: JsObject):Header = { - try { - msg.fields.get("header") match { - case Some(header) => - header.convertTo[Header] - case None => - throw MessageProcessException("Cannot get header: [" + msg + "]") - } - } catch { - case e: DeserializationException => - throw MessageProcessException("Failed to deserialize header: [" + msg + "]") + case InMsgNameConst.UserJoinRequest => + //handleUserJoin(msg) + case InMsgNameConst.UserLeaveEvent => + //handleUserLeave(msg) + case InMsgNameConst.GetUsersRequest => + //handleGetUsers(msg) + case InMsgNameConst.AssignPresenterRequest => + //handleAssignPresenter(msg) + + case _ => + log.error("Unknown message name: [{}]", msg.header.name) } } - - def payload(msg: JsObject):JsObject = { - msg.fields.get("payload") match { - case Some(payload) => - payload.asJsObject - case None => - throw MessageProcessException("Cannot get payload information: [" + msg + "]") - } + + def header(msg: JsObject): Header = { + try { + msg.fields.get("header") match { + case Some(header) => + header.convertTo[Header] + case None => + throw MessageProcessException("Cannot get header: [" + msg + "]") + } + } catch { + case e: DeserializationException => + throw MessageProcessException("Failed to deserialize header: [" + msg + "]") + } } - - def toJsObject(msg: String):JsObject = { + + def payload(msg: JsObject): JsObject = { + msg.fields.get("payload") match { + case Some(payload) => + payload.asJsObject + case None => + throw MessageProcessException("Cannot get payload information: [" + msg + "]") + } + } + + def toJsObject(msg: String): JsObject = { try { JsonParser(msg).asJsObject } catch { @@ -78,16 +78,16 @@ class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) exte } } - def toHeaderAndJsonMessage(header: Header, message:String):HeaderAndJsonMessage = { + def toHeaderAndJsonMessage(header: Header, message: String): HeaderAndJsonMessage = { HeaderAndJsonMessage(header, message) } - - def unmarshall(jsonMsg: String):Try[HeaderAndJsonMessage] = { + + def unmarshall(jsonMsg: String): Try[HeaderAndJsonMessage] = { for { jsonObj <- Try(toJsObject(jsonMsg)) header <- Try(header(jsonObj)) message = toHeaderAndJsonMessage(header, jsonMsg) } yield message } - + } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala index 4cddc330da..6a992824ab 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala @@ -6,9 +6,9 @@ import org.bigbluebutton.apps.MeetingIdAndName sealed abstract class OutMsgFormatter case class MeetingCreatedEventFormat(header: Header, - payload: MeetingCreatedEventPayloadFormat) -case class UserJoinResponseFormat(header: Header, - payload: UserJoinResponseFormatPayload) extends OutMsgFormatter -case class UserJoinResponseFormatPayload(meeting: MeetingIdAndName, - session: String, result: ResultFormat, - user: Option[UserFormat]) \ No newline at end of file + payload: MeetingCreatedEventPayloadFormat) +case class UserJoinResponseFormat(header: Header, + payload: UserJoinResponseFormatPayload) extends OutMsgFormatter +case class UserJoinResponseFormatPayload(meeting: MeetingIdAndName, + session: String, result: ResultFormat, + user: Option[UserFormat]) \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala index cba7fa76eb..f3ef70ec93 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala @@ -1,22 +1,21 @@ package org.bigbluebutton.endpoint -import akka.actor.{Actor, ActorRef, ActorLogging, Props} +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } /** * This Actor is responsible for building formatted messages that - * will be sent to the pubsub. + * will be sent to the pubsub. */ object OutMsgBuilderActor { - def props(pubsubActor: ActorRef): Props = - Props(classOf[OutMsgBuilderActor], pubsubActor) + def props(pubsubActor: ActorRef): Props = + Props(classOf[OutMsgBuilderActor], pubsubActor) } -class OutMsgBuilderActor private (val bbbAppsActor: ActorRef, - val messageMarshallingActor: ActorRef) extends Actor - with ActorLogging { +class OutMsgBuilderActor private (val bbbAppsActor: ActorRef, + val messageMarshallingActor: ActorRef) extends Actor + with ActorLogging { - - def receive = { - case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) + def receive = { + case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) } } \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala index 95b02500fd..29e5fa498f 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala @@ -1,6 +1,6 @@ package org.bigbluebutton.endpoint -import spray.json.{DefaultJsonProtocol, JsValue, JsString, DeserializationException, JsonFormat} +import spray.json.{ DefaultJsonProtocol, JsValue, JsString, DeserializationException, JsonFormat } import spray.json.DefaultJsonProtocol._ import org.bigbluebutton.apps.users.data._ import org.bigbluebutton.apps.protocol._ @@ -8,100 +8,99 @@ import org.bigbluebutton.apps.Role import org.bigbluebutton.apps.MeetingIdAndName import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport.headerFormat - -/** JSON Conversion Protocol **/ +/** JSON Conversion Protocol **/ object UserMessagesProtocol extends DefaultJsonProtocol { import HeaderAndPayloadJsonSupport._ implicit object RoleJsonFormat extends JsonFormat[Role.RoleType] { - def write(obj: Role.RoleType): JsValue = JsString(obj.toString) - - def read(json: JsValue): Role.RoleType = json match { - case JsString(str) => Role.withName(str) - case _ => throw new DeserializationException("Enum string expected") - } + def write(obj: Role.RoleType): JsValue = JsString(obj.toString) + + def read(json: JsValue): Role.RoleType = json match { + case JsString(str) => Role.withName(str) + case _ => throw new DeserializationException("Enum string expected") + } } -/* + /* implicit val webIdentityFormat = jsonFormat1(WebIdentity) implicit val callerIdFormat = jsonFormat2(CallerId) implicit val voiceIdentityFormat = jsonFormat5(VoiceIdentity) -*/ - implicit val userFormat = - jsonFormat8(UserFormat) - implicit val userIdAndNameFormat = - jsonFormat2(UserIdAndName) - implicit val meetingIdAndNameFormat = - jsonFormat2(MeetingIdAndName) - implicit val userJoinRequestPayloadFormat = - jsonFormat3(UserJoinRequestPayloadFormat) - implicit val userJoinRequestMessageFormat = - jsonFormat2(UserJoinRequestFormat) - implicit val resultFormat = - jsonFormat2(ResultFormat) - implicit val userJoinResponsePayloadFormat = - jsonFormat4(UserJoinResponseFormatPayload) - implicit val userJoinResponseJsonMessageFormat = - jsonFormat2(UserJoinResponseFormat) - implicit val userLeavePayloadFormat = - jsonFormat3(UserLeavePayload) - implicit val userLeaveMessageFormat = - jsonFormat2(UserLeaveMessage) - implicit val getUsersRequestPayloadFormat = - jsonFormat3(GetUsersRequestPayload) - implicit val getUsersRequestMessageFormat = - jsonFormat2(GetUsersRequestMessage) - implicit val assignPresenterPayloadFormat = - jsonFormat4(AssignPresenterPayload) - implicit val assignPresenterMessageFormat = - jsonFormat2(AssignPresenterMessage) - implicit val durationFormat = - jsonFormat3(DurationFormat) - implicit val voiceConferenceFormat = - jsonFormat2(VoiceConferenceFormat) - implicit val phoneNumberFormat = - jsonFormat2(PhoneNumberFormat) - implicit val meetingDescriptorFormat = - jsonFormat11(MeetingDescriptorFormat) - implicit val createMeetingRequestPayloadFormat = - jsonFormat1(CreateMeetingRequestPayloadFormat) - implicit val createMeetingRequestMessageFormat = - jsonFormat2(CreateMeetingRequestFormat) - implicit val createMeetingResponsePayloadFormat = - jsonFormat4(CreateMeetingResponsePayloadFormat) - implicit val createMeetingResponseFormat = - jsonFormat2(CreateMeetingResponseFormat) - implicit val meetingCreatedEventPayloadFormat = - jsonFormat3(MeetingCreatedEventPayloadFormat) - implicit val meetingCreatedEventFormat = - jsonFormat2(MeetingCreatedEventFormat) - implicit val userDescriptorFormat = - jsonFormat8(UserDescriptorFormat) +*/ + implicit val userFormat = + jsonFormat8(UserFormat) + implicit val userIdAndNameFormat = + jsonFormat2(UserIdAndName) + implicit val meetingIdAndNameFormat = + jsonFormat2(MeetingIdAndName) + implicit val userJoinRequestPayloadFormat = + jsonFormat3(UserJoinRequestPayloadFormat) + implicit val userJoinRequestMessageFormat = + jsonFormat2(UserJoinRequestFormat) + implicit val resultFormat = + jsonFormat2(ResultFormat) + implicit val userJoinResponsePayloadFormat = + jsonFormat4(UserJoinResponseFormatPayload) + implicit val userJoinResponseJsonMessageFormat = + jsonFormat2(UserJoinResponseFormat) + implicit val userLeavePayloadFormat = + jsonFormat3(UserLeavePayload) + implicit val userLeaveMessageFormat = + jsonFormat2(UserLeaveMessage) + implicit val getUsersRequestPayloadFormat = + jsonFormat3(GetUsersRequestPayload) + implicit val getUsersRequestMessageFormat = + jsonFormat2(GetUsersRequestMessage) + implicit val assignPresenterPayloadFormat = + jsonFormat4(AssignPresenterPayload) + implicit val assignPresenterMessageFormat = + jsonFormat2(AssignPresenterMessage) + implicit val durationFormat = + jsonFormat3(DurationFormat) + implicit val voiceConferenceFormat = + jsonFormat2(VoiceConferenceFormat) + implicit val phoneNumberFormat = + jsonFormat2(PhoneNumberFormat) + implicit val meetingDescriptorFormat = + jsonFormat11(MeetingDescriptorFormat) + implicit val createMeetingRequestPayloadFormat = + jsonFormat1(CreateMeetingRequestPayloadFormat) + implicit val createMeetingRequestMessageFormat = + jsonFormat2(CreateMeetingRequestFormat) + implicit val createMeetingResponsePayloadFormat = + jsonFormat4(CreateMeetingResponsePayloadFormat) + implicit val createMeetingResponseFormat = + jsonFormat2(CreateMeetingResponseFormat) + implicit val meetingCreatedEventPayloadFormat = + jsonFormat3(MeetingCreatedEventPayloadFormat) + implicit val meetingCreatedEventFormat = + jsonFormat2(MeetingCreatedEventFormat) + implicit val userDescriptorFormat = + jsonFormat8(UserDescriptorFormat) implicit val registerUserRequestPayloadFormat = - jsonFormat3(RegisterUserRequestPayloadFormat) + jsonFormat3(RegisterUserRequestPayloadFormat) implicit val registerUserRequestFormat = - jsonFormat2(RegisterUserRequestFormat) - implicit val registerUserResponsePayloadFormat = - jsonFormat5(RegisterUserResponsePayloadFormat) - implicit val registerUserResponseFormat = - jsonFormat2(RegisterUserResponseFormat) + jsonFormat2(RegisterUserRequestFormat) + implicit val registerUserResponsePayloadFormat = + jsonFormat5(RegisterUserResponsePayloadFormat) + implicit val registerUserResponseFormat = + jsonFormat2(RegisterUserResponseFormat) implicit val userRegisteredEventPayloadFormat = - jsonFormat3(UserRegisteredEventPayloadFormat) + jsonFormat3(UserRegisteredEventPayloadFormat) implicit val userRegisteredEventFormat = - jsonFormat2(UserRegisteredEventFormat) - implicit val statusFormat = - jsonFormat4(StatusFormat) - implicit val callerIdFormat = - jsonFormat2(CallerIdFormat) - implicit val mediaStreamFormat = - jsonFormat3(MediaStreamFormat) - implicit val joinedUserFormat = - jsonFormat12(JoinedUserFormat) - implicit val userJoinedEventPayloadFormat = - jsonFormat3(UserJoinedEventPayloadFormat) + jsonFormat2(UserRegisteredEventFormat) + implicit val statusFormat = + jsonFormat4(StatusFormat) + implicit val callerIdFormat = + jsonFormat2(CallerIdFormat) + implicit val mediaStreamFormat = + jsonFormat3(MediaStreamFormat) + implicit val joinedUserFormat = + jsonFormat12(JoinedUserFormat) + implicit val userJoinedEventPayloadFormat = + jsonFormat3(UserJoinedEventPayloadFormat) implicit val userJoinedEventFormat = jsonFormat2(UserJoinedEventFormat) } diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala index c34dcb40d8..17d146942a 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala @@ -10,18 +10,18 @@ import akka.actor.Actor import org.bigbluebutton.SystemConfiguration object AppsRedisPublisherActor extends SystemConfiguration { - + val channels = Seq("time") val patterns = Seq("pattern.*") - - def props(system: ActorSystem): Props = - Props(classOf[AppsRedisPublisherActor], - system, redisHost, redisPort) + + def props(system: ActorSystem): Props = + Props(classOf[AppsRedisPublisherActor], + system, redisHost, redisPort) } -class AppsRedisPublisherActor(val system: ActorSystem, +class AppsRedisPublisherActor(val system: ActorSystem, val host: String, val port: Int) extends Actor { - + val redis = RedisClient(host, port)(system) val futurePong = redis.ping() @@ -29,17 +29,17 @@ class AppsRedisPublisherActor(val system: ActorSystem, futurePong.map(pong => { println(s"Redis replied with a $pong") }) - + Await.result(futurePong, 5 seconds) - + def publish(channel: String, msg: String) { println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") - // redis.publish("time", System.currentTimeMillis()) + // redis.publish("time", System.currentTimeMillis()) } - + def receive = { //case msg: JsonMessage => publish(msg.channel, msg.message) - case msg:String => println("PUBLISH TO [channel]: \n [" + msg + "]") + case msg: String => println("PUBLISH TO [channel]: \n [" + msg + "]") } } diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala index 37ade8d5e9..24424bc00e 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -3,7 +3,7 @@ package org.bigbluebutton.endpoint.redis import akka.actor.Props import java.net.InetSocketAddress import redis.actors.RedisSubscriberActor -import redis.api.pubsub.{PMessage, Message} +import redis.api.pubsub.{ PMessage, Message } import scala.concurrent.duration._ import akka.actor.ActorRef import akka.actor.actorRef2Scala @@ -13,19 +13,19 @@ object AppsRedisSubscriberActor extends SystemConfiguration { val channels = Seq("time") val patterns = Seq("pattern.*") - - def props(bbbAppsActor: ActorRef): Props = - Props(classOf[AppsRedisSubscriberActor], - bbbAppsActor, redisHost, redisPort, channels, patterns). - withDispatcher("rediscala.rediscala-client-worker-dispatcher") + + def props(bbbAppsActor: ActorRef): Props = + Props(classOf[AppsRedisSubscriberActor], + bbbAppsActor, redisHost, redisPort, channels, patterns). + withDispatcher("rediscala.rediscala-client-worker-dispatcher") } -class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, - redisPort: Int, - channels: Seq[String] = Nil, patterns: Seq[String] = Nil) - extends RedisSubscriberActor( - new InetSocketAddress(redisHost, redisPort), - channels, patterns) { +class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, + redisPort: Int, + channels: Seq[String] = Nil, patterns: Seq[String] = Nil) + extends RedisSubscriberActor( + new InetSocketAddress(redisHost, redisPort), + channels, patterns) { def onMessage(message: Message) { log.debug(s"message received: $message") @@ -34,7 +34,7 @@ class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, def onPMessage(pmessage: PMessage) { log.debug(s"pattern message received: $pmessage") } - + def handleMessage(msg: String) { log.warning("**** TODO: Handle pubsub messages. ****") } diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala index ebd801a83b..22bea5fde4 100644 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala +++ b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala @@ -3,7 +3,7 @@ package org.bigbluebutton.endpoint.redis import akka.actor.Props import java.net.InetSocketAddress import redis.actors.RedisSubscriberActor -import redis.api.pubsub.{PMessage, Message} +import redis.api.pubsub.{ PMessage, Message } import redis.RedisClient import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits.global @@ -27,7 +27,7 @@ class RedisPubSubActor { } class SubscribeActor(channels: Seq[String] = Nil, patterns: Seq[String] = Nil) - extends RedisSubscriberActor(new InetSocketAddress("localhost", 6379), channels, patterns) { + extends RedisSubscriberActor(new InetSocketAddress("localhost", 6379), channels, patterns) { def onMessage(message: Message) { println(s"message received: $message") diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/MeetingMessageHandler.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/MeetingMessageHandler.scala deleted file mode 100755 index e9edd37f1d..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/MeetingMessageHandler.scala +++ /dev/null @@ -1,109 +0,0 @@ -package org.bigbluebutton.endpoint.rest - -import akka.actor.{Actor, Props, ActorRef, ActorLogging} -import akka.event.LoggingAdapter -import akka.pattern.{ask, pipe} -import akka.util.Timeout -import org.bigbluebutton.apps.CreateMeetingResponse -import org.bigbluebutton.apps.protocol.CreateMeetingRequestReply -import org.bigbluebutton.apps.protocol._ -import org.bigbluebutton.apps._ -import scala.concurrent.Future -import org.bigbluebutton.endpoint._ -import org.bigbluebutton.SystemConfiguration -import org.bigbluebutton.apps.users.data.RegisterUser -import org.bigbluebutton.apps.users.messages.RegisterUserRequest -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.messages.RegisterUserResponse - - -trait MeetingMessageHandler extends SystemConfiguration { - this : RestEndpointServiceActor => - - val msgReceiver: ActorRef - - def sendCreateMeetingMessage(message: CreateMeetingRequestFormat): - Future[CreateMeetingResponseFormat] = { - - val meeting = MeetingIdAndName(message.payload.meeting_descriptor.external_id, - message.payload.meeting_descriptor.name) - val descriptor = message.payload.meeting_descriptor - val header = Header(Destination(apiChannel, None), - InMsgNameConst.CreateMeetingResponse, - Util.generateTimestamp, apiSourceName, None) - - def buildJsonFailedResponse():CreateMeetingResponseFormat = { - val result = ResultFormat(false, "Failed to get a response.") - val payload = CreateMeetingResponsePayloadFormat(meeting, None, - result, descriptor) - CreateMeetingResponseFormat(header, payload) - } - - def buildJsonResponse(response: CreateMeetingResponse): - CreateMeetingResponseFormat = { - val result = ResultFormat(response.success, response.message) - val payload = CreateMeetingResponsePayloadFormat(meeting, - Some(response.session.id), result, descriptor) - CreateMeetingResponseFormat(header, payload) - } - - val duration = Duration(descriptor.duration.length_in_minutes, - descriptor.duration.allow_extend, - descriptor.duration.max_minutes) - - val voiceConf = VoiceConference(descriptor.voice_conference.pin, - descriptor.voice_conference.number) - - val phoneNumbers = descriptor.phone_numbers map { pn => - PhoneNumber(pn.number, pn.description) - } - - val mdesc = MeetingDescriptor(meeting.id, meeting.name, descriptor.record, - descriptor.welcome_message, descriptor.logout_url, - descriptor.avatar_url, descriptor.max_users, - duration, voiceConf, phoneNumbers, descriptor.metadata) - - val createMeetingMessage = CreateMeeting(mdesc) - - (msgReceiver ? createMeetingMessage).mapTo[CreateMeetingResponse] - .map(result => { buildJsonResponse(result) }) - .recover { case _ => buildJsonFailedResponse() } - } - - def sendRegisterUserRequestMessage(message: RegisterUserRequestFormat): - Future[RegisterUserResponseFormat] = { - val meeting = message.payload.meeting - val userDesc = message.payload.user_descriptor - val header = Header(Destination(apiChannel, None), - InMsgNameConst.RegisterUserResponse, - Util.generateTimestamp, apiSourceName, None) - - val regUser = RegisterUser(userDesc.external_id, userDesc.name, - userDesc.role, userDesc.pin, userDesc.welcome_message, - userDesc.logout_url, userDesc.avatar_url) - val session = Session(message.payload.session, meeting) - - - def buildJsonFailedResponse():RegisterUserResponseFormat = { - val result = ResultFormat(false, "Failed to get a response.") - val payload = RegisterUserResponsePayloadFormat(meeting, - message.payload.session, None, result, - userDesc) - RegisterUserResponseFormat(header, payload) - } - - def buildJsonResponse(response: RegisterUserResponse): - RegisterUserResponseFormat = { - val result = ResultFormat(response.result.success, response.result.message) - val payload = RegisterUserResponsePayloadFormat(meeting, - response.session.id, Some(response.token), result, - userDesc) - RegisterUserResponseFormat(header, payload) - } - - val registerUserMessage = RegisterUserRequest(session, regUser) - (msgReceiver ? registerUserMessage).mapTo[RegisterUserResponse] - .map(result => { buildJsonResponse(result) }) - .recover { case _ => buildJsonFailedResponse() } - } -} \ No newline at end of file diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/RestEndpointService.scala b/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/RestEndpointService.scala deleted file mode 100644 index d8dec57214..0000000000 --- a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/rest/RestEndpointService.scala +++ /dev/null @@ -1,80 +0,0 @@ -package org.bigbluebutton.endpoint.rest - -import akka.actor.{Actor, Props, ActorRef, ActorLogging} -import akka.event.LoggingAdapter -import akka.pattern.{ask, pipe} -import akka.util.Timeout -import scala.concurrent.duration._ -import scala.util.{Success, Failure} -import spray.json.{JsObject, JsValue, JsString, DefaultJsonProtocol} -import spray.httpx.SprayJsonSupport -import spray.routing._ -import spray.http._ -import MediaTypes._ -import spray.routing.directives.BasicDirectives._ -import spray.routing.Directive.pimpApply -import shapeless._ -import org.bigbluebutton.endpoint.CreateMeetingRequestFormat -import scala.util.Success -import org.bigbluebutton.endpoint.RegisterUserRequestFormat - -class RestEndpointServiceActor(val msgReceiver: ActorRef) extends Actor - with RestEndpointService with ActorLogging { - - def actorRefFactory = context - - def receive = runRoute(restApiRoute) -} - - -trait RestEndpointService extends HttpService with MeetingMessageHandler { - this: RestEndpointServiceActor => - - import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport._ - import org.bigbluebutton.endpoint.UserMessagesProtocol._ - - val msgReceiver: ActorRef - implicit def executionContext = actorRefFactory.dispatcher - implicit val timeout = Timeout(5 seconds) - - val supportedContentTypes = List[ContentType](`application/json`, `text/plain`) - - val restApiRoute = - path("") { - get { - respondWithMediaType(`text/html`) { - complete { - - -

Welcome to BigBlueButton!

- - - } - } - } - } ~ - path("meeting") { - post { - respondWithMediaType(`application/json`) { - entity(as[CreateMeetingRequestFormat]) { message => - val response = sendCreateMeetingMessage(message) - complete(response) - } - } - } - } ~ - path("user") { - post { - respondWithMediaType(`application/json`) { - entity(as[RegisterUserRequestFormat]) { message => - val response = sendRegisterUserRequestMessage(message) - complete(response) - } - } - } - } - - -} - - From 2999459efc487e7084a9def8a2983d657246bb90 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Wed, 13 May 2015 20:24:29 +0000 Subject: [PATCH 02/30] - try adding scheduler but it's not working --- .../main/scala/org/bigbluebutton/core/MeetingActor.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala index 76ce57ef8e..7a43464bcf 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -4,6 +4,8 @@ import akka.actor.Actor import akka.actor.ActorRef import akka.actor.ActorLogging import akka.actor.Props +import akka.util.Timeout +import scala.concurrent.duration._ import org.bigbluebutton.core.apps.poll.Poll import org.bigbluebutton.core.apps.poll.PollApp import org.bigbluebutton.core.apps.users.UsersApp @@ -14,6 +16,8 @@ import org.bigbluebutton.core.apps.chat.ChatApp import org.bigbluebutton.core.apps.whiteboard.WhiteboardApp import java.util.concurrent.TimeUnit import org.bigbluebutton.core.util._ +import akka.actor.ActorContext +import scala.concurrent.ExecutionContext.Implicits.global case object StopMeetingActor @@ -23,7 +27,7 @@ object MeetingActor { autoStartRecording: Boolean, allowStartStopRecording: Boolean, moderatorPass: String, viewerPass: String, createTime: Long, createDate: String, - outGW: MessageOutGateway): Props = + outGW: MessageOutGateway)(implicit context: ActorContext): Props = Props(classOf[MeetingActor], meetingID, externalMeetingID, meetingName, recorded, voiceBridge, duration, autoStartRecording, allowStartStopRecording, @@ -204,6 +208,7 @@ class MeetingActor(val meetingID: String, val externalMeetingID: String, val mee log.debug("MonitorNumberOfWebUsers continue for meeting [" + meetingID + "]") // val timerActor = new TimerActor(TIMER_INTERVAL, self, "MonitorNumberOfWebUsers") // timerActor.start +// context.system.scheduler.schedule(0 seconds, 2000 millis, self, "MonitorNumberOfWebUsers") } def timeNowInMinutes():Long = { From 8966138d1d35c09b8353e0b874f4b1342fcf1002 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Wed, 13 May 2015 20:24:57 +0000 Subject: [PATCH 03/30] - clean up --- .../scala/org/bigbluebutton/core/BigBlueButtonActor.scala | 1 - .../freeswitch/FreeswitchConferenceService.scala | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index 44ad0929fb..4089357ed1 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -22,7 +22,6 @@ class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) exte implicit def executionContext = actorRefFactory.dispatcher implicit val timeout = Timeout(5 seconds) - //private var meetings = new HashMap[String, MeetingActor] private var meetings = new collection.immutable.HashMap[String, RunningMeeting] def receive = { diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala index f320f3e272..c3df3a5d7d 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala @@ -14,9 +14,7 @@ class FreeswitchConferenceService(fsproxy: FreeswitchManagerProxy, fsListener.setVoiceConferenceService(this) implicit val system = ActorSystem("bigbluebutton-apps-fsesl") - - - + var bbbInGW: IBigBlueButtonInGW = _ var fsActor: ActorRef = _ From 362f3751803f13970aee4a1d9588e502767472bf Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 14 May 2015 20:23:16 +0000 Subject: [PATCH 04/30] - clean up --- .../conference/BigBlueButtonApplication.java | 9 +- .../conference/service/poll/PollService.java | 85 - .../redis/PollRedisMessageHandler.java | 43 - .../GenericObjectPoolConfigWrapper.java | 142 -- .../service/recorder/RecordEvent.java | 85 - .../conference/service/recorder/Recorder.java | 35 - .../service/recorder/RecorderApplication.java | 108 - .../service/recorder/RedisDispatcher.java | 57 - .../chat/AbstractChatRecordEvent.java | 28 - .../recorder/chat/PublicChatRecordEvent.java | 43 - .../AbstractParticipantRecordEvent.java | 28 - .../AssignPresenterRecordEvent.java | 39 - .../ParticipantEndAndKickAllRecordEvent.java | 27 - .../ParticipantJoinRecordEvent.java | 47 - .../ParticipantLeftRecordEvent.java | 32 - .../ParticipantStatusChangeRecordEvent.java | 39 - .../participants/RecordStatusRecordEvent.java | 35 - .../polling/AbstractPollRecordEvent.java | 29 - .../polling/PollClearedRecordEvent.java | 35 - .../polling/PollCreatedRecordEvent.java | 66 - .../polling/PollRemovedRecordEvent.java | 37 - .../polling/PollStartedRecordEvent.java | 35 - .../polling/PollStoppedRecordEvent.java | 35 - .../polling/PollUpdatedRecordEvent.java | 60 - .../AbstractPresentationRecordEvent.java | 28 - ...rsionCompletedPresentationRecordEvent.java | 40 - .../presentation/CursorUpdateRecordEvent.java | 36 - .../GenerateSlidePresentationRecordEvent.java | 40 - .../GotoSlidePresentationRecordEvent.java | 81 - ...vePresentationPresentationRecordEvent.java | 33 - ...zeAndMoveSlidePresentationRecordEvent.java | 72 - ...rePresentationPresentationRecordEvent.java | 40 - .../redis/AbstractWhiteboardRecordEvent.java | 46 - .../redis/AddShapeWhiteboardRecordEvent.java | 69 - .../redis/AddTextWhiteboardRecordEvent.java | 54 - .../redis/ClearPageWhiteboardRecordEvent.java | 28 - .../ModifyTextWhiteboardRecordEvent.java | 53 - .../ToggleGridWhiteboardRecordEvent.java | 33 - .../redis/UndoShapeWhiteboardRecordEvent.java | 32 - .../core/api/RedisLpushDispatcher.java | 66 - .../service/recording/RecordMessage.java | 5 - .../service/recording/RedisListRecorder.java | 78 - .../voice/AbstractVoiceRecordEvent.java | 32 - .../voice/ConferenceServerListener.java | 26 - .../voice/ConferenceServiceProvider.java | 28 - .../FreeswitchConferenceEventListener.java | 115 - .../voice/IVoiceConferenceService.java | 13 - .../ParticipantJoinedVoiceRecordEvent.java | 51 - .../ParticipantLeftVoiceRecordEvent.java | 31 - .../ParticipantLockedVoiceRecordEvent.java | 35 - .../ParticipantMutedVoiceRecordEvent.java | 35 - .../ParticipantTalkingVoiceRecordEvent.java | 36 - .../voice/StartRecordingVoiceRecordEvent.java | 38 - .../voice/VoiceEventRecorder.java | 144 -- .../voice/commands/ConferenceCommand.java | 40 - .../commands/ConferenceCommandResult.java | 56 - .../commands/EjectParticipantCommand.java | 34 - .../commands/GetParticipantsCommand.java | 27 - .../commands/MuteParticipantCommand.java | 40 - .../voice/events/ConferenceEventListener.java | 25 - .../voice/events/UnknownConferenceEvent.java | 27 - .../voice/events/VoiceConferenceEvent.java | 32 - .../events/VoiceStartRecordingEvent.java | 51 - .../voice/events/VoiceUserJoinedEvent.java | 70 - .../voice/events/VoiceUserLeftEvent.java | 33 - .../voice/events/VoiceUserLockedEvent.java | 40 - .../voice/events/VoiceUserMutedEvent.java | 40 - .../voice/events/VoiceUserTalkingEvent.java | 40 - .../voice/freeswitch/ConnectionManager.java | 157 -- .../voice/freeswitch/ESLEventListener.java | 208 -- .../freeswitch/FreeswitchApplication.java | 205 -- .../actions/BroadcastConferenceCommand.java | 54 - .../actions/EjectAllUsersCommand.java | 31 - .../actions/EjectParticipantCommand.java | 34 - .../freeswitch/actions/FreeswitchCommand.java | 45 - .../actions/MuteParticipantCommand.java | 40 - .../actions/PopulateRoomCommand.java | 119 - .../actions/RecordConferenceCommand.java | 53 - .../freeswitch/response/ConferenceMember.java | 88 - .../response/ConferenceMemberFlags.java | 54 - .../XMLResponseConferenceListParser.java | 164 -- .../voice/freeswitch/HeartbeatMonitor.scala | 5 - .../core/BigBlueButtonActor.scala | 181 -- .../core/BigBlueButtonGateway.scala | 23 - .../core/BigBlueButtonInGW.scala | 468 ---- .../bigbluebutton/core/CollectorActor.scala | 2163 ----------------- .../bigbluebutton/core/CollectorGateway.scala | 22 - .../org/bigbluebutton/core/MeetingActor.scala | 265 -- .../bigbluebutton/core/RunningMeeting.scala | 37 - .../core/SystemConfiguration.scala | 20 - .../scala/org/bigbluebutton/core/User.scala | 29 - .../core/api/ConsoleDispatcher.scala | 8 - .../bigbluebutton/core/api/Constants.scala | 96 - .../bigbluebutton/core/api/InMessages.scala | 514 ---- .../bigbluebutton/core/api/MessageNames.scala | 164 -- .../bigbluebutton/core/api/OutMessages.scala | 662 ----- .../core/api/TimestampGenerator.scala | 14 - .../bigbluebutton/core/api/ValueObjects.scala | 110 - .../org/bigbluebutton/core/api/Versions.scala | 5 - .../core/apps/chat/ChatApp.scala | 31 - .../core/apps/chat/ChatInGateway.scala | 19 - .../chat/red5/ChatClientMessageSender.scala | 66 - .../chat/redis/ChatEventRedisPublisher.scala | 38 - .../chat/redis/ChatEventRedisRecorder.scala | 29 - .../redis/ChatMessageToJsonConverter.scala | 67 - .../core/apps/layout/LayoutApp.scala | 66 - .../core/apps/layout/LayoutInGateway.scala | 21 - .../red5/LayoutClientMessageSender.scala | 52 - .../bigbluebutton/core/apps/poll/Poll.scala | 141 -- .../core/apps/poll/PollApp.scala | 123 - .../core/apps/poll/PollInGateway.scala | 56 - .../core/apps/poll/PollMessageConverter.scala | 190 -- .../core/apps/poll/PollModel.scala | 235 -- .../core/apps/poll/QuestionType.scala | 7 - .../poll/red5/PollClientMessageSender.scala | 125 - .../poll/redis/PollEventRedisPublisher.scala | 114 - .../poll/redis/PollEventRedisRecorder.scala | 115 - .../apps/presentation/PresentationApp.scala | 157 -- .../apps/presentation/PresentationModel.scala | 128 - .../PresentationClientMessageSender.scala | 295 --- .../PesentationMessageToJsonConverter.scala | 281 --- .../PresentationEventRedisPublisher.scala | 111 - .../PresentationEventRedisRecorder.scala | 128 - .../bigbluebutton/core/apps/users/Users.scala | 133 - .../core/apps/users/UsersApp.scala | 448 ---- .../core/apps/users/UsersModel.scala | 101 - .../users/red5/UsersClientMessageSender.scala | 494 ---- .../redis/UsersEventRedisPublisher.scala | 188 -- .../users/redis/UsersEventRedisRecorder.scala | 214 -- .../redis/UsersMessageToJsonConverter.scala | 361 --- .../core/apps/voice/VoiceApp.scala | 34 - .../core/apps/voice/VoiceInGateway.scala | 65 - .../core/apps/whiteboard/WhiteboardApp.scala | 100 - .../apps/whiteboard/WhiteboardInGateway.scala | 54 - .../apps/whiteboard/WhiteboardModel.scala | 87 - .../red5/WhiteboardClientMessageSender.scala | 130 - .../redis/WhiteboardEventRedisPublisher.scala | 56 - .../redis/WhiteboardEventRedisRecorder.scala | 93 - .../WhiteboardMessageToJsonConverter.scala | 94 - .../apps/whiteboard/vo/ValueObjects.scala | 3 - .../meeting/MeetingEventRedisPublisher.scala | 94 - .../MeetingMessageToJsonConverter.scala | 132 - .../bigbluebutton/core/messaging/Util.scala | 33 - .../bigbluebutton/core/models/Values.scala | 23 - .../bigbluebutton/core/util/LogHelper.scala | 13 - .../core/util/RandomStringGenerator.scala | 17 - .../core/voice/VoiceConferenceActor.scala | 16 - .../core/voice/VoiceConferenceService.scala | 19 - .../freeswitch/FreeswitchConference.scala | 54 - .../FreeswitchConferenceActor.scala | 250 -- .../FreeswitchConferenceService.scala | 124 - .../freeswitch/FreeswitchManagerProxy.scala | 32 - .../freeswitch/FsInGwWrapper.scala | 12 - 153 files changed, 1 insertion(+), 15258 deletions(-) delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/PollService.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/messaging/redis/PollRedisMessageHandler.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/User.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/red5/ChatClientMessageSender.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/red5/PollClientMessageSender.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/red5/PresentationClientMessageSender.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/red5/WhiteboardClientMessageSender.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/LogHelper.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala delete mode 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala delete mode 100755 bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java index 2c880d7e71..3d8e8d379e 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java @@ -22,9 +22,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; - import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService; -import org.bigbluebutton.conference.service.recorder.RecorderApplication; import org.bigbluebutton.core.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.IApplication; @@ -40,7 +38,6 @@ import com.google.gson.Gson; public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter { private static Logger log = Red5LoggerFactory.getLogger(BigBlueButtonApplication.class, "bigbluebutton"); - private RecorderApplication recorderApplication; private ConnectionInvokerService connInvokerService; private IBigBlueButtonInGW bbbGW; @@ -96,7 +93,6 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter { @Override public void roomStop(IScope room) { - recorderApplication.destroyRecordSession(room.getName()); super.roomStop(room); } @@ -128,7 +124,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter { } if (record == true) { - recorderApplication.createRecordSession(room); + } String userId = internalUserID; @@ -254,9 +250,6 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter { bbbGW.validateAuthToken(meetingId, userId, token, meetingId + "/" + userId, sessionId); } - public void setRecorderApplication(RecorderApplication a) { - recorderApplication = a; - } public void setApplicationListeners(Set listeners) { Iterator iter = listeners.iterator(); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/PollService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/PollService.java deleted file mode 100755 index 7e4004f625..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/PollService.java +++ /dev/null @@ -1,85 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 2.1 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.poll; - -import org.slf4j.Logger; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.red5.logging.Red5LoggerFactory; -import org.red5.server.api.Red5; -import org.red5.server.api.scope.IScope; - -public class PollService { - private static Logger log = Red5LoggerFactory.getLogger( PollService.class, "bigbluebutton" ); - - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - public void getPolls() { - bbbInGW.getPolls(getMeetingID(), getRequesterID()); - } - - public void createPoll(String msg){ - System.out.println("*** PollService:: create poll \n" + msg + "\n"); - - bbbInGW.createPoll(getMeetingID(), getRequesterID(), msg); - } - - public void updatePoll(String msg){ - System.out.println("*** PollService:: update poll \n" + msg + "\n"); - bbbInGW.updatePoll(getMeetingID(), getRequesterID(), msg); - } - - public void startPoll(String msg){ - System.out.println("*** PollService:: start poll \n" + msg + "\n"); - bbbInGW.startPoll(getMeetingID(), getRequesterID(), msg); - } - - public void stopPoll(String msg){ - System.out.println("*** PollService:: stop poll \n" + msg + "\n"); - bbbInGW.stopPoll(getMeetingID(), getRequesterID(), msg); - } - - public void removePoll(String msg){ - System.out.println("*** PollService:: remove poll \n" + msg + "\n"); - bbbInGW.removePoll(getMeetingID(), getRequesterID(), msg); - } - - public void respondPoll(String msg){ - System.out.println("*** PollService:: respond poll \n" + msg + "\n"); - bbbInGW.respondPoll(getMeetingID(), getRequesterID(), msg); - } - - private String getMeetingID() { - IScope scope = Red5.getConnectionLocal().getScope(); - return scope.getName(); - } - - private String getRequesterID() { - return getBbbSession().getInternalUserID(); - } - - private BigBlueButtonSession getBbbSession() { - return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/messaging/redis/PollRedisMessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/messaging/redis/PollRedisMessageHandler.java deleted file mode 100755 index b142018d03..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/poll/messaging/redis/PollRedisMessageHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.bigbluebutton.conference.service.poll.messaging.redis; - - -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class PollRedisMessageHandler implements MessageHandler { - private static Logger log = Red5LoggerFactory.getLogger(PollRedisMessageHandler.class, "bigbluebutton"); - - private IBigBlueButtonInGW bbbGW; - - @Override - public void handleMessage(String pattern, String channel, String message) { -// log.debug("Checking message: " + pattern + " " + channel + " " + message); - if (channel.equalsIgnoreCase(MessagingConstants.TO_POLLING_CHANNEL)){ - Gson gson = new Gson(); - JsonParser parser = new JsonParser(); - JsonObject obj = parser.parse(message).getAsJsonObject(); - String messageId = gson.fromJson(obj.get("messageId"), String.class); - - //HashMap map = gson.fromJson(message, new TypeToken>() {}.getType()); - - //String messageId = map.get("messageId"); - if (messageId != null){ - if (MessagingConstants.SEND_POLLS_EVENT.equalsIgnoreCase(messageId)){ - String meetingId = gson.fromJson(obj.get("meetingId"), String.class); - bbbGW.preCreatedPoll(meetingId, message); - } - } - } - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { - this.bbbGW = bbbGW; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java deleted file mode 100755 index 416b341293..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java +++ /dev/null @@ -1,142 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import org.apache.commons.pool.impl.GenericObjectPool; - -public class GenericObjectPoolConfigWrapper { - - private final GenericObjectPool.Config config; - - public GenericObjectPoolConfigWrapper() { - this.config = new GenericObjectPool.Config(); - } - - public GenericObjectPool.Config getConfig() { - return config; - } - - public int getMaxIdle() { - return this.config.maxIdle; - } - - public void setMaxIdle(int maxIdle) { - this.config.maxIdle = maxIdle; - } - - public int getMinIdle() { - return this.config.minIdle; - } - - public void setMinIdle(int minIdle) { - this.config.minIdle = minIdle; - } - - public int getMaxActive() { - return this.config.maxActive; - } - - public void setMaxActive(int maxActive) { - this.config.maxActive = maxActive; - } - - public long getMaxWait() { - return this.config.maxWait; - } - - public void setMaxWait(long maxWait) { - this.config.maxWait = maxWait; - } - - public byte getWhenExhaustedAction() { - return this.config.whenExhaustedAction; - } - - public void setWhenExhaustedAction(byte whenExhaustedAction) { - this.config.whenExhaustedAction = whenExhaustedAction; - } - - public boolean isTestOnBorrow() { - return this.config.testOnBorrow; - } - - public void setTestOnBorrow(boolean testOnBorrow) { - this.config.testOnBorrow = testOnBorrow; - } - - public boolean isTestOnReturn() { - return this.config.testOnReturn; - } - - public void setTestOnReturn(boolean testOnReturn) { - this.config.testOnReturn = testOnReturn; - } - - public boolean isTestWhileIdle() { - return this.config.testWhileIdle; - } - - public void setTestWhileIdle(boolean testWhileIdle) { - this.config.testWhileIdle = testWhileIdle; - } - - public long getTimeBetweenEvictionRunsMillis() { - return this.config.timeBetweenEvictionRunsMillis; - } - - public void setTimeBetweenEvictionRunsMillis( - long timeBetweenEvictionRunsMillis) { - this.config.timeBetweenEvictionRunsMillis = - timeBetweenEvictionRunsMillis; - } - - public int getNumTestsPerEvictionRun() { - return this.config.numTestsPerEvictionRun; - } - - public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { - this.config.numTestsPerEvictionRun = numTestsPerEvictionRun; - } - - public long getMinEvictableIdleTimeMillis() { - return this.config.minEvictableIdleTimeMillis; - } - - public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { - this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; - } - - public long getSoftMinEvictableIdleTimeMillis() { - return this.config.softMinEvictableIdleTimeMillis; - } - - public void setSoftMinEvictableIdleTimeMillis( - long softMinEvictableIdleTimeMillis) { - this.config.softMinEvictableIdleTimeMillis = - softMinEvictableIdleTimeMillis; - } - - public boolean isLifo() { - return this.config.lifo; - } - - public void setLifo(boolean lifo) { - this.config.lifo = lifo; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java deleted file mode 100755 index a8cf016b6e..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import java.util.HashMap; - -/** - * Abstract class for all events that need to be recorded. - * @author Richard Alam - * - */ -public abstract class RecordEvent { - protected final HashMap eventMap = new HashMap(); - - protected final static String MODULE = "module"; - protected final static String TIMESTAMP = "timestamp"; - protected final static String MEETING = "meetingId"; - protected final static String EVENT = "eventName"; - - public final String getMeetingID() { - return eventMap.get(MEETING); - } - - /** - * Set the module that generated the event. - * @param module - */ - public final void setModule(String module) { - eventMap.put(MODULE, module); - } - - /** - * Set the timestamp of the event. - * @param timestamp - */ - public final void setTimestamp(long timestamp) { - eventMap.put(TIMESTAMP, Long.toString(timestamp)); - } - - /** - * Set the meetingId for this particular event. - * @param meetingId - */ - public final void setMeetingId(String meetingId) { - eventMap.put(MEETING, meetingId); - } - - /** - * Set the name of the event. - * @param event - */ - public final void setEvent(String event) { - eventMap.put(EVENT, event); - } - - - /** - * Convert the event into a Map to be recorded. - * @return - */ - public final HashMap toMap() { - return eventMap; - } - - @Override - public String toString() { - return eventMap.get(MODULE) + " " + eventMap.get(EVENT); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java deleted file mode 100755 index f5a24578ba..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -/** - * - * The IRecorder interface define all the neccesary methods to implement for - * dispatch events to a JMS queue - * - * */ -public interface Recorder { - /** - * Receive the messages from the bigbluebutton modules and send - * them to a queue. These messages are the events generated in a conference. - * @param message a JSON String message with the attributes of an event - */ - public void record(String session, RecordEvent event); - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java deleted file mode 100644 index d8fb2bd689..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java +++ /dev/null @@ -1,108 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; - -import org.bigbluebutton.service.recording.RedisListRecorder; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -/** - * - * The RecorderApplication class is used for setting the record module - * in BigBlueButton for send events messages to a JMS queue. - * The class follows the same standard as the others modules of BigBlueButton Apps. - */ -public class RecorderApplication { - private static Logger log = Red5LoggerFactory.getLogger(RecorderApplication.class, "bigbluebutton"); - - private static final int NTHREADS = 1; - private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); - - private BlockingQueue messages; - private volatile boolean recordEvents = false; - - private RedisListRecorder redisListRecorder; - - private Recorder recorder; - - public RecorderApplication() { - messages = new LinkedBlockingQueue(); - } - - public void start() { - recordEvents = true; - Runnable sender = new Runnable() { - public void run() { - while (recordEvents) { - RecordEvent message; - try { - message = messages.take(); - recordEvent(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - exec.execute(sender); - } - - public void stop() { - recordEvents = false; - } - - public void destroyRecordSession(String meetingID) { -// recordingSessions.remove(meetingID); - } - - public void createRecordSession(String meetingID) { -// recordingSessions.put(meetingID, meetingID); - } - - public void record(String meetingID, RecordEvent message) { - messages.offer(message); - } - - private void recordEvent(final RecordEvent message) { - Runnable task = new Runnable() { - public void run() { - recorder.record(message.getMeetingID(), message); - } - }; - runExec.execute(task); - } - - public void setRecorder(Recorder recorder) { - this.recorder = recorder; - log.debug("setting recorder"); - } - - public void setRedisListRecorder(RedisListRecorder rec) { - redisListRecorder = rec; - } -} - diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java deleted file mode 100755 index 877f50dc7e..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java +++ /dev/null @@ -1,57 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class RedisDispatcher implements Recorder { - private static Logger log = Red5LoggerFactory.getLogger(Recorder.class, "bigbluebutton"); - private static final String COLON=":"; - JedisPool redisPool; - - public RedisDispatcher() { - super(); - log.debug("setting redis dispatcher"); - } - - @Override - public void record(String session, RecordEvent message) { - Jedis jedis = redisPool.getResource(); - try { - Long msgid = jedis.incr("global:nextRecordedMsgId"); - jedis.hmset("recording" + COLON + session + COLON + msgid, message.toMap()); - jedis.rpush("meeting" + COLON + session + COLON + "recordings", msgid.toString()); - } finally { - redisPool.returnResource(jedis); - } - } - - public JedisPool getRedisPool() { - return redisPool; - } - - public void setRedisPool(JedisPool redisPool) { - this.redisPool = redisPool; - } - - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java deleted file mode 100755 index f07a52713c..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.chat; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractChatRecordEvent extends RecordEvent { - - public AbstractChatRecordEvent() { - setModule("CHAT"); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java deleted file mode 100755 index d3db884a58..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.chat; - - -public class PublicChatRecordEvent extends AbstractChatRecordEvent { - private static final String SENDER = "sender"; - private static final String MESSAGE = "message"; - private static final String COLOR = "color"; - - public PublicChatRecordEvent() { - super(); - setEvent("PublicChatEvent"); - } - - public void setSender(String sender) { - eventMap.put(SENDER, sender); - } - - public void setMessage(String message) { - eventMap.put(MESSAGE, message); - } - - public void setColor(String color) { - eventMap.put(COLOR, color); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java deleted file mode 100755 index 48c735b0a4..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractParticipantRecordEvent extends RecordEvent { - - public AbstractParticipantRecordEvent() { - setModule("PARTICIPANT"); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java deleted file mode 100755 index f23c441914..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent { - - public AssignPresenterRecordEvent() { - super(); - setEvent("AssignPresenterEvent"); - } - - public void setUserId(String userid) { - eventMap.put("userid", userid); - } - - public void setName(String name) { - eventMap.put("name", name); - } - - public void setAssignedBy(String by) { - eventMap.put("assignedBy", by); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java deleted file mode 100755 index 46de9dd422..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantEndAndKickAllRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantEndAndKickAllRecordEvent() { - super(); - setEvent("EndAndKickAllEvent"); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java deleted file mode 100755 index fe22c8c7d2..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantJoinRecordEvent() { - super(); - setEvent("ParticipantJoinEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - - public void setName(String name){ - eventMap.put("name",name); - } - - /** - * Sets the role of the user as MODERATOR or VIEWER - * @param role - */ - public void setRole(String role) { - eventMap.put("role", role); - } - - public void setStatus(String status) { - eventMap.put("status", status); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java deleted file mode 100755 index 90812dd22d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantLeftRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantLeftRecordEvent() { - super(); - setEvent("ParticipantLeftEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java deleted file mode 100755 index e8c6e9048b..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantStatusChangeRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantStatusChangeRecordEvent() { - super(); - setEvent("ParticipantStatusChangeEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - - public void setStatus(String status) { - eventMap.put("status", status); - } - - public void setValue(String value) { - eventMap.put("value", value); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java deleted file mode 100644 index a00e60fafc..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class RecordStatusRecordEvent extends AbstractParticipantRecordEvent { - - public RecordStatusRecordEvent() { - super(); - setEvent("RecordStatusEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - - public void setRecordingStatus(String status) { - eventMap.put("status", status); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java deleted file mode 100755 index b95e18e37a..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractPollRecordEvent extends RecordEvent { - - public AbstractPollRecordEvent() { - setModule("POLL"); - } -} - diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java deleted file mode 100755 index 3eb9b25730..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollClearedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollClearedRecordEvent(){ - super(); - setEvent("PollClearedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java deleted file mode 100755 index d1003abdef..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollCreatedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - private static final String TITLE = "title"; - - private static final String QUESTION_PATTERN = "question"; - private static final String QUESTION_TEXT = "text"; - private static final String QUESTION_MULTIRESPONSE = "multiresponse"; - - private static final String RESPONSE_PATTERN = "response"; - private static final String RESPONSE_TEXT = "text"; - - private static final String RESPONDER_PATTERN = "responder"; - private static final String RESPONDER_USER = "user"; - - private static final String SEPARATOR = "-"; - - - public PollCreatedRecordEvent() { - super(); - setEvent("PollCreatedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - - public void setTitle(String title) { - eventMap.put(TITLE, title); - } - - public void addQuestion(String id, String question, Boolean multiresponse) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question); - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString()); - } - - public void addResponse(String questionID, String responseID, String response) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); - } - - /*public void addResponder(String questionID, String responseID, String responderID, String userID) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); - }*/ - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java deleted file mode 100755 index 2b4b445d34..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollRemovedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollRemovedRecordEvent(){ - super(); - setEvent("PollRemovedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} - - diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java deleted file mode 100755 index b86592ee5a..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollStartedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollStartedRecordEvent(){ - super(); - setEvent("PollStartedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java deleted file mode 100755 index efe04ba4de..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollStoppedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollStoppedRecordEvent(){ - super(); - setEvent("PollStoppedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java deleted file mode 100755 index f26b1eef8e..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollUpdatedRecordEvent extends AbstractPollRecordEvent { - private static final String POLL_ID = "pollID"; - private static final String TITLE = "title"; - - private static final String QUESTION_PATTERN = "question"; - private static final String QUESTION_TEXT = "text"; - private static final String QUESTION_MULTIRESPONSE = "multiresponse"; - - private static final String RESPONSE_PATTERN = "response"; - private static final String RESPONSE_TEXT = "text"; - - private static final String RESPONDER_PATTERN = "responder"; - private static final String RESPONDER_USER = "user"; - - private static final String SEPARATOR = "-"; - - public PollUpdatedRecordEvent(){ - super(); - setEvent("PollUpdatedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - - public void setTitle(String title) { - eventMap.put(TITLE, title); - } - - public void addQuestion(String id, String question, Boolean multiresponse) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question); - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString()); - } - - public void addResponse(String questionID, String responseID, String response) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java deleted file mode 100755 index fc26c2243e..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractPresentationRecordEvent extends RecordEvent { - - public AbstractPresentationRecordEvent() { - setModule("PRESENTATION"); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java deleted file mode 100755 index a134d7e4c1..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class ConversionCompletedPresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public ConversionCompletedPresentationRecordEvent() { - super(); - setEvent("ConversionCompletedEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - - public void setOriginalFilename(String name) { - eventMap.put("originalFilename", name); - } - - public void setSlidesInfo(String slidesInfo) { - eventMap.put("slidesInfo", slidesInfo); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java deleted file mode 100755 index 9964bbf617..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class CursorUpdateRecordEvent extends AbstractPresentationRecordEvent{ - - public CursorUpdateRecordEvent() { - super(); - setEvent("CursorMoveEvent"); - } - - public void setXPercent(double percent) { - eventMap.put("xOffset", Double.toString(percent)); - } - - public void setYPercent(double percent) { - eventMap.put("yOffset", Double.toString(percent)); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java deleted file mode 100755 index 171fdb9a09..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class GenerateSlidePresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public GenerateSlidePresentationRecordEvent() { - super(); - setEvent("GenerateSlideEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - - public void setNumberOfPages(int numPages) { - eventMap.put("numberOfPages", Integer.toString(numPages)); - } - - public void setPagesCompleted(int pagesCompleted) { - eventMap.put("pagesCompleted", Integer.toString(pagesCompleted)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java deleted file mode 100644 index a58f2d3b1a..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class GotoSlidePresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public GotoSlidePresentationRecordEvent() { - super(); - setEvent("GotoSlideEvent"); - } - - public void setSlide(int slide) { - /** - * Subtract 1 from the page number to be zero-based to be - * compatible with 0.81 and earlier. (ralam Sept 2, 2014) - */ - eventMap.put("slide", Integer.toString(slide - 1)); - } - - public void setId(String id) { - eventMap.put("id", id); - } - - public void setNum(int num) { - - eventMap.put("num", Integer.toString(num)); - } - - public void setCurrent(boolean current) { - eventMap.put("current", Boolean.toString(current)); - } - - public void setThumbUri(String thumbUri) { - eventMap.put("thumbUri", thumbUri); - } - - public void setSwfUri(String swfUri) { - eventMap.put("swfUri", swfUri); - } - - public void setTxtUri(String txtUri) { - eventMap.put("txtUri", txtUri); - } - - public void setPngUri(String pngUri) { - eventMap.put("pngUri", pngUri); - } - - public void setXOffset(double offset) { - eventMap.put("xOffset", Double.toString(offset)); - } - - public void setYOffset(double offset) { - eventMap.put("yOffset", Double.toString(offset)); - } - - public void setWidthRatio(double ratio) { - eventMap.put("widthRatio", Double.toString(ratio)); - } - - public void setHeightRatio(double ratio) { - eventMap.put("heightRatio", Double.toString(ratio)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java deleted file mode 100755 index 01d371cc7d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class RemovePresentationPresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public RemovePresentationPresentationRecordEvent() { - super(); - setEvent("RemovePresentationEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java deleted file mode 100644 index bf55a97ce2..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class ResizeAndMoveSlidePresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public ResizeAndMoveSlidePresentationRecordEvent() { - super(); - setEvent("ResizeAndMoveSlideEvent"); - } - - public void setId(String id) { - eventMap.put("id", id); - } - - public void setNum(int num) { - eventMap.put("num", Integer.toString(num)); - } - - public void setCurrent(boolean current) { - eventMap.put("current", Boolean.toString(current)); - } - - public void setThumbUri(String thumbUri) { - eventMap.put("thumbUri", thumbUri); - } - - public void setSwfUri(String swfUri) { - eventMap.put("swfUri", swfUri); - } - - public void setTxtUri(String txtUri) { - eventMap.put("txtUri", txtUri); - } - - public void setPngUri(String pngUri) { - eventMap.put("pngUri", pngUri); - } - - public void setXOffset(double offset) { - eventMap.put("xOffset", Double.toString(offset)); - } - - public void setYOffset(double offset) { - eventMap.put("yOffset", Double.toString(offset)); - } - - public void setWidthRatio(double ratio) { - eventMap.put("widthRatio", Double.toString(ratio)); - } - - public void setHeightRatio(double ratio) { - eventMap.put("heightRatio", Double.toString(ratio)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java deleted file mode 100755 index 0efd6273fc..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class SharePresentationPresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public SharePresentationPresentationRecordEvent() { - super(); - setEvent("SharePresentationEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - - public void setOriginalFilename(String name) { - eventMap.put("originalFilename", name); - } - - public void setShare(boolean share) { - eventMap.put("share", Boolean.toString(share)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java deleted file mode 100644 index aed2b1c94b..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractWhiteboardRecordEvent extends RecordEvent { - - public AbstractWhiteboardRecordEvent() { - setModule("WHITEBOARD"); - } - - public void setPresentation(String name) { - eventMap.put("presentation", name); - } - - public void setPageNumber(String page) { - /** - * Subtract 1 from the page number to be zero-based to be - * compatible with 0.81 and earlier. (ralam Sept 2, 2014) - */ - Integer num = new Integer(page); -// System.out.println("WB Page Number real pagenum=[" + num + "] rec pagenum=[" + (num - 1) + "]"); - eventMap.put("pageNumber", new Integer(num - 1).toString()); - } - - public void setWhiteboardId(String id) { - eventMap.put("whiteboardId", id); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java deleted file mode 100755 index fa667798c6..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import java.util.ArrayList; -import java.util.Map; - -public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { - - public AddShapeWhiteboardRecordEvent() { - super(); - setEvent("AddShapeEvent"); - } - - public void addAnnotation(Map annotation) { - for (Map.Entry entry : annotation.entrySet()) { - String key = entry.getKey(); - - if (key.equals("points")) { - eventMap.put("dataPoints", pointsToString((ArrayList)entry.getValue())); - } else { - Object value = entry.getValue(); - eventMap.put(key, value.toString()); - } - } - } - - private String pointsToString(ArrayList points){ - String datapoints = ""; - for (int i = 0; i < points.size(); i++) { - datapoints += (points.get(i)).toString() + ","; - } - // Trim the trailing comma - return datapoints.substring(0, datapoints.length() - 1); - } - - public void setFillColor(int fillColor) { - eventMap.put("fillColor", Integer.toString(fillColor)); - } - - public void setThickness(int thickness) { - eventMap.put("thickness", Integer.toString(thickness)); - } - - public void setFill(boolean fill) { - eventMap.put("fill", Boolean.toString(fill)); - } - - public void setTransparent(boolean transparent) { - eventMap.put("transparent", Boolean.toString(transparent)); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java deleted file mode 100755 index fc3c0b4fcf..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import java.util.ArrayList; -import java.util.Map; - -public class AddTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { - - public AddTextWhiteboardRecordEvent() { - super(); - setEvent("AddTextEvent"); - } - - public void addAnnotation(Map annotation) { - for (Map.Entry entry : annotation.entrySet()) { - String key = entry.getKey(); - - if (key.equals("points")) { - ArrayList value = (ArrayList)entry.getValue(); - eventMap.put("dataPoints", pointsToString(value)); - } else { - Object value = entry.getValue(); - eventMap.put(key, value.toString()); - } - } - } - - private String pointsToString(ArrayList points){ - String datapoints = ""; - for (Double i : points) { - datapoints += i + ","; - } - // Trim the trailing comma - return datapoints.substring(0, datapoints.length() - 1); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java deleted file mode 100755 index 583d374470..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -public class ClearPageWhiteboardRecordEvent extends - AbstractWhiteboardRecordEvent { - - public ClearPageWhiteboardRecordEvent() { - super(); - setEvent("ClearPageEvent"); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java deleted file mode 100755 index ca6f398f3b..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import java.util.ArrayList; -import java.util.Map; - -public class ModifyTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { - - public ModifyTextWhiteboardRecordEvent() { - super(); - setEvent("ModifyTextEvent"); - } - - public void addAnnotation(Map annotation) { - for (Map.Entry entry : annotation.entrySet()) { - String key = entry.getKey(); - - if (key.equals("points")) { - ArrayList value = (ArrayList)entry.getValue(); - eventMap.put("dataPoints", pointsToString(value)); - } else { - Object value = entry.getValue(); - eventMap.put(key, value.toString()); - } - } - } - - private String pointsToString(ArrayList points){ - String datapoints = ""; - for (Double i : points) { - datapoints += i + ","; - } - // Trim the trailing comma - return datapoints.substring(0, datapoints.length() - 1); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java deleted file mode 100755 index 1b68d43f7a..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -public class ToggleGridWhiteboardRecordEvent extends - AbstractWhiteboardRecordEvent { - - public ToggleGridWhiteboardRecordEvent() { - super(); - setEvent("ToggleGridEvent"); - } - - public void setGridEnabled(boolean enabled) { - eventMap.put("gridEnabled", Boolean.toString(enabled)); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java deleted file mode 100755 index 0d9cbd4ef6..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -public class UndoShapeWhiteboardRecordEvent extends - AbstractWhiteboardRecordEvent { - - public UndoShapeWhiteboardRecordEvent() { - super(); - setEvent("UndoShapeEvent"); - } - - public void setShapeId(String id) { - eventMap.put("shapeId", id); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java deleted file mode 100755 index 68ed47975d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.bigbluebutton.core.api; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class RedisLpushDispatcher implements IDispatcher { - private static final int NTHREADS = 1; - private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); - - private static final String BBBMESSAGES = "bbb:meeting:messages"; - - private BlockingQueue messages; - private volatile boolean dispatchEvents = false; - - private JedisPool redisPool; - - public RedisLpushDispatcher() { - messages = new LinkedBlockingQueue(); - } - - @Override - public void dispatch(String jsonMessage) { - messages.offer(jsonMessage); - } - - private void saveMessage(String msg) { - Jedis jedis = redisPool.getResource(); - try { - jedis.lpush(BBBMESSAGES, msg); - } finally { - redisPool.returnResource(jedis); - } - } - - public void start() { - dispatchEvents = true; - Runnable sender = new Runnable() { - public void run() { - while (dispatchEvents) { - String message; - try { - message = messages.take(); - saveMessage(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - exec.execute(sender); - } - - public void stop() { - dispatchEvents = false; - } - - public void setRedisPool(JedisPool redisPool) { - this.redisPool = redisPool; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java deleted file mode 100755 index e8bf93bee4..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.service.recording; - -public class RecordMessage { - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java deleted file mode 100644 index bead66f1fc..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.bigbluebutton.service.recording; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -import com.google.gson.Gson; - -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class RedisListRecorder { - private static Logger log = Red5LoggerFactory.getLogger(RedisListRecorder.class, "bigbluebutton"); - private static final int NTHREADS = 1; - private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - private volatile boolean recordEvents = false; - - JedisPool redisPool; - - public void start() { - recordEvents = true; - Runnable sender = new Runnable() { - public void run() { - while (recordEvents) { - RecordEvent message; - try { - message = messages.take(); - recordEvent(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - exec.execute(sender); - } - - public void stop() { - recordEvents = false; - } - - private void recordEvent(final RecordEvent message) { - Runnable task = new Runnable() { - public void run() { - Jedis jedis = redisPool.getResource(); - try { - String key = "bbb:recording:" + message.getMeetingID(); - Gson gson= new Gson(); - jedis.rpush(key, gson.toJson(message.toMap())); - } finally { - redisPool.returnResource(jedis); - } - } - }; - runExec.execute(task); - } - - public void record(RecordEvent message) { - messages.offer(message); - } - - public JedisPool getRedisPool() { - return redisPool; - } - - public void setRedisPool(JedisPool redisPool) { - this.redisPool = redisPool; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java deleted file mode 100755 index 9f03321ce0..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractVoiceRecordEvent extends RecordEvent { - - public AbstractVoiceRecordEvent() { - setModule("VOICE"); - } - - public void setBridge(String bridge) { - eventMap.put("bridge", bridge); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java deleted file mode 100755 index 1e4616ef56..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public interface ConferenceServerListener { - public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); - public void left(String room, Integer participant); - public void muted(String room, Integer participant, Boolean muted); - public void talking(String room, Integer participant, Boolean talking); -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java deleted file mode 100755 index ffebb366ee..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public interface ConferenceServiceProvider { - public void populateRoom(String room); - public void mute(String room, String participant, Boolean mute); - public void eject(String room, String participant); - public void ejectAll(String room); - public void record(String room, String meetingid); - public void broadcast(String room, String meetingid); -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java deleted file mode 100644 index f24a4de2e5..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java +++ /dev/null @@ -1,115 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; - -public class FreeswitchConferenceEventListener implements ConferenceEventListener { - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - - private volatile boolean sendMessages = false; - private IVoiceConferenceService vcs; - - public void setVoiceConferenceService(IVoiceConferenceService vcs) { - this.vcs = vcs; - } - - private void queueMessage(VoiceConferenceEvent event) { - try { - messages.offer(event, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { - Runnable task = new Runnable() { - public void run() { - if (event instanceof VoiceUserJoinedEvent) { - System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); - VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; - vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), - evt.getCallerIdNum(), evt.getCallerIdName(), - evt.getMuted(), evt.getSpeaking()); - } else if (event instanceof VoiceUserLeftEvent) { - System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); - VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; - vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); - } else if (event instanceof VoiceUserMutedEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); - VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; - vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); - } else if (event instanceof VoiceUserTalkingEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); - VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; - vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); - } else if (event instanceof VoiceStartRecordingEvent) { - VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; - System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); - vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); - } - } - }; - - runExec.execute(task); - } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - VoiceConferenceEvent message; - try { - message = messages.take(); - sendMessageToBigBlueButton(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - - public void handleConferenceEvent(VoiceConferenceEvent event) { - queueMessage(event); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java deleted file mode 100755 index f26f38b458..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.webconference.voice; - -public interface IVoiceConferenceService { - void voiceUserJoined(String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); - void voiceUserLeft(String meetingId, String userId); - void voiceUserLocked(String meetingId, String userId, Boolean locked); - void voiceUserMuted(String meetingId, String userId, Boolean muted); - void voiceUserTalking(String meetingId, String userId, Boolean talking); - void voiceStartedRecording(String conference, String recordingFile, - String timestamp, Boolean recording); -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java deleted file mode 100755 index 7417a522af..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantJoinedVoiceRecordEvent() { - super(); - setEvent("ParticipantJoinedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setCallerName(String name) { - eventMap.put("callername", name); - } - - public void setCallerNumber(String name) { - eventMap.put("callernumber", name); - } - - public void setMuted(boolean muted) { - eventMap.put("muted", Boolean.toString(muted)); - } - - public void setTalking(boolean talking) { - eventMap.put("talking", Boolean.toString(talking)); - } - - public void setLocked(boolean locked) { - eventMap.put("locked", Boolean.toString(locked)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java deleted file mode 100755 index 0b3bfaa25c..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantLeftVoiceRecordEvent() { - super(); - setEvent("ParticipantLeftEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java deleted file mode 100755 index ff7be6cbd5..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantLockedVoiceRecordEvent() { - super(); - setEvent("ParticipantLockedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setLocked(boolean locked) { - eventMap.put("locked", Boolean.toString(locked)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java deleted file mode 100755 index eb23d6bc70..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantMutedVoiceRecordEvent() { - super(); - setEvent("ParticipantMutedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setMuted(boolean muted) { - eventMap.put("muted", Boolean.toString(muted)); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java deleted file mode 100755 index e0b2814349..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantTalkingVoiceRecordEvent() { - super(); - setEvent("ParticipantTalkingEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setTalking(boolean talking) { - eventMap.put("talking", Boolean.toString(talking)); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java deleted file mode 100755 index 7c46b0f0bf..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public StartRecordingVoiceRecordEvent(boolean record) { - super(); - if (record) - setEvent("StartRecordingEvent"); - else - setEvent("StopRecordingEvent"); - } - - public void setRecordingTimestamp(String timestamp) { - eventMap.put("recordingTimestamp", timestamp); - } - - public void setFilename(String filename) { - eventMap.put("filename", filename); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java deleted file mode 100644 index 4eb041e569..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java +++ /dev/null @@ -1,144 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.conference.service.recorder.RecorderApplication; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class VoiceEventRecorder { - private static final Logger log = Red5LoggerFactory.getLogger(VoiceEventRecorder.class, "bigbluebutton"); - - private RecorderApplication recorder; - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - public void recordConferenceEvent(VoiceConferenceEvent event, String room) { - if (event instanceof VoiceUserJoinedEvent) { - recordParticipantJoinedEvent(event, room); - } else if (event instanceof VoiceUserLeftEvent) { - recordParticipantLeftEvent(event, room); - } else if (event instanceof VoiceUserMutedEvent) { - recordParticipantMutedEvent(event, room); - } else if (event instanceof VoiceUserTalkingEvent) { - recordParticipantTalkingEvent(event, room); - } else if (event instanceof VoiceUserLockedEvent) { - recordParticipantLockedEvent(event, room); - } else if (event instanceof VoiceStartRecordingEvent) { - recordStartRecordingEvent(event, room); - } else { - log.debug("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() ); - } - } - - private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) { - VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event; - StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord()); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setRecordingTimestamp(sre.getTimestamp()); - evt.setFilename(sre.getRecordingFilename()); - System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename")); - recorder.record(room, evt); - } - - private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) { - VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event; - - ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(pje.getUserId().toString()); - evt.setCallerName(pje.getCallerIdName()); - evt.setCallerNumber(pje.getCallerIdName()); - evt.setMuted(pje.getMuted()); - evt.setTalking(pje.getSpeaking()); - - recorder.record(room, evt); - } - - private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) { - - ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - - - evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString()); - - recorder.record(room, evt); - } - - private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) { - VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event; - - ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString()); - evt.setMuted(pme.isMuted()); - - recorder.record(room, evt); - } - - private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) { - VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event; - - ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString()); - evt.setTalking(pte.isTalking()); - - recorder.record(room, evt); - } - - private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) { - VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event; - - ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString()); - evt.setLocked(ple.isLocked()); - - recorder.record(room, evt); - } - - public void setRecorderApplication(RecorderApplication recorder) { - this.recorder = recorder; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java deleted file mode 100755 index d0402213cc..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public abstract class ConferenceCommand { - - private final String room; - private final Integer requesterId; - - public ConferenceCommand(String room, Integer requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public String getRoom() { - return room; - } - - public Integer getRequesterId() { - return requesterId; - } - - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java deleted file mode 100755 index e9b6c0f3be..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java +++ /dev/null @@ -1,56 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class ConferenceCommandResult { - - private final String room; - private final Integer requesterId; - private boolean success = false; - private String message = ""; - - public ConferenceCommandResult(String room, Integer requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getRoom() { - return room; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Integer getRequesterId() { - return requesterId; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java deleted file mode 100755 index 140b26a75f..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class EjectParticipantCommand extends ConferenceCommand { - - private final Integer participantId; - - public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { - super(room, requesterId); - this.participantId = participantId; - } - - public Integer getParticipantId() { - return participantId; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java deleted file mode 100755 index ff774f702d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class GetParticipantsCommand extends ConferenceCommand { - - public GetParticipantsCommand(String room, Integer requesterId) { - super(room, requesterId); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java deleted file mode 100755 index 789a355cde..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class MuteParticipantCommand extends ConferenceCommand { - - private final Integer participantId; - private final boolean mute; - - public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { - super(room, requesterId); - this.participantId = participantId; - this.mute = mute; - } - - public Integer getParticipantId() { - return participantId; - } - - public boolean isMute() { - return mute; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java deleted file mode 100755 index 15800e757d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - - -public interface ConferenceEventListener { - public void handleConferenceEvent(VoiceConferenceEvent event); - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java deleted file mode 100755 index 735180a415..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class UnknownConferenceEvent extends VoiceConferenceEvent { - - public UnknownConferenceEvent(String participantId, String room) { - super(room); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java deleted file mode 100755 index d1ee12a966..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public abstract class VoiceConferenceEvent { - private final String room; - - public VoiceConferenceEvent(String room) { - this.room = room; - } - - public String getRoom() { - return room; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java deleted file mode 100755 index 0e2b8bcc90..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceStartRecordingEvent extends VoiceConferenceEvent { - - private String timestamp; - private String filename; - private boolean record; - - public VoiceStartRecordingEvent(String room, boolean record) { - super(room); - this.record = record; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public void setRecordingFilename(String filename) { - this.filename = filename; - } - - public String getTimestamp() { - return timestamp; - } - - public String getRecordingFilename() { - return filename; - } - - public boolean startRecord() { - return record; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java deleted file mode 100755 index 1a721c5015..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserJoinedEvent extends VoiceConferenceEvent { - - private final String voiceUserId; - private final String callerIdNum; - private final String callerIdName; - private final Boolean muted; - private final Boolean speaking; - private final Boolean locked = false; - private final String userId; - - public VoiceUserJoinedEvent(String userId, String voiceUserId, String room, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking) { - super(room); - this.userId = userId; - this.voiceUserId = voiceUserId; - this.callerIdName = callerIdName; - this.callerIdNum = callerIdNum; - this.muted = muted; - this.speaking = speaking; - } - - public String getUserId() { - return userId; - } - - public String getVoiceUserId() { - return voiceUserId; - } - - public String getCallerIdNum() { - return callerIdNum; - } - - public String getCallerIdName() { - return callerIdName; - } - - public Boolean getMuted() { - return muted; - } - - public Boolean getSpeaking() { - return speaking; - } - - public Boolean isLocked() { - return locked; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java deleted file mode 100755 index f5371e5620..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserLeftEvent extends VoiceConferenceEvent { - - private final String userId; - - public VoiceUserLeftEvent(String userId, String room) { - super(room); - this.userId = userId; - } - - public String getUserId() { - return userId; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java deleted file mode 100755 index 414be991c6..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserLockedEvent extends VoiceConferenceEvent { - - private final boolean locked; - private final String userId; - - public VoiceUserLockedEvent(String userId, String room, boolean locked) { - super(room); - this.locked = locked; - this.userId = userId; - } - - public String getUserId() { - return userId; - } - - public boolean isLocked() { - return locked; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java deleted file mode 100755 index 203e93743c..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserMutedEvent extends VoiceConferenceEvent { - - private final boolean muted; - private final String userId; - - public VoiceUserMutedEvent(String userId, String room, boolean muted) { - super(room); - this.muted = muted; - this.userId = userId; - } - - public String getUserId() { - return userId; - } - - public boolean isMuted() { - return muted; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java deleted file mode 100755 index 3ecd6759e4..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserTalkingEvent extends VoiceConferenceEvent { - - private final boolean talking; - private final String userId; - - public VoiceUserTalkingEvent(String userId, String room, boolean talking) { - super(room); - this.talking = talking; - this.userId = userId; - } - - public String getUserId() { - return userId; - } - - public boolean isTalking() { - return talking; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java deleted file mode 100755 index 63f859c3e5..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java +++ /dev/null @@ -1,157 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; -import org.freeswitch.esl.client.inbound.Client; -import org.freeswitch.esl.client.inbound.InboundConnectionFailure; -import org.freeswitch.esl.client.manager.ManagerConnection; -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class ConnectionManager { - private static Logger log = Red5LoggerFactory.getLogger(ConnectionManager.class, "bigbluebutton"); - private static final String EVENT_NAME = "Event-Name"; - - private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); - - private ManagerConnection manager; - private ScheduledFuture connectTask; - - private volatile boolean subscribed = false; - - private ConferenceEventListener conferenceEventListener; - private ESLEventListener eslEventListener; - - private void connect() { - try { - Client c = manager.getESLClient(); - if (! c.canSend()) { - log.info("Attempting to connect to FreeSWITCH ESL"); - subscribed = false; - manager.connect(); - } else { - if (!subscribed) { - log.info("Subscribing for ESL events."); - c.cancelEventSubscriptions(); - c.addEventListener(eslEventListener); - c.setEventSubscriptions( "plain", "all" ); - c.addEventFilter( EVENT_NAME, "heartbeat" ); - c.addEventFilter( EVENT_NAME, "custom" ); - c.addEventFilter( EVENT_NAME, "background_job" ); - subscribed = true; - } - } - } catch (InboundConnectionFailure e) { - System.out.println("Failed to connect to ESL"); - log.error("Failed to connect to ESL"); - } - } - - public void start() { - log.info("Starting FreeSWITCH ESL connection manager."); - System.out.println("***************** Starting FreeSWITCH ESL connection manager."); - ConnectThread connector = new ConnectThread(); - connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); - } - - public void stop() { - if (connectTask != null) { - connectTask.cancel(true); - } - } - - private class ConnectThread implements Runnable { - public void run() { - connect(); - } - } - - - public void broadcast(BroadcastConferenceCommand rcc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); - rcc.handleResponse(response, conferenceEventListener); - } - } - - public void getUsers(PopulateRoomCommand prc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); - prc.handleResponse(response, conferenceEventListener); - } - } - - public void mute(MuteParticipantCommand mpc) { - System.out.println("Got mute request from FSApplication."); - Client c = manager.getESLClient(); - if (c.canSend()) { - System.out.println("Issuing command to FS ESL."); - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void eject(EjectParticipantCommand mpc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void ejectAll(EjectAllUsersCommand mpc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void record(RecordConferenceCommand rcc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); - rcc.handleResponse(response, conferenceEventListener); - } - } - - public void setManagerConnection(ManagerConnection manager) { - this.manager = manager; - } - - public void setESLEventListener(ESLEventListener listener) { - this.eslEventListener = listener; - } - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java deleted file mode 100644 index 92400799d3..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.bigbluebutton.webconference.voice.freeswitch; - - -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.freeswitch.esl.client.IEslEventListener; -import org.freeswitch.esl.client.transport.event.EslEvent; -import org.jboss.netty.channel.ExceptionEvent; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class ESLEventListener implements IEslEventListener { - private static Logger log = Red5LoggerFactory.getLogger(ESLEventListener.class, "bigbluebutton"); - - private static final String START_TALKING_EVENT = "start-talking"; - private static final String STOP_TALKING_EVENT = "stop-talking"; - private static final String START_RECORDING_EVENT = "start-recording"; - private static final String STOP_RECORDING_EVENT = "stop-recording"; - - private ConferenceEventListener conferenceEventListener; - - @Override - public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { - //Ignored, Noop - } - - @Override - public void backgroundJobResultReceived(EslEvent event) { - log.debug( "Background job result received [{}]", event ); - } - - @Override - public void exceptionCaught(ExceptionEvent e) { -// setChanged(); -// notifyObservers(e); - } - - private static final Pattern GLOBAL_AUDION_PATTERN = Pattern.compile("(GLOBAL_AUDIO)_(.*)$"); - private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); - - @Override - public void conferenceEventJoin(String uniqueId, String confName, int confSize, EslEvent event) { - - Integer memberId = this.getMemberIdFromEvent(event); - Map headers = event.getEventHeaders(); - String callerId = this.getCallerIdFromEvent(event); - String callerIdName = this.getCallerIdNameFromEvent(event); - boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue - boolean speaking = headers.get("Talking").equals("true") ? true : false; - - String voiceUserId = callerIdName; - - log.info("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); - - Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); - if (gapMatcher.matches()) { - log.debug("Ignoring GLOBAL AUDIO USER [{}]", callerIdName); - return; - } - - Matcher matcher = CALLERNAME_PATTERN.matcher(callerIdName); - if (matcher.matches()) { - voiceUserId = matcher.group(1).trim(); - callerIdName = matcher.group(2).trim(); - } - - VoiceUserJoinedEvent pj = new VoiceUserJoinedEvent(voiceUserId, memberId.toString(), confName, callerId, callerIdName, muted, speaking); - conferenceEventListener.handleConferenceEvent(pj); - } - - @Override - public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - log.info("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); - conferenceEventListener.handleConferenceEvent(pl); - } - - @Override - public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); - log.info("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); - conferenceEventListener.handleConferenceEvent(pm); - } - - @Override - public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); - log.info("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); - conferenceEventListener.handleConferenceEvent(pm); - } - - @Override - public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - VoiceUserTalkingEvent pt; - - System.out.println("******************** Receive conference Action [" + action + "]"); - - if (action == null) { - return; - } - - if (action.equals(START_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); - conferenceEventListener.handleConferenceEvent(pt); - } else if (action.equals(STOP_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); - conferenceEventListener.handleConferenceEvent(pt); - } else { - log.debug("Unknown conference Action [{}]", action); - System.out.println("Unknown conference Action [" + action + "]"); - } - } - - @Override - public void conferenceEventTransfer(String uniqueId, String confName, int confSize, EslEvent event) { - //Ignored, Noop - } - - @Override - public void conferenceEventThreadRun(String uniqueId, String confName, int confSize, EslEvent event) { - - } - - //@Override - public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) { - String action = event.getEventHeaders().get("Action"); - - if(action == null) { - return; - } - - if (log.isDebugEnabled()) - log.debug("Handling conferenceEventRecord " + action); - - if (action.equals(START_RECORDING_EVENT)) { - VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); - sre.setRecordingFilename(getRecordFilenameFromEvent(event)); - sre.setTimestamp(genTimestamp().toString()); - - log.info("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); - - conferenceEventListener.handleConferenceEvent(sre); - } else if (action.equals(STOP_RECORDING_EVENT)) { - VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false); - srev.setRecordingFilename(getRecordFilenameFromEvent(event)); - srev.setTimestamp(genTimestamp().toString()); - - log.info("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); - conferenceEventListener.handleConferenceEvent(srev); - } else { - if (log.isDebugEnabled()) - log.warn("Processing UNKNOWN conference Action {}", action); - } - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void eventReceived(EslEvent event) { - System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]"); -// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) { -//// setChanged(); -// notifyObservers(event); -// return; -// } - } - - private Integer getMemberIdFromEvent(EslEvent e) { - return new Integer(e.getEventHeaders().get("Member-ID")); - } - - private String getCallerIdFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Number"); - } - - private String getCallerIdNameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Name"); - } - - private String getRecordFilenameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Path"); - } - - /*private String getRecordTimestampFromEvent(EslEvent e) { - return e.getEventHeaders().get("Event-Date-Timestamp"); - }*/ - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java deleted file mode 100644 index 42b4eb6574..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java +++ /dev/null @@ -1,205 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch; - -import java.io.File; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class FreeswitchApplication implements ConferenceServiceProvider { - private static Logger log = Red5LoggerFactory.getLogger( FreeswitchApplication.class, "bigbluebutton" ); - - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - private ConnectionManager manager; - - private String icecastProtocol = "shout"; - private String icecastHost = "localhost"; - private int icecastPort = 8000; - private String icecastUsername = "source"; - private String icecastPassword = "hackme"; - private String icecastStreamExtension = ".mp3"; - private Boolean icecastBroadcast = false; - - private final String USER = "0"; /* not used for now */ - - private volatile boolean sendMessages = false; - - private void queueMessage(FreeswitchCommand command) { - try { - messages.offer(command, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public void populateRoom(String room) { - PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); - queueMessage(prc); - } - - public void mute(String room, String participant, Boolean mute) { - MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); - queueMessage(mpc); - } - - public void eject(String room, String participant) { - EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); - queueMessage(mpc); - } - - @Override - public void ejectAll(String room) { - EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); - queueMessage(mpc); - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void record(String room, String meetingid){ - String RECORD_DIR = "/var/freeswitch/meetings"; - String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; - - RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); - queueMessage(rcc); - } - - @Override - public void broadcast(String room, String meetingid) { - if (icecastBroadcast) { - broadcastToIcecast(room, meetingid); - } - } - - private void broadcastToIcecast(String room, String meetingid) { - String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort - + File.separatorChar + meetingid + "." + icecastStreamExtension; - - BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); - queueMessage(rcc); - } - - public void setConnectionManager(ConnectionManager manager) { - this.manager = manager; - } - - public void setIcecastProtocol(String protocol) { - icecastProtocol = protocol; - } - - public void setIcecastHost(String host) { - icecastHost = host; - } - - public void setIcecastPort(int port) { - icecastPort = port; - } - - public void setIcecastUsername(String username) { - icecastUsername = username; - } - - public void setIcecastPassword(String password) { - icecastPassword = password; - } - - public void setIcecastBroadcast(Boolean broadcast) { - icecastBroadcast = broadcast; - } - - public void setIcecastStreamExtension(String ext) { - icecastStreamExtension = ext; - } - - private void sendMessageToFreeswitch(final FreeswitchCommand command) { - Runnable task = new Runnable() { - public void run() { - if (command instanceof PopulateRoomCommand) { - PopulateRoomCommand cmd = (PopulateRoomCommand) command; - log.debug("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); - manager.getUsers(cmd); - } else if (command instanceof MuteParticipantCommand) { - MuteParticipantCommand cmd = (MuteParticipantCommand) command; - log.debug("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.mute(cmd); - } else if (command instanceof EjectParticipantCommand) { - EjectParticipantCommand cmd = (EjectParticipantCommand) command; - log.debug("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.eject(cmd); - } else if (command instanceof EjectAllUsersCommand) { - EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; - log.debug("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); - manager.ejectAll(cmd); - } else if (command instanceof RecordConferenceCommand) { - manager.record((RecordConferenceCommand) command); - } else if (command instanceof BroadcastConferenceCommand) { - manager.broadcast((BroadcastConferenceCommand) command); - } - } - }; - - runExec.execute(task); - } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - FreeswitchCommand message; - try { - message = messages.take(); - sendMessageToFreeswitch(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java deleted file mode 100755 index ad8c7e5f71..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java +++ /dev/null @@ -1,54 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class BroadcastConferenceCommand extends FreeswitchCommand { - - private static Logger log = Red5LoggerFactory.getLogger(BroadcastConferenceCommand.class, "bigbluebutton"); - private boolean record; - private String icecastPath; - - public BroadcastConferenceCommand(String room, String requesterId, boolean record, String icecastPath){ - super(room, requesterId); - this.record = record; - this.icecastPath = icecastPath; - } - - - @Override - public String getCommandArgs() { - String action = "norecord"; - if (record) - action = "record"; - - return SPACE + getRoom() + SPACE + action + SPACE + icecastPath; - } - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java deleted file mode 100755 index e4826d72ea..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public class EjectAllUsersCommand extends FreeswitchCommand { - - public EjectAllUsersCommand(String room, String requesterId) { - super(room, requesterId); - } - - @Override - public String getCommandArgs() { - return room + " kick all"; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java deleted file mode 100755 index 0924b164eb..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public class EjectParticipantCommand extends FreeswitchCommand { - - private final String participant; - - public EjectParticipantCommand(String room, String participant, String requesterId) { - super(room, requesterId); - this.participant = participant; - } - - @Override - public String getCommandArgs() { - return room + " kick " + participant; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java deleted file mode 100755 index db9800fa93..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public abstract class FreeswitchCommand { - public static final String SPACE = " "; - - protected final String room; - protected final String requesterId; - - public FreeswitchCommand(String room, String requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public String getCommand() { - return "conference"; //conference is default, override if needed. - } - - public abstract String getCommandArgs(); - - public String getRoom() { - return room; - } - - public String getRequesterId() { - return requesterId; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java deleted file mode 100755 index a54ab6dacc..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public class MuteParticipantCommand extends FreeswitchCommand { - - private final String participant; - private final Boolean mute; - - public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { - super(room, requesterId); - this.participant = participant; - this.mute = mute; - } - - @Override - public String getCommandArgs() { - String action = "unmute"; - if (mute) action = "mute"; - - return room + SPACE + action + SPACE + participant; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java deleted file mode 100755 index 1aeb7f64a7..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java +++ /dev/null @@ -1,119 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; -import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; -import org.xml.sax.SAXException; - -public class PopulateRoomCommand extends FreeswitchCommand { - private static Logger log = Red5LoggerFactory.getLogger(PopulateRoomCommand.class, "bigbluebutton"); - - public PopulateRoomCommand(String room, String requesterId) { - super(room, requesterId); - } - - @Override - public String getCommandArgs() { - return getRoom() + SPACE + "xml_list"; - } - - private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - String firstLine = response.getBodyLines().get(0); - - //E.g. Conference 85115 not found - - if(!firstLine.startsWith(". -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - -public class RecordConferenceCommand extends FreeswitchCommand { - - private static Logger log = Red5LoggerFactory.getLogger(RecordConferenceCommand.class, "bigbluebutton"); - private boolean record; - private String recordPath; - - public RecordConferenceCommand(String room, String requesterId, boolean record, String recordPath){ - super(room, requesterId); - this.record = record; - this.recordPath = recordPath; - } - - - @Override - public String getCommandArgs() { - String action = "norecord"; - if (record) - action = "record"; - - return SPACE + getRoom() + SPACE + action + SPACE + recordPath; - } - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java deleted file mode 100755 index 4e6caf9050..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java +++ /dev/null @@ -1,88 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.webconference.voice.freeswitch.response; - -/** - * - * @author leif - */ -public class ConferenceMember { - - protected Integer memberId; - protected ConferenceMemberFlags flags; - protected String uuid; - protected String callerIdName; - protected String callerId; - protected Integer joinTime; - protected Integer lastTalking; - - public Integer getId() { - return memberId; - } - - public ConferenceMemberFlags getFlags() { - return flags; - } - - public String getCallerId() { - return callerId; - } - - public String getCallerIdName() { - return callerIdName; - } - - public boolean getMuted() { - return flags.getIsMuted(); - } - - public boolean getSpeaking() { - return flags.getIsSpeaking(); - } - - public void setFlags(ConferenceMemberFlags flags) { - this.flags = flags; - } - - public void setId(int parseInt) { - memberId = parseInt; - } - - public void setUUID(String tempVal) { - this.uuid = tempVal; - } - - public void setCallerIdName(String tempVal) { - this.callerIdName = tempVal; - } - - public void setCallerId(String tempVal) { - this.callerId = tempVal; - } - - public void setJoinTime(int parseInt) { - this.joinTime = parseInt; - } - - void setLastTalking(int parseInt) { - this.lastTalking = parseInt; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java deleted file mode 100755 index be507e2c0d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java +++ /dev/null @@ -1,54 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.webconference.voice.freeswitch.response; - -/** - * - * @author leif - */ -public class ConferenceMemberFlags { - //private boolean canHear = false; - private boolean canSpeak = false; - private boolean talking = false; - //private boolean hasVideo = false; - //private boolean hasFloor = false; - //private boolean isModerator = false; - //private boolean endConference = false; - - boolean getIsSpeaking() { - return talking; - } - - boolean getIsMuted() { - if(canSpeak == true) { - return false; - } - return true; - } - - void setCanSpeak(String tempVal) { - canSpeak = tempVal.equals("true") ? true : false; - } - - void setTalking(String tempVal) { - talking = tempVal.equals("true") ? true : false; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java deleted file mode 100755 index 4a0b9db710..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java +++ /dev/null @@ -1,164 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.response; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * - * @author leif - */ -public class XMLResponseConferenceListParser extends DefaultHandler { - private static Logger log = Red5LoggerFactory.getLogger(XMLResponseConferenceListParser.class, "bigbluebutton"); - - private List myConfrenceMembers; - private String tempVal; - private ConferenceMember tempMember; - private ConferenceMemberFlags tempFlags; - private String room; - private boolean inFlags = false; - - public XMLResponseConferenceListParser() { - myConfrenceMembers = new ArrayList(); - } - - public String getConferenceRoom() { - return room; - } - - public void printConferneceMemebers() { - log.info("Number of Members found in room [{}] was ({}).", room, myConfrenceMembers.size()); - Iterator it = myConfrenceMembers.iterator(); - while(it.hasNext()) { - log.info("room [{}] member: [{}]", room, it.next().toString()); - } - } - - public List getConferenceList() { - return myConfrenceMembers; - } - - /* - - - - - - 6 - - true - true - false - false - true - false - false - - 3a16f061-0df6-45d5-b401-d8e977e08a5c - 1001 - 1001 - 65 - 4 - - - - - - */ - - - //SAX Event Handlers - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - //reset - inFlags = false; - tempVal = ""; - if(qName.equalsIgnoreCase("member")) { - //create a new instance of ConferenceMember - tempMember = new ConferenceMember(); - } - - if(qName.equalsIgnoreCase("flags")) { - //create a new instance of ConferenceMember - tempFlags = new ConferenceMemberFlags(); - inFlags = true; - } - - if(qName.equalsIgnoreCase("conference")) { - room = attributes.getValue("name"); - } - } - - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - tempVal = new String(ch,start,length); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - - if(qName.equalsIgnoreCase("member")) { - //add it to the list - myConfrenceMembers.add(tempMember); - }else if(qName.equalsIgnoreCase("flags")) { - tempMember.setFlags(tempFlags); - inFlags = false; - }else if(inFlags) { - if (qName.equalsIgnoreCase("can_speak")) { - tempFlags.setCanSpeak(tempVal); - }else if (qName.equalsIgnoreCase("talking")) { - tempFlags.setTalking(tempVal); - } - }else if (qName.equalsIgnoreCase("id")) { - try { - tempMember.setId(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { - log.error("cannot set ConferenceMember Id value [{}] NFE.", tempVal); - } - }else if (qName.equalsIgnoreCase("uuid")) { - tempMember.setUUID(tempVal); - }else if (qName.equalsIgnoreCase("caller_id_name")) { - tempMember.setCallerIdName(tempVal); - }else if (qName.equalsIgnoreCase("caller_id_number")) { - tempMember.setCallerId(tempVal); - }else if (qName.equalsIgnoreCase("join_time")) { - try { - tempMember.setJoinTime(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { - log.debug("cannot set setJoinTime value [{}] NFE.", tempVal); - } - }else if (qName.equalsIgnoreCase("last_talking")) { - try { - tempMember.setLastTalking(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { - log.debug("cannot set setLastTalking value [{}] NFE.", tempVal); - } - } - - } -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala deleted file mode 100755 index a4e615328d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.conference.voice.freeswitch - -class HeartbeatMonitor() { - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala deleted file mode 100755 index 4089357ed1..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ /dev/null @@ -1,181 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor._ -import akka.actor.ActorLogging -import akka.pattern.{ask, pipe} -import akka.util.Timeout -import scala.concurrent.duration._ -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.util._ -import org.bigbluebutton.core.api.ValidateAuthTokenTimedOut -import scala.util.Success -import scala.util.Failure - -object BigBlueButtonActor extends SystemConfiguration { - def props(system: ActorSystem, outGW: MessageOutGateway): Props = - Props(classOf[BigBlueButtonActor], system, outGW) -} - -class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) extends Actor with ActorLogging { - def actorRefFactory = context - implicit def executionContext = actorRefFactory.dispatcher - implicit val timeout = Timeout(5 seconds) - - private var meetings = new collection.immutable.HashMap[String, RunningMeeting] - - def receive = { - case msg: CreateMeeting => handleCreateMeeting(msg) - case msg: DestroyMeeting => handleDestroyMeeting(msg) - case msg: KeepAliveMessage => handleKeepAliveMessage(msg) - case msg: ValidateAuthToken => handleValidateAuthToken(msg) - case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) - case msg: InMessage => handleMeetingMessage(msg) - case _ => // do nothing - } - - private def handleValidateAuthToken(msg: ValidateAuthToken) { - meetings.get(msg.meetingID) foreach { m => - val future = m.actorRef.ask(msg)(5 seconds) - - future onComplete { - case Success(result) => { - log.debug("Got response from meeting=" + msg.meetingID + "].") - /** - * Received a reply from MeetingActor which means hasn't hung! - * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple - * audit to check whether the actor is still alive. (ralam feb 25, 2015) - */ - } - case Failure(failure) => { - log.warning("Failed to get response to from meeting=" + msg.meetingID + "]. Meeting has probably hung.") - outGW.send(new ValidateAuthTokenTimedOut(msg.meetingID, msg.userId, msg.token, false, msg.correlationId, msg.sessionId)) - } - } - } - } - - private def handleMeetingMessage(msg: InMessage):Unit = { - msg match { - case ucm: UserConnectedToGlobalAudio => { - val m = meetings.values.find( m => m.voiceBridge == ucm.voiceConf) - m foreach {mActor => mActor.actorRef ! ucm} - } - case udm: UserDisconnectedFromGlobalAudio => { - val m = meetings.values.find( m => m.voiceBridge == udm.voiceConf) - m foreach {mActor => mActor.actorRef ! udm} - } - case allOthers => { - meetings.get(allOthers.meetingID) match { - case None => handleMeetingNotFound(allOthers) - case Some(m) => { - // log.debug("Forwarding message [{}] to meeting [{}]", msg.meetingID) - m.actorRef ! allOthers - } - } - } - } - } - - private def handleMeetingNotFound(msg: InMessage) { - msg match { - case vat:ValidateAuthToken => { - log.info("No meeting [" + vat.meetingID + "] for auth token [" + vat.token + "]") - outGW.send(new ValidateAuthTokenReply(vat.meetingID, vat.userId, vat.token, false, vat.correlationId, vat.sessionId)) - } - case _ => { - log.info("No meeting [" + msg.meetingID + "] for message type [" + msg.getClass() + "]") - // do nothing - } - } - } - - private def handleKeepAliveMessage(msg: KeepAliveMessage):Unit = { - outGW.send(new KeepAliveMessageReply(msg.aliveID)) - } - - private def handleDestroyMeeting(msg: DestroyMeeting) { - log.info("BBBActor received DestroyMeeting message for meeting id [" + msg.meetingID + "]") - meetings.get(msg.meetingID) match { - case None => println("Could not find meeting id[" + msg.meetingID + "] to destroy.") - case Some(m) => { - m.actorRef ! StopMeetingActor - meetings -= msg.meetingID - log.info("Kick everyone out on meeting id[" + msg.meetingID + "].") - outGW.send(new EndAndKickAll(msg.meetingID, m.recorded)) - - log.info("Destroyed meeting id[" + msg.meetingID + "].") - outGW.send(new MeetingDestroyed(msg.meetingID)) - } - } - } - - private def handleCreateMeeting(msg: CreateMeeting):Unit = { - meetings.get(msg.meetingID) match { - case None => { - log.info("New meeting create request [" + msg.meetingName + "]") - var m = RunningMeeting(msg.meetingID, msg.externalMeetingID, msg.meetingName, msg.recorded, - msg.voiceBridge, msg.duration, - msg.autoStartRecording, msg.allowStartStopRecording, msg.moderatorPass, - msg.viewerPass, msg.createTime, msg.createDate, - outGW) - - meetings += m.meetingID -> m - outGW.send(new MeetingCreated(m.meetingID, m.externalMeetingID, m.recorded, m.meetingName, m.voiceBridge, msg.duration, - msg.moderatorPass, msg.viewerPass, msg.createTime, msg.createDate)) - - m.actorRef ! new InitializeMeeting(m.meetingID, m.recorded) - m.actorRef ! "StartTimer" - } - case Some(m) => { - log.info("Meeting already created [" + msg.meetingName + "]") - // do nothing - } - } - } - - private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { - - var len = meetings.keys.size - println("meetings.size=" + meetings.size) - println("len_=" + len) - - val set = meetings.keySet - val arr : Array[String] = new Array[String](len) - set.copyToArray(arr) - val resultArray : Array[MeetingInfo] = new Array[MeetingInfo](len) - - for(i <- 0 until arr.length) { - val id = arr(i) - val duration = meetings.get(arr(i)).head.duration - val name = meetings.get(arr(i)).head.meetingName - val recorded = meetings.get(arr(i)).head.recorded - val voiceBridge = meetings.get(arr(i)).head.voiceBridge - - var info = new MeetingInfo(id, name, recorded, voiceBridge, duration) - resultArray(i) = info - - //remove later - println("for a meeting:" + id) - println("Meeting Name = " + meetings.get(id).head.meetingName) - println("isRecorded = " + meetings.get(id).head.recorded) - println("voiceBridge = " + voiceBridge) - println("duration = " + duration) - - //send the users - self ! (new GetUsers(id, "nodeJSapp")) - - //send the presentation - self ! (new GetPresentationInfo(id, "nodeJSapp", "nodeJSapp")) - - //send chat history - self ! (new GetChatHistoryRequest(id, "nodeJSapp", "nodeJSapp")) - - //send lock settings - self ! (new GetLockSettings(id, "nodeJSapp")) - } - - outGW.send(new GetAllMeetingsReply(resultArray)) - } - -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala deleted file mode 100755 index f5cadeeaac..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api._ -import java.util.concurrent.CountDownLatch -import akka.actor.{ ActorSystem, Props } - -class BigBlueButtonGateway(outGW: MessageOutGateway) { - - implicit val system = ActorSystem("bigbluebutton-apps-system") - - val bbbActor = system.actorOf( - BigBlueButtonActor.props(system, outGW), - "bigbluebutton-actor") - - def accept(msg: InMessage):Unit = { - bbbActor ! msg - } - - def acceptKeepAlive(msg: KeepAliveMessage):Unit = { - bbbActor ! msg - } - -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala deleted file mode 100755 index 0a369c53de..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ /dev/null @@ -1,468 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.presentation.PreuploadedPresentationsUtil -import scala.collection.JavaConversions._ -import org.bigbluebutton.core.apps.poll.PollInGateway -import org.bigbluebutton.core.apps.layout.LayoutInGateway -import org.bigbluebutton.core.apps.chat.ChatInGateway -import scala.collection.JavaConversions._ -import org.bigbluebutton.core.apps.whiteboard.WhiteboardInGateway -import org.bigbluebutton.core.apps.voice.VoiceInGateway -import java.util.ArrayList -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.apps.presentation.Page -import org.bigbluebutton.core.apps.presentation.Presentation - -class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway, presUtil: PreuploadedPresentationsUtil) extends IBigBlueButtonInGW { - - // Meeting - def createMeeting2(meetingID: String, externalMeetingID:String, meetingName: String, record: Boolean, - voiceBridge: String, duration: Long, autoStartRecording: Boolean, - allowStartStopRecording: Boolean, moderatorPass: String, viewerPass: String, - createTime: Long, createDate: String) { -// println("******************** CREATING MEETING [" + meetingID + "] ***************************** ") - bbbGW.accept(new CreateMeeting(meetingID, externalMeetingID, meetingName, record, - voiceBridge, duration, autoStartRecording, - allowStartStopRecording, moderatorPass, viewerPass, - createTime, createDate)) - } - - def destroyMeeting(meetingID: String) { -// println("******************** DESTROY MEETING [" + meetingID + "] ***************************** ") - bbbGW.accept(new DestroyMeeting(meetingID)) - } - - def getAllMeetings(meetingID: String) { - println("******************** GET ALL MEETINGS ***************************** ") - bbbGW.accept(new GetAllMeetingsRequest("meetingId")) - } - - def isAliveAudit(aliveId:String) { - bbbGW.acceptKeepAlive(new KeepAliveMessage(aliveId)); - } - - def lockSettings(meetingID: String, locked: java.lang.Boolean, - lockSettings: java.util.Map[String, java.lang.Boolean]) { - - } - - def statusMeetingAudit(meetingID: String) { - - } - - def endMeeting(meetingID: String) { -// println("******************** END MEETING [" + meetingID + "] ***************************** ") - bbbGW.accept(new EndMeeting(meetingID)) - } - - def endAllMeetings() { - - } - - /************************************************************* - * Message Interface for Users - *************************************************************/ - def validateAuthToken(meetingId: String, userId: String, token: String, correlationId: String, sessionId: String) { -// println("******************** VALIDATE TOKEN [" + token + "] ***************************** ") - bbbGW.accept(new ValidateAuthToken(meetingId, userId, token, correlationId, sessionId)) - } - - def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String, authToken: String):Unit = { - val userRole = if (role == "MODERATOR") Role.MODERATOR else Role.VIEWER - bbbGW.accept(new RegisterUser(meetingID, userID, name, userRole, extUserID, authToken)) - } - - def sendLockSettings(meetingID: String, userId: String, settings: java.util.Map[String, java.lang.Boolean]) { - // Convert java.util.Map to scala.collection.immutable.Map - // settings.mapValues -> convaert java Map to scala mutable Map - // v => v.booleanValue() -> convert java Boolean to Scala Boolean - // toMap -> converts from scala mutable map to scala immutable map - val s = settings.mapValues (v => v.booleanValue() /* convert java Boolean to Scala Boolean */).toMap - val disableCam = s.getOrElse("disableCam", false) - val disableMic = s.getOrElse("disableMic", false) - val disablePrivChat = s.getOrElse("disablePrivateChat", false) - val disablePubChat = s.getOrElse("disablePublicChat", false) - val lockedLayout = s.getOrElse("lockedLayout", false) - var lockOnJoin = s.getOrElse("lockOnJoin", false) - var lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) - - val permissions = new Permissions(disableCam = disableCam, - disableMic = disableMic, - disablePrivChat = disablePrivChat, - disablePubChat = disablePubChat, - lockedLayout = lockedLayout, - lockOnJoin = lockOnJoin, - lockOnJoinConfigurable = lockOnJoinConfigurable) - - bbbGW.accept(new SetLockSettings(meetingID, userId, permissions)) - } - - def initLockSettings(meetingID: String, settings: java.util.Map[String, java.lang.Boolean]) { - // Convert java.util.Map to scala.collection.immutable.Map - // settings.mapValues -> convert java Map to scala mutable Map - // v => v.booleanValue() -> convert java Boolean to Scala Boolean - // toMap -> converts from scala mutable map to scala immutable map - val s = settings.mapValues (v => v.booleanValue() /* convert java Boolean to Scala Boolean */).toMap - val disableCam = s.getOrElse("disableCam", false) - val disableMic = s.getOrElse("disableMic", false) - val disablePrivChat = s.getOrElse("disablePrivateChat", false) - val disablePubChat = s.getOrElse("disablePublicChat", false) - val lockedLayout = s.getOrElse("lockedLayout", false) - val lockOnJoin = s.getOrElse("lockOnJoin", false) - val lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) - val permissions = new Permissions(disableCam = disableCam, - disableMic = disableMic, - disablePrivChat = disablePrivChat, - disablePubChat = disablePubChat, - lockedLayout = lockedLayout, - lockOnJoin = lockOnJoin, - lockOnJoinConfigurable = lockOnJoinConfigurable) - - bbbGW.accept(new InitLockSettings(meetingID, permissions)) - } - - - - def initAudioSettings(meetingID: String, requesterID: String, muted: java.lang.Boolean) { - bbbGW.accept(new InitAudioSettings(meetingID, requesterID, muted.booleanValue())) - } - - def getLockSettings(meetingId: String, userId: String) { - bbbGW.accept(new GetLockSettings(meetingId, userId)) - } - - def lockUser(meetingId: String, requesterID: String, lock: Boolean, userId: String) { - bbbGW.accept(new LockUserRequest(meetingId, requesterID, userId, lock)) - } - - def setRecordingStatus(meetingId: String, userId: String, recording: java.lang.Boolean) { - bbbGW.accept(new SetRecordingStatus(meetingId, userId, recording.booleanValue())) - } - - def getRecordingStatus(meetingId: String, userId: String) { - bbbGW.accept(new GetRecordingStatus(meetingId, userId)) - } - - - // Users - def userRaiseHand(meetingId: String, userId: String) { - bbbGW.accept(new UserRaiseHand(meetingId, userId)) - } - - def lowerHand(meetingId: String, userId: String, loweredBy: String) { - bbbGW.accept(new UserLowerHand(meetingId, userId, loweredBy)) - } - - def ejectUserFromMeeting(meetingId: String, userId: String, ejectedBy: String) { - bbbGW.accept(new EjectUserFromMeeting(meetingId, userId, ejectedBy)) - } - - def shareWebcam(meetingId: String, userId: String, stream: String) { - bbbGW.accept(new UserShareWebcam(meetingId, userId, stream)) - } - - def unshareWebcam(meetingId: String, userId: String, stream:String) { - bbbGW.accept(new UserUnshareWebcam(meetingId, userId, stream)) - } - - def setUserStatus(meetingID: String, userID: String, status: String, value: Object):Unit = { - bbbGW.accept(new ChangeUserStatus(meetingID, userID, status, value)); - } - - def getUsers(meetingID: String, requesterID: String):Unit = { - bbbGW.accept(new GetUsers(meetingID, requesterID)) - } - - def userLeft(meetingID: String, userID: String, sessionId: String):Unit = { - bbbGW.accept(new UserLeaving(meetingID, userID, sessionId)) - } - - def userJoin(meetingID: String, userID: String, authToken: String):Unit = { - bbbGW.accept(new UserJoining(meetingID, userID, authToken)) - } - - def assignPresenter(meetingID: String, newPresenterID: String, newPresenterName: String, assignedBy: String):Unit = { - bbbGW.accept(new AssignPresenter(meetingID, newPresenterID, newPresenterName, assignedBy)) - } - - def getCurrentPresenter(meetingID: String, requesterID: String):Unit = { - // do nothing - } - - def userConnectedToGlobalAudio(voiceConf: String, userid: String, name: String) { - // we are required to pass the meeting_id as first parameter (just to satisfy trait) - // but it's not used anywhere. That's why we pass voiceConf twice instead - bbbGW.accept(new UserConnectedToGlobalAudio(voiceConf, voiceConf, userid, name)) - } - - def userDisconnectedFromGlobalAudio(voiceConf: String, userid: String, name: String) { - // we are required to pass the meeting_id as first parameter (just to satisfy trait) - // but it's not used anywhere. That's why we pass voiceConf twice instead - bbbGW.accept(new UserDisconnectedFromGlobalAudio(voiceConf, voiceConf, userid, name)) - } - - /************************************************************************************** - * Message Interface for Presentation - **************************************************************************************/ - - def clear(meetingID: String) { - bbbGW.accept(new ClearPresentation(meetingID)) - } - - def sendConversionUpdate(messageKey: String, meetingId: String, - code: String, presentationId: String, presName: String) { - bbbGW.accept(new PresentationConversionUpdate(meetingId, messageKey, - code, presentationId, presName)) - } - - def sendPageCountError(messageKey: String, meetingId: String, - code: String, presentationId: String, numberOfPages: Int, - maxNumberPages: Int, presName: String) { - bbbGW.accept(new PresentationPageCountError(meetingId, messageKey, - code, presentationId, numberOfPages, maxNumberPages, presName)) - } - - def sendSlideGenerated(messageKey: String, meetingId: String, - code: String, presentationId: String, numberOfPages: Int, - pagesCompleted: Int, presName: String) { - bbbGW.accept(new PresentationSlideGenerated(meetingId, messageKey, - code, presentationId, numberOfPages, pagesCompleted, presName)) - } - - def generatePresentationPages(presId: String, numPages: Int, presBaseUrl: String):scala.collection.immutable.HashMap[String, Page] = { - var pages = new scala.collection.immutable.HashMap[String, Page] - val baseUrl = - for (i <- 1 to numPages) { - val id = presId + "/" + i - val num = i; - val current = if (i == 1) true else false - val thumbnail = presBaseUrl + "/thumbnail/" + i - val swfUri = presBaseUrl + "/slide/" + i - - val txtUri = presBaseUrl + "/textfiles/" + i - val pngUri = presBaseUrl + "/png/" + i - - val p = new Page(id=id, num=num, thumbUri=thumbnail, swfUri=swfUri, - txtUri=txtUri, pngUri=pngUri, - current=current) - pages += (p.id -> p) - } - - pages - } - - def sendConversionCompleted(messageKey: String, meetingId: String, - code: String, presentationId: String, numPages: Int, - presName: String, presBaseUrl: String) { -// println("******************** PRESENTATION CONVERSION COMPLETED MESSAGE ***************************** ") - val pages = generatePresentationPages(presentationId, numPages, presBaseUrl) - - val presentation = new Presentation(id=presentationId, name=presName, pages=pages) - bbbGW.accept(new PresentationConversionCompleted(meetingId, messageKey, - code, presentation)) - - } - - def removePresentation(meetingID: String, presentationID: String) { - bbbGW.accept(new RemovePresentation(meetingID, presentationID)) - } - - def getPresentationInfo(meetingID: String, requesterID: String, replyTo: String) { -// println("**** Forwarding GetPresentationInfo for meeting[" + meetingID + "] ****") - bbbGW.accept(new GetPresentationInfo(meetingID, requesterID, replyTo)) - } - - def sendCursorUpdate(meetingID: String, xPercent: Double, yPercent: Double) { - bbbGW.accept(new SendCursorUpdate(meetingID, xPercent, yPercent)) - } - - def resizeAndMoveSlide(meetingID: String, xOffset: Double, yOffset: Double, widthRatio: Double, heightRatio: Double) { - bbbGW.accept(new ResizeAndMoveSlide(meetingID, xOffset, yOffset, widthRatio, heightRatio)) - } - - def gotoSlide(meetingID: String, pageId: String) { -// println("**** Forwarding GotoSlide for meeting[" + meetingID + "] ****") - bbbGW.accept(new GotoSlide(meetingID, pageId)) - } - - def sharePresentation(meetingID: String, presentationID: String, share: Boolean) { - bbbGW.accept(new SharePresentation(meetingID, presentationID, share)) - } - - def getSlideInfo(meetingID: String, requesterID: String, replyTo: String) { - bbbGW.accept(new GetSlideInfo(meetingID, requesterID, replyTo)) - } - - /************************************************************** - * Message Interface Polling - **************************************************************/ - val pollGW = new PollInGateway(bbbGW) - - def getPolls(meetingID: String, requesterID: String) { - pollGW.getPolls(meetingID, requesterID) - } - - def preCreatedPoll(meetingID: String, msg: String) { - pollGW.preCreatedPoll(meetingID, msg) - } - - def createPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.createPoll(meetingID, requesterID, msg) - } - - def updatePoll(meetingID: String, requesterID: String, msg: String) { - pollGW.updatePoll(meetingID, requesterID, msg) - } - - def startPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.startPoll(meetingID, requesterID, msg) - } - - def stopPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.stopPoll(meetingID, requesterID, msg) - } - - def removePoll(meetingID: String, requesterID: String, msg: String) { - pollGW.removePoll(meetingID, requesterID, msg) - } - - def respondPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.respondPoll(meetingID, requesterID, msg) - } - - def showPollResult(meetingID: String, requesterID: String, msg: String) { - pollGW.showPollResult(meetingID, requesterID, msg) - } - - def hidePollResult(meetingID: String, requesterID: String, msg: String) { - pollGW.hidePollResult(meetingID, requesterID, msg) - } - - /************************************************************************* - * Message Interface for Layout - *********************************************************************/ - val layoutGW = new LayoutInGateway(bbbGW) - - def getCurrentLayout(meetingID: String, requesterID: String) { - layoutGW.getCurrentLayout(meetingID, requesterID) - } - - def broadcastLayout(meetingID: String, requesterID: String, layout: String) { - layoutGW.broadcastLayout(meetingID, requesterID, layout) - } - - def lockLayout(meetingId: String, setById: String, - lock: Boolean, viewersOnly: Boolean, - layout: scala.Option[String]) { - layoutGW.lockLayout(meetingId, setById, lock, viewersOnly, layout) - } - - /********************************************************************* - * Message Interface for Chat - *******************************************************************/ - val chatGW = new ChatInGateway(bbbGW) - - def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { - chatGW.getChatHistory(meetingID, requesterID, replyTo) - } - - def sendPublicMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { - // Convert java Map to Scala Map, then convert Mutable map to immutable map - chatGW.sendPublicMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) - } - - def sendPrivateMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { - chatGW.sendPrivateMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) - } - - /********************************************************************* - * Message Interface for Whiteboard - *******************************************************************/ - val wbGW = new WhiteboardInGateway(bbbGW) - - def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) { - wbGW.sendWhiteboardAnnotation(meetingID, requesterID, mapAsScalaMap(annotation).toMap) - } - - def requestWhiteboardAnnotationHistory(meetingID: String, requestedID: String, whiteboardId: String, replyTo: String) { - wbGW.requestWhiteboardAnnotationHistory(meetingID, requestedID, whiteboardId, replyTo) - } - - def clearWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { - wbGW.clearWhiteboard(meetingID, requestedID, whiteboardId); - } - - def undoWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { - wbGW.undoWhiteboard(meetingID, requestedID, whiteboardId) - } - - def enableWhiteboard(meetingID: String, requestedID: String, enable: java.lang.Boolean) { - wbGW.enableWhiteboard(meetingID, requestedID, enable) - } - - def isWhiteboardEnabled(meetingID: String, requestedID: String, replyTo: String) { - wbGW.isWhiteboardEnabled(meetingID, requestedID, replyTo) - } - - /********************************************************************* - * Message Interface for Voice - *******************************************************************/ - val voiceGW = new VoiceInGateway(bbbGW) - - def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: java.lang.Boolean) { - voiceGW.muteAllExceptPresenter(meetingID, requesterID, mute) - } - - def muteAllUsers(meetingID: String, requesterID: String, mute: java.lang.Boolean) { - voiceGW.muteAllUsers(meetingID, requesterID, mute) - } - - def isMeetingMuted(meetingID: String, requesterID: String) { - voiceGW.isMeetingMuted(meetingID, requesterID) - } - - def muteUser(meetingID: String, requesterID: String, userID: String, mute: java.lang.Boolean) { - voiceGW.muteUser(meetingID, requesterID, userID, mute) - } - - def lockMuteUser(meetingID: String, requesterID: String, userID: String, lock: java.lang.Boolean) { - voiceGW.lockUser(meetingID, requesterID, userID, lock) - } - - def ejectUserFromVoice(meetingId: String, userId: String, ejectedBy: String) { - voiceGW.ejectUserFromVoice(meetingId, userId, ejectedBy) - } - - def voiceUserJoined(meetingId: String, userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, - muted: java.lang.Boolean, speaking: java.lang.Boolean) { - - voiceGW.voiceUserJoined(meetingId, userId, webUserId, - conference, callerIdNum, - callerIdName, muted, speaking) - } - - def voiceUserLeft(meetingId: String, userId: String) { - voiceGW.voiceUserLeft(meetingId, userId) - } - - def voiceUserLocked(meetingId: String, userId: String, locked: java.lang.Boolean) { - voiceGW.voiceUserLocked(meetingId, userId, locked) - } - - def voiceUserMuted(meetingId: String, userId: String, muted: java.lang.Boolean) { - voiceGW.voiceUserMuted(meetingId, userId, muted) - } - - def voiceUserTalking(meetingId: String, userId: String, talking: java.lang.Boolean) { - voiceGW.voiceUserTalking(meetingId, userId, talking) - } - - def voiceRecording(meetingId: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - voiceGW.voiceRecording(meetingId, recordingFile, - timestamp, recording) - } -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala deleted file mode 100755 index 08c96838d4..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala +++ /dev/null @@ -1,2163 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor._ -import akka.actor.ActorLogging -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList -import org.bigbluebutton.core.apps.poll.PollVO -import org.bigbluebutton.core.apps.presentation.Page -import org.bigbluebutton.core.apps.presentation.Presentation -import org.bigbluebutton.core.apps.chat.redis.ChatMessageToJsonConverter -import org.bigbluebutton.core.apps.presentation.redis.PesentationMessageToJsonConverter -import org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardMessageToJsonConverter -import org.bigbluebutton.core.meeting.MeetingMessageToJsonConverter -import org.bigbluebutton.core.apps.users.redis.UsersMessageToJsonConverter - -class CollectorActor(dispatcher: IDispatcher) extends Actor { - - def receive = { - //IN MESSAGES - case msg: CreateMeeting => handleCreateMeeting(msg) - case msg: InitializeMeeting => handleInitializeMeeting(msg) - case msg: DestroyMeeting => handleDestroyMeeting(msg) - case msg: StartMeeting => handleStartMeeting(msg) - case msg: EndMeeting => handleEndMeeting(msg) - case msg: LockSetting => handleLockSetting(msg) - case msg: LockUser => handleLockUser(msg) - case msg: InitLockSettings => handleInitLockSettings(msg) - case msg: InitAudioSettings => handleInitAudioSettings(msg) - case msg: SetLockSettings => handleSetLockSettings(msg) - case msg: GetLockSettings => handleGetLockSettings(msg) - case msg: ValidateAuthToken => handleValidateAuthToken(msg) - case msg: RegisterUser => handleRegisterUser(msg) - case msg: UserJoining => handleUserJoining(msg) - case msg: UserLeaving => handleUserLeaving(msg) - case msg: GetUsers => handleGetUsers(msg) - case msg: UserRaiseHand => handleUserRaiseHand(msg) - case msg: UserLowerHand => handleUserLowerHand(msg) - case msg: UserShareWebcam => handleUserShareWebcam(msg) - case msg: UserUnshareWebcam => handleUserUnshareWebcam(msg) - case msg: ChangeUserStatus => handleChangeUserStatus(msg) - case msg: AssignPresenter => handleAssignPresenter(msg) - case msg: SetRecordingStatus => handleSetRecordingStatus(msg) - case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) - case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) - case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) - case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) - case msg: PreCreatedPoll => handlePreCreatedPoll(msg) - case msg: CreatePoll => handleCreatePoll(msg) - case msg: UpdatePoll => handleUpdatePoll(msg) - case msg: GetPolls => handleGetPolls(msg) - case msg: DestroyPoll => handleDestroyPoll(msg) - case msg: RemovePoll => handleRemovePoll(msg) - case msg: SharePoll => handleSharePoll(msg) - case msg: ShowPollResult => handleShowPollResult(msg) - case msg: HidePollResult => handleHidePollResult(msg) - case msg: StopPoll => handleStopPoll(msg) - case msg: StartPoll => handleStartPoll(msg) - case msg: ClearPoll => handleClearPoll(msg) - case msg: GetPollResult => handleGetPollResult(msg) - case msg: RespondToPoll => handleRespondToPoll(msg) - case msg: ClearPresentation => handleClearPresentation(msg) - case msg: RemovePresentation => handleRemovePresentation(msg) - case msg: GetPresentationInfo => handleGetPresentationInfo(msg) - //case msg: SendCursorUpdate => handleSendCursorUpdate(msg) - case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) - case msg: GotoSlide => handleGotoSlide(msg) - case msg: SharePresentation => handleSharePresentation(msg) - case msg: GetSlideInfo => handleGetSlideInfo(msg) - case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) - case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) - case msg: PresentationPageCountError => handlePresentationPageCountError(msg) - case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) - case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) - case msg: SendVoiceUsersRequest => handleSendVoiceUsersRequest(msg) - case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) - case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) - case msg: MuteUserRequest => handleMuteUserRequest(msg) - case msg: LockUserRequest => handleLockUserRequest(msg) - case msg: EjectUserFromVoiceRequest => handleEjectUserFromVoiceRequest(msg) - case msg: VoiceUserJoinedMessage => handleVoiceUserJoinedMessage(msg) - case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - case msg: VoiceUserLocked => handleVoiceUserLocked(msg) - case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - case msg: VoiceUserTalking => handleVoiceUserTalking(msg) - case msg: VoiceRecording => handleVoiceRecording(msg) - case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) - case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) - case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) - case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) - case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) - case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) - case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) - - //OUT MESSAGES - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) - case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingHasEnded => handleMeetingHasEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) - case msg: DisconnectUser => handleDisconnectUser(msg) - case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) - case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) - case msg: UserLocked => handleUserLocked(msg) - case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) - case msg: UserRegistered => handleUserRegistered(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: PresenterAssigned => handlePresenterAssigned(msg) - case msg: EndAndKickAll => handleEndAndKickAll(msg) - case msg: GetUsersReply => handleGetUsersReply(msg) - case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) - case msg: GetCurrentLayoutReply => handleGetCurrentLayoutReply(msg) - case msg: BroadcastLayoutEvent => handleBroadcastLayoutEvent(msg) - case msg: GetPollResultReply => handleGetPollResultReply(msg) - case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) - case msg: ClearPollFailed => handleClearPollFailed(msg) - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) - case msg: PollHideResultOutMsg => handlePollHideResultOutMsg(msg) - case msg: PollShowResultOutMsg => handlePollShowResultOutMsg(msg) - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) - //case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) - case msg: GetPreuploadedPresentationsOutMsg => handleGetPreuploadedPresentationsOutMsg(msg) - case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) - case msg: PresentationConversionError => handlePresentationConversionError(msg) - case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) - case msg: PresentationConversionDone => handlePresentationConversionDone(msg) - case msg: PresentationChanged => handlePresentationChanged(msg) - case msg: GetPresentationStatusReply => handleGetPresentationStatusReply(msg) - case msg: PresentationRemoved => handlePresentationRemoved(msg) - case msg: PageChanged => handlePageChanged(msg) - case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) - case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) - case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) - - case _ => // do nothing - } - - private def buildUserHashMap(user: UserVO):java.util.HashMap[String, Object] = { - val vu = user.voiceUser - val vuser = new java.util.HashMap[String, Object]() - vuser.put(Constants.USER_ID, vu.userId) - vuser.put(Constants.WEB_USER_ID, vu.webUserId) - vuser.put(Constants.CALLER_ID_NAME, vu.callerName) - vuser.put(Constants.CALLER_ID_NUM, vu.callerNum) - vuser.put(Constants.JOINED, vu.joined:java.lang.Boolean) - vuser.put(Constants.LOCKED, vu.locked:java.lang.Boolean) - vuser.put(Constants.MUTED, vu.muted:java.lang.Boolean) - vuser.put(Constants.TALKING, vu.talking:java.lang.Boolean) - - val wuser = new java.util.HashMap[String, Object]() - wuser.put(Constants.USER_ID, user.userID) - wuser.put(Constants.EXT_USER_ID, user.externUserID) - wuser.put(Constants.NAME, user.name) - wuser.put(Constants.ROLE, user.role.toString()) - wuser.put(Constants.RAISE_HAND, user.raiseHand:java.lang.Boolean) - wuser.put(Constants.PRESENTER, user.presenter:java.lang.Boolean) - wuser.put(Constants.HAS_STREAM, user.hasStream:java.lang.Boolean) - wuser.put(Constants.LOCKED, user.locked:java.lang.Boolean) - wuser.put("webcamStream", user.webcamStreams mkString("|")) - wuser.put(Constants.PHONE_USER, user.phoneUser:java.lang.Boolean) - wuser.put(Constants.VOICE_USER, vuser) - - wuser - } - - private def buildJson(header: java.util.HashMap[String, Any], - payload: java.util.HashMap[String, Any]): String = { - - val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() - message.put(Constants.HEADER, header) - message.put(Constants.PAYLOAD, payload) - - val gson = new Gson() - gson.toJson(message) - } - - // IN MESSAGES - private def handleCreateMeeting(msg: CreateMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) - payload.put(Constants.MEETING_NAME, msg.meetingName) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.VOICE_CONF, msg.voiceBridge) - payload.put(Constants.DURATION, msg.duration) - payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) - payload.put(Constants.VIEWER_PASS, msg.viewerPass) - payload.put(Constants.CREATE_TIME, msg.createTime) - payload.put(Constants.CREATE_DATE, msg.createDate) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CREATE_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CREATE MEETING *****************") - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleInitializeMeeting(msg: InitializeMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.INITIALIZE_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING INITIALIZE MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleDestroyMeeting(msg: DestroyMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DESTROY_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING DESTROY MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStartMeeting(msg: StartMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.START_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING START MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEndMeeting(msg: EndMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING END MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockSetting(msg: LockSetting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.LOCKED, msg.locked) - - val settingsMap = new java.util.HashMap[String, Boolean]() - for ((key, value) <- msg.settings) { - settingsMap.put(key, value) - } - - payload.put("settings", settingsMap) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING LOCK SETTING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockUser(msg: LockUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCK, msg.lock) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING LOCK USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleInitLockSettings(msg: InitLockSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.settings.toString()) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.INIT_LOCK_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING INIT LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleInitAudioSettings(msg: InitAudioSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MUTED, msg.muted.toString()) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.INIT_AUDIO_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING INIT LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSetLockSettings(msg: SetLockSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.settings.toString()) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SET_LOCK_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SET LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetLockSettings(msg: GetLockSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_LOCK_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleValidateAuthToken(msg: ValidateAuthToken) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.AUTH_TOKEN, msg.token) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VALIDATE AUTH TOKEN *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRegisterUser(msg: RegisterUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.NAME, msg.name) - payload.put(Constants.ROLE, msg.role.toString()) - payload.put(Constants.EXT_USER_ID, msg.extUserID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.REGISTER_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING REGISTER USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserJoining(msg: UserJoining) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_JOINING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING HANDLE USER JOINING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLeaving(msg: UserLeaving) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LEAVING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING HANDLE USER LEAVING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetUsers(msg: GetUsers) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_USERS) - - /** - * Let's temporarily have this convention as correlationId - */ - val replyTo = msg.meetingID + "/" + msg.requesterID - header.put(Constants.REPLY_TO, replyTo) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING HANDLE GET USERS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserRaiseHand(msg: UserRaiseHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.RAISE_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER RAISE HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLowerHand(msg: UserLowerHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOWERED_BY, msg.loweredBy) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.LOWER_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER LOWER HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserShareWebcam(msg: UserShareWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.STREAM, msg.stream) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_SHARE_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER SHARE WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserUnshareWebcam(msg: UserUnshareWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_UNSHARE_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER UNSHARE WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleChangeUserStatus(msg: ChangeUserStatus) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STATUS, msg.status) - payload.put(Constants.VALUE, msg.value) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CHANGE_USER_STATUS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CHANGE USER STATUS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleAssignPresenter(msg: AssignPresenter) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.NEW_PRESENTER_ID, msg.newPresenterID) - payload.put(Constants.NEW_PRESENTER_NAME, msg.newPresenterName) - payload.put(Constants.ASSIGNED_BY, msg.assignedBy) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.ASSIGN_PRESENTER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING ASSIGN PRESENTER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSetRecordingStatus(msg: SetRecordingStatus) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SET_RECORDING_STATUS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SET RECORDING STATUS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_CHAT_HISTORY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET CHAT HISTORY REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val messageMap = new java.util.HashMap[String, String]() - for ((key, value) <- msg.message) { - messageMap.put(key, value) - } - payload.put("message", messageMap) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_PUBLIC_MESSAGE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SEND PUBLIC MESSAGE REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val messageMap = new java.util.HashMap[String, String]() - for ((key, value) <- msg.message) { - messageMap.put(key, value) - } - payload.put("message", messageMap) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_PRIVATE_CHAT_MESSAGE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SEND PRIVATE MESSAGE REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET CURRENT LAYOUT REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT, msg.layout) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockLayoutRequest(msg: LockLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.setById) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.UNLOCK_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePreCreatedPoll(msg: PreCreatedPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL, msg.poll) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRECREATED_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PRE CREATED POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleCreatePoll(msg: CreatePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL, msg.poll) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CREATE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CREATE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUpdatePoll(msg: UpdatePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL, msg.poll) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.UPDATE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING UPDATE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPolls(msg: GetPolls) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLLS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET POLLS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleDestroyPoll(msg: DestroyPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DESTROY_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING DESTROY POLLS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRemovePoll(msg: RemovePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.REMOVE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING REMOVE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSharePoll(msg: SharePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SHARE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SHARE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleShowPollResult(msg: ShowPollResult) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SHOW_POLL_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SHOW POLL RESULTS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleHidePollResult(msg: HidePollResult) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.HIDE_POLL_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING HIDE POLL RESULTS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStopPoll(msg: StopPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.STOP_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING STOP POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStartPoll(msg: StartPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.START_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING START POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPoll(msg: ClearPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.FORCE, msg.force) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CLEAR POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPollResult(msg: GetPollResult) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLL_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET POLL RESULT *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRespondToPoll(msg: RespondToPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.RESPONSE, msg.response) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.RESPONT_TO_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING RESPOND TO POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPresentation(msg: ClearPresentation) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_PRESENTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CLEAR PRESENTATION *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRemovePresentation(msg: RemovePresentation) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.REMOVE_PRESENTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING REMOVE PRESENTATION *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPresentationInfo(msg: GetPresentationInfo) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_PRESENTATION_INFO) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET PRESENTATION INFO *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - /*private def handleSendCursorUpdate(msg: SendCursorUpdate) { - var map = new java.util.HashMap[String, Any]() - map.put("meetingID", msg.meetingID) - map.put("xPercent", msg.xPercent) - map.put("yPercent", msg.yPercent) - map.put("timestamp", TimestampGenerator.generateTimestamp) - - println("***** DISPATCHING SEND CURSOR UPDATE *****************") - dispatcher.dispatch(buildJson(header, payload)) - }*/ - - private def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.X_OFFSET, msg.xOffset) - payload.put(Constants.Y_OFFSET, msg.yOffset) - payload.put(Constants.WIDTH_RATIO, msg.widthRatio) - payload.put(Constants.HEIGHT_RATIO, msg.heightRatio) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.RESIZE_AND_MOVE_SLIDE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING RESIZE AND MOVE SLIDE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGotoSlide(msg: GotoSlide) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, msg.page) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GO_TO_SLIDE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GO TO SLIDE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSharePresentation(msg: SharePresentation) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationID) - payload.put(Constants.SHARE, msg.share) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SHARE_PRESENTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SHARE PRESENTATION *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetSlideInfo(msg: GetSlideInfo) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_SLIDE_INFO) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET SLIDE INFO *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePreuploadedPresentations(msg: PreuploadedPresentations) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATIONS, msg.presentations.toString()) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PREUPLOADED_PRESENTATIONS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PREUPLOADED PRESENTATIONS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presName) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_UPDATE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PRESENTATION CONVERSION UPDATE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationPageCountError(msg: PresentationPageCountError) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_COUNT_ERROR) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PRESENTATION PAGE COUNT ERROR *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_GENERATED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PRESENTATION SLIDE GENERATED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentation) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_COMPLETED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PRESENTATION CONVERSION COMPLETED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendVoiceUsersRequest(msg: SendVoiceUsersRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_VOICE_USERS_REQUEST) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SEND VOICE USERS REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleMuteMeetingRequest(msg: MuteMeetingRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTE, msg.mute) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.MUTE_MEETING_REQUEST) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING MUTE MEETING REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING IS MEETING MUTED REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleMuteUserRequest(msg: MuteUserRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.MUTE, msg.mute) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.MUTE_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING MUTE USER REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockUserRequest(msg: LockUserRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LOCK, msg.lock) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.LOCK_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING LOCK USER REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEjectUserFromVoiceRequest(msg: EjectUserFromVoiceRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.ejectedBy) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.EJECT_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING EJECT USER REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserJoinedMessage(msg: VoiceUserJoinedMessage) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.voiceConfId) - payload.put(Constants.CALLER_ID_NUM, msg.callerIdNum) - payload.put(Constants.CALLER_ID_NAME, msg.callerIdName) - payload.put(Constants.MUTED, msg.muted) - payload.put(Constants.TALKING, msg.talking) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED_MESSAGE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE USER JOINED MESSAGE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserJoined(msg: VoiceUserJoined) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.VOICE_USER, msg.voiceUser) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE USER JOINED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserLeft(msg: VoiceUserLeft) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_LEFT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE USER LEFT *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserLocked(msg: VoiceUserLocked) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCKED, msg.locked) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_LOCKED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE USER LOCKED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserMuted(msg: VoiceUserMuted) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.MUTED, msg.muted) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_MUTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE USER MUTED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserTalking(msg: VoiceUserTalking) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.TALKING, msg.talking) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_TALKING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE USER TALKING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceRecording(msg: VoiceRecording) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDING_FILE, msg.recordingFile) - payload.put(Constants.TIMESTAMP, msg.timestamp) - payload.put(Constants.RECORDING, msg.recording) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_RECORDING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VOICE RECORDING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ANNOTATION, msg.annotation) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_WHITEBOARD_ANNOTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SEND WHITEBOARD ANNOTATION REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_WHITEBOARD_SHAPES) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING SEND WHITEBOARD SHAPES REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_WHITEBOARD) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CLEAR WHITEBOARD REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.UNDO_WHITEBOARD) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING UNDO WHITEBOARD REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ENABLE, msg.enable) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.ENABLE_WHITEBOARD) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING ENABLE WHITEBOARD REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.IS_WHITEBOARD_ENABLED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING IS WHITEBOARD ENABLED REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { - println("***** DISPATCHING GET ALL MEETINGS REQUEST *****************") - } - - - - // OUT MESSAGES - private def handleMeetingCreated(msg: MeetingCreated) { - val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { - val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { - val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handleMeetingEnded(msg: MeetingEnded) { - val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleMeetingHasEnded(msg: MeetingHasEnded) { - val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DISCONNECT_ALL_USERS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING DISCONNECT ALL USERS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleDisconnectUser(msg: DisconnectUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DISCONNECT_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING DISCONNECT USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PERMISSION_SETTING_INITIALIZED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PERMISSIONS SETTING INIIALIZED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.NEW_PERMISSION_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING NEW PERMISSIONS SETTING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLocked(msg: UserLocked) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCKED, msg.lock) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LOCKED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER LOCKED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_PERMISSION_SETTINGS_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserRegistered(msg: UserRegistered) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_REGISTERED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER REGISTERED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLeft(msg: UserLeft) { - val json = UsersMessageToJsonConverter.userLeftToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresenterAssigned(msg: PresenterAssigned) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); - payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); - payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTER_ASSIGNED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING PRESENTER ASSIGNED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEndAndKickAll(msg: EndAndKickAll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_AND_KICK_ALL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING END AND KICK ALL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetUsersReply(msg: GetUsersReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val users = new ArrayList[java.util.HashMap[String, Object]]; - msg.users.foreach(uvo => { - users.add(buildUserHashMap(uvo)) - }) - - payload.put(Constants.USERS, users) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_USERS_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET USERS REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterId) - payload.put(Constants.AUTH_TOKEN, msg.token) - payload.put(Constants.VALID, msg.valid) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING VALIDATE AUTH TOKEN REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserJoined(msg: UserJoined) { - val json = UsersMessageToJsonConverter.userJoinedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleUserRaisedHand(msg: UserRaisedHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_RAISED_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER RAISED HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLoweredHand(msg: UserLoweredHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LOWERED_BY, msg.loweredBy) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LOWERED_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER LOWERED HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserSharedWebcam(msg: UserSharedWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_SHARED_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER SHARED WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_UNSHARED_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER UNSHARED WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserStatusChange(msg: UserStatusChange) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STATUS, msg.status) - payload.put(Constants.VALUE, msg.value) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_STATUS_CHANGED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER STATUS CHANGE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTE, msg.mute) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.MUTE_VOICE_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING MUTE VOICE USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserVoiceMuted(msg: UserVoiceMuted) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_VOICE_MUTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER VOICE MUTED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserVoiceTalking(msg: UserVoiceTalking) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_VOICE_TALKING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER VOICE TALKING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.EJECT_VOICE_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING EJECT VOICE USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_JOINED_VOICE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER JOINED VOICE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LEFT_VOICE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING USER LEFT VOICE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTED, msg.meetingMuted) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING IS MEETING MUTED REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStartRecording(msg: StartRecording) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.START_RECORDING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING START RECORDING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStopRecording(msg: StopRecording) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.STOP_RECORDING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING STOP RECORDING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { - val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { - val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetCurrentLayoutReply(msg: GetCurrentLayoutReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT_ID, msg.layoutID) - payload.put(Constants.LOCKED, msg.locked) - payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET CURRENT LAYOUT REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleBroadcastLayoutEvent(msg: BroadcastLayoutEvent) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT_ID, msg.layoutID) - payload.put(Constants.LOCKED, msg.locked) - payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING BROADCAST LAYOUT EVENT *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - - private def handleGetPollResultReply(msg: GetPollResultReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL, msg.pollVO) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLL_RESULT_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET POLL RESULT REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val collection = new ArrayList[PollVO](); - msg.polls.foreach(p => { - collection.add(p) - }) - - payload.put(Constants.POLLS, collection) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLLS_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING GET POLLS REPLY OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPollFailed(msg: ClearPollFailed) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.REASON, msg.reason) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_POLL_FAILED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING CLEAR POLL FAILED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_CLEARED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL CLEARED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_STARTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL STARTED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_STOPPED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL STOPPED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_REMOVED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL REMOVED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.POLL, msg.pollVO) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_UPDATED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL UPDATED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.POLL, msg.pollVO) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_CREATED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL CREATED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RESPONDER, msg.responder) - payload.put(Constants.RESPONSE, msg.response) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_RESPONSE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL RESPONSE OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollHideResultOutMsg(msg: PollHideResultOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_HIDE_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL HIDE RESULT OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollShowResultOutMsg(msg: PollShowResultOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_SHOW_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - -// println("***** DISPATCHING POLL SHOW RESULT OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) - // Comment out as we don't want to store cursor updates (ralam may 7, 2014) - //dispatcher.dispatch(json) - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { - val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { - val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationConversionError(msg: PresentationConversionError) { - val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { - val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationChanged(msg: PresentationChanged) { - val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { - val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationRemoved(msg: PresentationRemoved) { - val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePageChanged(msg: PageChanged) { - val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { - val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { - val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { - val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) - dispatcher.dispatch(json) - } - private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { - val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) - println("***** DISPATCHING GET ALL MEETINGS REPLY OUTMSG *****************") - dispatcher.dispatch(json) - } -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala deleted file mode 100755 index 5f21f668d1..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala +++ /dev/null @@ -1,22 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api.IDispatcher -import org.bigbluebutton.core.api.InMessage -import org.bigbluebutton.core.api.IOutMessage -import org.bigbluebutton.core.api.OutMessageListener2 - -class CollectorGateway(dispatcher: IDispatcher) extends OutMessageListener2 { - - // FIXME -// private val collActor = new CollectorActor(dispatcher) - -// collActor.start - - def collectInMessage(msg: InMessage) { -// collActor ! msg - } - - def handleMessage(msg: IOutMessage) { -// collActor ! msg - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala deleted file mode 100755 index 7a43464bcf..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala +++ /dev/null @@ -1,265 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor.Actor -import akka.actor.ActorRef -import akka.actor.ActorLogging -import akka.actor.Props -import akka.util.Timeout -import scala.concurrent.duration._ -import org.bigbluebutton.core.apps.poll.Poll -import org.bigbluebutton.core.apps.poll.PollApp -import org.bigbluebutton.core.apps.users.UsersApp -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.apps.presentation.PresentationApp -import org.bigbluebutton.core.apps.layout.LayoutApp -import org.bigbluebutton.core.apps.chat.ChatApp -import org.bigbluebutton.core.apps.whiteboard.WhiteboardApp -import java.util.concurrent.TimeUnit -import org.bigbluebutton.core.util._ -import akka.actor.ActorContext -import scala.concurrent.ExecutionContext.Implicits.global - -case object StopMeetingActor - -object MeetingActor { - def props(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, - voiceBridge: String, duration: Long, - autoStartRecording: Boolean, allowStartStopRecording: Boolean, - moderatorPass: String, viewerPass: String, - createTime: Long, createDate: String, - outGW: MessageOutGateway)(implicit context: ActorContext): Props = - Props(classOf[MeetingActor], meetingID, externalMeetingID, meetingName, recorded, - voiceBridge, duration, - autoStartRecording, allowStartStopRecording, - moderatorPass, viewerPass, - createTime, createDate, - outGW) -} - -class MeetingActor(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, - val voiceBridge: String, duration: Long, - val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, - val moderatorPass: String, val viewerPass: String, - val createTime: Long, val createDate: String, - val outGW: MessageOutGateway) - extends Actor with UsersApp with PresentationApp - with PollApp with LayoutApp with ChatApp - with WhiteboardApp with ActorLogging { - - var audioSettingsInited = false - var permissionsInited = false - var permissions = new Permissions() - var recording = false; - var muted = false; - var meetingEnded = false - - val TIMER_INTERVAL = 30000 - var hasLastWebUserLeft = false - var lastWebUserLeftOn:Long = 0 - - // FIXME -// class TimerActor(val timeout: Long, val who: Actor, val reply: String) extends Actor { -// def act { -// reactWithin(timeout) { -// case TIMEOUT => who ! reply -// } -// } -// } - - def receive = { - case "StartTimer" => handleStartTimer - case "Hello" => handleHello - case "MonitorNumberOfWebUsers" => handleMonitorNumberOfWebUsers() - case msg: ValidateAuthToken => handleValidateAuthToken(msg) - case msg: RegisterUser => handleRegisterUser(msg) - case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - case msg: VoiceUserTalking => handleVoiceUserTalking(msg) - case msg: UserJoining => handleUserJoin(msg) - case msg: UserLeaving => handleUserLeft(msg) - case msg: AssignPresenter => handleAssignPresenter(msg) - case msg: GetUsers => handleGetUsers(msg) - case msg: ChangeUserStatus => handleChangeUserStatus(msg) - case msg: EjectUserFromMeeting => handleEjectUserFromMeeting(msg) - case msg: UserRaiseHand => handleUserRaiseHand(msg) - case msg: UserLowerHand => handleUserLowerHand(msg) - case msg: UserShareWebcam => handleUserShareWebcam(msg) - case msg: UserUnshareWebcam => handleUserunshareWebcam(msg) - case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) - case msg: MuteAllExceptPresenterRequest => handleMuteAllExceptPresenterRequest(msg) - case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) - case msg: MuteUserRequest => handleMuteUserRequest(msg) - case msg: EjectUserFromVoiceRequest => handleEjectUserRequest(msg) - case msg: SetLockSettings => handleSetLockSettings(msg) - case msg: GetLockSettings => handleGetLockSettings(msg) - case msg: LockUserRequest => handleLockUserRequest(msg) - case msg: InitLockSettings => handleInitLockSettings(msg) - case msg: InitAudioSettings => handleInitAudioSettings(msg) - case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) - case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) - case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) - case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) - case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) - case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) - case msg: InitializeMeeting => handleInitializeMeeting(msg) - case msg: ClearPresentation => handleClearPresentation(msg) - case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) - case msg: PresentationPageCountError => handlePresentationPageCountError(msg) - case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) - case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) - case msg: RemovePresentation => handleRemovePresentation(msg) - case msg: GetPresentationInfo => handleGetPresentationInfo(msg) - case msg: SendCursorUpdate => handleSendCursorUpdate(msg) - case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) - case msg: GotoSlide => handleGotoSlide(msg) - case msg: SharePresentation => handleSharePresentation(msg) - case msg: GetSlideInfo => handleGetSlideInfo(msg) - case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) - case msg: PreCreatedPoll => handlePreCreatedPoll(msg) - case msg: CreatePoll => handleCreatePoll(msg) - case msg: UpdatePoll => handleUpdatePoll(msg) - case msg: DestroyPoll => handleDestroyPoll(msg) - case msg: RemovePoll => handleRemovePoll(msg) - case msg: SharePoll => handleSharePoll(msg) - case msg: StopPoll => handleStopPoll(msg) - case msg: StartPoll => handleStartPoll(msg) - case msg: ClearPoll => handleClearPoll(msg) - case msg: GetPolls => handleGetPolls(msg) - case msg: RespondToPoll => handleRespondToPoll(msg) - case msg: HidePollResult => handleHidePollResult(msg) - case msg: ShowPollResult => handleShowPollResult(msg) - case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) - case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) - case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) - case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) - case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) - case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) - case msg: SetRecordingStatus => handleSetRecordingStatus(msg) - case msg: GetRecordingStatus => handleGetRecordingStatus(msg) - case msg: VoiceRecording => handleVoiceRecording(msg) - - case msg: EndMeeting => handleEndMeeting(msg) - case StopMeetingActor => //exit - case _ => // do nothing - } - - def hasMeetingEnded():Boolean = { - meetingEnded - } - - private def handleStartTimer() { -// println("***************timer started******************") -// val timerActor = new TimerActor(2000, self, "Hello") -// timerActor.start - } - - private def handleHello() { -// println("***************hello received on [" + System.currentTimeMillis() + "]******************") - -// val timerActor = new TimerActor(2000, self, "Hello") -// timerActor.start - } - - def webUserJoined() { - if (users.numWebUsers > 0) { - lastWebUserLeftOn = 0 - } - } - - def startRecordingIfAutoStart() { - if (recorded && !recording && autoStartRecording && users.numWebUsers == 1) { - log.info("Auto start recording for meeting=[" + meetingID + "]") - recording = true - outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) - } - } - - def stopAutoStartedRecording() { - if (recorded && recording && autoStartRecording - && users.numWebUsers == 0) { - log.info("Last web user left. Auto stopping recording for meeting=[{}", meetingID) - recording = false - outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) - } - } - - def startCheckingIfWeNeedToEndVoiceConf() { - if (users.numWebUsers == 0) { - lastWebUserLeftOn = timeNowInMinutes - log.debug("MonitorNumberOfWebUsers started for meeting [" + meetingID + "]") - scheduleEndVoiceConference() - } - } - - def handleMonitorNumberOfWebUsers() { - if (users.numWebUsers == 0 && lastWebUserLeftOn > 0) { - if (timeNowInMinutes - lastWebUserLeftOn > 2) { - log.info("MonitorNumberOfWebUsers empty for meeting [" + meetingID + "]. Ejecting all users from voice.") - outGW.send(new EjectAllVoiceUsers(meetingID, recorded, voiceBridge)) - } else { - scheduleEndVoiceConference() - } - } - } - - private def scheduleEndVoiceConference() { - log.debug("MonitorNumberOfWebUsers continue for meeting [" + meetingID + "]") -// val timerActor = new TimerActor(TIMER_INTERVAL, self, "MonitorNumberOfWebUsers") -// timerActor.start -// context.system.scheduler.schedule(0 seconds, 2000 millis, self, "MonitorNumberOfWebUsers") - } - - def timeNowInMinutes():Long = { - TimeUnit.NANOSECONDS.toMinutes(System.nanoTime()) - } - - def sendMeetingHasEnded(userId: String) { - outGW.send(new MeetingHasEnded(meetingID, userId)) - outGW.send(new DisconnectUser(meetingID, userId)) - } - - private def handleEndMeeting(msg: EndMeeting) { - meetingEnded = true - outGW.send(new MeetingEnded(msg.meetingID, recorded, voiceBridge)) - outGW.send(new DisconnectAllUsers(msg.meetingID)) - } - - private def handleVoiceRecording(msg: VoiceRecording) { - if (msg.recording) { - outGW.send(new VoiceRecordingStarted(meetingID, - recorded, msg.recordingFile, - msg.timestamp, voiceBridge)) - } else { - outGW.send(new VoiceRecordingStopped(meetingID, recorded, - msg.recordingFile, msg.timestamp, voiceBridge)) - } - } - - private def handleSetRecordingStatus(msg: SetRecordingStatus) { - log.debug("Change recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") - if (allowStartStopRecording && recording != msg.recording) { - recording = msg.recording - log.debug("Sending recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") - outGW.send(new RecordingStatusChanged(meetingID, recorded, msg.userId, msg.recording)) - } - } - - private def handleGetRecordingStatus(msg: GetRecordingStatus) { - outGW.send(new GetRecordingStatusReply(meetingID, recorded, msg.userId, recording.booleanValue())) - } - - def lockLayout(lock: Boolean) { - permissions = permissions.copy(lockedLayout=lock) - } - - def newPermissions(np: Permissions) { - permissions = np - } - - def permissionsEqual(other: Permissions):Boolean = { - permissions == other - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala deleted file mode 100755 index 8eaebd5f55..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala +++ /dev/null @@ -1,37 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor.ActorRef -import akka.actor.ActorContext -import org.bigbluebutton.core.api.MessageOutGateway - -object RunningMeeting { - def apply(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, - voiceBridge: String, duration: Long, - autoStartRecording: Boolean, allowStartStopRecording: Boolean, - moderatorPass: String, viewerPass: String, - createTime: Long, createDate: String, - outGW: MessageOutGateway) - (implicit context: ActorContext) = - new RunningMeeting(meetingID, externalMeetingID, meetingName, recorded, - voiceBridge, duration, - autoStartRecording, allowStartStopRecording, - moderatorPass, viewerPass, - createTime, createDate, - outGW)(context) -} - -class RunningMeeting (val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, - val voiceBridge: String, val duration: Long, - val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, - val moderatorPass: String, val viewerPass: String, - val createTime: Long, val createDate: String, - val outGW: MessageOutGateway) - (implicit val context: ActorContext) { - - val actorRef = context.actorOf(MeetingActor.props(meetingID, externalMeetingID, meetingName, recorded, - voiceBridge, duration, - autoStartRecording, allowStartStopRecording, - moderatorPass, viewerPass, - createTime, createDate, - outGW), meetingID) -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala deleted file mode 100755 index 11e4373cfe..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.core - -import com.typesafe.config.ConfigFactory -import scala.util.Try - -trait SystemConfiguration { - - val config = ConfigFactory.load() - - lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") - - lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) - - lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") - - lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) - - lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") - lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/User.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/User.scala deleted file mode 100755 index 56ce8df5fb..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/User.scala +++ /dev/null @@ -1,29 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.api.Role._ - -class User(val intUserID: String, val extUserID: String, val name: String, val role: Role) { - - private var presenter = false - private var handRaised = false - private var hasStream = false - private var voiceId:String = _ - private var muted = false - private var talking = false - private var locked = false - - def isPresenter():Boolean = { - return presenter; - } - - def becomePresenter() { - presenter = true - } - - def unbecomePresenter() { - presenter = false - } -} - -case class VoiceUser(userId: String, muted: Boolean=false, talking: Boolean=false, locked: Boolean=false) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala deleted file mode 100755 index df46b038da..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala +++ /dev/null @@ -1,8 +0,0 @@ -package org.bigbluebutton.core.api - -class ConsoleDispatcher extends IDispatcher { - - def dispatch(jsonMessage: String) { - println(jsonMessage) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala deleted file mode 100644 index 1457829ac2..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala +++ /dev/null @@ -1,96 +0,0 @@ -package org.bigbluebutton.core.api - -object Constants { - val NAME = "name" - val HEADER = "header" - val PAYLOAD = "payload" - val MEETING_ID = "meeting_id" - val EXTERNAL_MEETING_ID = "external_meeting_id" - val TIMESTAMP = "timestamp" - val CURRENT_TIME = "current_time" - val USER_ID = "userid" - val RECORDED = "recorded" - val MEETING_NAME = "meeting_name" - val VOICE_CONF = "voice_conf" - val DURATION = "duration" - val AUTH_TOKEN = "auth_token" - val ROLE = "role" - val EXT_USER_ID = "external_user_id" - val REQUESTER_ID = "requester_id" - val REPLY_TO = "reply_to" - val LOWERED_BY = "lowered_by" - val STREAM = "stream" - val LOCKED = "locked" - val SETTINGS = "settings" - val LOCK = "lock" - val EXCEPT_USERS = "except_users" - val STATUS = "status" - val VALUE = "value" - val NEW_PRESENTER_ID = "new_presenter_id" - val NEW_PRESENTER_NAME = "new_presenter_name" - val ASSIGNED_BY = "assigned_by" - val RECORDING = "recording" - val LAYOUT_ID = "layout_id" - val LAYOUT = "layout" - val POLL = "poll" - val POLL_ID = "poll_id" - val FORCE = "force" - val RESPONSE = "response" - val PRESENTATION_ID = "presentation_id" - val X_OFFSET = "x_offset" - val Y_OFFSET = "y_offset" - val WIDTH_RATIO = "width_ratio" - val HEIGHT_RATIO = "height_ratio" - val PAGE = "page" - val SHARE = "share" - val PRESENTATIONS = "presentations" - val MESSAGE_KEY = "message_key" - val CODE = "code" - val PRESENTATION_NAME = "presentation_name" - val NUM_PAGES = "num_pages" - val MAX_NUM_PAGES = "max_num_pages" - val PAGES_COMPLETED = "pages_completed" - val MUTE = "mute" - val CALLER_ID_NUM = "caller_id_num" - val CALLER_ID_NAME = "caller_id_name" - val TALKING = "talking" - val USER = "user" - val MUTED = "muted" - val VOICE_USER = "voice_user" - val RECORDING_FILE = "recording_file" - val ANNOTATION = "annotation" - val WHITEBOARD_ID = "whiteboard_id" - val ENABLE = "enable" - val PRESENTER = "presenter" - val USERS = "users" - val RAISE_HAND = "raise_hand" - val HAS_STREAM = "has_stream" - val WEBCAM_STREAM = "webcam_stream" - val PHONE_USER = "phone_user" - val PERMISSIONS = "permissions" - val VALID = "valid" - val CHAT_HISTORY = "chat_history" - val MESSAGE = "message" - val SET_BY_USER_ID = "set_by_user_id" - val POLLS = "polls" - val REASON = "reason" - val RESPONDER = "responder" - val PRESENTATION_INFO = "presentation_info" - val SHAPES = "shapes" - val SHAPE = "shape" - val SHAPE_ID = "shape_id" - val PRESENTATION = "presentation" - val ID = "id" - val CURRENT = "current" - val PAGES = "pages" - val WEB_USER_ID = "web_user_id" - val JOINED = "joined" - val X_PERCENT = "x_percent" - val Y_PERCENT = "y_percent" - val KEEP_ALIVE_ID = "keep_alive_id" - val LISTEN_ONLY = "listen_only" - val MODERATOR_PASS = "moderator_pass" - val VIEWER_PASS = "viewer_pass" - val CREATE_TIME = "create_time" - val CREATE_DATE = "create_date" -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala deleted file mode 100755 index 207787fb9f..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala +++ /dev/null @@ -1,514 +0,0 @@ -package org.bigbluebutton.core.api - -import org.bigbluebutton.core.api.Role._ -import org.bigbluebutton.core.apps.poll._ -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import org.bigbluebutton.core.apps.presentation.Presentation - -trait InMessage {val meetingID: String} - -case class IsMeetingActorAliveMessage ( - meetingId:String -) - -case class KeepAliveMessage -( - aliveID:String -) - -case class CreateMeeting -( - meetingID: String, - externalMeetingID: String, - meetingName: String, - recorded: Boolean, - voiceBridge: String, - duration: Long, - autoStartRecording: Boolean, - allowStartStopRecording: Boolean, - moderatorPass: String, - viewerPass: String, - createTime: Long, - createDate: String -) extends InMessage - -case class InitializeMeeting( - meetingID: String, - recorded: Boolean) extends InMessage - -case class DestroyMeeting( - meetingID: String) extends InMessage - -case class StartMeeting( - meetingID: String) extends InMessage - -case class EndMeeting( - meetingID: String) extends InMessage - -case class LockSetting( - meetingID: String, - locked: Boolean, - settings: Map[String, Boolean]) extends InMessage - -// Lock -case class LockUser( - meetingID: String, - userId: String, - lock: Boolean) extends InMessage - -case class InitLockSettings( - meetingID: String, - settings: Permissions) extends InMessage - -case class SetLockSettings( - meetingID: String, - setByUser: String, - settings: Permissions -) extends InMessage - -case class GetLockSettings( - meetingID: String, - userId: String -) extends InMessage - -// Users -case class ValidateAuthToken( - meetingID: String, - userId: String, - token: String, - correlationId: String, - sessionId: String) extends InMessage - -case class RegisterUser( - meetingID: String, - userID: String, - name: String, - role: Role, - extUserID: String, - authToken: String -) extends InMessage - -case class UserJoining( - meetingID: String, - userID: String, - authToken: String -) extends InMessage - -case class UserLeaving( - meetingID: String, - userID: String, - sessionId: String -) extends InMessage - -case class GetUsers( - meetingID: String, - requesterID: String -) extends InMessage - -case class UserRaiseHand( - meetingID: String, - userId: String -) extends InMessage - -case class UserLowerHand( - meetingID: String, - userId: String, - loweredBy: String -) extends InMessage - -case class EjectUserFromMeeting(meetingID: String, userId: String, ejectedBy: String) extends InMessage - -case class UserShareWebcam( - meetingID: String, - userId: String, - stream: String -) extends InMessage - -case class UserUnshareWebcam( - meetingID: String, - userId: String, - stream: String -) extends InMessage - -case class ChangeUserStatus( - meetingID: String, - userID: String, - status: String, - value: Object -) extends InMessage - -case class AssignPresenter( - meetingID: String, - newPresenterID: String, - newPresenterName: String, - assignedBy: String -) extends InMessage - -case class SetRecordingStatus( - meetingID: String, - userId: String, - recording: Boolean -) extends InMessage - -case class GetRecordingStatus( - meetingID: String, - userId: String -) extends InMessage - -// Chat -case class GetChatHistoryRequest( - meetingID: String, - requesterID: String, - replyTo: String -) extends InMessage - -case class SendPublicMessageRequest( - meetingID: String, - requesterID: String, - message: Map[String, String] -) extends InMessage - -case class SendPrivateMessageRequest( - meetingID: String, - requesterID: String, - message: Map[String, String] -) extends InMessage - -case class UserConnectedToGlobalAudio( - meetingID: String, /** Not used. Just to satisfy trait **/ - voiceConf: String, - userid: String, - name: String -) extends InMessage - -case class UserDisconnectedFromGlobalAudio( - meetingID: String, /** Not used. Just to satisfy trait **/ - voiceConf: String, - userid: String, - name: String -) extends InMessage - -// Layout -case class GetCurrentLayoutRequest( - meetingID: String, - requesterID: String -) extends InMessage - -case class SetLayoutRequest( - meetingID: String, - requesterID: String, - layoutID: String -) extends InMessage - -case class LockLayoutRequest( - meetingID: String, - setById: String, - lock: Boolean, - viewersOnly: Boolean, - layout: Option[String] -) extends InMessage - -case class BroadcastLayoutRequest( - meetingID: String, - requesterID: String, - layout: String -) extends InMessage - -// Poll -case class PreCreatedPoll( - meetingID: String, - poll: PollVO -) extends InMessage - -case class CreatePoll( - meetingID: String, - requesterID: String, - poll: PollVO -) extends InMessage - -case class UpdatePoll( - meetingID: String, - requesterID: String, - poll: PollVO -) extends InMessage - -case class GetPolls( - meetingID: String, - requesterID: String -) extends InMessage - -case class DestroyPoll( - meetingID: String, - requesterID: String, - pollID: String -) extends InMessage - -case class RemovePoll( - meetingID: String, - requesterID: String, - pollID: String -) extends InMessage - -case class SharePoll( - meetingID: String, - requesterID: String, - pollID: String -) extends InMessage - -case class ShowPollResult( - meetingID: String, - requesterID: String, - pollID: String -) extends InMessage - -case class HidePollResult( - meetingID: String, - requesterID: String, - pollID: String -) extends InMessage - -case class StopPoll( - meetingID:String, - requesterID: String, - pollID: String -) extends InMessage - -case class StartPoll( - meetingID:String, - requesterID: String, - pollID: String -) extends InMessage - -case class ClearPoll( - meetingID: String, - requesterID: String, - pollID: String, - force: Boolean=false -) extends InMessage - -case class GetPollResult( - meetingID:String, - requesterID: String, - pollID: String -) extends InMessage - -case class RespondToPoll( - meetingID: String, - requesterID: String, - response: PollResponseVO -) extends InMessage - -// Presentation -case class ClearPresentation( - meetingID: String -) extends InMessage - -case class RemovePresentation( - meetingID: String, - presentationID: String -) extends InMessage - -case class GetPresentationInfo( - meetingID: String, - requesterID: String, - replyTo:String -) extends InMessage - -case class SendCursorUpdate( - meetingID: String, - xPercent: Double, - yPercent: Double -) extends InMessage - -case class ResizeAndMoveSlide( - meetingID: String, - xOffset: Double, - yOffset: Double, - widthRatio: Double, - heightRatio: Double -) extends InMessage - -case class GotoSlide( - meetingID: String, - page: String -) extends InMessage - -case class SharePresentation( - meetingID: String, - presentationID: String, - share: Boolean -) extends InMessage - -case class GetSlideInfo( - meetingID: String, - requesterID: String, - replyTo: String -) extends InMessage - -case class PreuploadedPresentations( - meetingID: String, - presentations: Seq[Presentation] -) extends InMessage - -case class PresentationConversionUpdate( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - presName: String -) extends InMessage - -case class PresentationPageCountError( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - maxNumberPages: Int, - presName: String -) extends InMessage - -case class PresentationSlideGenerated( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - pagesCompleted: Int, - presName: String -) extends InMessage - -case class PresentationConversionCompleted( - meetingID: String, - messageKey: String, - code: String, - presentation: Presentation -) extends InMessage - -// Voice -case class InitAudioSettings( - meetingID: String, - requesterID: String, - muted: Boolean) extends InMessage - -case class SendVoiceUsersRequest( - meetingID: String, - requesterID: String) extends InMessage - -case class MuteAllExceptPresenterRequest( - meetingID: String, - requesterID: String, - mute: Boolean) extends InMessage - -case class MuteMeetingRequest( - meetingID: String, - requesterID: String, - mute: Boolean) extends InMessage - -case class IsMeetingMutedRequest( - meetingID: String, - requesterID: String) extends InMessage - -case class MuteUserRequest( - meetingID: String, - requesterID: String, - userID: String, - mute: Boolean) extends InMessage - -case class LockUserRequest( - meetingID: String, - requesterID: String, - userID: String, - lock: Boolean) extends InMessage - -case class EjectUserFromVoiceRequest( - meetingID: String, - userId: String, - ejectedBy: String) extends InMessage - -case class VoiceUserJoinedMessage( - meetingID: String, - user: String, - voiceConfId: String, - callerIdNum: String, - callerIdName: String, - muted: Boolean, - talking: Boolean) extends InMessage - - -case class VoiceUserJoined( - meetingID: String, - voiceUser: VoiceUser -) extends InMessage - -case class VoiceUserLeft( - meetingID: String, - userId: String -) extends InMessage - -case class VoiceUserLocked( - meetingID: String, - userId: String, - locked: Boolean -) extends InMessage - -case class VoiceUserMuted( - meetingID: String, - userId: String, - muted: Boolean -) extends InMessage - -case class VoiceUserTalking( - meetingID: String, - userId: String, - talking: Boolean -) extends InMessage - -case class VoiceRecording( - meetingID: String, - recordingFile: String, - timestamp: String, - recording: Boolean -) extends InMessage - -// Whiteboard -case class SendWhiteboardAnnotationRequest( - meetingID: String, - requesterID: String, - annotation: AnnotationVO -) extends InMessage - -case class GetWhiteboardShapesRequest( - meetingID: String, - requesterID: String, - whiteboardId: String, - replyTo: String -) extends InMessage - -case class ClearWhiteboardRequest( - meetingID: String, - requesterID: String, - whiteboardId: String -) extends InMessage - -case class UndoWhiteboardRequest( - meetingID: String, - requesterID: String, - whiteboardId: String -) extends InMessage - -case class EnableWhiteboardRequest( - meetingID: String, - requesterID: String, - enable: Boolean -) extends InMessage - -case class IsWhiteboardEnabledRequest( - meetingID: String, - requesterID: String, - replyTo: String -) extends InMessage - -case class GetAllMeetingsRequest( - meetingID: String /** Not used. Just to satisfy trait **/ - ) extends InMessage diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala deleted file mode 100755 index e837c32b79..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala +++ /dev/null @@ -1,164 +0,0 @@ -package org.bigbluebutton.core.api - -object MessageNames { - val CREATE_MEETING = "create_meeting_request" - val INITIALIZE_MEETING = "initialize_meeting_request" - val DESTROY_MEETING = "destroy_meeting_request" - val START_MEETING = "start_meeting_request" - val END_MEETING = "end_meeting_request" - val LOCK_SETTING = "lock_setting_request" - val LOCK_USER = "lock_user_request" - val INIT_LOCK_SETTINGS = "init_lock_settings" - val INIT_AUDIO_SETTINGS = "init_audio_settings" - val SET_LOCK_SETTINGS = "set_lock_settings" - val GET_LOCK_SETTINGS = "get_lock_settings" - val IS_MEETING_LOCKED = "is_meeting_locked" - val VALIDATE_AUTH_TOKEN = "validate_auth_token_request" - val VALIDATE_AUTH_TOKEN_REPLY = "validate_auth_token_reply" - val REGISTER_USER = "register_user_request" - val USER_JOINING = "user_joining_request" - val USER_LEAVING = "user_leaving_request" - val GET_USERS = "get_users_request" - val RAISE_HAND = "user_raise_hand_request" - val LOWER_HAND = "user_lower_hand_request" - val USER_SHARE_WEBCAM = "user_share_webcam_request" - val USER_UNSHARE_WEBCAM = "user_unshare_webcam_request" - val CHANGE_USER_STATUS = "change_user_status_request" - val ASSIGN_PRESENTER = "assign_presenter_request" - val SET_RECORDING_STATUS = "set_recording_status_request" - val GET_CHAT_HISTORY = "get_chat_history_request" - val SEND_PUBLIC_MESSAGE = "send_public_chat_message_request" - val SEND_PRIVATE_MESSAGE = "send_private_chat_message_request" - val GET_CURRENT_LAYOUT = "get_current_layout_request" - val SET_LAYOUT = "set_layout_request" - val BROADCAST_LAYOUT = "broadcast_layout_request" - val UNLOCK_LAYOUT = "unlock_layout_request" - val PRECREATED_POLL = "precreated_poll_request" - val CREATE_POLL = "create_poll_request" - val UPDATE_POLL = "update_poll_request" - val GET_POLLS = "get_polls_request" - val DESTROY_POLL = "destroy_poll_request" - val REMOVE_POLL = "remove_poll_request" - val SHARE_POLL = "share_poll_request" - val SHOW_POLL_RESULT = "show_poll_result_request" - val HIDE_POLL_RESULT = "hide_poll_result_request" - val START_POLL = "start_poll_request" - val STOP_POLL = "stop_poll_request" - val CLEAR_POLL = "clear_poll_request" - val GET_POLL_RESULT = "get_poll_result_request" - val RESPONT_TO_POLL = "respond_to_poll_request" - val CLEAR_PRESENTATION = "clear_presentation_request" - val REMOVE_PRESENTATION = "remove_presentation_request" - val GET_PRESENTATION_INFO = "get_presentation_info_request" - val RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide_request" - val GO_TO_SLIDE = "go_to_slide_request" - val SHARE_PRESENTATION = "share_presentation_request" - val GET_SLIDE_INFO = "get_slide_info_request" - val GET_SLIDE_INFO_REPLY = "get_slide_info_reply" - val PREUPLOADED_PRESENTATIONS = "preuploaded_presentation_request" - val PRESENTATION_CONVERSION_UPDATE = "presentation_conversion_update_message" - val PRESENTATION_PAGE_COUNT_ERROR = "presentation_page_count_error_message" - val PRESENTATION_SLIDE_GENERATED = "presentation_slide_generated_message" - val PRESENTATION_CONVERSION_COMPLETED = "presentation_conversion_completed_message" - val PRESENTATION_CURSOR_UPDATED = "presentation_cursor_updated_message" - val SEND_VOICE_USERS_REQUEST = "send_voice_users_request" - val MUTE_MEETING_REQUEST = "mute_meeting_request" - val IS_MEETING_MUTED = "is_meeting_muted_request" - val MUTE_USER = "mute_user_request" - val EJECT_USER = "eject_user_request" - val VOICE_USER_JOINED_MESSAGE = "voice_user_joined_message" - val VOICE_USER_JOINED = "voice_user_joined" - val VOICE_USER_LEFT = "voice_user_left_message" - val VOICE_USER_LOCKED = "voice_user_locked_message" - val VOICE_USER_MUTED = "voice_user_muted_message" - val VOICE_USER_TALKING = "voice_user_talking_message" - val VOICE_RECORDING = "voice_recording_message" - val SEND_WHITEBOARD_ANNOTATION = "send_whiteboard_annotation_request" - val GET_WHITEBOARD_SHAPES = "get_whiteboard_shapes_request" - val CLEAR_WHITEBOARD = "clear_whiteboard_request" - val UNDO_WHITEBOARD = "undo_whiteboard_request" - val ENABLE_WHITEBOARD = "enable_whiteboard_request" - val IS_WHITEBOARD_ENABLED = "is_whiteboard_enabled_request" - val GET_ALL_MEETINGS_REQUEST = "get_all_meetings_request" - - // OUT MESSAGES - val MEETING_CREATED = "meeting_created_message" - val VOICE_RECORDING_STARTED = "voice_recording_started_message" - val VOICE_RECORDING_STOPPED = "voice_recording_stopped_message" - val RECORDING_STATUS_CHANGED = "recording_status_changed_message" - val GET_RECORDING_STATUS_REPLY = "get_recording_status_reply" - val MEETING_ENDED = "meeting_ended_message" - val MEETING_HAS_ENDED = "meeting_has_ended_message" - val MEETING_DESTROYED = "meeting_destroyed_message" - val DISCONNECT_ALL_USERS = "disconnect_all_users_message" - val DISCONNECT_USER = "disconnect_user_message" - val PERMISSION_SETTING_INITIALIZED = "permisssion_setting_initialized_message" - val NEW_PERMISSION_SETTINGS = "new_permission_settings" - val USER_LOCKED = "user_locked_message" - val USERS_LOCKED = "users_locked_message" - val GET_PERMISSION_SETTINGS_REPLY = "get_permissions_setting_reply" - val IS_MEETING_LOCKED_REPLY = "is_meeting_locked_reply" - val USER_REGISTERED = "user_registered_message" - val USER_LEFT = "user_left_message" - val PRESENTER_ASSIGNED = "presenter_assigned_message" - val END_AND_KICK_ALL = "end_and_kick_all_message" - val GET_USERS_REPLY = "get_users_reply" - val USER_JOINED = "user_joined_message" - val USER_RAISED_HAND = "user_raised_hand_message" - val USER_LOWERED_HAND = "user_lowered_hand_message" - val USER_SHARED_WEBCAM = "user_shared_webcam_message" - val USER_UNSHARED_WEBCAM = "user_unshared_webcam_message" - val USER_STATUS_CHANGED = "user_status_changed_message" - val MUTE_VOICE_USER = "mute_voice_user_request" - val USER_VOICE_MUTED = "user_voice_muted_message" - val USER_VOICE_TALKING = "user_voice_talking_message" - val EJECT_VOICE_USER = "eject_voice_user_message" - val USER_JOINED_VOICE = "user_joined_voice_message" - val USER_LEFT_VOICE = "user_left_voice_message" - val IS_MEETING_MUTED_REPLY = "is_meeting_muted_reply" - val START_RECORDING = "start_recording_message" - val STOP_RECORDING = "stop_recording_message" - val GET_CHAT_HISTORY_REPLY = "get_chat_history_reply" - val SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message" - val SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message" - val GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply" - val SET_LAYOUT_REPLY = "set_layout_reply" - val BROADCAST_LAYOUT_REPLY = "broadcast_layout_reply" - val UNLOCK_LAYOUT_REPLY = "unlock_layout_reply" - val GET_POLL_RESULT_REPLY = "get_poll_result_reply" - val POLL_CLEARED = "poll_cleared_message" - val GET_POLLS_REPLY = "get_polls_reply" - val CLEAR_POLL_FAILED = "clear_poll_failed" - val POLL_STARTED = "poll_started_message" - val POLL_STOPPED = "poll_stopped_message" - val POLL_REMOVED = "poll_removed" - val POLL_UPDATED = "poll_updated_message" - val POLL_CREATED = "poll_created_message" - val POLL_RESPONSE = "poll_response_message" - val POLL_HIDE_RESULT = "poll_hide_result_message" - val POLL_SHOW_RESULT = "poll_show_result_message" - val PRESENTATION_CLEARED = "presentation_cleared_message" - val PRESENTATION_REMOVED = "presentation_removed_message" - val GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply" - val PRESENTATION_PAGE_RESIZED = "presentation_page_resized_message" - val PRESENTATION_PAGE_CHANGED = "presentation_page_changed_message" - val PRESENTATION_SHARED = "presentation_shared_message" - val GET_PREUPLOADED_PRESENTATIONS = "get_preuploaded_presentations_message" - val PRESENTATION_CONVERSION_PROGRESS = "presentation_conversion_progress_message" - val PRESENTATION_CONVERSION_ERROR = "presentation_conversion_error_message" - val PRESENTATION_CONVERSION_DONE = "presentation_conversion_done_message" - val PRESENTATION_CHANGED = "presentation_changed_message" - val GET_PRESENTATION_STATUS_REPLY = "get_presentation_status_reply" - val PRESENTATION_REMOVED_MESSAGE = "presentation_removed_message" - val PRESENTATION_PAGE_GENERATED = "presentation_page_generated_message" - val GET_WHITEBOARD_SHAPES_REPLY = "get_whiteboard_shapes_reply" - val SEND_WHITEBOARD_SHAPE = "send_whiteboard_shape_message" - val UNDO_WHITEBOARD_MESSAGE = "undo_whiteboard_message" - val WHITEBOARD_ENABLED = "whiteboard_enabled_message" - val WHITEBOARD_CLEARED = "whiteboard_cleared_message" - val IS_WHITEBOARD_ENABLED_REPLY = "is_whiteboard_enabled_reply" - val MEETING_DESTROYED_EVENT = "meeting_destroyed_event" - val KEEP_ALIVE_REPLY = "keep_alive_reply" - val USER_LISTEN_ONLY = "user_listening_only" - val GET_ALL_MEETINGS_REPLY = "get_all_meetings_reply" -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala deleted file mode 100755 index f36e420de2..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala +++ /dev/null @@ -1,662 +0,0 @@ -package org.bigbluebutton.core.api - -import org.bigbluebutton.core.apps.poll._ -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import org.bigbluebutton.core.apps.presentation.CurrentPresentationInfo -import org.bigbluebutton.core.apps.presentation.Presentation -import org.bigbluebutton.core.apps.presentation.Page - -abstract class OutMessage - -case class VoiceRecordingStarted( - meetingID: String, - recorded: Boolean, - recordingFile: String, - timestamp: String, - confNum: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class VoiceRecordingStopped( - meetingID: String, - recorded: Boolean, - recordingFile: String, - timestamp: String, - confNum: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class RecordingStatusChanged( - meetingID: String, - recorded: Boolean, - userId: String, - recording: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetRecordingStatusReply( - meetingID: String, - recorded: Boolean, - userId: String, - recording: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MeetingCreated( - meetingID: String, - externalMeetingID: String, - recorded: Boolean, - name: String, - voiceBridge: String, - duration: Long, - moderatorPass: String, - viewerPass: String, - createTime: Long, - createDate: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MeetingMuted( - meetingID: String, - recorded: Boolean, - meetingMuted: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MeetingEnded( - meetingID: String, - recorded: Boolean, - voiceBridge: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MeetingState( - meetingID: String, - recorded: Boolean, - userId: String, - permissions: Permissions, - meetingMuted: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MeetingHasEnded( - meetingID: String, - userId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MeetingDestroyed( - meetingID: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class DisconnectAllUsers( - meetingID: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class DisconnectUser( - meetingID: String, - userId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class KeepAliveMessageReply( - aliveID:String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case object IsAliveMessage extends IOutMessage - -// Permissions -case class PermissionsSettingInitialized( - meetingID: String, - permissions: Permissions, - applyTo: Array[UserVO], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class NewPermissionsSetting( - meetingID: String, - setByUser: String, - permissions: Permissions, - applyTo: Array[UserVO], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserLocked( - meetingID: String, - userId: String, - lock: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetPermissionsSettingReply( - meetingID: String, - userId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - - -// Users -case class UserRegistered( - meetingID: String, - recorded: Boolean, - user: RegisteredUser, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserLeft( - meetingID: String, - recorded: Boolean, - user:UserVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserEjectedFromMeeting(meetingID: String, recorded: Boolean, userId: String, ejectedBy: String, version:String = Versions.V_0_0_1) extends IOutMessage - -case class PresenterAssigned( - meetingID: String, - recorded: Boolean, - presenter: Presenter, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class EjectAllVoiceUsers( - meetingID: String, - recorded: Boolean, - voiceBridge:String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class EndAndKickAll( - meetingID: String, - recorded: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetUsersReply( - meetingID: String, - requesterID: String, - users: Array[UserVO], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class ValidateAuthTokenTimedOut( - meetingID: String, - requesterId: String, - token: String, - valid: Boolean, - correlationId: String, - version:String = Versions.V_0_0_1 - ) extends IOutMessage - -case class ValidateAuthTokenReply( - meetingID: String, - requesterId: String, - token: String, - valid: Boolean, - correlationId: String, - version:String = Versions.V_0_0_1 - ) extends IOutMessage - -case class UserJoined( - meetingID: String, - recorded: Boolean, - user:UserVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserRaisedHand( - meetingID: String, - recorded: Boolean, - userID: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserLoweredHand( - meetingID: String, - recorded: Boolean, - userID: String, - loweredBy: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserListeningOnly( - meetingID: String, - recorded: Boolean, - userID: String, - listenOnly: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserSharedWebcam( - meetingID: String, - recorded: Boolean, - userID: String, - stream: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserUnsharedWebcam( - meetingID: String, - recorded: Boolean, - userID: String, - stream: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserStatusChange( - meetingID: String, - recorded: Boolean, - userID: String, - status: String, - value: Object, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class MuteVoiceUser( - meetingID: String, - recorded: Boolean, - requesterID: String, - userId: String, - mute: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserVoiceMuted( - meetingID: String, - recorded: Boolean, - confNum: String, - user:UserVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserVoiceTalking( - meetingID: String, - recorded: Boolean, - confNum: String, - user:UserVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class EjectVoiceUser( - meetingID: String, - recorded: Boolean, - requesterID: String, - userId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserJoinedVoice( - meetingID: String, - recorded: Boolean, - confNum: String, - user:UserVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UserLeftVoice( - meetingID: String, - recorded: Boolean, - confNum: String, - user:UserVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -// Voice -case class IsMeetingMutedReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - meetingMuted: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class StartRecording( - meetingID: String, - recorded: Boolean, - requesterID: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class StopRecording( - meetingID: String, - recorded: Boolean, - requesterID: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -// Chat -case class GetChatHistoryReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - replyTo: String, - history: Array[Map[String, String]], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class SendPublicMessageEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - message: Map[String, String], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class SendPrivateMessageEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - message: Map[String, String], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -// Layout -case class GetCurrentLayoutReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - layoutID: String, - locked: Boolean, - setByUserID: String -) extends IOutMessage - -case class BroadcastLayoutEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - layoutID: String, - locked: Boolean, - setByUserID: String, - applyTo: Array[UserVO] -) extends IOutMessage - -case class LockLayoutEvent( - meetingID: String, - recorded: Boolean, - setById: String, - locked: Boolean, - applyTo: Array[UserVO] -) extends IOutMessage - -// Poll -case class GetPollResultReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - pollVO: PollVO -) extends IOutMessage - -case class GetPollsReplyOutMsg( - meetingID: String, - recorded: Boolean, - requesterID: String, - polls: Array[PollVO] -) extends IOutMessage - -case class ClearPollFailed( - meetingID: String, - pollID: String, - requesterID: String, - reason: String -) extends IOutMessage - -case class PollClearedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String -) extends IOutMessage - -case class PollStartedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String -) extends IOutMessage - -case class PollStoppedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String -) extends IOutMessage - -case class PollRemovedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String -) extends IOutMessage - -case class PollUpdatedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String, - pollVO: PollVO -) extends IOutMessage - -case class PollCreatedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String, - pollVO: PollVO -) extends IOutMessage - -case class PollResponseOutMsg( - meetingID: String, - recorded: Boolean, - responder: Responder, - response: PollResponseVO -) extends IOutMessage - -case class PollHideResultOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String -) extends IOutMessage - -case class PollShowResultOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String -) extends IOutMessage - -// Presentation -case class ClearPresentationOutMsg( - meetingID: String, - recorded: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class RemovePresentationOutMsg( - meetingID: String, - recorded: Boolean, - presentationID: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetPresentationInfoOutMsg( - meetingID: String, - recorded: Boolean, - requesterID: String, - info: CurrentPresentationInfo, - replyTo:String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class SendCursorUpdateOutMsg( - meetingID: String, - recorded: Boolean, - xPercent: Double, - yPercent: Double, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class ResizeAndMoveSlideOutMsg( - meetingID: String, - recorded: Boolean, - page: Page, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GotoSlideOutMsg( - meetingID: String, - recorded: Boolean, - page: Page, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class SharePresentationOutMsg( - meetingID: String, - recorded: Boolean, - presentation: Presentation, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetSlideInfoOutMsg( - meetingID: String, - recorded: Boolean, - requesterID: String, - page: Page, - replyTo: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetPreuploadedPresentationsOutMsg( - meetingID:String, - recorded: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PresentationConversionProgress( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - presentationName: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PresentationConversionError( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - maxNumberPages: Int, - presentationName: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PresentationPageGenerated( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - pagesCompleted: Int, - presentationName: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PresentationConversionDone( - meetingID: String, - recorded: Boolean, - messageKey: String, - code: String, - presentation: Presentation, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PresentationChanged( - meetingID: String, - presentation: Presentation, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetPresentationStatusReply( - meetingID: String, - presentations: Seq[Presentation], - current: Presentation, - replyTo: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PresentationRemoved( - meetingID: String, - presentationId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class PageChanged( - meetingID: String, - page: Page, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -// Whiteboard -case class GetWhiteboardShapesReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - shapes: Array[AnnotationVO], - replyTo: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class SendWhiteboardAnnotationEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - shape: AnnotationVO, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class ClearWhiteboardEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class UndoWhiteboardEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - shapeId: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - - -case class WhiteboardEnabledEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - enable: Boolean, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class IsWhiteboardEnabledReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - enabled: Boolean, - replyTo: String, - version:String = Versions.V_0_0_1 -) extends IOutMessage - -case class GetAllMeetingsReply( - meetings: Array[MeetingInfo], - version:String = Versions.V_0_0_1 -) extends IOutMessage - -// Value Objects -case class MeetingVO( - id: String, - recorded: Boolean -) - - diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala deleted file mode 100644 index 4e71fc086d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.bigbluebutton.core.api - -import java.util.concurrent.TimeUnit - -object TimestampGenerator { - - def generateTimestamp():Long = { - TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - } - - def getCurrentTime():Long = { - System.currentTimeMillis(); - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala deleted file mode 100755 index c97c490647..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala +++ /dev/null @@ -1,110 +0,0 @@ -package org.bigbluebutton.core.api - -import java.lang.Boolean - -object Role extends Enumeration { - type Role = Value - val MODERATOR = Value("MODERATOR") - val VIEWER = Value("VIEWER") -} - -case class Presenter( - presenterID: String, - presenterName: String, - assignedBy: String) - -case class User( - id: String, - externId: String, - name: String, - moderator: Boolean, - avatarUrl: String, - logoutUrl: String, - presenter: Boolean, - callerId: CallerId, - phoneCaller: Boolean, - handRaised: Boolean, - muted: Boolean, - talking: Boolean -) - -case class CallerId( - name: String, - number: String -) - -case class Permissions( - disableCam: Boolean = false, - disableMic: Boolean = false, - disablePrivChat: Boolean = false, - disablePubChat: Boolean = false, - lockedLayout:Boolean = false, - lockOnJoin:Boolean = false, - lockOnJoinConfigurable:Boolean = false -) - -case class RegisteredUser ( - id: String, - externId: String, - name: String, - role: Role.Role, - authToken: String -) - -case class Voice( - id: String, - webId: String, - callId: CallerId, - phoningIn: Boolean, - joined: Boolean, - locked: Boolean, - muted: Boolean, - talking: Boolean -) - -case class UserVO( - userID: String, - externUserID: String, - name: String, - role: Role.Role, - raiseHand: Boolean, - presenter: Boolean, - hasStream: Boolean, - locked: Boolean, - webcamStreams: Set[String], - phoneUser: Boolean, - voiceUser: VoiceUser, - listenOnly: Boolean) - -case class VoiceUser(userId: String, - webUserId: String, - callerName: String, - callerNum: String, - joined: Boolean, - locked: Boolean, - muted: Boolean, - talking: Boolean) - -case class MeetingConfig(name: String, - id: MeetingID, - passwords: MeetingPasswords, - welcomeMsg: String, - logoutUrl: String, - maxUsers: Int, - record: Boolean=false, - duration: MeetingDuration, - defaultAvatarURL: String, - defaultConfigToken: String) - -case class MeetingName(name: String) - -case class MeetingID(internal:String, external: String) - -case class VoiceConfig(telVoice: String, webVoice: String, dialNumber: String) - -case class MeetingPasswords(moderatorPass: String, viewerPass: String) - -case class MeetingDuration(duration: Int = 0, createdTime: Long = 0, - startTime: Long = 0, endTime: Long = 0) - -case class MeetingInfo(meetingID: String, meetingName: String, recorded: Boolean, voiceBridge: String, duration: Long) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala deleted file mode 100755 index 6fe5b194e8..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.api - -object Versions { - val V_0_0_1 = "0.0.1" -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala deleted file mode 100755 index 5bcb0223b7..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala +++ /dev/null @@ -1,31 +0,0 @@ -package org.bigbluebutton.core.apps.chat - -import org.bigbluebutton.core.api._ -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.MeetingActor - -trait ChatApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - val messages = new ArrayBuffer[Map[String, String]]() - - def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { - val history = new Array[Map[String, String]](messages.size) - messages.copyToArray(history) - outGW.send(new GetChatHistoryReply(meetingID, recorded, msg.requesterID, msg.replyTo, history)) - } - - def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { - messages append msg.message.toMap - val pubMsg = msg.message.toMap - - outGW.send(new SendPublicMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) - } - - def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { - val pubMsg = msg.message.toMap - outGW.send(new SendPrivateMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala deleted file mode 100755 index db21b72009..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.core.apps.chat - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class ChatInGateway(bbbGW: BigBlueButtonGateway) { - - def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { - bbbGW.accept(new GetChatHistoryRequest(meetingID, requesterID, replyTo)) - } - - def sendPrivateMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { - bbbGW.accept(new SendPrivateMessageRequest(meetingID, requesterID, msg)) - } - - def sendPublicMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { - bbbGW.accept(new SendPublicMessageRequest(meetingID, requesterID, msg)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/red5/ChatClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/red5/ChatClientMessageSender.scala deleted file mode 100755 index 8e607bfa64..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/red5/ChatClientMessageSender.scala +++ /dev/null @@ -1,66 +0,0 @@ -package org.bigbluebutton.core.apps.chat.red5 - -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage -import com.google.gson.Gson -import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList - -class ChatClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) - case _ => // do nothing - } - } - - private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - - val collection = new ArrayList[java.util.Map[String, String]](); - - msg.history.foreach(p => { - collection.add(mapAsJavaMap(p)) - }) - - val jsonMsg = gson.toJson(collection) - -// System.out.println("************ CHAT HISTORY = \n" + jsonMsg + "\n") - message.put("msg", jsonMsg) - - val m = new DirectClientMessage(msg.meetingID, msg.requesterID, "ChatRequestMessageHistoryReply", message); - service.sendMessage(m); - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - val gson = new Gson() - val jsonMsg = gson.toJson(mapAsJavaMap(msg.message)) -// System.out.println("************ PUBLIC CHAT MESSAGE = \n" + jsonMsg + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "ChatReceivePublicMessageCommand", mapAsJavaMap(msg.message)); - service.sendMessage(m); - } - - private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { - msg.message.get("toUserID") match { - case Some(uid) => { - val m = new DirectClientMessage(msg.meetingID, uid, "ChatReceivePrivateMessageCommand", mapAsJavaMap(msg.message)); - service.sendMessage(m); - } - case None => // do nothing - - } - - val m2 = new DirectClientMessage(msg.meetingID, msg.requesterID, "ChatReceivePrivateMessageCommand", mapAsJavaMap(msg.message)); - service.sendMessage(m2); - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala deleted file mode 100755 index 828162c6d2..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala +++ /dev/null @@ -1,38 +0,0 @@ -package org.bigbluebutton.core.apps.chat.redis - -import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import org.bigbluebutton.core.messaging.Util - -class ChatEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) - case _ => // do nothing - } - } - - private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { - val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { - val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala deleted file mode 100755 index 4d971adda3..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala +++ /dev/null @@ -1,29 +0,0 @@ -package org.bigbluebutton.core.apps.chat.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.recorder.chat.PublicChatRecordEvent -import scala.collection.JavaConversions._ - -class ChatEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case _ => // do nothing - } - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - if (msg.recorded) { - val message = mapAsJavaMap(msg.message) - val ev = new PublicChatRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setMeetingId(msg.meetingID); - ev.setSender(message.get("fromUsername")); - ev.setMessage(message.get("message")); - ev.setColor(message.get("fromColor")); - recorder.record(msg.meetingID, ev); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala deleted file mode 100755 index 3bb28c43d3..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala +++ /dev/null @@ -1,67 +0,0 @@ -package org.bigbluebutton.core.apps.chat.redis - -import scala.collection.mutable.HashMap -import org.bigbluebutton.conference.service.chat.ChatKeyUtil -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import org.bigbluebutton.core.messaging.Util - -object ChatMessageToJsonConverter { - - val UNKNOWN = "unknown" - - private def chatMessageToMap(msg: Map[String, String]):HashMap[String, String] = { - val res = new HashMap[String, String] - res += "chat_type" -> msg.get(ChatKeyUtil.CHAT_TYPE).getOrElse(UNKNOWN) - res += "from_userid" -> msg.get(ChatKeyUtil.FROM_USERID).getOrElse(UNKNOWN) - res += "from_username" -> msg.get(ChatKeyUtil.FROM_USERNAME).getOrElse(UNKNOWN) - res += "from_color" -> msg.get(ChatKeyUtil.FROM_COLOR).getOrElse(UNKNOWN) - res += "from_time" -> msg.get(ChatKeyUtil.FROM_TIME).getOrElse(UNKNOWN) - res += "from_tz_offset" -> msg.get(ChatKeyUtil.FROM_TZ_OFFSET).getOrElse(UNKNOWN) - res += "to_userid" -> msg.get(ChatKeyUtil.TO_USERID).getOrElse(UNKNOWN) - res += "to_username" -> msg.get(ChatKeyUtil.TO_USERNAME).getOrElse(UNKNOWN) - res += "message" -> msg.get(ChatKeyUtil.MESSAGE).getOrElse(UNKNOWN) - - res - } - - def getChatHistoryReplyToJson(msg: GetChatHistoryReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val collection = new ArrayList[java.util.Map[String, String]](); - - msg.history.foreach(p => { - collection.add(mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(p))) - }) - - payload.put(Constants.CHAT_HISTORY, collection) - - val header = Util.buildHeader(MessageNames.GET_CHAT_HISTORY_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendPublicMessageEventToJson(msg: SendPublicMessageEvent):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) - - val header = Util.buildHeader(MessageNames.SEND_PUBLIC_CHAT_MESSAGE, msg.version, None) - Util.buildJson(header, payload) - } - - def sendPrivateMessageEventToJson(msg: SendPrivateMessageEvent):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) - - val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala deleted file mode 100755 index 9fbc137593..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala +++ /dev/null @@ -1,66 +0,0 @@ -package org.bigbluebutton.core.apps.layout - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.MeetingActor -import scala.collection.mutable.ArrayBuffer - -trait LayoutApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - private var setByUser:String = "system"; - private var currentLayout = ""; - private var layoutLocked = false - private var viewersOnly = true - - def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { - outGW.send(new GetCurrentLayoutReply(msg.meetingID, recorded, msg.requesterID, - currentLayout, permissions.lockedLayout, setByUser)) - } - - def handleLockLayoutRequest(msg: LockLayoutRequest) { - viewersOnly = msg.viewersOnly - lockLayout(msg.lock) - - outGW.send(new LockLayoutEvent(msg.meetingID, recorded, - msg.setById, msg.lock, affectedUsers)) - - msg.layout foreach {l => - currentLayout = l - broadcastSyncLayout(msg.meetingID, msg.setById) - } - } - - private def broadcastSyncLayout(meetingId: String, setById: String) { - outGW.send(new BroadcastLayoutEvent(meetingId, recorded, setById, - currentLayout, permissions.lockedLayout, setByUser, affectedUsers)) - } - - def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { - currentLayout = msg.layout - broadcastSyncLayout(msg.meetingID, msg.requesterID) - } - - def handleLockLayout(lock: Boolean, setById: String) { - outGW.send(new LockLayoutEvent(meetingID, recorded, setById, lock, affectedUsers)) - - broadcastSyncLayout(meetingID, setById) - } - - def affectedUsers():Array[UserVO] = { - if (viewersOnly) { - val au = ArrayBuffer[UserVO]() - users.getUsers foreach {u => - if (! u.presenter && u.role != Role.MODERATOR) { - au += u - } - } - au.toArray - } else { - users.getUsers - } - - } - -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala deleted file mode 100644 index c26255644c..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala +++ /dev/null @@ -1,21 +0,0 @@ -package org.bigbluebutton.core.apps.layout - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class LayoutInGateway(bbbGW: BigBlueButtonGateway) { - - def getCurrentLayout(meetingID: String, requesterID: String) { - bbbGW.accept(new GetCurrentLayoutRequest(meetingID, requesterID)) - } - - def broadcastLayout(meetingID: String, requesterID: String, layout: String) { - bbbGW.accept(new BroadcastLayoutRequest(meetingID, requesterID, layout)) - } - - def lockLayout(meetingID: String, setById: String, - lock: Boolean, viewersOnly: Boolean, - layout: Option[String]) { - bbbGW.accept(new LockLayoutRequest(meetingID, setById, lock, viewersOnly, layout)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala deleted file mode 100755 index 9f1820498c..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala +++ /dev/null @@ -1,52 +0,0 @@ -package org.bigbluebutton.core.apps.layout.red5 - -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage -import com.google.gson.Gson -import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage - -class LayoutClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg:GetCurrentLayoutReply => handleGetCurrentLayoutReply(msg) - case msg:BroadcastLayoutEvent => handleBroadcastLayoutEvent(msg) - case msg:LockLayoutEvent => handleLockLayoutEvent(msg) - case _ => // do nothing - } - } - - private def handleGetCurrentLayoutReply(msg: GetCurrentLayoutReply) { - val message = new java.util.HashMap[String, Object]() - message.put("locked", msg.locked:java.lang.Boolean); - message.put("setById", msg.setByUserID); - message.put("layout", msg.layoutID); - - var m = new DirectClientMessage(msg.meetingID, msg.requesterID, "getCurrentLayoutResponse", message); - service.sendMessage(m); - } - - private def handleBroadcastLayoutEvent(msg: BroadcastLayoutEvent) { - val message = new java.util.HashMap[String, Object]() - message.put("locked", msg.locked:java.lang.Boolean); - message.put("setByUserID", msg.setByUserID); - message.put("layout", msg.layoutID); - - msg.applyTo foreach {u => - var m = new DirectClientMessage(msg.meetingID, u.userID, "syncLayout", message); - service.sendMessage(m); - } - } - - private def handleLockLayoutEvent(msg: LockLayoutEvent) { - val message = new java.util.HashMap[String, Object]() - message.put("locked", msg.locked:java.lang.Boolean); - message.put("setById", msg.setById); - - msg.applyTo foreach {u => - var m = new DirectClientMessage(msg.meetingID, u.userID, "layoutLocked", message); - service.sendMessage(m); - }; - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala deleted file mode 100755 index 893a9d0aff..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala +++ /dev/null @@ -1,141 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import scala.collection.mutable.HashMap -import scala.collection.mutable.ArrayBuffer - -case class QuestionResponsesVO(val questionID:String, val responseIDs:Array[String]) -case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) -case class ResponderVO(responseID: String, user: Responder) - -case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) -case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) -case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) - -case class Responder(val userID: String, name: String) - -case class ResponseOutVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) -case class QuestionOutVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseOutVO]) -case class PollOutVO(id: String, title: String, started: Boolean, stopped: Boolean, questions: Array[QuestionOutVO]) - - -class Poll(val id: String, val title: String, val questions: Array[Question]) { - private var _started: Boolean = false - private var _stopped: Boolean = false - - private var _showResult: Boolean = false - - def showResult() { - _showResult = true - } - - def hideResult() { - _showResult = false - } - - def resultShown(): Boolean = { - _showResult - } - - def start() { - _started = true; - } - - def stop() { - _stopped = true; - } - - def isStarted():Boolean = { - return _started - } - - def isStopped():Boolean = { - return _stopped - } - - def clear() { - questions.foreach(q => { - q.clear - }) - - _started = false - _stopped = false - } - - def hasResponses():Boolean = { - questions.foreach(q => { - if (q.hasResponders) return true - }) - - return false - } - - def respondToQuestion(questionID: String, responseID: String, responder: Responder) { - questions.foreach(q => { - if (q.id.equals(questionID)) { - q.respondToQuestion(responseID, responder) - } - }) - } - - def toPollVO():PollVO = { - val qvos = new ArrayBuffer[QuestionVO] - questions.foreach(q => { - qvos += q.toQuestionVO - }) - - new PollVO(id, title, qvos.toArray, _started, _stopped) - } -} - -class Question(val id: String, val multiResponse: Boolean, val question: String, val responses: Array[Response]) { - - def clear() { - responses.foreach(r => r.clear) - } - - def hasResponders():Boolean = { - responses.foreach(r => { - if (r.numResponders > 0) return true - }) - - return false - } - - def respondToQuestion(id: String, responder: Responder) { - responses.foreach(r => { - if (r.id == id) r.addResponder(responder) - }) - } - - def toQuestionVO():QuestionVO = { - val rvos = new ArrayBuffer[ResponseVO] - responses.foreach(response => { - val r = new ResponseVO(response.id, response.response, response.getResponders) - rvos += r - }) - - new QuestionVO(id, multiResponse, question, rvos.toArray) - } -} - -class Response(val id: String, val response: String) { - - val responders = new ArrayBuffer[Responder]() - - def clear() { - responders.clear - } - def addResponder(responder: Responder) { - responders += responder - } - - def numResponders():Int = { - responders.length; - } - - def getResponders():Array[Responder] = { - var r = new Array[Responder](responders.length) - responders.copyToArray(r) - return r - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala deleted file mode 100755 index 1b66d21659..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala +++ /dev/null @@ -1,123 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.api._ -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.MeetingActor - -trait PollApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - private val pollModel = new PollModel - - def handleHidePollResult(msg: HidePollResult) { - val pollID = msg.pollID - - if (pollModel.hasPoll(pollID)) { - pollModel.hidePollResult(pollID) - outGW.send(new PollHideResultOutMsg(meetingID, recorded, pollID)) - } - } - - def handleShowPollResult(msg: ShowPollResult) { - val pollID = msg.pollID - - if (pollModel.hasPoll(pollID)) { - pollModel.showPollResult(pollID) - outGW.send(new PollShowResultOutMsg(meetingID, recorded, pollID)) - } - } - - def handleRespondToPoll(msg: RespondToPoll) { - val pollID = msg.response.pollID - - if (pollModel.hasPoll(pollID)) { - if (hasUser(msg.requesterID)) { - getUser(msg.requesterID) match { - case Some(user) => { - val responder = new Responder(user.userID, user.name) - msg.response.responses.foreach(question => { - question.responseIDs.foreach(response => { - pollModel.respondToQuestion(pollID, question.questionID, response, responder) - }) - }) - - pollModel.getPoll(msg.response.pollID) match { - case Some(poll) => outGW.send(new PollResponseOutMsg(meetingID, recorded, responder, msg.response)) - case None => // do nothing - } - } - case None => //do nothing - } - } - } - } - - def handleGetPolls(msg: GetPolls) { - var polls = pollModel.getPolls - outGW.send(new GetPollsReplyOutMsg(meetingID, recorded, msg.requesterID, polls)) - } - - def handleClearPoll(msg: ClearPoll) { - if (pollModel.clearPoll(msg.pollID)) { - outGW.send(new PollClearedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleClearPoll - " + msg.pollID + " not found" ) - } - } - - def handleStartPoll(msg: StartPoll) { - if (pollModel.hasPoll(msg.pollID)) { - pollModel.startPoll(msg.pollID) - outGW.send(new PollStartedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleStartPoll - " + msg.pollID + " not found" ) - } - } - - def handleStopPoll(msg: StopPoll) { - if (pollModel.hasPoll(msg.pollID)) { - pollModel.stopPoll(msg.pollID) - outGW.send(new PollStoppedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleStopPoll - " + msg.pollID + " not found" ) - } - } - - def handleSharePoll(msg: SharePoll) { - - } - - def handleRemovePoll(msg: RemovePoll) { - if (pollModel.hasPoll(msg.pollID)) { - pollModel.removePoll(msg.pollID) - outGW.send(new PollRemovedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleRemovePoll - " + msg.pollID + " not found" ) - } - } - - def handleDestroyPoll(msg: DestroyPoll) { - - } - - def handleUpdatePoll(msg: UpdatePoll) { - if (pollModel.updatePoll(msg.poll)) { - outGW.send(new PollUpdatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) - } else { - print("PollApp:: handleUpdatePoll - " + msg.poll.id + " not found" ) - } - } - - def handlePreCreatedPoll(msg: PreCreatedPoll) { - pollModel.createPoll(msg.poll) - outGW.send(new PollCreatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) - } - - def handleCreatePoll(msg: CreatePoll) { - pollModel.createPoll(msg.poll) - outGW.send(new PollCreatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala deleted file mode 100755 index 6a31c26d6f..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class PollInGateway(bbbGW: BigBlueButtonGateway) { - - val msgConverter = new PollMessageConverter - - def getPolls(meetingID: String, requesterID: String) { - bbbGW.accept(new GetPolls(meetingID, requesterID)) - } - - def preCreatedPoll(meetingID: String, msg: String) { - val pvo = msgConverter.convertPreCreatedPollMessage(msg) - bbbGW.accept(new PreCreatedPoll(meetingID, pvo)) - } - - def createPoll(meetingID: String, requesterID: String, msg: String) { - val pvo = msgConverter.convertCreatePollMessage(msg) - bbbGW.accept(new CreatePoll(meetingID, requesterID, pvo)) - } - - def updatePoll(meetingID: String, requesterID: String, msg: String) { - val pvo = msgConverter.convertUpdatePollMessage(msg) - bbbGW.accept(new UpdatePoll(meetingID, requesterID, pvo)) - } - - def startPoll(meetingID: String, requesterID: String, msg: String) { - val pollID = msgConverter.convertStartPollMessage(msg) - bbbGW.accept(new StartPoll(meetingID, requesterID, pollID)) - } - - def stopPoll(meetingID: String, requesterID: String, msg: String) { - val pollID = msgConverter.convertStopPollMessage(msg) - bbbGW.accept(new StopPoll(meetingID, requesterID, pollID)) - } - - def removePoll(meetingID: String, requesterID: String, msg: String) { - val pollID = msgConverter.convertRemovePollMessage(msg) - bbbGW.accept(new RemovePoll(meetingID, requesterID, pollID)) - } - - def respondPoll(meetingID: String, requesterID: String, msg: String) { - val pollResponse = msgConverter.convertTakePollMessage(msg) - bbbGW.accept(new RespondToPoll(meetingID, requesterID, pollResponse)) - } - - def showPollResult(meetingID: String, requesterID: String, pollID: String) { - bbbGW.accept(new ShowPollResult(meetingID, requesterID, pollID)) - } - - def hidePollResult(meetingID: String, requesterID: String, pollID: String) { - bbbGW.accept(new HidePollResult(meetingID, requesterID, pollID)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala deleted file mode 100755 index e3763ef85c..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala +++ /dev/null @@ -1,190 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import com.google.gson.Gson -import com.google.gson.JsonParser -import org.bigbluebutton.core.util.RandomStringGenerator._ -import scala.collection.mutable.ArrayBuffer - -class PollMessageConverter { - - def convertPreCreatedPollMessage(msg:String):PollVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val title = gson.fromJson(obj.get("title"), classOf[String]); - - val question = gson.fromJson(obj.get("question"), classOf[String]); - val qType = gson.fromJson(obj.get("questionType"), classOf[String]) - - val cvoArray = ArrayBuffer[QuestionVO]() - - val responses = obj.get("answers").getAsJsonArray(); - - val rvoArray = ArrayBuffer[ResponseVO]() - - var j = 0 - val respIter = responses.iterator() - while(respIter.hasNext()) { - val response = gson.fromJson(respIter.next(), classOf[String]); - - rvoArray += new ResponseVO(j.toString, response) - - j += 1 - } - - val questionType = if (qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false - - cvoArray += new QuestionVO(0.toString, questionType, question, rvoArray.toArray) - - new PollVO(randomAlphanumericString(12), title, cvoArray.toArray) - - } - - def convertCreatePollMessage(msg:String):PollVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val title = gson.fromJson(obj.get("title"), classOf[String]); - - val questions = obj.get("questions").getAsJsonArray(); - val cvoArray = ArrayBuffer[QuestionVO]() - - val iter = questions.iterator() - var i = 0 - while(iter.hasNext()) { - val aquestion = iter.next().getAsJsonObject(); - val questionText = gson.fromJson(aquestion.get("question"), classOf[String]) - - val qType = gson.fromJson(aquestion.get("questionType"), classOf[String]) - - val responses = aquestion.get("responses").getAsJsonArray(); - - val rvoArray = ArrayBuffer[ResponseVO]() - - var j = 0 - val respIter = responses.iterator() - while(respIter.hasNext()) { - val response = gson.fromJson(respIter.next(), classOf[String]); - - rvoArray += new ResponseVO(j.toString, response) - - j += 1 - } - - val questionType = if (! qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false - - cvoArray += new QuestionVO(i.toString, questionType, questionText, rvoArray.toArray) - - i += 1 - } - - new PollVO(randomAlphanumericString(12), title, cvoArray.toArray) - - } - - def convertUpdatePollMessage(msg:String):PollVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val title = gson.fromJson(obj.get("title"), classOf[String]); - val pollID = gson.fromJson(obj.get("id"), classOf[String]); - - val questions = obj.get("questions").getAsJsonArray(); - - val cvoArray = ArrayBuffer[QuestionVO]() - - val iter = questions.iterator() - var i = 0 - while(iter.hasNext()) { - val aquestion = iter.next().getAsJsonObject(); - val questionText = gson.fromJson(aquestion.get("question"), classOf[String]) - - val responses = aquestion.get("responses").getAsJsonArray(); - - val rvoArray = ArrayBuffer[ResponseVO]() - - var j = 0 - val respIter = responses.iterator() - while(respIter.hasNext()) { - val response = respIter.next().getAsJsonObject() - - // Get the old response id - val oldRespID = gson.fromJson(response.get("id"), classOf[String]) - // if the old response id is empty, then this is a new answer, create a new id - val respID = if (oldRespID == "") j.toString() else oldRespID - val respText = gson.fromJson(response.get("response"), classOf[String]) - - rvoArray += new ResponseVO(respID, respText) - - j += 1 - } - - val qType = gson.fromJson(aquestion.get("questionType"), classOf[String]) - val qID = gson.fromJson(aquestion.get("id"), classOf[String]) - val questionType = if (qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false - - cvoArray += new QuestionVO(qID, questionType, questionText, rvoArray.toArray) - - i += 1 - } - - new PollVO(pollID, title, cvoArray.toArray) - } - - def convertStartPollMessage(msg: String):String = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - - pollID - } - - def convertStopPollMessage(msg: String):String = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - - pollID - } - - def convertRemovePollMessage(msg: String):String = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - - pollID - } - - def convertTakePollMessage(msg: String):PollResponseVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - val questions = obj.get("questions").getAsJsonArray(); - - val qVO = ArrayBuffer[QuestionResponsesVO](); - - val iter = questions.iterator() - while(iter.hasNext()) { - val aquestion = iter.next().getAsJsonObject(); - val questionID = gson.fromJson(aquestion.get("questionID"), classOf[String]) - - val responses = aquestion.get("responseIDs").getAsJsonArray(); - - val rvoArray = ArrayBuffer[String]() - - val respIter = responses.iterator() - while(respIter.hasNext()) { - val response = gson.fromJson(respIter.next(), classOf[String]); - rvoArray += response - } - - qVO += new QuestionResponsesVO(questionID, rvoArray.toArray) - } - - new PollResponseVO(pollID, qVO.toArray) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala deleted file mode 100755 index 1b1efcb26d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala +++ /dev/null @@ -1,235 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import scala.collection.mutable.ArrayBuffer -import scala.collection.mutable.HashMap - -class PollModel { - - private val polls = new HashMap[String, Poll]() - - /*** - * Uncomment to create sample polls for manual testing purposes - */ - //createSamplePoll - - def numPolls():Int = { - polls.size - } - - def createPoll(pollVO: PollVO) { - val questions = new ArrayBuffer[Question] - pollVO.questions.foreach(qv => { - val responses = new ArrayBuffer[Response] - qv.responses.foreach(rv => { - val response = new Response(rv.id, rv.text) - responses += response - }) - questions += new Question(qv.id, qv.multiResponse, qv.question, responses.toArray) - }) - - val poll = new Poll(pollVO.id, pollVO.title, questions.toArray) - polls += poll.id -> poll - } - - def updatePoll(pollVO: PollVO):Boolean = { - var success = false - - polls.get(pollVO.id) match { - case Some(p) => { - val questions = new ArrayBuffer[Question] - pollVO.questions.foreach(qv => { - val responses = new ArrayBuffer[Response] - qv.responses.foreach(rv => { - val response = new Response(rv.id, rv.text) - responses += response - }) - questions += new Question(qv.id, qv.multiResponse, qv.question, responses.toArray) - }) - - val poll = new Poll(pollVO.id, pollVO.title, questions.toArray) - polls += poll.id -> poll - success = true - } - case None => success = false - } - - success - } - - def getPolls():Array[PollVO] = { - val poll = new ArrayBuffer[PollVO] - polls.values.foreach(p => { - poll += p.toPollVO - }) - - poll.toArray - } - - def clearPoll(pollID: String):Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - p.clear - success = true - } - case None => success = false - } - - success - } - - def startPoll(pollID: String):Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - p.start - success = true - } - case None => success = false - } - - success - } - - def removePoll(pollID: String):Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - polls -= p.id - success = true - } - case None => success = false - } - - success - } - - def stopPoll(pollID: String):Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - p.stop - success = true - } - case None => success = false - } - - success - } - - def hasPoll(pollID: String):Boolean = { - var present = false - polls.get(pollID) match { - case Some(p) => { - present = true - } - case None => present = false - } - - present - } - - def getPoll(pollID: String):Option[PollVO] = { - var poll:Option[PollVO] = None - - polls.get(pollID) match { - case Some(p) => { - val questions = new ArrayBuffer[QuestionVO] - p.questions.foreach(q => { - val responses = new ArrayBuffer[ResponseVO] - q.responses.foreach(response => { - val r = new ResponseVO(response.id, response.response, response.getResponders) - responses += r - }) - - val quest = new QuestionVO(q.id, q.multiResponse, q.question, responses.toArray) - questions += quest - }) - poll = Some(new PollVO(p.id, p.title, questions.toArray)) - } - case None => poll = None - } - - poll - } - - def hidePollResult(pollID: String) { - polls.get(pollID) match { - case Some(p) => p.hideResult - case None => // do nothing - } - } - - def showPollResult(pollID: String) { - polls.get(pollID) match { - case Some(p) => p.showResult - case None => // do nothing - } - } - - def respondToQuestion(pollID: String, questionID: String, responseID: String, responder: Responder) { - polls.get(pollID) match { - case Some(p) => { - p.respondToQuestion(questionID, responseID, responder) - } - case None => - } - } - - /******************************************************** - * Some pre-created polls for testing and simulation so we don't have - * to manually generate polls when testing the UI. - */ - def createSamplePoll() { - addSamplePoll1() - addSamplePoll2() - addSamplePoll3() - } - - def addSamplePoll1() { - val r1 = new ResponseVO("0", "Visa") - val r2 = new ResponseVO("1", "MasterCard") - val r3 = new ResponseVO("2", "AmEx") - val r4 = new ResponseVO("3", "Diners Club") - - var q = new QuestionVO("q1", false, "What type of credit card do you prefer?", Array(r1, r2, r3, r4)) - val pvo = new PollVO("pollID-101", "Preferred Credit Card", Array(q)) - - createPoll(pvo) - - respondToQuestion("pollID-101", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-101", "q1", "0", new Responder("user2", "Asyong Aksaya")) - } - - def addSamplePoll2() { - val r1 = new ResponseVO("0", "Visa") - val r2 = new ResponseVO("1", "MasterCard") - val r3 = new ResponseVO("2", "AmEx") - val r4 = new ResponseVO("3", "Diners Club") - - var q = new QuestionVO("q1", true, "Which credit cards do you own?", Array(r1, r2, r3, r4)) - val pvo = new PollVO("pollID-102", "Owned Credit Cards", Array(q)) - - createPoll(pvo) - - respondToQuestion("pollID-102", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-102", "q1", "0", new Responder("user2", "Asyong Aksaya")) - } - - def addSamplePoll3() { - val r1 = new ResponseVO("0", "Dumaguete") - val r2 = new ResponseVO("1", "Cebu") - val r3 = new ResponseVO("2", "Zamboanga") - val r4 = new ResponseVO("3", "None of the above") - - var q = new QuestionVO("q1", true, "What is the capital of the Philippines?", Array(r1, r2, r3, r4)) - val pvo = new PollVO("pollID-103", "Philippine Capital", Array(q)) - - createPoll(pvo) - - respondToQuestion("pollID-103", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-103", "q1", "0", new Responder("user2", "Asyong")) - respondToQuestion("pollID-103", "q1", "2", new Responder("user3", "Pedro")) - respondToQuestion("pollID-103", "q1", "3", new Responder("user4", "Aksaya")) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala deleted file mode 100755 index fdfc60122e..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala +++ /dev/null @@ -1,7 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -object QuestionType extends Enumeration { - type QuestionType = Value - val MULTI_CHOICE = Value("MULTI_CHOICE") - val MULTI_REPONSE = Value("MULTI_REPONSE") -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/red5/PollClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/red5/PollClientMessageSender.scala deleted file mode 100755 index 4505561d7d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/red5/PollClientMessageSender.scala +++ /dev/null @@ -1,125 +0,0 @@ -package org.bigbluebutton.core.apps.poll.red5 - -import com.google.gson.Gson -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage -import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage -import java.util.ArrayList -import org.bigbluebutton.core.apps.poll.PollVO - -class PollClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) - case _ => // do nothing - } - } - - private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("responder", msg.responder) - map.put("response", msg.response) - - val message = new java.util.HashMap[String, Object]() - message.put("msg", gson.toJson(map)) - -// println("PollClientMessageSender - Handling PollResponseOutMsg \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "pollResultUpdatedMessage", message); - service.sendMessage(m); - } - - private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - - val collection = new ArrayList[PollVO](); - - msg.polls.foreach(p => { - collection.add(p) - }) - - message.put("msg", gson.toJson(collection)) - -// println("PollClientMessageSender - Handling GetPollsReplyOutMsg \n" + message.get("msg") + "\n") - - var m = new DirectClientMessage(msg.meetingID, msg.requesterID, "pollGetPollsReply", message); - service.sendMessage(m); - } - - private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { -// println("PollClientMessageSender - Handling PollClearedOutMsg") - } - - private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { -// println("PollClientMessageSender - Handling PollStartedOutMsg") - - val map = new java.util.HashMap[String, Object]() - map.put("pollID", msg.pollID) - - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - message.put("msg", gson.toJson(map)) - - var m = new BroadcastClientMessage(msg.meetingID, "pollStartedMessage", message); - service.sendMessage(m); - } - - private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { -// println("PollClientMessageSender - Handling PollStoppedOutMsg") - - val map = new java.util.HashMap[String, Object]() - map.put("pollID", msg.pollID) - - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - message.put("msg", gson.toJson(map)) - - var m = new BroadcastClientMessage(msg.meetingID, "pollStoppedMessage", message); - service.sendMessage(m); - } - - private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { -// println("PollClientMessageSender - Handling PollRemovedOutMsg") - val map = new java.util.HashMap[String, Object]() - map.put("pollID", msg.pollID) - - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - message.put("msg", gson.toJson(map)) - - var m = new BroadcastClientMessage(msg.meetingID, "pollDestroyedMessage", message); - service.sendMessage(m); - } - - private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { -// println("PollClientMessageSender - Handling PollUpdatedOutMsg") - val gson= new Gson(); - val message = new java.util.HashMap[String, Object]() - message.put("msg", gson.toJson(msg.pollVO)) - - var m = new BroadcastClientMessage(msg.meetingID, "pollUpdatedMessage", message); - service.sendMessage(m); - } - - private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { -// println("PollClientMessageSender - Handling PollCreatedOutMsg") - val gson= new Gson(); - - val message = new java.util.HashMap[String, Object]() - message.put("msg", gson.toJson(msg.pollVO)) - - var m = new BroadcastClientMessage(msg.meetingID, "pollCreatedMessage", message); - service.sendMessage(m); - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala deleted file mode 100755 index ead1864980..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala +++ /dev/null @@ -1,114 +0,0 @@ -package org.bigbluebutton.core.apps.poll.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import com.google.gson.Gson -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import java.util.ArrayList -import org.bigbluebutton.core.apps.poll.PollVO - -class PollEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) - case _ => // do nothing - } - } - - private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - - map.put("meetingID", msg.meetingID) - map.put("event", "PollResponseEvent") - map.put("responder", msg.responder) - map.put("response", msg.response) - - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - - val collection = new ArrayList[PollVO](); - - msg.polls.foreach(p => { - collection.add(p) - }) - - message.put("msg", gson.toJson(collection)) - -// println("PollClientMessageSender - Handling GetPollsReplyOutMsg \n" + message.get("msg") + "\n") - - } - - private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { -// println("PollClientMessageSender - Handling PollClearedOutMsg") - } - - private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { -// println("PollClientMessageSender - Handling PollStartedOutMsg") - - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollStartedEvent") - map.put("pollID", msg.pollID) - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - - } - - private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { -// println("PollClientMessageSender - Handling PollStoppedOutMsg") - - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollStoppedEvent") - map.put("pollID", msg.pollID) - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { -// println("PollClientMessageSender - Handling PollRemovedOutMsg") - - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollRemovedEvent") - map.put("pollID", msg.pollID) - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { -// println("PollClientMessageSender - Handling PollUpdatedOutMsg") - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollUpdatedEvent") - map.put("msg", gson.toJson(msg.pollVO)) - - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { -// println("PollClientMessageSender - Handling PollCreatedOutMsg") - val gson = new Gson(); - - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollCreatedEvent") - map.put("msg", gson.toJson(msg.pollVO)) - - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala deleted file mode 100755 index c0ffd80d25..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala +++ /dev/null @@ -1,115 +0,0 @@ -package org.bigbluebutton.core.apps.poll.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.recorder.polling.PollCreatedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollUpdatedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollRemovedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollStoppedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollStartedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollClearedRecordEvent - -class PollEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetPollsReplyOutMsg => // do nothing? - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case _ => // do nothing - } - } - - def handlePollCreatedOutMsg(msg: PollCreatedOutMsg):Unit = { - if (msg.recorded) { - val ev = new PollCreatedRecordEvent(); - ev.setPollID(msg.pollVO.id) - ev.setTitle(msg.pollVO.title) - - for ( q <- msg.pollVO.questions ) { - ev.addQuestion(q.id, q.question, q.multiResponse) - for( resp <- q.responses ){ - ev.addResponse(q.id, resp.id, resp.text) - - /*for( responder <- resp.responders ){ - ev.addResponder(q.id, resp.id, responder.id, ) - }*/ - } - } - - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - - } - - def handlePollUpdatedOutMsg(msg:PollUpdatedOutMsg):Unit = { - if (msg.recorded) { - val ev = new PollUpdatedRecordEvent(); - ev.setPollID(msg.pollVO.id) - ev.setTitle(msg.pollVO.title) - - for ( q <- msg.pollVO.questions ) { - ev.addQuestion(q.id, q.question, q.multiResponse) - for( resp <- q.responses ){ - ev.addResponse(q.id, resp.id, resp.text) - - /*for( responder <- resp.responders ){ - ev.addResponder(q.id, resp.id, responder.id, ) - }*/ - } - } - - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollRemovedOutMsg(msg:PollRemovedOutMsg):Unit = { - if (msg.recorded) { - val ev = new PollRemovedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollStoppedOutMsg(msg:PollStoppedOutMsg):Unit = { - if (msg.recorded) { - val ev = new PollStoppedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollStartedOutMsg(msg:PollStartedOutMsg):Unit = { - if(msg.recorded) { - val ev = new PollStartedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(System.currentTimeMillis()) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollClearedOutMsg(msg:PollClearedOutMsg):Unit = { - if (msg.recorded) { - val ev = new PollClearedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala deleted file mode 100755 index 0329e21704..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala +++ /dev/null @@ -1,157 +0,0 @@ -package org.bigbluebutton.core.apps.presentation - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.MeetingActor -import com.google.gson.Gson - -case class CurrentPresenter(userId: String, name: String, assignedBy: String) - -case class CurrentPresentationInfo(presenter: CurrentPresenter, - presentations: Seq[Presentation]) -case class CursorLocation(xPercent: Double = 0D, yPercent: Double = 0D) - - - -trait PresentationApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - private var cursorLocation = new CursorLocation - private val presModel = new PresentationModel - - - def handlePreuploadedPresentations(msg: PreuploadedPresentations) { - val pres = msg.presentations - - msg.presentations.foreach(presentation => { - presModel.addPresentation(presentation) - - sharePresentation(presentation.id, true) - }) - } - - def handleInitializeMeeting(msg: InitializeMeeting) { - - } - - def handleClearPresentation(msg: ClearPresentation) { - outGW.send(new ClearPresentationOutMsg(meetingID, recorded)) - } - - def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { - outGW.send(new PresentationConversionProgress(meetingID, msg.messageKey, - msg.code, msg.presentationId, msg.presName)) - } - - def handlePresentationPageCountError(msg: PresentationPageCountError) { - outGW.send(new PresentationConversionError(meetingID, msg.messageKey, - msg.code, msg.presentationId, - msg.numberOfPages, - msg.maxNumberPages, msg.presName)) - } - - def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { - outGW.send(new PresentationPageGenerated(meetingID, msg.messageKey, - msg.code, msg.presentationId, - msg.numberOfPages, - msg.pagesCompleted, msg.presName)) - } - - def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { - - presModel.addPresentation(msg.presentation) - - outGW.send(new PresentationConversionDone(meetingID, recorded, msg.messageKey, - msg.code, msg.presentation)) - - sharePresentation(msg.presentation.id, true) - } - - def handleRemovePresentation(msg: RemovePresentation) { - val curPres = presModel.getCurrentPresentation - - val removedPresentation = presModel.remove(msg.presentationID) - - curPres foreach (cp => { - if (cp.id == msg.presentationID) { - sharePresentation(msg.presentationID, false); - } - }) - - outGW.send(new RemovePresentationOutMsg(msg.meetingID, recorded, msg.presentationID)) - - } - - def handleGetPresentationInfo(msg: GetPresentationInfo) { -// println("PresentationApp : handleGetPresentationInfo GetPresentationInfo for meeting [" + msg.meetingID + "] [" + msg.requesterID + "]" ) - - val curPresenter = getCurrentPresenter; - val presenter = new CurrentPresenter(curPresenter.presenterID, - curPresenter.presenterName, - curPresenter.assignedBy) - val presentations = presModel.getPresentations - val presentationInfo = new CurrentPresentationInfo(presenter, presentations) - outGW.send(new GetPresentationInfoOutMsg(meetingID, recorded, msg.requesterID, presentationInfo, msg.replyTo)) - } - - def handleSendCursorUpdate(msg: SendCursorUpdate) { - cursorLocation = new CursorLocation(msg.xPercent, msg.yPercent) - outGW.send(new SendCursorUpdateOutMsg(meetingID, recorded, msg.xPercent, msg.yPercent)) - } - - def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { - val page = presModel.resizePage(msg.xOffset, msg.yOffset, - msg.widthRatio, msg.heightRatio); - page foreach (p => outGW.send(new ResizeAndMoveSlideOutMsg(meetingID, recorded, p))) - } - - def handleGotoSlide(msg: GotoSlide) { -// println("Received GotoSlide for meeting=[" + msg.meetingID + "] page=[" + msg.page + "]") -// println("*** Before change page ****") -// printPresentations - presModel.changePage(msg.page) foreach {page => -// println("Switching page for meeting=[" + msg.meetingID + "] page=[" + page.id + "]") - outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) - } -// println("*** After change page ****") -// printPresentations - } - - def handleSharePresentation(msg: SharePresentation) { - sharePresentation(msg.presentationID, msg.share) - } - - def sharePresentation(presentationID: String, share: Boolean) { - val pres = presModel.sharePresentation(presentationID) - - pres foreach { p => - outGW.send(new SharePresentationOutMsg(meetingID, recorded, p)) - - presModel.getCurrentPage(p) foreach {page => - outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) - } - } - - } - - def handleGetSlideInfo(msg: GetSlideInfo) { - presModel.getCurrentPresentation foreach {pres => - presModel.getCurrentPage(pres) foreach {page => - outGW.send(new GetSlideInfoOutMsg(meetingID, recorded, msg.requesterID, page, msg.replyTo)) - } - } - - } - - def printPresentations() { - presModel.getPresentations foreach {pres => - println("presentation id=[" + pres.id + "] current=[" + pres.current + "]") - pres.pages.values foreach {page => - println("page id=[" + page.id + "] current=[" + page.current + "]") - } - } - - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala deleted file mode 100755 index 7f96eb4a09..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala +++ /dev/null @@ -1,128 +0,0 @@ -package org.bigbluebutton.core.apps.presentation - -case class Presentation(id: String, name: String, current: Boolean = false, - pages: scala.collection.immutable.HashMap[String, Page]) - -case class Page(id: String, num: Int, - thumbUri: String = "", - swfUri: String, - txtUri: String, - pngUri: String, - current: Boolean = false, - xOffset: Double = 0, yOffset: Double = 0, - widthRatio: Double = 100D, heightRatio: Double = 100D) - -class PresentationModel { - private var presentations = new scala.collection.immutable.HashMap[String, Presentation] - - def addPresentation(pres: Presentation) { - savePresentation(pres) - } - - def getPresentations():Seq[Presentation] = { - presentations.values.toSeq - } - - def getCurrentPresentation():Option[Presentation] = { - presentations.values find (p => p.current) - } - - def getCurrentPage(pres: Presentation):Option[Page] = { - pres.pages.values find (p => p.current) - } - - def remove(presId: String):Option[Presentation] = { - val pres = presentations.get(presId) - pres foreach (p => presentations -= p.id) - pres - } - - def sharePresentation(presId: String):Option[Presentation] = { - getCurrentPresentation foreach (curPres => { - if (curPres.id != presId) { - val newPres = curPres.copy(current = false) - savePresentation(newPres) - } - }) - - presentations.get(presId) match { - case Some(pres) => { - val cp = pres.copy(current = true) - savePresentation(cp) - Some(cp) - } - case None => None - } - } - - private def savePresentation(pres: Presentation) { - presentations += pres.id -> pres - } - - private def resizeCurrentPage(pres: Presentation, - xOffset: Double, yOffset: Double, - widthRatio: Double, - heightRatio: Double):Option[Page] = { - getCurrentPage(pres) match { - case Some(cp) => { - val page = cp.copy(xOffset = xOffset, yOffset = yOffset, - widthRatio= widthRatio, heightRatio = heightRatio) - val nPages = pres.pages + (page.id -> page) - val newPres = pres.copy(pages= nPages) - savePresentation(newPres) - Some(page) - } - case None => None - } - } - - def resizePage(xOffset: Double, yOffset: Double, - widthRatio: Double, heightRatio: Double):Option[Page] = { - for { - curPres <- getCurrentPresentation - page <- resizeCurrentPage(curPres, xOffset, yOffset, widthRatio, heightRatio) - } yield page - } - - private def deactivateCurrentPage(pres: Presentation) { - getCurrentPage(pres) foreach {cp => - val page = cp.copy(current = false) - val nPages = pres.pages + (page.id -> page) - val newPres = pres.copy(pages= nPages) - savePresentation(newPres) -// println("Making page[" + page.id + "] not current[" + page.current + "]") -// println("After deact page. presentation id=[" + newPres.id + "] current=[" + newPres.current + "]") -// newPres.pages.values foreach {page => -// println("page id=[" + page.id + "] current=[" + page.current + "]") -// } - } - } - - - private def makePageCurrent(pres: Presentation, page: String):Option[Page] = { - pres.pages.values find (p => p.id == page) match { - case Some(newCurPage) => { - val page = newCurPage.copy(current=true) - val newPages = pres.pages + (page.id -> page) - val newPres = pres.copy(pages= newPages) - savePresentation(newPres) -// println("Making page[" + page.id + "] current[" + page.current + "]") - Some(page) - } - case None => { -// println("Could not find page[" + page + "] in presentation [" + pres.id + "]") - None - } - } - } - - def changePage(pageId: String):Option[Page] = { - getCurrentPresentation foreach {pres => deactivateCurrentPage(pres)} - - for { - pres <- getCurrentPresentation - page <- makePageCurrent(pres, pageId) - } yield page - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/red5/PresentationClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/red5/PresentationClientMessageSender.scala deleted file mode 100755 index fc7ec4bb29..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/red5/PresentationClientMessageSender.scala +++ /dev/null @@ -1,295 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.red5 - -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage -import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage -import collection.JavaConversions._ -import com.google.gson.Gson -import java.util.ArrayList -import org.bigbluebutton.core.apps.presentation.Page -import org.bigbluebutton.core.apps.presentation.Presentation - - -class PresentationClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 { - - private val OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS"; - private val OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED"; - private val SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT"; - private val UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT"; - private val PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED"; - private val PAGE_COUNT_EXCEEDED_KEY = "PAGE_COUNT_EXCEEDED"; - private val GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; - private val GENERATING_THUMBNAIL_KEY = "GENERATING_THUMBNAIL"; - private val GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL"; - private val CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) - case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) - case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) - case msg: PresentationConversionError => handlePresentationConversionError(msg) - case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) - case msg: PresentationConversionDone => handlePresentationConversionDone(msg) - case _ => // do nothing - } - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - - } - - private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { - val args = new java.util.HashMap[String, String](); - args.put("meetingID", msg.meetingID); - args.put("code", msg.code); - args.put("presentationID", msg.presentationId); - args.put("presentationName", msg.presentationName); - args.put("messageKey", msg.messageKey); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("PresentationClientMessageSender - handlePresentationConversionProgress \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "conversionUpdateMessageCallback", message); - service.sendMessage(m); - } - - private def handlePresentationConversionError(msg: PresentationConversionError) { - val args = new java.util.HashMap[String, String](); - args.put("meetingID", msg.meetingID); - args.put("code", msg.code); - args.put("presentationID", msg.presentationId); - args.put("presentationName", msg.presentationName); - args.put("messageKey", msg.messageKey); - args.put("numberOfPages", msg.numberOfPages.toString); - args.put("maxNumberPages", msg.maxNumberPages.toString); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("PresentationClientMessageSender - handlePresentationConversionError \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "pageCountExceededUpdateMessageCallback", message); - service.sendMessage(m); - } - - private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { - val args = new java.util.HashMap[String, String](); - args.put("meetingID", msg.meetingID); - args.put("code", msg.code); - args.put("presentationID", msg.presentationId); - args.put("presentationName", msg.presentationName); - args.put("messageKey", msg.messageKey); - args.put("numberOfPages", msg.numberOfPages.toString); - args.put("pagesCompleted", msg.pagesCompleted.toString); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("PresentationClientMessageSender - handlePresentationPageGenerated \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "generatedSlideUpdateMessageCallback", message); - service.sendMessage(m); - } - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - val args = new java.util.HashMap[String, Object]() - args.put("meetingID", msg.meetingID); - args.put("code", msg.code); - - val presentation = new java.util.HashMap[String, Object](); - presentation.put("id", msg.presentation.id) - presentation.put("name", msg.presentation.name) - presentation.put("current", msg.presentation.current:java.lang.Boolean) - - val pages = new ArrayList[Page]() - - msg.presentation.pages.values foreach {p => -// println("PresentationClientMessageSender **** Page [" + p.id + "," + p.num + "]") - pages.add(p) - } - - presentation.put("pages", pages) - - args.put("presentation", presentation); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("PresentationClientMessageSender - handlePresentationConversionDone \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "conversionCompletedUpdateMessageCallback", message); - service.sendMessage(m); - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - val args = new java.util.HashMap[String, Object](); - args.put("presentationID", msg.presentationID); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new BroadcastClientMessage(msg.meetingID, "removePresentationCallback", message); - service.sendMessage(m); - } - - private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { - val info = msg.info - - // Build JSON - val args = new java.util.HashMap[String, Object]() - args.put("meetingID", msg.meetingID); - - // Create a map for our current presenter - val presenter = new java.util.HashMap[String, String]() - presenter.put("userId", info.presenter.userId) - presenter.put("name", info.presenter.name) - presenter.put("assignedBy", info.presenter.assignedBy) - - args.put("presenter", presenter) - - // Create an array for our presentations - val presentations = new ArrayList[java.util.HashMap[String, Object]] - info.presentations.foreach { pres => - val presentation = new java.util.HashMap[String, Object](); - presentation.put("id", pres.id) - presentation.put("name", pres.name) - presentation.put("current", pres.current:java.lang.Boolean) - - // Get the pages for a presentation - val pages = new ArrayList[Page]() - pres.pages.values foreach {p => - pages.add(p) - } - // store the pages in the presentation - presentation.put("pages", pages) - - // add this presentation into our presentations list - presentations.add(presentation); - } - - // add the presentation to our map to complete our json - args.put("presentations", presentations) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("***** PresentationClientMessageSender - handleGetPresentationInfoOutMsg to user[" +msg.requesterID + "] message[" + message.get("msg") + "]") - - val m = new DirectClientMessage(msg.meetingID, msg.requesterID, "getPresentationInfoReply", message); - service.sendMessage(m); - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - val args = new java.util.HashMap[String, Object](); - args.put("xPercent", msg.xPercent:java.lang.Double); - args.put("yPercent", msg.yPercent:java.lang.Double); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new BroadcastClientMessage(msg.meetingID, "PresentationCursorUpdateCommand", message); - service.sendMessage(m); - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - val args = new java.util.HashMap[String, Object](); - args.put("id", msg.page.id) - args.put("num", msg.page.num:java.lang.Integer) - args.put("current", msg.page.current:java.lang.Boolean) - args.put("swfUri", msg.page.swfUri) - args.put("txtUri", msg.page.txtUri) - args.put("pngUri", msg.page.pngUri) - args.put("thumbUri", msg.page.thumbUri) - args.put("xOffset", msg.page.xOffset:java.lang.Double); - args.put("yOffset", msg.page.yOffset:java.lang.Double); - args.put("widthRatio", msg.page.widthRatio:java.lang.Double); - args.put("heightRatio", msg.page.heightRatio:java.lang.Double); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new BroadcastClientMessage(msg.meetingID, "moveCallback", message); - service.sendMessage(m); - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - val args = new java.util.HashMap[String, Object](); - args.put("id", msg.page.id) - args.put("num", msg.page.num:java.lang.Integer) - args.put("current", msg.page.current:java.lang.Boolean) - args.put("swfUri", msg.page.swfUri) - args.put("txtUri", msg.page.txtUri) - args.put("pngUri", msg.page.pngUri) - args.put("thumbUri", msg.page.thumbUri) - args.put("xOffset", msg.page.xOffset:java.lang.Double); - args.put("yOffset", msg.page.yOffset:java.lang.Double); - args.put("widthRatio", msg.page.widthRatio:java.lang.Double); - args.put("heightRatio", msg.page.heightRatio:java.lang.Double); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new BroadcastClientMessage(msg.meetingID, "goToSlideCallback", message); - service.sendMessage(m); - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - val args = new java.util.HashMap[String, Object](); - - val presentation = new java.util.HashMap[String, Object](); - presentation.put("id", msg.presentation.id) - presentation.put("name", msg.presentation.name) - presentation.put("current", msg.presentation.current:java.lang.Boolean) - - // Get the pages for a presentation - val pages = new ArrayList[Page]() - msg.presentation.pages.values foreach {p => - pages.add(p) - } - // store the pages in the presentation - presentation.put("pages", pages) - - args.put("presentation", presentation); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new BroadcastClientMessage(msg.meetingID, "sharePresentationCallback", message); - service.sendMessage(m); - } - - private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { - val args = new java.util.HashMap[String, Object](); - args.put("xOffset", msg.page.xOffset:java.lang.Double); - args.put("yOffest", msg.page.yOffset:java.lang.Double); - args.put("widthRatio", msg.page.widthRatio:java.lang.Double); - args.put("heightRatio", msg.page.heightRatio:java.lang.Double); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new DirectClientMessage(msg.meetingID, msg.requesterID, "getPresentationInfoReply", message); - service.sendMessage(m); - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala deleted file mode 100755 index e6833b11a0..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala +++ /dev/null @@ -1,281 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.core.apps.presentation.Page -import collection.JavaConverters._ -import scala.collection.JavaConversions._ - -object PesentationMessageToJsonConverter { - private def pageToMap(page: Page):java.util.Map[String, Any] = { - val res = new scala.collection.mutable.HashMap[String, Any] - res += "id" -> page.id - res += "num" -> page.num - res += "thumb_uri" -> page.thumbUri - res += "swf_uri" -> page.swfUri - res += "txt_uri" -> page.txtUri - res += "png_uri" -> page.pngUri - res += "current" -> page.current - res += "x_offset" -> page.xOffset - res += "y_offset" -> page.yOffset - res += "width_ratio" -> page.widthRatio - res += "height_ratio" -> page.heightRatio - - mapAsJavaMap(res) - } - - def clearPresentationOutMsgToJson(msg: ClearPresentationOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CLEARED, msg.version, None) - Util.buildJson(header, payload) - } - - def removePresentationOutMsgToJson(msg: RemovePresentationOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationID) - - val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) - Util.buildJson(header, payload) - } - - def getPresentationInfoOutMsgToJson(msg: GetPresentationInfoOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_INFO, msg.info) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val info = msg.info - - // Create a map for our current presenter - val presenter = new java.util.HashMap[String, String]() - presenter.put(Constants.USER_ID, info.presenter.userId) - presenter.put(Constants.NAME, info.presenter.name) - presenter.put(Constants.ASSIGNED_BY, info.presenter.assignedBy) - - payload.put(Constants.PRESENTER, presenter) - - // Create an array for our presentations - val presentations = new java.util.ArrayList[java.util.HashMap[String, Object]] - info.presentations.foreach { pres => - val presentation = new java.util.HashMap[String, Object]() - presentation.put(Constants.ID, pres.id) - presentation.put(Constants.NAME, pres.name) - presentation.put(Constants.CURRENT, pres.current:java.lang.Boolean) - - // Get the pages for a presentation - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - pres.pages.values foreach {p => - pages.add(pageToMap(p)) - } - // store the pages in the presentation - presentation.put(Constants.PAGES, pages) - - // add this presentation into our presentations list - presentations.add(presentation); - } - - // add the presentation to our map to complete our json - payload.put(Constants.PRESENTATIONS, presentations) - - val header = Util.buildHeader(MessageNames.GET_PRESENTATION_INFO_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendCursorUpdateOutMsgToJson(msg: SendCursorUpdateOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.X_PERCENT, msg.xPercent) - payload.put(Constants.Y_PERCENT, msg.yPercent) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CURSOR_UPDATED, msg.version, None) - Util.buildJson(header, payload) - } - - def resizeAndMoveSlideOutMsgToJson(msg: ResizeAndMoveSlideOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_RESIZED, msg.version, None) - Util.buildJson(header, payload) - } - - def gotoSlideOutMsgToJson(msg: GotoSlideOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def sharePresentationOutMsgToJson(msg: SharePresentationOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val presentation = new java.util.HashMap[String, Object](); - presentation.put(Constants.ID, msg.presentation.id) - presentation.put(Constants.NAME, msg.presentation.name) - presentation.put(Constants.CURRENT, msg.presentation.current:java.lang.Boolean) - - // Get the pages for a presentation - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.presentation.pages.values foreach {p => - pages.add(pageToMap(p)) - } - - // store the pages in the presentation - presentation.put(Constants.PAGES, pages) - - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.PRESENTATION_SHARED, msg.version, None) - Util.buildJson(header, payload) - } - - def getSlideInfoOutMsgToJson(msg: GetSlideInfoOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.GET_SLIDE_INFO_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def getPreuploadedPresentationsOutMsgToJson(msg: GetPreuploadedPresentationsOutMsg):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.GET_PREUPLOADED_PRESENTATIONS, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationConversionProgressToJson(msg: PresentationConversionProgress):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presentationName) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_PROGRESS, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationConversionErrorToJson(msg: PresentationConversionError):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presentationName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_ERROR, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationPageGenerated(msg: PresentationPageGenerated):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presentationName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_GENERATED, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationConversionDoneToJson(msg: PresentationConversionDone):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - - val presentation = new java.util.HashMap[String, Object](); - presentation.put(Constants.ID, msg.presentation.id) - presentation.put(Constants.NAME, msg.presentation.name) - presentation.put(Constants.CURRENT, msg.presentation.current:java.lang.Boolean) - - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.presentation.pages.values foreach {p => - pages.add(pageToMap(p)) - } - - presentation.put(Constants.PAGES, pages) - - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_DONE, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationChangedToJson(msg: PresentationChanged):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - val presentation = new java.util.HashMap[String, Object](); - presentation.put(Constants.ID, msg.presentation.id) - presentation.put(Constants.NAME, msg.presentation.name) - presentation.put(Constants.CURRENT, msg.presentation.current:java.lang.Boolean) - - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.presentation.pages.values foreach {p => - pages.add(pageToMap(p)) - } - - presentation.put(Constants.PAGES, pages) - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.PRESENTATION_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def getPresentationStatusReplyToJson(msg: GetPresentationStatusReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - val presentation = new java.util.HashMap[String, Object](); - - presentation.put(Constants.ID, msg.current.id) - presentation.put(Constants.NAME, msg.current.name) - presentation.put(Constants.CURRENT, msg.current.current:java.lang.Boolean) - - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - - msg.current.pages.values foreach {p => - pages.add(pageToMap(p)) - } - - presentation.put(Constants.PAGES, pages) - - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.GET_PRESENTATION_STATUS_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def presentationRemovedToJson(msg: PresentationRemoved):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - - val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) - Util.buildJson(header, payload) - } - - def pageChangedToJson(msg: PageChanged):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala deleted file mode 100755 index 37977b0a09..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala +++ /dev/null @@ -1,111 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.redis - -import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants - -class PresentationEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) - case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) - case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) - case msg: PresentationConversionError => handlePresentationConversionError(msg) - case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) - case msg: PresentationConversionDone => handlePresentationConversionDone(msg) - case _ => // do nothing - } - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { - val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { - val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationConversionError(msg: PresentationConversionError) { - val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { - val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationChanged(msg: PresentationChanged) { - val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { - val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationRemoved(msg: PresentationRemoved) { - val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePageChanged(msg: PageChanged) { - val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala deleted file mode 100644 index c47cf19039..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala +++ /dev/null @@ -1,128 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.core.api.IOutMessage -import org.bigbluebutton.conference.service.recorder.presentation.GenerateSlidePresentationRecordEvent -import org.bigbluebutton.conference.service.recorder.presentation.ConversionCompletedPresentationRecordEvent -import org.bigbluebutton.core.api.GotoSlideOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.GotoSlidePresentationRecordEvent -import org.bigbluebutton.core.api.ResizeAndMoveSlideOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.ResizeAndMoveSlidePresentationRecordEvent -import org.bigbluebutton.core.api.RemovePresentationOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.RemovePresentationPresentationRecordEvent -import org.bigbluebutton.core.api.SharePresentationOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.SharePresentationPresentationRecordEvent -import org.bigbluebutton.core.api.SendCursorUpdateOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.CursorUpdateRecordEvent -import org.bigbluebutton.core.api.ClearPresentationOutMsg -import org.bigbluebutton.core.api.PresentationConversionDone -import org.bigbluebutton.core.api.TimestampGenerator - -class PresentationEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - private val GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; - private val CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case _ => // do nothing - } - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - - } - - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - if (msg.recorded) { - val event = new ConversionCompletedPresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setPresentationName(msg.presentation.id); - event.setOriginalFilename(msg.presentation.name); - recorder.record(msg.meetingID, event); - } - - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - if (msg.recorded) { - val event = new GotoSlidePresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setSlide(msg.page.num); - event.setId(msg.page.id); - event.setNum(msg.page.num); - event.setThumbUri(msg.page.thumbUri); - event.setSwfUri(msg.page.swfUri); - event.setTxtUri(msg.page.txtUri); - event.setPngUri(msg.page.pngUri); - event.setXOffset(msg.page.xOffset); - event.setYOffset(msg.page.yOffset); - event.setWidthRatio(msg.page.widthRatio); - event.setHeightRatio(msg.page.heightRatio); - recorder.record(msg.meetingID, event); - } - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - if (msg.recorded) { - val event = new ResizeAndMoveSlidePresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setId(msg.page.id); - event.setNum(msg.page.num); - event.setThumbUri(msg.page.thumbUri); - event.setSwfUri(msg.page.swfUri); - event.setTxtUri(msg.page.txtUri); - event.setPngUri(msg.page.pngUri); - event.setXOffset(msg.page.xOffset); - event.setYOffset(msg.page.yOffset); - event.setWidthRatio(msg.page.widthRatio); - event.setHeightRatio(msg.page.heightRatio); - - recorder.record(msg.meetingID, event); - } - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - if (msg.recorded) { - val event = new RemovePresentationPresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setPresentationName(msg.presentationID); - recorder.record(msg.meetingID, event); - } - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - if (msg.recorded) { - val event = new SharePresentationPresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setPresentationName(msg.presentation.id); - event.setOriginalFilename(msg.presentation.name); - event.setShare(true); - recorder.record(msg.meetingID, event); - } - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - if (msg.recorded) { - val event = new CursorUpdateRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setXPercent(msg.xPercent); - event.setYPercent(msg.yPercent); - - recorder.record(msg.meetingID, event); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala deleted file mode 100755 index 4148bbfe65..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala +++ /dev/null @@ -1,133 +0,0 @@ -package org.bigbluebutton.core.apps.users - -import org.bigbluebutton.core.models.{UserV, Voice} -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.api.Role._ - -class Users { - - private val users = collection.mutable.HashMap[String, UserV]() - - /** - * Add a new user. - */ - def add(user: UserV) = users += user.id -> user - - /** - * Returns the number of users. - */ - def count = users.size - - /** - * Removes a user. - */ - def remove(id: String) = users -= id - - /** - * Gets a user. - */ - def get(id: String):Option[UserV] = users.values.find(u => u.id == id) - - /** - * Get all users. - */ - def all():Array[UserV] = users.values.toArray - - def getPresenter():Option[UserV] = users.values.find(u => u.status.isPresenter) - - def makeEveryoneNotPresenter():Unit = { - users.values map (u => { - val p = u.copy(status = u.status.copy(isPresenter=false)) - users += p.id -> p - }) - } - - def makePresenter(id:String):Option[UserV] = { - var newPresenter: Option[UserV] = None - get(id) match { - case Some(u) => { - val p = u.copy(status = u.status.copy(isPresenter=true)) - newPresenter = Some(p) - users += p.id -> p - } - case None => - } - newPresenter - } - - def moderatorCount:Int = users.values.filter(u => u.role == MODERATOR).size - - def getVoiceUser(id:String):Option[UserV] = users.values.find(u => u.voice.id == id) - - def mute(id:String):Option[UserV] = { - var user:Option[UserV] = None - getVoiceUser(id) match { - case Some(u) => { - val mutedUser = u.copy(voice=u.voice.copy(muted=true)) - users += mutedUser.id -> mutedUser - user = Some(mutedUser) - } - case None => - } - - user - } - - def unmute(id:String):Option[UserV] = { - var user:Option[UserV] = None - getVoiceUser(id) match { - case Some(u) => { - val unmutedUser = u.copy(voice=u.voice.copy(muted=false)) - users += unmutedUser.id -> unmutedUser - user = Some(unmutedUser) - } - case None => - } - - user - } - - def lockVoice(id:String, lock: Boolean):Option[UserV] = { - var user:Option[UserV] = None - get(id) match { - case Some(u) => { - val lockedUser = u.copy(voice=u.voice.copy(locked=lock)) - users += lockedUser.id -> lockedUser - user = Some(lockedUser) - } - case None => - } - - user - } - - def joinedVoice(id:String, voice: Voice):Option[UserV] = { - var user:Option[UserV] = None - get(id) match { - case Some(u) => { - val voiceUser = u.copy(voice=voice) - users += voiceUser.id -> voiceUser - user = Some(voiceUser) - } - case None => - } - - user - } - - def leftVoice(id:String):Option[UserV] = { - var user:Option[UserV] = None - getVoiceUser(id) match { - case Some(u) => { - val voiceUser = u.copy(voice=Voice()) - users += voiceUser.id -> voiceUser - user = Some(voiceUser) - } - case None => - } - - user - } - - def unlockedUsers():Array[UserV] = users.values filter (u => !u.voice.locked) toArray -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala deleted file mode 100755 index 451237ef67..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala +++ /dev/null @@ -1,448 +0,0 @@ -package org.bigbluebutton.core.apps.users - -import org.bigbluebutton.core.api._ -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.User -import java.util.ArrayList -import org.bigbluebutton.core.MeetingActor -import scala.collection.mutable.ArrayBuffer -import scala.collection.immutable.ListSet - -trait UsersApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - val users = new UsersModel - private var regUsers = new collection.immutable.HashMap[String, RegisteredUser] - - private var locked = false - private var meetingMuted = false - - private var currentPresenter = new Presenter("system", "system", "system") - - def hasUser(userID: String):Boolean = { - users.hasUser(userID) - } - - def getUser(userID:String):Option[UserVO] = { - users.getUser(userID) - } - - def getCurrentPresenter:Presenter = { - currentPresenter - } - - def handleUserConnectedToGlobalAudio(msg: UserConnectedToGlobalAudio) { - val user = users.getUserWithExternalId(msg.userid) - user foreach {u => - val vu = u.voiceUser.copy(talking=false) - val uvo = u.copy(listenOnly=true, voiceUser=vu) - users.addUser(uvo) - log.info("UserConnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") - outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) - } - } - - def handleUserDisconnectedFromGlobalAudio(msg: UserDisconnectedFromGlobalAudio) { - val user = users.getUserWithExternalId(msg.userid) - user foreach {u => - val uvo = u.copy(listenOnly=false) - users.addUser(uvo) - log.info("UserDisconnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") - outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) - } - } - - - def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { - meetingMuted = msg.mute - outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) - - usersWhoAreNotPresenter foreach {u => - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) - } - } - - def handleMuteMeetingRequest(msg: MuteMeetingRequest) { - meetingMuted = msg.mute - outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) - users.getUsers foreach {u => - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) - } - } - - def handleValidateAuthToken(msg: ValidateAuthToken) { -// println("*************** Got ValidateAuthToken message ********************" ) - regUsers.get (msg.token) match { - case Some(u) => - { - val replyTo = meetingID + '/' + msg.userId - - //send the reply - outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, true, msg.correlationId, msg.sessionId)) - - //join the user - handleUserJoin(new UserJoining(meetingID, msg.userId, msg.token)) - - //send the presentation - log.info("ValidateToken success: mid=[" + meetingID + "] uid=[" + msg.userId + "]") - } - case None => { - log.info("ValidateToken failed: mid=[" + meetingID + "] uid=[" + msg.userId + "]") - outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId)) - } - } - - /** - * Send a reply to BigBlueButtonActor to let it know this MeetingActor hasn't hung! - * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple - * audit to check whether the actor is still alive. (ralam feb 25, 2015) - */ - sender ! new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId) - } - - def handleRegisterUser(msg: RegisterUser) { - if (hasMeetingEnded) { - // Check first if the meeting has ended and the user refreshed the client to re-connect. - log.info("Register user failed: reason=[meeting has ended] mid=[" + meetingID + "] uid=[" + msg.userID + "]") - sendMeetingHasEnded(msg.userID) - } else { - val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken) - regUsers += msg.authToken -> regUser - log.info("Register user success: mid=[" + meetingID + "] uid=[" + msg.userID + "]") - outGW.send(new UserRegistered(meetingID, recorded, regUser)) - } - - } - - def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { - outGW.send(new IsMeetingMutedReply(meetingID, recorded, msg.requesterID, meetingMuted)) - } - - def handleMuteUserRequest(msg: MuteUserRequest) { -// println("Received mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") - users.getUser(msg.userID) match { - case Some(u) => { -// println("Sending mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") - log.info("Muting user: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) - } - case None => { - log.info("Could not find user to mute: mid=[" + meetingID + "] uid=[" + msg.userID + "]") -// println("Could not find user to mute. uid=[" + msg.userID + "] mute=[" + msg.mute + "]") - } - } - } - - def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { -// println("Received eject user request uid=[" + msg.userID + "]") - users.getUser(msg.userId) match { - case Some(u) => { - if (u.voiceUser.joined) { - log.info("Ejecting user from voice: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, u.userID)) - } - } - case None => // do nothing - } - } - - def handleGetLockSettings(msg: GetLockSettings) { - //println("*************** Reply with current lock settings ********************") - - //reusing the existing handle for NewPermissionsSettings to reply to the GetLockSettings request - outGW.send(new NewPermissionsSetting(meetingID, msg.userId, permissions, users.getUsers)) - } - - def handleSetLockSettings(msg: SetLockSettings) { -// println("*************** Received new lock settings ********************") - if (!permissionsEqual(msg.settings)) { - newPermissions(msg.settings) - outGW.send(new NewPermissionsSetting(meetingID, msg.setByUser, permissions, users.getUsers)) - - handleLockLayout(msg.settings.lockedLayout, msg.setByUser) - } - } - - def handleLockUserRequest(msg: LockUserRequest) { - users.getUser(msg.userID) match { - case Some(u) => { - val uvo = u.copy(locked=msg.lock) - users.addUser(uvo) - - log.info("Lock user: mid=[" + meetingID + "] uid=[" + u.userID + "] lock=[" + msg.lock + "]") - outGW.send(new UserLocked(meetingID, u.userID, msg.lock)) - } - case None => { - log.info("Could not find user to lock: mid=[" + meetingID + "] uid=[" + msg.userID + "] lock=[" + msg.lock + "]") - } - } - } - - def handleInitLockSettings(msg: InitLockSettings) { - if (! permissionsInited) { - permissionsInited = true - newPermissions(msg.settings) - outGW.send(new PermissionsSettingInitialized(msg.meetingID, msg.settings, users.getUsers)) - } - } - - def handleInitAudioSettings(msg: InitAudioSettings) { - if (! audioSettingsInited) { - audioSettingsInited = true - if(meetingMuted != msg.muted) { - handleMuteAllExceptPresenterRequest(new MuteAllExceptPresenterRequest(meetingID, msg.requesterID, msg.muted)); - } - } - } - - def usersWhoAreNotPresenter():Array[UserVO] = { - val au = ArrayBuffer[UserVO]() - - users.getUsers foreach {u => - if (! u.presenter) { - au += u - } - } - au.toArray - } - - def handleUserRaiseHand(msg: UserRaiseHand) { - users.getUser(msg.userId) foreach {user => - val uvo = user.copy(raiseHand=true) - users.addUser(uvo) - outGW.send(new UserRaisedHand(meetingID, recorded, uvo.userID)) - } - } - - def handleUserLowerHand(msg: UserLowerHand) { - users.getUser(msg.userId) foreach {user => - val uvo = user.copy(raiseHand=false) - users.addUser(uvo) - outGW.send(new UserLoweredHand(meetingID, recorded, uvo.userID, msg.loweredBy)) - } - } - - def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) { - users.getUser(msg.userId) foreach {user => - if (user.voiceUser.joined) { - outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, msg.userId)) - } - - users.removeUser(msg.userId) - - log.info("Ejecting user from meeting: mid=[" + meetingID + "]uid=[" + msg.userId + "]") - outGW.send(new UserEjectedFromMeeting(meetingID, recorded, msg.userId, msg.ejectedBy)) - outGW.send(new DisconnectUser(meetingID, msg.userId)) - - outGW.send(new UserLeft(msg.meetingID, recorded, user)) - } - } - - def handleUserShareWebcam(msg: UserShareWebcam) { - users.getUser(msg.userId) foreach {user => - val streams = user.webcamStreams + msg.stream - val uvo = user.copy(hasStream=true, webcamStreams=streams) - users.addUser(uvo) - log.info("User shared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] sharedStream=[" + msg.stream + "] streams=[" + streams + "]") - outGW.send(new UserSharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) - } - } - - def handleUserunshareWebcam(msg: UserUnshareWebcam) { - users.getUser(msg.userId) foreach {user => - val streams = user.webcamStreams - msg.stream - val uvo = user.copy(hasStream=(!streams.isEmpty), webcamStreams=streams) - users.addUser(uvo) - log.info("User unshared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] unsharedStream=[" + msg.stream + "] streams=[" + streams + "]") - outGW.send(new UserUnsharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) - } - } - - def handleChangeUserStatus(msg: ChangeUserStatus):Unit = { - if (users.hasUser(msg.userID)) { - outGW.send(new UserStatusChange(meetingID, recorded, msg.userID, msg.status, msg.value)) - } - } - - def handleGetUsers(msg: GetUsers):Unit = { - outGW.send(new GetUsersReply(msg.meetingID, msg.requesterID, users.getUsers)) - } - - def handleUserJoin(msg: UserJoining):Unit = { - val regUser = regUsers.get(msg.authToken) - regUser foreach { ru => - val vu = new VoiceUser(msg.userID, msg.userID, ru.name, ru.name, - false, false, false, false) - val uvo = new UserVO(msg.userID, ru.externId, ru.name, - ru.role, raiseHand=false, presenter=false, - hasStream=false, locked=getInitialLockStatus(ru.role), - webcamStreams=new ListSet[String](), phoneUser=false, vu, listenOnly=false) - - users.addUser(uvo) - - log.info("User joined meeting: mid=[" + meetingID + "] uid=[" + uvo.userID + "] role=[" + uvo.role + "] locked=[" + uvo.locked + "] permissions.lockOnJoin=[" + permissions.lockOnJoin + "] permissions.lockOnJoinConfigurable=[" + permissions.lockOnJoinConfigurable + "]") - outGW.send(new UserJoined(meetingID, recorded, uvo)) - - outGW.send(new MeetingState(meetingID, recorded, uvo.userID, permissions, meetingMuted)) - - // Become presenter if the only moderator - if (users.numModerators == 1) { - if (ru.role == Role.MODERATOR) { - assignNewPresenter(msg.userID, ru.name, msg.userID) - } - } - webUserJoined - startRecordingIfAutoStart() - } - } - - def handleUserLeft(msg: UserLeaving):Unit = { - if (users.hasUser(msg.userID)) { - val user = users.removeUser(msg.userID) - user foreach { u => - log.info("User left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new UserLeft(msg.meetingID, recorded, u)) - - if (u.presenter) { - /* The current presenter has left the meeting. Find a moderator and make - * him presenter. This way, if there is a moderator in the meeting, there - * will always be a presenter. - */ - val moderator = users.findAModerator() - moderator.foreach { mod => - log.info("Presenter left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]. Making user=[" + mod.userID + "] presenter.") - assignNewPresenter(mod.userID, mod.name, mod.userID) - } - } - } - - startCheckingIfWeNeedToEndVoiceConf() - stopAutoStartedRecording() - } - } - - def getInitialLockStatus(role: Role.Role):Boolean = { - permissions.lockOnJoin && !role.equals(Role.MODERATOR) - } - - def handleUserJoinedVoiceFromPhone(msg: VoiceUserJoined) = { - val user = users.getUserWithVoiceUserId(msg.voiceUser.userId) match { - case Some(user) => { - log.info("Voice user=[" + msg.voiceUser.userId + "] is already in conf=[" + voiceBridge + "]. Must be duplicate message.") - } - case None => { - // No current web user. This means that the user called in through - // the phone. We need to generate a new user as we are not able - // to match with a web user. - val webUserId = users.generateWebUserId - val vu = new VoiceUser(msg.voiceUser.userId, webUserId, - msg.voiceUser.callerName, msg.voiceUser.callerNum, - true, false, false, false) - - val sessionId = "PHONE-" + webUserId; - - val uvo = new UserVO(webUserId, webUserId, msg.voiceUser.callerName, - Role.VIEWER, raiseHand=false, presenter=false, - hasStream=false, locked=getInitialLockStatus(Role.VIEWER), webcamStreams=new ListSet[String](), - phoneUser=true, vu, listenOnly=false) - - users.addUser(uvo) - log.info("New user joined voice for user [" + uvo.name + "] userid=[" + msg.voiceUser.webUserId + "]") - outGW.send(new UserJoined(meetingID, recorded, uvo, sessionId)) - - outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, uvo)) - if (meetingMuted) - outGW.send(new MuteVoiceUser(meetingID, recorded, uvo.userID, uvo.userID, meetingMuted)) - - } - } - } - - def handleVoiceUserJoined(msg: VoiceUserJoined) = { - val user = users.getUser(msg.voiceUser.webUserId) match { - case Some(user) => { - val nu = user.copy(voiceUser=msg.voiceUser) - users.addUser(nu) - log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.voiceUser.webUserId + "]" ) - outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) - - if (meetingMuted) - outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, meetingMuted)) - } - case None => { - handleUserJoinedVoiceFromPhone(msg) - } - } - } - - def handleVoiceUserLeft(msg: VoiceUserLeft) { - users.getUser(msg.userId) foreach {user => - val vu = new VoiceUser(user.userID, user.userID, user.name, user.name, - false, false, false, false) - val nu = user.copy(voiceUser=vu) - users.addUser(nu) - -// println("Received voice user left =[" + user.name + "] wid=[" + msg.userId + "]" ) - log.info("Received user left voice for user [" + nu.name + "] userid=[" + msg.userId + "]" ) - outGW.send(new UserLeftVoice(meetingID, recorded, voiceBridge, nu)) - - if (user.phoneUser) { - if (users.hasUser(user.userID)) { - val userLeaving = users.removeUser(user.userID) - userLeaving foreach (u => outGW.send(new UserLeft(msg.meetingID, recorded, u))) - } - } - } - } - - def handleVoiceUserMuted(msg: VoiceUserMuted) { - users.getUser(msg.userId) foreach {user => - val talking:Boolean = if (msg.muted) false else user.voiceUser.talking - val nv = user.voiceUser.copy(muted=msg.muted, talking=talking) - val nu = user.copy(voiceUser=nv) - users.addUser(nu) -// println("Received voice muted=[" + msg.muted + "] wid=[" + msg.userId + "]" ) - outGW.send(new UserVoiceMuted(meetingID, recorded, voiceBridge, nu)) - } - } - - def handleVoiceUserTalking(msg: VoiceUserTalking) { - users.getUser(msg.userId) foreach {user => - val nv = user.voiceUser.copy(talking=msg.talking) - val nu = user.copy(voiceUser=nv) - users.addUser(nu) -// println("Received voice talking=[" + msg.talking + "] wid=[" + msg.userId + "]" ) - outGW.send(new UserVoiceTalking(meetingID, recorded, voiceBridge, nu)) - } - } - - def handleAssignPresenter(msg: AssignPresenter):Unit = { - assignNewPresenter(msg.newPresenterID, msg.newPresenterName, msg.assignedBy) - } - - def assignNewPresenter(newPresenterID:String, newPresenterName: String, assignedBy: String) { - if (users.hasUser(newPresenterID)) { - - users.getCurrentPresenter match { - case Some(curPres) => { - users.unbecomePresenter(curPres.userID) - outGW.send(new UserStatusChange(meetingID, recorded, curPres.userID, "presenter", false:java.lang.Boolean)) - } - case None => // do nothing - } - - users.getUser(newPresenterID) match { - case Some(newPres) => { - users.becomePresenter(newPres.userID) - currentPresenter = new Presenter(newPresenterID, newPresenterName, assignedBy) - outGW.send(new PresenterAssigned(meetingID, recorded, new Presenter(newPresenterID, newPresenterName, assignedBy))) - outGW.send(new UserStatusChange(meetingID, recorded, newPresenterID, "presenter", true:java.lang.Boolean)) - } - case None => // do nothing - } - - } - } -} diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala deleted file mode 100755 index 5642ecf785..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala +++ /dev/null @@ -1,101 +0,0 @@ -package org.bigbluebutton.core.apps.users - -import org.bigbluebutton.core.User -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.api.Role._ -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.api.VoiceUser -import org.bigbluebutton.core.util.RandomStringGenerator - -class UsersModel { - private var uservos = new collection.immutable.HashMap[String, UserVO] - - def generateWebUserId:String = { - val webUserId = RandomStringGenerator.randomAlphanumericString(6) - if (! hasUser(webUserId)) webUserId else generateWebUserId - } - - def addUser(uvo: UserVO) { - uservos += uvo.userID -> uvo - } - - def removeUser(userId: String):Option[UserVO] = { - val user = uservos get (userId) - user foreach (u => uservos -= userId) - - user - } - - def hasSessionId(sessionId: String):Boolean = { - uservos.contains(sessionId) - } - - def hasUser(userID: String):Boolean = { - uservos.contains(userID) - } - - def numUsers():Int = { - uservos.size - } - - def numWebUsers():Int = { - uservos.values filter (u => u.phoneUser == false) size - } - - def getUserWithExternalId(userID:String):Option[UserVO] = { - uservos.values find (u => u.externUserID == userID) - } - - def getUserWithVoiceUserId(voiceUserId: String):Option[UserVO] = { - uservos.values find (u => u.voiceUser.userId == voiceUserId) - } - - def getUser(userID:String):Option[UserVO] = { - uservos.values find (u => u.userID == userID) - } - - def getUsers():Array[UserVO] = { - uservos.values toArray - } - - def numModerators():Int = { - getModerators.length - } - - def findAModerator():Option[UserVO] = { - uservos.values find (u => u.role == MODERATOR) - } - - def getCurrentPresenter():Option[UserVO] = { - uservos.values find (u => u.presenter == true) - } - - def unbecomePresenter(userID: String) = { - uservos.get(userID) match { - case Some(u) => { - val nu = u.copy(presenter = false) - uservos += nu.userID -> nu - } - case None => // do nothing - } - } - - def becomePresenter(userID: String) = { - uservos.get(userID) match { - case Some(u) => { - val nu = u.copy(presenter = true) - uservos += nu.userID -> nu - } - case None => // do nothing - } - } - - def getModerators():Array[UserVO] = { - uservos.values filter (u => u.role == MODERATOR ) toArray - } - - def getViewers():Array[UserVO] = { - uservos.values filter (u => u.role == VIEWER ) toArray - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala deleted file mode 100755 index c02d91341f..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala +++ /dev/null @@ -1,494 +0,0 @@ -package org.bigbluebutton.core.apps.users.red5 - -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService -import org.bigbluebutton.conference.meeting.messaging.red5.SharedObjectClientMessage -import java.util.ArrayList -import java.util.List -import java.util.Map -import java.util.HashMap -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage -import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage -import com.google.gson.Gson -import scala.collection.JavaConversions._ -import org.bigbluebutton.conference.meeting.messaging.red5.DisconnectAllClientsMessage -import org.bigbluebutton.conference.meeting.messaging.red5.DisconnectClientMessage - -class UsersClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) - case msg: MeetingHasEnded => handleMeetingHasEnded(msg) - case msg: DisconnectUser => handleDisconnectUser(msg) - case msg: PresenterAssigned => handleAssignPresenter(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnshareWebcam(msg) - case msg: GetUsersReply => handleGetUsersReply(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) - case msg: ValidateAuthTokenTimedOut => handleValidateAuthTokenTimedOut(msg) - case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) - case msg: UserRegistered => handleRegisteredUser(msg) - case msg: UserListeningOnly => handleUserListeningOnly(msg) - case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) - case msg: UserLocked => handleUserLocked(msg) - case msg: MeetingMuted => handleMeetingMuted(msg) - case msg: MeetingState => handleMeetingState(msg) - - case _ => // println("Unhandled message in UsersClientMessageSender") - } - } - - private def buildPermissionsHashMap(perms: Permissions):java.util.HashMap[String, java.lang.Boolean] = { - val args = new java.util.HashMap[String, java.lang.Boolean](); - args.put("disableCam", perms.disableCam:java.lang.Boolean); - args.put("disableMic", perms.disableMic:java.lang.Boolean); - args.put("disablePrivChat", perms.disablePrivChat:java.lang.Boolean); - args.put("disablePubChat", perms.disablePubChat:java.lang.Boolean); - args.put("lockedLayout", perms.lockedLayout:java.lang.Boolean); - args.put("lockOnJoin", perms.lockOnJoin:java.lang.Boolean); - args.put("lockOnJoinConfigurable", perms.lockOnJoinConfigurable:java.lang.Boolean); - args - } - - private def buildUserHashMap(user: UserVO):java.util.HashMap[String, Object] = { - val vu = user.voiceUser - val vuser = new HashMap[String, Object]() - vuser.put("userId", vu.userId) - vuser.put("webUserId", vu.webUserId) - vuser.put("callerName", vu.callerName) - vuser.put("callerNum", vu.callerNum) - vuser.put("joined", vu.joined:java.lang.Boolean) - vuser.put("locked", vu.locked:java.lang.Boolean) - vuser.put("muted", vu.muted:java.lang.Boolean) - vuser.put("talking", vu.talking:java.lang.Boolean) - - val wuser = new HashMap[String, Object]() - wuser.put("userId", user.userID) - wuser.put("externUserID", user.externUserID) - wuser.put("name", user.name) - wuser.put("role", user.role.toString()) - wuser.put("raiseHand", user.raiseHand:java.lang.Boolean) - wuser.put("presenter", user.presenter:java.lang.Boolean) - wuser.put("hasStream", user.hasStream:java.lang.Boolean) - wuser.put("locked", user.locked:java.lang.Boolean) - wuser.put("webcamStream", user.webcamStreams mkString("|")) - wuser.put("phoneUser", user.phoneUser:java.lang.Boolean) - wuser.put("voiceUser", vuser) - wuser.put("listenOnly", user.listenOnly:java.lang.Boolean) - - wuser - } - - private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { - val args = new java.util.HashMap[String, Object](); - args.put("disableCam", msg.permissions.disableCam:java.lang.Boolean); - args.put("disableMic", msg.permissions.disableMic:java.lang.Boolean); - args.put("disablePrivChat", msg.permissions.disablePrivChat:java.lang.Boolean); - args.put("disablePubChat", msg.permissions.disablePubChat:java.lang.Boolean); - args.put("lockedLayout", msg.permissions.lockedLayout:java.lang.Boolean); - args.put("lockOnJoin", msg.permissions.lockOnJoin:java.lang.Boolean); - args.put("lockOnJoinConfigurable", msg.permissions.lockOnJoinConfigurable:java.lang.Boolean); - - var users = new ArrayList[java.util.HashMap[String, Object]]; - msg.applyTo.foreach(uvo => { - users.add(buildUserHashMap(uvo)) - }) - - args.put("users", users); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleNewPermissionsSetting \n" + message.get("msg") + "\n") - val m = new BroadcastClientMessage(msg.meetingID, "permissionsSettingsChanged", message); - service.sendMessage(m); - } - - private def handleUserLocked(msg: UserLocked) { - val args = new java.util.HashMap[String, Object](); - args.put("meetingID", msg.meetingID); - args.put("user", msg.userId) - args.put("lock", msg.lock:java.lang.Boolean) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - val m = new BroadcastClientMessage(msg.meetingID, "userLocked", message); - service.sendMessage(m); - } - - private def handleRegisteredUser(msg: UserRegistered) { - val args = new java.util.HashMap[String, Object](); - args.put("userId", msg.user.id); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - // println("UsersClientMessageSender - handleRegisteredUser \n" + message.get("msg") + "\n") - } - - private def handleValidateAuthTokenTimedOut(msg: ValidateAuthTokenTimedOut) { - val args = new java.util.HashMap[String, Object](); - args.put("userId", msg.requesterId); - args.put("valid", msg.valid:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleValidateAuthTokenReply \n" + message.get("msg") + "\n") - val m = new DirectClientMessage(msg.meetingID, msg.requesterId, "validateAuthTokenTimedOut", message); - service.sendMessage(m); - } - - - - private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { - val args = new java.util.HashMap[String, Object](); - args.put("userId", msg.requesterId); - args.put("valid", msg.valid:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleValidateAuthTokenReply \n" + message.get("msg") + "\n") - val m = new DirectClientMessage(msg.meetingID, msg.requesterId, "validateAuthTokenReply", message); - service.sendMessage(m); - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val args = new java.util.HashMap[String, Object](); - args.put("userId", msg.userId); - args.put("recording", msg.recording:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleGetRecordingStatusReply \n" + message.get("msg") + "\n") - val m = new DirectClientMessage(msg.meetingID, msg.userId, "getRecordingStatusReply", message); - service.sendMessage(m); - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val args = new java.util.HashMap[String, Object](); - args.put("userId", msg.userId); - args.put("recording", msg.recording:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleRecordingStatusChanged \n" + message.get("msg") + "\n") - val m = new BroadcastClientMessage(msg.meetingID, "recordingStatusChanged", message); - service.sendMessage(m); - } - - private def handleUserVoiceMuted(msg: UserVoiceMuted) { - val args = new java.util.HashMap[String, Object](); - args.put("meetingID", msg.meetingID); - args.put("userId", msg.user.userID); - args.put("voiceUserId", msg.user.voiceUser.userId); - args.put("muted", msg.user.voiceUser.muted:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserVoiceMuted \n" + message.get("msg") + "\n") -// log.debug("UsersClientMessageSender - handlePresentationConversionProgress \n" + message.get("msg") + "\n") - val m = new BroadcastClientMessage(msg.meetingID, "voiceUserMuted", message); - service.sendMessage(m); - } - - private def handleUserVoiceTalking(msg: UserVoiceTalking) { - val args = new java.util.HashMap[String, Object](); - args.put("meetingID", msg.meetingID); - args.put("userId", msg.user.userID); - args.put("voiceUserId", msg.user.voiceUser.userId); - args.put("talking", msg.user.voiceUser.talking:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - // println("UsersClientMessageSender - handleUserVoiceTalking \n" + message.get("msg") + "\n") -// log.debug("UsersClientMessageSender - handlePresentationConversionProgress \n" + message.get("msg") + "\n") - val m = new BroadcastClientMessage(msg.meetingID, "voiceUserTalking", message); - service.sendMessage(m); - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val args = new java.util.HashMap[String, Object](); - args.put("meetingID", msg.meetingID); - args.put("user", buildUserHashMap(msg.user)) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserLeftVoice \n" + message.get("msg") + "\n") -// log.debug("UsersClientMessageSender - handleUserLeftVoice \n" + message.get("msg") + "\n") - val m = new BroadcastClientMessage(msg.meetingID, "userLeftVoice", message); - service.sendMessage(m); - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val args = new java.util.HashMap[String, Object](); - args.put("meetingID", msg.meetingID); - args.put("user", buildUserHashMap(msg.user)) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserJoinedVoice \n" + message.get("msg") + "\n") -// log.debug("UsersClientMessageSender - handlePresentationConversionProgress \n" + message.get("msg") + "\n") - val m = new BroadcastClientMessage(msg.meetingID, "userJoinedVoice", message); - service.sendMessage(m); - } - - private def handleGetUsersReply(msg: GetUsersReply):Unit = { - var args = new HashMap[String, Object](); - args.put("count", msg.users.length:java.lang.Integer) - - var users = new ArrayList[java.util.HashMap[String, Object]]; - msg.users.foreach(uvo => { - users.add(buildUserHashMap(uvo)) - }) - - args.put("users", users); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson() - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleGetUsersReply \n" + message.get("msg") + "\n") - - var m = new DirectClientMessage(msg.meetingID, msg.requesterID, "getUsersReply", message) - service.sendMessage(m) - } - - private def handleMeetingHasEnded(msg: MeetingHasEnded):Unit = { - var args = new HashMap[String, Object](); - args.put("status", "Meeting has already ended."); - - var message = new HashMap[String, Object](); - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleMeetingHasEnded \n" + message.get("msg") + "\n") - - var m = new DirectClientMessage(msg.meetingID, msg.userId, "meetingHasEnded", message) - service.sendMessage(m); - } - - private def handleDisconnectUser(msg: DisconnectUser) { -// println("UsersClientMessageSender - handleDisconnectUser mid=[" + msg.meetingID + "], uid=[" + msg.userId + "]\n") - - var m = new DisconnectClientMessage(msg.meetingID, msg.userId) - service.sendMessage(m); - } - - private def handleMeetingState(msg: MeetingState) { - var args = new HashMap[String, Object](); - args.put("permissions", buildPermissionsHashMap(msg.permissions)); - args.put("meetingMuted", msg.meetingMuted:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - var jmr = new DirectClientMessage(msg.meetingID, msg.userId, "meetingState", message); - service.sendMessage(jmr); - } - - private def handleMeetingMuted(msg: MeetingMuted) { - var args = new HashMap[String, Object](); - args.put("meetingMuted", msg.meetingMuted:java.lang.Boolean); - - var message = new HashMap[String, Object](); - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - - var m = new BroadcastClientMessage(msg.meetingID, "meetingMuted", message); - service.sendMessage(m); - } - - - private def handleMeetingEnded(msg: MeetingEnded):Unit = { - var args = new HashMap[String, Object](); - args.put("status", "Meeting has been ended."); - - var message = new HashMap[String, Object](); - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleMeetingEnded \n" + msg.meetingID + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "meetingEnded", message); - service.sendMessage(m); - } - - private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { - var dm = new DisconnectAllClientsMessage(msg.meetingID) - service.sendMessage(dm) - } - - private def handleAssignPresenter(msg:PresenterAssigned):Unit = { - var args = new HashMap[String, Object](); - args.put("newPresenterID", msg.presenter.presenterID); - args.put("newPresenterName", msg.presenter.presenterName); - args.put("assignedBy", msg.presenter.assignedBy); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleAssignPresenter \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "assignPresenterCallback", message); - service.sendMessage(m); - } - - private def handleUserJoined(msg: UserJoined):Unit = { - var args = new HashMap[String, Object](); - args.put("user", buildUserHashMap(msg.user)); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - joinMeetingReply \n" + message.get("msg") + "\n") - - var jmr = new DirectClientMessage(msg.meetingID, msg.user.userID, "joinMeetingReply", message); - service.sendMessage(jmr); - -// println("UsersClientMessageSender - handleUserJoined \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "participantJoined", message); - service.sendMessage(m); - } - - - - private def handleUserLeft(msg: UserLeft):Unit = { - var args = new HashMap[String, Object](); - args.put("user", buildUserHashMap(msg.user)); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserLeft \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "participantLeft", message); - service.sendMessage(m); - } - - def handleUserRaisedHand(msg: UserRaisedHand) { - var args = new HashMap[String, Object]() - args.put("userId", msg.userID) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserRaisedHand \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "userRaisedHand", message); - service.sendMessage(m); - } - - def handleUserLoweredHand(msg: UserLoweredHand) { - var args = new HashMap[String, Object](); - args.put("userId", msg.userID) - args.put("loweredBy", msg.loweredBy) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserLoweredHand \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "userLoweredHand", message); - service.sendMessage(m); - } - - def handleUserSharedWebcam(msg: UserSharedWebcam) { - var args = new HashMap[String, Object]() - args.put("userId", msg.userID) - args.put("webcamStream", msg.stream) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserSharedWebcam \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "userSharedWebcam", message); - service.sendMessage(m); - } - - def handleUserUnshareWebcam(msg: UserUnsharedWebcam) { - var args = new HashMap[String, Object]() - args.put("userId", msg.userID) - args.put("webcamStream", msg.stream) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserUnshareWebcam \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "userUnsharedWebcam", message); - service.sendMessage(m); - } - - private def handleUserStatusChange(msg: UserStatusChange):Unit = { - var args = new HashMap[String, Object](); - args.put("userID", msg.userID); - args.put("status", msg.status); - args.put("value", msg.value); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserStatusChange \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "participantStatusChange", message); - service.sendMessage(m); - } - - private def handleUserListeningOnly(msg: UserListeningOnly) { - var args = new HashMap[String, Object](); - args.put("userId", msg.userID); - args.put("listenOnly", msg.listenOnly:java.lang.Boolean); - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("UsersClientMessageSender - handleUserListeningOnly \n" + message.get("msg") + "\n") - - var m = new BroadcastClientMessage(msg.meetingID, "user_listening_only", message); - service.sendMessage(m); - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala deleted file mode 100755 index 791ffb2d4e..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala +++ /dev/null @@ -1,188 +0,0 @@ -package org.bigbluebutton.core.apps.users.redis - -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import com.google.gson.Gson - -class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - - case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) - case msg: DisconnectUser => handleDisconnectUser(msg) - case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) - case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) - case msg: UserLocked => handleUserLocked(msg) - case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) - case msg: UserRegistered => handleUserRegistered(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: PresenterAssigned => handlePresenterAssigned(msg) - case msg: EndAndKickAll => handleEndAndKickAll(msg) - case msg: GetUsersReply => handleGetUsersReply(msg) - case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) - case msg: UserListeningOnly => handleUserListeningOnly(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { - val json = UsersMessageToJsonConverter.disconnectAllUsersToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleDisconnectUser(msg: DisconnectUser) { - val json = UsersMessageToJsonConverter.disconnectUserToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { - val json = UsersMessageToJsonConverter.permissionsSettingInitializedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { - val json = UsersMessageToJsonConverter.newPermissionsSettingToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleUserLocked(msg: UserLocked) { - val json = UsersMessageToJsonConverter.userLockedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { - val json = UsersMessageToJsonConverter.getPermissionsSettingReplyToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleUserRegistered(msg: UserRegistered) { - val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleUserStatusChange(msg: UserStatusChange) { - val json = UsersMessageToJsonConverter.userStatusChangeToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserRaisedHand(msg: UserRaisedHand) { - val json = UsersMessageToJsonConverter.userRaisedHandToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserLoweredHand(msg: UserLoweredHand) { - val json = UsersMessageToJsonConverter.userLoweredHandToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserSharedWebcam(msg: UserSharedWebcam) { - val json = UsersMessageToJsonConverter.userSharedWebcamToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { - val json = UsersMessageToJsonConverter.userUnsharedWebcamToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleGetUsersReply(msg: GetUsersReply) { - val json = UsersMessageToJsonConverter.getUsersReplyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val json = UsersMessageToJsonConverter.userJoinedVoice(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserVoiceMuted(msg: UserVoiceMuted) { - val json = UsersMessageToJsonConverter.userVoiceMuted(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserVoiceTalking(msg: UserVoiceTalking) { - val json = UsersMessageToJsonConverter.userVoiceTalking(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val json = UsersMessageToJsonConverter.muteVoiceUserToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val json = UsersMessageToJsonConverter.ejectVoiceUserToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val json = UsersMessageToJsonConverter.userLeftVoiceToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { - val json = UsersMessageToJsonConverter.isMeetingMutedReplyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val json = UsersMessageToJsonConverter.recordingStatusChangedToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val json = UsersMessageToJsonConverter.getRecordingStatusReplyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { - val json = UsersMessageToJsonConverter.validateAuthTokenReplyToJson(msg) -// println("************** Publishing [" + json + "] *******************") - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserJoined(msg: UserJoined) { - val json = UsersMessageToJsonConverter.userJoinedToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleRegisteredUser(msg: UserRegistered) { - val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserLeft(msg: UserLeft) { - val json = UsersMessageToJsonConverter.userLeftToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handlePresenterAssigned(msg: PresenterAssigned) { - val json = UsersMessageToJsonConverter.presenterAssignedToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleEndAndKickAll(msg: EndAndKickAll) { - val json = UsersMessageToJsonConverter.endAndKickAllToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserListeningOnly(msg: UserListeningOnly) { - val json = UsersMessageToJsonConverter.userListeningOnlyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala deleted file mode 100755 index e203aaa81f..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala +++ /dev/null @@ -1,214 +0,0 @@ -package org.bigbluebutton.core.apps.users.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.recorder.participants.ParticipantEndAndKickAllRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.AssignPresenterRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.ParticipantStatusChangeRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.ParticipantLeftRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.ParticipantJoinRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantMutedVoiceRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantTalkingVoiceRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantJoinedVoiceRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantLeftVoiceRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.RecordStatusRecordEvent -import org.bigbluebutton.webconference.voice.StartRecordingVoiceRecordEvent - -class UsersEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: EndAndKickAll => handleEndAndKickAll(msg) - case msg: PresenterAssigned => handleAssignPresenter(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) - case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) - case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def handleEndAndKickAll(msg: EndAndKickAll):Unit = { - if (msg.recorded) { - val ev = new ParticipantEndAndKickAllRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setMeetingId(msg.meetingID); - recorder.record(msg.meetingID, ev); - } - } - - private def handleUserJoined(msg: UserJoined):Unit = { - if (msg.recorded) { - val ev = new ParticipantJoinRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setUserId(msg.user.userID); - ev.setName(msg.user.name); - ev.setMeetingId(msg.meetingID); - ev.setRole(msg.user.role.toString()); - - recorder.record(msg.meetingID, ev); - } - } - - def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { - if (msg.recorded) { - val evt = new StartRecordingVoiceRecordEvent(true); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setRecordingTimestamp(msg.timestamp); - evt.setFilename(msg.recordingFile); - recorder.record(msg.meetingID, evt); - } - } - - def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { - if (msg.recorded) { - val evt = new StartRecordingVoiceRecordEvent(false); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setRecordingTimestamp(msg.timestamp); - evt.setFilename(msg.recordingFile); - recorder.record(msg.meetingID, evt); - } - } - - def handleUserVoiceMuted(msg: UserVoiceMuted) { - if (msg.recorded) { - val ev = new ParticipantMutedVoiceRecordEvent() - ev.setMeetingId(msg.meetingID); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setBridge(msg.confNum); - ev.setParticipant(msg.user.voiceUser.userId); - ev.setMuted(msg.user.voiceUser.muted); - - recorder.record(msg.meetingID, ev); - } - } - - def handleUserVoiceTalking(msg: UserVoiceTalking) { - if (msg.recorded) { - val evt = new ParticipantTalkingVoiceRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setParticipant(msg.user.userID); - evt.setTalking(msg.user.voiceUser.talking); - - recorder.record(msg.meetingID, evt); - } - } - - def handleUserJoinedVoice(msg: UserJoinedVoice) { - if (msg.recorded) { - val evt = new ParticipantJoinedVoiceRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setParticipant(msg.user.voiceUser.userId); - evt.setCallerName(msg.user.voiceUser.callerName); - evt.setCallerNumber(msg.user.voiceUser.callerNum); - evt.setMuted(msg.user.voiceUser.muted); - evt.setTalking(msg.user.voiceUser.talking); - - recorder.record(msg.meetingID, evt) - } - } - - def handleUserLeftVoice(msg: UserLeftVoice) { - if (msg.recorded) { - val evt = new ParticipantLeftVoiceRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setParticipant(msg.user.voiceUser.userId); - recorder.record(msg.meetingID, evt); - } - } - - def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - if (msg.recorded) { - val evt = new RecordStatusRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setUserId(msg.userId); - evt.setRecordingStatus(msg.recording.toString); - - recorder.record(msg.meetingID, evt); - } - } - - private def handleUserLeft(msg: UserLeft):Unit = { - if (msg.recorded) { - val ev = new ParticipantLeftRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setUserId(msg.user.userID); - ev.setMeetingId(msg.meetingID); - - recorder.record(msg.meetingID, ev); - } - - } - - private def handleUserRaisedHand(msg: UserRaisedHand) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "raiseHand", true:java.lang.Boolean) - handleUserStatusChange(status) - } - - private def handleUserLoweredHand(msg: UserLoweredHand) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "raiseHand", false:java.lang.Boolean) - handleUserStatusChange(status) - } - - private def handleUserSharedWebcam(msg: UserSharedWebcam) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "hasStream", "true,stream=" + msg.stream) - handleUserStatusChange(status) - } - - private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "hasStream", "false,stream=" + msg.stream) - handleUserStatusChange(status) - } - - private def handleUserStatusChange(msg: UserStatusChange):Unit = { - if (msg.recorded) { - val ev = new ParticipantStatusChangeRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setUserId(msg.userID); - ev.setMeetingId(msg.meetingID); - ev.setStatus(msg.status); - ev.setValue(msg.value.toString()); - - recorder.record(msg.meetingID, ev); - } - } - - private def handleAssignPresenter(msg:PresenterAssigned):Unit = { - if (msg.recorded) { - val event = new AssignPresenterRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setUserId(msg.presenter.presenterID); - event.setName(msg.presenter.presenterName); - event.setAssignedBy(msg.presenter.assignedBy); - - recorder.record(msg.meetingID, event); - } - - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala deleted file mode 100644 index 0683a13422..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala +++ /dev/null @@ -1,361 +0,0 @@ -package org.bigbluebutton.core.apps.users.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import org.bigbluebutton.core.messaging.Util -import com.google.gson.Gson -import org.bigbluebutton.core.api.UserVO -import collection.JavaConverters._ -import scala.collection.JavaConversions._ - -object UsersMessageToJsonConverter { - private def userToMap(user: UserVO):java.util.Map[String, Any] = { - - val wuser = new scala.collection.mutable.HashMap[String, Any] - wuser += "userid" -> user.userID - wuser += "extern_userid" -> user.externUserID - wuser += "name" -> user.name - wuser += "role" -> user.role.toString() - wuser += "raise_hand" -> user.raiseHand - wuser += "presenter" -> user.presenter - wuser += "has_stream" -> user.hasStream - wuser += "locked" -> user.locked - wuser += "webcam_stream" -> user.webcamStreams - wuser += "phone_user" -> user.phoneUser - wuser += "listenOnly" -> user.listenOnly - - val vuser = new scala.collection.mutable.HashMap[String, Any] - vuser += "userid" -> user.voiceUser.userId - vuser += "web_userid" -> user.voiceUser.webUserId - vuser += "callername" -> user.voiceUser.callerName - vuser += "callernum" -> user.voiceUser.callerNum - vuser += "joined" -> user.voiceUser.joined - vuser += "locked" -> user.voiceUser.locked - vuser += "muted" -> user.voiceUser.muted - vuser += "talking" -> user.voiceUser.talking - - wuser.put("voiceUser", mapAsJavaMap(vuser)) - - mapAsJavaMap(wuser) - } - - private def registeredUserToMap(user: RegisteredUser):java.util.Map[String, Any] = { - val wuser = new scala.collection.mutable.HashMap[String, Any] - wuser += "userid" -> user.id - wuser += "extern_userid" -> user.externId - wuser += "name" -> user.name - wuser += "role" -> user.role.toString() - wuser += "authToken" -> user.authToken - - mapAsJavaMap(wuser) - } - - def disconnectAllUsersToJson(msg: DisconnectAllUsers):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.DISCONNECT_ALL_USERS, msg.version, None) - Util.buildJson(header, payload) - } - - def disconnectUserToJson(msg: DisconnectUser):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = Util.buildHeader(MessageNames.DISCONNECT_USER, msg.version, None) - Util.buildJson(header, payload) - } - - def permissionsSettingInitializedToJson(msg: PermissionsSettingInitialized):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested - - val header = Util.buildHeader(MessageNames.PERMISSION_SETTING_INITIALIZED, msg.version, None) - Util.buildJson(header, payload) - } - - def newPermissionsSettingToJson(msg: NewPermissionsSetting):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("disableCam", msg.permissions.disableCam) - payload.put("disableMic", msg.permissions.disableMic) - payload.put("disablePrivChat", msg.permissions.disablePrivChat) - payload.put("disablePubChat", msg.permissions.disablePubChat) - payload.put("lockedLayout", msg.permissions.lockedLayout) - payload.put("lockOnJoin", msg.permissions.lockOnJoin) - payload.put("lockOnJoinConfigurable", msg.permissions.lockOnJoin) - - val users = new java.util.ArrayList[java.util.Map[String, Any]] - msg.applyTo.foreach(uvo => { - users.add(userToMap(uvo)) - }) - - payload.put("users", users) - - val header = Util.buildHeader(MessageNames.NEW_PERMISSION_SETTINGS, msg.version, None) - Util.buildJson(header, payload) - } - - def userLockedToJson(msg: UserLocked):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCKED, msg.lock) - - val header = Util.buildHeader(MessageNames.USER_LOCKED, msg.version, None) - Util.buildJson(header, payload) - } - - def getPermissionsSettingReplyToJson(msg: GetPermissionsSettingReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = Util.buildHeader(MessageNames.GET_PERMISSION_SETTINGS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def userRegisteredToJson(msg: UserRegistered):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER, registeredUserToMap(msg.user)) - payload.put(Constants.RECORDED, msg.recorded) - - val header = Util.buildHeader(MessageNames.USER_REGISTERED, msg.version, None) - Util.buildJson(header, payload) - } - - - def userRaisedHandToJson(msg: UserRaisedHand):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - - val header = Util.buildHeader(MessageNames.USER_RAISED_HAND, msg.version, None) - Util.buildJson(header, payload) - } - - def userLoweredHandToJson(msg: UserLoweredHand):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LOWERED_BY, msg.loweredBy) - - val header = Util.buildHeader(MessageNames.USER_LOWERED_HAND, msg.version, None) - Util.buildJson(header, payload) - } - - def userStatusChangeToJson(msg: UserStatusChange):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STATUS, msg.status) - payload.put(Constants.VALUE, msg.value.toString) - - val header = Util.buildHeader(MessageNames.USER_STATUS_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def userSharedWebcamToJson(msg: UserSharedWebcam):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = Util.buildHeader(MessageNames.USER_SHARED_WEBCAM, msg.version, None) - Util.buildJson(header, payload) - } - - def userUnsharedWebcamToJson(msg: UserUnsharedWebcam):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = Util.buildHeader(MessageNames.USER_UNSHARED_WEBCAM, msg.version, None) - Util.buildJson(header, payload) - } - - def getUsersReplyToJson(msg: GetUsersReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val users = new java.util.ArrayList[java.util.Map[String, Any]]; - msg.users.foreach(uvo => { - users.add(userToMap(uvo)) - }) - - payload.put(Constants.USERS, users) - - val header = Util.buildHeader(MessageNames.GET_USERS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def userJoinedVoice(msg: UserJoinedVoice):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_JOINED_VOICE, msg.version, None) - Util.buildJson(header, payload) - } - - def userVoiceMuted(msg: UserVoiceMuted):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_VOICE_MUTED, msg.version, None) - Util.buildJson(header, payload) - } - - def userVoiceTalking(msg: UserVoiceTalking):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_VOICE_TALKING, msg.version, None) - Util.buildJson(header, payload) - } - - def muteVoiceUserToJson(msg: MuteVoiceUser):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MUTE, msg.mute) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) - Util.buildJson(header, payload) - } - - def ejectVoiceUserToJson(msg: EjectVoiceUser):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) - Util.buildJson(header, payload) - } - - def userLeftVoiceToJson(msg: UserLeftVoice):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_LEFT_VOICE, msg.version, None) - Util.buildJson(header, payload) - } - - def isMeetingMutedReplyToJson(msg: IsMeetingMutedReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTED, msg.meetingMuted) - - val header = Util.buildHeader(MessageNames.IS_MEETING_MUTED_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def recordingStatusChangedToJson(msg: RecordingStatusChanged):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def validateAuthTokenReplyToJson(msg: ValidateAuthTokenReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.REPLY_TO, msg.correlationId) - payload.put(Constants.VALID, msg.valid.toString) - payload.put(Constants.USER_ID, msg.requesterId) - payload.put(Constants.AUTH_TOKEN, msg.token) - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.VALIDATE_AUTH_TOKEN_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def userJoinedToJson(msg: UserJoined):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("user", userToMap(msg.user)) - - val header = Util.buildHeader(MessageNames.USER_JOINED, msg.version, None) - Util.buildJson(header, payload) - } - - - def userLeftToJson(msg: UserLeft):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("user", userToMap(msg.user)) - - val header = Util.buildHeader(MessageNames.USER_LEFT, msg.version, None) - Util.buildJson(header, payload) - } - - def presenterAssignedToJson(msg: PresenterAssigned):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); - payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); - payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); - payload.put(Constants.RECORDED, msg.recorded) - - val header = Util.buildHeader(MessageNames.PRESENTER_ASSIGNED, msg.version, None) - Util.buildJson(header, payload) - } - - def endAndKickAllToJson(msg: EndAndKickAll):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - - val header = Util.buildHeader(MessageNames.END_AND_KICK_ALL, msg.version, None) - Util.buildJson(header, payload) - } - - def userListeningOnlyToJson(msg: UserListeningOnly):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LISTEN_ONLY, msg.listenOnly) - - val header = Util.buildHeader(MessageNames.USER_LISTEN_ONLY, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala deleted file mode 100644 index 89c6059bca..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala +++ /dev/null @@ -1,34 +0,0 @@ -package org.bigbluebutton.core.apps.voice - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.MeetingActor - -trait VoiceApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { - - } - - def handleMuteMeetingRequest(msg: MuteMeetingRequest) { - - } - - def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { - - } - - def handleMuteUserRequest(msg: MuteUserRequest) { - - } - - def handleLockUserRequest(msg: LockUserRequest) { - - } - - def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { - - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala deleted file mode 100644 index 3381ce549d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala +++ /dev/null @@ -1,65 +0,0 @@ -package org.bigbluebutton.core.apps.voice - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class VoiceInGateway(bbbGW: BigBlueButtonGateway) { - - def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: Boolean) { - bbbGW.accept(new MuteAllExceptPresenterRequest(meetingID, requesterID, mute)) - } - - def muteAllUsers(meetingID: String, requesterID: String, mute: Boolean) { - bbbGW.accept(new MuteMeetingRequest(meetingID, requesterID, mute)) - } - - def isMeetingMuted(meetingID: String, requesterID: String) { - bbbGW.accept(new IsMeetingMutedRequest(meetingID, requesterID)) - } - - def muteUser(meetingID: String, requesterID: String, userID: String, mute: Boolean) { - bbbGW.accept(new MuteUserRequest(meetingID, requesterID, userID, mute)) - } - - def lockUser(meetingID: String, requesterID: String, userID: String, lock: Boolean) { - bbbGW.accept(new LockUserRequest(meetingID, requesterID, userID, lock)) - } - - def ejectUserFromVoice(meetingID: String, userId: String, ejectedBy: String) { - bbbGW.accept(new EjectUserFromVoiceRequest(meetingID, userId, ejectedBy)) - } - - def voiceUserJoined(meetingId: String, userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, - muted: Boolean, talking: Boolean) { -// println("VoiceInGateway: Got voiceUserJoined message for meeting [" + meetingId + "] user[" + callerIdName + "]") - val voiceUser = new VoiceUser(userId, webUserId, - callerIdName, callerIdNum, - true, false, muted, talking) - bbbGW.accept(new VoiceUserJoined(meetingId, voiceUser)) - } - - def voiceUserLeft(meetingId: String, userId: String) { -// println("VoiceInGateway: Got voiceUserLeft message for meeting [" + meetingId + "] user[" + userId + "]") - bbbGW.accept(new VoiceUserLeft(meetingId, userId)) - } - - def voiceUserLocked(meetingId: String, userId: String, locked: Boolean) { - bbbGW.accept(new VoiceUserLocked(meetingId, userId, locked)) - } - - def voiceUserMuted(meetingId: String, userId: String, muted: Boolean) { - bbbGW.accept(new VoiceUserMuted(meetingId, userId, muted)) - } - - def voiceUserTalking(meetingId: String, userId: String, talking: Boolean) { - bbbGW.accept(new VoiceUserTalking(meetingId, userId, talking)) - } - - def voiceRecording(meetingId: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - bbbGW.accept(new VoiceRecording(meetingId, recordingFile, - timestamp, recording)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala deleted file mode 100644 index d0d8a82027..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala +++ /dev/null @@ -1,100 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil -import org.bigbluebutton.core.MeetingActor -import org.bigbluebutton.core.apps.whiteboard.vo._ - -case class Whiteboard(id: String, shapes:Seq[AnnotationVO]) - -trait WhiteboardApp { - this : MeetingActor => - - val outGW: MessageOutGateway - - private val wbModel = new WhiteboardModel - - def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { - val status = msg.annotation.status - val shapeType = msg.annotation.shapeType - val wbId = msg.annotation.wbId - val shape = msg.annotation - - initWhiteboard(wbId) - -// println("Received whiteboard shape. status=[" + status + "], shapeType=[" + shapeType + "]") - - if (WhiteboardKeyUtil.TEXT_CREATED_STATUS == status) { -// println("Received textcreated status") - wbModel.addAnnotation(wbId, shape) - } else if ((WhiteboardKeyUtil.PENCIL_TYPE == shapeType) - && (WhiteboardKeyUtil.DRAW_START_STATUS == status)) { -// println("Received pencil draw start status") - wbModel.addAnnotation(wbId, shape) - } else if ((WhiteboardKeyUtil.DRAW_END_STATUS == status) - && ((WhiteboardKeyUtil.RECTANGLE_TYPE == shapeType) - || (WhiteboardKeyUtil.ELLIPSE_TYPE == shapeType) - || (WhiteboardKeyUtil.TRIANGLE_TYPE == shapeType) - || (WhiteboardKeyUtil.LINE_TYPE == shapeType))) { -// println("Received [" + shapeType +"] draw end status") - wbModel.addAnnotation(wbId, shape) - } else if (WhiteboardKeyUtil.TEXT_TYPE == shapeType) { -// println("Received [" + shapeType +"] modify text status") - wbModel.modifyText(wbId, shape) - } else { -// println("Received UNKNOWN whiteboard shape!!!!. status=[" + status + "], shapeType=[" + shapeType + "]") - } - wbModel.getWhiteboard(wbId) foreach {wb => -// println("WhiteboardApp::handleSendWhiteboardAnnotationRequest - num shapes [" + wb.shapes.length + "]") - outGW.send(new SendWhiteboardAnnotationEvent(meetingID, recorded, - msg.requesterID, wbId, msg.annotation)) - } - - } - - private def initWhiteboard(wbId: String) { - if (! wbModel.hasWhiteboard(wbId)) { - wbModel.createWhiteboard(wbId) - } - } - - def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { - //println("WB: Received page history [" + msg.whiteboardId + "]") - wbModel.history(msg.whiteboardId) foreach {wb => - outGW.send(new GetWhiteboardShapesReply(meetingID, recorded, - msg.requesterID, wb.id, wb.shapes.toArray, msg.replyTo)) - } - } - - def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { - //println("WB: Received clear whiteboard") - wbModel.clearWhiteboard(msg.whiteboardId) - wbModel.getWhiteboard(msg.whiteboardId) foreach {wb => - outGW.send(new ClearWhiteboardEvent(meetingID, recorded, - msg.requesterID, wb.id)) - } - } - - def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { -// println("WB: Received undo whiteboard") - - wbModel.getWhiteboard(msg.whiteboardId) foreach {wb => - wbModel.undoWhiteboard(msg.whiteboardId) foreach {last => - outGW.send(new UndoWhiteboardEvent(meetingID, recorded, - msg.requesterID, wb.id, last.id)) - } - } - } - - def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { - wbModel.enableWhiteboard(msg.enable) - outGW.send(new WhiteboardEnabledEvent(meetingID, recorded, - msg.requesterID, msg.enable)) - } - - def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { - val enabled = wbModel.isWhiteboardEnabled() - outGW.send(new IsWhiteboardEnabledReply(meetingID, recorded, - msg.requesterID, enabled, msg.replyTo)) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala deleted file mode 100755 index c92ef2c0e1..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO - -class WhiteboardInGateway(bbbGW: BigBlueButtonGateway) { - - private def buildAnnotation(annotation: Map[String, Object]):Option[AnnotationVO] = { - var shape:Option[AnnotationVO] = None - - val id = annotation.getOrElse("id", null).asInstanceOf[String] - val shapeType = annotation.getOrElse("type", null).asInstanceOf[String] - val status = annotation.getOrElse("status", null).asInstanceOf[String] - val wbId = annotation.getOrElse("whiteboardId", null).asInstanceOf[String] -// println("** GOT ANNOTATION status[" + status + "] shape=[" + shapeType + "]"); - - if (id != null && shapeType != null && status != null && wbId != null) { - shape = Some(new AnnotationVO(id, status, shapeType, annotation.toMap, wbId)) - } - - shape - } - - def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: Map[String, Object]) { - buildAnnotation(annotation) match { - case Some(shape) => { - bbbGW.accept(new SendWhiteboardAnnotationRequest(meetingID, requesterID, shape)) - } - case None => // do nothing - } - } - - def requestWhiteboardAnnotationHistory(meetingID: String, requesterID: String, whiteboardId: String, replyTo: String) { - bbbGW.accept(new GetWhiteboardShapesRequest(meetingID, requesterID, whiteboardId, replyTo)) - } - - def clearWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { - bbbGW.accept(new ClearWhiteboardRequest(meetingID, requesterID, whiteboardId)) - } - - def undoWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { - bbbGW.accept(new UndoWhiteboardRequest(meetingID, requesterID, whiteboardId)) - } - - def enableWhiteboard(meetingID: String, requesterID: String, enable: Boolean) { - bbbGW.accept(new EnableWhiteboardRequest(meetingID, requesterID, enable)) - } - - def isWhiteboardEnabled(meetingID: String, requesterID: String, replyTo: String) { - bbbGW.accept(new IsWhiteboardEnabledRequest(meetingID, requesterID, replyTo)) - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala deleted file mode 100644 index 7e19312cd1..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala +++ /dev/null @@ -1,87 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard - -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import scala.collection.mutable.ArrayBuffer - -class WhiteboardModel { - private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]() - - private var _enabled = true - - private def saveWhiteboard(wb: Whiteboard) { - _whiteboards += wb.id -> wb - } - - def getWhiteboard(id: String):Option[Whiteboard] = { - _whiteboards.values.find(wb => wb.id == id) - } - - def hasWhiteboard(id: String):Boolean = { - _whiteboards.contains(id) - } - - def createWhiteboard(wbId: String) { - val vec = scala.collection.immutable.Vector.empty - val wb = new Whiteboard(wbId, vec) - saveWhiteboard(wb) - } - - def addAnnotationToShape(wb: Whiteboard, shape: AnnotationVO) = { -// println("Adding shape to wb [" + wb.id + "]. Before numShapes=[" + wb.shapes.length + "].") - val newWb = wb.copy(shapes=(wb.shapes :+ shape)) -// println("Adding shape to page [" + wb.id + "]. After numShapes=[" + newWb.shapes.length + "].") - saveWhiteboard(newWb) - } - - def addAnnotation(wbId:String, shape: AnnotationVO) { - getWhiteboard(wbId) foreach { wb => - addAnnotationToShape(wb, shape) - } - } - - private def modifyTextInPage(wb: Whiteboard, shape: AnnotationVO) = { - val removedLastText = wb.shapes.dropRight(1) - val addedNewText = removedLastText :+ shape - val newWb = wb.copy(shapes=addedNewText) - saveWhiteboard(newWb) - } - - def modifyText(wbId:String, shape: AnnotationVO) { - getWhiteboard(wbId) foreach { wb => - modifyTextInPage(wb, shape) - } - } - - def history(wbId:String):Option[Whiteboard] = { - getWhiteboard(wbId) - } - - def clearWhiteboard(wbId:String) { - getWhiteboard(wbId) foreach { wb => - val clearedShapes = wb.shapes.drop(wb.shapes.length) - val newWb = wb.copy(shapes= clearedShapes) - saveWhiteboard(newWb) - } - } - - def undoWhiteboard(wbId:String):Option[AnnotationVO] = { - var last:Option[AnnotationVO] = None - getWhiteboard(wbId) foreach { wb => - if (!wb.shapes.isEmpty) { - last = Some(wb.shapes.last) - val remaining = wb.shapes.dropRight(1) - val newWb = wb.copy(shapes=remaining) - saveWhiteboard(newWb) - } - } - last - } - - def enableWhiteboard(enable: Boolean) { - _enabled = enable - } - - def isWhiteboardEnabled():Boolean = { - _enabled - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/red5/WhiteboardClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/red5/WhiteboardClientMessageSender.scala deleted file mode 100755 index 206be9a24f..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/red5/WhiteboardClientMessageSender.scala +++ /dev/null @@ -1,130 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.red5 - -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage -import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage -import scala.collection.JavaConversions._ -import com.google.gson.Gson -import java.util.ArrayList - -class WhiteboardClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) - case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) - case _ => // do nothing - } - } - - private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { - val args = new java.util.HashMap[String, Object]() - args.put("enabled", msg.enable:java.lang.Boolean) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("WhiteboardClientMessageSender - handleWhiteboardEnabledEvent \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "WhiteboardEnableWhiteboardCommand", message) - service.sendMessage(m) - } - - private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { - val args = new java.util.HashMap[String, Object]() - args.put("enabled", msg.enabled:java.lang.Boolean) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("WhiteboardClientMessageSender - handleIsWhiteboardEnabledReply \n" + message.get("msg") + "\n") - - val m = new DirectClientMessage(msg.meetingID, msg.requesterID, "WhiteboardIsWhiteboardEnabledReply", message) - service.sendMessage(m) - } - - private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { - val args = new java.util.HashMap[String, Object]() - args.put("count", msg.shapes.length:java.lang.Integer) - args.put("whiteboardId", msg.whiteboardId) - - val annotations = new ArrayList[java.util.HashMap[String, Object]] - msg.shapes.foreach {shape => - val annotation = new java.util.HashMap[String, Object](); - annotation.put("id", shape.id) - annotation.put("status", shape.status) - annotation.put("type", shape.shapeType) - annotation.put("shapes", mapAsJavaMap(shape.shape)) - - annotations.add(annotation); - } - - args.put("annotations", annotations) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("WhiteboardClientMessageSender - handleSendWhiteboardAnnotationHistoryReply \n" + message.get("msg") + "\n") - - val m = new DirectClientMessage(msg.meetingID, msg.requesterID, "WhiteboardRequestAnnotationHistoryReply", message) - service.sendMessage(m) - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - val args = new java.util.HashMap[String, Object]() - args.put("whiteboardId", msg.whiteboardId) - - val shape = new java.util.HashMap[String, Object]() - shape.put("id", msg.shape.id) - shape.put("type", msg.shape.shapeType) - shape.put("status", msg.shape.status) - shape.put("shape", mapAsJavaMap(msg.shape.shape)) - - args.put("shape", shape) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("WhiteboardClientMessageSender - handleSendWhiteboardAnnotationEvent \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "WhiteboardNewAnnotationCommand", message) - service.sendMessage(m) - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val args = new java.util.HashMap[String, Object]() - args.put("whiteboardId", msg.whiteboardId) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("WhiteboardClientMessageSender - handleClearWhiteboardEvent \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "WhiteboardClearCommand", message); - service.sendMessage(m); - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val args = new java.util.HashMap[String, Object]() - args.put("whiteboardId", msg.whiteboardId) - args.put("shapeId", msg.shapeId) - - val message = new java.util.HashMap[String, Object]() - val gson = new Gson(); - message.put("msg", gson.toJson(args)) - -// println("WhiteboardClientMessageSender - handleUndoWhiteboardEvent \n" + message.get("msg") + "\n") - - val m = new BroadcastClientMessage(msg.meetingID, "WhiteboardUndoCommand", message); - service.sendMessage(m); - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala deleted file mode 100755 index 185d74f5ed..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.redis - -import org.bigbluebutton.core.api._ -import scala.collection.JavaConversions._ -import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil -import scala.collection.immutable.StringOps -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.conference.service.messaging.MessagingConstants - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -class WhiteboardEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) - case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { - val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { - val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { - val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala deleted file mode 100644 index 4d5ba7cb5a..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala +++ /dev/null @@ -1,93 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.whiteboard.redis.AddShapeWhiteboardRecordEvent -import scala.collection.JavaConversions._ -import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil -import org.bigbluebutton.conference.service.whiteboard.redis.AddTextWhiteboardRecordEvent -import org.bigbluebutton.conference.service.whiteboard.redis.ClearPageWhiteboardRecordEvent -import org.bigbluebutton.conference.service.whiteboard.redis.UndoShapeWhiteboardRecordEvent -import org.bigbluebutton.conference.service.whiteboard.redis.ModifyTextWhiteboardRecordEvent -import scala.collection.immutable.StringOps - - -class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def getPresentationId(whiteboardId:String):String = { - // Need to split the whiteboard id into presenation id and page num as the old - // recording expects them - val strId = new StringOps(whiteboardId) - val ids = strId.split('/') - var presId:String = "" - if (ids.length == 2) { - presId = ids(0) - } - - presId - } - - private def getPageNum(whiteboardId:String):String = { - val strId = new StringOps(whiteboardId) - val ids = strId.split('/') - var pageNum = "0" - if (ids.length == 2) { - pageNum = ids(1) - } - pageNum - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - if ((msg.shape.shapeType == WhiteboardKeyUtil.TEXT_TYPE) && (msg.shape.status != WhiteboardKeyUtil.TEXT_CREATED_STATUS)) { - - val event = new ModifyTextWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId) - event.addAnnotation(mapAsJavaMap(msg.shape.shape)) - recorder.record(msg.meetingID, event) - } else { - val event = new AddShapeWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId); - event.addAnnotation(mapAsJavaMap(msg.shape.shape)) - recorder.record(msg.meetingID, event) - } - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val event = new ClearPageWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId) - recorder.record(msg.meetingID, event) - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val event = new UndoShapeWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId) - event.setShapeId(msg.shapeId); - recorder.record(msg.meetingID, event) - } - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala deleted file mode 100755 index cbdd521e52..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala +++ /dev/null @@ -1,94 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import collection.JavaConverters._ -import scala.collection.JavaConversions._ - -object WhiteboardMessageToJsonConverter { - private def shapeToMap(shape: AnnotationVO):java.util.Map[String, Any] = { - val res = new scala.collection.mutable.HashMap[String, Any] - res += "id" -> shape.id - res += "status" -> shape.status - res += "shape_type" -> shape.shapeType - res += "wb_id" -> shape.wbId - - val shapeMap = new scala.collection.mutable.HashMap[String, Any]() - for ((key, value) <- shape.shape) { - shapeMap += key -> value - } - res += "shape" -> mapAsJavaMap(shapeMap) - - mapAsJavaMap(res) - } - - def getWhiteboardShapesReplyToJson(msg: GetWhiteboardShapesReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val shapes = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.shapes.foreach {shape => - shapes.add(shapeToMap(shape)) - } - - payload.put(Constants.SHAPES, shapes) - - val header = Util.buildHeader(MessageNames.GET_WHITEBOARD_SHAPES_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendWhiteboardAnnotationEventToJson(msg: SendWhiteboardAnnotationEvent):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - payload.put(Constants.SHAPE, shapeToMap(msg.shape)) - - val header = Util.buildHeader(MessageNames.SEND_WHITEBOARD_SHAPE, msg.version, None) - Util.buildJson(header, payload) - } - - def clearWhiteboardEventToJson(msg: ClearWhiteboardEvent):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = Util.buildHeader(MessageNames.WHITEBOARD_CLEARED, msg.version, None) - Util.buildJson(header, payload) - } - - def undoWhiteboardEventToJson(msg: UndoWhiteboardEvent):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - payload.put(Constants.SHAPE_ID, msg.shapeId) - - val header = Util.buildHeader(MessageNames.UNDO_WHITEBOARD, msg.version, None) - Util.buildJson(header, payload) - } - - def whiteboardEnabledEventToJson(msg: WhiteboardEnabledEvent):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ENABLE, msg.enable) - - val header = Util.buildHeader(MessageNames.WHITEBOARD_ENABLED, msg.version, None) - Util.buildJson(header, payload) - } - - def isWhiteboardEnabledReplyToJson(msg: IsWhiteboardEnabledReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ENABLE, msg.enabled) - - val header = Util.buildHeader(MessageNames.IS_WHITEBOARD_ENABLED_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala deleted file mode 100755 index 81711b8f5c..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala +++ /dev/null @@ -1,3 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.vo - -case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Object], wbId:String) \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala deleted file mode 100755 index 79973fb147..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala +++ /dev/null @@ -1,94 +0,0 @@ -package org.bigbluebutton.core.meeting - -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import scala.collection.immutable.HashMap -import com.google.gson.Gson -import scala.collection.JavaConverters._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants - -class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - - private val KEEP_ALIVE_REPLY = "KEEP_ALIVE_REPLY" - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) - case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingHasEnded => handleMeetingHasEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: KeepAliveMessageReply => handleKeepAliveMessageReply(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) - case _ => //println("Unhandled message in MeetingEventRedisPublisher") - } - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) -// System.out.println("****\n" + json) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply) { - val json = MeetingMessageToJsonConverter.keepAliveMessageReplyToJson(msg) - service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, json) - } - - private def handleMeetingCreated(msg:MeetingCreated) { - val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) -// System.out.println("****\n" + json) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleMeetingEnded(msg:MeetingEnded){ - val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) -// System.out.println("****\n" + json) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleStartRecording(msg: StartRecording) { - val json = MeetingMessageToJsonConverter.startRecordingToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleStopRecording(msg: StopRecording) { - val json = MeetingMessageToJsonConverter.stopRecordingToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { - val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { - val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleMeetingHasEnded(msg: MeetingHasEnded) { - val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { - val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala deleted file mode 100644 index 72050524f2..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala +++ /dev/null @@ -1,132 +0,0 @@ -package org.bigbluebutton.core.meeting - -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.JavaConverters._ - -object MeetingMessageToJsonConverter { - def meetingDestroyedToJson(msg: MeetingDestroyed):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.MEETING_DESTROYED_EVENT, msg.version, None) - Util.buildJson(header, payload) - } - - def keepAliveMessageReplyToJson(msg: KeepAliveMessageReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.KEEP_ALIVE_ID, msg.aliveID) - - val header = Util.buildHeader(MessageNames.KEEP_ALIVE_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def meetingCreatedToJson(msg:MeetingCreated):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) - payload.put(Constants.NAME, msg.name) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.VOICE_CONF, msg.voiceBridge) - payload.put(Constants.DURATION, msg.duration) - payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) - payload.put(Constants.VIEWER_PASS, msg.viewerPass) - payload.put(Constants.CREATE_TIME, msg.createTime) - payload.put(Constants.CREATE_DATE, msg.createDate) - - val header = Util.buildHeader(MessageNames.MEETING_CREATED, msg.version, None) - Util.buildJson(header, payload) - } - - def meetingEndedToJson(msg:MeetingEnded):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) - Util.buildJson(header, payload) - } - - def voiceRecordingStartedToJson(msg: VoiceRecordingStarted):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.RECORDING_FILE, msg.recordingFile) - payload.put(Constants.VOICE_CONF, msg.confNum) - payload.put(Constants.TIMESTAMP, msg.timestamp) - - val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STARTED, msg.version, None) - Util.buildJson(header, payload) - } - - def voiceRecordingStoppedToJson(msg: VoiceRecordingStopped):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.RECORDING_FILE, msg.recordingFile) - payload.put(Constants.VOICE_CONF, msg.confNum) - payload.put(Constants.TIMESTAMP, msg.timestamp) - - val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STOPPED, msg.version, None) - Util.buildJson(header, payload) - } - - def recordingStatusChangedToJson(msg: RecordingStatusChanged):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def meetingHasEndedToJson(msg: MeetingHasEnded):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) - Util.buildJson(header, payload) - } - - def startRecordingToJson(msg: StartRecording):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.START_RECORDING, msg.version, None) - Util.buildJson(header, payload) - } - - def stopRecordingToJson(msg: StopRecording):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.STOP_RECORDING, msg.version, None) - Util.buildJson(header, payload) - } - - def getAllMeetingsReplyToJson(msg: GetAllMeetingsReply):String = { - val payload = new java.util.HashMap[String, Any]() - payload.put("meetings", msg.meetings) - - val header = Util.buildHeader(MessageNames.GET_ALL_MEETINGS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala deleted file mode 100644 index 868c08b81c..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala +++ /dev/null @@ -1,33 +0,0 @@ -package org.bigbluebutton.core.messaging - -import org.bigbluebutton.core.api._ -import com.google.gson.Gson - -object Util { - - val VERSION = "version" - - def buildHeader(name: String, version: String, - replyTo:Option[String]):java.util.HashMap[String, Any] = { - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, name) - header.put(VERSION, version) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - replyTo.foreach(rep => header.put(Constants.REPLY_TO, rep)) - - header - } - - - def buildJson(header: java.util.HashMap[String, Any], - payload: java.util.HashMap[String, Any]): String = { - - val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() - message.put(Constants.HEADER, header) - message.put(Constants.PAYLOAD, payload) - - val gson = new Gson() - gson.toJson(message) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala deleted file mode 100755 index 02a3fa94a1..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.bigbluebutton.core.models - -import org.bigbluebutton.core.api.Role._ - -case class Status(isPresenter: Boolean = false, handRaised: Boolean = false) - -case class CallerId(num: String="", name: String="") - -case class Voice( - hasJoined: Boolean = false, - id: String = "", - callerId: CallerId = CallerId(), - muted: Boolean = false, - talking: Boolean = false, - locked: Boolean = false) - -case class UserV( - id: String, - extId: String, - name: String, - role: Role = VIEWER, - status: Status = Status(), - voice: Voice = Voice()) \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/LogHelper.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/LogHelper.scala deleted file mode 100644 index f4646b81b4..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/LogHelper.scala +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.core.util - -import org.slf4j.Logger -import org.red5.logging.Red5LoggerFactory; - -/** - * LogHelper is a trait you can mix in to provide easy log4j logging - * for your scala classes. - **/ -trait LogHelper { - val loggerName = this.getClass.getName - lazy val logger = Red5LoggerFactory.getLogger(this.getClass, "bigbluebutton") -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala deleted file mode 100755 index 08fede1efa..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala +++ /dev/null @@ -1,17 +0,0 @@ -package org.bigbluebutton.core.util - -object RandomStringGenerator { -// From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ - - // Random generator - val random = new scala.util.Random - - // Generate a random string of length n from the given alphabet - def randomString(alphabet: String)(n: Int): String = - Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString - - // Generate a random alphabnumeric string of length n - def randomAlphanumericString(n: Int) = - randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) -} - diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala deleted file mode 100755 index 2b34a0f239..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala +++ /dev/null @@ -1,16 +0,0 @@ -package org.bigbluebutton.core.voice - -import akka.actor._ -import akka.actor.ActorLogging - -case class MuteAllUsers(meetingId: String, except: Option[Seq[String]]) -case class MuteUser(meetingId: String, userId: String) -case class UnmuteUser(meetingId: String, userId: String) -case class EjectVoiceUser(meetingId: String, userId: String) - - -class VoiceConferenceActor(val meetingId: String, - val voiceConf: String) { //extends Actor { - - -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala deleted file mode 100755 index 51c4c3100d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.core.voice - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.freeswitch.FreeswitchManagerProxy - -class VoiceConferenceService(fsproxy: FreeswitchManagerProxy, - bbbInGW: IBigBlueButtonInGW) - extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - } - } - - private def handleMeetingCreated(msg: MeetingCreated) { - - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala deleted file mode 100644 index bb657183ff..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.util._ - -class FreeswitchConference(val conferenceNum: String, - val meetingId: String, - val recorded: Boolean) extends LogHelper { - - private var users = new scala.collection.immutable.HashMap[String, UserVO] - - private var recording:Boolean = false - - def addUser(user: UserVO) { - users += user.userID -> user - } - - def removeUser(user: UserVO) { - users -= user.userID - } - - def getWebUserUsingExtId(webUserId: String):Option[UserVO] = { - users.values find {u => - (u.externUserID == webUserId) - } - } - - def getWebUser(webUserId: String):Option[UserVO] = { - users.values find (u => (u.userID == webUserId)) - } - - def getVoiceUser(voiceUserId: String):Option[UserVO] = { - users.values find (u => u.voiceUser.userId == voiceUserId) - } - - def numUsersInVoiceConference:Int = { - val joinedUsers = users.values filter (u => u.voiceUser.joined) - joinedUsers.size - } - - def numUsers = users.size - - def recordingStarted() { - recording = true; - } - - def recordingStopped() { - recording = false - } - - def isRecording():Boolean = { - recording - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala deleted file mode 100755 index 669b79e771..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala +++ /dev/null @@ -1,250 +0,0 @@ -package org.bigbluebutton.freeswitch - -import akka.actor._ -import akka.actor.ActorLogging -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.util._ - -case class FsVoiceUserJoined(userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, muted: Boolean, - speaking: Boolean) - -case class FsVoiceUserLeft(userId: String, conference: String) -case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) -case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) -case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) -case class FsRecording(conference: String, recordingFile: String, - timestamp: String, recording: Boolean) - -object FreeswitchConferenceActor { - def props(system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW): Props = - Props(classOf[FreeswitchConferenceActor], system, fsproxy, bbbInGW) -} - -class FreeswitchConferenceActor(val system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW) extends Actor with ActorLogging { - - private var confs = new scala.collection.immutable.HashMap[String, FreeswitchConference] - - def receive = { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: FsRecording => handleFsRecording(msg) - case msg: FsVoiceUserJoined => handleFsVoiceUserJoined(msg) - case msg: FsVoiceUserLeft => handleFsVoiceUserLeft(msg) - case msg: FsVoiceUserLocked => handleFsVoiceUserLocked(msg) - case msg: FsVoiceUserMuted => handleFsVoiceUserMuted(msg) - case msg: FsVoiceUserTalking => handleFsVoiceUserTalking(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) - case _ => // do nothing - } - - private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - fsproxy.ejectUsers(fc.conferenceNum) - }) - } - - private def handleMeetingCreated(msg: MeetingCreated) { - if (! confs.contains(msg.meetingID)) { - log.info("Meeting created [" + msg.meetingID + "] with voice conf [" + msg.voiceBridge + "]") - val fsconf = new FreeswitchConference(msg.voiceBridge, - msg.meetingID, - msg.recorded) - confs += fsconf.meetingId -> fsconf - } - - fsproxy.getUsers(msg.voiceBridge) - } - - private def handleMeetingEnded(msg: MeetingEnded) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Meeting ended [" + msg.meetingID + "]") - fsproxy.ejectUsers(fc.conferenceNum) - confs -= fc.meetingId - }) - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Meeting destroyed [" + msg.meetingID + "]") - fsproxy.ejectUsers(fc.conferenceNum) - confs -= fc.meetingId - }) - } - - - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach {fc => - log.info("Web user has joined voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") - fc.addUser(msg.user) - if (fc.numUsersInVoiceConference == 1 && fc.recorded) { - log.info("Meeting is recorded. Tell FreeSWITCH to start recording. mid[" + fc.meetingId + "]") - fsproxy.startRecording(fc.conferenceNum, fc.meetingId) - } - } - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - -// println("FreeswitchConferenceActor - handleUserLeftVoice mid=[" + msg.meetingID + "]") - - fsconf foreach {fc => - fc.addUser(msg.user) - log.info("Web user has left voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") - if (fc.numUsersInVoiceConference == 0 && fc.recorded) { - log.info("Meeting is recorded. No more users in voice conference. Tell FreeSWITCH to stop recording. mid[" + fc.meetingId + "]") - fsproxy.stopRecording(fc.conferenceNum) - } - } - } - - private def handleUserJoined(msg: UserJoined) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Web user id joining meeting id[" + fc.meetingId + "] wid=[" + msg.user.userID + "], extId=[" + msg.user.externUserID + "]") - fc.addUser(msg.user) - }) - } - - private def handleUserLeft(msg: UserLeft) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - fc.removeUser(msg.user) - }) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - log.debug("Mute user request for wid[" + msg.userId + "] mute=[" + msg.mute + "]") - fsconf foreach (fc => { - val user = fc.getWebUser(msg.userId) - user foreach (u => { - log.debug("Muting user wid[" + msg.userId + "] mute=[" + msg.mute + "]") - fsproxy.muteUser(fc.conferenceNum, u.voiceUser.userId, msg.mute) - }) - }) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - val user = fc.getWebUser(msg.userId) - user foreach (u => { - fsproxy.ejectUser(fc.conferenceNum, u.voiceUser.userId) - }) - }) - } - - private def handleStartRecording(msg: StartRecording) { - - } - - private def handleStopRecording(msg: StopRecording) { - - } - - private def handleFsRecording(msg: FsRecording) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - fsconf foreach {fc => - // Need to filter recording events here to not have duplicate events - if (! fc.isRecording && msg.recording) { - // - fc.recordingStarted - bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) - } else if (fc.isRecording && ! msg.recording) { - fc.recordingStopped - bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) - } - } - } - - private def sendNonWebUserJoined(meetingId: String, webUserId: String, msg: FsVoiceUserJoined) { - bbbInGW.voiceUserJoined(meetingId, msg.userId, - webUserId, msg.conference, msg.callerIdNum, msg.callerIdName, - msg.muted, msg.speaking) - } - - private def handleFsVoiceUserJoined(msg: FsVoiceUserJoined) { - log.info("A user has joined the voice conference [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - log.debug("Meeting [" + fc.meetingId + "] has [" + fc.numUsers + "]") - fc.getWebUserUsingExtId(msg.webUserId) match { - case Some(user) => { - log.info("The user is also in the web client. [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - sendNonWebUserJoined(fc.meetingId, user.userID, msg) - } - case None => { - log.info("User is not a web user. Must be a phone caller. [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - sendNonWebUserJoined(fc.meetingId, msg.userId, msg) - } - } - }) - } - - private def handleFsVoiceUserLeft(msg: FsVoiceUserLeft) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - user foreach (u => bbbInGW.voiceUserLeft(fc.meetingId, u.userID)) - }) - } - - private def handleFsVoiceUserLocked(msg: FsVoiceUserLocked) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - user foreach (u => bbbInGW.voiceUserLocked(fc.meetingId, u.userID, msg.locked)) - }) - } - - private def handleFsVoiceUserMuted(msg: FsVoiceUserMuted) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - -// println("Rx voice user muted for cnum=[" + msg.conference + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) -// println("Rx voice user muted for mid=[" + fc.meetingId + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") - user foreach (u => bbbInGW.voiceUserMuted(fc.meetingId, u.userID, msg.muted)) - }) - } - - private def handleFsVoiceUserTalking(msg: FsVoiceUserTalking) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) -// println("Rx voice user talking for vid[" + msg.userId + "] mute=[" + msg.talking + "]") - user foreach (u => bbbInGW.voiceUserTalking(fc.meetingId, u.userID, msg.talking)) - }) - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala deleted file mode 100755 index c3df3a5d7d..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala +++ /dev/null @@ -1,124 +0,0 @@ -package org.bigbluebutton.freeswitch - -import akka.actor.{ ActorSystem, Props } -import org.bigbluebutton.webconference.voice.IVoiceConferenceService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.webconference.voice.FreeswitchConferenceEventListener -import akka.actor.ActorRef - -class FreeswitchConferenceService(fsproxy: FreeswitchManagerProxy, - fsListener: FreeswitchConferenceEventListener) - extends IVoiceConferenceService - with OutMessageListener2 { - - fsListener.setVoiceConferenceService(this) - - implicit val system = ActorSystem("bigbluebutton-apps-fsesl") - - var bbbInGW: IBigBlueButtonInGW = _ - var fsActor: ActorRef = _ - - def setIBigBlueButtonInGW(inGW: IBigBlueButtonInGW) { - bbbInGW = inGW - fsActor = system.actorOf( - FreeswitchConferenceActor.props(system, fsproxy, bbbInGW), - "bigbluebutton-fs-actor") - } - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) - case _ => // do nothing - } - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - fsActor ! msg - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - fsActor ! msg - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - fsActor ! msg - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - fsActor ! msg - } - - private def handleUserLeft(msg: UserLeft) { - fsActor ! msg - } - - private def handleUserJoined(msg: UserJoined) { - fsActor ! msg - } - - private def handleMeetingCreated(msg: MeetingCreated) { - fsActor ! msg - } - - private def handleMeetingEnded(msg: MeetingEnded) { - fsActor ! msg - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - fsActor ! msg - } - - - private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { - fsActor ! msg - } - - def voiceStartedRecording(conference: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) - fsActor ! fsRec - } - - def voiceUserJoined(userId: String, webUserId: String, conference: String, - callerIdNum: String, callerIdName: String, - muted: java.lang.Boolean, talking: java.lang.Boolean) { -// println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") - val vuj = new FsVoiceUserJoined(userId, webUserId, - conference, callerIdNum, - callerIdName, muted, - talking) - fsActor ! vuj - } - - def voiceUserLeft(userId: String, conference: String) { -// println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") - val vul = new FsVoiceUserLeft(userId, conference) - fsActor ! vul - } - - def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { - val vul = new FsVoiceUserLocked(userId, conference, locked) - fsActor ! vul - } - - def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") - val vum = new FsVoiceUserMuted(userId, conference, muted) - fsActor ! vum - } - - def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") - val vut = new FsVoiceUserTalking(userId, conference, talking) - fsActor ! vut - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala deleted file mode 100755 index a5d5434b30..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.webconference.voice.freeswitch.FreeswitchApplication - -class FreeswitchManagerProxy(fsApp: FreeswitchApplication) { - - def getUsers(conference: String) { - fsApp.populateRoom(conference) - } - - def ejectUsers(conference: String) { - fsApp.ejectAll(conference) - } - - def muteUser(conference: String, userId: String, mute: Boolean) { - println("Forwarding mute request to fsApp") - fsApp.mute(conference, userId, mute) - } - - def ejectUser(conference: String, userId: String ) { - println("Forwarding eject user request to fsApp") - fsApp.eject(conference, userId) - } - - def startRecording(conference: String, meetingId: String) { - fsApp.record(conference, meetingId) - } - - def stopRecording(conference: String) { - - } -} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala deleted file mode 100755 index 011be11c57..0000000000 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.core.api.IBigBlueButtonInGW - -/** - * Workaround to get away from circular dependency injection. - */ -class FsInGwWrapper(inGW: IBigBlueButtonInGW, - fsConfService: FreeswitchConferenceService) { - - fsConfService.setIBigBlueButtonInGW(inGW) -} \ No newline at end of file From 371c7507cc8431da5d8062d3e47f279968bdd672 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 14 May 2015 20:58:57 +0000 Subject: [PATCH 05/30] - clean up --- bigbluebutton-apps/build.gradle | 18 ------- .../service/layout/LayoutApplication.java | 11 ++-- .../service/layout/LayoutService.java | 15 +++--- .../core/api/IBigBlueButtonInGW.java | 6 +-- .../bigbluebutton/core/api/IDispatcher.java | 6 --- .../src/main/webapp/WEB-INF/red5-web.xml | 52 ++----------------- 6 files changed, 19 insertions(+), 89 deletions(-) mode change 100644 => 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java diff --git a/bigbluebutton-apps/build.gradle b/bigbluebutton-apps/build.gradle index 16e262975d..812053967a 100755 --- a/bigbluebutton-apps/build.gradle +++ b/bigbluebutton-apps/build.gradle @@ -99,24 +99,6 @@ dependencies { //compile 'redis.clients:jedis:2.0.0' providedCompile 'commons-pool:commons-pool:1.5.6' - // Libraries needed to run the scala tools - scalaTools 'org.scala-lang:scala-compiler:2.11.6' - scalaTools 'org.scala-lang:scala-library:2.11.6' - - // Libraries needed for scala api - compile 'org.scala-lang:scala-library:2.11.6' - - compile 'com.typesafe.akka:akka-actor_2.11:2.3.10' - compile 'com.typesafe.akka:akka-testkit_2.11:2.3.10' - compile 'com.typesafe.akka:akka-slf4j_2.11:2.3.10' - - // workaround for http://issues.gradle.org/browse/GRADLE-1273 - //compileScala.classpath = sourceSets.main.compileClasspath + files(sourceSets.main.classesDir) - //compileTestScala.classpath = sourceSets.test.compileClasspath + files(sourceSets.test.classesDir) - - // Freeswitch ESL Client - compile 'org/freeswitch:fs-esl-client:0.8.2@jar' - compile 'org.jboss.netty:netty:3.2.1.Final@jar' compile 'com.google.code.gson:gson:1.7.1' providedCompile 'org.apache.commons:commons-lang3:3.2' diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java old mode 100644 new mode 100755 index ea62ccfee6..0c8fcb32ac --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java @@ -20,7 +20,6 @@ package org.bigbluebutton.conference.service.layout; import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import scala.Option; public class LayoutApplication { private IBigBlueButtonInGW bbbInGW; @@ -33,11 +32,11 @@ public class LayoutApplication { bbbInGW.broadcastLayout(meetingID, requesterID, layout); } - public void lockLayout(String meetingId, String setById, - Boolean lock, Boolean viewersOnly, - Option layout) { - bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout); - } +// public void lockLayout(String meetingId, String setById, +// Boolean lock, Boolean viewersOnly, +// Option layout) { +// bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout); +// } public void getCurrentLayout(String meetingID, String requesterID) { bbbInGW.getCurrentLayout(meetingID, requesterID); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java index 1290756063..aa660b616f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java @@ -25,7 +25,6 @@ import org.bigbluebutton.conference.Constants; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; -import scala.Option; public class LayoutService { @@ -59,12 +58,12 @@ public class LayoutService { Boolean lock = (Boolean) message.get("lock"); Boolean viewersOnly = (Boolean) message.get("viewersOnly"); - Option layout; - if (newlayout == null || newlayout.isEmpty()) { - layout = Option.empty(); - } else { - layout = scala.Option.apply(newlayout); - } +// Option layout; +// if (newlayout == null || newlayout.isEmpty()) { +// layout = Option.empty(); +// } else { +// layout = scala.Option.apply(newlayout); +// } if (lock == null) { log.error("Invalid Lock Layout message. lock in null."); @@ -76,7 +75,7 @@ public class LayoutService { return; } - application.lockLayout(meetingID, getBbbSession().getInternalUserID(), lock, viewersOnly, layout); +// application.lockLayout(meetingID, getBbbSession().getInternalUserID(), lock, viewersOnly, layout); } public void setLayoutApplication(LayoutApplication a) { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java index 8dd2dbb26c..a095dfb906 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -99,9 +99,9 @@ public interface IBigBlueButtonInGW { // Layout void getCurrentLayout(String meetingID, String requesterID); void broadcastLayout(String meetingID, String requesterID, String layout); - void lockLayout(String meetingID, String setById, - boolean lock, boolean viewersOnly, - scala.Option layout); +// void lockLayout(String meetingID, String setById, +// boolean lock, boolean viewersOnly, +// scala.Option layout); // Chat void getChatHistory(String meetingID, String requesterID, String replyTo); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java deleted file mode 100755 index fa1b97c3c6..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface IDispatcher { - - void dispatch(String jsonMessage); -} diff --git a/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml b/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml index b90467c897..a966998f9e 100755 --- a/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml +++ b/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml @@ -86,18 +86,7 @@ with BigBlueButton; if not, see . - - - - - - - - - - @@ -172,50 +161,17 @@ with BigBlueButton; if not, see . - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + From 09b7d5e14e1de743ec74bc9f1da307b0118488ff Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 15 May 2015 14:27:17 +0000 Subject: [PATCH 06/30] - cleanup --- .../red5/ConnectionInvokerService.java | 34 ---- .../red5/SharedObjectClientMessage.java | 59 ------- .../service/chat/ChatApplication.java | 51 ------ .../conference/service/chat/ChatService.java | 20 ++- .../service/layout/LayoutApplication.java | 44 ------ .../service/layout/LayoutService.java | 18 ++- .../participants/ParticipantsApplication.java | 77 --------- .../participants/ParticipantsHandler.java | 104 ------------- .../participants/ParticipantsService.java | 37 +++-- .../ConversionUpdatesProcessor.java | 59 ------- .../presentation/PresentationApplication.java | 97 ------------ .../PresentationMessageListener.java | 147 ------------------ .../presentation/PresentationService.java | 38 +++-- .../PreuploadedPresentationsUtil.java | 55 ------- .../whiteboard/WhiteboardApplication.java | 121 -------------- .../service/whiteboard/WhiteboardService.java | 43 ++--- .../src/main/webapp/WEB-INF/red5-web.xml | 26 +--- 17 files changed, 91 insertions(+), 939 deletions(-) delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/SharedObjectClientMessage.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsHandler.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java delete mode 100644 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardApplication.java diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java index 9988ef9e79..2353862f07 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java @@ -22,20 +22,13 @@ import java.util.Set; import java.util.ArrayList; import java.util.List; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; - import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.IConnection; import org.red5.server.api.scope.IScope; -import org.red5.server.api.scope.ScopeType; import org.red5.server.api.service.ServiceUtils; -import org.red5.server.api.so.ISharedObject; -import org.red5.server.api.so.ISharedObjectService; -import org.red5.server.so.SharedObjectService; -import org.red5.server.util.ScopeUtils; import org.slf4j.Logger; public class ConnectionInvokerService { @@ -93,8 +86,6 @@ public class ConnectionInvokerService { sendBroadcastMessage((BroadcastClientMessage) message); } else if (message instanceof DirectClientMessage) { sendDirectMessage((DirectClientMessage) message); - } else if (message instanceof SharedObjectClientMessage) { - sendSharedObjectMessage((SharedObjectClientMessage) message); } else if (message instanceof DisconnectClientMessage) { handlDisconnectClientMessage((DisconnectClientMessage) message); } else if (message instanceof DisconnectAllClientsMessage) { @@ -130,27 +121,6 @@ public class ConnectionInvokerService { } } } - - private void sendSharedObjectMessage(SharedObjectClientMessage msg) { - System.out.println("*********** Request to send [" + msg.getMessageName() + "] using shared object."); - - IScope meetingScope = getScope(msg.getMeetingID()); - if (meetingScope != null) { - if (meetingScope.hasChildScope(ScopeType.SHARED_OBJECT, msg.getSharedObjectName())) { - ISharedObject so = getSharedObject(meetingScope, msg.getSharedObjectName()); - if (so != null) { - System.out.println("*********** Sending [" + msg.getMessageName() + "] using shared object."); - so.sendMessage(msg.getMessageName(), msg.getMessage()); - } else { - System.out.println("**** Cannot get SO for [" + msg.getSharedObjectName() + "]"); - } - } else { - System.out.println("**** No SO scope for [" + msg.getSharedObjectName() + "]"); - } - } else { - System.out.println("**** No Meeting scope for [" + msg.getMeetingID() + "]"); - } - } private void sendDirectMessage(final DirectClientMessage msg) { final String sessionId = CONN + msg.getUserID(); @@ -216,8 +186,4 @@ public class ConnectionInvokerService { return null; } - private ISharedObject getSharedObject(IScope scope, String name) { - ISharedObjectService service = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, SharedObjectService.class, false); - return service.getSharedObject(scope, name); - } } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/SharedObjectClientMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/SharedObjectClientMessage.java deleted file mode 100755 index 33abc80a67..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/SharedObjectClientMessage.java +++ /dev/null @@ -1,59 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.meeting.messaging.red5; - -import java.util.ArrayList; - -public class SharedObjectClientMessage implements ClientMessage { - public static final String BROADCAST = "broadcast"; - public static final String DIRECT = "direct"; - public static final String SHAREDOBJECT = "sharedobject"; - - private String meetingID; - private String sharedObjectName; - private ArrayList message; - private String messageName; - - public SharedObjectClientMessage(String meetingID, String sharedObjectName, String messageName, ArrayList message) { - this.meetingID = meetingID; - this.message = message; - this.sharedObjectName = sharedObjectName; - this.messageName = messageName; - } - - public void setSharedObjectName(String name) { - sharedObjectName = name; - } - - public String getSharedObjectName() { - return sharedObjectName; - } - - public String getMeetingID() { - return meetingID; - } - - public String getMessageName() { - return messageName; - } - - public ArrayList getMessage() { - return message; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatApplication.java deleted file mode 100755 index 69d611b87f..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatApplication.java +++ /dev/null @@ -1,51 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.conference.service.chat; - -import java.util.Map; - -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.red5.logging.Red5LoggerFactory; -import org.slf4j.Logger; - - -public class ChatApplication { - private static Logger log = Red5LoggerFactory.getLogger( ChatApplication.class, "bigbluebutton" ); - - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - public void sendPublicChatHistory(String meetingID, String requesterID) { - // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) - String replyTo = meetingID + "/" + requesterID; - bbbInGW.getChatHistory(meetingID, requesterID, replyTo); - } - - public void sendPublicMessage(String meetingID, String requesterID, Map message) { - bbbInGW.sendPublicMessage(meetingID, requesterID, message); - } - - public void sendPrivateMessage(String meetingID, String requesterID, Map message) { - bbbInGW.sendPrivateMessage(meetingID, requesterID, message); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java index ad8f40a645..129f19d90b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java @@ -20,21 +20,29 @@ package org.bigbluebutton.conference.service.chat; import java.util.HashMap; import java.util.Map; + import org.slf4j.Logger; import org.bigbluebutton.conference.BigBlueButtonSession; import org.bigbluebutton.conference.Constants; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; public class ChatService { private static Logger log = Red5LoggerFactory.getLogger( ChatService.class, "bigbluebutton" ); - private ChatApplication application; + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } public void sendPublicChatHistory() { String meetingID = Red5.getConnectionLocal().getScope().getName(); String requesterID = getBbbSession().getInternalUserID(); + // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) + String replyTo = meetingID + "/" + requesterID; - application.sendPublicChatHistory(meetingID, requesterID); + bbbInGW.getChatHistory(meetingID, requesterID, replyTo); } private BigBlueButtonSession getBbbSession() { @@ -67,12 +75,10 @@ public class ChatService { String meetingID = Red5.getConnectionLocal().getScope().getName(); String requesterID = getBbbSession().getInternalUserID(); - application.sendPublicMessage(meetingID, requesterID, message); + bbbInGW.sendPublicMessage(meetingID, requesterID, message); } - public void setChatApplication(ChatApplication a) { - application = a; - } + public void sendPrivateMessage(Map msg){ String chatType = msg.get(ChatKeyUtil.CHAT_TYPE).toString(); @@ -99,7 +105,7 @@ public class ChatService { String meetingID = Red5.getConnectionLocal().getScope().getName(); String requesterID = getBbbSession().getInternalUserID(); - application.sendPrivateMessage(meetingID, requesterID, message); + bbbInGW.sendPrivateMessage(meetingID, requesterID, message); } } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java deleted file mode 100755 index 0c8fcb32ac..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java +++ /dev/null @@ -1,44 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.layout; - -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - - -public class LayoutApplication { - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - public void broadcastLayout(String meetingID, String requesterID, String layout) { - bbbInGW.broadcastLayout(meetingID, requesterID, layout); - } - -// public void lockLayout(String meetingId, String setById, -// Boolean lock, Boolean viewersOnly, -// Option layout) { -// bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout); -// } - - public void getCurrentLayout(String meetingID, String requesterID) { - bbbInGW.getCurrentLayout(meetingID, requesterID); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java index aa660b616f..d2527d77a3 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java @@ -22,6 +22,7 @@ import java.util.Map; import org.bigbluebutton.conference.BigBlueButtonSession; import org.bigbluebutton.conference.Constants; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; @@ -30,12 +31,16 @@ public class LayoutService { private static Logger log = Red5LoggerFactory.getLogger( LayoutService.class, "bigbluebutton" ); - private LayoutApplication application; - + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } + public void getCurrentLayout() { String meetingID = Red5.getConnectionLocal().getScope().getName(); log.debug("Received get current layout request"); - application.getCurrentLayout(meetingID, getBbbSession().getInternalUserID()); + bbbInGW.getCurrentLayout(meetingID, getBbbSession().getInternalUserID()); } public void broadcast(Map message) { @@ -48,7 +53,7 @@ public class LayoutService { return; } - application.broadcastLayout(meetingID, getBbbSession().getInternalUserID(), newlayout); + bbbInGW.broadcastLayout(meetingID, getBbbSession().getInternalUserID(), newlayout); } public void lock(Map message) { @@ -75,12 +80,9 @@ public class LayoutService { return; } -// application.lockLayout(meetingID, getBbbSession().getInternalUserID(), lock, viewersOnly, layout); +// bbbInGW.lockLayout(meetingID, getBbbSession().getInternalUserID(), lock, viewersOnly, layout); } - public void setLayoutApplication(LayoutApplication a) { - application = a; - } private BigBlueButtonSession getBbbSession() { return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsApplication.java deleted file mode 100755 index 89b6977d1b..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsApplication.java +++ /dev/null @@ -1,77 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.participants; - -import org.slf4j.Logger; -import org.red5.logging.Red5LoggerFactory; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - -public class ParticipantsApplication { - private static Logger log = Red5LoggerFactory.getLogger( ParticipantsApplication.class, "bigbluebutton" ); - private IBigBlueButtonInGW bbbInGW; - - public void userRaiseHand(String meetingId, String userId) { - bbbInGW.userRaiseHand(meetingId, userId); - } - - public void lowerHand(String meetingId, String userId, String loweredBy) { - bbbInGW.lowerHand(meetingId, userId, loweredBy); - } - - public void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy) { - bbbInGW.ejectUserFromMeeting(meetingId, userId, ejectedBy); - } - - public void shareWebcam(String meetingId, String userId, String stream) { - bbbInGW.shareWebcam(meetingId, userId, stream); - } - - public void unshareWebcam(String meetingId, String userId, String stream) { - bbbInGW.unshareWebcam(meetingId, userId, stream); - } - - public void setParticipantStatus(String room, String userid, String status, Object value) { - bbbInGW.setUserStatus(room, userid, status, value); - } - - public boolean registerUser(String roomName, String userid, String username, String role, String externUserID) { - bbbInGW.registerUser(roomName, userid, username, role, externUserID, userid); - return true; - } - - public void assignPresenter(String room, String newPresenterID, String newPresenterName, String assignedBy){ - bbbInGW.assignPresenter(room, newPresenterID, newPresenterName, assignedBy); - } - - public void getUsers(String meetingID, String requesterID, String sessionId) { - bbbInGW.getUsers(meetingID, requesterID); - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - public void setRecordingStatus(String meetingId, String userId, Boolean recording) { - bbbInGW.setRecordingStatus(meetingId, userId, recording); - } - - public void getRecordingStatus(String meetingId, String userId) { - bbbInGW.getRecordingStatus(meetingId, userId); - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsHandler.java deleted file mode 100755 index 008ccb1614..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.conference.service.participants; - -import org.red5.server.adapter.IApplication; -import org.red5.server.api.IClient; -import org.red5.server.api.IConnection; -import org.slf4j.Logger; -import org.red5.logging.Red5LoggerFactory; -import org.red5.server.api.scope.IScope; -import org.red5.server.api.Red5; -import java.util.HashMap; -import java.util.Map; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; - -public class ParticipantsHandler implements IApplication{ - private static Logger log = Red5LoggerFactory.getLogger( ParticipantsHandler.class, "bigbluebutton" ); - - private static final String APP = "USERS"; - - private ParticipantsApplication participantsApplication; - - @Override - public boolean appConnect(IConnection conn, Object[] params) { - return true; - } - - @Override - public void appDisconnect(IConnection conn) { - } - - @Override - public boolean appJoin(IClient client, IScope scope) { - return true; - } - - @Override - public void appLeave(IClient client, IScope scope) { - } - - @Override - public boolean appStart(IScope scope) { - return true; - } - - @Override - public void appStop(IScope scope) { - } - - @Override - public void roomDisconnect(IConnection connection) { - } - - @Override - public boolean roomStart(IScope scope) { - return true; - } - - @Override - public boolean roomConnect(IConnection connection, Object[] params) { - return true; - } - - @Override - public boolean roomJoin(IClient client, IScope scope) { - return true; - } - - @Override - public void roomLeave(IClient client, IScope scope) { - } - - @Override - public void roomStop(IScope scope) { - } - - public void setParticipantsApplication(ParticipantsApplication a) { - participantsApplication = a; - } - - - private BigBlueButtonSession getBbbSession() { - return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java index 9228da53f1..6f5e0c2288 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java @@ -23,78 +23,81 @@ import org.slf4j.Logger; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.red5.server.api.scope.IScope; + import java.util.Map; + import org.bigbluebutton.conference.BigBlueButtonSession; import org.bigbluebutton.conference.Constants; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; public class ParticipantsService { private static Logger log = Red5LoggerFactory.getLogger( ParticipantsService.class, "bigbluebutton" ); - private ParticipantsApplication application; + private final String CONN = "RED5-"; + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } + public void assignPresenter(Map msg) { IScope scope = Red5.getConnectionLocal().getScope(); - application.assignPresenter(scope.getName(), (String) msg.get("newPresenterID"), (String) msg.get("newPresenterName"), (String) msg.get("assignedBy")); + bbbInGW.assignPresenter(scope.getName(), (String) msg.get("newPresenterID"), (String) msg.get("newPresenterName"), (String) msg.get("assignedBy")); } public void getParticipants() { IScope scope = Red5.getConnectionLocal().getScope(); String connId = Red5.getConnectionLocal().getSessionId(); - String sessionId = CONN + connId + "-" + getBbbSession().getInternalUserID(); - application.getUsers(scope.getName(), getBbbSession().getInternalUserID(), sessionId); + bbbInGW.getUsers(scope.getName(), getBbbSession().getInternalUserID()); } public void userRaiseHand() { IScope scope = Red5.getConnectionLocal().getScope(); String userId = getBbbSession().getInternalUserID(); - application.userRaiseHand(scope.getName(), userId); + bbbInGW.userRaiseHand(scope.getName(), userId); } public void lowerHand(Map msg) { String userId = (String) msg.get("userId"); String loweredBy = (String) msg.get("loweredBy"); IScope scope = Red5.getConnectionLocal().getScope(); - application.lowerHand(scope.getName(), userId, loweredBy); + bbbInGW.lowerHand(scope.getName(), userId, loweredBy); } public void ejectUserFromMeeting(Map msg) { String userId = (String) msg.get("userId"); String ejectedBy = (String) msg.get("ejectedBy"); IScope scope = Red5.getConnectionLocal().getScope(); - application.ejectUserFromMeeting(scope.getName(), userId, ejectedBy); + bbbInGW.ejectUserFromMeeting(scope.getName(), userId, ejectedBy); } public void shareWebcam(String stream) { IScope scope = Red5.getConnectionLocal().getScope(); String userId = getBbbSession().getInternalUserID(); - application.shareWebcam(scope.getName(), userId, stream); + bbbInGW.shareWebcam(scope.getName(), userId, stream); } public void unshareWebcam(String stream) { IScope scope = Red5.getConnectionLocal().getScope(); String userId = getBbbSession().getInternalUserID(); - application.unshareWebcam(scope.getName(), userId, stream); + bbbInGW.unshareWebcam(scope.getName(), userId, stream); } public void setParticipantStatus(Map msg) { String roomName = Red5.getConnectionLocal().getScope().getName(); - - application.setParticipantStatus(roomName, (String) msg.get("userID"), (String) msg.get("status"), (Object) msg.get("value")); - } - - public void setParticipantsApplication(ParticipantsApplication a) { - application = a; + bbbInGW.setUserStatus(roomName, (String) msg.get("userID"), (String) msg.get("status"), (Object) msg.get("value")); } public void setRecordingStatus(Map msg) { String roomName = Red5.getConnectionLocal().getScope().getName(); - application.setRecordingStatus(roomName, (String)msg.get("userId"), (Boolean) msg.get("recording")); + bbbInGW.setRecordingStatus(roomName, (String)msg.get("userId"), (Boolean) msg.get("recording")); } public void getRecordingStatus() { String roomName = Red5.getConnectionLocal().getScope().getName(); - application.getRecordingStatus(roomName, getMyUserId()); + bbbInGW.getRecordingStatus(roomName, getMyUserId()); } public String getMyUserId() { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java deleted file mode 100755 index 1cf384454c..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java +++ /dev/null @@ -1,59 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.presentation; - -import org.slf4j.Logger; -import org.red5.logging.Red5LoggerFactory; -public class ConversionUpdatesProcessor { - private static Logger log = Red5LoggerFactory.getLogger(ConversionUpdatesProcessor.class, "bigbluebutton"); - - private PresentationApplication presentationApplication; - - public void sendConversionUpdate(String messageKey, String conference, - String code, String presId, String presName) { - presentationApplication.sendConversionUpdate(messageKey, conference, - code, presId, presName); - } - - public void sendPageCountError(String messageKey, String conference, - String code, String presId, int numberOfPages, - int maxNumberPages, String presName) { - presentationApplication.sendPageCountError(messageKey, conference, - code, presId, numberOfPages, - maxNumberPages, presName); - } - - public void sendSlideGenerated(String messageKey, String conference, - String code, String presId, int numberOfPages, - int pagesCompleted, String presName) { - presentationApplication.sendSlideGenerated(messageKey, conference, - code, presId, numberOfPages, pagesCompleted, presName); - } - - public void sendConversionCompleted(String messageKey, String conference, - String code, String presId, Integer numberOfPages, String presName, - String presBaseUrl) { - presentationApplication.sendConversionCompleted(messageKey, conference, - code, presId, numberOfPages, presName, presBaseUrl); - } - - public void setPresentationApplication(PresentationApplication a) { - presentationApplication = a; - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java deleted file mode 100755 index c1562c9abb..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationApplication.java +++ /dev/null @@ -1,97 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.presentation; - -import org.slf4j.Logger; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.red5.logging.Red5LoggerFactory; - -public class PresentationApplication { - private static Logger log = Red5LoggerFactory.getLogger( PresentationApplication.class, "bigbluebutton" ); - - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - public void clear(String meetingID) { - - } - - public void sendConversionUpdate(String messageKey, String meetingId, - String code, String presentationId, String presName) { - bbbInGW.sendConversionUpdate(messageKey, meetingId, code, - presentationId, presName); - } - - public void sendPageCountError(String messageKey, String meetingId, - String code, String presentationId, int numberOfPages, - int maxNumberPages, String presName) { - bbbInGW.sendPageCountError(messageKey, meetingId, code, - presentationId, numberOfPages, maxNumberPages, presName); - } - - public void sendSlideGenerated(String messageKey, String meetingId, - String code, String presentationId, int numberOfPages, - int pagesCompleted, String presName) { - bbbInGW.sendSlideGenerated(messageKey, meetingId, code, - presentationId, numberOfPages, pagesCompleted, presName); - } - - public void sendConversionCompleted(String messageKey, String meetingId, - String code, String presentation, int numberOfPages, - String presName, String presBaseUrl) { - bbbInGW.sendConversionCompleted(messageKey, meetingId, - code, presentation, numberOfPages, presName, presBaseUrl); - } - - public void removePresentation(String meetingID, String presentationID){ - bbbInGW.removePresentation(meetingID, presentationID); - } - - public void getPresentationInfo(String meetingID, String requesterID) { - // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) - String replyTo = meetingID + "/" + requesterID; - bbbInGW.getPresentationInfo(meetingID, requesterID, replyTo); - } - - public void sendCursorUpdate(String meetingID, Double xPercent, Double yPercent) { - bbbInGW.sendCursorUpdate(meetingID, xPercent, yPercent); - } - - public void resizeAndMoveSlide(String meetingID, Double xOffset, Double yOffset, Double widthRatio, Double heightRatio) { - bbbInGW.resizeAndMoveSlide(meetingID, xOffset, yOffset, widthRatio, heightRatio); - } - - public void gotoSlide(String meetingID, String pageId){ - bbbInGW.gotoSlide(meetingID, pageId); - } - - public void sharePresentation(String meetingID, String presentationID, Boolean share){ - bbbInGW.sharePresentation(meetingID, presentationID, share); - } - - public void getSlideInfo(String meetingID, String requesterID) { - // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) - String replyTo = meetingID + "/" + requesterID; - bbbInGW.getSlideInfo(meetingID, requesterID, replyTo); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java deleted file mode 100755 index 457bb69895..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.bigbluebutton.conference.service.presentation; - -import java.util.HashMap; -import java.util.Map; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import com.google.gson.JsonParser; -import com.google.gson.JsonObject; - -public class PresentationMessageListener implements MessageHandler { - - public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS"; - public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED"; - public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT"; - public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT"; - public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED"; - public static final String PAGE_COUNT_EXCEEDED_KEY = "PAGE_COUNT_EXCEEDED"; - public static final String GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; - public static final String GENERATING_THUMBNAIL_KEY = "GENERATING_THUMBNAIL"; - public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL"; - public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; - - private ConversionUpdatesProcessor conversionUpdatesProcessor; - private IBigBlueButtonInGW bbbInGW; - - public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) { - conversionUpdatesProcessor = p; - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - private void sendConversionUpdate(String messageKey, String conference, - String code, String presId, String filename) { - - conversionUpdatesProcessor.sendConversionUpdate(messageKey, conference, - code, presId, filename); - } - - public void sendPageCountError(String messageKey, String conference, - String code, String presId, Integer numberOfPages, - Integer maxNumberPages, String filename) { - - conversionUpdatesProcessor.sendPageCountError(messageKey, conference, - code, presId, numberOfPages, - maxNumberPages, filename); - } - - private void sendSlideGenerated(String messageKey, String conference, - String code, String presId, Integer numberOfPages, - Integer pagesCompleted, String filename) { - - conversionUpdatesProcessor.sendSlideGenerated(messageKey, conference, - code, presId, numberOfPages, - pagesCompleted, filename); - } - - private void sendConversionCompleted(String messageKey, String conference, - String code, String presId, Integer numberOfPages, - String filename, String presBaseUrl) { - - conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference, - code, presId, numberOfPages, filename, presBaseUrl); - } - - @Override - public void handleMessage(String pattern, String channel, String message) { - - if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) { - - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if(obj.has("payload") && obj.has("header")) { - - JsonObject headerObject = (JsonObject) obj.get("header"); - JsonObject payloadObject = (JsonObject) obj.get("payload"); - - String eventName = headerObject.get("name").toString().replace("\"", ""); - - if(eventName.equalsIgnoreCase("presentation_page_changed_message") || - eventName.equalsIgnoreCase("presentation_page_resized_message")) { - - JsonObject pageObject = (JsonObject) payloadObject.get("page"); - String roomName = payloadObject.get("meeting_id").toString().replace("\"", ""); - - if(eventName.equalsIgnoreCase("presentation_page_changed_message")) { - String pageId = pageObject.get("id").toString().replace("\"", ""); - bbbInGW.gotoSlide(roomName, pageId); - } else if(eventName.equalsIgnoreCase("presentation_page_resized_message")) { - String xOffset = pageObject.get("x_offset").toString().replace("\"", ""); - String yOffset = pageObject.get("y_offset").toString().replace("\"", ""); - String widthRatio = pageObject.get("width_ratio").toString().replace("\"", ""); - String heightRatio = pageObject.get("height_ratio").toString().replace("\"", ""); - bbbInGW.resizeAndMoveSlide(roomName, Double.parseDouble(xOffset), Double.parseDouble(yOffset), Double.parseDouble(widthRatio), Double.parseDouble(heightRatio)); - } - } - } - else { - Gson gson = new Gson(); - HashMap map = gson.fromJson(message, new TypeToken>() {}.getType()); - - String code = (String) map.get("returnCode"); - String presId = (String) map.get("presentationId"); - String filename = (String) map.get("filename"); - String conference = (String) map.get("conference"); - String messageKey = (String) map.get("messageKey"); - - if (messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_SUCCESS_KEY) || - messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_FAILED_KEY) || - messageKey.equalsIgnoreCase(SUPPORTED_DOCUMENT_KEY) || - messageKey.equalsIgnoreCase(UNSUPPORTED_DOCUMENT_KEY) || - messageKey.equalsIgnoreCase(GENERATING_THUMBNAIL_KEY) || - messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY) || - messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){ - - sendConversionUpdate(messageKey, conference, code, presId, filename); - - } else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){ - Integer numberOfPages = new Integer((String) map.get("numberOfPages")); - Integer maxNumberPages = new Integer((String) map.get("maxNumberPages")); - - sendPageCountError(messageKey, conference, code, - presId, numberOfPages, maxNumberPages, filename); - - } else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){ - Integer numberOfPages = new Integer((String) map.get("numberOfPages")); - Integer pagesCompleted = new Integer((String) map.get("pagesCompleted")); - - sendSlideGenerated(messageKey, conference, code, - presId, numberOfPages, pagesCompleted, filename); - - } else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){ - Integer numberOfPages = new Integer((String) map.get("numberOfPages")); - String presBaseUrl = (String) map.get("presentationBaseUrl"); - - sendConversionCompleted(messageKey, conference, code, - presId, numberOfPages, filename, presBaseUrl); - } - } - } - } -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java index 0873b641ed..bcf512fcc2 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java @@ -19,41 +19,51 @@ package org.bigbluebutton.conference.service.presentation; import java.util.Map; - import org.slf4j.Logger; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.red5.server.api.scope.IScope; import org.bigbluebutton.conference.BigBlueButtonSession; import org.bigbluebutton.conference.Constants; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; public class PresentationService { private static Logger log = Red5LoggerFactory.getLogger( PresentationService.class, "bigbluebutton" ); - private PresentationApplication presentationApplication; + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } public void removePresentation(Map msg) { String presentationID = (String) msg.get("presentationID"); IScope scope = Red5.getConnectionLocal().getScope(); - presentationApplication.removePresentation(scope.getName(), presentationID); + bbbInGW.removePresentation(scope.getName(), presentationID); } public void getSlideInfo() { IScope scope = Red5.getConnectionLocal().getScope(); - log.debug("Getting slide info for meeting [{}]", scope.getName()); - presentationApplication.getSlideInfo(scope.getName(), getBbbSession().getInternalUserID()); + String meetingID = scope.getName(); + String requesterID = getBbbSession().getInternalUserID(); + // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) + String replyTo = meetingID + "/" + requesterID; + bbbInGW.getSlideInfo(meetingID, requesterID, replyTo); } public void clear() { IScope scope = Red5.getConnectionLocal().getScope(); - presentationApplication.clear(scope.getName()); + bbbInGW.clear(scope.getName()); } public void getPresentationInfo() { IScope scope = Red5.getConnectionLocal().getScope(); - log.debug("Getting presentation info for meeting [{}]", scope.getName()); - presentationApplication.getPresentationInfo(scope.getName(), getBbbSession().getInternalUserID()); + String meetingID = scope.getName(); + String requesterID = getBbbSession().getInternalUserID(); + // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) + String replyTo = meetingID + "/" + requesterID; + bbbInGW.getPresentationInfo(meetingID, requesterID, replyTo); } public void gotoSlide(Map msg) { @@ -62,7 +72,7 @@ public class PresentationService { IScope scope = Red5.getConnectionLocal().getScope(); log.debug("Got GotoSlide for meeting [{}] page=[{}]", scope.getName(), pageId); - presentationApplication.gotoSlide(scope.getName(), pageId); + bbbInGW.gotoSlide(scope.getName(), pageId); } public void sharePresentation(Map msg) { @@ -70,7 +80,7 @@ public class PresentationService { Boolean share = (Boolean) msg.get("share"); IScope scope = Red5.getConnectionLocal().getScope(); - presentationApplication.sharePresentation(scope.getName(), presentationID, share); + bbbInGW.sharePresentation(scope.getName(), presentationID, share); } public void sendCursorUpdate(Map msg) { @@ -93,7 +103,7 @@ public class PresentationService { yPercent = (Double) msg.get("yPercent"); } - presentationApplication.sendCursorUpdate(scope.getName(), xPercent, yPercent); + bbbInGW.sendCursorUpdate(scope.getName(), xPercent, yPercent); } public void resizeAndMoveSlide(Map msg) { @@ -132,11 +142,7 @@ public class PresentationService { } IScope scope = Red5.getConnectionLocal().getScope(); - presentationApplication.resizeAndMoveSlide(scope.getName(), xOffset, yOffset, widthRatio, heightRatio); - } - - public void setPresentationApplication(PresentationApplication a) { - presentationApplication = a; + bbbInGW.resizeAndMoveSlide(scope.getName(), xOffset, yOffset, widthRatio, heightRatio); } private BigBlueButtonSession getBbbSession() { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java deleted file mode 100644 index 94266c37f1..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.bigbluebutton.conference.service.presentation; - -import java.io.File; -import java.io.FileFilter; -import java.io.FilenameFilter; -import java.util.ArrayList; - -public class PreuploadedPresentationsUtil { - - private String bbbDir = "/var/bigbluebutton/"; - - public ArrayList getPreuploadedPresentations(String meetingID) { - ArrayList preuploadedPresentations = new ArrayList(); - - try { - // TODO: this is hard-coded, and not really a great abstraction. need to fix this up later - String folderPath = bbbDir + meetingID + "/" + meetingID; - File folder = new File(folderPath); - //log.debug("folder: {} - exists: {} - isDir: {}", folder.getAbsolutePath(), folder.exists(), folder.isDirectory()); - if (folder.exists() && folder.isDirectory()) { - File[] presentations = folder.listFiles(new FileFilter() { - public boolean accept(File path) { - return path.isDirectory(); - } - }); - for (File presFile : presentations) { - int numPages = getNumPages(presFile); - PreuploadedPresentation p = new PreuploadedPresentation(presFile.getName(), numPages); - preuploadedPresentations.add(p); - } - } - } catch (Exception ex) { - - } - - return preuploadedPresentations; - } - - private int getNumPages(File presDir) { - File[] files = presDir.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.toLowerCase().endsWith(".swf"); - } - }); - - return files.length; - } - - public void setBigBlueButtonDirectory(String dir) { - if (dir.endsWith("/")) bbbDir = dir; - else bbbDir = dir + "/"; - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardApplication.java deleted file mode 100755 index f499980b8e..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardApplication.java +++ /dev/null @@ -1,121 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard; - -import org.red5.logging.Red5LoggerFactory; -import org.red5.server.adapter.IApplication; -import org.red5.server.api.IClient; -import org.red5.server.api.IConnection; -import org.red5.server.api.scope.IScope; -import org.slf4j.Logger; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - -public class WhiteboardApplication implements IApplication { - private static Logger log = Red5LoggerFactory.getLogger(WhiteboardApplication.class, "bigbluebutton"); - - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - @Override - public boolean appConnect(IConnection conn, Object[] params) { - return true; - } - - @Override - public void appDisconnect(IConnection conn) { - } - - @Override - public boolean appJoin(IClient client, IScope scope) { - return true; - } - - @Override - public void appLeave(IClient client, IScope scope) { - } - - @Override - public boolean appStart(IScope scope) { - return true; - } - - @Override - public void appStop(IScope scope) { - } - - @Override - public boolean roomConnect(IConnection connection, Object[] params) { - return true; - } - - @Override - public void roomDisconnect(IConnection connection) { - - } - - @Override - public boolean roomJoin(IClient client, IScope scope) { - return true; - } - - @Override - public void roomLeave(IClient client, IScope scope) { - } - - @Override - public boolean roomStart(IScope scope) { - return true; - } - - @Override - public void roomStop(IScope scope) { - } - - public void requestAnnotationHistory(String meetingID, String requesterID, String whiteboardId) { - // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) - String replyTo = meetingID + "/" + requesterID; - bbbInGW.requestWhiteboardAnnotationHistory(meetingID, requesterID, whiteboardId, replyTo); - } - - public void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map shape) { - bbbInGW.sendWhiteboardAnnotation(meetingID, requesterID, shape); - } - - public void clearWhiteboard(String meetingID, String requesterID, String whiteboardId) { - bbbInGW.clearWhiteboard(meetingID, requesterID, whiteboardId); - } - - public void undoWhiteboard(String meetingID, String requesterID, String whiteboardId) { - bbbInGW.undoWhiteboard(meetingID, requesterID, whiteboardId); - } - - public void setWhiteboardEnable(String meetingID, String requesterID, Boolean enable) { - bbbInGW.enableWhiteboard(meetingID, requesterID, enable); - } - - public void setIsWhiteboardEnabled(String meetingID, String requesterID) { - // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) - String replyTo = meetingID + "/" + requesterID; - bbbInGW.isWhiteboardEnabled(meetingID, requesterID, replyTo); - } - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java index 25ef5a82d5..d78640a04f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java @@ -22,24 +22,25 @@ import java.util.Map; import org.bigbluebutton.conference.BigBlueButtonSession; import org.bigbluebutton.conference.Constants; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; public class WhiteboardService { private static Logger log = Red5LoggerFactory.getLogger(WhiteboardService.class, "bigbluebutton"); - private WhiteboardApplication application; + + private final static String TYPE = "type"; + private final static String STATUS = "status"; + private final static String COR_ID = "id"; + private final static String WB_ID = "whiteboardId"; - private final static String TYPE = "type"; - private final static String STATUS = "status"; - private final static String COR_ID = "id"; - private final static String WB_ID = "whiteboardId"; - - public void setWhiteboardApplication(WhiteboardApplication a){ - log.debug("Setting whiteboard application instance"); - this.application = a; - } + private IBigBlueButtonInGW bbbInGW; + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } + private boolean validMessage(Map shp) { if (shp.containsKey(COR_ID) && shp.containsKey(TYPE) && shp.containsKey(STATUS) && shp.containsKey(WB_ID)) return true; @@ -64,7 +65,7 @@ public class WhiteboardService { String requesterID = getBbbSession().getInternalUserID(); if (validMessage(annotation)) { - application.sendWhiteboardAnnotation(meetingID, requesterID, annotation); + bbbInGW.sendWhiteboardAnnotation(meetingID, requesterID, annotation); } } @@ -86,9 +87,11 @@ public class WhiteboardService { String meetingID = getMeetingId(); String requesterID = getBbbSession().getInternalUserID(); - String wbId = (String) message.get(WB_ID); - if (wbId != null) { - application.requestAnnotationHistory(meetingID, requesterID, wbId); + String whiteboardId = (String) message.get(WB_ID); + if (whiteboardId != null) { + // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) + String replyTo = meetingID + "/" + requesterID; + bbbInGW.requestWhiteboardAnnotationHistory(meetingID, requesterID, whiteboardId, replyTo); } } @@ -99,7 +102,7 @@ public class WhiteboardService { String requesterID = getBbbSession().getInternalUserID(); String wbId = (String) message.get(WB_ID); if (wbId != null) { - application.clearWhiteboard(meetingID, requesterID, wbId); + bbbInGW.clearWhiteboard(meetingID, requesterID, wbId); } } @@ -110,7 +113,7 @@ public class WhiteboardService { String requesterID = getBbbSession().getInternalUserID(); String wbId = (String) message.get(WB_ID); if (wbId != null) { - application.undoWhiteboard(meetingID, requesterID, wbId); + bbbInGW.undoWhiteboard(meetingID, requesterID, wbId); } } @@ -125,14 +128,16 @@ public class WhiteboardService { String meetingID = getMeetingId(); String requesterID = getBbbSession().getInternalUserID(); Boolean enable = (Boolean)message.get("enabled"); - - application.setWhiteboardEnable(meetingID, requesterID, enable); + bbbInGW.enableWhiteboard(meetingID, requesterID, enable); } public void isWhiteboardEnabled() { String meetingID = getMeetingId(); String requesterID = getBbbSession().getInternalUserID(); - application.setIsWhiteboardEnabled(meetingID, requesterID); + // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) + String replyTo = meetingID + "/" + requesterID; + bbbInGW.isWhiteboardEnabled(meetingID, requesterID, replyTo); + } private BigBlueButtonSession getBbbSession() { diff --git a/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml b/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml index a966998f9e..df8732d30a 100755 --- a/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml +++ b/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml @@ -55,9 +55,6 @@ with BigBlueButton; if not, see . - - - @@ -75,39 +72,20 @@ with BigBlueButton; if not, see . - - - - - - + - - - - - - - - - - - - - - - + From 503b5dabee3850c86e784c96dfc83d344421c0a6 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 15 May 2015 15:27:48 +0000 Subject: [PATCH 07/30] - rename package --- .../service/messaging/IMessage.java | 5 - .../bigbluebutton/core/api/IOutMessage.java | 5 - .../BigBlueButtonApplication.java | 7 +- .../BigBlueButtonSession.java | 2 +- .../{conference => red5}/Constants.java | 2 +- .../red5/api/BigBlueButtonInGW.java | 492 ++++++++++++++++++ .../api/IBigBlueButtonInGW.java | 2 +- .../bigbluebutton/red5/api/IOutMessage.java | 5 + .../{core => red5}/api/MessageOutGateway.java | 2 +- .../api/OutMessageListener2.java | 2 +- .../red5/BroadcastClientMessage.java | 2 +- .../meeting/messaging/red5/ClientMessage.java | 2 +- .../red5/ConnectionInvokerService.java | 2 +- .../messaging/red5/DirectClientMessage.java | 2 +- .../red5/DisconnectAllClientsMessage.java | 2 +- .../red5/DisconnectClientMessage.java | 2 +- .../redis/MeetingMessageHandler.java | 32 +- .../service/chat/ChatKeyUtil.java | 2 +- .../service/chat/ChatMessageListener.java | 8 +- .../service/chat/ChatService.java | 8 +- .../service/layout/LayoutService.java | 8 +- .../service/lock/LockService.java | 8 +- .../service/messaging/Constants.java | 2 +- .../messaging/CreateMeetingMessage.java | 2 +- .../messaging/DestroyMeetingMessage.java | 2 +- .../service/messaging/EndMeetingMessage.java | 2 +- .../messaging/GetAllMeetingsRequest.java | 2 +- .../red5/service/messaging/IMessage.java | 5 + .../service/messaging/KeepAliveMessage.java | 2 +- .../service/messaging/MessageBuilder.java | 2 +- .../messaging/MessageFromJsonConverter.java | 2 +- .../service/messaging/MessagingConstants.java | 2 +- .../service/messaging/MessagingService.java | 2 +- .../messaging/RegisterUserMessage.java | 2 +- .../messaging/UserConnectedToGlobalAudio.java | 2 +- .../UserDisconnectedFromGlobalAudio.java | 2 +- .../messaging/ValidateAuthTokenMessage.java | 2 +- .../messaging/redis/MessageDistributor.java | 2 +- .../messaging/redis/MessageHandler.java | 2 +- .../messaging/redis/MessageReceiver.java | 6 +- .../messaging/redis/MessageSender.java | 22 +- .../messaging/redis/MessageToSend.java | 2 +- .../messaging/redis/ReceivedMessage.java | 2 +- .../redis/ReceivedMessageHandler.java | 2 +- .../participants/ParticipantsListener.java | 10 +- .../participants/ParticipantsService.java | 8 +- .../presentation/PresentationService.java | 9 +- .../presentation/PreuploadedPresentation.java | 2 +- .../service/voice/VoiceKeyUtil.java | 2 +- .../service/voice/VoiceMessageListener.java | 8 +- .../service/voice/VoiceService.java | 8 +- .../service/whiteboard/WhiteboardKeyUtil.java | 2 +- .../whiteboard/WhiteboardListener.java | 8 +- .../service/whiteboard/WhiteboardService.java | 8 +- 54 files changed, 618 insertions(+), 120 deletions(-) delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/BigBlueButtonApplication.java (98%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/BigBlueButtonSession.java (98%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/Constants.java (96%) create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/BigBlueButtonInGW.java rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{core => red5}/api/IBigBlueButtonInGW.java (97%) create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IOutMessage.java rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{core => red5}/api/MessageOutGateway.java (90%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{core => red5}/api/OutMessageListener2.java (65%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/red5/BroadcastClientMessage.java (92%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/red5/ClientMessage.java (91%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/red5/ConnectionInvokerService.java (96%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/red5/DirectClientMessage.java (93%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/red5/DisconnectAllClientsMessage.java (77%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/red5/DisconnectClientMessage.java (81%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/meeting/messaging/redis/MeetingMessageHandler.java (79%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/chat/ChatKeyUtil.java (89%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/chat/ChatMessageListener.java (92%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/chat/ChatService.java (95%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/layout/LayoutService.java (93%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/lock/LockService.java (93%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/Constants.java (97%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/CreateMeetingMessage.java (93%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/DestroyMeetingMessage.java (82%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/EndMeetingMessage.java (81%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/GetAllMeetingsRequest.java (84%) mode change 100644 => 100755 create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/KeepAliveMessage.java (82%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/MessageBuilder.java (92%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/MessageFromJsonConverter.java (96%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/MessagingConstants.java (96%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/MessagingService.java (92%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/RegisterUserMessage.java (95%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/UserConnectedToGlobalAudio.java (94%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/UserDisconnectedFromGlobalAudio.java (94%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/ValidateAuthTokenMessage.java (88%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/MessageDistributor.java (87%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/MessageHandler.java (91%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/MessageReceiver.java (90%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/MessageSender.java (80%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/MessageToSend.java (79%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/ReceivedMessage.java (83%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/messaging/redis/ReceivedMessageHandler.java (93%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/participants/ParticipantsListener.java (85%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/participants/ParticipantsService.java (94%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/presentation/PresentationService.java (95%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/presentation/PreuploadedPresentation.java (74%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/voice/VoiceKeyUtil.java (69%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/voice/VoiceMessageListener.java (86%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/voice/VoiceService.java (94%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/whiteboard/WhiteboardKeyUtil.java (88%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/whiteboard/WhiteboardListener.java (85%) mode change 100644 => 100755 rename bigbluebutton-apps/src/main/java/org/bigbluebutton/{conference => red5}/service/whiteboard/WhiteboardService.java (93%) diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java deleted file mode 100755 index 2414f55a30..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public interface IMessage { - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java deleted file mode 100755 index 94939235e2..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface IOutMessage { - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonApplication.java similarity index 98% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonApplication.java index 3d8e8d379e..fac2dab98b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonApplication.java @@ -16,14 +16,15 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference; +package org.bigbluebutton.red5; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; -import org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.meeting.messaging.red5.ConnectionInvokerService; import org.red5.logging.Red5LoggerFactory; import org.red5.server.adapter.IApplication; import org.red5.server.adapter.MultiThreadedApplicationAdapter; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonSession.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonSession.java similarity index 98% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonSession.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonSession.java index 74a1c969e5..0d4de10fa1 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/BigBlueButtonSession.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/BigBlueButtonSession.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.conference; +package org.bigbluebutton.red5; public class BigBlueButtonSession { private final String username; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Constants.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/Constants.java similarity index 96% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Constants.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/Constants.java index 3b2d4cfb33..f1f74d195f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/Constants.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/Constants.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.conference; +package org.bigbluebutton.red5; public class Constants{ diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/BigBlueButtonInGW.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/BigBlueButtonInGW.java new file mode 100755 index 0000000000..db7eb7a593 --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/BigBlueButtonInGW.java @@ -0,0 +1,492 @@ +package org.bigbluebutton.red5.api; + +import java.util.Map; + +public class BigBlueButtonInGW implements IBigBlueButtonInGW { + + @Override + public void isAliveAudit(String aliveID) { + // TODO Auto-generated method stub + + } + + @Override + public void statusMeetingAudit(String meetingID) { + // TODO Auto-generated method stub + + } + + @Override + public void endMeeting(String meetingID) { + // TODO Auto-generated method stub + + } + + @Override + public void endAllMeetings() { + // TODO Auto-generated method stub + + } + + @Override + public void createMeeting2(String meetingID, String externalMeetingID, + String meetingName, boolean recorded, String voiceBridge, + long duration, boolean autoStartRecording, + boolean allowStartStopRecording, String moderatorPass, + String viewerPass, long createTime, String createDate) { + // TODO Auto-generated method stub + + } + + @Override + public void destroyMeeting(String meetingID) { + // TODO Auto-generated method stub + + } + + @Override + public void getAllMeetings(String meetingID) { + // TODO Auto-generated method stub + + } + + @Override + public void lockSettings(String meetingID, Boolean locked, + Map lockSettigs) { + // TODO Auto-generated method stub + + } + + @Override + public void initLockSettings(String meetingID, Map settings) { + // TODO Auto-generated method stub + + } + + @Override + public void sendLockSettings(String meetingID, String userId, + Map settings) { + // TODO Auto-generated method stub + + } + + @Override + public void getLockSettings(String meetingId, String userId) { + // TODO Auto-generated method stub + + } + + @Override + public void lockUser(String meetingId, String requesterID, boolean lock, + String internalUserID) { + // TODO Auto-generated method stub + + } + + @Override + public void validateAuthToken(String meetingId, String userId, + String token, String correlationId, String sessionId) { + // TODO Auto-generated method stub + + } + + @Override + public void registerUser(String roomName, String userid, String username, + String role, String externUserID, String authToken) { + // TODO Auto-generated method stub + + } + + @Override + public void userRaiseHand(String meetingId, String userId) { + // TODO Auto-generated method stub + + } + + @Override + public void lowerHand(String meetingId, String userId, String loweredBy) { + // TODO Auto-generated method stub + + } + + @Override + public void shareWebcam(String meetingId, String userId, String stream) { + // TODO Auto-generated method stub + + } + + @Override + public void unshareWebcam(String meetingId, String userId, String stream) { + // TODO Auto-generated method stub + + } + + @Override + public void setUserStatus(String meetingID, String userID, String status, + Object value) { + // TODO Auto-generated method stub + + } + + @Override + public void getUsers(String meetingID, String requesterID) { + // TODO Auto-generated method stub + + } + + @Override + public void userLeft(String meetingID, String userID, String sessionId) { + // TODO Auto-generated method stub + + } + + @Override + public void userJoin(String meetingID, String userID, String authToken) { + // TODO Auto-generated method stub + + } + + @Override + public void getCurrentPresenter(String meetingID, String requesterID) { + // TODO Auto-generated method stub + + } + + @Override + public void assignPresenter(String meetingID, String newPresenterID, + String newPresenterName, String assignedBy) { + // TODO Auto-generated method stub + + } + + @Override + public void setRecordingStatus(String meetingId, String userId, + Boolean recording) { + // TODO Auto-generated method stub + + } + + @Override + public void getRecordingStatus(String meetingId, String userId) { + // TODO Auto-generated method stub + + } + + @Override + public void userConnectedToGlobalAudio(String voiceConf, String userid, + String name) { + // TODO Auto-generated method stub + + } + + @Override + public void userDisconnectedFromGlobalAudio(String voiceConf, + String userid, String name) { + // TODO Auto-generated method stub + + } + + @Override + public void initAudioSettings(String meetingID, String requesterID, + Boolean muted) { + // TODO Auto-generated method stub + + } + + @Override + public void muteAllExceptPresenter(String meetingID, String requesterID, + Boolean mute) { + // TODO Auto-generated method stub + + } + + @Override + public void muteAllUsers(String meetingID, String requesterID, Boolean mute) { + // TODO Auto-generated method stub + + } + + @Override + public void isMeetingMuted(String meetingID, String requesterID) { + // TODO Auto-generated method stub + + } + + @Override + public void muteUser(String meetingID, String requesterID, String userID, + Boolean mute) { + // TODO Auto-generated method stub + + } + + @Override + public void lockMuteUser(String meetingID, String requesterID, + String userID, Boolean lock) { + // TODO Auto-generated method stub + + } + + @Override + public void ejectUserFromVoice(String meetingID, String userId, + String ejectedBy) { + // TODO Auto-generated method stub + + } + + @Override + public void ejectUserFromMeeting(String meetingId, String userId, + String ejectedBy) { + // TODO Auto-generated method stub + + } + + @Override + public void voiceUserJoined(String meetingId, String userId, + String webUserId, String conference, String callerIdNum, + String callerIdName, Boolean muted, Boolean speaking) { + // TODO Auto-generated method stub + + } + + @Override + public void voiceUserLeft(String meetingId, String userId) { + // TODO Auto-generated method stub + + } + + @Override + public void voiceUserLocked(String meetingId, String userId, Boolean locked) { + // TODO Auto-generated method stub + + } + + @Override + public void voiceUserMuted(String meetingId, String userId, Boolean muted) { + // TODO Auto-generated method stub + + } + + @Override + public void voiceUserTalking(String meetingId, String userId, + Boolean talking) { + // TODO Auto-generated method stub + + } + + @Override + public void voiceRecording(String meetingId, String recordingFile, + String timestamp, Boolean recording) { + // TODO Auto-generated method stub + + } + + @Override + public void clear(String meetingID) { + // TODO Auto-generated method stub + + } + + @Override + public void removePresentation(String meetingID, String presentationID) { + // TODO Auto-generated method stub + + } + + @Override + public void getPresentationInfo(String meetingID, String requesterID, + String replyTo) { + // TODO Auto-generated method stub + + } + + @Override + public void sendCursorUpdate(String meetingID, double xPercent, + double yPercent) { + // TODO Auto-generated method stub + + } + + @Override + public void resizeAndMoveSlide(String meetingID, double xOffset, + double yOffset, double widthRatio, double heightRatio) { + // TODO Auto-generated method stub + + } + + @Override + public void gotoSlide(String meetingID, String page) { + // TODO Auto-generated method stub + + } + + @Override + public void sharePresentation(String meetingID, String presentationID, + boolean share) { + // TODO Auto-generated method stub + + } + + @Override + public void getSlideInfo(String meetingID, String requesterID, + String replyTo) { + // TODO Auto-generated method stub + + } + + @Override + public void sendConversionUpdate(String messageKey, String meetingId, + String code, String presId, String presName) { + // TODO Auto-generated method stub + + } + + @Override + public void sendPageCountError(String messageKey, String meetingId, + String code, String presId, int numberOfPages, int maxNumberPages, + String presName) { + // TODO Auto-generated method stub + + } + + @Override + public void sendSlideGenerated(String messageKey, String meetingId, + String code, String presId, int numberOfPages, int pagesCompleted, + String presName) { + // TODO Auto-generated method stub + + } + + @Override + public void sendConversionCompleted(String messageKey, String meetingId, + String code, String presId, int numPages, String presName, + String presBaseUrl) { + // TODO Auto-generated method stub + + } + + @Override + public void getPolls(String meetingID, String requesterID) { + // TODO Auto-generated method stub + + } + + @Override + public void createPoll(String meetingID, String requesterID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void updatePoll(String meetingID, String requesterID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void startPoll(String meetingID, String requesterID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void stopPoll(String meetingID, String requesterID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void removePoll(String meetingID, String requesterID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void respondPoll(String meetingID, String requesterID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void preCreatedPoll(String meetingID, String msg) { + // TODO Auto-generated method stub + + } + + @Override + public void getCurrentLayout(String meetingID, String requesterID) { + // TODO Auto-generated method stub + + } + + @Override + public void broadcastLayout(String meetingID, String requesterID, + String layout) { + // TODO Auto-generated method stub + + } + + @Override + public void getChatHistory(String meetingID, String requesterID, + String replyTo) { + // TODO Auto-generated method stub + + } + + @Override + public void sendPublicMessage(String meetingID, String requesterID, + Map message) { + // TODO Auto-generated method stub + + } + + @Override + public void sendPrivateMessage(String meetingID, String requesterID, + Map message) { + // TODO Auto-generated method stub + + } + + @Override + public void sendWhiteboardAnnotation(String meetingID, String requesterID, + Map annotation) { + // TODO Auto-generated method stub + + } + + @Override + public void requestWhiteboardAnnotationHistory(String meetingID, + String requesterID, String whiteboardId, String replyTo) { + // TODO Auto-generated method stub + + } + + @Override + public void clearWhiteboard(String meetingID, String requesterID, + String whiteboardId) { + // TODO Auto-generated method stub + + } + + @Override + public void undoWhiteboard(String meetingID, String requesterID, + String whiteboardId) { + // TODO Auto-generated method stub + + } + + @Override + public void enableWhiteboard(String meetingID, String requesterID, + Boolean enable) { + // TODO Auto-generated method stub + + } + + @Override + public void isWhiteboardEnabled(String meetingID, String requesterID, + String replyTo) { + // TODO Auto-generated method stub + + } + + +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IBigBlueButtonInGW.java similarity index 97% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IBigBlueButtonInGW.java index a095dfb906..80483f33af 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IBigBlueButtonInGW.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.api; +package org.bigbluebutton.red5.api; import java.util.Map; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IOutMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IOutMessage.java new file mode 100755 index 0000000000..d4bdbd6521 --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/IOutMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.red5.api; + +public interface IOutMessage { + +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/MessageOutGateway.java similarity index 90% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/MessageOutGateway.java index 4f3766c71d..40d8eb82ba 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/MessageOutGateway.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.api; +package org.bigbluebutton.red5.api; import java.util.Set; import org.red5.logging.Red5LoggerFactory; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/OutMessageListener2.java similarity index 65% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/OutMessageListener2.java index ec6d099a45..f972c3bf1d 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/api/OutMessageListener2.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.api; +package org.bigbluebutton.red5.api; public interface OutMessageListener2 { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/BroadcastClientMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/BroadcastClientMessage.java similarity index 92% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/BroadcastClientMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/BroadcastClientMessage.java index ce005c2fed..3c3d23a4b3 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/BroadcastClientMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/BroadcastClientMessage.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.meeting.messaging.red5; +package org.bigbluebutton.red5.meeting.messaging.red5; import java.util.Map; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ClientMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ClientMessage.java similarity index 91% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ClientMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ClientMessage.java index 5194eca8d4..3f1fafc296 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ClientMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ClientMessage.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.meeting.messaging.red5; +package org.bigbluebutton.red5.meeting.messaging.red5; public interface ClientMessage { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ConnectionInvokerService.java similarity index 96% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ConnectionInvokerService.java index 2353862f07..e4da5f2a14 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/ConnectionInvokerService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/ConnectionInvokerService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.meeting.messaging.red5; +package org.bigbluebutton.red5.meeting.messaging.red5; import java.util.Set; import java.util.ArrayList; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DirectClientMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DirectClientMessage.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DirectClientMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DirectClientMessage.java index 3edf12c747..a5ce05a969 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DirectClientMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DirectClientMessage.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.meeting.messaging.red5; +package org.bigbluebutton.red5.meeting.messaging.red5; import java.util.Map; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectAllClientsMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectAllClientsMessage.java similarity index 77% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectAllClientsMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectAllClientsMessage.java index c9dd6aee65..2927996f04 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectAllClientsMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectAllClientsMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.meeting.messaging.red5; +package org.bigbluebutton.red5.meeting.messaging.red5; public class DisconnectAllClientsMessage implements ClientMessage { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectClientMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectClientMessage.java similarity index 81% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectClientMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectClientMessage.java index a43468f025..061a397c1b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/red5/DisconnectClientMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/red5/DisconnectClientMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.meeting.messaging.red5; +package org.bigbluebutton.red5.meeting.messaging.red5; public class DisconnectClientMessage implements ClientMessage { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java similarity index 79% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java index c9b530b0cc..a9170f33de 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java @@ -1,23 +1,25 @@ -package org.bigbluebutton.conference.meeting.messaging.redis; +package org.bigbluebutton.red5.meeting.messaging.redis; import java.util.HashMap; import java.util.Map; -import org.bigbluebutton.conference.service.messaging.CreateMeetingMessage; -import org.bigbluebutton.conference.service.messaging.DestroyMeetingMessage; -import org.bigbluebutton.conference.service.messaging.EndMeetingMessage; -import org.bigbluebutton.conference.service.messaging.IMessage; -import org.bigbluebutton.conference.service.messaging.KeepAliveMessage; -import org.bigbluebutton.conference.service.messaging.MessageFromJsonConverter; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.RegisterUserMessage; -import org.bigbluebutton.conference.service.messaging.UserConnectedToGlobalAudio; -import org.bigbluebutton.conference.service.messaging.UserDisconnectedFromGlobalAudio; -import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage; -import org.bigbluebutton.conference.service.messaging.GetAllMeetingsRequest; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.messaging.CreateMeetingMessage; +import org.bigbluebutton.red5.service.messaging.DestroyMeetingMessage; +import org.bigbluebutton.red5.service.messaging.EndMeetingMessage; +import org.bigbluebutton.red5.service.messaging.GetAllMeetingsRequest; +import org.bigbluebutton.red5.service.messaging.IMessage; +import org.bigbluebutton.red5.service.messaging.KeepAliveMessage; +import org.bigbluebutton.red5.service.messaging.MessageFromJsonConverter; +import org.bigbluebutton.red5.service.messaging.MessagingConstants; +import org.bigbluebutton.red5.service.messaging.RegisterUserMessage; +import org.bigbluebutton.red5.service.messaging.UserConnectedToGlobalAudio; +import org.bigbluebutton.red5.service.messaging.UserDisconnectedFromGlobalAudio; +import org.bigbluebutton.red5.service.messaging.ValidateAuthTokenMessage; +import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; + import com.google.gson.Gson; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatKeyUtil.java similarity index 89% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatKeyUtil.java index babdde091d..2b5486613b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatKeyUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.chat; +package org.bigbluebutton.red5.service.chat; public class ChatKeyUtil { public static final String CHAT_TYPE = "chatType"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java similarity index 92% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java index 6c0b78acb1..3050550534 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java @@ -1,14 +1,14 @@ -package org.bigbluebutton.conference.service.chat; +package org.bigbluebutton.red5.service.chat; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; import com.google.gson.JsonParser; import com.google.gson.JsonObject; import java.util.Map; import java.util.HashMap; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.messaging.MessagingConstants; +import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; public class ChatMessageListener implements MessageHandler{ diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatService.java similarity index 95% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatService.java index 129f19d90b..37845f34b9 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatService.java @@ -16,15 +16,15 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.chat; +package org.bigbluebutton.red5.service.chat; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; public class ChatService { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/layout/LayoutService.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/layout/LayoutService.java index d2527d77a3..73120acf03 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/layout/LayoutService.java @@ -16,13 +16,13 @@ * with BigBlueButton; if not, see . * Author: Felipe Cecagno */ -package org.bigbluebutton.conference.service.layout; +package org.bigbluebutton.red5.service.layout; import java.util.Map; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/lock/LockService.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/lock/LockService.java index 4d1a275e09..b1ae057cc5 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/lock/LockService.java @@ -16,14 +16,14 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.lock; +package org.bigbluebutton.red5.service.lock; import java.util.ArrayList; import java.util.Map; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/Constants.java old mode 100644 new mode 100755 similarity index 97% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/Constants.java index 8b324b248c..169059d6e6 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/Constants.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class Constants { public static final String NAME = "name"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/CreateMeetingMessage.java old mode 100644 new mode 100755 similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/CreateMeetingMessage.java index 4db244c13d..cb82b48d25 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/CreateMeetingMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class CreateMeetingMessage implements IMessage { public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/DestroyMeetingMessage.java similarity index 82% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/DestroyMeetingMessage.java index 01106c1730..f7553ef731 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/DestroyMeetingMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class DestroyMeetingMessage implements IMessage { public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/EndMeetingMessage.java similarity index 81% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/EndMeetingMessage.java index 3a02401421..557d7f47ee 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/EndMeetingMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class EndMeetingMessage implements IMessage { public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/GetAllMeetingsRequest.java old mode 100644 new mode 100755 similarity index 84% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/GetAllMeetingsRequest.java index baa1cd4099..98ac5b7283 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/GetAllMeetingsRequest.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class GetAllMeetingsRequest implements IMessage { public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java new file mode 100755 index 0000000000..0d1f225308 --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.red5.service.messaging; + +public interface IMessage { + +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/KeepAliveMessage.java old mode 100644 new mode 100755 similarity index 82% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/KeepAliveMessage.java index 6cebf71a4a..7905aa4145 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/KeepAliveMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class KeepAliveMessage implements IMessage { public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageBuilder.java similarity index 92% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageBuilder.java index 2137a063b5..1f17aac7d1 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageBuilder.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; import java.util.concurrent.TimeUnit; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageFromJsonConverter.java similarity index 96% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageFromJsonConverter.java index 4efc79d5dc..c4e89b25de 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageFromJsonConverter.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingConstants.java old mode 100644 new mode 100755 similarity index 96% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingConstants.java index 7e6a0258b9..975dedb877 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingConstants.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class MessagingConstants { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingService.java similarity index 92% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingService.java index 8721b188ca..13cb0daba1 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; import redis.clients.jedis.Jedis; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/RegisterUserMessage.java old mode 100644 new mode 100755 similarity index 95% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/RegisterUserMessage.java index 9e7dfe5259..0167609f2a --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/RegisterUserMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; import java.util.HashMap; import com.google.gson.JsonObject; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserConnectedToGlobalAudio.java old mode 100644 new mode 100755 similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserConnectedToGlobalAudio.java index 3ae49d0faf..3af2954621 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserConnectedToGlobalAudio.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; import java.util.HashMap; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserDisconnectedFromGlobalAudio.java similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserDisconnectedFromGlobalAudio.java index 314e0a798d..c73ff925ac 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserDisconnectedFromGlobalAudio.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; import java.util.HashMap; import com.google.gson.JsonObject; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/ValidateAuthTokenMessage.java similarity index 88% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/ValidateAuthTokenMessage.java index 3f036d96dc..04db1d9296 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/ValidateAuthTokenMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging; +package org.bigbluebutton.red5.service.messaging; public class ValidateAuthTokenMessage implements IMessage { public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageDistributor.java similarity index 87% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageDistributor.java index d8518438ea..dcb19fd8d2 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageDistributor.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; import java.util.Set; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageHandler.java similarity index 91% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageHandler.java index 64e25cb510..980f22acd2 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageHandler.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; public interface MessageHandler { void handleMessage(String pattern, String channel, String message); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageReceiver.java similarity index 90% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageReceiver.java index 066171f5a7..51ee41b052 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageReceiver.java @@ -1,10 +1,12 @@ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; import java.util.concurrent.Executor; import java.util.concurrent.Executors; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; + +import org.bigbluebutton.red5.service.messaging.MessagingConstants; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; + import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPubSub; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageSender.java old mode 100644 new mode 100755 similarity index 80% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageSender.java index f464e76daf..ef3b9a4570 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageSender.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; @@ -53,16 +53,16 @@ public class MessageSender { private void publish(final String channel, final String message) { Runnable task = new Runnable() { - public void run() { - Jedis jedis = redisPool.getResource(); - try { - jedis.publish(channel, message); - } catch(Exception e){ - log.warn("Cannot publish the message to redis", e); - } finally { - redisPool.returnResource(jedis); - } - } + public void run() { + Jedis jedis = redisPool.getResource(); + try { + jedis.publish(channel, message); + } catch(Exception e){ + log.warn("Cannot publish the message to redis", e); + } finally { + redisPool.returnResource(jedis); + } + } }; runExec.execute(task); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageToSend.java similarity index 79% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageToSend.java index e01dfc84e1..20be2d7392 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageToSend.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; public class MessageToSend { private final String channel; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessage.java similarity index 83% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessage.java index 9319407276..9a1a7518db 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; public class ReceivedMessage { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessageHandler.java old mode 100644 new mode 100755 similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessageHandler.java index 7df2fb37ec..962ea8476a --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessageHandler.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.messaging.redis; +package org.bigbluebutton.red5.service.messaging.redis; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java similarity index 85% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java index d1efd34f65..4a9b53753f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java @@ -1,13 +1,13 @@ -package org.bigbluebutton.conference.service.participants; +package org.bigbluebutton.red5.service.participants; -import org.bigbluebutton.conference.BigBlueButtonApplication; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; //import org.bigbluebutton.core.api.*; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonApplication; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.messaging.MessagingConstants; +import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsService.java similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsService.java index 6f5e0c2288..6901b82b4a 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsService.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.conference.service.participants; +package org.bigbluebutton.red5.service.participants; import org.slf4j.Logger; import org.red5.logging.Red5LoggerFactory; @@ -26,9 +26,9 @@ import org.red5.server.api.scope.IScope; import java.util.Map; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; public class ParticipantsService { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PresentationService.java similarity index 95% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PresentationService.java index bcf512fcc2..c577af3022 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PresentationService.java @@ -16,16 +16,17 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.presentation; +package org.bigbluebutton.red5.service.presentation; import java.util.Map; + import org.slf4j.Logger; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.red5.server.api.scope.IScope; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; public class PresentationService { private static Logger log = Red5LoggerFactory.getLogger( PresentationService.class, "bigbluebutton" ); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PreuploadedPresentation.java similarity index 74% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PreuploadedPresentation.java index 0c05f23f20..b2d6ee0a6c 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PreuploadedPresentation.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.presentation; +package org.bigbluebutton.red5.service.presentation; public class PreuploadedPresentation { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceKeyUtil.java old mode 100644 new mode 100755 similarity index 69% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceKeyUtil.java index 9bc1fd75bc..9055beb8d2 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceKeyUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.voice; +package org.bigbluebutton.red5.service.voice; public class VoiceKeyUtil { public static final String MUTE = "mute"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java old mode 100644 new mode 100755 similarity index 86% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java index 35be1ab2f4..f6675c3c53 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java @@ -1,8 +1,8 @@ -package org.bigbluebutton.conference.service.voice; +package org.bigbluebutton.red5.service.voice; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.messaging.MessagingConstants; +import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceService.java old mode 100644 new mode 100755 similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceService.java index 03d19e46c9..99b082edd0 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceService.java @@ -16,12 +16,12 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.voice; +package org.bigbluebutton.red5.service.voice; import java.util.Map; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardKeyUtil.java similarity index 88% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardKeyUtil.java index 7d635ba285..f33c5aa65c 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardKeyUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.whiteboard; +package org.bigbluebutton.red5.service.whiteboard; public class WhiteboardKeyUtil { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java old mode 100644 new mode 100755 similarity index 85% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java index 8f80bdb8bd..25413c94a8 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java @@ -1,11 +1,11 @@ -package org.bigbluebutton.conference.service.whiteboard; +package org.bigbluebutton.red5.service.whiteboard; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.messaging.MessagingConstants; +import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; import com.google.gson.JsonParser; import com.google.gson.JsonObject; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardService.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardService.java index d78640a04f..dbe314c402 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardService.java @@ -16,13 +16,13 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard; +package org.bigbluebutton.red5.service.whiteboard; import java.util.Map; -import org.bigbluebutton.conference.BigBlueButtonSession; -import org.bigbluebutton.conference.Constants; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.BigBlueButtonSession; +import org.bigbluebutton.red5.Constants; +import org.bigbluebutton.red5.api.IBigBlueButtonInGW; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; From bf683be215eb0a9322ec599d94ac3389cdbd5f31 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 15 May 2015 15:35:00 +0000 Subject: [PATCH 08/30] - restructure --- .../org/bigbluebutton/red5/service/{chat => }/ChatService.java | 3 ++- .../bigbluebutton/red5/service/{layout => }/LayoutService.java | 2 +- .../org/bigbluebutton/red5/service/{lock => }/LockService.java | 2 +- .../red5/service/{participants => }/ParticipantsService.java | 2 +- .../red5/service/{presentation => }/PresentationService.java | 2 +- .../bigbluebutton/red5/service/{voice => }/VoiceService.java | 3 ++- .../red5/service/{whiteboard => }/WhiteboardService.java | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{chat => }/ChatService.java (97%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{layout => }/LayoutService.java (98%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{lock => }/LockService.java (98%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{participants => }/ParticipantsService.java (98%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{presentation => }/PresentationService.java (98%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{voice => }/VoiceService.java (97%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/{whiteboard => }/WhiteboardService.java (96%) diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java similarity index 97% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java index 37845f34b9..872396328b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.chat; +package org.bigbluebutton.red5.service; import java.util.HashMap; import java.util.Map; @@ -25,6 +25,7 @@ import org.slf4j.Logger; import org.bigbluebutton.red5.BigBlueButtonSession; import org.bigbluebutton.red5.Constants; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.chat.ChatKeyUtil; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; public class ChatService { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/layout/LayoutService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LayoutService.java similarity index 98% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/layout/LayoutService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LayoutService.java index 73120acf03..a463fefb1a 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/layout/LayoutService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LayoutService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * Author: Felipe Cecagno */ -package org.bigbluebutton.red5.service.layout; +package org.bigbluebutton.red5.service; import java.util.Map; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/lock/LockService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LockService.java similarity index 98% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/lock/LockService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LockService.java index b1ae057cc5..d2041a5725 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/lock/LockService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/LockService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.lock; +package org.bigbluebutton.red5.service; import java.util.ArrayList; import java.util.Map; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ParticipantsService.java similarity index 98% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ParticipantsService.java index 6901b82b4a..6eded9f290 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ParticipantsService.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.red5.service.participants; +package org.bigbluebutton.red5.service; import org.slf4j.Logger; import org.red5.logging.Red5LoggerFactory; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PresentationService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PresentationService.java similarity index 98% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PresentationService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PresentationService.java index c577af3022..3d950614b7 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/presentation/PresentationService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PresentationService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.presentation; +package org.bigbluebutton.red5.service; import java.util.Map; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/VoiceService.java similarity index 97% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/VoiceService.java index 99b082edd0..8d640428b1 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/VoiceService.java @@ -16,12 +16,13 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.voice; +package org.bigbluebutton.red5.service; import java.util.Map; import org.bigbluebutton.red5.BigBlueButtonSession; import org.bigbluebutton.red5.Constants; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; +import org.bigbluebutton.red5.service.voice.VoiceKeyUtil; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/WhiteboardService.java similarity index 96% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/WhiteboardService.java index dbe314c402..3239003590 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/WhiteboardService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.whiteboard; +package org.bigbluebutton.red5.service; import java.util.Map; From 23b6297e116d638ffb121524d3ea2f079323c48f Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 15 May 2015 15:57:20 +0000 Subject: [PATCH 09/30] - rename package --- .../redis/MeetingMessageHandler.java | 26 +++++++++---------- .../messages}/Constants.java | 2 +- .../messages}/CreateMeetingMessage.java | 2 +- .../messages}/DestroyMeetingMessage.java | 2 +- .../messages}/EndMeetingMessage.java | 2 +- .../messages}/GetAllMeetingsRequest.java | 2 +- .../red5/pubsub/messages/IMessage.java | 5 ++++ .../messages}/KeepAliveMessage.java | 2 +- .../messages}/MessageBuilder.java | 2 +- .../messages}/MessageFromJsonConverter.java | 2 +- .../messages}/MessagingConstants.java | 2 +- .../messages}/MessagingService.java | 2 +- .../messages}/RegisterUserMessage.java | 2 +- .../messages}/UserConnectedToGlobalAudio.java | 2 +- .../UserDisconnectedFromGlobalAudio.java | 2 +- .../messages}/ValidateAuthTokenMessage.java | 2 +- .../redis/MessageDistributor.java | 2 +- .../redis/MessageHandler.java | 2 +- .../redis/MessageReceiver.java | 4 +-- .../redis/MessageSender.java | 2 +- .../redis/MessageToSend.java | 2 +- .../redis/ReceivedMessage.java | 2 +- .../redis/ReceivedMessageHandler.java | 2 +- .../service/chat/ChatMessageListener.java | 4 +-- .../red5/service/messaging/IMessage.java | 5 ---- .../participants/ParticipantsListener.java | 4 +-- .../service/voice/VoiceMessageListener.java | 4 +-- .../whiteboard/WhiteboardListener.java | 4 +-- 28 files changed, 48 insertions(+), 48 deletions(-) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/Constants.java (97%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/CreateMeetingMessage.java (93%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/DestroyMeetingMessage.java (83%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/EndMeetingMessage.java (83%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/GetAllMeetingsRequest.java (86%) create mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/IMessage.java rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/KeepAliveMessage.java (83%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/MessageBuilder.java (93%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/MessageFromJsonConverter.java (96%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/MessagingConstants.java (97%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/MessagingService.java (93%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/RegisterUserMessage.java (95%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/UserConnectedToGlobalAudio.java (94%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/UserDisconnectedFromGlobalAudio.java (94%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub/messages}/ValidateAuthTokenMessage.java (89%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/MessageDistributor.java (88%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/MessageHandler.java (92%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/MessageReceiver.java (90%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/MessageSender.java (94%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/MessageToSend.java (80%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/ReceivedMessage.java (84%) rename bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/{service/messaging => pubsub}/redis/ReceivedMessageHandler.java (94%) delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java index a9170f33de..1552f76807 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/meeting/messaging/redis/MeetingMessageHandler.java @@ -4,19 +4,19 @@ import java.util.HashMap; import java.util.Map; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; -import org.bigbluebutton.red5.service.messaging.CreateMeetingMessage; -import org.bigbluebutton.red5.service.messaging.DestroyMeetingMessage; -import org.bigbluebutton.red5.service.messaging.EndMeetingMessage; -import org.bigbluebutton.red5.service.messaging.GetAllMeetingsRequest; -import org.bigbluebutton.red5.service.messaging.IMessage; -import org.bigbluebutton.red5.service.messaging.KeepAliveMessage; -import org.bigbluebutton.red5.service.messaging.MessageFromJsonConverter; -import org.bigbluebutton.red5.service.messaging.MessagingConstants; -import org.bigbluebutton.red5.service.messaging.RegisterUserMessage; -import org.bigbluebutton.red5.service.messaging.UserConnectedToGlobalAudio; -import org.bigbluebutton.red5.service.messaging.UserDisconnectedFromGlobalAudio; -import org.bigbluebutton.red5.service.messaging.ValidateAuthTokenMessage; -import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; +import org.bigbluebutton.red5.pubsub.messages.CreateMeetingMessage; +import org.bigbluebutton.red5.pubsub.messages.DestroyMeetingMessage; +import org.bigbluebutton.red5.pubsub.messages.EndMeetingMessage; +import org.bigbluebutton.red5.pubsub.messages.GetAllMeetingsRequest; +import org.bigbluebutton.red5.pubsub.messages.IMessage; +import org.bigbluebutton.red5.pubsub.messages.KeepAliveMessage; +import org.bigbluebutton.red5.pubsub.messages.MessageFromJsonConverter; +import org.bigbluebutton.red5.pubsub.messages.MessagingConstants; +import org.bigbluebutton.red5.pubsub.messages.RegisterUserMessage; +import org.bigbluebutton.red5.pubsub.messages.UserConnectedToGlobalAudio; +import org.bigbluebutton.red5.pubsub.messages.UserDisconnectedFromGlobalAudio; +import org.bigbluebutton.red5.pubsub.messages.ValidateAuthTokenMessage; +import org.bigbluebutton.red5.pubsub.redis.MessageHandler; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/Constants.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/Constants.java similarity index 97% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/Constants.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/Constants.java index 169059d6e6..4b14b26b50 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/Constants.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/Constants.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class Constants { public static final String NAME = "name"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/CreateMeetingMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/CreateMeetingMessage.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/CreateMeetingMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/CreateMeetingMessage.java index cb82b48d25..ebd8c2c644 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/CreateMeetingMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/CreateMeetingMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class CreateMeetingMessage implements IMessage { public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/DestroyMeetingMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/DestroyMeetingMessage.java similarity index 83% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/DestroyMeetingMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/DestroyMeetingMessage.java index f7553ef731..2026be049b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/DestroyMeetingMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/DestroyMeetingMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class DestroyMeetingMessage implements IMessage { public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/EndMeetingMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/EndMeetingMessage.java similarity index 83% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/EndMeetingMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/EndMeetingMessage.java index 557d7f47ee..00f7bca649 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/EndMeetingMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/EndMeetingMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class EndMeetingMessage implements IMessage { public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/GetAllMeetingsRequest.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/GetAllMeetingsRequest.java similarity index 86% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/GetAllMeetingsRequest.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/GetAllMeetingsRequest.java index 98ac5b7283..920596a597 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/GetAllMeetingsRequest.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/GetAllMeetingsRequest.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class GetAllMeetingsRequest implements IMessage { public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/IMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/IMessage.java new file mode 100755 index 0000000000..b16a6aeb12 --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/IMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.red5.pubsub.messages; + +public interface IMessage { + +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/KeepAliveMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/KeepAliveMessage.java similarity index 83% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/KeepAliveMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/KeepAliveMessage.java index 7905aa4145..70ce51d41a 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/KeepAliveMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/KeepAliveMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class KeepAliveMessage implements IMessage { public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageBuilder.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageBuilder.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageBuilder.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageBuilder.java index 1f17aac7d1..068c13a0e3 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageBuilder.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageBuilder.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; import java.util.concurrent.TimeUnit; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageFromJsonConverter.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageFromJsonConverter.java similarity index 96% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageFromJsonConverter.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageFromJsonConverter.java index c4e89b25de..8d68a93a3a 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessageFromJsonConverter.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessageFromJsonConverter.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingConstants.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingConstants.java similarity index 97% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingConstants.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingConstants.java index 975dedb877..fe5081a130 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingConstants.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingConstants.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class MessagingConstants { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingService.java similarity index 93% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingService.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingService.java index 13cb0daba1..9f12b6f8ec 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/MessagingService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/MessagingService.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; import redis.clients.jedis.Jedis; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/RegisterUserMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/RegisterUserMessage.java similarity index 95% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/RegisterUserMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/RegisterUserMessage.java index 0167609f2a..c0e7d0978c 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/RegisterUserMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/RegisterUserMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; import java.util.HashMap; import com.google.gson.JsonObject; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserConnectedToGlobalAudio.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserConnectedToGlobalAudio.java similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserConnectedToGlobalAudio.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserConnectedToGlobalAudio.java index 3af2954621..2946992e39 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserConnectedToGlobalAudio.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserConnectedToGlobalAudio.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; import java.util.HashMap; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserDisconnectedFromGlobalAudio.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserDisconnectedFromGlobalAudio.java similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserDisconnectedFromGlobalAudio.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserDisconnectedFromGlobalAudio.java index c73ff925ac..097060fbcf 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/UserDisconnectedFromGlobalAudio.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/UserDisconnectedFromGlobalAudio.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; import java.util.HashMap; import com.google.gson.JsonObject; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/ValidateAuthTokenMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/ValidateAuthTokenMessage.java similarity index 89% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/ValidateAuthTokenMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/ValidateAuthTokenMessage.java index 04db1d9296..8eb99f813a 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/ValidateAuthTokenMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/messages/ValidateAuthTokenMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging; +package org.bigbluebutton.red5.pubsub.messages; public class ValidateAuthTokenMessage implements IMessage { public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageDistributor.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageDistributor.java similarity index 88% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageDistributor.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageDistributor.java index dcb19fd8d2..ac500fcc7a 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageDistributor.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageDistributor.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; import java.util.Set; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageHandler.java similarity index 92% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageHandler.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageHandler.java index 980f22acd2..77b71af081 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageHandler.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; public interface MessageHandler { void handleMessage(String pattern, String channel, String message); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageReceiver.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageReceiver.java similarity index 90% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageReceiver.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageReceiver.java index 51ee41b052..49659a96fe 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageReceiver.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageReceiver.java @@ -1,9 +1,9 @@ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; import java.util.concurrent.Executor; import java.util.concurrent.Executors; -import org.bigbluebutton.red5.service.messaging.MessagingConstants; +import org.bigbluebutton.red5.pubsub.messages.MessagingConstants; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageSender.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageSender.java similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageSender.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageSender.java index ef3b9a4570..322b2b6acc 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageSender.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageSender.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageToSend.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageToSend.java similarity index 80% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageToSend.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageToSend.java index 20be2d7392..421d1f10b2 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/MessageToSend.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/MessageToSend.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; public class MessageToSend { private final String channel; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/ReceivedMessage.java similarity index 84% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessage.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/ReceivedMessage.java index 9a1a7518db..3d1dbb08dc 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessage.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/ReceivedMessage.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; public class ReceivedMessage { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/ReceivedMessageHandler.java similarity index 94% rename from bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessageHandler.java rename to bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/ReceivedMessageHandler.java index 962ea8476a..09e0003ceb 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/redis/ReceivedMessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/ReceivedMessageHandler.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.red5.service.messaging.redis; +package org.bigbluebutton.red5.pubsub.redis; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java index 3050550534..a33feeb1fe 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/chat/ChatMessageListener.java @@ -7,8 +7,8 @@ import java.util.Map; import java.util.HashMap; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; -import org.bigbluebutton.red5.service.messaging.MessagingConstants; -import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; +import org.bigbluebutton.red5.pubsub.messages.MessagingConstants; +import org.bigbluebutton.red5.pubsub.redis.MessageHandler; public class ChatMessageListener implements MessageHandler{ diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java deleted file mode 100755 index 0d1f225308..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/messaging/IMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.red5.service.messaging; - -public interface IMessage { - -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java index 4a9b53753f..66caaf2e29 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/participants/ParticipantsListener.java @@ -6,8 +6,8 @@ package org.bigbluebutton.red5.service.participants; import org.bigbluebutton.red5.BigBlueButtonApplication; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; -import org.bigbluebutton.red5.service.messaging.MessagingConstants; -import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; +import org.bigbluebutton.red5.pubsub.messages.MessagingConstants; +import org.bigbluebutton.red5.pubsub.redis.MessageHandler; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java index f6675c3c53..7d497022db 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/voice/VoiceMessageListener.java @@ -1,8 +1,8 @@ package org.bigbluebutton.red5.service.voice; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; -import org.bigbluebutton.red5.service.messaging.MessagingConstants; -import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; +import org.bigbluebutton.red5.pubsub.messages.MessagingConstants; +import org.bigbluebutton.red5.pubsub.redis.MessageHandler; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java index 25413c94a8..9ea91f4a6b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/whiteboard/WhiteboardListener.java @@ -3,8 +3,8 @@ package org.bigbluebutton.red5.service.whiteboard; import org.bigbluebutton.red5.api.IBigBlueButtonInGW; -import org.bigbluebutton.red5.service.messaging.MessagingConstants; -import org.bigbluebutton.red5.service.messaging.redis.MessageHandler; +import org.bigbluebutton.red5.pubsub.messages.MessagingConstants; +import org.bigbluebutton.red5.pubsub.redis.MessageHandler; import com.google.gson.JsonParser; import com.google.gson.JsonObject; From ac80d18c2cfb91743ff0bce7431d4a99ea206123 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 15 May 2015 19:15:41 +0000 Subject: [PATCH 10/30] - rename project --- labs/{bbb-apps => akka-bbb-apps}/.gitignore | 0 labs/{bbb-apps => akka-bbb-apps}/build.sbt | 0 labs/{bbb-apps => akka-bbb-apps}/project/Build.scala | 0 labs/{bbb-apps => akka-bbb-apps}/project/build.properties | 0 labs/{bbb-apps => akka-bbb-apps}/project/plugins.sbt | 0 labs/{bbb-apps => akka-bbb-apps}/src/main/java/.gitkeep | 0 .../conference/meeting/messaging/redis/MeetingMessageHandler.java | 0 .../org/bigbluebutton/conference/service/chat/ChatKeyUtil.java | 0 .../conference/service/chat/ChatMessageListener.java | 0 .../conference/service/layout/LayoutApplication.java | 0 .../org/bigbluebutton/conference/service/messaging/Constants.java | 0 .../conference/service/messaging/CreateMeetingMessage.java | 0 .../conference/service/messaging/DestroyMeetingMessage.java | 0 .../conference/service/messaging/EndMeetingMessage.java | 0 .../conference/service/messaging/GetAllMeetingsRequest.java | 0 .../org/bigbluebutton/conference/service/messaging/IMessage.java | 0 .../conference/service/messaging/KeepAliveMessage.java | 0 .../conference/service/messaging/MessageBuilder.java | 0 .../conference/service/messaging/MessageFromJsonConverter.java | 0 .../conference/service/messaging/MessagingConstants.java | 0 .../conference/service/messaging/MessagingService.java | 0 .../conference/service/messaging/RegisterUserMessage.java | 0 .../conference/service/messaging/UserConnectedToGlobalAudio.java | 0 .../service/messaging/UserDisconnectedFromGlobalAudio.java | 0 .../conference/service/messaging/ValidateAuthTokenMessage.java | 0 .../conference/service/messaging/redis/MessageDistributor.java | 0 .../conference/service/messaging/redis/MessageHandler.java | 0 .../conference/service/messaging/redis/MessageReceiver.java | 0 .../conference/service/messaging/redis/MessageSender.java | 0 .../conference/service/messaging/redis/MessageToSend.java | 0 .../conference/service/messaging/redis/ReceivedMessage.java | 0 .../service/messaging/redis/ReceivedMessageHandler.java | 0 .../service/presentation/ConversionUpdatesProcessor.java | 0 .../service/presentation/PresentationMessageListener.java | 0 .../conference/service/presentation/PreuploadedPresentation.java | 0 .../service/presentation/PreuploadedPresentationsUtil.java | 0 .../service/recorder/GenericObjectPoolConfigWrapper.java | 0 .../bigbluebutton/conference/service/recorder/RecordEvent.java | 0 .../org/bigbluebutton/conference/service/recorder/Recorder.java | 0 .../conference/service/recorder/RecorderApplication.java | 0 .../conference/service/recorder/RedisDispatcher.java | 0 .../conference/service/recorder/chat/AbstractChatRecordEvent.java | 0 .../conference/service/recorder/chat/PublicChatRecordEvent.java | 0 .../recorder/participants/AbstractParticipantRecordEvent.java | 0 .../service/recorder/participants/AssignPresenterRecordEvent.java | 0 .../participants/ParticipantEndAndKickAllRecordEvent.java | 0 .../service/recorder/participants/ParticipantJoinRecordEvent.java | 0 .../service/recorder/participants/ParticipantLeftRecordEvent.java | 0 .../recorder/participants/ParticipantStatusChangeRecordEvent.java | 0 .../service/recorder/participants/RecordStatusRecordEvent.java | 0 .../service/recorder/polling/AbstractPollRecordEvent.java | 0 .../service/recorder/polling/PollClearedRecordEvent.java | 0 .../service/recorder/polling/PollCreatedRecordEvent.java | 0 .../service/recorder/polling/PollRemovedRecordEvent.java | 0 .../service/recorder/polling/PollStartedRecordEvent.java | 0 .../service/recorder/polling/PollStoppedRecordEvent.java | 0 .../service/recorder/polling/PollUpdatedRecordEvent.java | 0 .../recorder/presentation/AbstractPresentationRecordEvent.java | 0 .../presentation/ConversionCompletedPresentationRecordEvent.java | 0 .../service/recorder/presentation/CursorUpdateRecordEvent.java | 0 .../presentation/GenerateSlidePresentationRecordEvent.java | 0 .../recorder/presentation/GotoSlidePresentationRecordEvent.java | 0 .../presentation/RemovePresentationPresentationRecordEvent.java | 0 .../presentation/ResizeAndMoveSlidePresentationRecordEvent.java | 0 .../presentation/SharePresentationPresentationRecordEvent.java | 0 .../org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java | 0 .../conference/service/voice/VoiceMessageListener.java | 0 .../conference/service/whiteboard/WhiteboardKeyUtil.java | 0 .../conference/service/whiteboard/WhiteboardListener.java | 0 .../service/whiteboard/redis/AbstractWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/AddTextWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java | 0 .../main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java | 0 .../src/main/java/org/bigbluebutton/core/api/IDispatcher.java | 0 .../src/main/java/org/bigbluebutton/core/api/IOutMessage.java | 0 .../main/java/org/bigbluebutton/core/api/MessageOutGateway.java | 0 .../main/java/org/bigbluebutton/core/api/OutMessageListener2.java | 0 .../java/org/bigbluebutton/core/api/RedisLpushDispatcher.java | 0 .../java/org/bigbluebutton/service/recording/RecordMessage.java | 0 .../org/bigbluebutton/service/recording/RedisListRecorder.java | 0 .../webconference/voice/AbstractVoiceRecordEvent.java | 0 .../webconference/voice/ConferenceServerListener.java | 0 .../webconference/voice/ConferenceServiceProvider.java | 0 .../webconference/voice/FreeswitchConferenceEventListener.java | 0 .../webconference/voice/IVoiceConferenceService.java | 0 .../webconference/voice/ParticipantJoinedVoiceRecordEvent.java | 0 .../webconference/voice/ParticipantLeftVoiceRecordEvent.java | 0 .../webconference/voice/ParticipantLockedVoiceRecordEvent.java | 0 .../webconference/voice/ParticipantMutedVoiceRecordEvent.java | 0 .../webconference/voice/ParticipantTalkingVoiceRecordEvent.java | 0 .../webconference/voice/StartRecordingVoiceRecordEvent.java | 0 .../org/bigbluebutton/webconference/voice/VoiceEventRecorder.java | 0 .../webconference/voice/commands/ConferenceCommand.java | 0 .../webconference/voice/commands/ConferenceCommandResult.java | 0 .../webconference/voice/commands/EjectParticipantCommand.java | 0 .../webconference/voice/commands/GetParticipantsCommand.java | 0 .../webconference/voice/commands/MuteParticipantCommand.java | 0 .../webconference/voice/events/ConferenceEventListener.java | 0 .../webconference/voice/events/UnknownConferenceEvent.java | 0 .../webconference/voice/events/VoiceConferenceEvent.java | 0 .../webconference/voice/events/VoiceStartRecordingEvent.java | 0 .../webconference/voice/events/VoiceUserJoinedEvent.java | 0 .../webconference/voice/events/VoiceUserLeftEvent.java | 0 .../webconference/voice/events/VoiceUserLockedEvent.java | 0 .../webconference/voice/events/VoiceUserMutedEvent.java | 0 .../webconference/voice/events/VoiceUserTalkingEvent.java | 0 .../webconference/voice/freeswitch/ConnectionManager.java | 0 .../webconference/voice/freeswitch/ESLEventListener.java | 0 .../webconference/voice/freeswitch/FreeswitchApplication.java | 0 .../voice/freeswitch/actions/BroadcastConferenceCommand.java | 0 .../voice/freeswitch/actions/EjectAllUsersCommand.java | 0 .../voice/freeswitch/actions/EjectParticipantCommand.java | 0 .../webconference/voice/freeswitch/actions/FreeswitchCommand.java | 0 .../voice/freeswitch/actions/MuteParticipantCommand.java | 0 .../voice/freeswitch/actions/PopulateRoomCommand.java | 0 .../voice/freeswitch/actions/RecordConferenceCommand.java | 0 .../webconference/voice/freeswitch/response/ConferenceMember.java | 0 .../voice/freeswitch/response/ConferenceMemberFlags.java | 0 .../freeswitch/response/XMLResponseConferenceListParser.java | 0 labs/{bbb-apps => akka-bbb-apps}/src/main/resources/README | 0 .../src/main/resources/application.conf | 0 labs/{bbb-apps => akka-bbb-apps}/src/main/resources/logback.xml | 0 .../main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala | 0 .../src/main/scala/org/bigbluebutton/Boot.scala | 0 .../src/main/scala/org/bigbluebutton/SystemConfig.scala | 0 .../src/main/scala/org/bigbluebutton/apps/Data.scala | 0 .../src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala | 0 .../src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala | 0 .../src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala | 0 .../src/main/scala/org/bigbluebutton/apps/Util.scala | 0 .../src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala | 0 .../src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala | 0 .../scala/org/bigbluebutton/apps/chat/messages/Messages.scala | 0 .../src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala | 0 .../src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala | 0 .../scala/org/bigbluebutton/apps/layout/messages/Messages.scala | 0 .../org/bigbluebutton/apps/presentation/PresentationApp.scala | 0 .../scala/org/bigbluebutton/apps/presentation/data/Data.scala | 0 .../org/bigbluebutton/apps/presentation/messages/Messages.scala | 0 .../main/scala/org/bigbluebutton/apps/protocol/InMessage.scala | 0 .../src/main/scala/org/bigbluebutton/apps/protocol/Message.scala | 0 .../main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala | 0 .../src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala | 0 .../src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala | 0 .../src/main/scala/org/bigbluebutton/apps/users/data/Model.scala | 0 .../scala/org/bigbluebutton/apps/users/messages/Messages.scala | 0 .../bigbluebutton/apps/users/protocol/UsersMessageHandler.scala | 0 .../apps/users/protocol/UsersMessageMarshalling.scala | 0 .../apps/users/protocol/UsersMessageUnmarshalling.scala | 0 .../org/bigbluebutton/apps/utils/RandomStringGenerator.scala | 0 .../scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala | 0 .../main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala | 0 .../org/bigbluebutton/apps/whiteboard/messages/Messages.scala | 0 .../main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala | 0 .../main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala | 0 .../src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala | 0 .../src/main/scala/org/bigbluebutton/core/CollectorActor.scala | 0 .../src/main/scala/org/bigbluebutton/core/CollectorGateway.scala | 0 .../src/main/scala/org/bigbluebutton/core/MeetingActor.scala | 0 .../src/main/scala/org/bigbluebutton/core/RunningMeeting.scala | 0 .../main/scala/org/bigbluebutton/core/SystemConfiguration.scala | 0 .../src/main/scala/org/bigbluebutton/core/User.scala | 0 .../main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala | 0 .../src/main/scala/org/bigbluebutton/core/api/Constants.scala | 0 .../src/main/scala/org/bigbluebutton/core/api/InMessages.scala | 0 .../src/main/scala/org/bigbluebutton/core/api/MessageNames.scala | 0 .../src/main/scala/org/bigbluebutton/core/api/OutMessages.scala | 0 .../scala/org/bigbluebutton/core/api/TimestampGenerator.scala | 0 .../src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala | 0 .../src/main/scala/org/bigbluebutton/core/api/Versions.scala | 0 .../src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala | 0 .../scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala | 0 .../core/apps/chat/redis/ChatEventRedisPublisher.scala | 0 .../core/apps/chat/redis/ChatEventRedisRecorder.scala | 0 .../core/apps/chat/redis/ChatMessageToJsonConverter.scala | 0 .../main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala | 0 .../org/bigbluebutton/core/apps/layout/LayoutInGateway.scala | 0 .../src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala | 0 .../src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala | 0 .../scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala | 0 .../org/bigbluebutton/core/apps/poll/PollMessageConverter.scala | 0 .../main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala | 0 .../scala/org/bigbluebutton/core/apps/poll/QuestionType.scala | 0 .../core/apps/poll/redis/PollEventRedisPublisher.scala | 0 .../core/apps/poll/redis/PollEventRedisRecorder.scala | 0 .../bigbluebutton/core/apps/presentation/PresentationApp.scala | 0 .../bigbluebutton/core/apps/presentation/PresentationModel.scala | 0 .../presentation/redis/PesentationMessageToJsonConverter.scala | 0 .../apps/presentation/redis/PresentationEventRedisPublisher.scala | 0 .../apps/presentation/redis/PresentationEventRedisRecorder.scala | 0 .../src/main/scala/org/bigbluebutton/core/apps/users/Users.scala | 0 .../main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala | 0 .../main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala | 0 .../core/apps/users/redis/UsersEventRedisPublisher.scala | 0 .../core/apps/users/redis/UsersEventRedisRecorder.scala | 0 .../core/apps/users/redis/UsersMessageToJsonConverter.scala | 0 .../main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala | 0 .../scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala | 0 .../org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala | 0 .../bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala | 0 .../org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala | 0 .../apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala | 0 .../core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala | 0 .../apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala | 0 .../org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala | 0 .../bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala | 0 .../core/meeting/MeetingMessageToJsonConverter.scala | 0 .../src/main/scala/org/bigbluebutton/core/messaging/Util.scala | 0 .../src/main/scala/org/bigbluebutton/core/models/Values.scala | 0 .../scala/org/bigbluebutton/core/util/RandomStringGenerator.scala | 0 .../scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala | 0 .../scala/org/bigbluebutton/endpoint/InMessageFormatters.scala | 0 .../scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala | 0 .../main/scala/org/bigbluebutton/endpoint/MessageFormats.scala | 0 .../org/bigbluebutton/endpoint/MessageMarshallingActor.scala | 0 .../scala/org/bigbluebutton/endpoint/MessageNameConstants.scala | 0 .../org/bigbluebutton/endpoint/MessageUmarshallingActor.scala | 0 .../scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala | 0 .../scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala | 0 .../src/main/scala/org/bigbluebutton/endpoint/Protocol.scala | 0 .../bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala | 0 .../bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala | 0 .../src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala | 0 .../scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala | 0 labs/{bbb-apps => akka-bbb-apps}/src/test/java/README | 0 labs/{bbb-apps => akka-bbb-apps}/src/test/resources/README | 0 .../src/test/resources/messages/create-meeting.json | 0 .../src/test/resources/messages/register-user-request.json | 0 .../src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala | 0 .../test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala | 0 .../scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala | 0 .../scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala | 0 .../scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala | 0 .../src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala | 0 .../src/test/scala/org/bigbluebutton/apps/UnitSpec.scala | 0 .../test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala | 0 .../scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala | 0 .../org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala | 0 .../src/test/scala/org/bigbluebutton/apps/protocol/configws.sc | 0 .../scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc | 0 .../test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc | 0 .../scala/org/bigbluebutton/apps/protocol/futureandpromise.sc | 0 .../test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc | 0 .../src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc | 0 .../test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc | 0 .../test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc | 0 .../scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc | 0 .../scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala | 0 .../org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala | 0 .../org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala | 0 .../bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala | 0 .../bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala | 0 .../org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala | 0 .../src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc | 0 .../org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc | 0 259 files changed, 0 insertions(+), 0 deletions(-) rename labs/{bbb-apps => akka-bbb-apps}/.gitignore (100%) rename labs/{bbb-apps => akka-bbb-apps}/build.sbt (100%) rename labs/{bbb-apps => akka-bbb-apps}/project/Build.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/project/build.properties (100%) rename labs/{bbb-apps => akka-bbb-apps}/project/plugins.sbt (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/.gitkeep (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/core/api/IDispatcher.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/core/api/IOutMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/resources/README (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/resources/application.conf (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/resources/logback.xml (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/Boot.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/SystemConfig.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/Data.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/Util.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/CollectorActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/MeetingActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/User.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/Constants.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/InMessages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/api/Versions.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/messaging/Util.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/models/Values.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/java/README (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/resources/README (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/resources/messages/create-meeting.json (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/resources/messages/register-user-request.json (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc (100%) rename labs/{bbb-apps => akka-bbb-apps}/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc (100%) diff --git a/labs/bbb-apps/.gitignore b/labs/akka-bbb-apps/.gitignore similarity index 100% rename from labs/bbb-apps/.gitignore rename to labs/akka-bbb-apps/.gitignore diff --git a/labs/bbb-apps/build.sbt b/labs/akka-bbb-apps/build.sbt similarity index 100% rename from labs/bbb-apps/build.sbt rename to labs/akka-bbb-apps/build.sbt diff --git a/labs/bbb-apps/project/Build.scala b/labs/akka-bbb-apps/project/Build.scala similarity index 100% rename from labs/bbb-apps/project/Build.scala rename to labs/akka-bbb-apps/project/Build.scala diff --git a/labs/bbb-apps/project/build.properties b/labs/akka-bbb-apps/project/build.properties similarity index 100% rename from labs/bbb-apps/project/build.properties rename to labs/akka-bbb-apps/project/build.properties diff --git a/labs/bbb-apps/project/plugins.sbt b/labs/akka-bbb-apps/project/plugins.sbt similarity index 100% rename from labs/bbb-apps/project/plugins.sbt rename to labs/akka-bbb-apps/project/plugins.sbt diff --git a/labs/bbb-apps/src/main/java/.gitkeep b/labs/akka-bbb-apps/src/main/java/.gitkeep similarity index 100% rename from labs/bbb-apps/src/main/java/.gitkeep rename to labs/akka-bbb-apps/src/main/java/.gitkeep diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java diff --git a/labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java similarity index 100% rename from labs/bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java diff --git a/labs/bbb-apps/src/main/resources/README b/labs/akka-bbb-apps/src/main/resources/README similarity index 100% rename from labs/bbb-apps/src/main/resources/README rename to labs/akka-bbb-apps/src/main/resources/README diff --git a/labs/bbb-apps/src/main/resources/application.conf b/labs/akka-bbb-apps/src/main/resources/application.conf similarity index 100% rename from labs/bbb-apps/src/main/resources/application.conf rename to labs/akka-bbb-apps/src/main/resources/application.conf diff --git a/labs/bbb-apps/src/main/resources/logback.xml b/labs/akka-bbb-apps/src/main/resources/logback.xml similarity index 100% rename from labs/bbb-apps/src/main/resources/logback.xml rename to labs/akka-bbb-apps/src/main/resources/logback.xml diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala diff --git a/labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala similarity index 100% rename from labs/bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala diff --git a/labs/bbb-apps/src/test/java/README b/labs/akka-bbb-apps/src/test/java/README similarity index 100% rename from labs/bbb-apps/src/test/java/README rename to labs/akka-bbb-apps/src/test/java/README diff --git a/labs/bbb-apps/src/test/resources/README b/labs/akka-bbb-apps/src/test/resources/README similarity index 100% rename from labs/bbb-apps/src/test/resources/README rename to labs/akka-bbb-apps/src/test/resources/README diff --git a/labs/bbb-apps/src/test/resources/messages/create-meeting.json b/labs/akka-bbb-apps/src/test/resources/messages/create-meeting.json similarity index 100% rename from labs/bbb-apps/src/test/resources/messages/create-meeting.json rename to labs/akka-bbb-apps/src/test/resources/messages/create-meeting.json diff --git a/labs/bbb-apps/src/test/resources/messages/register-user-request.json b/labs/akka-bbb-apps/src/test/resources/messages/register-user-request.json similarity index 100% rename from labs/bbb-apps/src/test/resources/messages/register-user-request.json rename to labs/akka-bbb-apps/src/test/resources/messages/register-user-request.json diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc diff --git a/labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc similarity index 100% rename from labs/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc rename to labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc From 59b5f3b4ac272340d4fab6f7114ff376e2b63886 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 15 May 2015 19:17:12 +0000 Subject: [PATCH 11/30] - add bbb fs esl --- labs/akka-bbb-fs/.gitignore | 56 + labs/akka-bbb-fs/build.sbt | 63 + labs/akka-bbb-fs/project/Build.scala | 0 labs/akka-bbb-fs/project/build.properties | 1 + labs/akka-bbb-fs/project/plugins.sbt | 5 + labs/akka-bbb-fs/src/main/java/.gitkeep | 0 .../redis/MeetingMessageHandler.java | 112 + .../service/messaging/Constants.java | 96 + .../messaging/CreateMeetingMessage.java | 37 + .../messaging/DestroyMeetingMessage.java | 12 + .../service/messaging/EndMeetingMessage.java | 12 + .../messaging/GetAllMeetingsRequest.java | 12 + .../service/messaging/IMessage.java | 5 + .../service/messaging/KeepAliveMessage.java | 12 + .../service/messaging/MessageBuilder.java | 36 + .../messaging/MessageFromJsonConverter.java | 89 + .../service/messaging/MessagingConstants.java | 59 + .../service/messaging/MessagingService.java | 27 + .../messaging/RegisterUserMessage.java | 73 + .../messaging/UserConnectedToGlobalAudio.java | 59 + .../UserDisconnectedFromGlobalAudio.java | 56 + .../messaging/ValidateAuthTokenMessage.java | 20 + .../messaging/redis/MessageDistributor.java | 25 + .../messaging/redis/MessageHandler.java | 23 + .../messaging/redis/MessageReceiver.java | 85 + .../messaging/redis/MessageSender.java | 70 + .../messaging/redis/MessageToSend.java | 19 + .../messaging/redis/ReceivedMessage.java | 28 + .../redis/ReceivedMessageHandler.java | 68 + .../core/api/IBigBlueButtonInGW.java | 119 + .../bigbluebutton/core/api/IDispatcher.java | 6 + .../bigbluebutton/core/api/IOutMessage.java | 5 + .../core/api/MessageOutGateway.java | 21 + .../core/api/OutMessageListener2.java | 6 + .../voice/AbstractVoiceRecordEvent.java | 32 + .../voice/ConferenceServerListener.java | 26 + .../voice/ConferenceServiceProvider.java | 28 + .../FreeswitchConferenceEventListener.java | 115 + .../voice/IVoiceConferenceService.java | 13 + .../ParticipantJoinedVoiceRecordEvent.java | 51 + .../ParticipantLeftVoiceRecordEvent.java | 31 + .../ParticipantLockedVoiceRecordEvent.java | 35 + .../ParticipantMutedVoiceRecordEvent.java | 35 + .../ParticipantTalkingVoiceRecordEvent.java | 36 + .../voice/StartRecordingVoiceRecordEvent.java | 38 + .../voice/VoiceEventRecorder.java | 141 ++ .../voice/commands/ConferenceCommand.java | 40 + .../commands/ConferenceCommandResult.java | 56 + .../commands/EjectParticipantCommand.java | 34 + .../commands/GetParticipantsCommand.java | 27 + .../commands/MuteParticipantCommand.java | 40 + .../voice/events/ConferenceEventListener.java | 25 + .../voice/events/UnknownConferenceEvent.java | 27 + .../voice/events/VoiceConferenceEvent.java | 32 + .../events/VoiceStartRecordingEvent.java | 51 + .../voice/events/VoiceUserJoinedEvent.java | 70 + .../voice/events/VoiceUserLeftEvent.java | 33 + .../voice/events/VoiceUserLockedEvent.java | 40 + .../voice/events/VoiceUserMutedEvent.java | 40 + .../voice/events/VoiceUserTalkingEvent.java | 40 + .../voice/freeswitch/ConnectionManager.java | 154 ++ .../voice/freeswitch/ESLEventListener.java | 204 ++ .../freeswitch/FreeswitchApplication.java | 202 ++ .../actions/BroadcastConferenceCommand.java | 50 + .../actions/EjectAllUsersCommand.java | 31 + .../actions/EjectParticipantCommand.java | 34 + .../freeswitch/actions/FreeswitchCommand.java | 45 + .../actions/MuteParticipantCommand.java | 40 + .../actions/PopulateRoomCommand.java | 116 + .../actions/RecordConferenceCommand.java | 50 + .../freeswitch/response/ConferenceMember.java | 88 + .../response/ConferenceMemberFlags.java | 54 + .../XMLResponseConferenceListParser.java | 160 ++ labs/akka-bbb-fs/src/main/resources/README | 0 .../src/main/resources/application.conf | 23 + .../src/main/resources/logback.xml | 17 + .../BigBlueButtonAppsMainActor.scala | 16 + .../main/scala/org/bigbluebutton/Boot.scala | 21 + .../org/bigbluebutton/SystemConfig.scala | 20 + .../apps/protocol/InMessage.scala | 54 + .../bigbluebutton/apps/protocol/Message.scala | 64 + .../apps/protocol/OutMessages.scala | 31 + .../apps/protocol/Protocol.scala | 75 + .../endpoint/InMessageFormatters.scala | 37 + .../endpoint/InMessageHandlerActor.scala | 32 + .../endpoint/MessageFormats.scala | 90 + .../endpoint/MessageMarshallingActor.scala | 23 + .../endpoint/MessageNameConstants.scala | 47 + .../endpoint/MessageUmarshallingActor.scala | 93 + .../endpoint/OutMessageFormatters.scala | 14 + .../endpoint/OutMsgBuilderActor.scala | 21 + .../org/bigbluebutton/endpoint/Protocol.scala | 107 + .../redis/AppsRedisPublisherActor.scala | 45 + .../redis/AppsRedisSubscriberActor.scala | 41 + .../endpoint/redis/Message.scala | 3 + .../endpoint/redis/RedisPubSubActor.scala | 39 + labs/akka-bbb-fs/src/test/java/README | 0 labs/akka-bbb-fs/src/test/resources/README | 8 + .../resources/messages/create-meeting.json | 49 + .../messages/register-user-request.json | 30 + .../apps/MeetingManagerSpec.scala | 54 + .../apps/MeetingManagerTestFixtures.scala | 12 + .../apps/MeetingManagerUnitSpec.scala | 42 + .../apps/RunningMeetingActorSpec.scala | 57 + .../bigbluebutton/apps/TestKitUsageSpec.scala | 154 ++ .../org/bigbluebutton/apps/UnitSpec.scala | 8 + .../apps/models/UsersAppSpec.scala | 18 + .../apps/protocol/ClientConfigSpec.scala | 82 + .../protocol/ExampleMessageFixtures.scala | 286 +++ .../bigbluebutton/apps/protocol/configws.sc | 146 ++ .../apps/protocol/createmeetingrequest.sc | 199 ++ .../apps/protocol/extractorsws.sc | 43 + .../apps/protocol/futureandpromise.sc | 48 + .../apps/protocol/futuretesting.sc | 72 + .../apps/protocol/joinuserrep.sc | 118 + .../apps/protocol/whiteboardmsgws.sc | 134 ++ .../apps/users/data/usersmsgWS.sc | 114 + .../apps/whiteboard/data/sequencews.sc | 26 + .../endpoint/JsonMessagesFixtures.scala | 2116 +++++++++++++++++ .../endpoint/MessageHandlerActorSpec.scala | 41 + .../MessageMarshallingActorSpec.scala | 38 + .../MessageUnmarshallingActorSpec.scala | 70 + .../UsersMessageJsonConversionSpec.scala | 124 + .../endpoint/UsersMessageTestFixtures.scala | 39 + .../bigbluebutton/endpoint/redis/JsonLens.sc | 81 + .../endpoint/redis/MessageTestWorksheet.sc | 15 + 126 files changed, 8818 insertions(+) create mode 100644 labs/akka-bbb-fs/.gitignore create mode 100755 labs/akka-bbb-fs/build.sbt create mode 100755 labs/akka-bbb-fs/project/Build.scala create mode 100755 labs/akka-bbb-fs/project/build.properties create mode 100755 labs/akka-bbb-fs/project/plugins.sbt create mode 100644 labs/akka-bbb-fs/src/main/java/.gitkeep create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java create mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java create mode 100644 labs/akka-bbb-fs/src/main/resources/README create mode 100644 labs/akka-bbb-fs/src/main/resources/application.conf create mode 100644 labs/akka-bbb-fs/src/main/resources/logback.xml create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala create mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala create mode 100644 labs/akka-bbb-fs/src/test/java/README create mode 100644 labs/akka-bbb-fs/src/test/resources/README create mode 100644 labs/akka-bbb-fs/src/test/resources/messages/create-meeting.json create mode 100644 labs/akka-bbb-fs/src/test/resources/messages/register-user-request.json create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala create mode 100755 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala create mode 100755 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc create mode 100644 labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc diff --git a/labs/akka-bbb-fs/.gitignore b/labs/akka-bbb-fs/.gitignore new file mode 100644 index 0000000000..82f02806ec --- /dev/null +++ b/labs/akka-bbb-fs/.gitignore @@ -0,0 +1,56 @@ +.DS_Store +._.DS_Store* +.metadata +.project +.classpath +.settings +.history +.worksheet +gen +**/*.swp +**/*~.nib +**/build/ +**/*.pbxuser +**/*.perspective +**/*.perspectivev3 +*.xcworkspace +*.xcuserdatad +**/target +target +*.iml +project/*.ipr +project/*.iml +project/*.iws +project/out +project/*/target +project/target +project/*/bin +project/*/build +project/*.iml +project/*/*.iml +project/.idea +project/.idea/* +.idea +.idea/* +.idea/**/* +.DS_Store +project/.DS_Store +project/*/.DS_Store +tm.out +tmlog*.log +*.tm*.epoch +out/ +provisioning/.vagrant +provisioning/*/.vagrant +provisioning/*/*.known +/sbt/akka-patterns-store/ +/daemon/src/build/ +*.lock +log/ +tmp/ +build/ +akka-patterns-store/ +lib_managed/ +.cache +bin/ + diff --git a/labs/akka-bbb-fs/build.sbt b/labs/akka-bbb-fs/build.sbt new file mode 100755 index 0000000000..a0658a7b4d --- /dev/null +++ b/labs/akka-bbb-fs/build.sbt @@ -0,0 +1,63 @@ + +name := "akka-bbb-fs" + +organization := "org.bigbluebutton" + +version := "0.1-SNAPSHOT" + +scalaVersion := "2.11.6" + +scalacOptions ++= Seq( + "-unchecked", + "-deprecation", + "-Xlint", + "-Ywarn-dead-code", + "-language:_", + "-target:jvm-1.7", + "-encoding", "UTF-8" +) + +resolvers ++= Seq( + "spray repo" at "http://repo.spray.io/", + "rediscala" at "http://dl.bintray.com/etaty/maven", + "blindside-repos" at "http://blindside.googlecode.com/svn/repository/" +) + +publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/dev/repo/maven-repo/releases" )) ) + +// We want to have our jar files in lib_managed dir. +// This way we'll have the right path when we import +// into eclipse. +retrieveManaged := true + +testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "html", "console", "junitxml") + +testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-h", "target/scalatest-reports") + +libraryDependencies ++= { + val akkaVersion = "2.3.10" + val sprayVersion = "1.3.2" + Seq( + "io.spray" %% "spray-json" % sprayVersion, + "io.spray" %% "spray-routing" % sprayVersion, + "com.typesafe.akka" %% "akka-actor" % akkaVersion, + "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test", + "com.typesafe.akka" %% "akka-slf4j" % akkaVersion, + "ch.qos.logback" % "logback-classic" % "1.0.3", + "org.pegdown" % "pegdown" % "1.4.0", + "junit" % "junit" % "4.11", + "com.etaty.rediscala" %% "rediscala" % "1.4.0", + "commons-codec" % "commons-codec" % "1.8", + "joda-time" % "joda-time" % "2.3", + "net.virtual-void" %% "json-lenses" % "0.5.4", + "com.google.code.gson" % "gson" % "1.7.1", + "redis.clients" % "jedis" % "2.1.0", + "org.jboss.netty" % "netty" % "3.2.1.Final", + "org.apache.commons" % "commons-lang3" % "3.2" + )} + +libraryDependencies += "org.freeswitch" % "fs-esl-client" % "0.8.2" from "http://blindside.googlecode.com/svn/repository/org/freeswitch/fs-esl-client/0.8.2/fs-esl-client-0.8.2.jar" + +seq(Revolver.settings: _*) + +scalariformSettings diff --git a/labs/akka-bbb-fs/project/Build.scala b/labs/akka-bbb-fs/project/Build.scala new file mode 100755 index 0000000000..e69de29bb2 diff --git a/labs/akka-bbb-fs/project/build.properties b/labs/akka-bbb-fs/project/build.properties new file mode 100755 index 0000000000..a6e117b610 --- /dev/null +++ b/labs/akka-bbb-fs/project/build.properties @@ -0,0 +1 @@ +sbt.version=0.13.8 diff --git a/labs/akka-bbb-fs/project/plugins.sbt b/labs/akka-bbb-fs/project/plugins.sbt new file mode 100755 index 0000000000..425fa8ab29 --- /dev/null +++ b/labs/akka-bbb-fs/project/plugins.sbt @@ -0,0 +1,5 @@ +addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2") + +addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") + +addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0") diff --git a/labs/akka-bbb-fs/src/main/java/.gitkeep b/labs/akka-bbb-fs/src/main/java/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java new file mode 100755 index 0000000000..a98e4f430c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java @@ -0,0 +1,112 @@ +package org.bigbluebutton.conference.meeting.messaging.redis; + +import java.util.HashMap; +import java.util.Map; +import org.bigbluebutton.conference.service.messaging.CreateMeetingMessage; +import org.bigbluebutton.conference.service.messaging.DestroyMeetingMessage; +import org.bigbluebutton.conference.service.messaging.EndMeetingMessage; +import org.bigbluebutton.conference.service.messaging.IMessage; +import org.bigbluebutton.conference.service.messaging.KeepAliveMessage; +import org.bigbluebutton.conference.service.messaging.MessageFromJsonConverter; +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.RegisterUserMessage; +import org.bigbluebutton.conference.service.messaging.UserConnectedToGlobalAudio; +import org.bigbluebutton.conference.service.messaging.UserDisconnectedFromGlobalAudio; +import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage; +import org.bigbluebutton.conference.service.messaging.GetAllMeetingsRequest; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.Gson; + +public class MeetingMessageHandler implements MessageHandler { + + private IBigBlueButtonInGW bbbGW; + + @Override + public void handleMessage(String pattern, String channel, String message) { +// System.out.println("Checking message: " + pattern + " " + channel + " " + message); + if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { +// System.out.println("Meeting message: " + channel + " " + message); + IMessage msg = MessageFromJsonConverter.convert(message); + + if (msg != null) { + if (msg instanceof EndMeetingMessage) { + EndMeetingMessage emm = (EndMeetingMessage) msg; +// log.info("Received end meeting request. Meeting id [{}]", emm.meetingId); + bbbGW.endMeeting(emm.meetingId); + } else if (msg instanceof CreateMeetingMessage) { + CreateMeetingMessage emm = (CreateMeetingMessage) msg; +// log.info("Received create meeting request. Meeting id [{}]", emm.id); + bbbGW.createMeeting2(emm.id, emm.externalId, emm.name, emm.record, emm.voiceBridge, + emm.duration, emm.autoStartRecording, emm.allowStartStopRecording, + emm.moderatorPass, emm.viewerPass, emm.createTime, emm.createDate); + } else if (msg instanceof RegisterUserMessage) { + RegisterUserMessage emm = (RegisterUserMessage) msg; +// log.info("Received register user request. Meeting id [{}], userid=[{}], token=[{}]", emm.meetingID, emm.internalUserId, emm.authToken); + bbbGW.registerUser(emm.meetingID, emm.internalUserId, emm.fullname, emm.role, emm.externUserID, emm.authToken); + } else if (msg instanceof DestroyMeetingMessage) { + DestroyMeetingMessage emm = (DestroyMeetingMessage) msg; +// log.info("Received destroy meeting request. Meeting id [{}]", emm.meetingId); + bbbGW.destroyMeeting(emm.meetingId); + } else if (msg instanceof ValidateAuthTokenMessage) { + ValidateAuthTokenMessage emm = (ValidateAuthTokenMessage) msg; +// log.info("Received ValidateAuthTokenMessage token request. Meeting id [{}]", emm.meetingId); +// log.warn("TODO: Need to pass sessionId on ValidateAuthTokenMessage message."); + String sessionId = "tobeimplemented"; + bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo, sessionId); + } else if (msg instanceof UserConnectedToGlobalAudio) { + UserConnectedToGlobalAudio emm = (UserConnectedToGlobalAudio) msg; + + Map logData = new HashMap(); + logData.put("voiceConf", emm.voiceConf); + logData.put("userId", emm.userid); + logData.put("username", emm.name); + logData.put("event", "user_connected_to_global_audio"); + logData.put("description", "User connected to global audio."); + + Gson gson = new Gson(); + String logStr = gson.toJson(logData); + +// log.info("User connected to global audio: data={}", logStr); + + bbbGW.userConnectedToGlobalAudio(emm.voiceConf, emm.userid, emm.name); + } else if (msg instanceof UserDisconnectedFromGlobalAudio) { + UserDisconnectedFromGlobalAudio emm = (UserDisconnectedFromGlobalAudio) msg; + + Map logData = new HashMap(); + logData.put("voiceConf", emm.voiceConf); + logData.put("userId", emm.userid); + logData.put("username", emm.name); + logData.put("event", "user_disconnected_from_global_audio"); + logData.put("description", "User disconnected from global audio."); + + Gson gson = new Gson(); + String logStr = gson.toJson(logData); + +// log.info("User disconnected from global audio: data={}", logStr); + bbbGW.userDisconnectedFromGlobalAudio(emm.voiceConf, emm.userid, emm.name); + } + else if (msg instanceof GetAllMeetingsRequest) { + GetAllMeetingsRequest emm = (GetAllMeetingsRequest) msg; +// log.info("Received GetAllMeetingsRequest"); + bbbGW.getAllMeetings("no_need_of_a_meeting_id"); + } + } + } else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) { + IMessage msg = MessageFromJsonConverter.convert(message); + + if (msg != null) { + if (msg instanceof KeepAliveMessage) { + KeepAliveMessage emm = (KeepAliveMessage) msg; +// log.debug("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId); + bbbGW.isAliveAudit(emm.keepAliveId); + } + } + } + } + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java new file mode 100644 index 0000000000..8b324b248c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java @@ -0,0 +1,96 @@ +package org.bigbluebutton.conference.service.messaging; + +public class Constants { + public static final String NAME = "name"; + public static final String HEADER = "header"; + public static final String PAYLOAD = "payload"; + public static final String MEETING_ID = "meeting_id"; + public static final String EXTERNAL_MEETING_ID = "external_meeting_id"; + public static final String TIMESTAMP = "timestamp"; + public static final String USER_ID = "userid"; + public static final String RECORDED = "recorded"; + public static final String MEETING_NAME = "meeting_name"; + public static final String VOICE_CONF = "voice_conf"; + public static final String DURATION = "duration"; + public static final String AUTH_TOKEN = "auth_token"; + public static final String ROLE = "role"; + public static final String EXT_USER_ID = "external_user_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String REPLY_TO = "reply_to"; + public static final String LOWERED_BY = "lowered_by"; + public static final String STREAM = "stream"; + public static final String LOCKED = "locked"; + public static final String SETTINGS = "settings"; + public static final String LOCK = "lock"; + public static final String EXCEPT_USERS = "except_users"; + public static final String STATUS = "status"; + public static final String VALUE = "value"; + public static final String NEW_PRESENTER_ID = "new_presenter_id"; + public static final String NEW_PRESENTER_NAME = "new_presenter_name"; + public static final String ASSIGNED_BY = "assigned_by"; + public static final String RECORDING = "recording"; + public static final String AUTO_START_RECORDING = "auto_start_recording"; + public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording"; + public static final String LAYOUT_ID = "layout_id"; + public static final String POLL = "poll"; + public static final String POLL_ID = "poll_id"; + public static final String FORCE = "force"; + public static final String RESPONSE = "response"; + public static final String PRESENTATION_ID = "presentation_id"; + public static final String X_OFFSET = "x_offset"; + public static final String Y_OFFSET = "y_offset"; + public static final String WIDTH_RATIO = "width_ratio"; + public static final String HEIGHT_RATIO = "height_ratio"; + public static final String PAGE = "page"; + public static final String SHARE = "share"; + public static final String PRESENTATIONS = "presentations"; + public static final String MESSAGE_KEY = "message_key"; + public static final String CODE = "code"; + public static final String PRESENTATION_NAME = "presentation_name"; + public static final String NUM_PAGES = "num_pages"; + public static final String MAX_NUM_PAGES = "max_num_pages"; + public static final String PAGES_COMPLETED = "pages_completed"; + public static final String MUTE = "mute"; + public static final String CALLER_ID_NUM = "caller_id_num"; + public static final String CALLER_ID_NAME = "caller_id_name"; + public static final String TALKING = "talking"; + public static final String USER = "user"; + public static final String MUTED = "muted"; + public static final String VOICE_USER = "voice_user"; + public static final String RECORDING_FILE = "recording_file"; + public static final String ANNOTATION = "annotation"; + public static final String WHITEBOARD_ID = "whiteboard_id"; + public static final String ENABLE = "enable"; + public static final String PRESENTER = "presenter"; + public static final String USERS = "users"; + public static final String RAISE_HAND = "raise_hand"; + public static final String HAS_STREAM = "has_stream"; + public static final String WEBCAM_STREAM = "webcam_stream"; + public static final String PHONE_USER = "phone_user"; + public static final String PERMISSIONS = "permissions"; + public static final String VALID = "valid"; + public static final String CHAT_HISTORY = "chat_history"; + public static final String MESSAGE = "message"; + public static final String SET_BY_USER_ID = "set_by_user_id"; + public static final String POLLS = "polls"; + public static final String REASON = "reason"; + public static final String RESPONDER = "responder"; + public static final String PRESENTATION_INFO = "presentation_info"; + public static final String SHAPES = "shapes"; + public static final String SHAPE = "shape"; + public static final String SHAPE_ID = "shape_id"; + public static final String PRESENTATION = "presentation"; + public static final String ID = "id"; + public static final String CURRENT = "current"; + public static final String PAGES = "pages"; + public static final String WEB_USER_ID = "web_user_id"; + public static final String JOINED = "joined"; + public static final String X_PERCENT = "x_percent"; + public static final String Y_PERCENT = "y_percent"; + public static final String KEEP_ALIVE_ID = "keep_alive_id"; + public static final String INTERNAL_USER_ID = "internal_user_id"; + public static final String MODERATOR_PASS = "moderator_pass"; + public static final String VIEWER_PASS = "viewer_pass"; + public static final String CREATE_TIME = "create_time"; + public static final String CREATE_DATE = "create_date"; +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java new file mode 100644 index 0000000000..4db244c13d --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java @@ -0,0 +1,37 @@ +package org.bigbluebutton.conference.service.messaging; + +public class CreateMeetingMessage implements IMessage { + public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; + public static final String VERSION = "0.0.1"; + + public final String id; + public final String externalId; + public final String name; + public final Boolean record; + public final String voiceBridge; + public final Long duration; + public final Boolean autoStartRecording; + public final Boolean allowStartStopRecording; + public final String moderatorPass; + public final String viewerPass; + public final Long createTime; + public final String createDate; + + public CreateMeetingMessage(String id, String externalId, String name, Boolean record, String voiceBridge, + Long duration, Boolean autoStartRecording, + Boolean allowStartStopRecording, String moderatorPass, + String viewerPass, Long createTime, String createDate) { + this.id = id; + this.externalId = externalId; + this.name = name; + this.record = record; + this.voiceBridge = voiceBridge; + this.duration = duration; + this.autoStartRecording = autoStartRecording; + this.allowStartStopRecording = allowStartStopRecording; + this.moderatorPass = moderatorPass; + this.viewerPass = viewerPass; + this.createTime = createTime; + this.createDate = createDate; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java new file mode 100755 index 0000000000..01106c1730 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class DestroyMeetingMessage implements IMessage { + public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public DestroyMeetingMessage(String meetingId) { + this.meetingId = meetingId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java new file mode 100755 index 0000000000..3a02401421 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class EndMeetingMessage implements IMessage { + public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public EndMeetingMessage(String meetingId) { + this.meetingId = meetingId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java new file mode 100644 index 0000000000..baa1cd4099 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class GetAllMeetingsRequest implements IMessage { + public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public GetAllMeetingsRequest(String meetingId) { + this.meetingId = meetingId; + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java new file mode 100755 index 0000000000..2414f55a30 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.conference.service.messaging; + +public interface IMessage { + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java new file mode 100644 index 0000000000..6cebf71a4a --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.messaging; + +public class KeepAliveMessage implements IMessage { + public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; + public static final String VERSION = "0.0.1"; + + public final String keepAliveId; + + public KeepAliveMessage(String keepAliveId) { + this.keepAliveId = keepAliveId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java new file mode 100755 index 0000000000..2137a063b5 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java @@ -0,0 +1,36 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.concurrent.TimeUnit; + +import com.google.gson.Gson; + +public class MessageBuilder { + public final static String VERSION = "version"; + + public static long generateTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public static java.util.HashMap buildHeader(String name, String version, String replyTo) { + java.util.HashMap header = new java.util.HashMap(); + header.put(Constants.NAME, name); + header.put(VERSION, version); + header.put(Constants.TIMESTAMP, generateTimestamp()); + if (replyTo != null && replyTo != "") + header.put(Constants.REPLY_TO, replyTo); + + return header; + } + + + public static String buildJson(java.util.HashMap header, + java.util.HashMap payload) { + + java.util.HashMap> message = new java.util.HashMap>(); + message.put(Constants.HEADER, header); + message.put(Constants.PAYLOAD, payload); + + Gson gson = new Gson(); + return gson.toJson(message); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java new file mode 100755 index 0000000000..4efc79d5dc --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java @@ -0,0 +1,89 @@ +package org.bigbluebutton.conference.service.messaging; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MessageFromJsonConverter { + + public static IMessage convert(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + switch (messageName) { + case CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT: + return processCreateMeeting(payload); + case DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT: + return processDestroyMeeting(payload); + case EndMeetingMessage.END_MEETING_REQUEST_EVENT: + return processEndMeetingMessage(payload); + case KeepAliveMessage.KEEP_ALIVE_REQUEST: + return processKeepAlive(payload); + case RegisterUserMessage.REGISTER_USER: + System.out.println("Registering a user"); + return RegisterUserMessage.fromJson(message); + case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN: + return processValidateAuthTokenMessage(header, payload); + case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO: + return UserConnectedToGlobalAudio.fromJson(message); + case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO: + return UserDisconnectedFromGlobalAudio.fromJson(message); + case GetAllMeetingsRequest.GET_ALL_MEETINGS_REQUEST_EVENT: + return new GetAllMeetingsRequest("the_string_is_not_used_anywhere"); + } + } + } + return null; + } + + private static IMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + String replyTo = header.get(Constants.REPLY_TO).getAsString(); + String sessionId = "tobeimplemented"; + return new ValidateAuthTokenMessage(id, userid, authToken, replyTo, + sessionId); + } + + private static IMessage processCreateMeeting(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + Boolean record = payload.get(Constants.RECORDED).getAsBoolean(); + String voiceBridge = payload.get(Constants.VOICE_CONF).getAsString(); + Long duration = payload.get(Constants.DURATION).getAsLong(); + Boolean autoStartRecording = payload.get(Constants.AUTO_START_RECORDING).getAsBoolean(); + Boolean allowStartStopRecording = payload.get(Constants.ALLOW_START_STOP_RECORDING).getAsBoolean(); + String moderatorPassword = payload.get(Constants.MODERATOR_PASS).getAsString(); + String viewerPassword = payload.get(Constants.VIEWER_PASS).getAsString(); + Long createTime = payload.get(Constants.CREATE_TIME).getAsLong(); + String createDate = payload.get(Constants.CREATE_DATE).getAsString(); + + return new CreateMeetingMessage(id, externalId, name, record, voiceBridge, + duration, autoStartRecording, allowStartStopRecording, + moderatorPassword, viewerPassword, createTime, createDate); + } + + private static IMessage processDestroyMeeting(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + return new DestroyMeetingMessage(id); + } + + private static IMessage processEndMeetingMessage(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + return new EndMeetingMessage(id); + } + + private static IMessage processKeepAlive(JsonObject payload) { + String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString(); + return new KeepAliveMessage(id); + } + + //private static IMessage processGetAllMeetings(JsonObject) +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java new file mode 100644 index 0000000000..7e6a0258b9 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java @@ -0,0 +1,59 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.messaging; + +public class MessagingConstants { + + public static final String FROM_BBB_APPS_CHANNEL = "bigbluebutton:from-bbb-apps"; + public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*"; + public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system"; + public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting"; + public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation"; + public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling"; + public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users"; + public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat"; + public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard"; + + public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps"; + public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*"; + public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting"; + public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system"; + public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation"; + public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling"; + public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users"; + public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat"; + public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; + public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; + + public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent"; + public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent"; + public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent"; + public static final String MEETING_STARTED_EVENT = "meeting_created_message"; + public static final String MEETING_ENDED_EVENT = "meeting_ended_event"; + public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event"; + public static final String USER_JOINED_EVENT = "UserJoinedEvent"; + public static final String USER_LEFT_EVENT = "UserLeftEvent"; + public static final String USER_LEFT_VOICE_REQUEST = "user_left_voice_request"; + public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; + public static final String SEND_POLLS_EVENT = "SendPollsEvent"; + public static final String RECORD_STATUS_EVENT = "RecordStatusEvent"; + public static final String SEND_PUBLIC_CHAT_MESSAGE_REQUEST = "send_public_chat_message_request"; + public static final String SEND_PRIVATE_CHAT_MESSAGE_REQUEST = "send_private_chat_message_request"; + public static final String MUTE_USER_REQUEST = "mute_user_request"; +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java new file mode 100755 index 0000000000..8721b188ca --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.messaging; + +import redis.clients.jedis.Jedis; + +public interface MessagingService { + public void send(String channel, String message); + public Jedis createRedisClient(); + public void dropRedisClient(Jedis jedis); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java new file mode 100644 index 0000000000..9e7dfe5259 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java @@ -0,0 +1,73 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class RegisterUserMessage implements IMessage { + public static final String REGISTER_USER = "register_user_request"; + public final String VERSION = "0.0.1"; + + public final String meetingID; + public final String internalUserId; + public final String fullname; + public final String role; + public final String externUserID; + public final String authToken; + + public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) { + this.meetingID = meetingID; + this.internalUserId = internalUserId; + this.fullname = fullname; + this.role = role; + this.externUserID = externUserID; + this.authToken = authToken; + } + + public String toJson() { + HashMap payload = new HashMap(); + + payload.put(Constants.MEETING_ID, meetingID); + payload.put(Constants.INTERNAL_USER_ID, internalUserId); + payload.put(Constants.NAME, fullname); + payload.put(Constants.ROLE, role); + payload.put(Constants.EXT_USER_ID, externUserID); + payload.put(Constants.AUTH_TOKEN, authToken); + + java.util.HashMap header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static RegisterUserMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (REGISTER_USER.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.NAME) + && payload.has(Constants.ROLE) + && payload.has(Constants.EXT_USER_ID) + && payload.has(Constants.AUTH_TOKEN)) { + + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String fullname = payload.get(Constants.NAME).getAsString(); + String role = payload.get(Constants.ROLE).getAsString(); + String externUserID = payload.get(Constants.EXT_USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + + //use externalUserId twice - once for external, once for internal + return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken); + } + } + } + } + System.out.println("Failed to parse RegisterUserMessage"); + return null; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java new file mode 100644 index 0000000000..3ae49d0faf --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserConnectedToGlobalAudio implements IMessage { + public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio"; + public static final String VERSION = "0.0.1"; + + public final String voiceConf; + public final String name; + public final String userid; + + + + public UserConnectedToGlobalAudio(String voiceConf, String userid, String name) { + this.voiceConf = voiceConf; + this.userid = userid; + this.name = name; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.VOICE_CONF, voiceConf); + payload.put(Constants.USER_ID, userid); + payload.put(Constants.NAME, name); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_CONNECTED_TO_GLOBAL_AUDIO, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserConnectedToGlobalAudio fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_CONNECTED_TO_GLOBAL_AUDIO.equals(messageName)) { + if (payload.has(Constants.VOICE_CONF) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NAME)) { + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + return new UserConnectedToGlobalAudio(voiceConf, userid, name); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java new file mode 100755 index 0000000000..314e0a798d --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.conference.service.messaging; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserDisconnectedFromGlobalAudio implements IMessage { + public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio"; + public static final String VERSION = "0.0.1"; + + public final String voiceConf; + public final String name; + public final String userid; + + public UserDisconnectedFromGlobalAudio(String voiceConf, String userid, String name) { + this.voiceConf = voiceConf; + this.userid = userid; + this.name = name; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.VOICE_CONF, voiceConf); + payload.put(Constants.USER_ID, userid); + payload.put(Constants.NAME, name); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_DISCONNECTED_FROM_GLOBAL_AUDIO, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserDisconnectedFromGlobalAudio fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_DISCONNECTED_FROM_GLOBAL_AUDIO.equals(messageName)) { + if (payload.has(Constants.VOICE_CONF) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NAME)) { + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + return new UserDisconnectedFromGlobalAudio(voiceConf, userid, name); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java new file mode 100755 index 0000000000..3f036d96dc --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java @@ -0,0 +1,20 @@ +package org.bigbluebutton.conference.service.messaging; + +public class ValidateAuthTokenMessage implements IMessage { + public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String token; + public final String replyTo; + public final String sessionId; + + public ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo, String sessionId) { + this.meetingId = meetingId; + this.userId = userId; + this.token = token; + this.replyTo = replyTo; + this.sessionId = sessionId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java new file mode 100755 index 0000000000..d8518438ea --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java @@ -0,0 +1,25 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.Set; + +public class MessageDistributor { + private ReceivedMessageHandler handler; + private Set listeners; + + public void setMessageListeners(Set listeners) { + this.listeners = listeners; + } + + public void setMessageHandler(ReceivedMessageHandler handler) { + this.handler = handler; + if (handler != null) { + handler.setMessageDistributor(this); + } + } + + public void notifyListeners(String pattern, String channel, String message) { + for (MessageHandler listener : listeners) { + listener.handleMessage(pattern, channel, message); + } + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java new file mode 100755 index 0000000000..64e25cb510 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java @@ -0,0 +1,23 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.messaging.redis; + +public interface MessageHandler { + void handleMessage(String pattern, String channel, String message); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java new file mode 100755 index 0000000000..b051b9e86b --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java @@ -0,0 +1,85 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPubSub; + +public class MessageReceiver { + private ReceivedMessageHandler handler; + + private JedisPool redisPool; + private volatile boolean receiveMessage = false; + + private final Executor msgReceiverExec = Executors.newSingleThreadExecutor(); + + public void stop() { + receiveMessage = false; + } + + public void start() { +// log.info("Ready to receive messages from Redis pubsub."); + try { + receiveMessage = true; + final Jedis jedis = redisPool.getResource(); + + Runnable messageReceiver = new Runnable() { + public void run() { + if (receiveMessage) { + jedis.psubscribe(new PubSubListener(), MessagingConstants.TO_BBB_APPS_PATTERN); + } + } + }; + msgReceiverExec.execute(messageReceiver); + } catch (Exception e) { +// log.error("Error subscribing to channels: " + e.getMessage()); + } + } + + public void setRedisPool(JedisPool redisPool){ + this.redisPool = redisPool; + } + + public void setMessageHandler(ReceivedMessageHandler handler) { + this.handler = handler; + } + + private class PubSubListener extends JedisPubSub { + + public PubSubListener() { + super(); + } + + @Override + public void onMessage(String channel, String message) { + // Not used. + } + + @Override + public void onPMessage(String pattern, String channel, String message) { + handler.handleMessage(pattern, channel, message); + } + + @Override + public void onPSubscribe(String pattern, int subscribedChannels) { +// log.debug("Subscribed to the pattern: " + pattern); + } + + @Override + public void onPUnsubscribe(String pattern, int subscribedChannels) { + // Not used. + } + + @Override + public void onSubscribe(String channel, int subscribedChannels) { + // Not used. + } + + @Override + public void onUnsubscribe(String channel, int subscribedChannels) { + // Not used. + } + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java new file mode 100755 index 0000000000..477c1165fa --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java @@ -0,0 +1,70 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class MessageSender { + private JedisPool redisPool; + private volatile boolean sendMessage = false; + + private final Executor msgSenderExec = Executors.newSingleThreadExecutor(); + private final Executor runExec = Executors.newSingleThreadExecutor(); + private BlockingQueue messages = new LinkedBlockingQueue(); + + public void stop() { + sendMessage = false; + } + + public void start() { +// log.info("Redis message publisher starting!"); + try { + sendMessage = true; + + Runnable messageSender = new Runnable() { + public void run() { + while (sendMessage) { + try { + MessageToSend msg = messages.take(); + publish(msg.getChannel(), msg.getMessage()); + } catch (InterruptedException e) { +// log.warn("Failed to get message from queue."); + } + } + } + }; + msgSenderExec.execute(messageSender); + } catch (Exception e) { +// log.error("Error subscribing to channels: " + e.getMessage()); + } + } + + public void send(String channel, String message) { + MessageToSend msg = new MessageToSend(channel, message); + messages.add(msg); + } + + private void publish(final String channel, final String message) { + Runnable task = new Runnable() { + public void run() { + Jedis jedis = redisPool.getResource(); + try { + jedis.publish(channel, message); + } catch(Exception e){ +// log.warn("Cannot publish the message to redis", e); + } finally { + redisPool.returnResource(jedis); + } + } + }; + + runExec.execute(task); + } + + public void setRedisPool(JedisPool redisPool){ + this.redisPool = redisPool; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java new file mode 100755 index 0000000000..e01dfc84e1 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java @@ -0,0 +1,19 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +public class MessageToSend { + private final String channel; + private final String message; + + public MessageToSend(String channel, String message) { + this.channel = channel; + this.message = message; + } + + public String getChannel() { + return channel; + } + + public String getMessage() { + return message; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java new file mode 100755 index 0000000000..9319407276 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java @@ -0,0 +1,28 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +public class ReceivedMessage { + + private final String pattern; + private final String channel; + private final String message; + + public ReceivedMessage(String pattern, String channel, String message) { + this.pattern = pattern; + this.channel = channel; + this.message = message; + } + + public String getPattern() { + return pattern; + } + + public String getChannel() { + return channel; + } + + public String getMessage() { + return message; + } + + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java new file mode 100755 index 0000000000..6350be0fc9 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java @@ -0,0 +1,68 @@ +package org.bigbluebutton.conference.service.messaging.redis; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; + +public class ReceivedMessageHandler { + + private BlockingQueue receivedMessages = new LinkedBlockingQueue(); + + private volatile boolean processMessage = false; + + private final Executor msgProcessorExec = Executors.newSingleThreadExecutor(); + private final Executor runExec = Executors.newSingleThreadExecutor(); + + private MessageDistributor handler; + + public void stop() { + processMessage = false; + } + + public void start() { +// log.info("Ready to handle messages from Redis pubsub!"); + + try { + processMessage = true; + + Runnable messageProcessor = new Runnable() { + public void run() { + while (processMessage) { + try { + ReceivedMessage msg = receivedMessages.take(); + processMessage(msg); + } catch (InterruptedException e) { +// log.warn("Error while taking received message from queue."); + } + } + } + }; + msgProcessorExec.execute(messageProcessor); + } catch (Exception e) { +// log.error("Error subscribing to channels: " + e.getMessage()); + } + } + + private void processMessage(final ReceivedMessage msg) { + Runnable task = new Runnable() { + public void run() { + if (handler != null) { + handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage()); + } else { +// log.info("No listeners interested in messages from Redis!"); + } + } + }; + runExec.execute(task); + } + + public void handleMessage(String pattern, String channel, String message) { + ReceivedMessage rm = new ReceivedMessage(pattern, channel, message); + receivedMessages.add(rm); + } + + public void setMessageDistributor(MessageDistributor h) { + this.handler = h; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java new file mode 100755 index 0000000000..8dd2dbb26c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -0,0 +1,119 @@ +package org.bigbluebutton.core.api; + +import java.util.Map; + + +public interface IBigBlueButtonInGW { + + void isAliveAudit(String aliveID); + void statusMeetingAudit(String meetingID); + void endMeeting(String meetingID); + void endAllMeetings(); + void createMeeting2(String meetingID, String externalMeetingID, String meetingName, boolean recorded, + String voiceBridge, long duration, boolean autoStartRecording, + boolean allowStartStopRecording, String moderatorPass, String viewerPass, + long createTime, String createDate); + void destroyMeeting(String meetingID); + void getAllMeetings(String meetingID); + void lockSettings(String meetingID, Boolean locked, Map lockSettigs); + + + // Lock + void initLockSettings(String meetingID, Map settings); + void sendLockSettings(String meetingID, String userId, Map settings); + void getLockSettings(String meetingId, String userId); + void lockUser(String meetingId, String requesterID, boolean lock, String internalUserID); + + + // Users + void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId); + void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken); + void userRaiseHand(String meetingId, String userId); + void lowerHand(String meetingId, String userId, String loweredBy); + void shareWebcam(String meetingId, String userId, String stream); + void unshareWebcam(String meetingId, String userId, String stream); + void setUserStatus(String meetingID, String userID, String status, Object value); + void getUsers(String meetingID, String requesterID); + void userLeft(String meetingID, String userID, String sessionId); + void userJoin(String meetingID, String userID, String authToken); + void getCurrentPresenter(String meetingID, String requesterID); + void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy); + void setRecordingStatus(String meetingId, String userId, Boolean recording); + void getRecordingStatus(String meetingId, String userId); + void userConnectedToGlobalAudio(String voiceConf, String userid, String name); + void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name); + + // Voice + void initAudioSettings(String meetingID, String requesterID, Boolean muted); + void muteAllExceptPresenter(String meetingID, String requesterID, Boolean mute); + void muteAllUsers(String meetingID, String requesterID, Boolean mute); + void isMeetingMuted(String meetingID, String requesterID); + void muteUser(String meetingID, String requesterID, String userID, Boolean mute); + void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock); + void ejectUserFromVoice(String meetingID, String userId, String ejectedBy); + void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy); + void voiceUserJoined(String meetingId, String userId, String webUserId, String conference, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking); + void voiceUserLeft(String meetingId, String userId); + void voiceUserLocked(String meetingId, String userId, Boolean locked); + void voiceUserMuted(String meetingId, String userId, Boolean muted); + void voiceUserTalking(String meetingId, String userId, Boolean talking); + void voiceRecording(String meetingId, String recordingFile, + String timestamp, Boolean recording); + + // Presentation + void clear(String meetingID); + void removePresentation(String meetingID, String presentationID); + void getPresentationInfo(String meetingID, String requesterID, String replyTo); + void sendCursorUpdate(String meetingID, double xPercent, double yPercent); + void resizeAndMoveSlide(String meetingID, double xOffset, double yOffset, double widthRatio, double heightRatio); + void gotoSlide(String meetingID, String page); + void sharePresentation(String meetingID, String presentationID, boolean share); + void getSlideInfo(String meetingID, String requesterID, String replyTo); + + void sendConversionUpdate(String messageKey, String meetingId, + String code, String presId, String presName); + + void sendPageCountError(String messageKey, String meetingId, + String code, String presId, int numberOfPages, + int maxNumberPages, String presName); + + void sendSlideGenerated(String messageKey, String meetingId, + String code, String presId, int numberOfPages, + int pagesCompleted, String presName); + + void sendConversionCompleted(String messageKey, String meetingId, + String code, String presId, int numPages, String presName, String presBaseUrl); + + // Polling + void getPolls(String meetingID, String requesterID); + void createPoll(String meetingID, String requesterID, String msg); + void updatePoll(String meetingID, String requesterID, String msg); + void startPoll(String meetingID, String requesterID, String msg); + void stopPoll(String meetingID, String requesterID, String msg); + void removePoll(String meetingID, String requesterID, String msg); + void respondPoll(String meetingID, String requesterID, String msg); + void preCreatedPoll(String meetingID, String msg); + + // Layout + void getCurrentLayout(String meetingID, String requesterID); + void broadcastLayout(String meetingID, String requesterID, String layout); + void lockLayout(String meetingID, String setById, + boolean lock, boolean viewersOnly, + scala.Option layout); + + // Chat + void getChatHistory(String meetingID, String requesterID, String replyTo); + void sendPublicMessage(String meetingID, String requesterID, Map message); + void sendPrivateMessage(String meetingID, String requesterID, Map message); + + // Whiteboard + void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map annotation); + void requestWhiteboardAnnotationHistory(String meetingID, String requesterID, String whiteboardId, String replyTo); + void clearWhiteboard(String meetingID, String requesterID, String whiteboardId); + void undoWhiteboard(String meetingID, String requesterID, String whiteboardId); + void enableWhiteboard(String meetingID, String requesterID, Boolean enable); + void isWhiteboardEnabled(String meetingID, String requesterID, String replyTo); + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java new file mode 100755 index 0000000000..fa1b97c3c6 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.core.api; + +public interface IDispatcher { + + void dispatch(String jsonMessage); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java new file mode 100755 index 0000000000..94939235e2 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.api; + +public interface IOutMessage { + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java new file mode 100755 index 0000000000..93573a265e --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java @@ -0,0 +1,21 @@ +package org.bigbluebutton.core.api; + +import java.util.Set; + + +public class MessageOutGateway { + + private Set listeners; + + public void send(IOutMessage msg) { +// log.debug("before listeners send. check message:" + msg); + for (OutMessageListener2 l : listeners) { +// log.debug("listener " + l); + l.handleMessage(msg); + } + } + + public void setListeners(Set listeners) { + this.listeners = listeners; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java new file mode 100755 index 0000000000..ec6d099a45 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.core.api; + +public interface OutMessageListener2 { + + void handleMessage(IOutMessage msg); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java new file mode 100755 index 0000000000..9f03321ce0 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractVoiceRecordEvent extends RecordEvent { + + public AbstractVoiceRecordEvent() { + setModule("VOICE"); + } + + public void setBridge(String bridge) { + eventMap.put("bridge", bridge); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java new file mode 100755 index 0000000000..1e4616ef56 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java @@ -0,0 +1,26 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public interface ConferenceServerListener { + public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); + public void left(String room, Integer participant); + public void muted(String room, Integer participant, Boolean muted); + public void talking(String room, Integer participant, Boolean talking); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java new file mode 100755 index 0000000000..ffebb366ee --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public interface ConferenceServiceProvider { + public void populateRoom(String room); + public void mute(String room, String participant, Boolean mute); + public void eject(String room, String participant); + public void ejectAll(String room); + public void record(String room, String meetingid); + public void broadcast(String room, String meetingid); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java new file mode 100644 index 0000000000..f24a4de2e5 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java @@ -0,0 +1,115 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +public class FreeswitchConferenceEventListener implements ConferenceEventListener { + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + + private volatile boolean sendMessages = false; + private IVoiceConferenceService vcs; + + public void setVoiceConferenceService(IVoiceConferenceService vcs) { + this.vcs = vcs; + } + + private void queueMessage(VoiceConferenceEvent event) { + try { + messages.offer(event, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { + Runnable task = new Runnable() { + public void run() { + if (event instanceof VoiceUserJoinedEvent) { + System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); + VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; + vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), + evt.getCallerIdNum(), evt.getCallerIdName(), + evt.getMuted(), evt.getSpeaking()); + } else if (event instanceof VoiceUserLeftEvent) { + System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); + VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; + vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); + } else if (event instanceof VoiceUserMutedEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); + VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; + vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); + } else if (event instanceof VoiceUserTalkingEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); + VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; + vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); + } else if (event instanceof VoiceStartRecordingEvent) { + VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; + System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); + vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + VoiceConferenceEvent message; + try { + message = messages.take(); + sendMessageToBigBlueButton(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } + + public void handleConferenceEvent(VoiceConferenceEvent event) { + queueMessage(event); + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java new file mode 100755 index 0000000000..f26f38b458 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java @@ -0,0 +1,13 @@ +package org.bigbluebutton.webconference.voice; + +public interface IVoiceConferenceService { + void voiceUserJoined(String userId, String webUserId, String conference, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking); + void voiceUserLeft(String meetingId, String userId); + void voiceUserLocked(String meetingId, String userId, Boolean locked); + void voiceUserMuted(String meetingId, String userId, Boolean muted); + void voiceUserTalking(String meetingId, String userId, Boolean talking); + void voiceStartedRecording(String conference, String recordingFile, + String timestamp, Boolean recording); +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java new file mode 100755 index 0000000000..7417a522af --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java @@ -0,0 +1,51 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantJoinedVoiceRecordEvent() { + super(); + setEvent("ParticipantJoinedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setCallerName(String name) { + eventMap.put("callername", name); + } + + public void setCallerNumber(String name) { + eventMap.put("callernumber", name); + } + + public void setMuted(boolean muted) { + eventMap.put("muted", Boolean.toString(muted)); + } + + public void setTalking(boolean talking) { + eventMap.put("talking", Boolean.toString(talking)); + } + + public void setLocked(boolean locked) { + eventMap.put("locked", Boolean.toString(locked)); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java new file mode 100755 index 0000000000..0b3bfaa25c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java @@ -0,0 +1,31 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantLeftVoiceRecordEvent() { + super(); + setEvent("ParticipantLeftEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java new file mode 100755 index 0000000000..ff7be6cbd5 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantLockedVoiceRecordEvent() { + super(); + setEvent("ParticipantLockedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setLocked(boolean locked) { + eventMap.put("locked", Boolean.toString(locked)); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java new file mode 100755 index 0000000000..eb23d6bc70 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantMutedVoiceRecordEvent() { + super(); + setEvent("ParticipantMutedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setMuted(boolean muted) { + eventMap.put("muted", Boolean.toString(muted)); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java new file mode 100755 index 0000000000..e0b2814349 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java @@ -0,0 +1,36 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantTalkingVoiceRecordEvent() { + super(); + setEvent("ParticipantTalkingEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setTalking(boolean talking) { + eventMap.put("talking", Boolean.toString(talking)); + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java new file mode 100755 index 0000000000..7c46b0f0bf --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java @@ -0,0 +1,38 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public StartRecordingVoiceRecordEvent(boolean record) { + super(); + if (record) + setEvent("StartRecordingEvent"); + else + setEvent("StopRecordingEvent"); + } + + public void setRecordingTimestamp(String timestamp) { + eventMap.put("recordingTimestamp", timestamp); + } + + public void setFilename(String filename) { + eventMap.put("filename", filename); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java new file mode 100755 index 0000000000..310d5392cd --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java @@ -0,0 +1,141 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import java.util.concurrent.TimeUnit; + +import org.bigbluebutton.conference.service.recorder.RecorderApplication; +import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +public class VoiceEventRecorder { + + private RecorderApplication recorder; + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public void recordConferenceEvent(VoiceConferenceEvent event, String room) { + if (event instanceof VoiceUserJoinedEvent) { + recordParticipantJoinedEvent(event, room); + } else if (event instanceof VoiceUserLeftEvent) { + recordParticipantLeftEvent(event, room); + } else if (event instanceof VoiceUserMutedEvent) { + recordParticipantMutedEvent(event, room); + } else if (event instanceof VoiceUserTalkingEvent) { + recordParticipantTalkingEvent(event, room); + } else if (event instanceof VoiceUserLockedEvent) { + recordParticipantLockedEvent(event, room); + } else if (event instanceof VoiceStartRecordingEvent) { + recordStartRecordingEvent(event, room); + } else { +// log.debug("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() ); + } + } + + private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) { + VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event; + StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord()); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setRecordingTimestamp(sre.getTimestamp()); + evt.setFilename(sre.getRecordingFilename()); + System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename")); + recorder.record(room, evt); + } + + private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) { + VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event; + + ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(pje.getUserId().toString()); + evt.setCallerName(pje.getCallerIdName()); + evt.setCallerNumber(pje.getCallerIdName()); + evt.setMuted(pje.getMuted()); + evt.setTalking(pje.getSpeaking()); + + recorder.record(room, evt); + } + + private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) { + + ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + + + evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString()); + + recorder.record(room, evt); + } + + private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) { + VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event; + + ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString()); + evt.setMuted(pme.isMuted()); + + recorder.record(room, evt); + } + + private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) { + VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event; + + ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString()); + evt.setTalking(pte.isTalking()); + + recorder.record(room, evt); + } + + private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) { + VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event; + + ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString()); + evt.setLocked(ple.isLocked()); + + recorder.record(room, evt); + } + + public void setRecorderApplication(RecorderApplication recorder) { + this.recorder = recorder; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java new file mode 100755 index 0000000000..d0402213cc --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public abstract class ConferenceCommand { + + private final String room; + private final Integer requesterId; + + public ConferenceCommand(String room, Integer requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public String getRoom() { + return room; + } + + public Integer getRequesterId() { + return requesterId; + } + + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java new file mode 100755 index 0000000000..e9b6c0f3be --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java @@ -0,0 +1,56 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class ConferenceCommandResult { + + private final String room; + private final Integer requesterId; + private boolean success = false; + private String message = ""; + + public ConferenceCommandResult(String room, Integer requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getRoom() { + return room; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Integer getRequesterId() { + return requesterId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java new file mode 100755 index 0000000000..140b26a75f --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java @@ -0,0 +1,34 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class EjectParticipantCommand extends ConferenceCommand { + + private final Integer participantId; + + public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { + super(room, requesterId); + this.participantId = participantId; + } + + public Integer getParticipantId() { + return participantId; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java new file mode 100755 index 0000000000..ff774f702d --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class GetParticipantsCommand extends ConferenceCommand { + + public GetParticipantsCommand(String room, Integer requesterId) { + super(room, requesterId); + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java new file mode 100755 index 0000000000..789a355cde --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class MuteParticipantCommand extends ConferenceCommand { + + private final Integer participantId; + private final boolean mute; + + public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { + super(room, requesterId); + this.participantId = participantId; + this.mute = mute; + } + + public Integer getParticipantId() { + return participantId; + } + + public boolean isMute() { + return mute; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java new file mode 100755 index 0000000000..15800e757d --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java @@ -0,0 +1,25 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + + +public interface ConferenceEventListener { + public void handleConferenceEvent(VoiceConferenceEvent event); + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java new file mode 100755 index 0000000000..735180a415 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class UnknownConferenceEvent extends VoiceConferenceEvent { + + public UnknownConferenceEvent(String participantId, String room) { + super(room); + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java new file mode 100755 index 0000000000..d1ee12a966 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public abstract class VoiceConferenceEvent { + private final String room; + + public VoiceConferenceEvent(String room) { + this.room = room; + } + + public String getRoom() { + return room; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java new file mode 100755 index 0000000000..0e2b8bcc90 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java @@ -0,0 +1,51 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceStartRecordingEvent extends VoiceConferenceEvent { + + private String timestamp; + private String filename; + private boolean record; + + public VoiceStartRecordingEvent(String room, boolean record) { + super(room); + this.record = record; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public void setRecordingFilename(String filename) { + this.filename = filename; + } + + public String getTimestamp() { + return timestamp; + } + + public String getRecordingFilename() { + return filename; + } + + public boolean startRecord() { + return record; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java new file mode 100755 index 0000000000..1a721c5015 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java @@ -0,0 +1,70 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserJoinedEvent extends VoiceConferenceEvent { + + private final String voiceUserId; + private final String callerIdNum; + private final String callerIdName; + private final Boolean muted; + private final Boolean speaking; + private final Boolean locked = false; + private final String userId; + + public VoiceUserJoinedEvent(String userId, String voiceUserId, String room, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking) { + super(room); + this.userId = userId; + this.voiceUserId = voiceUserId; + this.callerIdName = callerIdName; + this.callerIdNum = callerIdNum; + this.muted = muted; + this.speaking = speaking; + } + + public String getUserId() { + return userId; + } + + public String getVoiceUserId() { + return voiceUserId; + } + + public String getCallerIdNum() { + return callerIdNum; + } + + public String getCallerIdName() { + return callerIdName; + } + + public Boolean getMuted() { + return muted; + } + + public Boolean getSpeaking() { + return speaking; + } + + public Boolean isLocked() { + return locked; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java new file mode 100755 index 0000000000..f5371e5620 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserLeftEvent extends VoiceConferenceEvent { + + private final String userId; + + public VoiceUserLeftEvent(String userId, String room) { + super(room); + this.userId = userId; + } + + public String getUserId() { + return userId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java new file mode 100755 index 0000000000..414be991c6 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserLockedEvent extends VoiceConferenceEvent { + + private final boolean locked; + private final String userId; + + public VoiceUserLockedEvent(String userId, String room, boolean locked) { + super(room); + this.locked = locked; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isLocked() { + return locked; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java new file mode 100755 index 0000000000..203e93743c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserMutedEvent extends VoiceConferenceEvent { + + private final boolean muted; + private final String userId; + + public VoiceUserMutedEvent(String userId, String room, boolean muted) { + super(room); + this.muted = muted; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isMuted() { + return muted; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java new file mode 100755 index 0000000000..3ecd6759e4 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserTalkingEvent extends VoiceConferenceEvent { + + private final boolean talking; + private final String userId; + + public VoiceUserTalkingEvent(String userId, String room, boolean talking) { + super(room); + this.talking = talking; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isTalking() { + return talking; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java new file mode 100755 index 0000000000..f3dcd0fc59 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java @@ -0,0 +1,154 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; +import org.freeswitch.esl.client.inbound.Client; +import org.freeswitch.esl.client.inbound.InboundConnectionFailure; +import org.freeswitch.esl.client.manager.ManagerConnection; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class ConnectionManager { + private static final String EVENT_NAME = "Event-Name"; + + private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); + + private ManagerConnection manager; + private ScheduledFuture connectTask; + + private volatile boolean subscribed = false; + + private ConferenceEventListener conferenceEventListener; + private ESLEventListener eslEventListener; + + private void connect() { + try { + Client c = manager.getESLClient(); + if (! c.canSend()) { +// log.info("Attempting to connect to FreeSWITCH ESL"); + subscribed = false; + manager.connect(); + } else { + if (!subscribed) { +// log.info("Subscribing for ESL events."); + c.cancelEventSubscriptions(); + c.addEventListener(eslEventListener); + c.setEventSubscriptions( "plain", "all" ); + c.addEventFilter( EVENT_NAME, "heartbeat" ); + c.addEventFilter( EVENT_NAME, "custom" ); + c.addEventFilter( EVENT_NAME, "background_job" ); + subscribed = true; + } + } + } catch (InboundConnectionFailure e) { + System.out.println("Failed to connect to ESL"); +// log.error("Failed to connect to ESL"); + } + } + + public void start() { +// log.info("Starting FreeSWITCH ESL connection manager."); + System.out.println("***************** Starting FreeSWITCH ESL connection manager."); + ConnectThread connector = new ConnectThread(); + connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); + } + + public void stop() { + if (connectTask != null) { + connectTask.cancel(true); + } + } + + private class ConnectThread implements Runnable { + public void run() { + connect(); + } + } + + + public void broadcast(BroadcastConferenceCommand rcc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); + rcc.handleResponse(response, conferenceEventListener); + } + } + + public void getUsers(PopulateRoomCommand prc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); + prc.handleResponse(response, conferenceEventListener); + } + } + + public void mute(MuteParticipantCommand mpc) { + System.out.println("Got mute request from FSApplication."); + Client c = manager.getESLClient(); + if (c.canSend()) { + System.out.println("Issuing command to FS ESL."); + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void eject(EjectParticipantCommand mpc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void ejectAll(EjectAllUsersCommand mpc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void record(RecordConferenceCommand rcc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); + rcc.handleResponse(response, conferenceEventListener); + } + } + + public void setManagerConnection(ManagerConnection manager) { + this.manager = manager; + } + + public void setESLEventListener(ESLEventListener listener) { + this.eslEventListener = listener; + } + + public void setConferenceEventListener(ConferenceEventListener listener) { + this.conferenceEventListener = listener; + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java new file mode 100755 index 0000000000..3f627965c3 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java @@ -0,0 +1,204 @@ +package org.bigbluebutton.webconference.voice.freeswitch; + + +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.freeswitch.esl.client.IEslEventListener; +import org.freeswitch.esl.client.transport.event.EslEvent; +import org.jboss.netty.channel.ExceptionEvent; + +public class ESLEventListener implements IEslEventListener { + + private static final String START_TALKING_EVENT = "start-talking"; + private static final String STOP_TALKING_EVENT = "stop-talking"; + private static final String START_RECORDING_EVENT = "start-recording"; + private static final String STOP_RECORDING_EVENT = "stop-recording"; + + private ConferenceEventListener conferenceEventListener; + + @Override + public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { + //Ignored, Noop + } + + @Override + public void backgroundJobResultReceived(EslEvent event) { +// log.debug( "Background job result received [{}]", event ); + } + + @Override + public void exceptionCaught(ExceptionEvent e) { +// setChanged(); +// notifyObservers(e); + } + + private static final Pattern GLOBAL_AUDION_PATTERN = Pattern.compile("(GLOBAL_AUDIO)_(.*)$"); + private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); + + @Override + public void conferenceEventJoin(String uniqueId, String confName, int confSize, EslEvent event) { + + Integer memberId = this.getMemberIdFromEvent(event); + Map headers = event.getEventHeaders(); + String callerId = this.getCallerIdFromEvent(event); + String callerIdName = this.getCallerIdNameFromEvent(event); + boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue + boolean speaking = headers.get("Talking").equals("true") ? true : false; + + String voiceUserId = callerIdName; + +// log.info("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); + + Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); + if (gapMatcher.matches()) { +// log.debug("Ignoring GLOBAL AUDIO USER [{}]", callerIdName); + return; + } + + Matcher matcher = CALLERNAME_PATTERN.matcher(callerIdName); + if (matcher.matches()) { + voiceUserId = matcher.group(1).trim(); + callerIdName = matcher.group(2).trim(); + } + + VoiceUserJoinedEvent pj = new VoiceUserJoinedEvent(voiceUserId, memberId.toString(), confName, callerId, callerIdName, muted, speaking); + conferenceEventListener.handleConferenceEvent(pj); + } + + @Override + public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); +// log.info("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); + conferenceEventListener.handleConferenceEvent(pl); + } + + @Override + public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); +// log.info("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); + conferenceEventListener.handleConferenceEvent(pm); + } + + @Override + public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); +// log.info("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); + conferenceEventListener.handleConferenceEvent(pm); + } + + @Override + public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + VoiceUserTalkingEvent pt; + + System.out.println("******************** Receive conference Action [" + action + "]"); + + if (action == null) { + return; + } + + if (action.equals(START_TALKING_EVENT)) { + pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); + conferenceEventListener.handleConferenceEvent(pt); + } else if (action.equals(STOP_TALKING_EVENT)) { + pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); + conferenceEventListener.handleConferenceEvent(pt); + } else { +// log.debug("Unknown conference Action [{}]", action); + System.out.println("Unknown conference Action [" + action + "]"); + } + } + + @Override + public void conferenceEventTransfer(String uniqueId, String confName, int confSize, EslEvent event) { + //Ignored, Noop + } + + @Override + public void conferenceEventThreadRun(String uniqueId, String confName, int confSize, EslEvent event) { + + } + + //@Override + public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) { + String action = event.getEventHeaders().get("Action"); + + if(action == null) { + return; + } + + // if (log.isDebugEnabled()) + // log.debug("Handling conferenceEventRecord " + action); + + if (action.equals(START_RECORDING_EVENT)) { + VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); + sre.setRecordingFilename(getRecordFilenameFromEvent(event)); + sre.setTimestamp(genTimestamp().toString()); + +// log.info("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + + conferenceEventListener.handleConferenceEvent(sre); + } else if (action.equals(STOP_RECORDING_EVENT)) { + VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false); + srev.setRecordingFilename(getRecordFilenameFromEvent(event)); + srev.setTimestamp(genTimestamp().toString()); + +// log.info("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + conferenceEventListener.handleConferenceEvent(srev); + } else { +// if (log.isDebugEnabled()) +// log.warn("Processing UNKNOWN conference Action {}", action); + } + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + @Override + public void eventReceived(EslEvent event) { + System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]"); +// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) { +//// setChanged(); +// notifyObservers(event); +// return; +// } + } + + private Integer getMemberIdFromEvent(EslEvent e) { + return new Integer(e.getEventHeaders().get("Member-ID")); + } + + private String getCallerIdFromEvent(EslEvent e) { + return e.getEventHeaders().get("Caller-Caller-ID-Number"); + } + + private String getCallerIdNameFromEvent(EslEvent e) { + return e.getEventHeaders().get("Caller-Caller-ID-Name"); + } + + private String getRecordFilenameFromEvent(EslEvent e) { + return e.getEventHeaders().get("Path"); + } + + /*private String getRecordTimestampFromEvent(EslEvent e) { + return e.getEventHeaders().get("Event-Date-Timestamp"); + }*/ + + public void setConferenceEventListener(ConferenceEventListener listener) { + this.conferenceEventListener = listener; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java new file mode 100755 index 0000000000..d0abdcc759 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java @@ -0,0 +1,202 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch; + +import java.io.File; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; +import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +public class FreeswitchApplication implements ConferenceServiceProvider { + + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + private ConnectionManager manager; + + private String icecastProtocol = "shout"; + private String icecastHost = "localhost"; + private int icecastPort = 8000; + private String icecastUsername = "source"; + private String icecastPassword = "hackme"; + private String icecastStreamExtension = ".mp3"; + private Boolean icecastBroadcast = false; + + private final String USER = "0"; /* not used for now */ + + private volatile boolean sendMessages = false; + + private void queueMessage(FreeswitchCommand command) { + try { + messages.offer(command, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void populateRoom(String room) { + PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); + queueMessage(prc); + } + + public void mute(String room, String participant, Boolean mute) { + MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); + queueMessage(mpc); + } + + public void eject(String room, String participant) { + EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); + queueMessage(mpc); + } + + @Override + public void ejectAll(String room) { + EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); + queueMessage(mpc); + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + @Override + public void record(String room, String meetingid){ + String RECORD_DIR = "/var/freeswitch/meetings"; + String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; + + RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); + queueMessage(rcc); + } + + @Override + public void broadcast(String room, String meetingid) { + if (icecastBroadcast) { + broadcastToIcecast(room, meetingid); + } + } + + private void broadcastToIcecast(String room, String meetingid) { + String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort + + File.separatorChar + meetingid + "." + icecastStreamExtension; + + BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); + queueMessage(rcc); + } + + public void setConnectionManager(ConnectionManager manager) { + this.manager = manager; + } + + public void setIcecastProtocol(String protocol) { + icecastProtocol = protocol; + } + + public void setIcecastHost(String host) { + icecastHost = host; + } + + public void setIcecastPort(int port) { + icecastPort = port; + } + + public void setIcecastUsername(String username) { + icecastUsername = username; + } + + public void setIcecastPassword(String password) { + icecastPassword = password; + } + + public void setIcecastBroadcast(Boolean broadcast) { + icecastBroadcast = broadcast; + } + + public void setIcecastStreamExtension(String ext) { + icecastStreamExtension = ext; + } + + private void sendMessageToFreeswitch(final FreeswitchCommand command) { + Runnable task = new Runnable() { + public void run() { + if (command instanceof PopulateRoomCommand) { + PopulateRoomCommand cmd = (PopulateRoomCommand) command; +// log.debug("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); + manager.getUsers(cmd); + } else if (command instanceof MuteParticipantCommand) { + MuteParticipantCommand cmd = (MuteParticipantCommand) command; +// log.debug("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.mute(cmd); + } else if (command instanceof EjectParticipantCommand) { + EjectParticipantCommand cmd = (EjectParticipantCommand) command; +// log.debug("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.eject(cmd); + } else if (command instanceof EjectAllUsersCommand) { + EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; +// log.debug("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); + manager.ejectAll(cmd); + } else if (command instanceof RecordConferenceCommand) { + manager.record((RecordConferenceCommand) command); + } else if (command instanceof BroadcastConferenceCommand) { + manager.broadcast((BroadcastConferenceCommand) command); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + FreeswitchCommand message; + try { + message = messages.take(); + sendMessageToFreeswitch(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java new file mode 100755 index 0000000000..c0aa4d35b3 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java @@ -0,0 +1,50 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class BroadcastConferenceCommand extends FreeswitchCommand { + private boolean record; + private String icecastPath; + + public BroadcastConferenceCommand(String room, String requesterId, boolean record, String icecastPath){ + super(room, requesterId); + this.record = record; + this.icecastPath = icecastPath; + } + + + @Override + public String getCommandArgs() { + String action = "norecord"; + if (record) + action = "record"; + + return SPACE + getRoom() + SPACE + action + SPACE + icecastPath; + } + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java new file mode 100755 index 0000000000..e4826d72ea --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java @@ -0,0 +1,31 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class EjectAllUsersCommand extends FreeswitchCommand { + + public EjectAllUsersCommand(String room, String requesterId) { + super(room, requesterId); + } + + @Override + public String getCommandArgs() { + return room + " kick all"; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java new file mode 100755 index 0000000000..0924b164eb --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java @@ -0,0 +1,34 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class EjectParticipantCommand extends FreeswitchCommand { + + private final String participant; + + public EjectParticipantCommand(String room, String participant, String requesterId) { + super(room, requesterId); + this.participant = participant; + } + + @Override + public String getCommandArgs() { + return room + " kick " + participant; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java new file mode 100755 index 0000000000..db9800fa93 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java @@ -0,0 +1,45 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public abstract class FreeswitchCommand { + public static final String SPACE = " "; + + protected final String room; + protected final String requesterId; + + public FreeswitchCommand(String room, String requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public String getCommand() { + return "conference"; //conference is default, override if needed. + } + + public abstract String getCommandArgs(); + + public String getRoom() { + return room; + } + + public String getRequesterId() { + return requesterId; + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java new file mode 100755 index 0000000000..a54ab6dacc --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class MuteParticipantCommand extends FreeswitchCommand { + + private final String participant; + private final Boolean mute; + + public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { + super(room, requesterId); + this.participant = participant; + this.mute = mute; + } + + @Override + public String getCommandArgs() { + String action = "unmute"; + if (mute) action = "mute"; + + return room + SPACE + action + SPACE + participant; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java new file mode 100755 index 0000000000..0697ac610c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java @@ -0,0 +1,116 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.freeswitch.esl.client.transport.message.EslMessage; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; +import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.SAXException; + +public class PopulateRoomCommand extends FreeswitchCommand { + + public PopulateRoomCommand(String room, String requesterId) { + super(room, requesterId); + } + + @Override + public String getCommandArgs() { + return getRoom() + SPACE + "xml_list"; + } + + private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + String firstLine = response.getBodyLines().get(0); + + //E.g. Conference 85115 not found + + if(!firstLine.startsWith(". +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.freeswitch.esl.client.transport.message.EslMessage; +import org.slf4j.Logger; + +public class RecordConferenceCommand extends FreeswitchCommand { + private boolean record; + private String recordPath; + + public RecordConferenceCommand(String room, String requesterId, boolean record, String recordPath){ + super(room, requesterId); + this.record = record; + this.recordPath = recordPath; + } + + + @Override + public String getCommandArgs() { + String action = "norecord"; + if (record) + action = "record"; + + return SPACE + getRoom() + SPACE + action + SPACE + recordPath; + } + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java new file mode 100755 index 0000000000..4e6caf9050 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java @@ -0,0 +1,88 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.webconference.voice.freeswitch.response; + +/** + * + * @author leif + */ +public class ConferenceMember { + + protected Integer memberId; + protected ConferenceMemberFlags flags; + protected String uuid; + protected String callerIdName; + protected String callerId; + protected Integer joinTime; + protected Integer lastTalking; + + public Integer getId() { + return memberId; + } + + public ConferenceMemberFlags getFlags() { + return flags; + } + + public String getCallerId() { + return callerId; + } + + public String getCallerIdName() { + return callerIdName; + } + + public boolean getMuted() { + return flags.getIsMuted(); + } + + public boolean getSpeaking() { + return flags.getIsSpeaking(); + } + + public void setFlags(ConferenceMemberFlags flags) { + this.flags = flags; + } + + public void setId(int parseInt) { + memberId = parseInt; + } + + public void setUUID(String tempVal) { + this.uuid = tempVal; + } + + public void setCallerIdName(String tempVal) { + this.callerIdName = tempVal; + } + + public void setCallerId(String tempVal) { + this.callerId = tempVal; + } + + public void setJoinTime(int parseInt) { + this.joinTime = parseInt; + } + + void setLastTalking(int parseInt) { + this.lastTalking = parseInt; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java new file mode 100755 index 0000000000..be507e2c0d --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java @@ -0,0 +1,54 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.webconference.voice.freeswitch.response; + +/** + * + * @author leif + */ +public class ConferenceMemberFlags { + //private boolean canHear = false; + private boolean canSpeak = false; + private boolean talking = false; + //private boolean hasVideo = false; + //private boolean hasFloor = false; + //private boolean isModerator = false; + //private boolean endConference = false; + + boolean getIsSpeaking() { + return talking; + } + + boolean getIsMuted() { + if(canSpeak == true) { + return false; + } + return true; + } + + void setCanSpeak(String tempVal) { + canSpeak = tempVal.equals("true") ? true : false; + } + + void setTalking(String tempVal) { + talking = tempVal.equals("true") ? true : false; + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java new file mode 100755 index 0000000000..0411d85d5e --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java @@ -0,0 +1,160 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.response; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.slf4j.Logger; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * + * @author leif + */ +public class XMLResponseConferenceListParser extends DefaultHandler { + private List myConfrenceMembers; + private String tempVal; + private ConferenceMember tempMember; + private ConferenceMemberFlags tempFlags; + private String room; + private boolean inFlags = false; + + public XMLResponseConferenceListParser() { + myConfrenceMembers = new ArrayList(); + } + + public String getConferenceRoom() { + return room; + } + + public void printConferneceMemebers() { +// log.info("Number of Members found in room [{}] was ({}).", room, myConfrenceMembers.size()); + Iterator it = myConfrenceMembers.iterator(); + while(it.hasNext()) { + // log.info("room [{}] member: [{}]", room, it.next().toString()); + } + } + + public List getConferenceList() { + return myConfrenceMembers; + } + + /* + + + + + + 6 + + true + true + false + false + true + false + false + + 3a16f061-0df6-45d5-b401-d8e977e08a5c + 1001 + 1001 + 65 + 4 + + + + + + */ + + + //SAX Event Handlers + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + //reset + inFlags = false; + tempVal = ""; + if(qName.equalsIgnoreCase("member")) { + //create a new instance of ConferenceMember + tempMember = new ConferenceMember(); + } + + if(qName.equalsIgnoreCase("flags")) { + //create a new instance of ConferenceMember + tempFlags = new ConferenceMemberFlags(); + inFlags = true; + } + + if(qName.equalsIgnoreCase("conference")) { + room = attributes.getValue("name"); + } + } + + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + tempVal = new String(ch,start,length); + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + + if(qName.equalsIgnoreCase("member")) { + //add it to the list + myConfrenceMembers.add(tempMember); + }else if(qName.equalsIgnoreCase("flags")) { + tempMember.setFlags(tempFlags); + inFlags = false; + }else if(inFlags) { + if (qName.equalsIgnoreCase("can_speak")) { + tempFlags.setCanSpeak(tempVal); + }else if (qName.equalsIgnoreCase("talking")) { + tempFlags.setTalking(tempVal); + } + }else if (qName.equalsIgnoreCase("id")) { + try { + tempMember.setId(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { +// log.error("cannot set ConferenceMember Id value [{}] NFE.", tempVal); + } + }else if (qName.equalsIgnoreCase("uuid")) { + tempMember.setUUID(tempVal); + }else if (qName.equalsIgnoreCase("caller_id_name")) { + tempMember.setCallerIdName(tempVal); + }else if (qName.equalsIgnoreCase("caller_id_number")) { + tempMember.setCallerId(tempVal); + }else if (qName.equalsIgnoreCase("join_time")) { + try { + tempMember.setJoinTime(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { +// log.debug("cannot set setJoinTime value [{}] NFE.", tempVal); + } + }else if (qName.equalsIgnoreCase("last_talking")) { + try { + tempMember.setLastTalking(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { +// log.debug("cannot set setLastTalking value [{}] NFE.", tempVal); + } + } + + } +} diff --git a/labs/akka-bbb-fs/src/main/resources/README b/labs/akka-bbb-fs/src/main/resources/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/labs/akka-bbb-fs/src/main/resources/application.conf b/labs/akka-bbb-fs/src/main/resources/application.conf new file mode 100644 index 0000000000..89ab866646 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/resources/application.conf @@ -0,0 +1,23 @@ +akka { + actor { + debug { + receive = on + } + } + loglevel = DEBUG + stdout-loglevel = "DEBUG" +} + +spray.can.server { + request-timeout = 10s +} + +service { + host = "192.168.153.144" + port = 8989 +} + +api { + channel = "bbb-apps-channel" + source = "bigbluebutton-apps" +} diff --git a/labs/akka-bbb-fs/src/main/resources/logback.xml b/labs/akka-bbb-fs/src/main/resources/logback.xml new file mode 100644 index 0000000000..6b68ae21bb --- /dev/null +++ b/labs/akka-bbb-fs/src/main/resources/logback.xml @@ -0,0 +1,17 @@ + + + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + + + + + + + \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala new file mode 100755 index 0000000000..0ae0562756 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/BigBlueButtonAppsMainActor.scala @@ -0,0 +1,16 @@ +package org.bigbluebutton + +import akka.actor.Props +import akka.actor.Actor + +object BigBlueButtonAppsMainActor { + def props(name: String): Props = + Props(classOf[BigBlueButtonAppsMainActor]) +} + +class BigBlueButtonAppsMainActor extends Actor { + + def receive = { + case _ => None + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala new file mode 100755 index 0000000000..245ccd7ffc --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala @@ -0,0 +1,21 @@ +package org.bigbluebutton + +import akka.actor.{ ActorSystem, Props } +import scala.concurrent.duration._ +import redis.RedisClient +import scala.concurrent.{ Future, Await } +import scala.concurrent.ExecutionContext.Implicits.global +//import org.bigbluebutton.apps.MeetingManager +import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor + +object Boot extends App with SystemConfiguration { + + implicit val system = ActorSystem("bigbluebutton-apps-system") + + val redisPublisherActor = system.actorOf( + AppsRedisPublisherActor.props(system), + "redis-publisher") + + // val meetingManager = system.actorOf(MeetingManager.props(redisPublisherActor), "meeting-manager") + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala new file mode 100644 index 0000000000..3fbdbc4b52 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala @@ -0,0 +1,20 @@ +package org.bigbluebutton + +import com.typesafe.config.ConfigFactory +import scala.util.Try + +trait SystemConfiguration { + + val config = ConfigFactory.load() + + lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") + + lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) + + lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") + + lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) + + lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") + lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala new file mode 100644 index 0000000000..c00384aaea --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala @@ -0,0 +1,54 @@ +package org.bigbluebutton.apps.protocol + +import org.bigbluebutton.apps.users.data.UserIdAndName + +trait InMessage + +// Poll Messages +case class PreCreatedPoll(meetingID: String, poll: PollVO) extends InMessage +case class CreatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage +case class UpdatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage +case class GetPolls(meetingID: String, requesterID: String) extends InMessage +case class DestroyPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class RemovePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class SharePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class ShowPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class HidePollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class StopPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class StartPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class ClearPoll(meetingID: String, requesterID: String, pollID: String, force: Boolean = false) extends InMessage +case class GetPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage +case class RespondToPoll(meetingID: String, requesterID: String, response: PollResponseVO) extends InMessage + +case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) +case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) +case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) +case class QuestionResponsesVO(val questionID: String, val responseIDs: Array[String]) +case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) +case class ResponderVO(responseID: String, user: Responder) +case class Responder(val userID: String, name: String) + +case class SendVoiceUsersRequest(meetingID: String, requesterID: String) extends InMessage +case class MuteMeetingRequest(meetingID: String, requesterID: String, mute: Boolean) extends InMessage +case class IsMeetingMutedRequest(meetingID: String, requesterID: String) extends InMessage +case class MuteUserRequest(meetingID: String, requesterID: String, userID: String, mute: Boolean) extends InMessage +case class LockUserRequest(meetingID: String, requesterID: String, userID: String, lock: Boolean) extends InMessage +case class EjectUserRequest(meetingID: String, requesterID: String, userID: String) extends InMessage +case class VoiceUserJoinedMessage(meetingID: String, user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, + muted: Boolean, talking: Boolean) extends InMessage + +case class VoiceUserLeftMessage(meetingID: String, user: String, voiceConfId: String) extends InMessage +case class VoiceUserMutedMessage(meetingID: String, user: String, voiceConfId: String, muted: Boolean) extends InMessage +case class VoiceUserTalkingMessage(meetingID: String, user: String, voiceConfId: String, talking: Boolean) extends InMessage +case class VoiceStartedRecordingMessage(meetingID: String, voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends InMessage + +// Need these extra classes since InMessage needs meetingID as parameter and +// our messages from FreeSWITCH doesn't have it. +trait VoiceMessage +case class VoiceUserJoined(user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, muted: Boolean, speaking: Boolean) extends VoiceMessage + +case class VoiceUserLeft(user: String, voiceConfId: String) extends VoiceMessage +case class VoiceUserMuted(user: String, voiceConfId: String, muted: Boolean) extends VoiceMessage +case class VoiceUserTalking(user: String, voiceConfId: String, talking: Boolean) extends VoiceMessage +case class VoiceStartedRecording(voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends VoiceMessage + diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala new file mode 100644 index 0000000000..8ccd7dbb65 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala @@ -0,0 +1,64 @@ +package org.bigbluebutton.apps.protocol + +import spray.json.DefaultJsonProtocol +import spray.json.JsValue +import spray.json.JsObject +import spray.json.JsonParser +import Message._ + +import org.parboiled.errors.ParsingException + +object Message { + case class Meeting(id: String, name: String, session: String) + case class MessageHeader(name: String, timestamp: Long, meeting: Meeting) + case class MessageEvent(header: MessageHeader, payload: JsValue) +} + +object MessageHeaderJsonProtocol extends DefaultJsonProtocol { + implicit val meetingFormat = jsonFormat3(Meeting) + implicit val messageHeaderFormat = jsonFormat3(MessageHeader) +} + +import MessageHeaderJsonProtocol._ + +object MessageHandler { + def extractMessageHeader(msg: JsObject): Option[MessageHeader] = { + msg.fields.get("header") match { + case Some(header) => { + val h = header.convertTo[MessageHeader] + Some(h) + } + case None => None + } + } + + def extractPayload(msg: JsObject): Option[JsValue] = { + msg.fields.get("payload") + } + + def processMessage(msg: String): Option[JsObject] = { + try { + val msgObject = JsonParser(msg).asJsObject + Some(msgObject) + } catch { + case e: ParsingException => None + } + } + + def forwardMessage(header: MessageHeader, payload: JsValue) { + + } + + def handleMessage(jsonMsg: String) { + val jsonObj = processMessage(jsonMsg) + if (jsonObj != None) { + val msgObj = jsonObj get + val header = extractMessageHeader(msgObj) + val payload = extractPayload(msgObj) + + if (header != None && payload != None) { + forwardMessage(header get, payload get) + } + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala new file mode 100644 index 0000000000..c7060c6fd1 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala @@ -0,0 +1,31 @@ +package org.bigbluebutton.apps.protocol + +import org.bigbluebutton.apps.users.data._ +import org.bigbluebutton.apps.Session +import org.bigbluebutton.apps.MeetingDescriptor +import spray.json.DefaultJsonProtocol +import org.bigbluebutton.apps.Duration +import org.bigbluebutton.apps.PhoneNumber +import org.bigbluebutton.apps.MeetingDescriptor + +/* +object MyJsonProtocol extends DefaultJsonProtocol { + implicit val sessionFormat = jsonFormat3(Session) + implicit val usersDefFormat = jsonFormat2(MaxUsers) + implicit val durationDefFormat = jsonFormat3(MeetingDuration) + implicit val voiceConfDefFormat = jsonFormat2(VoiceConfAndPin) + implicit val phoneNumberDefFormat = jsonFormat2(PhoneNumber) + implicit val meetingDefFormat = jsonFormat11(MeetingDescriptor) +} +*/ +case class CreateMeetingRequestReply(created: Boolean, message: String, session: Session) + +case class MeetingHeader(name: String, externalId: String, session: String) + +case class UserRegistered(meeting: MeetingHeader, user: RegisteredUser) +case class EndAndKickAll(meeting: MeetingHeader) +case class GetUsersReply(meeting: MeetingHeader, users: Seq[JoinedUser]) +case class PresenterAssigned(meeting: MeetingHeader, newPresenter: UserIdAndName, assignedBy: UserIdAndName) +case class UserJoined(meeting: MeetingHeader, user: JoinedUser) +case class UserLeft(meeting: MeetingHeader, user: UserIdAndName) +case class UserStatusChange(meeting: MeetingHeader, user: UserIdAndName, status: String, value: Object) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala new file mode 100644 index 0000000000..9d01448b6b --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala @@ -0,0 +1,75 @@ +package org.bigbluebutton.apps.protocol + +import spray.json.JsValue +import org.bigbluebutton.apps.users.data.{ RegisterUser, JoinedUser } +import spray.json.DefaultJsonProtocol +import spray.httpx.SprayJsonSupport + +case class Destination(to: String, correlation_id: Option[String]) +case class ReplyDestination(to: String, correlation_id: String) + +case class Header(destination: Destination, name: String, + timestamp: String, source: String, + reply: Option[ReplyDestination]) + +case class HeaderMeeting(name: String, id: String, session: Option[String]) + +case class HeaderAndJsonMessage(header: Header, jsonMessage: String) +case class ReplyStatus(status: String, message: String, error: Option[Int]) + +case class StatusCode(code: Int, message: String) +case class ErrorCode(code: Int, message: String, details: Option[String] = None) +case class Response(status: StatusCode, errors: Option[Seq[ErrorCode]] = None) + +case class ResponsePayload(response: Response) +case class JsonResponse(header: Header, payload: Option[ResponsePayload] = None) + +case class MessageProcessException(message: String) extends Exception(message) + +object HeaderAndPayloadJsonSupport extends DefaultJsonProtocol with SprayJsonSupport { + implicit val statusCodeFormat = jsonFormat2(StatusCode) + implicit val errorCodeFormat = jsonFormat3(ErrorCode) + implicit val responseFormat = jsonFormat2(Response) + implicit val headerDestinationFormat = jsonFormat2(Destination) + implicit val headerMeetingFormat = jsonFormat3(HeaderMeeting) + implicit val replyDestinationFormat = jsonFormat2(ReplyDestination) + implicit val headerFormat = jsonFormat5(Header) + implicit val headerAndPayloadFormat = jsonFormat2(HeaderAndJsonMessage) + implicit val responsePayloadFormat = jsonFormat1(ResponsePayload) + implicit val jsonResponseFormat = jsonFormat2(JsonResponse) +} + +object StatusCodes extends Enumeration { + type StatusCodeType = Value + + val OK = Value(200, "OK") + val NOT_MODIFIED = Value(304, "Not Modified") + val BAD_REQUEST = Value(400, "Bad Request") + val UNAUTHORIZED = Value(401, "Unauthorized") + val FORBIDDEN = Value(403, "Forbidden") + val NOT_FOUND = Value(404, "Not Found") + val NOT_ACCEPTABLE = Value(406, "Not Acceptable") + val INTERNAL_SERVER_ERROR = Value(500, "Internal Server Error") + val BAD_GATEWAY = Value(502, "Bad Gateway") + val SERVICE_UNAVAILABLE = Value(503, "Service Unavailable") +} + +object StatusCodeBuilder { + def buildStatus(codeType: StatusCodes.StatusCodeType): StatusCode = { + StatusCode(codeType.id, codeType.toString()) + } +} + +object ErrorCodes extends Enumeration { + type ErrorCodeType = Value + + val INVALID_TOKEN = Value(1, "Invalid or expired token") + val INVALID_MESSAGE = Value(2, "Invalid message") + +} + +object ErrorCodeBuilder { + def buildError(codeType: ErrorCodes.ErrorCodeType, details: String): ErrorCode = { + ErrorCode(codeType.id, codeType.toString(), Some(details)) + } +} diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala new file mode 100644 index 0000000000..e154a9c78b --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala @@ -0,0 +1,37 @@ +package org.bigbluebutton.endpoint + +import org.bigbluebutton.apps.protocol.Header +import org.bigbluebutton.apps.MeetingIdAndName +import org.bigbluebutton.apps.users.data.UserIdAndName + +sealed abstract class InMsgFormatter + +case class CreateMeetingRequestFormat(header: Header, + payload: CreateMeetingRequestPayloadFormat) extends InMsgFormatter + +case class CreateMeetingResponseFormat(header: Header, + payload: CreateMeetingResponsePayloadFormat) extends InMsgFormatter + +case class RegisterUserRequestFormat(header: Header, + payload: RegisterUserRequestPayloadFormat) extends InMsgFormatter + +case class RegisterUserResponseFormat(header: Header, + payload: RegisterUserResponsePayloadFormat) extends InMsgFormatter + +case class UserRegisteredEventFormat(header: Header, + payload: UserRegisteredEventPayloadFormat) extends InMsgFormatter + +case class UserJoinRequestFormat(header: Header, + payload: UserJoinRequestPayloadFormat) extends InMsgFormatter + +case class UserJoinedEventFormat(header: Header, + payload: UserJoinedEventPayloadFormat) extends InMsgFormatter + +case class UserLeaveMessage(header: Header, + payload: UserLeavePayload) extends InMsgFormatter + +case class GetUsersRequestMessage(header: Header, + payload: GetUsersRequestPayload) extends InMsgFormatter + +case class AssignPresenterMessage(header: Header, + payload: AssignPresenterPayload) extends InMsgFormatter diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala new file mode 100755 index 0000000000..3d1d31d76d --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala @@ -0,0 +1,32 @@ +package org.bigbluebutton.endpoint + +import akka.util.Timeout +import scala.concurrent.duration._ +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } +import org.bigbluebutton.apps.users.protocol.UsersMessageHandler + +/** + * This actor is responsible for handling messages from the pubsub. + */ +object MessageHandlerActor { + def props(bbbAppsActor: ActorRef, messageMarshallingActor: ActorRef): Props = + Props(classOf[MessageHandlerActor], bbbAppsActor, messageMarshallingActor) +} + +class MessageHandlerActor private (val bbbAppsActor: ActorRef, + val messageMarshallingActor: ActorRef) extends Actor + with ActorLogging { + + /** RefFactory for actor request-response (ask pattern) **/ + def actorRefFactory = context + + /** Required for actor request-response (ask pattern) **/ + implicit def executionContext = actorRefFactory.dispatcher + implicit val timeout = Timeout(5 seconds) + + def receive = { + case msg: UserJoinRequestFormat => //handleUserJoinRequestMessage(msg) + + case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala new file mode 100644 index 0000000000..bb36c3b1b2 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala @@ -0,0 +1,90 @@ +package org.bigbluebutton.endpoint + +import org.bigbluebutton.apps.users.data._ +import org.bigbluebutton.apps.protocol._ +import org.bigbluebutton.apps.Role +import org.bigbluebutton.apps.users.messages.UserJoined +import org.bigbluebutton.apps.Session +import org.bigbluebutton.apps.MeetingIdAndName +import org.bigbluebutton.apps.users.messages.Result +import org.bigbluebutton.apps.users.messages.UserJoinResponse + +case class ResultFormat(success: Boolean, message: String) + +case class UserFormat(id: String, external_id: String, name: String, + role: Role.RoleType, pin: Int, welcome_message: String, + logout_url: String, avatar_url: String) + +case class DurationFormat(length_in_minutes: Int, allow_extend: Boolean, max_minutes: Int) + +case class VoiceConferenceFormat(pin: Int, number: Int) + +case class PhoneNumberFormat(number: String, description: String) + +case class MeetingDescriptorFormat(name: String, external_id: String, + record: Boolean, welcome_message: String, logout_url: String, + avatar_url: String, max_users: Int, duration: DurationFormat, + voice_conference: VoiceConferenceFormat, + phone_numbers: Seq[PhoneNumberFormat], + metadata: Map[String, String]) + +case class CreateMeetingRequestPayloadFormat(meeting_descriptor: MeetingDescriptorFormat) + +case class CreateMeetingResponsePayloadFormat(meeting: MeetingIdAndName, + session: Option[String], result: ResultFormat, + meeting_descriptor: MeetingDescriptorFormat) + +case class MeetingCreatedEventPayloadFormat(meeting: MeetingIdAndName, + session: String, meeting_descriptor: MeetingDescriptorFormat) + +case class UserDescriptorFormat(external_id: String, name: String, + role: Role.RoleType, pin: Int, + welcome_message: String, + logout_url: String, avatar_url: String, + metadata: Map[String, String]) + +case class RegisterUserRequestPayloadFormat(meeting: MeetingIdAndName, + session: String, user_descriptor: UserDescriptorFormat) + +case class RegisterUserResponsePayloadFormat(meeting: MeetingIdAndName, + session: String, user_token: Option[String], + result: ResultFormat, user_descriptor: UserDescriptorFormat) + +case class UserRegisteredEventPayloadFormat(meeting: MeetingIdAndName, + session: String, user_descriptor: UserDescriptorFormat) + +case class StatusFormat(hand_raised: Boolean, muted: Boolean, + locked: Boolean, talking: Boolean) + +case class CallerIdFormat(name: String, number: String) + +case class MediaStreamFormat(media_type: String, uri: String, + metadata: Map[String, String]) + +case class JoinedUserFormat(id: String, external_id: String, name: String, + role: Role.RoleType, pin: Int, welcome_message: String, + logout_url: String, avatar_url: String, is_presenter: Boolean, + status: StatusFormat, caller_id: CallerIdFormat, + media_streams: Seq[MediaStreamFormat]) + +case class UserJoinedEventPayloadFormat(meeting: MeetingIdAndName, + session: String, user: JoinedUserFormat) + +case class UserJoinResponseMessage(header: Header, response: UserJoinResponse) + +case class JoinUserResponse(response: Response, token: String, joinedUser: Option[JoinedUser]) + +case class JoinUserReply(header: Header, payload: JoinUserResponse) + +case class UserJoinRequestPayloadFormat(meeting: MeetingIdAndName, + session: String, token: String) + +case class UserLeavePayload(meeting: MeetingIdAndName, + session: String, user: UserIdAndName) + +case class GetUsersRequestPayload(meeting: MeetingIdAndName, + session: String, requester: UserIdAndName) + +case class AssignPresenterPayload(meeting: MeetingIdAndName, + session: String, presenter: UserIdAndName, + assigned_by: UserIdAndName) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala new file mode 100755 index 0000000000..d94d5c8e4c --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala @@ -0,0 +1,23 @@ +package org.bigbluebutton.endpoint + +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } +import org.bigbluebutton.apps.users.protocol.UsersMessageMarshalling + +/** + * This Actor is responsible for converting messages into JSON string + * to be published into the pubsub. + */ +object MessageMarshallingActor { + def props(pubsubActor: ActorRef): Props = + Props(classOf[MessageMarshallingActor], pubsubActor) +} + +class MessageMarshallingActor private (val pubsubActor: ActorRef) extends Actor + with ActorLogging { + + def receive = { + case msg: UserJoinResponseMessage => //marshallUserJoinResponseMessage(msg) + + case unknownMsg => log.error("Cannot marshall unknown message: [{}]", unknownMsg) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala new file mode 100644 index 0000000000..c3a29bb97b --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala @@ -0,0 +1,47 @@ +package org.bigbluebutton.endpoint + +object InMsgNameConst { + val CreateMeetingRequest = "create_meeting_request" + val CreateMeetingResponse = "create_meeting_response" + val MeetingCreatedEvent = "meeting_created_event" + val EndMeetingRequest = "end_meeting_request" + val EndMeetingResponse = "end_meeting_response" + val EndMeetingWarningEvent = "end_meeting_warning_event" + val MeetingEndEvent = "meeting_end_event" + val MeetingEndedEvent = "meeting_ended_event" + val ExtendMeetingRequest = "extend_meeting_request" + val ExtendMeetingResponse = "extend_meeting_response" + val MeetingExtendedEvent = "meeting_extended_event" + + val RegisterUserRequest = "register_user_request" + val RegisterUserResponse = "register_user_response" + val UserRegisteredEvent = "user_registered_event" + val UserJoinRequest = "user_join_request" + val UserJoinResponse = "user_join_response" + val UserJoinedEvent = "user_joined_event" + val UserLeaveEvent = "user_leave_event" + val UserLeftEvent = "user_left_event" + val GetUsersRequest = "get_users_request" + val GetUsersResponse = "get_users_response" + val RaiseUserHandRequest = "raise_user_hand_request" + val UserRaisedHandEvent = "user_raised_hand_event" + val AssignPresenterRequest = "assign_presenter_request" + val PresenterAssignedEvent = "presenter_assigned_event" + val MuteUserRequest = "mute_user_request" + val MuteUserRequestEvent = "mute_user_request_event" + val MuteVoiceUserRequest = "mute_voice_user_request" + val VoiceUserMutedEvent = "voice_user_muted_event" + val UserMutedEvent = "user_muted_event" + val EjectUserRequest = "eject_user_request" + val UserEjectedEvent = "user_ejected_event" + val EjectUserFromVoiceRequest = "eject_user_from_voice_request" + val EjectVoiceUserRequest = "eject_voice_user_request" + val VoiceUserEjectedEvent = "voice_user_ejected_event" + val LockUserRequest = "lock_user_request" + val LockVoiceUserRequest = "lock_voice_user_request" + val VoiceUserLockedEvent = "voice_user_locked_event" + val UserLockedEvent = "user_locked_event" + val LockAllUsersRequest = "lock_all_users_request" + val AllUsersLockedEvent = "all_users_locked_event" +} + diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala new file mode 100755 index 0000000000..0e24e14a5a --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala @@ -0,0 +1,93 @@ +package org.bigbluebutton.endpoint + +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } +import spray.json.{ JsObject, JsonParser, DeserializationException } +import org.parboiled.errors.ParsingException +import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport._ +import org.bigbluebutton.apps.protocol._ +import scala.util.{ Try, Success, Failure } +import org.bigbluebutton.apps.users.protocol.UsersMessageUnmarshalling + +object MessageUnmarshallingActor { + def props(messageHandlerActor: ActorRef): Props = + Props(classOf[MessageUnmarshallingActor], messageHandlerActor) +} + +class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) extends Actor + with ActorLogging { + + def receive = { + case msg: String => handleMessage(msg) + case badMsg => log.error("Unhandled message: [{}", badMsg) + } + + def handleMessage(msg: String) = { + unmarshall(msg) match { + case Success(validMsg) => forwardMessage(validMsg) + case Failure(ex) => log.error("Unhandled message: [{}]", ex) + } + } + + def forwardMessage(msg: HeaderAndJsonMessage) = { + msg.header.name match { + case InMsgNameConst.UserJoinRequest => + //handleUserJoin(msg) + case InMsgNameConst.UserLeaveEvent => + //handleUserLeave(msg) + case InMsgNameConst.GetUsersRequest => + //handleGetUsers(msg) + case InMsgNameConst.AssignPresenterRequest => + //handleAssignPresenter(msg) + + case _ => + log.error("Unknown message name: [{}]", msg.header.name) + } + } + + def header(msg: JsObject): Header = { + try { + msg.fields.get("header") match { + case Some(header) => + header.convertTo[Header] + case None => + throw MessageProcessException("Cannot get header: [" + msg + "]") + } + } catch { + case e: DeserializationException => + throw MessageProcessException("Failed to deserialize header: [" + msg + "]") + } + } + + def payload(msg: JsObject): JsObject = { + msg.fields.get("payload") match { + case Some(payload) => + payload.asJsObject + case None => + throw MessageProcessException("Cannot get payload information: [" + msg + "]") + } + } + + def toJsObject(msg: String): JsObject = { + try { + JsonParser(msg).asJsObject + } catch { + case e: ParsingException => { + log.error("Cannot parse message: {}", msg) + throw MessageProcessException("Cannot parse JSON message: [" + msg + "]") + } + } + } + + def toHeaderAndJsonMessage(header: Header, message: String): HeaderAndJsonMessage = { + HeaderAndJsonMessage(header, message) + } + + def unmarshall(jsonMsg: String): Try[HeaderAndJsonMessage] = { + for { + jsonObj <- Try(toJsObject(jsonMsg)) + header <- Try(header(jsonObj)) + message = toHeaderAndJsonMessage(header, jsonMsg) + } yield message + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala new file mode 100644 index 0000000000..6a992824ab --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala @@ -0,0 +1,14 @@ +package org.bigbluebutton.endpoint + +import org.bigbluebutton.apps.protocol.Header +import org.bigbluebutton.apps.MeetingIdAndName + +sealed abstract class OutMsgFormatter + +case class MeetingCreatedEventFormat(header: Header, + payload: MeetingCreatedEventPayloadFormat) +case class UserJoinResponseFormat(header: Header, + payload: UserJoinResponseFormatPayload) extends OutMsgFormatter +case class UserJoinResponseFormatPayload(meeting: MeetingIdAndName, + session: String, result: ResultFormat, + user: Option[UserFormat]) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala new file mode 100644 index 0000000000..f3ef70ec93 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala @@ -0,0 +1,21 @@ +package org.bigbluebutton.endpoint + +import akka.actor.{ Actor, ActorRef, ActorLogging, Props } + +/** + * This Actor is responsible for building formatted messages that + * will be sent to the pubsub. + */ +object OutMsgBuilderActor { + def props(pubsubActor: ActorRef): Props = + Props(classOf[OutMsgBuilderActor], pubsubActor) +} + +class OutMsgBuilderActor private (val bbbAppsActor: ActorRef, + val messageMarshallingActor: ActorRef) extends Actor + with ActorLogging { + + def receive = { + case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala new file mode 100644 index 0000000000..29e5fa498f --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala @@ -0,0 +1,107 @@ +package org.bigbluebutton.endpoint + +import spray.json.{ DefaultJsonProtocol, JsValue, JsString, DeserializationException, JsonFormat } +import spray.json.DefaultJsonProtocol._ +import org.bigbluebutton.apps.users.data._ +import org.bigbluebutton.apps.protocol._ +import org.bigbluebutton.apps.Role +import org.bigbluebutton.apps.MeetingIdAndName +import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport.headerFormat + +/** JSON Conversion Protocol **/ +object UserMessagesProtocol extends DefaultJsonProtocol { + import HeaderAndPayloadJsonSupport._ + + implicit object RoleJsonFormat extends JsonFormat[Role.RoleType] { + def write(obj: Role.RoleType): JsValue = JsString(obj.toString) + + def read(json: JsValue): Role.RoleType = json match { + case JsString(str) => Role.withName(str) + case _ => throw new DeserializationException("Enum string expected") + } + } + + /* + implicit val webIdentityFormat = + jsonFormat1(WebIdentity) + implicit val callerIdFormat = + jsonFormat2(CallerId) + implicit val voiceIdentityFormat = + jsonFormat5(VoiceIdentity) +*/ + implicit val userFormat = + jsonFormat8(UserFormat) + implicit val userIdAndNameFormat = + jsonFormat2(UserIdAndName) + implicit val meetingIdAndNameFormat = + jsonFormat2(MeetingIdAndName) + implicit val userJoinRequestPayloadFormat = + jsonFormat3(UserJoinRequestPayloadFormat) + implicit val userJoinRequestMessageFormat = + jsonFormat2(UserJoinRequestFormat) + implicit val resultFormat = + jsonFormat2(ResultFormat) + implicit val userJoinResponsePayloadFormat = + jsonFormat4(UserJoinResponseFormatPayload) + implicit val userJoinResponseJsonMessageFormat = + jsonFormat2(UserJoinResponseFormat) + implicit val userLeavePayloadFormat = + jsonFormat3(UserLeavePayload) + implicit val userLeaveMessageFormat = + jsonFormat2(UserLeaveMessage) + implicit val getUsersRequestPayloadFormat = + jsonFormat3(GetUsersRequestPayload) + implicit val getUsersRequestMessageFormat = + jsonFormat2(GetUsersRequestMessage) + implicit val assignPresenterPayloadFormat = + jsonFormat4(AssignPresenterPayload) + implicit val assignPresenterMessageFormat = + jsonFormat2(AssignPresenterMessage) + implicit val durationFormat = + jsonFormat3(DurationFormat) + implicit val voiceConferenceFormat = + jsonFormat2(VoiceConferenceFormat) + implicit val phoneNumberFormat = + jsonFormat2(PhoneNumberFormat) + implicit val meetingDescriptorFormat = + jsonFormat11(MeetingDescriptorFormat) + implicit val createMeetingRequestPayloadFormat = + jsonFormat1(CreateMeetingRequestPayloadFormat) + implicit val createMeetingRequestMessageFormat = + jsonFormat2(CreateMeetingRequestFormat) + implicit val createMeetingResponsePayloadFormat = + jsonFormat4(CreateMeetingResponsePayloadFormat) + implicit val createMeetingResponseFormat = + jsonFormat2(CreateMeetingResponseFormat) + implicit val meetingCreatedEventPayloadFormat = + jsonFormat3(MeetingCreatedEventPayloadFormat) + implicit val meetingCreatedEventFormat = + jsonFormat2(MeetingCreatedEventFormat) + implicit val userDescriptorFormat = + jsonFormat8(UserDescriptorFormat) + implicit val registerUserRequestPayloadFormat = + jsonFormat3(RegisterUserRequestPayloadFormat) + implicit val registerUserRequestFormat = + jsonFormat2(RegisterUserRequestFormat) + implicit val registerUserResponsePayloadFormat = + jsonFormat5(RegisterUserResponsePayloadFormat) + implicit val registerUserResponseFormat = + jsonFormat2(RegisterUserResponseFormat) + implicit val userRegisteredEventPayloadFormat = + jsonFormat3(UserRegisteredEventPayloadFormat) + implicit val userRegisteredEventFormat = + jsonFormat2(UserRegisteredEventFormat) + implicit val statusFormat = + jsonFormat4(StatusFormat) + implicit val callerIdFormat = + jsonFormat2(CallerIdFormat) + implicit val mediaStreamFormat = + jsonFormat3(MediaStreamFormat) + implicit val joinedUserFormat = + jsonFormat12(JoinedUserFormat) + implicit val userJoinedEventPayloadFormat = + jsonFormat3(UserJoinedEventPayloadFormat) + implicit val userJoinedEventFormat = jsonFormat2(UserJoinedEventFormat) + +} + diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala new file mode 100644 index 0000000000..17d146942a --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala @@ -0,0 +1,45 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import redis.RedisClient +import scala.concurrent.duration._ +import scala.concurrent.ExecutionContext.Implicits.global +import akka.actor.ActorSystem +import scala.concurrent.Await +import akka.actor.Actor +import org.bigbluebutton.SystemConfiguration + +object AppsRedisPublisherActor extends SystemConfiguration { + + val channels = Seq("time") + val patterns = Seq("pattern.*") + + def props(system: ActorSystem): Props = + Props(classOf[AppsRedisPublisherActor], + system, redisHost, redisPort) +} + +class AppsRedisPublisherActor(val system: ActorSystem, + val host: String, val port: Int) extends Actor { + + val redis = RedisClient(host, port)(system) + + val futurePong = redis.ping() + println("Ping sent!") + futurePong.map(pong => { + println(s"Redis replied with a $pong") + }) + + Await.result(futurePong, 5 seconds) + + def publish(channel: String, msg: String) { + println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") + // redis.publish("time", System.currentTimeMillis()) + } + + def receive = { + //case msg: JsonMessage => publish(msg.channel, msg.message) + case msg: String => println("PUBLISH TO [channel]: \n [" + msg + "]") + } + +} diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala new file mode 100644 index 0000000000..24424bc00e --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -0,0 +1,41 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import java.net.InetSocketAddress +import redis.actors.RedisSubscriberActor +import redis.api.pubsub.{ PMessage, Message } +import scala.concurrent.duration._ +import akka.actor.ActorRef +import akka.actor.actorRef2Scala +import org.bigbluebutton.SystemConfiguration + +object AppsRedisSubscriberActor extends SystemConfiguration { + + val channels = Seq("time") + val patterns = Seq("pattern.*") + + def props(bbbAppsActor: ActorRef): Props = + Props(classOf[AppsRedisSubscriberActor], + bbbAppsActor, redisHost, redisPort, channels, patterns). + withDispatcher("rediscala.rediscala-client-worker-dispatcher") +} + +class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, + redisPort: Int, + channels: Seq[String] = Nil, patterns: Seq[String] = Nil) + extends RedisSubscriberActor( + new InetSocketAddress(redisHost, redisPort), + channels, patterns) { + + def onMessage(message: Message) { + log.debug(s"message received: $message") + } + + def onPMessage(pmessage: PMessage) { + log.debug(s"pattern message received: $pmessage") + } + + def handleMessage(msg: String) { + log.warning("**** TODO: Handle pubsub messages. ****") + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala new file mode 100644 index 0000000000..336601f401 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala @@ -0,0 +1,3 @@ +package org.bigbluebutton.endpoint.redis + +case class JsonMessage(channel: String, message: String) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala new file mode 100644 index 0000000000..22bea5fde4 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala @@ -0,0 +1,39 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import java.net.InetSocketAddress +import redis.actors.RedisSubscriberActor +import redis.api.pubsub.{ PMessage, Message } +import redis.RedisClient +import scala.concurrent.duration._ +import scala.concurrent.ExecutionContext.Implicits.global + +class RedisPubSubActor { + implicit val akkaSystem = akka.actor.ActorSystem() + + val redis = RedisClient() + + // publish after 2 seconds every 2 or 5 seconds + akkaSystem.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) + akkaSystem.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("pattern.match", "pattern value")) + // shutdown Akka in 20 seconds + akkaSystem.scheduler.scheduleOnce(20 seconds)(akkaSystem.shutdown()) + + val channels = Seq("time") + val patterns = Seq("pattern.*") + // create SubscribeActor instance + akkaSystem.actorOf(Props(classOf[SubscribeActor], channels, patterns).withDispatcher("rediscala.rediscala-client-worker-dispatcher")) + +} + +class SubscribeActor(channels: Seq[String] = Nil, patterns: Seq[String] = Nil) + extends RedisSubscriberActor(new InetSocketAddress("localhost", 6379), channels, patterns) { + + def onMessage(message: Message) { + println(s"message received: $message") + } + + def onPMessage(pmessage: PMessage) { + println(s"pattern message received: $pmessage") + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/java/README b/labs/akka-bbb-fs/src/test/java/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/labs/akka-bbb-fs/src/test/resources/README b/labs/akka-bbb-fs/src/test/resources/README new file mode 100644 index 0000000000..2c6bd342ed --- /dev/null +++ b/labs/akka-bbb-fs/src/test/resources/README @@ -0,0 +1,8 @@ + +1. Install httpie (https://github.com/jkbr/httpie) + +sudo apt-get install python-setuptools +sudo easy_install httpie + +2. Send messages stored in messages/ directory + e.g. http POST 192.168.22.146:8989/meeting < create-meeting.json diff --git a/labs/akka-bbb-fs/src/test/resources/messages/create-meeting.json b/labs/akka-bbb-fs/src/test/resources/messages/create-meeting.json new file mode 100644 index 0000000000..cc7b3745f0 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/resources/messages/create-meeting.json @@ -0,0 +1,49 @@ + { + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "create_meeting_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting_descriptor": { + "name": "English 101", + "external_id": "english_101", + "record": true, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.bigbluebutton.org", + "avatar_url": "http://www.gravatar.com/bigbluebutton", + "max_users": 20, + "duration": { + "length": 120, + "allow_extend": false, + "max": 240 + }, + "voice_conference": { + "pin": 123456, + "number": 85115 + }, + "phone_numbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customer_id": "acme-customer", + "customer_name": "ACME" + } + } + } + } + diff --git a/labs/akka-bbb-fs/src/test/resources/messages/register-user-request.json b/labs/akka-bbb-fs/src/test/resources/messages/register-user-request.json new file mode 100644 index 0000000000..e4c4d0bd6c --- /dev/null +++ b/labs/akka-bbb-fs/src/test/resources/messages/register-user-request.json @@ -0,0 +1,30 @@ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "register_user_request", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-web" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user_descriptor": { + "external_id": "user1", + "name": "Guga", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.example.com", + "avatar_url": "http://www.example.com/avatar.png" + } + } +} diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala new file mode 100644 index 0000000000..866e73bb80 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala @@ -0,0 +1,54 @@ +package org.bigbluebutton.apps + +import akka.testkit.DefaultTimeout +import akka.testkit.ImplicitSender +import akka.testkit.TestKit +import scala.concurrent.duration._ +import scala.collection.immutable +import org.scalatest.matchers.ShouldMatchers +import org.scalatest.WordSpecLike +import org.scalatest.BeforeAndAfterAll +import org.scalatest.Matchers +import akka.actor.ActorSystem +import collection.mutable.Stack +import akka.actor.Props +import akka.testkit.TestProbe +import org.bigbluebutton.apps._ + + +class MeetingManagerSpec extends + TestKit(ActorSystem("MeetingManagerSpec")) + with DefaultTimeout with ImplicitSender with WordSpecLike + with Matchers with BeforeAndAfterAll with MeetingManagerTestFixtures { + + val pubsub = TestProbe() + val meetingMgrRef = system.actorOf(Props(classOf[MeetingManager], pubsub.ref)) + + override def afterAll { + shutdown(system) + } + + "An MeetingManagerActor" should { + "Respond with the Meeting created" in { + within(500 millis) { + val createMsg = generateCreateMeetingMessage() + + meetingMgrRef ! createMsg + + expectMsgPF() { + case resp:CreateMeetingResponse => { + resp.success shouldBe true + resp.message shouldBe "Meeting successfully created." + } + } + + pubsub.expectMsgPF(500 millis) { + case pubMsg:MeetingCreated => { + pubMsg.meeting.id shouldBe createMsg.descriptor.id + } + } + } + } + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala new file mode 100644 index 0000000000..ef7d2ab0ff --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala @@ -0,0 +1,12 @@ +package org.bigbluebutton.apps + +import org.bigbluebutton.apps._ +import org.bigbluebutton.apps._ +import org.bigbluebutton.apps.users.data._ + +trait MeetingManagerTestFixtures extends AppsTestFixtures { + + def generateCreateMeetingMessage():CreateMeeting = { + CreateMeeting(eng101Desc) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala new file mode 100644 index 0000000000..99c33502a7 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala @@ -0,0 +1,42 @@ +package org.bigbluebutton.apps + +import akka.testkit.TestKit +import org.scalatest.BeforeAndAfterAll +import org.scalatest.Matchers +import akka.actor.ActorSystem +import akka.actor.Props +import akka.testkit.TestProbe +import akka.testkit.TestActorRef +import org.scalatest.FlatSpecLike + +class MeetingManagerUnitSpec extends + TestKit(ActorSystem("MeetingManagerUnitSpec")) + with FlatSpecLike with Matchers with BeforeAndAfterAll + with AppsTestFixtures { + + val pubsub = TestProbe() + + val actorRef = TestActorRef[MeetingManager](Props(classOf[MeetingManager], pubsub.ref)) + val actor = actorRef.underlyingActor + + "The MeetingManager" should "return false when a meeting doesn't exist" in { + assert(actor.meetingExist("no-meeting") === false) + } +/* + it should "return true when a meeting exist" in { + val internalId = "testMeetingId" + val sessionId = actor.getValidSession("testMeetingId") +// val meeting = actor.createMeeting(meetingConfig, internalId) + assert(actor.meetingExist(internalId) === true) + val m = actor.getMeeting(internalId) + + m should be ('defined) + +// m.map { n => +// n.config should have ( +// 'name (meetingConfig.name)) +// } + } + + */ +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala new file mode 100644 index 0000000000..a37f499575 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala @@ -0,0 +1,57 @@ + package org.bigbluebutton.apps + +import akka.testkit.DefaultTimeout +import akka.testkit.ImplicitSender +import akka.testkit.TestKit +import scala.concurrent.duration._ +import scala.collection.immutable +import org.scalatest.matchers.ShouldMatchers +import org.scalatest.WordSpecLike +import org.scalatest.BeforeAndAfterAll +import org.scalatest.Matchers +import akka.actor.ActorSystem +import collection.mutable.Stack +import akka.actor.Props +import akka.testkit.TestProbe +import org.bigbluebutton.apps._ +import org.bigbluebutton.apps.users.data.RegisterUser +import org.bigbluebutton.apps.users._ +import akka.testkit.TestActorRef +import org.bigbluebutton.apps.users.messages._ + +class RunningMeetingActorSpec extends + TestKit(ActorSystem("MeetingManagerSpec")) + with DefaultTimeout with ImplicitSender with WordSpecLike + with Matchers with BeforeAndAfterAll + with MeetingManagerTestFixtures { + + val pubsub = TestProbe() + val session = eng101Session + val config = eng101Desc + val runningMeetingActor = TestActorRef[RunningMeetingActor]( + RunningMeetingActor.props( + pubsub.ref, session, config)) + + override def afterAll { + shutdown(system) + } + + "An RunningMeetingActor" should { + "Respond with 'User has been registered.'" in { + within(500 millis) { + + runningMeetingActor ! RegisterUserRequest(session, juanUser) + + expectMsgPF() { + case resp:RegisterUserResponse => { + resp.result.success shouldBe true + resp.result.message shouldBe "User has been registered." + runningMeetingActor.underlyingActor.usersApp.isRegistered(resp.token) shouldBe true + runningMeetingActor.underlyingActor.usersApp.registered.length == 1 + } + } + } + } + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala new file mode 100644 index 0000000000..0649265561 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala @@ -0,0 +1,154 @@ +package org.bigbluebutton.apps + +import scala.util.Random +import com.typesafe.config.ConfigFactory +import akka.actor.Actor +import akka.actor.ActorRef +import akka.actor.ActorSystem +import akka.actor.Props +import akka.testkit.DefaultTimeout +import akka.testkit.ImplicitSender +import akka.testkit.TestKit +import scala.concurrent.duration._ +import scala.collection.immutable +import org.scalatest.matchers.ShouldMatchers +import org.scalatest.WordSpecLike +import org.scalatest.BeforeAndAfterAll +import org.scalatest.Matchers + +/** + * a Test to show some TestKit examples + */ +class TestKitUsageSpec extends + TestKit(ActorSystem("TestKitUsageSpec", + ConfigFactory.parseString(TestKitUsageSpec.config))) + with DefaultTimeout with ImplicitSender with WordSpecLike + with Matchers with BeforeAndAfterAll { + + import TestKitUsageSpec._ + + val echoRef = system.actorOf(Props[EchoActor]) + val forwardRef = system.actorOf(Props(classOf[ForwardingActor], testActor)) + val filterRef = system.actorOf(Props(classOf[FilteringActor], testActor)) + val randomHead = Random.nextInt(6) + val randomTail = Random.nextInt(10) + val headList = immutable.Seq().padTo(randomHead, "0") + val tailList = immutable.Seq().padTo(randomTail, "1") + val seqRef = + system.actorOf(Props(classOf[SequencingActor], testActor, headList, tailList)) + + override def afterAll { + shutdown(system) + } + + "An EchoActor" should { + "Respond with the same message it receives" in { + within(500 millis) { + echoRef ! "test" + expectMsg("test") + } + } + } + + "A ForwardingActor" should { + "Forward a message it receives" in { + within(500 millis) { + forwardRef ! "test" + expectMsg("test") + } + } + } + + "A FilteringActor" should { + "Filter all messages, except expected messagetypes it receives" in { + var messages = Seq[String]() + within(500 millis) { + filterRef ! "test" + expectMsg("test") + filterRef ! 1 + expectNoMsg + filterRef ! "some" + filterRef ! "more" + filterRef ! 1 + filterRef ! "text" + filterRef ! 1 + + receiveWhile(500 millis) { + case msg: String => messages = msg +: messages + } + } + messages.length should be(3) + messages.reverse should be(Seq("some", "more", "text")) + } + } + "A SequencingActor" should { + "receive an interesting message at some point " in { + within(500 millis) { + ignoreMsg { + case msg: String => msg != "something" + } + seqRef ! "something" + expectMsg("something") + ignoreMsg { + case msg: String => msg == "1" + } + expectNoMsg + ignoreNoMsg + } + } + } +} + +object TestKitUsageSpec { + // Define your test specific configuration here + val config = """ + akka { + loglevel = "WARNING" + } + """ + + /** + * An Actor that echoes everything you send to it + */ + class EchoActor extends Actor { + def receive = { + case msg => sender ! msg + } + } + + /** + * An Actor that forwards every message to a next Actor + */ + class ForwardingActor(next: ActorRef) extends Actor { + def receive = { + case msg => next ! msg + } + } + + /** + * An Actor that only forwards certain messages to a next Actor + */ + class FilteringActor(next: ActorRef) extends Actor { + def receive = { + case msg: String => next ! msg + case _ => None + } + } + + /** + * An actor that sends a sequence of messages with a random head list, an + * interesting value and a random tail list. The idea is that you would + * like to test that the interesting value is received and that you cant + * be bothered with the rest + */ + class SequencingActor(next: ActorRef, head: immutable.Seq[String], + tail: immutable.Seq[String]) extends Actor { + def receive = { + case msg => { + head foreach { next ! _ } + next ! msg + tail foreach { next ! _ } + } + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala new file mode 100644 index 0000000000..155ab14e49 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala @@ -0,0 +1,8 @@ +package org.bigbluebutton.apps + +import org.scalatest.FlatSpec +import org.scalatest.BeforeAndAfterAll +import org.scalatest.WordSpec +import org.scalatest.Matchers + +class UnitSpec extends FlatSpec with Matchers with BeforeAndAfterAll \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala new file mode 100755 index 0000000000..be0b951af2 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala @@ -0,0 +1,18 @@ +package org.bigbluebutton.apps.models + +import org.specs2.mutable.Specification + + +class UsersAppSpec extends Specification { + "The UsersTrait" should { + "returns the right number of registered users" in { +// val us = new Users {} +// var ruser = new RegisteredUser("abc", "Richard") +// var guser = new RegisteredUser("abc2", "Guga") +// us.register(ruser) +// us.register(guser) +// us.registered must have size(2) + true + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala new file mode 100755 index 0000000000..ea4adcd522 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala @@ -0,0 +1,82 @@ +package org.bigbluebutton.apps.protocol + +class ClientConfigSpec { + + val clientConfig = """ +{ + "config": { + "version": "0.8", + "locale": { + "version": 0.8, + "suppressWarning": false, + "userSelectionEnabled": true + }, + "help": { + "url": "http://192.168.0.150/help.html", + "showHelpButton": true + }, + "java": { + "url": "http://192.168.0.150/testjava.html" + }, + "skinning": { + "enabled": "true", + "url": "http://192.168.0.150/client/branding/css/BBBDefault.css.swf" + }, + "layout": { + "showLogButton": true, + "showVideoLayout": "false", + "showResetLayout": "true", + "defaultLayout": "Default", + "showToolbar": true, + "showFooter": true, + "showMeetingName": true, + "showLogoutWindow": true, + "showLayoutTools": true, + "confirmLogout": true + }, + "modules": [ + { + "name": "ChatModule", + "url": "http://192.168.0.150/client/ChatModule.swf?v=VERSION", + "uri": "rtmp://192.168.0.150/bigbluebutton", + "dependsOn": "UsersModule", + "translationOn": false, + "translationEnabled": false, + "privateEnabled": true, + "position": "top-right", + "baseTabIndex": "701" + }, + { + "name": "UsersModule", + "url": "http://192.168.0.150/client/UsersModule.swf?v=VERSION", + "uri": "rtmp://192.168.0.150/bigbluebutton", + "allowKickUser": true, + "enableRaiseHand": true, + "enableSettingsButton": true, + "baseTabIndex": "301" + }, + { + "name": "DeskShareModule", + "url": "http://192.168.0.150/client/DeskShareModule.swf?v=4105", + "uri": "rtmp://192.168.0.150/deskShare", + "showButton": true, + "autoStart": false, + "autoFullScreen": false, + "baseTabIndex": "201" + }, + { + "name": "PhoneModule", + "url": "http://192.168.0.150/client/PhoneModule.swf?v=VERSION", + "uri": "rtmp://192.168.0.150/sip", + "autoJoin": true, + "skipCheck": false, + "showButton": true, + "enabledEchoCancel": true, + "dependsOn": "UsersModule" + } + ] + } +} + + """ +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala new file mode 100644 index 0000000000..2eab9cc3a6 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala @@ -0,0 +1,286 @@ +package org.bigbluebutton.apps.protocol + +trait ExampleMessageFixtures { + val invalidJSON = """{ "invalid" "Missing a colon" }""" + + val validJSON = """{ "valid" : "Valid JSON" }""" + + val invalidMessage = """ +{ + "header": { + "name": "PrivateChatMessageEvent", + "timestamp": 123456 + }, + "payload1": { + "valid": "Valid JSON" + } +} + """ + + val validMessage = """ + { + "header": { + "event": { + "name": "CreateMeetingRequest", + "timestamp": 123456, + "reply": {"to": "replyChannel", "correlationId" : "abc123"}, + "source": "web-api" + }, + "meeting": { + "name": "English 101", + "id": "english_101" + } + }, + "payload": { + "meeting": { + "name": "English 101", + "externalId": "english_101", + "record": true, + "welcomeMessage": "Welcome to English 101", + "logoutUrl": "http://www.bigbluebutton.org", + "avatarUrl": "http://www.gravatar.com/bigbluebutton", + "users": { + "max": 20, + "hardLimit": false + }, + "duration": { + "length": 120, + "allowExtend": false, + "warnBefore": 30 + }, + "voiceConf": { + "pin": 123456, + "number": 85115 + }, + "phoneNumbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customerId": "acme-customer", + "customerName": "ACME" + } + } + } + } + """ + + val createMeetingRequest = """ + { + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "create_meeting_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "external_id": "english_101", + "record": true, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.bigbluebutton.org", + "avatar_url": "http://www.gravatar.com/bigbluebutton", + "max_users": 20, + "duration": { + "length": 120, + "allow_extend": false, + "max": 240 + }, + "voice_conference": { + "pin": 123456, + "number": 85115 + }, + "phone_numbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customer_id": "acme-customer", + "customer_name": "ACME" + } + } + } + } + """ + + val invalidCreateMeetingRequest = """ + { + "header": { + "name": "CreateMeeting", + "timestamp": 123456, + "correlation": "123abc", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "externalId": "english_101", + "record": true, + "welcomeMessage": "Welcome to English 101", + "logoutUrl": "http://www.bigbluebutton.org", + "avatarUrl": "http://www.gravatar.com/bigbluebutton", + "users": { + "max": 20, + "hardLimit": false + }, + "duration": { + "length": 120, + "allowExtend": false, + "warnBefore": 30 + }, + "voiceConf": { + "pin": 123456, + "number": 85115 + }, + "phoneNumbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": [ + {"customerId": "acme-customer"}, + {"customerName": "ACME"} + ] + } + } + } + """ + + val registerUserRequestMessage = """ + { + "header": { + "event": { + "name": "register_user", + "timestamp": 123456, + "reply": { + "to": "reply_channel", + "correlation_id": "abc123" + }, + "source": "web-api" + }, + "meeting": { + "name": "English 101", + "id": "english_101", + "session": "english_101-12345" + } + }, + "payload": { + "user": { + "external_id": "user1", + "name": "Guga", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.example.com", + "avatar_url": "http://www.example.com/avatar.png" + } + } + } + """ + + val exampleChatMessage = """ + { + "header": { + "event": { + "name": "public_chat_message", + "timestamp": 123456, + "source": "web-api" + }, + "meeting": { + "name": "English 101", + "id": "english_101", + "session": "english_101-12345" + } + }, + "payload": { + "chat": { + "id": "msg1", + "sentOn": 1383210123456, + "from": { + "id": "user1", + "name": "Richard" + }, + "message": { + "text": "Hello world!", + "lang": "en_US" + }, + "font": { + "color": 16711680, + "size": 14, + "type": "Arial" + }, + "translations": [ + { + "lang": "es_LA", + "text": "Hola Mundo!" + } + ] + } + } + } + """ + + val wbmsg = """ + { + "name": "whiteboard_draw", + "timestamp": 123456, + "meeting": { + "id": "english_101", + "name": "English 101", + "session": "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1383210136298" + }, + "payload": { + "whiteboard_id": "user1-shape-1", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "text", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "font": { + "style": "arial", + "color": 0, + "size": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "text": "He" + }, + "by": { + "id": "user1", + "name": "Guga" + } + } + } + """ +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc new file mode 100644 index 0000000000..c6dafd6240 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc @@ -0,0 +1,146 @@ +package org.bigbluebutton.apps.protocol + +import com.typesafe.config.ConfigFactory +import spray.json.JsString + +object configws { + val sampleClientConfig = """ +{ + "config": { + "version": "0.8", + "locale": { + "version": 0.8, + "suppressWarning": false, + "userSelectionEnabled": true + }, + "help": { + "url": "http://192.168.0.150/help.html", + "showHelpButton": true + }, + "java": { + "url": "http://192.168.0.150/testjava.html" + }, + "skinning": { + "enabled": "true", + "url": "http://192.168.0.150/client/branding/css/BBBDefault.css.swf" + }, + "layout": { + "showLogButton": true, + "showVideoLayout": "false", + "showResetLayout": "true", + "defaultLayout": "Default", + "showToolbar": true, + "showFooter": true, + "showMeetingName": true, + "showLogoutWindow": true, + "showLayoutTools": true, + "confirmLogout": true + }, + "modules": [ + { + "name": "ChatModule", + "url": "http://192.168.0.150/client/ChatModule.swf?v=VERSION", + "uri": "rtmp://192.168.0.150/bigbluebutton", + "dependsOn": "UsersModule", + "translationOn": false, + "translationEnabled": false, + "privateEnabled": true, + "position": "top-right", + "baseTabIndex": "701" + }, + { + "name": "UsersModule", + "url": "http://192.168.0.150/client/UsersModule.swf?v=VERSION", + "uri": "rtmp://192.168.0.150/bigbluebutton", + "allowKickUser": true, + "enableRaiseHand": true, + "enableSettingsButton": true, + "baseTabIndex": "301" + }, + { + "name": "DeskShareModule", + "url": "http://192.168.0.150/client/DeskShareModule.swf?v=4105", + "uri": "rtmp://192.168.0.150/deskShare", + "showButton": true, + "autoStart": false, + "autoFullScreen": false, + "baseTabIndex": "201" + }, + { + "name": "PhoneModule", + "url": "http://192.168.0.150/client/PhoneModule.swf?v=VERSION", + "uri": "rtmp://192.168.0.150/sip", + "autoJoin": true, + "skipCheck": false, + "showButton": true, + "enabledEchoCancel": true, + "dependsOn": "UsersModule" + } + ] + } +} + + """ //> sampleClientConfig : String = " + //| { + //| "config": { + //| "version": "0.8", + //| "locale": { + //| "version": 0.8, + //| "suppressWarning": false, + //| "userSelectionEnabled": true + //| }, + //| "help": { + //| "url": "http://192.168.0.150/help.html", + //| "showHelpButton": true + //| }, + //| "java": { + //| "url": "http://192.168.0.150/testjava.html" + //| }, + //| "skinning": { + //| "enabled": "true", + //| "url": "http://192.168.0.150/client/branding/css/BBBDefault.css + //| .swf" + //| }, + //| "layout": { + //| "showLogButton": true, + //| "showVideoLayout": "false", + //| "showResetLayout": "true", + //| "defaultLayout": "Default", + //| "showToolbar": true, + //| "showFooter": true, + //| "showMeetingName": true, + //| + //| Output exceeds cutoff limit. + + val conf = ConfigFactory.parseString(sampleClientConfig) + //> conf : com.typesafe.config.Config = Config(SimpleConfigObject({"config":{" + //| help":{"showHelpButton":true,"url":"http://192.168.0.150/help.html"},"skinn + //| ing":{"enabled":"true","url":"http://192.168.0.150/client/branding/css/BBBD + //| efault.css.swf"},"layout":{"showLayoutTools":true,"showToolbar":true,"showF + //| ooter":true,"showResetLayout":"true","showVideoLayout":"false","showLogButt + //| on":true,"defaultLayout":"Default","showLogoutWindow":true,"showMeetingName + //| ":true,"confirmLogout":true},"locale":{"suppressWarning":false,"userSelecti + //| onEnabled":true,"version":0.8},"java":{"url":"http://192.168.0.150/testjava + //| .html"},"modules":[{"position":"top-right","translationEnabled":false,"base + //| TabIndex":"701","name":"ChatModule","privateEnabled":true,"dependsOn":"User + //| sModule","uri":"rtmp://192.168.0.150/bigbluebutton","url":"http://192.168.0 + //| .150/client/ChatModule.swf?v=VERSION","translationOn":false},{"baseTabIndex + //| ":"301","name":"UsersMo + //| Output exceeds cutoff limit. + + val jsString = JsString(sampleClientConfig) //> jsString : spray.json.JsString = "\n{\n \"config\": {\n \"versio + //| n\": \"0.8\",\n \"locale\": {\n \"version\": 0.8,\n + //| \"suppressWarning\": false,\n \"userSelectionEnabled\": tr + //| ue\n },\n \"help\": {\n \"url\": \"http://192.168. + //| 0.150/help.html\",\n \"showHelpButton\": true\n },\n + //| \"java\": {\n \"url\": \"http://192.168.0.150/testjava.html\" + //| \n },\n \"skinning\": {\n \"enabled\": \"true\",\n + //| \"url\": \"http://192.168.0.150/client/branding/css/BBBDefault. + //| css.swf\"\n },\n \"layout\": {\n \"showLogButton\" + //| : true,\n \"showVideoLayout\": \"false\",\n \"showRes + //| etLayout\": \"true\",\n \"defaultLayout\": \"Default\",\n + //| \"showToolbar\": true,\n \"showFooter\": true,\n + //| \"showMeetingName\": t + //| Output exceeds cutoff limit. + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc new file mode 100644 index 0000000000..8d767225fb --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc @@ -0,0 +1,199 @@ +package org.bigbluebutton.apps.protocol + +import spray.json._ +import spray.json.JsonParser +import org.bigbluebutton.apps.models.MeetingConfig +import org.bigbluebutton.apps.protocol._ +import org.bigbluebutton.apps.models.MeetingSession +import org.bigbluebutton.apps.models.UsersConfig +import org.bigbluebutton.apps.models.DurationConfig +import org.bigbluebutton.apps.models.VoiceConfig +import org.bigbluebutton.apps.models.PhoneNumberConfig +import spray.json.DefaultJsonProtocol + +object createmeetingrequestWS { + val createMeetingRequestMsg = """ +{ + "header": { + "name": "CreateMeeting", + "timestamp": 123456, + "correlation": "123abc", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "externalId": "english_101", + "record": true, + "welcomeMessage": "Welcome to English 101", + "logoutUrl": "http://www.bigbluebutton.org", + "avatarUrl": "http://www.gravatar.com/bigbluebutton", + "users": { + "max": 20, + "hardLimit": false + }, + "duration": { + "length": 120, + "allowExtend": false, + "warnBefore": 30 + }, + "voiceConf": { + "pin": 123456, + "number": 85115 + }, + "phoneNumbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customerId": "acme-customer", + "customerName": "ACME" + } + } + } +} + """ //> createMeetingRequestMsg : String = " + //| { + //| "header": { + //| "name": "CreateMeeting", + //| "timestamp": 123456, + //| "correlation": "123abc", + //| "source": "web-api" + //| }, + //| "payload": { + //| "meeting": { + //| "name": "English 101", + //| "externalId": "english_101", + //| "record": true, + //| "welcomeMessage": "Welcome to English 101", + //| "logoutUrl": "http://www.bigbluebutton.org", + //| "avatarUrl": "http://www.gravatar.com/bigbluebutton", + //| "users": { + //| "max": 20, + //| "hardLimit": false + //| }, + //| "duration": { + //| "length": 120, + //| "allowExtend": false, + //| "warnBefore": 30 + //| }, + //| "voiceConf": { + //| "pin": 123456, + //| "number": 85115 + //| }, + + import CreateMeetingRequestJsonProtocol1._ + + val jsonAst = JsonParser(createMeetingRequestMsg) + //> jsonAst : spray.json.JsValue = {"header":{"name":"CreateMeeting","timestam + //| p":123456,"correlation":"123abc","source":"web-api"},"payload":{"meeting":{ + //| "name":"English 101","externalId":"english_101","record":true,"welcomeMessa + //| ge":"Welcome to English 101","logoutUrl":"http://www.bigbluebutton.org","av + //| atarUrl":"http://www.gravatar.com/bigbluebutton","users":{"max":20,"hardLim + //| it":false},"duration":{"length":120,"allowExtend":false,"warnBefore":30},"v + //| oiceConf":{"pin":123456,"number":85115},"phoneNumbers":[{"number":"613-520- + //| 7600","description":"Ottawa"},{"number":"1-888-555-7890","description":"NA + //| Toll-Free"}],"metadata":{"customerId":"acme-customer","customerName":"ACME" + //| }}}} + val jsonObj = jsonAst.asJsObject //> jsonObj : spray.json.JsObject = {"header":{"name":"CreateMeeting","timesta + //| mp":123456,"correlation":"123abc","source":"web-api"},"payload":{"meeting": + //| {"name":"English 101","externalId":"english_101","record":true,"welcomeMess + //| age":"Welcome to English 101","logoutUrl":"http://www.bigbluebutton.org","a + //| vatarUrl":"http://www.gravatar.com/bigbluebutton","users":{"max":20,"hardLi + //| mit":false},"duration":{"length":120,"allowExtend":false,"warnBefore":30}," + //| voiceConf":{"pin":123456,"number":85115},"phoneNumbers":[{"number":"613-520 + //| -7600","description":"Ottawa"},{"number":"1-888-555-7890","description":"NA + //| Toll-Free"}],"metadata":{"customerId":"acme-customer","customerName":"ACME + //| "}}}} + val payloadObj = jsonObj.fields.get("payload").get.asJsObject + //> payloadObj : spray.json.JsObject = {"meeting":{"name":"English 101","exter + //| nalId":"english_101","record":true,"welcomeMessage":"Welcome to English 101 + //| ","logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://www.gravat + //| ar.com/bigbluebutton","users":{"max":20,"hardLimit":false},"duration":{"len + //| gth":120,"allowExtend":false,"warnBefore":30},"voiceConf":{"pin":123456,"nu + //| mber":85115},"phoneNumbers":[{"number":"613-520-7600","description":"Ottawa + //| "},{"number":"1-888-555-7890","description":"NA Toll-Free"}],"metadata":{"c + //| ustomerId":"acme-customer","customerName":"ACME"}}} + val headerObj = jsonObj.fields.get("header").get.asJsObject + //> headerObj : spray.json.JsObject = {"name":"CreateMeeting","timestamp":1234 + //| 56,"correlation":"123abc","source":"web-api"} + val meeting = payloadObj.fields.get("meeting") + //> meeting : Option[spray.json.JsValue] = Some({"name":"English 101","externa + //| lId":"english_101","record":true,"welcomeMessage":"Welcome to English 101", + //| "logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://www.gravatar + //| .com/bigbluebutton","users":{"max":20,"hardLimit":false},"duration":{"lengt + //| h":120,"allowExtend":false,"warnBefore":30},"voiceConf":{"pin":123456,"numb + //| er":85115},"phoneNumbers":[{"number":"613-520-7600","description":"Ottawa"} + //| ,{"number":"1-888-555-7890","description":"NA Toll-Free"}],"metadata":{"cus + //| tomerId":"acme-customer","customerName":"ACME"}}) + if (meeting != None) { + val m = meeting.get.convertTo[MeetingConfig] + } else { + None + } //> res0: Any = () + +case class Color(name: String, red: Int, green: Int, blue: Int) + +object MyJsonProtocol extends DefaultJsonProtocol { + implicit val colorFormat = jsonFormat4(Color) +} + +import MyJsonProtocol._ + +val json = Color("CadetBlue", 95, 158, 160).toJson//> json : spray.json.JsValue = {"name":"CadetBlue","red":95,"green":158,"blue + //| ":160} +val color = json.convertTo[Color] //> color : org.bigbluebutton.apps.protocol.createmeetingrequestWS.Color = Col + //| or(CadetBlue,95,158,160) + + val session = MeetingSession("English 101", "english_101", "english101-123456") + //> session : org.bigbluebutton.apps.models.MeetingSession = MeetingSession(En + //| glish 101,english_101,english101-123456) + + val usersConfig = UsersConfig(20, true) //> usersConfig : org.bigbluebutton.apps.models.UsersConfig = UsersConfig(20,t + //| rue) + val durationConfig = DurationConfig(320, true, 30) + //> durationConfig : org.bigbluebutton.apps.models.DurationConfig = DurationCo + //| nfig(320,true,30) + val voiceConfig = VoiceConfig(12345, 85115) //> voiceConfig : org.bigbluebutton.apps.models.VoiceConfig = VoiceConfig(1234 + //| 5,85115) + val phone1 = PhoneNumberConfig("613-520-5555", "Ottawa") + //> phone1 : org.bigbluebutton.apps.models.PhoneNumberConfig = PhoneNumberConf + //| ig(613-520-5555,Ottawa) + val phone2 = PhoneNumberConfig("1-800-bbb-conf", "Toll Free") + //> phone2 : org.bigbluebutton.apps.models.PhoneNumberConfig = PhoneNumberConf + //| ig(1-800-bbb-conf,Toll Free) + val metadata = Map("customerId" -> "acme-customer", "customerName" -> "ACME") + //> metadata : scala.collection.immutable.Map[String,String] = Map(customerId + //| -> acme-customer, customerName -> ACME) + + val meetingConfig = MeetingConfig("English 101", "english_101", true, + "Welcome to English 101", "http://www.bigbluebutton.org", + "http://www.gravatar.com/bigbluebutton", + usersConfig, durationConfig, voiceConfig, + Seq(phone1, phone2), metadata) //> meetingConfig : org.bigbluebutton.apps.models.MeetingConfig = MeetingConfi + //| g(English 101,english_101,true,Welcome to English 101,http://www.bigbluebut + //| ton.org,http://www.gravatar.com/bigbluebutton,UsersConfig(20,true),Duration + //| Config(320,true,30),VoiceConfig(12345,85115),List(PhoneNumberConfig(613-520 + //| -5555,Ottawa), PhoneNumberConfig(1-800-bbb-conf,Toll Free)),Map(customerId + //| -> acme-customer, customerName -> ACME)) + + import org.bigbluebutton.apps.protocol.MyJsonProtocol._ + val reply = CreateMeetingRequestReply(session, meetingConfig).toJson + //> reply : spray.json.JsValue = {"session":{"name":"English 101","externalId" + //| :"english_101","session":"english101-123456"},"meeting":{"name":"English 10 + //| 1","externalId":"english_101","record":true,"welcomeMessage":"Welcome to En + //| glish 101","logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://w + //| ww.gravatar.com/bigbluebutton","users":{"max":20,"hardLimit":true},"duratio + //| n":{"length":320,"allowExtend":true,"warnBefore":30},"voiceConf":{"pin":123 + //| 45,"number":85115},"phoneNumbers":[{"number":"613-520-5555","description":" + //| Ottawa"},{"number":"1-800-bbb-conf","description":"Toll Free"}],"metadata": + //| {"customerId":"acme-customer","customerName":"ACME"}}} + + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc new file mode 100644 index 0000000000..6163abe4bb --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc @@ -0,0 +1,43 @@ +package org.bigbluebutton.apps.protocol + +import org.bigbluebutton.apps.protocol._ + +object extractorsws { + + case class Header1(name: String, timestamp: Long, + correlation: String, source: String, + meeting: Option[HeaderMeeting1]) + + case class HeaderMeeting1(name: String, externalId: String, sessionId: String) + + val headerMeeting = HeaderMeeting1("English 101", "english_101", "english_101-123456") + //> headerMeeting : org.bigbluebutton.apps.protocol.extractorsws.HeaderMeeting1 + //| = HeaderMeeting1(English 101,english_101,english_101-123456) + val header1 = Header1("RegisterUserRequest", 1234567L, "123abc", "bbb-apps", Some(headerMeeting)) + //> header1 : org.bigbluebutton.apps.protocol.extractorsws.Header1 = Header1(Re + //| gisterUserRequest,1234567,123abc,bbb-apps,Some(HeaderMeeting1(English 101,en + //| glish_101,english_101-123456))) + header1 match { + case Header1(name, _, _, _, Some(meeting)) => println(meeting) + case Header1(name, _, _, _, None) => println("no meeting") + } //> HeaderMeeting1(English 101,english_101,english_101-123456) + + val header2 = Header1("RegisterUserRequest", 1234567L, "123abc", "bbb-apps", None) + //> header2 : org.bigbluebutton.apps.protocol.extractorsws.Header1 = Header1(Re + //| gisterUserRequest,1234567,123abc,bbb-apps,None) + + header2 match { + case Header1(name, _, _, _, Some(meeting)) => println(meeting) + case Header1(name, _, _, _, None) => println("no meeting") + } //> no meeting + + val from = "abc" //> from : String = abc + val to = "abd" //> to : String = abd + val from1 = new scala.collection.immutable.StringOps(from) + //> from1 : scala.collection.immutable.StringOps = abc + val to1 = new scala.collection.immutable.StringOps(to) + //> to1 : scala.collection.immutable.StringOps = abd + + from1 < to1 //> res0: Boolean = true + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc new file mode 100644 index 0000000000..7c4f1656f5 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc @@ -0,0 +1,48 @@ +package org.bigbluebutton.apps.protocol + +object futureandpromise { + import scala.util.Try + // Some type aliases, just for getting more meaningful method signatures: + type CoffeeBeans = String + type GroundCoffee = String + case class Water(temperature: Int) + type Milk = String + type FrothedMilk = String + type Espresso = String + type Cappuccino = String + // dummy implementations of the individual steps: + def grind(beans: CoffeeBeans): GroundCoffee = s"ground coffee of $beans" + //> grind: (beans: org.bigbluebutton.apps.protocol.futureandpromise.CoffeeBeans) + //| org.bigbluebutton.apps.protocol.futureandpromise.GroundCoffee + def heatWater(water: Water): Water = water.copy(temperature = 85) + //> heatWater: (water: org.bigbluebutton.apps.protocol.futureandpromise.Water)or + //| g.bigbluebutton.apps.protocol.futureandpromise.Water + def frothMilk(milk: Milk): FrothedMilk = s"frothed $milk" + //> frothMilk: (milk: org.bigbluebutton.apps.protocol.futureandpromise.Milk)org. + //| bigbluebutton.apps.protocol.futureandpromise.FrothedMilk + def brew(coffee: GroundCoffee, heatedWater: Water): Espresso = "espresso" + //> brew: (coffee: org.bigbluebutton.apps.protocol.futureandpromise.GroundCoffee + //| , heatedWater: org.bigbluebutton.apps.protocol.futureandpromise.Water)org.bi + //| gbluebutton.apps.protocol.futureandpromise.Espresso + def combine(espresso: Espresso, frothedMilk: FrothedMilk): Cappuccino = "cappuccino" + //> combine: (espresso: org.bigbluebutton.apps.protocol.futureandpromise.Espress + //| o, frothedMilk: org.bigbluebutton.apps.protocol.futureandpromise.FrothedMilk + //| )org.bigbluebutton.apps.protocol.futureandpromise.Cappuccino + // some exceptions for things that might go wrong in the individual steps + // (we'll need some of them later, use the others when experimenting + // with the code): + case class GrindingException(msg: String) extends Exception(msg) + case class FrothingException(msg: String) extends Exception(msg) + case class WaterBoilingException(msg: String) extends Exception(msg) + case class BrewingException(msg: String) extends Exception(msg) + // going through these steps sequentially: + def prepareCappuccino(): Try[Cappuccino] = for { + ground <- Try(grind("arabica beans")) + water <- Try(heatWater(Water(25))) + espresso <- Try(brew(ground, water)) + foam <- Try(frothMilk("milk")) + } yield combine(espresso, foam) //> prepareCappuccino: ()scala.util.Try[org.bigbluebutton.apps.protocol.futurea + //| ndpromise.Cappuccino] + prepareCappuccino() //> res0: scala.util.Try[org.bigbluebutton.apps.protocol.futureandpromise.Cappu + //| ccino] = Success(cappuccino) +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc new file mode 100644 index 0000000000..8d40c6ed68 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc @@ -0,0 +1,72 @@ +package org.bigbluebutton.apps.protocol + +import scala.concurrent.Await +import scala.concurrent.Future +import scala.concurrent.duration._ +import akka.util.Timeout +import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.{ ExecutionContext, Promise } +import scala.util.{Success, Failure} + +object futuretesting { + + implicit val timeout = Timeout(5 seconds) //> timeout : akka.util.Timeout = Timeout(5 seconds) + +// val f = Promise.successful("foo") + + val future = Future { + "Hello" + "World" + } //> future : scala.concurrent.Future[String] = scala.concurrent.impl.Promise$De + //| faultPromise@610ac287 + + future foreach println + + future onComplete { + case Success(result) => println("RESULT: " + result) + case Failure(failure) => println("FAIL: " + failure) + } //> HelloWorld + + + case class Email( + subject: String, + text: String, + sender: String, + recipient: String) + + type EmailFilter = Email => Boolean + + def newMailsForUser(mails: Seq[Email], f: EmailFilter) = mails.filter(f) + //> newMailsForUser: (mails: Seq[org.bigbluebutton.apps.protocol.futuretesting.E + //| mail], f: org.bigbluebutton.apps.protocol.futuretesting.Email => Boolean)Seq + //| [org.bigbluebutton.apps.protocol.futuretesting.Email] + + val sentByOneOf: Set[String] => EmailFilter = + senders => email => senders.contains(email.sender) + //> RESULT: HelloWorld + //| sentByOneOf : Set[String] => (org.bigbluebutton.apps.protocol.futuretesting + //| .Email => Boolean) = + val notSentByAnyOf: Set[String] => EmailFilter = + senders => email => !senders.contains(email.sender) + //> notSentByAnyOf : Set[String] => (org.bigbluebutton.apps.protocol.futuretes + //| ting.Email => Boolean) = + val minimumSize: Int => EmailFilter = n => email => email.text.size >= n + //> minimumSize : Int => (org.bigbluebutton.apps.protocol.futuretesting.Email + //| => Boolean) = + val maximumSize: Int => EmailFilter = n => email => email.text.size <= n + //> maximumSize : Int => (org.bigbluebutton.apps.protocol.futuretesting.Email + //| => Boolean) = + + val emailFilter: EmailFilter = notSentByAnyOf(Set("johndoe@example.com")) + //> emailFilter : org.bigbluebutton.apps.protocol.futuretesting.Email => Boole + //| an = + val mails = Email( + subject = "It's me again, your stalker friend!", + text = "Hello my friend! How are you?", + sender = "johndoe@example.com", + recipient = "me@example.com") :: Nil + //> mails : List[org.bigbluebutton.apps.protocol.futuretesting.Email] = List(E + //| mail(It's me again, your stalker friend!,Hello my friend! How are you?,john + //| doe@example.com,me@example.com)) + newMailsForUser(mails, emailFilter) //> res0: Seq[org.bigbluebutton.apps.protocol.futuretesting.Email] = List() + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc new file mode 100644 index 0000000000..a0babcd52f --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc @@ -0,0 +1,118 @@ +package org.bigbluebutton.apps.protocol + +import spray.json._ +import spray.json.DefaultJsonProtocol +import org.bigbluebutton.apps.models.UsersApp.JoinedUser +import org.bigbluebutton.apps.models.UsersApp.User +import org.bigbluebutton.apps.models.Role +import org.bigbluebutton.apps.models.UsersApp.{WebIdentity, CallerId, VoiceIdentity} +import org.bigbluebutton.apps.protocol.UserMessages.{JoinUserReply, JoinUserResponse} + +object joinuserrep { + + import UserMessagesProtocol._ + import HeaderAndPayloadJsonSupport._ + import DefaultJsonProtocol._ + + val replyHeader = ReplyHeader("replyChannel", "abc123") + //> replyHeader : org.bigbluebutton.apps.protocol.ReplyHeader = ReplyHeader(rep + //| lyChannel,abc123) + val headerMeeting = HeaderMeeting("English 101", "english_101", Some("english_101-12345")) + //> headerMeeting : org.bigbluebutton.apps.protocol.HeaderMeeting = HeaderMeeti + //| ng(English 101,english_101,Some(english_101-12345)) + val headerEvent = HeaderEvent("CreateMeetingRequest", 123456, "web-api", Some(replyHeader)) + //> headerEvent : org.bigbluebutton.apps.protocol.HeaderEvent = HeaderEvent(Cre + //| ateMeetingRequest,123456,web-api,Some(ReplyHeader(replyChannel,abc123))) + val header = Header(headerEvent, headerMeeting)//> header : org.bigbluebutton.apps.protocol.Header = Header(HeaderEvent(Create + //| MeetingRequest,123456,web-api,Some(ReplyHeader(replyChannel,abc123))),Header + //| Meeting(English 101,english_101,Some(english_101-12345))) + header.toJson //> res0: spray.json.JsValue = {"event":{"name":"CreateMeetingRequest","timestam + //| p":123456,"source":"web-api","reply":{"to":"replyChannel","correlationId":"a + //| bc123"}},"meeting":{"name":"English 101","externalId":"english_101","session + //| Id":"english_101-12345"}} + + + + val user = User("user1", "Guga", Role.MODERATOR, 85115, "Welcome to English 101", + "http://www.example.com", "http://www.example.com/avatar.png") + //> user : org.bigbluebutton.apps.models.UsersApp.User = User(user1,Guga,MODER + //| ATOR,85115,Welcome to English 101,http://www.example.com,http://www.example + //| .com/avatar.png) + + val webId = WebIdentity("RichWeb") //> webId : org.bigbluebutton.apps.models.UsersApp.WebIdentity = WebIdentity(R + //| ichWeb) + val callerId = CallerId("Richard", "6135207610")//> callerId : org.bigbluebutton.apps.models.UsersApp.CallerId = CallerId(Rich + //| ard,6135207610) + val voiceId = VoiceIdentity("Richard", callerId)//> voiceId : org.bigbluebutton.apps.models.UsersApp.VoiceIdentity = VoiceIden + //| tity(Richard,CallerId(Richard,6135207610)) + +// val juser = JoinedUser("user1", "usertoken", user, false, None, None) +// juser.toJson +// val jurPayload = JoinUserReplyPayload(false, "Successfully joined user.", None) + +// val jur = JoinUserReply(header, jurPayload) +// jur.toJson + + val juser1 = JoinedUser("user1", "usertoken", user, false, Some(webId), Some(voiceId)) + //> juser1 : org.bigbluebutton.apps.models.UsersApp.JoinedUser = JoinedUser(us + //| er1,usertoken,User(user1,Guga,MODERATOR,85115,Welcome to English 101,http:/ + //| /www.example.com,http://www.example.com/avatar.png),false,Some(WebIdentity( + //| RichWeb)),Some(VoiceIdentity(Richard,CallerId(Richard,6135207610)))) + + juser1.toJson //> res1: spray.json.JsValue = {"id":"user1","token":"usertoken","user":{"exter + //| nalId":"user1","name":"Guga","role":"MODERATOR","pin":85115,"welcomeMessage + //| ":"Welcome to English 101","logoutUrl":"http://www.example.com","avatarUrl" + //| :"http://www.example.com/avatar.png"},"isPresenter":false,"webIdent":{"name + //| ":"RichWeb"},"voiceIdent":{"name":"Richard","callerId":{"name":"Richard","n + //| umber":"6135207610"}}} + +// val jur1Payload = JoinUserReplyPayload( true, "Successfully joined user.", Some(juser1)) +// val jur1 = JoinUserReply(header, jur1Payload) +// jur1.toJson + + + val statusCode = StatusCode(StatusCodes.NOT_FOUND.id, + StatusCodes.NOT_FOUND.toString()) + //> statusCode : org.bigbluebutton.apps.protocol.StatusCode = StatusCode(404,N + //| ot Found) + val errorCode = ErrorCode(ErrorCodes.INVALID_TOKEN.id, + ErrorCodes.INVALID_TOKEN.toString()) + //> errorCode : org.bigbluebutton.apps.protocol.ErrorCode = ErrorCode(1,Invali + //| d or expired token) + val response = Response(status = statusCode, + errors = Some(Seq(errorCode))) + //> response : org.bigbluebutton.apps.protocol.Response = Response(StatusCode( + //| 404,Not Found),Some(List(ErrorCode(1,Invalid or expired token)))) + + val jur2 = JoinUserResponse(response, "mytoken", Some(juser1)) + //> jur2 : org.bigbluebutton.apps.protocol.UserMessages.JoinUserResponse = Joi + //| nUserResponse(Response(StatusCode(404,Not Found),Some(List(ErrorCode(1,Inva + //| lid or expired token)))),mytoken,Some(JoinedUser(user1,usertoken,User(user1 + //| ,Guga,MODERATOR,85115,Welcome to English 101,http://www.example.com,http:// + //| www.example.com/avatar.png),false,Some(WebIdentity(RichWeb)),Some(VoiceIden + //| tity(Richard,CallerId(Richard,6135207610)))))) + + val finalReply = JoinUserReply(header, jur2).toJson + //> finalReply : spray.json.JsValue = {"header":{"event":{"name":"CreateMeetin + //| gRequest","timestamp":123456,"source":"web-api","reply":{"to":"replyChannel + //| ","correlationId":"abc123"}},"meeting":{"name":"English 101","externalId":" + //| english_101","sessionId":"english_101-12345"}},"payload":{"response":{"stat + //| us":{"code":404,"message":"Not Found"},"errors":[{"code":1,"message":"Inval + //| id or expired token"}]},"token":"mytoken","joinedUser":{"id":"user1","token + //| ":"usertoken","user":{"externalId":"user1","name":"Guga","role":"MODERATOR" + //| ,"pin":85115,"welcomeMessage":"Welcome to English 101","logoutUrl":"http:// + //| www.example.com","avatarUrl":"http://www.example.com/avatar.png"},"isPresen + //| ter":false,"webIdent":{"name":"RichWeb"},"voiceIdent":{"name":"Richard","ca + //| llerId":{"name":"Richard","number":"6135207610"}}}}} + val failure = JsString( + """Malformed message: [{"meeting1":{"name":"English 101","externalId":"english_101","record":true,"welcomeMessage":"Welcome to English 101","logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://www.gravatar.com/bigbluebutton","users":{"max":20,"hardLimit":false},"duration":{"length":120,"allowExtend":false,"warnBefore":30},"voiceConf":{"pin":123456,"number":85115},"phoneNumbers":[{"number":"613-520-7600","description":"Ottawa"},{"number":"1-888-555-7890","description":"NA Toll-Free"}],"metadata":{"customerId":"acme-customer","customerName":"ACME"}}}]""") + //> failure : spray.json.JsString = "Malformed message: [{\"meeting1\":{\"name + //| \":\"English 101\",\"externalId\":\"english_101\",\"record\":true,\"welcome + //| Message\":\"Welcome to English 101\",\"logoutUrl\":\"http://www.bigbluebutt + //| on.org\",\"avatarUrl\":\"http://www.gravatar.com/bigbluebutton\",\"users\": + //| {\"max\":20,\"hardLimit\":false},\"duration\":{\"length\":120,\"allowExtend + //| \":false,\"warnBefore\":30},\"voiceConf\":{\"pin\":123456,\"number\":85115} + //| ,\"phoneNumbers\":[{\"number\":\"613-520-7600\",\"description\":\"Ottawa\"} + //| ,{\"number\":\"1-888-555-7890\",\"description\":\"NA Toll-Free\"}],\"metada + //| ta\":{\"customerId\":\"acme-customer\",\"customerName\":\"ACME\"}}}]" +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc new file mode 100644 index 0000000000..05215061b7 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc @@ -0,0 +1,134 @@ +package org.bigbluebutton.apps.protocol + +import spray.json._ +import org.bigbluebutton.apps.models._ + + + +object whiteboardmsgws { + val wbmsg = """ +{ + + "id": "user1-shape-1", + "correlationId": "q779ogycfmxk-13-1383262166102", + "type": "text", + "data": { + "coordinate": { + "firstX": 0.016025641025641028, + "firstY": 0.982905982905983, + "lastX": 1.33, + "lastY": 2.45 + }, + "font": { + "color": 0, + "size": 18 + }, + "background": true, + "backgroundColor": 16777215, + "text": "He" + }, + "by": { + "id": "user1", + "name": "Guga" + } + +} + """ //> wbmsg : String = " + //| { + //| + //| "id": "user1-shape-1", + //| "correlationId": "q779ogycfmxk-13-1383262166102", + //| "type": "text", + //| "data": { + //| "coordinate": { + //| "firstX": 0.016025641025641028, + //| "firstY": 0.982905982905983, + //| "lastX": 1.33, + //| "lastY": 2.45 + //| }, + //| "font": { + //| "color": 0, + //| "size": 18 + //| }, + //| "background": true, + //| "backgroundColor": 16777215, + //| "text": "He" + //| }, + //| "by": { + //| "id": "user1", + //| "name": "Guga" + //| } + //| + //| } + //| " + + case class Shape(id: String, correlationId: String, data: Map[String, String], by: Map[String, String]) + + object ShapeJsonProtocol extends DefaultJsonProtocol { + implicit val shapeFormat = jsonFormat4(Shape) + } + + import ShapeJsonProtocol._ + + val jsonAst = JsonParser(wbmsg) //> jsonAst : spray.json.JsValue = {"id":"user1-shape-1","correlationId":"q779 + //| ogycfmxk-13-1383262166102","type":"text","data":{"coordinate":{"firstX":0.0 + //| 16025641025641028,"firstY":0.982905982905983,"lastX":1.33,"lastY":2.45},"fo + //| nt":{"color":0,"size":18},"background":true,"backgroundColor":16777215,"tex + //| t":"He"},"by":{"id":"user1","name":"Guga"}} + val jsonObj = jsonAst.asJsObject //> jsonObj : spray.json.JsObject = {"id":"user1-shape-1","correlationId":"q77 + //| 9ogycfmxk-13-1383262166102","type":"text","data":{"coordinate":{"firstX":0. + //| 016025641025641028,"firstY":0.982905982905983,"lastX":1.33,"lastY":2.45},"f + //| ont":{"color":0,"size":18},"background":true,"backgroundColor":16777215,"te + //| xt":"He"},"by":{"id":"user1","name":"Guga"}} + val typeObj = jsonObj.fields.get("type").get //> typeObj : spray.json.JsValue = "text" + val dataObj = jsonObj.fields.get("data").get.asJsObject + //> dataObj : spray.json.JsObject = {"coordinate":{"firstX":0.0160256410256410 + //| 28,"firstY":0.982905982905983,"lastX":1.33,"lastY":2.45},"font":{"color":0, + //| "size":18},"background":true,"backgroundColor":16777215,"text":"He"} + + val userJoinMessage = """ + { + "name": "user_join", + "timestamp": 123456, + "meeting": { + "id": "english_101", + "name": "English 101", + "session": "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1383210136298" + }, + "payload": { + "token": "user1-token-1" + } + } + + """ //> userJoinMessage : String = " + //| { + //| "name": "user_join", + //| "timestamp": 123456, + //| "meeting": { + //| "id": "english_101", + //| "name": "English 101", + //| "session": "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-138321013629 + //| 8" + //| }, + //| "payload": { + //| "token": "user1-token-1" + //| } + //| } + //| + //| " + val userJoinAst = JsonParser(userJoinMessage).asJsObject + //> userJoinAst : spray.json.JsObject = {"name":"user_join","timestamp":123456 + //| ,"meeting":{"id":"english_101","name":"English 101","session":"183f0bf3a098 + //| 2a127bdb8161e0c44eb696b3e75c-1383210136298"},"payload":{"token":"user1-toke + //| n-1"}} + val tokenObj = userJoinAst.fields.get("payload").get.asJsObject + //> tokenObj : spray.json.JsObject = {"token":"user1-token-1"} + val tokenVal = tokenObj.fields.get("token").get.prettyPrint + //> tokenVal : String = "user1-token-1" + + + + + + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc new file mode 100644 index 0000000000..ee72606983 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc @@ -0,0 +1,114 @@ +package org.bigbluebutton.apps.users.data + +import spray.json._ +import spray.json.DefaultJsonProtocol._ +import org.bigbluebutton.apps.protocol._ + +object usersmsgWS1 { + + object Role extends Enumeration { + type RoleType = Value + val MODERATOR = Value("MODERATOR") + val VIEWER = Value("VIEWER") + } + case class Session(id: String, meetingId: String, meetingName: String) + case class WebIdentity(handRaised: Boolean = false) + + case class CallerId(name: String, number: String) + case class VoiceIdentity(callerId: CallerId, muted: Boolean = false, + locked: Boolean = false, talking: Boolean = false, + metadata: Map[String, String]) + + case class UserIdAndName(id: String, name: String) + + object SystemUser extends UserIdAndName(id = "system", name = "System") + + case class JoinedUser(id: String, token: String, user: User, + isPresenter: Boolean = false, + webIdentity: WebIdentity, + voiceIdentity: VoiceIdentity) + + case class RegisteredUser(token: String, user: User) + + case class User(externalId: String, name: String, + role: Role.RoleType, pin: Int, welcomeMessage: String, + logoutUrl: String, avatarUrl: String) + + case class Presenter(presenter: UserIdAndName, assignedBy: UserIdAndName) + case class UserJoined(session: Session, token: String, joinedUser: JoinedUser) + + val eng101Session = Session("english_101-1234", "english_101", "English 101") + //> eng101Session : org.bigbluebutton.apps.users.data.usersmsgWS1.Session = Se + //| ssion(english_101-1234,english_101,English 101) + val userJuan = User("userjuan", "Juan Tamad", + Role.MODERATOR, 12345, + "Welcome Juan", + "http://www.umaliska.don", + "http://www.mukhamo.com/unggoy")//> userJuan : org.bigbluebutton.apps.users.data.usersmsgWS1.User = User(userj + //| uan,Juan Tamad,MODERATOR,12345,Welcome Juan,http://www.umaliska.don,http:// + //| www.mukhamo.com/unggoy) + val juanWebIdentity = WebIdentity(false) //> juanWebIdentity : org.bigbluebutton.apps.users.data.usersmsgWS1.WebIdentit + //| y = WebIdentity(false) + val juanCallerId = CallerId("Juan Tamad", "011-63-917-555-1234") + //> juanCallerId : org.bigbluebutton.apps.users.data.usersmsgWS1.CallerId = Ca + //| llerId(Juan Tamad,011-63-917-555-1234) + val juanVoiceMeta = Map("userid" -> "1", "conference_num" -> "85115") + //> juanVoiceMeta : scala.collection.immutable.Map[String,String] = Map(userid + //| -> 1, conference_num -> 85115) + val juanVoiceIdentity = VoiceIdentity(juanCallerId, false, + false, false, juanVoiceMeta) + //> juanVoiceIdentity : org.bigbluebutton.apps.users.data.usersmsgWS1.VoiceIde + //| ntity = VoiceIdentity(CallerId(Juan Tamad,011-63-917-555-1234),false,false, + //| false,Map(userid -> 1, conference_num -> 85115)) + + val joinedUserJuan = JoinedUser("juanid", "juanToken", userJuan, + true, juanWebIdentity, juanVoiceIdentity) + //> joinedUserJuan : org.bigbluebutton.apps.users.data.usersmsgWS1.JoinedUser + //| = JoinedUser(juanid,juanToken,User(userjuan,Juan Tamad,MODERATOR,12345,Welc + //| ome Juan,http://www.umaliska.don,http://www.mukhamo.com/unggoy),true,WebIde + //| ntity(false),VoiceIdentity(CallerId(Juan Tamad,011-63-917-555-1234),false,f + //| alse,false,Map(userid -> 1, conference_num -> 85115))) + +object UserMessagesProtocol1 extends DefaultJsonProtocol { + implicit object RoleJsonFormat extends JsonFormat[Role.RoleType] { + def write(obj: Role.RoleType): JsValue = JsString(obj.toString) + + def read(json: JsValue): Role.RoleType = json match { + case JsString(str) => Role.withName(str) + case _ => throw new DeserializationException("Enum string expected") + } + } + + implicit val webIdentityFormat = jsonFormat1(WebIdentity) + implicit val callerIdFormat = jsonFormat2(CallerId) + implicit val voiceIdentityFormat = jsonFormat5(VoiceIdentity) + + implicit val userFormat = jsonFormat7(User) + implicit val joinedUserFormat = jsonFormat6(JoinedUser) + + implicit val userIdAndNameFormat = jsonFormat2(UserIdAndName) + implicit val sessionFormat = jsonFormat3(Session) + implicit val userJoinedFormat = jsonFormat3(UserJoined) +} + + import UserMessagesProtocol1._ + val userJoinedMsg = UserJoined(eng101Session, "juanToken", joinedUserJuan).toJson + //> userJoinedMsg : spray.json.JsValue = {"session":{"id":"english_101-1234"," + //| meetingId":"english_101","meetingName":"English 101"},"token":"juanToken"," + //| joinedUser":{"id":"juanid","token":"juanToken","user":{"externalId":"userju + //| an","name":"Juan Tamad","role":"MODERATOR","pin":12345,"welcomeMessage":"We + //| lcome Juan","logoutUrl":"http://www.umaliska.don","avatarUrl":"http://www.m + //| ukhamo.com/unggoy"},"isPresenter":true,"webIdentity":{"handRaised":false}," + //| voiceIdentity":{"callerId":{"name":"Juan Tamad","number":"011-63-917-555-12 + //| 34"},"muted":false,"locked":false,"talking":false,"metadata":{"userid":"1", + //| "conference_num":"85115"}}}} + val ujmJson = userJoinedMsg.toJson //> ujmJson : spray.json.JsValue = {"session":{"id":"english_101-1234","meetin + //| gId":"english_101","meetingName":"English 101"},"token":"juanToken","joined + //| User":{"id":"juanid","token":"juanToken","user":{"externalId":"userjuan","n + //| ame":"Juan Tamad","role":"MODERATOR","pin":12345,"welcomeMessage":"Welcome + //| Juan","logoutUrl":"http://www.umaliska.don","avatarUrl":"http://www.mukhamo + //| .com/unggoy"},"isPresenter":true,"webIdentity":{"handRaised":false},"voiceI + //| dentity":{"callerId":{"name":"Juan Tamad","number":"011-63-917-555-1234"}," + //| muted":false,"locked":false,"talking":false,"metadata":{"userid":"1","confe + //| rence_num":"85115"}}}} +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc new file mode 100644 index 0000000000..7dc9f8ea5b --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc @@ -0,0 +1,26 @@ +package org.bigbluebutton.apps.whiteboard.data + +import org.bigbluebutton.apps.users.data.UserIdAndName + + + +object sequencews1 { + val nums = Seq(1,2,3,4,5) //> nums : Seq[Int] = List(1, 2, 3, 4, 5) + + val isEven : PartialFunction[Int, Int] = { case x if x % 2 == 0 => x} + //> isEven : PartialFunction[Int,Int] = + nums collect isEven //> res0: Seq[Int] = List(2, 4) + + val user = UserIdAndName("me", "me") //> user : org.bigbluebutton.apps.users.data.UserIdAndName = UserIdAndName(me,m + //| e) + + val f = Foo1("bar") //> f : org.bigbluebutton.apps.whiteboard.data.Foo1 = Foo1(bar) + var desc = new ShapeDescriptor("shape1", "cor1", ShapeTypes.SCRIBBLE, user, 0) + //> desc : org.bigbluebutton.apps.whiteboard.data.ShapeDescriptor = ShapeDescri + //| ptor(shape1,cor1,SCRIBBLE,UserIdAndName(me,me),0) +// val isShape : PartialFunction[Shape, Option[Shape]] = { +// case x @ Scribble(desc, _, _) => if (desc.id == x.descriptor.id) Some(x) else None +// } + + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala new file mode 100644 index 0000000000..b64759c108 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala @@ -0,0 +1,2116 @@ +package org.bigbluebutton.endpoint + +/** + * This file contains messages received and sent from/to pubsub by bbb-apps. + */ +trait JsonMessagesFixtures { + +/** + * Message received from pubsub to create a meeting. + * + * meeting_descriptor: different default values for features of the meeting. + */ + val CreateMeetingRequestJson = +""" + { + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "create_meeting_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting_descriptor": { + "name": "English 101", + "external_id": "english_101", + "record": true, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.bigbluebutton.org", + "avatar_url": "http://www.gravatar.com/bigbluebutton", + "max_users": 20, + "duration": { + "length_in_minutes": 120, + "allow_extend": false, + "max_minutes": 240 + }, + "voice_conference": { + "pin": 123456, + "number": 85115 + }, + "phone_numbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customer_id": "acme-customer", + "customer_name": "ACME" + } + } + } + } +""" + +/** + * Message response to the create meeting request. + * + * session: the session id for this newly created meeting. + * result: the result of the request and relevant message. + * meeting_descriptor: the meeting_descriptor passed on the create request. + * + */ + + val CreateMeetingResponseJson = +""" +{ + "header": { + "destination": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "create_meeting_response", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-1234", + "result": { + "success": true, + "message": "Success" + }, + "meeting_descriptor": { + "name": "English 101", + "external_id": "english_101", + "record": true, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.bigbluebutton.org", + "avatar_url": "http://www.gravatar.com/bigbluebutton", + "max_users": 20, + "duration": { + "length_in_minutes": 120, + "allow_extend": false, + "max_minutes": 240 + }, + "voice_conference": { + "pin": 123456, + "number": 85115 + }, + "phone_numbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customer_id": "acme-customer", + "customer_name": "ACME" + } + } + } +} +""" + +/** + * Broadcast message to pubsub about the newly created meeting. + * Interested parties who keep track of running meeting listen for this + * event and initialize their own data in preparation for users joining + * the meeting. + * + */ + val MeetingCreatedEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "meeting_created_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-1234", + "meeting_descriptor": { + "name": "English 101", + "external_id": "english_101", + "record": true, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.bigbluebutton.org", + "avatar_url": "http://www.gravatar.com/bigbluebutton", + "max_users": 20, + "duration": { + "length_in_minutes": 120, + "allow_extend": false, + "max_minutes": 240 + }, + "voice_conference": { + "pin": 123456, + "number": 85115 + }, + "phone_numbers": [ + { + "number": "613-520-7600", + "description": "Ottawa" + }, + { + "number": "1-888-555-7890", + "description": "NA Toll-Free" + } + ], + "metadata": { + "customer_id": "acme-customer", + "customer_name": "ACME" + } + } + } +} + """ + +/** + * Message received from the pubsub to end the meeting. + * + * force: true/false - kick everyone out and end the meeting + * warn_users: true/false - notify users and wait for a few seconds + * before kicking everyone out. + */ + val EndMeetingRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "end_meeting_request", + "timestamp": "2013-12-23T08: 50Z", + "source": "bbb-web" + }, + "payload": { + "meeting": { + "name": "English101", + "id": "english_101" + }, + "session": "english_101-12345", + "force": true, + "warn_users": true + } +} + """ + +/** + * Response to the end meeting request. + */ + val EndMeetingResponseJson = """ +{ + "header": { + "destination": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "end_meeting_response", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "result": { + "success": true, + "message": "Ending the meeting. Please wait several seconds to complete the request." + } + } +} + """ + +/** + * Notify users that the meeting is about to end. This message gets sent when + * an end meeting request is received and as a notice that a meeting is about + * to reach its duration. + * + * time_left, time_unit: time left before the users will be kicked out. + * allow_extend: allow moderators to extend the meeting up to max duration. + * + */ + val EndMeetingWarningEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "end_meeting_warning_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "time_left": 30, + "time_unit": "seconds", + "allow_extend": false + } +} + """ + +/** + * Broadcast message that the meeting has ended and that all users have been + * kicked out. Interested parties should clean up their data. + * + */ + val MeetingEndedEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "meeting_ended_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345" + } +} + """ + +/** + * Received from the pubsub that a user is about to join the meeting. + */ + val RegisterUserRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "register_user_request", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-web" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user_descriptor": { + "external_id": "user1", + "name": "Guga", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.example.com", + "avatar_url": "http://www.example.com/avatar.png", + "metadata": { + "student_id": "54321", + "program": "engineering" + } + } + } +} + """ + +/** + * Response to the register user request. + * + * user_token: auth token the user needs to pass when joining the meeting. + * + */ + val RegisterUserResponseJson = """ +{ + "header": { + "destination": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "register_user_response", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user_token": "guga-token", + "result": { + "success": true, + "message": "Success" + }, + "user_descriptor": { + "external_id": "user1", + "name": "Guga", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.example.com", + "avatar_url": "http://www.example.com/avatar.png", + "metadata": { + "student_id": "54321", + "program": "engineering" + } + } + } +} + """ + +/** + * Broadcast to pubsub that a user is about to join the meeting. + */ + val UserRegisteredEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_registered_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-1234", + "user_descriptor": { + "external_id": "user1", + "name": "Guga", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome to English 101", + "logout_url": "http://www.example.com", + "avatar_url": "http://www.example.com/avatar.png", + "metadata": { + "student_id": "54321", + "program": "engineering" + } + } + } +} + """ + +/** + * Received when a user joins the meeting. + * + * token: auth token returned on the register user response. + */ + val UserJoinRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "user_join_request", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "token": "user1-token-1" + } +} + """ + +/** + * Response to the user join request when the token is valid. + * + * The information about the user is returned with the user id. + */ + val UserJoinResponseJson = """ +{ + "header": { + "destination": { + "to": "apps_channel", + "correlation_id": "abc-corelid" + }, + "name": "user_join_response", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "id": "english_101", + "name": "English 101" + }, + "session": "english_101-1234", + "result": { + "success": true, + "message": "Success" + }, + "user": { + "id": "juan-user1", + "external_id": "juan-ext-user1", + "name": "Juan Tamad", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome Juan", + "logout_url": "http://www.umaliska.don", + "avatar_url": "http://www.mukhamo.com/unggoy", + "metadata": { + "student_id": "54321", + "program": "engineering" + } + } + } +} + """ + +/** + * Broadcast message to interested parties that a user has joined the meeting. + * + */ + val UserJoinedEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_joined_event", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user": { + "id": "juanid", + "external_id": "userjuan", + "name": "Juan Tamad", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome Juan", + "logout_url": "http://www.umaliska.don", + "avatar_url": "http://www.mukhamo.com/unggoy", + "is_presenter": true, + "status": { + "hand_raised": false, + "muted": false, + "locked": false, + "talking": false + }, + "caller_id": { + "name": "Juan Tamad", + "number": "011-63-917-555-1234" + }, + "media_streams": [ + { + "media_type": "audio", + "uri": "http://cdn.bigbluebutton.org/stream/a1234", + "metadata": { + "foo": "bar" + } + }, + { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + { + "media_type": "screen", + "uri": "http://cdn.bigbluebutton.org/stream/s1234", + "metadata": { + "foo": "bar" + } + } + ], + "metadata": { + "student_id": "54321", + "program": "engineering" + } + } + } +} + """ + +/** + * Received message that a user has left the meeting. + */ + val UserLeaveEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_leave_event", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user": { + "id": "juanid", + "name": "Juan Tamad" + } + } +} + """ + +/** + * Broadcast message that a user has left the meeting. + */ + val UserLeftEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_left_event", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user": { + "id": "juanid", + "name": "Juan Tamad" + } + } +} + """ + +/** + * Received messages to get all the users in a meeting. + */ + val GetUsersRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "get_users_request", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-web" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "requester": { + "id": "juanid", + "name": "Juan Tamad" + } + } +} + """ + +/** + * Response to the get users request. + */ + val GetUsersResponseJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "get_users_response", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "users": [ + { + "id": "juanid", + "external_id": "userjuan", + "name": "Juan Tamad", + "role": "MODERATOR", + "pin": 12345, + "welcome_message": "Welcome Juan", + "logout_url": "http://www.umaliska.don", + "avatar_url": "http://www.mukhamo.com/unggoy", + "is_presenter": true, + "status": { + "hand_raised": false, + "muted": false, + "locked": false, + "talking": false + }, + "caller_id": { + "name": "Juan Tamad", + "number": "011-63-917-555-1234" + }, + "media_streams": [ + { + "media_type": "audio", + "uri": "http://cdn.bigbluebutton.org/stream/a1234", + "metadata": { + "foo": "bar" + } + }, + { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + { + "media_type": "screen", + "uri": "http://cdn.bigbluebutton.org/stream/s1234", + "metadata": { + "foo": "bar" + } + } + ], + "metadata": { + "student_id": "54321", + "program": "engineering" + } + } + ] + } +} + """ + +/** + * Received message that a user has raised hand. + */ + val RaiseUserHandRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "raise_user_hand_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "requester": { + "id": "juanid", + "name": "Juan Tamad" + }, + "raise": true + } +} + """ + +/** + * Broadcast message that a user has raise her/his hand. + */ + val UserRaisedHandEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_raised_hand_event", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "requester": { + "id": "juanid", + "name": "Juan Tamad" + }, + "raised": true + } +} + """ + +/** + * Received message to assign a user as a presenter. + */ + val AssignPresenterRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "assign_presenter_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "presenter": { + "id": "user1", + "name": "Guga" + }, + "assigned_by": { + "id": "user2", + "name": "Juan" + } + } +} + """ + +/** + * Broadcast message that a new presenter has been assigned. + */ + val PresenterAssignedEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "presenter_assigned_event", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "presenter": { + "id": "user1", + "name": "Guga" + }, + "assigned_by": { + "id": "user2", + "name": "Juan" + } + } +} + """ + +/** + * Received message to mute a user. + */ + val MuteUserRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "mute_user_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user": { + "id": "user1", + "name": "Guga" + }, + "requester": { + "id": "user2", + "name": "Juan" + }, + "mute": true + } +} + """ + +/** + * Broadcast message that a request to mute a user has been received. + */ + val MuteUserRequestEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "mute_user_request_event", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "user": { + "id": "user1", + "name": "Guga" + }, + "requester": { + "id": "user2", + "name": "Juan" + }, + "mute": true + } +} + """ + +/** + * Broadcast message to the voice conference provider (FreeSWITCH) to mute + * a user. + */ + val MuteVoiceUserRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "mute_voice_user_request", + "timestamp": "2013-12-23T08:50Z", + "source": "web-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "mute": true, + "user_metadata": { + "id": "user1", + "name": "Guga" + }, + "voice_metadata": { + "FreeSWITCH-IPv4": "192.168.0.166", + "Conference-Name": "72382", + "Conference-Unique-ID": "480d3f7c-224f-11e0-ae04-fbe97e271da0", + "conference_member_id": "1" + } + } +} + """ + +/** + * Message from FreeSWITCH that the user has been muted. + */ + val VoiceUserMutedEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "voice_user_muted_event", + "timestamp": "2013-12-23T08:50Z", + "source": "fs-esl" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "muted": true, + "user_metadata": { + "id": "user1", + "name": "Guga" + }, + "voice_metadata": { + "FreeSWITCH-IPv4": "192.168.0.166", + "Conference-Name": "72382", + "Conference-Unique-ID": "480d3f7c-224f-11e0-ae04-fbe97e271da0", + "conference_member_id": "1" + } + } +} + """ + +/** + * Broadcast messages to interested parties that the user is now muted. + */ + val UserMutedEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_muted_event", + "timestamp": "2013-12-23T08:50Z", + "source": "fs-esl" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "muted": true, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val UserPublishStreamRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "user_publish_stream_request", + "timestamp": "2013-12-23T08:50Z", + "source": "fs-esl" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val PublishStreamRequestJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "reply": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "publish_stream_request", + "timestamp": "2013-12-23T08:50Z", + "source": "fs-esl" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val PublishStreamResponseJson = """ +{ + "header": { + "destination": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "publish_stream_response", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-api" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val UserPublishStreamResponseJson = """ +{ + "header": { + "destination": { + "to": "apps_channel", + "correlation_id": "abc" + }, + "name": "user_publish_stream_response", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val PublishedStreamEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "published_stream_event", + "timestamp": "2013-12-23T08:50Z", + "source": "media-server" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val UserPublishedStreamEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_published_stream_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val UnpublishedStreamEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "unpublished_stream_event", + "timestamp": "2013-12-23T08:50Z", + "source": "media-server" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val UserUnpublishedStreamEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "user_unpublished_stream_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "meeting": { + "name": "English 101", + "id": "english_101" + }, + "session": "english_101-12345", + "media": { + "media_type": "video", + "uri": "http://cdn.bigbluebutton.org/stream/v1234", + "metadata": { + "foo": "bar" + } + }, + "user": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val PublicChatMessageEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "public_chat_message_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "chat_message": { + "correlation_id": "user1-msg1", + "timestamp": "2013-12-23T08:50Z", + "from": { + "id": "user1", + "name": "Richard" + }, + "message": { + "text": "Hello world!", + "lang": "en_US" + }, + "font": { + "color": 16711680, + "size": 14, + "font_type": "Arial" + } + } + } +} + """ + +val BroadcastPublicChatMessageEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_public_chat_message_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "chat_message": { + "id": "msg1234", + "server_timestamp": "2013-12-23T08:50Z", + "correlation_id": "user1-msg1", + "user_timestamp": "2013-12-23T08:50Z", + "from": { + "id": "user1", + "name": "Richard" + }, + "message": { + "text": "Hello world!", + "lang": "en_US" + }, + "font": { + "color": 16711680, + "size": 14, + "font_type": "Arial" + }, + "translations": [ + { + "lang": "es_LA", + "text": "Hola Mundo!" + } + ] + } + } +} + """ + +val PrivateChatMessageEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "private_chat_message_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "chat_message": { + "correlation_id": "user1-msg1", + "timestamp": "2013-12-23T08:50Z", + "from": { + "id": "user1", + "name": "Richard" + }, + "to": { + "id": "user2", + "name": "Guga" + }, + "message": { + "text": "Hello world!", + "lang": "en_US" + }, + "font": { + "color": 16711680, + "size": 14, + "font_type": "Arial" + } + } + } +} + """ + +val BroadcastPrivateChatMessageEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_private_chat_message_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "chat_message": { + "id": "msg1234", + "server_timestamp": "2013-12-23T08:50Z", + "correlation_id": "user1-msg1", + "user_timestamp": "2013-12-23T08:50Z", + "from": { + "id": "user1", + "name": "Richard" + }, + "to": { + "id": "user2", + "name": "Guga" + }, + "message": { + "text": "Hello world!", + "lang": "en_US" + }, + "font": { + "color": 16711680, + "size": 14, + "font_type": "Arial" + }, + "translations": [ + { + "lang": "es_LA", + "text": "Hola Mundo!" + } + ] + } + } +} + """ + +val WhiteboardDrawLineEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "line", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val WhiteboardUpdateLineEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_update_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "line", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 2.33, + "last_y": 3.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val WhiteboardDrawScribbleEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "scribble", + "data": { + "points": [ + { + "x": 0.016025641025641028, + "y": 0.982905982905983 + }, + { + "x": 2.33, + "y": 3.45 + } + ], + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardDrawRectangleEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "rectangle", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "square": false + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardUpdateRectangleEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_update_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "rectangle", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 2.33, + "last_y": 3.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "square": false + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardDrawEllipseEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "ellipse", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "circle": false + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardUpdateEllipseleEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_update_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "ellipse", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 2.33, + "last_y": 3.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "circle": false + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardDrawTriangleEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "triangle", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardUpdateTriangleleEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_update_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "triangle", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 2.33, + "last_y": 3.45 + }, + "line": { + "line_type": "solid", + "color": 0, + "weight": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardDrawTextEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "text", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "font": { + "style": "arial", + "color": 0, + "size": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "text": "He" + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val WhiteboardUpdateTextEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_draw_update_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "shape_type": "text", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "font": { + "style": "arial", + "color": 0, + "size": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "text": "He" + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val BroadcastWhiteboardDrawTextEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_whiteboard_draw_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "timestamp": "2013-12-23T08:50Z", + "zorder": 100, + "shape_type": "text", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "font": { + "style": "arial", + "color": 0, + "size": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "text": "He" + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + val BroadcastWhiteboardUpdateTextEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_whiteboard_draw_update_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "presentation_id/page_num", + "shape_id": "q779ogycfmxk-13-1383262166102", + "timestamp": "2013-12-23T08:50Z", + "zorder": 100, + "shape_type": "text", + "data": { + "coordinate": { + "first_x": 0.016025641025641028, + "first_y": 0.982905982905983, + "last_x": 1.33, + "last_y": 2.45 + }, + "font": { + "style": "arial", + "color": 0, + "size": 18 + }, + "background": { + "visible": true, + "color": 16777215, + "alpha": 0 + }, + "text": "He" + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + + + +val WhiteboardCursorEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "whiteboard_cursor_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "user1-shape-1", + "cursor": { + "x": 0.54, + "y": 0.98 + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val BroadcastWhiteboardCursorEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_whiteboard_cursor_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "whiteboard_id": "user1-shape-1", + "cursor": { + "x": 0.54, + "y": 0.98 + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val SharePresentationEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "share_presentation_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "presentation": { + "id": "pres-123", + "name": "Flight School" + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + """ + +val BroadcastSharePresentationEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_share_presentation_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "presentation": { + "id": "pres-123", + "name": "Flight School" + }, + "page": { + "id": "pres-123/1", + "uri": "http://www.example.com/presentations/pres-123/1.swf", + "position": { + "x_offset": 0, + "y_offset": 0, + "width_ratio": 100, + "height_ratio": 100 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + + """ + +val ResizeAndMovePagePageEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "resize_and_move_page_presentation_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "presentation": { + "id": "pres-123", + "name": "Flight School" + }, + "page": { + "id": "pres-123/1", + "uri": "http://www.example.com/presentations/pres-123/1.swf", + "position": { + "x_offset": 0, + "y_offset": 0, + "width_ratio": 100, + "height_ratio": 100 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + + """ + +val BroadcastResizeAndMovePagePageEventJson = """ +{ + "header": { + "destination": { + "to": "apps_channel" + }, + "name": "broadcast_resize_and_move_page_presentation_event", + "timestamp": "2013-12-23T08:50Z", + "source": "bbb-apps" + }, + "payload": { + "presentation": { + "id": "pres-123", + "name": "Flight School" + }, + "page": { + "id": "pres-123/1", + "uri": "http://www.example.com/presentations/pres-123/1.swf", + "position": { + "x_offset": 0, + "y_offset": 0, + "width_ratio": 100, + "height_ratio": 100 + } + }, + "by": { + "id": "user1", + "name": "Guga" + } + } +} + + """ +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala new file mode 100644 index 0000000000..636c09487e --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala @@ -0,0 +1,41 @@ +package org.bigbluebutton.endpoint +import akka.actor.ActorSystem +import akka.testkit.{DefaultTimeout, ImplicitSender, TestKit, TestProbe, TestActorRef} +import scala.concurrent.duration._ +import org.scalatest.{WordSpecLike, BeforeAndAfterAll, Matchers} +import org.bigbluebutton.apps.users.messages.UserJoinRequest + +class MessageHandlerActorSpec extends + TestKit(ActorSystem("MessageHandlerActorSpec")) with DefaultTimeout with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll with UsersMessageTestFixtures { + + val messageMarshallerProbe = TestProbe() + val bbbAppsProbe = TestProbe() + val messageHandlerActor = TestActorRef[MessageHandlerActor]( + MessageHandlerActor.props( + bbbAppsProbe.ref, messageMarshallerProbe.ref)) + + override def afterAll { + shutdown(system) + } + + "The MessageHandlerActor"should { + "Send a UserJoinResponseMessage message when receiving a user join request message" in { + messageHandlerActor ! userJoinRequestMessage + + bbbAppsProbe.expectMsgPF(500 millis) { + case ujr:UserJoinRequest => { + ujr.token shouldBe juanUserToken + bbbAppsProbe.reply(userJoinSuccessResponse) + } + case _ => fail("Expected a UserJoinRequest message.") + } + + messageMarshallerProbe.expectMsgPF(500 millis) { + case ujr:UserJoinResponseMessage => { + ujr.response.result.success shouldBe true + } + case _ => fail("Expected a UserJoinResponseMessage message.") + } + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala new file mode 100644 index 0000000000..dfe8b26da8 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala @@ -0,0 +1,38 @@ +package org.bigbluebutton.endpoint +import akka.actor.ActorSystem +import akka.testkit.{DefaultTimeout, ImplicitSender, TestKit, TestProbe, TestActorRef} +import scala.concurrent.duration._ +import org.scalatest.{WordSpecLike, BeforeAndAfterAll, Matchers} +import spray.json._ +import spray.json.DefaultJsonProtocol._ +import org.bigbluebutton.endpoint.redis.JsonMessage + +class MessageMarshallingActorSpec extends + TestKit(ActorSystem("MessageMarshallingActorSpec")) + with DefaultTimeout with ImplicitSender with WordSpecLike + with Matchers with BeforeAndAfterAll + with UsersMessageTestFixtures { + + val pubsubProbe = TestProbe() + val marshallingActor = TestActorRef[MessageMarshallingActor]( + MessageMarshallingActor.props( + pubsubProbe.ref)) + + override def afterAll { + shutdown(system) + } + + "The MessageMarshallingActor" should { + "Send a UserJoinResponse message when receiving a user join JSON message" in { + marshallingActor ! userJoinResponseMessage + + pubsubProbe.expectMsgPF(500 millis) { + case ujr:JsonMessage => { + ujr.message should include (juanExtUserId) + } + case _ => fail("Expected a JsonMessage message.") + } + } + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala new file mode 100644 index 0000000000..efc50c0001 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala @@ -0,0 +1,70 @@ +package org.bigbluebutton.endpoint + +import akka.actor.ActorSystem +import akka.testkit.{DefaultTimeout, ImplicitSender, TestKit, TestProbe, TestActorRef} +import scala.concurrent.duration._ +import org.scalatest.{WordSpecLike, BeforeAndAfterAll, Matchers} +import org.bigbluebutton.apps.AppsTestFixtures + +class MessageUnmarshallingActorSpec extends + TestKit(ActorSystem("MessageUnmarshallingActorSpec")) + with DefaultTimeout with ImplicitSender with WordSpecLike + with Matchers with BeforeAndAfterAll + with UsersMessageTestFixtures + with JsonMessagesFixtures with AppsTestFixtures { + + val messageHandlerProbe = TestProbe() + val unmarshallingActor = TestActorRef[MessageUnmarshallingActor]( + MessageUnmarshallingActor.props( + messageHandlerProbe.ref)) + + override def afterAll { + shutdown(system) + } + + "The MessageUnmarshallingActor" should { + "Send a UserJoinRequest message when receiving a user join JSON message" in { + unmarshallingActor ! UserJoinRequestJson + + messageHandlerProbe.expectMsgPF(500 millis) { + case ujr:UserJoinRequestFormat => { + ujr.payload.token should be ("user1-token-1") + } + case _ => fail("Should have returned UserJoinRequestMessage") + } + } + + "Send a UserLeave message when receiving a user leave JSON message" in { + unmarshallingActor ! UserLeaveEventJson + + messageHandlerProbe.expectMsgPF(500 millis) { + case ujr:UserLeaveMessage => { + ujr.payload.user.id should be ("juanid") + } + case _ => fail("Should have returned UserLeaveMessage") + } + } + + "Send a GetUsers message when receiving a get users JSON message" in { + unmarshallingActor ! GetUsersRequestJson + + messageHandlerProbe.expectMsgPF(500 millis) { + case ujr:GetUsersRequestMessage => { + ujr.payload.requester.id should be ("juanid") + } + case _ => fail("Should have returned GetUsersRequest") + } + } + + "Send an AssignPresenter message when receiving assign presenter JSON message" in { + unmarshallingActor ! AssignPresenterRequestJson + + messageHandlerProbe.expectMsgPF(500 millis) { + case ujr:AssignPresenterMessage => { + ujr.payload.presenter.id should be ("user1") + } + case _ => fail("Should have returned AssignPresenter") + } + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala new file mode 100644 index 0000000000..90acd20f7a --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala @@ -0,0 +1,124 @@ +package org.bigbluebutton.endpoint + +import org.bigbluebutton.apps.UnitSpec +import spray.json.JsonParser +import spray.json._ +import spray.json.DefaultJsonProtocol._ +import spray.json.lenses.JsonLenses._ +import spray.json.lenses._ +import org.bigbluebutton.endpoint.UserMessagesProtocol._ +import org.bigbluebutton.apps.AppsTestFixtures + +class UsersMessageJsonConversionSpec extends UnitSpec + with JsonMessagesFixtures with AppsTestFixtures { + + "A CreateMeetingRequestJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(CreateMeetingRequestJson) + val message = ujrm.convertTo[CreateMeetingRequestFormat] + + message.payload.meeting_descriptor.external_id should be (eng101MeetingId) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val meetingIdLens = ("payload" /"meeting_descriptor" / "external_id") + val meetingId = jsonMessage.extract[String](meetingIdLens) + meetingId should be (eng101MeetingId) + } + + "A CreateMeetingResponseJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(CreateMeetingResponseJson) + val message = ujrm.convertTo[CreateMeetingResponseFormat] + + message.payload.session should be (Some(eng101SessionId)) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val sessionIdLens = ("payload" /"session") + val sessionId = jsonMessage.extract[String](sessionIdLens) + sessionId should be (eng101SessionId) + } + + "A MeetingCreatedEvent Message" should "be un/marshalled" in { + val ujrm = JsonParser(MeetingCreatedEventJson) + val message = ujrm.convertTo[MeetingCreatedEventFormat] + + message.payload.session should be (eng101SessionId) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val sessionIdLens = ("payload" /"session") + val sessionId = jsonMessage.extract[String](sessionIdLens) + sessionId should be (eng101SessionId) + } + + "A RegisterUserRequestJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(RegisterUserRequestJson) + val message = ujrm.convertTo[RegisterUserRequestFormat] + + val user1Id = "user1" + message.payload.user_descriptor.external_id should be (user1Id) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val userIdLens = ("payload" / "user_descriptor" / "external_id") + val userId = jsonMessage.extract[String](userIdLens) + userId should be (user1Id) + } + + "A RegisterUserResponseJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(RegisterUserResponseJson) + val message = ujrm.convertTo[RegisterUserResponseFormat] + + val userToken = "guga-token" + message.payload.user_token should be (Some(userToken)) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val userTokenLens = ("payload" / "user_token") + val userId = jsonMessage.extract[String](userTokenLens) + userId should be (userToken) + } + + "A UserRegisteredEventJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(UserRegisteredEventJson) + val message = ujrm.convertTo[UserRegisteredEventFormat] + + message.payload.session should be (eng101SessionId) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val sessionLens = ("payload" / "session") + val sessionId = jsonMessage.extract[String](sessionLens) + sessionId should be (eng101SessionId) + } + + "A UserJoinResponseJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(UserJoinResponseJson) + val message = ujrm.convertTo[UserJoinResponseFormat] + + message.payload.user match { + case Some(u) => u.id should be (juanUserId) + case None => fail("Should have user field") + } + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val userIdLens = ("payload" / "user" / "id") + val userId = jsonMessage.extract[String](userIdLens) + userId should be (juanUserId) + } + + "A UserJoinedEventJson Message" should "be un/marshalled" in { + val ujrm = JsonParser(UserJoinedEventJson) + val message = ujrm.convertTo[UserJoinedEventFormat] + + val user1Id = "juanid" + message.payload.user.id should be (user1Id) + + import spray.json.DefaultJsonProtocol._ + val jsonMessage = message.toJson + val userIdLens = ("payload" / "user" / "id") + val userId = jsonMessage.extract[String](userIdLens) + userId should be (user1Id) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala new file mode 100644 index 0000000000..7942bd928e --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala @@ -0,0 +1,39 @@ +package org.bigbluebutton.endpoint + +import org.bigbluebutton.apps.users.data._ +import org.bigbluebutton.apps.AppsTestFixtures +import org.bigbluebutton.apps.protocol.Destination +import org.bigbluebutton.apps.protocol.Header +import org.bigbluebutton.apps.users.messages.UserJoinResponse +import org.bigbluebutton.apps.users.messages.Result +import org.bigbluebutton.apps.protocol.ReplyDestination + +trait UsersMessageTestFixtures extends AppsTestFixtures { + val userJoinSuccessResponse = UserJoinResponse(eng101Session, Result(true, "Success"), + Some(joinedUserJuan)) + val userJoinFailResponse = UserJoinResponse(eng101Session, Result(false, "Success"), None) + + val userJoinRequestPayload = UserJoinRequestPayloadFormat(eng101MeetingIdAndName, eng101SessionId, juanUserToken) + + val destination = Destination("apps_channel", None) + val replyTo = ReplyDestination("apps_channel", "abc-corelid") + val userJoinReqHeader = Header(destination, InMsgNameConst.UserJoinRequest, + "2013-12-23T08:50Z", "web-api", + Some(replyTo)) + val userJoinRequestMessage = UserJoinRequestFormat(userJoinReqHeader, userJoinRequestPayload) + + val userJoinRespHeader = Header(Destination(replyTo.to, + Some(replyTo.correlation_id)), + InMsgNameConst.UserJoinResponse, + "2013-12-23T08:50Z", "web-api", None) + val userJoinResponseMessage = UserJoinResponseMessage(userJoinRespHeader, userJoinSuccessResponse) + + val userFormat = UserFormat(juanUserId, juanUser.externalId, juanUser.name, + juanUser.role, juanUser.pin, juanUser.welcomeMessage, + juanUser.logoutUrl, juanUser.avatarUrl) + val userJoinResponseJsonPayload = UserJoinResponseFormatPayload( + eng101MeetingIdAndName, + eng101SessionId, + ResultFormat(true, "Success"), Some(userFormat)) + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc new file mode 100644 index 0000000000..57e6800fe0 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc @@ -0,0 +1,81 @@ +package org.bigbluebutton.endpoint.redis + +import spray.json._ +import spray.json.DefaultJsonProtocol._ +import org.bigbluebutton.apps.users.protocol.UserMessagesProtocol._ +import org.bigbluebutton.apps.users.protocol.UserJoinResponseJsonMessage +import spray.json.lenses.JsonLenses._ +import spray.json.lenses._ + +object JsonLens extends UsersMessageTestFixtures + with UsersMessageJsonTestFixtures { + +val userJoinResponseMessage2 = UserJoinResponseJsonMessage(userJoinRespHeader, userJoinResponseJsonPayload).toJson + //> userJoinResponseMessage2 : spray.json.JsValue = {"header":{"destination":{" + //| to":"apps_channel","correlation_id":"abc-corelid"},"name":"user_join_respons + //| e","timestamp":"2013-12-23T08:50Z","source":"web-api"},"payload":{"meeting": + //| {"id":"english_101","name":"English 101"},"session":"english_101-1234","resu + //| lt":{"success":true,"message":"Success"},"user":{"id":"juan-user1","external + //| _id":"juan-ext-user1","name":"Juan Tamad","role":"MODERATOR","pin":12345,"we + //| lcome_message":"Welcome Juan","logout_url":"http://www.umaliska.don","avatar + //| _url":"http://www.mukhamo.com/unggoy"}}} +val userJoinResponseMessageJson = JsonParser(user_join_response_Message) + //> userJoinResponseMessageJson : spray.json.JsValue = {"header":{"destination" + //| :{"to":"apps_channel","correlation_id":"abc-corelid"},"name":"user_join_resp + //| onse","timestamp":"2013-12-23T08:50Z","source":"web-api"},"payload":{"meetin + //| g":{"id":"english_101","name":"English 101"},"session":"english_101-1234","r + //| esult":{"success":true,"message":"Success"},"user":{"id":"juan-user1","exter + //| nal_id":"juan-ext-user1","name":"Juan Tamad","role":"MODERATOR","pin":12345, + //| "welcome_message":"Welcome Juan","logout_url":"http://www.umaliska.don","ava + //| tar_url":"http://www.mukhamo.com/unggoy"}}} +val foo = userJoinResponseMessageJson.convertTo[UserJoinResponseJsonMessage] + //> foo : org.bigbluebutton.apps.users.protocol.UserJoinResponseJsonMessage = U + //| serJoinResponseJsonMessage(Header(Destination(apps_channel,Some(abc-corelid) + //| ),user_join_response,2013-12-23T08:50Z,web-api,None),UserJoinResponseJsonPay + //| load(MeetingIdAndName(english_101,English 101),english_101-1234,Result(true, + //| Success),Some(UserFormat(juan-user1,juan-ext-user1,Juan Tamad,MODERATOR,1234 + //| 5,Welcome Juan,http://www.umaliska.don,http://www.mukhamo.com/unggoy)))) +val jsonFoo = foo.toJson //> jsonFoo : spray.json.JsValue = {"header":{"destination":{"to":"apps_channel + //| ","correlation_id":"abc-corelid"},"name":"user_join_response","timestamp":"2 + //| 013-12-23T08:50Z","source":"web-api"},"payload":{"meeting":{"id":"english_10 + //| 1","name":"English 101"},"session":"english_101-1234","result":{"success":tr + //| ue,"message":"Success"},"user":{"id":"juan-user1","external_id":"juan-ext-us + //| er1","name":"Juan Tamad","role":"MODERATOR","pin":12345,"welcome_message":"W + //| elcome Juan","logout_url":"http://www.umaliska.don","avatar_url":"http://www + //| .mukhamo.com/unggoy"}}} + +import spray.json.DefaultJsonProtocol._ +val userIdLens = ("payload" / "user" / "id") //> userIdLens : spray.json.lenses.Lens[spray.json.lenses.Id] = spray.json.lens + //| es.JsonLenses$$anon$1@25c22d44 +val userId = jsonFoo.extract[String](userIdLens) //> userId : String = juan-user1 + + val json = """ +{ "store": { + "book": [ + { "category": "reference", + "author": "Nigel Rees", + "title": "Sayings of the Century", + "price": 8.95 + }, + { "category": "fiction", + "author": "Evelyn Waugh", + "title": "Sword of Honour", + "price": 12.99, + "isbn": "0-553-21311-3" + } + ], + "bicycle": { + "color": "red", + "price": 19.95 + } + } +}""".asJson //> json : spray.json.JsValue = {"store":{"book":[{"category":"reference","aut + //| hor":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category + //| ":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99 + //| ,"isbn":"0-553-21311-3"}],"bicycle":{"color":"red","price":19.95}}} + + +val allAuthors = 'store / 'book / * / 'author //> allAuthors : spray.json.lenses.Lens[Seq] = spray.json.lenses.JsonLenses$$a + //| non$1@2f290d08 +val authorNames = json.extract[String](allAuthors)//> authorNames : Seq[String] = List(Nigel Rees, Evelyn Waugh) +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc new file mode 100644 index 0000000000..3212068106 --- /dev/null +++ b/labs/akka-bbb-fs/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc @@ -0,0 +1,15 @@ +package org.bigbluebutton.endpoint.redis + +import spray.json._ +import spray.json.DefaultJsonProtocol._ +import org.bigbluebutton.apps.users.protocol.UserMessagesProtocol._ +import org.bigbluebutton.apps.users.protocol.UserJoinResponseJsonMessage +import spray.json.lenses.JsonLenses._ +import spray.json.lenses._ + +object MessageTestWorksheet extends UsersMessageTestFixtures + with UsersMessageJsonTestFixtures { + + + +} \ No newline at end of file From 994a1bb336f876f38e3caaa6d4142e43644b076d Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 15:45:00 +0000 Subject: [PATCH 12/30] - rename old packages --- .../meeting/messaging/redis/MeetingMessageHandler.java | 0 .../{conference => old_conference}/service/chat/ChatKeyUtil.java | 0 .../service/chat/ChatMessageListener.java | 0 .../service/layout/LayoutApplication.java | 0 .../service/messaging/Constants.java | 0 .../service/messaging/CreateMeetingMessage.java | 0 .../service/messaging/DestroyMeetingMessage.java | 0 .../service/messaging/EndMeetingMessage.java | 0 .../service/messaging/GetAllMeetingsRequest.java | 0 .../service/messaging/IMessage.java | 0 .../service/messaging/KeepAliveMessage.java | 0 .../service/messaging/MessageBuilder.java | 0 .../service/messaging/MessageFromJsonConverter.java | 0 .../service/messaging/MessagingConstants.java | 0 .../service/messaging/MessagingService.java | 0 .../service/messaging/RegisterUserMessage.java | 0 .../service/messaging/UserConnectedToGlobalAudio.java | 0 .../service/messaging/UserDisconnectedFromGlobalAudio.java | 0 .../service/messaging/ValidateAuthTokenMessage.java | 0 .../service/messaging/redis/MessageDistributor.java | 0 .../service/messaging/redis/MessageHandler.java | 0 .../service/messaging/redis/MessageReceiver.java | 0 .../service/messaging/redis/MessageSender.java | 0 .../service/messaging/redis/MessageToSend.java | 0 .../service/messaging/redis/ReceivedMessage.java | 0 .../service/messaging/redis/ReceivedMessageHandler.java | 0 .../service/presentation/ConversionUpdatesProcessor.java | 0 .../service/presentation/PresentationMessageListener.java | 0 .../service/presentation/PreuploadedPresentation.java | 0 .../service/presentation/PreuploadedPresentationsUtil.java | 0 .../service/recorder/GenericObjectPoolConfigWrapper.java | 0 .../service/recorder/RecordEvent.java | 0 .../{conference => old_conference}/service/recorder/Recorder.java | 0 .../service/recorder/RecorderApplication.java | 0 .../service/recorder/RedisDispatcher.java | 0 .../service/recorder/chat/AbstractChatRecordEvent.java | 0 .../service/recorder/chat/PublicChatRecordEvent.java | 0 .../recorder/participants/AbstractParticipantRecordEvent.java | 0 .../service/recorder/participants/AssignPresenterRecordEvent.java | 0 .../participants/ParticipantEndAndKickAllRecordEvent.java | 0 .../service/recorder/participants/ParticipantJoinRecordEvent.java | 0 .../service/recorder/participants/ParticipantLeftRecordEvent.java | 0 .../recorder/participants/ParticipantStatusChangeRecordEvent.java | 0 .../service/recorder/participants/RecordStatusRecordEvent.java | 0 .../service/recorder/polling/AbstractPollRecordEvent.java | 0 .../service/recorder/polling/PollClearedRecordEvent.java | 0 .../service/recorder/polling/PollCreatedRecordEvent.java | 0 .../service/recorder/polling/PollRemovedRecordEvent.java | 0 .../service/recorder/polling/PollStartedRecordEvent.java | 0 .../service/recorder/polling/PollStoppedRecordEvent.java | 0 .../service/recorder/polling/PollUpdatedRecordEvent.java | 0 .../recorder/presentation/AbstractPresentationRecordEvent.java | 0 .../presentation/ConversionCompletedPresentationRecordEvent.java | 0 .../service/recorder/presentation/CursorUpdateRecordEvent.java | 0 .../presentation/GenerateSlidePresentationRecordEvent.java | 0 .../recorder/presentation/GotoSlidePresentationRecordEvent.java | 0 .../presentation/RemovePresentationPresentationRecordEvent.java | 0 .../presentation/ResizeAndMoveSlidePresentationRecordEvent.java | 0 .../presentation/SharePresentationPresentationRecordEvent.java | 0 .../service/voice/VoiceKeyUtil.java | 0 .../service/voice/VoiceMessageListener.java | 0 .../service/whiteboard/WhiteboardKeyUtil.java | 0 .../service/whiteboard/WhiteboardListener.java | 0 .../service/whiteboard/redis/AbstractWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/AddTextWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java | 0 .../service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java | 0 .../bigbluebutton/{core => old_core}/api/IBigBlueButtonInGW.java | 0 .../org/bigbluebutton/{core => old_core}/api/IDispatcher.java | 0 .../org/bigbluebutton/{core => old_core}/api/IOutMessage.java | 0 .../bigbluebutton/{core => old_core}/api/MessageOutGateway.java | 0 .../bigbluebutton/{core => old_core}/api/OutMessageListener2.java | 0 .../{core => old_core}/api/RedisLpushDispatcher.java | 0 .../{service => old_service}/recording/RecordMessage.java | 0 .../{service => old_service}/recording/RedisListRecorder.java | 0 .../voice/AbstractVoiceRecordEvent.java | 0 .../voice/ConferenceServerListener.java | 0 .../voice/ConferenceServiceProvider.java | 0 .../voice/FreeswitchConferenceEventListener.java | 0 .../voice/IVoiceConferenceService.java | 0 .../voice/ParticipantJoinedVoiceRecordEvent.java | 0 .../voice/ParticipantLeftVoiceRecordEvent.java | 0 .../voice/ParticipantLockedVoiceRecordEvent.java | 0 .../voice/ParticipantMutedVoiceRecordEvent.java | 0 .../voice/ParticipantTalkingVoiceRecordEvent.java | 0 .../voice/StartRecordingVoiceRecordEvent.java | 0 .../voice/VoiceEventRecorder.java | 0 .../voice/commands/ConferenceCommand.java | 0 .../voice/commands/ConferenceCommandResult.java | 0 .../voice/commands/EjectParticipantCommand.java | 0 .../voice/commands/GetParticipantsCommand.java | 0 .../voice/commands/MuteParticipantCommand.java | 0 .../voice/events/ConferenceEventListener.java | 0 .../voice/events/UnknownConferenceEvent.java | 0 .../voice/events/VoiceConferenceEvent.java | 0 .../voice/events/VoiceStartRecordingEvent.java | 0 .../voice/events/VoiceUserJoinedEvent.java | 0 .../voice/events/VoiceUserLeftEvent.java | 0 .../voice/events/VoiceUserLockedEvent.java | 0 .../voice/events/VoiceUserMutedEvent.java | 0 .../voice/events/VoiceUserTalkingEvent.java | 0 .../voice/freeswitch/ConnectionManager.java | 0 .../voice/freeswitch/ESLEventListener.java | 0 .../voice/freeswitch/FreeswitchApplication.java | 0 .../voice/freeswitch/actions/BroadcastConferenceCommand.java | 0 .../voice/freeswitch/actions/EjectAllUsersCommand.java | 0 .../voice/freeswitch/actions/EjectParticipantCommand.java | 0 .../voice/freeswitch/actions/FreeswitchCommand.java | 0 .../voice/freeswitch/actions/MuteParticipantCommand.java | 0 .../voice/freeswitch/actions/PopulateRoomCommand.java | 0 .../voice/freeswitch/actions/RecordConferenceCommand.java | 0 .../voice/freeswitch/response/ConferenceMember.java | 0 .../voice/freeswitch/response/ConferenceMemberFlags.java | 0 .../freeswitch/response/XMLResponseConferenceListParser.java | 0 117 files changed, 0 insertions(+), 0 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/meeting/messaging/redis/MeetingMessageHandler.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/chat/ChatKeyUtil.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/chat/ChatMessageListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/layout/LayoutApplication.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/Constants.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/CreateMeetingMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/DestroyMeetingMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/EndMeetingMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/GetAllMeetingsRequest.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/IMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/KeepAliveMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/MessageBuilder.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/MessageFromJsonConverter.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/MessagingConstants.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/MessagingService.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/RegisterUserMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/UserConnectedToGlobalAudio.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/UserDisconnectedFromGlobalAudio.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/ValidateAuthTokenMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/MessageDistributor.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/MessageHandler.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/MessageReceiver.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/MessageSender.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/MessageToSend.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/ReceivedMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/messaging/redis/ReceivedMessageHandler.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/presentation/ConversionUpdatesProcessor.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/presentation/PresentationMessageListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/presentation/PreuploadedPresentation.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/presentation/PreuploadedPresentationsUtil.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/GenericObjectPoolConfigWrapper.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/RecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/Recorder.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/RecorderApplication.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/RedisDispatcher.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/chat/AbstractChatRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/chat/PublicChatRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/AbstractParticipantRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/AssignPresenterRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/ParticipantJoinRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/ParticipantLeftRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/ParticipantStatusChangeRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/participants/RecordStatusRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/AbstractPollRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/PollClearedRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/PollCreatedRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/PollRemovedRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/PollStartedRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/PollStoppedRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/polling/PollUpdatedRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/AbstractPresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/CursorUpdateRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/GotoSlidePresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/recorder/presentation/SharePresentationPresentationRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/voice/VoiceKeyUtil.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/voice/VoiceMessageListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/WhiteboardKeyUtil.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/WhiteboardListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => old_conference}/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{core => old_core}/api/IBigBlueButtonInGW.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{core => old_core}/api/IDispatcher.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{core => old_core}/api/IOutMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{core => old_core}/api/MessageOutGateway.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{core => old_core}/api/OutMessageListener2.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{core => old_core}/api/RedisLpushDispatcher.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{service => old_service}/recording/RecordMessage.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{service => old_service}/recording/RedisListRecorder.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/AbstractVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ConferenceServerListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ConferenceServiceProvider.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/FreeswitchConferenceEventListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/IVoiceConferenceService.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ParticipantJoinedVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ParticipantLeftVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ParticipantLockedVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ParticipantMutedVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/ParticipantTalkingVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/StartRecordingVoiceRecordEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/VoiceEventRecorder.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/commands/ConferenceCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/commands/ConferenceCommandResult.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/commands/EjectParticipantCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/commands/GetParticipantsCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/commands/MuteParticipantCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/ConferenceEventListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/UnknownConferenceEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceConferenceEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceStartRecordingEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceUserJoinedEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceUserLeftEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceUserLockedEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceUserMutedEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/events/VoiceUserTalkingEvent.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/ConnectionManager.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/ESLEventListener.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/FreeswitchApplication.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/BroadcastConferenceCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/EjectAllUsersCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/EjectParticipantCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/FreeswitchCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/MuteParticipantCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/PopulateRoomCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/actions/RecordConferenceCommand.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/response/ConferenceMember.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/response/ConferenceMemberFlags.java (100%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => old_webconference}/voice/freeswitch/response/XMLResponseConferenceListParser.java (100%) diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/meeting/messaging/redis/MeetingMessageHandler.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/meeting/messaging/redis/MeetingMessageHandler.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatKeyUtil.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatKeyUtil.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatMessageListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatMessageListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/layout/LayoutApplication.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/layout/LayoutApplication.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/Constants.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/Constants.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/CreateMeetingMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/CreateMeetingMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/DestroyMeetingMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/DestroyMeetingMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/EndMeetingMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/EndMeetingMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/GetAllMeetingsRequest.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/GetAllMeetingsRequest.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/IMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/IMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/KeepAliveMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/KeepAliveMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageBuilder.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageBuilder.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageFromJsonConverter.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageFromJsonConverter.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingConstants.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingConstants.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingService.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingService.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/RegisterUserMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/RegisterUserMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserConnectedToGlobalAudio.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserConnectedToGlobalAudio.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserDisconnectedFromGlobalAudio.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserDisconnectedFromGlobalAudio.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/ValidateAuthTokenMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/ValidateAuthTokenMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageDistributor.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageDistributor.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageHandler.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageHandler.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageReceiver.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageReceiver.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageSender.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageSender.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageToSend.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageToSend.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessageHandler.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessageHandler.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/ConversionUpdatesProcessor.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/ConversionUpdatesProcessor.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PresentationMessageListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PresentationMessageListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentation.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentation.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentationsUtil.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentationsUtil.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/GenericObjectPoolConfigWrapper.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/GenericObjectPoolConfigWrapper.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/Recorder.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/Recorder.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecorderApplication.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecorderApplication.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RedisDispatcher.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RedisDispatcher.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/AbstractChatRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/AbstractChatRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/PublicChatRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/PublicChatRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AbstractParticipantRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AbstractParticipantRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AssignPresenterRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AssignPresenterRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantJoinRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantJoinRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantLeftRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantLeftRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/RecordStatusRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/RecordStatusRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/AbstractPollRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/AbstractPollRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/AbstractPollRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollClearedRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollClearedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollClearedRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollCreatedRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollCreatedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollCreatedRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollRemovedRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollRemovedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollRemovedRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStartedRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStartedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStartedRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStoppedRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollStoppedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStoppedRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollUpdatedRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/polling/PollUpdatedRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollUpdatedRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/AbstractPresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/AbstractPresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/CursorUpdateRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/CursorUpdateRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceKeyUtil.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceKeyUtil.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceMessageListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceMessageListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardKeyUtil.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardKeyUtil.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IBigBlueButtonInGW.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IBigBlueButtonInGW.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IDispatcher.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IDispatcher.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IOutMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IOutMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/MessageOutGateway.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/MessageOutGateway.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/OutMessageListener2.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/OutMessageListener2.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/RedisLpushDispatcher.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/RedisLpushDispatcher.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RecordMessage.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RecordMessage.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RedisListRecorder.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RedisListRecorder.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/AbstractVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/AbstractVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServerListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServerListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServiceProvider.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServiceProvider.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/FreeswitchConferenceEventListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/FreeswitchConferenceEventListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/IVoiceConferenceService.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/IVoiceConferenceService.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantJoinedVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantJoinedVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLeftVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLeftVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLockedVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLockedVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantMutedVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantMutedVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantTalkingVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantTalkingVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/StartRecordingVoiceRecordEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/StartRecordingVoiceRecordEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/VoiceEventRecorder.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/VoiceEventRecorder.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommandResult.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommandResult.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/EjectParticipantCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/EjectParticipantCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/GetParticipantsCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/GetParticipantsCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/MuteParticipantCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/MuteParticipantCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/ConferenceEventListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/ConferenceEventListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/UnknownConferenceEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/UnknownConferenceEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceConferenceEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceConferenceEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceStartRecordingEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceStartRecordingEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserJoinedEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserJoinedEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLeftEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLeftEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLockedEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLockedEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserMutedEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserMutedEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserTalkingEvent.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserTalkingEvent.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ConnectionManager.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ConnectionManager.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ESLEventListener.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ESLEventListener.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/FreeswitchApplication.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/FreeswitchApplication.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectAllUsersCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectAllUsersCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectParticipantCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectParticipantCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/FreeswitchCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/FreeswitchCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/MuteParticipantCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/MuteParticipantCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/PopulateRoomCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/PopulateRoomCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/RecordConferenceCommand.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/RecordConferenceCommand.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMember.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMember.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMemberFlags.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMemberFlags.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java similarity index 100% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java From d64e5a1a858050cde6a3180c43440f0a6e9032e2 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 15:48:18 +0000 Subject: [PATCH 13/30] - rename packages --- .../main/scala/org/bigbluebutton/{apps => old_apps}/Data.scala | 0 .../org/bigbluebutton/{apps => old_apps}/IncomingMessage.scala | 0 .../org/bigbluebutton/{apps => old_apps}/MeetingMessage.scala | 0 .../org/bigbluebutton/{apps => old_apps}/OutgoingMessage.scala | 0 .../main/scala/org/bigbluebutton/{apps => old_apps}/Util.scala | 0 .../scala/org/bigbluebutton/{apps => old_apps}/chat/ChatApp.scala | 0 .../org/bigbluebutton/{apps => old_apps}/chat/data/Data.scala | 0 .../bigbluebutton/{apps => old_apps}/chat/messages/Messages.scala | 0 .../org/bigbluebutton/{apps => old_apps}/layout/LayoutApp.scala | 0 .../org/bigbluebutton/{apps => old_apps}/layout/data/Data.scala | 0 .../{apps => old_apps}/layout/messages/Messages.scala | 0 .../{apps => old_apps}/presentation/PresentationApp.scala | 0 .../bigbluebutton/{apps => old_apps}/presentation/data/Data.scala | 0 .../{apps => old_apps}/presentation/messages/Messages.scala | 0 .../org/bigbluebutton/{apps => old_apps}/protocol/InMessage.scala | 0 .../org/bigbluebutton/{apps => old_apps}/protocol/Message.scala | 0 .../bigbluebutton/{apps => old_apps}/protocol/OutMessages.scala | 0 .../org/bigbluebutton/{apps => old_apps}/protocol/Protocol.scala | 0 .../org/bigbluebutton/{apps => old_apps}/users/UsersApp.scala | 0 .../org/bigbluebutton/{apps => old_apps}/users/data/Model.scala | 0 .../{apps => old_apps}/users/messages/Messages.scala | 0 .../{apps => old_apps}/users/protocol/UsersMessageHandler.scala | 0 .../users/protocol/UsersMessageMarshalling.scala | 0 .../users/protocol/UsersMessageUnmarshalling.scala | 0 .../{apps => old_apps}/utils/RandomStringGenerator.scala | 0 .../{apps => old_apps}/whiteboard/WhiteboardApp.scala | 0 .../bigbluebutton/{apps => old_apps}/whiteboard/data/Model.scala | 0 .../{apps => old_apps}/whiteboard/messages/Messages.scala | 0 .../org/bigbluebutton/{core => old_core}/BigBlueButtonActor.scala | 0 .../bigbluebutton/{core => old_core}/BigBlueButtonGateway.scala | 0 .../org/bigbluebutton/{core => old_core}/BigBlueButtonInGW.scala | 0 .../org/bigbluebutton/{core => old_core}/CollectorActor.scala | 0 .../org/bigbluebutton/{core => old_core}/CollectorGateway.scala | 0 .../scala/org/bigbluebutton/{core => old_core}/MeetingActor.scala | 0 .../org/bigbluebutton/{core => old_core}/RunningMeeting.scala | 0 .../bigbluebutton/{core => old_core}/SystemConfiguration.scala | 0 .../main/scala/org/bigbluebutton/{core => old_core}/User.scala | 0 .../bigbluebutton/{core => old_core}/api/ConsoleDispatcher.scala | 0 .../org/bigbluebutton/{core => old_core}/api/Constants.scala | 0 .../org/bigbluebutton/{core => old_core}/api/InMessages.scala | 0 .../org/bigbluebutton/{core => old_core}/api/MessageNames.scala | 0 .../org/bigbluebutton/{core => old_core}/api/OutMessages.scala | 0 .../bigbluebutton/{core => old_core}/api/TimestampGenerator.scala | 0 .../org/bigbluebutton/{core => old_core}/api/ValueObjects.scala | 0 .../scala/org/bigbluebutton/{core => old_core}/api/Versions.scala | 0 .../org/bigbluebutton/{core => old_core}/apps/chat/ChatApp.scala | 0 .../{core => old_core}/apps/chat/ChatInGateway.scala | 0 .../apps/chat/redis/ChatEventRedisPublisher.scala | 0 .../apps/chat/redis/ChatEventRedisRecorder.scala | 0 .../apps/chat/redis/ChatMessageToJsonConverter.scala | 0 .../bigbluebutton/{core => old_core}/apps/layout/LayoutApp.scala | 0 .../{core => old_core}/apps/layout/LayoutInGateway.scala | 0 .../org/bigbluebutton/{core => old_core}/apps/poll/Poll.scala | 0 .../org/bigbluebutton/{core => old_core}/apps/poll/PollApp.scala | 0 .../{core => old_core}/apps/poll/PollInGateway.scala | 0 .../{core => old_core}/apps/poll/PollMessageConverter.scala | 0 .../bigbluebutton/{core => old_core}/apps/poll/PollModel.scala | 0 .../bigbluebutton/{core => old_core}/apps/poll/QuestionType.scala | 0 .../apps/poll/redis/PollEventRedisPublisher.scala | 0 .../apps/poll/redis/PollEventRedisRecorder.scala | 0 .../{core => old_core}/apps/presentation/PresentationApp.scala | 0 .../{core => old_core}/apps/presentation/PresentationModel.scala | 0 .../presentation/redis/PesentationMessageToJsonConverter.scala | 0 .../apps/presentation/redis/PresentationEventRedisPublisher.scala | 0 .../apps/presentation/redis/PresentationEventRedisRecorder.scala | 0 .../org/bigbluebutton/{core => old_core}/apps/users/Users.scala | 0 .../bigbluebutton/{core => old_core}/apps/users/UsersApp.scala | 0 .../bigbluebutton/{core => old_core}/apps/users/UsersModel.scala | 0 .../apps/users/redis/UsersEventRedisPublisher.scala | 0 .../apps/users/redis/UsersEventRedisRecorder.scala | 0 .../apps/users/redis/UsersMessageToJsonConverter.scala | 0 .../bigbluebutton/{core => old_core}/apps/voice/VoiceApp.scala | 0 .../{core => old_core}/apps/voice/VoiceInGateway.scala | 0 .../{core => old_core}/apps/whiteboard/WhiteboardApp.scala | 0 .../{core => old_core}/apps/whiteboard/WhiteboardInGateway.scala | 0 .../{core => old_core}/apps/whiteboard/WhiteboardModel.scala | 0 .../apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala | 0 .../apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala | 0 .../apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala | 0 .../{core => old_core}/apps/whiteboard/vo/ValueObjects.scala | 0 .../{core => old_core}/meeting/MeetingEventRedisPublisher.scala | 0 .../meeting/MeetingMessageToJsonConverter.scala | 0 .../org/bigbluebutton/{core => old_core}/messaging/Util.scala | 0 .../org/bigbluebutton/{core => old_core}/models/Values.scala | 0 .../{core => old_core}/util/RandomStringGenerator.scala | 0 .../{core => old_core}/voice/VoiceConferenceActor.scala | 0 .../{endpoint => old_endpoint}/InMessageFormatters.scala | 0 .../{endpoint => old_endpoint}/InMessageHandlerActor.scala | 0 .../bigbluebutton/{endpoint => old_endpoint}/MessageFormats.scala | 0 .../{endpoint => old_endpoint}/MessageMarshallingActor.scala | 0 .../{endpoint => old_endpoint}/MessageNameConstants.scala | 0 .../{endpoint => old_endpoint}/MessageUmarshallingActor.scala | 0 .../{endpoint => old_endpoint}/OutMessageFormatters.scala | 0 .../{endpoint => old_endpoint}/OutMsgBuilderActor.scala | 0 .../org/bigbluebutton/{endpoint => old_endpoint}/Protocol.scala | 0 .../redis/AppsRedisPublisherActor.scala | 0 .../redis/AppsRedisSubscriberActor.scala | 0 .../bigbluebutton/{endpoint => old_endpoint}/redis/Message.scala | 0 .../{endpoint => old_endpoint}/redis/RedisPubSubActor.scala | 0 99 files changed, 0 insertions(+), 0 deletions(-) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/Data.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/IncomingMessage.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/MeetingMessage.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/OutgoingMessage.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/Util.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/chat/ChatApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/chat/data/Data.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/chat/messages/Messages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/layout/LayoutApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/layout/data/Data.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/layout/messages/Messages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/presentation/PresentationApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/presentation/data/Data.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/presentation/messages/Messages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/protocol/InMessage.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/protocol/Message.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/protocol/OutMessages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/protocol/Protocol.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/users/UsersApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/users/data/Model.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/users/messages/Messages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/users/protocol/UsersMessageHandler.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/users/protocol/UsersMessageMarshalling.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/users/protocol/UsersMessageUnmarshalling.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/utils/RandomStringGenerator.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/whiteboard/WhiteboardApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/whiteboard/data/Model.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{apps => old_apps}/whiteboard/messages/Messages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/BigBlueButtonActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/BigBlueButtonGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/BigBlueButtonInGW.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/CollectorActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/CollectorGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/MeetingActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/RunningMeeting.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/SystemConfiguration.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/User.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/ConsoleDispatcher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/Constants.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/InMessages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/MessageNames.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/OutMessages.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/TimestampGenerator.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/ValueObjects.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/api/Versions.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/chat/ChatApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/chat/ChatInGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/chat/redis/ChatEventRedisPublisher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/chat/redis/ChatEventRedisRecorder.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/chat/redis/ChatMessageToJsonConverter.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/layout/LayoutApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/layout/LayoutInGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/Poll.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/PollApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/PollInGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/PollMessageConverter.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/PollModel.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/QuestionType.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/redis/PollEventRedisPublisher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/poll/redis/PollEventRedisRecorder.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/presentation/PresentationApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/presentation/PresentationModel.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/presentation/redis/PesentationMessageToJsonConverter.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/presentation/redis/PresentationEventRedisPublisher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/presentation/redis/PresentationEventRedisRecorder.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/users/Users.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/users/UsersApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/users/UsersModel.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/users/redis/UsersEventRedisPublisher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/users/redis/UsersEventRedisRecorder.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/users/redis/UsersMessageToJsonConverter.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/voice/VoiceApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/voice/VoiceInGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/WhiteboardApp.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/WhiteboardInGateway.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/WhiteboardModel.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/apps/whiteboard/vo/ValueObjects.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/meeting/MeetingEventRedisPublisher.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/meeting/MeetingMessageToJsonConverter.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/messaging/Util.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/models/Values.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/util/RandomStringGenerator.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{core => old_core}/voice/VoiceConferenceActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/InMessageFormatters.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/InMessageHandlerActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/MessageFormats.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/MessageMarshallingActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/MessageNameConstants.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/MessageUmarshallingActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/OutMessageFormatters.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/OutMsgBuilderActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/Protocol.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/redis/AppsRedisPublisherActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/redis/AppsRedisSubscriberActor.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/redis/Message.scala (100%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{endpoint => old_endpoint}/redis/RedisPubSubActor.scala (100%) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Data.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Data.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/IncomingMessage.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/IncomingMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/IncomingMessage.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/MeetingMessage.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/MeetingMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/MeetingMessage.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/OutgoingMessage.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/OutgoingMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/OutgoingMessage.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Util.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/Util.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Util.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/ChatApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/ChatApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/ChatApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/data/Data.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/data/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/data/Data.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/messages/Messages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/chat/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/messages/Messages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/LayoutApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/LayoutApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/LayoutApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/data/Data.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/data/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/data/Data.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/messages/Messages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/layout/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/messages/Messages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/PresentationApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/PresentationApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/PresentationApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/data/Data.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/data/Data.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/data/Data.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/messages/Messages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/presentation/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/messages/Messages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/InMessage.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/InMessage.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Message.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Message.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/OutMessages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/OutMessages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Protocol.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Protocol.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/UsersApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/UsersApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/UsersApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/data/Model.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/data/Model.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/data/Model.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/messages/Messages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/messages/Messages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageHandler.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageHandler.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageHandler.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageMarshalling.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageMarshalling.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageMarshalling.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageUnmarshalling.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/users/protocol/UsersMessageUnmarshalling.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageUnmarshalling.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/utils/RandomStringGenerator.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/utils/RandomStringGenerator.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/utils/RandomStringGenerator.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/WhiteboardApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/WhiteboardApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/WhiteboardApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/data/Model.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/data/Model.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/data/Model.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/messages/Messages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/apps/whiteboard/messages/Messages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/messages/Messages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonInGW.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonInGW.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/MeetingActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/MeetingActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/RunningMeeting.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/RunningMeeting.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/SystemConfiguration.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/SystemConfiguration.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/User.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/User.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ConsoleDispatcher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ConsoleDispatcher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Constants.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Constants.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/InMessages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/InMessages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/MessageNames.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/MessageNames.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/OutMessages.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/OutMessages.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/TimestampGenerator.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/TimestampGenerator.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ValueObjects.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ValueObjects.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Versions.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Versions.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatInGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatInGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisPublisher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisRecorder.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisRecorder.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatMessageToJsonConverter.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatMessageToJsonConverter.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutInGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutInGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/Poll.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/Poll.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/Poll.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollInGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollInGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollMessageConverter.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollMessageConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollMessageConverter.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollModel.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollModel.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/QuestionType.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/QuestionType.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/QuestionType.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisPublisher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisRecorder.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/poll/redis/PollEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisRecorder.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationModel.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationModel.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PesentationMessageToJsonConverter.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PesentationMessageToJsonConverter.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisPublisher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisRecorder.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisRecorder.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/Users.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/Users.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersModel.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersModel.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisPublisher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisRecorder.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisRecorder.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersMessageToJsonConverter.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersMessageToJsonConverter.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceInGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceInGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardApp.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardApp.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardInGateway.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardInGateway.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardModel.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardModel.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/vo/ValueObjects.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/vo/ValueObjects.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingEventRedisPublisher.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingEventRedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingMessageToJsonConverter.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingMessageToJsonConverter.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/messaging/Util.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/messaging/Util.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/models/Values.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/models/Values.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/util/RandomStringGenerator.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/util/RandomStringGenerator.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/voice/VoiceConferenceActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/voice/VoiceConferenceActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageFormatters.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageFormatters.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageHandlerActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageHandlerActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageFormats.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageFormats.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageMarshallingActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageMarshallingActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageNameConstants.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageNameConstants.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageUmarshallingActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageUmarshallingActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMessageFormatters.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMessageFormatters.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMsgBuilderActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMsgBuilderActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/Protocol.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/Protocol.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisPublisherActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisPublisherActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisSubscriberActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisSubscriberActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/Message.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/Message.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/RedisPubSubActor.scala similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/RedisPubSubActor.scala From 5fe15691e1ffbcf017a0e138e1b78d022de7d2db Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 15:51:03 +0000 Subject: [PATCH 14/30] - cleanup --- .../org/bigbluebutton/old_apps/Data.scala | 22 - .../old_apps/IncomingMessage.scala | 6 - .../old_apps/MeetingMessage.scala | 9 - .../old_apps/OutgoingMessage.scala | 5 - .../org/bigbluebutton/old_apps/Util.scala | 27 - .../bigbluebutton/old_apps/chat/ChatApp.scala | 56 - .../old_apps/chat/data/Data.scala | 20 - .../old_apps/chat/messages/Messages.scala | 24 - .../old_apps/layout/LayoutApp.scala | 50 - .../old_apps/layout/data/Data.scala | 4 - .../old_apps/layout/messages/Messages.scala | 17 - .../presentation/PresentationApp.scala | 79 - .../old_apps/presentation/data/Data.scala | 9 - .../presentation/messages/Messages.scala | 57 - .../old_apps/protocol/InMessage.scala | 54 - .../old_apps/protocol/Message.scala | 64 - .../old_apps/protocol/OutMessages.scala | 31 - .../old_apps/protocol/Protocol.scala | 75 - .../old_apps/users/UsersApp.scala | 177 -- .../old_apps/users/data/Model.scala | 27 - .../old_apps/users/messages/Messages.scala | 130 - .../users/protocol/UsersMessageHandler.scala | 54 - .../protocol/UsersMessageMarshalling.scala | 59 - .../protocol/UsersMessageUnmarshalling.scala | 106 - .../utils/RandomStringGenerator.scala | 24 - .../old_apps/whiteboard/WhiteboardApp.scala | 17 - .../old_apps/whiteboard/data/Model.scala | 80 - .../whiteboard/messages/Messages.scala | 33 - .../old_core/BigBlueButtonActor.scala | 181 -- .../old_core/BigBlueButtonGateway.scala | 23 - .../old_core/BigBlueButtonInGW.scala | 479 ---- .../old_core/CollectorActor.scala | 2160 ----------------- .../old_core/CollectorGateway.scala | 22 - .../bigbluebutton/old_core/MeetingActor.scala | 265 -- .../old_core/RunningMeeting.scala | 35 - .../old_core/SystemConfiguration.scala | 20 - .../org/bigbluebutton/old_core/User.scala | 29 - .../old_core/api/ConsoleDispatcher.scala | 8 - .../old_core/api/Constants.scala | 96 - .../old_core/api/InMessages.scala | 447 ---- .../old_core/api/MessageNames.scala | 164 -- .../old_core/api/OutMessages.scala | 575 ----- .../old_core/api/TimestampGenerator.scala | 14 - .../old_core/api/ValueObjects.scala | 105 - .../bigbluebutton/old_core/api/Versions.scala | 5 - .../old_core/apps/chat/ChatApp.scala | 31 - .../old_core/apps/chat/ChatInGateway.scala | 19 - .../chat/redis/ChatEventRedisPublisher.scala | 38 - .../chat/redis/ChatEventRedisRecorder.scala | 29 - .../redis/ChatMessageToJsonConverter.scala | 67 - .../old_core/apps/layout/LayoutApp.scala | 66 - .../apps/layout/LayoutInGateway.scala | 21 - .../old_core/apps/poll/Poll.scala | 140 -- .../old_core/apps/poll/PollApp.scala | 123 - .../old_core/apps/poll/PollInGateway.scala | 56 - .../apps/poll/PollMessageConverter.scala | 190 -- .../old_core/apps/poll/PollModel.scala | 237 -- .../old_core/apps/poll/QuestionType.scala | 7 - .../poll/redis/PollEventRedisPublisher.scala | 114 - .../poll/redis/PollEventRedisRecorder.scala | 114 - .../apps/presentation/PresentationApp.scala | 154 -- .../apps/presentation/PresentationModel.scala | 127 - .../PesentationMessageToJsonConverter.scala | 281 --- .../PresentationEventRedisPublisher.scala | 111 - .../PresentationEventRedisRecorder.scala | 127 - .../old_core/apps/users/Users.scala | 133 - .../old_core/apps/users/UsersApp.scala | 447 ---- .../old_core/apps/users/UsersModel.scala | 101 - .../redis/UsersEventRedisPublisher.scala | 188 -- .../users/redis/UsersEventRedisRecorder.scala | 214 -- .../redis/UsersMessageToJsonConverter.scala | 359 --- .../old_core/apps/voice/VoiceApp.scala | 34 - .../old_core/apps/voice/VoiceInGateway.scala | 65 - .../apps/whiteboard/WhiteboardApp.scala | 100 - .../apps/whiteboard/WhiteboardInGateway.scala | 54 - .../apps/whiteboard/WhiteboardModel.scala | 87 - .../redis/WhiteboardEventRedisPublisher.scala | 56 - .../redis/WhiteboardEventRedisRecorder.scala | 92 - .../WhiteboardMessageToJsonConverter.scala | 94 - .../apps/whiteboard/vo/ValueObjects.scala | 3 - .../meeting/MeetingEventRedisPublisher.scala | 94 - .../MeetingMessageToJsonConverter.scala | 132 - .../old_core/messaging/Util.scala | 32 - .../old_core/models/Values.scala | 23 - .../old_core/util/RandomStringGenerator.scala | 17 - .../old_core/voice/VoiceConferenceActor.scala | 14 - .../old_endpoint/InMessageFormatters.scala | 37 - .../old_endpoint/InMessageHandlerActor.scala | 32 - .../old_endpoint/MessageFormats.scala | 90 - .../MessageMarshallingActor.scala | 23 - .../old_endpoint/MessageNameConstants.scala | 47 - .../MessageUmarshallingActor.scala | 93 - .../old_endpoint/OutMessageFormatters.scala | 14 - .../old_endpoint/OutMsgBuilderActor.scala | 21 - .../bigbluebutton/old_endpoint/Protocol.scala | 107 - .../redis/AppsRedisPublisherActor.scala | 45 - .../redis/AppsRedisSubscriberActor.scala | 41 - .../old_endpoint/redis/Message.scala | 3 - .../old_endpoint/redis/RedisPubSubActor.scala | 39 - 99 files changed, 10927 deletions(-) delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Data.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/IncomingMessage.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/MeetingMessage.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/OutgoingMessage.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Util.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/ChatApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/data/Data.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/messages/Messages.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/LayoutApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/data/Data.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/messages/Messages.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/PresentationApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/data/Data.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/messages/Messages.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/InMessage.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Message.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/OutMessages.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Protocol.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/UsersApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/data/Model.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/messages/Messages.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageHandler.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageMarshalling.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageUnmarshalling.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/utils/RandomStringGenerator.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/WhiteboardApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/data/Model.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/messages/Messages.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonActor.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonGateway.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonInGW.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorActor.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorGateway.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/MeetingActor.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/RunningMeeting.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/SystemConfiguration.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/User.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ConsoleDispatcher.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Constants.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/InMessages.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/MessageNames.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/OutMessages.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/TimestampGenerator.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ValueObjects.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Versions.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatApp.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatInGateway.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisPublisher.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisRecorder.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatMessageToJsonConverter.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutInGateway.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/Poll.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollApp.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollInGateway.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollMessageConverter.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollModel.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/QuestionType.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisPublisher.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisRecorder.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationApp.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationModel.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PesentationMessageToJsonConverter.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisPublisher.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisRecorder.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/Users.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersApp.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersModel.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisPublisher.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisRecorder.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersMessageToJsonConverter.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceApp.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceInGateway.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardApp.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardInGateway.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardModel.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/vo/ValueObjects.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingEventRedisPublisher.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingMessageToJsonConverter.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/messaging/Util.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/models/Values.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/util/RandomStringGenerator.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/voice/VoiceConferenceActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageFormatters.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageHandlerActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageFormats.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageMarshallingActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageNameConstants.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageUmarshallingActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMessageFormatters.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMsgBuilderActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/Protocol.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisPublisherActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisSubscriberActor.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/Message.scala delete mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/RedisPubSubActor.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Data.scala deleted file mode 100644 index b12c308a37..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Data.scala +++ /dev/null @@ -1,22 +0,0 @@ -package org.bigbluebutton.apps - -object Role extends Enumeration { - type RoleType = Value - val MODERATOR = Value("MODERATOR") - val VIEWER = Value("VIEWER") -} - -case class Duration(lengthInMinutes: Int, allowExtend: Boolean, maxDuration: Int) -case class VoiceConference(pin: Int, number: Int) -case class PhoneNumber(number: String, description: String) - -case class MeetingDescriptor(id: String, name: String, - record: Boolean, welcomeMessage: String, - logoutUrl: String, avatarUrl: String, - numUsers: Int, duration: Duration, - voiceConf: VoiceConference, phoneNumbers: Seq[PhoneNumber], - metadata: Map[String, String]) - -case class MeetingIdAndName(id: String, name: String) -case class Session(id: String, meeting: MeetingIdAndName) - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/IncomingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/IncomingMessage.scala deleted file mode 100644 index 62ae04f80a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/IncomingMessage.scala +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.apps - -sealed abstract class InMsg - -case class CreateMessageRequest(id: String) extends InMsg - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/MeetingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/MeetingMessage.scala deleted file mode 100644 index 10e277ab0b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/MeetingMessage.scala +++ /dev/null @@ -1,9 +0,0 @@ -package org.bigbluebutton.apps - -case class CreateMeeting(descriptor: MeetingDescriptor) -case class CreateMeetingResponse(success: Boolean, - descriptor: MeetingDescriptor, - message: String, - session: Session) - -case class MeetingCreated(session: Session, meeting: MeetingDescriptor) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/OutgoingMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/OutgoingMessage.scala deleted file mode 100644 index 20d39654af..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/OutgoingMessage.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.apps - -sealed abstract class OutMsg - -case class MeetingCreatedEvent(id: String) extends OutMsg \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Util.scala deleted file mode 100644 index 67b64dd847..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/Util.scala +++ /dev/null @@ -1,27 +0,0 @@ -package org.bigbluebutton.apps - -import org.apache.commons.codec.digest.DigestUtils -import java.util.TimeZone -import java.text.DateFormat -import java.text.SimpleDateFormat -import java.util.Date - -/** - * Some utilities. - */ -object Util { - - /** - * Convert the external meeting id passed from 3rd-party applications - * into an internal meeting id. - */ - def toInternalMeetingId(externalMeetingId: String) = - DigestUtils.sha1Hex(externalMeetingId) - - def generateTimestamp(): String = { - val tz: TimeZone = TimeZone.getTimeZone("UTC"); - val df: DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); - df.setTimeZone(tz); - df.format(new Date()); - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/ChatApp.scala deleted file mode 100644 index 695453d0ad..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/ChatApp.scala +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.apps.chat - -import org.bigbluebutton.apps.chat.data._ -import org.bigbluebutton.apps.users.data._ - -object ChatApp { - -} - -class ChatApp { - private var privateChats = new collection.immutable.HashMap[String, PrivateChatConversation]() - private var publicChat = new PublicChatConversation(Seq()) - - private var counter = 0 - - def generateMessageId(): String = { - counter += 1 - "msg".concat(counter.toString) - } - - def savePrivateChat(conv: PrivateChatConversation) = { - privateChats += conv.id -> conv - } - - def getConversionId(msg: PrivateMessage): String = { - val from = new collection.immutable.StringOps(msg.from.id) - val to = new collection.immutable.StringOps(msg.to.id) - - if (from < to) from.concat("-").concat(to) else to.concat("-").concat(from) - - } - - def newPrivateChatMessage(msg: PrivateMessage) = { - val convId = getConversionId(msg) - val conversation = privateChats.get(convId) - conversation match { - case Some(conv) => { - val x = conv.copy(messages = (conv.messages :+ msg)) - savePrivateChat(x) - } - case None => { - val chat = new PrivateChatConversation(convId, Seq()) - val x = chat.copy(messages = (chat.messages :+ msg)) - savePrivateChat(x) - } - } - } - - def newPublicChatMessages(msg: PublicMessage) = { - publicChat = publicChat.copy(messages = (publicChat.messages :+ msg)) - } - - def getPublicChatHistory(): Array[PublicMessage] = { - publicChat.messages.toArray - } -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/data/Data.scala deleted file mode 100644 index 08e52b83c0..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/data/Data.scala +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.apps.chat.data - -import org.bigbluebutton.apps.users.data.UserIdAndName - -case class Text(lang: String, text: String) -case class TextFont(color: Int, size: Int, fontType: String) - -case class Translation(lang: String, text: String) - -case class PrivateMessage(id: String, timestamp: Long, from: UserIdAndName, - to: UserIdAndName, - font: TextFont, text: Text, - translations: Option[Seq[Translation]] = None) -case class PublicMessage(id: String, timestamp: Long, from: UserIdAndName, - font: TextFont, text: Text, - translations: Option[Seq[Translation]] = None) - -case class PublicChatConversation(messages: Seq[PublicMessage]) - -case class PrivateChatConversation(id: String, messages: Seq[PrivateMessage]) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/messages/Messages.scala deleted file mode 100644 index 2ca062a874..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/chat/messages/Messages.scala +++ /dev/null @@ -1,24 +0,0 @@ -package org.bigbluebutton.apps.chat.messages - -import org.bigbluebutton.apps.chat.data.Text -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.data.UserIdAndName -import org.bigbluebutton.apps.chat.data._ - -case class GetPublicChatHistory(session: Session, requester: UserIdAndName) -case class GetPublicChatHistoryResponse(session: Session, - requester: UserIdAndName, - messages: Seq[PublicMessage]) - -case class NewPrivateChatMessage(session: Session, - from: UserIdAndName, - font: TextFont, text: Text, - to: UserIdAndName) - -case class SendPrivateChatMessage(session: Session, message: PrivateMessage) - -case class NewPublicChatMessage(session: Session, - from: UserIdAndName, - font: TextFont, text: Text) - -case class SendPublicChatMessage(session: Session, message: PublicMessage) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/LayoutApp.scala deleted file mode 100644 index f202b7da0c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/LayoutApp.scala +++ /dev/null @@ -1,50 +0,0 @@ -package org.bigbluebutton.apps.layout - -import org.bigbluebutton.apps.layout.data.Layout - -class LayoutApp { - private var layouts = new collection.immutable.HashMap[String, Layout]() - - private var layoutLocked = false - - private def saveLayout(layout: Layout) = { - layouts += layout.id -> layout - } - - def currentLayout(): Option[Layout] = { - layouts.values find { l => l.current } - } - - def newLayout(id: String, layout: String, default: Boolean): Layout = { - val lout = Layout(id, layout, default) - saveLayout(lout) - lout - } - - def deactivateCurrentLayout() = { - currentLayout foreach { cl => - saveLayout(cl.copy(current = false)) - } - } - - def lockLayout(id: String, lock: Boolean): Option[Layout] = { - layouts.get(id) match { - case Some(lout) => { - layoutLocked = lock - Some(lout) - } - case None => None - } - } - - def setLayout(id: String): Option[Layout] = { - layouts.get(id) match { - case Some(lout) => { - val l = lout.copy(current = true) - saveLayout(l) - Some(l) - } - case None => None - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/data/Data.scala deleted file mode 100644 index a154f3f688..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/data/Data.scala +++ /dev/null @@ -1,4 +0,0 @@ -package org.bigbluebutton.apps.layout.data - -case class Layout(id: String, layout: String, default: Boolean = false, - current: Boolean = false) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/messages/Messages.scala deleted file mode 100644 index 7ad22a09e9..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/layout/messages/Messages.scala +++ /dev/null @@ -1,17 +0,0 @@ -package org.bigbluebutton.apps.layout.messages - -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.data.UserIdAndName - -case class NewLayout(session: Session, layoutId: String, - layout: String, default: Boolean = false) -case class GetCurrentLayoutRequest(session: Session, requester: UserIdAndName) -case class SetLayoutRequest(session: Session, requester: UserIdAndName, layoutId: String) -case class LockLayoutRequest(session: Session, requester: UserIdAndName, - lock: Boolean, layoutId: String) - -case class GetCurrentLayoutResponse(session: Session, - requester: UserIdAndName, - layoutId: String) -case class SetLayout(session: Session, requester: UserIdAndName, layoutId: String) -case class LockedLayout(session: Session, requester: UserIdAndName, lock: Boolean, layoutId: String) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/PresentationApp.scala deleted file mode 100644 index 0fe51111aa..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/PresentationApp.scala +++ /dev/null @@ -1,79 +0,0 @@ -package org.bigbluebutton.apps.presentation - -import org.bigbluebutton.apps.presentation.data._ - -class PresentationApp { - private var presentations = new collection.immutable.HashMap[String, Presentation]() - - private var currentPresentation: Option[Presentation] = None - - private def savePresentation(p: Presentation) = { - presentations += p.id -> p - } - - def clearPresentation(id: String) = { - currentPresentation foreach { cp => - if (cp.id == id) currentPresentation = None - } - } - - private def getPresentation(id: String): Option[Presentation] = { - presentations.get(id) - } - - private def getPage(pres: Presentation, page: Int): Option[Page] = { - pres.pages find { x => x.num == page } - } - - private def remove(id: String) = { - presentations -= id - } - - def removePresentation(id: String): Option[Presentation] = { - val pres = getPresentation(id) - remove(id) - pres - } - - def newPresentation(pres: Presentation) = { - savePresentation(pres) - } - - def sharePresentation(id: String): Option[Presentation] = { - val pres = presentations.get(id) - pres foreach { p => currentPresentation = Some(p) } - pres - } - - def setCurrentPageForPresentation(pres: Presentation, page: Page): Option[Presentation] = { - val newPres = pres.copy(currentPage = page.num) - savePresentation(newPres) - Some(newPres) - } - - def displayPage(presentation: String, num: Int): Option[Page] = { - for { - pres <- getPresentation(presentation) - page <- getPage(pres, num) - newpres <- setCurrentPageForPresentation(pres, page) - } yield page - } - - private def changePagePosition(pres: Presentation, page: Page, - position: Position): Page = { - val newPage = page.copy(position = position) - val otherPages = pres.pages filterNot { op => op.num == page.num } - val newPages = otherPages :+ newPage - val newPres = pres.copy(pages = newPages) - newPage - } - - def resizeAndMovePage(id: String, pageNum: Int, - position: Position): Option[Page] = { - for { - pres <- getPresentation(id) - page <- getPage(pres, pageNum) - newPage = changePagePosition(pres, page, position) - } yield newPage - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/data/Data.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/data/Data.scala deleted file mode 100644 index 1a3f130e4e..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/data/Data.scala +++ /dev/null @@ -1,9 +0,0 @@ -package org.bigbluebutton.apps.presentation.data - -case class Position(xOffset: Double = 0, yOffset: Double = 0, - widthRatio: Double = 100, heightRatio: Double = 100) -case class Page(num: Int, location: String, position: Position) - -case class PresentationIdAndName(id: String, name: String) -case class Presentation(id: String, name: String, currentPage: Int = 1, - pages: Seq[Page]) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/messages/Messages.scala deleted file mode 100644 index 545025e031..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/presentation/messages/Messages.scala +++ /dev/null @@ -1,57 +0,0 @@ -package org.bigbluebutton.apps.presentation.messages - -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.data.UserIdAndName -import org.bigbluebutton.apps.presentation.data._ - -case class ClearPresentation(session: Session, - presentation: PresentationIdAndName, - clearedBy: UserIdAndName) - -case class PresentationCleared(session: Session, - presentation: PresentationIdAndName, - clearedBy: UserIdAndName) - -case class RemovePresentation(session: Session, - presentation: PresentationIdAndName, - removedBy: UserIdAndName) - -case class PresentationRemoved(session: Session, - presentation: PresentationIdAndName, - removedBy: UserIdAndName) - -case class SendCursorUpdate(session: Session, - xPercent: Double, yPercent: Double) -case class UpdateCursorPosition(session: Session, - xPercent: Double, yPercent: Double) - -case class ResizeAndMovePage(session: Session, - presentation: PresentationIdAndName, - page: Int, - position: Position) -case class PageMoved(session: Session, - presentation: PresentationIdAndName, - page: Page) - -case class DisplayPage(session: Session, - presentation: PresentationIdAndName, - page: Int) - -case class PageDisplayed(session: Session, - presentation: PresentationIdAndName, - page: Page) - -case class SharePresentation(session: Session, - presentation: PresentationIdAndName) - -case class PresentationShared(session: Session, presentation: Presentation) - -case class PreuploadedPresentations(session: Session, - presentations: Seq[Presentation]) - -case class PresentationConverted(session: Session, - presentation: Presentation) - -case class PresentationConversionUpdate(meetingID: String, msg: Map[String, Object]) -case class GetPresentationInfo(meetingID: String, requesterID: String) -case class GetSlideInfo(meetingID: String, requesterID: String) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/InMessage.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/InMessage.scala deleted file mode 100644 index c00384aaea..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/InMessage.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import org.bigbluebutton.apps.users.data.UserIdAndName - -trait InMessage - -// Poll Messages -case class PreCreatedPoll(meetingID: String, poll: PollVO) extends InMessage -case class CreatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage -case class UpdatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage -case class GetPolls(meetingID: String, requesterID: String) extends InMessage -case class DestroyPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class RemovePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class SharePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class ShowPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class HidePollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class StopPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class StartPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class ClearPoll(meetingID: String, requesterID: String, pollID: String, force: Boolean = false) extends InMessage -case class GetPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class RespondToPoll(meetingID: String, requesterID: String, response: PollResponseVO) extends InMessage - -case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) -case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) -case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) -case class QuestionResponsesVO(val questionID: String, val responseIDs: Array[String]) -case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) -case class ResponderVO(responseID: String, user: Responder) -case class Responder(val userID: String, name: String) - -case class SendVoiceUsersRequest(meetingID: String, requesterID: String) extends InMessage -case class MuteMeetingRequest(meetingID: String, requesterID: String, mute: Boolean) extends InMessage -case class IsMeetingMutedRequest(meetingID: String, requesterID: String) extends InMessage -case class MuteUserRequest(meetingID: String, requesterID: String, userID: String, mute: Boolean) extends InMessage -case class LockUserRequest(meetingID: String, requesterID: String, userID: String, lock: Boolean) extends InMessage -case class EjectUserRequest(meetingID: String, requesterID: String, userID: String) extends InMessage -case class VoiceUserJoinedMessage(meetingID: String, user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, - muted: Boolean, talking: Boolean) extends InMessage - -case class VoiceUserLeftMessage(meetingID: String, user: String, voiceConfId: String) extends InMessage -case class VoiceUserMutedMessage(meetingID: String, user: String, voiceConfId: String, muted: Boolean) extends InMessage -case class VoiceUserTalkingMessage(meetingID: String, user: String, voiceConfId: String, talking: Boolean) extends InMessage -case class VoiceStartedRecordingMessage(meetingID: String, voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends InMessage - -// Need these extra classes since InMessage needs meetingID as parameter and -// our messages from FreeSWITCH doesn't have it. -trait VoiceMessage -case class VoiceUserJoined(user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, muted: Boolean, speaking: Boolean) extends VoiceMessage - -case class VoiceUserLeft(user: String, voiceConfId: String) extends VoiceMessage -case class VoiceUserMuted(user: String, voiceConfId: String, muted: Boolean) extends VoiceMessage -case class VoiceUserTalking(user: String, voiceConfId: String, talking: Boolean) extends VoiceMessage -case class VoiceStartedRecording(voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends VoiceMessage - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Message.scala deleted file mode 100644 index 8ccd7dbb65..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Message.scala +++ /dev/null @@ -1,64 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json.DefaultJsonProtocol -import spray.json.JsValue -import spray.json.JsObject -import spray.json.JsonParser -import Message._ - -import org.parboiled.errors.ParsingException - -object Message { - case class Meeting(id: String, name: String, session: String) - case class MessageHeader(name: String, timestamp: Long, meeting: Meeting) - case class MessageEvent(header: MessageHeader, payload: JsValue) -} - -object MessageHeaderJsonProtocol extends DefaultJsonProtocol { - implicit val meetingFormat = jsonFormat3(Meeting) - implicit val messageHeaderFormat = jsonFormat3(MessageHeader) -} - -import MessageHeaderJsonProtocol._ - -object MessageHandler { - def extractMessageHeader(msg: JsObject): Option[MessageHeader] = { - msg.fields.get("header") match { - case Some(header) => { - val h = header.convertTo[MessageHeader] - Some(h) - } - case None => None - } - } - - def extractPayload(msg: JsObject): Option[JsValue] = { - msg.fields.get("payload") - } - - def processMessage(msg: String): Option[JsObject] = { - try { - val msgObject = JsonParser(msg).asJsObject - Some(msgObject) - } catch { - case e: ParsingException => None - } - } - - def forwardMessage(header: MessageHeader, payload: JsValue) { - - } - - def handleMessage(jsonMsg: String) { - val jsonObj = processMessage(jsonMsg) - if (jsonObj != None) { - val msgObj = jsonObj get - val header = extractMessageHeader(msgObj) - val payload = extractPayload(msgObj) - - if (header != None && payload != None) { - forwardMessage(header get, payload get) - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/OutMessages.scala deleted file mode 100644 index c7060c6fd1..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/OutMessages.scala +++ /dev/null @@ -1,31 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.MeetingDescriptor -import spray.json.DefaultJsonProtocol -import org.bigbluebutton.apps.Duration -import org.bigbluebutton.apps.PhoneNumber -import org.bigbluebutton.apps.MeetingDescriptor - -/* -object MyJsonProtocol extends DefaultJsonProtocol { - implicit val sessionFormat = jsonFormat3(Session) - implicit val usersDefFormat = jsonFormat2(MaxUsers) - implicit val durationDefFormat = jsonFormat3(MeetingDuration) - implicit val voiceConfDefFormat = jsonFormat2(VoiceConfAndPin) - implicit val phoneNumberDefFormat = jsonFormat2(PhoneNumber) - implicit val meetingDefFormat = jsonFormat11(MeetingDescriptor) -} -*/ -case class CreateMeetingRequestReply(created: Boolean, message: String, session: Session) - -case class MeetingHeader(name: String, externalId: String, session: String) - -case class UserRegistered(meeting: MeetingHeader, user: RegisteredUser) -case class EndAndKickAll(meeting: MeetingHeader) -case class GetUsersReply(meeting: MeetingHeader, users: Seq[JoinedUser]) -case class PresenterAssigned(meeting: MeetingHeader, newPresenter: UserIdAndName, assignedBy: UserIdAndName) -case class UserJoined(meeting: MeetingHeader, user: JoinedUser) -case class UserLeft(meeting: MeetingHeader, user: UserIdAndName) -case class UserStatusChange(meeting: MeetingHeader, user: UserIdAndName, status: String, value: Object) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Protocol.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Protocol.scala deleted file mode 100644 index 9d01448b6b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/protocol/Protocol.scala +++ /dev/null @@ -1,75 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json.JsValue -import org.bigbluebutton.apps.users.data.{ RegisterUser, JoinedUser } -import spray.json.DefaultJsonProtocol -import spray.httpx.SprayJsonSupport - -case class Destination(to: String, correlation_id: Option[String]) -case class ReplyDestination(to: String, correlation_id: String) - -case class Header(destination: Destination, name: String, - timestamp: String, source: String, - reply: Option[ReplyDestination]) - -case class HeaderMeeting(name: String, id: String, session: Option[String]) - -case class HeaderAndJsonMessage(header: Header, jsonMessage: String) -case class ReplyStatus(status: String, message: String, error: Option[Int]) - -case class StatusCode(code: Int, message: String) -case class ErrorCode(code: Int, message: String, details: Option[String] = None) -case class Response(status: StatusCode, errors: Option[Seq[ErrorCode]] = None) - -case class ResponsePayload(response: Response) -case class JsonResponse(header: Header, payload: Option[ResponsePayload] = None) - -case class MessageProcessException(message: String) extends Exception(message) - -object HeaderAndPayloadJsonSupport extends DefaultJsonProtocol with SprayJsonSupport { - implicit val statusCodeFormat = jsonFormat2(StatusCode) - implicit val errorCodeFormat = jsonFormat3(ErrorCode) - implicit val responseFormat = jsonFormat2(Response) - implicit val headerDestinationFormat = jsonFormat2(Destination) - implicit val headerMeetingFormat = jsonFormat3(HeaderMeeting) - implicit val replyDestinationFormat = jsonFormat2(ReplyDestination) - implicit val headerFormat = jsonFormat5(Header) - implicit val headerAndPayloadFormat = jsonFormat2(HeaderAndJsonMessage) - implicit val responsePayloadFormat = jsonFormat1(ResponsePayload) - implicit val jsonResponseFormat = jsonFormat2(JsonResponse) -} - -object StatusCodes extends Enumeration { - type StatusCodeType = Value - - val OK = Value(200, "OK") - val NOT_MODIFIED = Value(304, "Not Modified") - val BAD_REQUEST = Value(400, "Bad Request") - val UNAUTHORIZED = Value(401, "Unauthorized") - val FORBIDDEN = Value(403, "Forbidden") - val NOT_FOUND = Value(404, "Not Found") - val NOT_ACCEPTABLE = Value(406, "Not Acceptable") - val INTERNAL_SERVER_ERROR = Value(500, "Internal Server Error") - val BAD_GATEWAY = Value(502, "Bad Gateway") - val SERVICE_UNAVAILABLE = Value(503, "Service Unavailable") -} - -object StatusCodeBuilder { - def buildStatus(codeType: StatusCodes.StatusCodeType): StatusCode = { - StatusCode(codeType.id, codeType.toString()) - } -} - -object ErrorCodes extends Enumeration { - type ErrorCodeType = Value - - val INVALID_TOKEN = Value(1, "Invalid or expired token") - val INVALID_MESSAGE = Value(2, "Invalid message") - -} - -object ErrorCodeBuilder { - def buildError(codeType: ErrorCodes.ErrorCodeType, details: String): ErrorCode = { - ErrorCode(codeType.id, codeType.toString(), Some(details)) - } -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/UsersApp.scala deleted file mode 100644 index 4a6a3427e2..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/UsersApp.scala +++ /dev/null @@ -1,177 +0,0 @@ -package org.bigbluebutton.apps.users - -import org.bigbluebutton.apps.utils.RandomStringGenerator -import org.bigbluebutton.apps.Role -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.MeetingDescriptor - -object UsersApp { - def apply() = new UsersApp() -} - -class UsersApp private { - import UsersApp._ - - private var registeredUsers = - new collection.immutable.HashMap[String, RegisteredUser] - - private var joinedUsers = - new collection.immutable.HashMap[String, JoinedUser] - - private var presenterAssignedBy = SystemUser - - def registered: Array[RegisteredUser] = registeredUsers.values toArray - - def joined: Array[JoinedUser] = joinedUsers.values toArray - - def isRegistered(token: String) = registeredUsers.get(token) != None - - def getRegisteredUser(token: String) = registeredUsers.get(token) - - private def add(user: RegisteredUser) = registeredUsers += user.token -> user - - private def add(token: String, ruser: RegisterUser): JoinedUser = { - val userId = generateValidUserId - val webIdent = WebIdentity() - val voceIdent = VoiceIdentity(callerId = CallerId(ruser.name, ruser.name), - muted = true, - locked = false, - talking = false, - metadata = Map("name" -> ruser.name)) - - val user = JoinedUser(userId, token, ruser, false, webIdent, voceIdent) - - addJoinedUser(user) - user - } - - private def addJoinedUser(user: JoinedUser) = joinedUsers += (user.id -> user) - private def save(user: JoinedUser) = joinedUsers += (user.id -> user) - - private def remove(id: String): Option[JoinedUser] = { - joinedUsers get (id) match { - case Some(user) => { - joinedUsers -= id - Some(user) - } - case None => None - } - } - - def exist(id: String): Boolean = joinedUsers.get(id) != None - - private def generateValidToken: String = { - val token = RandomStringGenerator.randomAlphanumericString(12) - if (!isRegistered(token)) token else generateValidToken - } - - private def generateValidUserId: String = { - val userId = RandomStringGenerator.randomAlphanumericString(6) - if (!exist(userId)) userId else generateValidUserId - } - - def register(user: RegisterUser): RegisteredUser = { - val token = generateValidToken - val u = RegisteredUser(token, user) - add(u) - u - } - - def join(token: String): Option[JoinedUser] = { - for { - ruser <- getRegisteredUser(token) - user = add(token, ruser.user) - } yield user - } - - def makeAllUsersViewer() = { - joined foreach { u => - makeViewer(u) - } - } - - def makePresenter(user: JoinedUser) = { - val u = user.copy(isPresenter = true) - joinedUsers += (user.id -> user) - } - - def makeViewer(user: JoinedUser) = { - val u = user.copy(isPresenter = false) - joinedUsers += (user.id -> user) - } - - def moderators: Array[JoinedUser] = - joinedUsers.values filter (p => p.user.role == Role.MODERATOR) toArray - - def viewers: Array[JoinedUser] = - joinedUsers.values filter (p => p.user.role == Role.VIEWER) toArray - - def hasPresenter(): Boolean = { - currentPresenter match { - case None => false - case Some(p) => true - } - } - - def currentPresenter: Option[JoinedUser] = - joinedUsers.values find (p => p.isPresenter) - - def getJoinedUser(id: String): Option[JoinedUser] = joinedUsers.get(id) - - def left(id: String): Option[JoinedUser] = { - remove(id) - } - - def findAModerator: Option[JoinedUser] = - joinedUsers.values find (m => m.user.role == Role.MODERATOR) - - private def raiseHand(user: JoinedUser, raised: Boolean): JoinedUser = { - val juser = user.copy(webIdentity = user.webIdentity.copy(handRaised = raised)) - addJoinedUser(juser) - juser - } - - def raiseHand(id: String, raise: Boolean): Option[JoinedUser] = { - for { - u <- getJoinedUser(id) - juser = raiseHand(u, raise) - } yield juser - } - - def joinVoiceUser(userId: String, voiceIdent: VoiceIdentity, - meeting: MeetingDescriptor): JoinedUser = { - - getJoinedUser(userId) match { - case Some(u) => { - val juser = u.copy(voiceIdentity = voiceIdent) - addJoinedUser(juser) - juser - } - case None => { - val uid = generateValidUserId - val token = generateValidToken - val usr = RegisterUser(uid, voiceIdent.callerId.name, Role.VIEWER, - meeting.voiceConf.pin, meeting.welcomeMessage, - meeting.logoutUrl, meeting.avatarUrl) - - val webIdent = WebIdentity() - val juser = JoinedUser(uid, token, usr, false, webIdent, voiceIdent) - addJoinedUser(juser) - juser - } - } - } - - private def muteUser(user: JoinedUser, muted: Boolean): JoinedUser = { - val juser = user.copy(voiceIdentity = user.voiceIdentity.copy(muted = muted)) - addJoinedUser(juser) - juser - } - - def userMuted(userId: String, muted: Boolean): Option[JoinedUser] = { - for { - u <- getJoinedUser(userId) - juser = muteUser(u, muted) - } yield juser - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/data/Model.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/data/Model.scala deleted file mode 100644 index 9533527b83..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/data/Model.scala +++ /dev/null @@ -1,27 +0,0 @@ -package org.bigbluebutton.apps.users.data - -import org.bigbluebutton.apps.Role - -case class WebIdentity(handRaised: Boolean = false) - -case class CallerId(name: String, number: String) -case class VoiceIdentity(callerId: CallerId, muted: Boolean = false, - locked: Boolean = false, talking: Boolean = false, - metadata: Map[String, String]) - -case class UserIdAndName(id: String, name: String) - -object SystemUser extends UserIdAndName(id = "system", name = "System") - -case class JoinedUser(id: String, token: String, user: RegisterUser, - isPresenter: Boolean = false, - webIdentity: WebIdentity, - voiceIdentity: VoiceIdentity) - -case class RegisteredUser(token: String, user: RegisterUser) - -case class RegisterUser(externalId: String, name: String, - role: Role.RoleType, pin: Int, welcomeMessage: String, - logoutUrl: String, avatarUrl: String) - -case class Presenter(presenter: UserIdAndName, assignedBy: UserIdAndName) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/messages/Messages.scala deleted file mode 100644 index bee698b02d..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/messages/Messages.scala +++ /dev/null @@ -1,130 +0,0 @@ -package org.bigbluebutton.apps.users.messages - -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.data.RegisterUser -import org.bigbluebutton.apps.users.data.Presenter -import org.bigbluebutton.apps.users.data.JoinedUser -import org.bigbluebutton.apps.users.data.UserIdAndName -import org.bigbluebutton.apps.users.data.CallerId - -trait MeetingMessage { def session: Session } - -case class Result(success: Boolean, message: String) - -/** - * Message from 3rd-party to register a user. - */ -case class RegisterUserRequest(session: Session, user: RegisterUser) extends MeetingMessage - -/** - * Reply message for the register user request. - */ -case class RegisterUserResponse(session: Session, result: Result, - token: String, user: RegisterUser) - -/** - * Message from 3rd-party for a user joining the meeting. - */ -case class UserJoinRequest(session: Session, token: String) - -/** - * Reply to the join user request. - */ -case class UserJoinResponse(session: Session, result: Result, - user: Option[JoinedUser]) - -/** - * Broadcast message to interested parties that a user has joined the meeting. - */ -case class UserJoined(session: Session, token: String, user: JoinedUser) - -/** - * Message that a user is leaving the meeting. - */ -case class UserLeave(session: Session, userId: String) - -/** - * Broadcast message to interested parties that a user has left the meeting. - */ -case class UserLeft(session: Session, user: JoinedUser) - -/** - * Message toq uery for a list of users in a meeting. - */ -case class GetUsersRequest(session: Session, requesterId: String) - -/** - * Reply to the get user request. - */ -case class GetUsersResponse(session: Session, requesterId: String, users: Seq[JoinedUser]) - -/** - * Message to assign a presenter. - */ -case class AssignPresenter(session: Session, presenter: Presenter) - -/** - * Broadcast message to tell users that a new presenter has been assigned. - */ -case class BecomePresenter(session: Session, presenter: Presenter) - -/** - * Broadcast message to tell users to become viewer. - */ -case class BecomeViewer(session: Session) - -/** - * Message that a user raised hand. - */ -case class RaiseHand(session: Session, user: UserIdAndName) - -/** - * Broadcast message that a user has raised her hand. - */ -case class HandRaised(session: Session, user: UserIdAndName) - -/** - * Message that a user has lowered hand. - */ -case class LowerHand(session: Session, user: UserIdAndName, loweredBy: UserIdAndName) - -/** - * Broadcast that a user has lowered hand. - */ -case class HandLowered(session: Session, user: UserIdAndName, loweredBy: UserIdAndName) - -/** - * Message that informs a user has joined the voice conference. - */ -case class VoiceUserJoin(userId: String, voiceConfId: String, callerId: CallerId, - muted: Boolean, locked: Boolean, talking: Boolean, - metadata: Map[String, String]) - -/** - * Message to mute a user. - */ -case class MuteUser(session: Session, user: UserIdAndName, mute: Boolean, mutedBy: UserIdAndName) - -/** - * Broadcast message that a user will be muted. - */ -case class MuteUserRequest(session: Session, user: UserIdAndName, mute: Boolean, mutedBy: UserIdAndName) - -/** - * Message to voice conference server to mute the user. - */ -case class UserMuteRequest(session: Session, user: UserIdAndName, mute: Boolean, - metadata: Map[String, String]) - -/** - * Message from voice conference server that the user has been muted. - */ -case class UserMuted(userId: String, muted: Boolean, metadata: Map[String, String]) - -case class UserHasBeenMuted(session: Session, user: UserIdAndName, muted: Boolean) - -case class LockUser(session: Session, user: UserIdAndName, lock: Boolean, lockedBy: UserIdAndName) - -case class LockedUser(session: Session, user: UserIdAndName, lock: Boolean, lockedBy: UserIdAndName) - -case class UserTalking(session: Session, user: UserIdAndName, talking: Boolean) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageHandler.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageHandler.scala deleted file mode 100644 index 5f200fccc1..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageHandler.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.apps.users.protocol - -import akka.actor.{ Actor, Props, ActorRef, ActorLogging } -import akka.event.LoggingAdapter -import akka.pattern.{ ask, pipe } - -import org.bigbluebutton.endpoint.MessageHandlerActor -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.messages.UserJoinRequest -import org.bigbluebutton.apps.users.messages.UserJoinResponse -import org.bigbluebutton.SystemConfiguration -import org.bigbluebutton.apps.Util -import org.bigbluebutton.endpoint.InMsgNameConst -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.users.messages.Result -import org.bigbluebutton.apps.users.messages.UserJoinResponse -import org.bigbluebutton.apps.protocol.Destination -import org.bigbluebutton.endpoint.InMsgNameConst -import org.bigbluebutton.endpoint.UserJoinResponseMessage -import org.bigbluebutton.endpoint.UserJoinRequestFormat - -trait UsersMessageHandler extends SystemConfiguration { - this: MessageHandlerActor => - - val bbbAppsActor: ActorRef - val messageMarshallingActor: ActorRef - val log: LoggingAdapter - - def handleUserJoinRequestMessage(msg: UserJoinRequestFormat) = { - val session = Session(msg.payload.session, msg.payload.meeting) - val replyDestination = msg.header.reply - - replyDestination foreach { replyTo => - val header = Header(Destination(replyTo.to, Some(replyTo.correlation_id)), - InMsgNameConst.UserJoinResponse, - Util.generateTimestamp, apiSourceName, None) - - val userJoinRequest = UserJoinRequest(session, msg.payload.token) - val response = (bbbAppsActor ? userJoinRequest) - .mapTo[UserJoinResponse] - .map(response => { - UserJoinResponseMessage(header, response) - }) - .recover { - case _ => - val result = Result(false, "Timeout waiting for response.") - val response = UserJoinResponse(session, result, None) - UserJoinResponseMessage(header, response) - } - - response pipeTo messageMarshallingActor - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageMarshalling.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageMarshalling.scala deleted file mode 100644 index 2efb888cc0..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageMarshalling.scala +++ /dev/null @@ -1,59 +0,0 @@ -package org.bigbluebutton.apps.users.protocol - -import akka.actor.ActorRef -import akka.event.LoggingAdapter -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.apps.users.messages.UserJoined -import org.bigbluebutton.endpoint.MessageMarshallingActor -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.users.messages.UserJoinResponse -import org.bigbluebutton.endpoint.redis.JsonMessage -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.endpoint.UserMessagesProtocol -import org.bigbluebutton.endpoint.UserJoinResponseMessage -import org.bigbluebutton.endpoint.UserJoinResponseFormatPayload -import org.bigbluebutton.endpoint.UserJoinResponseFormat -import org.bigbluebutton.endpoint.UserFormat -import org.bigbluebutton.endpoint.ResultFormat - -trait UsersMessageMarshalling { - this: MessageMarshallingActor => - - val pubsubActor: ActorRef - val log: LoggingAdapter - - private def publishUserJoinResponse(header: Header, payload: UserJoinResponseFormatPayload) = { - import UserMessagesProtocol._ - - val jsonFormatMsg = UserJoinResponseFormat(header, payload).toJson - val jsonMsg = JsonMessage(header.destination.to, jsonFormatMsg.compactPrint) - pubsubActor ! jsonMsg - } - - def marshallUserJoinResponseMessage(msg: UserJoinResponseMessage) = { - val result = ResultFormat(msg.response.result.success, - msg.response.result.message) - - msg.response.user match { - case Some(usr) => { - val user = UserFormat(usr.id, usr.user.externalId, usr.user.name, - usr.user.role, usr.user.pin, - usr.user.welcomeMessage, - usr.user.logoutUrl, usr.user.avatarUrl) - - val payload = UserJoinResponseFormatPayload( - msg.response.session.meeting, - msg.response.session.id, - result, Some(user)) - publishUserJoinResponse(msg.header, payload) - } - case None => { - val payload = UserJoinResponseFormatPayload( - msg.response.session.meeting, msg.response.session.id, - result, None) - publishUserJoinResponse(msg.header, payload) - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageUnmarshalling.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageUnmarshalling.scala deleted file mode 100644 index e3e0630c09..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/users/protocol/UsersMessageUnmarshalling.scala +++ /dev/null @@ -1,106 +0,0 @@ -package org.bigbluebutton.apps.users.protocol - -import akka.actor.ActorRef -import akka.event.LoggingAdapter -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import org.parboiled.errors.ParsingException -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.users.messages._ -import org.bigbluebutton.apps.users.data.Presenter -import org.bigbluebutton.apps.protocol.MessageProcessException -import org.bigbluebutton.apps.protocol.HeaderAndJsonMessage -import org.bigbluebutton.endpoint.MessageUnmarshallingActor -import org.bigbluebutton.apps.Session -import org.bigbluebutton.endpoint.UserMessagesProtocol -import org.bigbluebutton.endpoint.UserLeaveMessage -import org.bigbluebutton.endpoint.UserJoinRequestFormat -import org.bigbluebutton.endpoint.GetUsersRequestMessage -import org.bigbluebutton.endpoint.AssignPresenterMessage - -trait UsersMessageUnmarshalling { - this: MessageUnmarshallingActor => - - val messageHandlerActor: ActorRef - val log: LoggingAdapter - - def handleUserJoin(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage): Option[UserJoinRequestFormat] = { - import UserMessagesProtocol._ - try { - Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[UserJoinRequestFormat]) - } catch { - case e: DeserializationException => { - log.error("Failed to deserialize UserJoinRequestMessage: [{}]", msg.jsonMessage) - None - } - case e: ParsingException => { - log.error("Invalid JSON Format : [{}]", msg) - None - } - } - } - - message(msg) foreach { ujm => messageHandlerActor ! ujm } - } - - def handleUserLeave(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage): Option[UserLeaveMessage] = { - import UserMessagesProtocol._ - try { - Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[UserLeaveMessage]) - } catch { - case e: DeserializationException => { - log.error("Failed to deserialize UserLeaveMessage: [{}]", msg.jsonMessage) - None - } - case e: ParsingException => { - log.error("Invalid JSON Format : [{}]", msg) - None - } - } - } - - message(msg) foreach { ulm => messageHandlerActor ! ulm } - } - - def handleGetUsers(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage): Option[GetUsersRequestMessage] = { - import UserMessagesProtocol._ - try { - Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[GetUsersRequestMessage]) - } catch { - case e: DeserializationException => { - log.error("Failed to deserialize GetUsersRequestMessage: [{}]", msg.jsonMessage) - None - } - case e: ParsingException => { - log.error("Invalid JSON Format : [{}]", msg) - None - } - } - } - - message(msg) foreach { gum => messageHandlerActor ! gum } - } - - def handleAssignPresenter(msg: HeaderAndJsonMessage) = { - def message(msg: HeaderAndJsonMessage): Option[AssignPresenterMessage] = { - import UserMessagesProtocol._ - try { - Some(JsonParser(msg.jsonMessage).asJsObject.convertTo[AssignPresenterMessage]) - } catch { - case e: DeserializationException => { - log.error("Failed to deserialize AssignPresenterMessage: [{}]", msg.jsonMessage) - None - } - case e: ParsingException => { - log.error("Invalid JSON Format : [{}]", msg) - None - } - } - } - - message(msg) foreach { apm => messageHandlerActor ! apm } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/utils/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/utils/RandomStringGenerator.scala deleted file mode 100755 index 3d2c05f11c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/utils/RandomStringGenerator.scala +++ /dev/null @@ -1,24 +0,0 @@ -package org.bigbluebutton.apps.utils - -/** - * Utility to generate random strings. - * - * From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ - * - */ -object RandomStringGenerator { - - val random = new scala.util.Random - - /** - * Generate a random string of length n from the given alphabet - */ - def randomString(alphabet: String)(n: Int): String = - Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString - - /** - * Generate a random alphanumeric string of length n - */ - def randomAlphanumericString(n: Int) = - randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/WhiteboardApp.scala deleted file mode 100644 index 3435ef5f9c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/WhiteboardApp.scala +++ /dev/null @@ -1,17 +0,0 @@ -package org.bigbluebutton.apps.whiteboard - -import org.bigbluebutton.apps.whiteboard.data._ - -class WhiteboardApp { - private var whiteboards = new collection.immutable.HashMap[String, Whiteboard]() - - def addNewShape(descriptor: ShapeDescriptor, shape: WhiteboardShape): Shape = { - whiteboards get (descriptor.whiteboardId) match { - case Some(wb) => wb.newShape(descriptor, shape) - case None => { - val wb = new Whiteboard(descriptor.whiteboardId) - wb.newShape(descriptor, shape) - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/data/Model.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/data/Model.scala deleted file mode 100644 index d810002d2f..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/data/Model.scala +++ /dev/null @@ -1,80 +0,0 @@ -package org.bigbluebutton.apps.whiteboard.data - -import org.bigbluebutton.apps.users.data.UserIdAndName - -object ShapeTypes extends Enumeration { - type ShapeType = Value - val LINE = Value("LINE") - val SCRIBBLE = Value("SCRIBBLE") - val TEXT = Value("TEXT") - val RECTANGLE = Value("RECTANGLE") - val ELLIPSE = Value("ELLIPSE") - val TRIANGLE = Value("TRIANGLE") -} - -object LineTypes extends Enumeration { - type LineType = Value - val SOLID = Value("SOLID") - val DASH = Value("DASHED") - val DOT = Value("DOTTED") - val DASHDOT = Value("DASHEDOT") -} - -case class ShapeDescriptor(whiteboardId: String, shapeId: String, - shapeType: ShapeTypes.ShapeType, - by: UserIdAndName) - -case class Shape(descriptor: ShapeDescriptor, - shape: WhiteboardShape, zorder: Int) - -sealed trait WhiteboardShape - -class Container(coordinate: Coordinate, background: Background, - border: LineDescriptor) - -case class Point(x: Double, y: Double) - -case class Line(line: LineDescriptor, point1: Point, point2: Point) - extends WhiteboardShape -case class Scribble(line: LineDescriptor, points: Seq[Point]) - extends WhiteboardShape - -case class Background(visible: Boolean, color: Int, alpha: Int) - -case class LineDescriptor(weight: Int, color: Int, lineType: LineTypes.LineType) - -case class Coordinate(first: Point, last: Point) -case class Font(style: String, color: Int, size: Int) -case class Text(container: Container, font: Font, text: String) extends WhiteboardShape - -case class Rectangle(container: Container, square: Boolean) extends WhiteboardShape -case class Ellipse(container: Container, circle: Boolean) extends WhiteboardShape -case class Triangle(container: Container) extends WhiteboardShape - -class Whiteboard(id: String) { - private var shapes = Seq[Shape]() - - private var orderCount = 0 - - private def getOrder(): Int = { - val order = orderCount + 1 - orderCount = order - order - } - - def getShapes: Seq[Shape] = shapes.toSeq - - private def saveShape(s: Shape) = { - shapes :+ s - } - - def newShape(d: ShapeDescriptor, s: WhiteboardShape): Shape = { - val order = getOrder() - val shape = Shape(d, s, order) - saveShape(shape) - shape - } - - // def removeShape() - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/messages/Messages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/messages/Messages.scala deleted file mode 100644 index 0bf2665db9..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_apps/whiteboard/messages/Messages.scala +++ /dev/null @@ -1,33 +0,0 @@ -package org.bigbluebutton.apps.whiteboard.messages - -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.whiteboard.data._ -import org.bigbluebutton.apps.users.data.UserIdAndName - -case class NewWhiteboardShape(session: Session, descriptor: ShapeDescriptor, - shape: WhiteboardShape) -case class WhiteboardShapeCreated(session: Session, shape: Shape) - -case class UpdateWhiteboardShape(session: Session, descriptor: ShapeDescriptor, - shape: WhiteboardShape) -case class WhiteboardShapeUpdated(session: Session, descriptor: ShapeDescriptor, - shape: WhiteboardShape) - -case class DeleteWhiteboardShape(session: Session, whiteboardId: String, - shapeId: String, deletedBy: UserIdAndName) - -case class GetWhiteboardShapes(session: Session, requester: UserIdAndName, - whiteboardId: String) -case class GetWhiteboardShapesResponse(session: Session, requester: UserIdAndName, - whiteboardId: String, shapes: Seq[Shape]) - -case class ClearWhiteboardShapes(session: Session, requester: UserIdAndName, - whiteboardIds: Seq[String]) -case class DeleteWhiteboard(session: Session, requester: UserIdAndName, - whiteboardIds: Seq[String]) - -case class GetWhiteboardOptions(session: Session, requester: UserIdAndName) - -case class SendWhiteboardOptions(session: Session, requester: UserIdAndName, - options: Map[String, String]) - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonActor.scala deleted file mode 100755 index 4acef993fc..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonActor.scala +++ /dev/null @@ -1,181 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor._ -import akka.actor.ActorLogging -import akka.pattern.{ ask, pipe } -import akka.util.Timeout -import scala.concurrent.duration._ -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.util._ -import org.bigbluebutton.core.api.ValidateAuthTokenTimedOut -import scala.util.Success -import scala.util.Failure - -object BigBlueButtonActor extends SystemConfiguration { - def props(system: ActorSystem, outGW: MessageOutGateway): Props = - Props(classOf[BigBlueButtonActor], system, outGW) -} - -class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) extends Actor with ActorLogging { - def actorRefFactory = context - implicit def executionContext = actorRefFactory.dispatcher - implicit val timeout = Timeout(5 seconds) - - private var meetings = new collection.immutable.HashMap[String, RunningMeeting] - - def receive = { - case msg: CreateMeeting => handleCreateMeeting(msg) - case msg: DestroyMeeting => handleDestroyMeeting(msg) - case msg: KeepAliveMessage => handleKeepAliveMessage(msg) - case msg: ValidateAuthToken => handleValidateAuthToken(msg) - case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) - case msg: InMessage => handleMeetingMessage(msg) - case _ => // do nothing - } - - private def handleValidateAuthToken(msg: ValidateAuthToken) { - meetings.get(msg.meetingID) foreach { m => - val future = m.actorRef.ask(msg)(5 seconds) - - future onComplete { - case Success(result) => { - log.debug("Got response from meeting=" + msg.meetingID + "].") - /** - * Received a reply from MeetingActor which means hasn't hung! - * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple - * audit to check whether the actor is still alive. (ralam feb 25, 2015) - */ - } - case Failure(failure) => { - log.warning("Failed to get response to from meeting=" + msg.meetingID + "]. Meeting has probably hung.") - outGW.send(new ValidateAuthTokenTimedOut(msg.meetingID, msg.userId, msg.token, false, msg.correlationId, msg.sessionId)) - } - } - } - } - - private def handleMeetingMessage(msg: InMessage): Unit = { - msg match { - case ucm: UserConnectedToGlobalAudio => { - val m = meetings.values.find(m => m.voiceBridge == ucm.voiceConf) - m foreach { mActor => mActor.actorRef ! ucm } - } - case udm: UserDisconnectedFromGlobalAudio => { - val m = meetings.values.find(m => m.voiceBridge == udm.voiceConf) - m foreach { mActor => mActor.actorRef ! udm } - } - case allOthers => { - meetings.get(allOthers.meetingID) match { - case None => handleMeetingNotFound(allOthers) - case Some(m) => { - // log.debug("Forwarding message [{}] to meeting [{}]", msg.meetingID) - m.actorRef ! allOthers - } - } - } - } - } - - private def handleMeetingNotFound(msg: InMessage) { - msg match { - case vat: ValidateAuthToken => { - log.info("No meeting [" + vat.meetingID + "] for auth token [" + vat.token + "]") - outGW.send(new ValidateAuthTokenReply(vat.meetingID, vat.userId, vat.token, false, vat.correlationId, vat.sessionId)) - } - case _ => { - log.info("No meeting [" + msg.meetingID + "] for message type [" + msg.getClass() + "]") - // do nothing - } - } - } - - private def handleKeepAliveMessage(msg: KeepAliveMessage): Unit = { - outGW.send(new KeepAliveMessageReply(msg.aliveID)) - } - - private def handleDestroyMeeting(msg: DestroyMeeting) { - log.info("BBBActor received DestroyMeeting message for meeting id [" + msg.meetingID + "]") - meetings.get(msg.meetingID) match { - case None => println("Could not find meeting id[" + msg.meetingID + "] to destroy.") - case Some(m) => { - m.actorRef ! StopMeetingActor - meetings -= msg.meetingID - log.info("Kick everyone out on meeting id[" + msg.meetingID + "].") - outGW.send(new EndAndKickAll(msg.meetingID, m.recorded)) - - log.info("Destroyed meeting id[" + msg.meetingID + "].") - outGW.send(new MeetingDestroyed(msg.meetingID)) - } - } - } - - private def handleCreateMeeting(msg: CreateMeeting): Unit = { - meetings.get(msg.meetingID) match { - case None => { - log.info("New meeting create request [" + msg.meetingName + "]") - var m = RunningMeeting(msg.meetingID, msg.externalMeetingID, msg.meetingName, msg.recorded, - msg.voiceBridge, msg.duration, - msg.autoStartRecording, msg.allowStartStopRecording, msg.moderatorPass, - msg.viewerPass, msg.createTime, msg.createDate, - outGW) - - meetings += m.meetingID -> m - outGW.send(new MeetingCreated(m.meetingID, m.externalMeetingID, m.recorded, m.meetingName, m.voiceBridge, msg.duration, - msg.moderatorPass, msg.viewerPass, msg.createTime, msg.createDate)) - - m.actorRef ! new InitializeMeeting(m.meetingID, m.recorded) - m.actorRef ! "StartTimer" - } - case Some(m) => { - log.info("Meeting already created [" + msg.meetingName + "]") - // do nothing - } - } - } - - private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { - - var len = meetings.keys.size - println("meetings.size=" + meetings.size) - println("len_=" + len) - - val set = meetings.keySet - val arr: Array[String] = new Array[String](len) - set.copyToArray(arr) - val resultArray: Array[MeetingInfo] = new Array[MeetingInfo](len) - - for (i <- 0 until arr.length) { - val id = arr(i) - val duration = meetings.get(arr(i)).head.duration - val name = meetings.get(arr(i)).head.meetingName - val recorded = meetings.get(arr(i)).head.recorded - val voiceBridge = meetings.get(arr(i)).head.voiceBridge - - var info = new MeetingInfo(id, name, recorded, voiceBridge, duration) - resultArray(i) = info - - //remove later - println("for a meeting:" + id) - println("Meeting Name = " + meetings.get(id).head.meetingName) - println("isRecorded = " + meetings.get(id).head.recorded) - println("voiceBridge = " + voiceBridge) - println("duration = " + duration) - - //send the users - self ! (new GetUsers(id, "nodeJSapp")) - - //send the presentation - self ! (new GetPresentationInfo(id, "nodeJSapp", "nodeJSapp")) - - //send chat history - self ! (new GetChatHistoryRequest(id, "nodeJSapp", "nodeJSapp")) - - //send lock settings - self ! (new GetLockSettings(id, "nodeJSapp")) - } - - outGW.send(new GetAllMeetingsReply(resultArray)) - } - -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonGateway.scala deleted file mode 100755 index d91834b215..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonGateway.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api._ -import java.util.concurrent.CountDownLatch -import akka.actor.{ ActorSystem, Props } - -class BigBlueButtonGateway(outGW: MessageOutGateway) { - - implicit val system = ActorSystem("bigbluebutton-apps-system") - - val bbbActor = system.actorOf( - BigBlueButtonActor.props(system, outGW), - "bigbluebutton-actor") - - def accept(msg: InMessage): Unit = { - bbbActor ! msg - } - - def acceptKeepAlive(msg: KeepAliveMessage): Unit = { - bbbActor ! msg - } - -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonInGW.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonInGW.scala deleted file mode 100755 index eaf25f077a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/BigBlueButtonInGW.scala +++ /dev/null @@ -1,479 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.presentation.PreuploadedPresentationsUtil -import scala.collection.JavaConversions._ -import org.bigbluebutton.core.apps.poll.PollInGateway -import org.bigbluebutton.core.apps.layout.LayoutInGateway -import org.bigbluebutton.core.apps.chat.ChatInGateway -import scala.collection.JavaConversions._ -import org.bigbluebutton.core.apps.whiteboard.WhiteboardInGateway -import org.bigbluebutton.core.apps.voice.VoiceInGateway -import java.util.ArrayList -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.apps.presentation.Page -import org.bigbluebutton.core.apps.presentation.Presentation - -class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway, presUtil: PreuploadedPresentationsUtil) extends IBigBlueButtonInGW { - - // Meeting - def createMeeting2(meetingID: String, externalMeetingID: String, meetingName: String, record: Boolean, - voiceBridge: String, duration: Long, autoStartRecording: Boolean, - allowStartStopRecording: Boolean, moderatorPass: String, viewerPass: String, - createTime: Long, createDate: String) { - // println("******************** CREATING MEETING [" + meetingID + "] ***************************** ") - bbbGW.accept(new CreateMeeting(meetingID, externalMeetingID, meetingName, record, - voiceBridge, duration, autoStartRecording, - allowStartStopRecording, moderatorPass, viewerPass, - createTime, createDate)) - } - - def destroyMeeting(meetingID: String) { - // println("******************** DESTROY MEETING [" + meetingID + "] ***************************** ") - bbbGW.accept(new DestroyMeeting(meetingID)) - } - - def getAllMeetings(meetingID: String) { - println("******************** GET ALL MEETINGS ***************************** ") - bbbGW.accept(new GetAllMeetingsRequest("meetingId")) - } - - def isAliveAudit(aliveId: String) { - bbbGW.acceptKeepAlive(new KeepAliveMessage(aliveId)); - } - - def lockSettings(meetingID: String, locked: java.lang.Boolean, - lockSettings: java.util.Map[String, java.lang.Boolean]) { - - } - - def statusMeetingAudit(meetingID: String) { - - } - - def endMeeting(meetingID: String) { - // println("******************** END MEETING [" + meetingID + "] ***************************** ") - bbbGW.accept(new EndMeeting(meetingID)) - } - - def endAllMeetings() { - - } - - /** - * *********************************************************** - * Message Interface for Users - * *********************************************************** - */ - def validateAuthToken(meetingId: String, userId: String, token: String, correlationId: String, sessionId: String) { - // println("******************** VALIDATE TOKEN [" + token + "] ***************************** ") - bbbGW.accept(new ValidateAuthToken(meetingId, userId, token, correlationId, sessionId)) - } - - def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String, authToken: String): Unit = { - val userRole = if (role == "MODERATOR") Role.MODERATOR else Role.VIEWER - bbbGW.accept(new RegisterUser(meetingID, userID, name, userRole, extUserID, authToken)) - } - - def sendLockSettings(meetingID: String, userId: String, settings: java.util.Map[String, java.lang.Boolean]) { - // Convert java.util.Map to scala.collection.immutable.Map - // settings.mapValues -> convaert java Map to scala mutable Map - // v => v.booleanValue() -> convert java Boolean to Scala Boolean - // toMap -> converts from scala mutable map to scala immutable map - val s = settings.mapValues(v => v.booleanValue() /* convert java Boolean to Scala Boolean */ ).toMap - val disableCam = s.getOrElse("disableCam", false) - val disableMic = s.getOrElse("disableMic", false) - val disablePrivChat = s.getOrElse("disablePrivateChat", false) - val disablePubChat = s.getOrElse("disablePublicChat", false) - val lockedLayout = s.getOrElse("lockedLayout", false) - var lockOnJoin = s.getOrElse("lockOnJoin", false) - var lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) - - val permissions = new Permissions(disableCam = disableCam, - disableMic = disableMic, - disablePrivChat = disablePrivChat, - disablePubChat = disablePubChat, - lockedLayout = lockedLayout, - lockOnJoin = lockOnJoin, - lockOnJoinConfigurable = lockOnJoinConfigurable) - - bbbGW.accept(new SetLockSettings(meetingID, userId, permissions)) - } - - def initLockSettings(meetingID: String, settings: java.util.Map[String, java.lang.Boolean]) { - // Convert java.util.Map to scala.collection.immutable.Map - // settings.mapValues -> convert java Map to scala mutable Map - // v => v.booleanValue() -> convert java Boolean to Scala Boolean - // toMap -> converts from scala mutable map to scala immutable map - val s = settings.mapValues(v => v.booleanValue() /* convert java Boolean to Scala Boolean */ ).toMap - val disableCam = s.getOrElse("disableCam", false) - val disableMic = s.getOrElse("disableMic", false) - val disablePrivChat = s.getOrElse("disablePrivateChat", false) - val disablePubChat = s.getOrElse("disablePublicChat", false) - val lockedLayout = s.getOrElse("lockedLayout", false) - val lockOnJoin = s.getOrElse("lockOnJoin", false) - val lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) - val permissions = new Permissions(disableCam = disableCam, - disableMic = disableMic, - disablePrivChat = disablePrivChat, - disablePubChat = disablePubChat, - lockedLayout = lockedLayout, - lockOnJoin = lockOnJoin, - lockOnJoinConfigurable = lockOnJoinConfigurable) - - bbbGW.accept(new InitLockSettings(meetingID, permissions)) - } - - def initAudioSettings(meetingID: String, requesterID: String, muted: java.lang.Boolean) { - bbbGW.accept(new InitAudioSettings(meetingID, requesterID, muted.booleanValue())) - } - - def getLockSettings(meetingId: String, userId: String) { - bbbGW.accept(new GetLockSettings(meetingId, userId)) - } - - def lockUser(meetingId: String, requesterID: String, lock: Boolean, userId: String) { - bbbGW.accept(new LockUserRequest(meetingId, requesterID, userId, lock)) - } - - def setRecordingStatus(meetingId: String, userId: String, recording: java.lang.Boolean) { - bbbGW.accept(new SetRecordingStatus(meetingId, userId, recording.booleanValue())) - } - - def getRecordingStatus(meetingId: String, userId: String) { - bbbGW.accept(new GetRecordingStatus(meetingId, userId)) - } - - // Users - def userRaiseHand(meetingId: String, userId: String) { - bbbGW.accept(new UserRaiseHand(meetingId, userId)) - } - - def lowerHand(meetingId: String, userId: String, loweredBy: String) { - bbbGW.accept(new UserLowerHand(meetingId, userId, loweredBy)) - } - - def ejectUserFromMeeting(meetingId: String, userId: String, ejectedBy: String) { - bbbGW.accept(new EjectUserFromMeeting(meetingId, userId, ejectedBy)) - } - - def shareWebcam(meetingId: String, userId: String, stream: String) { - bbbGW.accept(new UserShareWebcam(meetingId, userId, stream)) - } - - def unshareWebcam(meetingId: String, userId: String, stream: String) { - bbbGW.accept(new UserUnshareWebcam(meetingId, userId, stream)) - } - - def setUserStatus(meetingID: String, userID: String, status: String, value: Object): Unit = { - bbbGW.accept(new ChangeUserStatus(meetingID, userID, status, value)); - } - - def getUsers(meetingID: String, requesterID: String): Unit = { - bbbGW.accept(new GetUsers(meetingID, requesterID)) - } - - def userLeft(meetingID: String, userID: String, sessionId: String): Unit = { - bbbGW.accept(new UserLeaving(meetingID, userID, sessionId)) - } - - def userJoin(meetingID: String, userID: String, authToken: String): Unit = { - bbbGW.accept(new UserJoining(meetingID, userID, authToken)) - } - - def assignPresenter(meetingID: String, newPresenterID: String, newPresenterName: String, assignedBy: String): Unit = { - bbbGW.accept(new AssignPresenter(meetingID, newPresenterID, newPresenterName, assignedBy)) - } - - def getCurrentPresenter(meetingID: String, requesterID: String): Unit = { - // do nothing - } - - def userConnectedToGlobalAudio(voiceConf: String, userid: String, name: String) { - // we are required to pass the meeting_id as first parameter (just to satisfy trait) - // but it's not used anywhere. That's why we pass voiceConf twice instead - bbbGW.accept(new UserConnectedToGlobalAudio(voiceConf, voiceConf, userid, name)) - } - - def userDisconnectedFromGlobalAudio(voiceConf: String, userid: String, name: String) { - // we are required to pass the meeting_id as first parameter (just to satisfy trait) - // but it's not used anywhere. That's why we pass voiceConf twice instead - bbbGW.accept(new UserDisconnectedFromGlobalAudio(voiceConf, voiceConf, userid, name)) - } - - /** - * ************************************************************************************ - * Message Interface for Presentation - * ************************************************************************************ - */ - - def clear(meetingID: String) { - bbbGW.accept(new ClearPresentation(meetingID)) - } - - def sendConversionUpdate(messageKey: String, meetingId: String, - code: String, presentationId: String, presName: String) { - bbbGW.accept(new PresentationConversionUpdate(meetingId, messageKey, - code, presentationId, presName)) - } - - def sendPageCountError(messageKey: String, meetingId: String, - code: String, presentationId: String, numberOfPages: Int, - maxNumberPages: Int, presName: String) { - bbbGW.accept(new PresentationPageCountError(meetingId, messageKey, - code, presentationId, numberOfPages, maxNumberPages, presName)) - } - - def sendSlideGenerated(messageKey: String, meetingId: String, - code: String, presentationId: String, numberOfPages: Int, - pagesCompleted: Int, presName: String) { - bbbGW.accept(new PresentationSlideGenerated(meetingId, messageKey, - code, presentationId, numberOfPages, pagesCompleted, presName)) - } - - def generatePresentationPages(presId: String, numPages: Int, presBaseUrl: String): scala.collection.immutable.HashMap[String, Page] = { - var pages = new scala.collection.immutable.HashMap[String, Page] - val baseUrl = - for (i <- 1 to numPages) { - val id = presId + "/" + i - val num = i; - val current = if (i == 1) true else false - val thumbnail = presBaseUrl + "/thumbnail/" + i - val swfUri = presBaseUrl + "/slide/" + i - - val txtUri = presBaseUrl + "/textfiles/" + i - val pngUri = presBaseUrl + "/png/" + i - - val p = new Page(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri, - txtUri = txtUri, pngUri = pngUri, - current = current) - pages += (p.id -> p) - } - - pages - } - - def sendConversionCompleted(messageKey: String, meetingId: String, - code: String, presentationId: String, numPages: Int, - presName: String, presBaseUrl: String) { - // println("******************** PRESENTATION CONVERSION COMPLETED MESSAGE ***************************** ") - val pages = generatePresentationPages(presentationId, numPages, presBaseUrl) - - val presentation = new Presentation(id = presentationId, name = presName, pages = pages) - bbbGW.accept(new PresentationConversionCompleted(meetingId, messageKey, - code, presentation)) - - } - - def removePresentation(meetingID: String, presentationID: String) { - bbbGW.accept(new RemovePresentation(meetingID, presentationID)) - } - - def getPresentationInfo(meetingID: String, requesterID: String, replyTo: String) { - // println("**** Forwarding GetPresentationInfo for meeting[" + meetingID + "] ****") - bbbGW.accept(new GetPresentationInfo(meetingID, requesterID, replyTo)) - } - - def sendCursorUpdate(meetingID: String, xPercent: Double, yPercent: Double) { - bbbGW.accept(new SendCursorUpdate(meetingID, xPercent, yPercent)) - } - - def resizeAndMoveSlide(meetingID: String, xOffset: Double, yOffset: Double, widthRatio: Double, heightRatio: Double) { - bbbGW.accept(new ResizeAndMoveSlide(meetingID, xOffset, yOffset, widthRatio, heightRatio)) - } - - def gotoSlide(meetingID: String, pageId: String) { - // println("**** Forwarding GotoSlide for meeting[" + meetingID + "] ****") - bbbGW.accept(new GotoSlide(meetingID, pageId)) - } - - def sharePresentation(meetingID: String, presentationID: String, share: Boolean) { - bbbGW.accept(new SharePresentation(meetingID, presentationID, share)) - } - - def getSlideInfo(meetingID: String, requesterID: String, replyTo: String) { - bbbGW.accept(new GetSlideInfo(meetingID, requesterID, replyTo)) - } - - /** - * ************************************************************ - * Message Interface Polling - * ************************************************************ - */ - val pollGW = new PollInGateway(bbbGW) - - def getPolls(meetingID: String, requesterID: String) { - pollGW.getPolls(meetingID, requesterID) - } - - def preCreatedPoll(meetingID: String, msg: String) { - pollGW.preCreatedPoll(meetingID, msg) - } - - def createPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.createPoll(meetingID, requesterID, msg) - } - - def updatePoll(meetingID: String, requesterID: String, msg: String) { - pollGW.updatePoll(meetingID, requesterID, msg) - } - - def startPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.startPoll(meetingID, requesterID, msg) - } - - def stopPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.stopPoll(meetingID, requesterID, msg) - } - - def removePoll(meetingID: String, requesterID: String, msg: String) { - pollGW.removePoll(meetingID, requesterID, msg) - } - - def respondPoll(meetingID: String, requesterID: String, msg: String) { - pollGW.respondPoll(meetingID, requesterID, msg) - } - - def showPollResult(meetingID: String, requesterID: String, msg: String) { - pollGW.showPollResult(meetingID, requesterID, msg) - } - - def hidePollResult(meetingID: String, requesterID: String, msg: String) { - pollGW.hidePollResult(meetingID, requesterID, msg) - } - - /** - * *********************************************************************** - * Message Interface for Layout - * ******************************************************************* - */ - val layoutGW = new LayoutInGateway(bbbGW) - - def getCurrentLayout(meetingID: String, requesterID: String) { - layoutGW.getCurrentLayout(meetingID, requesterID) - } - - def broadcastLayout(meetingID: String, requesterID: String, layout: String) { - layoutGW.broadcastLayout(meetingID, requesterID, layout) - } - - def lockLayout(meetingId: String, setById: String, - lock: Boolean, viewersOnly: Boolean, - layout: scala.Option[String]) { - layoutGW.lockLayout(meetingId, setById, lock, viewersOnly, layout) - } - - /** - * ******************************************************************* - * Message Interface for Chat - * ***************************************************************** - */ - val chatGW = new ChatInGateway(bbbGW) - - def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { - chatGW.getChatHistory(meetingID, requesterID, replyTo) - } - - def sendPublicMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { - // Convert java Map to Scala Map, then convert Mutable map to immutable map - chatGW.sendPublicMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) - } - - def sendPrivateMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { - chatGW.sendPrivateMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) - } - - /** - * ******************************************************************* - * Message Interface for Whiteboard - * ***************************************************************** - */ - val wbGW = new WhiteboardInGateway(bbbGW) - - def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) { - wbGW.sendWhiteboardAnnotation(meetingID, requesterID, mapAsScalaMap(annotation).toMap) - } - - def requestWhiteboardAnnotationHistory(meetingID: String, requestedID: String, whiteboardId: String, replyTo: String) { - wbGW.requestWhiteboardAnnotationHistory(meetingID, requestedID, whiteboardId, replyTo) - } - - def clearWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { - wbGW.clearWhiteboard(meetingID, requestedID, whiteboardId); - } - - def undoWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { - wbGW.undoWhiteboard(meetingID, requestedID, whiteboardId) - } - - def enableWhiteboard(meetingID: String, requestedID: String, enable: java.lang.Boolean) { - wbGW.enableWhiteboard(meetingID, requestedID, enable) - } - - def isWhiteboardEnabled(meetingID: String, requestedID: String, replyTo: String) { - wbGW.isWhiteboardEnabled(meetingID, requestedID, replyTo) - } - - /** - * ******************************************************************* - * Message Interface for Voice - * ***************************************************************** - */ - val voiceGW = new VoiceInGateway(bbbGW) - - def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: java.lang.Boolean) { - voiceGW.muteAllExceptPresenter(meetingID, requesterID, mute) - } - - def muteAllUsers(meetingID: String, requesterID: String, mute: java.lang.Boolean) { - voiceGW.muteAllUsers(meetingID, requesterID, mute) - } - - def isMeetingMuted(meetingID: String, requesterID: String) { - voiceGW.isMeetingMuted(meetingID, requesterID) - } - - def muteUser(meetingID: String, requesterID: String, userID: String, mute: java.lang.Boolean) { - voiceGW.muteUser(meetingID, requesterID, userID, mute) - } - - def lockMuteUser(meetingID: String, requesterID: String, userID: String, lock: java.lang.Boolean) { - voiceGW.lockUser(meetingID, requesterID, userID, lock) - } - - def ejectUserFromVoice(meetingId: String, userId: String, ejectedBy: String) { - voiceGW.ejectUserFromVoice(meetingId, userId, ejectedBy) - } - - def voiceUserJoined(meetingId: String, userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, - muted: java.lang.Boolean, speaking: java.lang.Boolean) { - - voiceGW.voiceUserJoined(meetingId, userId, webUserId, - conference, callerIdNum, - callerIdName, muted, speaking) - } - - def voiceUserLeft(meetingId: String, userId: String) { - voiceGW.voiceUserLeft(meetingId, userId) - } - - def voiceUserLocked(meetingId: String, userId: String, locked: java.lang.Boolean) { - voiceGW.voiceUserLocked(meetingId, userId, locked) - } - - def voiceUserMuted(meetingId: String, userId: String, muted: java.lang.Boolean) { - voiceGW.voiceUserMuted(meetingId, userId, muted) - } - - def voiceUserTalking(meetingId: String, userId: String, talking: java.lang.Boolean) { - voiceGW.voiceUserTalking(meetingId, userId, talking) - } - - def voiceRecording(meetingId: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - voiceGW.voiceRecording(meetingId, recordingFile, - timestamp, recording) - } -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorActor.scala deleted file mode 100755 index 42d6cd266e..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorActor.scala +++ /dev/null @@ -1,2160 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor._ -import akka.actor.ActorLogging -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList -import org.bigbluebutton.core.apps.poll.PollVO -import org.bigbluebutton.core.apps.presentation.Page -import org.bigbluebutton.core.apps.presentation.Presentation -import org.bigbluebutton.core.apps.chat.redis.ChatMessageToJsonConverter -import org.bigbluebutton.core.apps.presentation.redis.PesentationMessageToJsonConverter -import org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardMessageToJsonConverter -import org.bigbluebutton.core.meeting.MeetingMessageToJsonConverter -import org.bigbluebutton.core.apps.users.redis.UsersMessageToJsonConverter - -class CollectorActor(dispatcher: IDispatcher) extends Actor { - - def receive = { - //IN MESSAGES - case msg: CreateMeeting => handleCreateMeeting(msg) - case msg: InitializeMeeting => handleInitializeMeeting(msg) - case msg: DestroyMeeting => handleDestroyMeeting(msg) - case msg: StartMeeting => handleStartMeeting(msg) - case msg: EndMeeting => handleEndMeeting(msg) - case msg: LockSetting => handleLockSetting(msg) - case msg: LockUser => handleLockUser(msg) - case msg: InitLockSettings => handleInitLockSettings(msg) - case msg: InitAudioSettings => handleInitAudioSettings(msg) - case msg: SetLockSettings => handleSetLockSettings(msg) - case msg: GetLockSettings => handleGetLockSettings(msg) - case msg: ValidateAuthToken => handleValidateAuthToken(msg) - case msg: RegisterUser => handleRegisterUser(msg) - case msg: UserJoining => handleUserJoining(msg) - case msg: UserLeaving => handleUserLeaving(msg) - case msg: GetUsers => handleGetUsers(msg) - case msg: UserRaiseHand => handleUserRaiseHand(msg) - case msg: UserLowerHand => handleUserLowerHand(msg) - case msg: UserShareWebcam => handleUserShareWebcam(msg) - case msg: UserUnshareWebcam => handleUserUnshareWebcam(msg) - case msg: ChangeUserStatus => handleChangeUserStatus(msg) - case msg: AssignPresenter => handleAssignPresenter(msg) - case msg: SetRecordingStatus => handleSetRecordingStatus(msg) - case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) - case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) - case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) - case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) - case msg: PreCreatedPoll => handlePreCreatedPoll(msg) - case msg: CreatePoll => handleCreatePoll(msg) - case msg: UpdatePoll => handleUpdatePoll(msg) - case msg: GetPolls => handleGetPolls(msg) - case msg: DestroyPoll => handleDestroyPoll(msg) - case msg: RemovePoll => handleRemovePoll(msg) - case msg: SharePoll => handleSharePoll(msg) - case msg: ShowPollResult => handleShowPollResult(msg) - case msg: HidePollResult => handleHidePollResult(msg) - case msg: StopPoll => handleStopPoll(msg) - case msg: StartPoll => handleStartPoll(msg) - case msg: ClearPoll => handleClearPoll(msg) - case msg: GetPollResult => handleGetPollResult(msg) - case msg: RespondToPoll => handleRespondToPoll(msg) - case msg: ClearPresentation => handleClearPresentation(msg) - case msg: RemovePresentation => handleRemovePresentation(msg) - case msg: GetPresentationInfo => handleGetPresentationInfo(msg) - //case msg: SendCursorUpdate => handleSendCursorUpdate(msg) - case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) - case msg: GotoSlide => handleGotoSlide(msg) - case msg: SharePresentation => handleSharePresentation(msg) - case msg: GetSlideInfo => handleGetSlideInfo(msg) - case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) - case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) - case msg: PresentationPageCountError => handlePresentationPageCountError(msg) - case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) - case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) - case msg: SendVoiceUsersRequest => handleSendVoiceUsersRequest(msg) - case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) - case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) - case msg: MuteUserRequest => handleMuteUserRequest(msg) - case msg: LockUserRequest => handleLockUserRequest(msg) - case msg: EjectUserFromVoiceRequest => handleEjectUserFromVoiceRequest(msg) - case msg: VoiceUserJoinedMessage => handleVoiceUserJoinedMessage(msg) - case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - case msg: VoiceUserLocked => handleVoiceUserLocked(msg) - case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - case msg: VoiceUserTalking => handleVoiceUserTalking(msg) - case msg: VoiceRecording => handleVoiceRecording(msg) - case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) - case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) - case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) - case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) - case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) - case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) - case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) - - //OUT MESSAGES - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) - case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingHasEnded => handleMeetingHasEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) - case msg: DisconnectUser => handleDisconnectUser(msg) - case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) - case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) - case msg: UserLocked => handleUserLocked(msg) - case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) - case msg: UserRegistered => handleUserRegistered(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: PresenterAssigned => handlePresenterAssigned(msg) - case msg: EndAndKickAll => handleEndAndKickAll(msg) - case msg: GetUsersReply => handleGetUsersReply(msg) - case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) - case msg: GetCurrentLayoutReply => handleGetCurrentLayoutReply(msg) - case msg: BroadcastLayoutEvent => handleBroadcastLayoutEvent(msg) - case msg: GetPollResultReply => handleGetPollResultReply(msg) - case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) - case msg: ClearPollFailed => handleClearPollFailed(msg) - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) - case msg: PollHideResultOutMsg => handlePollHideResultOutMsg(msg) - case msg: PollShowResultOutMsg => handlePollShowResultOutMsg(msg) - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) - //case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) - case msg: GetPreuploadedPresentationsOutMsg => handleGetPreuploadedPresentationsOutMsg(msg) - case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) - case msg: PresentationConversionError => handlePresentationConversionError(msg) - case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) - case msg: PresentationConversionDone => handlePresentationConversionDone(msg) - case msg: PresentationChanged => handlePresentationChanged(msg) - case msg: GetPresentationStatusReply => handleGetPresentationStatusReply(msg) - case msg: PresentationRemoved => handlePresentationRemoved(msg) - case msg: PageChanged => handlePageChanged(msg) - case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) - case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) - case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) - - case _ => // do nothing - } - - private def buildUserHashMap(user: UserVO): java.util.HashMap[String, Object] = { - val vu = user.voiceUser - val vuser = new java.util.HashMap[String, Object]() - vuser.put(Constants.USER_ID, vu.userId) - vuser.put(Constants.WEB_USER_ID, vu.webUserId) - vuser.put(Constants.CALLER_ID_NAME, vu.callerName) - vuser.put(Constants.CALLER_ID_NUM, vu.callerNum) - vuser.put(Constants.JOINED, vu.joined: java.lang.Boolean) - vuser.put(Constants.LOCKED, vu.locked: java.lang.Boolean) - vuser.put(Constants.MUTED, vu.muted: java.lang.Boolean) - vuser.put(Constants.TALKING, vu.talking: java.lang.Boolean) - - val wuser = new java.util.HashMap[String, Object]() - wuser.put(Constants.USER_ID, user.userID) - wuser.put(Constants.EXT_USER_ID, user.externUserID) - wuser.put(Constants.NAME, user.name) - wuser.put(Constants.ROLE, user.role.toString()) - wuser.put(Constants.RAISE_HAND, user.raiseHand: java.lang.Boolean) - wuser.put(Constants.PRESENTER, user.presenter: java.lang.Boolean) - wuser.put(Constants.HAS_STREAM, user.hasStream: java.lang.Boolean) - wuser.put(Constants.LOCKED, user.locked: java.lang.Boolean) - wuser.put("webcamStream", user.webcamStreams mkString ("|")) - wuser.put(Constants.PHONE_USER, user.phoneUser: java.lang.Boolean) - wuser.put(Constants.VOICE_USER, vuser) - - wuser - } - - private def buildJson(header: java.util.HashMap[String, Any], - payload: java.util.HashMap[String, Any]): String = { - - val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() - message.put(Constants.HEADER, header) - message.put(Constants.PAYLOAD, payload) - - val gson = new Gson() - gson.toJson(message) - } - - // IN MESSAGES - private def handleCreateMeeting(msg: CreateMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) - payload.put(Constants.MEETING_NAME, msg.meetingName) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.VOICE_CONF, msg.voiceBridge) - payload.put(Constants.DURATION, msg.duration) - payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) - payload.put(Constants.VIEWER_PASS, msg.viewerPass) - payload.put(Constants.CREATE_TIME, msg.createTime) - payload.put(Constants.CREATE_DATE, msg.createDate) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CREATE_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CREATE MEETING *****************") - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleInitializeMeeting(msg: InitializeMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.INITIALIZE_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING INITIALIZE MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleDestroyMeeting(msg: DestroyMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DESTROY_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING DESTROY MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStartMeeting(msg: StartMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.START_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING START MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEndMeeting(msg: EndMeeting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING END MEETING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockSetting(msg: LockSetting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.LOCKED, msg.locked) - - val settingsMap = new java.util.HashMap[String, Boolean]() - for ((key, value) <- msg.settings) { - settingsMap.put(key, value) - } - - payload.put("settings", settingsMap) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING LOCK SETTING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockUser(msg: LockUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCK, msg.lock) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_MEETING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING LOCK USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleInitLockSettings(msg: InitLockSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.settings.toString()) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.INIT_LOCK_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING INIT LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleInitAudioSettings(msg: InitAudioSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MUTED, msg.muted.toString()) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.INIT_AUDIO_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING INIT LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSetLockSettings(msg: SetLockSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.settings.toString()) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SET_LOCK_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SET LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetLockSettings(msg: GetLockSettings) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_LOCK_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET LOCK SETTINGS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleValidateAuthToken(msg: ValidateAuthToken) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.AUTH_TOKEN, msg.token) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VALIDATE AUTH TOKEN *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRegisterUser(msg: RegisterUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.NAME, msg.name) - payload.put(Constants.ROLE, msg.role.toString()) - payload.put(Constants.EXT_USER_ID, msg.extUserID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.REGISTER_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING REGISTER USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserJoining(msg: UserJoining) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_JOINING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING HANDLE USER JOINING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLeaving(msg: UserLeaving) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LEAVING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING HANDLE USER LEAVING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetUsers(msg: GetUsers) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_USERS) - - /** - * Let's temporarily have this convention as correlationId - */ - val replyTo = msg.meetingID + "/" + msg.requesterID - header.put(Constants.REPLY_TO, replyTo) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING HANDLE GET USERS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserRaiseHand(msg: UserRaiseHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.RAISE_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER RAISE HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLowerHand(msg: UserLowerHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOWERED_BY, msg.loweredBy) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.LOWER_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER LOWER HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserShareWebcam(msg: UserShareWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.STREAM, msg.stream) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_SHARE_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER SHARE WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserUnshareWebcam(msg: UserUnshareWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_UNSHARE_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER UNSHARE WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleChangeUserStatus(msg: ChangeUserStatus) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STATUS, msg.status) - payload.put(Constants.VALUE, msg.value) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CHANGE_USER_STATUS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CHANGE USER STATUS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleAssignPresenter(msg: AssignPresenter) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.NEW_PRESENTER_ID, msg.newPresenterID) - payload.put(Constants.NEW_PRESENTER_NAME, msg.newPresenterName) - payload.put(Constants.ASSIGNED_BY, msg.assignedBy) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.ASSIGN_PRESENTER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING ASSIGN PRESENTER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSetRecordingStatus(msg: SetRecordingStatus) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SET_RECORDING_STATUS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SET RECORDING STATUS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_CHAT_HISTORY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET CHAT HISTORY REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val messageMap = new java.util.HashMap[String, String]() - for ((key, value) <- msg.message) { - messageMap.put(key, value) - } - payload.put("message", messageMap) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_PUBLIC_MESSAGE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SEND PUBLIC MESSAGE REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val messageMap = new java.util.HashMap[String, String]() - for ((key, value) <- msg.message) { - messageMap.put(key, value) - } - payload.put("message", messageMap) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_PRIVATE_CHAT_MESSAGE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SEND PRIVATE MESSAGE REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET CURRENT LAYOUT REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT, msg.layout) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockLayoutRequest(msg: LockLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.setById) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.UNLOCK_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePreCreatedPoll(msg: PreCreatedPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL, msg.poll) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRECREATED_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PRE CREATED POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleCreatePoll(msg: CreatePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL, msg.poll) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CREATE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CREATE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUpdatePoll(msg: UpdatePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL, msg.poll) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.UPDATE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING UPDATE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPolls(msg: GetPolls) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLLS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET POLLS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleDestroyPoll(msg: DestroyPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DESTROY_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING DESTROY POLLS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRemovePoll(msg: RemovePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.REMOVE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING REMOVE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSharePoll(msg: SharePoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SHARE_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SHARE POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleShowPollResult(msg: ShowPollResult) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SHOW_POLL_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SHOW POLL RESULTS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleHidePollResult(msg: HidePollResult) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.HIDE_POLL_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING HIDE POLL RESULTS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStopPoll(msg: StopPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.STOP_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING STOP POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStartPoll(msg: StartPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.START_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING START POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPoll(msg: ClearPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.FORCE, msg.force) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CLEAR POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPollResult(msg: GetPollResult) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLL_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET POLL RESULT *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRespondToPoll(msg: RespondToPoll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.RESPONSE, msg.response) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.RESPONT_TO_POLL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING RESPOND TO POLL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPresentation(msg: ClearPresentation) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_PRESENTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CLEAR PRESENTATION *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleRemovePresentation(msg: RemovePresentation) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.REMOVE_PRESENTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING REMOVE PRESENTATION *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPresentationInfo(msg: GetPresentationInfo) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_PRESENTATION_INFO) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET PRESENTATION INFO *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - /*private def handleSendCursorUpdate(msg: SendCursorUpdate) { - var map = new java.util.HashMap[String, Any]() - map.put("meetingID", msg.meetingID) - map.put("xPercent", msg.xPercent) - map.put("yPercent", msg.yPercent) - map.put("timestamp", TimestampGenerator.generateTimestamp) - - println("***** DISPATCHING SEND CURSOR UPDATE *****************") - dispatcher.dispatch(buildJson(header, payload)) - }*/ - - private def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.X_OFFSET, msg.xOffset) - payload.put(Constants.Y_OFFSET, msg.yOffset) - payload.put(Constants.WIDTH_RATIO, msg.widthRatio) - payload.put(Constants.HEIGHT_RATIO, msg.heightRatio) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.RESIZE_AND_MOVE_SLIDE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING RESIZE AND MOVE SLIDE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGotoSlide(msg: GotoSlide) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, msg.page) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GO_TO_SLIDE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GO TO SLIDE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSharePresentation(msg: SharePresentation) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationID) - payload.put(Constants.SHARE, msg.share) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SHARE_PRESENTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SHARE PRESENTATION *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetSlideInfo(msg: GetSlideInfo) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_SLIDE_INFO) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET SLIDE INFO *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePreuploadedPresentations(msg: PreuploadedPresentations) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATIONS, msg.presentations.toString()) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PREUPLOADED_PRESENTATIONS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PREUPLOADED PRESENTATIONS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presName) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_UPDATE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PRESENTATION CONVERSION UPDATE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationPageCountError(msg: PresentationPageCountError) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_COUNT_ERROR) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PRESENTATION PAGE COUNT ERROR *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_GENERATED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PRESENTATION SLIDE GENERATED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentation) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_COMPLETED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PRESENTATION CONVERSION COMPLETED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendVoiceUsersRequest(msg: SendVoiceUsersRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_VOICE_USERS_REQUEST) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SEND VOICE USERS REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleMuteMeetingRequest(msg: MuteMeetingRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTE, msg.mute) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.MUTE_MEETING_REQUEST) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING MUTE MEETING REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING IS MEETING MUTED REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleMuteUserRequest(msg: MuteUserRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.MUTE, msg.mute) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.MUTE_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING MUTE USER REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleLockUserRequest(msg: LockUserRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LOCK, msg.lock) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.LOCK_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING LOCK USER REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEjectUserFromVoiceRequest(msg: EjectUserFromVoiceRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.ejectedBy) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.EJECT_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING EJECT USER REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserJoinedMessage(msg: VoiceUserJoinedMessage) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.voiceConfId) - payload.put(Constants.CALLER_ID_NUM, msg.callerIdNum) - payload.put(Constants.CALLER_ID_NAME, msg.callerIdName) - payload.put(Constants.MUTED, msg.muted) - payload.put(Constants.TALKING, msg.talking) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED_MESSAGE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE USER JOINED MESSAGE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserJoined(msg: VoiceUserJoined) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.VOICE_USER, msg.voiceUser) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE USER JOINED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserLeft(msg: VoiceUserLeft) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_LEFT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE USER LEFT *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserLocked(msg: VoiceUserLocked) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCKED, msg.locked) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_LOCKED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE USER LOCKED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserMuted(msg: VoiceUserMuted) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.MUTED, msg.muted) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_MUTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE USER MUTED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceUserTalking(msg: VoiceUserTalking) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.TALKING, msg.talking) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_USER_TALKING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE USER TALKING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleVoiceRecording(msg: VoiceRecording) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDING_FILE, msg.recordingFile) - payload.put(Constants.TIMESTAMP, msg.timestamp) - payload.put(Constants.RECORDING, msg.recording) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VOICE_RECORDING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VOICE RECORDING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ANNOTATION, msg.annotation) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SEND_WHITEBOARD_ANNOTATION) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SEND WHITEBOARD ANNOTATION REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_WHITEBOARD_SHAPES) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING SEND WHITEBOARD SHAPES REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_WHITEBOARD) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CLEAR WHITEBOARD REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.UNDO_WHITEBOARD) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING UNDO WHITEBOARD REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ENABLE, msg.enable) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.ENABLE_WHITEBOARD) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING ENABLE WHITEBOARD REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.IS_WHITEBOARD_ENABLED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING IS WHITEBOARD ENABLED REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { - println("***** DISPATCHING GET ALL MEETINGS REQUEST *****************") - } - - // OUT MESSAGES - private def handleMeetingCreated(msg: MeetingCreated) { - val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { - val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { - val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handleMeetingEnded(msg: MeetingEnded) { - val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleMeetingHasEnded(msg: MeetingHasEnded) { - val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DISCONNECT_ALL_USERS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING DISCONNECT ALL USERS *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleDisconnectUser(msg: DisconnectUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.DISCONNECT_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING DISCONNECT USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PERMISSION_SETTING_INITIALIZED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PERMISSIONS SETTING INIIALIZED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.NEW_PERMISSION_SETTINGS) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING NEW PERMISSIONS SETTING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLocked(msg: UserLocked) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCKED, msg.lock) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LOCKED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER LOCKED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_PERMISSION_SETTINGS_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserRegistered(msg: UserRegistered) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_REGISTERED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER REGISTERED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLeft(msg: UserLeft) { - val json = UsersMessageToJsonConverter.userLeftToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresenterAssigned(msg: PresenterAssigned) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); - payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); - payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.PRESENTER_ASSIGNED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING PRESENTER ASSIGNED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEndAndKickAll(msg: EndAndKickAll) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.END_AND_KICK_ALL) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING END AND KICK ALL *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetUsersReply(msg: GetUsersReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val users = new ArrayList[java.util.HashMap[String, Object]]; - msg.users.foreach(uvo => { - users.add(buildUserHashMap(uvo)) - }) - - payload.put(Constants.USERS, users) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_USERS_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET USERS REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterId) - payload.put(Constants.AUTH_TOKEN, msg.token) - payload.put(Constants.VALID, msg.valid) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING VALIDATE AUTH TOKEN REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserJoined(msg: UserJoined) { - val json = UsersMessageToJsonConverter.userJoinedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleUserRaisedHand(msg: UserRaisedHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_RAISED_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER RAISED HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLoweredHand(msg: UserLoweredHand) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LOWERED_BY, msg.loweredBy) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LOWERED_HAND) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER LOWERED HAND *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserSharedWebcam(msg: UserSharedWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_SHARED_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER SHARED WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_UNSHARED_WEBCAM) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER UNSHARED WEBCAM *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserStatusChange(msg: UserStatusChange) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STATUS, msg.status) - payload.put(Constants.VALUE, msg.value) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_STATUS_CHANGED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER STATUS CHANGE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTE, msg.mute) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.MUTE_VOICE_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING MUTE VOICE USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserVoiceMuted(msg: UserVoiceMuted) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_VOICE_MUTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER VOICE MUTED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserVoiceTalking(msg: UserVoiceTalking) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_VOICE_TALKING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER VOICE TALKING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.EJECT_VOICE_USER) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING EJECT VOICE USER *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_JOINED_VOICE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER JOINED VOICE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, msg.user.toString()) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.USER_LEFT_VOICE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING USER LEFT VOICE *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTED, msg.meetingMuted) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING IS MEETING MUTED REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStartRecording(msg: StartRecording) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.START_RECORDING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING START RECORDING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleStopRecording(msg: StopRecording) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.STOP_RECORDING) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING STOP RECORDING *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { - val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { - val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetCurrentLayoutReply(msg: GetCurrentLayoutReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT_ID, msg.layoutID) - payload.put(Constants.LOCKED, msg.locked) - payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET CURRENT LAYOUT REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleBroadcastLayoutEvent(msg: BroadcastLayoutEvent) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT_ID, msg.layoutID) - payload.put(Constants.LOCKED, msg.locked) - payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING BROADCAST LAYOUT EVENT *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPollResultReply(msg: GetPollResultReply) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.POLL, msg.pollVO) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLL_RESULT_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET POLL RESULT REPLY *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val collection = new ArrayList[PollVO](); - msg.polls.foreach(p => { - collection.add(p) - }) - - payload.put(Constants.POLLS, collection) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.GET_POLLS_REPLY) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING GET POLLS REPLY OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPollFailed(msg: ClearPollFailed) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.REASON, msg.reason) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.CLEAR_POLL_FAILED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING CLEAR POLL FAILED *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_CLEARED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL CLEARED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_STARTED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL STARTED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_STOPPED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL STOPPED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_REMOVED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL REMOVED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.POLL, msg.pollVO) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_UPDATED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL UPDATED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - payload.put(Constants.POLL, msg.pollVO) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_CREATED) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL CREATED OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RESPONDER, msg.responder) - payload.put(Constants.RESPONSE, msg.response) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_RESPONSE) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL RESPONSE OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollHideResultOutMsg(msg: PollHideResultOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_HIDE_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL HIDE RESULT OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handlePollShowResultOutMsg(msg: PollShowResultOutMsg) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.POLL_ID, msg.pollID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.POLL_SHOW_RESULT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - - // println("***** DISPATCHING POLL SHOW RESULT OUTMSG *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) - // Comment out as we don't want to store cursor updates (ralam may 7, 2014) - //dispatcher.dispatch(json) - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { - val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { - val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationConversionError(msg: PresentationConversionError) { - val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { - val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationChanged(msg: PresentationChanged) { - val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { - val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePresentationRemoved(msg: PresentationRemoved) { - val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) - dispatcher.dispatch(json) - } - - private def handlePageChanged(msg: PageChanged) { - val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) - dispatcher.dispatch(json) - } - - private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { - val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) - dispatcher.dispatch(json) - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { - val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) - dispatcher.dispatch(json) - } - - private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { - val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) - dispatcher.dispatch(json) - } - private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { - val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) - println("***** DISPATCHING GET ALL MEETINGS REPLY OUTMSG *****************") - dispatcher.dispatch(json) - } -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorGateway.scala deleted file mode 100755 index c81112dd8e..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/CollectorGateway.scala +++ /dev/null @@ -1,22 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api.IDispatcher -import org.bigbluebutton.core.api.InMessage -import org.bigbluebutton.core.api.IOutMessage -import org.bigbluebutton.core.api.OutMessageListener2 - -class CollectorGateway(dispatcher: IDispatcher) extends OutMessageListener2 { - - // FIXME - // private val collActor = new CollectorActor(dispatcher) - - // collActor.start - - def collectInMessage(msg: InMessage) { - // collActor ! msg - } - - def handleMessage(msg: IOutMessage) { - // collActor ! msg - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/MeetingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/MeetingActor.scala deleted file mode 100755 index 8ec787f108..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/MeetingActor.scala +++ /dev/null @@ -1,265 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor.Actor -import akka.actor.ActorRef -import akka.actor.ActorLogging -import akka.actor.Props -import akka.util.Timeout -import scala.concurrent.duration._ -import org.bigbluebutton.core.apps.poll.Poll -import org.bigbluebutton.core.apps.poll.PollApp -import org.bigbluebutton.core.apps.users.UsersApp -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.apps.presentation.PresentationApp -import org.bigbluebutton.core.apps.layout.LayoutApp -import org.bigbluebutton.core.apps.chat.ChatApp -import org.bigbluebutton.core.apps.whiteboard.WhiteboardApp -import java.util.concurrent.TimeUnit -import org.bigbluebutton.core.util._ -import akka.actor.ActorContext -import scala.concurrent.ExecutionContext.Implicits.global - -case object StopMeetingActor - -object MeetingActor { - def props(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, - voiceBridge: String, duration: Long, - autoStartRecording: Boolean, allowStartStopRecording: Boolean, - moderatorPass: String, viewerPass: String, - createTime: Long, createDate: String, - outGW: MessageOutGateway)(implicit context: ActorContext): Props = - Props(classOf[MeetingActor], meetingID, externalMeetingID, meetingName, recorded, - voiceBridge, duration, - autoStartRecording, allowStartStopRecording, - moderatorPass, viewerPass, - createTime, createDate, - outGW) -} - -class MeetingActor(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, - val voiceBridge: String, duration: Long, - val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, - val moderatorPass: String, val viewerPass: String, - val createTime: Long, val createDate: String, - val outGW: MessageOutGateway) - extends Actor with UsersApp with PresentationApp - with PollApp with LayoutApp with ChatApp - with WhiteboardApp with ActorLogging { - - var audioSettingsInited = false - var permissionsInited = false - var permissions = new Permissions() - var recording = false; - var muted = false; - var meetingEnded = false - - val TIMER_INTERVAL = 30000 - var hasLastWebUserLeft = false - var lastWebUserLeftOn: Long = 0 - - // FIXME - // class TimerActor(val timeout: Long, val who: Actor, val reply: String) extends Actor { - // def act { - // reactWithin(timeout) { - // case TIMEOUT => who ! reply - // } - // } - // } - - def receive = { - case "StartTimer" => handleStartTimer - case "Hello" => handleHello - case "MonitorNumberOfWebUsers" => handleMonitorNumberOfWebUsers() - case msg: ValidateAuthToken => handleValidateAuthToken(msg) - case msg: RegisterUser => handleRegisterUser(msg) - case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - case msg: VoiceUserTalking => handleVoiceUserTalking(msg) - case msg: UserJoining => handleUserJoin(msg) - case msg: UserLeaving => handleUserLeft(msg) - case msg: AssignPresenter => handleAssignPresenter(msg) - case msg: GetUsers => handleGetUsers(msg) - case msg: ChangeUserStatus => handleChangeUserStatus(msg) - case msg: EjectUserFromMeeting => handleEjectUserFromMeeting(msg) - case msg: UserRaiseHand => handleUserRaiseHand(msg) - case msg: UserLowerHand => handleUserLowerHand(msg) - case msg: UserShareWebcam => handleUserShareWebcam(msg) - case msg: UserUnshareWebcam => handleUserunshareWebcam(msg) - case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) - case msg: MuteAllExceptPresenterRequest => handleMuteAllExceptPresenterRequest(msg) - case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) - case msg: MuteUserRequest => handleMuteUserRequest(msg) - case msg: EjectUserFromVoiceRequest => handleEjectUserRequest(msg) - case msg: SetLockSettings => handleSetLockSettings(msg) - case msg: GetLockSettings => handleGetLockSettings(msg) - case msg: LockUserRequest => handleLockUserRequest(msg) - case msg: InitLockSettings => handleInitLockSettings(msg) - case msg: InitAudioSettings => handleInitAudioSettings(msg) - case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) - case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) - case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) - case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) - case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) - case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) - case msg: InitializeMeeting => handleInitializeMeeting(msg) - case msg: ClearPresentation => handleClearPresentation(msg) - case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) - case msg: PresentationPageCountError => handlePresentationPageCountError(msg) - case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) - case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) - case msg: RemovePresentation => handleRemovePresentation(msg) - case msg: GetPresentationInfo => handleGetPresentationInfo(msg) - case msg: SendCursorUpdate => handleSendCursorUpdate(msg) - case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) - case msg: GotoSlide => handleGotoSlide(msg) - case msg: SharePresentation => handleSharePresentation(msg) - case msg: GetSlideInfo => handleGetSlideInfo(msg) - case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) - case msg: PreCreatedPoll => handlePreCreatedPoll(msg) - case msg: CreatePoll => handleCreatePoll(msg) - case msg: UpdatePoll => handleUpdatePoll(msg) - case msg: DestroyPoll => handleDestroyPoll(msg) - case msg: RemovePoll => handleRemovePoll(msg) - case msg: SharePoll => handleSharePoll(msg) - case msg: StopPoll => handleStopPoll(msg) - case msg: StartPoll => handleStartPoll(msg) - case msg: ClearPoll => handleClearPoll(msg) - case msg: GetPolls => handleGetPolls(msg) - case msg: RespondToPoll => handleRespondToPoll(msg) - case msg: HidePollResult => handleHidePollResult(msg) - case msg: ShowPollResult => handleShowPollResult(msg) - case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) - case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) - case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) - case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) - case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) - case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) - case msg: SetRecordingStatus => handleSetRecordingStatus(msg) - case msg: GetRecordingStatus => handleGetRecordingStatus(msg) - case msg: VoiceRecording => handleVoiceRecording(msg) - - case msg: EndMeeting => handleEndMeeting(msg) - case StopMeetingActor => //exit - case _ => // do nothing - } - - def hasMeetingEnded(): Boolean = { - meetingEnded - } - - private def handleStartTimer() { - // println("***************timer started******************") - // val timerActor = new TimerActor(2000, self, "Hello") - // timerActor.start - } - - private def handleHello() { - // println("***************hello received on [" + System.currentTimeMillis() + "]******************") - - // val timerActor = new TimerActor(2000, self, "Hello") - // timerActor.start - } - - def webUserJoined() { - if (users.numWebUsers > 0) { - lastWebUserLeftOn = 0 - } - } - - def startRecordingIfAutoStart() { - if (recorded && !recording && autoStartRecording && users.numWebUsers == 1) { - log.info("Auto start recording for meeting=[" + meetingID + "]") - recording = true - outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) - } - } - - def stopAutoStartedRecording() { - if (recorded && recording && autoStartRecording - && users.numWebUsers == 0) { - log.info("Last web user left. Auto stopping recording for meeting=[{}", meetingID) - recording = false - outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) - } - } - - def startCheckingIfWeNeedToEndVoiceConf() { - if (users.numWebUsers == 0) { - lastWebUserLeftOn = timeNowInMinutes - log.debug("MonitorNumberOfWebUsers started for meeting [" + meetingID + "]") - scheduleEndVoiceConference() - } - } - - def handleMonitorNumberOfWebUsers() { - if (users.numWebUsers == 0 && lastWebUserLeftOn > 0) { - if (timeNowInMinutes - lastWebUserLeftOn > 2) { - log.info("MonitorNumberOfWebUsers empty for meeting [" + meetingID + "]. Ejecting all users from voice.") - outGW.send(new EjectAllVoiceUsers(meetingID, recorded, voiceBridge)) - } else { - scheduleEndVoiceConference() - } - } - } - - private def scheduleEndVoiceConference() { - log.debug("MonitorNumberOfWebUsers continue for meeting [" + meetingID + "]") - // val timerActor = new TimerActor(TIMER_INTERVAL, self, "MonitorNumberOfWebUsers") - // timerActor.start - // context.system.scheduler.schedule(0 seconds, 2000 millis, self, "MonitorNumberOfWebUsers") - } - - def timeNowInMinutes(): Long = { - TimeUnit.NANOSECONDS.toMinutes(System.nanoTime()) - } - - def sendMeetingHasEnded(userId: String) { - outGW.send(new MeetingHasEnded(meetingID, userId)) - outGW.send(new DisconnectUser(meetingID, userId)) - } - - private def handleEndMeeting(msg: EndMeeting) { - meetingEnded = true - outGW.send(new MeetingEnded(msg.meetingID, recorded, voiceBridge)) - outGW.send(new DisconnectAllUsers(msg.meetingID)) - } - - private def handleVoiceRecording(msg: VoiceRecording) { - if (msg.recording) { - outGW.send(new VoiceRecordingStarted(meetingID, - recorded, msg.recordingFile, - msg.timestamp, voiceBridge)) - } else { - outGW.send(new VoiceRecordingStopped(meetingID, recorded, - msg.recordingFile, msg.timestamp, voiceBridge)) - } - } - - private def handleSetRecordingStatus(msg: SetRecordingStatus) { - log.debug("Change recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") - if (allowStartStopRecording && recording != msg.recording) { - recording = msg.recording - log.debug("Sending recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") - outGW.send(new RecordingStatusChanged(meetingID, recorded, msg.userId, msg.recording)) - } - } - - private def handleGetRecordingStatus(msg: GetRecordingStatus) { - outGW.send(new GetRecordingStatusReply(meetingID, recorded, msg.userId, recording.booleanValue())) - } - - def lockLayout(lock: Boolean) { - permissions = permissions.copy(lockedLayout = lock) - } - - def newPermissions(np: Permissions) { - permissions = np - } - - def permissionsEqual(other: Permissions): Boolean = { - permissions == other - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/RunningMeeting.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/RunningMeeting.scala deleted file mode 100755 index a20089f91b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/RunningMeeting.scala +++ /dev/null @@ -1,35 +0,0 @@ -package org.bigbluebutton.core - -import akka.actor.ActorRef -import akka.actor.ActorContext -import org.bigbluebutton.core.api.MessageOutGateway - -object RunningMeeting { - def apply(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, - voiceBridge: String, duration: Long, - autoStartRecording: Boolean, allowStartStopRecording: Boolean, - moderatorPass: String, viewerPass: String, - createTime: Long, createDate: String, - outGW: MessageOutGateway)(implicit context: ActorContext) = - new RunningMeeting(meetingID, externalMeetingID, meetingName, recorded, - voiceBridge, duration, - autoStartRecording, allowStartStopRecording, - moderatorPass, viewerPass, - createTime, createDate, - outGW)(context) -} - -class RunningMeeting(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, - val voiceBridge: String, val duration: Long, - val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, - val moderatorPass: String, val viewerPass: String, - val createTime: Long, val createDate: String, - val outGW: MessageOutGateway)(implicit val context: ActorContext) { - - val actorRef = context.actorOf(MeetingActor.props(meetingID, externalMeetingID, meetingName, recorded, - voiceBridge, duration, - autoStartRecording, allowStartStopRecording, - moderatorPass, viewerPass, - createTime, createDate, - outGW), meetingID) -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/SystemConfiguration.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/SystemConfiguration.scala deleted file mode 100755 index 66d8192f65..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/SystemConfiguration.scala +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.core - -import com.typesafe.config.ConfigFactory -import scala.util.Try - -trait SystemConfiguration { - - val config = ConfigFactory.load() - - lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") - - lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) - - lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") - - lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) - - lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") - lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/User.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/User.scala deleted file mode 100755 index d12357c29b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/User.scala +++ /dev/null @@ -1,29 +0,0 @@ -package org.bigbluebutton.core - -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.api.Role._ - -class User(val intUserID: String, val extUserID: String, val name: String, val role: Role) { - - private var presenter = false - private var handRaised = false - private var hasStream = false - private var voiceId: String = _ - private var muted = false - private var talking = false - private var locked = false - - def isPresenter(): Boolean = { - return presenter; - } - - def becomePresenter() { - presenter = true - } - - def unbecomePresenter() { - presenter = false - } -} - -case class VoiceUser(userId: String, muted: Boolean = false, talking: Boolean = false, locked: Boolean = false) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ConsoleDispatcher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ConsoleDispatcher.scala deleted file mode 100755 index df46b038da..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ConsoleDispatcher.scala +++ /dev/null @@ -1,8 +0,0 @@ -package org.bigbluebutton.core.api - -class ConsoleDispatcher extends IDispatcher { - - def dispatch(jsonMessage: String) { - println(jsonMessage) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Constants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Constants.scala deleted file mode 100644 index cdb6e62979..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Constants.scala +++ /dev/null @@ -1,96 +0,0 @@ -package org.bigbluebutton.core.api - -object Constants { - val NAME = "name" - val HEADER = "header" - val PAYLOAD = "payload" - val MEETING_ID = "meeting_id" - val EXTERNAL_MEETING_ID = "external_meeting_id" - val TIMESTAMP = "timestamp" - val CURRENT_TIME = "current_time" - val USER_ID = "userid" - val RECORDED = "recorded" - val MEETING_NAME = "meeting_name" - val VOICE_CONF = "voice_conf" - val DURATION = "duration" - val AUTH_TOKEN = "auth_token" - val ROLE = "role" - val EXT_USER_ID = "external_user_id" - val REQUESTER_ID = "requester_id" - val REPLY_TO = "reply_to" - val LOWERED_BY = "lowered_by" - val STREAM = "stream" - val LOCKED = "locked" - val SETTINGS = "settings" - val LOCK = "lock" - val EXCEPT_USERS = "except_users" - val STATUS = "status" - val VALUE = "value" - val NEW_PRESENTER_ID = "new_presenter_id" - val NEW_PRESENTER_NAME = "new_presenter_name" - val ASSIGNED_BY = "assigned_by" - val RECORDING = "recording" - val LAYOUT_ID = "layout_id" - val LAYOUT = "layout" - val POLL = "poll" - val POLL_ID = "poll_id" - val FORCE = "force" - val RESPONSE = "response" - val PRESENTATION_ID = "presentation_id" - val X_OFFSET = "x_offset" - val Y_OFFSET = "y_offset" - val WIDTH_RATIO = "width_ratio" - val HEIGHT_RATIO = "height_ratio" - val PAGE = "page" - val SHARE = "share" - val PRESENTATIONS = "presentations" - val MESSAGE_KEY = "message_key" - val CODE = "code" - val PRESENTATION_NAME = "presentation_name" - val NUM_PAGES = "num_pages" - val MAX_NUM_PAGES = "max_num_pages" - val PAGES_COMPLETED = "pages_completed" - val MUTE = "mute" - val CALLER_ID_NUM = "caller_id_num" - val CALLER_ID_NAME = "caller_id_name" - val TALKING = "talking" - val USER = "user" - val MUTED = "muted" - val VOICE_USER = "voice_user" - val RECORDING_FILE = "recording_file" - val ANNOTATION = "annotation" - val WHITEBOARD_ID = "whiteboard_id" - val ENABLE = "enable" - val PRESENTER = "presenter" - val USERS = "users" - val RAISE_HAND = "raise_hand" - val HAS_STREAM = "has_stream" - val WEBCAM_STREAM = "webcam_stream" - val PHONE_USER = "phone_user" - val PERMISSIONS = "permissions" - val VALID = "valid" - val CHAT_HISTORY = "chat_history" - val MESSAGE = "message" - val SET_BY_USER_ID = "set_by_user_id" - val POLLS = "polls" - val REASON = "reason" - val RESPONDER = "responder" - val PRESENTATION_INFO = "presentation_info" - val SHAPES = "shapes" - val SHAPE = "shape" - val SHAPE_ID = "shape_id" - val PRESENTATION = "presentation" - val ID = "id" - val CURRENT = "current" - val PAGES = "pages" - val WEB_USER_ID = "web_user_id" - val JOINED = "joined" - val X_PERCENT = "x_percent" - val Y_PERCENT = "y_percent" - val KEEP_ALIVE_ID = "keep_alive_id" - val LISTEN_ONLY = "listen_only" - val MODERATOR_PASS = "moderator_pass" - val VIEWER_PASS = "viewer_pass" - val CREATE_TIME = "create_time" - val CREATE_DATE = "create_date" -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/InMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/InMessages.scala deleted file mode 100755 index b9f9fd0036..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/InMessages.scala +++ /dev/null @@ -1,447 +0,0 @@ -package org.bigbluebutton.core.api - -import org.bigbluebutton.core.api.Role._ -import org.bigbluebutton.core.apps.poll._ -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import org.bigbluebutton.core.apps.presentation.Presentation - -trait InMessage { val meetingID: String } - -case class IsMeetingActorAliveMessage( - meetingId: String) - -case class KeepAliveMessage( - aliveID: String) - -case class CreateMeeting( - meetingID: String, - externalMeetingID: String, - meetingName: String, - recorded: Boolean, - voiceBridge: String, - duration: Long, - autoStartRecording: Boolean, - allowStartStopRecording: Boolean, - moderatorPass: String, - viewerPass: String, - createTime: Long, - createDate: String) extends InMessage - -case class InitializeMeeting( - meetingID: String, - recorded: Boolean) extends InMessage - -case class DestroyMeeting( - meetingID: String) extends InMessage - -case class StartMeeting( - meetingID: String) extends InMessage - -case class EndMeeting( - meetingID: String) extends InMessage - -case class LockSetting( - meetingID: String, - locked: Boolean, - settings: Map[String, Boolean]) extends InMessage - -// Lock -case class LockUser( - meetingID: String, - userId: String, - lock: Boolean) extends InMessage - -case class InitLockSettings( - meetingID: String, - settings: Permissions) extends InMessage - -case class SetLockSettings( - meetingID: String, - setByUser: String, - settings: Permissions) extends InMessage - -case class GetLockSettings( - meetingID: String, - userId: String) extends InMessage - -// Users -case class ValidateAuthToken( - meetingID: String, - userId: String, - token: String, - correlationId: String, - sessionId: String) extends InMessage - -case class RegisterUser( - meetingID: String, - userID: String, - name: String, - role: Role, - extUserID: String, - authToken: String) extends InMessage - -case class UserJoining( - meetingID: String, - userID: String, - authToken: String) extends InMessage - -case class UserLeaving( - meetingID: String, - userID: String, - sessionId: String) extends InMessage - -case class GetUsers( - meetingID: String, - requesterID: String) extends InMessage - -case class UserRaiseHand( - meetingID: String, - userId: String) extends InMessage - -case class UserLowerHand( - meetingID: String, - userId: String, - loweredBy: String) extends InMessage - -case class EjectUserFromMeeting(meetingID: String, userId: String, ejectedBy: String) extends InMessage - -case class UserShareWebcam( - meetingID: String, - userId: String, - stream: String) extends InMessage - -case class UserUnshareWebcam( - meetingID: String, - userId: String, - stream: String) extends InMessage - -case class ChangeUserStatus( - meetingID: String, - userID: String, - status: String, - value: Object) extends InMessage - -case class AssignPresenter( - meetingID: String, - newPresenterID: String, - newPresenterName: String, - assignedBy: String) extends InMessage - -case class SetRecordingStatus( - meetingID: String, - userId: String, - recording: Boolean) extends InMessage - -case class GetRecordingStatus( - meetingID: String, - userId: String) extends InMessage - -// Chat -case class GetChatHistoryRequest( - meetingID: String, - requesterID: String, - replyTo: String) extends InMessage - -case class SendPublicMessageRequest( - meetingID: String, - requesterID: String, - message: Map[String, String]) extends InMessage - -case class SendPrivateMessageRequest( - meetingID: String, - requesterID: String, - message: Map[String, String]) extends InMessage - -case class UserConnectedToGlobalAudio( - meetingID: String, - /** Not used. Just to satisfy trait **/ - voiceConf: String, - userid: String, - name: String) extends InMessage - -case class UserDisconnectedFromGlobalAudio( - meetingID: String, - /** Not used. Just to satisfy trait **/ - voiceConf: String, - userid: String, - name: String) extends InMessage - -// Layout -case class GetCurrentLayoutRequest( - meetingID: String, - requesterID: String) extends InMessage - -case class SetLayoutRequest( - meetingID: String, - requesterID: String, - layoutID: String) extends InMessage - -case class LockLayoutRequest( - meetingID: String, - setById: String, - lock: Boolean, - viewersOnly: Boolean, - layout: Option[String]) extends InMessage - -case class BroadcastLayoutRequest( - meetingID: String, - requesterID: String, - layout: String) extends InMessage - -// Poll -case class PreCreatedPoll( - meetingID: String, - poll: PollVO) extends InMessage - -case class CreatePoll( - meetingID: String, - requesterID: String, - poll: PollVO) extends InMessage - -case class UpdatePoll( - meetingID: String, - requesterID: String, - poll: PollVO) extends InMessage - -case class GetPolls( - meetingID: String, - requesterID: String) extends InMessage - -case class DestroyPoll( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class RemovePoll( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class SharePoll( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class ShowPollResult( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class HidePollResult( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class StopPoll( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class StartPoll( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class ClearPoll( - meetingID: String, - requesterID: String, - pollID: String, - force: Boolean = false) extends InMessage - -case class GetPollResult( - meetingID: String, - requesterID: String, - pollID: String) extends InMessage - -case class RespondToPoll( - meetingID: String, - requesterID: String, - response: PollResponseVO) extends InMessage - -// Presentation -case class ClearPresentation( - meetingID: String) extends InMessage - -case class RemovePresentation( - meetingID: String, - presentationID: String) extends InMessage - -case class GetPresentationInfo( - meetingID: String, - requesterID: String, - replyTo: String) extends InMessage - -case class SendCursorUpdate( - meetingID: String, - xPercent: Double, - yPercent: Double) extends InMessage - -case class ResizeAndMoveSlide( - meetingID: String, - xOffset: Double, - yOffset: Double, - widthRatio: Double, - heightRatio: Double) extends InMessage - -case class GotoSlide( - meetingID: String, - page: String) extends InMessage - -case class SharePresentation( - meetingID: String, - presentationID: String, - share: Boolean) extends InMessage - -case class GetSlideInfo( - meetingID: String, - requesterID: String, - replyTo: String) extends InMessage - -case class PreuploadedPresentations( - meetingID: String, - presentations: Seq[Presentation]) extends InMessage - -case class PresentationConversionUpdate( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - presName: String) extends InMessage - -case class PresentationPageCountError( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - maxNumberPages: Int, - presName: String) extends InMessage - -case class PresentationSlideGenerated( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - pagesCompleted: Int, - presName: String) extends InMessage - -case class PresentationConversionCompleted( - meetingID: String, - messageKey: String, - code: String, - presentation: Presentation) extends InMessage - -// Voice -case class InitAudioSettings( - meetingID: String, - requesterID: String, - muted: Boolean) extends InMessage - -case class SendVoiceUsersRequest( - meetingID: String, - requesterID: String) extends InMessage - -case class MuteAllExceptPresenterRequest( - meetingID: String, - requesterID: String, - mute: Boolean) extends InMessage - -case class MuteMeetingRequest( - meetingID: String, - requesterID: String, - mute: Boolean) extends InMessage - -case class IsMeetingMutedRequest( - meetingID: String, - requesterID: String) extends InMessage - -case class MuteUserRequest( - meetingID: String, - requesterID: String, - userID: String, - mute: Boolean) extends InMessage - -case class LockUserRequest( - meetingID: String, - requesterID: String, - userID: String, - lock: Boolean) extends InMessage - -case class EjectUserFromVoiceRequest( - meetingID: String, - userId: String, - ejectedBy: String) extends InMessage - -case class VoiceUserJoinedMessage( - meetingID: String, - user: String, - voiceConfId: String, - callerIdNum: String, - callerIdName: String, - muted: Boolean, - talking: Boolean) extends InMessage - -case class VoiceUserJoined( - meetingID: String, - voiceUser: VoiceUser) extends InMessage - -case class VoiceUserLeft( - meetingID: String, - userId: String) extends InMessage - -case class VoiceUserLocked( - meetingID: String, - userId: String, - locked: Boolean) extends InMessage - -case class VoiceUserMuted( - meetingID: String, - userId: String, - muted: Boolean) extends InMessage - -case class VoiceUserTalking( - meetingID: String, - userId: String, - talking: Boolean) extends InMessage - -case class VoiceRecording( - meetingID: String, - recordingFile: String, - timestamp: String, - recording: Boolean) extends InMessage - -// Whiteboard -case class SendWhiteboardAnnotationRequest( - meetingID: String, - requesterID: String, - annotation: AnnotationVO) extends InMessage - -case class GetWhiteboardShapesRequest( - meetingID: String, - requesterID: String, - whiteboardId: String, - replyTo: String) extends InMessage - -case class ClearWhiteboardRequest( - meetingID: String, - requesterID: String, - whiteboardId: String) extends InMessage - -case class UndoWhiteboardRequest( - meetingID: String, - requesterID: String, - whiteboardId: String) extends InMessage - -case class EnableWhiteboardRequest( - meetingID: String, - requesterID: String, - enable: Boolean) extends InMessage - -case class IsWhiteboardEnabledRequest( - meetingID: String, - requesterID: String, - replyTo: String) extends InMessage - -case class GetAllMeetingsRequest( - meetingID: String /** Not used. Just to satisfy trait **/ ) extends InMessage diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/MessageNames.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/MessageNames.scala deleted file mode 100755 index 6ae3769a3f..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/MessageNames.scala +++ /dev/null @@ -1,164 +0,0 @@ -package org.bigbluebutton.core.api - -object MessageNames { - val CREATE_MEETING = "create_meeting_request" - val INITIALIZE_MEETING = "initialize_meeting_request" - val DESTROY_MEETING = "destroy_meeting_request" - val START_MEETING = "start_meeting_request" - val END_MEETING = "end_meeting_request" - val LOCK_SETTING = "lock_setting_request" - val LOCK_USER = "lock_user_request" - val INIT_LOCK_SETTINGS = "init_lock_settings" - val INIT_AUDIO_SETTINGS = "init_audio_settings" - val SET_LOCK_SETTINGS = "set_lock_settings" - val GET_LOCK_SETTINGS = "get_lock_settings" - val IS_MEETING_LOCKED = "is_meeting_locked" - val VALIDATE_AUTH_TOKEN = "validate_auth_token_request" - val VALIDATE_AUTH_TOKEN_REPLY = "validate_auth_token_reply" - val REGISTER_USER = "register_user_request" - val USER_JOINING = "user_joining_request" - val USER_LEAVING = "user_leaving_request" - val GET_USERS = "get_users_request" - val RAISE_HAND = "user_raise_hand_request" - val LOWER_HAND = "user_lower_hand_request" - val USER_SHARE_WEBCAM = "user_share_webcam_request" - val USER_UNSHARE_WEBCAM = "user_unshare_webcam_request" - val CHANGE_USER_STATUS = "change_user_status_request" - val ASSIGN_PRESENTER = "assign_presenter_request" - val SET_RECORDING_STATUS = "set_recording_status_request" - val GET_CHAT_HISTORY = "get_chat_history_request" - val SEND_PUBLIC_MESSAGE = "send_public_chat_message_request" - val SEND_PRIVATE_MESSAGE = "send_private_chat_message_request" - val GET_CURRENT_LAYOUT = "get_current_layout_request" - val SET_LAYOUT = "set_layout_request" - val BROADCAST_LAYOUT = "broadcast_layout_request" - val UNLOCK_LAYOUT = "unlock_layout_request" - val PRECREATED_POLL = "precreated_poll_request" - val CREATE_POLL = "create_poll_request" - val UPDATE_POLL = "update_poll_request" - val GET_POLLS = "get_polls_request" - val DESTROY_POLL = "destroy_poll_request" - val REMOVE_POLL = "remove_poll_request" - val SHARE_POLL = "share_poll_request" - val SHOW_POLL_RESULT = "show_poll_result_request" - val HIDE_POLL_RESULT = "hide_poll_result_request" - val START_POLL = "start_poll_request" - val STOP_POLL = "stop_poll_request" - val CLEAR_POLL = "clear_poll_request" - val GET_POLL_RESULT = "get_poll_result_request" - val RESPONT_TO_POLL = "respond_to_poll_request" - val CLEAR_PRESENTATION = "clear_presentation_request" - val REMOVE_PRESENTATION = "remove_presentation_request" - val GET_PRESENTATION_INFO = "get_presentation_info_request" - val RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide_request" - val GO_TO_SLIDE = "go_to_slide_request" - val SHARE_PRESENTATION = "share_presentation_request" - val GET_SLIDE_INFO = "get_slide_info_request" - val GET_SLIDE_INFO_REPLY = "get_slide_info_reply" - val PREUPLOADED_PRESENTATIONS = "preuploaded_presentation_request" - val PRESENTATION_CONVERSION_UPDATE = "presentation_conversion_update_message" - val PRESENTATION_PAGE_COUNT_ERROR = "presentation_page_count_error_message" - val PRESENTATION_SLIDE_GENERATED = "presentation_slide_generated_message" - val PRESENTATION_CONVERSION_COMPLETED = "presentation_conversion_completed_message" - val PRESENTATION_CURSOR_UPDATED = "presentation_cursor_updated_message" - val SEND_VOICE_USERS_REQUEST = "send_voice_users_request" - val MUTE_MEETING_REQUEST = "mute_meeting_request" - val IS_MEETING_MUTED = "is_meeting_muted_request" - val MUTE_USER = "mute_user_request" - val EJECT_USER = "eject_user_request" - val VOICE_USER_JOINED_MESSAGE = "voice_user_joined_message" - val VOICE_USER_JOINED = "voice_user_joined" - val VOICE_USER_LEFT = "voice_user_left_message" - val VOICE_USER_LOCKED = "voice_user_locked_message" - val VOICE_USER_MUTED = "voice_user_muted_message" - val VOICE_USER_TALKING = "voice_user_talking_message" - val VOICE_RECORDING = "voice_recording_message" - val SEND_WHITEBOARD_ANNOTATION = "send_whiteboard_annotation_request" - val GET_WHITEBOARD_SHAPES = "get_whiteboard_shapes_request" - val CLEAR_WHITEBOARD = "clear_whiteboard_request" - val UNDO_WHITEBOARD = "undo_whiteboard_request" - val ENABLE_WHITEBOARD = "enable_whiteboard_request" - val IS_WHITEBOARD_ENABLED = "is_whiteboard_enabled_request" - val GET_ALL_MEETINGS_REQUEST = "get_all_meetings_request" - - // OUT MESSAGES - val MEETING_CREATED = "meeting_created_message" - val VOICE_RECORDING_STARTED = "voice_recording_started_message" - val VOICE_RECORDING_STOPPED = "voice_recording_stopped_message" - val RECORDING_STATUS_CHANGED = "recording_status_changed_message" - val GET_RECORDING_STATUS_REPLY = "get_recording_status_reply" - val MEETING_ENDED = "meeting_ended_message" - val MEETING_HAS_ENDED = "meeting_has_ended_message" - val MEETING_DESTROYED = "meeting_destroyed_message" - val DISCONNECT_ALL_USERS = "disconnect_all_users_message" - val DISCONNECT_USER = "disconnect_user_message" - val PERMISSION_SETTING_INITIALIZED = "permisssion_setting_initialized_message" - val NEW_PERMISSION_SETTINGS = "new_permission_settings" - val USER_LOCKED = "user_locked_message" - val USERS_LOCKED = "users_locked_message" - val GET_PERMISSION_SETTINGS_REPLY = "get_permissions_setting_reply" - val IS_MEETING_LOCKED_REPLY = "is_meeting_locked_reply" - val USER_REGISTERED = "user_registered_message" - val USER_LEFT = "user_left_message" - val PRESENTER_ASSIGNED = "presenter_assigned_message" - val END_AND_KICK_ALL = "end_and_kick_all_message" - val GET_USERS_REPLY = "get_users_reply" - val USER_JOINED = "user_joined_message" - val USER_RAISED_HAND = "user_raised_hand_message" - val USER_LOWERED_HAND = "user_lowered_hand_message" - val USER_SHARED_WEBCAM = "user_shared_webcam_message" - val USER_UNSHARED_WEBCAM = "user_unshared_webcam_message" - val USER_STATUS_CHANGED = "user_status_changed_message" - val MUTE_VOICE_USER = "mute_voice_user_request" - val USER_VOICE_MUTED = "user_voice_muted_message" - val USER_VOICE_TALKING = "user_voice_talking_message" - val EJECT_VOICE_USER = "eject_voice_user_message" - val USER_JOINED_VOICE = "user_joined_voice_message" - val USER_LEFT_VOICE = "user_left_voice_message" - val IS_MEETING_MUTED_REPLY = "is_meeting_muted_reply" - val START_RECORDING = "start_recording_message" - val STOP_RECORDING = "stop_recording_message" - val GET_CHAT_HISTORY_REPLY = "get_chat_history_reply" - val SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message" - val SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message" - val GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply" - val SET_LAYOUT_REPLY = "set_layout_reply" - val BROADCAST_LAYOUT_REPLY = "broadcast_layout_reply" - val UNLOCK_LAYOUT_REPLY = "unlock_layout_reply" - val GET_POLL_RESULT_REPLY = "get_poll_result_reply" - val POLL_CLEARED = "poll_cleared_message" - val GET_POLLS_REPLY = "get_polls_reply" - val CLEAR_POLL_FAILED = "clear_poll_failed" - val POLL_STARTED = "poll_started_message" - val POLL_STOPPED = "poll_stopped_message" - val POLL_REMOVED = "poll_removed" - val POLL_UPDATED = "poll_updated_message" - val POLL_CREATED = "poll_created_message" - val POLL_RESPONSE = "poll_response_message" - val POLL_HIDE_RESULT = "poll_hide_result_message" - val POLL_SHOW_RESULT = "poll_show_result_message" - val PRESENTATION_CLEARED = "presentation_cleared_message" - val PRESENTATION_REMOVED = "presentation_removed_message" - val GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply" - val PRESENTATION_PAGE_RESIZED = "presentation_page_resized_message" - val PRESENTATION_PAGE_CHANGED = "presentation_page_changed_message" - val PRESENTATION_SHARED = "presentation_shared_message" - val GET_PREUPLOADED_PRESENTATIONS = "get_preuploaded_presentations_message" - val PRESENTATION_CONVERSION_PROGRESS = "presentation_conversion_progress_message" - val PRESENTATION_CONVERSION_ERROR = "presentation_conversion_error_message" - val PRESENTATION_CONVERSION_DONE = "presentation_conversion_done_message" - val PRESENTATION_CHANGED = "presentation_changed_message" - val GET_PRESENTATION_STATUS_REPLY = "get_presentation_status_reply" - val PRESENTATION_REMOVED_MESSAGE = "presentation_removed_message" - val PRESENTATION_PAGE_GENERATED = "presentation_page_generated_message" - val GET_WHITEBOARD_SHAPES_REPLY = "get_whiteboard_shapes_reply" - val SEND_WHITEBOARD_SHAPE = "send_whiteboard_shape_message" - val UNDO_WHITEBOARD_MESSAGE = "undo_whiteboard_message" - val WHITEBOARD_ENABLED = "whiteboard_enabled_message" - val WHITEBOARD_CLEARED = "whiteboard_cleared_message" - val IS_WHITEBOARD_ENABLED_REPLY = "is_whiteboard_enabled_reply" - val MEETING_DESTROYED_EVENT = "meeting_destroyed_event" - val KEEP_ALIVE_REPLY = "keep_alive_reply" - val USER_LISTEN_ONLY = "user_listening_only" - val GET_ALL_MEETINGS_REPLY = "get_all_meetings_reply" -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/OutMessages.scala deleted file mode 100755 index 57f3b6a144..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/OutMessages.scala +++ /dev/null @@ -1,575 +0,0 @@ -package org.bigbluebutton.core.api - -import org.bigbluebutton.core.apps.poll._ -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import org.bigbluebutton.core.apps.presentation.CurrentPresentationInfo -import org.bigbluebutton.core.apps.presentation.Presentation -import org.bigbluebutton.core.apps.presentation.Page - -abstract class OutMessage - -case class VoiceRecordingStarted( - meetingID: String, - recorded: Boolean, - recordingFile: String, - timestamp: String, - confNum: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class VoiceRecordingStopped( - meetingID: String, - recorded: Boolean, - recordingFile: String, - timestamp: String, - confNum: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class RecordingStatusChanged( - meetingID: String, - recorded: Boolean, - userId: String, - recording: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetRecordingStatusReply( - meetingID: String, - recorded: Boolean, - userId: String, - recording: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MeetingCreated( - meetingID: String, - externalMeetingID: String, - recorded: Boolean, - name: String, - voiceBridge: String, - duration: Long, - moderatorPass: String, - viewerPass: String, - createTime: Long, - createDate: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MeetingMuted( - meetingID: String, - recorded: Boolean, - meetingMuted: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MeetingEnded( - meetingID: String, - recorded: Boolean, - voiceBridge: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MeetingState( - meetingID: String, - recorded: Boolean, - userId: String, - permissions: Permissions, - meetingMuted: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MeetingHasEnded( - meetingID: String, - userId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MeetingDestroyed( - meetingID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class DisconnectAllUsers( - meetingID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class DisconnectUser( - meetingID: String, - userId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class KeepAliveMessageReply( - aliveID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case object IsAliveMessage extends IOutMessage - -// Permissions -case class PermissionsSettingInitialized( - meetingID: String, - permissions: Permissions, - applyTo: Array[UserVO], - version: String = Versions.V_0_0_1) extends IOutMessage - -case class NewPermissionsSetting( - meetingID: String, - setByUser: String, - permissions: Permissions, - applyTo: Array[UserVO], - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserLocked( - meetingID: String, - userId: String, - lock: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetPermissionsSettingReply( - meetingID: String, - userId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -// Users -case class UserRegistered( - meetingID: String, - recorded: Boolean, - user: RegisteredUser, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserLeft( - meetingID: String, - recorded: Boolean, - user: UserVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserEjectedFromMeeting(meetingID: String, recorded: Boolean, userId: String, ejectedBy: String, version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresenterAssigned( - meetingID: String, - recorded: Boolean, - presenter: Presenter, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class EjectAllVoiceUsers( - meetingID: String, - recorded: Boolean, - voiceBridge: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class EndAndKickAll( - meetingID: String, - recorded: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetUsersReply( - meetingID: String, - requesterID: String, - users: Array[UserVO], - version: String = Versions.V_0_0_1) extends IOutMessage - -case class ValidateAuthTokenTimedOut( - meetingID: String, - requesterId: String, - token: String, - valid: Boolean, - correlationId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class ValidateAuthTokenReply( - meetingID: String, - requesterId: String, - token: String, - valid: Boolean, - correlationId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserJoined( - meetingID: String, - recorded: Boolean, - user: UserVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserRaisedHand( - meetingID: String, - recorded: Boolean, - userID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserLoweredHand( - meetingID: String, - recorded: Boolean, - userID: String, - loweredBy: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserListeningOnly( - meetingID: String, - recorded: Boolean, - userID: String, - listenOnly: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserSharedWebcam( - meetingID: String, - recorded: Boolean, - userID: String, - stream: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserUnsharedWebcam( - meetingID: String, - recorded: Boolean, - userID: String, - stream: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserStatusChange( - meetingID: String, - recorded: Boolean, - userID: String, - status: String, - value: Object, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class MuteVoiceUser( - meetingID: String, - recorded: Boolean, - requesterID: String, - userId: String, - mute: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserVoiceMuted( - meetingID: String, - recorded: Boolean, - confNum: String, - user: UserVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserVoiceTalking( - meetingID: String, - recorded: Boolean, - confNum: String, - user: UserVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class EjectVoiceUser( - meetingID: String, - recorded: Boolean, - requesterID: String, - userId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserJoinedVoice( - meetingID: String, - recorded: Boolean, - confNum: String, - user: UserVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UserLeftVoice( - meetingID: String, - recorded: Boolean, - confNum: String, - user: UserVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -// Voice -case class IsMeetingMutedReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - meetingMuted: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class StartRecording( - meetingID: String, - recorded: Boolean, - requesterID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class StopRecording( - meetingID: String, - recorded: Boolean, - requesterID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -// Chat -case class GetChatHistoryReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - replyTo: String, - history: Array[Map[String, String]], - version: String = Versions.V_0_0_1) extends IOutMessage - -case class SendPublicMessageEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - message: Map[String, String], - version: String = Versions.V_0_0_1) extends IOutMessage - -case class SendPrivateMessageEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - message: Map[String, String], - version: String = Versions.V_0_0_1) extends IOutMessage - -// Layout -case class GetCurrentLayoutReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - layoutID: String, - locked: Boolean, - setByUserID: String) extends IOutMessage - -case class BroadcastLayoutEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - layoutID: String, - locked: Boolean, - setByUserID: String, - applyTo: Array[UserVO]) extends IOutMessage - -case class LockLayoutEvent( - meetingID: String, - recorded: Boolean, - setById: String, - locked: Boolean, - applyTo: Array[UserVO]) extends IOutMessage - -// Poll -case class GetPollResultReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - pollVO: PollVO) extends IOutMessage - -case class GetPollsReplyOutMsg( - meetingID: String, - recorded: Boolean, - requesterID: String, - polls: Array[PollVO]) extends IOutMessage - -case class ClearPollFailed( - meetingID: String, - pollID: String, - requesterID: String, - reason: String) extends IOutMessage - -case class PollClearedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String) extends IOutMessage - -case class PollStartedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String) extends IOutMessage - -case class PollStoppedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String) extends IOutMessage - -case class PollRemovedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String) extends IOutMessage - -case class PollUpdatedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String, - pollVO: PollVO) extends IOutMessage - -case class PollCreatedOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String, - pollVO: PollVO) extends IOutMessage - -case class PollResponseOutMsg( - meetingID: String, - recorded: Boolean, - responder: Responder, - response: PollResponseVO) extends IOutMessage - -case class PollHideResultOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String) extends IOutMessage - -case class PollShowResultOutMsg( - meetingID: String, - recorded: Boolean, - pollID: String) extends IOutMessage - -// Presentation -case class ClearPresentationOutMsg( - meetingID: String, - recorded: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class RemovePresentationOutMsg( - meetingID: String, - recorded: Boolean, - presentationID: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetPresentationInfoOutMsg( - meetingID: String, - recorded: Boolean, - requesterID: String, - info: CurrentPresentationInfo, - replyTo: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class SendCursorUpdateOutMsg( - meetingID: String, - recorded: Boolean, - xPercent: Double, - yPercent: Double, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class ResizeAndMoveSlideOutMsg( - meetingID: String, - recorded: Boolean, - page: Page, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GotoSlideOutMsg( - meetingID: String, - recorded: Boolean, - page: Page, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class SharePresentationOutMsg( - meetingID: String, - recorded: Boolean, - presentation: Presentation, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetSlideInfoOutMsg( - meetingID: String, - recorded: Boolean, - requesterID: String, - page: Page, - replyTo: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetPreuploadedPresentationsOutMsg( - meetingID: String, - recorded: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresentationConversionProgress( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - presentationName: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresentationConversionError( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - maxNumberPages: Int, - presentationName: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresentationPageGenerated( - meetingID: String, - messageKey: String, - code: String, - presentationId: String, - numberOfPages: Int, - pagesCompleted: Int, - presentationName: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresentationConversionDone( - meetingID: String, - recorded: Boolean, - messageKey: String, - code: String, - presentation: Presentation, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresentationChanged( - meetingID: String, - presentation: Presentation, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetPresentationStatusReply( - meetingID: String, - presentations: Seq[Presentation], - current: Presentation, - replyTo: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PresentationRemoved( - meetingID: String, - presentationId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class PageChanged( - meetingID: String, - page: Page, - version: String = Versions.V_0_0_1) extends IOutMessage - -// Whiteboard -case class GetWhiteboardShapesReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - shapes: Array[AnnotationVO], - replyTo: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class SendWhiteboardAnnotationEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - shape: AnnotationVO, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class ClearWhiteboardEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class UndoWhiteboardEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - whiteboardId: String, - shapeId: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class WhiteboardEnabledEvent( - meetingID: String, - recorded: Boolean, - requesterID: String, - enable: Boolean, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class IsWhiteboardEnabledReply( - meetingID: String, - recorded: Boolean, - requesterID: String, - enabled: Boolean, - replyTo: String, - version: String = Versions.V_0_0_1) extends IOutMessage - -case class GetAllMeetingsReply( - meetings: Array[MeetingInfo], - version: String = Versions.V_0_0_1) extends IOutMessage - -// Value Objects -case class MeetingVO( - id: String, - recorded: Boolean) - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/TimestampGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/TimestampGenerator.scala deleted file mode 100644 index ed55b373fe..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/TimestampGenerator.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.bigbluebutton.core.api - -import java.util.concurrent.TimeUnit - -object TimestampGenerator { - - def generateTimestamp(): Long = { - TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - } - - def getCurrentTime(): Long = { - System.currentTimeMillis(); - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ValueObjects.scala deleted file mode 100755 index 82de5a8a5a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/ValueObjects.scala +++ /dev/null @@ -1,105 +0,0 @@ -package org.bigbluebutton.core.api - -import java.lang.Boolean - -object Role extends Enumeration { - type Role = Value - val MODERATOR = Value("MODERATOR") - val VIEWER = Value("VIEWER") -} - -case class Presenter( - presenterID: String, - presenterName: String, - assignedBy: String) - -case class User( - id: String, - externId: String, - name: String, - moderator: Boolean, - avatarUrl: String, - logoutUrl: String, - presenter: Boolean, - callerId: CallerId, - phoneCaller: Boolean, - handRaised: Boolean, - muted: Boolean, - talking: Boolean) - -case class CallerId( - name: String, - number: String) - -case class Permissions( - disableCam: Boolean = false, - disableMic: Boolean = false, - disablePrivChat: Boolean = false, - disablePubChat: Boolean = false, - lockedLayout: Boolean = false, - lockOnJoin: Boolean = false, - lockOnJoinConfigurable: Boolean = false) - -case class RegisteredUser( - id: String, - externId: String, - name: String, - role: Role.Role, - authToken: String) - -case class Voice( - id: String, - webId: String, - callId: CallerId, - phoningIn: Boolean, - joined: Boolean, - locked: Boolean, - muted: Boolean, - talking: Boolean) - -case class UserVO( - userID: String, - externUserID: String, - name: String, - role: Role.Role, - raiseHand: Boolean, - presenter: Boolean, - hasStream: Boolean, - locked: Boolean, - webcamStreams: Set[String], - phoneUser: Boolean, - voiceUser: VoiceUser, - listenOnly: Boolean) - -case class VoiceUser(userId: String, - webUserId: String, - callerName: String, - callerNum: String, - joined: Boolean, - locked: Boolean, - muted: Boolean, - talking: Boolean) - -case class MeetingConfig(name: String, - id: MeetingID, - passwords: MeetingPasswords, - welcomeMsg: String, - logoutUrl: String, - maxUsers: Int, - record: Boolean = false, - duration: MeetingDuration, - defaultAvatarURL: String, - defaultConfigToken: String) - -case class MeetingName(name: String) - -case class MeetingID(internal: String, external: String) - -case class VoiceConfig(telVoice: String, webVoice: String, dialNumber: String) - -case class MeetingPasswords(moderatorPass: String, viewerPass: String) - -case class MeetingDuration(duration: Int = 0, createdTime: Long = 0, - startTime: Long = 0, endTime: Long = 0) - -case class MeetingInfo(meetingID: String, meetingName: String, recorded: Boolean, voiceBridge: String, duration: Long) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Versions.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Versions.scala deleted file mode 100755 index 6fe5b194e8..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/api/Versions.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.api - -object Versions { - val V_0_0_1 = "0.0.1" -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatApp.scala deleted file mode 100755 index ee1664f3b6..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatApp.scala +++ /dev/null @@ -1,31 +0,0 @@ -package org.bigbluebutton.core.apps.chat - -import org.bigbluebutton.core.api._ -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.MeetingActor - -trait ChatApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - val messages = new ArrayBuffer[Map[String, String]]() - - def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { - val history = new Array[Map[String, String]](messages.size) - messages.copyToArray(history) - outGW.send(new GetChatHistoryReply(meetingID, recorded, msg.requesterID, msg.replyTo, history)) - } - - def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { - messages append msg.message.toMap - val pubMsg = msg.message.toMap - - outGW.send(new SendPublicMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) - } - - def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { - val pubMsg = msg.message.toMap - outGW.send(new SendPrivateMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatInGateway.scala deleted file mode 100755 index 573b51c5fc..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/ChatInGateway.scala +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.core.apps.chat - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class ChatInGateway(bbbGW: BigBlueButtonGateway) { - - def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { - bbbGW.accept(new GetChatHistoryRequest(meetingID, requesterID, replyTo)) - } - - def sendPrivateMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { - bbbGW.accept(new SendPrivateMessageRequest(meetingID, requesterID, msg)) - } - - def sendPublicMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { - bbbGW.accept(new SendPublicMessageRequest(meetingID, requesterID, msg)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisPublisher.scala deleted file mode 100755 index e9429e12be..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisPublisher.scala +++ /dev/null @@ -1,38 +0,0 @@ -package org.bigbluebutton.core.apps.chat.redis - -import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import org.bigbluebutton.core.messaging.Util - -class ChatEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) - case _ => // do nothing - } - } - - private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { - val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { - val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisRecorder.scala deleted file mode 100755 index c30ac8989a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatEventRedisRecorder.scala +++ /dev/null @@ -1,29 +0,0 @@ -package org.bigbluebutton.core.apps.chat.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.recorder.chat.PublicChatRecordEvent -import scala.collection.JavaConversions._ - -class ChatEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case _ => // do nothing - } - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - if (msg.recorded) { - val message = mapAsJavaMap(msg.message) - val ev = new PublicChatRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setMeetingId(msg.meetingID); - ev.setSender(message.get("fromUsername")); - ev.setMessage(message.get("message")); - ev.setColor(message.get("fromColor")); - recorder.record(msg.meetingID, ev); - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatMessageToJsonConverter.scala deleted file mode 100755 index 380e9a5d2a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/chat/redis/ChatMessageToJsonConverter.scala +++ /dev/null @@ -1,67 +0,0 @@ -package org.bigbluebutton.core.apps.chat.redis - -import scala.collection.mutable.HashMap -import org.bigbluebutton.conference.service.chat.ChatKeyUtil -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.mutable.HashMap -import collection.JavaConverters._ -import scala.collection.JavaConversions._ -import java.util.ArrayList -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import org.bigbluebutton.core.messaging.Util - -object ChatMessageToJsonConverter { - - val UNKNOWN = "unknown" - - private def chatMessageToMap(msg: Map[String, String]): HashMap[String, String] = { - val res = new HashMap[String, String] - res += "chat_type" -> msg.get(ChatKeyUtil.CHAT_TYPE).getOrElse(UNKNOWN) - res += "from_userid" -> msg.get(ChatKeyUtil.FROM_USERID).getOrElse(UNKNOWN) - res += "from_username" -> msg.get(ChatKeyUtil.FROM_USERNAME).getOrElse(UNKNOWN) - res += "from_color" -> msg.get(ChatKeyUtil.FROM_COLOR).getOrElse(UNKNOWN) - res += "from_time" -> msg.get(ChatKeyUtil.FROM_TIME).getOrElse(UNKNOWN) - res += "from_tz_offset" -> msg.get(ChatKeyUtil.FROM_TZ_OFFSET).getOrElse(UNKNOWN) - res += "to_userid" -> msg.get(ChatKeyUtil.TO_USERID).getOrElse(UNKNOWN) - res += "to_username" -> msg.get(ChatKeyUtil.TO_USERNAME).getOrElse(UNKNOWN) - res += "message" -> msg.get(ChatKeyUtil.MESSAGE).getOrElse(UNKNOWN) - - res - } - - def getChatHistoryReplyToJson(msg: GetChatHistoryReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val collection = new ArrayList[java.util.Map[String, String]](); - - msg.history.foreach(p => { - collection.add(mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(p))) - }) - - payload.put(Constants.CHAT_HISTORY, collection) - - val header = Util.buildHeader(MessageNames.GET_CHAT_HISTORY_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendPublicMessageEventToJson(msg: SendPublicMessageEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) - - val header = Util.buildHeader(MessageNames.SEND_PUBLIC_CHAT_MESSAGE, msg.version, None) - Util.buildJson(header, payload) - } - - def sendPrivateMessageEventToJson(msg: SendPrivateMessageEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) - - val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutApp.scala deleted file mode 100755 index 4bcfbfc4d3..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutApp.scala +++ /dev/null @@ -1,66 +0,0 @@ -package org.bigbluebutton.core.apps.layout - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.MeetingActor -import scala.collection.mutable.ArrayBuffer - -trait LayoutApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - private var setByUser: String = "system"; - private var currentLayout = ""; - private var layoutLocked = false - private var viewersOnly = true - - def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { - outGW.send(new GetCurrentLayoutReply(msg.meetingID, recorded, msg.requesterID, - currentLayout, permissions.lockedLayout, setByUser)) - } - - def handleLockLayoutRequest(msg: LockLayoutRequest) { - viewersOnly = msg.viewersOnly - lockLayout(msg.lock) - - outGW.send(new LockLayoutEvent(msg.meetingID, recorded, - msg.setById, msg.lock, affectedUsers)) - - msg.layout foreach { l => - currentLayout = l - broadcastSyncLayout(msg.meetingID, msg.setById) - } - } - - private def broadcastSyncLayout(meetingId: String, setById: String) { - outGW.send(new BroadcastLayoutEvent(meetingId, recorded, setById, - currentLayout, permissions.lockedLayout, setByUser, affectedUsers)) - } - - def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { - currentLayout = msg.layout - broadcastSyncLayout(msg.meetingID, msg.requesterID) - } - - def handleLockLayout(lock: Boolean, setById: String) { - outGW.send(new LockLayoutEvent(meetingID, recorded, setById, lock, affectedUsers)) - - broadcastSyncLayout(meetingID, setById) - } - - def affectedUsers(): Array[UserVO] = { - if (viewersOnly) { - val au = ArrayBuffer[UserVO]() - users.getUsers foreach { u => - if (!u.presenter && u.role != Role.MODERATOR) { - au += u - } - } - au.toArray - } else { - users.getUsers - } - - } - -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutInGateway.scala deleted file mode 100644 index 3e0c16d316..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/layout/LayoutInGateway.scala +++ /dev/null @@ -1,21 +0,0 @@ -package org.bigbluebutton.core.apps.layout - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class LayoutInGateway(bbbGW: BigBlueButtonGateway) { - - def getCurrentLayout(meetingID: String, requesterID: String) { - bbbGW.accept(new GetCurrentLayoutRequest(meetingID, requesterID)) - } - - def broadcastLayout(meetingID: String, requesterID: String, layout: String) { - bbbGW.accept(new BroadcastLayoutRequest(meetingID, requesterID, layout)) - } - - def lockLayout(meetingID: String, setById: String, - lock: Boolean, viewersOnly: Boolean, - layout: Option[String]) { - bbbGW.accept(new LockLayoutRequest(meetingID, setById, lock, viewersOnly, layout)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/Poll.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/Poll.scala deleted file mode 100755 index 6d13a3bb45..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/Poll.scala +++ /dev/null @@ -1,140 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import scala.collection.mutable.HashMap -import scala.collection.mutable.ArrayBuffer - -case class QuestionResponsesVO(val questionID: String, val responseIDs: Array[String]) -case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) -case class ResponderVO(responseID: String, user: Responder) - -case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) -case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) -case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) - -case class Responder(val userID: String, name: String) - -case class ResponseOutVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) -case class QuestionOutVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseOutVO]) -case class PollOutVO(id: String, title: String, started: Boolean, stopped: Boolean, questions: Array[QuestionOutVO]) - -class Poll(val id: String, val title: String, val questions: Array[Question]) { - private var _started: Boolean = false - private var _stopped: Boolean = false - - private var _showResult: Boolean = false - - def showResult() { - _showResult = true - } - - def hideResult() { - _showResult = false - } - - def resultShown(): Boolean = { - _showResult - } - - def start() { - _started = true; - } - - def stop() { - _stopped = true; - } - - def isStarted(): Boolean = { - return _started - } - - def isStopped(): Boolean = { - return _stopped - } - - def clear() { - questions.foreach(q => { - q.clear - }) - - _started = false - _stopped = false - } - - def hasResponses(): Boolean = { - questions.foreach(q => { - if (q.hasResponders) return true - }) - - return false - } - - def respondToQuestion(questionID: String, responseID: String, responder: Responder) { - questions.foreach(q => { - if (q.id.equals(questionID)) { - q.respondToQuestion(responseID, responder) - } - }) - } - - def toPollVO(): PollVO = { - val qvos = new ArrayBuffer[QuestionVO] - questions.foreach(q => { - qvos += q.toQuestionVO - }) - - new PollVO(id, title, qvos.toArray, _started, _stopped) - } -} - -class Question(val id: String, val multiResponse: Boolean, val question: String, val responses: Array[Response]) { - - def clear() { - responses.foreach(r => r.clear) - } - - def hasResponders(): Boolean = { - responses.foreach(r => { - if (r.numResponders > 0) return true - }) - - return false - } - - def respondToQuestion(id: String, responder: Responder) { - responses.foreach(r => { - if (r.id == id) r.addResponder(responder) - }) - } - - def toQuestionVO(): QuestionVO = { - val rvos = new ArrayBuffer[ResponseVO] - responses.foreach(response => { - val r = new ResponseVO(response.id, response.response, response.getResponders) - rvos += r - }) - - new QuestionVO(id, multiResponse, question, rvos.toArray) - } -} - -class Response(val id: String, val response: String) { - - val responders = new ArrayBuffer[Responder]() - - def clear() { - responders.clear - } - def addResponder(responder: Responder) { - responders += responder - } - - def numResponders(): Int = { - responders.length; - } - - def getResponders(): Array[Responder] = { - var r = new Array[Responder](responders.length) - responders.copyToArray(r) - return r - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollApp.scala deleted file mode 100755 index f8ac30d339..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollApp.scala +++ /dev/null @@ -1,123 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.api._ -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.MeetingActor - -trait PollApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - private val pollModel = new PollModel - - def handleHidePollResult(msg: HidePollResult) { - val pollID = msg.pollID - - if (pollModel.hasPoll(pollID)) { - pollModel.hidePollResult(pollID) - outGW.send(new PollHideResultOutMsg(meetingID, recorded, pollID)) - } - } - - def handleShowPollResult(msg: ShowPollResult) { - val pollID = msg.pollID - - if (pollModel.hasPoll(pollID)) { - pollModel.showPollResult(pollID) - outGW.send(new PollShowResultOutMsg(meetingID, recorded, pollID)) - } - } - - def handleRespondToPoll(msg: RespondToPoll) { - val pollID = msg.response.pollID - - if (pollModel.hasPoll(pollID)) { - if (hasUser(msg.requesterID)) { - getUser(msg.requesterID) match { - case Some(user) => { - val responder = new Responder(user.userID, user.name) - msg.response.responses.foreach(question => { - question.responseIDs.foreach(response => { - pollModel.respondToQuestion(pollID, question.questionID, response, responder) - }) - }) - - pollModel.getPoll(msg.response.pollID) match { - case Some(poll) => outGW.send(new PollResponseOutMsg(meetingID, recorded, responder, msg.response)) - case None => // do nothing - } - } - case None => //do nothing - } - } - } - } - - def handleGetPolls(msg: GetPolls) { - var polls = pollModel.getPolls - outGW.send(new GetPollsReplyOutMsg(meetingID, recorded, msg.requesterID, polls)) - } - - def handleClearPoll(msg: ClearPoll) { - if (pollModel.clearPoll(msg.pollID)) { - outGW.send(new PollClearedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleClearPoll - " + msg.pollID + " not found") - } - } - - def handleStartPoll(msg: StartPoll) { - if (pollModel.hasPoll(msg.pollID)) { - pollModel.startPoll(msg.pollID) - outGW.send(new PollStartedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleStartPoll - " + msg.pollID + " not found") - } - } - - def handleStopPoll(msg: StopPoll) { - if (pollModel.hasPoll(msg.pollID)) { - pollModel.stopPoll(msg.pollID) - outGW.send(new PollStoppedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleStopPoll - " + msg.pollID + " not found") - } - } - - def handleSharePoll(msg: SharePoll) { - - } - - def handleRemovePoll(msg: RemovePoll) { - if (pollModel.hasPoll(msg.pollID)) { - pollModel.removePoll(msg.pollID) - outGW.send(new PollRemovedOutMsg(meetingID, recorded, msg.pollID)) - } else { - print("PollApp:: handleRemovePoll - " + msg.pollID + " not found") - } - } - - def handleDestroyPoll(msg: DestroyPoll) { - - } - - def handleUpdatePoll(msg: UpdatePoll) { - if (pollModel.updatePoll(msg.poll)) { - outGW.send(new PollUpdatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) - } else { - print("PollApp:: handleUpdatePoll - " + msg.poll.id + " not found") - } - } - - def handlePreCreatedPoll(msg: PreCreatedPoll) { - pollModel.createPoll(msg.poll) - outGW.send(new PollCreatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) - } - - def handleCreatePoll(msg: CreatePoll) { - pollModel.createPoll(msg.poll) - outGW.send(new PollCreatedOutMsg(meetingID, recorded, msg.poll.id, msg.poll)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollInGateway.scala deleted file mode 100755 index 47982f583c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollInGateway.scala +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class PollInGateway(bbbGW: BigBlueButtonGateway) { - - val msgConverter = new PollMessageConverter - - def getPolls(meetingID: String, requesterID: String) { - bbbGW.accept(new GetPolls(meetingID, requesterID)) - } - - def preCreatedPoll(meetingID: String, msg: String) { - val pvo = msgConverter.convertPreCreatedPollMessage(msg) - bbbGW.accept(new PreCreatedPoll(meetingID, pvo)) - } - - def createPoll(meetingID: String, requesterID: String, msg: String) { - val pvo = msgConverter.convertCreatePollMessage(msg) - bbbGW.accept(new CreatePoll(meetingID, requesterID, pvo)) - } - - def updatePoll(meetingID: String, requesterID: String, msg: String) { - val pvo = msgConverter.convertUpdatePollMessage(msg) - bbbGW.accept(new UpdatePoll(meetingID, requesterID, pvo)) - } - - def startPoll(meetingID: String, requesterID: String, msg: String) { - val pollID = msgConverter.convertStartPollMessage(msg) - bbbGW.accept(new StartPoll(meetingID, requesterID, pollID)) - } - - def stopPoll(meetingID: String, requesterID: String, msg: String) { - val pollID = msgConverter.convertStopPollMessage(msg) - bbbGW.accept(new StopPoll(meetingID, requesterID, pollID)) - } - - def removePoll(meetingID: String, requesterID: String, msg: String) { - val pollID = msgConverter.convertRemovePollMessage(msg) - bbbGW.accept(new RemovePoll(meetingID, requesterID, pollID)) - } - - def respondPoll(meetingID: String, requesterID: String, msg: String) { - val pollResponse = msgConverter.convertTakePollMessage(msg) - bbbGW.accept(new RespondToPoll(meetingID, requesterID, pollResponse)) - } - - def showPollResult(meetingID: String, requesterID: String, pollID: String) { - bbbGW.accept(new ShowPollResult(meetingID, requesterID, pollID)) - } - - def hidePollResult(meetingID: String, requesterID: String, pollID: String) { - bbbGW.accept(new HidePollResult(meetingID, requesterID, pollID)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollMessageConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollMessageConverter.scala deleted file mode 100755 index 54b5232efa..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollMessageConverter.scala +++ /dev/null @@ -1,190 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import com.google.gson.Gson -import com.google.gson.JsonParser -import org.bigbluebutton.core.util.RandomStringGenerator._ -import scala.collection.mutable.ArrayBuffer - -class PollMessageConverter { - - def convertPreCreatedPollMessage(msg: String): PollVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val title = gson.fromJson(obj.get("title"), classOf[String]); - - val question = gson.fromJson(obj.get("question"), classOf[String]); - val qType = gson.fromJson(obj.get("questionType"), classOf[String]) - - val cvoArray = ArrayBuffer[QuestionVO]() - - val responses = obj.get("answers").getAsJsonArray(); - - val rvoArray = ArrayBuffer[ResponseVO]() - - var j = 0 - val respIter = responses.iterator() - while (respIter.hasNext()) { - val response = gson.fromJson(respIter.next(), classOf[String]); - - rvoArray += new ResponseVO(j.toString, response) - - j += 1 - } - - val questionType = if (qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false - - cvoArray += new QuestionVO(0.toString, questionType, question, rvoArray.toArray) - - new PollVO(randomAlphanumericString(12), title, cvoArray.toArray) - - } - - def convertCreatePollMessage(msg: String): PollVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val title = gson.fromJson(obj.get("title"), classOf[String]); - - val questions = obj.get("questions").getAsJsonArray(); - val cvoArray = ArrayBuffer[QuestionVO]() - - val iter = questions.iterator() - var i = 0 - while (iter.hasNext()) { - val aquestion = iter.next().getAsJsonObject(); - val questionText = gson.fromJson(aquestion.get("question"), classOf[String]) - - val qType = gson.fromJson(aquestion.get("questionType"), classOf[String]) - - val responses = aquestion.get("responses").getAsJsonArray(); - - val rvoArray = ArrayBuffer[ResponseVO]() - - var j = 0 - val respIter = responses.iterator() - while (respIter.hasNext()) { - val response = gson.fromJson(respIter.next(), classOf[String]); - - rvoArray += new ResponseVO(j.toString, response) - - j += 1 - } - - val questionType = if (!qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false - - cvoArray += new QuestionVO(i.toString, questionType, questionText, rvoArray.toArray) - - i += 1 - } - - new PollVO(randomAlphanumericString(12), title, cvoArray.toArray) - - } - - def convertUpdatePollMessage(msg: String): PollVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val title = gson.fromJson(obj.get("title"), classOf[String]); - val pollID = gson.fromJson(obj.get("id"), classOf[String]); - - val questions = obj.get("questions").getAsJsonArray(); - - val cvoArray = ArrayBuffer[QuestionVO]() - - val iter = questions.iterator() - var i = 0 - while (iter.hasNext()) { - val aquestion = iter.next().getAsJsonObject(); - val questionText = gson.fromJson(aquestion.get("question"), classOf[String]) - - val responses = aquestion.get("responses").getAsJsonArray(); - - val rvoArray = ArrayBuffer[ResponseVO]() - - var j = 0 - val respIter = responses.iterator() - while (respIter.hasNext()) { - val response = respIter.next().getAsJsonObject() - - // Get the old response id - val oldRespID = gson.fromJson(response.get("id"), classOf[String]) - // if the old response id is empty, then this is a new answer, create a new id - val respID = if (oldRespID == "") j.toString() else oldRespID - val respText = gson.fromJson(response.get("response"), classOf[String]) - - rvoArray += new ResponseVO(respID, respText) - - j += 1 - } - - val qType = gson.fromJson(aquestion.get("questionType"), classOf[String]) - val qID = gson.fromJson(aquestion.get("id"), classOf[String]) - val questionType = if (qType.equalsIgnoreCase(QuestionType.MULTI_CHOICE.toString())) true else false - - cvoArray += new QuestionVO(qID, questionType, questionText, rvoArray.toArray) - - i += 1 - } - - new PollVO(pollID, title, cvoArray.toArray) - } - - def convertStartPollMessage(msg: String): String = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - - pollID - } - - def convertStopPollMessage(msg: String): String = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - - pollID - } - - def convertRemovePollMessage(msg: String): String = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - - pollID - } - - def convertTakePollMessage(msg: String): PollResponseVO = { - val gson = new Gson(); - val parser = new JsonParser(); - val obj = parser.parse(msg).getAsJsonObject(); - val pollID = gson.fromJson(obj.get("pollID"), classOf[String]); - val questions = obj.get("questions").getAsJsonArray(); - - val qVO = ArrayBuffer[QuestionResponsesVO](); - - val iter = questions.iterator() - while (iter.hasNext()) { - val aquestion = iter.next().getAsJsonObject(); - val questionID = gson.fromJson(aquestion.get("questionID"), classOf[String]) - - val responses = aquestion.get("responseIDs").getAsJsonArray(); - - val rvoArray = ArrayBuffer[String]() - - val respIter = responses.iterator() - while (respIter.hasNext()) { - val response = gson.fromJson(respIter.next(), classOf[String]); - rvoArray += response - } - - qVO += new QuestionResponsesVO(questionID, rvoArray.toArray) - } - - new PollResponseVO(pollID, qVO.toArray) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollModel.scala deleted file mode 100755 index 227b21ec2c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/PollModel.scala +++ /dev/null @@ -1,237 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -import scala.collection.mutable.ArrayBuffer -import scala.collection.mutable.HashMap - -class PollModel { - - private val polls = new HashMap[String, Poll]() - - /** - * * - * Uncomment to create sample polls for manual testing purposes - */ - //createSamplePoll - - def numPolls(): Int = { - polls.size - } - - def createPoll(pollVO: PollVO) { - val questions = new ArrayBuffer[Question] - pollVO.questions.foreach(qv => { - val responses = new ArrayBuffer[Response] - qv.responses.foreach(rv => { - val response = new Response(rv.id, rv.text) - responses += response - }) - questions += new Question(qv.id, qv.multiResponse, qv.question, responses.toArray) - }) - - val poll = new Poll(pollVO.id, pollVO.title, questions.toArray) - polls += poll.id -> poll - } - - def updatePoll(pollVO: PollVO): Boolean = { - var success = false - - polls.get(pollVO.id) match { - case Some(p) => { - val questions = new ArrayBuffer[Question] - pollVO.questions.foreach(qv => { - val responses = new ArrayBuffer[Response] - qv.responses.foreach(rv => { - val response = new Response(rv.id, rv.text) - responses += response - }) - questions += new Question(qv.id, qv.multiResponse, qv.question, responses.toArray) - }) - - val poll = new Poll(pollVO.id, pollVO.title, questions.toArray) - polls += poll.id -> poll - success = true - } - case None => success = false - } - - success - } - - def getPolls(): Array[PollVO] = { - val poll = new ArrayBuffer[PollVO] - polls.values.foreach(p => { - poll += p.toPollVO - }) - - poll.toArray - } - - def clearPoll(pollID: String): Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - p.clear - success = true - } - case None => success = false - } - - success - } - - def startPoll(pollID: String): Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - p.start - success = true - } - case None => success = false - } - - success - } - - def removePoll(pollID: String): Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - polls -= p.id - success = true - } - case None => success = false - } - - success - } - - def stopPoll(pollID: String): Boolean = { - var success = false - polls.get(pollID) match { - case Some(p) => { - p.stop - success = true - } - case None => success = false - } - - success - } - - def hasPoll(pollID: String): Boolean = { - var present = false - polls.get(pollID) match { - case Some(p) => { - present = true - } - case None => present = false - } - - present - } - - def getPoll(pollID: String): Option[PollVO] = { - var poll: Option[PollVO] = None - - polls.get(pollID) match { - case Some(p) => { - val questions = new ArrayBuffer[QuestionVO] - p.questions.foreach(q => { - val responses = new ArrayBuffer[ResponseVO] - q.responses.foreach(response => { - val r = new ResponseVO(response.id, response.response, response.getResponders) - responses += r - }) - - val quest = new QuestionVO(q.id, q.multiResponse, q.question, responses.toArray) - questions += quest - }) - poll = Some(new PollVO(p.id, p.title, questions.toArray)) - } - case None => poll = None - } - - poll - } - - def hidePollResult(pollID: String) { - polls.get(pollID) match { - case Some(p) => p.hideResult - case None => // do nothing - } - } - - def showPollResult(pollID: String) { - polls.get(pollID) match { - case Some(p) => p.showResult - case None => // do nothing - } - } - - def respondToQuestion(pollID: String, questionID: String, responseID: String, responder: Responder) { - polls.get(pollID) match { - case Some(p) => { - p.respondToQuestion(questionID, responseID, responder) - } - case None => - } - } - - /** - * ****************************************************** - * Some pre-created polls for testing and simulation so we don't have - * to manually generate polls when testing the UI. - */ - def createSamplePoll() { - addSamplePoll1() - addSamplePoll2() - addSamplePoll3() - } - - def addSamplePoll1() { - val r1 = new ResponseVO("0", "Visa") - val r2 = new ResponseVO("1", "MasterCard") - val r3 = new ResponseVO("2", "AmEx") - val r4 = new ResponseVO("3", "Diners Club") - - var q = new QuestionVO("q1", false, "What type of credit card do you prefer?", Array(r1, r2, r3, r4)) - val pvo = new PollVO("pollID-101", "Preferred Credit Card", Array(q)) - - createPoll(pvo) - - respondToQuestion("pollID-101", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-101", "q1", "0", new Responder("user2", "Asyong Aksaya")) - } - - def addSamplePoll2() { - val r1 = new ResponseVO("0", "Visa") - val r2 = new ResponseVO("1", "MasterCard") - val r3 = new ResponseVO("2", "AmEx") - val r4 = new ResponseVO("3", "Diners Club") - - var q = new QuestionVO("q1", true, "Which credit cards do you own?", Array(r1, r2, r3, r4)) - val pvo = new PollVO("pollID-102", "Owned Credit Cards", Array(q)) - - createPoll(pvo) - - respondToQuestion("pollID-102", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-102", "q1", "0", new Responder("user2", "Asyong Aksaya")) - } - - def addSamplePoll3() { - val r1 = new ResponseVO("0", "Dumaguete") - val r2 = new ResponseVO("1", "Cebu") - val r3 = new ResponseVO("2", "Zamboanga") - val r4 = new ResponseVO("3", "None of the above") - - var q = new QuestionVO("q1", true, "What is the capital of the Philippines?", Array(r1, r2, r3, r4)) - val pvo = new PollVO("pollID-103", "Philippine Capital", Array(q)) - - createPoll(pvo) - - respondToQuestion("pollID-103", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-103", "q1", "0", new Responder("user2", "Asyong")) - respondToQuestion("pollID-103", "q1", "2", new Responder("user3", "Pedro")) - respondToQuestion("pollID-103", "q1", "3", new Responder("user4", "Aksaya")) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/QuestionType.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/QuestionType.scala deleted file mode 100755 index 24748b6665..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/QuestionType.scala +++ /dev/null @@ -1,7 +0,0 @@ -package org.bigbluebutton.core.apps.poll - -object QuestionType extends Enumeration { - type QuestionType = Value - val MULTI_CHOICE = Value("MULTI_CHOICE") - val MULTI_REPONSE = Value("MULTI_REPONSE") -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisPublisher.scala deleted file mode 100755 index 47bb7173e6..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisPublisher.scala +++ /dev/null @@ -1,114 +0,0 @@ -package org.bigbluebutton.core.apps.poll.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import com.google.gson.Gson -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import java.util.ArrayList -import org.bigbluebutton.core.apps.poll.PollVO - -class PollEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetPollsReplyOutMsg => handleGetPollsReplyOutMsg(msg) - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case msg: PollResponseOutMsg => handlePollResponseOutMsg(msg) - case _ => // do nothing - } - } - - private def handlePollResponseOutMsg(msg: PollResponseOutMsg) { - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - - map.put("meetingID", msg.meetingID) - map.put("event", "PollResponseEvent") - map.put("responder", msg.responder) - map.put("response", msg.response) - - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) { - val gson = new Gson(); - val message = new java.util.HashMap[String, Object]() - - val collection = new ArrayList[PollVO](); - - msg.polls.foreach(p => { - collection.add(p) - }) - - message.put("msg", gson.toJson(collection)) - - // println("PollClientMessageSender - Handling GetPollsReplyOutMsg \n" + message.get("msg") + "\n") - - } - - private def handlePollClearedOutMsg(msg: PollClearedOutMsg) { - // println("PollClientMessageSender - Handling PollClearedOutMsg") - } - - private def handlePollStartedOutMsg(msg: PollStartedOutMsg) { - // println("PollClientMessageSender - Handling PollStartedOutMsg") - - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollStartedEvent") - map.put("pollID", msg.pollID) - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - - } - - private def handlePollStoppedOutMsg(msg: PollStoppedOutMsg) { - // println("PollClientMessageSender - Handling PollStoppedOutMsg") - - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollStoppedEvent") - map.put("pollID", msg.pollID) - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handlePollRemovedOutMsg(msg: PollRemovedOutMsg) { - // println("PollClientMessageSender - Handling PollRemovedOutMsg") - - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollRemovedEvent") - map.put("pollID", msg.pollID) - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg) { - // println("PollClientMessageSender - Handling PollUpdatedOutMsg") - val gson = new Gson(); - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollUpdatedEvent") - map.put("msg", gson.toJson(msg.pollVO)) - - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } - - private def handlePollCreatedOutMsg(msg: PollCreatedOutMsg) { - // println("PollClientMessageSender - Handling PollCreatedOutMsg") - val gson = new Gson(); - - val map = new java.util.HashMap[String, Object]() - map.put("meetingID", msg.meetingID) - map.put("event", "PollCreatedEvent") - map.put("msg", gson.toJson(msg.pollVO)) - - service.send(MessagingConstants.FROM_POLLING_CHANNEL, gson.toJson(map)); - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisRecorder.scala deleted file mode 100755 index 1bf9615191..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/poll/redis/PollEventRedisRecorder.scala +++ /dev/null @@ -1,114 +0,0 @@ -package org.bigbluebutton.core.apps.poll.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.recorder.polling.PollCreatedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollUpdatedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollRemovedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollStoppedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollStartedRecordEvent -import org.bigbluebutton.conference.service.recorder.polling.PollClearedRecordEvent - -class PollEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetPollsReplyOutMsg => // do nothing? - case msg: PollClearedOutMsg => handlePollClearedOutMsg(msg) - case msg: PollStartedOutMsg => handlePollStartedOutMsg(msg) - case msg: PollStoppedOutMsg => handlePollStoppedOutMsg(msg) - case msg: PollRemovedOutMsg => handlePollRemovedOutMsg(msg) - case msg: PollUpdatedOutMsg => handlePollUpdatedOutMsg(msg) - case msg: PollCreatedOutMsg => handlePollCreatedOutMsg(msg) - case _ => // do nothing - } - } - - def handlePollCreatedOutMsg(msg: PollCreatedOutMsg): Unit = { - if (msg.recorded) { - val ev = new PollCreatedRecordEvent(); - ev.setPollID(msg.pollVO.id) - ev.setTitle(msg.pollVO.title) - - for (q <- msg.pollVO.questions) { - ev.addQuestion(q.id, q.question, q.multiResponse) - for (resp <- q.responses) { - ev.addResponse(q.id, resp.id, resp.text) - - /*for( responder <- resp.responders ){ - ev.addResponder(q.id, resp.id, responder.id, ) - }*/ - } - } - - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - - } - - def handlePollUpdatedOutMsg(msg: PollUpdatedOutMsg): Unit = { - if (msg.recorded) { - val ev = new PollUpdatedRecordEvent(); - ev.setPollID(msg.pollVO.id) - ev.setTitle(msg.pollVO.title) - - for (q <- msg.pollVO.questions) { - ev.addQuestion(q.id, q.question, q.multiResponse) - for (resp <- q.responses) { - ev.addResponse(q.id, resp.id, resp.text) - - /*for( responder <- resp.responders ){ - ev.addResponder(q.id, resp.id, responder.id, ) - }*/ - } - } - - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollRemovedOutMsg(msg: PollRemovedOutMsg): Unit = { - if (msg.recorded) { - val ev = new PollRemovedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollStoppedOutMsg(msg: PollStoppedOutMsg): Unit = { - if (msg.recorded) { - val ev = new PollStoppedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollStartedOutMsg(msg: PollStartedOutMsg): Unit = { - if (msg.recorded) { - val ev = new PollStartedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(System.currentTimeMillis()) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - - def handlePollClearedOutMsg(msg: PollClearedOutMsg): Unit = { - if (msg.recorded) { - val ev = new PollClearedRecordEvent() - ev.setPollID(msg.pollID) - ev.setTimestamp(TimestampGenerator.generateTimestamp) - ev.setMeetingId(msg.meetingID) - recorder.record(msg.meetingID, ev) - } - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationApp.scala deleted file mode 100755 index d2179fa56b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationApp.scala +++ /dev/null @@ -1,154 +0,0 @@ -package org.bigbluebutton.core.apps.presentation - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.MeetingActor -import com.google.gson.Gson - -case class CurrentPresenter(userId: String, name: String, assignedBy: String) - -case class CurrentPresentationInfo(presenter: CurrentPresenter, - presentations: Seq[Presentation]) -case class CursorLocation(xPercent: Double = 0D, yPercent: Double = 0D) - -trait PresentationApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - private var cursorLocation = new CursorLocation - private val presModel = new PresentationModel - - def handlePreuploadedPresentations(msg: PreuploadedPresentations) { - val pres = msg.presentations - - msg.presentations.foreach(presentation => { - presModel.addPresentation(presentation) - - sharePresentation(presentation.id, true) - }) - } - - def handleInitializeMeeting(msg: InitializeMeeting) { - - } - - def handleClearPresentation(msg: ClearPresentation) { - outGW.send(new ClearPresentationOutMsg(meetingID, recorded)) - } - - def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { - outGW.send(new PresentationConversionProgress(meetingID, msg.messageKey, - msg.code, msg.presentationId, msg.presName)) - } - - def handlePresentationPageCountError(msg: PresentationPageCountError) { - outGW.send(new PresentationConversionError(meetingID, msg.messageKey, - msg.code, msg.presentationId, - msg.numberOfPages, - msg.maxNumberPages, msg.presName)) - } - - def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { - outGW.send(new PresentationPageGenerated(meetingID, msg.messageKey, - msg.code, msg.presentationId, - msg.numberOfPages, - msg.pagesCompleted, msg.presName)) - } - - def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { - - presModel.addPresentation(msg.presentation) - - outGW.send(new PresentationConversionDone(meetingID, recorded, msg.messageKey, - msg.code, msg.presentation)) - - sharePresentation(msg.presentation.id, true) - } - - def handleRemovePresentation(msg: RemovePresentation) { - val curPres = presModel.getCurrentPresentation - - val removedPresentation = presModel.remove(msg.presentationID) - - curPres foreach (cp => { - if (cp.id == msg.presentationID) { - sharePresentation(msg.presentationID, false); - } - }) - - outGW.send(new RemovePresentationOutMsg(msg.meetingID, recorded, msg.presentationID)) - - } - - def handleGetPresentationInfo(msg: GetPresentationInfo) { - // println("PresentationApp : handleGetPresentationInfo GetPresentationInfo for meeting [" + msg.meetingID + "] [" + msg.requesterID + "]" ) - - val curPresenter = getCurrentPresenter; - val presenter = new CurrentPresenter(curPresenter.presenterID, - curPresenter.presenterName, - curPresenter.assignedBy) - val presentations = presModel.getPresentations - val presentationInfo = new CurrentPresentationInfo(presenter, presentations) - outGW.send(new GetPresentationInfoOutMsg(meetingID, recorded, msg.requesterID, presentationInfo, msg.replyTo)) - } - - def handleSendCursorUpdate(msg: SendCursorUpdate) { - cursorLocation = new CursorLocation(msg.xPercent, msg.yPercent) - outGW.send(new SendCursorUpdateOutMsg(meetingID, recorded, msg.xPercent, msg.yPercent)) - } - - def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { - val page = presModel.resizePage(msg.xOffset, msg.yOffset, - msg.widthRatio, msg.heightRatio); - page foreach (p => outGW.send(new ResizeAndMoveSlideOutMsg(meetingID, recorded, p))) - } - - def handleGotoSlide(msg: GotoSlide) { - // println("Received GotoSlide for meeting=[" + msg.meetingID + "] page=[" + msg.page + "]") - // println("*** Before change page ****") - // printPresentations - presModel.changePage(msg.page) foreach { page => - // println("Switching page for meeting=[" + msg.meetingID + "] page=[" + page.id + "]") - outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) - } - // println("*** After change page ****") - // printPresentations - } - - def handleSharePresentation(msg: SharePresentation) { - sharePresentation(msg.presentationID, msg.share) - } - - def sharePresentation(presentationID: String, share: Boolean) { - val pres = presModel.sharePresentation(presentationID) - - pres foreach { p => - outGW.send(new SharePresentationOutMsg(meetingID, recorded, p)) - - presModel.getCurrentPage(p) foreach { page => - outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) - } - } - - } - - def handleGetSlideInfo(msg: GetSlideInfo) { - presModel.getCurrentPresentation foreach { pres => - presModel.getCurrentPage(pres) foreach { page => - outGW.send(new GetSlideInfoOutMsg(meetingID, recorded, msg.requesterID, page, msg.replyTo)) - } - } - - } - - def printPresentations() { - presModel.getPresentations foreach { pres => - println("presentation id=[" + pres.id + "] current=[" + pres.current + "]") - pres.pages.values foreach { page => - println("page id=[" + page.id + "] current=[" + page.current + "]") - } - } - - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationModel.scala deleted file mode 100755 index 44a327a92f..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/PresentationModel.scala +++ /dev/null @@ -1,127 +0,0 @@ -package org.bigbluebutton.core.apps.presentation - -case class Presentation(id: String, name: String, current: Boolean = false, - pages: scala.collection.immutable.HashMap[String, Page]) - -case class Page(id: String, num: Int, - thumbUri: String = "", - swfUri: String, - txtUri: String, - pngUri: String, - current: Boolean = false, - xOffset: Double = 0, yOffset: Double = 0, - widthRatio: Double = 100D, heightRatio: Double = 100D) - -class PresentationModel { - private var presentations = new scala.collection.immutable.HashMap[String, Presentation] - - def addPresentation(pres: Presentation) { - savePresentation(pres) - } - - def getPresentations(): Seq[Presentation] = { - presentations.values.toSeq - } - - def getCurrentPresentation(): Option[Presentation] = { - presentations.values find (p => p.current) - } - - def getCurrentPage(pres: Presentation): Option[Page] = { - pres.pages.values find (p => p.current) - } - - def remove(presId: String): Option[Presentation] = { - val pres = presentations.get(presId) - pres foreach (p => presentations -= p.id) - pres - } - - def sharePresentation(presId: String): Option[Presentation] = { - getCurrentPresentation foreach (curPres => { - if (curPres.id != presId) { - val newPres = curPres.copy(current = false) - savePresentation(newPres) - } - }) - - presentations.get(presId) match { - case Some(pres) => { - val cp = pres.copy(current = true) - savePresentation(cp) - Some(cp) - } - case None => None - } - } - - private def savePresentation(pres: Presentation) { - presentations += pres.id -> pres - } - - private def resizeCurrentPage(pres: Presentation, - xOffset: Double, yOffset: Double, - widthRatio: Double, - heightRatio: Double): Option[Page] = { - getCurrentPage(pres) match { - case Some(cp) => { - val page = cp.copy(xOffset = xOffset, yOffset = yOffset, - widthRatio = widthRatio, heightRatio = heightRatio) - val nPages = pres.pages + (page.id -> page) - val newPres = pres.copy(pages = nPages) - savePresentation(newPres) - Some(page) - } - case None => None - } - } - - def resizePage(xOffset: Double, yOffset: Double, - widthRatio: Double, heightRatio: Double): Option[Page] = { - for { - curPres <- getCurrentPresentation - page <- resizeCurrentPage(curPres, xOffset, yOffset, widthRatio, heightRatio) - } yield page - } - - private def deactivateCurrentPage(pres: Presentation) { - getCurrentPage(pres) foreach { cp => - val page = cp.copy(current = false) - val nPages = pres.pages + (page.id -> page) - val newPres = pres.copy(pages = nPages) - savePresentation(newPres) - // println("Making page[" + page.id + "] not current[" + page.current + "]") - // println("After deact page. presentation id=[" + newPres.id + "] current=[" + newPres.current + "]") - // newPres.pages.values foreach {page => - // println("page id=[" + page.id + "] current=[" + page.current + "]") - // } - } - } - - private def makePageCurrent(pres: Presentation, page: String): Option[Page] = { - pres.pages.values find (p => p.id == page) match { - case Some(newCurPage) => { - val page = newCurPage.copy(current = true) - val newPages = pres.pages + (page.id -> page) - val newPres = pres.copy(pages = newPages) - savePresentation(newPres) - // println("Making page[" + page.id + "] current[" + page.current + "]") - Some(page) - } - case None => { - // println("Could not find page[" + page + "] in presentation [" + pres.id + "]") - None - } - } - } - - def changePage(pageId: String): Option[Page] = { - getCurrentPresentation foreach { pres => deactivateCurrentPage(pres) } - - for { - pres <- getCurrentPresentation - page <- makePageCurrent(pres, pageId) - } yield page - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PesentationMessageToJsonConverter.scala deleted file mode 100755 index 2ab3d5794c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PesentationMessageToJsonConverter.scala +++ /dev/null @@ -1,281 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.core.apps.presentation.Page -import collection.JavaConverters._ -import scala.collection.JavaConversions._ - -object PesentationMessageToJsonConverter { - private def pageToMap(page: Page): java.util.Map[String, Any] = { - val res = new scala.collection.mutable.HashMap[String, Any] - res += "id" -> page.id - res += "num" -> page.num - res += "thumb_uri" -> page.thumbUri - res += "swf_uri" -> page.swfUri - res += "txt_uri" -> page.txtUri - res += "png_uri" -> page.pngUri - res += "current" -> page.current - res += "x_offset" -> page.xOffset - res += "y_offset" -> page.yOffset - res += "width_ratio" -> page.widthRatio - res += "height_ratio" -> page.heightRatio - - mapAsJavaMap(res) - } - - def clearPresentationOutMsgToJson(msg: ClearPresentationOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CLEARED, msg.version, None) - Util.buildJson(header, payload) - } - - def removePresentationOutMsgToJson(msg: RemovePresentationOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationID) - - val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) - Util.buildJson(header, payload) - } - - def getPresentationInfoOutMsgToJson(msg: GetPresentationInfoOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_INFO, msg.info) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val info = msg.info - - // Create a map for our current presenter - val presenter = new java.util.HashMap[String, String]() - presenter.put(Constants.USER_ID, info.presenter.userId) - presenter.put(Constants.NAME, info.presenter.name) - presenter.put(Constants.ASSIGNED_BY, info.presenter.assignedBy) - - payload.put(Constants.PRESENTER, presenter) - - // Create an array for our presentations - val presentations = new java.util.ArrayList[java.util.HashMap[String, Object]] - info.presentations.foreach { pres => - val presentation = new java.util.HashMap[String, Object]() - presentation.put(Constants.ID, pres.id) - presentation.put(Constants.NAME, pres.name) - presentation.put(Constants.CURRENT, pres.current: java.lang.Boolean) - - // Get the pages for a presentation - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - pres.pages.values foreach { p => - pages.add(pageToMap(p)) - } - // store the pages in the presentation - presentation.put(Constants.PAGES, pages) - - // add this presentation into our presentations list - presentations.add(presentation); - } - - // add the presentation to our map to complete our json - payload.put(Constants.PRESENTATIONS, presentations) - - val header = Util.buildHeader(MessageNames.GET_PRESENTATION_INFO_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendCursorUpdateOutMsgToJson(msg: SendCursorUpdateOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.X_PERCENT, msg.xPercent) - payload.put(Constants.Y_PERCENT, msg.yPercent) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CURSOR_UPDATED, msg.version, None) - Util.buildJson(header, payload) - } - - def resizeAndMoveSlideOutMsgToJson(msg: ResizeAndMoveSlideOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_RESIZED, msg.version, None) - Util.buildJson(header, payload) - } - - def gotoSlideOutMsgToJson(msg: GotoSlideOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def sharePresentationOutMsgToJson(msg: SharePresentationOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val presentation = new java.util.HashMap[String, Object](); - presentation.put(Constants.ID, msg.presentation.id) - presentation.put(Constants.NAME, msg.presentation.name) - presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) - - // Get the pages for a presentation - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.presentation.pages.values foreach { p => - pages.add(pageToMap(p)) - } - - // store the pages in the presentation - presentation.put(Constants.PAGES, pages) - - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.PRESENTATION_SHARED, msg.version, None) - Util.buildJson(header, payload) - } - - def getSlideInfoOutMsgToJson(msg: GetSlideInfoOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.GET_SLIDE_INFO_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def getPreuploadedPresentationsOutMsgToJson(msg: GetPreuploadedPresentationsOutMsg): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.GET_PREUPLOADED_PRESENTATIONS, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationConversionProgressToJson(msg: PresentationConversionProgress): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presentationName) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_PROGRESS, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationConversionErrorToJson(msg: PresentationConversionError): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presentationName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) - - val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_ERROR, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationPageGenerated(msg: PresentationPageGenerated): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - payload.put(Constants.PRESENTATION_NAME, msg.presentationName) - payload.put(Constants.NUM_PAGES, msg.numberOfPages) - payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_GENERATED, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationConversionDoneToJson(msg: PresentationConversionDone): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE_KEY, msg.messageKey) - payload.put(Constants.CODE, msg.code) - - val presentation = new java.util.HashMap[String, Object](); - presentation.put(Constants.ID, msg.presentation.id) - presentation.put(Constants.NAME, msg.presentation.name) - presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) - - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.presentation.pages.values foreach { p => - pages.add(pageToMap(p)) - } - - presentation.put(Constants.PAGES, pages) - - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_DONE, msg.version, None) - Util.buildJson(header, payload) - } - - def presentationChangedToJson(msg: PresentationChanged): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - val presentation = new java.util.HashMap[String, Object](); - presentation.put(Constants.ID, msg.presentation.id) - presentation.put(Constants.NAME, msg.presentation.name) - presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) - - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.presentation.pages.values foreach { p => - pages.add(pageToMap(p)) - } - - presentation.put(Constants.PAGES, pages) - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.PRESENTATION_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def getPresentationStatusReplyToJson(msg: GetPresentationStatusReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - val presentation = new java.util.HashMap[String, Object](); - - presentation.put(Constants.ID, msg.current.id) - presentation.put(Constants.NAME, msg.current.name) - presentation.put(Constants.CURRENT, msg.current.current: java.lang.Boolean) - - val pages = new java.util.ArrayList[java.util.Map[String, Any]]() - - msg.current.pages.values foreach { p => - pages.add(pageToMap(p)) - } - - presentation.put(Constants.PAGES, pages) - - payload.put(Constants.PRESENTATION, presentation); - - val header = Util.buildHeader(MessageNames.GET_PRESENTATION_STATUS_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def presentationRemovedToJson(msg: PresentationRemoved): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PRESENTATION_ID, msg.presentationId) - - val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) - Util.buildJson(header, payload) - } - - def pageChangedToJson(msg: PageChanged): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.PAGE, pageToMap(msg.page)) - - val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisPublisher.scala deleted file mode 100755 index 93979ff098..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisPublisher.scala +++ /dev/null @@ -1,111 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.redis - -import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants - -class PresentationEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) - case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) - case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) - case msg: PresentationConversionError => handlePresentationConversionError(msg) - case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) - case msg: PresentationConversionDone => handlePresentationConversionDone(msg) - case _ => // do nothing - } - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { - val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { - val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { - val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationConversionError(msg: PresentationConversionError) { - val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { - val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationChanged(msg: PresentationChanged) { - val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { - val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePresentationRemoved(msg: PresentationRemoved) { - val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } - - private def handlePageChanged(msg: PageChanged) { - val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) - service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisRecorder.scala deleted file mode 100644 index e74ae53ae2..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/presentation/redis/PresentationEventRedisRecorder.scala +++ /dev/null @@ -1,127 +0,0 @@ -package org.bigbluebutton.core.apps.presentation.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.core.api.IOutMessage -import org.bigbluebutton.conference.service.recorder.presentation.GenerateSlidePresentationRecordEvent -import org.bigbluebutton.conference.service.recorder.presentation.ConversionCompletedPresentationRecordEvent -import org.bigbluebutton.core.api.GotoSlideOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.GotoSlidePresentationRecordEvent -import org.bigbluebutton.core.api.ResizeAndMoveSlideOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.ResizeAndMoveSlidePresentationRecordEvent -import org.bigbluebutton.core.api.RemovePresentationOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.RemovePresentationPresentationRecordEvent -import org.bigbluebutton.core.api.SharePresentationOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.SharePresentationPresentationRecordEvent -import org.bigbluebutton.core.api.SendCursorUpdateOutMsg -import org.bigbluebutton.conference.service.recorder.presentation.CursorUpdateRecordEvent -import org.bigbluebutton.core.api.ClearPresentationOutMsg -import org.bigbluebutton.core.api.PresentationConversionDone -import org.bigbluebutton.core.api.TimestampGenerator - -class PresentationEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - private val GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; - private val CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) - case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) - case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) - case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) - case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) - case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) - case _ => // do nothing - } - } - - private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { - - } - - private def handlePresentationConversionDone(msg: PresentationConversionDone) { - if (msg.recorded) { - val event = new ConversionCompletedPresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setPresentationName(msg.presentation.id); - event.setOriginalFilename(msg.presentation.name); - recorder.record(msg.meetingID, event); - } - - } - - private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { - if (msg.recorded) { - val event = new GotoSlidePresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setSlide(msg.page.num); - event.setId(msg.page.id); - event.setNum(msg.page.num); - event.setThumbUri(msg.page.thumbUri); - event.setSwfUri(msg.page.swfUri); - event.setTxtUri(msg.page.txtUri); - event.setPngUri(msg.page.pngUri); - event.setXOffset(msg.page.xOffset); - event.setYOffset(msg.page.yOffset); - event.setWidthRatio(msg.page.widthRatio); - event.setHeightRatio(msg.page.heightRatio); - recorder.record(msg.meetingID, event); - } - } - - private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { - if (msg.recorded) { - val event = new ResizeAndMoveSlidePresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setId(msg.page.id); - event.setNum(msg.page.num); - event.setThumbUri(msg.page.thumbUri); - event.setSwfUri(msg.page.swfUri); - event.setTxtUri(msg.page.txtUri); - event.setPngUri(msg.page.pngUri); - event.setXOffset(msg.page.xOffset); - event.setYOffset(msg.page.yOffset); - event.setWidthRatio(msg.page.widthRatio); - event.setHeightRatio(msg.page.heightRatio); - - recorder.record(msg.meetingID, event); - } - } - - private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { - if (msg.recorded) { - val event = new RemovePresentationPresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setPresentationName(msg.presentationID); - recorder.record(msg.meetingID, event); - } - } - - private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { - if (msg.recorded) { - val event = new SharePresentationPresentationRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setPresentationName(msg.presentation.id); - event.setOriginalFilename(msg.presentation.name); - event.setShare(true); - recorder.record(msg.meetingID, event); - } - } - - private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { - if (msg.recorded) { - val event = new CursorUpdateRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setXPercent(msg.xPercent); - event.setYPercent(msg.yPercent); - - recorder.record(msg.meetingID, event); - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/Users.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/Users.scala deleted file mode 100755 index 3c54a75328..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/Users.scala +++ /dev/null @@ -1,133 +0,0 @@ -package org.bigbluebutton.core.apps.users - -import org.bigbluebutton.core.models.{ UserV, Voice } -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.api.Role._ - -class Users { - - private val users = collection.mutable.HashMap[String, UserV]() - - /** - * Add a new user. - */ - def add(user: UserV) = users += user.id -> user - - /** - * Returns the number of users. - */ - def count = users.size - - /** - * Removes a user. - */ - def remove(id: String) = users -= id - - /** - * Gets a user. - */ - def get(id: String): Option[UserV] = users.values.find(u => u.id == id) - - /** - * Get all users. - */ - def all(): Array[UserV] = users.values.toArray - - def getPresenter(): Option[UserV] = users.values.find(u => u.status.isPresenter) - - def makeEveryoneNotPresenter(): Unit = { - users.values map (u => { - val p = u.copy(status = u.status.copy(isPresenter = false)) - users += p.id -> p - }) - } - - def makePresenter(id: String): Option[UserV] = { - var newPresenter: Option[UserV] = None - get(id) match { - case Some(u) => { - val p = u.copy(status = u.status.copy(isPresenter = true)) - newPresenter = Some(p) - users += p.id -> p - } - case None => - } - newPresenter - } - - def moderatorCount: Int = users.values.filter(u => u.role == MODERATOR).size - - def getVoiceUser(id: String): Option[UserV] = users.values.find(u => u.voice.id == id) - - def mute(id: String): Option[UserV] = { - var user: Option[UserV] = None - getVoiceUser(id) match { - case Some(u) => { - val mutedUser = u.copy(voice = u.voice.copy(muted = true)) - users += mutedUser.id -> mutedUser - user = Some(mutedUser) - } - case None => - } - - user - } - - def unmute(id: String): Option[UserV] = { - var user: Option[UserV] = None - getVoiceUser(id) match { - case Some(u) => { - val unmutedUser = u.copy(voice = u.voice.copy(muted = false)) - users += unmutedUser.id -> unmutedUser - user = Some(unmutedUser) - } - case None => - } - - user - } - - def lockVoice(id: String, lock: Boolean): Option[UserV] = { - var user: Option[UserV] = None - get(id) match { - case Some(u) => { - val lockedUser = u.copy(voice = u.voice.copy(locked = lock)) - users += lockedUser.id -> lockedUser - user = Some(lockedUser) - } - case None => - } - - user - } - - def joinedVoice(id: String, voice: Voice): Option[UserV] = { - var user: Option[UserV] = None - get(id) match { - case Some(u) => { - val voiceUser = u.copy(voice = voice) - users += voiceUser.id -> voiceUser - user = Some(voiceUser) - } - case None => - } - - user - } - - def leftVoice(id: String): Option[UserV] = { - var user: Option[UserV] = None - getVoiceUser(id) match { - case Some(u) => { - val voiceUser = u.copy(voice = Voice()) - users += voiceUser.id -> voiceUser - user = Some(voiceUser) - } - case None => - } - - user - } - - def unlockedUsers(): Array[UserV] = users.values filter (u => !u.voice.locked) toArray -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersApp.scala deleted file mode 100755 index 59f7e84293..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersApp.scala +++ /dev/null @@ -1,447 +0,0 @@ -package org.bigbluebutton.core.apps.users - -import org.bigbluebutton.core.api._ -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.User -import java.util.ArrayList -import org.bigbluebutton.core.MeetingActor -import scala.collection.mutable.ArrayBuffer -import scala.collection.immutable.ListSet - -trait UsersApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - val users = new UsersModel - private var regUsers = new collection.immutable.HashMap[String, RegisteredUser] - - private var locked = false - private var meetingMuted = false - - private var currentPresenter = new Presenter("system", "system", "system") - - def hasUser(userID: String): Boolean = { - users.hasUser(userID) - } - - def getUser(userID: String): Option[UserVO] = { - users.getUser(userID) - } - - def getCurrentPresenter: Presenter = { - currentPresenter - } - - def handleUserConnectedToGlobalAudio(msg: UserConnectedToGlobalAudio) { - val user = users.getUserWithExternalId(msg.userid) - user foreach { u => - val vu = u.voiceUser.copy(talking = false) - val uvo = u.copy(listenOnly = true, voiceUser = vu) - users.addUser(uvo) - log.info("UserConnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") - outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) - } - } - - def handleUserDisconnectedFromGlobalAudio(msg: UserDisconnectedFromGlobalAudio) { - val user = users.getUserWithExternalId(msg.userid) - user foreach { u => - val uvo = u.copy(listenOnly = false) - users.addUser(uvo) - log.info("UserDisconnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") - outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) - } - } - - def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { - meetingMuted = msg.mute - outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) - - usersWhoAreNotPresenter foreach { u => - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) - } - } - - def handleMuteMeetingRequest(msg: MuteMeetingRequest) { - meetingMuted = msg.mute - outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) - users.getUsers foreach { u => - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) - } - } - - def handleValidateAuthToken(msg: ValidateAuthToken) { - // println("*************** Got ValidateAuthToken message ********************" ) - regUsers.get(msg.token) match { - case Some(u) => - { - val replyTo = meetingID + '/' + msg.userId - - //send the reply - outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, true, msg.correlationId, msg.sessionId)) - - //join the user - handleUserJoin(new UserJoining(meetingID, msg.userId, msg.token)) - - //send the presentation - log.info("ValidateToken success: mid=[" + meetingID + "] uid=[" + msg.userId + "]") - } - case None => { - log.info("ValidateToken failed: mid=[" + meetingID + "] uid=[" + msg.userId + "]") - outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId)) - } - } - - /** - * Send a reply to BigBlueButtonActor to let it know this MeetingActor hasn't hung! - * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple - * audit to check whether the actor is still alive. (ralam feb 25, 2015) - */ - sender ! new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId) - } - - def handleRegisterUser(msg: RegisterUser) { - if (hasMeetingEnded) { - // Check first if the meeting has ended and the user refreshed the client to re-connect. - log.info("Register user failed: reason=[meeting has ended] mid=[" + meetingID + "] uid=[" + msg.userID + "]") - sendMeetingHasEnded(msg.userID) - } else { - val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken) - regUsers += msg.authToken -> regUser - log.info("Register user success: mid=[" + meetingID + "] uid=[" + msg.userID + "]") - outGW.send(new UserRegistered(meetingID, recorded, regUser)) - } - - } - - def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { - outGW.send(new IsMeetingMutedReply(meetingID, recorded, msg.requesterID, meetingMuted)) - } - - def handleMuteUserRequest(msg: MuteUserRequest) { - // println("Received mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") - users.getUser(msg.userID) match { - case Some(u) => { - // println("Sending mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") - log.info("Muting user: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) - } - case None => { - log.info("Could not find user to mute: mid=[" + meetingID + "] uid=[" + msg.userID + "]") - // println("Could not find user to mute. uid=[" + msg.userID + "] mute=[" + msg.mute + "]") - } - } - } - - def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { - // println("Received eject user request uid=[" + msg.userID + "]") - users.getUser(msg.userId) match { - case Some(u) => { - if (u.voiceUser.joined) { - log.info("Ejecting user from voice: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, u.userID)) - } - } - case None => // do nothing - } - } - - def handleGetLockSettings(msg: GetLockSettings) { - //println("*************** Reply with current lock settings ********************") - - //reusing the existing handle for NewPermissionsSettings to reply to the GetLockSettings request - outGW.send(new NewPermissionsSetting(meetingID, msg.userId, permissions, users.getUsers)) - } - - def handleSetLockSettings(msg: SetLockSettings) { - // println("*************** Received new lock settings ********************") - if (!permissionsEqual(msg.settings)) { - newPermissions(msg.settings) - outGW.send(new NewPermissionsSetting(meetingID, msg.setByUser, permissions, users.getUsers)) - - handleLockLayout(msg.settings.lockedLayout, msg.setByUser) - } - } - - def handleLockUserRequest(msg: LockUserRequest) { - users.getUser(msg.userID) match { - case Some(u) => { - val uvo = u.copy(locked = msg.lock) - users.addUser(uvo) - - log.info("Lock user: mid=[" + meetingID + "] uid=[" + u.userID + "] lock=[" + msg.lock + "]") - outGW.send(new UserLocked(meetingID, u.userID, msg.lock)) - } - case None => { - log.info("Could not find user to lock: mid=[" + meetingID + "] uid=[" + msg.userID + "] lock=[" + msg.lock + "]") - } - } - } - - def handleInitLockSettings(msg: InitLockSettings) { - if (!permissionsInited) { - permissionsInited = true - newPermissions(msg.settings) - outGW.send(new PermissionsSettingInitialized(msg.meetingID, msg.settings, users.getUsers)) - } - } - - def handleInitAudioSettings(msg: InitAudioSettings) { - if (!audioSettingsInited) { - audioSettingsInited = true - if (meetingMuted != msg.muted) { - handleMuteAllExceptPresenterRequest(new MuteAllExceptPresenterRequest(meetingID, msg.requesterID, msg.muted)); - } - } - } - - def usersWhoAreNotPresenter(): Array[UserVO] = { - val au = ArrayBuffer[UserVO]() - - users.getUsers foreach { u => - if (!u.presenter) { - au += u - } - } - au.toArray - } - - def handleUserRaiseHand(msg: UserRaiseHand) { - users.getUser(msg.userId) foreach { user => - val uvo = user.copy(raiseHand = true) - users.addUser(uvo) - outGW.send(new UserRaisedHand(meetingID, recorded, uvo.userID)) - } - } - - def handleUserLowerHand(msg: UserLowerHand) { - users.getUser(msg.userId) foreach { user => - val uvo = user.copy(raiseHand = false) - users.addUser(uvo) - outGW.send(new UserLoweredHand(meetingID, recorded, uvo.userID, msg.loweredBy)) - } - } - - def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) { - users.getUser(msg.userId) foreach { user => - if (user.voiceUser.joined) { - outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, msg.userId)) - } - - users.removeUser(msg.userId) - - log.info("Ejecting user from meeting: mid=[" + meetingID + "]uid=[" + msg.userId + "]") - outGW.send(new UserEjectedFromMeeting(meetingID, recorded, msg.userId, msg.ejectedBy)) - outGW.send(new DisconnectUser(meetingID, msg.userId)) - - outGW.send(new UserLeft(msg.meetingID, recorded, user)) - } - } - - def handleUserShareWebcam(msg: UserShareWebcam) { - users.getUser(msg.userId) foreach { user => - val streams = user.webcamStreams + msg.stream - val uvo = user.copy(hasStream = true, webcamStreams = streams) - users.addUser(uvo) - log.info("User shared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] sharedStream=[" + msg.stream + "] streams=[" + streams + "]") - outGW.send(new UserSharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) - } - } - - def handleUserunshareWebcam(msg: UserUnshareWebcam) { - users.getUser(msg.userId) foreach { user => - val streams = user.webcamStreams - msg.stream - val uvo = user.copy(hasStream = (!streams.isEmpty), webcamStreams = streams) - users.addUser(uvo) - log.info("User unshared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] unsharedStream=[" + msg.stream + "] streams=[" + streams + "]") - outGW.send(new UserUnsharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) - } - } - - def handleChangeUserStatus(msg: ChangeUserStatus): Unit = { - if (users.hasUser(msg.userID)) { - outGW.send(new UserStatusChange(meetingID, recorded, msg.userID, msg.status, msg.value)) - } - } - - def handleGetUsers(msg: GetUsers): Unit = { - outGW.send(new GetUsersReply(msg.meetingID, msg.requesterID, users.getUsers)) - } - - def handleUserJoin(msg: UserJoining): Unit = { - val regUser = regUsers.get(msg.authToken) - regUser foreach { ru => - val vu = new VoiceUser(msg.userID, msg.userID, ru.name, ru.name, - false, false, false, false) - val uvo = new UserVO(msg.userID, ru.externId, ru.name, - ru.role, raiseHand = false, presenter = false, - hasStream = false, locked = getInitialLockStatus(ru.role), - webcamStreams = new ListSet[String](), phoneUser = false, vu, listenOnly = false) - - users.addUser(uvo) - - log.info("User joined meeting: mid=[" + meetingID + "] uid=[" + uvo.userID + "] role=[" + uvo.role + "] locked=[" + uvo.locked + "] permissions.lockOnJoin=[" + permissions.lockOnJoin + "] permissions.lockOnJoinConfigurable=[" + permissions.lockOnJoinConfigurable + "]") - outGW.send(new UserJoined(meetingID, recorded, uvo)) - - outGW.send(new MeetingState(meetingID, recorded, uvo.userID, permissions, meetingMuted)) - - // Become presenter if the only moderator - if (users.numModerators == 1) { - if (ru.role == Role.MODERATOR) { - assignNewPresenter(msg.userID, ru.name, msg.userID) - } - } - webUserJoined - startRecordingIfAutoStart() - } - } - - def handleUserLeft(msg: UserLeaving): Unit = { - if (users.hasUser(msg.userID)) { - val user = users.removeUser(msg.userID) - user foreach { u => - log.info("User left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new UserLeft(msg.meetingID, recorded, u)) - - if (u.presenter) { - /* The current presenter has left the meeting. Find a moderator and make - * him presenter. This way, if there is a moderator in the meeting, there - * will always be a presenter. - */ - val moderator = users.findAModerator() - moderator.foreach { mod => - log.info("Presenter left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]. Making user=[" + mod.userID + "] presenter.") - assignNewPresenter(mod.userID, mod.name, mod.userID) - } - } - } - - startCheckingIfWeNeedToEndVoiceConf() - stopAutoStartedRecording() - } - } - - def getInitialLockStatus(role: Role.Role): Boolean = { - permissions.lockOnJoin && !role.equals(Role.MODERATOR) - } - - def handleUserJoinedVoiceFromPhone(msg: VoiceUserJoined) = { - val user = users.getUserWithVoiceUserId(msg.voiceUser.userId) match { - case Some(user) => { - log.info("Voice user=[" + msg.voiceUser.userId + "] is already in conf=[" + voiceBridge + "]. Must be duplicate message.") - } - case None => { - // No current web user. This means that the user called in through - // the phone. We need to generate a new user as we are not able - // to match with a web user. - val webUserId = users.generateWebUserId - val vu = new VoiceUser(msg.voiceUser.userId, webUserId, - msg.voiceUser.callerName, msg.voiceUser.callerNum, - true, false, false, false) - - val sessionId = "PHONE-" + webUserId; - - val uvo = new UserVO(webUserId, webUserId, msg.voiceUser.callerName, - Role.VIEWER, raiseHand = false, presenter = false, - hasStream = false, locked = getInitialLockStatus(Role.VIEWER), webcamStreams = new ListSet[String](), - phoneUser = true, vu, listenOnly = false) - - users.addUser(uvo) - log.info("New user joined voice for user [" + uvo.name + "] userid=[" + msg.voiceUser.webUserId + "]") - outGW.send(new UserJoined(meetingID, recorded, uvo, sessionId)) - - outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, uvo)) - if (meetingMuted) - outGW.send(new MuteVoiceUser(meetingID, recorded, uvo.userID, uvo.userID, meetingMuted)) - - } - } - } - - def handleVoiceUserJoined(msg: VoiceUserJoined) = { - val user = users.getUser(msg.voiceUser.webUserId) match { - case Some(user) => { - val nu = user.copy(voiceUser = msg.voiceUser) - users.addUser(nu) - log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.voiceUser.webUserId + "]") - outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) - - if (meetingMuted) - outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, meetingMuted)) - } - case None => { - handleUserJoinedVoiceFromPhone(msg) - } - } - } - - def handleVoiceUserLeft(msg: VoiceUserLeft) { - users.getUser(msg.userId) foreach { user => - val vu = new VoiceUser(user.userID, user.userID, user.name, user.name, - false, false, false, false) - val nu = user.copy(voiceUser = vu) - users.addUser(nu) - - // println("Received voice user left =[" + user.name + "] wid=[" + msg.userId + "]" ) - log.info("Received user left voice for user [" + nu.name + "] userid=[" + msg.userId + "]") - outGW.send(new UserLeftVoice(meetingID, recorded, voiceBridge, nu)) - - if (user.phoneUser) { - if (users.hasUser(user.userID)) { - val userLeaving = users.removeUser(user.userID) - userLeaving foreach (u => outGW.send(new UserLeft(msg.meetingID, recorded, u))) - } - } - } - } - - def handleVoiceUserMuted(msg: VoiceUserMuted) { - users.getUser(msg.userId) foreach { user => - val talking: Boolean = if (msg.muted) false else user.voiceUser.talking - val nv = user.voiceUser.copy(muted = msg.muted, talking = talking) - val nu = user.copy(voiceUser = nv) - users.addUser(nu) - // println("Received voice muted=[" + msg.muted + "] wid=[" + msg.userId + "]" ) - outGW.send(new UserVoiceMuted(meetingID, recorded, voiceBridge, nu)) - } - } - - def handleVoiceUserTalking(msg: VoiceUserTalking) { - users.getUser(msg.userId) foreach { user => - val nv = user.voiceUser.copy(talking = msg.talking) - val nu = user.copy(voiceUser = nv) - users.addUser(nu) - // println("Received voice talking=[" + msg.talking + "] wid=[" + msg.userId + "]" ) - outGW.send(new UserVoiceTalking(meetingID, recorded, voiceBridge, nu)) - } - } - - def handleAssignPresenter(msg: AssignPresenter): Unit = { - assignNewPresenter(msg.newPresenterID, msg.newPresenterName, msg.assignedBy) - } - - def assignNewPresenter(newPresenterID: String, newPresenterName: String, assignedBy: String) { - if (users.hasUser(newPresenterID)) { - - users.getCurrentPresenter match { - case Some(curPres) => { - users.unbecomePresenter(curPres.userID) - outGW.send(new UserStatusChange(meetingID, recorded, curPres.userID, "presenter", false: java.lang.Boolean)) - } - case None => // do nothing - } - - users.getUser(newPresenterID) match { - case Some(newPres) => { - users.becomePresenter(newPres.userID) - currentPresenter = new Presenter(newPresenterID, newPresenterName, assignedBy) - outGW.send(new PresenterAssigned(meetingID, recorded, new Presenter(newPresenterID, newPresenterName, assignedBy))) - outGW.send(new UserStatusChange(meetingID, recorded, newPresenterID, "presenter", true: java.lang.Boolean)) - } - case None => // do nothing - } - - } - } -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersModel.scala deleted file mode 100755 index b462192d8c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/UsersModel.scala +++ /dev/null @@ -1,101 +0,0 @@ -package org.bigbluebutton.core.apps.users - -import org.bigbluebutton.core.User -import scala.collection.mutable.HashMap -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.api.Role._ -import scala.collection.mutable.ArrayBuffer -import org.bigbluebutton.core.api.VoiceUser -import org.bigbluebutton.core.util.RandomStringGenerator - -class UsersModel { - private var uservos = new collection.immutable.HashMap[String, UserVO] - - def generateWebUserId: String = { - val webUserId = RandomStringGenerator.randomAlphanumericString(6) - if (!hasUser(webUserId)) webUserId else generateWebUserId - } - - def addUser(uvo: UserVO) { - uservos += uvo.userID -> uvo - } - - def removeUser(userId: String): Option[UserVO] = { - val user = uservos get (userId) - user foreach (u => uservos -= userId) - - user - } - - def hasSessionId(sessionId: String): Boolean = { - uservos.contains(sessionId) - } - - def hasUser(userID: String): Boolean = { - uservos.contains(userID) - } - - def numUsers(): Int = { - uservos.size - } - - def numWebUsers(): Int = { - uservos.values filter (u => u.phoneUser == false) size - } - - def getUserWithExternalId(userID: String): Option[UserVO] = { - uservos.values find (u => u.externUserID == userID) - } - - def getUserWithVoiceUserId(voiceUserId: String): Option[UserVO] = { - uservos.values find (u => u.voiceUser.userId == voiceUserId) - } - - def getUser(userID: String): Option[UserVO] = { - uservos.values find (u => u.userID == userID) - } - - def getUsers(): Array[UserVO] = { - uservos.values toArray - } - - def numModerators(): Int = { - getModerators.length - } - - def findAModerator(): Option[UserVO] = { - uservos.values find (u => u.role == MODERATOR) - } - - def getCurrentPresenter(): Option[UserVO] = { - uservos.values find (u => u.presenter == true) - } - - def unbecomePresenter(userID: String) = { - uservos.get(userID) match { - case Some(u) => { - val nu = u.copy(presenter = false) - uservos += nu.userID -> nu - } - case None => // do nothing - } - } - - def becomePresenter(userID: String) = { - uservos.get(userID) match { - case Some(u) => { - val nu = u.copy(presenter = true) - uservos += nu.userID -> nu - } - case None => // do nothing - } - } - - def getModerators(): Array[UserVO] = { - uservos.values filter (u => u.role == MODERATOR) toArray - } - - def getViewers(): Array[UserVO] = { - uservos.values filter (u => u.role == VIEWER) toArray - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisPublisher.scala deleted file mode 100755 index ab693a8848..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisPublisher.scala +++ /dev/null @@ -1,188 +0,0 @@ -package org.bigbluebutton.core.apps.users.redis - -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import com.google.gson.Gson - -class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - - case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) - case msg: DisconnectUser => handleDisconnectUser(msg) - case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) - case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) - case msg: UserLocked => handleUserLocked(msg) - case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) - case msg: UserRegistered => handleUserRegistered(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: PresenterAssigned => handlePresenterAssigned(msg) - case msg: EndAndKickAll => handleEndAndKickAll(msg) - case msg: GetUsersReply => handleGetUsersReply(msg) - case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) - case msg: UserListeningOnly => handleUserListeningOnly(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { - val json = UsersMessageToJsonConverter.disconnectAllUsersToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleDisconnectUser(msg: DisconnectUser) { - val json = UsersMessageToJsonConverter.disconnectUserToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { - val json = UsersMessageToJsonConverter.permissionsSettingInitializedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { - val json = UsersMessageToJsonConverter.newPermissionsSettingToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleUserLocked(msg: UserLocked) { - val json = UsersMessageToJsonConverter.userLockedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { - val json = UsersMessageToJsonConverter.getPermissionsSettingReplyToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleUserRegistered(msg: UserRegistered) { - val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleUserStatusChange(msg: UserStatusChange) { - val json = UsersMessageToJsonConverter.userStatusChangeToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserRaisedHand(msg: UserRaisedHand) { - val json = UsersMessageToJsonConverter.userRaisedHandToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserLoweredHand(msg: UserLoweredHand) { - val json = UsersMessageToJsonConverter.userLoweredHandToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserSharedWebcam(msg: UserSharedWebcam) { - val json = UsersMessageToJsonConverter.userSharedWebcamToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { - val json = UsersMessageToJsonConverter.userUnsharedWebcamToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleGetUsersReply(msg: GetUsersReply) { - val json = UsersMessageToJsonConverter.getUsersReplyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val json = UsersMessageToJsonConverter.userJoinedVoice(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserVoiceMuted(msg: UserVoiceMuted) { - val json = UsersMessageToJsonConverter.userVoiceMuted(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserVoiceTalking(msg: UserVoiceTalking) { - val json = UsersMessageToJsonConverter.userVoiceTalking(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val json = UsersMessageToJsonConverter.muteVoiceUserToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val json = UsersMessageToJsonConverter.ejectVoiceUserToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val json = UsersMessageToJsonConverter.userLeftVoiceToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { - val json = UsersMessageToJsonConverter.isMeetingMutedReplyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val json = UsersMessageToJsonConverter.recordingStatusChangedToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val json = UsersMessageToJsonConverter.getRecordingStatusReplyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { - val json = UsersMessageToJsonConverter.validateAuthTokenReplyToJson(msg) - // println("************** Publishing [" + json + "] *******************") - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserJoined(msg: UserJoined) { - val json = UsersMessageToJsonConverter.userJoinedToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleRegisteredUser(msg: UserRegistered) { - val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserLeft(msg: UserLeft) { - val json = UsersMessageToJsonConverter.userLeftToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handlePresenterAssigned(msg: PresenterAssigned) { - val json = UsersMessageToJsonConverter.presenterAssignedToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleEndAndKickAll(msg: EndAndKickAll) { - val json = UsersMessageToJsonConverter.endAndKickAllToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } - - private def handleUserListeningOnly(msg: UserListeningOnly) { - val json = UsersMessageToJsonConverter.userListeningOnlyToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisRecorder.scala deleted file mode 100755 index 713a505691..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersEventRedisRecorder.scala +++ /dev/null @@ -1,214 +0,0 @@ -package org.bigbluebutton.core.apps.users.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.recorder.participants.ParticipantEndAndKickAllRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.AssignPresenterRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.ParticipantStatusChangeRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.ParticipantLeftRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.ParticipantJoinRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantMutedVoiceRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantTalkingVoiceRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantJoinedVoiceRecordEvent -import org.bigbluebutton.webconference.voice.ParticipantLeftVoiceRecordEvent -import org.bigbluebutton.conference.service.recorder.participants.RecordStatusRecordEvent -import org.bigbluebutton.webconference.voice.StartRecordingVoiceRecordEvent - -class UsersEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: EndAndKickAll => handleEndAndKickAll(msg) - case msg: PresenterAssigned => handleAssignPresenter(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: UserStatusChange => handleUserStatusChange(msg) - case msg: UserVoiceMuted => handleUserVoiceMuted(msg) - case msg: UserVoiceTalking => handleUserVoiceTalking(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: UserRaisedHand => handleUserRaisedHand(msg) - case msg: UserLoweredHand => handleUserLoweredHand(msg) - case msg: UserSharedWebcam => handleUserSharedWebcam(msg) - case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) - case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) - case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def handleEndAndKickAll(msg: EndAndKickAll): Unit = { - if (msg.recorded) { - val ev = new ParticipantEndAndKickAllRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setMeetingId(msg.meetingID); - recorder.record(msg.meetingID, ev); - } - } - - private def handleUserJoined(msg: UserJoined): Unit = { - if (msg.recorded) { - val ev = new ParticipantJoinRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setUserId(msg.user.userID); - ev.setName(msg.user.name); - ev.setMeetingId(msg.meetingID); - ev.setRole(msg.user.role.toString()); - - recorder.record(msg.meetingID, ev); - } - } - - def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { - if (msg.recorded) { - val evt = new StartRecordingVoiceRecordEvent(true); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setRecordingTimestamp(msg.timestamp); - evt.setFilename(msg.recordingFile); - recorder.record(msg.meetingID, evt); - } - } - - def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { - if (msg.recorded) { - val evt = new StartRecordingVoiceRecordEvent(false); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setRecordingTimestamp(msg.timestamp); - evt.setFilename(msg.recordingFile); - recorder.record(msg.meetingID, evt); - } - } - - def handleUserVoiceMuted(msg: UserVoiceMuted) { - if (msg.recorded) { - val ev = new ParticipantMutedVoiceRecordEvent() - ev.setMeetingId(msg.meetingID); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setBridge(msg.confNum); - ev.setParticipant(msg.user.voiceUser.userId); - ev.setMuted(msg.user.voiceUser.muted); - - recorder.record(msg.meetingID, ev); - } - } - - def handleUserVoiceTalking(msg: UserVoiceTalking) { - if (msg.recorded) { - val evt = new ParticipantTalkingVoiceRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setParticipant(msg.user.userID); - evt.setTalking(msg.user.voiceUser.talking); - - recorder.record(msg.meetingID, evt); - } - } - - def handleUserJoinedVoice(msg: UserJoinedVoice) { - if (msg.recorded) { - val evt = new ParticipantJoinedVoiceRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setParticipant(msg.user.voiceUser.userId); - evt.setCallerName(msg.user.voiceUser.callerName); - evt.setCallerNumber(msg.user.voiceUser.callerNum); - evt.setMuted(msg.user.voiceUser.muted); - evt.setTalking(msg.user.voiceUser.talking); - - recorder.record(msg.meetingID, evt) - } - } - - def handleUserLeftVoice(msg: UserLeftVoice) { - if (msg.recorded) { - val evt = new ParticipantLeftVoiceRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setBridge(msg.confNum); - evt.setParticipant(msg.user.voiceUser.userId); - recorder.record(msg.meetingID, evt); - } - } - - def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - if (msg.recorded) { - val evt = new RecordStatusRecordEvent(); - evt.setMeetingId(msg.meetingID); - evt.setTimestamp(TimestampGenerator.generateTimestamp); - evt.setUserId(msg.userId); - evt.setRecordingStatus(msg.recording.toString); - - recorder.record(msg.meetingID, evt); - } - } - - private def handleUserLeft(msg: UserLeft): Unit = { - if (msg.recorded) { - val ev = new ParticipantLeftRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setUserId(msg.user.userID); - ev.setMeetingId(msg.meetingID); - - recorder.record(msg.meetingID, ev); - } - - } - - private def handleUserRaisedHand(msg: UserRaisedHand) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "raiseHand", true: java.lang.Boolean) - handleUserStatusChange(status) - } - - private def handleUserLoweredHand(msg: UserLoweredHand) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "raiseHand", false: java.lang.Boolean) - handleUserStatusChange(status) - } - - private def handleUserSharedWebcam(msg: UserSharedWebcam) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "hasStream", "true,stream=" + msg.stream) - handleUserStatusChange(status) - } - - private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { - val status = UserStatusChange(msg.meetingID, msg.recorded, - msg.userID, "hasStream", "false,stream=" + msg.stream) - handleUserStatusChange(status) - } - - private def handleUserStatusChange(msg: UserStatusChange): Unit = { - if (msg.recorded) { - val ev = new ParticipantStatusChangeRecordEvent(); - ev.setTimestamp(TimestampGenerator.generateTimestamp); - ev.setUserId(msg.userID); - ev.setMeetingId(msg.meetingID); - ev.setStatus(msg.status); - ev.setValue(msg.value.toString()); - - recorder.record(msg.meetingID, ev); - } - } - - private def handleAssignPresenter(msg: PresenterAssigned): Unit = { - if (msg.recorded) { - val event = new AssignPresenterRecordEvent(); - event.setMeetingId(msg.meetingID); - event.setTimestamp(TimestampGenerator.generateTimestamp); - event.setUserId(msg.presenter.presenterID); - event.setName(msg.presenter.presenterName); - event.setAssignedBy(msg.presenter.assignedBy); - - recorder.record(msg.meetingID, event); - } - - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersMessageToJsonConverter.scala deleted file mode 100644 index 88caab071d..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/users/redis/UsersMessageToJsonConverter.scala +++ /dev/null @@ -1,359 +0,0 @@ -package org.bigbluebutton.core.apps.users.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants -import org.bigbluebutton.core.messaging.Util -import com.google.gson.Gson -import org.bigbluebutton.core.api.UserVO -import collection.JavaConverters._ -import scala.collection.JavaConversions._ - -object UsersMessageToJsonConverter { - private def userToMap(user: UserVO): java.util.Map[String, Any] = { - - val wuser = new scala.collection.mutable.HashMap[String, Any] - wuser += "userid" -> user.userID - wuser += "extern_userid" -> user.externUserID - wuser += "name" -> user.name - wuser += "role" -> user.role.toString() - wuser += "raise_hand" -> user.raiseHand - wuser += "presenter" -> user.presenter - wuser += "has_stream" -> user.hasStream - wuser += "locked" -> user.locked - wuser += "webcam_stream" -> user.webcamStreams - wuser += "phone_user" -> user.phoneUser - wuser += "listenOnly" -> user.listenOnly - - val vuser = new scala.collection.mutable.HashMap[String, Any] - vuser += "userid" -> user.voiceUser.userId - vuser += "web_userid" -> user.voiceUser.webUserId - vuser += "callername" -> user.voiceUser.callerName - vuser += "callernum" -> user.voiceUser.callerNum - vuser += "joined" -> user.voiceUser.joined - vuser += "locked" -> user.voiceUser.locked - vuser += "muted" -> user.voiceUser.muted - vuser += "talking" -> user.voiceUser.talking - - wuser.put("voiceUser", mapAsJavaMap(vuser)) - - mapAsJavaMap(wuser) - } - - private def registeredUserToMap(user: RegisteredUser): java.util.Map[String, Any] = { - val wuser = new scala.collection.mutable.HashMap[String, Any] - wuser += "userid" -> user.id - wuser += "extern_userid" -> user.externId - wuser += "name" -> user.name - wuser += "role" -> user.role.toString() - wuser += "authToken" -> user.authToken - - mapAsJavaMap(wuser) - } - - def disconnectAllUsersToJson(msg: DisconnectAllUsers): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.DISCONNECT_ALL_USERS, msg.version, None) - Util.buildJson(header, payload) - } - - def disconnectUserToJson(msg: DisconnectUser): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = Util.buildHeader(MessageNames.DISCONNECT_USER, msg.version, None) - Util.buildJson(header, payload) - } - - def permissionsSettingInitializedToJson(msg: PermissionsSettingInitialized): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested - - val header = Util.buildHeader(MessageNames.PERMISSION_SETTING_INITIALIZED, msg.version, None) - Util.buildJson(header, payload) - } - - def newPermissionsSettingToJson(msg: NewPermissionsSetting): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("disableCam", msg.permissions.disableCam) - payload.put("disableMic", msg.permissions.disableMic) - payload.put("disablePrivChat", msg.permissions.disablePrivChat) - payload.put("disablePubChat", msg.permissions.disablePubChat) - payload.put("lockedLayout", msg.permissions.lockedLayout) - payload.put("lockOnJoin", msg.permissions.lockOnJoin) - payload.put("lockOnJoinConfigurable", msg.permissions.lockOnJoin) - - val users = new java.util.ArrayList[java.util.Map[String, Any]] - msg.applyTo.foreach(uvo => { - users.add(userToMap(uvo)) - }) - - payload.put("users", users) - - val header = Util.buildHeader(MessageNames.NEW_PERMISSION_SETTINGS, msg.version, None) - Util.buildJson(header, payload) - } - - def userLockedToJson(msg: UserLocked): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.LOCKED, msg.lock) - - val header = Util.buildHeader(MessageNames.USER_LOCKED, msg.version, None) - Util.buildJson(header, payload) - } - - def getPermissionsSettingReplyToJson(msg: GetPermissionsSettingReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = Util.buildHeader(MessageNames.GET_PERMISSION_SETTINGS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def userRegisteredToJson(msg: UserRegistered): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER, registeredUserToMap(msg.user)) - payload.put(Constants.RECORDED, msg.recorded) - - val header = Util.buildHeader(MessageNames.USER_REGISTERED, msg.version, None) - Util.buildJson(header, payload) - } - - def userRaisedHandToJson(msg: UserRaisedHand): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - - val header = Util.buildHeader(MessageNames.USER_RAISED_HAND, msg.version, None) - Util.buildJson(header, payload) - } - - def userLoweredHandToJson(msg: UserLoweredHand): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RAISE_HAND, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LOWERED_BY, msg.loweredBy) - - val header = Util.buildHeader(MessageNames.USER_LOWERED_HAND, msg.version, None) - Util.buildJson(header, payload) - } - - def userStatusChangeToJson(msg: UserStatusChange): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STATUS, msg.status) - payload.put(Constants.VALUE, msg.value.toString) - - val header = Util.buildHeader(MessageNames.USER_STATUS_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def userSharedWebcamToJson(msg: UserSharedWebcam): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = Util.buildHeader(MessageNames.USER_SHARED_WEBCAM, msg.version, None) - Util.buildJson(header, payload) - } - - def userUnsharedWebcamToJson(msg: UserUnsharedWebcam): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.STREAM, msg.stream) - - val header = Util.buildHeader(MessageNames.USER_UNSHARED_WEBCAM, msg.version, None) - Util.buildJson(header, payload) - } - - def getUsersReplyToJson(msg: GetUsersReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val users = new java.util.ArrayList[java.util.Map[String, Any]]; - msg.users.foreach(uvo => { - users.add(userToMap(uvo)) - }) - - payload.put(Constants.USERS, users) - - val header = Util.buildHeader(MessageNames.GET_USERS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def userJoinedVoice(msg: UserJoinedVoice): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_JOINED_VOICE, msg.version, None) - Util.buildJson(header, payload) - } - - def userVoiceMuted(msg: UserVoiceMuted): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_VOICE_MUTED, msg.version, None) - Util.buildJson(header, payload) - } - - def userVoiceTalking(msg: UserVoiceTalking): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_VOICE_TALKING, msg.version, None) - Util.buildJson(header, payload) - } - - def muteVoiceUserToJson(msg: MuteVoiceUser): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MUTE, msg.mute) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) - Util.buildJson(header, payload) - } - - def ejectVoiceUserToJson(msg: EjectVoiceUser): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) - Util.buildJson(header, payload) - } - - def userLeftVoiceToJson(msg: UserLeftVoice): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER, userToMap(msg.user)) - payload.put(Constants.VOICE_CONF, msg.confNum) - - val header = Util.buildHeader(MessageNames.USER_LEFT_VOICE, msg.version, None) - Util.buildJson(header, payload) - } - - def isMeetingMutedReplyToJson(msg: IsMeetingMutedReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.MUTED, msg.meetingMuted) - - val header = Util.buildHeader(MessageNames.IS_MEETING_MUTED_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def recordingStatusChangedToJson(msg: RecordingStatusChanged): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def validateAuthTokenReplyToJson(msg: ValidateAuthTokenReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.REPLY_TO, msg.correlationId) - payload.put(Constants.VALID, msg.valid.toString) - payload.put(Constants.USER_ID, msg.requesterId) - payload.put(Constants.AUTH_TOKEN, msg.token) - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.VALIDATE_AUTH_TOKEN_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def userJoinedToJson(msg: UserJoined): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("user", userToMap(msg.user)) - - val header = Util.buildHeader(MessageNames.USER_JOINED, msg.version, None) - Util.buildJson(header, payload) - } - - def userLeftToJson(msg: UserLeft): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("user", userToMap(msg.user)) - - val header = Util.buildHeader(MessageNames.USER_LEFT, msg.version, None) - Util.buildJson(header, payload) - } - - def presenterAssignedToJson(msg: PresenterAssigned): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); - payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); - payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); - payload.put(Constants.RECORDED, msg.recorded) - - val header = Util.buildHeader(MessageNames.PRESENTER_ASSIGNED, msg.version, None) - Util.buildJson(header, payload) - } - - def endAndKickAllToJson(msg: EndAndKickAll): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - - val header = Util.buildHeader(MessageNames.END_AND_KICK_ALL, msg.version, None) - Util.buildJson(header, payload) - } - - def userListeningOnlyToJson(msg: UserListeningOnly): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userID) - payload.put(Constants.LISTEN_ONLY, msg.listenOnly) - - val header = Util.buildHeader(MessageNames.USER_LISTEN_ONLY, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceApp.scala deleted file mode 100644 index f888c21f6e..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceApp.scala +++ /dev/null @@ -1,34 +0,0 @@ -package org.bigbluebutton.core.apps.voice - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.MeetingActor - -trait VoiceApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { - - } - - def handleMuteMeetingRequest(msg: MuteMeetingRequest) { - - } - - def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { - - } - - def handleMuteUserRequest(msg: MuteUserRequest) { - - } - - def handleLockUserRequest(msg: LockUserRequest) { - - } - - def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { - - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceInGateway.scala deleted file mode 100644 index f06efed41d..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/voice/VoiceInGateway.scala +++ /dev/null @@ -1,65 +0,0 @@ -package org.bigbluebutton.core.apps.voice - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ - -class VoiceInGateway(bbbGW: BigBlueButtonGateway) { - - def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: Boolean) { - bbbGW.accept(new MuteAllExceptPresenterRequest(meetingID, requesterID, mute)) - } - - def muteAllUsers(meetingID: String, requesterID: String, mute: Boolean) { - bbbGW.accept(new MuteMeetingRequest(meetingID, requesterID, mute)) - } - - def isMeetingMuted(meetingID: String, requesterID: String) { - bbbGW.accept(new IsMeetingMutedRequest(meetingID, requesterID)) - } - - def muteUser(meetingID: String, requesterID: String, userID: String, mute: Boolean) { - bbbGW.accept(new MuteUserRequest(meetingID, requesterID, userID, mute)) - } - - def lockUser(meetingID: String, requesterID: String, userID: String, lock: Boolean) { - bbbGW.accept(new LockUserRequest(meetingID, requesterID, userID, lock)) - } - - def ejectUserFromVoice(meetingID: String, userId: String, ejectedBy: String) { - bbbGW.accept(new EjectUserFromVoiceRequest(meetingID, userId, ejectedBy)) - } - - def voiceUserJoined(meetingId: String, userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, - muted: Boolean, talking: Boolean) { - // println("VoiceInGateway: Got voiceUserJoined message for meeting [" + meetingId + "] user[" + callerIdName + "]") - val voiceUser = new VoiceUser(userId, webUserId, - callerIdName, callerIdNum, - true, false, muted, talking) - bbbGW.accept(new VoiceUserJoined(meetingId, voiceUser)) - } - - def voiceUserLeft(meetingId: String, userId: String) { - // println("VoiceInGateway: Got voiceUserLeft message for meeting [" + meetingId + "] user[" + userId + "]") - bbbGW.accept(new VoiceUserLeft(meetingId, userId)) - } - - def voiceUserLocked(meetingId: String, userId: String, locked: Boolean) { - bbbGW.accept(new VoiceUserLocked(meetingId, userId, locked)) - } - - def voiceUserMuted(meetingId: String, userId: String, muted: Boolean) { - bbbGW.accept(new VoiceUserMuted(meetingId, userId, muted)) - } - - def voiceUserTalking(meetingId: String, userId: String, talking: Boolean) { - bbbGW.accept(new VoiceUserTalking(meetingId, userId, talking)) - } - - def voiceRecording(meetingId: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - bbbGW.accept(new VoiceRecording(meetingId, recordingFile, - timestamp, recording)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardApp.scala deleted file mode 100644 index 68ffa83d20..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardApp.scala +++ /dev/null @@ -1,100 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil -import org.bigbluebutton.core.MeetingActor -import org.bigbluebutton.core.apps.whiteboard.vo._ - -case class Whiteboard(id: String, shapes: Seq[AnnotationVO]) - -trait WhiteboardApp { - this: MeetingActor => - - val outGW: MessageOutGateway - - private val wbModel = new WhiteboardModel - - def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { - val status = msg.annotation.status - val shapeType = msg.annotation.shapeType - val wbId = msg.annotation.wbId - val shape = msg.annotation - - initWhiteboard(wbId) - - // println("Received whiteboard shape. status=[" + status + "], shapeType=[" + shapeType + "]") - - if (WhiteboardKeyUtil.TEXT_CREATED_STATUS == status) { - // println("Received textcreated status") - wbModel.addAnnotation(wbId, shape) - } else if ((WhiteboardKeyUtil.PENCIL_TYPE == shapeType) - && (WhiteboardKeyUtil.DRAW_START_STATUS == status)) { - // println("Received pencil draw start status") - wbModel.addAnnotation(wbId, shape) - } else if ((WhiteboardKeyUtil.DRAW_END_STATUS == status) - && ((WhiteboardKeyUtil.RECTANGLE_TYPE == shapeType) - || (WhiteboardKeyUtil.ELLIPSE_TYPE == shapeType) - || (WhiteboardKeyUtil.TRIANGLE_TYPE == shapeType) - || (WhiteboardKeyUtil.LINE_TYPE == shapeType))) { - // println("Received [" + shapeType +"] draw end status") - wbModel.addAnnotation(wbId, shape) - } else if (WhiteboardKeyUtil.TEXT_TYPE == shapeType) { - // println("Received [" + shapeType +"] modify text status") - wbModel.modifyText(wbId, shape) - } else { - // println("Received UNKNOWN whiteboard shape!!!!. status=[" + status + "], shapeType=[" + shapeType + "]") - } - wbModel.getWhiteboard(wbId) foreach { wb => - // println("WhiteboardApp::handleSendWhiteboardAnnotationRequest - num shapes [" + wb.shapes.length + "]") - outGW.send(new SendWhiteboardAnnotationEvent(meetingID, recorded, - msg.requesterID, wbId, msg.annotation)) - } - - } - - private def initWhiteboard(wbId: String) { - if (!wbModel.hasWhiteboard(wbId)) { - wbModel.createWhiteboard(wbId) - } - } - - def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { - //println("WB: Received page history [" + msg.whiteboardId + "]") - wbModel.history(msg.whiteboardId) foreach { wb => - outGW.send(new GetWhiteboardShapesReply(meetingID, recorded, - msg.requesterID, wb.id, wb.shapes.toArray, msg.replyTo)) - } - } - - def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { - //println("WB: Received clear whiteboard") - wbModel.clearWhiteboard(msg.whiteboardId) - wbModel.getWhiteboard(msg.whiteboardId) foreach { wb => - outGW.send(new ClearWhiteboardEvent(meetingID, recorded, - msg.requesterID, wb.id)) - } - } - - def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { - // println("WB: Received undo whiteboard") - - wbModel.getWhiteboard(msg.whiteboardId) foreach { wb => - wbModel.undoWhiteboard(msg.whiteboardId) foreach { last => - outGW.send(new UndoWhiteboardEvent(meetingID, recorded, - msg.requesterID, wb.id, last.id)) - } - } - } - - def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { - wbModel.enableWhiteboard(msg.enable) - outGW.send(new WhiteboardEnabledEvent(meetingID, recorded, - msg.requesterID, msg.enable)) - } - - def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { - val enabled = wbModel.isWhiteboardEnabled() - outGW.send(new IsWhiteboardEnabledReply(meetingID, recorded, - msg.requesterID, enabled, msg.replyTo)) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardInGateway.scala deleted file mode 100755 index 87a8edead7..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardInGateway.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard - -import org.bigbluebutton.core.BigBlueButtonGateway -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO - -class WhiteboardInGateway(bbbGW: BigBlueButtonGateway) { - - private def buildAnnotation(annotation: Map[String, Object]): Option[AnnotationVO] = { - var shape: Option[AnnotationVO] = None - - val id = annotation.getOrElse("id", null).asInstanceOf[String] - val shapeType = annotation.getOrElse("type", null).asInstanceOf[String] - val status = annotation.getOrElse("status", null).asInstanceOf[String] - val wbId = annotation.getOrElse("whiteboardId", null).asInstanceOf[String] - // println("** GOT ANNOTATION status[" + status + "] shape=[" + shapeType + "]"); - - if (id != null && shapeType != null && status != null && wbId != null) { - shape = Some(new AnnotationVO(id, status, shapeType, annotation.toMap, wbId)) - } - - shape - } - - def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: Map[String, Object]) { - buildAnnotation(annotation) match { - case Some(shape) => { - bbbGW.accept(new SendWhiteboardAnnotationRequest(meetingID, requesterID, shape)) - } - case None => // do nothing - } - } - - def requestWhiteboardAnnotationHistory(meetingID: String, requesterID: String, whiteboardId: String, replyTo: String) { - bbbGW.accept(new GetWhiteboardShapesRequest(meetingID, requesterID, whiteboardId, replyTo)) - } - - def clearWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { - bbbGW.accept(new ClearWhiteboardRequest(meetingID, requesterID, whiteboardId)) - } - - def undoWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { - bbbGW.accept(new UndoWhiteboardRequest(meetingID, requesterID, whiteboardId)) - } - - def enableWhiteboard(meetingID: String, requesterID: String, enable: Boolean) { - bbbGW.accept(new EnableWhiteboardRequest(meetingID, requesterID, enable)) - } - - def isWhiteboardEnabled(meetingID: String, requesterID: String, replyTo: String) { - bbbGW.accept(new IsWhiteboardEnabledRequest(meetingID, requesterID, replyTo)) - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardModel.scala deleted file mode 100644 index 831b7e9112..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/WhiteboardModel.scala +++ /dev/null @@ -1,87 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard - -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import scala.collection.mutable.ArrayBuffer - -class WhiteboardModel { - private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]() - - private var _enabled = true - - private def saveWhiteboard(wb: Whiteboard) { - _whiteboards += wb.id -> wb - } - - def getWhiteboard(id: String): Option[Whiteboard] = { - _whiteboards.values.find(wb => wb.id == id) - } - - def hasWhiteboard(id: String): Boolean = { - _whiteboards.contains(id) - } - - def createWhiteboard(wbId: String) { - val vec = scala.collection.immutable.Vector.empty - val wb = new Whiteboard(wbId, vec) - saveWhiteboard(wb) - } - - def addAnnotationToShape(wb: Whiteboard, shape: AnnotationVO) = { - // println("Adding shape to wb [" + wb.id + "]. Before numShapes=[" + wb.shapes.length + "].") - val newWb = wb.copy(shapes = (wb.shapes :+ shape)) - // println("Adding shape to page [" + wb.id + "]. After numShapes=[" + newWb.shapes.length + "].") - saveWhiteboard(newWb) - } - - def addAnnotation(wbId: String, shape: AnnotationVO) { - getWhiteboard(wbId) foreach { wb => - addAnnotationToShape(wb, shape) - } - } - - private def modifyTextInPage(wb: Whiteboard, shape: AnnotationVO) = { - val removedLastText = wb.shapes.dropRight(1) - val addedNewText = removedLastText :+ shape - val newWb = wb.copy(shapes = addedNewText) - saveWhiteboard(newWb) - } - - def modifyText(wbId: String, shape: AnnotationVO) { - getWhiteboard(wbId) foreach { wb => - modifyTextInPage(wb, shape) - } - } - - def history(wbId: String): Option[Whiteboard] = { - getWhiteboard(wbId) - } - - def clearWhiteboard(wbId: String) { - getWhiteboard(wbId) foreach { wb => - val clearedShapes = wb.shapes.drop(wb.shapes.length) - val newWb = wb.copy(shapes = clearedShapes) - saveWhiteboard(newWb) - } - } - - def undoWhiteboard(wbId: String): Option[AnnotationVO] = { - var last: Option[AnnotationVO] = None - getWhiteboard(wbId) foreach { wb => - if (!wb.shapes.isEmpty) { - last = Some(wb.shapes.last) - val remaining = wb.shapes.dropRight(1) - val newWb = wb.copy(shapes = remaining) - saveWhiteboard(newWb) - } - } - last - } - - def enableWhiteboard(enable: Boolean) { - _enabled = enable - } - - def isWhiteboardEnabled(): Boolean = { - _enabled - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala deleted file mode 100755 index a51bc0765a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.redis - -import org.bigbluebutton.core.api._ -import scala.collection.JavaConversions._ -import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil -import scala.collection.immutable.StringOps -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.conference.service.messaging.MessagingConstants - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -class WhiteboardEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - def handleMessage(msg: IOutMessage) { - msg match { - case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) - case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { - val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { - val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - - private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { - val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) - service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala deleted file mode 100644 index 6520e72e3b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala +++ /dev/null @@ -1,92 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.redis - -import org.bigbluebutton.conference.service.recorder.RecorderApplication -import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.whiteboard.redis.AddShapeWhiteboardRecordEvent -import scala.collection.JavaConversions._ -import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil -import org.bigbluebutton.conference.service.whiteboard.redis.AddTextWhiteboardRecordEvent -import org.bigbluebutton.conference.service.whiteboard.redis.ClearPageWhiteboardRecordEvent -import org.bigbluebutton.conference.service.whiteboard.redis.UndoShapeWhiteboardRecordEvent -import org.bigbluebutton.conference.service.whiteboard.redis.ModifyTextWhiteboardRecordEvent -import scala.collection.immutable.StringOps - -class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) - case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) - case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) - case _ => //println("Unhandled message in UsersClientMessageSender") - } - } - - private def getPresentationId(whiteboardId: String): String = { - // Need to split the whiteboard id into presenation id and page num as the old - // recording expects them - val strId = new StringOps(whiteboardId) - val ids = strId.split('/') - var presId: String = "" - if (ids.length == 2) { - presId = ids(0) - } - - presId - } - - private def getPageNum(whiteboardId: String): String = { - val strId = new StringOps(whiteboardId) - val ids = strId.split('/') - var pageNum = "0" - if (ids.length == 2) { - pageNum = ids(1) - } - pageNum - } - - private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { - if ((msg.shape.shapeType == WhiteboardKeyUtil.TEXT_TYPE) && (msg.shape.status != WhiteboardKeyUtil.TEXT_CREATED_STATUS)) { - - val event = new ModifyTextWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId) - event.addAnnotation(mapAsJavaMap(msg.shape.shape)) - recorder.record(msg.meetingID, event) - } else { - val event = new AddShapeWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId); - event.addAnnotation(mapAsJavaMap(msg.shape.shape)) - recorder.record(msg.meetingID, event) - } - } - - private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { - val event = new ClearPageWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId) - recorder.record(msg.meetingID, event) - } - - private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { - val event = new UndoShapeWhiteboardRecordEvent() - event.setMeetingId(msg.meetingID) - event.setTimestamp(TimestampGenerator.generateTimestamp) - event.setPresentation(getPresentationId(msg.whiteboardId)) - event.setPageNumber(getPageNum(msg.whiteboardId)) - event.setWhiteboardId(msg.whiteboardId) - event.setShapeId(msg.shapeId); - recorder.record(msg.meetingID, event) - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala deleted file mode 100755 index 6a9db85067..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala +++ /dev/null @@ -1,94 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.redis - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO -import collection.JavaConverters._ -import scala.collection.JavaConversions._ - -object WhiteboardMessageToJsonConverter { - private def shapeToMap(shape: AnnotationVO): java.util.Map[String, Any] = { - val res = new scala.collection.mutable.HashMap[String, Any] - res += "id" -> shape.id - res += "status" -> shape.status - res += "shape_type" -> shape.shapeType - res += "wb_id" -> shape.wbId - - val shapeMap = new scala.collection.mutable.HashMap[String, Any]() - for ((key, value) <- shape.shape) { - shapeMap += key -> value - } - res += "shape" -> mapAsJavaMap(shapeMap) - - mapAsJavaMap(res) - } - - def getWhiteboardShapesReplyToJson(msg: GetWhiteboardShapesReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val shapes = new java.util.ArrayList[java.util.Map[String, Any]]() - msg.shapes.foreach { shape => - shapes.add(shapeToMap(shape)) - } - - payload.put(Constants.SHAPES, shapes) - - val header = Util.buildHeader(MessageNames.GET_WHITEBOARD_SHAPES_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendWhiteboardAnnotationEventToJson(msg: SendWhiteboardAnnotationEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - payload.put(Constants.SHAPE, shapeToMap(msg.shape)) - - val header = Util.buildHeader(MessageNames.SEND_WHITEBOARD_SHAPE, msg.version, None) - Util.buildJson(header, payload) - } - - def clearWhiteboardEventToJson(msg: ClearWhiteboardEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - - val header = Util.buildHeader(MessageNames.WHITEBOARD_CLEARED, msg.version, None) - Util.buildJson(header, payload) - } - - def undoWhiteboardEventToJson(msg: UndoWhiteboardEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) - payload.put(Constants.SHAPE_ID, msg.shapeId) - - val header = Util.buildHeader(MessageNames.UNDO_WHITEBOARD, msg.version, None) - Util.buildJson(header, payload) - } - - def whiteboardEnabledEventToJson(msg: WhiteboardEnabledEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ENABLE, msg.enable) - - val header = Util.buildHeader(MessageNames.WHITEBOARD_ENABLED, msg.version, None) - Util.buildJson(header, payload) - } - - def isWhiteboardEnabledReplyToJson(msg: IsWhiteboardEnabledReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.ENABLE, msg.enabled) - - val header = Util.buildHeader(MessageNames.IS_WHITEBOARD_ENABLED_REPLY, msg.version, Some(msg.replyTo)) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/vo/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/vo/ValueObjects.scala deleted file mode 100755 index 8d373be551..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/apps/whiteboard/vo/ValueObjects.scala +++ /dev/null @@ -1,3 +0,0 @@ -package org.bigbluebutton.core.apps.whiteboard.vo - -case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Object], wbId: String) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingEventRedisPublisher.scala deleted file mode 100755 index b34133b525..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingEventRedisPublisher.scala +++ /dev/null @@ -1,94 +0,0 @@ -package org.bigbluebutton.core.meeting - -import org.bigbluebutton.conference.service.messaging.redis.MessageSender -import org.bigbluebutton.core.api._ -import scala.collection.immutable.HashMap -import com.google.gson.Gson -import scala.collection.JavaConverters._ -import org.bigbluebutton.conference.service.messaging.MessagingConstants - -class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { - - private val KEEP_ALIVE_REPLY = "KEEP_ALIVE_REPLY" - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) - case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) - case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) - case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingHasEnded => handleMeetingHasEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: KeepAliveMessageReply => handleKeepAliveMessageReply(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) - case _ => //println("Unhandled message in MeetingEventRedisPublisher") - } - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) - // System.out.println("****\n" + json) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply) { - val json = MeetingMessageToJsonConverter.keepAliveMessageReplyToJson(msg) - service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, json) - } - - private def handleMeetingCreated(msg: MeetingCreated) { - val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) - // System.out.println("****\n" + json) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleMeetingEnded(msg: MeetingEnded) { - val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) - // System.out.println("****\n" + json) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleStartRecording(msg: StartRecording) { - val json = MeetingMessageToJsonConverter.startRecordingToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleStopRecording(msg: StopRecording) { - val json = MeetingMessageToJsonConverter.stopRecordingToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { - val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { - val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { - val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { - val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleMeetingHasEnded(msg: MeetingHasEnded) { - val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } - - private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { - val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) - service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingMessageToJsonConverter.scala deleted file mode 100644 index 2dba6e981f..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/meeting/MeetingMessageToJsonConverter.scala +++ /dev/null @@ -1,132 +0,0 @@ -package org.bigbluebutton.core.meeting - -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.core.api._ -import com.google.gson.Gson -import scala.collection.JavaConverters._ - -object MeetingMessageToJsonConverter { - def meetingDestroyedToJson(msg: MeetingDestroyed): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.MEETING_DESTROYED_EVENT, msg.version, None) - Util.buildJson(header, payload) - } - - def keepAliveMessageReplyToJson(msg: KeepAliveMessageReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.KEEP_ALIVE_ID, msg.aliveID) - - val header = Util.buildHeader(MessageNames.KEEP_ALIVE_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def meetingCreatedToJson(msg: MeetingCreated): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) - payload.put(Constants.NAME, msg.name) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.VOICE_CONF, msg.voiceBridge) - payload.put(Constants.DURATION, msg.duration) - payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) - payload.put(Constants.VIEWER_PASS, msg.viewerPass) - payload.put(Constants.CREATE_TIME, msg.createTime) - payload.put(Constants.CREATE_DATE, msg.createDate) - - val header = Util.buildHeader(MessageNames.MEETING_CREATED, msg.version, None) - Util.buildJson(header, payload) - } - - def meetingEndedToJson(msg: MeetingEnded): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - - val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) - Util.buildJson(header, payload) - } - - def voiceRecordingStartedToJson(msg: VoiceRecordingStarted): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.RECORDING_FILE, msg.recordingFile) - payload.put(Constants.VOICE_CONF, msg.confNum) - payload.put(Constants.TIMESTAMP, msg.timestamp) - - val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STARTED, msg.version, None) - Util.buildJson(header, payload) - } - - def voiceRecordingStoppedToJson(msg: VoiceRecordingStopped): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.RECORDING_FILE, msg.recordingFile) - payload.put(Constants.VOICE_CONF, msg.confNum) - payload.put(Constants.TIMESTAMP, msg.timestamp) - - val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STOPPED, msg.version, None) - Util.buildJson(header, payload) - } - - def recordingStatusChangedToJson(msg: RecordingStatusChanged): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) - Util.buildJson(header, payload) - } - - def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.RECORDING, msg.recording) - - val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } - - def meetingHasEndedToJson(msg: MeetingHasEnded): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.USER_ID, msg.userId) - - val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) - Util.buildJson(header, payload) - } - - def startRecordingToJson(msg: StartRecording): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.START_RECORDING, msg.version, None) - Util.buildJson(header, payload) - } - - def stopRecordingToJson(msg: StopRecording): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.RECORDED, msg.recorded) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.STOP_RECORDING, msg.version, None) - Util.buildJson(header, payload) - } - - def getAllMeetingsReplyToJson(msg: GetAllMeetingsReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put("meetings", msg.meetings) - - val header = Util.buildHeader(MessageNames.GET_ALL_MEETINGS_REPLY, msg.version, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/messaging/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/messaging/Util.scala deleted file mode 100644 index 3e3eb7337c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/messaging/Util.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.bigbluebutton.core.messaging - -import org.bigbluebutton.core.api._ -import com.google.gson.Gson - -object Util { - - val VERSION = "version" - - def buildHeader(name: String, version: String, - replyTo: Option[String]): java.util.HashMap[String, Any] = { - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, name) - header.put(VERSION, version) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) - replyTo.foreach(rep => header.put(Constants.REPLY_TO, rep)) - - header - } - - def buildJson(header: java.util.HashMap[String, Any], - payload: java.util.HashMap[String, Any]): String = { - - val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() - message.put(Constants.HEADER, header) - message.put(Constants.PAYLOAD, payload) - - val gson = new Gson() - gson.toJson(message) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/models/Values.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/models/Values.scala deleted file mode 100755 index 14cf8bcbac..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/models/Values.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.bigbluebutton.core.models - -import org.bigbluebutton.core.api.Role._ - -case class Status(isPresenter: Boolean = false, handRaised: Boolean = false) - -case class CallerId(num: String = "", name: String = "") - -case class Voice( - hasJoined: Boolean = false, - id: String = "", - callerId: CallerId = CallerId(), - muted: Boolean = false, - talking: Boolean = false, - locked: Boolean = false) - -case class UserV( - id: String, - extId: String, - name: String, - role: Role = VIEWER, - status: Status = Status(), - voice: Voice = Voice()) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/util/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/util/RandomStringGenerator.scala deleted file mode 100755 index b1b60cc715..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/util/RandomStringGenerator.scala +++ /dev/null @@ -1,17 +0,0 @@ -package org.bigbluebutton.core.util - -object RandomStringGenerator { - // From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ - - // Random generator - val random = new scala.util.Random - - // Generate a random string of length n from the given alphabet - def randomString(alphabet: String)(n: Int): String = - Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString - - // Generate a random alphabnumeric string of length n - def randomAlphanumericString(n: Int) = - randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) -} - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/voice/VoiceConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/voice/VoiceConferenceActor.scala deleted file mode 100755 index 81c8cc3513..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_core/voice/VoiceConferenceActor.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.bigbluebutton.core.voice - -import akka.actor._ -import akka.actor.ActorLogging - -case class MuteAllUsers(meetingId: String, except: Option[Seq[String]]) -case class MuteUser(meetingId: String, userId: String) -case class UnmuteUser(meetingId: String, userId: String) -case class EjectVoiceUser(meetingId: String, userId: String) - -class VoiceConferenceActor(val meetingId: String, - val voiceConf: String) { //extends Actor { - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageFormatters.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageFormatters.scala deleted file mode 100644 index e154a9c78b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageFormatters.scala +++ /dev/null @@ -1,37 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.MeetingIdAndName -import org.bigbluebutton.apps.users.data.UserIdAndName - -sealed abstract class InMsgFormatter - -case class CreateMeetingRequestFormat(header: Header, - payload: CreateMeetingRequestPayloadFormat) extends InMsgFormatter - -case class CreateMeetingResponseFormat(header: Header, - payload: CreateMeetingResponsePayloadFormat) extends InMsgFormatter - -case class RegisterUserRequestFormat(header: Header, - payload: RegisterUserRequestPayloadFormat) extends InMsgFormatter - -case class RegisterUserResponseFormat(header: Header, - payload: RegisterUserResponsePayloadFormat) extends InMsgFormatter - -case class UserRegisteredEventFormat(header: Header, - payload: UserRegisteredEventPayloadFormat) extends InMsgFormatter - -case class UserJoinRequestFormat(header: Header, - payload: UserJoinRequestPayloadFormat) extends InMsgFormatter - -case class UserJoinedEventFormat(header: Header, - payload: UserJoinedEventPayloadFormat) extends InMsgFormatter - -case class UserLeaveMessage(header: Header, - payload: UserLeavePayload) extends InMsgFormatter - -case class GetUsersRequestMessage(header: Header, - payload: GetUsersRequestPayload) extends InMsgFormatter - -case class AssignPresenterMessage(header: Header, - payload: AssignPresenterPayload) extends InMsgFormatter diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageHandlerActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageHandlerActor.scala deleted file mode 100755 index 3d1d31d76d..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/InMessageHandlerActor.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.util.Timeout -import scala.concurrent.duration._ -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } -import org.bigbluebutton.apps.users.protocol.UsersMessageHandler - -/** - * This actor is responsible for handling messages from the pubsub. - */ -object MessageHandlerActor { - def props(bbbAppsActor: ActorRef, messageMarshallingActor: ActorRef): Props = - Props(classOf[MessageHandlerActor], bbbAppsActor, messageMarshallingActor) -} - -class MessageHandlerActor private (val bbbAppsActor: ActorRef, - val messageMarshallingActor: ActorRef) extends Actor - with ActorLogging { - - /** RefFactory for actor request-response (ask pattern) **/ - def actorRefFactory = context - - /** Required for actor request-response (ask pattern) **/ - implicit def executionContext = actorRefFactory.dispatcher - implicit val timeout = Timeout(5 seconds) - - def receive = { - case msg: UserJoinRequestFormat => //handleUserJoinRequestMessage(msg) - - case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageFormats.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageFormats.scala deleted file mode 100644 index bb36c3b1b2..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageFormats.scala +++ /dev/null @@ -1,90 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.protocol._ -import org.bigbluebutton.apps.Role -import org.bigbluebutton.apps.users.messages.UserJoined -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.MeetingIdAndName -import org.bigbluebutton.apps.users.messages.Result -import org.bigbluebutton.apps.users.messages.UserJoinResponse - -case class ResultFormat(success: Boolean, message: String) - -case class UserFormat(id: String, external_id: String, name: String, - role: Role.RoleType, pin: Int, welcome_message: String, - logout_url: String, avatar_url: String) - -case class DurationFormat(length_in_minutes: Int, allow_extend: Boolean, max_minutes: Int) - -case class VoiceConferenceFormat(pin: Int, number: Int) - -case class PhoneNumberFormat(number: String, description: String) - -case class MeetingDescriptorFormat(name: String, external_id: String, - record: Boolean, welcome_message: String, logout_url: String, - avatar_url: String, max_users: Int, duration: DurationFormat, - voice_conference: VoiceConferenceFormat, - phone_numbers: Seq[PhoneNumberFormat], - metadata: Map[String, String]) - -case class CreateMeetingRequestPayloadFormat(meeting_descriptor: MeetingDescriptorFormat) - -case class CreateMeetingResponsePayloadFormat(meeting: MeetingIdAndName, - session: Option[String], result: ResultFormat, - meeting_descriptor: MeetingDescriptorFormat) - -case class MeetingCreatedEventPayloadFormat(meeting: MeetingIdAndName, - session: String, meeting_descriptor: MeetingDescriptorFormat) - -case class UserDescriptorFormat(external_id: String, name: String, - role: Role.RoleType, pin: Int, - welcome_message: String, - logout_url: String, avatar_url: String, - metadata: Map[String, String]) - -case class RegisterUserRequestPayloadFormat(meeting: MeetingIdAndName, - session: String, user_descriptor: UserDescriptorFormat) - -case class RegisterUserResponsePayloadFormat(meeting: MeetingIdAndName, - session: String, user_token: Option[String], - result: ResultFormat, user_descriptor: UserDescriptorFormat) - -case class UserRegisteredEventPayloadFormat(meeting: MeetingIdAndName, - session: String, user_descriptor: UserDescriptorFormat) - -case class StatusFormat(hand_raised: Boolean, muted: Boolean, - locked: Boolean, talking: Boolean) - -case class CallerIdFormat(name: String, number: String) - -case class MediaStreamFormat(media_type: String, uri: String, - metadata: Map[String, String]) - -case class JoinedUserFormat(id: String, external_id: String, name: String, - role: Role.RoleType, pin: Int, welcome_message: String, - logout_url: String, avatar_url: String, is_presenter: Boolean, - status: StatusFormat, caller_id: CallerIdFormat, - media_streams: Seq[MediaStreamFormat]) - -case class UserJoinedEventPayloadFormat(meeting: MeetingIdAndName, - session: String, user: JoinedUserFormat) - -case class UserJoinResponseMessage(header: Header, response: UserJoinResponse) - -case class JoinUserResponse(response: Response, token: String, joinedUser: Option[JoinedUser]) - -case class JoinUserReply(header: Header, payload: JoinUserResponse) - -case class UserJoinRequestPayloadFormat(meeting: MeetingIdAndName, - session: String, token: String) - -case class UserLeavePayload(meeting: MeetingIdAndName, - session: String, user: UserIdAndName) - -case class GetUsersRequestPayload(meeting: MeetingIdAndName, - session: String, requester: UserIdAndName) - -case class AssignPresenterPayload(meeting: MeetingIdAndName, - session: String, presenter: UserIdAndName, - assigned_by: UserIdAndName) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageMarshallingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageMarshallingActor.scala deleted file mode 100755 index d94d5c8e4c..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageMarshallingActor.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } -import org.bigbluebutton.apps.users.protocol.UsersMessageMarshalling - -/** - * This Actor is responsible for converting messages into JSON string - * to be published into the pubsub. - */ -object MessageMarshallingActor { - def props(pubsubActor: ActorRef): Props = - Props(classOf[MessageMarshallingActor], pubsubActor) -} - -class MessageMarshallingActor private (val pubsubActor: ActorRef) extends Actor - with ActorLogging { - - def receive = { - case msg: UserJoinResponseMessage => //marshallUserJoinResponseMessage(msg) - - case unknownMsg => log.error("Cannot marshall unknown message: [{}]", unknownMsg) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageNameConstants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageNameConstants.scala deleted file mode 100644 index c3a29bb97b..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageNameConstants.scala +++ /dev/null @@ -1,47 +0,0 @@ -package org.bigbluebutton.endpoint - -object InMsgNameConst { - val CreateMeetingRequest = "create_meeting_request" - val CreateMeetingResponse = "create_meeting_response" - val MeetingCreatedEvent = "meeting_created_event" - val EndMeetingRequest = "end_meeting_request" - val EndMeetingResponse = "end_meeting_response" - val EndMeetingWarningEvent = "end_meeting_warning_event" - val MeetingEndEvent = "meeting_end_event" - val MeetingEndedEvent = "meeting_ended_event" - val ExtendMeetingRequest = "extend_meeting_request" - val ExtendMeetingResponse = "extend_meeting_response" - val MeetingExtendedEvent = "meeting_extended_event" - - val RegisterUserRequest = "register_user_request" - val RegisterUserResponse = "register_user_response" - val UserRegisteredEvent = "user_registered_event" - val UserJoinRequest = "user_join_request" - val UserJoinResponse = "user_join_response" - val UserJoinedEvent = "user_joined_event" - val UserLeaveEvent = "user_leave_event" - val UserLeftEvent = "user_left_event" - val GetUsersRequest = "get_users_request" - val GetUsersResponse = "get_users_response" - val RaiseUserHandRequest = "raise_user_hand_request" - val UserRaisedHandEvent = "user_raised_hand_event" - val AssignPresenterRequest = "assign_presenter_request" - val PresenterAssignedEvent = "presenter_assigned_event" - val MuteUserRequest = "mute_user_request" - val MuteUserRequestEvent = "mute_user_request_event" - val MuteVoiceUserRequest = "mute_voice_user_request" - val VoiceUserMutedEvent = "voice_user_muted_event" - val UserMutedEvent = "user_muted_event" - val EjectUserRequest = "eject_user_request" - val UserEjectedEvent = "user_ejected_event" - val EjectUserFromVoiceRequest = "eject_user_from_voice_request" - val EjectVoiceUserRequest = "eject_voice_user_request" - val VoiceUserEjectedEvent = "voice_user_ejected_event" - val LockUserRequest = "lock_user_request" - val LockVoiceUserRequest = "lock_voice_user_request" - val VoiceUserLockedEvent = "voice_user_locked_event" - val UserLockedEvent = "user_locked_event" - val LockAllUsersRequest = "lock_all_users_request" - val AllUsersLockedEvent = "all_users_locked_event" -} - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageUmarshallingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageUmarshallingActor.scala deleted file mode 100755 index 0e24e14a5a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/MessageUmarshallingActor.scala +++ /dev/null @@ -1,93 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } -import spray.json.{ JsObject, JsonParser, DeserializationException } -import org.parboiled.errors.ParsingException -import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport._ -import org.bigbluebutton.apps.protocol._ -import scala.util.{ Try, Success, Failure } -import org.bigbluebutton.apps.users.protocol.UsersMessageUnmarshalling - -object MessageUnmarshallingActor { - def props(messageHandlerActor: ActorRef): Props = - Props(classOf[MessageUnmarshallingActor], messageHandlerActor) -} - -class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) extends Actor - with ActorLogging { - - def receive = { - case msg: String => handleMessage(msg) - case badMsg => log.error("Unhandled message: [{}", badMsg) - } - - def handleMessage(msg: String) = { - unmarshall(msg) match { - case Success(validMsg) => forwardMessage(validMsg) - case Failure(ex) => log.error("Unhandled message: [{}]", ex) - } - } - - def forwardMessage(msg: HeaderAndJsonMessage) = { - msg.header.name match { - case InMsgNameConst.UserJoinRequest => - //handleUserJoin(msg) - case InMsgNameConst.UserLeaveEvent => - //handleUserLeave(msg) - case InMsgNameConst.GetUsersRequest => - //handleGetUsers(msg) - case InMsgNameConst.AssignPresenterRequest => - //handleAssignPresenter(msg) - - case _ => - log.error("Unknown message name: [{}]", msg.header.name) - } - } - - def header(msg: JsObject): Header = { - try { - msg.fields.get("header") match { - case Some(header) => - header.convertTo[Header] - case None => - throw MessageProcessException("Cannot get header: [" + msg + "]") - } - } catch { - case e: DeserializationException => - throw MessageProcessException("Failed to deserialize header: [" + msg + "]") - } - } - - def payload(msg: JsObject): JsObject = { - msg.fields.get("payload") match { - case Some(payload) => - payload.asJsObject - case None => - throw MessageProcessException("Cannot get payload information: [" + msg + "]") - } - } - - def toJsObject(msg: String): JsObject = { - try { - JsonParser(msg).asJsObject - } catch { - case e: ParsingException => { - log.error("Cannot parse message: {}", msg) - throw MessageProcessException("Cannot parse JSON message: [" + msg + "]") - } - } - } - - def toHeaderAndJsonMessage(header: Header, message: String): HeaderAndJsonMessage = { - HeaderAndJsonMessage(header, message) - } - - def unmarshall(jsonMsg: String): Try[HeaderAndJsonMessage] = { - for { - jsonObj <- Try(toJsObject(jsonMsg)) - header <- Try(header(jsonObj)) - message = toHeaderAndJsonMessage(header, jsonMsg) - } yield message - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMessageFormatters.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMessageFormatters.scala deleted file mode 100644 index 6a992824ab..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMessageFormatters.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.MeetingIdAndName - -sealed abstract class OutMsgFormatter - -case class MeetingCreatedEventFormat(header: Header, - payload: MeetingCreatedEventPayloadFormat) -case class UserJoinResponseFormat(header: Header, - payload: UserJoinResponseFormatPayload) extends OutMsgFormatter -case class UserJoinResponseFormatPayload(meeting: MeetingIdAndName, - session: String, result: ResultFormat, - user: Option[UserFormat]) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMsgBuilderActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMsgBuilderActor.scala deleted file mode 100644 index f3ef70ec93..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/OutMsgBuilderActor.scala +++ /dev/null @@ -1,21 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } - -/** - * This Actor is responsible for building formatted messages that - * will be sent to the pubsub. - */ -object OutMsgBuilderActor { - def props(pubsubActor: ActorRef): Props = - Props(classOf[OutMsgBuilderActor], pubsubActor) -} - -class OutMsgBuilderActor private (val bbbAppsActor: ActorRef, - val messageMarshallingActor: ActorRef) extends Actor - with ActorLogging { - - def receive = { - case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/Protocol.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/Protocol.scala deleted file mode 100644 index 29e5fa498f..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/Protocol.scala +++ /dev/null @@ -1,107 +0,0 @@ -package org.bigbluebutton.endpoint - -import spray.json.{ DefaultJsonProtocol, JsValue, JsString, DeserializationException, JsonFormat } -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.protocol._ -import org.bigbluebutton.apps.Role -import org.bigbluebutton.apps.MeetingIdAndName -import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport.headerFormat - -/** JSON Conversion Protocol **/ -object UserMessagesProtocol extends DefaultJsonProtocol { - import HeaderAndPayloadJsonSupport._ - - implicit object RoleJsonFormat extends JsonFormat[Role.RoleType] { - def write(obj: Role.RoleType): JsValue = JsString(obj.toString) - - def read(json: JsValue): Role.RoleType = json match { - case JsString(str) => Role.withName(str) - case _ => throw new DeserializationException("Enum string expected") - } - } - - /* - implicit val webIdentityFormat = - jsonFormat1(WebIdentity) - implicit val callerIdFormat = - jsonFormat2(CallerId) - implicit val voiceIdentityFormat = - jsonFormat5(VoiceIdentity) -*/ - implicit val userFormat = - jsonFormat8(UserFormat) - implicit val userIdAndNameFormat = - jsonFormat2(UserIdAndName) - implicit val meetingIdAndNameFormat = - jsonFormat2(MeetingIdAndName) - implicit val userJoinRequestPayloadFormat = - jsonFormat3(UserJoinRequestPayloadFormat) - implicit val userJoinRequestMessageFormat = - jsonFormat2(UserJoinRequestFormat) - implicit val resultFormat = - jsonFormat2(ResultFormat) - implicit val userJoinResponsePayloadFormat = - jsonFormat4(UserJoinResponseFormatPayload) - implicit val userJoinResponseJsonMessageFormat = - jsonFormat2(UserJoinResponseFormat) - implicit val userLeavePayloadFormat = - jsonFormat3(UserLeavePayload) - implicit val userLeaveMessageFormat = - jsonFormat2(UserLeaveMessage) - implicit val getUsersRequestPayloadFormat = - jsonFormat3(GetUsersRequestPayload) - implicit val getUsersRequestMessageFormat = - jsonFormat2(GetUsersRequestMessage) - implicit val assignPresenterPayloadFormat = - jsonFormat4(AssignPresenterPayload) - implicit val assignPresenterMessageFormat = - jsonFormat2(AssignPresenterMessage) - implicit val durationFormat = - jsonFormat3(DurationFormat) - implicit val voiceConferenceFormat = - jsonFormat2(VoiceConferenceFormat) - implicit val phoneNumberFormat = - jsonFormat2(PhoneNumberFormat) - implicit val meetingDescriptorFormat = - jsonFormat11(MeetingDescriptorFormat) - implicit val createMeetingRequestPayloadFormat = - jsonFormat1(CreateMeetingRequestPayloadFormat) - implicit val createMeetingRequestMessageFormat = - jsonFormat2(CreateMeetingRequestFormat) - implicit val createMeetingResponsePayloadFormat = - jsonFormat4(CreateMeetingResponsePayloadFormat) - implicit val createMeetingResponseFormat = - jsonFormat2(CreateMeetingResponseFormat) - implicit val meetingCreatedEventPayloadFormat = - jsonFormat3(MeetingCreatedEventPayloadFormat) - implicit val meetingCreatedEventFormat = - jsonFormat2(MeetingCreatedEventFormat) - implicit val userDescriptorFormat = - jsonFormat8(UserDescriptorFormat) - implicit val registerUserRequestPayloadFormat = - jsonFormat3(RegisterUserRequestPayloadFormat) - implicit val registerUserRequestFormat = - jsonFormat2(RegisterUserRequestFormat) - implicit val registerUserResponsePayloadFormat = - jsonFormat5(RegisterUserResponsePayloadFormat) - implicit val registerUserResponseFormat = - jsonFormat2(RegisterUserResponseFormat) - implicit val userRegisteredEventPayloadFormat = - jsonFormat3(UserRegisteredEventPayloadFormat) - implicit val userRegisteredEventFormat = - jsonFormat2(UserRegisteredEventFormat) - implicit val statusFormat = - jsonFormat4(StatusFormat) - implicit val callerIdFormat = - jsonFormat2(CallerIdFormat) - implicit val mediaStreamFormat = - jsonFormat3(MediaStreamFormat) - implicit val joinedUserFormat = - jsonFormat12(JoinedUserFormat) - implicit val userJoinedEventPayloadFormat = - jsonFormat3(UserJoinedEventPayloadFormat) - implicit val userJoinedEventFormat = jsonFormat2(UserJoinedEventFormat) - -} - diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisPublisherActor.scala deleted file mode 100644 index 17d146942a..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisPublisherActor.scala +++ /dev/null @@ -1,45 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import akka.actor.Props -import redis.RedisClient -import scala.concurrent.duration._ -import scala.concurrent.ExecutionContext.Implicits.global -import akka.actor.ActorSystem -import scala.concurrent.Await -import akka.actor.Actor -import org.bigbluebutton.SystemConfiguration - -object AppsRedisPublisherActor extends SystemConfiguration { - - val channels = Seq("time") - val patterns = Seq("pattern.*") - - def props(system: ActorSystem): Props = - Props(classOf[AppsRedisPublisherActor], - system, redisHost, redisPort) -} - -class AppsRedisPublisherActor(val system: ActorSystem, - val host: String, val port: Int) extends Actor { - - val redis = RedisClient(host, port)(system) - - val futurePong = redis.ping() - println("Ping sent!") - futurePong.map(pong => { - println(s"Redis replied with a $pong") - }) - - Await.result(futurePong, 5 seconds) - - def publish(channel: String, msg: String) { - println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") - // redis.publish("time", System.currentTimeMillis()) - } - - def receive = { - //case msg: JsonMessage => publish(msg.channel, msg.message) - case msg: String => println("PUBLISH TO [channel]: \n [" + msg + "]") - } - -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisSubscriberActor.scala deleted file mode 100644 index 24424bc00e..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/AppsRedisSubscriberActor.scala +++ /dev/null @@ -1,41 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import akka.actor.Props -import java.net.InetSocketAddress -import redis.actors.RedisSubscriberActor -import redis.api.pubsub.{ PMessage, Message } -import scala.concurrent.duration._ -import akka.actor.ActorRef -import akka.actor.actorRef2Scala -import org.bigbluebutton.SystemConfiguration - -object AppsRedisSubscriberActor extends SystemConfiguration { - - val channels = Seq("time") - val patterns = Seq("pattern.*") - - def props(bbbAppsActor: ActorRef): Props = - Props(classOf[AppsRedisSubscriberActor], - bbbAppsActor, redisHost, redisPort, channels, patterns). - withDispatcher("rediscala.rediscala-client-worker-dispatcher") -} - -class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, - redisPort: Int, - channels: Seq[String] = Nil, patterns: Seq[String] = Nil) - extends RedisSubscriberActor( - new InetSocketAddress(redisHost, redisPort), - channels, patterns) { - - def onMessage(message: Message) { - log.debug(s"message received: $message") - } - - def onPMessage(pmessage: PMessage) { - log.debug(s"pattern message received: $pmessage") - } - - def handleMessage(msg: String) { - log.warning("**** TODO: Handle pubsub messages. ****") - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/Message.scala deleted file mode 100644 index 336601f401..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/Message.scala +++ /dev/null @@ -1,3 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -case class JsonMessage(channel: String, message: String) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/RedisPubSubActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/RedisPubSubActor.scala deleted file mode 100644 index 22bea5fde4..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/old_endpoint/redis/RedisPubSubActor.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import akka.actor.Props -import java.net.InetSocketAddress -import redis.actors.RedisSubscriberActor -import redis.api.pubsub.{ PMessage, Message } -import redis.RedisClient -import scala.concurrent.duration._ -import scala.concurrent.ExecutionContext.Implicits.global - -class RedisPubSubActor { - implicit val akkaSystem = akka.actor.ActorSystem() - - val redis = RedisClient() - - // publish after 2 seconds every 2 or 5 seconds - akkaSystem.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) - akkaSystem.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("pattern.match", "pattern value")) - // shutdown Akka in 20 seconds - akkaSystem.scheduler.scheduleOnce(20 seconds)(akkaSystem.shutdown()) - - val channels = Seq("time") - val patterns = Seq("pattern.*") - // create SubscribeActor instance - akkaSystem.actorOf(Props(classOf[SubscribeActor], channels, patterns).withDispatcher("rediscala.rediscala-client-worker-dispatcher")) - -} - -class SubscribeActor(channels: Seq[String] = Nil, patterns: Seq[String] = Nil) - extends RedisSubscriberActor(new InetSocketAddress("localhost", 6379), channels, patterns) { - - def onMessage(message: Message) { - println(s"message received: $message") - } - - def onPMessage(pmessage: PMessage) { - println(s"pattern message received: $pmessage") - } -} \ No newline at end of file From 75c2a352e8e7831a94d1c9ff8a927449e142e303 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 15:52:50 +0000 Subject: [PATCH 15/30] - cleanup --- .../redis/MeetingMessageHandler.java | 112 ---------- .../service/chat/ChatKeyUtil.java | 13 -- .../service/chat/ChatMessageListener.java | 78 ------- .../service/layout/LayoutApplication.java | 45 ---- .../service/messaging/Constants.java | 96 --------- .../messaging/CreateMeetingMessage.java | 37 ---- .../messaging/DestroyMeetingMessage.java | 12 -- .../service/messaging/EndMeetingMessage.java | 12 -- .../messaging/GetAllMeetingsRequest.java | 12 -- .../service/messaging/IMessage.java | 5 - .../service/messaging/KeepAliveMessage.java | 12 -- .../service/messaging/MessageBuilder.java | 36 ---- .../messaging/MessageFromJsonConverter.java | 89 -------- .../service/messaging/MessagingConstants.java | 59 ----- .../service/messaging/MessagingService.java | 27 --- .../messaging/RegisterUserMessage.java | 73 ------- .../messaging/UserConnectedToGlobalAudio.java | 59 ----- .../UserDisconnectedFromGlobalAudio.java | 56 ----- .../messaging/ValidateAuthTokenMessage.java | 20 -- .../messaging/redis/MessageDistributor.java | 25 --- .../messaging/redis/MessageHandler.java | 23 -- .../messaging/redis/MessageReceiver.java | 85 -------- .../messaging/redis/MessageSender.java | 70 ------ .../messaging/redis/MessageToSend.java | 19 -- .../messaging/redis/ReceivedMessage.java | 28 --- .../redis/ReceivedMessageHandler.java | 68 ------ .../ConversionUpdatesProcessor.java | 56 ----- .../PresentationMessageListener.java | 147 ------------- .../presentation/PreuploadedPresentation.java | 12 -- .../PreuploadedPresentationsUtil.java | 55 ----- .../GenericObjectPoolConfigWrapper.java | 142 ------------ .../service/recorder/RecordEvent.java | 85 -------- .../service/recorder/Recorder.java | 35 --- .../service/recorder/RecorderApplication.java | 105 --------- .../service/recorder/RedisDispatcher.java | 53 ----- .../chat/AbstractChatRecordEvent.java | 28 --- .../recorder/chat/PublicChatRecordEvent.java | 43 ---- .../AbstractParticipantRecordEvent.java | 28 --- .../AssignPresenterRecordEvent.java | 39 ---- .../ParticipantEndAndKickAllRecordEvent.java | 27 --- .../ParticipantJoinRecordEvent.java | 47 ---- .../ParticipantLeftRecordEvent.java | 32 --- .../ParticipantStatusChangeRecordEvent.java | 39 ---- .../participants/RecordStatusRecordEvent.java | 35 --- .../polling/AbstractPollRecordEvent.java | 29 --- .../polling/PollClearedRecordEvent.java | 35 --- .../polling/PollCreatedRecordEvent.java | 66 ------ .../polling/PollRemovedRecordEvent.java | 37 ---- .../polling/PollStartedRecordEvent.java | 35 --- .../polling/PollStoppedRecordEvent.java | 35 --- .../polling/PollUpdatedRecordEvent.java | 60 ------ .../AbstractPresentationRecordEvent.java | 28 --- ...rsionCompletedPresentationRecordEvent.java | 40 ---- .../presentation/CursorUpdateRecordEvent.java | 36 ---- .../GenerateSlidePresentationRecordEvent.java | 40 ---- .../GotoSlidePresentationRecordEvent.java | 81 ------- ...vePresentationPresentationRecordEvent.java | 33 --- ...zeAndMoveSlidePresentationRecordEvent.java | 72 ------- ...rePresentationPresentationRecordEvent.java | 40 ---- .../service/voice/VoiceKeyUtil.java | 6 - .../service/voice/VoiceMessageListener.java | 50 ----- .../service/whiteboard/WhiteboardKeyUtil.java | 16 -- .../whiteboard/WhiteboardListener.java | 51 ----- .../redis/AbstractWhiteboardRecordEvent.java | 46 ---- .../redis/AddShapeWhiteboardRecordEvent.java | 69 ------ .../redis/AddTextWhiteboardRecordEvent.java | 54 ----- .../redis/ClearPageWhiteboardRecordEvent.java | 28 --- .../ModifyTextWhiteboardRecordEvent.java | 53 ----- .../ToggleGridWhiteboardRecordEvent.java | 33 --- .../redis/UndoShapeWhiteboardRecordEvent.java | 32 --- .../old_core/api/IBigBlueButtonInGW.java | 119 ---------- .../old_core/api/IDispatcher.java | 6 - .../old_core/api/IOutMessage.java | 5 - .../old_core/api/MessageOutGateway.java | 21 -- .../old_core/api/OutMessageListener2.java | 6 - .../old_core/api/RedisLpushDispatcher.java | 66 ------ .../old_service/recording/RecordMessage.java | 5 - .../recording/RedisListRecorder.java | 73 ------- .../voice/AbstractVoiceRecordEvent.java | 32 --- .../voice/ConferenceServerListener.java | 26 --- .../voice/ConferenceServiceProvider.java | 28 --- .../FreeswitchConferenceEventListener.java | 115 ---------- .../voice/IVoiceConferenceService.java | 13 -- .../ParticipantJoinedVoiceRecordEvent.java | 51 ----- .../ParticipantLeftVoiceRecordEvent.java | 31 --- .../ParticipantLockedVoiceRecordEvent.java | 35 --- .../ParticipantMutedVoiceRecordEvent.java | 35 --- .../ParticipantTalkingVoiceRecordEvent.java | 36 ---- .../voice/StartRecordingVoiceRecordEvent.java | 38 ---- .../voice/VoiceEventRecorder.java | 141 ------------ .../voice/commands/ConferenceCommand.java | 40 ---- .../commands/ConferenceCommandResult.java | 56 ----- .../commands/EjectParticipantCommand.java | 34 --- .../commands/GetParticipantsCommand.java | 27 --- .../commands/MuteParticipantCommand.java | 40 ---- .../voice/events/ConferenceEventListener.java | 25 --- .../voice/events/UnknownConferenceEvent.java | 27 --- .../voice/events/VoiceConferenceEvent.java | 32 --- .../events/VoiceStartRecordingEvent.java | 51 ----- .../voice/events/VoiceUserJoinedEvent.java | 70 ------ .../voice/events/VoiceUserLeftEvent.java | 33 --- .../voice/events/VoiceUserLockedEvent.java | 40 ---- .../voice/events/VoiceUserMutedEvent.java | 40 ---- .../voice/events/VoiceUserTalkingEvent.java | 40 ---- .../voice/freeswitch/ConnectionManager.java | 154 ------------- .../voice/freeswitch/ESLEventListener.java | 204 ------------------ .../freeswitch/FreeswitchApplication.java | 202 ----------------- .../actions/BroadcastConferenceCommand.java | 50 ----- .../actions/EjectAllUsersCommand.java | 31 --- .../actions/EjectParticipantCommand.java | 34 --- .../freeswitch/actions/FreeswitchCommand.java | 45 ---- .../actions/MuteParticipantCommand.java | 40 ---- .../actions/PopulateRoomCommand.java | 116 ---------- .../actions/RecordConferenceCommand.java | 50 ----- .../freeswitch/response/ConferenceMember.java | 88 -------- .../response/ConferenceMemberFlags.java | 54 ----- .../XMLResponseConferenceListParser.java | 160 -------------- 117 files changed, 5949 deletions(-) delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/meeting/messaging/redis/MeetingMessageHandler.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatKeyUtil.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatMessageListener.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/layout/LayoutApplication.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/Constants.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/CreateMeetingMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/DestroyMeetingMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/EndMeetingMessage.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/GetAllMeetingsRequest.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/IMessage.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/KeepAliveMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageBuilder.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageFromJsonConverter.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingConstants.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingService.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/RegisterUserMessage.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserConnectedToGlobalAudio.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserDisconnectedFromGlobalAudio.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/ValidateAuthTokenMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageDistributor.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageHandler.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageReceiver.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageSender.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageToSend.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessageHandler.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/ConversionUpdatesProcessor.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PresentationMessageListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentation.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentationsUtil.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/GenericObjectPoolConfigWrapper.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/Recorder.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecorderApplication.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RedisDispatcher.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/AbstractChatRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/PublicChatRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AbstractParticipantRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AssignPresenterRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantJoinRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantLeftRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/RecordStatusRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/AbstractPollRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollClearedRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollCreatedRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollRemovedRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStartedRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStoppedRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollUpdatedRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/AbstractPresentationRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/CursorUpdateRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceKeyUtil.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceMessageListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardKeyUtil.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardListener.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IBigBlueButtonInGW.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IDispatcher.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IOutMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/MessageOutGateway.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/OutMessageListener2.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/RedisLpushDispatcher.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RecordMessage.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RedisListRecorder.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/AbstractVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServerListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServiceProvider.java delete mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/FreeswitchConferenceEventListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/IVoiceConferenceService.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantJoinedVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLeftVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLockedVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantMutedVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantTalkingVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/StartRecordingVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/VoiceEventRecorder.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommandResult.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/EjectParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/GetParticipantsCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/MuteParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/ConferenceEventListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/UnknownConferenceEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceConferenceEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceStartRecordingEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserJoinedEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLeftEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLockedEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserMutedEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserTalkingEvent.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ConnectionManager.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ESLEventListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/FreeswitchApplication.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectAllUsersCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/FreeswitchCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/MuteParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/PopulateRoomCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/RecordConferenceCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMember.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMemberFlags.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/meeting/messaging/redis/MeetingMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/meeting/messaging/redis/MeetingMessageHandler.java deleted file mode 100755 index a98e4f430c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/meeting/messaging/redis/MeetingMessageHandler.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.bigbluebutton.conference.meeting.messaging.redis; - -import java.util.HashMap; -import java.util.Map; -import org.bigbluebutton.conference.service.messaging.CreateMeetingMessage; -import org.bigbluebutton.conference.service.messaging.DestroyMeetingMessage; -import org.bigbluebutton.conference.service.messaging.EndMeetingMessage; -import org.bigbluebutton.conference.service.messaging.IMessage; -import org.bigbluebutton.conference.service.messaging.KeepAliveMessage; -import org.bigbluebutton.conference.service.messaging.MessageFromJsonConverter; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.RegisterUserMessage; -import org.bigbluebutton.conference.service.messaging.UserConnectedToGlobalAudio; -import org.bigbluebutton.conference.service.messaging.UserDisconnectedFromGlobalAudio; -import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage; -import org.bigbluebutton.conference.service.messaging.GetAllMeetingsRequest; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import com.google.gson.Gson; - -public class MeetingMessageHandler implements MessageHandler { - - private IBigBlueButtonInGW bbbGW; - - @Override - public void handleMessage(String pattern, String channel, String message) { -// System.out.println("Checking message: " + pattern + " " + channel + " " + message); - if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { -// System.out.println("Meeting message: " + channel + " " + message); - IMessage msg = MessageFromJsonConverter.convert(message); - - if (msg != null) { - if (msg instanceof EndMeetingMessage) { - EndMeetingMessage emm = (EndMeetingMessage) msg; -// log.info("Received end meeting request. Meeting id [{}]", emm.meetingId); - bbbGW.endMeeting(emm.meetingId); - } else if (msg instanceof CreateMeetingMessage) { - CreateMeetingMessage emm = (CreateMeetingMessage) msg; -// log.info("Received create meeting request. Meeting id [{}]", emm.id); - bbbGW.createMeeting2(emm.id, emm.externalId, emm.name, emm.record, emm.voiceBridge, - emm.duration, emm.autoStartRecording, emm.allowStartStopRecording, - emm.moderatorPass, emm.viewerPass, emm.createTime, emm.createDate); - } else if (msg instanceof RegisterUserMessage) { - RegisterUserMessage emm = (RegisterUserMessage) msg; -// log.info("Received register user request. Meeting id [{}], userid=[{}], token=[{}]", emm.meetingID, emm.internalUserId, emm.authToken); - bbbGW.registerUser(emm.meetingID, emm.internalUserId, emm.fullname, emm.role, emm.externUserID, emm.authToken); - } else if (msg instanceof DestroyMeetingMessage) { - DestroyMeetingMessage emm = (DestroyMeetingMessage) msg; -// log.info("Received destroy meeting request. Meeting id [{}]", emm.meetingId); - bbbGW.destroyMeeting(emm.meetingId); - } else if (msg instanceof ValidateAuthTokenMessage) { - ValidateAuthTokenMessage emm = (ValidateAuthTokenMessage) msg; -// log.info("Received ValidateAuthTokenMessage token request. Meeting id [{}]", emm.meetingId); -// log.warn("TODO: Need to pass sessionId on ValidateAuthTokenMessage message."); - String sessionId = "tobeimplemented"; - bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo, sessionId); - } else if (msg instanceof UserConnectedToGlobalAudio) { - UserConnectedToGlobalAudio emm = (UserConnectedToGlobalAudio) msg; - - Map logData = new HashMap(); - logData.put("voiceConf", emm.voiceConf); - logData.put("userId", emm.userid); - logData.put("username", emm.name); - logData.put("event", "user_connected_to_global_audio"); - logData.put("description", "User connected to global audio."); - - Gson gson = new Gson(); - String logStr = gson.toJson(logData); - -// log.info("User connected to global audio: data={}", logStr); - - bbbGW.userConnectedToGlobalAudio(emm.voiceConf, emm.userid, emm.name); - } else if (msg instanceof UserDisconnectedFromGlobalAudio) { - UserDisconnectedFromGlobalAudio emm = (UserDisconnectedFromGlobalAudio) msg; - - Map logData = new HashMap(); - logData.put("voiceConf", emm.voiceConf); - logData.put("userId", emm.userid); - logData.put("username", emm.name); - logData.put("event", "user_disconnected_from_global_audio"); - logData.put("description", "User disconnected from global audio."); - - Gson gson = new Gson(); - String logStr = gson.toJson(logData); - -// log.info("User disconnected from global audio: data={}", logStr); - bbbGW.userDisconnectedFromGlobalAudio(emm.voiceConf, emm.userid, emm.name); - } - else if (msg instanceof GetAllMeetingsRequest) { - GetAllMeetingsRequest emm = (GetAllMeetingsRequest) msg; -// log.info("Received GetAllMeetingsRequest"); - bbbGW.getAllMeetings("no_need_of_a_meeting_id"); - } - } - } else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) { - IMessage msg = MessageFromJsonConverter.convert(message); - - if (msg != null) { - if (msg instanceof KeepAliveMessage) { - KeepAliveMessage emm = (KeepAliveMessage) msg; -// log.debug("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId); - bbbGW.isAliveAudit(emm.keepAliveId); - } - } - } - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { - this.bbbGW = bbbGW; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatKeyUtil.java deleted file mode 100755 index babdde091d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatKeyUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.conference.service.chat; - -public class ChatKeyUtil { - public static final String CHAT_TYPE = "chatType"; - public static final String FROM_USERID = "fromUserID"; - public static final String FROM_USERNAME = "fromUsername"; - public static final String FROM_COLOR = "fromColor"; - public static final String FROM_TIME = "fromTime"; - public static final String FROM_TZ_OFFSET = "fromTimezoneOffset"; - public static final String TO_USERID = "toUserID"; - public static final String TO_USERNAME = "toUsername"; - public static final String MESSAGE = "message"; -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatMessageListener.java deleted file mode 100755 index 6c0b78acb1..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/chat/ChatMessageListener.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.bigbluebutton.conference.service.chat; - -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import com.google.gson.JsonParser; -import com.google.gson.JsonObject; - -import java.util.Map; -import java.util.HashMap; - -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - -public class ChatMessageListener implements MessageHandler{ - - private IBigBlueButtonInGW bbbGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { - this.bbbGW = bbbGW; - } - - @Override - public void handleMessage(String pattern, String channel, String message) { - if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_CHANNEL)) { - - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - JsonObject headerObject = (JsonObject) obj.get("header"); - JsonObject payloadObject = (JsonObject) obj.get("payload"); - JsonObject messageObject = (JsonObject) payloadObject.get("message"); - - String eventName = headerObject.get("name").toString(); - eventName = eventName.replace("\"", ""); - - if (eventName.equalsIgnoreCase(MessagingConstants.SEND_PUBLIC_CHAT_MESSAGE_REQUEST) || - eventName.equalsIgnoreCase(MessagingConstants.SEND_PRIVATE_CHAT_MESSAGE_REQUEST)){ - - String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); - String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); - - //case getChatHistory - if(eventName.equalsIgnoreCase("get_chat_history")) { - String replyTo = meetingID + "/" + requesterID; - bbbGW.getChatHistory(meetingID, requesterID, replyTo); - } - else { - String chatType = messageObject.get("chat_type").toString().replace("\"", ""); - String fromUserID = messageObject.get("from_userid").toString().replace("\"", ""); - String fromUsername = messageObject.get("from_username").toString().replace("\"", ""); - String fromColor = messageObject.get("from_color").toString().replace("\"", ""); - String fromTime = messageObject.get("from_time").toString().replace("\"", ""); - String fromTimezoneOffset = messageObject.get("from_tz_offset").toString().replace("\"", ""); - String toUserID = messageObject.get("to_userid").toString().replace("\"", ""); - String toUsername = messageObject.get("to_username").toString().replace("\"", ""); - String tempChat = messageObject.get("message").toString(); - String chatText = tempChat.substring(1, tempChat.length() - 1).replace("\\\"", "\""); - - Map map = new HashMap(); - map.put(ChatKeyUtil.CHAT_TYPE, chatType); - map.put(ChatKeyUtil.FROM_USERID, fromUserID); - map.put(ChatKeyUtil.FROM_USERNAME, fromUsername); - map.put(ChatKeyUtil.FROM_COLOR, fromColor); - map.put(ChatKeyUtil.FROM_TIME, fromTime); - map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset); - map.put(ChatKeyUtil.TO_USERID, toUserID); - map.put(ChatKeyUtil.TO_USERNAME, toUsername); - map.put(ChatKeyUtil.MESSAGE, chatText); - - if(eventName.equalsIgnoreCase(MessagingConstants.SEND_PUBLIC_CHAT_MESSAGE_REQUEST)) { - bbbGW.sendPublicMessage(meetingID, requesterID, map); - } - else if(eventName.equalsIgnoreCase(MessagingConstants.SEND_PRIVATE_CHAT_MESSAGE_REQUEST)) { - bbbGW.sendPrivateMessage(meetingID, requesterID, map); - } - } - } - } - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/layout/LayoutApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/layout/LayoutApplication.java deleted file mode 100644 index ea62ccfee6..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/layout/LayoutApplication.java +++ /dev/null @@ -1,45 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.layout; - -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - -import scala.Option; - -public class LayoutApplication { - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - public void broadcastLayout(String meetingID, String requesterID, String layout) { - bbbInGW.broadcastLayout(meetingID, requesterID, layout); - } - - public void lockLayout(String meetingId, String setById, - Boolean lock, Boolean viewersOnly, - Option layout) { - bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout); - } - - public void getCurrentLayout(String meetingID, String requesterID) { - bbbInGW.getCurrentLayout(meetingID, requesterID); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/Constants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/Constants.java deleted file mode 100644 index 8b324b248c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/Constants.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class Constants { - public static final String NAME = "name"; - public static final String HEADER = "header"; - public static final String PAYLOAD = "payload"; - public static final String MEETING_ID = "meeting_id"; - public static final String EXTERNAL_MEETING_ID = "external_meeting_id"; - public static final String TIMESTAMP = "timestamp"; - public static final String USER_ID = "userid"; - public static final String RECORDED = "recorded"; - public static final String MEETING_NAME = "meeting_name"; - public static final String VOICE_CONF = "voice_conf"; - public static final String DURATION = "duration"; - public static final String AUTH_TOKEN = "auth_token"; - public static final String ROLE = "role"; - public static final String EXT_USER_ID = "external_user_id"; - public static final String REQUESTER_ID = "requester_id"; - public static final String REPLY_TO = "reply_to"; - public static final String LOWERED_BY = "lowered_by"; - public static final String STREAM = "stream"; - public static final String LOCKED = "locked"; - public static final String SETTINGS = "settings"; - public static final String LOCK = "lock"; - public static final String EXCEPT_USERS = "except_users"; - public static final String STATUS = "status"; - public static final String VALUE = "value"; - public static final String NEW_PRESENTER_ID = "new_presenter_id"; - public static final String NEW_PRESENTER_NAME = "new_presenter_name"; - public static final String ASSIGNED_BY = "assigned_by"; - public static final String RECORDING = "recording"; - public static final String AUTO_START_RECORDING = "auto_start_recording"; - public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording"; - public static final String LAYOUT_ID = "layout_id"; - public static final String POLL = "poll"; - public static final String POLL_ID = "poll_id"; - public static final String FORCE = "force"; - public static final String RESPONSE = "response"; - public static final String PRESENTATION_ID = "presentation_id"; - public static final String X_OFFSET = "x_offset"; - public static final String Y_OFFSET = "y_offset"; - public static final String WIDTH_RATIO = "width_ratio"; - public static final String HEIGHT_RATIO = "height_ratio"; - public static final String PAGE = "page"; - public static final String SHARE = "share"; - public static final String PRESENTATIONS = "presentations"; - public static final String MESSAGE_KEY = "message_key"; - public static final String CODE = "code"; - public static final String PRESENTATION_NAME = "presentation_name"; - public static final String NUM_PAGES = "num_pages"; - public static final String MAX_NUM_PAGES = "max_num_pages"; - public static final String PAGES_COMPLETED = "pages_completed"; - public static final String MUTE = "mute"; - public static final String CALLER_ID_NUM = "caller_id_num"; - public static final String CALLER_ID_NAME = "caller_id_name"; - public static final String TALKING = "talking"; - public static final String USER = "user"; - public static final String MUTED = "muted"; - public static final String VOICE_USER = "voice_user"; - public static final String RECORDING_FILE = "recording_file"; - public static final String ANNOTATION = "annotation"; - public static final String WHITEBOARD_ID = "whiteboard_id"; - public static final String ENABLE = "enable"; - public static final String PRESENTER = "presenter"; - public static final String USERS = "users"; - public static final String RAISE_HAND = "raise_hand"; - public static final String HAS_STREAM = "has_stream"; - public static final String WEBCAM_STREAM = "webcam_stream"; - public static final String PHONE_USER = "phone_user"; - public static final String PERMISSIONS = "permissions"; - public static final String VALID = "valid"; - public static final String CHAT_HISTORY = "chat_history"; - public static final String MESSAGE = "message"; - public static final String SET_BY_USER_ID = "set_by_user_id"; - public static final String POLLS = "polls"; - public static final String REASON = "reason"; - public static final String RESPONDER = "responder"; - public static final String PRESENTATION_INFO = "presentation_info"; - public static final String SHAPES = "shapes"; - public static final String SHAPE = "shape"; - public static final String SHAPE_ID = "shape_id"; - public static final String PRESENTATION = "presentation"; - public static final String ID = "id"; - public static final String CURRENT = "current"; - public static final String PAGES = "pages"; - public static final String WEB_USER_ID = "web_user_id"; - public static final String JOINED = "joined"; - public static final String X_PERCENT = "x_percent"; - public static final String Y_PERCENT = "y_percent"; - public static final String KEEP_ALIVE_ID = "keep_alive_id"; - public static final String INTERNAL_USER_ID = "internal_user_id"; - public static final String MODERATOR_PASS = "moderator_pass"; - public static final String VIEWER_PASS = "viewer_pass"; - public static final String CREATE_TIME = "create_time"; - public static final String CREATE_DATE = "create_date"; -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/CreateMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/CreateMeetingMessage.java deleted file mode 100644 index 4db244c13d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/CreateMeetingMessage.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class CreateMeetingMessage implements IMessage { - public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; - public static final String VERSION = "0.0.1"; - - public final String id; - public final String externalId; - public final String name; - public final Boolean record; - public final String voiceBridge; - public final Long duration; - public final Boolean autoStartRecording; - public final Boolean allowStartStopRecording; - public final String moderatorPass; - public final String viewerPass; - public final Long createTime; - public final String createDate; - - public CreateMeetingMessage(String id, String externalId, String name, Boolean record, String voiceBridge, - Long duration, Boolean autoStartRecording, - Boolean allowStartStopRecording, String moderatorPass, - String viewerPass, Long createTime, String createDate) { - this.id = id; - this.externalId = externalId; - this.name = name; - this.record = record; - this.voiceBridge = voiceBridge; - this.duration = duration; - this.autoStartRecording = autoStartRecording; - this.allowStartStopRecording = allowStartStopRecording; - this.moderatorPass = moderatorPass; - this.viewerPass = viewerPass; - this.createTime = createTime; - this.createDate = createDate; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/DestroyMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/DestroyMeetingMessage.java deleted file mode 100755 index 01106c1730..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/DestroyMeetingMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class DestroyMeetingMessage implements IMessage { - public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - - public DestroyMeetingMessage(String meetingId) { - this.meetingId = meetingId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/EndMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/EndMeetingMessage.java deleted file mode 100755 index 3a02401421..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/EndMeetingMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class EndMeetingMessage implements IMessage { - public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - - public EndMeetingMessage(String meetingId) { - this.meetingId = meetingId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/GetAllMeetingsRequest.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/GetAllMeetingsRequest.java deleted file mode 100644 index baa1cd4099..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/GetAllMeetingsRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class GetAllMeetingsRequest implements IMessage { - public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - - public GetAllMeetingsRequest(String meetingId) { - this.meetingId = meetingId; - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/IMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/IMessage.java deleted file mode 100755 index 2414f55a30..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/IMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public interface IMessage { - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/KeepAliveMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/KeepAliveMessage.java deleted file mode 100644 index 6cebf71a4a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/KeepAliveMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class KeepAliveMessage implements IMessage { - public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; - public static final String VERSION = "0.0.1"; - - public final String keepAliveId; - - public KeepAliveMessage(String keepAliveId) { - this.keepAliveId = keepAliveId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageBuilder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageBuilder.java deleted file mode 100755 index 2137a063b5..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageBuilder.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.concurrent.TimeUnit; - -import com.google.gson.Gson; - -public class MessageBuilder { - public final static String VERSION = "version"; - - public static long generateTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - public static java.util.HashMap buildHeader(String name, String version, String replyTo) { - java.util.HashMap header = new java.util.HashMap(); - header.put(Constants.NAME, name); - header.put(VERSION, version); - header.put(Constants.TIMESTAMP, generateTimestamp()); - if (replyTo != null && replyTo != "") - header.put(Constants.REPLY_TO, replyTo); - - return header; - } - - - public static String buildJson(java.util.HashMap header, - java.util.HashMap payload) { - - java.util.HashMap> message = new java.util.HashMap>(); - message.put(Constants.HEADER, header); - message.put(Constants.PAYLOAD, payload); - - Gson gson = new Gson(); - return gson.toJson(message); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageFromJsonConverter.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageFromJsonConverter.java deleted file mode 100755 index 4efc79d5dc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessageFromJsonConverter.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class MessageFromJsonConverter { - - public static IMessage convert(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - switch (messageName) { - case CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT: - return processCreateMeeting(payload); - case DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT: - return processDestroyMeeting(payload); - case EndMeetingMessage.END_MEETING_REQUEST_EVENT: - return processEndMeetingMessage(payload); - case KeepAliveMessage.KEEP_ALIVE_REQUEST: - return processKeepAlive(payload); - case RegisterUserMessage.REGISTER_USER: - System.out.println("Registering a user"); - return RegisterUserMessage.fromJson(message); - case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN: - return processValidateAuthTokenMessage(header, payload); - case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO: - return UserConnectedToGlobalAudio.fromJson(message); - case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO: - return UserDisconnectedFromGlobalAudio.fromJson(message); - case GetAllMeetingsRequest.GET_ALL_MEETINGS_REQUEST_EVENT: - return new GetAllMeetingsRequest("the_string_is_not_used_anywhere"); - } - } - } - return null; - } - - private static IMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - String userid = payload.get(Constants.USER_ID).getAsString(); - String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); - String replyTo = header.get(Constants.REPLY_TO).getAsString(); - String sessionId = "tobeimplemented"; - return new ValidateAuthTokenMessage(id, userid, authToken, replyTo, - sessionId); - } - - private static IMessage processCreateMeeting(JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString(); - String name = payload.get(Constants.NAME).getAsString(); - Boolean record = payload.get(Constants.RECORDED).getAsBoolean(); - String voiceBridge = payload.get(Constants.VOICE_CONF).getAsString(); - Long duration = payload.get(Constants.DURATION).getAsLong(); - Boolean autoStartRecording = payload.get(Constants.AUTO_START_RECORDING).getAsBoolean(); - Boolean allowStartStopRecording = payload.get(Constants.ALLOW_START_STOP_RECORDING).getAsBoolean(); - String moderatorPassword = payload.get(Constants.MODERATOR_PASS).getAsString(); - String viewerPassword = payload.get(Constants.VIEWER_PASS).getAsString(); - Long createTime = payload.get(Constants.CREATE_TIME).getAsLong(); - String createDate = payload.get(Constants.CREATE_DATE).getAsString(); - - return new CreateMeetingMessage(id, externalId, name, record, voiceBridge, - duration, autoStartRecording, allowStartStopRecording, - moderatorPassword, viewerPassword, createTime, createDate); - } - - private static IMessage processDestroyMeeting(JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - return new DestroyMeetingMessage(id); - } - - private static IMessage processEndMeetingMessage(JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - return new EndMeetingMessage(id); - } - - private static IMessage processKeepAlive(JsonObject payload) { - String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString(); - return new KeepAliveMessage(id); - } - - //private static IMessage processGetAllMeetings(JsonObject) -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingConstants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingConstants.java deleted file mode 100644 index 7e6a0258b9..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingConstants.java +++ /dev/null @@ -1,59 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.messaging; - -public class MessagingConstants { - - public static final String FROM_BBB_APPS_CHANNEL = "bigbluebutton:from-bbb-apps"; - public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*"; - public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system"; - public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting"; - public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation"; - public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling"; - public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users"; - public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat"; - public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard"; - - public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps"; - public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*"; - public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting"; - public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system"; - public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation"; - public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling"; - public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users"; - public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat"; - public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; - public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; - - public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent"; - public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent"; - public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent"; - public static final String MEETING_STARTED_EVENT = "meeting_created_message"; - public static final String MEETING_ENDED_EVENT = "meeting_ended_event"; - public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event"; - public static final String USER_JOINED_EVENT = "UserJoinedEvent"; - public static final String USER_LEFT_EVENT = "UserLeftEvent"; - public static final String USER_LEFT_VOICE_REQUEST = "user_left_voice_request"; - public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; - public static final String SEND_POLLS_EVENT = "SendPollsEvent"; - public static final String RECORD_STATUS_EVENT = "RecordStatusEvent"; - public static final String SEND_PUBLIC_CHAT_MESSAGE_REQUEST = "send_public_chat_message_request"; - public static final String SEND_PRIVATE_CHAT_MESSAGE_REQUEST = "send_private_chat_message_request"; - public static final String MUTE_USER_REQUEST = "mute_user_request"; -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingService.java deleted file mode 100755 index 8721b188ca..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/MessagingService.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.messaging; - -import redis.clients.jedis.Jedis; - -public interface MessagingService { - public void send(String channel, String message); - public Jedis createRedisClient(); - public void dropRedisClient(Jedis jedis); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/RegisterUserMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/RegisterUserMessage.java deleted file mode 100644 index 9e7dfe5259..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/RegisterUserMessage.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class RegisterUserMessage implements IMessage { - public static final String REGISTER_USER = "register_user_request"; - public final String VERSION = "0.0.1"; - - public final String meetingID; - public final String internalUserId; - public final String fullname; - public final String role; - public final String externUserID; - public final String authToken; - - public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) { - this.meetingID = meetingID; - this.internalUserId = internalUserId; - this.fullname = fullname; - this.role = role; - this.externUserID = externUserID; - this.authToken = authToken; - } - - public String toJson() { - HashMap payload = new HashMap(); - - payload.put(Constants.MEETING_ID, meetingID); - payload.put(Constants.INTERNAL_USER_ID, internalUserId); - payload.put(Constants.NAME, fullname); - payload.put(Constants.ROLE, role); - payload.put(Constants.EXT_USER_ID, externUserID); - payload.put(Constants.AUTH_TOKEN, authToken); - - java.util.HashMap header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - public static RegisterUserMessage fromJson(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (REGISTER_USER.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.NAME) - && payload.has(Constants.ROLE) - && payload.has(Constants.EXT_USER_ID) - && payload.has(Constants.AUTH_TOKEN)) { - - String meetingID = payload.get(Constants.MEETING_ID).getAsString(); - String fullname = payload.get(Constants.NAME).getAsString(); - String role = payload.get(Constants.ROLE).getAsString(); - String externUserID = payload.get(Constants.EXT_USER_ID).getAsString(); - String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); - - //use externalUserId twice - once for external, once for internal - return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken); - } - } - } - } - System.out.println("Failed to parse RegisterUserMessage"); - return null; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserConnectedToGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserConnectedToGlobalAudio.java deleted file mode 100644 index 3ae49d0faf..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserConnectedToGlobalAudio.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.HashMap; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class UserConnectedToGlobalAudio implements IMessage { - public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio"; - public static final String VERSION = "0.0.1"; - - public final String voiceConf; - public final String name; - public final String userid; - - - - public UserConnectedToGlobalAudio(String voiceConf, String userid, String name) { - this.voiceConf = voiceConf; - this.userid = userid; - this.name = name; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.VOICE_CONF, voiceConf); - payload.put(Constants.USER_ID, userid); - payload.put(Constants.NAME, name); - - java.util.HashMap header = MessageBuilder.buildHeader(USER_CONNECTED_TO_GLOBAL_AUDIO, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - - public static UserConnectedToGlobalAudio fromJson(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (USER_CONNECTED_TO_GLOBAL_AUDIO.equals(messageName)) { - if (payload.has(Constants.VOICE_CONF) - && payload.has(Constants.USER_ID) - && payload.has(Constants.NAME)) { - String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); - String userid = payload.get(Constants.USER_ID).getAsString(); - String name = payload.get(Constants.NAME).getAsString(); - return new UserConnectedToGlobalAudio(voiceConf, userid, name); - } - } - } - } - return null; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserDisconnectedFromGlobalAudio.java deleted file mode 100755 index 314e0a798d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/UserDisconnectedFromGlobalAudio.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class UserDisconnectedFromGlobalAudio implements IMessage { - public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio"; - public static final String VERSION = "0.0.1"; - - public final String voiceConf; - public final String name; - public final String userid; - - public UserDisconnectedFromGlobalAudio(String voiceConf, String userid, String name) { - this.voiceConf = voiceConf; - this.userid = userid; - this.name = name; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.VOICE_CONF, voiceConf); - payload.put(Constants.USER_ID, userid); - payload.put(Constants.NAME, name); - - java.util.HashMap header = MessageBuilder.buildHeader(USER_DISCONNECTED_FROM_GLOBAL_AUDIO, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - - public static UserDisconnectedFromGlobalAudio fromJson(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (USER_DISCONNECTED_FROM_GLOBAL_AUDIO.equals(messageName)) { - if (payload.has(Constants.VOICE_CONF) - && payload.has(Constants.USER_ID) - && payload.has(Constants.NAME)) { - String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); - String userid = payload.get(Constants.USER_ID).getAsString(); - String name = payload.get(Constants.NAME).getAsString(); - return new UserDisconnectedFromGlobalAudio(voiceConf, userid, name); - } - } - } - } - return null; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/ValidateAuthTokenMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/ValidateAuthTokenMessage.java deleted file mode 100755 index 3f036d96dc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/ValidateAuthTokenMessage.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class ValidateAuthTokenMessage implements IMessage { - public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - public final String userId; - public final String token; - public final String replyTo; - public final String sessionId; - - public ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo, String sessionId) { - this.meetingId = meetingId; - this.userId = userId; - this.token = token; - this.replyTo = replyTo; - this.sessionId = sessionId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageDistributor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageDistributor.java deleted file mode 100755 index d8518438ea..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageDistributor.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.Set; - -public class MessageDistributor { - private ReceivedMessageHandler handler; - private Set listeners; - - public void setMessageListeners(Set listeners) { - this.listeners = listeners; - } - - public void setMessageHandler(ReceivedMessageHandler handler) { - this.handler = handler; - if (handler != null) { - handler.setMessageDistributor(this); - } - } - - public void notifyListeners(String pattern, String channel, String message) { - for (MessageHandler listener : listeners) { - listener.handleMessage(pattern, channel, message); - } - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageHandler.java deleted file mode 100755 index 64e25cb510..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.messaging.redis; - -public interface MessageHandler { - void handleMessage(String pattern, String channel, String message); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageReceiver.java deleted file mode 100755 index b051b9e86b..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageReceiver.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPubSub; - -public class MessageReceiver { - private ReceivedMessageHandler handler; - - private JedisPool redisPool; - private volatile boolean receiveMessage = false; - - private final Executor msgReceiverExec = Executors.newSingleThreadExecutor(); - - public void stop() { - receiveMessage = false; - } - - public void start() { -// log.info("Ready to receive messages from Redis pubsub."); - try { - receiveMessage = true; - final Jedis jedis = redisPool.getResource(); - - Runnable messageReceiver = new Runnable() { - public void run() { - if (receiveMessage) { - jedis.psubscribe(new PubSubListener(), MessagingConstants.TO_BBB_APPS_PATTERN); - } - } - }; - msgReceiverExec.execute(messageReceiver); - } catch (Exception e) { -// log.error("Error subscribing to channels: " + e.getMessage()); - } - } - - public void setRedisPool(JedisPool redisPool){ - this.redisPool = redisPool; - } - - public void setMessageHandler(ReceivedMessageHandler handler) { - this.handler = handler; - } - - private class PubSubListener extends JedisPubSub { - - public PubSubListener() { - super(); - } - - @Override - public void onMessage(String channel, String message) { - // Not used. - } - - @Override - public void onPMessage(String pattern, String channel, String message) { - handler.handleMessage(pattern, channel, message); - } - - @Override - public void onPSubscribe(String pattern, int subscribedChannels) { -// log.debug("Subscribed to the pattern: " + pattern); - } - - @Override - public void onPUnsubscribe(String pattern, int subscribedChannels) { - // Not used. - } - - @Override - public void onSubscribe(String channel, int subscribedChannels) { - // Not used. - } - - @Override - public void onUnsubscribe(String channel, int subscribedChannels) { - // Not used. - } - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageSender.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageSender.java deleted file mode 100755 index 477c1165fa..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageSender.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class MessageSender { - private JedisPool redisPool; - private volatile boolean sendMessage = false; - - private final Executor msgSenderExec = Executors.newSingleThreadExecutor(); - private final Executor runExec = Executors.newSingleThreadExecutor(); - private BlockingQueue messages = new LinkedBlockingQueue(); - - public void stop() { - sendMessage = false; - } - - public void start() { -// log.info("Redis message publisher starting!"); - try { - sendMessage = true; - - Runnable messageSender = new Runnable() { - public void run() { - while (sendMessage) { - try { - MessageToSend msg = messages.take(); - publish(msg.getChannel(), msg.getMessage()); - } catch (InterruptedException e) { -// log.warn("Failed to get message from queue."); - } - } - } - }; - msgSenderExec.execute(messageSender); - } catch (Exception e) { -// log.error("Error subscribing to channels: " + e.getMessage()); - } - } - - public void send(String channel, String message) { - MessageToSend msg = new MessageToSend(channel, message); - messages.add(msg); - } - - private void publish(final String channel, final String message) { - Runnable task = new Runnable() { - public void run() { - Jedis jedis = redisPool.getResource(); - try { - jedis.publish(channel, message); - } catch(Exception e){ -// log.warn("Cannot publish the message to redis", e); - } finally { - redisPool.returnResource(jedis); - } - } - }; - - runExec.execute(task); - } - - public void setRedisPool(JedisPool redisPool){ - this.redisPool = redisPool; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageToSend.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageToSend.java deleted file mode 100755 index e01dfc84e1..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/MessageToSend.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -public class MessageToSend { - private final String channel; - private final String message; - - public MessageToSend(String channel, String message) { - this.channel = channel; - this.message = message; - } - - public String getChannel() { - return channel; - } - - public String getMessage() { - return message; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessage.java deleted file mode 100755 index 9319407276..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessage.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -public class ReceivedMessage { - - private final String pattern; - private final String channel; - private final String message; - - public ReceivedMessage(String pattern, String channel, String message) { - this.pattern = pattern; - this.channel = channel; - this.message = message; - } - - public String getPattern() { - return pattern; - } - - public String getChannel() { - return channel; - } - - public String getMessage() { - return message; - } - - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessageHandler.java deleted file mode 100755 index 6350be0fc9..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/messaging/redis/ReceivedMessageHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; - -public class ReceivedMessageHandler { - - private BlockingQueue receivedMessages = new LinkedBlockingQueue(); - - private volatile boolean processMessage = false; - - private final Executor msgProcessorExec = Executors.newSingleThreadExecutor(); - private final Executor runExec = Executors.newSingleThreadExecutor(); - - private MessageDistributor handler; - - public void stop() { - processMessage = false; - } - - public void start() { -// log.info("Ready to handle messages from Redis pubsub!"); - - try { - processMessage = true; - - Runnable messageProcessor = new Runnable() { - public void run() { - while (processMessage) { - try { - ReceivedMessage msg = receivedMessages.take(); - processMessage(msg); - } catch (InterruptedException e) { -// log.warn("Error while taking received message from queue."); - } - } - } - }; - msgProcessorExec.execute(messageProcessor); - } catch (Exception e) { -// log.error("Error subscribing to channels: " + e.getMessage()); - } - } - - private void processMessage(final ReceivedMessage msg) { - Runnable task = new Runnable() { - public void run() { - if (handler != null) { - handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage()); - } else { -// log.info("No listeners interested in messages from Redis!"); - } - } - }; - runExec.execute(task); - } - - public void handleMessage(String pattern, String channel, String message) { - ReceivedMessage rm = new ReceivedMessage(pattern, channel, message); - receivedMessages.add(rm); - } - - public void setMessageDistributor(MessageDistributor h) { - this.handler = h; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/ConversionUpdatesProcessor.java deleted file mode 100755 index c808b00502..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/ConversionUpdatesProcessor.java +++ /dev/null @@ -1,56 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.presentation; - -public class ConversionUpdatesProcessor { - -// private PresentationApplication presentationApplication; - - public void sendConversionUpdate(String messageKey, String conference, - String code, String presId, String presName) { -// presentationApplication.sendConversionUpdate(messageKey, conference, -// code, presId, presName); - } - - public void sendPageCountError(String messageKey, String conference, - String code, String presId, int numberOfPages, - int maxNumberPages, String presName) { -// presentationApplication.sendPageCountError(messageKey, conference, -// code, presId, numberOfPages, -// maxNumberPages, presName); - } - - public void sendSlideGenerated(String messageKey, String conference, - String code, String presId, int numberOfPages, - int pagesCompleted, String presName) { -// presentationApplication.sendSlideGenerated(messageKey, conference, -// code, presId, numberOfPages, pagesCompleted, presName); - } - - public void sendConversionCompleted(String messageKey, String conference, - String code, String presId, Integer numberOfPages, String presName, - String presBaseUrl) { -// presentationApplication.sendConversionCompleted(messageKey, conference, -// code, presId, numberOfPages, presName, presBaseUrl); - } - -// public void setPresentationApplication(PresentationApplication a) { -// presentationApplication = a; -// } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PresentationMessageListener.java deleted file mode 100755 index 457bb69895..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PresentationMessageListener.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.bigbluebutton.conference.service.presentation; - -import java.util.HashMap; -import java.util.Map; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import com.google.gson.JsonParser; -import com.google.gson.JsonObject; - -public class PresentationMessageListener implements MessageHandler { - - public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS"; - public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED"; - public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT"; - public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT"; - public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED"; - public static final String PAGE_COUNT_EXCEEDED_KEY = "PAGE_COUNT_EXCEEDED"; - public static final String GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; - public static final String GENERATING_THUMBNAIL_KEY = "GENERATING_THUMBNAIL"; - public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL"; - public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; - - private ConversionUpdatesProcessor conversionUpdatesProcessor; - private IBigBlueButtonInGW bbbInGW; - - public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) { - conversionUpdatesProcessor = p; - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { - bbbInGW = inGW; - } - - private void sendConversionUpdate(String messageKey, String conference, - String code, String presId, String filename) { - - conversionUpdatesProcessor.sendConversionUpdate(messageKey, conference, - code, presId, filename); - } - - public void sendPageCountError(String messageKey, String conference, - String code, String presId, Integer numberOfPages, - Integer maxNumberPages, String filename) { - - conversionUpdatesProcessor.sendPageCountError(messageKey, conference, - code, presId, numberOfPages, - maxNumberPages, filename); - } - - private void sendSlideGenerated(String messageKey, String conference, - String code, String presId, Integer numberOfPages, - Integer pagesCompleted, String filename) { - - conversionUpdatesProcessor.sendSlideGenerated(messageKey, conference, - code, presId, numberOfPages, - pagesCompleted, filename); - } - - private void sendConversionCompleted(String messageKey, String conference, - String code, String presId, Integer numberOfPages, - String filename, String presBaseUrl) { - - conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference, - code, presId, numberOfPages, filename, presBaseUrl); - } - - @Override - public void handleMessage(String pattern, String channel, String message) { - - if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) { - - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if(obj.has("payload") && obj.has("header")) { - - JsonObject headerObject = (JsonObject) obj.get("header"); - JsonObject payloadObject = (JsonObject) obj.get("payload"); - - String eventName = headerObject.get("name").toString().replace("\"", ""); - - if(eventName.equalsIgnoreCase("presentation_page_changed_message") || - eventName.equalsIgnoreCase("presentation_page_resized_message")) { - - JsonObject pageObject = (JsonObject) payloadObject.get("page"); - String roomName = payloadObject.get("meeting_id").toString().replace("\"", ""); - - if(eventName.equalsIgnoreCase("presentation_page_changed_message")) { - String pageId = pageObject.get("id").toString().replace("\"", ""); - bbbInGW.gotoSlide(roomName, pageId); - } else if(eventName.equalsIgnoreCase("presentation_page_resized_message")) { - String xOffset = pageObject.get("x_offset").toString().replace("\"", ""); - String yOffset = pageObject.get("y_offset").toString().replace("\"", ""); - String widthRatio = pageObject.get("width_ratio").toString().replace("\"", ""); - String heightRatio = pageObject.get("height_ratio").toString().replace("\"", ""); - bbbInGW.resizeAndMoveSlide(roomName, Double.parseDouble(xOffset), Double.parseDouble(yOffset), Double.parseDouble(widthRatio), Double.parseDouble(heightRatio)); - } - } - } - else { - Gson gson = new Gson(); - HashMap map = gson.fromJson(message, new TypeToken>() {}.getType()); - - String code = (String) map.get("returnCode"); - String presId = (String) map.get("presentationId"); - String filename = (String) map.get("filename"); - String conference = (String) map.get("conference"); - String messageKey = (String) map.get("messageKey"); - - if (messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_SUCCESS_KEY) || - messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_FAILED_KEY) || - messageKey.equalsIgnoreCase(SUPPORTED_DOCUMENT_KEY) || - messageKey.equalsIgnoreCase(UNSUPPORTED_DOCUMENT_KEY) || - messageKey.equalsIgnoreCase(GENERATING_THUMBNAIL_KEY) || - messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY) || - messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){ - - sendConversionUpdate(messageKey, conference, code, presId, filename); - - } else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){ - Integer numberOfPages = new Integer((String) map.get("numberOfPages")); - Integer maxNumberPages = new Integer((String) map.get("maxNumberPages")); - - sendPageCountError(messageKey, conference, code, - presId, numberOfPages, maxNumberPages, filename); - - } else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){ - Integer numberOfPages = new Integer((String) map.get("numberOfPages")); - Integer pagesCompleted = new Integer((String) map.get("pagesCompleted")); - - sendSlideGenerated(messageKey, conference, code, - presId, numberOfPages, pagesCompleted, filename); - - } else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){ - Integer numberOfPages = new Integer((String) map.get("numberOfPages")); - String presBaseUrl = (String) map.get("presentationBaseUrl"); - - sendConversionCompleted(messageKey, conference, code, - presId, numberOfPages, filename, presBaseUrl); - } - } - } - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentation.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentation.java deleted file mode 100755 index 0c05f23f20..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentation.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.presentation; - -public class PreuploadedPresentation { - - public final String id; - public final int numPages; - - public PreuploadedPresentation(String id, int numPages) { - this.id = id; - this.numPages = numPages; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentationsUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentationsUtil.java deleted file mode 100644 index 94266c37f1..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/presentation/PreuploadedPresentationsUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.bigbluebutton.conference.service.presentation; - -import java.io.File; -import java.io.FileFilter; -import java.io.FilenameFilter; -import java.util.ArrayList; - -public class PreuploadedPresentationsUtil { - - private String bbbDir = "/var/bigbluebutton/"; - - public ArrayList getPreuploadedPresentations(String meetingID) { - ArrayList preuploadedPresentations = new ArrayList(); - - try { - // TODO: this is hard-coded, and not really a great abstraction. need to fix this up later - String folderPath = bbbDir + meetingID + "/" + meetingID; - File folder = new File(folderPath); - //log.debug("folder: {} - exists: {} - isDir: {}", folder.getAbsolutePath(), folder.exists(), folder.isDirectory()); - if (folder.exists() && folder.isDirectory()) { - File[] presentations = folder.listFiles(new FileFilter() { - public boolean accept(File path) { - return path.isDirectory(); - } - }); - for (File presFile : presentations) { - int numPages = getNumPages(presFile); - PreuploadedPresentation p = new PreuploadedPresentation(presFile.getName(), numPages); - preuploadedPresentations.add(p); - } - } - } catch (Exception ex) { - - } - - return preuploadedPresentations; - } - - private int getNumPages(File presDir) { - File[] files = presDir.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.toLowerCase().endsWith(".swf"); - } - }); - - return files.length; - } - - public void setBigBlueButtonDirectory(String dir) { - if (dir.endsWith("/")) bbbDir = dir; - else bbbDir = dir + "/"; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/GenericObjectPoolConfigWrapper.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/GenericObjectPoolConfigWrapper.java deleted file mode 100755 index 416b341293..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/GenericObjectPoolConfigWrapper.java +++ /dev/null @@ -1,142 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import org.apache.commons.pool.impl.GenericObjectPool; - -public class GenericObjectPoolConfigWrapper { - - private final GenericObjectPool.Config config; - - public GenericObjectPoolConfigWrapper() { - this.config = new GenericObjectPool.Config(); - } - - public GenericObjectPool.Config getConfig() { - return config; - } - - public int getMaxIdle() { - return this.config.maxIdle; - } - - public void setMaxIdle(int maxIdle) { - this.config.maxIdle = maxIdle; - } - - public int getMinIdle() { - return this.config.minIdle; - } - - public void setMinIdle(int minIdle) { - this.config.minIdle = minIdle; - } - - public int getMaxActive() { - return this.config.maxActive; - } - - public void setMaxActive(int maxActive) { - this.config.maxActive = maxActive; - } - - public long getMaxWait() { - return this.config.maxWait; - } - - public void setMaxWait(long maxWait) { - this.config.maxWait = maxWait; - } - - public byte getWhenExhaustedAction() { - return this.config.whenExhaustedAction; - } - - public void setWhenExhaustedAction(byte whenExhaustedAction) { - this.config.whenExhaustedAction = whenExhaustedAction; - } - - public boolean isTestOnBorrow() { - return this.config.testOnBorrow; - } - - public void setTestOnBorrow(boolean testOnBorrow) { - this.config.testOnBorrow = testOnBorrow; - } - - public boolean isTestOnReturn() { - return this.config.testOnReturn; - } - - public void setTestOnReturn(boolean testOnReturn) { - this.config.testOnReturn = testOnReturn; - } - - public boolean isTestWhileIdle() { - return this.config.testWhileIdle; - } - - public void setTestWhileIdle(boolean testWhileIdle) { - this.config.testWhileIdle = testWhileIdle; - } - - public long getTimeBetweenEvictionRunsMillis() { - return this.config.timeBetweenEvictionRunsMillis; - } - - public void setTimeBetweenEvictionRunsMillis( - long timeBetweenEvictionRunsMillis) { - this.config.timeBetweenEvictionRunsMillis = - timeBetweenEvictionRunsMillis; - } - - public int getNumTestsPerEvictionRun() { - return this.config.numTestsPerEvictionRun; - } - - public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { - this.config.numTestsPerEvictionRun = numTestsPerEvictionRun; - } - - public long getMinEvictableIdleTimeMillis() { - return this.config.minEvictableIdleTimeMillis; - } - - public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { - this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; - } - - public long getSoftMinEvictableIdleTimeMillis() { - return this.config.softMinEvictableIdleTimeMillis; - } - - public void setSoftMinEvictableIdleTimeMillis( - long softMinEvictableIdleTimeMillis) { - this.config.softMinEvictableIdleTimeMillis = - softMinEvictableIdleTimeMillis; - } - - public boolean isLifo() { - return this.config.lifo; - } - - public void setLifo(boolean lifo) { - this.config.lifo = lifo; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecordEvent.java deleted file mode 100755 index a8cf016b6e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecordEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import java.util.HashMap; - -/** - * Abstract class for all events that need to be recorded. - * @author Richard Alam - * - */ -public abstract class RecordEvent { - protected final HashMap eventMap = new HashMap(); - - protected final static String MODULE = "module"; - protected final static String TIMESTAMP = "timestamp"; - protected final static String MEETING = "meetingId"; - protected final static String EVENT = "eventName"; - - public final String getMeetingID() { - return eventMap.get(MEETING); - } - - /** - * Set the module that generated the event. - * @param module - */ - public final void setModule(String module) { - eventMap.put(MODULE, module); - } - - /** - * Set the timestamp of the event. - * @param timestamp - */ - public final void setTimestamp(long timestamp) { - eventMap.put(TIMESTAMP, Long.toString(timestamp)); - } - - /** - * Set the meetingId for this particular event. - * @param meetingId - */ - public final void setMeetingId(String meetingId) { - eventMap.put(MEETING, meetingId); - } - - /** - * Set the name of the event. - * @param event - */ - public final void setEvent(String event) { - eventMap.put(EVENT, event); - } - - - /** - * Convert the event into a Map to be recorded. - * @return - */ - public final HashMap toMap() { - return eventMap; - } - - @Override - public String toString() { - return eventMap.get(MODULE) + " " + eventMap.get(EVENT); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/Recorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/Recorder.java deleted file mode 100755 index f5a24578ba..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/Recorder.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -/** - * - * The IRecorder interface define all the neccesary methods to implement for - * dispatch events to a JMS queue - * - * */ -public interface Recorder { - /** - * Receive the messages from the bigbluebutton modules and send - * them to a queue. These messages are the events generated in a conference. - * @param message a JSON String message with the attributes of an event - */ - public void record(String session, RecordEvent event); - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecorderApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecorderApplication.java deleted file mode 100755 index b645a0c0e6..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RecorderApplication.java +++ /dev/null @@ -1,105 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import org.bigbluebutton.service.recording.RedisListRecorder; - - -/** - * - * The RecorderApplication class is used for setting the record module - * in BigBlueButton for send events messages to a JMS queue. - * The class follows the same standard as the others modules of BigBlueButton Apps. - */ -public class RecorderApplication { - - private static final int NTHREADS = 1; - private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); - - private BlockingQueue messages; - private volatile boolean recordEvents = false; - - private RedisListRecorder redisListRecorder; - - private Recorder recorder; - - public RecorderApplication() { - messages = new LinkedBlockingQueue(); - } - - public void start() { - recordEvents = true; - Runnable sender = new Runnable() { - public void run() { - while (recordEvents) { - RecordEvent message; - try { - message = messages.take(); - recordEvent(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - exec.execute(sender); - } - - public void stop() { - recordEvents = false; - } - - public void destroyRecordSession(String meetingID) { -// recordingSessions.remove(meetingID); - } - - public void createRecordSession(String meetingID) { -// recordingSessions.put(meetingID, meetingID); - } - - public void record(String meetingID, RecordEvent message) { - messages.offer(message); - } - - private void recordEvent(final RecordEvent message) { - Runnable task = new Runnable() { - public void run() { - recorder.record(message.getMeetingID(), message); - } - }; - runExec.execute(task); - } - - public void setRecorder(Recorder recorder) { - this.recorder = recorder; -// log.debug("setting recorder"); - } - - public void setRedisListRecorder(RedisListRecorder rec) { - redisListRecorder = rec; - } -} - diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RedisDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RedisDispatcher.java deleted file mode 100755 index fc268e6b3b..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/RedisDispatcher.java +++ /dev/null @@ -1,53 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder; - -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class RedisDispatcher implements Recorder { - private static final String COLON=":"; - JedisPool redisPool; - - public RedisDispatcher() { - super(); - } - - @Override - public void record(String session, RecordEvent message) { - Jedis jedis = redisPool.getResource(); - try { - Long msgid = jedis.incr("global:nextRecordedMsgId"); - jedis.hmset("recording" + COLON + session + COLON + msgid, message.toMap()); - jedis.rpush("meeting" + COLON + session + COLON + "recordings", msgid.toString()); - } finally { - redisPool.returnResource(jedis); - } - } - - public JedisPool getRedisPool() { - return redisPool; - } - - public void setRedisPool(JedisPool redisPool) { - this.redisPool = redisPool; - } - - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/AbstractChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/AbstractChatRecordEvent.java deleted file mode 100755 index f07a52713c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/AbstractChatRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.chat; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractChatRecordEvent extends RecordEvent { - - public AbstractChatRecordEvent() { - setModule("CHAT"); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/PublicChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/PublicChatRecordEvent.java deleted file mode 100755 index d3db884a58..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/chat/PublicChatRecordEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.chat; - - -public class PublicChatRecordEvent extends AbstractChatRecordEvent { - private static final String SENDER = "sender"; - private static final String MESSAGE = "message"; - private static final String COLOR = "color"; - - public PublicChatRecordEvent() { - super(); - setEvent("PublicChatEvent"); - } - - public void setSender(String sender) { - eventMap.put(SENDER, sender); - } - - public void setMessage(String message) { - eventMap.put(MESSAGE, message); - } - - public void setColor(String color) { - eventMap.put(COLOR, color); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AbstractParticipantRecordEvent.java deleted file mode 100755 index 48c735b0a4..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AbstractParticipantRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractParticipantRecordEvent extends RecordEvent { - - public AbstractParticipantRecordEvent() { - setModule("PARTICIPANT"); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AssignPresenterRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AssignPresenterRecordEvent.java deleted file mode 100755 index f23c441914..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/AssignPresenterRecordEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent { - - public AssignPresenterRecordEvent() { - super(); - setEvent("AssignPresenterEvent"); - } - - public void setUserId(String userid) { - eventMap.put("userid", userid); - } - - public void setName(String name) { - eventMap.put("name", name); - } - - public void setAssignedBy(String by) { - eventMap.put("assignedBy", by); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java deleted file mode 100755 index 46de9dd422..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantEndAndKickAllRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantEndAndKickAllRecordEvent() { - super(); - setEvent("EndAndKickAllEvent"); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantJoinRecordEvent.java deleted file mode 100755 index fe22c8c7d2..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantJoinRecordEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantJoinRecordEvent() { - super(); - setEvent("ParticipantJoinEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - - public void setName(String name){ - eventMap.put("name",name); - } - - /** - * Sets the role of the user as MODERATOR or VIEWER - * @param role - */ - public void setRole(String role) { - eventMap.put("role", role); - } - - public void setStatus(String status) { - eventMap.put("status", status); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantLeftRecordEvent.java deleted file mode 100755 index 90812dd22d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantLeftRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantLeftRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantLeftRecordEvent() { - super(); - setEvent("ParticipantLeftEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java deleted file mode 100755 index e8c6e9048b..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class ParticipantStatusChangeRecordEvent extends AbstractParticipantRecordEvent { - - public ParticipantStatusChangeRecordEvent() { - super(); - setEvent("ParticipantStatusChangeEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - - public void setStatus(String status) { - eventMap.put("status", status); - } - - public void setValue(String value) { - eventMap.put("value", value); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/RecordStatusRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/RecordStatusRecordEvent.java deleted file mode 100644 index a00e60fafc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/participants/RecordStatusRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.participants; - -public class RecordStatusRecordEvent extends AbstractParticipantRecordEvent { - - public RecordStatusRecordEvent() { - super(); - setEvent("RecordStatusEvent"); - } - - public void setUserId(String userId) { - eventMap.put("userId", userId); - } - - public void setRecordingStatus(String status) { - eventMap.put("status", status); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/AbstractPollRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/AbstractPollRecordEvent.java deleted file mode 100755 index b95e18e37a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/AbstractPollRecordEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractPollRecordEvent extends RecordEvent { - - public AbstractPollRecordEvent() { - setModule("POLL"); - } -} - diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollClearedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollClearedRecordEvent.java deleted file mode 100755 index 3eb9b25730..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollClearedRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollClearedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollClearedRecordEvent(){ - super(); - setEvent("PollClearedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollCreatedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollCreatedRecordEvent.java deleted file mode 100755 index d1003abdef..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollCreatedRecordEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollCreatedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - private static final String TITLE = "title"; - - private static final String QUESTION_PATTERN = "question"; - private static final String QUESTION_TEXT = "text"; - private static final String QUESTION_MULTIRESPONSE = "multiresponse"; - - private static final String RESPONSE_PATTERN = "response"; - private static final String RESPONSE_TEXT = "text"; - - private static final String RESPONDER_PATTERN = "responder"; - private static final String RESPONDER_USER = "user"; - - private static final String SEPARATOR = "-"; - - - public PollCreatedRecordEvent() { - super(); - setEvent("PollCreatedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - - public void setTitle(String title) { - eventMap.put(TITLE, title); - } - - public void addQuestion(String id, String question, Boolean multiresponse) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question); - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString()); - } - - public void addResponse(String questionID, String responseID, String response) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); - } - - /*public void addResponder(String questionID, String responseID, String responderID, String userID) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); - }*/ - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollRemovedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollRemovedRecordEvent.java deleted file mode 100755 index 2b4b445d34..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollRemovedRecordEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollRemovedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollRemovedRecordEvent(){ - super(); - setEvent("PollRemovedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} - - diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStartedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStartedRecordEvent.java deleted file mode 100755 index b86592ee5a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStartedRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollStartedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollStartedRecordEvent(){ - super(); - setEvent("PollStartedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStoppedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStoppedRecordEvent.java deleted file mode 100755 index efe04ba4de..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollStoppedRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollStoppedRecordEvent extends AbstractPollRecordEvent { - - private static final String POLL_ID = "pollID"; - - public PollStoppedRecordEvent(){ - super(); - setEvent("PollStoppedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollUpdatedRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollUpdatedRecordEvent.java deleted file mode 100755 index f26b1eef8e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/polling/PollUpdatedRecordEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.polling; - - -public class PollUpdatedRecordEvent extends AbstractPollRecordEvent { - private static final String POLL_ID = "pollID"; - private static final String TITLE = "title"; - - private static final String QUESTION_PATTERN = "question"; - private static final String QUESTION_TEXT = "text"; - private static final String QUESTION_MULTIRESPONSE = "multiresponse"; - - private static final String RESPONSE_PATTERN = "response"; - private static final String RESPONSE_TEXT = "text"; - - private static final String RESPONDER_PATTERN = "responder"; - private static final String RESPONDER_USER = "user"; - - private static final String SEPARATOR = "-"; - - public PollUpdatedRecordEvent(){ - super(); - setEvent("PollUpdatedEvent"); - } - - public void setPollID(String pollID) { - eventMap.put(POLL_ID, pollID); - } - - public void setTitle(String title) { - eventMap.put(TITLE, title); - } - - public void addQuestion(String id, String question, Boolean multiresponse) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_TEXT, question); - eventMap.put(QUESTION_PATTERN + SEPARATOR + id + SEPARATOR + QUESTION_MULTIRESPONSE, multiresponse.toString()); - } - - public void addResponse(String questionID, String responseID, String response) { - eventMap.put(QUESTION_PATTERN + SEPARATOR + questionID + SEPARATOR + RESPONSE_PATTERN + SEPARATOR + responseID + RESPONSE_TEXT, response); - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/AbstractPresentationRecordEvent.java deleted file mode 100755 index fc26c2243e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/AbstractPresentationRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractPresentationRecordEvent extends RecordEvent { - - public AbstractPresentationRecordEvent() { - setModule("PRESENTATION"); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java deleted file mode 100755 index a134d7e4c1..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class ConversionCompletedPresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public ConversionCompletedPresentationRecordEvent() { - super(); - setEvent("ConversionCompletedEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - - public void setOriginalFilename(String name) { - eventMap.put("originalFilename", name); - } - - public void setSlidesInfo(String slidesInfo) { - eventMap.put("slidesInfo", slidesInfo); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/CursorUpdateRecordEvent.java deleted file mode 100755 index 9964bbf617..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/CursorUpdateRecordEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class CursorUpdateRecordEvent extends AbstractPresentationRecordEvent{ - - public CursorUpdateRecordEvent() { - super(); - setEvent("CursorMoveEvent"); - } - - public void setXPercent(double percent) { - eventMap.put("xOffset", Double.toString(percent)); - } - - public void setYPercent(double percent) { - eventMap.put("yOffset", Double.toString(percent)); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java deleted file mode 100755 index 171fdb9a09..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class GenerateSlidePresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public GenerateSlidePresentationRecordEvent() { - super(); - setEvent("GenerateSlideEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - - public void setNumberOfPages(int numPages) { - eventMap.put("numberOfPages", Integer.toString(numPages)); - } - - public void setPagesCompleted(int pagesCompleted) { - eventMap.put("pagesCompleted", Integer.toString(pagesCompleted)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java deleted file mode 100644 index a58f2d3b1a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class GotoSlidePresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public GotoSlidePresentationRecordEvent() { - super(); - setEvent("GotoSlideEvent"); - } - - public void setSlide(int slide) { - /** - * Subtract 1 from the page number to be zero-based to be - * compatible with 0.81 and earlier. (ralam Sept 2, 2014) - */ - eventMap.put("slide", Integer.toString(slide - 1)); - } - - public void setId(String id) { - eventMap.put("id", id); - } - - public void setNum(int num) { - - eventMap.put("num", Integer.toString(num)); - } - - public void setCurrent(boolean current) { - eventMap.put("current", Boolean.toString(current)); - } - - public void setThumbUri(String thumbUri) { - eventMap.put("thumbUri", thumbUri); - } - - public void setSwfUri(String swfUri) { - eventMap.put("swfUri", swfUri); - } - - public void setTxtUri(String txtUri) { - eventMap.put("txtUri", txtUri); - } - - public void setPngUri(String pngUri) { - eventMap.put("pngUri", pngUri); - } - - public void setXOffset(double offset) { - eventMap.put("xOffset", Double.toString(offset)); - } - - public void setYOffset(double offset) { - eventMap.put("yOffset", Double.toString(offset)); - } - - public void setWidthRatio(double ratio) { - eventMap.put("widthRatio", Double.toString(ratio)); - } - - public void setHeightRatio(double ratio) { - eventMap.put("heightRatio", Double.toString(ratio)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java deleted file mode 100755 index 01d371cc7d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class RemovePresentationPresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public RemovePresentationPresentationRecordEvent() { - super(); - setEvent("RemovePresentationEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java deleted file mode 100644 index bf55a97ce2..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class ResizeAndMoveSlidePresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public ResizeAndMoveSlidePresentationRecordEvent() { - super(); - setEvent("ResizeAndMoveSlideEvent"); - } - - public void setId(String id) { - eventMap.put("id", id); - } - - public void setNum(int num) { - eventMap.put("num", Integer.toString(num)); - } - - public void setCurrent(boolean current) { - eventMap.put("current", Boolean.toString(current)); - } - - public void setThumbUri(String thumbUri) { - eventMap.put("thumbUri", thumbUri); - } - - public void setSwfUri(String swfUri) { - eventMap.put("swfUri", swfUri); - } - - public void setTxtUri(String txtUri) { - eventMap.put("txtUri", txtUri); - } - - public void setPngUri(String pngUri) { - eventMap.put("pngUri", pngUri); - } - - public void setXOffset(double offset) { - eventMap.put("xOffset", Double.toString(offset)); - } - - public void setYOffset(double offset) { - eventMap.put("yOffset", Double.toString(offset)); - } - - public void setWidthRatio(double ratio) { - eventMap.put("widthRatio", Double.toString(ratio)); - } - - public void setHeightRatio(double ratio) { - eventMap.put("heightRatio", Double.toString(ratio)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java deleted file mode 100755 index 0efd6273fc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.recorder.presentation; - -public class SharePresentationPresentationRecordEvent extends - AbstractPresentationRecordEvent { - - public SharePresentationPresentationRecordEvent() { - super(); - setEvent("SharePresentationEvent"); - } - - public void setPresentationName(String name) { - eventMap.put("presentationName", name); - } - - public void setOriginalFilename(String name) { - eventMap.put("originalFilename", name); - } - - public void setShare(boolean share) { - eventMap.put("share", Boolean.toString(share)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceKeyUtil.java deleted file mode 100644 index 9bc1fd75bc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceKeyUtil.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.conference.service.voice; - -public class VoiceKeyUtil { - public static final String MUTE = "mute"; - public static final String USERID = "userId"; -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceMessageListener.java deleted file mode 100644 index 35be1ab2f4..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/voice/VoiceMessageListener.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.bigbluebutton.conference.service.voice; - -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class VoiceMessageListener implements MessageHandler{ - - private IBigBlueButtonInGW bbbGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { - this.bbbGW = bbbGW; - } - - @Override - public void handleMessage(String pattern, String channel, String message) { - if (channel.equalsIgnoreCase(MessagingConstants.TO_VOICE_CHANNEL)) { - - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - JsonObject headerObject = (JsonObject) obj.get("header"); - JsonObject payloadObject = (JsonObject) obj.get("payload"); - - String eventName = headerObject.get("name").toString().replace("\"", ""); - - if (eventName.equalsIgnoreCase(MessagingConstants.MUTE_USER_REQUEST)){ - - String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); - String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); - String userID = payloadObject.get("userid").toString().replace("\"", ""); - String muteString = payloadObject.get(VoiceKeyUtil.MUTE).toString().replace("\"", ""); - Boolean mute = Boolean.valueOf(muteString); - - System.out.println("handling mute_user_request"); - bbbGW.muteUser(meetingID, requesterID, userID, mute); - } - else if (eventName.equalsIgnoreCase(MessagingConstants.USER_LEFT_VOICE_REQUEST)){ - - String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); - String userID = payloadObject.get("userid").toString().replace("\"", ""); - - System.out.println("handling user_left_voice_request"); - bbbGW.voiceUserLeft(meetingID, userID); - } - } - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardKeyUtil.java deleted file mode 100755 index 7d635ba285..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardKeyUtil.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.bigbluebutton.conference.service.whiteboard; - -public class WhiteboardKeyUtil { - - public static final String TEXT_TYPE = "text"; - public static final String PENCIL_TYPE = "pencil"; - public static final String RECTANGLE_TYPE = "rectangle"; - public static final String ELLIPSE_TYPE = "ellipse"; - public static final String TRIANGLE_TYPE = "triangle"; - public static final String LINE_TYPE = "line"; - - public static final String TEXT_CREATED_STATUS = "textCreated"; - public static final String DRAW_START_STATUS = "DRAW_START"; - public static final String DRAW_END_STATUS = "DRAW_END"; - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardListener.java deleted file mode 100644 index 8f80bdb8bd..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/WhiteboardListener.java +++ /dev/null @@ -1,51 +0,0 @@ - -package org.bigbluebutton.conference.service.whiteboard; - - -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; - -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import com.google.gson.JsonParser; -import com.google.gson.JsonObject; - -public class WhiteboardListener implements MessageHandler{ - - private IBigBlueButtonInGW bbbInGW; - - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) { - this.bbbInGW = bbbInGW; - } - - @Override - public void handleMessage(String pattern, String channel, String message) { - if (channel.equalsIgnoreCase(MessagingConstants.TO_WHITEBOARD_CHANNEL)) { - - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - JsonObject headerObject = (JsonObject) obj.get("header"); - JsonObject payloadObject = (JsonObject) obj.get("payload"); - - String eventName = headerObject.get("name").toString().replace("\"", ""); - - if(eventName.equalsIgnoreCase("get_whiteboard_shapes_request")){ - //more cases to follow - - String roomName = payloadObject.get("meeting_id").toString().replace("\"", ""); - - if(eventName.equalsIgnoreCase("get_whiteboard_shapes_request")){ - String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); - if(payloadObject.get("whiteboard_id") != null){ - String whiteboardID = payloadObject.get("whiteboard_id").toString().replace("\"", ""); - System.out.println("\n FOUND A whiteboardID:" + whiteboardID + "\n"); - bbbInGW.requestWhiteboardAnnotationHistory(roomName, requesterID, whiteboardID, requesterID); - } - else { - System.out.println("\n DID NOT FIND A whiteboardID \n"); - } - System.out.println("\n user<" + requesterID + "> requested the shapes.\n"); - } - } - } - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java deleted file mode 100644 index aed2b1c94b..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractWhiteboardRecordEvent extends RecordEvent { - - public AbstractWhiteboardRecordEvent() { - setModule("WHITEBOARD"); - } - - public void setPresentation(String name) { - eventMap.put("presentation", name); - } - - public void setPageNumber(String page) { - /** - * Subtract 1 from the page number to be zero-based to be - * compatible with 0.81 and earlier. (ralam Sept 2, 2014) - */ - Integer num = new Integer(page); -// System.out.println("WB Page Number real pagenum=[" + num + "] rec pagenum=[" + (num - 1) + "]"); - eventMap.put("pageNumber", new Integer(num - 1).toString()); - } - - public void setWhiteboardId(String id) { - eventMap.put("whiteboardId", id); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java deleted file mode 100755 index fa667798c6..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java +++ /dev/null @@ -1,69 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import java.util.ArrayList; -import java.util.Map; - -public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { - - public AddShapeWhiteboardRecordEvent() { - super(); - setEvent("AddShapeEvent"); - } - - public void addAnnotation(Map annotation) { - for (Map.Entry entry : annotation.entrySet()) { - String key = entry.getKey(); - - if (key.equals("points")) { - eventMap.put("dataPoints", pointsToString((ArrayList)entry.getValue())); - } else { - Object value = entry.getValue(); - eventMap.put(key, value.toString()); - } - } - } - - private String pointsToString(ArrayList points){ - String datapoints = ""; - for (int i = 0; i < points.size(); i++) { - datapoints += (points.get(i)).toString() + ","; - } - // Trim the trailing comma - return datapoints.substring(0, datapoints.length() - 1); - } - - public void setFillColor(int fillColor) { - eventMap.put("fillColor", Integer.toString(fillColor)); - } - - public void setThickness(int thickness) { - eventMap.put("thickness", Integer.toString(thickness)); - } - - public void setFill(boolean fill) { - eventMap.put("fill", Boolean.toString(fill)); - } - - public void setTransparent(boolean transparent) { - eventMap.put("transparent", Boolean.toString(transparent)); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java deleted file mode 100755 index fc3c0b4fcf..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import java.util.ArrayList; -import java.util.Map; - -public class AddTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { - - public AddTextWhiteboardRecordEvent() { - super(); - setEvent("AddTextEvent"); - } - - public void addAnnotation(Map annotation) { - for (Map.Entry entry : annotation.entrySet()) { - String key = entry.getKey(); - - if (key.equals("points")) { - ArrayList value = (ArrayList)entry.getValue(); - eventMap.put("dataPoints", pointsToString(value)); - } else { - Object value = entry.getValue(); - eventMap.put(key, value.toString()); - } - } - } - - private String pointsToString(ArrayList points){ - String datapoints = ""; - for (Double i : points) { - datapoints += i + ","; - } - // Trim the trailing comma - return datapoints.substring(0, datapoints.length() - 1); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java deleted file mode 100755 index 583d374470..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -public class ClearPageWhiteboardRecordEvent extends - AbstractWhiteboardRecordEvent { - - public ClearPageWhiteboardRecordEvent() { - super(); - setEvent("ClearPageEvent"); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java deleted file mode 100755 index ca6f398f3b..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java +++ /dev/null @@ -1,53 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -import java.util.ArrayList; -import java.util.Map; - -public class ModifyTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { - - public ModifyTextWhiteboardRecordEvent() { - super(); - setEvent("ModifyTextEvent"); - } - - public void addAnnotation(Map annotation) { - for (Map.Entry entry : annotation.entrySet()) { - String key = entry.getKey(); - - if (key.equals("points")) { - ArrayList value = (ArrayList)entry.getValue(); - eventMap.put("dataPoints", pointsToString(value)); - } else { - Object value = entry.getValue(); - eventMap.put(key, value.toString()); - } - } - } - - private String pointsToString(ArrayList points){ - String datapoints = ""; - for (Double i : points) { - datapoints += i + ","; - } - // Trim the trailing comma - return datapoints.substring(0, datapoints.length() - 1); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java deleted file mode 100755 index 1b68d43f7a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -public class ToggleGridWhiteboardRecordEvent extends - AbstractWhiteboardRecordEvent { - - public ToggleGridWhiteboardRecordEvent() { - super(); - setEvent("ToggleGridEvent"); - } - - public void setGridEnabled(boolean enabled) { - eventMap.put("gridEnabled", Boolean.toString(enabled)); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java deleted file mode 100755 index 0d9cbd4ef6..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.whiteboard.redis; - -public class UndoShapeWhiteboardRecordEvent extends - AbstractWhiteboardRecordEvent { - - public UndoShapeWhiteboardRecordEvent() { - super(); - setEvent("UndoShapeEvent"); - } - - public void setShapeId(String id) { - eventMap.put("shapeId", id); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IBigBlueButtonInGW.java deleted file mode 100755 index 8dd2dbb26c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IBigBlueButtonInGW.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.bigbluebutton.core.api; - -import java.util.Map; - - -public interface IBigBlueButtonInGW { - - void isAliveAudit(String aliveID); - void statusMeetingAudit(String meetingID); - void endMeeting(String meetingID); - void endAllMeetings(); - void createMeeting2(String meetingID, String externalMeetingID, String meetingName, boolean recorded, - String voiceBridge, long duration, boolean autoStartRecording, - boolean allowStartStopRecording, String moderatorPass, String viewerPass, - long createTime, String createDate); - void destroyMeeting(String meetingID); - void getAllMeetings(String meetingID); - void lockSettings(String meetingID, Boolean locked, Map lockSettigs); - - - // Lock - void initLockSettings(String meetingID, Map settings); - void sendLockSettings(String meetingID, String userId, Map settings); - void getLockSettings(String meetingId, String userId); - void lockUser(String meetingId, String requesterID, boolean lock, String internalUserID); - - - // Users - void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId); - void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken); - void userRaiseHand(String meetingId, String userId); - void lowerHand(String meetingId, String userId, String loweredBy); - void shareWebcam(String meetingId, String userId, String stream); - void unshareWebcam(String meetingId, String userId, String stream); - void setUserStatus(String meetingID, String userID, String status, Object value); - void getUsers(String meetingID, String requesterID); - void userLeft(String meetingID, String userID, String sessionId); - void userJoin(String meetingID, String userID, String authToken); - void getCurrentPresenter(String meetingID, String requesterID); - void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy); - void setRecordingStatus(String meetingId, String userId, Boolean recording); - void getRecordingStatus(String meetingId, String userId); - void userConnectedToGlobalAudio(String voiceConf, String userid, String name); - void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name); - - // Voice - void initAudioSettings(String meetingID, String requesterID, Boolean muted); - void muteAllExceptPresenter(String meetingID, String requesterID, Boolean mute); - void muteAllUsers(String meetingID, String requesterID, Boolean mute); - void isMeetingMuted(String meetingID, String requesterID); - void muteUser(String meetingID, String requesterID, String userID, Boolean mute); - void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock); - void ejectUserFromVoice(String meetingID, String userId, String ejectedBy); - void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy); - void voiceUserJoined(String meetingId, String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); - void voiceUserLeft(String meetingId, String userId); - void voiceUserLocked(String meetingId, String userId, Boolean locked); - void voiceUserMuted(String meetingId, String userId, Boolean muted); - void voiceUserTalking(String meetingId, String userId, Boolean talking); - void voiceRecording(String meetingId, String recordingFile, - String timestamp, Boolean recording); - - // Presentation - void clear(String meetingID); - void removePresentation(String meetingID, String presentationID); - void getPresentationInfo(String meetingID, String requesterID, String replyTo); - void sendCursorUpdate(String meetingID, double xPercent, double yPercent); - void resizeAndMoveSlide(String meetingID, double xOffset, double yOffset, double widthRatio, double heightRatio); - void gotoSlide(String meetingID, String page); - void sharePresentation(String meetingID, String presentationID, boolean share); - void getSlideInfo(String meetingID, String requesterID, String replyTo); - - void sendConversionUpdate(String messageKey, String meetingId, - String code, String presId, String presName); - - void sendPageCountError(String messageKey, String meetingId, - String code, String presId, int numberOfPages, - int maxNumberPages, String presName); - - void sendSlideGenerated(String messageKey, String meetingId, - String code, String presId, int numberOfPages, - int pagesCompleted, String presName); - - void sendConversionCompleted(String messageKey, String meetingId, - String code, String presId, int numPages, String presName, String presBaseUrl); - - // Polling - void getPolls(String meetingID, String requesterID); - void createPoll(String meetingID, String requesterID, String msg); - void updatePoll(String meetingID, String requesterID, String msg); - void startPoll(String meetingID, String requesterID, String msg); - void stopPoll(String meetingID, String requesterID, String msg); - void removePoll(String meetingID, String requesterID, String msg); - void respondPoll(String meetingID, String requesterID, String msg); - void preCreatedPoll(String meetingID, String msg); - - // Layout - void getCurrentLayout(String meetingID, String requesterID); - void broadcastLayout(String meetingID, String requesterID, String layout); - void lockLayout(String meetingID, String setById, - boolean lock, boolean viewersOnly, - scala.Option layout); - - // Chat - void getChatHistory(String meetingID, String requesterID, String replyTo); - void sendPublicMessage(String meetingID, String requesterID, Map message); - void sendPrivateMessage(String meetingID, String requesterID, Map message); - - // Whiteboard - void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map annotation); - void requestWhiteboardAnnotationHistory(String meetingID, String requesterID, String whiteboardId, String replyTo); - void clearWhiteboard(String meetingID, String requesterID, String whiteboardId); - void undoWhiteboard(String meetingID, String requesterID, String whiteboardId); - void enableWhiteboard(String meetingID, String requesterID, Boolean enable); - void isWhiteboardEnabled(String meetingID, String requesterID, String replyTo); - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IDispatcher.java deleted file mode 100755 index fa1b97c3c6..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IDispatcher.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface IDispatcher { - - void dispatch(String jsonMessage); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IOutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IOutMessage.java deleted file mode 100755 index 94939235e2..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/IOutMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface IOutMessage { - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/MessageOutGateway.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/MessageOutGateway.java deleted file mode 100755 index 93573a265e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/MessageOutGateway.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.bigbluebutton.core.api; - -import java.util.Set; - - -public class MessageOutGateway { - - private Set listeners; - - public void send(IOutMessage msg) { -// log.debug("before listeners send. check message:" + msg); - for (OutMessageListener2 l : listeners) { -// log.debug("listener " + l); - l.handleMessage(msg); - } - } - - public void setListeners(Set listeners) { - this.listeners = listeners; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/OutMessageListener2.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/OutMessageListener2.java deleted file mode 100755 index ec6d099a45..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/OutMessageListener2.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface OutMessageListener2 { - - void handleMessage(IOutMessage msg); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/RedisLpushDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/RedisLpushDispatcher.java deleted file mode 100755 index 68ed47975d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_core/api/RedisLpushDispatcher.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.bigbluebutton.core.api; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class RedisLpushDispatcher implements IDispatcher { - private static final int NTHREADS = 1; - private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); - - private static final String BBBMESSAGES = "bbb:meeting:messages"; - - private BlockingQueue messages; - private volatile boolean dispatchEvents = false; - - private JedisPool redisPool; - - public RedisLpushDispatcher() { - messages = new LinkedBlockingQueue(); - } - - @Override - public void dispatch(String jsonMessage) { - messages.offer(jsonMessage); - } - - private void saveMessage(String msg) { - Jedis jedis = redisPool.getResource(); - try { - jedis.lpush(BBBMESSAGES, msg); - } finally { - redisPool.returnResource(jedis); - } - } - - public void start() { - dispatchEvents = true; - Runnable sender = new Runnable() { - public void run() { - while (dispatchEvents) { - String message; - try { - message = messages.take(); - saveMessage(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - exec.execute(sender); - } - - public void stop() { - dispatchEvents = false; - } - - public void setRedisPool(JedisPool redisPool) { - this.redisPool = redisPool; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RecordMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RecordMessage.java deleted file mode 100755 index e8bf93bee4..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RecordMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.service.recording; - -public class RecordMessage { - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RedisListRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RedisListRecorder.java deleted file mode 100755 index 80ca642a18..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_service/recording/RedisListRecorder.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.bigbluebutton.service.recording; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import org.bigbluebutton.conference.service.recorder.RecordEvent; -import com.google.gson.Gson; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class RedisListRecorder { - - private static final int NTHREADS = 1; - private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - private volatile boolean recordEvents = false; - - JedisPool redisPool; - - public void start() { - recordEvents = true; - Runnable sender = new Runnable() { - public void run() { - while (recordEvents) { - RecordEvent message; - try { - message = messages.take(); - recordEvent(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - exec.execute(sender); - } - - public void stop() { - recordEvents = false; - } - - private void recordEvent(final RecordEvent message) { - Runnable task = new Runnable() { - public void run() { - Jedis jedis = redisPool.getResource(); - try { - String key = "bbb:recording:" + message.getMeetingID(); - Gson gson= new Gson(); - jedis.rpush(key, gson.toJson(message.toMap())); - } finally { - redisPool.returnResource(jedis); - } - } - }; - runExec.execute(task); - } - - public void record(RecordEvent message) { - messages.offer(message); - } - - public JedisPool getRedisPool() { - return redisPool; - } - - public void setRedisPool(JedisPool redisPool) { - this.redisPool = redisPool; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/AbstractVoiceRecordEvent.java deleted file mode 100755 index 9f03321ce0..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/AbstractVoiceRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractVoiceRecordEvent extends RecordEvent { - - public AbstractVoiceRecordEvent() { - setModule("VOICE"); - } - - public void setBridge(String bridge) { - eventMap.put("bridge", bridge); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServerListener.java deleted file mode 100755 index 1e4616ef56..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServerListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public interface ConferenceServerListener { - public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); - public void left(String room, Integer participant); - public void muted(String room, Integer participant, Boolean muted); - public void talking(String room, Integer participant, Boolean talking); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServiceProvider.java deleted file mode 100755 index ffebb366ee..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ConferenceServiceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public interface ConferenceServiceProvider { - public void populateRoom(String room); - public void mute(String room, String participant, Boolean mute); - public void eject(String room, String participant); - public void ejectAll(String room); - public void record(String room, String meetingid); - public void broadcast(String room, String meetingid); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/FreeswitchConferenceEventListener.java deleted file mode 100644 index f24a4de2e5..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/FreeswitchConferenceEventListener.java +++ /dev/null @@ -1,115 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; - -public class FreeswitchConferenceEventListener implements ConferenceEventListener { - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - - private volatile boolean sendMessages = false; - private IVoiceConferenceService vcs; - - public void setVoiceConferenceService(IVoiceConferenceService vcs) { - this.vcs = vcs; - } - - private void queueMessage(VoiceConferenceEvent event) { - try { - messages.offer(event, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { - Runnable task = new Runnable() { - public void run() { - if (event instanceof VoiceUserJoinedEvent) { - System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); - VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; - vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), - evt.getCallerIdNum(), evt.getCallerIdName(), - evt.getMuted(), evt.getSpeaking()); - } else if (event instanceof VoiceUserLeftEvent) { - System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); - VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; - vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); - } else if (event instanceof VoiceUserMutedEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); - VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; - vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); - } else if (event instanceof VoiceUserTalkingEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); - VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; - vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); - } else if (event instanceof VoiceStartRecordingEvent) { - VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; - System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); - vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); - } - } - }; - - runExec.execute(task); - } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - VoiceConferenceEvent message; - try { - message = messages.take(); - sendMessageToBigBlueButton(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - - public void handleConferenceEvent(VoiceConferenceEvent event) { - queueMessage(event); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/IVoiceConferenceService.java deleted file mode 100755 index f26f38b458..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/IVoiceConferenceService.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.webconference.voice; - -public interface IVoiceConferenceService { - void voiceUserJoined(String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); - void voiceUserLeft(String meetingId, String userId); - void voiceUserLocked(String meetingId, String userId, Boolean locked); - void voiceUserMuted(String meetingId, String userId, Boolean muted); - void voiceUserTalking(String meetingId, String userId, Boolean talking); - void voiceStartedRecording(String conference, String recordingFile, - String timestamp, Boolean recording); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantJoinedVoiceRecordEvent.java deleted file mode 100755 index 7417a522af..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantJoinedVoiceRecordEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantJoinedVoiceRecordEvent() { - super(); - setEvent("ParticipantJoinedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setCallerName(String name) { - eventMap.put("callername", name); - } - - public void setCallerNumber(String name) { - eventMap.put("callernumber", name); - } - - public void setMuted(boolean muted) { - eventMap.put("muted", Boolean.toString(muted)); - } - - public void setTalking(boolean talking) { - eventMap.put("talking", Boolean.toString(talking)); - } - - public void setLocked(boolean locked) { - eventMap.put("locked", Boolean.toString(locked)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLeftVoiceRecordEvent.java deleted file mode 100755 index 0b3bfaa25c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLeftVoiceRecordEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantLeftVoiceRecordEvent() { - super(); - setEvent("ParticipantLeftEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLockedVoiceRecordEvent.java deleted file mode 100755 index ff7be6cbd5..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantLockedVoiceRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantLockedVoiceRecordEvent() { - super(); - setEvent("ParticipantLockedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setLocked(boolean locked) { - eventMap.put("locked", Boolean.toString(locked)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantMutedVoiceRecordEvent.java deleted file mode 100755 index eb23d6bc70..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantMutedVoiceRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantMutedVoiceRecordEvent() { - super(); - setEvent("ParticipantMutedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setMuted(boolean muted) { - eventMap.put("muted", Boolean.toString(muted)); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantTalkingVoiceRecordEvent.java deleted file mode 100755 index e0b2814349..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/ParticipantTalkingVoiceRecordEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantTalkingVoiceRecordEvent() { - super(); - setEvent("ParticipantTalkingEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setTalking(boolean talking) { - eventMap.put("talking", Boolean.toString(talking)); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/StartRecordingVoiceRecordEvent.java deleted file mode 100755 index 7c46b0f0bf..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/StartRecordingVoiceRecordEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public StartRecordingVoiceRecordEvent(boolean record) { - super(); - if (record) - setEvent("StartRecordingEvent"); - else - setEvent("StopRecordingEvent"); - } - - public void setRecordingTimestamp(String timestamp) { - eventMap.put("recordingTimestamp", timestamp); - } - - public void setFilename(String filename) { - eventMap.put("filename", filename); - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/VoiceEventRecorder.java deleted file mode 100755 index 310d5392cd..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/VoiceEventRecorder.java +++ /dev/null @@ -1,141 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.conference.service.recorder.RecorderApplication; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; - -public class VoiceEventRecorder { - - private RecorderApplication recorder; - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - public void recordConferenceEvent(VoiceConferenceEvent event, String room) { - if (event instanceof VoiceUserJoinedEvent) { - recordParticipantJoinedEvent(event, room); - } else if (event instanceof VoiceUserLeftEvent) { - recordParticipantLeftEvent(event, room); - } else if (event instanceof VoiceUserMutedEvent) { - recordParticipantMutedEvent(event, room); - } else if (event instanceof VoiceUserTalkingEvent) { - recordParticipantTalkingEvent(event, room); - } else if (event instanceof VoiceUserLockedEvent) { - recordParticipantLockedEvent(event, room); - } else if (event instanceof VoiceStartRecordingEvent) { - recordStartRecordingEvent(event, room); - } else { -// log.debug("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() ); - } - } - - private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) { - VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event; - StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord()); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setRecordingTimestamp(sre.getTimestamp()); - evt.setFilename(sre.getRecordingFilename()); - System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename")); - recorder.record(room, evt); - } - - private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) { - VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event; - - ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(pje.getUserId().toString()); - evt.setCallerName(pje.getCallerIdName()); - evt.setCallerNumber(pje.getCallerIdName()); - evt.setMuted(pje.getMuted()); - evt.setTalking(pje.getSpeaking()); - - recorder.record(room, evt); - } - - private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) { - - ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - - - evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString()); - - recorder.record(room, evt); - } - - private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) { - VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event; - - ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString()); - evt.setMuted(pme.isMuted()); - - recorder.record(room, evt); - } - - private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) { - VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event; - - ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString()); - evt.setTalking(pte.isTalking()); - - recorder.record(room, evt); - } - - private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) { - VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event; - - ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString()); - evt.setLocked(ple.isLocked()); - - recorder.record(room, evt); - } - - public void setRecorderApplication(RecorderApplication recorder) { - this.recorder = recorder; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommand.java deleted file mode 100755 index d0402213cc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public abstract class ConferenceCommand { - - private final String room; - private final Integer requesterId; - - public ConferenceCommand(String room, Integer requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public String getRoom() { - return room; - } - - public Integer getRequesterId() { - return requesterId; - } - - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommandResult.java deleted file mode 100755 index e9b6c0f3be..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/ConferenceCommandResult.java +++ /dev/null @@ -1,56 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class ConferenceCommandResult { - - private final String room; - private final Integer requesterId; - private boolean success = false; - private String message = ""; - - public ConferenceCommandResult(String room, Integer requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getRoom() { - return room; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Integer getRequesterId() { - return requesterId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/EjectParticipantCommand.java deleted file mode 100755 index 140b26a75f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/EjectParticipantCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class EjectParticipantCommand extends ConferenceCommand { - - private final Integer participantId; - - public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { - super(room, requesterId); - this.participantId = participantId; - } - - public Integer getParticipantId() { - return participantId; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/GetParticipantsCommand.java deleted file mode 100755 index ff774f702d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/GetParticipantsCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class GetParticipantsCommand extends ConferenceCommand { - - public GetParticipantsCommand(String room, Integer requesterId) { - super(room, requesterId); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/MuteParticipantCommand.java deleted file mode 100755 index 789a355cde..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/commands/MuteParticipantCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.commands; - -public class MuteParticipantCommand extends ConferenceCommand { - - private final Integer participantId; - private final boolean mute; - - public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { - super(room, requesterId); - this.participantId = participantId; - this.mute = mute; - } - - public Integer getParticipantId() { - return participantId; - } - - public boolean isMute() { - return mute; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/ConferenceEventListener.java deleted file mode 100755 index 15800e757d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/ConferenceEventListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - - -public interface ConferenceEventListener { - public void handleConferenceEvent(VoiceConferenceEvent event); - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/UnknownConferenceEvent.java deleted file mode 100755 index 735180a415..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/UnknownConferenceEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class UnknownConferenceEvent extends VoiceConferenceEvent { - - public UnknownConferenceEvent(String participantId, String room) { - super(room); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceConferenceEvent.java deleted file mode 100755 index d1ee12a966..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceConferenceEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public abstract class VoiceConferenceEvent { - private final String room; - - public VoiceConferenceEvent(String room) { - this.room = room; - } - - public String getRoom() { - return room; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceStartRecordingEvent.java deleted file mode 100755 index 0e2b8bcc90..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceStartRecordingEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceStartRecordingEvent extends VoiceConferenceEvent { - - private String timestamp; - private String filename; - private boolean record; - - public VoiceStartRecordingEvent(String room, boolean record) { - super(room); - this.record = record; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public void setRecordingFilename(String filename) { - this.filename = filename; - } - - public String getTimestamp() { - return timestamp; - } - - public String getRecordingFilename() { - return filename; - } - - public boolean startRecord() { - return record; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserJoinedEvent.java deleted file mode 100755 index 1a721c5015..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserJoinedEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserJoinedEvent extends VoiceConferenceEvent { - - private final String voiceUserId; - private final String callerIdNum; - private final String callerIdName; - private final Boolean muted; - private final Boolean speaking; - private final Boolean locked = false; - private final String userId; - - public VoiceUserJoinedEvent(String userId, String voiceUserId, String room, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking) { - super(room); - this.userId = userId; - this.voiceUserId = voiceUserId; - this.callerIdName = callerIdName; - this.callerIdNum = callerIdNum; - this.muted = muted; - this.speaking = speaking; - } - - public String getUserId() { - return userId; - } - - public String getVoiceUserId() { - return voiceUserId; - } - - public String getCallerIdNum() { - return callerIdNum; - } - - public String getCallerIdName() { - return callerIdName; - } - - public Boolean getMuted() { - return muted; - } - - public Boolean getSpeaking() { - return speaking; - } - - public Boolean isLocked() { - return locked; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLeftEvent.java deleted file mode 100755 index f5371e5620..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLeftEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserLeftEvent extends VoiceConferenceEvent { - - private final String userId; - - public VoiceUserLeftEvent(String userId, String room) { - super(room); - this.userId = userId; - } - - public String getUserId() { - return userId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLockedEvent.java deleted file mode 100755 index 414be991c6..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserLockedEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserLockedEvent extends VoiceConferenceEvent { - - private final boolean locked; - private final String userId; - - public VoiceUserLockedEvent(String userId, String room, boolean locked) { - super(room); - this.locked = locked; - this.userId = userId; - } - - public String getUserId() { - return userId; - } - - public boolean isLocked() { - return locked; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserMutedEvent.java deleted file mode 100755 index 203e93743c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserMutedEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserMutedEvent extends VoiceConferenceEvent { - - private final boolean muted; - private final String userId; - - public VoiceUserMutedEvent(String userId, String room, boolean muted) { - super(room); - this.muted = muted; - this.userId = userId; - } - - public String getUserId() { - return userId; - } - - public boolean isMuted() { - return muted; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserTalkingEvent.java deleted file mode 100755 index 3ecd6759e4..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/events/VoiceUserTalkingEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.events; - -public class VoiceUserTalkingEvent extends VoiceConferenceEvent { - - private final boolean talking; - private final String userId; - - public VoiceUserTalkingEvent(String userId, String room, boolean talking) { - super(room); - this.talking = talking; - this.userId = userId; - } - - public String getUserId() { - return userId; - } - - public boolean isTalking() { - return talking; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ConnectionManager.java deleted file mode 100755 index f3dcd0fc59..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ConnectionManager.java +++ /dev/null @@ -1,154 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; -import org.freeswitch.esl.client.inbound.Client; -import org.freeswitch.esl.client.inbound.InboundConnectionFailure; -import org.freeswitch.esl.client.manager.ManagerConnection; -import org.freeswitch.esl.client.transport.message.EslMessage; - -public class ConnectionManager { - private static final String EVENT_NAME = "Event-Name"; - - private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); - - private ManagerConnection manager; - private ScheduledFuture connectTask; - - private volatile boolean subscribed = false; - - private ConferenceEventListener conferenceEventListener; - private ESLEventListener eslEventListener; - - private void connect() { - try { - Client c = manager.getESLClient(); - if (! c.canSend()) { -// log.info("Attempting to connect to FreeSWITCH ESL"); - subscribed = false; - manager.connect(); - } else { - if (!subscribed) { -// log.info("Subscribing for ESL events."); - c.cancelEventSubscriptions(); - c.addEventListener(eslEventListener); - c.setEventSubscriptions( "plain", "all" ); - c.addEventFilter( EVENT_NAME, "heartbeat" ); - c.addEventFilter( EVENT_NAME, "custom" ); - c.addEventFilter( EVENT_NAME, "background_job" ); - subscribed = true; - } - } - } catch (InboundConnectionFailure e) { - System.out.println("Failed to connect to ESL"); -// log.error("Failed to connect to ESL"); - } - } - - public void start() { -// log.info("Starting FreeSWITCH ESL connection manager."); - System.out.println("***************** Starting FreeSWITCH ESL connection manager."); - ConnectThread connector = new ConnectThread(); - connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); - } - - public void stop() { - if (connectTask != null) { - connectTask.cancel(true); - } - } - - private class ConnectThread implements Runnable { - public void run() { - connect(); - } - } - - - public void broadcast(BroadcastConferenceCommand rcc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); - rcc.handleResponse(response, conferenceEventListener); - } - } - - public void getUsers(PopulateRoomCommand prc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); - prc.handleResponse(response, conferenceEventListener); - } - } - - public void mute(MuteParticipantCommand mpc) { - System.out.println("Got mute request from FSApplication."); - Client c = manager.getESLClient(); - if (c.canSend()) { - System.out.println("Issuing command to FS ESL."); - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void eject(EjectParticipantCommand mpc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void ejectAll(EjectAllUsersCommand mpc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void record(RecordConferenceCommand rcc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); - rcc.handleResponse(response, conferenceEventListener); - } - } - - public void setManagerConnection(ManagerConnection manager) { - this.manager = manager; - } - - public void setESLEventListener(ESLEventListener listener) { - this.eslEventListener = listener; - } - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ESLEventListener.java deleted file mode 100755 index 3f627965c3..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/ESLEventListener.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.bigbluebutton.webconference.voice.freeswitch; - - -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.freeswitch.esl.client.IEslEventListener; -import org.freeswitch.esl.client.transport.event.EslEvent; -import org.jboss.netty.channel.ExceptionEvent; - -public class ESLEventListener implements IEslEventListener { - - private static final String START_TALKING_EVENT = "start-talking"; - private static final String STOP_TALKING_EVENT = "stop-talking"; - private static final String START_RECORDING_EVENT = "start-recording"; - private static final String STOP_RECORDING_EVENT = "stop-recording"; - - private ConferenceEventListener conferenceEventListener; - - @Override - public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { - //Ignored, Noop - } - - @Override - public void backgroundJobResultReceived(EslEvent event) { -// log.debug( "Background job result received [{}]", event ); - } - - @Override - public void exceptionCaught(ExceptionEvent e) { -// setChanged(); -// notifyObservers(e); - } - - private static final Pattern GLOBAL_AUDION_PATTERN = Pattern.compile("(GLOBAL_AUDIO)_(.*)$"); - private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); - - @Override - public void conferenceEventJoin(String uniqueId, String confName, int confSize, EslEvent event) { - - Integer memberId = this.getMemberIdFromEvent(event); - Map headers = event.getEventHeaders(); - String callerId = this.getCallerIdFromEvent(event); - String callerIdName = this.getCallerIdNameFromEvent(event); - boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue - boolean speaking = headers.get("Talking").equals("true") ? true : false; - - String voiceUserId = callerIdName; - -// log.info("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); - - Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); - if (gapMatcher.matches()) { -// log.debug("Ignoring GLOBAL AUDIO USER [{}]", callerIdName); - return; - } - - Matcher matcher = CALLERNAME_PATTERN.matcher(callerIdName); - if (matcher.matches()) { - voiceUserId = matcher.group(1).trim(); - callerIdName = matcher.group(2).trim(); - } - - VoiceUserJoinedEvent pj = new VoiceUserJoinedEvent(voiceUserId, memberId.toString(), confName, callerId, callerIdName, muted, speaking); - conferenceEventListener.handleConferenceEvent(pj); - } - - @Override - public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); -// log.info("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); - conferenceEventListener.handleConferenceEvent(pl); - } - - @Override - public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); -// log.info("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); - conferenceEventListener.handleConferenceEvent(pm); - } - - @Override - public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); -// log.info("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); - conferenceEventListener.handleConferenceEvent(pm); - } - - @Override - public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - VoiceUserTalkingEvent pt; - - System.out.println("******************** Receive conference Action [" + action + "]"); - - if (action == null) { - return; - } - - if (action.equals(START_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); - conferenceEventListener.handleConferenceEvent(pt); - } else if (action.equals(STOP_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); - conferenceEventListener.handleConferenceEvent(pt); - } else { -// log.debug("Unknown conference Action [{}]", action); - System.out.println("Unknown conference Action [" + action + "]"); - } - } - - @Override - public void conferenceEventTransfer(String uniqueId, String confName, int confSize, EslEvent event) { - //Ignored, Noop - } - - @Override - public void conferenceEventThreadRun(String uniqueId, String confName, int confSize, EslEvent event) { - - } - - //@Override - public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) { - String action = event.getEventHeaders().get("Action"); - - if(action == null) { - return; - } - - // if (log.isDebugEnabled()) - // log.debug("Handling conferenceEventRecord " + action); - - if (action.equals(START_RECORDING_EVENT)) { - VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); - sre.setRecordingFilename(getRecordFilenameFromEvent(event)); - sre.setTimestamp(genTimestamp().toString()); - -// log.info("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); - - conferenceEventListener.handleConferenceEvent(sre); - } else if (action.equals(STOP_RECORDING_EVENT)) { - VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false); - srev.setRecordingFilename(getRecordFilenameFromEvent(event)); - srev.setTimestamp(genTimestamp().toString()); - -// log.info("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); - conferenceEventListener.handleConferenceEvent(srev); - } else { -// if (log.isDebugEnabled()) -// log.warn("Processing UNKNOWN conference Action {}", action); - } - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void eventReceived(EslEvent event) { - System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]"); -// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) { -//// setChanged(); -// notifyObservers(event); -// return; -// } - } - - private Integer getMemberIdFromEvent(EslEvent e) { - return new Integer(e.getEventHeaders().get("Member-ID")); - } - - private String getCallerIdFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Number"); - } - - private String getCallerIdNameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Name"); - } - - private String getRecordFilenameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Path"); - } - - /*private String getRecordTimestampFromEvent(EslEvent e) { - return e.getEventHeaders().get("Event-Date-Timestamp"); - }*/ - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/FreeswitchApplication.java deleted file mode 100755 index d0abdcc759..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/FreeswitchApplication.java +++ /dev/null @@ -1,202 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch; - -import java.io.File; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; - -public class FreeswitchApplication implements ConferenceServiceProvider { - - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - private ConnectionManager manager; - - private String icecastProtocol = "shout"; - private String icecastHost = "localhost"; - private int icecastPort = 8000; - private String icecastUsername = "source"; - private String icecastPassword = "hackme"; - private String icecastStreamExtension = ".mp3"; - private Boolean icecastBroadcast = false; - - private final String USER = "0"; /* not used for now */ - - private volatile boolean sendMessages = false; - - private void queueMessage(FreeswitchCommand command) { - try { - messages.offer(command, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public void populateRoom(String room) { - PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); - queueMessage(prc); - } - - public void mute(String room, String participant, Boolean mute) { - MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); - queueMessage(mpc); - } - - public void eject(String room, String participant) { - EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); - queueMessage(mpc); - } - - @Override - public void ejectAll(String room) { - EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); - queueMessage(mpc); - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void record(String room, String meetingid){ - String RECORD_DIR = "/var/freeswitch/meetings"; - String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; - - RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); - queueMessage(rcc); - } - - @Override - public void broadcast(String room, String meetingid) { - if (icecastBroadcast) { - broadcastToIcecast(room, meetingid); - } - } - - private void broadcastToIcecast(String room, String meetingid) { - String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort - + File.separatorChar + meetingid + "." + icecastStreamExtension; - - BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); - queueMessage(rcc); - } - - public void setConnectionManager(ConnectionManager manager) { - this.manager = manager; - } - - public void setIcecastProtocol(String protocol) { - icecastProtocol = protocol; - } - - public void setIcecastHost(String host) { - icecastHost = host; - } - - public void setIcecastPort(int port) { - icecastPort = port; - } - - public void setIcecastUsername(String username) { - icecastUsername = username; - } - - public void setIcecastPassword(String password) { - icecastPassword = password; - } - - public void setIcecastBroadcast(Boolean broadcast) { - icecastBroadcast = broadcast; - } - - public void setIcecastStreamExtension(String ext) { - icecastStreamExtension = ext; - } - - private void sendMessageToFreeswitch(final FreeswitchCommand command) { - Runnable task = new Runnable() { - public void run() { - if (command instanceof PopulateRoomCommand) { - PopulateRoomCommand cmd = (PopulateRoomCommand) command; -// log.debug("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); - manager.getUsers(cmd); - } else if (command instanceof MuteParticipantCommand) { - MuteParticipantCommand cmd = (MuteParticipantCommand) command; -// log.debug("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.mute(cmd); - } else if (command instanceof EjectParticipantCommand) { - EjectParticipantCommand cmd = (EjectParticipantCommand) command; -// log.debug("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.eject(cmd); - } else if (command instanceof EjectAllUsersCommand) { - EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; -// log.debug("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); - manager.ejectAll(cmd); - } else if (command instanceof RecordConferenceCommand) { - manager.record((RecordConferenceCommand) command); - } else if (command instanceof BroadcastConferenceCommand) { - manager.broadcast((BroadcastConferenceCommand) command); - } - } - }; - - runExec.execute(task); - } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - FreeswitchCommand message; - try { - message = messages.take(); - sendMessageToFreeswitch(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java deleted file mode 100755 index c0aa4d35b3..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java +++ /dev/null @@ -1,50 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.freeswitch.esl.client.transport.message.EslMessage; - -public class BroadcastConferenceCommand extends FreeswitchCommand { - private boolean record; - private String icecastPath; - - public BroadcastConferenceCommand(String room, String requesterId, boolean record, String icecastPath){ - super(room, requesterId); - this.record = record; - this.icecastPath = icecastPath; - } - - - @Override - public String getCommandArgs() { - String action = "norecord"; - if (record) - action = "record"; - - return SPACE + getRoom() + SPACE + action + SPACE + icecastPath; - } - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectAllUsersCommand.java deleted file mode 100755 index e4826d72ea..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectAllUsersCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public class EjectAllUsersCommand extends FreeswitchCommand { - - public EjectAllUsersCommand(String room, String requesterId) { - super(room, requesterId); - } - - @Override - public String getCommandArgs() { - return room + " kick all"; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectParticipantCommand.java deleted file mode 100755 index 0924b164eb..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/EjectParticipantCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public class EjectParticipantCommand extends FreeswitchCommand { - - private final String participant; - - public EjectParticipantCommand(String room, String participant, String requesterId) { - super(room, requesterId); - this.participant = participant; - } - - @Override - public String getCommandArgs() { - return room + " kick " + participant; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/FreeswitchCommand.java deleted file mode 100755 index db9800fa93..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/FreeswitchCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public abstract class FreeswitchCommand { - public static final String SPACE = " "; - - protected final String room; - protected final String requesterId; - - public FreeswitchCommand(String room, String requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public String getCommand() { - return "conference"; //conference is default, override if needed. - } - - public abstract String getCommandArgs(); - - public String getRoom() { - return room; - } - - public String getRequesterId() { - return requesterId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/MuteParticipantCommand.java deleted file mode 100755 index a54ab6dacc..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/MuteParticipantCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -public class MuteParticipantCommand extends FreeswitchCommand { - - private final String participant; - private final Boolean mute; - - public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { - super(room, requesterId); - this.participant = participant; - this.mute = mute; - } - - @Override - public String getCommandArgs() { - String action = "unmute"; - if (mute) action = "mute"; - - return room + SPACE + action + SPACE + participant; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/PopulateRoomCommand.java deleted file mode 100755 index 0697ac610c..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/actions/PopulateRoomCommand.java +++ /dev/null @@ -1,116 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; -import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.commons.lang3.StringUtils; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import org.xml.sax.SAXException; - -public class PopulateRoomCommand extends FreeswitchCommand { - - public PopulateRoomCommand(String room, String requesterId) { - super(room, requesterId); - } - - @Override - public String getCommandArgs() { - return getRoom() + SPACE + "xml_list"; - } - - private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - String firstLine = response.getBodyLines().get(0); - - //E.g. Conference 85115 not found - - if(!firstLine.startsWith(". -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.actions; - -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.slf4j.Logger; - -public class RecordConferenceCommand extends FreeswitchCommand { - private boolean record; - private String recordPath; - - public RecordConferenceCommand(String room, String requesterId, boolean record, String recordPath){ - super(room, requesterId); - this.record = record; - this.recordPath = recordPath; - } - - - @Override - public String getCommandArgs() { - String action = "norecord"; - if (record) - action = "record"; - - return SPACE + getRoom() + SPACE + action + SPACE + recordPath; - } - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMember.java deleted file mode 100755 index 4e6caf9050..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMember.java +++ /dev/null @@ -1,88 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.webconference.voice.freeswitch.response; - -/** - * - * @author leif - */ -public class ConferenceMember { - - protected Integer memberId; - protected ConferenceMemberFlags flags; - protected String uuid; - protected String callerIdName; - protected String callerId; - protected Integer joinTime; - protected Integer lastTalking; - - public Integer getId() { - return memberId; - } - - public ConferenceMemberFlags getFlags() { - return flags; - } - - public String getCallerId() { - return callerId; - } - - public String getCallerIdName() { - return callerIdName; - } - - public boolean getMuted() { - return flags.getIsMuted(); - } - - public boolean getSpeaking() { - return flags.getIsSpeaking(); - } - - public void setFlags(ConferenceMemberFlags flags) { - this.flags = flags; - } - - public void setId(int parseInt) { - memberId = parseInt; - } - - public void setUUID(String tempVal) { - this.uuid = tempVal; - } - - public void setCallerIdName(String tempVal) { - this.callerIdName = tempVal; - } - - public void setCallerId(String tempVal) { - this.callerId = tempVal; - } - - public void setJoinTime(int parseInt) { - this.joinTime = parseInt; - } - - void setLastTalking(int parseInt) { - this.lastTalking = parseInt; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMemberFlags.java deleted file mode 100755 index be507e2c0d..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/ConferenceMemberFlags.java +++ /dev/null @@ -1,54 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.webconference.voice.freeswitch.response; - -/** - * - * @author leif - */ -public class ConferenceMemberFlags { - //private boolean canHear = false; - private boolean canSpeak = false; - private boolean talking = false; - //private boolean hasVideo = false; - //private boolean hasFloor = false; - //private boolean isModerator = false; - //private boolean endConference = false; - - boolean getIsSpeaking() { - return talking; - } - - boolean getIsMuted() { - if(canSpeak == true) { - return false; - } - return true; - } - - void setCanSpeak(String tempVal) { - canSpeak = tempVal.equals("true") ? true : false; - } - - void setTalking(String tempVal) { - talking = tempVal.equals("true") ? true : false; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java deleted file mode 100755 index 0411d85d5e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/old_webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java +++ /dev/null @@ -1,160 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice.freeswitch.response; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.slf4j.Logger; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * - * @author leif - */ -public class XMLResponseConferenceListParser extends DefaultHandler { - private List myConfrenceMembers; - private String tempVal; - private ConferenceMember tempMember; - private ConferenceMemberFlags tempFlags; - private String room; - private boolean inFlags = false; - - public XMLResponseConferenceListParser() { - myConfrenceMembers = new ArrayList(); - } - - public String getConferenceRoom() { - return room; - } - - public void printConferneceMemebers() { -// log.info("Number of Members found in room [{}] was ({}).", room, myConfrenceMembers.size()); - Iterator it = myConfrenceMembers.iterator(); - while(it.hasNext()) { - // log.info("room [{}] member: [{}]", room, it.next().toString()); - } - } - - public List getConferenceList() { - return myConfrenceMembers; - } - - /* - - - - - - 6 - - true - true - false - false - true - false - false - - 3a16f061-0df6-45d5-b401-d8e977e08a5c - 1001 - 1001 - 65 - 4 - - - - - - */ - - - //SAX Event Handlers - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - //reset - inFlags = false; - tempVal = ""; - if(qName.equalsIgnoreCase("member")) { - //create a new instance of ConferenceMember - tempMember = new ConferenceMember(); - } - - if(qName.equalsIgnoreCase("flags")) { - //create a new instance of ConferenceMember - tempFlags = new ConferenceMemberFlags(); - inFlags = true; - } - - if(qName.equalsIgnoreCase("conference")) { - room = attributes.getValue("name"); - } - } - - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - tempVal = new String(ch,start,length); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - - if(qName.equalsIgnoreCase("member")) { - //add it to the list - myConfrenceMembers.add(tempMember); - }else if(qName.equalsIgnoreCase("flags")) { - tempMember.setFlags(tempFlags); - inFlags = false; - }else if(inFlags) { - if (qName.equalsIgnoreCase("can_speak")) { - tempFlags.setCanSpeak(tempVal); - }else if (qName.equalsIgnoreCase("talking")) { - tempFlags.setTalking(tempVal); - } - }else if (qName.equalsIgnoreCase("id")) { - try { - tempMember.setId(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { -// log.error("cannot set ConferenceMember Id value [{}] NFE.", tempVal); - } - }else if (qName.equalsIgnoreCase("uuid")) { - tempMember.setUUID(tempVal); - }else if (qName.equalsIgnoreCase("caller_id_name")) { - tempMember.setCallerIdName(tempVal); - }else if (qName.equalsIgnoreCase("caller_id_number")) { - tempMember.setCallerId(tempVal); - }else if (qName.equalsIgnoreCase("join_time")) { - try { - tempMember.setJoinTime(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { -// log.debug("cannot set setJoinTime value [{}] NFE.", tempVal); - } - }else if (qName.equalsIgnoreCase("last_talking")) { - try { - tempMember.setLastTalking(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { -// log.debug("cannot set setLastTalking value [{}] NFE.", tempVal); - } - } - - } -} From 7aa84da98083d427276acf66cceecbf9ee27a14a Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 19:42:57 +0000 Subject: [PATCH 16/30] - now compiles --- .../AssignPresenterRequestMessage.java | 64 + .../messages/BroadcastLayoutMessage.java | 80 + .../BroadcastLayoutRequestMessage.java | 61 + .../messages/ClearWhiteboardReplyMessage.java | 61 + .../ClearWhiteboardRequestMessage.java | 60 + .../common/messages/Constants.java | 130 + .../common/messages/CreateMeetingMessage.java | 37 + .../messages/DestroyMeetingMessage.java | 12 + .../messages/DisconnectAllUsersMessage.java | 48 + .../messages/DisconnectUserMessage.java | 51 + .../EjectUserFromMeetingRequestMessage.java | 61 + .../EjectUserFromVoiceRequestMessage.java | 63 + .../EnableWhiteboardRequestMessage.java | 61 + .../common/messages/EndMeetingMessage.java | 12 + .../messages/GetAllMeetingsRequest.java | 12 + .../common/messages/GetChatHistory.java | 59 + .../messages/GetChatHistoryReplyMessage.java | 66 + .../GetChatHistoryRequestMessage.java | 58 + .../GetCurrentLayoutReplyMessage.java | 74 + .../GetCurrentLayoutRequestMessage.java | 55 + .../messages/GetLockSettingsMessage.java | 54 + .../messages/GetPresentationInfoMessage.java | 58 + .../GetPresentationInfoReplyMessage.java | 72 + .../GetRecordingStatusReplyMessage.java | 59 + .../GetRecordingStatusRequestMessage.java | 54 + .../common/messages/GetSlideInfoMessage.java | 59 + .../common/messages/GetUsersReplyMessage.java | 66 + .../messages/GetUsersRequestMessage.java | 53 + .../GetWhiteboardShapesReplyMessage.java | 73 + .../common/messages/GoToSlideMessage.java | 54 + .../common/messages/IPublishedMessage.java | 5 + .../common/messages/ISubscribedMessage.java | 5 + .../messages/InitAudioSettingsMessage.java | 58 + .../InitPermissionsSettingMessage.java | 61 + .../messages/IsMeetingMutedReplyMessage.java | 63 + .../IsMeetingMutedRequestMessage.java | 57 + .../IsWhiteboardEnabledReplyMessage.java | 61 + .../IsWhiteboardEnabledRequestMessage.java | 61 + .../common/messages/KeepAliveMessage.java | 12 + .../common/messages/LockLayoutMessage.java | 74 + .../messages/LockLayoutRequestMessage.java | 75 + .../messages/LockMuteUserRequestMessage.java | 69 + .../common/messages/LockUserMessage.java | 65 + .../common/messages/MeetingEndedMessage.java | 48 + .../messages/MeetingHasEndedMessage.java | 48 + .../common/messages/MeetingMutedMessage.java | 54 + .../common/messages/MeetingStateMessage.java | 67 + .../common/messages/MessageBuilder.java | 36 + .../messages/MessageFromJsonConverter.java | 91 + .../common/messages/MessagingConstants.java | 59 + .../common/messages/MessagingService.java | 27 + .../MuteAllExceptPresenterRequestMessage.java | 63 + .../messages/MuteAllRequestMessage.java | 63 + .../messages/MuteUserRequestMessage.java | 69 + .../messages/MuteVoiceUserRequestMessage.java | 69 + .../NewPermissionsSettingMessage.java | 69 + .../messages/PresentationRemovedMessage.java | 56 + .../messages/PresenterAssignedMessage.java | 64 + .../RecordingStatusChangedMessage.java | 59 + .../common/messages/RegisterUserMessage.java | 73 + .../messages/RemovePresentationMessage.java | 54 + ...eboardAnnotationHistoryRequestMessage.java | 66 + .../messages/ResizeAndMoveSlideMessage.java | 69 + .../SendConversionCompletedMessage.java | 80 + .../messages/SendConversionUpdateMessage.java | 70 + .../messages/SendCursorUpdateMessage.java | 58 + .../messages/SendLockSettingsMessage.java | 111 + .../messages/SendPageCountErrorMessage.java | 81 + .../messages/SendPrivateChatMessage.java | 119 + .../messages/SendPublicChatMessage.java | 119 + .../messages/SendSlideGeneratedMessage.java | 81 + .../SendWhiteboardAnnotationReplyMessage.java | 74 + ...endWhiteboardAnnotationRequestMessage.java | 66 + .../SetRecordingStatusRequestMessage.java | 59 + .../messages/SetUserStatusRequestMessage.java | 64 + .../messages/SharePresentationMessage.java | 60 + .../messages/UndoWhiteboardReplyMessage.java | 70 + .../messages/UndoWhiteboardRequest.java | 60 + .../messages/UserConnectedToGlobalAudio.java | 59 + .../UserDisconnectedFromGlobalAudio.java | 57 + .../common/messages/UserJoinedMessage.java | 60 + .../messages/UserJoinedVoiceMessage.java | 66 + .../common/messages/UserLeavingMessage.java | 52 + .../common/messages/UserLeftMessage.java | 60 + .../common/messages/UserLeftVoiceMessage.java | 66 + .../messages/UserListeningOnlyMessage.java | 59 + .../common/messages/UserLockedMessage.java | 59 + .../messages/UserLoweredHandMessage.java | 64 + .../messages/UserRaisedHandMessage.java | 59 + .../UserShareWebcamRequestMessage.java | 59 + .../messages/UserSharedWebcamMessage.java | 59 + .../messages/UserStatusChangedMessage.java | 65 + .../UserUnshareWebcamRequestMessage.java | 59 + .../messages/UserUnsharedWebcamMessage.java | 59 + .../messages/UserVoiceMutedMessage.java | 66 + .../messages/UserVoiceTalkingMessage.java | 66 + .../bigbluebutton/common/messages/Util.java | 428 ++++ .../messages/ValidateAuthTokenMessage.java | 71 + .../ValidateAuthTokenReplyMessage.java | 69 + .../ValidateAuthTokenTimeoutMessage.java | 69 + .../conference/service/chat/ChatKeyUtil.java | 13 + .../service/chat/ChatMessageListener.java | 45 + .../service/lock/LockMessageListener.java | 45 + .../participants/ParticipantsListener.java | 278 +++ .../ConversionUpdatesProcessor.java | 57 + .../PresentationMessageListener.java | 240 ++ .../presentation/PreuploadedPresentation.java | 12 + .../PreuploadedPresentationsUtil.java | 55 + .../GenericObjectPoolConfigWrapper.java | 142 ++ .../service/recorder/RecordEvent.java | 85 + .../conference/service/recorder/Recorder.java | 35 + .../service/recorder/RecorderApplication.java | 103 + .../service/recorder/RedisDispatcher.java | 50 + .../chat/AbstractChatRecordEvent.java | 28 + .../recorder/chat/PublicChatRecordEvent.java | 43 + .../AbstractParticipantRecordEvent.java | 28 + .../AssignPresenterRecordEvent.java | 39 + .../ParticipantEndAndKickAllRecordEvent.java | 27 + .../ParticipantJoinRecordEvent.java | 47 + .../ParticipantLeftRecordEvent.java | 32 + .../ParticipantStatusChangeRecordEvent.java | 39 + .../participants/RecordStatusRecordEvent.java | 35 + .../AbstractPresentationRecordEvent.java | 28 + ...rsionCompletedPresentationRecordEvent.java | 40 + .../presentation/CursorUpdateRecordEvent.java | 36 + .../GenerateSlidePresentationRecordEvent.java | 40 + .../GotoSlidePresentationRecordEvent.java | 81 + ...vePresentationPresentationRecordEvent.java | 33 + ...zeAndMoveSlidePresentationRecordEvent.java | 72 + ...rePresentationPresentationRecordEvent.java | 40 + .../service/voice/VoiceKeyUtil.java | 6 + .../service/voice/VoiceMessageListener.java | 49 + .../service/whiteboard/WhiteboardKeyUtil.java | 16 + .../whiteboard/WhiteboardListener.java | 67 + .../redis/AbstractWhiteboardRecordEvent.java | 46 + .../redis/AddShapeWhiteboardRecordEvent.java | 69 + .../redis/AddTextWhiteboardRecordEvent.java | 54 + .../redis/ClearPageWhiteboardRecordEvent.java | 28 + .../ModifyTextWhiteboardRecordEvent.java | 53 + .../ToggleGridWhiteboardRecordEvent.java | 33 + .../redis/UndoShapeWhiteboardRecordEvent.java | 32 + .../core/api/IBigBlueButtonInGW.java | 109 + .../bigbluebutton/core/api/IDispatcher.java | 6 + .../bigbluebutton/core/api/IOutMessage.java | 5 + .../core/api/MessageOutGateway.java | 18 + .../core/api/OutMessageListener2.java | 6 + .../core/api/RedisLpushDispatcher.java | 66 + .../redis/GenericObjectPoolConfigWrapper.java | 142 ++ .../core/pubsub/redis/MessageDistributor.java | 25 + .../core/pubsub/redis/MessageHandler.java | 23 + .../core/pubsub/redis/MessageReceiver.java | 87 + .../core/pubsub/redis/MessageSender.java | 71 + .../core/pubsub/redis/MessageToSend.java | 19 + .../core/pubsub/redis/ReceivedMessage.java | 28 + .../pubsub/redis/ReceivedMessageHandler.java | 65 + .../service/recording/RecordMessage.java | 5 + .../service/recording/RedisListRecorder.java | 73 + .../voice/AbstractVoiceRecordEvent.java | 32 + .../voice/ConferenceServerListener.java | 26 + .../voice/ConferenceServiceProvider.java | 28 + .../FreeswitchConferenceEventListener.java | 115 + .../voice/IVoiceConferenceService.java | 13 + .../ParticipantJoinedVoiceRecordEvent.java | 51 + .../ParticipantLeftVoiceRecordEvent.java | 31 + .../ParticipantLockedVoiceRecordEvent.java | 35 + .../ParticipantMutedVoiceRecordEvent.java | 35 + .../ParticipantTalkingVoiceRecordEvent.java | 36 + .../voice/StartRecordingVoiceRecordEvent.java | 38 + .../voice/VoiceEventRecorder.java | 141 ++ .../voice/commands/ConferenceCommand.java | 40 + .../commands/ConferenceCommandResult.java | 56 + .../commands/EjectParticipantCommand.java | 34 + .../commands/GetParticipantsCommand.java | 27 + .../commands/MuteParticipantCommand.java | 40 + .../voice/events/ConferenceEventListener.java | 25 + .../voice/events/UnknownConferenceEvent.java | 27 + .../voice/events/VoiceConferenceEvent.java | 32 + .../events/VoiceStartRecordingEvent.java | 51 + .../voice/events/VoiceUserJoinedEvent.java | 70 + .../voice/events/VoiceUserLeftEvent.java | 33 + .../voice/events/VoiceUserLockedEvent.java | 40 + .../voice/events/VoiceUserMutedEvent.java | 40 + .../voice/events/VoiceUserTalkingEvent.java | 40 + .../voice/freeswitch/ConnectionManager.java | 153 ++ .../voice/freeswitch/ESLEventListener.java | 201 ++ .../freeswitch/FreeswitchApplication.java | 202 ++ .../actions/BroadcastConferenceCommand.java | 50 + .../actions/EjectAllUsersCommand.java | 31 + .../actions/EjectParticipantCommand.java | 34 + .../freeswitch/actions/FreeswitchCommand.java | 45 + .../actions/MuteParticipantCommand.java | 40 + .../actions/PopulateRoomCommand.java | 115 + .../actions/RecordConferenceCommand.java | 50 + .../freeswitch/response/ConferenceMember.java | 88 + .../response/ConferenceMemberFlags.java | 54 + .../XMLResponseConferenceListParser.java | 158 ++ .../main/scala/org/bigbluebutton/Boot.scala | 8 - .../voice/freeswitch/HeartbeatMonitor.scala | 5 + .../core/BigBlueButtonActor.scala | 182 ++ .../core/BigBlueButtonGateway.scala | 23 + .../core/BigBlueButtonInGW.scala | 432 ++++ .../bigbluebutton/core/CollectorActor.scala | 1741 ++++++++++++++ .../bigbluebutton/core/CollectorGateway.scala | 22 + .../org/bigbluebutton/core/MeetingActor.scala | 245 ++ .../bigbluebutton/core/RunningMeeting.scala | 35 + .../core/SystemConfiguration.scala | 20 + .../scala/org/bigbluebutton/core/User.scala | 29 + .../core/api/ConsoleDispatcher.scala | 8 + .../bigbluebutton/core/api/Constants.scala | 97 + .../bigbluebutton/core/api/InMessages.scala | 376 +++ .../bigbluebutton/core/api/MessageNames.scala | 167 ++ .../bigbluebutton/core/api/OutMessages.scala | 510 ++++ .../core/api/TimestampGenerator.scala | 14 + .../bigbluebutton/core/api/ValueObjects.scala | 105 + .../org/bigbluebutton/core/api/Versions.scala | 5 + .../core/apps/chat/ChatApp.scala | 31 + .../core/apps/chat/ChatInGateway.scala | 19 + .../chat/redis/ChatEventRedisPublisher.scala | 38 + .../chat/redis/ChatEventRedisRecorder.scala | 29 + .../redis/ChatMessageToJsonConverter.scala | 67 + .../core/apps/layout/LayoutApp.scala | 66 + .../core/apps/layout/LayoutInGateway.scala | 26 + .../apps/presentation/PresentationApp.scala | 154 ++ .../apps/presentation/PresentationModel.scala | 127 + .../PesentationMessageToJsonConverter.scala | 281 +++ .../PresentationEventRedisPublisher.scala | 161 ++ .../PresentationEventRedisRecorder.scala | 127 + .../bigbluebutton/core/apps/users/Users.scala | 133 ++ .../core/apps/users/UsersApp.scala | 447 ++++ .../core/apps/users/UsersModel.scala | 101 + .../redis/UsersEventRedisPublisher.scala | 251 ++ .../users/redis/UsersEventRedisRecorder.scala | 214 ++ .../redis/UsersMessageToJsonConverter.scala | 429 ++++ .../core/apps/voice/VoiceApp.scala | 34 + .../core/apps/voice/VoiceInGateway.scala | 65 + .../core/apps/whiteboard/WhiteboardApp.scala | 100 + .../apps/whiteboard/WhiteboardInGateway.scala | 54 + .../apps/whiteboard/WhiteboardModel.scala | 87 + .../redis/WhiteboardEventRedisPublisher.scala | 56 + .../redis/WhiteboardEventRedisRecorder.scala | 92 + .../WhiteboardMessageToJsonConverter.scala | 94 + .../apps/whiteboard/vo/ValueObjects.scala | 3 + .../meeting/MeetingEventRedisPublisher.scala | 94 + .../MeetingMessageToJsonConverter.scala | 132 + .../bigbluebutton/core/messaging/Util.scala | 32 + .../bigbluebutton/core/models/Values.scala | 23 + .../core/util/RandomStringGenerator.scala | 17 + .../core/voice/VoiceConferenceActor.scala | 14 + .../core/voice/VoiceConferenceService.scala | 19 + .../freeswitch/FreeswitchConference.scala | 54 + .../FreeswitchConferenceActor.scala | 248 ++ .../FreeswitchConferenceService.scala | 123 + .../freeswitch/FreeswitchManagerProxy.scala | 32 + .../freeswitch/FsInGwWrapper.scala | 12 + .../bigbluebutton/apps/AppsTestFixtures.scala | 62 - .../apps/MeetingManagerSpec.scala | 54 - .../apps/MeetingManagerTestFixtures.scala | 12 - .../apps/MeetingManagerUnitSpec.scala | 42 - .../apps/RunningMeetingActorSpec.scala | 57 - .../bigbluebutton/apps/TestKitUsageSpec.scala | 154 -- .../org/bigbluebutton/apps/UnitSpec.scala | 8 - .../apps/models/UsersAppSpec.scala | 18 - .../apps/protocol/ClientConfigSpec.scala | 82 - .../protocol/ExampleMessageFixtures.scala | 286 --- .../bigbluebutton/apps/protocol/configws.sc | 146 -- .../apps/protocol/createmeetingrequest.sc | 199 -- .../apps/protocol/extractorsws.sc | 43 - .../apps/protocol/futureandpromise.sc | 48 - .../apps/protocol/futuretesting.sc | 72 - .../apps/protocol/joinuserrep.sc | 118 - .../apps/protocol/whiteboardmsgws.sc | 134 -- .../apps/users/data/usersmsgWS.sc | 114 - .../apps/whiteboard/data/sequencews.sc | 26 - .../endpoint/JsonMessagesFixtures.scala | 2116 ----------------- .../endpoint/MessageHandlerActorSpec.scala | 41 - .../MessageMarshallingActorSpec.scala | 38 - .../MessageUnmarshallingActorSpec.scala | 70 - .../UsersMessageJsonConversionSpec.scala | 124 - .../endpoint/UsersMessageTestFixtures.scala | 39 - .../bigbluebutton/endpoint/redis/JsonLens.sc | 81 - .../endpoint/redis/MessageTestWorksheet.sc | 15 - 281 files changed, 20008 insertions(+), 4207 deletions(-) create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Constants.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromMeetingRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EnableWhiteboardRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetWhiteboardShapesReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ISubscribedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitAudioSettingsMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitPermissionsSettingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockMuteUserRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingEndedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingHasEndedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingMutedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingStateMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageBuilder.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingService.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllExceptPresenterRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteVoiceUserRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/NewPermissionsSettingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresentationRemovedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresenterAssignedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordingStatusChangedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RequestWhiteboardAnnotationHistoryRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetRecordingStatusRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetUserStatusRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardRequest.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeavingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserListeningOnlyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLoweredHandMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserRaisedHandMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserShareWebcamRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserSharedWebcamMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserStatusChangedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnshareWebcamRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnsharedWebcamMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceMutedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceTalkingMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenReplyMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenTimeoutMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/GenericObjectPoolConfigWrapper.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageReceiver.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageSender.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageToSend.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessageHandler.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java create mode 100644 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala delete mode 100755 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala delete mode 100755 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc delete mode 100644 labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java new file mode 100755 index 0000000000..055e2723da --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java @@ -0,0 +1,64 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class AssignPresenterRequestMessage implements IPublishedMessage { + public static final String ASSIGN_PRESENTER_REQUEST = "assign_presenter_request_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final String newPresenterId; + public final String newPresenterName; + public final String assignedBy; + + public AssignPresenterRequestMessage(String meetingID, String newPresenterId, String newPresenterName, String assignedBy) { + this.meetingId = meetingID; + this.newPresenterId = newPresenterId; + this.newPresenterName = newPresenterName; + this.assignedBy = assignedBy; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.NEW_PRESENTER_ID, newPresenterId); + payload.put(Constants.NEW_PRESENTER_NAME, newPresenterName); + payload.put(Constants.ASSIGNED_BY, assignedBy); + + java.util.HashMap header = MessageBuilder.buildHeader(ASSIGN_PRESENTER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static AssignPresenterRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (ASSIGN_PRESENTER_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NEW_PRESENTER_ID) + && payload.has(Constants.NEW_PRESENTER_NAME) + && payload.has(Constants.ASSIGNED_BY)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String newPresenterId = payload.get(Constants.USER_ID).getAsString(); + String newPresenterName = payload.get(Constants.NEW_PRESENTER_NAME).getAsString(); + String assignedBy = payload.get(Constants.ASSIGNED_BY).getAsString(); + + return new AssignPresenterRequestMessage(meetingId, newPresenterId, newPresenterName, assignedBy); + } + } + } + } + System.out.println("Failed to parse DisconnectUserMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutMessage.java new file mode 100755 index 0000000000..1aaf863f5c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutMessage.java @@ -0,0 +1,80 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class BroadcastLayoutMessage implements ISubscribedMessage { + public static final String BROADCAST_LAYOUT = "broadcast_layout_message"; + public static final String VERSION = "0.0.1"; + + public static final String SET_BY_USERID = "set_by_userid"; + public static final String LAYOUT = "layout"; + public static final String LOCKED = "locked"; + public static final String USERS = "users"; + + public final String meetingId; + public final String setByUserid; + public final String layout; + public final Boolean locked; + public final ArrayList users; + + public BroadcastLayoutMessage(String meetingId, String setByUserid, String layout, Boolean locked, ArrayList users) { + this.meetingId = meetingId; + this.setByUserid = setByUserid; + this.layout = layout; + this.locked = locked; + this.users = users; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(SET_BY_USERID, setByUserid); + payload.put(LAYOUT, layout); + payload.put(LOCKED, locked); + payload.put(USERS, users); + + java.util.HashMap header = MessageBuilder.buildHeader(BROADCAST_LAYOUT, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static BroadcastLayoutMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (BROADCAST_LAYOUT.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(LOCKED) + && payload.has(SET_BY_USERID) + && payload.has(USERS) + && payload.has(LAYOUT)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String setByUserid = payload.get(SET_BY_USERID).getAsString(); + String layout = payload.get(LAYOUT).getAsString(); + Boolean locked = payload.get(LOCKED).getAsBoolean(); + JsonArray usersArr = (JsonArray) payload.get(USERS); + + Util util = new Util(); + + ArrayList users = util.extractUserids(usersArr); + return new BroadcastLayoutMessage(id, setByUserid, layout, locked, users); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutRequestMessage.java new file mode 100755 index 0000000000..2aaa198cce --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/BroadcastLayoutRequestMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class BroadcastLayoutRequestMessage implements ISubscribedMessage { + public static final String BROADCAST_LAYOUT_REQUEST = "broadcast_layout_request_message"; + public static final String VERSION = "0.0.1"; + + public final static String LAYOUT = "layout"; + + public final String meetingId; + public final String userId; + public final String layout; + + public BroadcastLayoutRequestMessage(String meetingId, String userId, String layout) { + this.meetingId = meetingId; + this.userId = userId; + this.layout = layout; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(LAYOUT, layout); + + java.util.HashMap header = MessageBuilder.buildHeader(BROADCAST_LAYOUT_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static BroadcastLayoutRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (BROADCAST_LAYOUT_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(LAYOUT)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String layout = payload.get(LAYOUT).getAsString(); + return new BroadcastLayoutRequestMessage(id, userid, layout); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardReplyMessage.java new file mode 100755 index 0000000000..aa09e04332 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardReplyMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class ClearWhiteboardReplyMessage implements ISubscribedMessage { + + public static final String WHITEBOARD_CLEARED_MESSAGE = "whiteboard_cleared_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String whiteboardId; + public final String requesterId; + + + public ClearWhiteboardReplyMessage(String meetingId, String requesterId, String whiteboardId) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("ClearWhiteboardReplyMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(WHITEBOARD_CLEARED_MESSAGE, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static ClearWhiteboardReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (WHITEBOARD_CLEARED_MESSAGE.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + System.out.println("ClearWhiteboardReplyMessage fromJson"); + return new ClearWhiteboardReplyMessage(meetingId, requesterId, whiteboardId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardRequestMessage.java new file mode 100755 index 0000000000..508c56b96a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ClearWhiteboardRequestMessage.java @@ -0,0 +1,60 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class ClearWhiteboardRequestMessage implements ISubscribedMessage { + public static final String CLEAR_WHITEBOARD_REQUEST = "clear_whiteboard_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String whiteboardId; + public final String requesterId; + + + public ClearWhiteboardRequestMessage(String meetingId, String requesterId, String whiteboardId) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("ClearWhiteboardRequestMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(CLEAR_WHITEBOARD_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static ClearWhiteboardRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (CLEAR_WHITEBOARD_REQUEST.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + System.out.println("ClearWhiteboardRequestMessage fromJson"); + return new ClearWhiteboardRequestMessage(meetingId, requesterId, whiteboardId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Constants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Constants.java new file mode 100755 index 0000000000..381453eb9d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Constants.java @@ -0,0 +1,130 @@ +package org.bigbluebutton.common.messages; + +public class Constants { + public static final String NAME = "name"; + public static final String HEADER = "header"; + public static final String PAYLOAD = "payload"; + public static final String MEETING_ID = "meeting_id"; + public static final String EXTERNAL_MEETING_ID = "external_meeting_id"; + public static final String TIMESTAMP = "timestamp"; + public static final String USER_ID = "userid"; + public static final String RECORDED = "recorded"; + public static final String MEETING_NAME = "meeting_name"; + public static final String MEETING_MUTED = "meetingMuted"; + public static final String VOICE_CONF = "voice_conf"; + public static final String DURATION = "duration"; + public static final String AUTH_TOKEN = "auth_token"; + public static final String ROLE = "role"; + public static final String EXT_USER_ID = "external_user_id"; + public static final String EXTERN_USERID = "extern_userid"; + public static final String REQUESTER_ID = "requester_id"; + public static final String REPLY_TO = "reply_to"; + public static final String LOWERED_BY = "lowered_by"; + public static final String STREAM = "stream"; + public static final String LOCKED = "locked"; + public static final String SETTINGS = "settings"; + public static final String LOCK = "lock"; + public static final String EXCEPT_USERS = "except_users"; + public static final String STATUS = "status"; + public static final String VALUE = "value"; + public static final String NEW_PRESENTER_ID = "new_presenter_id"; + public static final String NEW_PRESENTER_NAME = "new_presenter_name"; + public static final String ASSIGNED_BY = "assigned_by"; + public static final String RECORDING = "recording"; + public static final String AUTO_START_RECORDING = "auto_start_recording"; + public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording"; + public static final String LAYOUT_ID = "layout_id"; + public static final String LISTENONLY = "listenOnly"; + public static final String LISTEN_ONLY = "listen_only"; + public static final String POLL = "poll"; + public static final String POLL_ID = "poll_id"; + public static final String FORCE = "force"; + public static final String RESPONSE = "response"; + public static final String PRESENTATION_ID = "presentation_id"; + public static final String X_OFFSET = "x_offset"; + public static final String Y_OFFSET = "y_offset"; + public static final String WIDTH_RATIO = "width_ratio"; + public static final String HEIGHT_RATIO = "height_ratio"; + public static final String PAGE = "page"; + public static final String SHARE = "share"; + public static final String PRESENTATIONS = "presentations"; + public static final String MESSAGE_KEY = "message_key"; + public static final String CODE = "code"; + public static final String PRESENTATION_NAME = "presentation_name"; + public static final String NUM_PAGES = "num_pages"; + public static final String MAX_NUM_PAGES = "max_num_pages"; + public static final String PAGES_COMPLETED = "pages_completed"; + public static final String MUTE = "mute"; + public static final String CALLER_ID_NUM = "caller_id_num"; + public static final String CALLER_ID_NAME = "caller_id_name"; + public static final String CALLERNUM = "callernum"; + public static final String CALLERNAME = "callername"; + public static final String TALKING = "talking"; + public static final String USER = "user"; + public static final String MUTED = "muted"; + public static final String VOICE_USER = "voice_user"; + public static final String VOICEUSER = "voiceUser"; + public static final String RECORDING_FILE = "recording_file"; + public static final String ANNOTATION = "annotation"; + public static final String WHITEBOARD_ID = "whiteboard_id"; + public static final String ENABLE = "enable"; + public static final String PRESENTER = "presenter"; + public static final String USERS = "users"; + public static final String RAISE_HAND = "raise_hand"; + public static final String HAS_STREAM = "has_stream"; + public static final String WEBCAM_STREAM = "webcam_stream"; + public static final String PHONE_USER = "phone_user"; + public static final String PERMISSIONS = "permissions"; + public static final String VALID = "valid"; + public static final String CHAT_HISTORY = "chat_history"; + public static final String MESSAGE = "message"; + public static final String SET_BY_USER_ID = "set_by_user_id"; + public static final String POLLS = "polls"; + public static final String REASON = "reason"; + public static final String RESPONDER = "responder"; + public static final String PRESENTATION_INFO = "presentation_info"; + public static final String SHAPES = "shapes"; + public static final String SHAPE = "shape"; + public static final String SHAPE_ID = "shape_id"; + public static final String PRESENTATION = "presentation"; + public static final String ID = "id"; + public static final String CURRENT = "current"; + public static final String PAGES = "pages"; + public static final String WEB_USER_ID = "web_user_id"; + public static final String WEB_USERID = "web_userid"; + public static final String JOINED = "joined"; + public static final String X_PERCENT = "x_percent"; + public static final String Y_PERCENT = "y_percent"; + public static final String KEEP_ALIVE_ID = "keep_alive_id"; + public static final String INTERNAL_USER_ID = "internal_user_id"; + public static final String MODERATOR_PASS = "moderator_pass"; + public static final String VIEWER_PASS = "viewer_pass"; + public static final String CREATE_TIME = "create_time"; + public static final String CREATE_DATE = "create_date"; + public static final String PRESENTATION_BASE_URL = "presentation_base_url"; + public static final String DISABLE_CAMERA = "disable_camera"; + public static final String LOCK_ON_JOIN_CONFIGURABLE = "lock_on_join_configurable"; + public static final String DISABLE_MICROPHONE = "disable_microphone"; + public static final String DISABLE_PRIVATE_CHAT = "disable_private_chat"; + public static final String DISABLE_PUBLIC_CHAT = "disable_public_chat"; + public static final String LOCK_ON_JOIN = "lock_on_join"; + public static final String LOCKED_LAYOUT = "locked_layout"; + public static final String CHAT_TYPE = "chat_type"; + public static final String TO_USERNAME = "to_username"; + public static final String FROM_USERNAME = "from_username"; + public static final String FROM_USERID = "from_userid"; + public static final String FROM_TZ_OFFSET = "from_tz_offset"; + public static final String FROM_COLOR = "from_color"; + public static final String TO_USERID = "to_userid"; + public static final String FROM_TIME = "from_time"; + public static final String PERM_DISABLE_CAM = "disableCam"; + public static final String PERM_DISABLE_MIC = "disableMic"; + public static final String PERM_DISABLE_PRIVCHAT = "disablePrivChat"; + public static final String PERM_DISABLE_PUBCHAT = "disablePubChat"; + public static final String PERM_LOCKED_LAYOUT = "lockedLayout"; + public static final String PERM_LOCK_ON_JOIN = "lockOnJoin"; + public static final String PERM_LOCK_ON_JOIN_CONFIG = "lockOnJoinConfigurable"; + public static final String ENABLED = "enabled"; +} + + diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java new file mode 100755 index 0000000000..461c0d283f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java @@ -0,0 +1,37 @@ +package org.bigbluebutton.common.messages; + +public class CreateMeetingMessage implements IPublishedMessage { + public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; + public static final String VERSION = "0.0.1"; + + public final String id; + public final String externalId; + public final String name; + public final Boolean record; + public final String voiceBridge; + public final Long duration; + public final Boolean autoStartRecording; + public final Boolean allowStartStopRecording; + public final String moderatorPass; + public final String viewerPass; + public final Long createTime; + public final String createDate; + + public CreateMeetingMessage(String id, String externalId, String name, Boolean record, String voiceBridge, + Long duration, Boolean autoStartRecording, + Boolean allowStartStopRecording, String moderatorPass, + String viewerPass, Long createTime, String createDate) { + this.id = id; + this.externalId = externalId; + this.name = name; + this.record = record; + this.voiceBridge = voiceBridge; + this.duration = duration; + this.autoStartRecording = autoStartRecording; + this.allowStartStopRecording = allowStartStopRecording; + this.moderatorPass = moderatorPass; + this.viewerPass = viewerPass; + this.createTime = createTime; + this.createDate = createDate; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java new file mode 100755 index 0000000000..4e040e4f4b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.common.messages; + +public class DestroyMeetingMessage implements IPublishedMessage { + public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public DestroyMeetingMessage(String meetingId) { + this.meetingId = meetingId; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java new file mode 100755 index 0000000000..de3d841bea --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java @@ -0,0 +1,48 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class DisconnectAllUsersMessage implements IPublishedMessage { + public static final String DISCONNECT_All_USERS = "disconnect_all_users_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + + public DisconnectAllUsersMessage(String meetingID) { + this.meetingId = meetingID; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(DISCONNECT_All_USERS, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static DisconnectAllUsersMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (DISCONNECT_All_USERS.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + + return new DisconnectAllUsersMessage(meetingId); + } + } + } + } + System.out.println("Failed to parse DisconnectAllUsersMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java new file mode 100755 index 0000000000..23b0f1109a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java @@ -0,0 +1,51 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class DisconnectUserMessage implements IPublishedMessage { + public static final String DISCONNECT_USER = "disconnect_user_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + + public DisconnectUserMessage(String meetingID, String userId) { + this.meetingId = meetingID; + this.userId = userId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(DISCONNECT_USER, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static DisconnectUserMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (DISCONNECT_USER.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String userId = payload.get(Constants.USER_ID).getAsString(); + + return new DisconnectUserMessage(meetingId, userId); + } + } + } + } + System.out.println("Failed to parse DisconnectUserMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromMeetingRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromMeetingRequestMessage.java new file mode 100755 index 0000000000..3476aec138 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromMeetingRequestMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class EjectUserFromMeetingRequestMessage implements ISubscribedMessage { + public static final String EJECT_USER_FROM_MEETING_REQUEST = "eject_user_from_meeting_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String ejectedBy; + + private static final String EJECTED_BY = "ejected_by"; + + public EjectUserFromMeetingRequestMessage(String meetingId, String userId, String ejectedBy) { + this.meetingId = meetingId; + this.userId = userId; + this.ejectedBy = ejectedBy; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(EJECTED_BY, ejectedBy); + + java.util.HashMap header = MessageBuilder.buildHeader(EJECT_USER_FROM_MEETING_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static EjectUserFromMeetingRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (EJECT_USER_FROM_MEETING_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(EJECTED_BY)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String ejectedBy = payload.get(EJECTED_BY).getAsString(); + return new EjectUserFromMeetingRequestMessage(id, userid, ejectedBy); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceRequestMessage.java new file mode 100755 index 0000000000..e3715ad2cd --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceRequestMessage.java @@ -0,0 +1,63 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class EjectUserFromVoiceRequestMessage implements ISubscribedMessage { + public static final String EJECT_USER_FROM_VOICE_REQUEST = "eject_user_from_voice_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String USER_ID = "user_id"; + + public final String meetingId; + public final String requesterId; + public final String userId; + + public EjectUserFromVoiceRequestMessage(String meetingId, String requesterId, String userId) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.userId = userId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(USER_ID, userId); + + java.util.HashMap header = MessageBuilder.buildHeader(EJECT_USER_FROM_VOICE_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static EjectUserFromVoiceRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (EJECT_USER_FROM_VOICE_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(USER_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + String userId = payload.get(USER_ID).getAsString(); + return new EjectUserFromVoiceRequestMessage(id, requesterId, userId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EnableWhiteboardRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EnableWhiteboardRequestMessage.java new file mode 100755 index 0000000000..03780c212f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EnableWhiteboardRequestMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class EnableWhiteboardRequestMessage implements ISubscribedMessage { + public static final String ENABLE_WHITEBOARD_REQUEST = "enable_whiteboard_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final boolean enable; + + + public EnableWhiteboardRequestMessage(String meetingId, + String requesterId, boolean enable) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.enable = enable; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.ENABLE, enable); + + System.out.println("EnableWhiteboardRequestMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(ENABLE_WHITEBOARD_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static EnableWhiteboardRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (ENABLE_WHITEBOARD_REQUEST.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.ENABLE) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + boolean enable = payload.get(Constants.ENABLE).getAsBoolean(); + + System.out.println("EnableWhiteboardRequestMessage fromJson"); + return new EnableWhiteboardRequestMessage(meetingId, requesterId, enable); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java new file mode 100755 index 0000000000..f2aa8d2df9 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.common.messages; + +public class EndMeetingMessage implements IPublishedMessage { + public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public EndMeetingMessage(String meetingId) { + this.meetingId = meetingId; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java new file mode 100755 index 0000000000..f4d321f357 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.common.messages; + +public class GetAllMeetingsRequest implements IPublishedMessage { + public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + + public GetAllMeetingsRequest(String meetingId) { + this.meetingId = meetingId; + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java new file mode 100755 index 0000000000..ff252757fb --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetChatHistory implements IPublishedMessage { + public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String replyTo; + public final String requesterId; + + + public GetChatHistory(String meetingId, String requesterId, String replyTo) { + this.meetingId = meetingId; + this.replyTo = replyTo; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REPLY_TO, replyTo); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("GetChatHistory toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static GetChatHistory fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_CHAT_HISTORY_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REPLY_TO) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + System.out.println("GetChatHistory fromJson"); + return new GetChatHistory(meetingId, replyTo, requesterId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java new file mode 100755 index 0000000000..be53843ae1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetChatHistoryReplyMessage implements ISubscribedMessage { + public static final String GET_CHAT_HISTORY_REPLY = "get_chat_history_reply"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final ArrayList> chatHistory; + + + public GetChatHistoryReplyMessage(String meetingId, String requesterId, ArrayList> chatHistory) { + this.meetingId = meetingId; + this.chatHistory = chatHistory; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.CHAT_HISTORY, chatHistory); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("GetChatHistoryReplyMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REPLY, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static GetChatHistoryReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_CHAT_HISTORY_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.CHAT_HISTORY) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + JsonArray history = (JsonArray) payload.get(Constants.CHAT_HISTORY); + + Util util = new Util(); + + ArrayList> chatHistory = util.extractChatHistory(history); + System.out.println("GetChatHistoryReplyMessage fromJson"); + return new GetChatHistoryReplyMessage(meetingId, requesterId, chatHistory); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java new file mode 100755 index 0000000000..a88fe24fd7 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java @@ -0,0 +1,58 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +public class GetChatHistoryRequestMessage implements IPublishedMessage { + public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String replyTo; + public final String requesterId; + + + public GetChatHistoryRequestMessage(String meetingId, String requesterId, String replyTo) { + this.meetingId = meetingId; + this.replyTo = replyTo; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REPLY_TO, replyTo); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("GetChatHistory toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static GetChatHistoryRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_CHAT_HISTORY_REQUEST.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REPLY_TO) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + System.out.println("GetChatHistory fromJson"); + return new GetChatHistoryRequestMessage(meetingId, replyTo, requesterId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutReplyMessage.java new file mode 100755 index 0000000000..d14fe7cc19 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutReplyMessage.java @@ -0,0 +1,74 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class GetCurrentLayoutReplyMessage implements ISubscribedMessage { + public static final String GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply_message"; + public static final String VERSION = "0.0.1"; + + public static final String SET_BY_USERID = "set_by_userid"; + public static final String REQUESTED_BY_USERID = "requested_by_userid"; + public static final String LAYOUT = "layout"; + public static final String LOCKED = "locked"; + + public final String meetingId; + public final String requestedByUserid; + public final String setByUserid; + public final String layout; + public final Boolean locked; + + public GetCurrentLayoutReplyMessage(String meetingId, String requestedByUserid, String setByUserid, String layout, Boolean locked) { + this.meetingId = meetingId; + this.requestedByUserid = requestedByUserid; + this.setByUserid = setByUserid; + this.layout = layout; + this.locked = locked; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(REQUESTED_BY_USERID, requestedByUserid); + payload.put(SET_BY_USERID, setByUserid); + payload.put(LAYOUT, layout); + payload.put(LOCKED, locked); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_CURRENT_LAYOUT_REPLY, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static GetCurrentLayoutReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_CURRENT_LAYOUT_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(REQUESTED_BY_USERID) + && payload.has(SET_BY_USERID) + && payload.has(LOCKED) + && payload.has(LAYOUT)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String requestedByUserid = payload.get(REQUESTED_BY_USERID).getAsString(); + String setByUserid = payload.get(SET_BY_USERID).getAsString(); + String layout = payload.get(LAYOUT).getAsString(); + Boolean locked = payload.get(LOCKED).getAsBoolean(); + return new GetCurrentLayoutReplyMessage(id, requestedByUserid, setByUserid, layout, locked); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutRequestMessage.java new file mode 100755 index 0000000000..c63028ea21 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetCurrentLayoutRequestMessage.java @@ -0,0 +1,55 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class GetCurrentLayoutRequestMessage implements ISubscribedMessage { + public static final String GET_CURRENT_LAYOUT_REQUEST = "get_current_layout_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + + + public GetCurrentLayoutRequestMessage(String meetingId, String userId) { + this.meetingId = meetingId; + this.userId = userId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_CURRENT_LAYOUT_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static GetCurrentLayoutRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_CURRENT_LAYOUT_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + return new GetCurrentLayoutRequestMessage(id, userid); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java new file mode 100755 index 0000000000..0c59fbe6b3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java @@ -0,0 +1,54 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetLockSettingsMessage implements IPublishedMessage { + public static final String GET_LOCK_SETTINGS = "get_lock_settings"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + + + public GetLockSettingsMessage(String meetingId, String userId) { + this.meetingId = meetingId; + this.userId = userId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + + System.out.println("GetLockSettings toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(GET_LOCK_SETTINGS, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static GetLockSettingsMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_LOCK_SETTINGS.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String userId = payload.get(Constants.USER_ID).getAsString(); + System.out.println("GetLockSettings fromJson"); + return new GetLockSettingsMessage(meetingId, userId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java new file mode 100755 index 0000000000..57aea21d01 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java @@ -0,0 +1,58 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetPresentationInfoMessage implements IPublishedMessage { + public static final String GET_PRESENTATION_INFO = "get_presentation_info"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final String replyTo; + + public GetPresentationInfoMessage(String meetingId, String requesterId, String replyTo) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.replyTo = replyTo; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.REPLY_TO, replyTo); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_PRESENTATION_INFO, VERSION, null); + System.out.println("GetPresentationInfo toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static GetPresentationInfoMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_PRESENTATION_INFO.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID) + && payload.has(Constants.REPLY_TO)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + System.out.println("GetPresentationInfo fromJson"); + return new GetPresentationInfoMessage(meetingId, requesterId, replyTo); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java new file mode 100755 index 0000000000..a420f5aaf1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java @@ -0,0 +1,72 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetPresentationInfoReplyMessage implements IPublishedMessage { + public static final String GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final Map presenter; + public final ArrayList> presentations; + + public GetPresentationInfoReplyMessage(String meetingId, String requesterId, + Map presenter, ArrayList> presentations) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.presenter = presenter; + this.presentations = presentations; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.PRESENTER, presenter); + payload.put(Constants.PRESENTATIONS, presentations); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_PRESENTATION_INFO_REPLY, VERSION, null); + System.out.println("GetPresentationInfo toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static GetPresentationInfoReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_PRESENTATION_INFO_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID) + && payload.has(Constants.PRESENTER) + && payload.has(Constants.PRESENTATIONS)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + JsonObject presenterJsonObject = payload.get(Constants.PRESENTER).getAsJsonObject(); + + Util util = new Util(); + Map presenter = util.extractCurrentPresenter(presenterJsonObject); + + JsonArray presentationsJsonArray = payload.get(Constants.PRESENTATIONS).getAsJsonArray(); + ArrayList> presentations = util.extractPresentations(presentationsJsonArray); + + return new GetPresentationInfoReplyMessage(meetingId, requesterId, presenter, presentations); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusReplyMessage.java new file mode 100755 index 0000000000..319143f28d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusReplyMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class GetRecordingStatusReplyMessage implements ISubscribedMessage { + public static final String Get_RECORDING_STATUS_REPLY = "get_recording_status_reply"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean recording; + + public GetRecordingStatusReplyMessage(String meetingId, String userId, Boolean recording) { + this.meetingId = meetingId; + this.userId = userId; + this.recording = recording; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.RECORDING, recording); + + java.util.HashMap header = MessageBuilder.buildHeader(Get_RECORDING_STATUS_REPLY, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static GetRecordingStatusReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (Get_RECORDING_STATUS_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.RECORDING)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean recording = payload.get(Constants.RECORDING).getAsBoolean(); + return new GetRecordingStatusReplyMessage(id, userid, recording); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusRequestMessage.java new file mode 100755 index 0000000000..ead0ae5b00 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetRecordingStatusRequestMessage.java @@ -0,0 +1,54 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class GetRecordingStatusRequestMessage implements ISubscribedMessage { + public static final String GET_RECORDING_STATUS_REQUEST = "get_recording_status_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + + public GetRecordingStatusRequestMessage(String meetingId, String userId) { + this.meetingId = meetingId; + this.userId = userId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_RECORDING_STATUS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static GetRecordingStatusRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_RECORDING_STATUS_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + return new GetRecordingStatusRequestMessage(id, userid); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java new file mode 100755 index 0000000000..53b3a0756c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetSlideInfoMessage implements IPublishedMessage { + public static final String GET_SLIDE_INFO = "get_slide_info"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final String replyTo; + + public GetSlideInfoMessage(String meetingId, String requesterId, String replyTo){ + this.meetingId = meetingId; + this.requesterId = requesterId; + this.replyTo = replyTo; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.REPLY_TO, replyTo); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_SLIDE_INFO, VERSION, null); + System.out.println("GetSlideInfo toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static GetSlideInfoMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_SLIDE_INFO.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID) + && payload.has(Constants.REPLY_TO)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + + System.out.println("GetSlideInfo fromJson"); + return new GetSlideInfoMessage(meetingId, requesterId, replyTo); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersReplyMessage.java new file mode 100755 index 0000000000..23e5601f88 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersReplyMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetUsersReplyMessage implements ISubscribedMessage { + public static final String GET_USERS_REPLY = "get_users_reply"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final ArrayList> users; + + public GetUsersReplyMessage(String meetingID, String requesterId, ArrayList> users) { + this.meetingId = meetingID; + this.requesterId = requesterId; + this.users = users; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(GET_USERS_REPLY, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static GetUsersReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_USERS_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID) + && payload.has(Constants.USERS)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + JsonArray users = (JsonArray) payload.get(Constants.USERS); + + Util util = new Util(); + ArrayList> usersList = util.extractUsers(users); + + if (usersList != null) { + return new GetUsersReplyMessage(meetingID, requesterId, usersList); + } + } + } + } + } + System.out.println("Failed to parse GetUsersReplyMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java new file mode 100755 index 0000000000..cdffd7635c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java @@ -0,0 +1,53 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetUsersRequestMessage implements IPublishedMessage { + public static final String GET_USERS_REQUEST = "get_users_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + + + public GetUsersRequestMessage(String meetingId, String requesterId) { + this.meetingId = meetingId; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_USERS_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static GetUsersRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_USERS_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + System.out.println("GetChatHistory fromJson"); + return new GetUsersRequestMessage(meetingId, requesterId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetWhiteboardShapesReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetWhiteboardShapesReplyMessage.java new file mode 100755 index 0000000000..87cc49efe7 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetWhiteboardShapesReplyMessage.java @@ -0,0 +1,73 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GetWhiteboardShapesReplyMessage implements ISubscribedMessage { + public static final String GET_WHITEBOARD_SHAPES_REPLY = "get_whiteboard_shapes_reply"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final String whiteboardId; + public final ArrayList> shapes; + + + public GetWhiteboardShapesReplyMessage(String meetingId, String requesterId, + String whiteboardId, ArrayList> shapes) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + this.shapes = shapes; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.SHAPES, shapes); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("GetWhiteboardShapesReplyMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(GET_WHITEBOARD_SHAPES_REPLY, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static GetWhiteboardShapesReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_WHITEBOARD_SHAPES_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.SHAPES) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + + JsonArray shapes = (JsonArray) payload.get(Constants.SHAPES); + + Util util = new Util(); + + ArrayList> shapesList = util.extractShapes(shapes); + System.out.println("GetWhiteboardShapesReplyMessage fromJson" + shapesList.toString()); + return new GetWhiteboardShapesReplyMessage(meetingId, requesterId, + whiteboardId, shapesList); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java new file mode 100755 index 0000000000..16925c3a67 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java @@ -0,0 +1,54 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class GoToSlideMessage implements IPublishedMessage { + public static final String GO_TO_SLIDE = "go_to_slide"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String page; + + public GoToSlideMessage(String meetingId, String page){ + this.meetingId = meetingId; + this.page = page; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.PAGE, page); + + java.util.HashMap header = MessageBuilder.buildHeader(GO_TO_SLIDE, VERSION, null); + System.out.println("GoToSlide toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static GoToSlideMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GO_TO_SLIDE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.PAGE)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String page = payload.get(Constants.PAGE).getAsString(); + + System.out.println("GoToSlide fromJson"); + return new GoToSlideMessage(meetingId, page); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java new file mode 100755 index 0000000000..649f395876 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.common.messages; + +public interface IPublishedMessage { + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ISubscribedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ISubscribedMessage.java new file mode 100755 index 0000000000..2a40912aee --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ISubscribedMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.common.messages; + +public interface ISubscribedMessage { + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitAudioSettingsMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitAudioSettingsMessage.java new file mode 100755 index 0000000000..d87523b9e4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitAudioSettingsMessage.java @@ -0,0 +1,58 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class InitAudioSettingsMessage implements ISubscribedMessage { + public static final String INIT_AUDIO_SETTING = "init_audio_settings_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean muted; + + public InitAudioSettingsMessage(String meetingID, String userId, Boolean muted) { + this.meetingId = meetingID; + this.userId = userId; + this.muted = muted; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(INIT_AUDIO_SETTING, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static InitAudioSettingsMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (INIT_AUDIO_SETTING.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.MUTED)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String userId = payload.get(Constants.USER_ID).getAsString(); + Boolean muted = payload.get(Constants.MUTED).getAsBoolean(); + + return new InitAudioSettingsMessage(meetingID, userId, muted); + } + } + } + } + System.out.println("Failed to parse NewPermissionsSettingMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitPermissionsSettingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitPermissionsSettingMessage.java new file mode 100755 index 0000000000..7a1364006e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/InitPermissionsSettingMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class InitPermissionsSettingMessage implements ISubscribedMessage { + public static final String INIT_PERMISSIONS_SETTING = "init_permission_settings_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map permissions; + + public InitPermissionsSettingMessage(String meetingID, Map permissions) { + this.meetingId = meetingID; + this.permissions = permissions; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(INIT_PERMISSIONS_SETTING, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static InitPermissionsSettingMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (INIT_PERMISSIONS_SETTING.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USERS) + && payload.has(Constants.PERMISSIONS)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + + JsonObject permissions = (JsonObject) payload.get(Constants.PERMISSIONS); + + Util util = new Util(); + Map permissionsMap = util.extractPermission(permissions); + + if (permissionsMap != null) { + return new InitPermissionsSettingMessage(meetingID, permissionsMap); + } + } + } + } + } + System.out.println("Failed to parse NewPermissionsSettingMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedReplyMessage.java new file mode 100755 index 0000000000..51188c6dc5 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedReplyMessage.java @@ -0,0 +1,63 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class IsMeetingMutedReplyMessage implements ISubscribedMessage { + public static final String IS_MEETING_MUTED_REPLY = "is_meeting_muted_reply_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String MUTED = "muted"; + + public final String meetingId; + public final String requesterId; + public final Boolean muted; + + public IsMeetingMutedReplyMessage(String meetingId, String requesterId, Boolean muted) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.muted = muted; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(MUTED, muted); + + java.util.HashMap header = MessageBuilder.buildHeader(IS_MEETING_MUTED_REPLY, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static IsMeetingMutedReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (IS_MEETING_MUTED_REPLY.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(MUTED)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + Boolean muted = payload.get(MUTED).getAsBoolean(); + return new IsMeetingMutedReplyMessage(id, requesterId, muted); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedRequestMessage.java new file mode 100755 index 0000000000..dcb391b804 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsMeetingMutedRequestMessage.java @@ -0,0 +1,57 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class IsMeetingMutedRequestMessage implements ISubscribedMessage { + public static final String IS_MEETING_MUTED_REQUEST = "is_meeting_muted_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + + public final String meetingId; + public final String requesterId; + + public IsMeetingMutedRequestMessage(String meetingId, String requesterId) { + this.meetingId = meetingId; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + + java.util.HashMap header = MessageBuilder.buildHeader(IS_MEETING_MUTED_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static IsMeetingMutedRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (IS_MEETING_MUTED_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + return new IsMeetingMutedRequestMessage(id, requesterId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledReplyMessage.java new file mode 100755 index 0000000000..a597086b0f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledReplyMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class IsWhiteboardEnabledReplyMessage implements ISubscribedMessage { + + public static final String IS_WHITEBOARD_ENABLED_REPLY = "whiteboard_enabled_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final boolean enabled; + + + public IsWhiteboardEnabledReplyMessage(String meetingId, String requesterId, boolean enabled) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.enabled = enabled; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.ENABLED, enabled); + + System.out.println("IsWhiteboardEnabledReplyMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(IS_WHITEBOARD_ENABLED_REPLY, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static IsWhiteboardEnabledReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (IS_WHITEBOARD_ENABLED_REPLY.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID) + && payload.has(Constants.ENABLED)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + boolean enabled = payload.get(Constants.ENABLED).getAsBoolean(); + + System.out.println("IsWhiteboardEnabledReplyMessage fromJson"); + return new IsWhiteboardEnabledReplyMessage(meetingId, requesterId, enabled); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledRequestMessage.java new file mode 100755 index 0000000000..f5319bb489 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/IsWhiteboardEnabledRequestMessage.java @@ -0,0 +1,61 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class IsWhiteboardEnabledRequestMessage implements ISubscribedMessage { + public static final String IS_WHITEBOARD_ENABLED_REQUEST = "is_whiteboard_enabled"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final String replyTo; + + + public IsWhiteboardEnabledRequestMessage(String meetingId, + String requesterId, String replyTo) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.replyTo = replyTo; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.REPLY_TO, replyTo); + + System.out.println("IsWhiteboardEnabledRequestMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(IS_WHITEBOARD_ENABLED_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static IsWhiteboardEnabledRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (IS_WHITEBOARD_ENABLED_REQUEST.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REPLY_TO) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + + System.out.println("IsWhiteboardEnabledRequestMessage fromJson"); + return new IsWhiteboardEnabledRequestMessage(meetingId, requesterId, replyTo); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java new file mode 100755 index 0000000000..059211e811 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.common.messages; + +public class KeepAliveMessage implements IPublishedMessage { + public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; + public static final String VERSION = "0.0.1"; + + public final String keepAliveId; + + public KeepAliveMessage(String keepAliveId) { + this.keepAliveId = keepAliveId; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutMessage.java new file mode 100755 index 0000000000..1ceb05bf93 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutMessage.java @@ -0,0 +1,74 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class LockLayoutMessage implements ISubscribedMessage { + public static final String LOCK_LAYOUT = "lock_layout_message"; + public static final String VERSION = "0.0.1"; + + public static final String SET_BY_USERID = "set_by_userid"; + public static final String LOCKED = "locked"; + public static final String USERS = "users"; + + public final String meetingId; + public final String setByUserid; + public final Boolean locked; + public final ArrayList users; + + public LockLayoutMessage(String meetingId, String setByUserid, Boolean locked, ArrayList users) { + this.meetingId = meetingId; + this.setByUserid = setByUserid; + this.locked = locked; + this.users = users; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(SET_BY_USERID, setByUserid); + payload.put(LOCKED, locked); + payload.put(USERS, users); + + java.util.HashMap header = MessageBuilder.buildHeader(LOCK_LAYOUT, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static LockLayoutMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (LOCK_LAYOUT.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(LOCKED) + && payload.has(SET_BY_USERID) + && payload.has(USERS)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String setByUserid = payload.get(SET_BY_USERID).getAsString(); + Boolean locked = payload.get(LOCKED).getAsBoolean(); + JsonArray usersArr = (JsonArray) payload.get(USERS); + + Util util = new Util(); + + ArrayList users = util.extractUserids(usersArr); + return new LockLayoutMessage(id, setByUserid, locked, users); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutRequestMessage.java new file mode 100755 index 0000000000..ab2dff2fb2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockLayoutRequestMessage.java @@ -0,0 +1,75 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class LockLayoutRequestMessage implements ISubscribedMessage { + public static final String LOCK_LAYOUT_REQUEST = "lock_layout_request_message"; + public static final String VERSION = "0.0.1"; + + public final static String LAYOUT = "layout"; + public final static String LOCK = "lock"; + public final static String VIEWERS_ONLY = "viewers_only"; + + public final String meetingId; + public final String userId; + public final Boolean lock; + public final Boolean viewersOnly; + + + public final String layout; + + public LockLayoutRequestMessage(String meetingId, String userId, Boolean lock, Boolean viewersOnly, String layout) { + this.meetingId = meetingId; + this.userId = userId; + this.lock = lock; + this.viewersOnly = viewersOnly; + this.layout = layout; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(LOCK, lock); + payload.put(VIEWERS_ONLY, viewersOnly); + payload.put(LAYOUT, layout); + + java.util.HashMap header = MessageBuilder.buildHeader(LOCK_LAYOUT_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static LockLayoutRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (LOCK_LAYOUT_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(LOCK) + && payload.has(VIEWERS_ONLY) + && payload.has(LAYOUT)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean lock = payload.get(LOCK).getAsBoolean(); + Boolean viewersOnly = payload.get(VIEWERS_ONLY).getAsBoolean(); + String layout = payload.get(LAYOUT).getAsString(); + return new LockLayoutRequestMessage(id, userid, lock, viewersOnly, layout); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockMuteUserRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockMuteUserRequestMessage.java new file mode 100755 index 0000000000..7276ead27f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockMuteUserRequestMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class LockMuteUserRequestMessage implements ISubscribedMessage { + public static final String LOCK_MUTE_USER_REQUEST = "lock_mute_user_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String USER_ID = "user_id"; + public static final String LOCK = "lock"; + + public final String meetingId; + public final String requesterId; + public final String userId; + public final Boolean lock; + + public LockMuteUserRequestMessage(String meetingId, String requesterId, String userId, Boolean lock) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.userId = userId; + this.lock = lock; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(USER_ID, userId); + payload.put(LOCK, lock); + + java.util.HashMap header = MessageBuilder.buildHeader(LOCK_MUTE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static LockMuteUserRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (LOCK_MUTE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(USER_ID) + && payload.has(LOCK)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + String userId = payload.get(USER_ID).getAsString(); + Boolean lock = payload.get(LOCK).getAsBoolean(); + return new LockMuteUserRequestMessage(id, requesterId, userId, lock); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java new file mode 100755 index 0000000000..eb212fc31a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java @@ -0,0 +1,65 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class LockUserMessage implements IPublishedMessage { + public static final String LOCK_USER = "lock_user"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final boolean lock; + public final String internalUserId; + + + public LockUserMessage(String meetingId, String requesterId, boolean lock, String internalUserId) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.lock = lock; + this.internalUserId = internalUserId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.LOCK, lock); + payload.put(Constants.INTERNAL_USER_ID, internalUserId); + + System.out.println("LockUser toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(LOCK_USER, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static LockUserMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (LOCK_USER.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.REQUESTER_ID) + && payload.has(Constants.LOCK) + && payload.has(Constants.INTERNAL_USER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + boolean lock = payload.get(Constants.LOCK).getAsBoolean(); + String internalUserId = payload.get(Constants.INTERNAL_USER_ID).getAsString(); + + System.out.println("LockUser fromJson"); + return new LockUserMessage(meetingId, requesterId, lock, internalUserId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingEndedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingEndedMessage.java new file mode 100755 index 0000000000..aa75aedac7 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingEndedMessage.java @@ -0,0 +1,48 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MeetingEndedMessage implements ISubscribedMessage { + public static final String MEETING_ENDED = "meeting_ended_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + + public MeetingEndedMessage(String meetingID) { + this.meetingId = meetingID; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(MEETING_ENDED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static MeetingEndedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MEETING_ENDED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + + return new MeetingEndedMessage(meetingId); + } + } + } + } + System.out.println("Failed to parse MeetingEndedMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingHasEndedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingHasEndedMessage.java new file mode 100755 index 0000000000..01adde0257 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingHasEndedMessage.java @@ -0,0 +1,48 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MeetingHasEndedMessage implements ISubscribedMessage { + public static final String MEETING_HAS_ENDED = "meeting_has_ended_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + + public MeetingHasEndedMessage(String meetingID) { + this.meetingId = meetingID; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(MEETING_HAS_ENDED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static MeetingHasEndedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MEETING_HAS_ENDED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + + return new MeetingHasEndedMessage(meetingId); + } + } + } + } + System.out.println("Failed to parse MeetingHasEndedMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingMutedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingMutedMessage.java new file mode 100755 index 0000000000..a895d770a2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingMutedMessage.java @@ -0,0 +1,54 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MeetingMutedMessage implements ISubscribedMessage { + public static final String MEETING_MUTED = "meeting_muted_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final Boolean muted; + + public MeetingMutedMessage(String meetingID, Boolean muted) { + this.meetingId = meetingID; + this.muted = muted; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(MEETING_MUTED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MeetingMutedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MEETING_MUTED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MEETING_MUTED)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + Boolean muted = payload.get(Constants.MEETING_MUTED).getAsBoolean(); + + return new MeetingMutedMessage(meetingID, muted); + } + } + } + } + System.out.println("Failed to parse MeetingMutedMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingStateMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingStateMessage.java new file mode 100755 index 0000000000..6903b531eb --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MeetingStateMessage.java @@ -0,0 +1,67 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MeetingStateMessage implements ISubscribedMessage { + public static final String MEETING_STATE = "meeting_state_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Map permissions; + public final Boolean muted; + + public MeetingStateMessage(String meetingID, String userId, Map permissions, Boolean muted) { + this.meetingId = meetingID; + this.userId = userId; + this.permissions = permissions; + this.muted = muted; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(MEETING_STATE, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static MeetingStateMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MEETING_STATE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.PERMISSIONS) + && payload.has(Constants.MEETING_MUTED)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String userId = payload.get(Constants.USER_ID).getAsString(); + Boolean muted = payload.get(Constants.MEETING_MUTED).getAsBoolean(); + JsonObject premissions = (JsonObject) payload.get(Constants.PERMISSIONS); + + Util util = new Util(); + Map premissionsMap = util.extractPermission(premissions); + + if (premissionsMap != null) { + return new MeetingStateMessage(meetingID, userId, premissionsMap, muted); + } + } + } + } + } + System.out.println("Failed to parse UserJoinedMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageBuilder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageBuilder.java new file mode 100755 index 0000000000..b9cf94ac41 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageBuilder.java @@ -0,0 +1,36 @@ +package org.bigbluebutton.common.messages; + +import java.util.concurrent.TimeUnit; + +import com.google.gson.Gson; + +public class MessageBuilder { + public final static String VERSION = "version"; + + public static long generateTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public static java.util.HashMap buildHeader(String name, String version, String replyTo) { + java.util.HashMap header = new java.util.HashMap(); + header.put(Constants.NAME, name); + header.put(VERSION, version); + header.put(Constants.TIMESTAMP, generateTimestamp()); + if (replyTo != null && replyTo != "") + header.put(Constants.REPLY_TO, replyTo); + + return header; + } + + + public static String buildJson(java.util.HashMap header, + java.util.HashMap payload) { + + java.util.HashMap> message = new java.util.HashMap>(); + message.put(Constants.HEADER, header); + message.put(Constants.PAYLOAD, payload); + + Gson gson = new Gson(); + return gson.toJson(message); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java new file mode 100755 index 0000000000..e2a905c27b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java @@ -0,0 +1,91 @@ +package org.bigbluebutton.common.messages; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class MessageFromJsonConverter { + + public static IPublishedMessage convert(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + switch (messageName) { + case CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT: + return processCreateMeeting(payload); + case DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT: + return processDestroyMeeting(payload); + case EndMeetingMessage.END_MEETING_REQUEST_EVENT: + return processEndMeetingMessage(payload); + case KeepAliveMessage.KEEP_ALIVE_REQUEST: + return processKeepAlive(payload); + case RegisterUserMessage.REGISTER_USER: + System.out.println("Registering a user"); + return RegisterUserMessage.fromJson(message); + case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN: + System.out.println("Process ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN"); + return processValidateAuthTokenMessage(header, payload); + // return ValidateAuthTokenMessage.fromJson(message); + case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO: + return UserConnectedToGlobalAudio.fromJson(message); + case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO: + return UserDisconnectedFromGlobalAudio.fromJson(message); + case GetAllMeetingsRequest.GET_ALL_MEETINGS_REQUEST_EVENT: + return new GetAllMeetingsRequest("the_string_is_not_used_anywhere"); + } + } + } + return null; + } + + private static IPublishedMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + String replyTo = header.get(Constants.REPLY_TO).getAsString(); + String sessionId = "tobeimplemented"; + return new ValidateAuthTokenMessage(id, userid, authToken, replyTo, + sessionId); + } + + private static IPublishedMessage processCreateMeeting(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + Boolean record = payload.get(Constants.RECORDED).getAsBoolean(); + String voiceBridge = payload.get(Constants.VOICE_CONF).getAsString(); + Long duration = payload.get(Constants.DURATION).getAsLong(); + Boolean autoStartRecording = payload.get(Constants.AUTO_START_RECORDING).getAsBoolean(); + Boolean allowStartStopRecording = payload.get(Constants.ALLOW_START_STOP_RECORDING).getAsBoolean(); + String moderatorPassword = payload.get(Constants.MODERATOR_PASS).getAsString(); + String viewerPassword = payload.get(Constants.VIEWER_PASS).getAsString(); + Long createTime = payload.get(Constants.CREATE_TIME).getAsLong(); + String createDate = payload.get(Constants.CREATE_DATE).getAsString(); + + return new CreateMeetingMessage(id, externalId, name, record, voiceBridge, + duration, autoStartRecording, allowStartStopRecording, + moderatorPassword, viewerPassword, createTime, createDate); + } + + private static IPublishedMessage processDestroyMeeting(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + return new DestroyMeetingMessage(id); + } + + private static IPublishedMessage processEndMeetingMessage(JsonObject payload) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + return new EndMeetingMessage(id); + } + + private static IPublishedMessage processKeepAlive(JsonObject payload) { + String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString(); + return new KeepAliveMessage(id); + } + + //private static IMessage processGetAllMeetings(JsonObject) +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java new file mode 100755 index 0000000000..d762cac491 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java @@ -0,0 +1,59 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.common.messages; + +public class MessagingConstants { + + public static final String FROM_BBB_APPS_CHANNEL = "bigbluebutton:from-bbb-apps"; + public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*"; + public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system"; + public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting"; + public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation"; + public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling"; + public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users"; + public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat"; + public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard"; + + public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps"; + public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*"; + public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting"; + public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system"; + public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation"; + public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling"; + public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users"; + public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat"; + public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; + public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; + + public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent"; + public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent"; + public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent"; + public static final String MEETING_STARTED_EVENT = "meeting_created_message"; + public static final String MEETING_ENDED_EVENT = "meeting_ended_event"; + public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event"; + public static final String USER_JOINED_EVENT = "UserJoinedEvent"; + public static final String USER_LEFT_EVENT = "UserLeftEvent"; + public static final String USER_LEFT_VOICE_REQUEST = "user_left_voice_request"; + public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; + public static final String SEND_POLLS_EVENT = "SendPollsEvent"; + public static final String RECORD_STATUS_EVENT = "RecordStatusEvent"; + public static final String SEND_PUBLIC_CHAT_MESSAGE_REQUEST = "send_public_chat_message_request"; + public static final String SEND_PRIVATE_CHAT_MESSAGE_REQUEST = "send_private_chat_message_request"; + public static final String MUTE_USER_REQUEST = "mute_user_request"; +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingService.java new file mode 100755 index 0000000000..03bb500abd --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingService.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.common.messages; + +import redis.clients.jedis.Jedis; + +public interface MessagingService { + public void send(String channel, String message); + public Jedis createRedisClient(); + public void dropRedisClient(Jedis jedis); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllExceptPresenterRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllExceptPresenterRequestMessage.java new file mode 100755 index 0000000000..7fed738b33 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllExceptPresenterRequestMessage.java @@ -0,0 +1,63 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class MuteAllExceptPresenterRequestMessage implements ISubscribedMessage { + public static final String MUTE_ALL_EXCEPT_PRESENTER_REQUEST = "mute_all_except_presenter_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String MUTE = "mute"; + + public final String meetingId; + public final String requesterId; + public final Boolean mute; + + public MuteAllExceptPresenterRequestMessage(String meetingId, String requesterId, Boolean mute) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.mute = mute; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(MUTE, mute); + + java.util.HashMap header = MessageBuilder.buildHeader(MUTE_ALL_EXCEPT_PRESENTER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MuteAllExceptPresenterRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MUTE_ALL_EXCEPT_PRESENTER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(MUTE)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + Boolean mute = payload.get(MUTE).getAsBoolean(); + return new MuteAllExceptPresenterRequestMessage(id, requesterId, mute); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllRequestMessage.java new file mode 100755 index 0000000000..4e0c4b9b0c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteAllRequestMessage.java @@ -0,0 +1,63 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class MuteAllRequestMessage implements ISubscribedMessage { + public static final String MUTE_ALL_REQUEST = "mute_all_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String MUTE = "mute"; + + public final String meetingId; + public final String requesterId; + public final Boolean mute; + + public MuteAllRequestMessage(String meetingId, String requesterId, Boolean mute) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.mute = mute; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(MUTE, mute); + + java.util.HashMap header = MessageBuilder.buildHeader(MUTE_ALL_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MuteAllRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MUTE_ALL_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(MUTE)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + Boolean mute = payload.get(MUTE).getAsBoolean(); + return new MuteAllRequestMessage(id, requesterId, mute); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserRequestMessage.java new file mode 100755 index 0000000000..776b3cc0c8 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserRequestMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class MuteUserRequestMessage implements ISubscribedMessage { + public static final String MUTE_USER_REQUEST = "mute_user_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String USER_ID = "user_id"; + public static final String MUTE = "mute"; + + public final String meetingId; + public final String requesterId; + public final String userId; + public final Boolean mute; + + public MuteUserRequestMessage(String meetingId, String requesterId, String userId, Boolean mute) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.userId = userId; + this.mute = mute; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(USER_ID, userId); + payload.put(MUTE, mute); + + java.util.HashMap header = MessageBuilder.buildHeader(MUTE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MuteUserRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MUTE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(USER_ID) + && payload.has(MUTE)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + String userId = payload.get(USER_ID).getAsString(); + Boolean mute = payload.get(MUTE).getAsBoolean(); + return new MuteUserRequestMessage(id, requesterId, userId, mute); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteVoiceUserRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteVoiceUserRequestMessage.java new file mode 100755 index 0000000000..16a9574952 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteVoiceUserRequestMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class MuteVoiceUserRequestMessage implements ISubscribedMessage { + public static final String MUTE_USER_REQUEST = "mute_user_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String REQUESTER_ID = "requester_id"; + public static final String USER_ID = "user_id"; + public static final String MUTE = "mute"; + + public final String meetingId; + public final String requesterId; + public final String userId; + public final Boolean mute; + + public MuteVoiceUserRequestMessage(String meetingId, String requesterId, String userId, Boolean mute) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.userId = userId; + this.mute = mute; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(REQUESTER_ID, requesterId); + payload.put(USER_ID, userId); + payload.put(MUTE, mute); + + java.util.HashMap header = MessageBuilder.buildHeader(MUTE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MuteVoiceUserRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MUTE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(REQUESTER_ID) + && payload.has(USER_ID) + && payload.has(MUTE)) { + String id = payload.get(MEETING_ID).getAsString(); + String requesterId = payload.get(REQUESTER_ID).getAsString(); + String userId = payload.get(USER_ID).getAsString(); + Boolean mute = payload.get(MUTE).getAsBoolean(); + return new MuteVoiceUserRequestMessage(id, requesterId, userId, mute); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/NewPermissionsSettingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/NewPermissionsSettingMessage.java new file mode 100755 index 0000000000..c773ae225f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/NewPermissionsSettingMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class NewPermissionsSettingMessage implements ISubscribedMessage { + public static final String NEW_PERMISSIONS_SETTING = "new_permission_settings"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final ArrayList> users; + public final Map permissions; + + public NewPermissionsSettingMessage(String meetingID, Map permissions, ArrayList> users) { + this.meetingId = meetingID; + this.users = users; + this.permissions = permissions; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(NEW_PERMISSIONS_SETTING, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static NewPermissionsSettingMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (NEW_PERMISSIONS_SETTING.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USERS) + && payload.has(Constants.PERMISSIONS)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + + JsonObject permissions = (JsonObject) payload.get(Constants.PERMISSIONS); + + Util util = new Util(); + Map permissionsMap = util.extractPermission(permissions); + + JsonArray users = (JsonArray) payload.get(Constants.USERS); + + ArrayList> usersList = util.extractUsers(users); + + if (usersList != null && permissionsMap != null) { + return new NewPermissionsSettingMessage(meetingID, permissionsMap, usersList); + } + } + } + } + } + System.out.println("Failed to parse NewPermissionsSettingMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresentationRemovedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresentationRemovedMessage.java new file mode 100755 index 0000000000..411a653cf1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresentationRemovedMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class PresentationRemovedMessage implements ISubscribedMessage { + public static final String PRESENTATION_REMOVED = "presentation_removed_message"; + public final String VERSION = "0.0.1"; + + public static final String PRESENTATION_ID = "presentation_id"; + public static final String MEETING_ID = "meeting_id"; + + public final String meetingId; + public final String presentationId; + + public PresentationRemovedMessage(String meetingId, String presentationId) { + this.meetingId = meetingId; + this.presentationId = presentationId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(PRESENTATION_ID, presentationId); + + java.util.HashMap header = MessageBuilder.buildHeader(PRESENTATION_REMOVED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static PresentationRemovedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (PRESENTATION_REMOVED.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(PRESENTATION_ID)) { + String meetingId = payload.get(MEETING_ID).getAsString(); + String presentationId = payload.get(MEETING_ID).getAsString(); + return new PresentationRemovedMessage(meetingId, presentationId); + } + } + } + } + System.out.println("Failed to parse PesentationRemovedMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresenterAssignedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresenterAssignedMessage.java new file mode 100755 index 0000000000..38a8f2dc72 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/PresenterAssignedMessage.java @@ -0,0 +1,64 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class PresenterAssignedMessage implements ISubscribedMessage { + public static final String PRESENTER_ASSIGNED = "presenter_assigned_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String newPresenterId; + public final String newPresenterName; + public final String assignedBy; + + public PresenterAssignedMessage(String meetingId, String newPresenterId, String newPresenterName, + String assignedBy) { + this.meetingId = meetingId; + this.newPresenterId = newPresenterId; + this.newPresenterName = newPresenterName; + this.assignedBy = assignedBy; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.NEW_PRESENTER_ID, newPresenterId); + payload.put(Constants.NEW_PRESENTER_NAME, newPresenterName); + payload.put(Constants.ASSIGNED_BY, assignedBy); + + java.util.HashMap header = MessageBuilder.buildHeader(PRESENTER_ASSIGNED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static PresenterAssignedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (PRESENTER_ASSIGNED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.NEW_PRESENTER_ID) + && payload.has(Constants.NEW_PRESENTER_NAME) + && payload.has(Constants.ASSIGNED_BY)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String presenterId = payload.get(Constants.NEW_PRESENTER_ID).getAsString(); + String presenterName = payload.get(Constants.NEW_PRESENTER_NAME).getAsString(); + String assignedBy = payload.get(Constants.ASSIGNED_BY).getAsString(); + return new PresenterAssignedMessage(id, presenterId, presenterName, assignedBy); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordingStatusChangedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordingStatusChangedMessage.java new file mode 100755 index 0000000000..a6f7b4a443 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordingStatusChangedMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class RecordingStatusChangedMessage implements ISubscribedMessage { + public static final String RECORDING_STATUS_CHANGED = "recording_status_changed_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean recording; + + public RecordingStatusChangedMessage(String meetingId, String userId, Boolean recording) { + this.meetingId = meetingId; + this.userId = userId; + this.recording = recording; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.RECORDING, recording); + + java.util.HashMap header = MessageBuilder.buildHeader(RECORDING_STATUS_CHANGED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static RecordingStatusChangedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (RECORDING_STATUS_CHANGED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.RECORDING)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean recording = payload.get(Constants.RECORDING).getAsBoolean(); + return new RecordingStatusChangedMessage(id, userid, recording); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java new file mode 100755 index 0000000000..29a72e5e0b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java @@ -0,0 +1,73 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class RegisterUserMessage implements IPublishedMessage { + public static final String REGISTER_USER = "register_user_request"; + public final String VERSION = "0.0.1"; + + public final String meetingID; + public final String internalUserId; + public final String fullname; + public final String role; + public final String externUserID; + public final String authToken; + + public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) { + this.meetingID = meetingID; + this.internalUserId = internalUserId; + this.fullname = fullname; + this.role = role; + this.externUserID = externUserID; + this.authToken = authToken; + } + + public String toJson() { + HashMap payload = new HashMap(); + + payload.put(Constants.MEETING_ID, meetingID); + payload.put(Constants.INTERNAL_USER_ID, internalUserId); + payload.put(Constants.NAME, fullname); + payload.put(Constants.ROLE, role); + payload.put(Constants.EXT_USER_ID, externUserID); + payload.put(Constants.AUTH_TOKEN, authToken); + + java.util.HashMap header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static RegisterUserMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (REGISTER_USER.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.NAME) + && payload.has(Constants.ROLE) + && payload.has(Constants.EXT_USER_ID) + && payload.has(Constants.AUTH_TOKEN)) { + + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String fullname = payload.get(Constants.NAME).getAsString(); + String role = payload.get(Constants.ROLE).getAsString(); + String externUserID = payload.get(Constants.EXT_USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + + //use externalUserId twice - once for external, once for internal + return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken); + } + } + } + } + System.out.println("Failed to parse RegisterUserMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java new file mode 100755 index 0000000000..4353a7eebc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java @@ -0,0 +1,54 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class RemovePresentationMessage implements IPublishedMessage { + public static final String REMOVE_PRESENTATION = "remove_presentation"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String presentationId; + + public RemovePresentationMessage(String meetingId, String presentationId){ + this.meetingId = meetingId; + this.presentationId = presentationId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.PRESENTATION_ID, presentationId); + + java.util.HashMap header = MessageBuilder.buildHeader(REMOVE_PRESENTATION, VERSION, null); + System.out.println("RemovePresentation toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static RemovePresentationMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (REMOVE_PRESENTATION.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.PRESENTATION_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String presentationId = payload.get(Constants.PRESENTATION_ID).getAsString(); + + System.out.println("RemovePresentation fromJson"); + return new RemovePresentationMessage(meetingId, presentationId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RequestWhiteboardAnnotationHistoryRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RequestWhiteboardAnnotationHistoryRequestMessage.java new file mode 100755 index 0000000000..6668f0370a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RequestWhiteboardAnnotationHistoryRequestMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class RequestWhiteboardAnnotationHistoryRequestMessage implements ISubscribedMessage { + public static final String REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST = "request_whiteboard_annotation_history_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String whiteboardId; + public final String requesterId; + public final String replyTo; + + + public RequestWhiteboardAnnotationHistoryRequestMessage(String meetingId, + String requesterId, String whiteboardId, String replyTo) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + this.replyTo = replyTo; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.REPLY_TO, replyTo); + + System.out.println("RequestWhiteboardAnnotationHistoryRequestMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static RequestWhiteboardAnnotationHistoryRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.REPLY_TO) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + + System.out.println("RequestWhiteboardAnnotationHistoryRequestMessage fromJson"); + return new RequestWhiteboardAnnotationHistoryRequestMessage(meetingId, requesterId, whiteboardId, replyTo); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java new file mode 100755 index 0000000000..ab7f5d7454 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class ResizeAndMoveSlideMessage implements IPublishedMessage { + public static final String RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final double xOffset; + public final double yOffset; + public final double widthRatio; + public final double heightRatio; + + public ResizeAndMoveSlideMessage(String meetingId, double xOffset, double yOffset, + double widthRatio, double heightRatio) { + this.meetingId = meetingId; + this.xOffset = xOffset; + this.yOffset = yOffset; + this.heightRatio = heightRatio; + this.widthRatio = widthRatio; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.X_OFFSET, xOffset); + payload.put(Constants.Y_OFFSET, yOffset); + payload.put(Constants.HEIGHT_RATIO, heightRatio); + payload.put(Constants.WIDTH_RATIO, widthRatio); + + java.util.HashMap header = MessageBuilder.buildHeader(RESIZE_AND_MOVE_SLIDE, VERSION, null); + System.out.println("ResizeAndMoveSlide toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static ResizeAndMoveSlideMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (RESIZE_AND_MOVE_SLIDE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.X_OFFSET) + && payload.has(Constants.Y_OFFSET) + && payload.has(Constants.HEIGHT_RATIO) + && payload.has(Constants.WIDTH_RATIO)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + double xOffset = payload.get(Constants.X_OFFSET).getAsDouble(); + double yOffset = payload.get(Constants.Y_OFFSET).getAsDouble(); + double heightRatio = payload.get(Constants.HEIGHT_RATIO).getAsDouble(); + double widthRatio = payload.get(Constants.WIDTH_RATIO).getAsDouble(); + System.out.println("ResizeAndMoveSlide fromJson"); + return new ResizeAndMoveSlideMessage(meetingId, xOffset, yOffset, widthRatio, heightRatio); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java new file mode 100755 index 0000000000..76fbbe3d31 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java @@ -0,0 +1,80 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendConversionCompletedMessage implements IPublishedMessage { + public static final String SEND_CONVERSION_COMPLETED = "send_conversion_completed"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String messageKey; + public final String code; + public final String presId; + public final int numPages; + public final String presName; + public final String presBaseUrl; + + public SendConversionCompletedMessage(String messageKey, String meetingId, String code, + String presId, int numPages, String presName, String presBaseUrl) { + this.meetingId = meetingId; + this.messageKey = messageKey; + this.code = code; + this.presId = presId; + this.numPages = numPages; + this.presName = presName; + this.presBaseUrl = presBaseUrl; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.MESSAGE_KEY, messageKey); + payload.put(Constants.CODE, code); + payload.put(Constants.PRESENTATION_ID, presId); + payload.put(Constants.NUM_PAGES, numPages); + payload.put(Constants.PRESENTATION_NAME, presName); + payload.put(Constants.PRESENTATION_BASE_URL, presBaseUrl); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_CONVERSION_COMPLETED, VERSION, null); + System.out.println("SendConversionCompleted toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SendConversionCompletedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_CONVERSION_COMPLETED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MESSAGE_KEY) + && payload.has(Constants.CODE) + && payload.has(Constants.PRESENTATION_ID) + && payload.has(Constants.NUM_PAGES) + && payload.has(Constants.PRESENTATION_NAME) + && payload.has(Constants.PRESENTATION_BASE_URL)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString(); + String code = payload.get(Constants.CODE).getAsString(); + String presId = payload.get(Constants.PRESENTATION_ID).getAsString(); + int numPages = payload.get(Constants.NUM_PAGES).getAsInt(); + String presName = payload.get(Constants.PRESENTATION_NAME).getAsString(); + String presBaseUrl = payload.get(Constants.PRESENTATION_BASE_URL).getAsString(); + + System.out.println("SendConversionCompleted fromJson"); + return new SendConversionCompletedMessage(messageKey, meetingId, code, presId, numPages, presName, presBaseUrl); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java new file mode 100755 index 0000000000..b0e8f87e53 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java @@ -0,0 +1,70 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendConversionUpdateMessage implements IPublishedMessage { + public static final String SEND_CONVERSION_UPDATE = "send_conversion_update"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String messageKey; + public final String code; + public final String presId; + public final String presName; + + + public SendConversionUpdateMessage(String messageKey, String meetingId, + String code, String presId, String presName) { + this.meetingId = meetingId; + this.messageKey = messageKey; + this.code = code; + this.presId = presId; + this.presName = presName; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.MESSAGE_KEY, messageKey); + payload.put(Constants.CODE, code); + payload.put(Constants.PRESENTATION_ID, presId); + payload.put(Constants.PRESENTATION_NAME, presName); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_CONVERSION_UPDATE, VERSION, null); + System.out.println("SendConversionUpdate toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SendConversionUpdateMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_CONVERSION_UPDATE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MESSAGE_KEY) + && payload.has(Constants.CODE) + && payload.has(Constants.PRESENTATION_NAME) + && payload.has(Constants.PRESENTATION_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String code = payload.get(Constants.CODE).getAsString(); + String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString(); + String presId = payload.get(Constants.PRESENTATION_ID).getAsString(); + String presName = payload.get(Constants.PRESENTATION_NAME).getAsString(); + System.out.println("SendConversionUpdate fromJson"); + return new SendConversionUpdateMessage(messageKey, meetingId, code, presId, presName); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java new file mode 100755 index 0000000000..c81e8e3ec3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java @@ -0,0 +1,58 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendCursorUpdateMessage implements IPublishedMessage { + public static final String SEND_CURSOR_UPDATE = "send_cursor_update"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final double xPercent; + public final double yPercent; + + public SendCursorUpdateMessage(String meetingId, double xPercent, double yPercent){ + this.meetingId = meetingId; + this.xPercent = xPercent; + this.yPercent = yPercent; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.X_PERCENT, xPercent); + payload.put(Constants.Y_PERCENT, yPercent); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_CURSOR_UPDATE, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static SendCursorUpdateMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_CURSOR_UPDATE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.X_PERCENT) + && payload.has(Constants.Y_PERCENT)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + double xPercent = payload.get(Constants.X_PERCENT).getAsDouble(); + double yPercent = payload.get(Constants.Y_PERCENT).getAsDouble(); + + return new SendCursorUpdateMessage(meetingId, xPercent, yPercent); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java new file mode 100755 index 0000000000..78764b59d4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java @@ -0,0 +1,111 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendLockSettingsMessage implements IPublishedMessage { + public static final String SEND_LOCK_SETTINGS = "send_lock_settings"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Map newSettings; + + + public SendLockSettingsMessage(String meetingId, String userId, Map newSettings) { + this.meetingId = meetingId; + this.userId = userId; + this.newSettings = newSettings; + } + + public String toJson() { + HashMap payload = new HashMap(); + + Map settingsMap = new HashMap(); + + settingsMap.put(Constants.DISABLE_CAMERA, newSettings.get("disableCam")); + settingsMap.put(Constants.DISABLE_MICROPHONE, newSettings.get("disableMic")); + settingsMap.put(Constants.DISABLE_PRIVATE_CHAT, newSettings.get("disablePrivateChat")); + settingsMap.put(Constants.DISABLE_PUBLIC_CHAT, newSettings.get("disablePublicChat")); + settingsMap.put(Constants.LOCKED_LAYOUT, newSettings.get("lockedLayout")); + settingsMap.put(Constants.LOCK_ON_JOIN, newSettings.get("lockOnJoin")); + settingsMap.put(Constants.LOCK_ON_JOIN_CONFIGURABLE, newSettings.get("lockOnJoinConfigurable")); + + +// System.out.println("\n\n" + newSettings.toString() + "\n\n"); +// settingsMap.put(Constants.DISABLE_CAMERA, newSettings.get(Constants.DISABLE_CAMERA)); +// settingsMap.put(Constants.DISABLE_MICROPHONE, newSettings.get(Constants.DISABLE_MICROPHONE)); +// settingsMap.put(Constants.DISABLE_PRIVATE_CHAT, newSettings.get(Constants.DISABLE_PRIVATE_CHAT)); +// settingsMap.put(Constants.DISABLE_PUBLIC_CHAT, newSettings.get(Constants.DISABLE_PUBLIC_CHAT)); +// settingsMap.put(Constants.LOCKED_LAYOUT, newSettings.get(Constants.LOCKED_LAYOUT)); +// settingsMap.put(Constants.LOCK_ON_JOIN, newSettings.get(Constants.LOCK_ON_JOIN)); +// settingsMap.put(Constants.LOCK_ON_JOIN_CONFIGURABLE, newSettings.get(Constants.LOCK_ON_JOIN_CONFIGURABLE)); + + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.SETTINGS, settingsMap); + + System.out.println("SendLockSettings toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(SEND_LOCK_SETTINGS, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static SendLockSettingsMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_LOCK_SETTINGS.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.SETTINGS)) { + + JsonObject settingsObj = (JsonObject) payload.get(Constants.SETTINGS).getAsJsonObject(); + if (settingsObj.has(Constants.DISABLE_CAMERA) + && settingsObj.has(Constants.DISABLE_CAMERA) + && settingsObj.has(Constants.DISABLE_MICROPHONE) + && settingsObj.has(Constants.DISABLE_PRIVATE_CHAT) + && settingsObj.has(Constants.DISABLE_PUBLIC_CHAT) + && settingsObj.has(Constants.LOCKED_LAYOUT) + && settingsObj.has(Constants.LOCK_ON_JOIN) + && settingsObj.has(Constants.LOCK_ON_JOIN_CONFIGURABLE)) { + + Map settingsMap = new HashMap(); + +// settingsMap.put(Constants.DISABLE_CAMERA, settingsObj.get(Constants.DISABLE_CAMERA).getAsBoolean()); +// settingsMap.put(Constants.DISABLE_MICROPHONE, settingsObj.get(Constants.DISABLE_MICROPHONE).getAsBoolean()); +// settingsMap.put(Constants.DISABLE_PRIVATE_CHAT, settingsObj.get(Constants.DISABLE_PRIVATE_CHAT).getAsBoolean()); +// settingsMap.put(Constants.DISABLE_PUBLIC_CHAT, settingsObj.get(Constants.DISABLE_PUBLIC_CHAT).getAsBoolean()); +// settingsMap.put(Constants.LOCKED_LAYOUT, settingsObj.get(Constants.LOCKED_LAYOUT).getAsBoolean()); +// settingsMap.put(Constants.LOCK_ON_JOIN, settingsObj.get(Constants.LOCK_ON_JOIN).getAsBoolean()); +// settingsMap.put(Constants.LOCK_ON_JOIN_CONFIGURABLE, settingsObj.get(Constants.LOCK_ON_JOIN_CONFIGURABLE).getAsBoolean()); + + settingsMap.put("disableCam", settingsObj.get(Constants.DISABLE_CAMERA).getAsBoolean()); + settingsMap.put("disableMic", settingsObj.get(Constants.DISABLE_MICROPHONE).getAsBoolean()); + settingsMap.put("disablePrivateChat", settingsObj.get(Constants.DISABLE_PRIVATE_CHAT).getAsBoolean()); + settingsMap.put("disablePublicChat", settingsObj.get(Constants.DISABLE_PUBLIC_CHAT).getAsBoolean()); + settingsMap.put("lockedLayout", settingsObj.get(Constants.LOCKED_LAYOUT).getAsBoolean()); + settingsMap.put("lockOnJoin", settingsObj.get(Constants.LOCK_ON_JOIN).getAsBoolean()); + settingsMap.put("lockOnJoinConfigurable", settingsObj.get(Constants.LOCK_ON_JOIN_CONFIGURABLE).getAsBoolean()); + + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String userId = payload.get(Constants.USER_ID).getAsString(); + + System.out.println("SendLockSettings fromJson"); + return new SendLockSettingsMessage(meetingId, userId, settingsMap); + } + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java new file mode 100755 index 0000000000..55979780ef --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java @@ -0,0 +1,81 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendPageCountErrorMessage implements IPublishedMessage { + public static final String SEND_PAGE_COUNT_ERROR = "send_page_count_error"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String messageKey; + public final String code; + public final String presId; + public final int numberOfPages; + public final int maxNumberPages; + public final String presName; + + public SendPageCountErrorMessage(String messageKey, String meetingId, + String code, String presId, int numberOfPages, int maxNumberPages, + String presName) { + this.meetingId = meetingId; + this.messageKey = messageKey; + this.code = code; + this.presId = presId; + this.numberOfPages = numberOfPages; + this.maxNumberPages = maxNumberPages; + this.presName = presName; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.MESSAGE_KEY, messageKey); + payload.put(Constants.CODE, code); + payload.put(Constants.PRESENTATION_ID, presId); + payload.put(Constants.NUM_PAGES, numberOfPages); + payload.put(Constants.MAX_NUM_PAGES, maxNumberPages); + payload.put(Constants.PRESENTATION_NAME, presName); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_PAGE_COUNT_ERROR, VERSION, null); + System.out.println("SendPageCountError toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SendPageCountErrorMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_PAGE_COUNT_ERROR.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MESSAGE_KEY) + && payload.has(Constants.CODE) + && payload.has(Constants.PRESENTATION_ID) + && payload.has(Constants.MAX_NUM_PAGES) + && payload.has(Constants.NUM_PAGES) + && payload.has(Constants.PRESENTATION_NAME)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString(); + String code = payload.get(Constants.CODE).getAsString(); + String presId = payload.get(Constants.PRESENTATION_ID).getAsString(); + int numberOfPages = payload.get(Constants.NUM_PAGES).getAsInt(); + int maxNumberPages = payload.get(Constants.MAX_NUM_PAGES).getAsInt(); + String presName = payload.get(Constants.PRESENTATION_NAME).getAsString(); + + System.out.println("SendPageCountError fromJson"); + return new SendPageCountErrorMessage(messageKey, meetingId, code, presId, numberOfPages, maxNumberPages, presName); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java new file mode 100755 index 0000000000..aa048b3dc8 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java @@ -0,0 +1,119 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import org.bigbluebutton.conference.service.chat.ChatKeyUtil; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendPrivateChatMessage implements IPublishedMessage { + public static final String SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final Map messageInfo; + + public SendPrivateChatMessage(String meetingId, String requesterId, + Map message) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.messageInfo = message; + } + + public String toJson() { + HashMap payload = new HashMap(); + + Map message = new HashMap(); + + message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE)); + message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE)); + message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME)); + message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET)); + message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR)); + message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID)); + message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID)); + message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME)); + message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME)); + + payload.put(Constants.MESSAGE, message); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_PRIVATE_CHAT_MESSAGE, VERSION, null); + + System.out.println("SendPrivateChatMessage toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SendPrivateChatMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MESSAGE)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + + JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject(); + Map messageInfo = new HashMap(); + + if (msgObj.has(ChatKeyUtil.CHAT_TYPE) + && msgObj.has(ChatKeyUtil.MESSAGE) + && msgObj.has(ChatKeyUtil.TO_USERNAME) + && msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET) + && msgObj.has(ChatKeyUtil.FROM_COLOR) + && msgObj.has(ChatKeyUtil.TO_USERID) + && msgObj.has(ChatKeyUtil.FROM_USERID) + && msgObj.has(ChatKeyUtil.FROM_TIME) + && msgObj.has(ChatKeyUtil.FROM_USERNAME)){ + messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString()); + messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString()); + + String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); + System.out.println("SendPrivateChatMessage fromJson"); + return new SendPrivateChatMessage(meetingId, requesterId, messageInfo); + } else if (msgObj.has(Constants.CHAT_TYPE) + && msgObj.has(Constants.MESSAGE) + && msgObj.has(Constants.TO_USERNAME) + && msgObj.has(Constants.FROM_TZ_OFFSET) + && msgObj.has(Constants.FROM_COLOR) + && msgObj.has(Constants.TO_USERID) + && msgObj.has(Constants.FROM_USERID) + && msgObj.has(Constants.FROM_TIME) + && msgObj.has(Constants.FROM_USERNAME)){ + messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString()); + messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString()); + + String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); + System.out.println("sendPrivateChatMessage fromJson"); + return new SendPrivateChatMessage(meetingId, requesterId, messageInfo); + } + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java new file mode 100755 index 0000000000..e3af4428e8 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java @@ -0,0 +1,119 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import org.bigbluebutton.conference.service.chat.ChatKeyUtil; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendPublicChatMessage implements IPublishedMessage { + public static final String SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final Map messageInfo; + + public SendPublicChatMessage(String meetingId, String requesterId, + Map message) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.messageInfo = message; + } + + public String toJson() { + HashMap payload = new HashMap(); + + Map message = new HashMap(); + + message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE)); + message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE)); + message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME)); + message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET)); + message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR)); + message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID)); + message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID)); + message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME)); + message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME)); + + payload.put(Constants.MESSAGE, message); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_PUBLIC_CHAT_MESSAGE, VERSION, null); + + System.out.println("sendPublicChatMessage toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SendPublicChatMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MESSAGE)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + + JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject(); + Map messageInfo = new HashMap(); + + if (msgObj.has(ChatKeyUtil.CHAT_TYPE) + && msgObj.has(ChatKeyUtil.MESSAGE) + && msgObj.has(ChatKeyUtil.TO_USERNAME) + && msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET) + && msgObj.has(ChatKeyUtil.FROM_COLOR) + && msgObj.has(ChatKeyUtil.TO_USERID) + && msgObj.has(ChatKeyUtil.FROM_USERID) + && msgObj.has(ChatKeyUtil.FROM_TIME) + && msgObj.has(ChatKeyUtil.FROM_USERNAME)){ + messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString()); + messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString()); + + String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); + System.out.println("sendPublicChatMessage fromJson"); + return new SendPublicChatMessage(meetingId, requesterId, messageInfo); + } else if (msgObj.has(Constants.CHAT_TYPE) + && msgObj.has(Constants.MESSAGE) + && msgObj.has(Constants.TO_USERNAME) + && msgObj.has(Constants.FROM_TZ_OFFSET) + && msgObj.has(Constants.FROM_COLOR) + && msgObj.has(Constants.TO_USERID) + && msgObj.has(Constants.FROM_USERID) + && msgObj.has(Constants.FROM_TIME) + && msgObj.has(Constants.FROM_USERNAME)){ + messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString()); + messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString()); + messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString()); + messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString()); + + String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); + System.out.println("sendPublicChatMessage fromJson"); + return new SendPublicChatMessage(meetingId, requesterId, messageInfo); + } + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java new file mode 100755 index 0000000000..fadb8dbf83 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java @@ -0,0 +1,81 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendSlideGeneratedMessage implements IPublishedMessage { + public static final String SEND_SLIDE_GENERATED = "send_slide_generated"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String messageKey; + public final String code; + public final String presId; + public final int numberOfPages; + public final int pagesCompleted; + public final String presName; + + public SendSlideGeneratedMessage(String messageKey, String meetingId, + String code, String presId, int numberOfPages, int pagesCompleted, + String presName) { + this.meetingId = meetingId; + this.messageKey = messageKey; + this.code = code; + this.presId = presId; + this.numberOfPages = numberOfPages; + this.pagesCompleted = pagesCompleted; + this.presName = presName; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.MESSAGE_KEY, messageKey); + payload.put(Constants.CODE, code); + payload.put(Constants.PRESENTATION_ID, presId); + payload.put(Constants.NUM_PAGES, numberOfPages); + payload.put(Constants.PAGES_COMPLETED, pagesCompleted); + payload.put(Constants.PRESENTATION_NAME, presName); + + java.util.HashMap header = MessageBuilder.buildHeader(SEND_SLIDE_GENERATED, VERSION, null); + System.out.println("SendSlideGenerated toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SendSlideGeneratedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_SLIDE_GENERATED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.MESSAGE_KEY) + && payload.has(Constants.CODE) + && payload.has(Constants.PRESENTATION_ID) + && payload.has(Constants.PAGES_COMPLETED) + && payload.has(Constants.NUM_PAGES) + && payload.has(Constants.PRESENTATION_NAME)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String messageKey = payload.get(Constants.MESSAGE_KEY).getAsString(); + String code = payload.get(Constants.CODE).getAsString(); + String presId = payload.get(Constants.PRESENTATION_ID).getAsString(); + int numberOfPages = payload.get(Constants.NUM_PAGES).getAsInt(); + int pagesCompleted = payload.get(Constants.PAGES_COMPLETED).getAsInt(); + String presName = payload.get(Constants.PRESENTATION_NAME).getAsString(); + + System.out.println("SendSlideGenerated fromJson"); + return new SendSlideGeneratedMessage(messageKey, meetingId, code, presId, numberOfPages, pagesCompleted, presName); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationReplyMessage.java new file mode 100755 index 0000000000..59140ef9f5 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationReplyMessage.java @@ -0,0 +1,74 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendWhiteboardAnnotationReplyMessage implements ISubscribedMessage { + public static final String SEND_WHITEBOARD_ANNOTATION_REPLY = "send_whiteboard_shape_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final String whiteboardId; + public final Map shape; + + + public SendWhiteboardAnnotationReplyMessage(String meetingId, String requesterId, + String whiteboardId, Map shape) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + this.shape = shape; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.SHAPE, shape); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("SendWhiteboardAnnotationReplyMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(SEND_WHITEBOARD_ANNOTATION_REPLY, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static SendWhiteboardAnnotationReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_WHITEBOARD_ANNOTATION_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.SHAPE) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + + JsonObject shape = (JsonObject) payload.get(Constants.SHAPE); + + Util util = new Util(); + Map annotation = util.extractOuterAnnotation(shape); + + + System.out.println("SendWhiteboardAnnotationReplyMessage fromJson"); + return new SendWhiteboardAnnotationReplyMessage(meetingId, requesterId, + whiteboardId, annotation); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationRequestMessage.java new file mode 100755 index 0000000000..566b0d9ff4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendWhiteboardAnnotationRequestMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SendWhiteboardAnnotationRequestMessage implements ISubscribedMessage { + public static final String SEND_WHITEBOARD_ANNOTATION_REQUEST = "send_whiteboard_annotation_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + public final Map annotation; + + + public SendWhiteboardAnnotationRequestMessage(String meetingId, + String requesterId, Map annotation) { + this.meetingId = meetingId; + this.requesterId = requesterId; + this.annotation = annotation; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.ANNOTATION, annotation); + + System.out.println("SendWhiteboardAnnotationRequestMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(SEND_WHITEBOARD_ANNOTATION_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static SendWhiteboardAnnotationRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SEND_WHITEBOARD_ANNOTATION_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.ANNOTATION) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + JsonObject annotationElement = (JsonObject) payload.get(Constants.ANNOTATION); + + Util util = new Util(); + Map annotation = util.extractAnnotation(annotationElement); + + System.out.println("SendWhiteboardAnnotationRequestMessage fromJson"); + return new SendWhiteboardAnnotationRequestMessage(meetingId, requesterId, annotation); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetRecordingStatusRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetRecordingStatusRequestMessage.java new file mode 100755 index 0000000000..5fdd73ad6f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetRecordingStatusRequestMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class SetRecordingStatusRequestMessage implements ISubscribedMessage { + public static final String SET_RECORDING_STATUS_REQUEST = "set_recording_status_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean recording; + + public SetRecordingStatusRequestMessage(String meetingId, String userId, Boolean recording) { + this.meetingId = meetingId; + this.userId = userId; + this.recording = recording; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.RECORDING, recording); + + java.util.HashMap header = MessageBuilder.buildHeader(SET_RECORDING_STATUS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static SetRecordingStatusRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SET_RECORDING_STATUS_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.RECORDING)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean recording = payload.get(Constants.RECORDING).getAsBoolean(); + return new SetRecordingStatusRequestMessage(id, userid, recording); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetUserStatusRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetUserStatusRequestMessage.java new file mode 100755 index 0000000000..e338a1b41a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SetUserStatusRequestMessage.java @@ -0,0 +1,64 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class SetUserStatusRequestMessage implements ISubscribedMessage { + public static final String SET_USER_STATUS_REQUEST = "set_user_status_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String status; + public final String value; + + public SetUserStatusRequestMessage(String meetingId, String userId, String status, String value) { + this.meetingId = meetingId; + this.userId = userId; + this.status = status; + this.value = value; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.STATUS, status); + payload.put(Constants.VALUE, value); + + java.util.HashMap header = MessageBuilder.buildHeader(SET_USER_STATUS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static SetUserStatusRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SET_USER_STATUS_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.STATUS) + && payload.has(Constants.VALUE)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String status = payload.get(Constants.STATUS).getAsString(); + String value = payload.get(Constants.VALUE).getAsString(); + return new SetUserStatusRequestMessage(id, userid, status, value); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java new file mode 100755 index 0000000000..a8fd2d9723 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java @@ -0,0 +1,60 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class SharePresentationMessage implements IPublishedMessage { + public static final String SHARE_PRESENTATION = "share_presentation"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String presentationId; + public final boolean share; + + public SharePresentationMessage(String meetingId, String presentationId, + boolean share){ + this.meetingId = meetingId; + this.presentationId = presentationId; + this.share = share; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.PRESENTATION_ID, presentationId); + payload.put(Constants.SHARE, share); + + java.util.HashMap header = MessageBuilder.buildHeader(SHARE_PRESENTATION, VERSION, null); + System.out.println("SharePresentation toJson"); + return MessageBuilder.buildJson(header, payload); + } + + public static SharePresentationMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SHARE_PRESENTATION.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.PRESENTATION_ID) + && payload.has(Constants.SHARE)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String presentationId = payload.get(Constants.PRESENTATION_ID).getAsString(); + boolean share = payload.get(Constants.SHARE).getAsBoolean(); + + System.out.println("SharePresentation fromJson"); + return new SharePresentationMessage(meetingId, presentationId, share); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardReplyMessage.java new file mode 100755 index 0000000000..5ce7ba9d3f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardReplyMessage.java @@ -0,0 +1,70 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UndoWhiteboardReplyMessage implements ISubscribedMessage { + + // the name of this event should be undo_whiteboard_reply (as it corresponds + // to undo_whiteboard_request which entered bbb-apps) + // However, on the clients we use undo_whiteboard_request for both request and reply + // + // The only difference is shapeId here. Plus this message is on channel FROM_WHITEBOARD_CHANNEL + public static final String UNDO_WHITEBOARD_REPLY = "undo_whiteboard_request";//see note above + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String whiteboardId; + public final String requesterId; + public final String shapeId; + + + public UndoWhiteboardReplyMessage(String meetingId, String requesterId, String whiteboardId, String shapeId) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + this.shapeId = shapeId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + payload.put(Constants.SHAPE_ID, shapeId); + + System.out.println("UndoWhiteboardReplyMessage toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(UNDO_WHITEBOARD_REPLY, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static UndoWhiteboardReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (UNDO_WHITEBOARD_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.SHAPE_ID) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + String shapeId = payload.get(Constants.SHAPE_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + System.out.println("UndoWhiteboardReplyMessage fromJson"); + return new UndoWhiteboardReplyMessage(meetingId, requesterId, whiteboardId, shapeId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardRequest.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardRequest.java new file mode 100755 index 0000000000..5b0e2b1712 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UndoWhiteboardRequest.java @@ -0,0 +1,60 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UndoWhiteboardRequest implements ISubscribedMessage { + public static final String UNDO_WHITEBOARD_REQUEST = "undo_whiteboard_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String whiteboardId; + public final String requesterId; + + + public UndoWhiteboardRequest(String meetingId, String requesterId, String whiteboardId) { + this.meetingId = meetingId; + this.whiteboardId = whiteboardId; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.WHITEBOARD_ID, whiteboardId); + payload.put(Constants.REQUESTER_ID, requesterId); + + System.out.println("UndoWhiteboardRequest toJson"); + java.util.HashMap header = MessageBuilder.buildHeader(UNDO_WHITEBOARD_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static UndoWhiteboardRequest fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (UNDO_WHITEBOARD_REQUEST.equals(messageName)) { + System.out.println("4"+payload.toString()); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.WHITEBOARD_ID) + && payload.has(Constants.REQUESTER_ID)) { + String meetingId = payload.get(Constants.MEETING_ID).getAsString(); + String whiteboardId = payload.get(Constants.WHITEBOARD_ID).getAsString(); + String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); + + System.out.println("UndoWhiteboardRequest fromJson"); + return new UndoWhiteboardRequest(meetingId, requesterId, whiteboardId); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java new file mode 100755 index 0000000000..a58cec926e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserConnectedToGlobalAudio implements IPublishedMessage { + public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio"; + public static final String VERSION = "0.0.1"; + + public final String voiceConf; + public final String name; + public final String userid; + + + + public UserConnectedToGlobalAudio(String voiceConf, String userid, String name) { + this.voiceConf = voiceConf; + this.userid = userid; + this.name = name; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.VOICE_CONF, voiceConf); + payload.put(Constants.USER_ID, userid); + payload.put(Constants.NAME, name); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_CONNECTED_TO_GLOBAL_AUDIO, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserConnectedToGlobalAudio fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_CONNECTED_TO_GLOBAL_AUDIO.equals(messageName)) { + if (payload.has(Constants.VOICE_CONF) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NAME)) { + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + return new UserConnectedToGlobalAudio(voiceConf, userid, name); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java new file mode 100755 index 0000000000..95218e2787 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java @@ -0,0 +1,57 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserDisconnectedFromGlobalAudio implements IPublishedMessage { + public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio"; + public static final String VERSION = "0.0.1"; + + public final String voiceConf; + public final String name; + public final String userid; + + public UserDisconnectedFromGlobalAudio(String voiceConf, String userid, String name) { + this.voiceConf = voiceConf; + this.userid = userid; + this.name = name; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.VOICE_CONF, voiceConf); + payload.put(Constants.USER_ID, userid); + payload.put(Constants.NAME, name); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_DISCONNECTED_FROM_GLOBAL_AUDIO, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserDisconnectedFromGlobalAudio fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_DISCONNECTED_FROM_GLOBAL_AUDIO.equals(messageName)) { + if (payload.has(Constants.VOICE_CONF) + && payload.has(Constants.USER_ID) + && payload.has(Constants.NAME)) { + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String name = payload.get(Constants.NAME).getAsString(); + return new UserDisconnectedFromGlobalAudio(voiceConf, userid, name); + } + } + } + } + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedMessage.java new file mode 100755 index 0000000000..b5e23c8806 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedMessage.java @@ -0,0 +1,60 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserJoinedMessage implements ISubscribedMessage { + public static final String USER_JOINED = "user_joined_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map user; + + public UserJoinedMessage(String meetingID, Map user) { + this.meetingId = meetingID; + this.user = user; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(USER_JOINED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static UserJoinedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_JOINED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + + JsonObject user = (JsonObject) payload.get(Constants.USER); + + Util util = new Util(); + Map userMap = util.extractUser(user); + + if (userMap != null) { + return new UserJoinedMessage(meetingID, userMap); + } + } + } + } + } + System.out.println("Failed to parse UserJoinedMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceMessage.java new file mode 100755 index 0000000000..9231fb66c4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserJoinedVoiceMessage implements ISubscribedMessage { + public static final String USER_JOINED_VOICE = "user_joined_voice_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map user; + public final String voiceConf; + + public UserJoinedVoiceMessage(String meetingId, Map user, String voiceConf) { + this.meetingId = meetingId; + this.user = user; + this.voiceConf = voiceConf; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER, user); + payload.put(Constants.VOICE_CONF, voiceConf); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_JOINED_VOICE, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserJoinedVoiceMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_JOINED_VOICE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + + JsonObject user = (JsonObject) payload.get(Constants.USER); + + Util util = new Util(); + Map userMap = util.extractUser(user); + + if (userMap != null) { + return new UserJoinedVoiceMessage(id, userMap, voiceConf); + } + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeavingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeavingMessage.java new file mode 100755 index 0000000000..447e49f703 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeavingMessage.java @@ -0,0 +1,52 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserLeavingMessage implements ISubscribedMessage { + public static final String USER_LEAVING = "user_leaving_request"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + + public UserLeavingMessage(String meetingID, String internalUserId) { + this.meetingId = meetingID; + this.userId = internalUserId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LEAVING, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static UserLeavingMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LEAVING.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + return new UserLeavingMessage(meetingID, userid); + } + } + } + } + System.out.println("Failed to parse UserLeavingMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftMessage.java new file mode 100755 index 0000000000..82548118a3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftMessage.java @@ -0,0 +1,60 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class UserLeftMessage implements ISubscribedMessage { + public static final String USER_LEFT = "user_left_message"; + public final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map user; + + public UserLeftMessage(String meetingID, Map user) { + this.meetingId = meetingID; + this.user = user; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LEFT, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + public static UserLeftMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LEFT.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER)) { + String meetingID = payload.get(Constants.MEETING_ID).getAsString(); + + JsonObject user = (JsonObject) payload.get(Constants.USER); + + Util util = new Util(); + Map userMap = util.extractUser(user); + + if (userMap != null) { + return new UserLeftMessage(meetingID, userMap); + } + } + } + } + } + System.out.println("Failed to parse UserLeftMessage"); + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceMessage.java new file mode 100755 index 0000000000..8e647a6bbf --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLeftVoiceMessage implements ISubscribedMessage { + public static final String USER_LEFT_VOICE = "user_left_voice_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map user; + public final String voiceConf; + + public UserLeftVoiceMessage(String meetingId, Map user, String voiceConf) { + this.meetingId = meetingId; + this.user = user; + this.voiceConf = voiceConf; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER, user); + payload.put(Constants.VOICE_CONF, voiceConf); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LEFT_VOICE, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLeftVoiceMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LEFT_VOICE.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + + JsonObject user = (JsonObject) payload.get(Constants.USER); + + Util util = new Util(); + Map userMap = util.extractUser(user); + + if (userMap != null) { + return new UserLeftVoiceMessage(id, userMap, voiceConf); + } + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserListeningOnlyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserListeningOnlyMessage.java new file mode 100755 index 0000000000..5f352b2645 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserListeningOnlyMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserListeningOnlyMessage implements ISubscribedMessage { + public static final String USER_LISTENING_ONLY = "user_listening_only"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean listenOnly; + + public UserListeningOnlyMessage(String meetingId, String userId, Boolean listenOnly) { + this.meetingId = meetingId; + this.userId = userId; + this.listenOnly = listenOnly; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.LISTEN_ONLY, listenOnly); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LISTENING_ONLY, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserListeningOnlyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LISTENING_ONLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.LISTEN_ONLY)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean listenOnly = payload.get(Constants.LISTEN_ONLY).getAsBoolean(); + return new UserListeningOnlyMessage(id, userid, listenOnly); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedMessage.java new file mode 100755 index 0000000000..c9c6aa8f3b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLockedMessage implements ISubscribedMessage { + public static final String USER_LOCKED = "user_locked_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean locked; + + public UserLockedMessage(String meetingId, String userId, Boolean locked) { + this.meetingId = meetingId; + this.userId = userId; + this.locked = locked; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.LOCKED, locked); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LOCKED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLockedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LOCKED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.LOCKED)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean locked = payload.get(Constants.LOCKED).getAsBoolean(); + return new UserLockedMessage(id, userid, locked); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLoweredHandMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLoweredHandMessage.java new file mode 100755 index 0000000000..fbc44a432f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLoweredHandMessage.java @@ -0,0 +1,64 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLoweredHandMessage implements ISubscribedMessage { + public static final String USER_LOWERED_HAND = "user_lowered_hand_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean raisedHand; + public final String loweredBy; + + public UserLoweredHandMessage(String meetingId, String userId, Boolean raisedHand, String loweredBy) { + this.meetingId = meetingId; + this.userId = userId; + this.raisedHand = raisedHand; + this.loweredBy = loweredBy; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.RAISE_HAND, raisedHand); + payload.put(Constants.LOWERED_BY, loweredBy); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LOWERED_HAND, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLoweredHandMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LOWERED_HAND.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.RAISE_HAND) + && payload.has(Constants.LOWERED_BY)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean raisedHand = payload.get(Constants.RAISE_HAND).getAsBoolean(); + String loweredBy = payload.get(Constants.LOWERED_BY).getAsString(); + return new UserLoweredHandMessage(id, userid, raisedHand, loweredBy); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserRaisedHandMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserRaisedHandMessage.java new file mode 100755 index 0000000000..5c2e5501af --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserRaisedHandMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserRaisedHandMessage implements ISubscribedMessage { + public static final String USER_RAISED_HAND = "user_raised_hand_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final Boolean raisedHand; + + public UserRaisedHandMessage(String meetingId, String userId, Boolean raisedHand) { + this.meetingId = meetingId; + this.userId = userId; + this.raisedHand = raisedHand; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.RAISE_HAND, raisedHand); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_RAISED_HAND, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserRaisedHandMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_RAISED_HAND.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.RAISE_HAND)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + Boolean raisedHand = payload.get(Constants.RAISE_HAND).getAsBoolean(); + return new UserRaisedHandMessage(id, userid, raisedHand); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserShareWebcamRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserShareWebcamRequestMessage.java new file mode 100755 index 0000000000..225580e1aa --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserShareWebcamRequestMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserShareWebcamRequestMessage implements ISubscribedMessage { + public static final String USER_SHARE_WEBCAM_REQUEST = "user_share_webcam_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String stream; + + public UserShareWebcamRequestMessage(String meetingId, String userId, String stream) { + this.meetingId = meetingId; + this.userId = userId; + this.stream = stream; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.STREAM, stream); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_SHARE_WEBCAM_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserShareWebcamRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_SHARE_WEBCAM_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.STREAM)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String stream = payload.get(Constants.STREAM).getAsString(); + return new UserShareWebcamRequestMessage(id, userid, stream); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserSharedWebcamMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserSharedWebcamMessage.java new file mode 100755 index 0000000000..5789b3942d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserSharedWebcamMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserSharedWebcamMessage implements ISubscribedMessage { + public static final String USER_SHARED_WEBCAM = "user_shared_webcam_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String stream; + + public UserSharedWebcamMessage(String meetingId, String userId, String stream) { + this.meetingId = meetingId; + this.userId = userId; + this.stream = stream; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.STREAM, stream); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_SHARED_WEBCAM, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserSharedWebcamMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_SHARED_WEBCAM.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.STREAM)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String stream = payload.get(Constants.STREAM).getAsString(); + return new UserSharedWebcamMessage(id, userid, stream); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserStatusChangedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserStatusChangedMessage.java new file mode 100755 index 0000000000..f643e72eb4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserStatusChangedMessage.java @@ -0,0 +1,65 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserStatusChangedMessage implements ISubscribedMessage { + public static final String USER_STATUS_CHANGED = "user_status_changed_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String status; + public final String value; + + public UserStatusChangedMessage(String meetingId, String userId, String status, + String value) { + this.meetingId = meetingId; + this.userId = userId; + this.status = status; + this.value = value; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.STATUS, status); + payload.put(Constants.VALUE, value); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_STATUS_CHANGED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserStatusChangedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_STATUS_CHANGED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.STATUS) + && payload.has(Constants.VALUE)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String status = payload.get(Constants.STATUS).getAsString(); + String value = payload.get(Constants.VALUE).getAsString(); + return new UserStatusChangedMessage(id, userid, status, value); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnshareWebcamRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnshareWebcamRequestMessage.java new file mode 100755 index 0000000000..051b91db02 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnshareWebcamRequestMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserUnshareWebcamRequestMessage implements ISubscribedMessage { + public static final String USER_UNSHARE_WEBCAM_REQUEST = "user_unshare_webcam_request_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String stream; + + public UserUnshareWebcamRequestMessage(String meetingId, String userId, String stream) { + this.meetingId = meetingId; + this.userId = userId; + this.stream = stream; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.STREAM, stream); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_UNSHARE_WEBCAM_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserUnshareWebcamRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_UNSHARE_WEBCAM_REQUEST.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.STREAM)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String stream = payload.get(Constants.STREAM).getAsString(); + return new UserUnshareWebcamRequestMessage(id, userid, stream); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnsharedWebcamMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnsharedWebcamMessage.java new file mode 100755 index 0000000000..8ae89d0348 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserUnsharedWebcamMessage.java @@ -0,0 +1,59 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserUnsharedWebcamMessage implements ISubscribedMessage { + public static final String USER_UNSHARED_WEBCAM = "user_unshared_webcam_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String stream; + + public UserUnsharedWebcamMessage(String meetingId, String userId, String stream) { + this.meetingId = meetingId; + this.userId = userId; + this.stream = stream; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.STREAM, stream); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_UNSHARED_WEBCAM, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserUnsharedWebcamMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_UNSHARED_WEBCAM.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.STREAM)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String stream = payload.get(Constants.STREAM).getAsString(); + return new UserUnsharedWebcamMessage(id, userid, stream); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceMutedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceMutedMessage.java new file mode 100755 index 0000000000..a994267071 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceMutedMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserVoiceMutedMessage implements ISubscribedMessage { + public static final String USER_VOICE_MUTED = "user_voice_muted_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map user; + public final String voiceConf; + + public UserVoiceMutedMessage(String meetingId, Map user, String voiceConf) { + this.meetingId = meetingId; + this.user = user; + this.voiceConf = voiceConf; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER, user); + payload.put(Constants.VOICE_CONF, voiceConf); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_VOICE_MUTED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserVoiceMutedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_VOICE_MUTED.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + + JsonObject user = (JsonObject) payload.get(Constants.USER); + + Util util = new Util(); + Map userMap = util.extractUser(user); + + if (userMap != null) { + return new UserVoiceMutedMessage(id, userMap, voiceConf); + } + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceTalkingMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceTalkingMessage.java new file mode 100755 index 0000000000..2445d97e71 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserVoiceTalkingMessage.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserVoiceTalkingMessage implements ISubscribedMessage { + public static final String USER_VOICE_TALKING = "user_voice_talking_message"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final Map user; + public final String voiceConf; + + public UserVoiceTalkingMessage(String meetingId, Map user, String voiceConf) { + this.meetingId = meetingId; + this.user = user; + this.voiceConf = voiceConf; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER, user); + payload.put(Constants.VOICE_CONF, voiceConf); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_VOICE_TALKING, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserVoiceTalkingMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_VOICE_TALKING.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); + + JsonObject user = (JsonObject) payload.get(Constants.USER); + + Util util = new Util(); + Map userMap = util.extractUser(user); + + if (userMap != null) { + return new UserVoiceTalkingMessage(id, userMap, voiceConf); + } + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java new file mode 100755 index 0000000000..c89714d17c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java @@ -0,0 +1,428 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.bigbluebutton.conference.service.chat.ChatKeyUtil; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +public class Util { + public Map extractPermission(JsonObject vu) { + if (vu.has(Constants.PERM_DISABLE_CAM) && vu.has(Constants.PERM_DISABLE_MIC) + && vu.has(Constants.PERM_DISABLE_PRIVCHAT) && vu.has(Constants.PERM_DISABLE_PUBCHAT) + && vu.has(Constants.PERM_LOCKED_LAYOUT) && vu.has(Constants.PERM_LOCK_ON_JOIN) + && vu.has(Constants.PERM_LOCK_ON_JOIN_CONFIG)){ + + Map vuMap = new HashMap(); + Boolean disableCam = vu.get(Constants.PERM_DISABLE_CAM).getAsBoolean(); + Boolean disableMic = vu.get(Constants.PERM_DISABLE_MIC).getAsBoolean(); + Boolean disablePrivChat = vu.get(Constants.PERM_DISABLE_PRIVCHAT).getAsBoolean(); + Boolean disablePubChat = vu.get(Constants.PERM_DISABLE_PUBCHAT).getAsBoolean(); + Boolean lockedLayout = vu.get(Constants.PERM_LOCKED_LAYOUT).getAsBoolean(); + Boolean lockOnJoin = vu.get(Constants.PERM_LOCK_ON_JOIN).getAsBoolean(); + Boolean lockOnJoinConfig = vu.get(Constants.PERM_LOCK_ON_JOIN_CONFIG).getAsBoolean(); + + vuMap.put(Constants.PERM_DISABLE_CAM, disableCam); + vuMap.put(Constants.PERM_DISABLE_MIC, disableMic); + vuMap.put(Constants.PERM_DISABLE_PRIVCHAT, disablePrivChat); + vuMap.put(Constants.PERM_DISABLE_PUBCHAT, disablePubChat); + vuMap.put(Constants.PERM_LOCKED_LAYOUT, lockedLayout); + vuMap.put(Constants.PERM_LOCK_ON_JOIN, lockOnJoin); + vuMap.put(Constants.PERM_LOCK_ON_JOIN_CONFIG, lockOnJoinConfig); + + return vuMap; + } + return null; + } + + public Map extractVoiceUser(JsonObject vu) { + if (vu.has(Constants.TALKING) && vu.has(Constants.LOCKED) + && vu.has(Constants.MUTED) && vu.has(Constants.JOINED) + && vu.has(Constants.CALLERNAME) && vu.has(Constants.CALLERNUM) + && vu.has(Constants.WEB_USERID) && vu.has(Constants.USER_ID)){ + + Map vuMap = new HashMap(); + Boolean talking = vu.get(Constants.TALKING).getAsBoolean(); + Boolean voiceLocked = vu.get(Constants.LOCKED).getAsBoolean(); + Boolean muted = vu.get(Constants.MUTED).getAsBoolean(); + Boolean joined = vu.get(Constants.JOINED).getAsBoolean(); + String callername = vu.get(Constants.CALLERNAME).getAsString(); + String callernum = vu.get(Constants.CALLERNUM).getAsString(); + String webUserId = vu.get(Constants.WEB_USERID).getAsString(); + String voiceUserId = vu.get(Constants.USER_ID).getAsString(); + + vuMap.put("talking", talking); + vuMap.put("locked", voiceLocked); + vuMap.put("muted", muted); + vuMap.put("joined", joined); + vuMap.put("callerName", callername); + vuMap.put("callerNum", callernum); + vuMap.put("webUserId", webUserId); + vuMap.put("userId", voiceUserId); + + return vuMap; + } + return null; + } + + public Map extractUser(JsonObject user) { + if (user.has(Constants.USER_ID) && user.has(Constants.NAME) + && user.has(Constants.HAS_STREAM) && user.has(Constants.LISTENONLY) + && user.has(Constants.RAISE_HAND) && user.has(Constants.PHONE_USER) + && user.has(Constants.PRESENTER) && user.has(Constants.LOCKED) + && user.has(Constants.EXTERN_USERID) && user.has(Constants.ROLE) + && user.has(Constants.VOICEUSER)){ + + Map userMap = new HashMap(); + + String userid = user.get(Constants.USER_ID).getAsString(); + String username = user.get(Constants.NAME).getAsString(); + Boolean hasStream = user.get(Constants.HAS_STREAM).getAsBoolean(); + Boolean listenOnly = user.get(Constants.LISTENONLY).getAsBoolean(); + Boolean raiseHand = user.get(Constants.RAISE_HAND).getAsBoolean(); + Boolean phoneUser = user.get(Constants.PHONE_USER).getAsBoolean(); + Boolean presenter = user.get(Constants.PRESENTER).getAsBoolean(); + Boolean locked = user.get(Constants.LOCKED).getAsBoolean(); + String extUserId = user.get(Constants.EXTERN_USERID).getAsString(); + String role = user.get(Constants.ROLE).getAsString(); + + userMap.put("userId", userid); + userMap.put("name", username); + userMap.put("listenOnly", listenOnly); + userMap.put("hasStream", hasStream); + userMap.put("raiseHand", raiseHand); + userMap.put("externUserID", extUserId); + userMap.put("phoneUser", phoneUser); + userMap.put("locked", locked); + userMap.put("role", role); + userMap.put("presenter", presenter); + + JsonObject vu = (JsonObject) user.get(Constants.VOICEUSER); + + Map vuMap = extractVoiceUser(vu); + if (vuMap != null) { + userMap.put("voiceUser", vuMap); + return userMap; + } + } + + return null; + + } + + public ArrayList> extractChatHistory(JsonArray history) { + ArrayList> collection = new ArrayList>(); + Iterator historyIter = history.iterator(); + while (historyIter.hasNext()){ + JsonElement chat = historyIter.next(); + Map chatMap = extractChat((JsonObject)chat); + if (chatMap != null) { + collection.add(chatMap); + } + } + return collection; + } + + private Map extractChat(JsonObject chat) { + + if (chat.has(Constants.FROM_COLOR) + && chat.has(Constants.MESSAGE) + && chat.has(Constants.TO_USERNAME) + && chat.has(Constants.FROM_TZ_OFFSET) + && chat.has(Constants.FROM_COLOR) + && chat.has(Constants.TO_USERID) + && chat.has(Constants.FROM_USERID) + && chat.has(Constants.FROM_TIME) + && chat.has(Constants.FROM_USERNAME)){ + + Map chatMap = new HashMap(); + + chatMap.put(ChatKeyUtil.CHAT_TYPE, chat.get(Constants.CHAT_TYPE).getAsString()); + chatMap.put(ChatKeyUtil.MESSAGE, chat.get(Constants.MESSAGE).getAsString()); + chatMap.put(ChatKeyUtil.TO_USERNAME, chat.get(Constants.TO_USERNAME).getAsString()); + chatMap.put(ChatKeyUtil.FROM_TZ_OFFSET, chat.get(Constants.FROM_TZ_OFFSET).getAsString()); + chatMap.put(ChatKeyUtil.FROM_COLOR, chat.get(Constants.FROM_COLOR).getAsString()); + chatMap.put(ChatKeyUtil.TO_USERID, chat.get(Constants.TO_USERID).getAsString()); + chatMap.put(ChatKeyUtil.FROM_USERID, chat.get(Constants.FROM_USERID).getAsString()); + chatMap.put(ChatKeyUtil.FROM_TIME, chat.get(Constants.FROM_TIME).getAsString()); + chatMap.put(ChatKeyUtil.FROM_USERNAME, chat.get(Constants.FROM_USERNAME).getAsString()); + + return chatMap; + } + return null; + } + + public ArrayList> extractUsers(JsonArray users) { + ArrayList> collection = new ArrayList>(); + + Iterator usersIter = users.iterator(); + while (usersIter.hasNext()){ + JsonElement user = usersIter.next(); + Map userMap = extractUser((JsonObject)user); + if (userMap != null) { + collection.add(userMap); + } + } + + return collection; + + } + + public ArrayList extractUserids(JsonArray users) { + ArrayList collection = new ArrayList(); + + Iterator usersIter = users.iterator(); + while (usersIter.hasNext()){ + JsonElement user = usersIter.next(); + collection.add(user.getAsString()); + } + + return collection; + + } + + public Map extractAnnotation(JsonObject annotationElement) { + //NON-TEXT SHAPE + if (annotationElement.has(Constants.ID) + && annotationElement.has("transparency") + && annotationElement.has("color") + && annotationElement.has("status") + && annotationElement.has("whiteboardId") + && annotationElement.has("type") + && annotationElement.has("thickness") + && annotationElement.has("points")){ + + Map finalAnnotation = new HashMap(); + + boolean transparency = annotationElement.get("transparency").getAsBoolean(); + String id = annotationElement.get(Constants.ID).getAsString(); + int color = annotationElement.get("color").getAsInt(); + String status = annotationElement.get(Constants.STATUS).getAsString(); + String whiteboardId = annotationElement.get("whiteboardId").getAsString(); + int thickness = annotationElement.get("thickness").getAsInt(); + String type = annotationElement.get("type").getAsString(); + + JsonArray pointsJsonArray = annotationElement.get("points").getAsJsonArray(); + + ArrayList pointsArray = new ArrayList(); + Iterator pointIter = pointsJsonArray.iterator(); + while (pointIter.hasNext()){ + JsonElement p = pointIter.next(); + Float pf = p.getAsFloat(); + if (pf != null) { + pointsArray.add(pf); + } + } + + finalAnnotation.put("transparency", transparency); + finalAnnotation.put(Constants.ID, id); + finalAnnotation.put("color", color); + finalAnnotation.put("status", status); + finalAnnotation.put("whiteboardId", whiteboardId); + finalAnnotation.put("thickness", thickness); + finalAnnotation.put("points", pointsArray); + finalAnnotation.put("type", type); + + return finalAnnotation; + } + + // TEXT SHAPE + else if (annotationElement.has(Constants.ID) + && annotationElement.has("text") + && annotationElement.has("fontColor") + && annotationElement.has("status") + && annotationElement.has("textBoxWidth") + && annotationElement.has("fontSize") + && annotationElement.has("type") + && annotationElement.has("calcedFontSize") + && annotationElement.has("textBoxHeight") + && annotationElement.has("calcedFontSize") + && annotationElement.has("whiteboardId") + && annotationElement.has("dataPoints") + && annotationElement.has("x") + && annotationElement.has("y")){ + + Map finalAnnotation = new HashMap(); + + String text = annotationElement.get("text").getAsString(); + int fontColor = annotationElement.get("fontColor").getAsInt(); + String status = annotationElement.get(Constants.STATUS).getAsString(); + Float textBoxWidth = annotationElement.get("textBoxWidth").getAsFloat(); + int fontSize = annotationElement.get("fontSize").getAsInt(); + String type = annotationElement.get("type").getAsString(); + Float calcedFontSize = annotationElement.get("calcedFontSize").getAsFloat(); + Float textBoxHeight = annotationElement.get("textBoxHeight").getAsFloat(); + String id = annotationElement.get(Constants.ID).getAsString(); + String whiteboardId = annotationElement.get("whiteboardId").getAsString(); + Float x = annotationElement.get("x").getAsFloat(); + Float y = annotationElement.get("y").getAsFloat(); + String dataPoints = annotationElement.get("dataPoints").getAsString(); + + finalAnnotation.put("text", text); + finalAnnotation.put("fontColor", fontColor); + finalAnnotation.put(Constants.STATUS, status); + finalAnnotation.put("textBoxWidth", textBoxWidth); + finalAnnotation.put("fontSize", fontSize); + finalAnnotation.put("type", type); + finalAnnotation.put("calcedFontSize", calcedFontSize); + finalAnnotation.put("textBoxHeight", textBoxHeight); + finalAnnotation.put(Constants.ID, id); + finalAnnotation.put("whiteboardId", whiteboardId); + finalAnnotation.put("x", x); + finalAnnotation.put("y", y); + finalAnnotation.put("dataPoints", dataPoints); + + return finalAnnotation; + } + return null; + } + + public Map extractCurrentPresenter(JsonObject vu) { + if (vu.has(Constants.USER_ID) && vu.has(Constants.NAME) + && vu.has(Constants.ASSIGNED_BY)){ + + Map vuMap = new HashMap(); + String presenterUserId = vu.get(Constants.USER_ID).getAsString(); + String presenterName = vu.get(Constants.NAME).getAsString(); + String assignedBy = vu.get(Constants.ASSIGNED_BY).getAsString(); + + vuMap.put("userId", presenterUserId); + vuMap.put("name", presenterName); + vuMap.put("assignedBy", assignedBy); + + return vuMap; + } + return null; + } + + + public ArrayList> extractPresentationPages(JsonArray pagesArray) { + ArrayList> pages = new ArrayList>(); + + Iterator pagesIter = pagesArray.iterator(); + while (pagesIter.hasNext()){ + JsonObject pageObj = (JsonObject)pagesIter.next(); + if (pageObj.has("id") && pageObj.has("num") + && pageObj.has("thumb_uri") && pageObj.has("swf_uri") + && pageObj.has("txt_uri") && pageObj.has("png_uri") + && pageObj.has("current") && pageObj.has("x_offset") + && pageObj.has("y_offset") && pageObj.has("width_ratio") + && pageObj.has("height_ratio")) { + + Map page = new HashMap(); + + String pageId = pageObj.get("id").getAsString(); + Integer pageNum = pageObj.get("num").getAsInt(); + String pageThumbUri = pageObj.get("thumb_uri").getAsString(); + String pageSwfUri = pageObj.get("swf_uri").getAsString(); + String pageTxtUri = pageObj.get("txt_uri").getAsString(); + String pagePngUri = pageObj.get("png_uri").getAsString(); + + Boolean currentPage = pageObj.get("current").getAsBoolean(); + Double xOffset = pageObj.get("x_offset").getAsDouble(); + Double yOffset = pageObj.get("y_offset").getAsDouble(); + Double widthRatio = pageObj.get("width_ratio").getAsDouble(); + Double heightRatio = pageObj.get("height_ratio").getAsDouble(); + + page.put("id", pageId); + page.put("num", pageNum); + page.put("thumbUri", pageThumbUri); + page.put("swfUri", pageSwfUri); + page.put("txtUri", pageTxtUri); + page.put("pngUri", pagePngUri); + page.put("current", currentPage); + page.put("xOffset", xOffset); + page.put("yOffset", yOffset); + page.put("widthRatio", widthRatio); + page.put("heightRatio", heightRatio); + + pages.add(page); + } + } + + return pages; + } + + public ArrayList> extractPresentations(JsonArray presArray) { + ArrayList> presentations = new ArrayList>(); + + Iterator presentationsIter = presArray.iterator(); + while (presentationsIter.hasNext()){ + JsonObject presObj = (JsonObject)presentationsIter.next(); + if (presObj.has(Constants.ID) && presObj.has(Constants.NAME) + && presObj.has(Constants.CURRENT) && presObj.has(Constants.PAGES)) { + Map pres = new HashMap(); + + String presId = presObj.get(Constants.ID).getAsString(); + String presName = presObj.get(Constants.NAME).getAsString(); + Boolean currentPres = presObj.get(Constants.CURRENT).getAsBoolean(); + + pres.put("id", presId); + pres.put("name", presName); + pres.put("current", currentPres); + + JsonArray pagesJsonArray = presObj.get(Constants.PAGES).getAsJsonArray(); + + ArrayList> pages = extractPresentationPages(pagesJsonArray); + // store the pages in the presentation + pres.put(Constants.PAGES, pages); + + // add this presentation into our presentations list + presentations.add(pres); + } + } + return presentations; + } + + public ArrayList> extractShapes(JsonArray shapes) { + ArrayList> collection = new ArrayList>(); + + Iterator shapesIter = shapes.iterator(); + while (shapesIter.hasNext()){ + JsonElement shape = shapesIter.next(); + + Map shapeMap = extractOuterAnnotation((JsonObject)shape); + + if (shapeMap != null) { + collection.add(shapeMap); + } + } + return collection; + } + + public Map extractOuterAnnotation(JsonObject annotationElement) { + + if (annotationElement.has(Constants.ID) + && annotationElement.has("shape") + && annotationElement.has("status") + && annotationElement.has("shape_type")){ + + Map finalAnnotation = new HashMap(); + + String id = annotationElement.get(Constants.ID).getAsString(); + String status = annotationElement.get("status").getAsString(); + String type = annotationElement.get("shape_type").getAsString(); + + finalAnnotation.put(Constants.ID, id); + finalAnnotation.put("type", type); + finalAnnotation.put("status", status); + finalAnnotation.put("status", status); + + JsonElement shape = annotationElement.get("shape"); + Map shapesMap = extractAnnotation((JsonObject)shape); + + if (shapesMap != null) { + finalAnnotation.put("shapes", shapesMap); + } + + return finalAnnotation; + } + + return null; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java new file mode 100755 index 0000000000..5edce96fd2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java @@ -0,0 +1,71 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class ValidateAuthTokenMessage implements IPublishedMessage { + public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String token; + public final String replyTo; + public final String sessionId; + + public ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo, String sessionId) { + this.meetingId = meetingId; + this.userId = userId; + this.token = token; + this.replyTo = replyTo; + this.sessionId = sessionId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.AUTH_TOKEN, token); + java.util.HashMap header = MessageBuilder.buildHeader(VALIDATE_AUTH_TOKEN, VERSION, replyTo); + + return MessageBuilder.buildJson(header, payload); + } + + public static ValidateAuthTokenMessage fromJson(String message) { + System.out.println("Process ValidateAuthTokenMessage.fromJson"); + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + System.out.println("Process ValidateAuthTokenMessage.fromJson 1"); + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + System.out.println("Process ValidateAuthTokenMessage.fromJson 2"); + String messageName = header.get("name").getAsString(); + if (VALIDATE_AUTH_TOKEN.equals(messageName)) { + System.out.println("Process ValidateAuthTokenMessage.fromJson 3"); + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.AUTH_TOKEN) + && header.has(Constants.REPLY_TO)) { + System.out.println("Process ValidateAuthTokenMessage.fromJson 4"); + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + String replyTo = header.get(Constants.REPLY_TO).getAsString(); + String sessionId = "tobeimplemented"; + return new ValidateAuthTokenMessage(id, userid, authToken, replyTo, + sessionId); + } + } + } + } + System.out.println("Process ValidateAuthTokenMessage.fromJson 0000"); + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenReplyMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenReplyMessage.java new file mode 100755 index 0000000000..01b16000e9 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenReplyMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class ValidateAuthTokenReplyMessage implements ISubscribedMessage { + public static final String VALIDATE_AUTH_TOKEN_REPLY = "validate_auth_token_reply"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String token; + public final String replyTo; + public final Boolean valid; + + public ValidateAuthTokenReplyMessage(String meetingId, String userId, String token, + Boolean valid, String replyTo) { + this.meetingId = meetingId; + this.userId = userId; + this.token = token; + this.replyTo = replyTo; + this.valid = valid; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.REPLY_TO, replyTo); + payload.put(Constants.VALID, valid); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.AUTH_TOKEN, token); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(VALIDATE_AUTH_TOKEN_REPLY, VERSION, replyTo); + + return MessageBuilder.buildJson(header, payload); + } + + public static ValidateAuthTokenReplyMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (VALIDATE_AUTH_TOKEN_REPLY.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.AUTH_TOKEN) + && payload.has(Constants.VALID) + && payload.has(Constants.REPLY_TO)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + Boolean valid = payload.get(Constants.VALID).getAsBoolean(); + return new ValidateAuthTokenReplyMessage(id, userid, authToken, valid, replyTo); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenTimeoutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenTimeoutMessage.java new file mode 100755 index 0000000000..f8fdd31f54 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenTimeoutMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class ValidateAuthTokenTimeoutMessage implements ISubscribedMessage { + public static final String VALIDATE_AUTH_TOKEN_TIMEOUT = "validate_auth_token_timeout"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String userId; + public final String token; + public final String replyTo; + public final Boolean valid; + + public ValidateAuthTokenTimeoutMessage(String meetingId, String userId, String token, + Boolean valid, String replyTo) { + this.meetingId = meetingId; + this.userId = userId; + this.token = token; + this.replyTo = replyTo; + this.valid = valid; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.REPLY_TO, replyTo); + payload.put(Constants.VALID, valid); + payload.put(Constants.USER_ID, userId); + payload.put(Constants.AUTH_TOKEN, token); + payload.put(Constants.MEETING_ID, meetingId); + + java.util.HashMap header = MessageBuilder.buildHeader(VALIDATE_AUTH_TOKEN_TIMEOUT, VERSION, replyTo); + + return MessageBuilder.buildJson(header, payload); + } + + public static ValidateAuthTokenTimeoutMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (VALIDATE_AUTH_TOKEN_TIMEOUT.equals(messageName)) { + if (payload.has(Constants.MEETING_ID) + && payload.has(Constants.USER_ID) + && payload.has(Constants.AUTH_TOKEN) + && payload.has(Constants.VALID) + && payload.has(Constants.REPLY_TO)) { + String id = payload.get(Constants.MEETING_ID).getAsString(); + String userid = payload.get(Constants.USER_ID).getAsString(); + String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); + String replyTo = payload.get(Constants.REPLY_TO).getAsString(); + Boolean valid = payload.get(Constants.VALID).getAsBoolean(); + return new ValidateAuthTokenTimeoutMessage(id, userid, authToken, valid, replyTo); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java new file mode 100755 index 0000000000..babdde091d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java @@ -0,0 +1,13 @@ +package org.bigbluebutton.conference.service.chat; + +public class ChatKeyUtil { + public static final String CHAT_TYPE = "chatType"; + public static final String FROM_USERID = "fromUserID"; + public static final String FROM_USERNAME = "fromUsername"; + public static final String FROM_COLOR = "fromColor"; + public static final String FROM_TIME = "fromTime"; + public static final String FROM_TZ_OFFSET = "fromTimezoneOffset"; + public static final String TO_USERID = "toUserID"; + public static final String TO_USERNAME = "toUsername"; + public static final String MESSAGE = "message"; +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java new file mode 100755 index 0000000000..abce5e8ae7 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java @@ -0,0 +1,45 @@ +package org.bigbluebutton.conference.service.chat; + +import org.bigbluebutton.common.messages.GetChatHistoryRequestMessage; +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.common.messages.SendPrivateChatMessage; +import org.bigbluebutton.common.messages.SendPublicChatMessage; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +public class ChatMessageListener implements MessageHandler{ + + private IBigBlueButtonInGW bbbGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_CHANNEL)) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GetChatHistoryRequestMessage.GET_CHAT_HISTORY_REQUEST.equals(messageName)) { + GetChatHistoryRequestMessage msg = GetChatHistoryRequestMessage.fromJson(message); + bbbGW.getChatHistory(msg.meetingId, msg.requesterId, msg.replyTo); + } else if (SendPublicChatMessage.SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)){ + SendPublicChatMessage msg = SendPublicChatMessage.fromJson(message); + bbbGW.sendPublicMessage(msg.meetingId, msg.requesterId, msg.messageInfo); + } else if (SendPrivateChatMessage.SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)){ + SendPrivateChatMessage msg = SendPrivateChatMessage.fromJson(message); + bbbGW.sendPrivateMessage(msg.meetingId, msg.requesterId, msg.messageInfo); + } + } + } + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java new file mode 100755 index 0000000000..68bed8ba77 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java @@ -0,0 +1,45 @@ +package org.bigbluebutton.conference.service.lock; + +import org.bigbluebutton.common.messages.GetLockSettingsMessage; +import org.bigbluebutton.common.messages.LockUserMessage; +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.common.messages.SendLockSettingsMessage; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +public class LockMessageListener implements MessageHandler { + + private IBigBlueButtonInGW bbbGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GetLockSettingsMessage.GET_LOCK_SETTINGS.equals(messageName)) { + GetLockSettingsMessage msg = GetLockSettingsMessage.fromJson(message); + bbbGW.getLockSettings(msg.meetingId, msg.userId); + } else if(LockUserMessage.LOCK_USER.equals(messageName)) { + LockUserMessage msg = LockUserMessage.fromJson(message); + bbbGW.lockUser(msg.meetingId, msg.requesterId, msg.lock, msg.internalUserId); + } else if(SendLockSettingsMessage.SEND_LOCK_SETTINGS.equals(messageName)) { + SendLockSettingsMessage msg = SendLockSettingsMessage.fromJson(message); + bbbGW.sendLockSettings(msg.meetingId, msg.userId, msg.newSettings); + } + } + } + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java new file mode 100755 index 0000000000..3a85319705 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java @@ -0,0 +1,278 @@ + +package org.bigbluebutton.conference.service.participants; + +import org.bigbluebutton.common.messages.AssignPresenterRequestMessage; +import org.bigbluebutton.common.messages.BroadcastLayoutRequestMessage; +import org.bigbluebutton.common.messages.EjectUserFromMeetingRequestMessage; +import org.bigbluebutton.common.messages.EjectUserFromVoiceRequestMessage; +import org.bigbluebutton.common.messages.GetCurrentLayoutRequestMessage; +import org.bigbluebutton.common.messages.GetRecordingStatusRequestMessage; +import org.bigbluebutton.common.messages.GetUsersRequestMessage; +import org.bigbluebutton.common.messages.InitAudioSettingsMessage; +import org.bigbluebutton.common.messages.InitPermissionsSettingMessage; +import org.bigbluebutton.common.messages.IsMeetingMutedRequestMessage; +import org.bigbluebutton.common.messages.LockLayoutRequestMessage; +import org.bigbluebutton.common.messages.LockMuteUserRequestMessage; +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.common.messages.MuteAllExceptPresenterRequestMessage; +import org.bigbluebutton.common.messages.MuteAllRequestMessage; +import org.bigbluebutton.common.messages.MuteUserRequestMessage; +import org.bigbluebutton.common.messages.SetRecordingStatusRequestMessage; +import org.bigbluebutton.common.messages.SetUserStatusRequestMessage; +import org.bigbluebutton.common.messages.UserLeavingMessage; +import org.bigbluebutton.common.messages.UserLoweredHandMessage; +import org.bigbluebutton.common.messages.UserRaisedHandMessage; +import org.bigbluebutton.common.messages.UserShareWebcamRequestMessage; +import org.bigbluebutton.common.messages.UserUnshareWebcamRequestMessage; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +public class ParticipantsListener implements MessageHandler{ + + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) { + this.bbbInGW = bbbInGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_USERS_CHANNEL)) { + System.out.println("Users message: " + channel + " " + message); + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + switch (messageName) { + case UserLeavingMessage.USER_LEAVING: + processUserLeavingMessage(message); + break; + case AssignPresenterRequestMessage.ASSIGN_PRESENTER_REQUEST: + processAssignPresenterRequestMessage(message); + break; + case UserRaisedHandMessage.USER_RAISED_HAND: + processUserRaisedHandMessage(message); + break; + case UserLoweredHandMessage.USER_LOWERED_HAND: + processUserLoweredHandMessage(message); + break; + case EjectUserFromMeetingRequestMessage.EJECT_USER_FROM_MEETING_REQUEST: + processEjectUserFromMeetingRequestMessage(message); + break; + case UserShareWebcamRequestMessage.USER_SHARE_WEBCAM_REQUEST: + processUserShareWebcamRequestMessage(message); + break; + case UserUnshareWebcamRequestMessage.USER_UNSHARE_WEBCAM_REQUEST: + processUserUnshareWebcamRequestMessage(message); + break; + case SetUserStatusRequestMessage.SET_USER_STATUS_REQUEST: + processSetUserStatusRequestMessage(message); + break; + case SetRecordingStatusRequestMessage.SET_RECORDING_STATUS_REQUEST: + processSetRecordingStatusRequestMessage(message); + break; + case GetRecordingStatusRequestMessage.GET_RECORDING_STATUS_REQUEST: + processGetRecordingStatusRequestMessage(message); + break; + case GetUsersRequestMessage.GET_USERS_REQUEST: + processGetUsersRequestMessage(message); + break; + case InitPermissionsSettingMessage.INIT_PERMISSIONS_SETTING: + processInitPermissionsSettingMessage(message); + break; + case InitAudioSettingsMessage.INIT_AUDIO_SETTING: + processInitAudioSettingsMessage(message); + break; + case BroadcastLayoutRequestMessage.BROADCAST_LAYOUT_REQUEST: + processBroadcastLayoutRequestMessage(message); + break; + case LockLayoutRequestMessage.LOCK_LAYOUT_REQUEST: + processLockLayoutRequestMessage(message); + break; + case GetCurrentLayoutRequestMessage.GET_CURRENT_LAYOUT_REQUEST: + processGetCurrentLayoutRequestMessage(message); + break; + case MuteAllExceptPresenterRequestMessage.MUTE_ALL_EXCEPT_PRESENTER_REQUEST: + processMuteAllExceptPresenterRequestMessage(message); + break; + case MuteAllRequestMessage.MUTE_ALL_REQUEST: + processMuteAllRequestMessage(message); + break; + case IsMeetingMutedRequestMessage.IS_MEETING_MUTED_REQUEST: + processIsMeetingMutedRequestMessage(message); + break; + case MuteUserRequestMessage.MUTE_USER_REQUEST: + processMuteUserRequestMessage(message); + break; + case LockMuteUserRequestMessage.LOCK_MUTE_USER_REQUEST: + processLockMuteUserRequestMessage(message); + break; + case EjectUserFromVoiceRequestMessage.EJECT_USER_FROM_VOICE_REQUEST: + processEjectUserFromVoiceRequestMessage(message); + break; + + } + } + } + } + } + + private void processUserLeavingMessage(String message) { + UserLeavingMessage ulm = UserLeavingMessage.fromJson(message); + if (ulm != null) { + bbbInGW.userLeft(ulm.meetingId, ulm.userId, ulm.meetingId); + } + } + + private void processAssignPresenterRequestMessage(String message) { + AssignPresenterRequestMessage apm = AssignPresenterRequestMessage.fromJson(message); + if (apm != null) { + bbbInGW.assignPresenter(apm.meetingId, apm.newPresenterId, apm.newPresenterName, apm.assignedBy); + } + } + + private void processUserRaisedHandMessage(String message) { + UserRaisedHandMessage urhm = UserRaisedHandMessage.fromJson(message); + if (urhm != null) { + bbbInGW.userRaiseHand(urhm.meetingId, urhm.userId);; + } + } + + private void processUserLoweredHandMessage(String message) { + UserLoweredHandMessage ulhm = UserLoweredHandMessage.fromJson(message); + if (ulhm != null) { + bbbInGW.lowerHand(ulhm.meetingId, ulhm.userId, ulhm.loweredBy); + } + } + + private void processEjectUserFromMeetingRequestMessage(String message) { + EjectUserFromMeetingRequestMessage eufm = EjectUserFromMeetingRequestMessage.fromJson(message); + if (eufm != null) { + bbbInGW.ejectUserFromMeeting(eufm.meetingId, eufm.userId, eufm.ejectedBy); + } + } + + private void processUserShareWebcamRequestMessage(String message) { + UserShareWebcamRequestMessage msg = UserShareWebcamRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.shareWebcam(msg.meetingId, msg.userId, msg.stream); + } + } + + private void processUserUnshareWebcamRequestMessage(String message) { + UserUnshareWebcamRequestMessage msg = UserUnshareWebcamRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.unshareWebcam(msg.meetingId, msg.userId, msg.stream); + } + } + + private void processSetUserStatusRequestMessage(String message) { + SetUserStatusRequestMessage msg = SetUserStatusRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.setUserStatus(msg.meetingId, msg.userId, msg.status, msg.value); + } + } + + private void processSetRecordingStatusRequestMessage(String message) { + SetRecordingStatusRequestMessage msg = SetRecordingStatusRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.setRecordingStatus(msg.meetingId, msg.userId, msg.recording); + } + } + + private void processGetRecordingStatusRequestMessage(String message) { + GetRecordingStatusRequestMessage msg = GetRecordingStatusRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.getRecordingStatus(msg.meetingId, msg.userId); + } + } + + private void processGetUsersRequestMessage(String message) { + GetUsersRequestMessage msg = GetUsersRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.getUsers(msg.meetingId, msg.requesterId); + } + } + + private void processInitPermissionsSettingMessage(String message) { + InitPermissionsSettingMessage msg = InitPermissionsSettingMessage.fromJson(message); + if (msg != null) { + bbbInGW.initLockSettings(msg.meetingId, msg.permissions); + } + } + + private void processInitAudioSettingsMessage(String message) { + InitAudioSettingsMessage msg = InitAudioSettingsMessage.fromJson(message); + if (msg != null) { + bbbInGW.initAudioSettings(msg.meetingId, msg.userId, msg.muted); + } + } + + private void processBroadcastLayoutRequestMessage(String message) { + BroadcastLayoutRequestMessage msg = BroadcastLayoutRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.broadcastLayout(msg.meetingId, msg.userId, msg.layout); + } + } + + private void processLockLayoutRequestMessage(String message) { + LockLayoutRequestMessage msg = LockLayoutRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.lockLayout(msg.meetingId, msg.userId, msg.lock, msg.viewersOnly, msg.layout); + } + } + + private void processGetCurrentLayoutRequestMessage(String message) { + GetCurrentLayoutRequestMessage msg = GetCurrentLayoutRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.getCurrentLayout(msg.meetingId, msg.userId); + } + } + + private void processMuteAllExceptPresenterRequestMessage(String message) { + MuteAllExceptPresenterRequestMessage msg = MuteAllExceptPresenterRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.muteAllExceptPresenter(msg.meetingId, msg.requesterId, msg.mute); + } + } + + private void processMuteAllRequestMessage(String message) { + MuteAllRequestMessage msg = MuteAllRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.muteAllUsers(msg.meetingId, msg.requesterId, msg.mute); + } + } + + private void processIsMeetingMutedRequestMessage(String message) { + IsMeetingMutedRequestMessage msg = IsMeetingMutedRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.isMeetingMuted(msg.meetingId, msg.requesterId); + } + } + + private void processMuteUserRequestMessage(String message) { + MuteUserRequestMessage msg = MuteUserRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.muteUser(msg.meetingId, msg.requesterId, msg.userId, msg.mute); + } + } + + private void processLockMuteUserRequestMessage(String message) { + LockMuteUserRequestMessage msg = LockMuteUserRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.lockMuteUser(msg.meetingId, msg.requesterId, msg.userId, msg.lock); + } + } + + private void processEjectUserFromVoiceRequestMessage(String message) { + EjectUserFromVoiceRequestMessage msg = EjectUserFromVoiceRequestMessage.fromJson(message); + if (msg != null) { + bbbInGW.ejectUserFromVoice(msg.meetingId, msg.userId, msg.requesterId); + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java new file mode 100755 index 0000000000..e94293e2a9 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java @@ -0,0 +1,57 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.presentation; + +import org.bigbluebutton.core.api.IBigBlueButtonInGW; + +public class ConversionUpdatesProcessor { + + private IBigBlueButtonInGW bbbInGW; + + public void sendConversionUpdate(String messageKey, String conference, + String code, String presId, String presName) { + bbbInGW.sendConversionUpdate(messageKey, conference, + code, presId, presName); + } + + public void sendPageCountError(String messageKey, String conference, + String code, String presId, int numberOfPages, + int maxNumberPages, String presName) { + bbbInGW.sendPageCountError(messageKey, conference, code, presId, numberOfPages, + maxNumberPages, presName); + } + + public void sendSlideGenerated(String messageKey, String conference, + String code, String presId, int numberOfPages, + int pagesCompleted, String presName) { + bbbInGW.sendSlideGenerated(messageKey, conference, + code, presId, numberOfPages, pagesCompleted, presName); + } + + public void sendConversionCompleted(String messageKey, String conference, + String code, String presId, Integer numberOfPages, String presName, + String presBaseUrl) { + bbbInGW.sendConversionCompleted(messageKey, conference, + code, presId, numberOfPages, presName, presBaseUrl); + } + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; +} +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java new file mode 100755 index 0000000000..55ecb5424b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java @@ -0,0 +1,240 @@ +package org.bigbluebutton.conference.service.presentation; + +import java.util.HashMap; +import java.util.Map; + +import org.bigbluebutton.common.messages.GetPresentationInfoMessage; +import org.bigbluebutton.common.messages.GetSlideInfoMessage; +import org.bigbluebutton.common.messages.GoToSlideMessage; +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.common.messages.RemovePresentationMessage; +import org.bigbluebutton.common.messages.ResizeAndMoveSlideMessage; +import org.bigbluebutton.common.messages.SendConversionCompletedMessage; +import org.bigbluebutton.common.messages.SendConversionUpdateMessage; +import org.bigbluebutton.common.messages.SendCursorUpdateMessage; +import org.bigbluebutton.common.messages.SendPageCountErrorMessage; +import org.bigbluebutton.common.messages.SendSlideGeneratedMessage; +import org.bigbluebutton.common.messages.SharePresentationMessage; +import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +public class PresentationMessageListener implements MessageHandler { + + public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS"; + public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED"; + public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT"; + public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT"; + public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED"; + public static final String PAGE_COUNT_EXCEEDED_KEY = "PAGE_COUNT_EXCEEDED"; + public static final String GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; + public static final String GENERATING_THUMBNAIL_KEY = "GENERATING_THUMBNAIL"; + public static final String GENERATED_THUMBNAIL_KEY = "GENERATED_THUMBNAIL"; + public static final String CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; + + private ConversionUpdatesProcessor conversionUpdatesProcessor; + private IBigBlueButtonInGW bbbInGW; + + public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) { + conversionUpdatesProcessor = p; + } + + public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + bbbInGW = inGW; + } + + private void sendConversionUpdate(String messageKey, String conference, + String code, String presId, String filename) { + + conversionUpdatesProcessor.sendConversionUpdate(messageKey, conference, + code, presId, filename); + } + + public void sendPageCountError(String messageKey, String conference, + String code, String presId, Integer numberOfPages, + Integer maxNumberPages, String filename) { + + conversionUpdatesProcessor.sendPageCountError(messageKey, conference, + code, presId, numberOfPages, + maxNumberPages, filename); + } + + private void sendSlideGenerated(String messageKey, String conference, + String code, String presId, Integer numberOfPages, + Integer pagesCompleted, String filename) { + + conversionUpdatesProcessor.sendSlideGenerated(messageKey, conference, + code, presId, numberOfPages, + pagesCompleted, filename); + } + + private void sendConversionCompleted(String messageKey, String conference, + String code, String presId, Integer numberOfPages, + String filename, String presBaseUrl) { + + conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference, + code, presId, numberOfPages, filename, presBaseUrl); + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (SendConversionUpdateMessage.SEND_CONVERSION_UPDATE.equals(messageName)) { + SendConversionUpdateMessage msg = SendConversionUpdateMessage.fromJson(message); + System.out.println("in messageHandler - sendConversionCompleted"); + +// sendConversionUpdate(msg.messageKey, msg.meetingId, msg.code, +// msg.presId, msg.presName); + bbbInGW.sendConversionUpdate(msg.messageKey, msg.meetingId, + msg.code, msg.presId, msg.presName); + } else if (ResizeAndMoveSlideMessage.RESIZE_AND_MOVE_SLIDE.equals(messageName)) { + System.out.println("in messageHandler - resizeAndMoveSlide"); + ResizeAndMoveSlideMessage msg = ResizeAndMoveSlideMessage.fromJson(message); + + bbbInGW.resizeAndMoveSlide(msg.meetingId, msg.xOffset, msg.yOffset, + msg.widthRatio, msg.heightRatio); + } else if (GetPresentationInfoMessage.GET_PRESENTATION_INFO.equals(messageName)) { + System.out.println("in messageHandler - getPresentationInfo"); + GetPresentationInfoMessage msg = GetPresentationInfoMessage.fromJson(message); + + bbbInGW.getPresentationInfo(msg.meetingId, msg.requesterId, msg.replyTo); + } else if (SendConversionCompletedMessage.SEND_CONVERSION_COMPLETED.equals(messageName)) { + System.out.println("in messageHandler - sendConversionCompleted"); + SendConversionCompletedMessage msg = SendConversionCompletedMessage.fromJson(message); + +// sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code, +// msg.presId, msg.numPages, msg.presName, msg.presBaseUrl); + bbbInGW.sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code, + msg.presId, msg.numPages, msg.presName, msg.presBaseUrl); + } else if (SendPageCountErrorMessage.SEND_PAGE_COUNT_ERROR.equals(messageName)) { + System.out.println("in messageHandler - sendPageCountError"); + SendPageCountErrorMessage msg = SendPageCountErrorMessage.fromJson(message); + +// sendPageCountError(msg.messageKey, msg.meetingId, msg.code, +// msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName); + bbbInGW.sendPageCountError(msg.messageKey, msg.meetingId, msg.code, + msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName); + } else if (GoToSlideMessage.GO_TO_SLIDE.equals(messageName)) { + System.out.println("in messageHandler - goToSlide"); + GoToSlideMessage msg = GoToSlideMessage.fromJson(message); + + bbbInGW.gotoSlide(msg.meetingId, msg.page); + } else if (RemovePresentationMessage.REMOVE_PRESENTATION.equals(messageName)) { + System.out.println("in messageHandler - removePresentation"); + RemovePresentationMessage msg = RemovePresentationMessage.fromJson(message); + + bbbInGW.removePresentation(msg.meetingId, msg.presentationId); + } else if (SendCursorUpdateMessage.SEND_CURSOR_UPDATE.equals(messageName)) { + SendCursorUpdateMessage msg = SendCursorUpdateMessage.fromJson(message); + + bbbInGW.sendCursorUpdate(msg.meetingId, msg.xPercent, msg.yPercent); + } else if (SharePresentationMessage.SHARE_PRESENTATION.equals(messageName)) { + System.out.println("in messageHandler - sharePresentation"); + SharePresentationMessage msg = SharePresentationMessage.fromJson(message); + + bbbInGW.sharePresentation(msg.meetingId, msg.presentationId, msg.share); + } else if (GetSlideInfoMessage.GET_SLIDE_INFO.equals(messageName)) { + System.out.println("in messageHandler - GetSlideInfo"); + GetSlideInfoMessage msg = GetSlideInfoMessage.fromJson(message); + + bbbInGW.getSlideInfo(msg.meetingId, msg.requesterId, msg.replyTo); + } else if (SendSlideGeneratedMessage.SEND_SLIDE_GENERATED.equals(messageName)) { + System.out.println("in messageHandler - SendSlideGenerated"); + SendSlideGeneratedMessage msg = SendSlideGeneratedMessage.fromJson(message); + + bbbInGW.sendSlideGenerated(msg.messageKey, msg.meetingId, msg.code, + msg.presId, msg.numberOfPages, msg.pagesCompleted, msg.presName); + } + } + } + else { + Gson gson = new Gson(); + HashMap map = gson.fromJson(message, new TypeToken>() {}.getType()); + String code = (String) map.get("returnCode"); + String presId = (String) map.get("presentationId"); + String filename = (String) map.get("filename"); + String conference = (String) map.get("conference"); + String messageKey = (String) map.get("messageKey"); + + if (messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_SUCCESS_KEY) || + messageKey.equalsIgnoreCase(OFFICE_DOC_CONVERSION_FAILED_KEY) || + messageKey.equalsIgnoreCase(SUPPORTED_DOCUMENT_KEY) || + messageKey.equalsIgnoreCase(UNSUPPORTED_DOCUMENT_KEY) || + messageKey.equalsIgnoreCase(GENERATING_THUMBNAIL_KEY) || + messageKey.equalsIgnoreCase(GENERATED_THUMBNAIL_KEY) || + messageKey.equalsIgnoreCase(PAGE_COUNT_FAILED_KEY)){ + + sendConversionUpdate(messageKey, conference, code, presId, filename); + } else if(messageKey.equalsIgnoreCase(PAGE_COUNT_EXCEEDED_KEY)){ + + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + Integer maxNumberPages = new Integer((String) map.get("maxNumberPages")); + sendPageCountError(messageKey, conference, code, + presId, numberOfPages, maxNumberPages, filename); + + } else if(messageKey.equalsIgnoreCase(GENERATED_SLIDE_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + Integer pagesCompleted = new Integer((String) map.get("pagesCompleted")); + + sendSlideGenerated(messageKey, conference, code, + presId, numberOfPages, pagesCompleted, filename); + + } else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){ + Integer numberOfPages = new Integer((String) map.get("numberOfPages")); + String presBaseUrl = (String) map.get("presentationBaseUrl"); + + sendConversionCompleted(messageKey, conference, code, + presId, numberOfPages, filename, presBaseUrl); + } + } + } + } +// @Override +// public void handleMessage(String pattern, String channel, String message) { +// +// if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) { +// +// JsonParser parser = new JsonParser(); +// JsonObject obj = (JsonObject) parser.parse(message); +// +// if(obj.has("payload") && obj.has("header")) { +// +// JsonObject headerObject = (JsonObject) obj.get("header"); +// JsonObject payloadObject = (JsonObject) obj.get("payload"); +// +// String eventName = headerObject.get("name").toString().replace("\"", ""); +// +// if(eventName.equalsIgnoreCase("presentation_page_changed_message") || +// eventName.equalsIgnoreCase("presentation_page_resized_message")) { +// +// JsonObject pageObject = (JsonObject) payloadObject.get("page"); +// String roomName = payloadObject.get("meeting_id").toString().replace("\"", ""); +// +// if(eventName.equalsIgnoreCase("presentation_page_changed_message")) { +// String pageId = pageObject.get("id").toString().replace("\"", ""); +// bbbInGW.gotoSlide(roomName, pageId); +// } else if(eventName.equalsIgnoreCase("presentation_page_resized_message")) { +// String xOffset = pageObject.get("x_offset").toString().replace("\"", ""); +// String yOffset = pageObject.get("y_offset").toString().replace("\"", ""); +// String widthRatio = pageObject.get("width_ratio").toString().replace("\"", ""); +// String heightRatio = pageObject.get("height_ratio").toString().replace("\"", ""); +// bbbInGW.resizeAndMoveSlide(roomName, Double.parseDouble(xOffset), Double.parseDouble(yOffset), Double.parseDouble(widthRatio), Double.parseDouble(heightRatio)); +// } +// } +// } +// +// } +// } +} + diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java new file mode 100755 index 0000000000..0c05f23f20 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java @@ -0,0 +1,12 @@ +package org.bigbluebutton.conference.service.presentation; + +public class PreuploadedPresentation { + + public final String id; + public final int numPages; + + public PreuploadedPresentation(String id, int numPages) { + this.id = id; + this.numPages = numPages; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java new file mode 100644 index 0000000000..94266c37f1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java @@ -0,0 +1,55 @@ +package org.bigbluebutton.conference.service.presentation; + +import java.io.File; +import java.io.FileFilter; +import java.io.FilenameFilter; +import java.util.ArrayList; + +public class PreuploadedPresentationsUtil { + + private String bbbDir = "/var/bigbluebutton/"; + + public ArrayList getPreuploadedPresentations(String meetingID) { + ArrayList preuploadedPresentations = new ArrayList(); + + try { + // TODO: this is hard-coded, and not really a great abstraction. need to fix this up later + String folderPath = bbbDir + meetingID + "/" + meetingID; + File folder = new File(folderPath); + //log.debug("folder: {} - exists: {} - isDir: {}", folder.getAbsolutePath(), folder.exists(), folder.isDirectory()); + if (folder.exists() && folder.isDirectory()) { + File[] presentations = folder.listFiles(new FileFilter() { + public boolean accept(File path) { + return path.isDirectory(); + } + }); + for (File presFile : presentations) { + int numPages = getNumPages(presFile); + PreuploadedPresentation p = new PreuploadedPresentation(presFile.getName(), numPages); + preuploadedPresentations.add(p); + } + } + } catch (Exception ex) { + + } + + return preuploadedPresentations; + } + + private int getNumPages(File presDir) { + File[] files = presDir.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.toLowerCase().endsWith(".swf"); + } + }); + + return files.length; + } + + public void setBigBlueButtonDirectory(String dir) { + if (dir.endsWith("/")) bbbDir = dir; + else bbbDir = dir + "/"; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java new file mode 100755 index 0000000000..416b341293 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java @@ -0,0 +1,142 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import org.apache.commons.pool.impl.GenericObjectPool; + +public class GenericObjectPoolConfigWrapper { + + private final GenericObjectPool.Config config; + + public GenericObjectPoolConfigWrapper() { + this.config = new GenericObjectPool.Config(); + } + + public GenericObjectPool.Config getConfig() { + return config; + } + + public int getMaxIdle() { + return this.config.maxIdle; + } + + public void setMaxIdle(int maxIdle) { + this.config.maxIdle = maxIdle; + } + + public int getMinIdle() { + return this.config.minIdle; + } + + public void setMinIdle(int minIdle) { + this.config.minIdle = minIdle; + } + + public int getMaxActive() { + return this.config.maxActive; + } + + public void setMaxActive(int maxActive) { + this.config.maxActive = maxActive; + } + + public long getMaxWait() { + return this.config.maxWait; + } + + public void setMaxWait(long maxWait) { + this.config.maxWait = maxWait; + } + + public byte getWhenExhaustedAction() { + return this.config.whenExhaustedAction; + } + + public void setWhenExhaustedAction(byte whenExhaustedAction) { + this.config.whenExhaustedAction = whenExhaustedAction; + } + + public boolean isTestOnBorrow() { + return this.config.testOnBorrow; + } + + public void setTestOnBorrow(boolean testOnBorrow) { + this.config.testOnBorrow = testOnBorrow; + } + + public boolean isTestOnReturn() { + return this.config.testOnReturn; + } + + public void setTestOnReturn(boolean testOnReturn) { + this.config.testOnReturn = testOnReturn; + } + + public boolean isTestWhileIdle() { + return this.config.testWhileIdle; + } + + public void setTestWhileIdle(boolean testWhileIdle) { + this.config.testWhileIdle = testWhileIdle; + } + + public long getTimeBetweenEvictionRunsMillis() { + return this.config.timeBetweenEvictionRunsMillis; + } + + public void setTimeBetweenEvictionRunsMillis( + long timeBetweenEvictionRunsMillis) { + this.config.timeBetweenEvictionRunsMillis = + timeBetweenEvictionRunsMillis; + } + + public int getNumTestsPerEvictionRun() { + return this.config.numTestsPerEvictionRun; + } + + public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { + this.config.numTestsPerEvictionRun = numTestsPerEvictionRun; + } + + public long getMinEvictableIdleTimeMillis() { + return this.config.minEvictableIdleTimeMillis; + } + + public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { + this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public long getSoftMinEvictableIdleTimeMillis() { + return this.config.softMinEvictableIdleTimeMillis; + } + + public void setSoftMinEvictableIdleTimeMillis( + long softMinEvictableIdleTimeMillis) { + this.config.softMinEvictableIdleTimeMillis = + softMinEvictableIdleTimeMillis; + } + + public boolean isLifo() { + return this.config.lifo; + } + + public void setLifo(boolean lifo) { + this.config.lifo = lifo; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java new file mode 100755 index 0000000000..a8cf016b6e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java @@ -0,0 +1,85 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import java.util.HashMap; + +/** + * Abstract class for all events that need to be recorded. + * @author Richard Alam + * + */ +public abstract class RecordEvent { + protected final HashMap eventMap = new HashMap(); + + protected final static String MODULE = "module"; + protected final static String TIMESTAMP = "timestamp"; + protected final static String MEETING = "meetingId"; + protected final static String EVENT = "eventName"; + + public final String getMeetingID() { + return eventMap.get(MEETING); + } + + /** + * Set the module that generated the event. + * @param module + */ + public final void setModule(String module) { + eventMap.put(MODULE, module); + } + + /** + * Set the timestamp of the event. + * @param timestamp + */ + public final void setTimestamp(long timestamp) { + eventMap.put(TIMESTAMP, Long.toString(timestamp)); + } + + /** + * Set the meetingId for this particular event. + * @param meetingId + */ + public final void setMeetingId(String meetingId) { + eventMap.put(MEETING, meetingId); + } + + /** + * Set the name of the event. + * @param event + */ + public final void setEvent(String event) { + eventMap.put(EVENT, event); + } + + + /** + * Convert the event into a Map to be recorded. + * @return + */ + public final HashMap toMap() { + return eventMap; + } + + @Override + public String toString() { + return eventMap.get(MODULE) + " " + eventMap.get(EVENT); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java new file mode 100755 index 0000000000..f5a24578ba --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +/** + * + * The IRecorder interface define all the neccesary methods to implement for + * dispatch events to a JMS queue + * + * */ +public interface Recorder { + /** + * Receive the messages from the bigbluebutton modules and send + * them to a queue. These messages are the events generated in a conference. + * @param message a JSON String message with the attributes of an event + */ + public void record(String session, RecordEvent event); + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java new file mode 100755 index 0000000000..3d8032ec34 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java @@ -0,0 +1,103 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import org.bigbluebutton.service.recording.RedisListRecorder; + +/** + * + * The RecorderApplication class is used for setting the record module + * in BigBlueButton for send events messages to a JMS queue. + * The class follows the same standard as the others modules of BigBlueButton Apps. + */ +public class RecorderApplication { + + private static final int NTHREADS = 1; + private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); + + private BlockingQueue messages; + private volatile boolean recordEvents = false; + + private RedisListRecorder redisListRecorder; + + private Recorder recorder; + + public RecorderApplication() { + messages = new LinkedBlockingQueue(); + } + + public void start() { + recordEvents = true; + Runnable sender = new Runnable() { + public void run() { + while (recordEvents) { + RecordEvent message; + try { + message = messages.take(); + recordEvent(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + exec.execute(sender); + } + + public void stop() { + recordEvents = false; + } + + public void destroyRecordSession(String meetingID) { +// recordingSessions.remove(meetingID); + } + + public void createRecordSession(String meetingID) { +// recordingSessions.put(meetingID, meetingID); + } + + public void record(String meetingID, RecordEvent message) { + messages.offer(message); + } + + private void recordEvent(final RecordEvent message) { + Runnable task = new Runnable() { + public void run() { + recorder.record(message.getMeetingID(), message); + } + }; + runExec.execute(task); + } + + public void setRecorder(Recorder recorder) { + this.recorder = recorder; + } + + public void setRedisListRecorder(RedisListRecorder rec) { + redisListRecorder = rec; + } +} + diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java new file mode 100755 index 0000000000..414883b09f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java @@ -0,0 +1,50 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder; + +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class RedisDispatcher implements Recorder { + + private static final String COLON=":"; + JedisPool redisPool; + + @Override + public void record(String session, RecordEvent message) { + Jedis jedis = redisPool.getResource(); + try { + Long msgid = jedis.incr("global:nextRecordedMsgId"); + jedis.hmset("recording" + COLON + session + COLON + msgid, message.toMap()); + jedis.rpush("meeting" + COLON + session + COLON + "recordings", msgid.toString()); + } finally { + redisPool.returnResource(jedis); + } + } + + public JedisPool getRedisPool() { + return redisPool; + } + + public void setRedisPool(JedisPool redisPool) { + this.redisPool = redisPool; + } + + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java new file mode 100755 index 0000000000..f07a52713c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.chat; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractChatRecordEvent extends RecordEvent { + + public AbstractChatRecordEvent() { + setModule("CHAT"); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java new file mode 100755 index 0000000000..d3db884a58 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java @@ -0,0 +1,43 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.chat; + + +public class PublicChatRecordEvent extends AbstractChatRecordEvent { + private static final String SENDER = "sender"; + private static final String MESSAGE = "message"; + private static final String COLOR = "color"; + + public PublicChatRecordEvent() { + super(); + setEvent("PublicChatEvent"); + } + + public void setSender(String sender) { + eventMap.put(SENDER, sender); + } + + public void setMessage(String message) { + eventMap.put(MESSAGE, message); + } + + public void setColor(String color) { + eventMap.put(COLOR, color); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java new file mode 100755 index 0000000000..48c735b0a4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractParticipantRecordEvent extends RecordEvent { + + public AbstractParticipantRecordEvent() { + setModule("PARTICIPANT"); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java new file mode 100755 index 0000000000..f23c441914 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java @@ -0,0 +1,39 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent { + + public AssignPresenterRecordEvent() { + super(); + setEvent("AssignPresenterEvent"); + } + + public void setUserId(String userid) { + eventMap.put("userid", userid); + } + + public void setName(String name) { + eventMap.put("name", name); + } + + public void setAssignedBy(String by) { + eventMap.put("assignedBy", by); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java new file mode 100755 index 0000000000..46de9dd422 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantEndAndKickAllRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantEndAndKickAllRecordEvent() { + super(); + setEvent("EndAndKickAllEvent"); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java new file mode 100755 index 0000000000..fe22c8c7d2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java @@ -0,0 +1,47 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantJoinRecordEvent() { + super(); + setEvent("ParticipantJoinEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + + public void setName(String name){ + eventMap.put("name",name); + } + + /** + * Sets the role of the user as MODERATOR or VIEWER + * @param role + */ + public void setRole(String role) { + eventMap.put("role", role); + } + + public void setStatus(String status) { + eventMap.put("status", status); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java new file mode 100755 index 0000000000..90812dd22d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantLeftRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantLeftRecordEvent() { + super(); + setEvent("ParticipantLeftEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java new file mode 100755 index 0000000000..e8c6e9048b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java @@ -0,0 +1,39 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class ParticipantStatusChangeRecordEvent extends AbstractParticipantRecordEvent { + + public ParticipantStatusChangeRecordEvent() { + super(); + setEvent("ParticipantStatusChangeEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + + public void setStatus(String status) { + eventMap.put("status", status); + } + + public void setValue(String value) { + eventMap.put("value", value); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java new file mode 100644 index 0000000000..a00e60fafc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.participants; + +public class RecordStatusRecordEvent extends AbstractParticipantRecordEvent { + + public RecordStatusRecordEvent() { + super(); + setEvent("RecordStatusEvent"); + } + + public void setUserId(String userId) { + eventMap.put("userId", userId); + } + + public void setRecordingStatus(String status) { + eventMap.put("status", status); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java new file mode 100755 index 0000000000..fc26c2243e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractPresentationRecordEvent extends RecordEvent { + + public AbstractPresentationRecordEvent() { + setModule("PRESENTATION"); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java new file mode 100755 index 0000000000..a134d7e4c1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class ConversionCompletedPresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public ConversionCompletedPresentationRecordEvent() { + super(); + setEvent("ConversionCompletedEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + + public void setOriginalFilename(String name) { + eventMap.put("originalFilename", name); + } + + public void setSlidesInfo(String slidesInfo) { + eventMap.put("slidesInfo", slidesInfo); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java new file mode 100755 index 0000000000..9964bbf617 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java @@ -0,0 +1,36 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class CursorUpdateRecordEvent extends AbstractPresentationRecordEvent{ + + public CursorUpdateRecordEvent() { + super(); + setEvent("CursorMoveEvent"); + } + + public void setXPercent(double percent) { + eventMap.put("xOffset", Double.toString(percent)); + } + + public void setYPercent(double percent) { + eventMap.put("yOffset", Double.toString(percent)); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java new file mode 100755 index 0000000000..171fdb9a09 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class GenerateSlidePresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public GenerateSlidePresentationRecordEvent() { + super(); + setEvent("GenerateSlideEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + + public void setNumberOfPages(int numPages) { + eventMap.put("numberOfPages", Integer.toString(numPages)); + } + + public void setPagesCompleted(int pagesCompleted) { + eventMap.put("pagesCompleted", Integer.toString(pagesCompleted)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java new file mode 100644 index 0000000000..a58f2d3b1a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java @@ -0,0 +1,81 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class GotoSlidePresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public GotoSlidePresentationRecordEvent() { + super(); + setEvent("GotoSlideEvent"); + } + + public void setSlide(int slide) { + /** + * Subtract 1 from the page number to be zero-based to be + * compatible with 0.81 and earlier. (ralam Sept 2, 2014) + */ + eventMap.put("slide", Integer.toString(slide - 1)); + } + + public void setId(String id) { + eventMap.put("id", id); + } + + public void setNum(int num) { + + eventMap.put("num", Integer.toString(num)); + } + + public void setCurrent(boolean current) { + eventMap.put("current", Boolean.toString(current)); + } + + public void setThumbUri(String thumbUri) { + eventMap.put("thumbUri", thumbUri); + } + + public void setSwfUri(String swfUri) { + eventMap.put("swfUri", swfUri); + } + + public void setTxtUri(String txtUri) { + eventMap.put("txtUri", txtUri); + } + + public void setPngUri(String pngUri) { + eventMap.put("pngUri", pngUri); + } + + public void setXOffset(double offset) { + eventMap.put("xOffset", Double.toString(offset)); + } + + public void setYOffset(double offset) { + eventMap.put("yOffset", Double.toString(offset)); + } + + public void setWidthRatio(double ratio) { + eventMap.put("widthRatio", Double.toString(ratio)); + } + + public void setHeightRatio(double ratio) { + eventMap.put("heightRatio", Double.toString(ratio)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java new file mode 100755 index 0000000000..01d371cc7d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class RemovePresentationPresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public RemovePresentationPresentationRecordEvent() { + super(); + setEvent("RemovePresentationEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java new file mode 100644 index 0000000000..bf55a97ce2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java @@ -0,0 +1,72 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class ResizeAndMoveSlidePresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public ResizeAndMoveSlidePresentationRecordEvent() { + super(); + setEvent("ResizeAndMoveSlideEvent"); + } + + public void setId(String id) { + eventMap.put("id", id); + } + + public void setNum(int num) { + eventMap.put("num", Integer.toString(num)); + } + + public void setCurrent(boolean current) { + eventMap.put("current", Boolean.toString(current)); + } + + public void setThumbUri(String thumbUri) { + eventMap.put("thumbUri", thumbUri); + } + + public void setSwfUri(String swfUri) { + eventMap.put("swfUri", swfUri); + } + + public void setTxtUri(String txtUri) { + eventMap.put("txtUri", txtUri); + } + + public void setPngUri(String pngUri) { + eventMap.put("pngUri", pngUri); + } + + public void setXOffset(double offset) { + eventMap.put("xOffset", Double.toString(offset)); + } + + public void setYOffset(double offset) { + eventMap.put("yOffset", Double.toString(offset)); + } + + public void setWidthRatio(double ratio) { + eventMap.put("widthRatio", Double.toString(ratio)); + } + + public void setHeightRatio(double ratio) { + eventMap.put("heightRatio", Double.toString(ratio)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java new file mode 100755 index 0000000000..0efd6273fc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.recorder.presentation; + +public class SharePresentationPresentationRecordEvent extends + AbstractPresentationRecordEvent { + + public SharePresentationPresentationRecordEvent() { + super(); + setEvent("SharePresentationEvent"); + } + + public void setPresentationName(String name) { + eventMap.put("presentationName", name); + } + + public void setOriginalFilename(String name) { + eventMap.put("originalFilename", name); + } + + public void setShare(boolean share) { + eventMap.put("share", Boolean.toString(share)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java new file mode 100644 index 0000000000..9bc1fd75bc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.conference.service.voice; + +public class VoiceKeyUtil { + public static final String MUTE = "mute"; + public static final String USERID = "userId"; +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java new file mode 100755 index 0000000000..293ebf0677 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java @@ -0,0 +1,49 @@ +package org.bigbluebutton.conference.service.voice; + +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class VoiceMessageListener implements MessageHandler { + + private IBigBlueButtonInGW bbbGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_VOICE_CHANNEL)) { + + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + JsonObject headerObject = (JsonObject) obj.get("header"); + JsonObject payloadObject = (JsonObject) obj.get("payload"); + + String eventName = headerObject.get("name").toString().replace("\"", ""); + + if (eventName.equalsIgnoreCase(MessagingConstants.MUTE_USER_REQUEST)){ + + String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); + String requesterID = payloadObject.get("requester_id").toString().replace("\"", ""); + String userID = payloadObject.get("userid").toString().replace("\"", ""); + String muteString = payloadObject.get(VoiceKeyUtil.MUTE).toString().replace("\"", ""); + Boolean mute = Boolean.valueOf(muteString); + + System.out.println("handling mute_user_request"); + bbbGW.muteUser(meetingID, requesterID, userID, mute); + } + else if (eventName.equalsIgnoreCase(MessagingConstants.USER_LEFT_VOICE_REQUEST)){ + + String meetingID = payloadObject.get("meeting_id").toString().replace("\"", ""); + String userID = payloadObject.get("userid").toString().replace("\"", ""); + + System.out.println("handling user_left_voice_request"); + bbbGW.voiceUserLeft(meetingID, userID); + } + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java new file mode 100755 index 0000000000..7d635ba285 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java @@ -0,0 +1,16 @@ +package org.bigbluebutton.conference.service.whiteboard; + +public class WhiteboardKeyUtil { + + public static final String TEXT_TYPE = "text"; + public static final String PENCIL_TYPE = "pencil"; + public static final String RECTANGLE_TYPE = "rectangle"; + public static final String ELLIPSE_TYPE = "ellipse"; + public static final String TRIANGLE_TYPE = "triangle"; + public static final String LINE_TYPE = "line"; + + public static final String TEXT_CREATED_STATUS = "textCreated"; + public static final String DRAW_START_STATUS = "DRAW_START"; + public static final String DRAW_END_STATUS = "DRAW_END"; + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java new file mode 100755 index 0000000000..56733e28d2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java @@ -0,0 +1,67 @@ + +package org.bigbluebutton.conference.service.whiteboard; + + +import org.bigbluebutton.common.messages.ClearWhiteboardRequestMessage; +import org.bigbluebutton.common.messages.EnableWhiteboardRequestMessage; +import org.bigbluebutton.common.messages.IsWhiteboardEnabledRequestMessage; +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.common.messages.RequestWhiteboardAnnotationHistoryRequestMessage; +import org.bigbluebutton.common.messages.SendWhiteboardAnnotationRequestMessage; +import org.bigbluebutton.common.messages.UndoWhiteboardRequest; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; + +import com.google.gson.JsonParser; +import com.google.gson.JsonObject; + +public class WhiteboardListener implements MessageHandler { + + private IBigBlueButtonInGW bbbInGW; + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) { + this.bbbInGW = bbbInGW; + } + + @Override + public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(MessagingConstants.TO_WHITEBOARD_CHANNEL)) { + + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (UndoWhiteboardRequest.UNDO_WHITEBOARD_REQUEST.equals(messageName)) { + System.out.println("inListener:UNDO_WHITEBOARD_REQUEST"); + UndoWhiteboardRequest msg = UndoWhiteboardRequest.fromJson(message); + bbbInGW.undoWhiteboard(msg.meetingId, msg.requesterId, msg.whiteboardId); + } else if (ClearWhiteboardRequestMessage.CLEAR_WHITEBOARD_REQUEST.equals(messageName)) { + System.out.println("inListener:CLEAR_WHITEBOARD_REQUEST"); + ClearWhiteboardRequestMessage msg = ClearWhiteboardRequestMessage.fromJson(message); + bbbInGW.clearWhiteboard(msg.meetingId, msg.requesterId, msg.whiteboardId); + } else if (RequestWhiteboardAnnotationHistoryRequestMessage.REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST.equals(messageName)) { + System.out.println("inListener:REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST"); + RequestWhiteboardAnnotationHistoryRequestMessage msg = RequestWhiteboardAnnotationHistoryRequestMessage.fromJson(message); + bbbInGW.requestWhiteboardAnnotationHistory(msg.meetingId, msg.requesterId, msg.whiteboardId, msg.replyTo); + } else if (IsWhiteboardEnabledRequestMessage.IS_WHITEBOARD_ENABLED_REQUEST.equals(messageName)) { + System.out.println("inListener: IS_WHITEBOARD_ENABLED_REQUEST"); + IsWhiteboardEnabledRequestMessage msg = IsWhiteboardEnabledRequestMessage.fromJson(message); + bbbInGW.isWhiteboardEnabled(msg.meetingId, msg.requesterId, msg.replyTo); + } else if (EnableWhiteboardRequestMessage.ENABLE_WHITEBOARD_REQUEST.equals(messageName)) { + System.out.println("inListener: ENABLE_WHITEBOARD_REQUEST"); + EnableWhiteboardRequestMessage msg = EnableWhiteboardRequestMessage.fromJson(message); + bbbInGW.enableWhiteboard(msg.meetingId, msg.requesterId, msg.enable); + } else if (SendWhiteboardAnnotationRequestMessage.SEND_WHITEBOARD_ANNOTATION_REQUEST.equals(messageName)) { + System.out.println("inListener: SEND_WHITEBOARD_ANNOTATION_REQUEST"); + SendWhiteboardAnnotationRequestMessage msg = SendWhiteboardAnnotationRequestMessage.fromJson(message); + bbbInGW.sendWhiteboardAnnotation(msg.meetingId, msg.requesterId, msg.annotation); + } + } + } + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java new file mode 100644 index 0000000000..aed2b1c94b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java @@ -0,0 +1,46 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractWhiteboardRecordEvent extends RecordEvent { + + public AbstractWhiteboardRecordEvent() { + setModule("WHITEBOARD"); + } + + public void setPresentation(String name) { + eventMap.put("presentation", name); + } + + public void setPageNumber(String page) { + /** + * Subtract 1 from the page number to be zero-based to be + * compatible with 0.81 and earlier. (ralam Sept 2, 2014) + */ + Integer num = new Integer(page); +// System.out.println("WB Page Number real pagenum=[" + num + "] rec pagenum=[" + (num - 1) + "]"); + eventMap.put("pageNumber", new Integer(num - 1).toString()); + } + + public void setWhiteboardId(String id) { + eventMap.put("whiteboardId", id); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java new file mode 100755 index 0000000000..fa667798c6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java @@ -0,0 +1,69 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import java.util.ArrayList; +import java.util.Map; + +public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { + + public AddShapeWhiteboardRecordEvent() { + super(); + setEvent("AddShapeEvent"); + } + + public void addAnnotation(Map annotation) { + for (Map.Entry entry : annotation.entrySet()) { + String key = entry.getKey(); + + if (key.equals("points")) { + eventMap.put("dataPoints", pointsToString((ArrayList)entry.getValue())); + } else { + Object value = entry.getValue(); + eventMap.put(key, value.toString()); + } + } + } + + private String pointsToString(ArrayList points){ + String datapoints = ""; + for (int i = 0; i < points.size(); i++) { + datapoints += (points.get(i)).toString() + ","; + } + // Trim the trailing comma + return datapoints.substring(0, datapoints.length() - 1); + } + + public void setFillColor(int fillColor) { + eventMap.put("fillColor", Integer.toString(fillColor)); + } + + public void setThickness(int thickness) { + eventMap.put("thickness", Integer.toString(thickness)); + } + + public void setFill(boolean fill) { + eventMap.put("fill", Boolean.toString(fill)); + } + + public void setTransparent(boolean transparent) { + eventMap.put("transparent", Boolean.toString(transparent)); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java new file mode 100755 index 0000000000..fc3c0b4fcf --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java @@ -0,0 +1,54 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import java.util.ArrayList; +import java.util.Map; + +public class AddTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { + + public AddTextWhiteboardRecordEvent() { + super(); + setEvent("AddTextEvent"); + } + + public void addAnnotation(Map annotation) { + for (Map.Entry entry : annotation.entrySet()) { + String key = entry.getKey(); + + if (key.equals("points")) { + ArrayList value = (ArrayList)entry.getValue(); + eventMap.put("dataPoints", pointsToString(value)); + } else { + Object value = entry.getValue(); + eventMap.put(key, value.toString()); + } + } + } + + private String pointsToString(ArrayList points){ + String datapoints = ""; + for (Double i : points) { + datapoints += i + ","; + } + // Trim the trailing comma + return datapoints.substring(0, datapoints.length() - 1); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java new file mode 100755 index 0000000000..583d374470 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +public class ClearPageWhiteboardRecordEvent extends + AbstractWhiteboardRecordEvent { + + public ClearPageWhiteboardRecordEvent() { + super(); + setEvent("ClearPageEvent"); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java new file mode 100755 index 0000000000..ca6f398f3b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java @@ -0,0 +1,53 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +import java.util.ArrayList; +import java.util.Map; + +public class ModifyTextWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { + + public ModifyTextWhiteboardRecordEvent() { + super(); + setEvent("ModifyTextEvent"); + } + + public void addAnnotation(Map annotation) { + for (Map.Entry entry : annotation.entrySet()) { + String key = entry.getKey(); + + if (key.equals("points")) { + ArrayList value = (ArrayList)entry.getValue(); + eventMap.put("dataPoints", pointsToString(value)); + } else { + Object value = entry.getValue(); + eventMap.put(key, value.toString()); + } + } + } + + private String pointsToString(ArrayList points){ + String datapoints = ""; + for (Double i : points) { + datapoints += i + ","; + } + // Trim the trailing comma + return datapoints.substring(0, datapoints.length() - 1); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java new file mode 100755 index 0000000000..1b68d43f7a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +public class ToggleGridWhiteboardRecordEvent extends + AbstractWhiteboardRecordEvent { + + public ToggleGridWhiteboardRecordEvent() { + super(); + setEvent("ToggleGridEvent"); + } + + public void setGridEnabled(boolean enabled) { + eventMap.put("gridEnabled", Boolean.toString(enabled)); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java new file mode 100755 index 0000000000..0d9cbd4ef6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.conference.service.whiteboard.redis; + +public class UndoShapeWhiteboardRecordEvent extends + AbstractWhiteboardRecordEvent { + + public UndoShapeWhiteboardRecordEvent() { + super(); + setEvent("UndoShapeEvent"); + } + + public void setShapeId(String id) { + eventMap.put("shapeId", id); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java new file mode 100755 index 0000000000..87c17e28c1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -0,0 +1,109 @@ +package org.bigbluebutton.core.api; + +import java.util.Map; + + +public interface IBigBlueButtonInGW { + + void isAliveAudit(String aliveID); + void statusMeetingAudit(String meetingID); + void endMeeting(String meetingID); + void endAllMeetings(); + void createMeeting2(String meetingID, String externalMeetingID, String meetingName, boolean recorded, + String voiceBridge, long duration, boolean autoStartRecording, + boolean allowStartStopRecording, String moderatorPass, String viewerPass, + long createTime, String createDate); + void destroyMeeting(String meetingID); + void getAllMeetings(String meetingID); + void lockSettings(String meetingID, Boolean locked, Map lockSettigs); + + + // Lock + void initLockSettings(String meetingID, Map settings); + void sendLockSettings(String meetingID, String userId, Map settings); + void getLockSettings(String meetingId, String userId); + void lockUser(String meetingId, String requesterID, boolean lock, String internalUserID); + + + // Users + void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId); + void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken); + void userRaiseHand(String meetingId, String userId); + void lowerHand(String meetingId, String userId, String loweredBy); + void shareWebcam(String meetingId, String userId, String stream); + void unshareWebcam(String meetingId, String userId, String stream); + void setUserStatus(String meetingID, String userID, String status, Object value); + void getUsers(String meetingID, String requesterID); + void userLeft(String meetingID, String userID, String sessionId); + void userJoin(String meetingID, String userID, String authToken); + void getCurrentPresenter(String meetingID, String requesterID); + void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy); + void setRecordingStatus(String meetingId, String userId, Boolean recording); + void getRecordingStatus(String meetingId, String userId); + void userConnectedToGlobalAudio(String voiceConf, String userid, String name); + void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name); + + // Voice + void initAudioSettings(String meetingID, String requesterID, Boolean muted); + void muteAllExceptPresenter(String meetingID, String requesterID, Boolean mute); + void muteAllUsers(String meetingID, String requesterID, Boolean mute); + void isMeetingMuted(String meetingID, String requesterID); + void muteUser(String meetingID, String requesterID, String userID, Boolean mute); + void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock); + void ejectUserFromVoice(String meetingID, String userId, String ejectedBy); + void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy); + void voiceUserJoined(String meetingId, String userId, String webUserId, String conference, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking); + void voiceUserLeft(String meetingId, String userId); + void voiceUserLocked(String meetingId, String userId, Boolean locked); + void voiceUserMuted(String meetingId, String userId, Boolean muted); + void voiceUserTalking(String meetingId, String userId, Boolean talking); + void voiceRecording(String meetingId, String recordingFile, + String timestamp, Boolean recording); + + // Presentation + void clear(String meetingID); + void removePresentation(String meetingID, String presentationID); + void getPresentationInfo(String meetingID, String requesterID, String replyTo); + void sendCursorUpdate(String meetingID, double xPercent, double yPercent); + void resizeAndMoveSlide(String meetingID, double xOffset, double yOffset, double widthRatio, double heightRatio); + void gotoSlide(String meetingID, String page); + void sharePresentation(String meetingID, String presentationID, boolean share); + void getSlideInfo(String meetingID, String requesterID, String replyTo); + + void sendConversionUpdate(String messageKey, String meetingId, + String code, String presId, String presName); + + void sendPageCountError(String messageKey, String meetingId, + String code, String presId, int numberOfPages, + int maxNumberPages, String presName); + + void sendSlideGenerated(String messageKey, String meetingId, + String code, String presId, int numberOfPages, + int pagesCompleted, String presName); + + void sendConversionCompleted(String messageKey, String meetingId, + String code, String presId, int numPages, String presName, String presBaseUrl); + + // Layout + void getCurrentLayout(String meetingID, String requesterID); + void broadcastLayout(String meetingID, String requesterID, String layout); + void lockLayout(String meetingID, String setById, + boolean lock, boolean viewersOnly, + String layout); + + // Chat + void getChatHistory(String meetingID, String requesterID, String replyTo); + void sendPublicMessage(String meetingID, String requesterID, Map message); + void sendPrivateMessage(String meetingID, String requesterID, Map message); + + // Whiteboard + void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map annotation); + void requestWhiteboardAnnotationHistory(String meetingID, String requesterID, String whiteboardId, String replyTo); + void clearWhiteboard(String meetingID, String requesterID, String whiteboardId); + void undoWhiteboard(String meetingID, String requesterID, String whiteboardId); + void enableWhiteboard(String meetingID, String requesterID, Boolean enable); + void isWhiteboardEnabled(String meetingID, String requesterID, String replyTo); + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java new file mode 100755 index 0000000000..fa1b97c3c6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IDispatcher.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.core.api; + +public interface IDispatcher { + + void dispatch(String jsonMessage); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java new file mode 100755 index 0000000000..94939235e2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IOutMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.api; + +public interface IOutMessage { + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java new file mode 100755 index 0000000000..ca8617bf72 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java @@ -0,0 +1,18 @@ +package org.bigbluebutton.core.api; + +import java.util.Set; + +public class MessageOutGateway { + + private Set listeners; + + public void send(IOutMessage msg) { + for (OutMessageListener2 l : listeners) { + l.handleMessage(msg); + } + } + + public void setListeners(Set listeners) { + this.listeners = listeners; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java new file mode 100755 index 0000000000..ec6d099a45 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java @@ -0,0 +1,6 @@ +package org.bigbluebutton.core.api; + +public interface OutMessageListener2 { + + void handleMessage(IOutMessage msg); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java new file mode 100755 index 0000000000..68ed47975d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/RedisLpushDispatcher.java @@ -0,0 +1,66 @@ +package org.bigbluebutton.core.api; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class RedisLpushDispatcher implements IDispatcher { + private static final int NTHREADS = 1; + private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); + + private static final String BBBMESSAGES = "bbb:meeting:messages"; + + private BlockingQueue messages; + private volatile boolean dispatchEvents = false; + + private JedisPool redisPool; + + public RedisLpushDispatcher() { + messages = new LinkedBlockingQueue(); + } + + @Override + public void dispatch(String jsonMessage) { + messages.offer(jsonMessage); + } + + private void saveMessage(String msg) { + Jedis jedis = redisPool.getResource(); + try { + jedis.lpush(BBBMESSAGES, msg); + } finally { + redisPool.returnResource(jedis); + } + } + + public void start() { + dispatchEvents = true; + Runnable sender = new Runnable() { + public void run() { + while (dispatchEvents) { + String message; + try { + message = messages.take(); + saveMessage(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + exec.execute(sender); + } + + public void stop() { + dispatchEvents = false; + } + + public void setRedisPool(JedisPool redisPool) { + this.redisPool = redisPool; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/GenericObjectPoolConfigWrapper.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/GenericObjectPoolConfigWrapper.java new file mode 100755 index 0000000000..a5fc454500 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/GenericObjectPoolConfigWrapper.java @@ -0,0 +1,142 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.core.pubsub.redis; + +import org.apache.commons.pool.impl.GenericObjectPool; + +public class GenericObjectPoolConfigWrapper { + + private final GenericObjectPool.Config config; + + public GenericObjectPoolConfigWrapper() { + this.config = new GenericObjectPool.Config(); + } + + public GenericObjectPool.Config getConfig() { + return config; + } + + public int getMaxIdle() { + return this.config.maxIdle; + } + + public void setMaxIdle(int maxIdle) { + this.config.maxIdle = maxIdle; + } + + public int getMinIdle() { + return this.config.minIdle; + } + + public void setMinIdle(int minIdle) { + this.config.minIdle = minIdle; + } + + public int getMaxActive() { + return this.config.maxActive; + } + + public void setMaxActive(int maxActive) { + this.config.maxActive = maxActive; + } + + public long getMaxWait() { + return this.config.maxWait; + } + + public void setMaxWait(long maxWait) { + this.config.maxWait = maxWait; + } + + public byte getWhenExhaustedAction() { + return this.config.whenExhaustedAction; + } + + public void setWhenExhaustedAction(byte whenExhaustedAction) { + this.config.whenExhaustedAction = whenExhaustedAction; + } + + public boolean isTestOnBorrow() { + return this.config.testOnBorrow; + } + + public void setTestOnBorrow(boolean testOnBorrow) { + this.config.testOnBorrow = testOnBorrow; + } + + public boolean isTestOnReturn() { + return this.config.testOnReturn; + } + + public void setTestOnReturn(boolean testOnReturn) { + this.config.testOnReturn = testOnReturn; + } + + public boolean isTestWhileIdle() { + return this.config.testWhileIdle; + } + + public void setTestWhileIdle(boolean testWhileIdle) { + this.config.testWhileIdle = testWhileIdle; + } + + public long getTimeBetweenEvictionRunsMillis() { + return this.config.timeBetweenEvictionRunsMillis; + } + + public void setTimeBetweenEvictionRunsMillis( + long timeBetweenEvictionRunsMillis) { + this.config.timeBetweenEvictionRunsMillis = + timeBetweenEvictionRunsMillis; + } + + public int getNumTestsPerEvictionRun() { + return this.config.numTestsPerEvictionRun; + } + + public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { + this.config.numTestsPerEvictionRun = numTestsPerEvictionRun; + } + + public long getMinEvictableIdleTimeMillis() { + return this.config.minEvictableIdleTimeMillis; + } + + public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { + this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public long getSoftMinEvictableIdleTimeMillis() { + return this.config.softMinEvictableIdleTimeMillis; + } + + public void setSoftMinEvictableIdleTimeMillis( + long softMinEvictableIdleTimeMillis) { + this.config.softMinEvictableIdleTimeMillis = + softMinEvictableIdleTimeMillis; + } + + public boolean isLifo() { + return this.config.lifo; + } + + public void setLifo(boolean lifo) { + this.config.lifo = lifo; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java new file mode 100755 index 0000000000..24f3fc9cf9 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java @@ -0,0 +1,25 @@ +package org.bigbluebutton.core.pubsub.redis; + +import java.util.Set; + +public class MessageDistributor { + private ReceivedMessageHandler handler; + private Set listeners; + + public void setMessageListeners(Set listeners) { + this.listeners = listeners; + } + + public void setMessageHandler(ReceivedMessageHandler handler) { + this.handler = handler; + if (handler != null) { + handler.setMessageDistributor(this); + } + } + + public void notifyListeners(String pattern, String channel, String message) { + for (MessageHandler listener : listeners) { + listener.handleMessage(pattern, channel, message); + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java new file mode 100755 index 0000000000..c35931287e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java @@ -0,0 +1,23 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.core.pubsub.redis; + +public interface MessageHandler { + void handleMessage(String pattern, String channel, String message); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageReceiver.java new file mode 100755 index 0000000000..08c5d6f5b1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageReceiver.java @@ -0,0 +1,87 @@ +package org.bigbluebutton.core.pubsub.redis; + +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import org.bigbluebutton.common.messages.MessagingConstants; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.jedis.JedisPubSub; + +public class MessageReceiver { + + private ReceivedMessageHandler handler; + + private JedisPool redisPool; + private volatile boolean receiveMessage = false; + + private final Executor msgReceiverExec = Executors.newSingleThreadExecutor(); + + public void stop() { + receiveMessage = false; + } + + public void start() { + System.out.println("Ready to receive messages from Redis pubsub."); + try { + receiveMessage = true; + final Jedis jedis = redisPool.getResource(); + + Runnable messageReceiver = new Runnable() { + public void run() { + if (receiveMessage) { + jedis.psubscribe(new PubSubListener(), + MessagingConstants.FROM_BBB_APPS_PATTERN); + } + } + }; + msgReceiverExec.execute(messageReceiver); + } catch (Exception e) { + System.out.println("Error subscribing to channels: " + e.getMessage()); + } + } + + public void setRedisPool(JedisPool redisPool){ + this.redisPool = redisPool; + } + + public void setMessageHandler(ReceivedMessageHandler handler) { + this.handler = handler; + } + + private class PubSubListener extends JedisPubSub { + + public PubSubListener() { + super(); + } + + @Override + public void onMessage(String channel, String message) { + // Not used. + } + + @Override + public void onPMessage(String pattern, String channel, String message) { + handler.handleMessage(pattern, channel, message); + } + + @Override + public void onPSubscribe(String pattern, int subscribedChannels) { + System.out.println("Subscribed to the pattern: " + pattern); + } + + @Override + public void onPUnsubscribe(String pattern, int subscribedChannels) { + // Not used. + } + + @Override + public void onSubscribe(String channel, int subscribedChannels) { + // Not used. + } + + @Override + public void onUnsubscribe(String channel, int subscribedChannels) { + // Not used. + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageSender.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageSender.java new file mode 100755 index 0000000000..17ee299ca3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageSender.java @@ -0,0 +1,71 @@ +package org.bigbluebutton.core.pubsub.redis; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class MessageSender { + + private JedisPool redisPool; + private volatile boolean sendMessage = false; + + private final Executor msgSenderExec = Executors.newSingleThreadExecutor(); + private final Executor runExec = Executors.newSingleThreadExecutor(); + private BlockingQueue messages = new LinkedBlockingQueue(); + + public void stop() { + sendMessage = false; + } + + public void start() { + System.out.println("Redis message publisher starting!"); + try { + sendMessage = true; + + Runnable messageSender = new Runnable() { + public void run() { + while (sendMessage) { + try { + MessageToSend msg = messages.take(); + publish(msg.getChannel(), msg.getMessage()); + } catch (InterruptedException e) { + System.out.println("Failed to get message from queue."); + } + } + } + }; + msgSenderExec.execute(messageSender); + } catch (Exception e) { + System.out.println("Error subscribing to channels: " + e.getMessage()); + } + } + + public void send(String channel, String message) { + MessageToSend msg = new MessageToSend(channel, message); + messages.add(msg); + } + + private void publish(final String channel, final String message) { + Runnable task = new Runnable() { + public void run() { + Jedis jedis = redisPool.getResource(); + try { + jedis.publish(channel, message); + } catch(Exception e){ + System.out.println("Cannot publish the message to redis " + e); + } finally { + redisPool.returnResource(jedis); + } + } + }; + + runExec.execute(task); + } + + public void setRedisPool(JedisPool redisPool){ + this.redisPool = redisPool; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageToSend.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageToSend.java new file mode 100755 index 0000000000..b68d029f54 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageToSend.java @@ -0,0 +1,19 @@ +package org.bigbluebutton.core.pubsub.redis; + +public class MessageToSend { + private final String channel; + private final String message; + + public MessageToSend(String channel, String message) { + this.channel = channel; + this.message = message; + } + + public String getChannel() { + return channel; + } + + public String getMessage() { + return message; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessage.java new file mode 100755 index 0000000000..623d4db822 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessage.java @@ -0,0 +1,28 @@ +package org.bigbluebutton.core.pubsub.redis; + +public class ReceivedMessage { + + private final String pattern; + private final String channel; + private final String message; + + public ReceivedMessage(String pattern, String channel, String message) { + this.pattern = pattern; + this.channel = channel; + this.message = message; + } + + public String getPattern() { + return pattern; + } + + public String getChannel() { + return channel; + } + + public String getMessage() { + return message; + } + + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessageHandler.java new file mode 100755 index 0000000000..eb3e69372d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/ReceivedMessageHandler.java @@ -0,0 +1,65 @@ +package org.bigbluebutton.core.pubsub.redis; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; + +public class ReceivedMessageHandler { + private BlockingQueue receivedMessages = new LinkedBlockingQueue(); + + private volatile boolean processMessage = false; + + private final Executor msgProcessorExec = Executors.newSingleThreadExecutor(); + private final Executor runExec = Executors.newSingleThreadExecutor(); + + private MessageDistributor handler; + + public void stop() { + processMessage = false; + } + + public void start() { + try { + processMessage = true; + + Runnable messageProcessor = new Runnable() { + public void run() { + while (processMessage) { + try { + ReceivedMessage msg = receivedMessages.take(); + processMessage(msg); + } catch (InterruptedException e) { + System.out.println("Error while taking received message from queue."); + } + } + } + }; + msgProcessorExec.execute(messageProcessor); + } catch (Exception e) { + System.out.println("Error subscribing to channels: " + e.getMessage()); + } + } + + private void processMessage(final ReceivedMessage msg) { + Runnable task = new Runnable() { + public void run() { + if (handler != null) { + handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage()); + } else { + System.out.println("No listeners interested in messages from Redis!"); + } + } + }; + runExec.execute(task); + } + + public void handleMessage(String pattern, String channel, String message) { + ReceivedMessage rm = new ReceivedMessage(pattern, channel, message); + receivedMessages.add(rm); + } + + public void setMessageDistributor(MessageDistributor h) { + this.handler = h; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java new file mode 100755 index 0000000000..e8bf93bee4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RecordMessage.java @@ -0,0 +1,5 @@ +package org.bigbluebutton.service.recording; + +public class RecordMessage { + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java new file mode 100755 index 0000000000..80ca642a18 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java @@ -0,0 +1,73 @@ +package org.bigbluebutton.service.recording; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import org.bigbluebutton.conference.service.recorder.RecordEvent; +import com.google.gson.Gson; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; + +public class RedisListRecorder { + + private static final int NTHREADS = 1; + private static final Executor exec = Executors.newFixedThreadPool(NTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(NTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + private volatile boolean recordEvents = false; + + JedisPool redisPool; + + public void start() { + recordEvents = true; + Runnable sender = new Runnable() { + public void run() { + while (recordEvents) { + RecordEvent message; + try { + message = messages.take(); + recordEvent(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + exec.execute(sender); + } + + public void stop() { + recordEvents = false; + } + + private void recordEvent(final RecordEvent message) { + Runnable task = new Runnable() { + public void run() { + Jedis jedis = redisPool.getResource(); + try { + String key = "bbb:recording:" + message.getMeetingID(); + Gson gson= new Gson(); + jedis.rpush(key, gson.toJson(message.toMap())); + } finally { + redisPool.returnResource(jedis); + } + } + }; + runExec.execute(task); + } + + public void record(RecordEvent message) { + messages.offer(message); + } + + public JedisPool getRedisPool() { + return redisPool; + } + + public void setRedisPool(JedisPool redisPool) { + this.redisPool = redisPool; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java new file mode 100755 index 0000000000..9f03321ce0 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import org.bigbluebutton.conference.service.recorder.RecordEvent; + +public abstract class AbstractVoiceRecordEvent extends RecordEvent { + + public AbstractVoiceRecordEvent() { + setModule("VOICE"); + } + + public void setBridge(String bridge) { + eventMap.put("bridge", bridge); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java new file mode 100755 index 0000000000..1e4616ef56 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java @@ -0,0 +1,26 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public interface ConferenceServerListener { + public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); + public void left(String room, Integer participant); + public void muted(String room, Integer participant, Boolean muted); + public void talking(String room, Integer participant, Boolean talking); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java new file mode 100755 index 0000000000..ffebb366ee --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public interface ConferenceServiceProvider { + public void populateRoom(String room); + public void mute(String room, String participant, Boolean mute); + public void eject(String room, String participant); + public void ejectAll(String room); + public void record(String room, String meetingid); + public void broadcast(String room, String meetingid); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java new file mode 100644 index 0000000000..f24a4de2e5 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java @@ -0,0 +1,115 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +public class FreeswitchConferenceEventListener implements ConferenceEventListener { + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + + private volatile boolean sendMessages = false; + private IVoiceConferenceService vcs; + + public void setVoiceConferenceService(IVoiceConferenceService vcs) { + this.vcs = vcs; + } + + private void queueMessage(VoiceConferenceEvent event) { + try { + messages.offer(event, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { + Runnable task = new Runnable() { + public void run() { + if (event instanceof VoiceUserJoinedEvent) { + System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); + VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; + vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), + evt.getCallerIdNum(), evt.getCallerIdName(), + evt.getMuted(), evt.getSpeaking()); + } else if (event instanceof VoiceUserLeftEvent) { + System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); + VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; + vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); + } else if (event instanceof VoiceUserMutedEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); + VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; + vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); + } else if (event instanceof VoiceUserTalkingEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); + VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; + vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); + } else if (event instanceof VoiceStartRecordingEvent) { + VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; + System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); + vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + VoiceConferenceEvent message; + try { + message = messages.take(); + sendMessageToBigBlueButton(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } + + public void handleConferenceEvent(VoiceConferenceEvent event) { + queueMessage(event); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java new file mode 100755 index 0000000000..f26f38b458 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java @@ -0,0 +1,13 @@ +package org.bigbluebutton.webconference.voice; + +public interface IVoiceConferenceService { + void voiceUserJoined(String userId, String webUserId, String conference, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking); + void voiceUserLeft(String meetingId, String userId); + void voiceUserLocked(String meetingId, String userId, Boolean locked); + void voiceUserMuted(String meetingId, String userId, Boolean muted); + void voiceUserTalking(String meetingId, String userId, Boolean talking); + void voiceStartedRecording(String conference, String recordingFile, + String timestamp, Boolean recording); +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java new file mode 100755 index 0000000000..7417a522af --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java @@ -0,0 +1,51 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantJoinedVoiceRecordEvent() { + super(); + setEvent("ParticipantJoinedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setCallerName(String name) { + eventMap.put("callername", name); + } + + public void setCallerNumber(String name) { + eventMap.put("callernumber", name); + } + + public void setMuted(boolean muted) { + eventMap.put("muted", Boolean.toString(muted)); + } + + public void setTalking(boolean talking) { + eventMap.put("talking", Boolean.toString(talking)); + } + + public void setLocked(boolean locked) { + eventMap.put("locked", Boolean.toString(locked)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java new file mode 100755 index 0000000000..0b3bfaa25c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java @@ -0,0 +1,31 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantLeftVoiceRecordEvent() { + super(); + setEvent("ParticipantLeftEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java new file mode 100755 index 0000000000..ff7be6cbd5 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantLockedVoiceRecordEvent() { + super(); + setEvent("ParticipantLockedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setLocked(boolean locked) { + eventMap.put("locked", Boolean.toString(locked)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java new file mode 100755 index 0000000000..eb23d6bc70 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java @@ -0,0 +1,35 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantMutedVoiceRecordEvent() { + super(); + setEvent("ParticipantMutedEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setMuted(boolean muted) { + eventMap.put("muted", Boolean.toString(muted)); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java new file mode 100755 index 0000000000..e0b2814349 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java @@ -0,0 +1,36 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public ParticipantTalkingVoiceRecordEvent() { + super(); + setEvent("ParticipantTalkingEvent"); + } + + public void setParticipant(String p) { + eventMap.put("participant", p); + } + + public void setTalking(boolean talking) { + eventMap.put("talking", Boolean.toString(talking)); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java new file mode 100755 index 0000000000..7c46b0f0bf --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java @@ -0,0 +1,38 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { + + public StartRecordingVoiceRecordEvent(boolean record) { + super(); + if (record) + setEvent("StartRecordingEvent"); + else + setEvent("StopRecordingEvent"); + } + + public void setRecordingTimestamp(String timestamp) { + eventMap.put("recordingTimestamp", timestamp); + } + + public void setFilename(String filename) { + eventMap.put("filename", filename); + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java new file mode 100755 index 0000000000..3ce7b114ed --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java @@ -0,0 +1,141 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice; + +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.conference.service.recorder.RecorderApplication; +import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + + +public class VoiceEventRecorder { + + private RecorderApplication recorder; + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public void recordConferenceEvent(VoiceConferenceEvent event, String room) { + if (event instanceof VoiceUserJoinedEvent) { + recordParticipantJoinedEvent(event, room); + } else if (event instanceof VoiceUserLeftEvent) { + recordParticipantLeftEvent(event, room); + } else if (event instanceof VoiceUserMutedEvent) { + recordParticipantMutedEvent(event, room); + } else if (event instanceof VoiceUserTalkingEvent) { + recordParticipantTalkingEvent(event, room); + } else if (event instanceof VoiceUserLockedEvent) { + recordParticipantLockedEvent(event, room); + } else if (event instanceof VoiceStartRecordingEvent) { + recordStartRecordingEvent(event, room); + } else { + System.out.println("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() ); + } + } + + private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) { + VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event; + StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord()); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setRecordingTimestamp(sre.getTimestamp()); + evt.setFilename(sre.getRecordingFilename()); + System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename")); + recorder.record(room, evt); + } + + private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) { + VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event; + + ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(pje.getUserId().toString()); + evt.setCallerName(pje.getCallerIdName()); + evt.setCallerNumber(pje.getCallerIdName()); + evt.setMuted(pje.getMuted()); + evt.setTalking(pje.getSpeaking()); + + recorder.record(room, evt); + } + + private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) { + + ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + + + evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString()); + + recorder.record(room, evt); + } + + private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) { + VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event; + + ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString()); + evt.setMuted(pme.isMuted()); + + recorder.record(room, evt); + } + + private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) { + VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event; + + ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString()); + evt.setTalking(pte.isTalking()); + + recorder.record(room, evt); + } + + private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) { + VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event; + + ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent(); + evt.setMeetingId(room); + evt.setTimestamp(genTimestamp()); + evt.setBridge(event.getRoom()); + evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString()); + evt.setLocked(ple.isLocked()); + + recorder.record(room, evt); + } + + public void setRecorderApplication(RecorderApplication recorder) { + this.recorder = recorder; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java new file mode 100755 index 0000000000..d0402213cc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public abstract class ConferenceCommand { + + private final String room; + private final Integer requesterId; + + public ConferenceCommand(String room, Integer requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public String getRoom() { + return room; + } + + public Integer getRequesterId() { + return requesterId; + } + + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java new file mode 100755 index 0000000000..e9b6c0f3be --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java @@ -0,0 +1,56 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class ConferenceCommandResult { + + private final String room; + private final Integer requesterId; + private boolean success = false; + private String message = ""; + + public ConferenceCommandResult(String room, Integer requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public String getRoom() { + return room; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Integer getRequesterId() { + return requesterId; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java new file mode 100755 index 0000000000..140b26a75f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java @@ -0,0 +1,34 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class EjectParticipantCommand extends ConferenceCommand { + + private final Integer participantId; + + public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { + super(room, requesterId); + this.participantId = participantId; + } + + public Integer getParticipantId() { + return participantId; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java new file mode 100755 index 0000000000..ff774f702d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class GetParticipantsCommand extends ConferenceCommand { + + public GetParticipantsCommand(String room, Integer requesterId) { + super(room, requesterId); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java new file mode 100755 index 0000000000..789a355cde --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.commands; + +public class MuteParticipantCommand extends ConferenceCommand { + + private final Integer participantId; + private final boolean mute; + + public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { + super(room, requesterId); + this.participantId = participantId; + this.mute = mute; + } + + public Integer getParticipantId() { + return participantId; + } + + public boolean isMute() { + return mute; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java new file mode 100755 index 0000000000..15800e757d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java @@ -0,0 +1,25 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + + +public interface ConferenceEventListener { + public void handleConferenceEvent(VoiceConferenceEvent event); + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java new file mode 100755 index 0000000000..735180a415 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class UnknownConferenceEvent extends VoiceConferenceEvent { + + public UnknownConferenceEvent(String participantId, String room) { + super(room); + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java new file mode 100755 index 0000000000..d1ee12a966 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java @@ -0,0 +1,32 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public abstract class VoiceConferenceEvent { + private final String room; + + public VoiceConferenceEvent(String room) { + this.room = room; + } + + public String getRoom() { + return room; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java new file mode 100755 index 0000000000..0e2b8bcc90 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java @@ -0,0 +1,51 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceStartRecordingEvent extends VoiceConferenceEvent { + + private String timestamp; + private String filename; + private boolean record; + + public VoiceStartRecordingEvent(String room, boolean record) { + super(room); + this.record = record; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public void setRecordingFilename(String filename) { + this.filename = filename; + } + + public String getTimestamp() { + return timestamp; + } + + public String getRecordingFilename() { + return filename; + } + + public boolean startRecord() { + return record; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java new file mode 100755 index 0000000000..1a721c5015 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java @@ -0,0 +1,70 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserJoinedEvent extends VoiceConferenceEvent { + + private final String voiceUserId; + private final String callerIdNum; + private final String callerIdName; + private final Boolean muted; + private final Boolean speaking; + private final Boolean locked = false; + private final String userId; + + public VoiceUserJoinedEvent(String userId, String voiceUserId, String room, + String callerIdNum, String callerIdName, + Boolean muted, Boolean speaking) { + super(room); + this.userId = userId; + this.voiceUserId = voiceUserId; + this.callerIdName = callerIdName; + this.callerIdNum = callerIdNum; + this.muted = muted; + this.speaking = speaking; + } + + public String getUserId() { + return userId; + } + + public String getVoiceUserId() { + return voiceUserId; + } + + public String getCallerIdNum() { + return callerIdNum; + } + + public String getCallerIdName() { + return callerIdName; + } + + public Boolean getMuted() { + return muted; + } + + public Boolean getSpeaking() { + return speaking; + } + + public Boolean isLocked() { + return locked; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java new file mode 100755 index 0000000000..f5371e5620 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java @@ -0,0 +1,33 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserLeftEvent extends VoiceConferenceEvent { + + private final String userId; + + public VoiceUserLeftEvent(String userId, String room) { + super(room); + this.userId = userId; + } + + public String getUserId() { + return userId; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java new file mode 100755 index 0000000000..414be991c6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserLockedEvent extends VoiceConferenceEvent { + + private final boolean locked; + private final String userId; + + public VoiceUserLockedEvent(String userId, String room, boolean locked) { + super(room); + this.locked = locked; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isLocked() { + return locked; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java new file mode 100755 index 0000000000..203e93743c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserMutedEvent extends VoiceConferenceEvent { + + private final boolean muted; + private final String userId; + + public VoiceUserMutedEvent(String userId, String room, boolean muted) { + super(room); + this.muted = muted; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isMuted() { + return muted; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java new file mode 100755 index 0000000000..3ecd6759e4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.events; + +public class VoiceUserTalkingEvent extends VoiceConferenceEvent { + + private final boolean talking; + private final String userId; + + public VoiceUserTalkingEvent(String userId, String room, boolean talking) { + super(room); + this.talking = talking; + this.userId = userId; + } + + public String getUserId() { + return userId; + } + + public boolean isTalking() { + return talking; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java new file mode 100755 index 0000000000..8c149344e9 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java @@ -0,0 +1,153 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; +import org.freeswitch.esl.client.inbound.Client; +import org.freeswitch.esl.client.inbound.InboundConnectionFailure; +import org.freeswitch.esl.client.manager.ManagerConnection; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class ConnectionManager { + + private static final String EVENT_NAME = "Event-Name"; + + private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); + + private ManagerConnection manager; + private ScheduledFuture connectTask; + + private volatile boolean subscribed = false; + + private ConferenceEventListener conferenceEventListener; + private ESLEventListener eslEventListener; + + private void connect() { + try { + Client c = manager.getESLClient(); + if (! c.canSend()) { + System.out.println("Attempting to connect to FreeSWITCH ESL"); + subscribed = false; + manager.connect(); + } else { + if (!subscribed) { + System.out.println("Subscribing for ESL events."); + c.cancelEventSubscriptions(); + c.addEventListener(eslEventListener); + c.setEventSubscriptions( "plain", "all" ); + c.addEventFilter( EVENT_NAME, "heartbeat" ); + c.addEventFilter( EVENT_NAME, "custom" ); + c.addEventFilter( EVENT_NAME, "background_job" ); + subscribed = true; + } + } + } catch (InboundConnectionFailure e) { + System.out.println("Failed to connect to ESL"); + } + } + + public void start() { + System.out.println("Starting FreeSWITCH ESL connection manager."); + ConnectThread connector = new ConnectThread(); + connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); + } + + public void stop() { + if (connectTask != null) { + connectTask.cancel(true); + } + } + + private class ConnectThread implements Runnable { + public void run() { + connect(); + } + } + + + public void broadcast(BroadcastConferenceCommand rcc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); + rcc.handleResponse(response, conferenceEventListener); + } + } + + public void getUsers(PopulateRoomCommand prc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); + prc.handleResponse(response, conferenceEventListener); + } + } + + public void mute(MuteParticipantCommand mpc) { + System.out.println("Got mute request from FSApplication."); + Client c = manager.getESLClient(); + if (c.canSend()) { + System.out.println("Issuing command to FS ESL."); + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void eject(EjectParticipantCommand mpc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void ejectAll(EjectAllUsersCommand mpc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); + } + } + + public void record(RecordConferenceCommand rcc) { + Client c = manager.getESLClient(); + if (c.canSend()) { + EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); + rcc.handleResponse(response, conferenceEventListener); + } + } + + public void setManagerConnection(ManagerConnection manager) { + this.manager = manager; + } + + public void setESLEventListener(ESLEventListener listener) { + this.eslEventListener = listener; + } + + public void setConferenceEventListener(ConferenceEventListener listener) { + this.conferenceEventListener = listener; + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java new file mode 100755 index 0000000000..8e800f488d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java @@ -0,0 +1,201 @@ +package org.bigbluebutton.webconference.voice.freeswitch; + + +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; +import org.freeswitch.esl.client.IEslEventListener; +import org.freeswitch.esl.client.transport.event.EslEvent; +import org.jboss.netty.channel.ExceptionEvent; + +public class ESLEventListener implements IEslEventListener { + + private static final String START_TALKING_EVENT = "start-talking"; + private static final String STOP_TALKING_EVENT = "stop-talking"; + private static final String START_RECORDING_EVENT = "start-recording"; + private static final String STOP_RECORDING_EVENT = "stop-recording"; + + private ConferenceEventListener conferenceEventListener; + + @Override + public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { + //Ignored, Noop + } + + @Override + public void backgroundJobResultReceived(EslEvent event) { + System.out.println( "Background job result received [" + event + "]"); + } + + @Override + public void exceptionCaught(ExceptionEvent e) { +// setChanged(); +// notifyObservers(e); + } + + private static final Pattern GLOBAL_AUDION_PATTERN = Pattern.compile("(GLOBAL_AUDIO)_(.*)$"); + private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); + + @Override + public void conferenceEventJoin(String uniqueId, String confName, int confSize, EslEvent event) { + + Integer memberId = this.getMemberIdFromEvent(event); + Map headers = event.getEventHeaders(); + String callerId = this.getCallerIdFromEvent(event); + String callerIdName = this.getCallerIdNameFromEvent(event); + boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue + boolean speaking = headers.get("Talking").equals("true") ? true : false; + + String voiceUserId = callerIdName; + + System.out.println("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); + + Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); + if (gapMatcher.matches()) { + System.out.println("Ignoring GLOBAL AUDIO USER [" + callerIdName + "]"); + return; + } + + Matcher matcher = CALLERNAME_PATTERN.matcher(callerIdName); + if (matcher.matches()) { + voiceUserId = matcher.group(1).trim(); + callerIdName = matcher.group(2).trim(); + } + + VoiceUserJoinedEvent pj = new VoiceUserJoinedEvent(voiceUserId, memberId.toString(), confName, callerId, callerIdName, muted, speaking); + conferenceEventListener.handleConferenceEvent(pj); + } + + @Override + public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); + conferenceEventListener.handleConferenceEvent(pl); + } + + @Override + public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); + System.out.println("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); + conferenceEventListener.handleConferenceEvent(pm); + } + + @Override + public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); + System.out.println("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); + conferenceEventListener.handleConferenceEvent(pm); + } + + @Override + public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { + Integer memberId = this.getMemberIdFromEvent(event); + VoiceUserTalkingEvent pt; + + System.out.println("******************** Receive conference Action [" + action + "]"); + + if (action == null) { + return; + } + + if (action.equals(START_TALKING_EVENT)) { + pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); + conferenceEventListener.handleConferenceEvent(pt); + } else if (action.equals(STOP_TALKING_EVENT)) { + pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); + conferenceEventListener.handleConferenceEvent(pt); + } else { + System.out.println("Unknown conference Action [" + action + "]"); + } + } + + @Override + public void conferenceEventTransfer(String uniqueId, String confName, int confSize, EslEvent event) { + //Ignored, Noop + } + + @Override + public void conferenceEventThreadRun(String uniqueId, String confName, int confSize, EslEvent event) { + + } + + //@Override + public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) { + String action = event.getEventHeaders().get("Action"); + + if(action == null) { + return; + } + + System.out.println("Handling conferenceEventRecord " + action); + + if (action.equals(START_RECORDING_EVENT)) { + VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); + sre.setRecordingFilename(getRecordFilenameFromEvent(event)); + sre.setTimestamp(genTimestamp().toString()); + + System.out.println("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + + conferenceEventListener.handleConferenceEvent(sre); + } else if (action.equals(STOP_RECORDING_EVENT)) { + VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false); + srev.setRecordingFilename(getRecordFilenameFromEvent(event)); + srev.setTimestamp(genTimestamp().toString()); + + System.out.println("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + conferenceEventListener.handleConferenceEvent(srev); + } else { + System.out.println("Processing UNKNOWN conference Action " + action + "]"); + } + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + @Override + public void eventReceived(EslEvent event) { + System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]"); +// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) { +//// setChanged(); +// notifyObservers(event); +// return; +// } + } + + private Integer getMemberIdFromEvent(EslEvent e) { + return new Integer(e.getEventHeaders().get("Member-ID")); + } + + private String getCallerIdFromEvent(EslEvent e) { + return e.getEventHeaders().get("Caller-Caller-ID-Number"); + } + + private String getCallerIdNameFromEvent(EslEvent e) { + return e.getEventHeaders().get("Caller-Caller-ID-Name"); + } + + private String getRecordFilenameFromEvent(EslEvent e) { + return e.getEventHeaders().get("Path"); + } + + /*private String getRecordTimestampFromEvent(EslEvent e) { + return e.getEventHeaders().get("Event-Date-Timestamp"); + }*/ + + public void setConferenceEventListener(ConferenceEventListener listener) { + this.conferenceEventListener = listener; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java new file mode 100755 index 0000000000..267343d4c8 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java @@ -0,0 +1,202 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch; + +import java.io.File; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; +import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; +import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +public class FreeswitchApplication implements ConferenceServiceProvider { + + private static final int SENDERTHREADS = 1; + private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); + private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); + private BlockingQueue messages = new LinkedBlockingQueue(); + private ConnectionManager manager; + + private String icecastProtocol = "shout"; + private String icecastHost = "localhost"; + private int icecastPort = 8000; + private String icecastUsername = "source"; + private String icecastPassword = "hackme"; + private String icecastStreamExtension = ".mp3"; + private Boolean icecastBroadcast = false; + + private final String USER = "0"; /* not used for now */ + + private volatile boolean sendMessages = false; + + private void queueMessage(FreeswitchCommand command) { + try { + messages.offer(command, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void populateRoom(String room) { + PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); + queueMessage(prc); + } + + public void mute(String room, String participant, Boolean mute) { + MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); + queueMessage(mpc); + } + + public void eject(String room, String participant) { + EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); + queueMessage(mpc); + } + + @Override + public void ejectAll(String room) { + EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); + queueMessage(mpc); + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + @Override + public void record(String room, String meetingid){ + String RECORD_DIR = "/var/freeswitch/meetings"; + String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; + + RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); + queueMessage(rcc); + } + + @Override + public void broadcast(String room, String meetingid) { + if (icecastBroadcast) { + broadcastToIcecast(room, meetingid); + } + } + + private void broadcastToIcecast(String room, String meetingid) { + String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort + + File.separatorChar + meetingid + "." + icecastStreamExtension; + + BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); + queueMessage(rcc); + } + + public void setConnectionManager(ConnectionManager manager) { + this.manager = manager; + } + + public void setIcecastProtocol(String protocol) { + icecastProtocol = protocol; + } + + public void setIcecastHost(String host) { + icecastHost = host; + } + + public void setIcecastPort(int port) { + icecastPort = port; + } + + public void setIcecastUsername(String username) { + icecastUsername = username; + } + + public void setIcecastPassword(String password) { + icecastPassword = password; + } + + public void setIcecastBroadcast(Boolean broadcast) { + icecastBroadcast = broadcast; + } + + public void setIcecastStreamExtension(String ext) { + icecastStreamExtension = ext; + } + + private void sendMessageToFreeswitch(final FreeswitchCommand command) { + Runnable task = new Runnable() { + public void run() { + if (command instanceof PopulateRoomCommand) { + PopulateRoomCommand cmd = (PopulateRoomCommand) command; + System.out.println("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); + manager.getUsers(cmd); + } else if (command instanceof MuteParticipantCommand) { + MuteParticipantCommand cmd = (MuteParticipantCommand) command; + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.mute(cmd); + } else if (command instanceof EjectParticipantCommand) { + EjectParticipantCommand cmd = (EjectParticipantCommand) command; + System.out.println("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.eject(cmd); + } else if (command instanceof EjectAllUsersCommand) { + EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; + System.out.println("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); + manager.ejectAll(cmd); + } else if (command instanceof RecordConferenceCommand) { + manager.record((RecordConferenceCommand) command); + } else if (command instanceof BroadcastConferenceCommand) { + manager.broadcast((BroadcastConferenceCommand) command); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + FreeswitchCommand message; + try { + message = messages.take(); + sendMessageToFreeswitch(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java new file mode 100755 index 0000000000..c0aa4d35b3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java @@ -0,0 +1,50 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class BroadcastConferenceCommand extends FreeswitchCommand { + private boolean record; + private String icecastPath; + + public BroadcastConferenceCommand(String room, String requesterId, boolean record, String icecastPath){ + super(room, requesterId); + this.record = record; + this.icecastPath = icecastPath; + } + + + @Override + public String getCommandArgs() { + String action = "norecord"; + if (record) + action = "record"; + + return SPACE + getRoom() + SPACE + action + SPACE + icecastPath; + } + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java new file mode 100755 index 0000000000..e4826d72ea --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java @@ -0,0 +1,31 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class EjectAllUsersCommand extends FreeswitchCommand { + + public EjectAllUsersCommand(String room, String requesterId) { + super(room, requesterId); + } + + @Override + public String getCommandArgs() { + return room + " kick all"; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java new file mode 100755 index 0000000000..0924b164eb --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java @@ -0,0 +1,34 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class EjectParticipantCommand extends FreeswitchCommand { + + private final String participant; + + public EjectParticipantCommand(String room, String participant, String requesterId) { + super(room, requesterId); + this.participant = participant; + } + + @Override + public String getCommandArgs() { + return room + " kick " + participant; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java new file mode 100755 index 0000000000..db9800fa93 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java @@ -0,0 +1,45 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public abstract class FreeswitchCommand { + public static final String SPACE = " "; + + protected final String room; + protected final String requesterId; + + public FreeswitchCommand(String room, String requesterId) { + this.room = room; + this.requesterId = requesterId; + } + + public String getCommand() { + return "conference"; //conference is default, override if needed. + } + + public abstract String getCommandArgs(); + + public String getRoom() { + return room; + } + + public String getRequesterId() { + return requesterId; + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java new file mode 100755 index 0000000000..a54ab6dacc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java @@ -0,0 +1,40 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +public class MuteParticipantCommand extends FreeswitchCommand { + + private final String participant; + private final Boolean mute; + + public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { + super(room, requesterId); + this.participant = participant; + this.mute = mute; + } + + @Override + public String getCommandArgs() { + String action = "unmute"; + if (mute) action = "mute"; + + return room + SPACE + action + SPACE + participant; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java new file mode 100755 index 0000000000..7d6c462f58 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java @@ -0,0 +1,115 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.freeswitch.esl.client.transport.message.EslMessage; +import org.apache.commons.lang3.StringUtils; +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; +import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.SAXException; + +public class PopulateRoomCommand extends FreeswitchCommand { + + public PopulateRoomCommand(String room, String requesterId) { + super(room, requesterId); + } + + @Override + public String getCommandArgs() { + return getRoom() + SPACE + "xml_list"; + } + + private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + String firstLine = response.getBodyLines().get(0); + + //E.g. Conference 85115 not found + + if(!firstLine.startsWith(". +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.actions; + +import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.freeswitch.esl.client.transport.message.EslMessage; + +public class RecordConferenceCommand extends FreeswitchCommand { + + private boolean record; + private String recordPath; + + public RecordConferenceCommand(String room, String requesterId, boolean record, String recordPath){ + super(room, requesterId); + this.record = record; + this.recordPath = recordPath; + } + + + @Override + public String getCommandArgs() { + String action = "norecord"; + if (record) + action = "record"; + + return SPACE + getRoom() + SPACE + action + SPACE + recordPath; + } + + public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { + + //Test for Known Conference + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java new file mode 100755 index 0000000000..4e6caf9050 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java @@ -0,0 +1,88 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.webconference.voice.freeswitch.response; + +/** + * + * @author leif + */ +public class ConferenceMember { + + protected Integer memberId; + protected ConferenceMemberFlags flags; + protected String uuid; + protected String callerIdName; + protected String callerId; + protected Integer joinTime; + protected Integer lastTalking; + + public Integer getId() { + return memberId; + } + + public ConferenceMemberFlags getFlags() { + return flags; + } + + public String getCallerId() { + return callerId; + } + + public String getCallerIdName() { + return callerIdName; + } + + public boolean getMuted() { + return flags.getIsMuted(); + } + + public boolean getSpeaking() { + return flags.getIsSpeaking(); + } + + public void setFlags(ConferenceMemberFlags flags) { + this.flags = flags; + } + + public void setId(int parseInt) { + memberId = parseInt; + } + + public void setUUID(String tempVal) { + this.uuid = tempVal; + } + + public void setCallerIdName(String tempVal) { + this.callerIdName = tempVal; + } + + public void setCallerId(String tempVal) { + this.callerId = tempVal; + } + + public void setJoinTime(int parseInt) { + this.joinTime = parseInt; + } + + void setLastTalking(int parseInt) { + this.lastTalking = parseInt; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java new file mode 100755 index 0000000000..be507e2c0d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java @@ -0,0 +1,54 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ + +package org.bigbluebutton.webconference.voice.freeswitch.response; + +/** + * + * @author leif + */ +public class ConferenceMemberFlags { + //private boolean canHear = false; + private boolean canSpeak = false; + private boolean talking = false; + //private boolean hasVideo = false; + //private boolean hasFloor = false; + //private boolean isModerator = false; + //private boolean endConference = false; + + boolean getIsSpeaking() { + return talking; + } + + boolean getIsMuted() { + if(canSpeak == true) { + return false; + } + return true; + } + + void setCanSpeak(String tempVal) { + canSpeak = tempVal.equals("true") ? true : false; + } + + void setTalking(String tempVal) { + talking = tempVal.equals("true") ? true : false; + } + +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java new file mode 100755 index 0000000000..e99dcafa89 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java @@ -0,0 +1,158 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.webconference.voice.freeswitch.response; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * + * @author leif + */ +public class XMLResponseConferenceListParser extends DefaultHandler { + private List myConfrenceMembers; + private String tempVal; + private ConferenceMember tempMember; + private ConferenceMemberFlags tempFlags; + private String room; + private boolean inFlags = false; + + public XMLResponseConferenceListParser() { + myConfrenceMembers = new ArrayList(); + } + + public String getConferenceRoom() { + return room; + } + + public void printConferneceMemebers() { + Iterator it = myConfrenceMembers.iterator(); + while(it.hasNext()) { + + } + } + + public List getConferenceList() { + return myConfrenceMembers; + } + + /* + + + + + + 6 + + true + true + false + false + true + false + false + + 3a16f061-0df6-45d5-b401-d8e977e08a5c + 1001 + 1001 + 65 + 4 + + + + + + */ + + + //SAX Event Handlers + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + //reset + inFlags = false; + tempVal = ""; + if(qName.equalsIgnoreCase("member")) { + //create a new instance of ConferenceMember + tempMember = new ConferenceMember(); + } + + if(qName.equalsIgnoreCase("flags")) { + //create a new instance of ConferenceMember + tempFlags = new ConferenceMemberFlags(); + inFlags = true; + } + + if(qName.equalsIgnoreCase("conference")) { + room = attributes.getValue("name"); + } + } + + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + tempVal = new String(ch,start,length); + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + + if(qName.equalsIgnoreCase("member")) { + //add it to the list + myConfrenceMembers.add(tempMember); + }else if(qName.equalsIgnoreCase("flags")) { + tempMember.setFlags(tempFlags); + inFlags = false; + }else if(inFlags) { + if (qName.equalsIgnoreCase("can_speak")) { + tempFlags.setCanSpeak(tempVal); + }else if (qName.equalsIgnoreCase("talking")) { + tempFlags.setTalking(tempVal); + } + }else if (qName.equalsIgnoreCase("id")) { + try { + tempMember.setId(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { + + } + }else if (qName.equalsIgnoreCase("uuid")) { + tempMember.setUUID(tempVal); + }else if (qName.equalsIgnoreCase("caller_id_name")) { + tempMember.setCallerIdName(tempVal); + }else if (qName.equalsIgnoreCase("caller_id_number")) { + tempMember.setCallerId(tempVal); + }else if (qName.equalsIgnoreCase("join_time")) { + try { + tempMember.setJoinTime(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { + + } + }else if (qName.equalsIgnoreCase("last_talking")) { + try { + tempMember.setLastTalking(Integer.parseInt(tempVal)); + } catch(NumberFormatException nfe) { + + } + } + + } +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala index 245ccd7ffc..89b7c84f32 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala @@ -5,17 +5,9 @@ import scala.concurrent.duration._ import redis.RedisClient import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global -//import org.bigbluebutton.apps.MeetingManager -import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor object Boot extends App with SystemConfiguration { implicit val system = ActorSystem("bigbluebutton-apps-system") - val redisPublisherActor = system.actorOf( - AppsRedisPublisherActor.props(system), - "redis-publisher") - - // val meetingManager = system.actorOf(MeetingManager.props(redisPublisherActor), "meeting-manager") - } \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala new file mode 100755 index 0000000000..a4e615328d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala @@ -0,0 +1,5 @@ +package org.bigbluebutton.conference.voice.freeswitch + +class HeartbeatMonitor() { + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala new file mode 100755 index 0000000000..8e18ec0e0b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -0,0 +1,182 @@ +package org.bigbluebutton.core + +import akka.actor._ +import akka.actor.ActorLogging +import akka.pattern.{ ask, pipe } +import akka.util.Timeout +import scala.concurrent.duration._ +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.util._ +import org.bigbluebutton.core.api.ValidateAuthTokenTimedOut +import scala.util.Success +import scala.util.Failure + +object BigBlueButtonActor extends SystemConfiguration { + def props(system: ActorSystem, outGW: MessageOutGateway): Props = + Props(classOf[BigBlueButtonActor], system, outGW) +} + +class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) extends Actor with ActorLogging { + def actorRefFactory = context + implicit def executionContext = actorRefFactory.dispatcher + implicit val timeout = Timeout(5 seconds) + + //private var meetings = new HashMap[String, MeetingActor] + private var meetings = new collection.immutable.HashMap[String, RunningMeeting] + + def receive = { + case msg: CreateMeeting => handleCreateMeeting(msg) + case msg: DestroyMeeting => handleDestroyMeeting(msg) + case msg: KeepAliveMessage => handleKeepAliveMessage(msg) + case msg: ValidateAuthToken => handleValidateAuthToken(msg) + case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) + case msg: InMessage => handleMeetingMessage(msg) + case _ => // do nothing + } + + private def handleValidateAuthToken(msg: ValidateAuthToken) { + meetings.get(msg.meetingID) foreach { m => + val future = m.actorRef.ask(msg)(5 seconds) + + future onComplete { + case Success(result) => { + log.debug("Got response from meeting=" + msg.meetingID + "].") + /** + * Received a reply from MeetingActor which means hasn't hung! + * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple + * audit to check whether the actor is still alive. (ralam feb 25, 2015) + */ + } + case Failure(failure) => { + log.warning("Failed to get response to from meeting=" + msg.meetingID + "]. Meeting has probably hung.") + outGW.send(new ValidateAuthTokenTimedOut(msg.meetingID, msg.userId, msg.token, false, msg.correlationId, msg.sessionId)) + } + } + } + } + + private def handleMeetingMessage(msg: InMessage): Unit = { + msg match { + case ucm: UserConnectedToGlobalAudio => { + val m = meetings.values.find(m => m.voiceBridge == ucm.voiceConf) + m foreach { mActor => mActor.actorRef ! ucm } + } + case udm: UserDisconnectedFromGlobalAudio => { + val m = meetings.values.find(m => m.voiceBridge == udm.voiceConf) + m foreach { mActor => mActor.actorRef ! udm } + } + case allOthers => { + meetings.get(allOthers.meetingID) match { + case None => handleMeetingNotFound(allOthers) + case Some(m) => { + // log.debug("Forwarding message [{}] to meeting [{}]", msg.meetingID) + m.actorRef ! allOthers + } + } + } + } + } + + private def handleMeetingNotFound(msg: InMessage) { + msg match { + case vat: ValidateAuthToken => { + log.info("No meeting [" + vat.meetingID + "] for auth token [" + vat.token + "]") + outGW.send(new ValidateAuthTokenReply(vat.meetingID, vat.userId, vat.token, false, vat.correlationId, vat.sessionId)) + } + case _ => { + log.info("No meeting [" + msg.meetingID + "] for message type [" + msg.getClass() + "]") + // do nothing + } + } + } + + private def handleKeepAliveMessage(msg: KeepAliveMessage): Unit = { + outGW.send(new KeepAliveMessageReply(msg.aliveID)) + } + + private def handleDestroyMeeting(msg: DestroyMeeting) { + log.info("BBBActor received DestroyMeeting message for meeting id [" + msg.meetingID + "]") + meetings.get(msg.meetingID) match { + case None => println("Could not find meeting id[" + msg.meetingID + "] to destroy.") + case Some(m) => { + m.actorRef ! StopMeetingActor + meetings -= msg.meetingID + log.info("Kick everyone out on meeting id[" + msg.meetingID + "].") + outGW.send(new EndAndKickAll(msg.meetingID, m.recorded)) + outGW.send(new DisconnectAllUsers(msg.meetingID)) + log.info("Destroyed meeting id[" + msg.meetingID + "].") + outGW.send(new MeetingDestroyed(msg.meetingID)) + } + } + } + + private def handleCreateMeeting(msg: CreateMeeting): Unit = { + meetings.get(msg.meetingID) match { + case None => { + log.info("New meeting create request [" + msg.meetingName + "]") + var m = RunningMeeting(msg.meetingID, msg.externalMeetingID, msg.meetingName, msg.recorded, + msg.voiceBridge, msg.duration, + msg.autoStartRecording, msg.allowStartStopRecording, msg.moderatorPass, + msg.viewerPass, msg.createTime, msg.createDate, + outGW) + + meetings += m.meetingID -> m + outGW.send(new MeetingCreated(m.meetingID, m.externalMeetingID, m.recorded, m.meetingName, m.voiceBridge, msg.duration, + msg.moderatorPass, msg.viewerPass, msg.createTime, msg.createDate)) + + m.actorRef ! new InitializeMeeting(m.meetingID, m.recorded) + m.actorRef ! "StartTimer" + } + case Some(m) => { + log.info("Meeting already created [" + msg.meetingName + "]") + // do nothing + } + } + } + + private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { + + var len = meetings.keys.size + println("meetings.size=" + meetings.size) + println("len_=" + len) + + val set = meetings.keySet + val arr: Array[String] = new Array[String](len) + set.copyToArray(arr) + val resultArray: Array[MeetingInfo] = new Array[MeetingInfo](len) + + for (i <- 0 until arr.length) { + val id = arr(i) + val duration = meetings.get(arr(i)).head.duration + val name = meetings.get(arr(i)).head.meetingName + val recorded = meetings.get(arr(i)).head.recorded + val voiceBridge = meetings.get(arr(i)).head.voiceBridge + + var info = new MeetingInfo(id, name, recorded, voiceBridge, duration) + resultArray(i) = info + + //remove later + println("for a meeting:" + id) + println("Meeting Name = " + meetings.get(id).head.meetingName) + println("isRecorded = " + meetings.get(id).head.recorded) + println("voiceBridge = " + voiceBridge) + println("duration = " + duration) + + //send the users + self ! (new GetUsers(id, "nodeJSapp")) + + //send the presentation + self ! (new GetPresentationInfo(id, "nodeJSapp", "nodeJSapp")) + + //send chat history + self ! (new GetChatHistoryRequest(id, "nodeJSapp", "nodeJSapp")) + + //send lock settings + self ! (new GetLockSettings(id, "nodeJSapp")) + } + + outGW.send(new GetAllMeetingsReply(resultArray)) + } + +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala new file mode 100755 index 0000000000..d91834b215 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala @@ -0,0 +1,23 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api._ +import java.util.concurrent.CountDownLatch +import akka.actor.{ ActorSystem, Props } + +class BigBlueButtonGateway(outGW: MessageOutGateway) { + + implicit val system = ActorSystem("bigbluebutton-apps-system") + + val bbbActor = system.actorOf( + BigBlueButtonActor.props(system, outGW), + "bigbluebutton-actor") + + def accept(msg: InMessage): Unit = { + bbbActor ! msg + } + + def acceptKeepAlive(msg: KeepAliveMessage): Unit = { + bbbActor ! msg + } + +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala new file mode 100755 index 0000000000..9560dc3f89 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -0,0 +1,432 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.presentation.PreuploadedPresentationsUtil +import scala.collection.JavaConversions._ +import org.bigbluebutton.core.apps.layout.LayoutInGateway +import org.bigbluebutton.core.apps.chat.ChatInGateway +import scala.collection.JavaConversions._ +import org.bigbluebutton.core.apps.whiteboard.WhiteboardInGateway +import org.bigbluebutton.core.apps.voice.VoiceInGateway +import java.util.ArrayList +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.apps.presentation.Page +import org.bigbluebutton.core.apps.presentation.Presentation + +class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway, presUtil: PreuploadedPresentationsUtil) extends IBigBlueButtonInGW { + + // Meeting + def createMeeting2(meetingID: String, externalMeetingID: String, meetingName: String, record: Boolean, + voiceBridge: String, duration: Long, autoStartRecording: Boolean, + allowStartStopRecording: Boolean, moderatorPass: String, viewerPass: String, + createTime: Long, createDate: String) { + // println("******************** CREATING MEETING [" + meetingID + "] ***************************** ") + bbbGW.accept(new CreateMeeting(meetingID, externalMeetingID, meetingName, record, + voiceBridge, duration, autoStartRecording, + allowStartStopRecording, moderatorPass, viewerPass, + createTime, createDate)) + } + + def destroyMeeting(meetingID: String) { + // println("******************** DESTROY MEETING [" + meetingID + "] ***************************** ") + bbbGW.accept(new DestroyMeeting(meetingID)) + } + + def getAllMeetings(meetingID: String) { + println("******************** GET ALL MEETINGS ***************************** ") + bbbGW.accept(new GetAllMeetingsRequest("meetingId")) + } + + def isAliveAudit(aliveId: String) { + bbbGW.acceptKeepAlive(new KeepAliveMessage(aliveId)); + } + + def lockSettings(meetingID: String, locked: java.lang.Boolean, + lockSettings: java.util.Map[String, java.lang.Boolean]) { + + } + + def statusMeetingAudit(meetingID: String) { + + } + + def endMeeting(meetingID: String) { + // println("******************** END MEETING [" + meetingID + "] ***************************** ") + bbbGW.accept(new EndMeeting(meetingID)) + } + + def endAllMeetings() { + + } + + /** + * *********************************************************** + * Message Interface for Users + * *********************************************************** + */ + def validateAuthToken(meetingId: String, userId: String, token: String, correlationId: String, sessionId: String) { + // println("******************** VALIDATE TOKEN [" + token + "] ***************************** ") + bbbGW.accept(new ValidateAuthToken(meetingId, userId, token, correlationId, sessionId)) + } + + def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String, authToken: String): Unit = { + val userRole = if (role == "MODERATOR") Role.MODERATOR else Role.VIEWER + bbbGW.accept(new RegisterUser(meetingID, userID, name, userRole, extUserID, authToken)) + } + + def sendLockSettings(meetingID: String, userId: String, settings: java.util.Map[String, java.lang.Boolean]) { + // Convert java.util.Map to scala.collection.immutable.Map + // settings.mapValues -> convaert java Map to scala mutable Map + // v => v.booleanValue() -> convert java Boolean to Scala Boolean + // toMap -> converts from scala mutable map to scala immutable map + val s = settings.mapValues(v => v.booleanValue() /* convert java Boolean to Scala Boolean */ ).toMap + val disableCam = s.getOrElse("disableCam", false) + val disableMic = s.getOrElse("disableMic", false) + val disablePrivChat = s.getOrElse("disablePrivateChat", false) + val disablePubChat = s.getOrElse("disablePublicChat", false) + val lockedLayout = s.getOrElse("lockedLayout", false) + var lockOnJoin = s.getOrElse("lockOnJoin", false) + var lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) + + val permissions = new Permissions(disableCam = disableCam, + disableMic = disableMic, + disablePrivChat = disablePrivChat, + disablePubChat = disablePubChat, + lockedLayout = lockedLayout, + lockOnJoin = lockOnJoin, + lockOnJoinConfigurable = lockOnJoinConfigurable) + + bbbGW.accept(new SetLockSettings(meetingID, userId, permissions)) + } + + def initLockSettings(meetingID: String, settings: java.util.Map[String, java.lang.Boolean]) { + // Convert java.util.Map to scala.collection.immutable.Map + // settings.mapValues -> convert java Map to scala mutable Map + // v => v.booleanValue() -> convert java Boolean to Scala Boolean + // toMap -> converts from scala mutable map to scala immutable map + val s = settings.mapValues(v => v.booleanValue() /* convert java Boolean to Scala Boolean */ ).toMap + val disableCam = s.getOrElse("disableCam", false) + val disableMic = s.getOrElse("disableMic", false) + val disablePrivChat = s.getOrElse("disablePrivateChat", false) + val disablePubChat = s.getOrElse("disablePublicChat", false) + val lockedLayout = s.getOrElse("lockedLayout", false) + val lockOnJoin = s.getOrElse("lockOnJoin", false) + val lockOnJoinConfigurable = s.getOrElse("lockOnJoinConfigurable", false) + val permissions = new Permissions(disableCam = disableCam, + disableMic = disableMic, + disablePrivChat = disablePrivChat, + disablePubChat = disablePubChat, + lockedLayout = lockedLayout, + lockOnJoin = lockOnJoin, + lockOnJoinConfigurable = lockOnJoinConfigurable) + + bbbGW.accept(new InitLockSettings(meetingID, permissions)) + } + + def initAudioSettings(meetingID: String, requesterID: String, muted: java.lang.Boolean) { + bbbGW.accept(new InitAudioSettings(meetingID, requesterID, muted.booleanValue())) + } + + def getLockSettings(meetingId: String, userId: String) { + bbbGW.accept(new GetLockSettings(meetingId, userId)) + } + + def lockUser(meetingId: String, requesterID: String, lock: Boolean, userId: String) { + bbbGW.accept(new LockUserRequest(meetingId, requesterID, userId, lock)) + } + + def setRecordingStatus(meetingId: String, userId: String, recording: java.lang.Boolean) { + bbbGW.accept(new SetRecordingStatus(meetingId, userId, recording.booleanValue())) + } + + def getRecordingStatus(meetingId: String, userId: String) { + bbbGW.accept(new GetRecordingStatus(meetingId, userId)) + } + + // Users + def userRaiseHand(meetingId: String, userId: String) { + bbbGW.accept(new UserRaiseHand(meetingId, userId)) + } + + def lowerHand(meetingId: String, userId: String, loweredBy: String) { + bbbGW.accept(new UserLowerHand(meetingId, userId, loweredBy)) + } + + def ejectUserFromMeeting(meetingId: String, userId: String, ejectedBy: String) { + bbbGW.accept(new EjectUserFromMeeting(meetingId, userId, ejectedBy)) + } + + def shareWebcam(meetingId: String, userId: String, stream: String) { + bbbGW.accept(new UserShareWebcam(meetingId, userId, stream)) + } + + def unshareWebcam(meetingId: String, userId: String, stream: String) { + bbbGW.accept(new UserUnshareWebcam(meetingId, userId, stream)) + } + + def setUserStatus(meetingID: String, userID: String, status: String, value: Object): Unit = { + bbbGW.accept(new ChangeUserStatus(meetingID, userID, status, value)); + } + + def getUsers(meetingID: String, requesterID: String): Unit = { + bbbGW.accept(new GetUsers(meetingID, requesterID)) + } + + def userLeft(meetingID: String, userID: String, sessionId: String): Unit = { + bbbGW.accept(new UserLeaving(meetingID, userID, sessionId)) + } + + def userJoin(meetingID: String, userID: String, authToken: String): Unit = { + bbbGW.accept(new UserJoining(meetingID, userID, authToken)) + } + + def assignPresenter(meetingID: String, newPresenterID: String, newPresenterName: String, assignedBy: String): Unit = { + bbbGW.accept(new AssignPresenter(meetingID, newPresenterID, newPresenterName, assignedBy)) + } + + def getCurrentPresenter(meetingID: String, requesterID: String): Unit = { + // do nothing + } + + def userConnectedToGlobalAudio(voiceConf: String, userid: String, name: String) { + // we are required to pass the meeting_id as first parameter (just to satisfy trait) + // but it's not used anywhere. That's why we pass voiceConf twice instead + bbbGW.accept(new UserConnectedToGlobalAudio(voiceConf, voiceConf, userid, name)) + } + + def userDisconnectedFromGlobalAudio(voiceConf: String, userid: String, name: String) { + // we are required to pass the meeting_id as first parameter (just to satisfy trait) + // but it's not used anywhere. That's why we pass voiceConf twice instead + bbbGW.accept(new UserDisconnectedFromGlobalAudio(voiceConf, voiceConf, userid, name)) + } + + /** + * ************************************************************************************ + * Message Interface for Presentation + * ************************************************************************************ + */ + + def clear(meetingID: String) { + bbbGW.accept(new ClearPresentation(meetingID)) + } + + def sendConversionUpdate(messageKey: String, meetingId: String, + code: String, presentationId: String, presName: String) { + bbbGW.accept(new PresentationConversionUpdate(meetingId, messageKey, + code, presentationId, presName)) + } + + def sendPageCountError(messageKey: String, meetingId: String, + code: String, presentationId: String, numberOfPages: Int, + maxNumberPages: Int, presName: String) { + bbbGW.accept(new PresentationPageCountError(meetingId, messageKey, + code, presentationId, numberOfPages, maxNumberPages, presName)) + } + + def sendSlideGenerated(messageKey: String, meetingId: String, + code: String, presentationId: String, numberOfPages: Int, + pagesCompleted: Int, presName: String) { + bbbGW.accept(new PresentationSlideGenerated(meetingId, messageKey, + code, presentationId, numberOfPages, pagesCompleted, presName)) + } + + def generatePresentationPages(presId: String, numPages: Int, presBaseUrl: String): scala.collection.immutable.HashMap[String, Page] = { + var pages = new scala.collection.immutable.HashMap[String, Page] + val baseUrl = + for (i <- 1 to numPages) { + val id = presId + "/" + i + val num = i; + val current = if (i == 1) true else false + val thumbnail = presBaseUrl + "/thumbnail/" + i + val swfUri = presBaseUrl + "/slide/" + i + + val txtUri = presBaseUrl + "/textfiles/" + i + val pngUri = presBaseUrl + "/png/" + i + + val p = new Page(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri, + txtUri = txtUri, pngUri = pngUri, + current = current) + pages += (p.id -> p) + } + + pages + } + + def sendConversionCompleted(messageKey: String, meetingId: String, + code: String, presentationId: String, numPages: Int, + presName: String, presBaseUrl: String) { + // println("******************** PRESENTATION CONVERSION COMPLETED MESSAGE ***************************** ") + val pages = generatePresentationPages(presentationId, numPages, presBaseUrl) + + val presentation = new Presentation(id = presentationId, name = presName, pages = pages) + bbbGW.accept(new PresentationConversionCompleted(meetingId, messageKey, + code, presentation)) + + } + + def removePresentation(meetingID: String, presentationID: String) { + bbbGW.accept(new RemovePresentation(meetingID, presentationID)) + } + + def getPresentationInfo(meetingID: String, requesterID: String, replyTo: String) { + // println("**** Forwarding GetPresentationInfo for meeting[" + meetingID + "] ****") + bbbGW.accept(new GetPresentationInfo(meetingID, requesterID, replyTo)) + } + + def sendCursorUpdate(meetingID: String, xPercent: Double, yPercent: Double) { + bbbGW.accept(new SendCursorUpdate(meetingID, xPercent, yPercent)) + } + + def resizeAndMoveSlide(meetingID: String, xOffset: Double, yOffset: Double, widthRatio: Double, heightRatio: Double) { + bbbGW.accept(new ResizeAndMoveSlide(meetingID, xOffset, yOffset, widthRatio, heightRatio)) + } + + def gotoSlide(meetingID: String, pageId: String) { + // println("**** Forwarding GotoSlide for meeting[" + meetingID + "] ****") + bbbGW.accept(new GotoSlide(meetingID, pageId)) + } + + def sharePresentation(meetingID: String, presentationID: String, share: Boolean) { + bbbGW.accept(new SharePresentation(meetingID, presentationID, share)) + } + + def getSlideInfo(meetingID: String, requesterID: String, replyTo: String) { + bbbGW.accept(new GetSlideInfo(meetingID, requesterID, replyTo)) + } + + /** + * *********************************************************************** + * Message Interface for Layout + * ******************************************************************* + */ + val layoutGW = new LayoutInGateway(bbbGW) + + def getCurrentLayout(meetingID: String, requesterID: String) { + layoutGW.getCurrentLayout(meetingID, requesterID) + } + + def broadcastLayout(meetingID: String, requesterID: String, layout: String) { + layoutGW.broadcastLayout(meetingID, requesterID, layout) + } + + def lockLayout(meetingId: String, setById: String, + lock: Boolean, viewersOnly: Boolean, + layout: String) { + layoutGW.lockLayout(meetingId, setById, lock, viewersOnly, layout) + + } + + /** + * ******************************************************************* + * Message Interface for Chat + * ***************************************************************** + */ + val chatGW = new ChatInGateway(bbbGW) + + def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { + chatGW.getChatHistory(meetingID, requesterID, replyTo) + } + + def sendPublicMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { + // Convert java Map to Scala Map, then convert Mutable map to immutable map + chatGW.sendPublicMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) + } + + def sendPrivateMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { + chatGW.sendPrivateMessage(meetingID, requesterID, mapAsScalaMap(message).toMap) + } + + /** + * ******************************************************************* + * Message Interface for Whiteboard + * ***************************************************************** + */ + val wbGW = new WhiteboardInGateway(bbbGW) + + def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) { + wbGW.sendWhiteboardAnnotation(meetingID, requesterID, mapAsScalaMap(annotation).toMap) + } + + def requestWhiteboardAnnotationHistory(meetingID: String, requestedID: String, whiteboardId: String, replyTo: String) { + wbGW.requestWhiteboardAnnotationHistory(meetingID, requestedID, whiteboardId, replyTo) + } + + def clearWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { + wbGW.clearWhiteboard(meetingID, requestedID, whiteboardId); + } + + def undoWhiteboard(meetingID: String, requestedID: String, whiteboardId: String) { + wbGW.undoWhiteboard(meetingID, requestedID, whiteboardId) + } + + def enableWhiteboard(meetingID: String, requestedID: String, enable: java.lang.Boolean) { + wbGW.enableWhiteboard(meetingID, requestedID, enable) + } + + def isWhiteboardEnabled(meetingID: String, requestedID: String, replyTo: String) { + wbGW.isWhiteboardEnabled(meetingID, requestedID, replyTo) + } + + /** + * ******************************************************************* + * Message Interface for Voice + * ***************************************************************** + */ + val voiceGW = new VoiceInGateway(bbbGW) + + def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: java.lang.Boolean) { + voiceGW.muteAllExceptPresenter(meetingID, requesterID, mute) + } + + def muteAllUsers(meetingID: String, requesterID: String, mute: java.lang.Boolean) { + voiceGW.muteAllUsers(meetingID, requesterID, mute) + } + + def isMeetingMuted(meetingID: String, requesterID: String) { + voiceGW.isMeetingMuted(meetingID, requesterID) + } + + def muteUser(meetingID: String, requesterID: String, userID: String, mute: java.lang.Boolean) { + voiceGW.muteUser(meetingID, requesterID, userID, mute) + } + + def lockMuteUser(meetingID: String, requesterID: String, userID: String, lock: java.lang.Boolean) { + voiceGW.lockUser(meetingID, requesterID, userID, lock) + } + + def ejectUserFromVoice(meetingId: String, userId: String, ejectedBy: String) { + voiceGW.ejectUserFromVoice(meetingId, userId, ejectedBy) + } + + def voiceUserJoined(meetingId: String, userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, + muted: java.lang.Boolean, speaking: java.lang.Boolean) { + + voiceGW.voiceUserJoined(meetingId, userId, webUserId, + conference, callerIdNum, + callerIdName, muted, speaking) + } + + def voiceUserLeft(meetingId: String, userId: String) { + voiceGW.voiceUserLeft(meetingId, userId) + } + + def voiceUserLocked(meetingId: String, userId: String, locked: java.lang.Boolean) { + voiceGW.voiceUserLocked(meetingId, userId, locked) + } + + def voiceUserMuted(meetingId: String, userId: String, muted: java.lang.Boolean) { + voiceGW.voiceUserMuted(meetingId, userId, muted) + } + + def voiceUserTalking(meetingId: String, userId: String, talking: java.lang.Boolean) { + voiceGW.voiceUserTalking(meetingId, userId, talking) + } + + def voiceRecording(meetingId: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + voiceGW.voiceRecording(meetingId, recordingFile, + timestamp, recording) + } +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala new file mode 100755 index 0000000000..f1b4f3bd6f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala @@ -0,0 +1,1741 @@ +package org.bigbluebutton.core + +import akka.actor._ +import akka.actor.ActorLogging +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.mutable.HashMap +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import java.util.ArrayList +import org.bigbluebutton.core.apps.presentation.Page +import org.bigbluebutton.core.apps.presentation.Presentation +import org.bigbluebutton.core.apps.chat.redis.ChatMessageToJsonConverter +import org.bigbluebutton.core.apps.presentation.redis.PesentationMessageToJsonConverter +import org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardMessageToJsonConverter +import org.bigbluebutton.core.meeting.MeetingMessageToJsonConverter +import org.bigbluebutton.core.apps.users.redis.UsersMessageToJsonConverter + +class CollectorActor(dispatcher: IDispatcher) extends Actor { + + def receive = { + //IN MESSAGES + case msg: CreateMeeting => handleCreateMeeting(msg) + case msg: InitializeMeeting => handleInitializeMeeting(msg) + case msg: DestroyMeeting => handleDestroyMeeting(msg) + case msg: StartMeeting => handleStartMeeting(msg) + case msg: EndMeeting => handleEndMeeting(msg) + case msg: LockSetting => handleLockSetting(msg) + case msg: LockUser => handleLockUser(msg) + case msg: InitLockSettings => handleInitLockSettings(msg) + case msg: InitAudioSettings => handleInitAudioSettings(msg) + case msg: SetLockSettings => handleSetLockSettings(msg) + case msg: GetLockSettings => handleGetLockSettings(msg) + case msg: ValidateAuthToken => handleValidateAuthToken(msg) + case msg: RegisterUser => handleRegisterUser(msg) + case msg: UserJoining => handleUserJoining(msg) + case msg: UserLeaving => handleUserLeaving(msg) + case msg: GetUsers => handleGetUsers(msg) + case msg: UserRaiseHand => handleUserRaiseHand(msg) + case msg: UserLowerHand => handleUserLowerHand(msg) + case msg: UserShareWebcam => handleUserShareWebcam(msg) + case msg: UserUnshareWebcam => handleUserUnshareWebcam(msg) + case msg: ChangeUserStatus => handleChangeUserStatus(msg) + case msg: AssignPresenter => handleAssignPresenter(msg) + case msg: SetRecordingStatus => handleSetRecordingStatus(msg) + case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) + case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) + case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) + case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) + case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) + case msg: ClearPresentation => handleClearPresentation(msg) + case msg: RemovePresentation => handleRemovePresentation(msg) + case msg: GetPresentationInfo => handleGetPresentationInfo(msg) + //case msg: SendCursorUpdate => handleSendCursorUpdate(msg) + case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) + case msg: GotoSlide => handleGotoSlide(msg) + case msg: SharePresentation => handleSharePresentation(msg) + case msg: GetSlideInfo => handleGetSlideInfo(msg) + case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) + case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) + case msg: PresentationPageCountError => handlePresentationPageCountError(msg) + case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) + case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) + case msg: SendVoiceUsersRequest => handleSendVoiceUsersRequest(msg) + case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) + case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) + case msg: MuteUserRequest => handleMuteUserRequest(msg) + case msg: LockUserRequest => handleLockUserRequest(msg) + case msg: EjectUserFromVoiceRequest => handleEjectUserFromVoiceRequest(msg) + case msg: VoiceUserJoinedMessage => handleVoiceUserJoinedMessage(msg) + case msg: VoiceUserJoined => handleVoiceUserJoined(msg) + case msg: VoiceUserLeft => handleVoiceUserLeft(msg) + case msg: VoiceUserLocked => handleVoiceUserLocked(msg) + case msg: VoiceUserMuted => handleVoiceUserMuted(msg) + case msg: VoiceUserTalking => handleVoiceUserTalking(msg) + case msg: VoiceRecording => handleVoiceRecording(msg) + case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) + case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) + case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) + case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) + case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) + case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) + case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) + + //OUT MESSAGES + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) + case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingHasEnded => handleMeetingHasEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) + case msg: DisconnectUser => handleDisconnectUser(msg) + case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) + case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) + case msg: UserLocked => handleUserLocked(msg) + case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) + case msg: UserRegistered => handleUserRegistered(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: PresenterAssigned => handlePresenterAssigned(msg) + case msg: EndAndKickAll => handleEndAndKickAll(msg) + case msg: GetUsersReply => handleGetUsersReply(msg) + case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserRaisedHand => handleUserRaisedHand(msg) + case msg: UserLoweredHand => handleUserLoweredHand(msg) + case msg: UserSharedWebcam => handleUserSharedWebcam(msg) + case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) + case msg: UserStatusChange => handleUserStatusChange(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: UserVoiceMuted => handleUserVoiceMuted(msg) + case msg: UserVoiceTalking => handleUserVoiceTalking(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) + case msg: StartRecording => handleStartRecording(msg) + case msg: StopRecording => handleStopRecording(msg) + case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) + case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) + case msg: GetCurrentLayoutReply => handleGetCurrentLayoutReply(msg) + case msg: BroadcastLayoutEvent => handleBroadcastLayoutEvent(msg) + case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) + case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) + case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) + //case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) + case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) + case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) + case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) + case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) + case msg: GetPreuploadedPresentationsOutMsg => handleGetPreuploadedPresentationsOutMsg(msg) + case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) + case msg: PresentationConversionError => handlePresentationConversionError(msg) + case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) + case msg: PresentationConversionDone => handlePresentationConversionDone(msg) + case msg: PresentationChanged => handlePresentationChanged(msg) + case msg: GetPresentationStatusReply => handleGetPresentationStatusReply(msg) + case msg: PresentationRemoved => handlePresentationRemoved(msg) + case msg: PageChanged => handlePageChanged(msg) + case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) + case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) + case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) + case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) + case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) + case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) + case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) + + case _ => // do nothing + } + + private def buildUserHashMap(user: UserVO): java.util.HashMap[String, Object] = { + val vu = user.voiceUser + val vuser = new java.util.HashMap[String, Object]() + vuser.put(Constants.USER_ID, vu.userId) + vuser.put(Constants.WEB_USER_ID, vu.webUserId) + vuser.put(Constants.CALLER_ID_NAME, vu.callerName) + vuser.put(Constants.CALLER_ID_NUM, vu.callerNum) + vuser.put(Constants.JOINED, vu.joined: java.lang.Boolean) + vuser.put(Constants.LOCKED, vu.locked: java.lang.Boolean) + vuser.put(Constants.MUTED, vu.muted: java.lang.Boolean) + vuser.put(Constants.TALKING, vu.talking: java.lang.Boolean) + + val wuser = new java.util.HashMap[String, Object]() + wuser.put(Constants.USER_ID, user.userID) + wuser.put(Constants.EXT_USER_ID, user.externUserID) + wuser.put(Constants.NAME, user.name) + wuser.put(Constants.ROLE, user.role.toString()) + wuser.put(Constants.RAISE_HAND, user.raiseHand: java.lang.Boolean) + wuser.put(Constants.PRESENTER, user.presenter: java.lang.Boolean) + wuser.put(Constants.HAS_STREAM, user.hasStream: java.lang.Boolean) + wuser.put(Constants.LOCKED, user.locked: java.lang.Boolean) + wuser.put("webcamStream", user.webcamStreams mkString ("|")) + wuser.put(Constants.PHONE_USER, user.phoneUser: java.lang.Boolean) + wuser.put(Constants.VOICE_USER, vuser) + + wuser + } + + private def buildJson(header: java.util.HashMap[String, Any], + payload: java.util.HashMap[String, Any]): String = { + + val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() + message.put(Constants.HEADER, header) + message.put(Constants.PAYLOAD, payload) + + val gson = new Gson() + gson.toJson(message) + } + + // IN MESSAGES + private def handleCreateMeeting(msg: CreateMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) + payload.put(Constants.MEETING_NAME, msg.meetingName) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.VOICE_CONF, msg.voiceBridge) + payload.put(Constants.DURATION, msg.duration) + payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) + payload.put(Constants.VIEWER_PASS, msg.viewerPass) + payload.put(Constants.CREATE_TIME, msg.createTime) + payload.put(Constants.CREATE_DATE, msg.createDate) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CREATE_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CREATE MEETING *****************") + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleInitializeMeeting(msg: InitializeMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.INITIALIZE_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING INITIALIZE MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleDestroyMeeting(msg: DestroyMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DESTROY_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DESTROY MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStartMeeting(msg: StartMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.START_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING START MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEndMeeting(msg: EndMeeting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING END MEETING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockSetting(msg: LockSetting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.LOCKED, msg.locked) + + val settingsMap = new java.util.HashMap[String, Boolean]() + for ((key, value) <- msg.settings) { + settingsMap.put(key, value) + } + + payload.put("settings", settingsMap) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING LOCK SETTING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockUser(msg: LockUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCK, msg.lock) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_MEETING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING LOCK USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleInitLockSettings(msg: InitLockSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.settings.toString()) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.INIT_LOCK_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING INIT LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleInitAudioSettings(msg: InitAudioSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MUTED, msg.muted.toString()) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.INIT_AUDIO_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING INIT LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSetLockSettings(msg: SetLockSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.settings.toString()) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SET_LOCK_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SET LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetLockSettings(msg: GetLockSettings) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_LOCK_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET LOCK SETTINGS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleValidateAuthToken(msg: ValidateAuthToken) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.AUTH_TOKEN, msg.token) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VALIDATE AUTH TOKEN *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleRegisterUser(msg: RegisterUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.NAME, msg.name) + payload.put(Constants.ROLE, msg.role.toString()) + payload.put(Constants.EXT_USER_ID, msg.extUserID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.REGISTER_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING REGISTER USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserJoining(msg: UserJoining) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_JOINING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HANDLE USER JOINING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLeaving(msg: UserLeaving) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LEAVING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HANDLE USER LEAVING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetUsers(msg: GetUsers) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_USERS) + + /** + * Let's temporarily have this convention as correlationId + */ + val replyTo = msg.meetingID + "/" + msg.requesterID + header.put(Constants.REPLY_TO, replyTo) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING HANDLE GET USERS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserRaiseHand(msg: UserRaiseHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.RAISE_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER RAISE HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLowerHand(msg: UserLowerHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOWERED_BY, msg.loweredBy) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.LOWER_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LOWER HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserShareWebcam(msg: UserShareWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.STREAM, msg.stream) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_SHARE_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER SHARE WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserUnshareWebcam(msg: UserUnshareWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_UNSHARE_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER UNSHARE WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleChangeUserStatus(msg: ChangeUserStatus) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STATUS, msg.status) + payload.put(Constants.VALUE, msg.value) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CHANGE_USER_STATUS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CHANGE USER STATUS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleAssignPresenter(msg: AssignPresenter) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.NEW_PRESENTER_ID, msg.newPresenterID) + payload.put(Constants.NEW_PRESENTER_NAME, msg.newPresenterName) + payload.put(Constants.ASSIGNED_BY, msg.assignedBy) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.ASSIGN_PRESENTER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING ASSIGN PRESENTER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSetRecordingStatus(msg: SetRecordingStatus) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SET_RECORDING_STATUS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SET RECORDING STATUS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_CHAT_HISTORY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET CHAT HISTORY REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val messageMap = new java.util.HashMap[String, String]() + for ((key, value) <- msg.message) { + messageMap.put(key, value) + } + payload.put("message", messageMap) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_PUBLIC_MESSAGE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND PUBLIC MESSAGE REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val messageMap = new java.util.HashMap[String, String]() + for ((key, value) <- msg.message) { + messageMap.put(key, value) + } + payload.put("message", messageMap) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_PRIVATE_CHAT_MESSAGE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND PRIVATE MESSAGE REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET CURRENT LAYOUT REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.LAYOUT, msg.layout) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockLayoutRequest(msg: LockLayoutRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.setById) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.UNLOCK_LAYOUT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearPresentation(msg: ClearPresentation) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CLEAR_PRESENTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CLEAR PRESENTATION *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleRemovePresentation(msg: RemovePresentation) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.REMOVE_PRESENTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING REMOVE PRESENTATION *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPresentationInfo(msg: GetPresentationInfo) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_PRESENTATION_INFO) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET PRESENTATION INFO *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + /*private def handleSendCursorUpdate(msg: SendCursorUpdate) { + var map = new java.util.HashMap[String, Any]() + map.put("meetingID", msg.meetingID) + map.put("xPercent", msg.xPercent) + map.put("yPercent", msg.yPercent) + map.put("timestamp", TimestampGenerator.generateTimestamp) + + println("***** DISPATCHING SEND CURSOR UPDATE *****************") + dispatcher.dispatch(buildJson(header, payload)) + }*/ + + private def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.X_OFFSET, msg.xOffset) + payload.put(Constants.Y_OFFSET, msg.yOffset) + payload.put(Constants.WIDTH_RATIO, msg.widthRatio) + payload.put(Constants.HEIGHT_RATIO, msg.heightRatio) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.RESIZE_AND_MOVE_SLIDE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING RESIZE AND MOVE SLIDE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGotoSlide(msg: GotoSlide) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, msg.page) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GO_TO_SLIDE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GO TO SLIDE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSharePresentation(msg: SharePresentation) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationID) + payload.put(Constants.SHARE, msg.share) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SHARE_PRESENTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SHARE PRESENTATION *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetSlideInfo(msg: GetSlideInfo) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_SLIDE_INFO) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET SLIDE INFO *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePreuploadedPresentations(msg: PreuploadedPresentations) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATIONS, msg.presentations.toString()) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PREUPLOADED_PRESENTATIONS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PREUPLOADED PRESENTATIONS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presName) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_UPDATE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION CONVERSION UPDATE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationPageCountError(msg: PresentationPageCountError) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_COUNT_ERROR) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION PAGE COUNT ERROR *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_PAGE_GENERATED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION SLIDE GENERATED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentation) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTATION_CONVERSION_COMPLETED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTATION CONVERSION COMPLETED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendVoiceUsersRequest(msg: SendVoiceUsersRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_VOICE_USERS_REQUEST) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND VOICE USERS REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleMuteMeetingRequest(msg: MuteMeetingRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTE, msg.mute) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.MUTE_MEETING_REQUEST) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING MUTE MEETING REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING IS MEETING MUTED REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleMuteUserRequest(msg: MuteUserRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.MUTE, msg.mute) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.MUTE_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING MUTE USER REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleLockUserRequest(msg: LockUserRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LOCK, msg.lock) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.LOCK_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING LOCK USER REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEjectUserFromVoiceRequest(msg: EjectUserFromVoiceRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.ejectedBy) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.EJECT_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING EJECT USER REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserJoinedMessage(msg: VoiceUserJoinedMessage) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.voiceConfId) + payload.put(Constants.CALLER_ID_NUM, msg.callerIdNum) + payload.put(Constants.CALLER_ID_NAME, msg.callerIdName) + payload.put(Constants.MUTED, msg.muted) + payload.put(Constants.TALKING, msg.talking) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED_MESSAGE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER JOINED MESSAGE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserJoined(msg: VoiceUserJoined) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.VOICE_USER, msg.voiceUser) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_JOINED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER JOINED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserLeft(msg: VoiceUserLeft) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_LEFT) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER LEFT *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserLocked(msg: VoiceUserLocked) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCKED, msg.locked) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_LOCKED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER LOCKED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserMuted(msg: VoiceUserMuted) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.MUTED, msg.muted) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_MUTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER MUTED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceUserTalking(msg: VoiceUserTalking) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.TALKING, msg.talking) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_USER_TALKING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE USER TALKING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleVoiceRecording(msg: VoiceRecording) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDING_FILE, msg.recordingFile) + payload.put(Constants.TIMESTAMP, msg.timestamp) + payload.put(Constants.RECORDING, msg.recording) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VOICE_RECORDING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VOICE RECORDING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ANNOTATION, msg.annotation) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.SEND_WHITEBOARD_ANNOTATION) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND WHITEBOARD ANNOTATION REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_WHITEBOARD_SHAPES) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING SEND WHITEBOARD SHAPES REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.CLEAR_WHITEBOARD) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING CLEAR WHITEBOARD REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.UNDO_WHITEBOARD) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING UNDO WHITEBOARD REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ENABLE, msg.enable) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.ENABLE_WHITEBOARD) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING ENABLE WHITEBOARD REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.IS_WHITEBOARD_ENABLED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING IS WHITEBOARD ENABLED REQUEST *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetAllMeetingsRequest(msg: GetAllMeetingsRequest) { + println("***** DISPATCHING GET ALL MEETINGS REQUEST *****************") + } + + // OUT MESSAGES + private def handleMeetingCreated(msg: MeetingCreated) { + val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { + val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { + val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { + val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handleMeetingEnded(msg: MeetingEnded) { + val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleMeetingHasEnded(msg: MeetingHasEnded) { + val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DISCONNECT_ALL_USERS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DISCONNECT ALL USERS *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleDisconnectUser(msg: DisconnectUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.DISCONNECT_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING DISCONNECT USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PERMISSION_SETTING_INITIALIZED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PERMISSIONS SETTING INIIALIZED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.NEW_PERMISSION_SETTINGS) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING NEW PERMISSIONS SETTING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLocked(msg: UserLocked) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCKED, msg.lock) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LOCKED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LOCKED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_PERMISSION_SETTINGS_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserRegistered(msg: UserRegistered) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_REGISTERED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER REGISTERED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLeft(msg: UserLeft) { + val json = UsersMessageToJsonConverter.userLeftToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresenterAssigned(msg: PresenterAssigned) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); + payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); + payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.PRESENTER_ASSIGNED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING PRESENTER ASSIGNED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEndAndKickAll(msg: EndAndKickAll) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.END_AND_KICK_ALL) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING END AND KICK ALL *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetUsersReply(msg: GetUsersReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val users = new ArrayList[java.util.HashMap[String, Object]]; + msg.users.foreach(uvo => { + users.add(buildUserHashMap(uvo)) + }) + + payload.put(Constants.USERS, users) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_USERS_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET USERS REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterId) + payload.put(Constants.AUTH_TOKEN, msg.token) + payload.put(Constants.VALID, msg.valid) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.VALIDATE_AUTH_TOKEN_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING VALIDATE AUTH TOKEN REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserJoined(msg: UserJoined) { + val json = UsersMessageToJsonConverter.userJoinedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleUserRaisedHand(msg: UserRaisedHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_RAISED_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER RAISED HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLoweredHand(msg: UserLoweredHand) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LOWERED_BY, msg.loweredBy) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LOWERED_HAND) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LOWERED HAND *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserSharedWebcam(msg: UserSharedWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_SHARED_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER SHARED WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_UNSHARED_WEBCAM) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER UNSHARED WEBCAM *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserStatusChange(msg: UserStatusChange) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STATUS, msg.status) + payload.put(Constants.VALUE, msg.value) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_STATUS_CHANGED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER STATUS CHANGE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTE, msg.mute) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.MUTE_VOICE_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING MUTE VOICE USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserVoiceMuted(msg: UserVoiceMuted) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_VOICE_MUTED) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER VOICE MUTED *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserVoiceTalking(msg: UserVoiceTalking) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_VOICE_TALKING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER VOICE TALKING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.EJECT_VOICE_USER) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING EJECT VOICE USER *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_JOINED_VOICE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER JOINED VOICE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, msg.user.toString()) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.USER_LEFT_VOICE) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING USER LEFT VOICE *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTED, msg.meetingMuted) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.IS_MEETING_MUTED_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING IS MEETING MUTED REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStartRecording(msg: StartRecording) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.START_RECORDING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING START RECORDING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleStopRecording(msg: StopRecording) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.STOP_RECORDING) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING STOP RECORDING *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { + val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { + val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetCurrentLayoutReply(msg: GetCurrentLayoutReply) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.LAYOUT_ID, msg.layoutID) + payload.put(Constants.LOCKED, msg.locked) + payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.GET_CURRENT_LAYOUT_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING GET CURRENT LAYOUT REPLY *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleBroadcastLayoutEvent(msg: BroadcastLayoutEvent) { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.LAYOUT_ID, msg.layoutID) + payload.put(Constants.LOCKED, msg.locked) + payload.put(Constants.SET_BY_USER_ID, msg.setByUserID) + + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT_REPLY) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + + // println("***** DISPATCHING BROADCAST LAYOUT EVENT *****************") + dispatcher.dispatch(buildJson(header, payload)) + } + + private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { + val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.removePresentationOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { + val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) + // Comment out as we don't want to store cursor updates (ralam may 7, 2014) + //dispatcher.dispatch(json) + } + + private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { + val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { + val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { + val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { + val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationConversionError(msg: PresentationConversionError) { + val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { + val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationConversionDone(msg: PresentationConversionDone) { + val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationChanged(msg: PresentationChanged) { + val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { + val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePresentationRemoved(msg: PresentationRemoved) { + val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) + dispatcher.dispatch(json) + } + + private def handlePageChanged(msg: PageChanged) { + val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) + dispatcher.dispatch(json) + } + + private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { + val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) + dispatcher.dispatch(json) + } + + private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { + val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { + val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) + dispatcher.dispatch(json) + } + + private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { + val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) + dispatcher.dispatch(json) + } + private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { + val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) + println("***** DISPATCHING GET ALL MEETINGS REPLY OUTMSG *****************") + dispatcher.dispatch(json) + } +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala new file mode 100755 index 0000000000..c81112dd8e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorGateway.scala @@ -0,0 +1,22 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api.IDispatcher +import org.bigbluebutton.core.api.InMessage +import org.bigbluebutton.core.api.IOutMessage +import org.bigbluebutton.core.api.OutMessageListener2 + +class CollectorGateway(dispatcher: IDispatcher) extends OutMessageListener2 { + + // FIXME + // private val collActor = new CollectorActor(dispatcher) + + // collActor.start + + def collectInMessage(msg: InMessage) { + // collActor ! msg + } + + def handleMessage(msg: IOutMessage) { + // collActor ! msg + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala new file mode 100755 index 0000000000..0897ae2438 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -0,0 +1,245 @@ +package org.bigbluebutton.core + +import akka.actor.Actor +import akka.actor.ActorRef +import akka.actor.ActorLogging +import akka.actor.Props +import org.bigbluebutton.core.apps.users.UsersApp +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.apps.presentation.PresentationApp +import org.bigbluebutton.core.apps.layout.LayoutApp +import org.bigbluebutton.core.apps.chat.ChatApp +import org.bigbluebutton.core.apps.whiteboard.WhiteboardApp +import java.util.concurrent.TimeUnit +import org.bigbluebutton.core.util._ + +case object StopMeetingActor + +object MeetingActor { + def props(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, + voiceBridge: String, duration: Long, + autoStartRecording: Boolean, allowStartStopRecording: Boolean, + moderatorPass: String, viewerPass: String, + createTime: Long, createDate: String, + outGW: MessageOutGateway): Props = + Props(classOf[MeetingActor], meetingID, externalMeetingID, meetingName, recorded, + voiceBridge, duration, + autoStartRecording, allowStartStopRecording, + moderatorPass, viewerPass, + createTime, createDate, + outGW) +} + +class MeetingActor(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, + val voiceBridge: String, duration: Long, + val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, + val moderatorPass: String, val viewerPass: String, + val createTime: Long, val createDate: String, + val outGW: MessageOutGateway) + extends Actor with UsersApp with PresentationApp + with LayoutApp with ChatApp + with WhiteboardApp with ActorLogging { + + var audioSettingsInited = false + var permissionsInited = false + var permissions = new Permissions() + var recording = false; + var muted = false; + var meetingEnded = false + + val TIMER_INTERVAL = 30000 + var hasLastWebUserLeft = false + var lastWebUserLeftOn: Long = 0 + + // FIXME + // class TimerActor(val timeout: Long, val who: Actor, val reply: String) extends Actor { + // def act { + // reactWithin(timeout) { + // case TIMEOUT => who ! reply + // } + // } + // } + + def receive = { + case "StartTimer" => handleStartTimer + case "Hello" => handleHello + case "MonitorNumberOfWebUsers" => handleMonitorNumberOfWebUsers() + case msg: ValidateAuthToken => handleValidateAuthToken(msg) + case msg: RegisterUser => handleRegisterUser(msg) + case msg: VoiceUserJoined => handleVoiceUserJoined(msg) + case msg: VoiceUserLeft => handleVoiceUserLeft(msg) + case msg: VoiceUserMuted => handleVoiceUserMuted(msg) + case msg: VoiceUserTalking => handleVoiceUserTalking(msg) + case msg: UserJoining => handleUserJoin(msg) + case msg: UserLeaving => handleUserLeft(msg) + case msg: AssignPresenter => handleAssignPresenter(msg) + case msg: GetUsers => handleGetUsers(msg) + case msg: ChangeUserStatus => handleChangeUserStatus(msg) + case msg: EjectUserFromMeeting => handleEjectUserFromMeeting(msg) + case msg: UserRaiseHand => handleUserRaiseHand(msg) + case msg: UserLowerHand => handleUserLowerHand(msg) + case msg: UserShareWebcam => handleUserShareWebcam(msg) + case msg: UserUnshareWebcam => handleUserunshareWebcam(msg) + case msg: MuteMeetingRequest => handleMuteMeetingRequest(msg) + case msg: MuteAllExceptPresenterRequest => handleMuteAllExceptPresenterRequest(msg) + case msg: IsMeetingMutedRequest => handleIsMeetingMutedRequest(msg) + case msg: MuteUserRequest => handleMuteUserRequest(msg) + case msg: EjectUserFromVoiceRequest => handleEjectUserRequest(msg) + case msg: SetLockSettings => handleSetLockSettings(msg) + case msg: GetLockSettings => handleGetLockSettings(msg) + case msg: LockUserRequest => handleLockUserRequest(msg) + case msg: InitLockSettings => handleInitLockSettings(msg) + case msg: InitAudioSettings => handleInitAudioSettings(msg) + case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) + case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) + case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) + case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) + case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) + case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) + case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) + case msg: InitializeMeeting => handleInitializeMeeting(msg) + case msg: ClearPresentation => handleClearPresentation(msg) + case msg: PresentationConversionUpdate => handlePresentationConversionUpdate(msg) + case msg: PresentationPageCountError => handlePresentationPageCountError(msg) + case msg: PresentationSlideGenerated => handlePresentationSlideGenerated(msg) + case msg: PresentationConversionCompleted => handlePresentationConversionCompleted(msg) + case msg: RemovePresentation => handleRemovePresentation(msg) + case msg: GetPresentationInfo => handleGetPresentationInfo(msg) + case msg: SendCursorUpdate => handleSendCursorUpdate(msg) + case msg: ResizeAndMoveSlide => handleResizeAndMoveSlide(msg) + case msg: GotoSlide => handleGotoSlide(msg) + case msg: SharePresentation => handleSharePresentation(msg) + case msg: GetSlideInfo => handleGetSlideInfo(msg) + case msg: PreuploadedPresentations => handlePreuploadedPresentations(msg) + case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) + case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) + case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) + case msg: UndoWhiteboardRequest => handleUndoWhiteboardRequest(msg) + case msg: EnableWhiteboardRequest => handleEnableWhiteboardRequest(msg) + case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) + case msg: SetRecordingStatus => handleSetRecordingStatus(msg) + case msg: GetRecordingStatus => handleGetRecordingStatus(msg) + case msg: VoiceRecording => handleVoiceRecording(msg) + + case msg: EndMeeting => handleEndMeeting(msg) + case StopMeetingActor => //exit + case _ => // do nothing + } + + def hasMeetingEnded(): Boolean = { + meetingEnded + } + + private def handleStartTimer() { + // println("***************timer started******************") + // val timerActor = new TimerActor(2000, self, "Hello") + // timerActor.start + } + + private def handleHello() { + // println("***************hello received on [" + System.currentTimeMillis() + "]******************") + + // val timerActor = new TimerActor(2000, self, "Hello") + // timerActor.start + } + + def webUserJoined() { + if (users.numWebUsers > 0) { + lastWebUserLeftOn = 0 + } + } + + def startRecordingIfAutoStart() { + if (recorded && !recording && autoStartRecording && users.numWebUsers == 1) { + log.info("Auto start recording for meeting=[" + meetingID + "]") + recording = true + outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) + } + } + + def stopAutoStartedRecording() { + if (recorded && recording && autoStartRecording + && users.numWebUsers == 0) { + log.info("Last web user left. Auto stopping recording for meeting=[{}", meetingID) + recording = false + outGW.send(new RecordingStatusChanged(meetingID, recorded, "system", recording)) + } + } + + def startCheckingIfWeNeedToEndVoiceConf() { + if (users.numWebUsers == 0) { + lastWebUserLeftOn = timeNowInMinutes + log.debug("MonitorNumberOfWebUsers started for meeting [" + meetingID + "]") + scheduleEndVoiceConference() + } + } + + def handleMonitorNumberOfWebUsers() { + if (users.numWebUsers == 0 && lastWebUserLeftOn > 0) { + if (timeNowInMinutes - lastWebUserLeftOn > 2) { + log.info("MonitorNumberOfWebUsers empty for meeting [" + meetingID + "]. Ejecting all users from voice.") + outGW.send(new EjectAllVoiceUsers(meetingID, recorded, voiceBridge)) + } else { + scheduleEndVoiceConference() + } + } + } + + private def scheduleEndVoiceConference() { + log.debug("MonitorNumberOfWebUsers continue for meeting [" + meetingID + "]") + // val timerActor = new TimerActor(TIMER_INTERVAL, self, "MonitorNumberOfWebUsers") + // timerActor.start + } + + def timeNowInMinutes(): Long = { + TimeUnit.NANOSECONDS.toMinutes(System.nanoTime()) + } + + def sendMeetingHasEnded(userId: String) { + outGW.send(new MeetingHasEnded(meetingID, userId)) + outGW.send(new DisconnectUser(meetingID, userId)) + } + + private def handleEndMeeting(msg: EndMeeting) { + meetingEnded = true + outGW.send(new MeetingEnded(msg.meetingID, recorded, voiceBridge)) + outGW.send(new DisconnectAllUsers(msg.meetingID)) + } + + private def handleVoiceRecording(msg: VoiceRecording) { + if (msg.recording) { + outGW.send(new VoiceRecordingStarted(meetingID, + recorded, msg.recordingFile, + msg.timestamp, voiceBridge)) + } else { + outGW.send(new VoiceRecordingStopped(meetingID, recorded, + msg.recordingFile, msg.timestamp, voiceBridge)) + } + } + + private def handleSetRecordingStatus(msg: SetRecordingStatus) { + log.debug("Change recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") + if (allowStartStopRecording && recording != msg.recording) { + recording = msg.recording + log.debug("Sending recording status for meeting [" + meetingID + "], recording=[" + msg.recording + "]") + outGW.send(new RecordingStatusChanged(meetingID, recorded, msg.userId, msg.recording)) + } + } + + private def handleGetRecordingStatus(msg: GetRecordingStatus) { + outGW.send(new GetRecordingStatusReply(meetingID, recorded, msg.userId, recording.booleanValue())) + } + + def lockLayout(lock: Boolean) { + permissions = permissions.copy(lockedLayout = lock) + } + + def newPermissions(np: Permissions) { + permissions = np + } + + def permissionsEqual(other: Permissions): Boolean = { + permissions == other + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala new file mode 100755 index 0000000000..a20089f91b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/RunningMeeting.scala @@ -0,0 +1,35 @@ +package org.bigbluebutton.core + +import akka.actor.ActorRef +import akka.actor.ActorContext +import org.bigbluebutton.core.api.MessageOutGateway + +object RunningMeeting { + def apply(meetingID: String, externalMeetingID: String, meetingName: String, recorded: Boolean, + voiceBridge: String, duration: Long, + autoStartRecording: Boolean, allowStartStopRecording: Boolean, + moderatorPass: String, viewerPass: String, + createTime: Long, createDate: String, + outGW: MessageOutGateway)(implicit context: ActorContext) = + new RunningMeeting(meetingID, externalMeetingID, meetingName, recorded, + voiceBridge, duration, + autoStartRecording, allowStartStopRecording, + moderatorPass, viewerPass, + createTime, createDate, + outGW)(context) +} + +class RunningMeeting(val meetingID: String, val externalMeetingID: String, val meetingName: String, val recorded: Boolean, + val voiceBridge: String, val duration: Long, + val autoStartRecording: Boolean, val allowStartStopRecording: Boolean, + val moderatorPass: String, val viewerPass: String, + val createTime: Long, val createDate: String, + val outGW: MessageOutGateway)(implicit val context: ActorContext) { + + val actorRef = context.actorOf(MeetingActor.props(meetingID, externalMeetingID, meetingName, recorded, + voiceBridge, duration, + autoStartRecording, allowStartStopRecording, + moderatorPass, viewerPass, + createTime, createDate, + outGW), meetingID) +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala new file mode 100755 index 0000000000..66d8192f65 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala @@ -0,0 +1,20 @@ +package org.bigbluebutton.core + +import com.typesafe.config.ConfigFactory +import scala.util.Try + +trait SystemConfiguration { + + val config = ConfigFactory.load() + + lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") + + lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) + + lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") + + lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) + + lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") + lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala new file mode 100755 index 0000000000..d12357c29b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/User.scala @@ -0,0 +1,29 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.core.api.UserVO +import org.bigbluebutton.core.api.Role._ + +class User(val intUserID: String, val extUserID: String, val name: String, val role: Role) { + + private var presenter = false + private var handRaised = false + private var hasStream = false + private var voiceId: String = _ + private var muted = false + private var talking = false + private var locked = false + + def isPresenter(): Boolean = { + return presenter; + } + + def becomePresenter() { + presenter = true + } + + def unbecomePresenter() { + presenter = false + } +} + +case class VoiceUser(userId: String, muted: Boolean = false, talking: Boolean = false, locked: Boolean = false) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala new file mode 100755 index 0000000000..df46b038da --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ConsoleDispatcher.scala @@ -0,0 +1,8 @@ +package org.bigbluebutton.core.api + +class ConsoleDispatcher extends IDispatcher { + + def dispatch(jsonMessage: String) { + println(jsonMessage) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala new file mode 100755 index 0000000000..867bec3a53 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala @@ -0,0 +1,97 @@ +package org.bigbluebutton.core.api + +object Constants { + val NAME = "name" + val HEADER = "header" + val PAYLOAD = "payload" + val MEETING_ID = "meeting_id" + val EXTERNAL_MEETING_ID = "external_meeting_id" + val TIMESTAMP = "timestamp" + val CURRENT_TIME = "current_time" + val USER_ID = "userid" + val RECORDED = "recorded" + val MEETING_NAME = "meeting_name" + val MEETING_MUTED = "meetingMuted" + val VOICE_CONF = "voice_conf" + val DURATION = "duration" + val AUTH_TOKEN = "auth_token" + val ROLE = "role" + val EXT_USER_ID = "external_user_id" + val REQUESTER_ID = "requester_id" + val REPLY_TO = "reply_to" + val LOWERED_BY = "lowered_by" + val STREAM = "stream" + val LOCKED = "locked" + val SETTINGS = "settings" + val LOCK = "lock" + val EXCEPT_USERS = "except_users" + val STATUS = "status" + val VALUE = "value" + val NEW_PRESENTER_ID = "new_presenter_id" + val NEW_PRESENTER_NAME = "new_presenter_name" + val ASSIGNED_BY = "assigned_by" + val RECORDING = "recording" + val LAYOUT_ID = "layout_id" + val LAYOUT = "layout" + val POLL = "poll" + val POLL_ID = "poll_id" + val FORCE = "force" + val RESPONSE = "response" + val PRESENTATION_ID = "presentation_id" + val X_OFFSET = "x_offset" + val Y_OFFSET = "y_offset" + val WIDTH_RATIO = "width_ratio" + val HEIGHT_RATIO = "height_ratio" + val PAGE = "page" + val SHARE = "share" + val PRESENTATIONS = "presentations" + val MESSAGE_KEY = "message_key" + val CODE = "code" + val PRESENTATION_NAME = "presentation_name" + val NUM_PAGES = "num_pages" + val MAX_NUM_PAGES = "max_num_pages" + val PAGES_COMPLETED = "pages_completed" + val MUTE = "mute" + val CALLER_ID_NUM = "caller_id_num" + val CALLER_ID_NAME = "caller_id_name" + val TALKING = "talking" + val USER = "user" + val MUTED = "muted" + val VOICE_USER = "voice_user" + val RECORDING_FILE = "recording_file" + val ANNOTATION = "annotation" + val WHITEBOARD_ID = "whiteboard_id" + val ENABLE = "enable" + val PRESENTER = "presenter" + val USERS = "users" + val RAISE_HAND = "raise_hand" + val HAS_STREAM = "has_stream" + val WEBCAM_STREAM = "webcam_stream" + val PHONE_USER = "phone_user" + val PERMISSIONS = "permissions" + val VALID = "valid" + val CHAT_HISTORY = "chat_history" + val MESSAGE = "message" + val SET_BY_USER_ID = "set_by_user_id" + val POLLS = "polls" + val REASON = "reason" + val RESPONDER = "responder" + val PRESENTATION_INFO = "presentation_info" + val SHAPES = "shapes" + val SHAPE = "shape" + val SHAPE_ID = "shape_id" + val PRESENTATION = "presentation" + val ID = "id" + val CURRENT = "current" + val PAGES = "pages" + val WEB_USER_ID = "web_user_id" + val JOINED = "joined" + val X_PERCENT = "x_percent" + val Y_PERCENT = "y_percent" + val KEEP_ALIVE_ID = "keep_alive_id" + val LISTEN_ONLY = "listen_only" + val MODERATOR_PASS = "moderator_pass" + val VIEWER_PASS = "viewer_pass" + val CREATE_TIME = "create_time" + val CREATE_DATE = "create_date" +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala new file mode 100755 index 0000000000..6b93e92e35 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -0,0 +1,376 @@ +package org.bigbluebutton.core.api + +import org.bigbluebutton.core.api.Role._ +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import org.bigbluebutton.core.apps.presentation.Presentation + +trait InMessage { val meetingID: String } + +case class IsMeetingActorAliveMessage( + meetingId: String) + +case class KeepAliveMessage( + aliveID: String) + +case class CreateMeeting( + meetingID: String, + externalMeetingID: String, + meetingName: String, + recorded: Boolean, + voiceBridge: String, + duration: Long, + autoStartRecording: Boolean, + allowStartStopRecording: Boolean, + moderatorPass: String, + viewerPass: String, + createTime: Long, + createDate: String) extends InMessage + +case class InitializeMeeting( + meetingID: String, + recorded: Boolean) extends InMessage + +case class DestroyMeeting( + meetingID: String) extends InMessage + +case class StartMeeting( + meetingID: String) extends InMessage + +case class EndMeeting( + meetingID: String) extends InMessage + +case class LockSetting( + meetingID: String, + locked: Boolean, + settings: Map[String, Boolean]) extends InMessage + +// Lock +case class LockUser( + meetingID: String, + userId: String, + lock: Boolean) extends InMessage + +case class InitLockSettings( + meetingID: String, + settings: Permissions) extends InMessage + +case class SetLockSettings( + meetingID: String, + setByUser: String, + settings: Permissions) extends InMessage + +case class GetLockSettings( + meetingID: String, + userId: String) extends InMessage + +// Users +case class ValidateAuthToken( + meetingID: String, + userId: String, + token: String, + correlationId: String, + sessionId: String) extends InMessage + +case class RegisterUser( + meetingID: String, + userID: String, + name: String, + role: Role, + extUserID: String, + authToken: String) extends InMessage + +case class UserJoining( + meetingID: String, + userID: String, + authToken: String) extends InMessage + +case class UserLeaving( + meetingID: String, + userID: String, + sessionId: String) extends InMessage + +case class GetUsers( + meetingID: String, + requesterID: String) extends InMessage + +case class UserRaiseHand( + meetingID: String, + userId: String) extends InMessage + +case class UserLowerHand( + meetingID: String, + userId: String, + loweredBy: String) extends InMessage + +case class EjectUserFromMeeting(meetingID: String, userId: String, ejectedBy: String) extends InMessage + +case class UserShareWebcam( + meetingID: String, + userId: String, + stream: String) extends InMessage + +case class UserUnshareWebcam( + meetingID: String, + userId: String, + stream: String) extends InMessage + +case class ChangeUserStatus( + meetingID: String, + userID: String, + status: String, + value: Object) extends InMessage + +case class AssignPresenter( + meetingID: String, + newPresenterID: String, + newPresenterName: String, + assignedBy: String) extends InMessage + +case class SetRecordingStatus( + meetingID: String, + userId: String, + recording: Boolean) extends InMessage + +case class GetRecordingStatus( + meetingID: String, + userId: String) extends InMessage + +// Chat +case class GetChatHistoryRequest( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class SendPublicMessageRequest( + meetingID: String, + requesterID: String, + message: Map[String, String]) extends InMessage + +case class SendPrivateMessageRequest( + meetingID: String, + requesterID: String, + message: Map[String, String]) extends InMessage + +case class UserConnectedToGlobalAudio( + meetingID: String, + /** Not used. Just to satisfy trait **/ + voiceConf: String, + userid: String, + name: String) extends InMessage + +case class UserDisconnectedFromGlobalAudio( + meetingID: String, + /** Not used. Just to satisfy trait **/ + voiceConf: String, + userid: String, + name: String) extends InMessage + +// Layout +case class GetCurrentLayoutRequest( + meetingID: String, + requesterID: String) extends InMessage + +case class SetLayoutRequest( + meetingID: String, + requesterID: String, + layoutID: String) extends InMessage + +case class LockLayoutRequest( + meetingID: String, + setById: String, + lock: Boolean, + viewersOnly: Boolean, + layout: Option[String]) extends InMessage + +case class BroadcastLayoutRequest( + meetingID: String, + requesterID: String, + layout: String) extends InMessage + +// Presentation +case class ClearPresentation( + meetingID: String) extends InMessage + +case class RemovePresentation( + meetingID: String, + presentationID: String) extends InMessage + +case class GetPresentationInfo( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class SendCursorUpdate( + meetingID: String, + xPercent: Double, + yPercent: Double) extends InMessage + +case class ResizeAndMoveSlide( + meetingID: String, + xOffset: Double, + yOffset: Double, + widthRatio: Double, + heightRatio: Double) extends InMessage + +case class GotoSlide( + meetingID: String, + page: String) extends InMessage + +case class SharePresentation( + meetingID: String, + presentationID: String, + share: Boolean) extends InMessage + +case class GetSlideInfo( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class PreuploadedPresentations( + meetingID: String, + presentations: Seq[Presentation]) extends InMessage + +case class PresentationConversionUpdate( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + presName: String) extends InMessage + +case class PresentationPageCountError( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + maxNumberPages: Int, + presName: String) extends InMessage + +case class PresentationSlideGenerated( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + pagesCompleted: Int, + presName: String) extends InMessage + +case class PresentationConversionCompleted( + meetingID: String, + messageKey: String, + code: String, + presentation: Presentation) extends InMessage + +// Voice +case class InitAudioSettings( + meetingID: String, + requesterID: String, + muted: Boolean) extends InMessage + +case class SendVoiceUsersRequest( + meetingID: String, + requesterID: String) extends InMessage + +case class MuteAllExceptPresenterRequest( + meetingID: String, + requesterID: String, + mute: Boolean) extends InMessage + +case class MuteMeetingRequest( + meetingID: String, + requesterID: String, + mute: Boolean) extends InMessage + +case class IsMeetingMutedRequest( + meetingID: String, + requesterID: String) extends InMessage + +case class MuteUserRequest( + meetingID: String, + requesterID: String, + userID: String, + mute: Boolean) extends InMessage + +case class LockUserRequest( + meetingID: String, + requesterID: String, + userID: String, + lock: Boolean) extends InMessage + +case class EjectUserFromVoiceRequest( + meetingID: String, + userId: String, + ejectedBy: String) extends InMessage + +case class VoiceUserJoinedMessage( + meetingID: String, + user: String, + voiceConfId: String, + callerIdNum: String, + callerIdName: String, + muted: Boolean, + talking: Boolean) extends InMessage + +case class VoiceUserJoined( + meetingID: String, + voiceUser: VoiceUser) extends InMessage + +case class VoiceUserLeft( + meetingID: String, + userId: String) extends InMessage + +case class VoiceUserLocked( + meetingID: String, + userId: String, + locked: Boolean) extends InMessage + +case class VoiceUserMuted( + meetingID: String, + userId: String, + muted: Boolean) extends InMessage + +case class VoiceUserTalking( + meetingID: String, + userId: String, + talking: Boolean) extends InMessage + +case class VoiceRecording( + meetingID: String, + recordingFile: String, + timestamp: String, + recording: Boolean) extends InMessage + +// Whiteboard +case class SendWhiteboardAnnotationRequest( + meetingID: String, + requesterID: String, + annotation: AnnotationVO) extends InMessage + +case class GetWhiteboardShapesRequest( + meetingID: String, + requesterID: String, + whiteboardId: String, + replyTo: String) extends InMessage + +case class ClearWhiteboardRequest( + meetingID: String, + requesterID: String, + whiteboardId: String) extends InMessage + +case class UndoWhiteboardRequest( + meetingID: String, + requesterID: String, + whiteboardId: String) extends InMessage + +case class EnableWhiteboardRequest( + meetingID: String, + requesterID: String, + enable: Boolean) extends InMessage + +case class IsWhiteboardEnabledRequest( + meetingID: String, + requesterID: String, + replyTo: String) extends InMessage + +case class GetAllMeetingsRequest( + meetingID: String /** Not used. Just to satisfy trait **/ ) extends InMessage diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala new file mode 100755 index 0000000000..b202969944 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala @@ -0,0 +1,167 @@ +package org.bigbluebutton.core.api + +object MessageNames { + val CREATE_MEETING = "create_meeting_request" + val INITIALIZE_MEETING = "initialize_meeting_request" + val DESTROY_MEETING = "destroy_meeting_request" + val START_MEETING = "start_meeting_request" + val END_MEETING = "end_meeting_request" + val LOCK_SETTING = "lock_setting_request" + val LOCK_USER = "lock_user_request" + val INIT_LOCK_SETTINGS = "init_lock_settings" + val INIT_AUDIO_SETTINGS = "init_audio_settings" + val SET_LOCK_SETTINGS = "set_lock_settings" + val GET_LOCK_SETTINGS = "get_lock_settings" + val IS_MEETING_LOCKED = "is_meeting_locked" + val VALIDATE_AUTH_TOKEN = "validate_auth_token_request" + val VALIDATE_AUTH_TOKEN_REPLY = "validate_auth_token_reply" + val VALIDATE_AUTH_TOKEN_TIMEOUT = "validate_auth_token_timeout" + val REGISTER_USER = "register_user_request" + val USER_JOINING = "user_joining_request" + val USER_LEAVING = "user_leaving_request" + val GET_USERS = "get_users_request" + val RAISE_HAND = "user_raise_hand_request" + val LOWER_HAND = "user_lower_hand_request" + val USER_SHARE_WEBCAM = "user_share_webcam_request" + val USER_UNSHARE_WEBCAM = "user_unshare_webcam_request" + val CHANGE_USER_STATUS = "change_user_status_request" + val ASSIGN_PRESENTER = "assign_presenter_request" + val SET_RECORDING_STATUS = "set_recording_status_request" + val GET_CHAT_HISTORY = "get_chat_history_request" + val SEND_PUBLIC_MESSAGE = "send_public_chat_message_request" + val SEND_PRIVATE_MESSAGE = "send_private_chat_message_request" + val GET_CURRENT_LAYOUT = "get_current_layout_request" + val SET_LAYOUT = "set_layout_request" + val BROADCAST_LAYOUT = "broadcast_layout_request" + val UNLOCK_LAYOUT = "unlock_layout_request" + val PRECREATED_POLL = "precreated_poll_request" + val CREATE_POLL = "create_poll_request" + val UPDATE_POLL = "update_poll_request" + val GET_POLLS = "get_polls_request" + val DESTROY_POLL = "destroy_poll_request" + val REMOVE_POLL = "remove_poll_request" + val SHARE_POLL = "share_poll_request" + val SHOW_POLL_RESULT = "show_poll_result_request" + val HIDE_POLL_RESULT = "hide_poll_result_request" + val START_POLL = "start_poll_request" + val STOP_POLL = "stop_poll_request" + val CLEAR_POLL = "clear_poll_request" + val GET_POLL_RESULT = "get_poll_result_request" + val RESPONT_TO_POLL = "respond_to_poll_request" + val CLEAR_PRESENTATION = "clear_presentation_request" + val REMOVE_PRESENTATION = "remove_presentation_request" + val GET_PRESENTATION_INFO = "get_presentation_info_request" + val RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide_request" + val GO_TO_SLIDE = "go_to_slide_request" + val SHARE_PRESENTATION = "share_presentation_request" + val GET_SLIDE_INFO = "get_slide_info_request" + val GET_SLIDE_INFO_REPLY = "get_slide_info_reply" + val PREUPLOADED_PRESENTATIONS = "preuploaded_presentation_request" + val PRESENTATION_CONVERSION_UPDATE = "presentation_conversion_update_message" + val PRESENTATION_PAGE_COUNT_ERROR = "presentation_page_count_error_message" + val PRESENTATION_SLIDE_GENERATED = "presentation_slide_generated_message" + val PRESENTATION_CONVERSION_COMPLETED = "presentation_conversion_completed_message" + val PRESENTATION_CURSOR_UPDATED = "presentation_cursor_updated_message" + val SEND_VOICE_USERS_REQUEST = "send_voice_users_request" + val MUTE_MEETING_REQUEST = "mute_meeting_request" + val IS_MEETING_MUTED = "is_meeting_muted_request" + val MUTE_USER = "mute_user_request" + val EJECT_USER = "eject_user_request" + val VOICE_USER_JOINED_MESSAGE = "voice_user_joined_message" + val VOICE_USER_JOINED = "voice_user_joined" + val VOICE_USER_LEFT = "voice_user_left_message" + val VOICE_USER_LOCKED = "voice_user_locked_message" + val VOICE_USER_MUTED = "voice_user_muted_message" + val VOICE_USER_TALKING = "voice_user_talking_message" + val VOICE_RECORDING = "voice_recording_message" + val SEND_WHITEBOARD_ANNOTATION = "send_whiteboard_annotation_request" + val GET_WHITEBOARD_SHAPES = "get_whiteboard_shapes_request" + val CLEAR_WHITEBOARD = "clear_whiteboard_request" + val UNDO_WHITEBOARD = "undo_whiteboard_request" + val ENABLE_WHITEBOARD = "enable_whiteboard_request" + val IS_WHITEBOARD_ENABLED = "is_whiteboard_enabled_request" + val GET_ALL_MEETINGS_REQUEST = "get_all_meetings_request" + + // OUT MESSAGES + val MEETING_CREATED = "meeting_created_message" + val VOICE_RECORDING_STARTED = "voice_recording_started_message" + val VOICE_RECORDING_STOPPED = "voice_recording_stopped_message" + val RECORDING_STATUS_CHANGED = "recording_status_changed_message" + val GET_RECORDING_STATUS_REPLY = "get_recording_status_reply" + val MEETING_ENDED = "meeting_ended_message" + val MEETING_HAS_ENDED = "meeting_has_ended_message" + val MEETING_STATE = "meeting_state_message" + val MEETING_MUTED = "meeting_muted_message" + val MEETING_DESTROYED = "meeting_destroyed_message" + val DISCONNECT_ALL_USERS = "disconnect_all_users_message" + val DISCONNECT_USER = "disconnect_user_message" + val PERMISSION_SETTING_INITIALIZED = "permisssion_setting_initialized_message" + val NEW_PERMISSION_SETTINGS = "new_permission_settings" + val USER_LOCKED = "user_locked_message" + val USERS_LOCKED = "users_locked_message" + val GET_PERMISSION_SETTINGS_REPLY = "get_permissions_setting_reply" + val IS_MEETING_LOCKED_REPLY = "is_meeting_locked_reply" + val USER_REGISTERED = "user_registered_message" + val USER_LEFT = "user_left_message" + val PRESENTER_ASSIGNED = "presenter_assigned_message" + val END_AND_KICK_ALL = "end_and_kick_all_message" + val GET_USERS_REPLY = "get_users_reply" + val USER_JOINED = "user_joined_message" + val USER_RAISED_HAND = "user_raised_hand_message" + val USER_LOWERED_HAND = "user_lowered_hand_message" + val USER_SHARED_WEBCAM = "user_shared_webcam_message" + val USER_UNSHARED_WEBCAM = "user_unshared_webcam_message" + val USER_STATUS_CHANGED = "user_status_changed_message" + val MUTE_VOICE_USER = "mute_voice_user_request" + val USER_VOICE_MUTED = "user_voice_muted_message" + val USER_VOICE_TALKING = "user_voice_talking_message" + val EJECT_VOICE_USER = "eject_voice_user_message" + val USER_JOINED_VOICE = "user_joined_voice_message" + val USER_LEFT_VOICE = "user_left_voice_message" + val IS_MEETING_MUTED_REPLY = "is_meeting_muted_reply" + val START_RECORDING = "start_recording_message" + val STOP_RECORDING = "stop_recording_message" + val GET_CHAT_HISTORY_REPLY = "get_chat_history_reply" + val SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message" + val SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message" + val GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply" + val SET_LAYOUT_REPLY = "set_layout_reply" + val BROADCAST_LAYOUT_REPLY = "broadcast_layout_reply" + val UNLOCK_LAYOUT_REPLY = "unlock_layout_reply" + val GET_POLL_RESULT_REPLY = "get_poll_result_reply" + val POLL_CLEARED = "poll_cleared_message" + val GET_POLLS_REPLY = "get_polls_reply" + val CLEAR_POLL_FAILED = "clear_poll_failed" + val POLL_STARTED = "poll_started_message" + val POLL_STOPPED = "poll_stopped_message" + val POLL_REMOVED = "poll_removed" + val POLL_UPDATED = "poll_updated_message" + val POLL_CREATED = "poll_created_message" + val POLL_RESPONSE = "poll_response_message" + val POLL_HIDE_RESULT = "poll_hide_result_message" + val POLL_SHOW_RESULT = "poll_show_result_message" + val PRESENTATION_CLEARED = "presentation_cleared_message" + val PRESENTATION_REMOVED = "presentation_removed_message" + val GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply" + val PRESENTATION_PAGE_RESIZED = "presentation_page_resized_message" + val PRESENTATION_PAGE_CHANGED = "presentation_page_changed_message" + val PRESENTATION_SHARED = "presentation_shared_message" + val GET_PREUPLOADED_PRESENTATIONS = "get_preuploaded_presentations_message" + val PRESENTATION_CONVERSION_PROGRESS = "presentation_conversion_progress_message" + val PRESENTATION_CONVERSION_ERROR = "presentation_conversion_error_message" + val PRESENTATION_CONVERSION_DONE = "presentation_conversion_done_message" + val PRESENTATION_CHANGED = "presentation_changed_message" + val GET_PRESENTATION_STATUS_REPLY = "get_presentation_status_reply" + val PRESENTATION_REMOVED_MESSAGE = "presentation_removed_message" + val PRESENTATION_PAGE_GENERATED = "presentation_page_generated_message" + val GET_WHITEBOARD_SHAPES_REPLY = "get_whiteboard_shapes_reply" + val SEND_WHITEBOARD_SHAPE = "send_whiteboard_shape_message" + val UNDO_WHITEBOARD_MESSAGE = "undo_whiteboard_message" + val WHITEBOARD_ENABLED = "whiteboard_enabled_message" + val WHITEBOARD_CLEARED = "whiteboard_cleared_message" + val IS_WHITEBOARD_ENABLED_REPLY = "is_whiteboard_enabled_reply" + val MEETING_DESTROYED_EVENT = "meeting_destroyed_event" + val KEEP_ALIVE_REPLY = "keep_alive_reply" + val USER_LISTEN_ONLY = "user_listening_only" + val GET_ALL_MEETINGS_REPLY = "get_all_meetings_reply" +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala new file mode 100755 index 0000000000..de4be709e3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala @@ -0,0 +1,510 @@ +package org.bigbluebutton.core.api + +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import org.bigbluebutton.core.apps.presentation.CurrentPresentationInfo +import org.bigbluebutton.core.apps.presentation.Presentation +import org.bigbluebutton.core.apps.presentation.Page + +abstract class OutMessage + +case class VoiceRecordingStarted( + meetingID: String, + recorded: Boolean, + recordingFile: String, + timestamp: String, + confNum: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class VoiceRecordingStopped( + meetingID: String, + recorded: Boolean, + recordingFile: String, + timestamp: String, + confNum: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class RecordingStatusChanged( + meetingID: String, + recorded: Boolean, + userId: String, + recording: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetRecordingStatusReply( + meetingID: String, + recorded: Boolean, + userId: String, + recording: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingCreated( + meetingID: String, + externalMeetingID: String, + recorded: Boolean, + name: String, + voiceBridge: String, + duration: Long, + moderatorPass: String, + viewerPass: String, + createTime: Long, + createDate: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingMuted( + meetingID: String, + recorded: Boolean, + meetingMuted: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingEnded( + meetingID: String, + recorded: Boolean, + voiceBridge: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingState( + meetingID: String, + recorded: Boolean, + userId: String, + permissions: Permissions, + meetingMuted: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingHasEnded( + meetingID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MeetingDestroyed( + meetingID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class DisconnectAllUsers( + meetingID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class DisconnectUser( + meetingID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class KeepAliveMessageReply( + aliveID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case object IsAliveMessage extends IOutMessage + +// Permissions +case class PermissionsSettingInitialized( + meetingID: String, + permissions: Permissions, + applyTo: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class NewPermissionsSetting( + meetingID: String, + setByUser: String, + permissions: Permissions, + applyTo: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLocked( + meetingID: String, + userId: String, + lock: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPermissionsSettingReply( + meetingID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Users +case class UserRegistered( + meetingID: String, + recorded: Boolean, + user: RegisteredUser, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLeft( + meetingID: String, + recorded: Boolean, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserEjectedFromMeeting(meetingID: String, recorded: Boolean, userId: String, ejectedBy: String, version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresenterAssigned( + meetingID: String, + recorded: Boolean, + presenter: Presenter, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class EjectAllVoiceUsers( + meetingID: String, + recorded: Boolean, + voiceBridge: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class EndAndKickAll( + meetingID: String, + recorded: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetUsersReply( + meetingID: String, + requesterID: String, + users: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ValidateAuthTokenTimedOut( + meetingID: String, + requesterId: String, + token: String, + valid: Boolean, + correlationId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ValidateAuthTokenReply( + meetingID: String, + requesterId: String, + token: String, + valid: Boolean, + correlationId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserJoined( + meetingID: String, + recorded: Boolean, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserRaisedHand( + meetingID: String, + recorded: Boolean, + raisedHand: Boolean, + userID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLoweredHand( + meetingID: String, + recorded: Boolean, + raisedHand: Boolean, + userID: String, + loweredBy: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserListeningOnly( + meetingID: String, + recorded: Boolean, + userID: String, + listenOnly: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserSharedWebcam( + meetingID: String, + recorded: Boolean, + userID: String, + stream: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserUnsharedWebcam( + meetingID: String, + recorded: Boolean, + userID: String, + stream: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserStatusChange( + meetingID: String, + recorded: Boolean, + userID: String, + status: String, + value: Object, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class MuteVoiceUser( + meetingID: String, + recorded: Boolean, + requesterID: String, + userId: String, + mute: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserVoiceMuted( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserVoiceTalking( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class EjectVoiceUser( + meetingID: String, + recorded: Boolean, + requesterID: String, + userId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserJoinedVoice( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UserLeftVoice( + meetingID: String, + recorded: Boolean, + confNum: String, + user: UserVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Voice +case class IsMeetingMutedReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + meetingMuted: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class StartRecording( + meetingID: String, + recorded: Boolean, + requesterID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class StopRecording( + meetingID: String, + recorded: Boolean, + requesterID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Chat +case class GetChatHistoryReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + replyTo: String, + history: Array[Map[String, String]], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendPublicMessageEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + message: Map[String, String], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendPrivateMessageEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + message: Map[String, String], + version: String = Versions.V_0_0_1) extends IOutMessage + +// Layout +case class GetCurrentLayoutReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + layoutID: String, + locked: Boolean, + setByUserID: String) extends IOutMessage + +case class BroadcastLayoutEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + layoutID: String, + locked: Boolean, + setByUserID: String, + applyTo: Array[UserVO], + version: String = Versions.V_0_0_1) extends IOutMessage + +case class LockLayoutEvent( + meetingID: String, + recorded: Boolean, + setById: String, + locked: Boolean, + applyTo: Array[UserVO]) extends IOutMessage + +// Presentation +case class ClearPresentationOutMsg( + meetingID: String, + recorded: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class RemovePresentationOutMsg( + meetingID: String, + recorded: Boolean, + presentationID: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPresentationInfoOutMsg( + meetingID: String, + recorded: Boolean, + requesterID: String, + info: CurrentPresentationInfo, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendCursorUpdateOutMsg( + meetingID: String, + recorded: Boolean, + xPercent: Double, + yPercent: Double, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ResizeAndMoveSlideOutMsg( + meetingID: String, + recorded: Boolean, + page: Page, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GotoSlideOutMsg( + meetingID: String, + recorded: Boolean, + page: Page, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SharePresentationOutMsg( + meetingID: String, + recorded: Boolean, + presentation: Presentation, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetSlideInfoOutMsg( + meetingID: String, + recorded: Boolean, + requesterID: String, + page: Page, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPreuploadedPresentationsOutMsg( + meetingID: String, + recorded: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationConversionProgress( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + presentationName: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationConversionError( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + maxNumberPages: Int, + presentationName: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationPageGenerated( + meetingID: String, + messageKey: String, + code: String, + presentationId: String, + numberOfPages: Int, + pagesCompleted: Int, + presentationName: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationConversionDone( + meetingID: String, + recorded: Boolean, + messageKey: String, + code: String, + presentation: Presentation, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationChanged( + meetingID: String, + presentation: Presentation, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetPresentationStatusReply( + meetingID: String, + presentations: Seq[Presentation], + current: Presentation, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PresentationRemoved( + meetingID: String, + presentationId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class PageChanged( + meetingID: String, + page: Page, + version: String = Versions.V_0_0_1) extends IOutMessage + +// Whiteboard +case class GetWhiteboardShapesReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + shapes: Array[AnnotationVO], + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class SendWhiteboardAnnotationEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + shape: AnnotationVO, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class ClearWhiteboardEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class UndoWhiteboardEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + whiteboardId: String, + shapeId: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class WhiteboardEnabledEvent( + meetingID: String, + recorded: Boolean, + requesterID: String, + enable: Boolean, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class IsWhiteboardEnabledReply( + meetingID: String, + recorded: Boolean, + requesterID: String, + enabled: Boolean, + replyTo: String, + version: String = Versions.V_0_0_1) extends IOutMessage + +case class GetAllMeetingsReply( + meetings: Array[MeetingInfo], + version: String = Versions.V_0_0_1) extends IOutMessage + +// Value Objects +case class MeetingVO( + id: String, + recorded: Boolean) + diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala new file mode 100644 index 0000000000..ed55b373fe --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/TimestampGenerator.scala @@ -0,0 +1,14 @@ +package org.bigbluebutton.core.api + +import java.util.concurrent.TimeUnit + +object TimestampGenerator { + + def generateTimestamp(): Long = { + TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) + } + + def getCurrentTime(): Long = { + System.currentTimeMillis(); + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala new file mode 100755 index 0000000000..82de5a8a5a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala @@ -0,0 +1,105 @@ +package org.bigbluebutton.core.api + +import java.lang.Boolean + +object Role extends Enumeration { + type Role = Value + val MODERATOR = Value("MODERATOR") + val VIEWER = Value("VIEWER") +} + +case class Presenter( + presenterID: String, + presenterName: String, + assignedBy: String) + +case class User( + id: String, + externId: String, + name: String, + moderator: Boolean, + avatarUrl: String, + logoutUrl: String, + presenter: Boolean, + callerId: CallerId, + phoneCaller: Boolean, + handRaised: Boolean, + muted: Boolean, + talking: Boolean) + +case class CallerId( + name: String, + number: String) + +case class Permissions( + disableCam: Boolean = false, + disableMic: Boolean = false, + disablePrivChat: Boolean = false, + disablePubChat: Boolean = false, + lockedLayout: Boolean = false, + lockOnJoin: Boolean = false, + lockOnJoinConfigurable: Boolean = false) + +case class RegisteredUser( + id: String, + externId: String, + name: String, + role: Role.Role, + authToken: String) + +case class Voice( + id: String, + webId: String, + callId: CallerId, + phoningIn: Boolean, + joined: Boolean, + locked: Boolean, + muted: Boolean, + talking: Boolean) + +case class UserVO( + userID: String, + externUserID: String, + name: String, + role: Role.Role, + raiseHand: Boolean, + presenter: Boolean, + hasStream: Boolean, + locked: Boolean, + webcamStreams: Set[String], + phoneUser: Boolean, + voiceUser: VoiceUser, + listenOnly: Boolean) + +case class VoiceUser(userId: String, + webUserId: String, + callerName: String, + callerNum: String, + joined: Boolean, + locked: Boolean, + muted: Boolean, + talking: Boolean) + +case class MeetingConfig(name: String, + id: MeetingID, + passwords: MeetingPasswords, + welcomeMsg: String, + logoutUrl: String, + maxUsers: Int, + record: Boolean = false, + duration: MeetingDuration, + defaultAvatarURL: String, + defaultConfigToken: String) + +case class MeetingName(name: String) + +case class MeetingID(internal: String, external: String) + +case class VoiceConfig(telVoice: String, webVoice: String, dialNumber: String) + +case class MeetingPasswords(moderatorPass: String, viewerPass: String) + +case class MeetingDuration(duration: Int = 0, createdTime: Long = 0, + startTime: Long = 0, endTime: Long = 0) + +case class MeetingInfo(meetingID: String, meetingName: String, recorded: Boolean, voiceBridge: String, duration: Long) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala new file mode 100755 index 0000000000..6fe5b194e8 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Versions.scala @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.api + +object Versions { + val V_0_0_1 = "0.0.1" +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala new file mode 100755 index 0000000000..ee1664f3b6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp.scala @@ -0,0 +1,31 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.api._ +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.MeetingActor + +trait ChatApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + val messages = new ArrayBuffer[Map[String, String]]() + + def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { + val history = new Array[Map[String, String]](messages.size) + messages.copyToArray(history) + outGW.send(new GetChatHistoryReply(meetingID, recorded, msg.requesterID, msg.replyTo, history)) + } + + def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { + messages append msg.message.toMap + val pubMsg = msg.message.toMap + + outGW.send(new SendPublicMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) + } + + def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { + val pubMsg = msg.message.toMap + outGW.send(new SendPrivateMessageEvent(meetingID, recorded, msg.requesterID, pubMsg)) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala new file mode 100755 index 0000000000..573b51c5fc --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatInGateway.scala @@ -0,0 +1,19 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class ChatInGateway(bbbGW: BigBlueButtonGateway) { + + def getChatHistory(meetingID: String, requesterID: String, replyTo: String) { + bbbGW.accept(new GetChatHistoryRequest(meetingID, requesterID, replyTo)) + } + + def sendPrivateMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { + bbbGW.accept(new SendPrivateMessageRequest(meetingID, requesterID, msg)) + } + + def sendPublicMessage(meetingID: String, requesterID: String, msg: Map[String, String]) { + bbbGW.accept(new SendPublicMessageRequest(meetingID, requesterID, msg)) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala new file mode 100755 index 0000000000..81940bf350 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala @@ -0,0 +1,38 @@ +package org.bigbluebutton.core.apps.chat.redis + +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.mutable.HashMap +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import java.util.ArrayList +import org.bigbluebutton.common.messages.MessagingConstants +import org.bigbluebutton.core.messaging.Util + +class ChatEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + def handleMessage(msg: IOutMessage) { + msg match { + case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) + case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) + case _ => // do nothing + } + } + + private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { + val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) + service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) + } + + private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) + service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) + } + + private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { + val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) + service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala new file mode 100755 index 0000000000..c30ac8989a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala @@ -0,0 +1,29 @@ +package org.bigbluebutton.core.apps.chat.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.recorder.chat.PublicChatRecordEvent +import scala.collection.JavaConversions._ + +class ChatEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + case _ => // do nothing + } + } + + private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + if (msg.recorded) { + val message = mapAsJavaMap(msg.message) + val ev = new PublicChatRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setMeetingId(msg.meetingID); + ev.setSender(message.get("fromUsername")); + ev.setMessage(message.get("message")); + ev.setColor(message.get("fromColor")); + recorder.record(msg.meetingID, ev); + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala new file mode 100755 index 0000000000..d434664ef8 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala @@ -0,0 +1,67 @@ +package org.bigbluebutton.core.apps.chat.redis + +import scala.collection.mutable.HashMap +import org.bigbluebutton.conference.service.chat.ChatKeyUtil +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.mutable.HashMap +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import java.util.ArrayList +import org.bigbluebutton.common.messages.MessagingConstants +import org.bigbluebutton.core.messaging.Util + +object ChatMessageToJsonConverter { + + val UNKNOWN = "unknown" + + private def chatMessageToMap(msg: Map[String, String]): HashMap[String, String] = { + val res = new HashMap[String, String] + res += "chat_type" -> msg.get(ChatKeyUtil.CHAT_TYPE).getOrElse(UNKNOWN) + res += "from_userid" -> msg.get(ChatKeyUtil.FROM_USERID).getOrElse(UNKNOWN) + res += "from_username" -> msg.get(ChatKeyUtil.FROM_USERNAME).getOrElse(UNKNOWN) + res += "from_color" -> msg.get(ChatKeyUtil.FROM_COLOR).getOrElse(UNKNOWN) + res += "from_time" -> msg.get(ChatKeyUtil.FROM_TIME).getOrElse(UNKNOWN) + res += "from_tz_offset" -> msg.get(ChatKeyUtil.FROM_TZ_OFFSET).getOrElse(UNKNOWN) + res += "to_userid" -> msg.get(ChatKeyUtil.TO_USERID).getOrElse(UNKNOWN) + res += "to_username" -> msg.get(ChatKeyUtil.TO_USERNAME).getOrElse(UNKNOWN) + res += "message" -> msg.get(ChatKeyUtil.MESSAGE).getOrElse(UNKNOWN) + + res + } + + def getChatHistoryReplyToJson(msg: GetChatHistoryReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val collection = new ArrayList[java.util.Map[String, String]](); + + msg.history.foreach(p => { + collection.add(mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(p))) + }) + + payload.put(Constants.CHAT_HISTORY, collection) + + val header = Util.buildHeader(MessageNames.GET_CHAT_HISTORY_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def sendPublicMessageEventToJson(msg: SendPublicMessageEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) + + val header = Util.buildHeader(MessageNames.SEND_PUBLIC_CHAT_MESSAGE, msg.version, None) + Util.buildJson(header, payload) + } + + def sendPrivateMessageEventToJson(msg: SendPrivateMessageEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE, mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) + + val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala new file mode 100755 index 0000000000..4bcfbfc4d3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala @@ -0,0 +1,66 @@ +package org.bigbluebutton.core.apps.layout + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.MeetingActor +import scala.collection.mutable.ArrayBuffer + +trait LayoutApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private var setByUser: String = "system"; + private var currentLayout = ""; + private var layoutLocked = false + private var viewersOnly = true + + def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { + outGW.send(new GetCurrentLayoutReply(msg.meetingID, recorded, msg.requesterID, + currentLayout, permissions.lockedLayout, setByUser)) + } + + def handleLockLayoutRequest(msg: LockLayoutRequest) { + viewersOnly = msg.viewersOnly + lockLayout(msg.lock) + + outGW.send(new LockLayoutEvent(msg.meetingID, recorded, + msg.setById, msg.lock, affectedUsers)) + + msg.layout foreach { l => + currentLayout = l + broadcastSyncLayout(msg.meetingID, msg.setById) + } + } + + private def broadcastSyncLayout(meetingId: String, setById: String) { + outGW.send(new BroadcastLayoutEvent(meetingId, recorded, setById, + currentLayout, permissions.lockedLayout, setByUser, affectedUsers)) + } + + def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { + currentLayout = msg.layout + broadcastSyncLayout(msg.meetingID, msg.requesterID) + } + + def handleLockLayout(lock: Boolean, setById: String) { + outGW.send(new LockLayoutEvent(meetingID, recorded, setById, lock, affectedUsers)) + + broadcastSyncLayout(meetingID, setById) + } + + def affectedUsers(): Array[UserVO] = { + if (viewersOnly) { + val au = ArrayBuffer[UserVO]() + users.getUsers foreach { u => + if (!u.presenter && u.role != Role.MODERATOR) { + au += u + } + } + au.toArray + } else { + users.getUsers + } + + } + +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala new file mode 100755 index 0000000000..05455ce69e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala @@ -0,0 +1,26 @@ +package org.bigbluebutton.core.apps.layout + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class LayoutInGateway(bbbGW: BigBlueButtonGateway) { + + def getCurrentLayout(meetingID: String, requesterID: String) { + bbbGW.accept(new GetCurrentLayoutRequest(meetingID, requesterID)) + } + + def broadcastLayout(meetingID: String, requesterID: String, layout: String) { + bbbGW.accept(new BroadcastLayoutRequest(meetingID, requesterID, layout)) + } + + def lockLayout(meetingID: String, setById: String, + lock: Boolean, viewersOnly: Boolean, + layout: String) { + if (layout != null) { + bbbGW.accept(new LockLayoutRequest(meetingID, setById, lock, viewersOnly, Some(layout))) + } else { + bbbGW.accept(new LockLayoutRequest(meetingID, setById, lock, viewersOnly, None)) + } + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala new file mode 100755 index 0000000000..d2179fa56b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp.scala @@ -0,0 +1,154 @@ +package org.bigbluebutton.core.apps.presentation + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.MeetingActor +import com.google.gson.Gson + +case class CurrentPresenter(userId: String, name: String, assignedBy: String) + +case class CurrentPresentationInfo(presenter: CurrentPresenter, + presentations: Seq[Presentation]) +case class CursorLocation(xPercent: Double = 0D, yPercent: Double = 0D) + +trait PresentationApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private var cursorLocation = new CursorLocation + private val presModel = new PresentationModel + + def handlePreuploadedPresentations(msg: PreuploadedPresentations) { + val pres = msg.presentations + + msg.presentations.foreach(presentation => { + presModel.addPresentation(presentation) + + sharePresentation(presentation.id, true) + }) + } + + def handleInitializeMeeting(msg: InitializeMeeting) { + + } + + def handleClearPresentation(msg: ClearPresentation) { + outGW.send(new ClearPresentationOutMsg(meetingID, recorded)) + } + + def handlePresentationConversionUpdate(msg: PresentationConversionUpdate) { + outGW.send(new PresentationConversionProgress(meetingID, msg.messageKey, + msg.code, msg.presentationId, msg.presName)) + } + + def handlePresentationPageCountError(msg: PresentationPageCountError) { + outGW.send(new PresentationConversionError(meetingID, msg.messageKey, + msg.code, msg.presentationId, + msg.numberOfPages, + msg.maxNumberPages, msg.presName)) + } + + def handlePresentationSlideGenerated(msg: PresentationSlideGenerated) { + outGW.send(new PresentationPageGenerated(meetingID, msg.messageKey, + msg.code, msg.presentationId, + msg.numberOfPages, + msg.pagesCompleted, msg.presName)) + } + + def handlePresentationConversionCompleted(msg: PresentationConversionCompleted) { + + presModel.addPresentation(msg.presentation) + + outGW.send(new PresentationConversionDone(meetingID, recorded, msg.messageKey, + msg.code, msg.presentation)) + + sharePresentation(msg.presentation.id, true) + } + + def handleRemovePresentation(msg: RemovePresentation) { + val curPres = presModel.getCurrentPresentation + + val removedPresentation = presModel.remove(msg.presentationID) + + curPres foreach (cp => { + if (cp.id == msg.presentationID) { + sharePresentation(msg.presentationID, false); + } + }) + + outGW.send(new RemovePresentationOutMsg(msg.meetingID, recorded, msg.presentationID)) + + } + + def handleGetPresentationInfo(msg: GetPresentationInfo) { + // println("PresentationApp : handleGetPresentationInfo GetPresentationInfo for meeting [" + msg.meetingID + "] [" + msg.requesterID + "]" ) + + val curPresenter = getCurrentPresenter; + val presenter = new CurrentPresenter(curPresenter.presenterID, + curPresenter.presenterName, + curPresenter.assignedBy) + val presentations = presModel.getPresentations + val presentationInfo = new CurrentPresentationInfo(presenter, presentations) + outGW.send(new GetPresentationInfoOutMsg(meetingID, recorded, msg.requesterID, presentationInfo, msg.replyTo)) + } + + def handleSendCursorUpdate(msg: SendCursorUpdate) { + cursorLocation = new CursorLocation(msg.xPercent, msg.yPercent) + outGW.send(new SendCursorUpdateOutMsg(meetingID, recorded, msg.xPercent, msg.yPercent)) + } + + def handleResizeAndMoveSlide(msg: ResizeAndMoveSlide) { + val page = presModel.resizePage(msg.xOffset, msg.yOffset, + msg.widthRatio, msg.heightRatio); + page foreach (p => outGW.send(new ResizeAndMoveSlideOutMsg(meetingID, recorded, p))) + } + + def handleGotoSlide(msg: GotoSlide) { + // println("Received GotoSlide for meeting=[" + msg.meetingID + "] page=[" + msg.page + "]") + // println("*** Before change page ****") + // printPresentations + presModel.changePage(msg.page) foreach { page => + // println("Switching page for meeting=[" + msg.meetingID + "] page=[" + page.id + "]") + outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) + } + // println("*** After change page ****") + // printPresentations + } + + def handleSharePresentation(msg: SharePresentation) { + sharePresentation(msg.presentationID, msg.share) + } + + def sharePresentation(presentationID: String, share: Boolean) { + val pres = presModel.sharePresentation(presentationID) + + pres foreach { p => + outGW.send(new SharePresentationOutMsg(meetingID, recorded, p)) + + presModel.getCurrentPage(p) foreach { page => + outGW.send(new GotoSlideOutMsg(meetingID, recorded, page)) + } + } + + } + + def handleGetSlideInfo(msg: GetSlideInfo) { + presModel.getCurrentPresentation foreach { pres => + presModel.getCurrentPage(pres) foreach { page => + outGW.send(new GetSlideInfoOutMsg(meetingID, recorded, msg.requesterID, page, msg.replyTo)) + } + } + + } + + def printPresentations() { + presModel.getPresentations foreach { pres => + println("presentation id=[" + pres.id + "] current=[" + pres.current + "]") + pres.pages.values foreach { page => + println("page id=[" + page.id + "] current=[" + page.current + "]") + } + } + + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala new file mode 100755 index 0000000000..44a327a92f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationModel.scala @@ -0,0 +1,127 @@ +package org.bigbluebutton.core.apps.presentation + +case class Presentation(id: String, name: String, current: Boolean = false, + pages: scala.collection.immutable.HashMap[String, Page]) + +case class Page(id: String, num: Int, + thumbUri: String = "", + swfUri: String, + txtUri: String, + pngUri: String, + current: Boolean = false, + xOffset: Double = 0, yOffset: Double = 0, + widthRatio: Double = 100D, heightRatio: Double = 100D) + +class PresentationModel { + private var presentations = new scala.collection.immutable.HashMap[String, Presentation] + + def addPresentation(pres: Presentation) { + savePresentation(pres) + } + + def getPresentations(): Seq[Presentation] = { + presentations.values.toSeq + } + + def getCurrentPresentation(): Option[Presentation] = { + presentations.values find (p => p.current) + } + + def getCurrentPage(pres: Presentation): Option[Page] = { + pres.pages.values find (p => p.current) + } + + def remove(presId: String): Option[Presentation] = { + val pres = presentations.get(presId) + pres foreach (p => presentations -= p.id) + pres + } + + def sharePresentation(presId: String): Option[Presentation] = { + getCurrentPresentation foreach (curPres => { + if (curPres.id != presId) { + val newPres = curPres.copy(current = false) + savePresentation(newPres) + } + }) + + presentations.get(presId) match { + case Some(pres) => { + val cp = pres.copy(current = true) + savePresentation(cp) + Some(cp) + } + case None => None + } + } + + private def savePresentation(pres: Presentation) { + presentations += pres.id -> pres + } + + private def resizeCurrentPage(pres: Presentation, + xOffset: Double, yOffset: Double, + widthRatio: Double, + heightRatio: Double): Option[Page] = { + getCurrentPage(pres) match { + case Some(cp) => { + val page = cp.copy(xOffset = xOffset, yOffset = yOffset, + widthRatio = widthRatio, heightRatio = heightRatio) + val nPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = nPages) + savePresentation(newPres) + Some(page) + } + case None => None + } + } + + def resizePage(xOffset: Double, yOffset: Double, + widthRatio: Double, heightRatio: Double): Option[Page] = { + for { + curPres <- getCurrentPresentation + page <- resizeCurrentPage(curPres, xOffset, yOffset, widthRatio, heightRatio) + } yield page + } + + private def deactivateCurrentPage(pres: Presentation) { + getCurrentPage(pres) foreach { cp => + val page = cp.copy(current = false) + val nPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = nPages) + savePresentation(newPres) + // println("Making page[" + page.id + "] not current[" + page.current + "]") + // println("After deact page. presentation id=[" + newPres.id + "] current=[" + newPres.current + "]") + // newPres.pages.values foreach {page => + // println("page id=[" + page.id + "] current=[" + page.current + "]") + // } + } + } + + private def makePageCurrent(pres: Presentation, page: String): Option[Page] = { + pres.pages.values find (p => p.id == page) match { + case Some(newCurPage) => { + val page = newCurPage.copy(current = true) + val newPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = newPages) + savePresentation(newPres) + // println("Making page[" + page.id + "] current[" + page.current + "]") + Some(page) + } + case None => { + // println("Could not find page[" + page + "] in presentation [" + pres.id + "]") + None + } + } + } + + def changePage(pageId: String): Option[Page] = { + getCurrentPresentation foreach { pres => deactivateCurrentPage(pres) } + + for { + pres <- getCurrentPresentation + page <- makePageCurrent(pres, pageId) + } yield page + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala new file mode 100755 index 0000000000..2ab3d5794c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala @@ -0,0 +1,281 @@ +package org.bigbluebutton.core.apps.presentation.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.messaging.Util +import org.bigbluebutton.core.apps.presentation.Page +import collection.JavaConverters._ +import scala.collection.JavaConversions._ + +object PesentationMessageToJsonConverter { + private def pageToMap(page: Page): java.util.Map[String, Any] = { + val res = new scala.collection.mutable.HashMap[String, Any] + res += "id" -> page.id + res += "num" -> page.num + res += "thumb_uri" -> page.thumbUri + res += "swf_uri" -> page.swfUri + res += "txt_uri" -> page.txtUri + res += "png_uri" -> page.pngUri + res += "current" -> page.current + res += "x_offset" -> page.xOffset + res += "y_offset" -> page.yOffset + res += "width_ratio" -> page.widthRatio + res += "height_ratio" -> page.heightRatio + + mapAsJavaMap(res) + } + + def clearPresentationOutMsgToJson(msg: ClearPresentationOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CLEARED, msg.version, None) + Util.buildJson(header, payload) + } + + def removePresentationOutMsgToJson(msg: RemovePresentationOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationID) + + val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) + Util.buildJson(header, payload) + } + + def getPresentationInfoOutMsgToJson(msg: GetPresentationInfoOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_INFO, msg.info) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val info = msg.info + + // Create a map for our current presenter + val presenter = new java.util.HashMap[String, String]() + presenter.put(Constants.USER_ID, info.presenter.userId) + presenter.put(Constants.NAME, info.presenter.name) + presenter.put(Constants.ASSIGNED_BY, info.presenter.assignedBy) + + payload.put(Constants.PRESENTER, presenter) + + // Create an array for our presentations + val presentations = new java.util.ArrayList[java.util.HashMap[String, Object]] + info.presentations.foreach { pres => + val presentation = new java.util.HashMap[String, Object]() + presentation.put(Constants.ID, pres.id) + presentation.put(Constants.NAME, pres.name) + presentation.put(Constants.CURRENT, pres.current: java.lang.Boolean) + + // Get the pages for a presentation + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + pres.pages.values foreach { p => + pages.add(pageToMap(p)) + } + // store the pages in the presentation + presentation.put(Constants.PAGES, pages) + + // add this presentation into our presentations list + presentations.add(presentation); + } + + // add the presentation to our map to complete our json + payload.put(Constants.PRESENTATIONS, presentations) + + val header = Util.buildHeader(MessageNames.GET_PRESENTATION_INFO_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def sendCursorUpdateOutMsgToJson(msg: SendCursorUpdateOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.X_PERCENT, msg.xPercent) + payload.put(Constants.Y_PERCENT, msg.yPercent) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CURSOR_UPDATED, msg.version, None) + Util.buildJson(header, payload) + } + + def resizeAndMoveSlideOutMsgToJson(msg: ResizeAndMoveSlideOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_RESIZED, msg.version, None) + Util.buildJson(header, payload) + } + + def gotoSlideOutMsgToJson(msg: GotoSlideOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def sharePresentationOutMsgToJson(msg: SharePresentationOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val presentation = new java.util.HashMap[String, Object](); + presentation.put(Constants.ID, msg.presentation.id) + presentation.put(Constants.NAME, msg.presentation.name) + presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) + + // Get the pages for a presentation + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.presentation.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + // store the pages in the presentation + presentation.put(Constants.PAGES, pages) + + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.PRESENTATION_SHARED, msg.version, None) + Util.buildJson(header, payload) + } + + def getSlideInfoOutMsgToJson(msg: GetSlideInfoOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.GET_SLIDE_INFO_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def getPreuploadedPresentationsOutMsgToJson(msg: GetPreuploadedPresentationsOutMsg): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.GET_PREUPLOADED_PRESENTATIONS, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationConversionProgressToJson(msg: PresentationConversionProgress): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presentationName) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_PROGRESS, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationConversionErrorToJson(msg: PresentationConversionError): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presentationName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.MAX_NUM_PAGES, msg.maxNumberPages) + + val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_ERROR, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationPageGenerated(msg: PresentationPageGenerated): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + payload.put(Constants.PRESENTATION_NAME, msg.presentationName) + payload.put(Constants.NUM_PAGES, msg.numberOfPages) + payload.put(Constants.PAGES_COMPLETED, msg.pagesCompleted) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_GENERATED, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationConversionDoneToJson(msg: PresentationConversionDone): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MESSAGE_KEY, msg.messageKey) + payload.put(Constants.CODE, msg.code) + + val presentation = new java.util.HashMap[String, Object](); + presentation.put(Constants.ID, msg.presentation.id) + presentation.put(Constants.NAME, msg.presentation.name) + presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) + + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.presentation.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + presentation.put(Constants.PAGES, pages) + + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.PRESENTATION_CONVERSION_DONE, msg.version, None) + Util.buildJson(header, payload) + } + + def presentationChangedToJson(msg: PresentationChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + val presentation = new java.util.HashMap[String, Object](); + presentation.put(Constants.ID, msg.presentation.id) + presentation.put(Constants.NAME, msg.presentation.name) + presentation.put(Constants.CURRENT, msg.presentation.current: java.lang.Boolean) + + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.presentation.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + presentation.put(Constants.PAGES, pages) + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.PRESENTATION_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def getPresentationStatusReplyToJson(msg: GetPresentationStatusReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + val presentation = new java.util.HashMap[String, Object](); + + presentation.put(Constants.ID, msg.current.id) + presentation.put(Constants.NAME, msg.current.name) + presentation.put(Constants.CURRENT, msg.current.current: java.lang.Boolean) + + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + + msg.current.pages.values foreach { p => + pages.add(pageToMap(p)) + } + + presentation.put(Constants.PAGES, pages) + + payload.put(Constants.PRESENTATION, presentation); + + val header = Util.buildHeader(MessageNames.GET_PRESENTATION_STATUS_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def presentationRemovedToJson(msg: PresentationRemoved): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PRESENTATION_ID, msg.presentationId) + + val header = Util.buildHeader(MessageNames.PRESENTATION_REMOVED, msg.version, None) + Util.buildJson(header, payload) + } + + def pageChangedToJson(msg: PageChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PAGE, pageToMap(msg.page)) + + val header = Util.buildHeader(MessageNames.PRESENTATION_PAGE_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala new file mode 100755 index 0000000000..1bfb58d14f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala @@ -0,0 +1,161 @@ +package org.bigbluebutton.core.apps.presentation.redis + +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.core.apps.presentation.Page +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import org.bigbluebutton.common.messages.MessagingConstants +import org.bigbluebutton.common.messages.PresentationRemovedMessage +import collection.JavaConverters._ +import scala.collection.JavaConversions._ +import org.bigbluebutton.common.messages.GetPresentationInfoReplyMessage + +class PresentationEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + def handleMessage(msg: IOutMessage) { + msg match { + case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) + case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) + case msg: GetPresentationInfoOutMsg => handleGetPresentationInfoOutMsg(msg) + case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) + case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) + case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) + case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) + case msg: GetSlideInfoOutMsg => handleGetSlideInfoOutMsg(msg) + case msg: PresentationConversionProgress => handlePresentationConversionProgress(msg) + case msg: PresentationConversionError => handlePresentationConversionError(msg) + case msg: PresentationPageGenerated => handlePresentationPageGenerated(msg) + case msg: PresentationConversionDone => handlePresentationConversionDone(msg) + case _ => // do nothing + } + } + + private def pageToMap(page: Page): java.util.Map[String, Any] = { + val res = new scala.collection.mutable.HashMap[String, Any] + res += "id" -> page.id + res += "num" -> page.num + res += "thumb_uri" -> page.thumbUri + res += "swf_uri" -> page.swfUri + res += "txt_uri" -> page.txtUri + res += "png_uri" -> page.pngUri + res += "current" -> page.current + res += "x_offset" -> page.xOffset + res += "y_offset" -> page.yOffset + res += "width_ratio" -> page.widthRatio + res += "height_ratio" -> page.heightRatio + + mapAsJavaMap(res) + } + + private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { + val json = PesentationMessageToJsonConverter.clearPresentationOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { + val m = new PresentationRemovedMessage(msg.meetingID, msg.presentationID) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, m.toJson()) + } + + private def handleGetPresentationInfoOutMsg(msg: GetPresentationInfoOutMsg) { + // Create a map for our current presenter + val presenter = new java.util.HashMap[String, Object]() + presenter.put(Constants.USER_ID, msg.info.presenter.userId) + presenter.put(Constants.NAME, msg.info.presenter.name) + presenter.put(Constants.ASSIGNED_BY, msg.info.presenter.assignedBy) + + // Create an array for our presentations + val presentations = new java.util.ArrayList[java.util.Map[String, Object]] + msg.info.presentations.foreach { pres => + val presentation = new java.util.HashMap[String, Object]() + presentation.put(Constants.ID, pres.id) + presentation.put(Constants.NAME, pres.name) + presentation.put(Constants.CURRENT, pres.current: java.lang.Boolean) + + // Get the pages for a presentation + val pages = new java.util.ArrayList[java.util.Map[String, Any]]() + pres.pages.values foreach { p => + pages.add(pageToMap(p)) + } + // store the pages in the presentation + presentation.put(Constants.PAGES, pages) + + // add this presentation into our presentations list + presentations.add(presentation); + } + + val reply = new GetPresentationInfoReplyMessage(msg.meetingID, msg.requesterID, presenter, presentations) + + val json = PesentationMessageToJsonConverter.getPresentationInfoOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { + val json = PesentationMessageToJsonConverter.sendCursorUpdateOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { + val json = PesentationMessageToJsonConverter.resizeAndMoveSlideOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { + val json = PesentationMessageToJsonConverter.gotoSlideOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { + val json = PesentationMessageToJsonConverter.sharePresentationOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetSlideInfoOutMsg(msg: GetSlideInfoOutMsg) { + val json = PesentationMessageToJsonConverter.getSlideInfoOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetPreuploadedPresentationsOutMsg(msg: GetPreuploadedPresentationsOutMsg) { + val json = PesentationMessageToJsonConverter.getPreuploadedPresentationsOutMsgToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationConversionProgress(msg: PresentationConversionProgress) { + val json = PesentationMessageToJsonConverter.presentationConversionProgressToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationConversionError(msg: PresentationConversionError) { + val json = PesentationMessageToJsonConverter.presentationConversionErrorToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationPageGenerated(msg: PresentationPageGenerated) { + val json = PesentationMessageToJsonConverter.presentationPageGenerated(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationConversionDone(msg: PresentationConversionDone) { + val json = PesentationMessageToJsonConverter.presentationConversionDoneToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationChanged(msg: PresentationChanged) { + val json = PesentationMessageToJsonConverter.presentationChangedToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handleGetPresentationStatusReply(msg: GetPresentationStatusReply) { + val json = PesentationMessageToJsonConverter.getPresentationStatusReplyToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePresentationRemoved(msg: PresentationRemoved) { + val json = PesentationMessageToJsonConverter.presentationRemovedToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } + + private def handlePageChanged(msg: PageChanged) { + val json = PesentationMessageToJsonConverter.pageChangedToJson(msg) + service.send(MessagingConstants.FROM_PRESENTATION_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala new file mode 100644 index 0000000000..e74ae53ae2 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala @@ -0,0 +1,127 @@ +package org.bigbluebutton.core.apps.presentation.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.core.api.IOutMessage +import org.bigbluebutton.conference.service.recorder.presentation.GenerateSlidePresentationRecordEvent +import org.bigbluebutton.conference.service.recorder.presentation.ConversionCompletedPresentationRecordEvent +import org.bigbluebutton.core.api.GotoSlideOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.GotoSlidePresentationRecordEvent +import org.bigbluebutton.core.api.ResizeAndMoveSlideOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.ResizeAndMoveSlidePresentationRecordEvent +import org.bigbluebutton.core.api.RemovePresentationOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.RemovePresentationPresentationRecordEvent +import org.bigbluebutton.core.api.SharePresentationOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.SharePresentationPresentationRecordEvent +import org.bigbluebutton.core.api.SendCursorUpdateOutMsg +import org.bigbluebutton.conference.service.recorder.presentation.CursorUpdateRecordEvent +import org.bigbluebutton.core.api.ClearPresentationOutMsg +import org.bigbluebutton.core.api.PresentationConversionDone +import org.bigbluebutton.core.api.TimestampGenerator + +class PresentationEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + private val GENERATED_SLIDE_KEY = "GENERATED_SLIDE"; + private val CONVERSION_COMPLETED_KEY = "CONVERSION_COMPLETED"; + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) + case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) + case msg: SendCursorUpdateOutMsg => handleSendCursorUpdateOutMsg(msg) + case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) + case msg: GotoSlideOutMsg => handleGotoSlideOutMsg(msg) + case msg: SharePresentationOutMsg => handleSharePresentationOutMsg(msg) + case _ => // do nothing + } + } + + private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { + + } + + private def handlePresentationConversionDone(msg: PresentationConversionDone) { + if (msg.recorded) { + val event = new ConversionCompletedPresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setPresentationName(msg.presentation.id); + event.setOriginalFilename(msg.presentation.name); + recorder.record(msg.meetingID, event); + } + + } + + private def handleGotoSlideOutMsg(msg: GotoSlideOutMsg) { + if (msg.recorded) { + val event = new GotoSlidePresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setSlide(msg.page.num); + event.setId(msg.page.id); + event.setNum(msg.page.num); + event.setThumbUri(msg.page.thumbUri); + event.setSwfUri(msg.page.swfUri); + event.setTxtUri(msg.page.txtUri); + event.setPngUri(msg.page.pngUri); + event.setXOffset(msg.page.xOffset); + event.setYOffset(msg.page.yOffset); + event.setWidthRatio(msg.page.widthRatio); + event.setHeightRatio(msg.page.heightRatio); + recorder.record(msg.meetingID, event); + } + } + + private def handleResizeAndMoveSlideOutMsg(msg: ResizeAndMoveSlideOutMsg) { + if (msg.recorded) { + val event = new ResizeAndMoveSlidePresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setId(msg.page.id); + event.setNum(msg.page.num); + event.setThumbUri(msg.page.thumbUri); + event.setSwfUri(msg.page.swfUri); + event.setTxtUri(msg.page.txtUri); + event.setPngUri(msg.page.pngUri); + event.setXOffset(msg.page.xOffset); + event.setYOffset(msg.page.yOffset); + event.setWidthRatio(msg.page.widthRatio); + event.setHeightRatio(msg.page.heightRatio); + + recorder.record(msg.meetingID, event); + } + } + + private def handleRemovePresentationOutMsg(msg: RemovePresentationOutMsg) { + if (msg.recorded) { + val event = new RemovePresentationPresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setPresentationName(msg.presentationID); + recorder.record(msg.meetingID, event); + } + } + + private def handleSharePresentationOutMsg(msg: SharePresentationOutMsg) { + if (msg.recorded) { + val event = new SharePresentationPresentationRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setPresentationName(msg.presentation.id); + event.setOriginalFilename(msg.presentation.name); + event.setShare(true); + recorder.record(msg.meetingID, event); + } + } + + private def handleSendCursorUpdateOutMsg(msg: SendCursorUpdateOutMsg) { + if (msg.recorded) { + val event = new CursorUpdateRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setXPercent(msg.xPercent); + event.setYPercent(msg.yPercent); + + recorder.record(msg.meetingID, event); + } + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala new file mode 100755 index 0000000000..3c54a75328 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/Users.scala @@ -0,0 +1,133 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.models.{ UserV, Voice } +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.api.Role._ + +class Users { + + private val users = collection.mutable.HashMap[String, UserV]() + + /** + * Add a new user. + */ + def add(user: UserV) = users += user.id -> user + + /** + * Returns the number of users. + */ + def count = users.size + + /** + * Removes a user. + */ + def remove(id: String) = users -= id + + /** + * Gets a user. + */ + def get(id: String): Option[UserV] = users.values.find(u => u.id == id) + + /** + * Get all users. + */ + def all(): Array[UserV] = users.values.toArray + + def getPresenter(): Option[UserV] = users.values.find(u => u.status.isPresenter) + + def makeEveryoneNotPresenter(): Unit = { + users.values map (u => { + val p = u.copy(status = u.status.copy(isPresenter = false)) + users += p.id -> p + }) + } + + def makePresenter(id: String): Option[UserV] = { + var newPresenter: Option[UserV] = None + get(id) match { + case Some(u) => { + val p = u.copy(status = u.status.copy(isPresenter = true)) + newPresenter = Some(p) + users += p.id -> p + } + case None => + } + newPresenter + } + + def moderatorCount: Int = users.values.filter(u => u.role == MODERATOR).size + + def getVoiceUser(id: String): Option[UserV] = users.values.find(u => u.voice.id == id) + + def mute(id: String): Option[UserV] = { + var user: Option[UserV] = None + getVoiceUser(id) match { + case Some(u) => { + val mutedUser = u.copy(voice = u.voice.copy(muted = true)) + users += mutedUser.id -> mutedUser + user = Some(mutedUser) + } + case None => + } + + user + } + + def unmute(id: String): Option[UserV] = { + var user: Option[UserV] = None + getVoiceUser(id) match { + case Some(u) => { + val unmutedUser = u.copy(voice = u.voice.copy(muted = false)) + users += unmutedUser.id -> unmutedUser + user = Some(unmutedUser) + } + case None => + } + + user + } + + def lockVoice(id: String, lock: Boolean): Option[UserV] = { + var user: Option[UserV] = None + get(id) match { + case Some(u) => { + val lockedUser = u.copy(voice = u.voice.copy(locked = lock)) + users += lockedUser.id -> lockedUser + user = Some(lockedUser) + } + case None => + } + + user + } + + def joinedVoice(id: String, voice: Voice): Option[UserV] = { + var user: Option[UserV] = None + get(id) match { + case Some(u) => { + val voiceUser = u.copy(voice = voice) + users += voiceUser.id -> voiceUser + user = Some(voiceUser) + } + case None => + } + + user + } + + def leftVoice(id: String): Option[UserV] = { + var user: Option[UserV] = None + getVoiceUser(id) match { + case Some(u) => { + val voiceUser = u.copy(voice = Voice()) + users += voiceUser.id -> voiceUser + user = Some(voiceUser) + } + case None => + } + + user + } + + def unlockedUsers(): Array[UserV] = users.values filter (u => !u.voice.locked) toArray +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala new file mode 100755 index 0000000000..578f05f25e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala @@ -0,0 +1,447 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.api._ +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.User +import java.util.ArrayList +import org.bigbluebutton.core.MeetingActor +import scala.collection.mutable.ArrayBuffer +import scala.collection.immutable.ListSet + +trait UsersApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + val users = new UsersModel + private var regUsers = new collection.immutable.HashMap[String, RegisteredUser] + + private var locked = false + private var meetingMuted = false + + private var currentPresenter = new Presenter("system", "system", "system") + + def hasUser(userID: String): Boolean = { + users.hasUser(userID) + } + + def getUser(userID: String): Option[UserVO] = { + users.getUser(userID) + } + + def getCurrentPresenter: Presenter = { + currentPresenter + } + + def handleUserConnectedToGlobalAudio(msg: UserConnectedToGlobalAudio) { + val user = users.getUserWithExternalId(msg.userid) + user foreach { u => + val vu = u.voiceUser.copy(talking = false) + val uvo = u.copy(listenOnly = true, voiceUser = vu) + users.addUser(uvo) + log.info("UserConnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") + outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) + } + } + + def handleUserDisconnectedFromGlobalAudio(msg: UserDisconnectedFromGlobalAudio) { + val user = users.getUserWithExternalId(msg.userid) + user foreach { u => + val uvo = u.copy(listenOnly = false) + users.addUser(uvo) + log.info("UserDisconnectedToGlobalAudio: mid=[" + meetingID + "] uid=[" + uvo.userID + "]") + outGW.send(new UserListeningOnly(meetingID, recorded, uvo.userID, uvo.listenOnly)) + } + } + + def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { + meetingMuted = msg.mute + outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) + + usersWhoAreNotPresenter foreach { u => + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + } + } + + def handleMuteMeetingRequest(msg: MuteMeetingRequest) { + meetingMuted = msg.mute + outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) + users.getUsers foreach { u => + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + } + } + + def handleValidateAuthToken(msg: ValidateAuthToken) { + // println("*************** Got ValidateAuthToken message ********************" ) + regUsers.get(msg.token) match { + case Some(u) => + { + val replyTo = meetingID + '/' + msg.userId + + //send the reply + outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, true, msg.correlationId, msg.sessionId)) + + //join the user + handleUserJoin(new UserJoining(meetingID, msg.userId, msg.token)) + + //send the presentation + log.info("ValidateToken success: mid=[" + meetingID + "] uid=[" + msg.userId + "]") + } + case None => { + log.info("ValidateToken failed: mid=[" + meetingID + "] uid=[" + msg.userId + "]") + outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId)) + } + } + + /** + * Send a reply to BigBlueButtonActor to let it know this MeetingActor hasn't hung! + * Sometimes, the actor seems to hang and doesn't anymore accept messages. This is a simple + * audit to check whether the actor is still alive. (ralam feb 25, 2015) + */ + sender ! new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId) + } + + def handleRegisterUser(msg: RegisterUser) { + if (hasMeetingEnded) { + // Check first if the meeting has ended and the user refreshed the client to re-connect. + log.info("Register user failed: reason=[meeting has ended] mid=[" + meetingID + "] uid=[" + msg.userID + "]") + sendMeetingHasEnded(msg.userID) + } else { + val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken) + regUsers += msg.authToken -> regUser + log.info("Register user success: mid=[" + meetingID + "] uid=[" + msg.userID + "]") + outGW.send(new UserRegistered(meetingID, recorded, regUser)) + } + + } + + def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { + outGW.send(new IsMeetingMutedReply(meetingID, recorded, msg.requesterID, meetingMuted)) + } + + def handleMuteUserRequest(msg: MuteUserRequest) { + // println("Received mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") + users.getUser(msg.userID) match { + case Some(u) => { + // println("Sending mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") + log.info("Muting user: mid=[" + meetingID + "] uid=[" + u.userID + "]") + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + } + case None => { + log.info("Could not find user to mute: mid=[" + meetingID + "] uid=[" + msg.userID + "]") + // println("Could not find user to mute. uid=[" + msg.userID + "] mute=[" + msg.mute + "]") + } + } + } + + def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { + // println("Received eject user request uid=[" + msg.userID + "]") + users.getUser(msg.userId) match { + case Some(u) => { + if (u.voiceUser.joined) { + log.info("Ejecting user from voice: mid=[" + meetingID + "] uid=[" + u.userID + "]") + outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, u.userID)) + } + } + case None => // do nothing + } + } + + def handleGetLockSettings(msg: GetLockSettings) { + //println("*************** Reply with current lock settings ********************") + + //reusing the existing handle for NewPermissionsSettings to reply to the GetLockSettings request + outGW.send(new NewPermissionsSetting(meetingID, msg.userId, permissions, users.getUsers)) + } + + def handleSetLockSettings(msg: SetLockSettings) { + // println("*************** Received new lock settings ********************") + if (!permissionsEqual(msg.settings)) { + newPermissions(msg.settings) + outGW.send(new NewPermissionsSetting(meetingID, msg.setByUser, permissions, users.getUsers)) + + handleLockLayout(msg.settings.lockedLayout, msg.setByUser) + } + } + + def handleLockUserRequest(msg: LockUserRequest) { + users.getUser(msg.userID) match { + case Some(u) => { + val uvo = u.copy(locked = msg.lock) + users.addUser(uvo) + + log.info("Lock user: mid=[" + meetingID + "] uid=[" + u.userID + "] lock=[" + msg.lock + "]") + outGW.send(new UserLocked(meetingID, u.userID, msg.lock)) + } + case None => { + log.info("Could not find user to lock: mid=[" + meetingID + "] uid=[" + msg.userID + "] lock=[" + msg.lock + "]") + } + } + } + + def handleInitLockSettings(msg: InitLockSettings) { + if (!permissionsInited) { + permissionsInited = true + newPermissions(msg.settings) + outGW.send(new PermissionsSettingInitialized(msg.meetingID, msg.settings, users.getUsers)) + } + } + + def handleInitAudioSettings(msg: InitAudioSettings) { + if (!audioSettingsInited) { + audioSettingsInited = true + if (meetingMuted != msg.muted) { + handleMuteAllExceptPresenterRequest(new MuteAllExceptPresenterRequest(meetingID, msg.requesterID, msg.muted)); + } + } + } + + def usersWhoAreNotPresenter(): Array[UserVO] = { + val au = ArrayBuffer[UserVO]() + + users.getUsers foreach { u => + if (!u.presenter) { + au += u + } + } + au.toArray + } + + def handleUserRaiseHand(msg: UserRaiseHand) { + users.getUser(msg.userId) foreach { user => + val uvo = user.copy(raiseHand = true) + users.addUser(uvo) + outGW.send(new UserRaisedHand(meetingID, recorded, uvo.raiseHand, uvo.userID)) + } + } + + def handleUserLowerHand(msg: UserLowerHand) { + users.getUser(msg.userId) foreach { user => + val uvo = user.copy(raiseHand = false) + users.addUser(uvo) + outGW.send(new UserLoweredHand(meetingID, recorded, uvo.raiseHand, uvo.userID, msg.loweredBy)) + } + } + + def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) { + users.getUser(msg.userId) foreach { user => + if (user.voiceUser.joined) { + outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, msg.userId)) + } + + users.removeUser(msg.userId) + + log.info("Ejecting user from meeting: mid=[" + meetingID + "]uid=[" + msg.userId + "]") + outGW.send(new UserEjectedFromMeeting(meetingID, recorded, msg.userId, msg.ejectedBy)) + outGW.send(new DisconnectUser(meetingID, msg.userId)) + + outGW.send(new UserLeft(msg.meetingID, recorded, user)) + } + } + + def handleUserShareWebcam(msg: UserShareWebcam) { + users.getUser(msg.userId) foreach { user => + val streams = user.webcamStreams + msg.stream + val uvo = user.copy(hasStream = true, webcamStreams = streams) + users.addUser(uvo) + log.info("User shared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] sharedStream=[" + msg.stream + "] streams=[" + streams + "]") + outGW.send(new UserSharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) + } + } + + def handleUserunshareWebcam(msg: UserUnshareWebcam) { + users.getUser(msg.userId) foreach { user => + val streams = user.webcamStreams - msg.stream + val uvo = user.copy(hasStream = (!streams.isEmpty), webcamStreams = streams) + users.addUser(uvo) + log.info("User unshared webcam: mid=[" + meetingID + "] uid=[" + uvo.userID + "] unsharedStream=[" + msg.stream + "] streams=[" + streams + "]") + outGW.send(new UserUnsharedWebcam(meetingID, recorded, uvo.userID, msg.stream)) + } + } + + def handleChangeUserStatus(msg: ChangeUserStatus): Unit = { + if (users.hasUser(msg.userID)) { + outGW.send(new UserStatusChange(meetingID, recorded, msg.userID, msg.status, msg.value)) + } + } + + def handleGetUsers(msg: GetUsers): Unit = { + outGW.send(new GetUsersReply(msg.meetingID, msg.requesterID, users.getUsers)) + } + + def handleUserJoin(msg: UserJoining): Unit = { + val regUser = regUsers.get(msg.authToken) + regUser foreach { ru => + val vu = new VoiceUser(msg.userID, msg.userID, ru.name, ru.name, + false, false, false, false) + val uvo = new UserVO(msg.userID, ru.externId, ru.name, + ru.role, raiseHand = false, presenter = false, + hasStream = false, locked = getInitialLockStatus(ru.role), + webcamStreams = new ListSet[String](), phoneUser = false, vu, listenOnly = false) + + users.addUser(uvo) + + log.info("User joined meeting: mid=[" + meetingID + "] uid=[" + uvo.userID + "] role=[" + uvo.role + "] locked=[" + uvo.locked + "] permissions.lockOnJoin=[" + permissions.lockOnJoin + "] permissions.lockOnJoinConfigurable=[" + permissions.lockOnJoinConfigurable + "]") + outGW.send(new UserJoined(meetingID, recorded, uvo)) + + outGW.send(new MeetingState(meetingID, recorded, uvo.userID, permissions, meetingMuted)) + + // Become presenter if the only moderator + if (users.numModerators == 1) { + if (ru.role == Role.MODERATOR) { + assignNewPresenter(msg.userID, ru.name, msg.userID) + } + } + webUserJoined + startRecordingIfAutoStart() + } + } + + def handleUserLeft(msg: UserLeaving): Unit = { + if (users.hasUser(msg.userID)) { + val user = users.removeUser(msg.userID) + user foreach { u => + log.info("User left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]") + outGW.send(new UserLeft(msg.meetingID, recorded, u)) + + if (u.presenter) { + /* The current presenter has left the meeting. Find a moderator and make + * him presenter. This way, if there is a moderator in the meeting, there + * will always be a presenter. + */ + val moderator = users.findAModerator() + moderator.foreach { mod => + log.info("Presenter left meeting: mid=[" + meetingID + "] uid=[" + u.userID + "]. Making user=[" + mod.userID + "] presenter.") + assignNewPresenter(mod.userID, mod.name, mod.userID) + } + } + } + + startCheckingIfWeNeedToEndVoiceConf() + stopAutoStartedRecording() + } + } + + def getInitialLockStatus(role: Role.Role): Boolean = { + permissions.lockOnJoin && !role.equals(Role.MODERATOR) + } + + def handleUserJoinedVoiceFromPhone(msg: VoiceUserJoined) = { + val user = users.getUserWithVoiceUserId(msg.voiceUser.userId) match { + case Some(user) => { + log.info("Voice user=[" + msg.voiceUser.userId + "] is already in conf=[" + voiceBridge + "]. Must be duplicate message.") + } + case None => { + // No current web user. This means that the user called in through + // the phone. We need to generate a new user as we are not able + // to match with a web user. + val webUserId = users.generateWebUserId + val vu = new VoiceUser(msg.voiceUser.userId, webUserId, + msg.voiceUser.callerName, msg.voiceUser.callerNum, + true, false, false, false) + + val sessionId = "PHONE-" + webUserId; + + val uvo = new UserVO(webUserId, webUserId, msg.voiceUser.callerName, + Role.VIEWER, raiseHand = false, presenter = false, + hasStream = false, locked = getInitialLockStatus(Role.VIEWER), webcamStreams = new ListSet[String](), + phoneUser = true, vu, listenOnly = false) + + users.addUser(uvo) + log.info("New user joined voice for user [" + uvo.name + "] userid=[" + msg.voiceUser.webUserId + "]") + outGW.send(new UserJoined(meetingID, recorded, uvo, sessionId)) + + outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, uvo)) + if (meetingMuted) + outGW.send(new MuteVoiceUser(meetingID, recorded, uvo.userID, uvo.userID, meetingMuted)) + + } + } + } + + def handleVoiceUserJoined(msg: VoiceUserJoined) = { + val user = users.getUser(msg.voiceUser.webUserId) match { + case Some(user) => { + val nu = user.copy(voiceUser = msg.voiceUser) + users.addUser(nu) + log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.voiceUser.webUserId + "]") + outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) + + if (meetingMuted) + outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, meetingMuted)) + } + case None => { + handleUserJoinedVoiceFromPhone(msg) + } + } + } + + def handleVoiceUserLeft(msg: VoiceUserLeft) { + users.getUser(msg.userId) foreach { user => + val vu = new VoiceUser(user.userID, user.userID, user.name, user.name, + false, false, false, false) + val nu = user.copy(voiceUser = vu) + users.addUser(nu) + + // println("Received voice user left =[" + user.name + "] wid=[" + msg.userId + "]" ) + log.info("Received user left voice for user [" + nu.name + "] userid=[" + msg.userId + "]") + outGW.send(new UserLeftVoice(meetingID, recorded, voiceBridge, nu)) + + if (user.phoneUser) { + if (users.hasUser(user.userID)) { + val userLeaving = users.removeUser(user.userID) + userLeaving foreach (u => outGW.send(new UserLeft(msg.meetingID, recorded, u))) + } + } + } + } + + def handleVoiceUserMuted(msg: VoiceUserMuted) { + users.getUser(msg.userId) foreach { user => + val talking: Boolean = if (msg.muted) false else user.voiceUser.talking + val nv = user.voiceUser.copy(muted = msg.muted, talking = talking) + val nu = user.copy(voiceUser = nv) + users.addUser(nu) + // println("Received voice muted=[" + msg.muted + "] wid=[" + msg.userId + "]" ) + outGW.send(new UserVoiceMuted(meetingID, recorded, voiceBridge, nu)) + } + } + + def handleVoiceUserTalking(msg: VoiceUserTalking) { + users.getUser(msg.userId) foreach { user => + val nv = user.voiceUser.copy(talking = msg.talking) + val nu = user.copy(voiceUser = nv) + users.addUser(nu) + // println("Received voice talking=[" + msg.talking + "] wid=[" + msg.userId + "]" ) + outGW.send(new UserVoiceTalking(meetingID, recorded, voiceBridge, nu)) + } + } + + def handleAssignPresenter(msg: AssignPresenter): Unit = { + assignNewPresenter(msg.newPresenterID, msg.newPresenterName, msg.assignedBy) + } + + def assignNewPresenter(newPresenterID: String, newPresenterName: String, assignedBy: String) { + if (users.hasUser(newPresenterID)) { + + users.getCurrentPresenter match { + case Some(curPres) => { + users.unbecomePresenter(curPres.userID) + outGW.send(new UserStatusChange(meetingID, recorded, curPres.userID, "presenter", false: java.lang.Boolean)) + } + case None => // do nothing + } + + users.getUser(newPresenterID) match { + case Some(newPres) => { + users.becomePresenter(newPres.userID) + currentPresenter = new Presenter(newPresenterID, newPresenterName, assignedBy) + outGW.send(new PresenterAssigned(meetingID, recorded, new Presenter(newPresenterID, newPresenterName, assignedBy))) + outGW.send(new UserStatusChange(meetingID, recorded, newPresenterID, "presenter", true: java.lang.Boolean)) + } + case None => // do nothing + } + + } + } +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala new file mode 100755 index 0000000000..b462192d8c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersModel.scala @@ -0,0 +1,101 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.User +import scala.collection.mutable.HashMap +import org.bigbluebutton.core.api.UserVO +import org.bigbluebutton.core.api.Role._ +import scala.collection.mutable.ArrayBuffer +import org.bigbluebutton.core.api.VoiceUser +import org.bigbluebutton.core.util.RandomStringGenerator + +class UsersModel { + private var uservos = new collection.immutable.HashMap[String, UserVO] + + def generateWebUserId: String = { + val webUserId = RandomStringGenerator.randomAlphanumericString(6) + if (!hasUser(webUserId)) webUserId else generateWebUserId + } + + def addUser(uvo: UserVO) { + uservos += uvo.userID -> uvo + } + + def removeUser(userId: String): Option[UserVO] = { + val user = uservos get (userId) + user foreach (u => uservos -= userId) + + user + } + + def hasSessionId(sessionId: String): Boolean = { + uservos.contains(sessionId) + } + + def hasUser(userID: String): Boolean = { + uservos.contains(userID) + } + + def numUsers(): Int = { + uservos.size + } + + def numWebUsers(): Int = { + uservos.values filter (u => u.phoneUser == false) size + } + + def getUserWithExternalId(userID: String): Option[UserVO] = { + uservos.values find (u => u.externUserID == userID) + } + + def getUserWithVoiceUserId(voiceUserId: String): Option[UserVO] = { + uservos.values find (u => u.voiceUser.userId == voiceUserId) + } + + def getUser(userID: String): Option[UserVO] = { + uservos.values find (u => u.userID == userID) + } + + def getUsers(): Array[UserVO] = { + uservos.values toArray + } + + def numModerators(): Int = { + getModerators.length + } + + def findAModerator(): Option[UserVO] = { + uservos.values find (u => u.role == MODERATOR) + } + + def getCurrentPresenter(): Option[UserVO] = { + uservos.values find (u => u.presenter == true) + } + + def unbecomePresenter(userID: String) = { + uservos.get(userID) match { + case Some(u) => { + val nu = u.copy(presenter = false) + uservos += nu.userID -> nu + } + case None => // do nothing + } + } + + def becomePresenter(userID: String) = { + uservos.get(userID) match { + case Some(u) => { + val nu = u.copy(presenter = true) + uservos += nu.userID -> nu + } + case None => // do nothing + } + } + + def getModerators(): Array[UserVO] = { + uservos.values filter (u => u.role == MODERATOR) toArray + } + + def getViewers(): Array[UserVO] = { + uservos.values filter (u => u.role == VIEWER) toArray + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala new file mode 100755 index 0000000000..1700984b96 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala @@ -0,0 +1,251 @@ +package org.bigbluebutton.core.apps.users.redis + +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import org.bigbluebutton.common.messages.MessagingConstants +import com.google.gson.Gson +import org.bigbluebutton.common.messages.GetCurrentLayoutReplyMessage +import org.bigbluebutton.common.messages.BroadcastLayoutMessage +import org.bigbluebutton.common.messages.LockLayoutMessage + +class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) + case msg: MeetingMuted => handleMeetingMuted(msg) + case msg: MeetingState => handleMeetingState(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingHasEnded => handleMeetingHasEnded(msg) + case msg: DisconnectAllUsers => handleDisconnectAllUsers(msg) + case msg: DisconnectUser => handleDisconnectUser(msg) + case msg: PermissionsSettingInitialized => handlePermissionsSettingInitialized(msg) + case msg: NewPermissionsSetting => handleNewPermissionsSetting(msg) + case msg: UserLocked => handleUserLocked(msg) + case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg) + case msg: UserRegistered => handleUserRegistered(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: PresenterAssigned => handlePresenterAssigned(msg) + case msg: EndAndKickAll => handleEndAndKickAll(msg) + case msg: GetUsersReply => handleGetUsersReply(msg) + case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(msg) + case msg: ValidateAuthTokenTimedOut => handleValidateAuthTokenTimedOut(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserRaisedHand => handleUserRaisedHand(msg) + case msg: UserLoweredHand => handleUserLoweredHand(msg) + case msg: UserSharedWebcam => handleUserSharedWebcam(msg) + case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) + case msg: UserStatusChange => handleUserStatusChange(msg) + case msg: UserVoiceMuted => handleUserVoiceMuted(msg) + case msg: UserVoiceTalking => handleUserVoiceTalking(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: IsMeetingMutedReply => handleIsMeetingMutedReply(msg) + case msg: UserListeningOnly => handleUserListeningOnly(msg) + case msg: GetCurrentLayoutReply => handleGetCurrentLayoutReply(msg) + case msg: BroadcastLayoutEvent => handleBroadcastLayoutEvent(msg) + case msg: LockLayoutEvent => handleLockLayoutEvent(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def handleLockLayoutEvent(msg: LockLayoutEvent) { + val users = new java.util.ArrayList[String]; + msg.applyTo.foreach(uvo => { + users.add(uvo.userID) + }) + + val evt = new LockLayoutMessage(msg.meetingID, msg.setById, msg.locked, users) + service.send(MessagingConstants.FROM_USERS_CHANNEL, evt.toJson()) + } + + private def handleBroadcastLayoutEvent(msg: BroadcastLayoutEvent) { + val users = new java.util.ArrayList[String]; + msg.applyTo.foreach(uvo => { + users.add(uvo.userID) + }) + + val evt = new BroadcastLayoutMessage(msg.meetingID, msg.setByUserID, msg.layoutID, msg.locked, users) + service.send(MessagingConstants.FROM_USERS_CHANNEL, evt.toJson()) + } + + private def handleGetCurrentLayoutReply(msg: GetCurrentLayoutReply) { + val reply = new GetCurrentLayoutReplyMessage(msg.meetingID, msg.requesterID, msg.setByUserID, msg.layoutID, msg.locked) + service.send(MessagingConstants.FROM_USERS_CHANNEL, reply.toJson()) + } + + private def handleMeetingState(msg: MeetingState) { + val json = UsersMessageToJsonConverter.meetingState(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingMuted(msg: MeetingMuted) { + val json = UsersMessageToJsonConverter.meetingMuted(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingHasEnded(msg: MeetingHasEnded): Unit = { + val json = UsersMessageToJsonConverter.meetingHasEnded(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingEnded(msg: MeetingEnded): Unit = { + val json = UsersMessageToJsonConverter.meetingEnded(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleDisconnectAllUsers(msg: DisconnectAllUsers) { + val json = UsersMessageToJsonConverter.disconnectAllUsersToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleDisconnectUser(msg: DisconnectUser) { + val json = UsersMessageToJsonConverter.disconnectUserToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handlePermissionsSettingInitialized(msg: PermissionsSettingInitialized) { + val json = UsersMessageToJsonConverter.permissionsSettingInitializedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { + val json = UsersMessageToJsonConverter.newPermissionsSettingToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleUserLocked(msg: UserLocked) { + val json = UsersMessageToJsonConverter.userLockedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleGetPermissionsSettingReply(msg: GetPermissionsSettingReply) { + val json = UsersMessageToJsonConverter.getPermissionsSettingReplyToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleUserRegistered(msg: UserRegistered) { + val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleUserStatusChange(msg: UserStatusChange) { + val json = UsersMessageToJsonConverter.userStatusChangeToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserRaisedHand(msg: UserRaisedHand) { + val json = UsersMessageToJsonConverter.userRaisedHandToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserLoweredHand(msg: UserLoweredHand) { + val json = UsersMessageToJsonConverter.userLoweredHandToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserSharedWebcam(msg: UserSharedWebcam) { + val json = UsersMessageToJsonConverter.userSharedWebcamToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { + val json = UsersMessageToJsonConverter.userUnsharedWebcamToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleGetUsersReply(msg: GetUsersReply) { + val json = UsersMessageToJsonConverter.getUsersReplyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + val json = UsersMessageToJsonConverter.userJoinedVoice(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserVoiceMuted(msg: UserVoiceMuted) { + val json = UsersMessageToJsonConverter.userVoiceMuted(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserVoiceTalking(msg: UserVoiceTalking) { + val json = UsersMessageToJsonConverter.userVoiceTalking(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + val json = UsersMessageToJsonConverter.muteVoiceUserToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + val json = UsersMessageToJsonConverter.ejectVoiceUserToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + val json = UsersMessageToJsonConverter.userLeftVoiceToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) { + val json = UsersMessageToJsonConverter.isMeetingMutedReplyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + val json = UsersMessageToJsonConverter.recordingStatusChangedToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { + val json = UsersMessageToJsonConverter.getRecordingStatusReplyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) { + val json = UsersMessageToJsonConverter.validateAuthTokenReplyToJson(msg) + println("************** Publishing [" + json + "] *******************") + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleValidateAuthTokenTimedOut(msg: ValidateAuthTokenTimedOut) { + val json = UsersMessageToJsonConverter.validateAuthTokenTimeoutToJson(msg) + println("************** Publishing [" + json + "] *******************") + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserJoined(msg: UserJoined) { + val json = UsersMessageToJsonConverter.userJoinedToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleRegisteredUser(msg: UserRegistered) { + val json = UsersMessageToJsonConverter.userRegisteredToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserLeft(msg: UserLeft) { + val json = UsersMessageToJsonConverter.userLeftToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handlePresenterAssigned(msg: PresenterAssigned) { + val json = UsersMessageToJsonConverter.presenterAssignedToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleEndAndKickAll(msg: EndAndKickAll) { + val json = UsersMessageToJsonConverter.endAndKickAllToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } + + private def handleUserListeningOnly(msg: UserListeningOnly) { + val json = UsersMessageToJsonConverter.userListeningOnlyToJson(msg) + service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala new file mode 100755 index 0000000000..713a505691 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala @@ -0,0 +1,214 @@ +package org.bigbluebutton.core.apps.users.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.recorder.participants.ParticipantEndAndKickAllRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.AssignPresenterRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.ParticipantStatusChangeRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.ParticipantLeftRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.ParticipantJoinRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantMutedVoiceRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantTalkingVoiceRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantJoinedVoiceRecordEvent +import org.bigbluebutton.webconference.voice.ParticipantLeftVoiceRecordEvent +import org.bigbluebutton.conference.service.recorder.participants.RecordStatusRecordEvent +import org.bigbluebutton.webconference.voice.StartRecordingVoiceRecordEvent + +class UsersEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: EndAndKickAll => handleEndAndKickAll(msg) + case msg: PresenterAssigned => handleAssignPresenter(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: UserStatusChange => handleUserStatusChange(msg) + case msg: UserVoiceMuted => handleUserVoiceMuted(msg) + case msg: UserVoiceTalking => handleUserVoiceTalking(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: UserRaisedHand => handleUserRaisedHand(msg) + case msg: UserLoweredHand => handleUserLoweredHand(msg) + case msg: UserSharedWebcam => handleUserSharedWebcam(msg) + case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg) + case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) + case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def handleEndAndKickAll(msg: EndAndKickAll): Unit = { + if (msg.recorded) { + val ev = new ParticipantEndAndKickAllRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setMeetingId(msg.meetingID); + recorder.record(msg.meetingID, ev); + } + } + + private def handleUserJoined(msg: UserJoined): Unit = { + if (msg.recorded) { + val ev = new ParticipantJoinRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setUserId(msg.user.userID); + ev.setName(msg.user.name); + ev.setMeetingId(msg.meetingID); + ev.setRole(msg.user.role.toString()); + + recorder.record(msg.meetingID, ev); + } + } + + def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { + if (msg.recorded) { + val evt = new StartRecordingVoiceRecordEvent(true); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setRecordingTimestamp(msg.timestamp); + evt.setFilename(msg.recordingFile); + recorder.record(msg.meetingID, evt); + } + } + + def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { + if (msg.recorded) { + val evt = new StartRecordingVoiceRecordEvent(false); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setRecordingTimestamp(msg.timestamp); + evt.setFilename(msg.recordingFile); + recorder.record(msg.meetingID, evt); + } + } + + def handleUserVoiceMuted(msg: UserVoiceMuted) { + if (msg.recorded) { + val ev = new ParticipantMutedVoiceRecordEvent() + ev.setMeetingId(msg.meetingID); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setBridge(msg.confNum); + ev.setParticipant(msg.user.voiceUser.userId); + ev.setMuted(msg.user.voiceUser.muted); + + recorder.record(msg.meetingID, ev); + } + } + + def handleUserVoiceTalking(msg: UserVoiceTalking) { + if (msg.recorded) { + val evt = new ParticipantTalkingVoiceRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setParticipant(msg.user.userID); + evt.setTalking(msg.user.voiceUser.talking); + + recorder.record(msg.meetingID, evt); + } + } + + def handleUserJoinedVoice(msg: UserJoinedVoice) { + if (msg.recorded) { + val evt = new ParticipantJoinedVoiceRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setParticipant(msg.user.voiceUser.userId); + evt.setCallerName(msg.user.voiceUser.callerName); + evt.setCallerNumber(msg.user.voiceUser.callerNum); + evt.setMuted(msg.user.voiceUser.muted); + evt.setTalking(msg.user.voiceUser.talking); + + recorder.record(msg.meetingID, evt) + } + } + + def handleUserLeftVoice(msg: UserLeftVoice) { + if (msg.recorded) { + val evt = new ParticipantLeftVoiceRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setBridge(msg.confNum); + evt.setParticipant(msg.user.voiceUser.userId); + recorder.record(msg.meetingID, evt); + } + } + + def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + if (msg.recorded) { + val evt = new RecordStatusRecordEvent(); + evt.setMeetingId(msg.meetingID); + evt.setTimestamp(TimestampGenerator.generateTimestamp); + evt.setUserId(msg.userId); + evt.setRecordingStatus(msg.recording.toString); + + recorder.record(msg.meetingID, evt); + } + } + + private def handleUserLeft(msg: UserLeft): Unit = { + if (msg.recorded) { + val ev = new ParticipantLeftRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setUserId(msg.user.userID); + ev.setMeetingId(msg.meetingID); + + recorder.record(msg.meetingID, ev); + } + + } + + private def handleUserRaisedHand(msg: UserRaisedHand) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "raiseHand", true: java.lang.Boolean) + handleUserStatusChange(status) + } + + private def handleUserLoweredHand(msg: UserLoweredHand) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "raiseHand", false: java.lang.Boolean) + handleUserStatusChange(status) + } + + private def handleUserSharedWebcam(msg: UserSharedWebcam) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "hasStream", "true,stream=" + msg.stream) + handleUserStatusChange(status) + } + + private def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) { + val status = UserStatusChange(msg.meetingID, msg.recorded, + msg.userID, "hasStream", "false,stream=" + msg.stream) + handleUserStatusChange(status) + } + + private def handleUserStatusChange(msg: UserStatusChange): Unit = { + if (msg.recorded) { + val ev = new ParticipantStatusChangeRecordEvent(); + ev.setTimestamp(TimestampGenerator.generateTimestamp); + ev.setUserId(msg.userID); + ev.setMeetingId(msg.meetingID); + ev.setStatus(msg.status); + ev.setValue(msg.value.toString()); + + recorder.record(msg.meetingID, ev); + } + } + + private def handleAssignPresenter(msg: PresenterAssigned): Unit = { + if (msg.recorded) { + val event = new AssignPresenterRecordEvent(); + event.setMeetingId(msg.meetingID); + event.setTimestamp(TimestampGenerator.generateTimestamp); + event.setUserId(msg.presenter.presenterID); + event.setName(msg.presenter.presenterName); + event.setAssignedBy(msg.presenter.assignedBy); + + recorder.record(msg.meetingID, event); + } + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala new file mode 100755 index 0000000000..ebc42c4f17 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala @@ -0,0 +1,429 @@ +package org.bigbluebutton.core.apps.users.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.common.messages.MessagingConstants +import org.bigbluebutton.core.messaging.Util +import com.google.gson.Gson +import org.bigbluebutton.core.api.UserVO +import collection.JavaConverters._ +import scala.collection.JavaConversions._ + +object UsersMessageToJsonConverter { + private def userToMap(user: UserVO): java.util.Map[String, Any] = { + + val wuser = new scala.collection.mutable.HashMap[String, Any] + wuser += "userid" -> user.userID + wuser += "extern_userid" -> user.externUserID + wuser += "name" -> user.name + wuser += "role" -> user.role.toString() + wuser += "raise_hand" -> user.raiseHand + wuser += "presenter" -> user.presenter + wuser += "has_stream" -> user.hasStream + wuser += "locked" -> user.locked + wuser += "webcam_stream" -> user.webcamStreams + wuser += "phone_user" -> user.phoneUser + wuser += "listenOnly" -> user.listenOnly + + val vuser = new scala.collection.mutable.HashMap[String, Any] + vuser += "userid" -> user.voiceUser.userId + vuser += "web_userid" -> user.voiceUser.webUserId + vuser += "callername" -> user.voiceUser.callerName + vuser += "callernum" -> user.voiceUser.callerNum + vuser += "joined" -> user.voiceUser.joined + vuser += "locked" -> user.voiceUser.locked + vuser += "muted" -> user.voiceUser.muted + vuser += "talking" -> user.voiceUser.talking + + wuser.put("voiceUser", mapAsJavaMap(vuser)) + + mapAsJavaMap(wuser) + } + + private def registeredUserToMap(user: RegisteredUser): java.util.Map[String, Any] = { + val wuser = new scala.collection.mutable.HashMap[String, Any] + wuser += "userid" -> user.id + wuser += "extern_userid" -> user.externId + wuser += "name" -> user.name + wuser += "role" -> user.role.toString() + wuser += "authToken" -> user.authToken + + mapAsJavaMap(wuser) + } + + private def buildPermissionsHashMap(perms: Permissions): java.util.HashMap[String, java.lang.Boolean] = { + val args = new java.util.HashMap[String, java.lang.Boolean](); + args.put("disableCam", perms.disableCam: java.lang.Boolean); + args.put("disableMic", perms.disableMic: java.lang.Boolean); + args.put("disablePrivChat", perms.disablePrivChat: java.lang.Boolean); + args.put("disablePubChat", perms.disablePubChat: java.lang.Boolean); + args.put("lockedLayout", perms.lockedLayout: java.lang.Boolean); + args.put("lockOnJoin", perms.lockOnJoin: java.lang.Boolean); + args.put("lockOnJoinConfigurable", perms.lockOnJoinConfigurable: java.lang.Boolean); + args + } + + def meetingState(msg: MeetingState): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PERMISSIONS, buildPermissionsHashMap(msg.permissions)) + payload.put(Constants.MEETING_MUTED, msg.meetingMuted: java.lang.Boolean); + payload.put(Constants.USER_ID, msg.userId); + + val header = Util.buildHeader(MessageNames.MEETING_STATE, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingMuted(msg: MeetingMuted): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MEETING_MUTED, msg.meetingMuted: java.lang.Boolean); + + val header = Util.buildHeader(MessageNames.MEETING_MUTED, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingHasEnded(msg: MeetingHasEnded): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.MEETING_HAS_ENDED, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingEnded(msg: MeetingEnded): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) + Util.buildJson(header, payload) + } + + def disconnectAllUsersToJson(msg: DisconnectAllUsers): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.DISCONNECT_ALL_USERS, msg.version, None) + Util.buildJson(header, payload) + } + + def disconnectUserToJson(msg: DisconnectUser): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = Util.buildHeader(MessageNames.DISCONNECT_USER, msg.version, None) + Util.buildJson(header, payload) + } + + def permissionsSettingInitializedToJson(msg: PermissionsSettingInitialized): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested + + val header = Util.buildHeader(MessageNames.PERMISSION_SETTING_INITIALIZED, msg.version, None) + Util.buildJson(header, payload) + } + + def newPermissionsSettingToJson(msg: NewPermissionsSetting): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.PERMISSIONS, buildPermissionsHashMap(msg.permissions)) + + val users = new java.util.ArrayList[java.util.Map[String, Any]] + msg.applyTo.foreach(uvo => { + users.add(userToMap(uvo)) + }) + + payload.put("users", users) + + val header = Util.buildHeader(MessageNames.NEW_PERMISSION_SETTINGS, msg.version, None) + Util.buildJson(header, payload) + } + + def userLockedToJson(msg: UserLocked): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.LOCKED, msg.lock) + + val header = Util.buildHeader(MessageNames.USER_LOCKED, msg.version, None) + Util.buildJson(header, payload) + } + + def getPermissionsSettingReplyToJson(msg: GetPermissionsSettingReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = Util.buildHeader(MessageNames.GET_PERMISSION_SETTINGS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def userRegisteredToJson(msg: UserRegistered): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER, registeredUserToMap(msg.user)) + payload.put(Constants.RECORDED, msg.recorded) + + val header = Util.buildHeader(MessageNames.USER_REGISTERED, msg.version, None) + Util.buildJson(header, payload) + } + + def userRaisedHandToJson(msg: UserRaisedHand): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.raisedHand) + payload.put(Constants.USER_ID, msg.userID) + + val header = Util.buildHeader(MessageNames.USER_RAISED_HAND, msg.version, None) + Util.buildJson(header, payload) + } + + def userLoweredHandToJson(msg: UserLoweredHand): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RAISE_HAND, msg.raisedHand) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LOWERED_BY, msg.loweredBy) + + val header = Util.buildHeader(MessageNames.USER_LOWERED_HAND, msg.version, None) + Util.buildJson(header, payload) + } + + def userStatusChangeToJson(msg: UserStatusChange): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STATUS, msg.status) + payload.put(Constants.VALUE, msg.value.toString) + + val header = Util.buildHeader(MessageNames.USER_STATUS_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def userSharedWebcamToJson(msg: UserSharedWebcam): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = Util.buildHeader(MessageNames.USER_SHARED_WEBCAM, msg.version, None) + Util.buildJson(header, payload) + } + + def userUnsharedWebcamToJson(msg: UserUnsharedWebcam): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.STREAM, msg.stream) + + val header = Util.buildHeader(MessageNames.USER_UNSHARED_WEBCAM, msg.version, None) + Util.buildJson(header, payload) + } + + def broadcastLayout(msg: BroadcastLayoutEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val users = new java.util.ArrayList[String]; + msg.applyTo.foreach(uvo => { + users.add(uvo.userID) + }) + + payload.put(Constants.USERS, users) + + val header = Util.buildHeader(MessageNames.GET_USERS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def getUsersReplyToJson(msg: GetUsersReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val users = new java.util.ArrayList[java.util.Map[String, Any]]; + msg.users.foreach(uvo => { + users.add(userToMap(uvo)) + }) + + payload.put(Constants.USERS, users) + + val header = Util.buildHeader(MessageNames.GET_USERS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def userJoinedVoice(msg: UserJoinedVoice): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_JOINED_VOICE, msg.version, None) + Util.buildJson(header, payload) + } + + def userVoiceMuted(msg: UserVoiceMuted): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_VOICE_MUTED, msg.version, None) + Util.buildJson(header, payload) + } + + def userVoiceTalking(msg: UserVoiceTalking): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_VOICE_TALKING, msg.version, None) + Util.buildJson(header, payload) + } + + def muteVoiceUserToJson(msg: MuteVoiceUser): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.MUTE, msg.mute) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) + Util.buildJson(header, payload) + } + + def ejectVoiceUserToJson(msg: EjectVoiceUser): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) + Util.buildJson(header, payload) + } + + def userLeftVoiceToJson(msg: UserLeftVoice): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER, userToMap(msg.user)) + payload.put(Constants.VOICE_CONF, msg.confNum) + + val header = Util.buildHeader(MessageNames.USER_LEFT_VOICE, msg.version, None) + Util.buildJson(header, payload) + } + + def isMeetingMutedReplyToJson(msg: IsMeetingMutedReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.MUTED, msg.meetingMuted) + + val header = Util.buildHeader(MessageNames.IS_MEETING_MUTED_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def recordingStatusChangedToJson(msg: RecordingStatusChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def validateAuthTokenReplyToJson(msg: ValidateAuthTokenReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.REPLY_TO, msg.correlationId) + payload.put(Constants.VALID, msg.valid.toString) + payload.put(Constants.USER_ID, msg.requesterId) + payload.put(Constants.AUTH_TOKEN, msg.token) + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.VALIDATE_AUTH_TOKEN_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def validateAuthTokenTimeoutToJson(msg: ValidateAuthTokenTimedOut): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.REPLY_TO, msg.correlationId) + payload.put(Constants.VALID, msg.valid.toString) + payload.put(Constants.AUTH_TOKEN, msg.token) + payload.put(Constants.USER_ID, msg.requesterId) + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.VALIDATE_AUTH_TOKEN_TIMEOUT, msg.version, None) + Util.buildJson(header, payload) + } + + def userJoinedToJson(msg: UserJoined): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put("user", userToMap(msg.user)) + + val header = Util.buildHeader(MessageNames.USER_JOINED, msg.version, None) + Util.buildJson(header, payload) + } + + def userLeftToJson(msg: UserLeft): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put("user", userToMap(msg.user)) + + val header = Util.buildHeader(MessageNames.USER_LEFT, msg.version, None) + Util.buildJson(header, payload) + } + + def presenterAssignedToJson(msg: PresenterAssigned): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.NEW_PRESENTER_ID, msg.presenter.presenterID); + payload.put(Constants.NEW_PRESENTER_NAME, msg.presenter.presenterName); + payload.put(Constants.ASSIGNED_BY, msg.presenter.assignedBy); + payload.put(Constants.RECORDED, msg.recorded) + + val header = Util.buildHeader(MessageNames.PRESENTER_ASSIGNED, msg.version, None) + Util.buildJson(header, payload) + } + + def endAndKickAllToJson(msg: EndAndKickAll): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + + val header = Util.buildHeader(MessageNames.END_AND_KICK_ALL, msg.version, None) + Util.buildJson(header, payload) + } + + def userListeningOnlyToJson(msg: UserListeningOnly): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userID) + payload.put(Constants.LISTEN_ONLY, msg.listenOnly) + + val header = Util.buildHeader(MessageNames.USER_LISTEN_ONLY, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala new file mode 100644 index 0000000000..f888c21f6e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala @@ -0,0 +1,34 @@ +package org.bigbluebutton.core.apps.voice + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.MeetingActor + +trait VoiceApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + def handleMuteAllExceptPresenterRequest(msg: MuteAllExceptPresenterRequest) { + + } + + def handleMuteMeetingRequest(msg: MuteMeetingRequest) { + + } + + def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) { + + } + + def handleMuteUserRequest(msg: MuteUserRequest) { + + } + + def handleLockUserRequest(msg: LockUserRequest) { + + } + + def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) { + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala new file mode 100644 index 0000000000..f06efed41d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala @@ -0,0 +1,65 @@ +package org.bigbluebutton.core.apps.voice + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ + +class VoiceInGateway(bbbGW: BigBlueButtonGateway) { + + def muteAllExceptPresenter(meetingID: String, requesterID: String, mute: Boolean) { + bbbGW.accept(new MuteAllExceptPresenterRequest(meetingID, requesterID, mute)) + } + + def muteAllUsers(meetingID: String, requesterID: String, mute: Boolean) { + bbbGW.accept(new MuteMeetingRequest(meetingID, requesterID, mute)) + } + + def isMeetingMuted(meetingID: String, requesterID: String) { + bbbGW.accept(new IsMeetingMutedRequest(meetingID, requesterID)) + } + + def muteUser(meetingID: String, requesterID: String, userID: String, mute: Boolean) { + bbbGW.accept(new MuteUserRequest(meetingID, requesterID, userID, mute)) + } + + def lockUser(meetingID: String, requesterID: String, userID: String, lock: Boolean) { + bbbGW.accept(new LockUserRequest(meetingID, requesterID, userID, lock)) + } + + def ejectUserFromVoice(meetingID: String, userId: String, ejectedBy: String) { + bbbGW.accept(new EjectUserFromVoiceRequest(meetingID, userId, ejectedBy)) + } + + def voiceUserJoined(meetingId: String, userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, + muted: Boolean, talking: Boolean) { + // println("VoiceInGateway: Got voiceUserJoined message for meeting [" + meetingId + "] user[" + callerIdName + "]") + val voiceUser = new VoiceUser(userId, webUserId, + callerIdName, callerIdNum, + true, false, muted, talking) + bbbGW.accept(new VoiceUserJoined(meetingId, voiceUser)) + } + + def voiceUserLeft(meetingId: String, userId: String) { + // println("VoiceInGateway: Got voiceUserLeft message for meeting [" + meetingId + "] user[" + userId + "]") + bbbGW.accept(new VoiceUserLeft(meetingId, userId)) + } + + def voiceUserLocked(meetingId: String, userId: String, locked: Boolean) { + bbbGW.accept(new VoiceUserLocked(meetingId, userId, locked)) + } + + def voiceUserMuted(meetingId: String, userId: String, muted: Boolean) { + bbbGW.accept(new VoiceUserMuted(meetingId, userId, muted)) + } + + def voiceUserTalking(meetingId: String, userId: String, talking: Boolean) { + bbbGW.accept(new VoiceUserTalking(meetingId, userId, talking)) + } + + def voiceRecording(meetingId: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + bbbGW.accept(new VoiceRecording(meetingId, recordingFile, + timestamp, recording)) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala new file mode 100644 index 0000000000..68ffa83d20 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardApp.scala @@ -0,0 +1,100 @@ +package org.bigbluebutton.core.apps.whiteboard + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil +import org.bigbluebutton.core.MeetingActor +import org.bigbluebutton.core.apps.whiteboard.vo._ + +case class Whiteboard(id: String, shapes: Seq[AnnotationVO]) + +trait WhiteboardApp { + this: MeetingActor => + + val outGW: MessageOutGateway + + private val wbModel = new WhiteboardModel + + def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { + val status = msg.annotation.status + val shapeType = msg.annotation.shapeType + val wbId = msg.annotation.wbId + val shape = msg.annotation + + initWhiteboard(wbId) + + // println("Received whiteboard shape. status=[" + status + "], shapeType=[" + shapeType + "]") + + if (WhiteboardKeyUtil.TEXT_CREATED_STATUS == status) { + // println("Received textcreated status") + wbModel.addAnnotation(wbId, shape) + } else if ((WhiteboardKeyUtil.PENCIL_TYPE == shapeType) + && (WhiteboardKeyUtil.DRAW_START_STATUS == status)) { + // println("Received pencil draw start status") + wbModel.addAnnotation(wbId, shape) + } else if ((WhiteboardKeyUtil.DRAW_END_STATUS == status) + && ((WhiteboardKeyUtil.RECTANGLE_TYPE == shapeType) + || (WhiteboardKeyUtil.ELLIPSE_TYPE == shapeType) + || (WhiteboardKeyUtil.TRIANGLE_TYPE == shapeType) + || (WhiteboardKeyUtil.LINE_TYPE == shapeType))) { + // println("Received [" + shapeType +"] draw end status") + wbModel.addAnnotation(wbId, shape) + } else if (WhiteboardKeyUtil.TEXT_TYPE == shapeType) { + // println("Received [" + shapeType +"] modify text status") + wbModel.modifyText(wbId, shape) + } else { + // println("Received UNKNOWN whiteboard shape!!!!. status=[" + status + "], shapeType=[" + shapeType + "]") + } + wbModel.getWhiteboard(wbId) foreach { wb => + // println("WhiteboardApp::handleSendWhiteboardAnnotationRequest - num shapes [" + wb.shapes.length + "]") + outGW.send(new SendWhiteboardAnnotationEvent(meetingID, recorded, + msg.requesterID, wbId, msg.annotation)) + } + + } + + private def initWhiteboard(wbId: String) { + if (!wbModel.hasWhiteboard(wbId)) { + wbModel.createWhiteboard(wbId) + } + } + + def handleGetWhiteboardShapesRequest(msg: GetWhiteboardShapesRequest) { + //println("WB: Received page history [" + msg.whiteboardId + "]") + wbModel.history(msg.whiteboardId) foreach { wb => + outGW.send(new GetWhiteboardShapesReply(meetingID, recorded, + msg.requesterID, wb.id, wb.shapes.toArray, msg.replyTo)) + } + } + + def handleClearWhiteboardRequest(msg: ClearWhiteboardRequest) { + //println("WB: Received clear whiteboard") + wbModel.clearWhiteboard(msg.whiteboardId) + wbModel.getWhiteboard(msg.whiteboardId) foreach { wb => + outGW.send(new ClearWhiteboardEvent(meetingID, recorded, + msg.requesterID, wb.id)) + } + } + + def handleUndoWhiteboardRequest(msg: UndoWhiteboardRequest) { + // println("WB: Received undo whiteboard") + + wbModel.getWhiteboard(msg.whiteboardId) foreach { wb => + wbModel.undoWhiteboard(msg.whiteboardId) foreach { last => + outGW.send(new UndoWhiteboardEvent(meetingID, recorded, + msg.requesterID, wb.id, last.id)) + } + } + } + + def handleEnableWhiteboardRequest(msg: EnableWhiteboardRequest) { + wbModel.enableWhiteboard(msg.enable) + outGW.send(new WhiteboardEnabledEvent(meetingID, recorded, + msg.requesterID, msg.enable)) + } + + def handleIsWhiteboardEnabledRequest(msg: IsWhiteboardEnabledRequest) { + val enabled = wbModel.isWhiteboardEnabled() + outGW.send(new IsWhiteboardEnabledReply(meetingID, recorded, + msg.requesterID, enabled, msg.replyTo)) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala new file mode 100755 index 0000000000..87a8edead7 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardInGateway.scala @@ -0,0 +1,54 @@ +package org.bigbluebutton.core.apps.whiteboard + +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO + +class WhiteboardInGateway(bbbGW: BigBlueButtonGateway) { + + private def buildAnnotation(annotation: Map[String, Object]): Option[AnnotationVO] = { + var shape: Option[AnnotationVO] = None + + val id = annotation.getOrElse("id", null).asInstanceOf[String] + val shapeType = annotation.getOrElse("type", null).asInstanceOf[String] + val status = annotation.getOrElse("status", null).asInstanceOf[String] + val wbId = annotation.getOrElse("whiteboardId", null).asInstanceOf[String] + // println("** GOT ANNOTATION status[" + status + "] shape=[" + shapeType + "]"); + + if (id != null && shapeType != null && status != null && wbId != null) { + shape = Some(new AnnotationVO(id, status, shapeType, annotation.toMap, wbId)) + } + + shape + } + + def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: Map[String, Object]) { + buildAnnotation(annotation) match { + case Some(shape) => { + bbbGW.accept(new SendWhiteboardAnnotationRequest(meetingID, requesterID, shape)) + } + case None => // do nothing + } + } + + def requestWhiteboardAnnotationHistory(meetingID: String, requesterID: String, whiteboardId: String, replyTo: String) { + bbbGW.accept(new GetWhiteboardShapesRequest(meetingID, requesterID, whiteboardId, replyTo)) + } + + def clearWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { + bbbGW.accept(new ClearWhiteboardRequest(meetingID, requesterID, whiteboardId)) + } + + def undoWhiteboard(meetingID: String, requesterID: String, whiteboardId: String) { + bbbGW.accept(new UndoWhiteboardRequest(meetingID, requesterID, whiteboardId)) + } + + def enableWhiteboard(meetingID: String, requesterID: String, enable: Boolean) { + bbbGW.accept(new EnableWhiteboardRequest(meetingID, requesterID, enable)) + } + + def isWhiteboardEnabled(meetingID: String, requesterID: String, replyTo: String) { + bbbGW.accept(new IsWhiteboardEnabledRequest(meetingID, requesterID, replyTo)) + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala new file mode 100644 index 0000000000..831b7e9112 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/WhiteboardModel.scala @@ -0,0 +1,87 @@ +package org.bigbluebutton.core.apps.whiteboard + +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import scala.collection.mutable.ArrayBuffer + +class WhiteboardModel { + private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]() + + private var _enabled = true + + private def saveWhiteboard(wb: Whiteboard) { + _whiteboards += wb.id -> wb + } + + def getWhiteboard(id: String): Option[Whiteboard] = { + _whiteboards.values.find(wb => wb.id == id) + } + + def hasWhiteboard(id: String): Boolean = { + _whiteboards.contains(id) + } + + def createWhiteboard(wbId: String) { + val vec = scala.collection.immutable.Vector.empty + val wb = new Whiteboard(wbId, vec) + saveWhiteboard(wb) + } + + def addAnnotationToShape(wb: Whiteboard, shape: AnnotationVO) = { + // println("Adding shape to wb [" + wb.id + "]. Before numShapes=[" + wb.shapes.length + "].") + val newWb = wb.copy(shapes = (wb.shapes :+ shape)) + // println("Adding shape to page [" + wb.id + "]. After numShapes=[" + newWb.shapes.length + "].") + saveWhiteboard(newWb) + } + + def addAnnotation(wbId: String, shape: AnnotationVO) { + getWhiteboard(wbId) foreach { wb => + addAnnotationToShape(wb, shape) + } + } + + private def modifyTextInPage(wb: Whiteboard, shape: AnnotationVO) = { + val removedLastText = wb.shapes.dropRight(1) + val addedNewText = removedLastText :+ shape + val newWb = wb.copy(shapes = addedNewText) + saveWhiteboard(newWb) + } + + def modifyText(wbId: String, shape: AnnotationVO) { + getWhiteboard(wbId) foreach { wb => + modifyTextInPage(wb, shape) + } + } + + def history(wbId: String): Option[Whiteboard] = { + getWhiteboard(wbId) + } + + def clearWhiteboard(wbId: String) { + getWhiteboard(wbId) foreach { wb => + val clearedShapes = wb.shapes.drop(wb.shapes.length) + val newWb = wb.copy(shapes = clearedShapes) + saveWhiteboard(newWb) + } + } + + def undoWhiteboard(wbId: String): Option[AnnotationVO] = { + var last: Option[AnnotationVO] = None + getWhiteboard(wbId) foreach { wb => + if (!wb.shapes.isEmpty) { + last = Some(wb.shapes.last) + val remaining = wb.shapes.dropRight(1) + val newWb = wb.copy(shapes = remaining) + saveWhiteboard(newWb) + } + } + last + } + + def enableWhiteboard(enable: Boolean) { + _enabled = enable + } + + def isWhiteboardEnabled(): Boolean = { + _enabled + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala new file mode 100755 index 0000000000..272ab7c5d9 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala @@ -0,0 +1,56 @@ +package org.bigbluebutton.core.apps.whiteboard.redis + +import org.bigbluebutton.core.api._ +import scala.collection.JavaConversions._ +import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil +import scala.collection.immutable.StringOps +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.common.messages.MessagingConstants + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +class WhiteboardEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + def handleMessage(msg: IOutMessage) { + msg match { + case msg: GetWhiteboardShapesReply => handleGetWhiteboardShapesReply(msg) + case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) + case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) + case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) + case msg: WhiteboardEnabledEvent => handleWhiteboardEnabledEvent(msg) + case msg: IsWhiteboardEnabledReply => handleIsWhiteboardEnabledReply(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def handleGetWhiteboardShapesReply(msg: GetWhiteboardShapesReply) { + val json = WhiteboardMessageToJsonConverter.getWhiteboardShapesReplyToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { + val json = WhiteboardMessageToJsonConverter.sendWhiteboardAnnotationEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.clearWhiteboardEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { + val json = WhiteboardMessageToJsonConverter.undoWhiteboardEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleWhiteboardEnabledEvent(msg: WhiteboardEnabledEvent) { + val json = WhiteboardMessageToJsonConverter.whiteboardEnabledEventToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + + private def handleIsWhiteboardEnabledReply(msg: IsWhiteboardEnabledReply) { + val json = WhiteboardMessageToJsonConverter.isWhiteboardEnabledReplyToJson(msg) + service.send(MessagingConstants.FROM_WHITEBOARD_CHANNEL, json) + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala new file mode 100644 index 0000000000..6520e72e3b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala @@ -0,0 +1,92 @@ +package org.bigbluebutton.core.apps.whiteboard.redis + +import org.bigbluebutton.conference.service.recorder.RecorderApplication +import org.bigbluebutton.core.api._ +import org.bigbluebutton.conference.service.whiteboard.redis.AddShapeWhiteboardRecordEvent +import scala.collection.JavaConversions._ +import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil +import org.bigbluebutton.conference.service.whiteboard.redis.AddTextWhiteboardRecordEvent +import org.bigbluebutton.conference.service.whiteboard.redis.ClearPageWhiteboardRecordEvent +import org.bigbluebutton.conference.service.whiteboard.redis.UndoShapeWhiteboardRecordEvent +import org.bigbluebutton.conference.service.whiteboard.redis.ModifyTextWhiteboardRecordEvent +import scala.collection.immutable.StringOps + +class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: SendWhiteboardAnnotationEvent => handleSendWhiteboardAnnotationEvent(msg) + case msg: ClearWhiteboardEvent => handleClearWhiteboardEvent(msg) + case msg: UndoWhiteboardEvent => handleUndoWhiteboardEvent(msg) + case _ => //println("Unhandled message in UsersClientMessageSender") + } + } + + private def getPresentationId(whiteboardId: String): String = { + // Need to split the whiteboard id into presenation id and page num as the old + // recording expects them + val strId = new StringOps(whiteboardId) + val ids = strId.split('/') + var presId: String = "" + if (ids.length == 2) { + presId = ids(0) + } + + presId + } + + private def getPageNum(whiteboardId: String): String = { + val strId = new StringOps(whiteboardId) + val ids = strId.split('/') + var pageNum = "0" + if (ids.length == 2) { + pageNum = ids(1) + } + pageNum + } + + private def handleSendWhiteboardAnnotationEvent(msg: SendWhiteboardAnnotationEvent) { + if ((msg.shape.shapeType == WhiteboardKeyUtil.TEXT_TYPE) && (msg.shape.status != WhiteboardKeyUtil.TEXT_CREATED_STATUS)) { + + val event = new ModifyTextWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId) + event.addAnnotation(mapAsJavaMap(msg.shape.shape)) + recorder.record(msg.meetingID, event) + } else { + val event = new AddShapeWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId); + event.addAnnotation(mapAsJavaMap(msg.shape.shape)) + recorder.record(msg.meetingID, event) + } + } + + private def handleClearWhiteboardEvent(msg: ClearWhiteboardEvent) { + val event = new ClearPageWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId) + recorder.record(msg.meetingID, event) + } + + private def handleUndoWhiteboardEvent(msg: UndoWhiteboardEvent) { + val event = new UndoShapeWhiteboardRecordEvent() + event.setMeetingId(msg.meetingID) + event.setTimestamp(TimestampGenerator.generateTimestamp) + event.setPresentation(getPresentationId(msg.whiteboardId)) + event.setPageNumber(getPageNum(msg.whiteboardId)) + event.setWhiteboardId(msg.whiteboardId) + event.setShapeId(msg.shapeId); + recorder.record(msg.meetingID, event) + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala new file mode 100755 index 0000000000..6a9db85067 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala @@ -0,0 +1,94 @@ +package org.bigbluebutton.core.apps.whiteboard.redis + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.messaging.Util +import org.bigbluebutton.core.apps.whiteboard.vo.AnnotationVO +import collection.JavaConverters._ +import scala.collection.JavaConversions._ + +object WhiteboardMessageToJsonConverter { + private def shapeToMap(shape: AnnotationVO): java.util.Map[String, Any] = { + val res = new scala.collection.mutable.HashMap[String, Any] + res += "id" -> shape.id + res += "status" -> shape.status + res += "shape_type" -> shape.shapeType + res += "wb_id" -> shape.wbId + + val shapeMap = new scala.collection.mutable.HashMap[String, Any]() + for ((key, value) <- shape.shape) { + shapeMap += key -> value + } + res += "shape" -> mapAsJavaMap(shapeMap) + + mapAsJavaMap(res) + } + + def getWhiteboardShapesReplyToJson(msg: GetWhiteboardShapesReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val shapes = new java.util.ArrayList[java.util.Map[String, Any]]() + msg.shapes.foreach { shape => + shapes.add(shapeToMap(shape)) + } + + payload.put(Constants.SHAPES, shapes) + + val header = Util.buildHeader(MessageNames.GET_WHITEBOARD_SHAPES_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } + + def sendWhiteboardAnnotationEventToJson(msg: SendWhiteboardAnnotationEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + payload.put(Constants.SHAPE, shapeToMap(msg.shape)) + + val header = Util.buildHeader(MessageNames.SEND_WHITEBOARD_SHAPE, msg.version, None) + Util.buildJson(header, payload) + } + + def clearWhiteboardEventToJson(msg: ClearWhiteboardEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + + val header = Util.buildHeader(MessageNames.WHITEBOARD_CLEARED, msg.version, None) + Util.buildJson(header, payload) + } + + def undoWhiteboardEventToJson(msg: UndoWhiteboardEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.WHITEBOARD_ID, msg.whiteboardId) + payload.put(Constants.SHAPE_ID, msg.shapeId) + + val header = Util.buildHeader(MessageNames.UNDO_WHITEBOARD, msg.version, None) + Util.buildJson(header, payload) + } + + def whiteboardEnabledEventToJson(msg: WhiteboardEnabledEvent): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ENABLE, msg.enable) + + val header = Util.buildHeader(MessageNames.WHITEBOARD_ENABLED, msg.version, None) + Util.buildJson(header, payload) + } + + def isWhiteboardEnabledReplyToJson(msg: IsWhiteboardEnabledReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.ENABLE, msg.enabled) + + val header = Util.buildHeader(MessageNames.IS_WHITEBOARD_ENABLED_REPLY, msg.version, Some(msg.replyTo)) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala new file mode 100755 index 0000000000..8d373be551 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/vo/ValueObjects.scala @@ -0,0 +1,3 @@ +package org.bigbluebutton.core.apps.whiteboard.vo + +case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Object], wbId: String) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala new file mode 100755 index 0000000000..8b801eae80 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala @@ -0,0 +1,94 @@ +package org.bigbluebutton.core.meeting + +import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.api._ +import scala.collection.immutable.HashMap +import com.google.gson.Gson +import scala.collection.JavaConverters._ +import org.bigbluebutton.common.messages.MessagingConstants + +class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { + + private val KEEP_ALIVE_REPLY = "KEEP_ALIVE_REPLY" + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) + case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) + case msg: RecordingStatusChanged => handleRecordingStatusChanged(msg) + case msg: GetRecordingStatusReply => handleGetRecordingStatusReply(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingHasEnded => handleMeetingHasEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: KeepAliveMessageReply => handleKeepAliveMessageReply(msg) + case msg: StartRecording => handleStartRecording(msg) + case msg: StopRecording => handleStopRecording(msg) + case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg) + case _ => //println("Unhandled message in MeetingEventRedisPublisher") + } + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg) + // System.out.println("****\n" + json) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply) { + val json = MeetingMessageToJsonConverter.keepAliveMessageReplyToJson(msg) + service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, json) + } + + private def handleMeetingCreated(msg: MeetingCreated) { + val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg) + // System.out.println("****\n" + json) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingEnded(msg: MeetingEnded) { + val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg) + // System.out.println("****\n" + json) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleStartRecording(msg: StartRecording) { + val json = MeetingMessageToJsonConverter.startRecordingToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleStopRecording(msg: StopRecording) { + val json = MeetingMessageToJsonConverter.stopRecordingToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) { + val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) { + val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleRecordingStatusChanged(msg: RecordingStatusChanged) { + val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) { + val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleMeetingHasEnded(msg: MeetingHasEnded) { + val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } + + private def handleGetAllMeetingsReply(msg: GetAllMeetingsReply) { + val json = MeetingMessageToJsonConverter.getAllMeetingsReplyToJson(msg) + service.send(MessagingConstants.FROM_MEETING_CHANNEL, json) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala new file mode 100644 index 0000000000..2dba6e981f --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala @@ -0,0 +1,132 @@ +package org.bigbluebutton.core.meeting + +import org.bigbluebutton.core.messaging.Util +import org.bigbluebutton.core.api._ +import com.google.gson.Gson +import scala.collection.JavaConverters._ + +object MeetingMessageToJsonConverter { + def meetingDestroyedToJson(msg: MeetingDestroyed): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.MEETING_DESTROYED_EVENT, msg.version, None) + Util.buildJson(header, payload) + } + + def keepAliveMessageReplyToJson(msg: KeepAliveMessageReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.KEEP_ALIVE_ID, msg.aliveID) + + val header = Util.buildHeader(MessageNames.KEEP_ALIVE_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingCreatedToJson(msg: MeetingCreated): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.EXTERNAL_MEETING_ID, msg.externalMeetingID) + payload.put(Constants.NAME, msg.name) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.VOICE_CONF, msg.voiceBridge) + payload.put(Constants.DURATION, msg.duration) + payload.put(Constants.MODERATOR_PASS, msg.moderatorPass) + payload.put(Constants.VIEWER_PASS, msg.viewerPass) + payload.put(Constants.CREATE_TIME, msg.createTime) + payload.put(Constants.CREATE_DATE, msg.createDate) + + val header = Util.buildHeader(MessageNames.MEETING_CREATED, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingEndedToJson(msg: MeetingEnded): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + + val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) + Util.buildJson(header, payload) + } + + def voiceRecordingStartedToJson(msg: VoiceRecordingStarted): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.RECORDING_FILE, msg.recordingFile) + payload.put(Constants.VOICE_CONF, msg.confNum) + payload.put(Constants.TIMESTAMP, msg.timestamp) + + val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STARTED, msg.version, None) + Util.buildJson(header, payload) + } + + def voiceRecordingStoppedToJson(msg: VoiceRecordingStopped): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.RECORDING_FILE, msg.recordingFile) + payload.put(Constants.VOICE_CONF, msg.confNum) + payload.put(Constants.TIMESTAMP, msg.timestamp) + + val header = Util.buildHeader(MessageNames.VOICE_RECORDING_STOPPED, msg.version, None) + Util.buildJson(header, payload) + } + + def recordingStatusChangedToJson(msg: RecordingStatusChanged): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.RECORDING_STATUS_CHANGED, msg.version, None) + Util.buildJson(header, payload) + } + + def getRecordingStatusReplyToJson(msg: GetRecordingStatusReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.USER_ID, msg.userId) + payload.put(Constants.RECORDING, msg.recording) + + val header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } + + def meetingHasEndedToJson(msg: MeetingHasEnded): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.USER_ID, msg.userId) + + val header = Util.buildHeader(MessageNames.MEETING_ENDED, msg.version, None) + Util.buildJson(header, payload) + } + + def startRecordingToJson(msg: StartRecording): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.START_RECORDING, msg.version, None) + Util.buildJson(header, payload) + } + + def stopRecordingToJson(msg: StopRecording): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put(Constants.MEETING_ID, msg.meetingID) + payload.put(Constants.RECORDED, msg.recorded) + payload.put(Constants.REQUESTER_ID, msg.requesterID) + + val header = Util.buildHeader(MessageNames.STOP_RECORDING, msg.version, None) + Util.buildJson(header, payload) + } + + def getAllMeetingsReplyToJson(msg: GetAllMeetingsReply): String = { + val payload = new java.util.HashMap[String, Any]() + payload.put("meetings", msg.meetings) + + val header = Util.buildHeader(MessageNames.GET_ALL_MEETINGS_REPLY, msg.version, None) + Util.buildJson(header, payload) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala new file mode 100644 index 0000000000..3e3eb7337c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/messaging/Util.scala @@ -0,0 +1,32 @@ +package org.bigbluebutton.core.messaging + +import org.bigbluebutton.core.api._ +import com.google.gson.Gson + +object Util { + + val VERSION = "version" + + def buildHeader(name: String, version: String, + replyTo: Option[String]): java.util.HashMap[String, Any] = { + val header = new java.util.HashMap[String, Any]() + header.put(Constants.NAME, name) + header.put(VERSION, version) + header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) + header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime) + replyTo.foreach(rep => header.put(Constants.REPLY_TO, rep)) + + header + } + + def buildJson(header: java.util.HashMap[String, Any], + payload: java.util.HashMap[String, Any]): String = { + + val message = new java.util.HashMap[String, java.util.HashMap[String, Any]]() + message.put(Constants.HEADER, header) + message.put(Constants.PAYLOAD, payload) + + val gson = new Gson() + gson.toJson(message) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala new file mode 100755 index 0000000000..14cf8bcbac --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Values.scala @@ -0,0 +1,23 @@ +package org.bigbluebutton.core.models + +import org.bigbluebutton.core.api.Role._ + +case class Status(isPresenter: Boolean = false, handRaised: Boolean = false) + +case class CallerId(num: String = "", name: String = "") + +case class Voice( + hasJoined: Boolean = false, + id: String = "", + callerId: CallerId = CallerId(), + muted: Boolean = false, + talking: Boolean = false, + locked: Boolean = false) + +case class UserV( + id: String, + extId: String, + name: String, + role: Role = VIEWER, + status: Status = Status(), + voice: Voice = Voice()) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala new file mode 100755 index 0000000000..b1b60cc715 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/util/RandomStringGenerator.scala @@ -0,0 +1,17 @@ +package org.bigbluebutton.core.util + +object RandomStringGenerator { + // From: http://www.bindschaedler.com/2012/04/07/elegant-random-string-generation-in-scala/ + + // Random generator + val random = new scala.util.Random + + // Generate a random string of length n from the given alphabet + def randomString(alphabet: String)(n: Int): String = + Stream.continually(random.nextInt(alphabet.size)).map(alphabet).take(n).mkString + + // Generate a random alphabnumeric string of length n + def randomAlphanumericString(n: Int) = + randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n) +} + diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala new file mode 100755 index 0000000000..81c8cc3513 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala @@ -0,0 +1,14 @@ +package org.bigbluebutton.core.voice + +import akka.actor._ +import akka.actor.ActorLogging + +case class MuteAllUsers(meetingId: String, except: Option[Seq[String]]) +case class MuteUser(meetingId: String, userId: String) +case class UnmuteUser(meetingId: String, userId: String) +case class EjectVoiceUser(meetingId: String, userId: String) + +class VoiceConferenceActor(val meetingId: String, + val voiceConf: String) { //extends Actor { + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala new file mode 100755 index 0000000000..f2121ff9f6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala @@ -0,0 +1,19 @@ +package org.bigbluebutton.core.voice + +import org.bigbluebutton.core.api._ +import org.bigbluebutton.freeswitch.FreeswitchManagerProxy + +class VoiceConferenceService(fsproxy: FreeswitchManagerProxy, + bbbInGW: IBigBlueButtonInGW) + extends OutMessageListener2 { + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: MeetingCreated => handleMeetingCreated(msg) + } + } + + private def handleMeetingCreated(msg: MeetingCreated) { + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala new file mode 100755 index 0000000000..47b35daae4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala @@ -0,0 +1,54 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.core.api.UserVO +import org.bigbluebutton.core.util._ + +class FreeswitchConference(val conferenceNum: String, + val meetingId: String, + val recorded: Boolean) { + + private var users = new scala.collection.immutable.HashMap[String, UserVO] + + private var recording: Boolean = false + + def addUser(user: UserVO) { + users += user.userID -> user + } + + def removeUser(user: UserVO) { + users -= user.userID + } + + def getWebUserUsingExtId(webUserId: String): Option[UserVO] = { + users.values find { u => + (u.externUserID == webUserId) + } + } + + def getWebUser(webUserId: String): Option[UserVO] = { + users.values find (u => (u.userID == webUserId)) + } + + def getVoiceUser(voiceUserId: String): Option[UserVO] = { + users.values find (u => u.voiceUser.userId == voiceUserId) + } + + def numUsersInVoiceConference: Int = { + val joinedUsers = users.values filter (u => u.voiceUser.joined) + joinedUsers.size + } + + def numUsers = users.size + + def recordingStarted() { + recording = true; + } + + def recordingStopped() { + recording = false + } + + def isRecording(): Boolean = { + recording + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala new file mode 100755 index 0000000000..c10bdd52b1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala @@ -0,0 +1,248 @@ +package org.bigbluebutton.freeswitch + +import akka.actor._ +import akka.actor.ActorLogging +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.util._ + +case class FsVoiceUserJoined(userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, muted: Boolean, + speaking: Boolean) + +case class FsVoiceUserLeft(userId: String, conference: String) +case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) +case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) +case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) +case class FsRecording(conference: String, recordingFile: String, + timestamp: String, recording: Boolean) + +object FreeswitchConferenceActor { + def props(system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW): Props = + Props(classOf[FreeswitchConferenceActor], system, fsproxy, bbbInGW) +} + +class FreeswitchConferenceActor(val system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW) extends Actor with ActorLogging { + + private var confs = new scala.collection.immutable.HashMap[String, FreeswitchConference] + + def receive = { + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: StartRecording => handleStartRecording(msg) + case msg: StopRecording => handleStopRecording(msg) + case msg: FsRecording => handleFsRecording(msg) + case msg: FsVoiceUserJoined => handleFsVoiceUserJoined(msg) + case msg: FsVoiceUserLeft => handleFsVoiceUserLeft(msg) + case msg: FsVoiceUserLocked => handleFsVoiceUserLocked(msg) + case msg: FsVoiceUserMuted => handleFsVoiceUserMuted(msg) + case msg: FsVoiceUserTalking => handleFsVoiceUserTalking(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) + case _ => // do nothing + } + + private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + fsproxy.ejectUsers(fc.conferenceNum) + }) + } + + private def handleMeetingCreated(msg: MeetingCreated) { + if (!confs.contains(msg.meetingID)) { + log.info("Meeting created [" + msg.meetingID + "] with voice conf [" + msg.voiceBridge + "]") + val fsconf = new FreeswitchConference(msg.voiceBridge, + msg.meetingID, + msg.recorded) + confs += fsconf.meetingId -> fsconf + } + + fsproxy.getUsers(msg.voiceBridge) + } + + private def handleMeetingEnded(msg: MeetingEnded) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + log.info("Meeting ended [" + msg.meetingID + "]") + fsproxy.ejectUsers(fc.conferenceNum) + confs -= fc.meetingId + }) + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + log.info("Meeting destroyed [" + msg.meetingID + "]") + fsproxy.ejectUsers(fc.conferenceNum) + confs -= fc.meetingId + }) + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach { fc => + log.info("Web user has joined voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") + fc.addUser(msg.user) + if (fc.numUsersInVoiceConference == 1 && fc.recorded) { + log.info("Meeting is recorded. Tell FreeSWITCH to start recording. mid[" + fc.meetingId + "]") + fsproxy.startRecording(fc.conferenceNum, fc.meetingId) + } + } + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + // println("FreeswitchConferenceActor - handleUserLeftVoice mid=[" + msg.meetingID + "]") + + fsconf foreach { fc => + fc.addUser(msg.user) + log.info("Web user has left voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") + if (fc.numUsersInVoiceConference == 0 && fc.recorded) { + log.info("Meeting is recorded. No more users in voice conference. Tell FreeSWITCH to stop recording. mid[" + fc.meetingId + "]") + fsproxy.stopRecording(fc.conferenceNum) + } + } + } + + private def handleUserJoined(msg: UserJoined) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + log.info("Web user id joining meeting id[" + fc.meetingId + "] wid=[" + msg.user.userID + "], extId=[" + msg.user.externUserID + "]") + fc.addUser(msg.user) + }) + } + + private def handleUserLeft(msg: UserLeft) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + fc.removeUser(msg.user) + }) + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + log.debug("Mute user request for wid[" + msg.userId + "] mute=[" + msg.mute + "]") + fsconf foreach (fc => { + val user = fc.getWebUser(msg.userId) + user foreach (u => { + log.debug("Muting user wid[" + msg.userId + "] mute=[" + msg.mute + "]") + fsproxy.muteUser(fc.conferenceNum, u.voiceUser.userId, msg.mute) + }) + }) + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + val user = fc.getWebUser(msg.userId) + user foreach (u => { + fsproxy.ejectUser(fc.conferenceNum, u.voiceUser.userId) + }) + }) + } + + private def handleStartRecording(msg: StartRecording) { + + } + + private def handleStopRecording(msg: StopRecording) { + + } + + private def handleFsRecording(msg: FsRecording) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + fsconf foreach { fc => + // Need to filter recording events here to not have duplicate events + if (!fc.isRecording && msg.recording) { + // + fc.recordingStarted + bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) + } else if (fc.isRecording && !msg.recording) { + fc.recordingStopped + bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) + } + } + } + + private def sendNonWebUserJoined(meetingId: String, webUserId: String, msg: FsVoiceUserJoined) { + bbbInGW.voiceUserJoined(meetingId, msg.userId, + webUserId, msg.conference, msg.callerIdNum, msg.callerIdName, + msg.muted, msg.speaking) + } + + private def handleFsVoiceUserJoined(msg: FsVoiceUserJoined) { + log.info("A user has joined the voice conference [" + + msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + log.debug("Meeting [" + fc.meetingId + "] has [" + fc.numUsers + "]") + fc.getWebUserUsingExtId(msg.webUserId) match { + case Some(user) => { + log.info("The user is also in the web client. [" + + msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") + sendNonWebUserJoined(fc.meetingId, user.userID, msg) + } + case None => { + log.info("User is not a web user. Must be a phone caller. [" + + msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") + sendNonWebUserJoined(fc.meetingId, msg.userId, msg) + } + } + }) + } + + private def handleFsVoiceUserLeft(msg: FsVoiceUserLeft) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + user foreach (u => bbbInGW.voiceUserLeft(fc.meetingId, u.userID)) + }) + } + + private def handleFsVoiceUserLocked(msg: FsVoiceUserLocked) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + user foreach (u => bbbInGW.voiceUserLocked(fc.meetingId, u.userID, msg.locked)) + }) + } + + private def handleFsVoiceUserMuted(msg: FsVoiceUserMuted) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + // println("Rx voice user muted for cnum=[" + msg.conference + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + // println("Rx voice user muted for mid=[" + fc.meetingId + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") + user foreach (u => bbbInGW.voiceUserMuted(fc.meetingId, u.userID, msg.muted)) + }) + } + + private def handleFsVoiceUserTalking(msg: FsVoiceUserTalking) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + // println("Rx voice user talking for vid[" + msg.userId + "] mute=[" + msg.talking + "]") + user foreach (u => bbbInGW.voiceUserTalking(fc.meetingId, u.userID, msg.talking)) + }) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala new file mode 100755 index 0000000000..4761993aa0 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala @@ -0,0 +1,123 @@ +package org.bigbluebutton.freeswitch + +import akka.actor.{ ActorSystem, Props } +import org.bigbluebutton.webconference.voice.IVoiceConferenceService +import org.bigbluebutton.core.api._ +import org.bigbluebutton.webconference.voice.FreeswitchConferenceEventListener +import akka.actor.ActorRef + +class FreeswitchConferenceService(fsproxy: FreeswitchManagerProxy, + fsListener: FreeswitchConferenceEventListener) + extends IVoiceConferenceService + with OutMessageListener2 { + + fsListener.setVoiceConferenceService(this) + + implicit val system = ActorSystem("bigbluebutton-apps-fsesl") + + var bbbInGW: IBigBlueButtonInGW = _ + var fsActor: ActorRef = _ + + def setIBigBlueButtonInGW(inGW: IBigBlueButtonInGW) { + bbbInGW = inGW + fsActor = system.actorOf( + FreeswitchConferenceActor.props(system, fsproxy, bbbInGW), + "bigbluebutton-fs-actor") + } + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) + case _ => // do nothing + } + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + fsActor ! msg + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + fsActor ! msg + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + fsActor ! msg + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + fsActor ! msg + } + + private def handleUserLeft(msg: UserLeft) { + fsActor ! msg + } + + private def handleUserJoined(msg: UserJoined) { + fsActor ! msg + } + + private def handleMeetingCreated(msg: MeetingCreated) { + fsActor ! msg + } + + private def handleMeetingEnded(msg: MeetingEnded) { + fsActor ! msg + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + fsActor ! msg + } + + private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { + fsActor ! msg + } + + def voiceStartedRecording(conference: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) + fsActor ! fsRec + } + + def voiceUserJoined(userId: String, webUserId: String, conference: String, + callerIdNum: String, callerIdName: String, + muted: java.lang.Boolean, talking: java.lang.Boolean) { + // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") + val vuj = new FsVoiceUserJoined(userId, webUserId, + conference, callerIdNum, + callerIdName, muted, + talking) + fsActor ! vuj + } + + def voiceUserLeft(userId: String, conference: String) { + // println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") + val vul = new FsVoiceUserLeft(userId, conference) + fsActor ! vul + } + + def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { + val vul = new FsVoiceUserLocked(userId, conference, locked) + fsActor ! vul + } + + def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") + val vum = new FsVoiceUserMuted(userId, conference, muted) + fsActor ! vum + } + + def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") + val vut = new FsVoiceUserTalking(userId, conference, talking) + fsActor ! vut + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala new file mode 100755 index 0000000000..993e77f699 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala @@ -0,0 +1,32 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.webconference.voice.freeswitch.FreeswitchApplication + +class FreeswitchManagerProxy(fsApp: FreeswitchApplication) { + + def getUsers(conference: String) { + fsApp.populateRoom(conference) + } + + def ejectUsers(conference: String) { + fsApp.ejectAll(conference) + } + + def muteUser(conference: String, userId: String, mute: Boolean) { + println("Forwarding mute request to fsApp") + fsApp.mute(conference, userId, mute) + } + + def ejectUser(conference: String, userId: String) { + println("Forwarding eject user request to fsApp") + fsApp.eject(conference, userId) + } + + def startRecording(conference: String, meetingId: String) { + fsApp.record(conference, meetingId) + } + + def stopRecording(conference: String) { + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala new file mode 100755 index 0000000000..60f07a7211 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala @@ -0,0 +1,12 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.core.api.IBigBlueButtonInGW + +/** + * Workaround to get away from circular dependency injection. + */ +class FsInGwWrapper(inGW: IBigBlueButtonInGW, + fsConfService: FreeswitchConferenceService) { + + fsConfService.setIBigBlueButtonInGW(inGW) +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala deleted file mode 100644 index 260e49f6e4..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/AppsTestFixtures.scala +++ /dev/null @@ -1,62 +0,0 @@ -package org.bigbluebutton.apps - -import org.bigbluebutton.apps._ -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.protocol.Destination - - -trait AppsTestFixtures { - - val maxUsers = 20 - val duration = Duration(120, true, 160) - val voiceConference = VoiceConference(85115, 1234) - val phone1 = PhoneNumber("613-555-7600", "Ottawa") - val phone2 = PhoneNumber("1-888-555-7890", "NA Toll-Free") - val metadata = Map("customerId" -> "acme-customer", - "customerName" -> "ACME") - - val eng101MeetingId = "english_101" - val eng101MeetingName = "English 101" - val eng101MeetingIdAndName = MeetingIdAndName(eng101MeetingId, eng101MeetingName) - val eng101SessionId = "english_101-1234" - val eng101Session = Session(eng101SessionId, eng101MeetingIdAndName) - - val eng101Desc = MeetingDescriptor("english_101", "English 101", - true, "Welcome to English 101", - "http://www.bigbluebutton.org", - "http://www.gravatar.com/bigbluebutton", - maxUsers, duration, - voiceConference, Seq(phone1, phone2), - metadata) - - val juanUserId = "juan-user1" - val juanExtUserId = "juan-ext-user1" - val juanUser = RegisterUser(juanExtUserId, "Juan Tamad", - Role.MODERATOR, 12345, "Welcome Juan", - "http://www.umaliska.don", "http://www.mukhamo.com/unggoy") - val juanWebIdentity = WebIdentity(false) - val juanCallerId = CallerId("Juan Tamad", "011-63-917-555-1234") - val juanVoiceMeta = Map("userid" -> "1", "conference_num" -> "85115") - val juanVoiceIdentity = VoiceIdentity(juanCallerId, false, - false, false, juanVoiceMeta) - - val juanUserToken = "juanToken" - val joinedUserJuan = JoinedUser(juanUserId, juanUserToken, juanUser, - true, juanWebIdentity, juanVoiceIdentity) - - val asyongUserId = "asyong-user1" - val asyongExtUserId = "asyong-ext-user1" - val asyongUser = RegisterUser(asyongExtUserId, "Asyong Aksaya", - Role.VIEWER, 12346, "Welcome Asyong", - "http://www.bilmoko.nyan", "http://www.mukhamo.com/pera") - val asyongWebIdentity = WebIdentity(true) - val asyongCallerId = CallerId("Asyong Aksaya", "011-63-917-555-1234") - val asyongVoiceMeta = Map("userid" -> "2", "conference_num" -> "85115") - val asyongVoiceIdentity = VoiceIdentity(asyongCallerId, false, - false, false, asyongVoiceMeta) - - val joinedUserAsyong = JoinedUser("asyongid", "asyongToken", asyongUser, - true, asyongWebIdentity, asyongVoiceIdentity) - - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala deleted file mode 100644 index 866e73bb80..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerSpec.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.apps - -import akka.testkit.DefaultTimeout -import akka.testkit.ImplicitSender -import akka.testkit.TestKit -import scala.concurrent.duration._ -import scala.collection.immutable -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.WordSpecLike -import org.scalatest.BeforeAndAfterAll -import org.scalatest.Matchers -import akka.actor.ActorSystem -import collection.mutable.Stack -import akka.actor.Props -import akka.testkit.TestProbe -import org.bigbluebutton.apps._ - - -class MeetingManagerSpec extends - TestKit(ActorSystem("MeetingManagerSpec")) - with DefaultTimeout with ImplicitSender with WordSpecLike - with Matchers with BeforeAndAfterAll with MeetingManagerTestFixtures { - - val pubsub = TestProbe() - val meetingMgrRef = system.actorOf(Props(classOf[MeetingManager], pubsub.ref)) - - override def afterAll { - shutdown(system) - } - - "An MeetingManagerActor" should { - "Respond with the Meeting created" in { - within(500 millis) { - val createMsg = generateCreateMeetingMessage() - - meetingMgrRef ! createMsg - - expectMsgPF() { - case resp:CreateMeetingResponse => { - resp.success shouldBe true - resp.message shouldBe "Meeting successfully created." - } - } - - pubsub.expectMsgPF(500 millis) { - case pubMsg:MeetingCreated => { - pubMsg.meeting.id shouldBe createMsg.descriptor.id - } - } - } - } - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala deleted file mode 100644 index ef7d2ab0ff..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerTestFixtures.scala +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.apps - -import org.bigbluebutton.apps._ -import org.bigbluebutton.apps._ -import org.bigbluebutton.apps.users.data._ - -trait MeetingManagerTestFixtures extends AppsTestFixtures { - - def generateCreateMeetingMessage():CreateMeeting = { - CreateMeeting(eng101Desc) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala deleted file mode 100644 index 99c33502a7..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/MeetingManagerUnitSpec.scala +++ /dev/null @@ -1,42 +0,0 @@ -package org.bigbluebutton.apps - -import akka.testkit.TestKit -import org.scalatest.BeforeAndAfterAll -import org.scalatest.Matchers -import akka.actor.ActorSystem -import akka.actor.Props -import akka.testkit.TestProbe -import akka.testkit.TestActorRef -import org.scalatest.FlatSpecLike - -class MeetingManagerUnitSpec extends - TestKit(ActorSystem("MeetingManagerUnitSpec")) - with FlatSpecLike with Matchers with BeforeAndAfterAll - with AppsTestFixtures { - - val pubsub = TestProbe() - - val actorRef = TestActorRef[MeetingManager](Props(classOf[MeetingManager], pubsub.ref)) - val actor = actorRef.underlyingActor - - "The MeetingManager" should "return false when a meeting doesn't exist" in { - assert(actor.meetingExist("no-meeting") === false) - } -/* - it should "return true when a meeting exist" in { - val internalId = "testMeetingId" - val sessionId = actor.getValidSession("testMeetingId") -// val meeting = actor.createMeeting(meetingConfig, internalId) - assert(actor.meetingExist(internalId) === true) - val m = actor.getMeeting(internalId) - - m should be ('defined) - -// m.map { n => -// n.config should have ( -// 'name (meetingConfig.name)) -// } - } - - */ -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala deleted file mode 100644 index a37f499575..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/RunningMeetingActorSpec.scala +++ /dev/null @@ -1,57 +0,0 @@ - package org.bigbluebutton.apps - -import akka.testkit.DefaultTimeout -import akka.testkit.ImplicitSender -import akka.testkit.TestKit -import scala.concurrent.duration._ -import scala.collection.immutable -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.WordSpecLike -import org.scalatest.BeforeAndAfterAll -import org.scalatest.Matchers -import akka.actor.ActorSystem -import collection.mutable.Stack -import akka.actor.Props -import akka.testkit.TestProbe -import org.bigbluebutton.apps._ -import org.bigbluebutton.apps.users.data.RegisterUser -import org.bigbluebutton.apps.users._ -import akka.testkit.TestActorRef -import org.bigbluebutton.apps.users.messages._ - -class RunningMeetingActorSpec extends - TestKit(ActorSystem("MeetingManagerSpec")) - with DefaultTimeout with ImplicitSender with WordSpecLike - with Matchers with BeforeAndAfterAll - with MeetingManagerTestFixtures { - - val pubsub = TestProbe() - val session = eng101Session - val config = eng101Desc - val runningMeetingActor = TestActorRef[RunningMeetingActor]( - RunningMeetingActor.props( - pubsub.ref, session, config)) - - override def afterAll { - shutdown(system) - } - - "An RunningMeetingActor" should { - "Respond with 'User has been registered.'" in { - within(500 millis) { - - runningMeetingActor ! RegisterUserRequest(session, juanUser) - - expectMsgPF() { - case resp:RegisterUserResponse => { - resp.result.success shouldBe true - resp.result.message shouldBe "User has been registered." - runningMeetingActor.underlyingActor.usersApp.isRegistered(resp.token) shouldBe true - runningMeetingActor.underlyingActor.usersApp.registered.length == 1 - } - } - } - } - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala deleted file mode 100644 index 0649265561..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/TestKitUsageSpec.scala +++ /dev/null @@ -1,154 +0,0 @@ -package org.bigbluebutton.apps - -import scala.util.Random -import com.typesafe.config.ConfigFactory -import akka.actor.Actor -import akka.actor.ActorRef -import akka.actor.ActorSystem -import akka.actor.Props -import akka.testkit.DefaultTimeout -import akka.testkit.ImplicitSender -import akka.testkit.TestKit -import scala.concurrent.duration._ -import scala.collection.immutable -import org.scalatest.matchers.ShouldMatchers -import org.scalatest.WordSpecLike -import org.scalatest.BeforeAndAfterAll -import org.scalatest.Matchers - -/** - * a Test to show some TestKit examples - */ -class TestKitUsageSpec extends - TestKit(ActorSystem("TestKitUsageSpec", - ConfigFactory.parseString(TestKitUsageSpec.config))) - with DefaultTimeout with ImplicitSender with WordSpecLike - with Matchers with BeforeAndAfterAll { - - import TestKitUsageSpec._ - - val echoRef = system.actorOf(Props[EchoActor]) - val forwardRef = system.actorOf(Props(classOf[ForwardingActor], testActor)) - val filterRef = system.actorOf(Props(classOf[FilteringActor], testActor)) - val randomHead = Random.nextInt(6) - val randomTail = Random.nextInt(10) - val headList = immutable.Seq().padTo(randomHead, "0") - val tailList = immutable.Seq().padTo(randomTail, "1") - val seqRef = - system.actorOf(Props(classOf[SequencingActor], testActor, headList, tailList)) - - override def afterAll { - shutdown(system) - } - - "An EchoActor" should { - "Respond with the same message it receives" in { - within(500 millis) { - echoRef ! "test" - expectMsg("test") - } - } - } - - "A ForwardingActor" should { - "Forward a message it receives" in { - within(500 millis) { - forwardRef ! "test" - expectMsg("test") - } - } - } - - "A FilteringActor" should { - "Filter all messages, except expected messagetypes it receives" in { - var messages = Seq[String]() - within(500 millis) { - filterRef ! "test" - expectMsg("test") - filterRef ! 1 - expectNoMsg - filterRef ! "some" - filterRef ! "more" - filterRef ! 1 - filterRef ! "text" - filterRef ! 1 - - receiveWhile(500 millis) { - case msg: String => messages = msg +: messages - } - } - messages.length should be(3) - messages.reverse should be(Seq("some", "more", "text")) - } - } - "A SequencingActor" should { - "receive an interesting message at some point " in { - within(500 millis) { - ignoreMsg { - case msg: String => msg != "something" - } - seqRef ! "something" - expectMsg("something") - ignoreMsg { - case msg: String => msg == "1" - } - expectNoMsg - ignoreNoMsg - } - } - } -} - -object TestKitUsageSpec { - // Define your test specific configuration here - val config = """ - akka { - loglevel = "WARNING" - } - """ - - /** - * An Actor that echoes everything you send to it - */ - class EchoActor extends Actor { - def receive = { - case msg => sender ! msg - } - } - - /** - * An Actor that forwards every message to a next Actor - */ - class ForwardingActor(next: ActorRef) extends Actor { - def receive = { - case msg => next ! msg - } - } - - /** - * An Actor that only forwards certain messages to a next Actor - */ - class FilteringActor(next: ActorRef) extends Actor { - def receive = { - case msg: String => next ! msg - case _ => None - } - } - - /** - * An actor that sends a sequence of messages with a random head list, an - * interesting value and a random tail list. The idea is that you would - * like to test that the interesting value is received and that you cant - * be bothered with the rest - */ - class SequencingActor(next: ActorRef, head: immutable.Seq[String], - tail: immutable.Seq[String]) extends Actor { - def receive = { - case msg => { - head foreach { next ! _ } - next ! msg - tail foreach { next ! _ } - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala deleted file mode 100644 index 155ab14e49..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/UnitSpec.scala +++ /dev/null @@ -1,8 +0,0 @@ -package org.bigbluebutton.apps - -import org.scalatest.FlatSpec -import org.scalatest.BeforeAndAfterAll -import org.scalatest.WordSpec -import org.scalatest.Matchers - -class UnitSpec extends FlatSpec with Matchers with BeforeAndAfterAll \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala deleted file mode 100755 index be0b951af2..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/models/UsersAppSpec.scala +++ /dev/null @@ -1,18 +0,0 @@ -package org.bigbluebutton.apps.models - -import org.specs2.mutable.Specification - - -class UsersAppSpec extends Specification { - "The UsersTrait" should { - "returns the right number of registered users" in { -// val us = new Users {} -// var ruser = new RegisteredUser("abc", "Richard") -// var guser = new RegisteredUser("abc2", "Guga") -// us.register(ruser) -// us.register(guser) -// us.registered must have size(2) - true - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala deleted file mode 100755 index ea4adcd522..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ClientConfigSpec.scala +++ /dev/null @@ -1,82 +0,0 @@ -package org.bigbluebutton.apps.protocol - -class ClientConfigSpec { - - val clientConfig = """ -{ - "config": { - "version": "0.8", - "locale": { - "version": 0.8, - "suppressWarning": false, - "userSelectionEnabled": true - }, - "help": { - "url": "http://192.168.0.150/help.html", - "showHelpButton": true - }, - "java": { - "url": "http://192.168.0.150/testjava.html" - }, - "skinning": { - "enabled": "true", - "url": "http://192.168.0.150/client/branding/css/BBBDefault.css.swf" - }, - "layout": { - "showLogButton": true, - "showVideoLayout": "false", - "showResetLayout": "true", - "defaultLayout": "Default", - "showToolbar": true, - "showFooter": true, - "showMeetingName": true, - "showLogoutWindow": true, - "showLayoutTools": true, - "confirmLogout": true - }, - "modules": [ - { - "name": "ChatModule", - "url": "http://192.168.0.150/client/ChatModule.swf?v=VERSION", - "uri": "rtmp://192.168.0.150/bigbluebutton", - "dependsOn": "UsersModule", - "translationOn": false, - "translationEnabled": false, - "privateEnabled": true, - "position": "top-right", - "baseTabIndex": "701" - }, - { - "name": "UsersModule", - "url": "http://192.168.0.150/client/UsersModule.swf?v=VERSION", - "uri": "rtmp://192.168.0.150/bigbluebutton", - "allowKickUser": true, - "enableRaiseHand": true, - "enableSettingsButton": true, - "baseTabIndex": "301" - }, - { - "name": "DeskShareModule", - "url": "http://192.168.0.150/client/DeskShareModule.swf?v=4105", - "uri": "rtmp://192.168.0.150/deskShare", - "showButton": true, - "autoStart": false, - "autoFullScreen": false, - "baseTabIndex": "201" - }, - { - "name": "PhoneModule", - "url": "http://192.168.0.150/client/PhoneModule.swf?v=VERSION", - "uri": "rtmp://192.168.0.150/sip", - "autoJoin": true, - "skipCheck": false, - "showButton": true, - "enabledEchoCancel": true, - "dependsOn": "UsersModule" - } - ] - } -} - - """ -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala deleted file mode 100644 index 2eab9cc3a6..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/ExampleMessageFixtures.scala +++ /dev/null @@ -1,286 +0,0 @@ -package org.bigbluebutton.apps.protocol - -trait ExampleMessageFixtures { - val invalidJSON = """{ "invalid" "Missing a colon" }""" - - val validJSON = """{ "valid" : "Valid JSON" }""" - - val invalidMessage = """ -{ - "header": { - "name": "PrivateChatMessageEvent", - "timestamp": 123456 - }, - "payload1": { - "valid": "Valid JSON" - } -} - """ - - val validMessage = """ - { - "header": { - "event": { - "name": "CreateMeetingRequest", - "timestamp": 123456, - "reply": {"to": "replyChannel", "correlationId" : "abc123"}, - "source": "web-api" - }, - "meeting": { - "name": "English 101", - "id": "english_101" - } - }, - "payload": { - "meeting": { - "name": "English 101", - "externalId": "english_101", - "record": true, - "welcomeMessage": "Welcome to English 101", - "logoutUrl": "http://www.bigbluebutton.org", - "avatarUrl": "http://www.gravatar.com/bigbluebutton", - "users": { - "max": 20, - "hardLimit": false - }, - "duration": { - "length": 120, - "allowExtend": false, - "warnBefore": 30 - }, - "voiceConf": { - "pin": 123456, - "number": 85115 - }, - "phoneNumbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": { - "customerId": "acme-customer", - "customerName": "ACME" - } - } - } - } - """ - - val createMeetingRequest = """ - { - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "create_meeting_request", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "external_id": "english_101", - "record": true, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.bigbluebutton.org", - "avatar_url": "http://www.gravatar.com/bigbluebutton", - "max_users": 20, - "duration": { - "length": 120, - "allow_extend": false, - "max": 240 - }, - "voice_conference": { - "pin": 123456, - "number": 85115 - }, - "phone_numbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": { - "customer_id": "acme-customer", - "customer_name": "ACME" - } - } - } - } - """ - - val invalidCreateMeetingRequest = """ - { - "header": { - "name": "CreateMeeting", - "timestamp": 123456, - "correlation": "123abc", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "externalId": "english_101", - "record": true, - "welcomeMessage": "Welcome to English 101", - "logoutUrl": "http://www.bigbluebutton.org", - "avatarUrl": "http://www.gravatar.com/bigbluebutton", - "users": { - "max": 20, - "hardLimit": false - }, - "duration": { - "length": 120, - "allowExtend": false, - "warnBefore": 30 - }, - "voiceConf": { - "pin": 123456, - "number": 85115 - }, - "phoneNumbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": [ - {"customerId": "acme-customer"}, - {"customerName": "ACME"} - ] - } - } - } - """ - - val registerUserRequestMessage = """ - { - "header": { - "event": { - "name": "register_user", - "timestamp": 123456, - "reply": { - "to": "reply_channel", - "correlation_id": "abc123" - }, - "source": "web-api" - }, - "meeting": { - "name": "English 101", - "id": "english_101", - "session": "english_101-12345" - } - }, - "payload": { - "user": { - "external_id": "user1", - "name": "Guga", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.example.com", - "avatar_url": "http://www.example.com/avatar.png" - } - } - } - """ - - val exampleChatMessage = """ - { - "header": { - "event": { - "name": "public_chat_message", - "timestamp": 123456, - "source": "web-api" - }, - "meeting": { - "name": "English 101", - "id": "english_101", - "session": "english_101-12345" - } - }, - "payload": { - "chat": { - "id": "msg1", - "sentOn": 1383210123456, - "from": { - "id": "user1", - "name": "Richard" - }, - "message": { - "text": "Hello world!", - "lang": "en_US" - }, - "font": { - "color": 16711680, - "size": 14, - "type": "Arial" - }, - "translations": [ - { - "lang": "es_LA", - "text": "Hola Mundo!" - } - ] - } - } - } - """ - - val wbmsg = """ - { - "name": "whiteboard_draw", - "timestamp": 123456, - "meeting": { - "id": "english_101", - "name": "English 101", - "session": "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1383210136298" - }, - "payload": { - "whiteboard_id": "user1-shape-1", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "text", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "font": { - "style": "arial", - "color": 0, - "size": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "text": "He" - }, - "by": { - "id": "user1", - "name": "Guga" - } - } - } - """ -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc deleted file mode 100644 index c6dafd6240..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/configws.sc +++ /dev/null @@ -1,146 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import com.typesafe.config.ConfigFactory -import spray.json.JsString - -object configws { - val sampleClientConfig = """ -{ - "config": { - "version": "0.8", - "locale": { - "version": 0.8, - "suppressWarning": false, - "userSelectionEnabled": true - }, - "help": { - "url": "http://192.168.0.150/help.html", - "showHelpButton": true - }, - "java": { - "url": "http://192.168.0.150/testjava.html" - }, - "skinning": { - "enabled": "true", - "url": "http://192.168.0.150/client/branding/css/BBBDefault.css.swf" - }, - "layout": { - "showLogButton": true, - "showVideoLayout": "false", - "showResetLayout": "true", - "defaultLayout": "Default", - "showToolbar": true, - "showFooter": true, - "showMeetingName": true, - "showLogoutWindow": true, - "showLayoutTools": true, - "confirmLogout": true - }, - "modules": [ - { - "name": "ChatModule", - "url": "http://192.168.0.150/client/ChatModule.swf?v=VERSION", - "uri": "rtmp://192.168.0.150/bigbluebutton", - "dependsOn": "UsersModule", - "translationOn": false, - "translationEnabled": false, - "privateEnabled": true, - "position": "top-right", - "baseTabIndex": "701" - }, - { - "name": "UsersModule", - "url": "http://192.168.0.150/client/UsersModule.swf?v=VERSION", - "uri": "rtmp://192.168.0.150/bigbluebutton", - "allowKickUser": true, - "enableRaiseHand": true, - "enableSettingsButton": true, - "baseTabIndex": "301" - }, - { - "name": "DeskShareModule", - "url": "http://192.168.0.150/client/DeskShareModule.swf?v=4105", - "uri": "rtmp://192.168.0.150/deskShare", - "showButton": true, - "autoStart": false, - "autoFullScreen": false, - "baseTabIndex": "201" - }, - { - "name": "PhoneModule", - "url": "http://192.168.0.150/client/PhoneModule.swf?v=VERSION", - "uri": "rtmp://192.168.0.150/sip", - "autoJoin": true, - "skipCheck": false, - "showButton": true, - "enabledEchoCancel": true, - "dependsOn": "UsersModule" - } - ] - } -} - - """ //> sampleClientConfig : String = " - //| { - //| "config": { - //| "version": "0.8", - //| "locale": { - //| "version": 0.8, - //| "suppressWarning": false, - //| "userSelectionEnabled": true - //| }, - //| "help": { - //| "url": "http://192.168.0.150/help.html", - //| "showHelpButton": true - //| }, - //| "java": { - //| "url": "http://192.168.0.150/testjava.html" - //| }, - //| "skinning": { - //| "enabled": "true", - //| "url": "http://192.168.0.150/client/branding/css/BBBDefault.css - //| .swf" - //| }, - //| "layout": { - //| "showLogButton": true, - //| "showVideoLayout": "false", - //| "showResetLayout": "true", - //| "defaultLayout": "Default", - //| "showToolbar": true, - //| "showFooter": true, - //| "showMeetingName": true, - //| - //| Output exceeds cutoff limit. - - val conf = ConfigFactory.parseString(sampleClientConfig) - //> conf : com.typesafe.config.Config = Config(SimpleConfigObject({"config":{" - //| help":{"showHelpButton":true,"url":"http://192.168.0.150/help.html"},"skinn - //| ing":{"enabled":"true","url":"http://192.168.0.150/client/branding/css/BBBD - //| efault.css.swf"},"layout":{"showLayoutTools":true,"showToolbar":true,"showF - //| ooter":true,"showResetLayout":"true","showVideoLayout":"false","showLogButt - //| on":true,"defaultLayout":"Default","showLogoutWindow":true,"showMeetingName - //| ":true,"confirmLogout":true},"locale":{"suppressWarning":false,"userSelecti - //| onEnabled":true,"version":0.8},"java":{"url":"http://192.168.0.150/testjava - //| .html"},"modules":[{"position":"top-right","translationEnabled":false,"base - //| TabIndex":"701","name":"ChatModule","privateEnabled":true,"dependsOn":"User - //| sModule","uri":"rtmp://192.168.0.150/bigbluebutton","url":"http://192.168.0 - //| .150/client/ChatModule.swf?v=VERSION","translationOn":false},{"baseTabIndex - //| ":"301","name":"UsersMo - //| Output exceeds cutoff limit. - - val jsString = JsString(sampleClientConfig) //> jsString : spray.json.JsString = "\n{\n \"config\": {\n \"versio - //| n\": \"0.8\",\n \"locale\": {\n \"version\": 0.8,\n - //| \"suppressWarning\": false,\n \"userSelectionEnabled\": tr - //| ue\n },\n \"help\": {\n \"url\": \"http://192.168. - //| 0.150/help.html\",\n \"showHelpButton\": true\n },\n - //| \"java\": {\n \"url\": \"http://192.168.0.150/testjava.html\" - //| \n },\n \"skinning\": {\n \"enabled\": \"true\",\n - //| \"url\": \"http://192.168.0.150/client/branding/css/BBBDefault. - //| css.swf\"\n },\n \"layout\": {\n \"showLogButton\" - //| : true,\n \"showVideoLayout\": \"false\",\n \"showRes - //| etLayout\": \"true\",\n \"defaultLayout\": \"Default\",\n - //| \"showToolbar\": true,\n \"showFooter\": true,\n - //| \"showMeetingName\": t - //| Output exceeds cutoff limit. - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc deleted file mode 100644 index 8d767225fb..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/createmeetingrequest.sc +++ /dev/null @@ -1,199 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json._ -import spray.json.JsonParser -import org.bigbluebutton.apps.models.MeetingConfig -import org.bigbluebutton.apps.protocol._ -import org.bigbluebutton.apps.models.MeetingSession -import org.bigbluebutton.apps.models.UsersConfig -import org.bigbluebutton.apps.models.DurationConfig -import org.bigbluebutton.apps.models.VoiceConfig -import org.bigbluebutton.apps.models.PhoneNumberConfig -import spray.json.DefaultJsonProtocol - -object createmeetingrequestWS { - val createMeetingRequestMsg = """ -{ - "header": { - "name": "CreateMeeting", - "timestamp": 123456, - "correlation": "123abc", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "externalId": "english_101", - "record": true, - "welcomeMessage": "Welcome to English 101", - "logoutUrl": "http://www.bigbluebutton.org", - "avatarUrl": "http://www.gravatar.com/bigbluebutton", - "users": { - "max": 20, - "hardLimit": false - }, - "duration": { - "length": 120, - "allowExtend": false, - "warnBefore": 30 - }, - "voiceConf": { - "pin": 123456, - "number": 85115 - }, - "phoneNumbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": { - "customerId": "acme-customer", - "customerName": "ACME" - } - } - } -} - """ //> createMeetingRequestMsg : String = " - //| { - //| "header": { - //| "name": "CreateMeeting", - //| "timestamp": 123456, - //| "correlation": "123abc", - //| "source": "web-api" - //| }, - //| "payload": { - //| "meeting": { - //| "name": "English 101", - //| "externalId": "english_101", - //| "record": true, - //| "welcomeMessage": "Welcome to English 101", - //| "logoutUrl": "http://www.bigbluebutton.org", - //| "avatarUrl": "http://www.gravatar.com/bigbluebutton", - //| "users": { - //| "max": 20, - //| "hardLimit": false - //| }, - //| "duration": { - //| "length": 120, - //| "allowExtend": false, - //| "warnBefore": 30 - //| }, - //| "voiceConf": { - //| "pin": 123456, - //| "number": 85115 - //| }, - - import CreateMeetingRequestJsonProtocol1._ - - val jsonAst = JsonParser(createMeetingRequestMsg) - //> jsonAst : spray.json.JsValue = {"header":{"name":"CreateMeeting","timestam - //| p":123456,"correlation":"123abc","source":"web-api"},"payload":{"meeting":{ - //| "name":"English 101","externalId":"english_101","record":true,"welcomeMessa - //| ge":"Welcome to English 101","logoutUrl":"http://www.bigbluebutton.org","av - //| atarUrl":"http://www.gravatar.com/bigbluebutton","users":{"max":20,"hardLim - //| it":false},"duration":{"length":120,"allowExtend":false,"warnBefore":30},"v - //| oiceConf":{"pin":123456,"number":85115},"phoneNumbers":[{"number":"613-520- - //| 7600","description":"Ottawa"},{"number":"1-888-555-7890","description":"NA - //| Toll-Free"}],"metadata":{"customerId":"acme-customer","customerName":"ACME" - //| }}}} - val jsonObj = jsonAst.asJsObject //> jsonObj : spray.json.JsObject = {"header":{"name":"CreateMeeting","timesta - //| mp":123456,"correlation":"123abc","source":"web-api"},"payload":{"meeting": - //| {"name":"English 101","externalId":"english_101","record":true,"welcomeMess - //| age":"Welcome to English 101","logoutUrl":"http://www.bigbluebutton.org","a - //| vatarUrl":"http://www.gravatar.com/bigbluebutton","users":{"max":20,"hardLi - //| mit":false},"duration":{"length":120,"allowExtend":false,"warnBefore":30}," - //| voiceConf":{"pin":123456,"number":85115},"phoneNumbers":[{"number":"613-520 - //| -7600","description":"Ottawa"},{"number":"1-888-555-7890","description":"NA - //| Toll-Free"}],"metadata":{"customerId":"acme-customer","customerName":"ACME - //| "}}}} - val payloadObj = jsonObj.fields.get("payload").get.asJsObject - //> payloadObj : spray.json.JsObject = {"meeting":{"name":"English 101","exter - //| nalId":"english_101","record":true,"welcomeMessage":"Welcome to English 101 - //| ","logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://www.gravat - //| ar.com/bigbluebutton","users":{"max":20,"hardLimit":false},"duration":{"len - //| gth":120,"allowExtend":false,"warnBefore":30},"voiceConf":{"pin":123456,"nu - //| mber":85115},"phoneNumbers":[{"number":"613-520-7600","description":"Ottawa - //| "},{"number":"1-888-555-7890","description":"NA Toll-Free"}],"metadata":{"c - //| ustomerId":"acme-customer","customerName":"ACME"}}} - val headerObj = jsonObj.fields.get("header").get.asJsObject - //> headerObj : spray.json.JsObject = {"name":"CreateMeeting","timestamp":1234 - //| 56,"correlation":"123abc","source":"web-api"} - val meeting = payloadObj.fields.get("meeting") - //> meeting : Option[spray.json.JsValue] = Some({"name":"English 101","externa - //| lId":"english_101","record":true,"welcomeMessage":"Welcome to English 101", - //| "logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://www.gravatar - //| .com/bigbluebutton","users":{"max":20,"hardLimit":false},"duration":{"lengt - //| h":120,"allowExtend":false,"warnBefore":30},"voiceConf":{"pin":123456,"numb - //| er":85115},"phoneNumbers":[{"number":"613-520-7600","description":"Ottawa"} - //| ,{"number":"1-888-555-7890","description":"NA Toll-Free"}],"metadata":{"cus - //| tomerId":"acme-customer","customerName":"ACME"}}) - if (meeting != None) { - val m = meeting.get.convertTo[MeetingConfig] - } else { - None - } //> res0: Any = () - -case class Color(name: String, red: Int, green: Int, blue: Int) - -object MyJsonProtocol extends DefaultJsonProtocol { - implicit val colorFormat = jsonFormat4(Color) -} - -import MyJsonProtocol._ - -val json = Color("CadetBlue", 95, 158, 160).toJson//> json : spray.json.JsValue = {"name":"CadetBlue","red":95,"green":158,"blue - //| ":160} -val color = json.convertTo[Color] //> color : org.bigbluebutton.apps.protocol.createmeetingrequestWS.Color = Col - //| or(CadetBlue,95,158,160) - - val session = MeetingSession("English 101", "english_101", "english101-123456") - //> session : org.bigbluebutton.apps.models.MeetingSession = MeetingSession(En - //| glish 101,english_101,english101-123456) - - val usersConfig = UsersConfig(20, true) //> usersConfig : org.bigbluebutton.apps.models.UsersConfig = UsersConfig(20,t - //| rue) - val durationConfig = DurationConfig(320, true, 30) - //> durationConfig : org.bigbluebutton.apps.models.DurationConfig = DurationCo - //| nfig(320,true,30) - val voiceConfig = VoiceConfig(12345, 85115) //> voiceConfig : org.bigbluebutton.apps.models.VoiceConfig = VoiceConfig(1234 - //| 5,85115) - val phone1 = PhoneNumberConfig("613-520-5555", "Ottawa") - //> phone1 : org.bigbluebutton.apps.models.PhoneNumberConfig = PhoneNumberConf - //| ig(613-520-5555,Ottawa) - val phone2 = PhoneNumberConfig("1-800-bbb-conf", "Toll Free") - //> phone2 : org.bigbluebutton.apps.models.PhoneNumberConfig = PhoneNumberConf - //| ig(1-800-bbb-conf,Toll Free) - val metadata = Map("customerId" -> "acme-customer", "customerName" -> "ACME") - //> metadata : scala.collection.immutable.Map[String,String] = Map(customerId - //| -> acme-customer, customerName -> ACME) - - val meetingConfig = MeetingConfig("English 101", "english_101", true, - "Welcome to English 101", "http://www.bigbluebutton.org", - "http://www.gravatar.com/bigbluebutton", - usersConfig, durationConfig, voiceConfig, - Seq(phone1, phone2), metadata) //> meetingConfig : org.bigbluebutton.apps.models.MeetingConfig = MeetingConfi - //| g(English 101,english_101,true,Welcome to English 101,http://www.bigbluebut - //| ton.org,http://www.gravatar.com/bigbluebutton,UsersConfig(20,true),Duration - //| Config(320,true,30),VoiceConfig(12345,85115),List(PhoneNumberConfig(613-520 - //| -5555,Ottawa), PhoneNumberConfig(1-800-bbb-conf,Toll Free)),Map(customerId - //| -> acme-customer, customerName -> ACME)) - - import org.bigbluebutton.apps.protocol.MyJsonProtocol._ - val reply = CreateMeetingRequestReply(session, meetingConfig).toJson - //> reply : spray.json.JsValue = {"session":{"name":"English 101","externalId" - //| :"english_101","session":"english101-123456"},"meeting":{"name":"English 10 - //| 1","externalId":"english_101","record":true,"welcomeMessage":"Welcome to En - //| glish 101","logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://w - //| ww.gravatar.com/bigbluebutton","users":{"max":20,"hardLimit":true},"duratio - //| n":{"length":320,"allowExtend":true,"warnBefore":30},"voiceConf":{"pin":123 - //| 45,"number":85115},"phoneNumbers":[{"number":"613-520-5555","description":" - //| Ottawa"},{"number":"1-800-bbb-conf","description":"Toll Free"}],"metadata": - //| {"customerId":"acme-customer","customerName":"ACME"}}} - - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc deleted file mode 100644 index 6163abe4bb..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/extractorsws.sc +++ /dev/null @@ -1,43 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import org.bigbluebutton.apps.protocol._ - -object extractorsws { - - case class Header1(name: String, timestamp: Long, - correlation: String, source: String, - meeting: Option[HeaderMeeting1]) - - case class HeaderMeeting1(name: String, externalId: String, sessionId: String) - - val headerMeeting = HeaderMeeting1("English 101", "english_101", "english_101-123456") - //> headerMeeting : org.bigbluebutton.apps.protocol.extractorsws.HeaderMeeting1 - //| = HeaderMeeting1(English 101,english_101,english_101-123456) - val header1 = Header1("RegisterUserRequest", 1234567L, "123abc", "bbb-apps", Some(headerMeeting)) - //> header1 : org.bigbluebutton.apps.protocol.extractorsws.Header1 = Header1(Re - //| gisterUserRequest,1234567,123abc,bbb-apps,Some(HeaderMeeting1(English 101,en - //| glish_101,english_101-123456))) - header1 match { - case Header1(name, _, _, _, Some(meeting)) => println(meeting) - case Header1(name, _, _, _, None) => println("no meeting") - } //> HeaderMeeting1(English 101,english_101,english_101-123456) - - val header2 = Header1("RegisterUserRequest", 1234567L, "123abc", "bbb-apps", None) - //> header2 : org.bigbluebutton.apps.protocol.extractorsws.Header1 = Header1(Re - //| gisterUserRequest,1234567,123abc,bbb-apps,None) - - header2 match { - case Header1(name, _, _, _, Some(meeting)) => println(meeting) - case Header1(name, _, _, _, None) => println("no meeting") - } //> no meeting - - val from = "abc" //> from : String = abc - val to = "abd" //> to : String = abd - val from1 = new scala.collection.immutable.StringOps(from) - //> from1 : scala.collection.immutable.StringOps = abc - val to1 = new scala.collection.immutable.StringOps(to) - //> to1 : scala.collection.immutable.StringOps = abd - - from1 < to1 //> res0: Boolean = true - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc deleted file mode 100644 index 7c4f1656f5..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futureandpromise.sc +++ /dev/null @@ -1,48 +0,0 @@ -package org.bigbluebutton.apps.protocol - -object futureandpromise { - import scala.util.Try - // Some type aliases, just for getting more meaningful method signatures: - type CoffeeBeans = String - type GroundCoffee = String - case class Water(temperature: Int) - type Milk = String - type FrothedMilk = String - type Espresso = String - type Cappuccino = String - // dummy implementations of the individual steps: - def grind(beans: CoffeeBeans): GroundCoffee = s"ground coffee of $beans" - //> grind: (beans: org.bigbluebutton.apps.protocol.futureandpromise.CoffeeBeans) - //| org.bigbluebutton.apps.protocol.futureandpromise.GroundCoffee - def heatWater(water: Water): Water = water.copy(temperature = 85) - //> heatWater: (water: org.bigbluebutton.apps.protocol.futureandpromise.Water)or - //| g.bigbluebutton.apps.protocol.futureandpromise.Water - def frothMilk(milk: Milk): FrothedMilk = s"frothed $milk" - //> frothMilk: (milk: org.bigbluebutton.apps.protocol.futureandpromise.Milk)org. - //| bigbluebutton.apps.protocol.futureandpromise.FrothedMilk - def brew(coffee: GroundCoffee, heatedWater: Water): Espresso = "espresso" - //> brew: (coffee: org.bigbluebutton.apps.protocol.futureandpromise.GroundCoffee - //| , heatedWater: org.bigbluebutton.apps.protocol.futureandpromise.Water)org.bi - //| gbluebutton.apps.protocol.futureandpromise.Espresso - def combine(espresso: Espresso, frothedMilk: FrothedMilk): Cappuccino = "cappuccino" - //> combine: (espresso: org.bigbluebutton.apps.protocol.futureandpromise.Espress - //| o, frothedMilk: org.bigbluebutton.apps.protocol.futureandpromise.FrothedMilk - //| )org.bigbluebutton.apps.protocol.futureandpromise.Cappuccino - // some exceptions for things that might go wrong in the individual steps - // (we'll need some of them later, use the others when experimenting - // with the code): - case class GrindingException(msg: String) extends Exception(msg) - case class FrothingException(msg: String) extends Exception(msg) - case class WaterBoilingException(msg: String) extends Exception(msg) - case class BrewingException(msg: String) extends Exception(msg) - // going through these steps sequentially: - def prepareCappuccino(): Try[Cappuccino] = for { - ground <- Try(grind("arabica beans")) - water <- Try(heatWater(Water(25))) - espresso <- Try(brew(ground, water)) - foam <- Try(frothMilk("milk")) - } yield combine(espresso, foam) //> prepareCappuccino: ()scala.util.Try[org.bigbluebutton.apps.protocol.futurea - //| ndpromise.Cappuccino] - prepareCappuccino() //> res0: scala.util.Try[org.bigbluebutton.apps.protocol.futureandpromise.Cappu - //| ccino] = Success(cappuccino) -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc deleted file mode 100644 index 8d40c6ed68..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/futuretesting.sc +++ /dev/null @@ -1,72 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import scala.concurrent.Await -import scala.concurrent.Future -import scala.concurrent.duration._ -import akka.util.Timeout -import scala.concurrent.ExecutionContext.Implicits.global -import scala.concurrent.{ ExecutionContext, Promise } -import scala.util.{Success, Failure} - -object futuretesting { - - implicit val timeout = Timeout(5 seconds) //> timeout : akka.util.Timeout = Timeout(5 seconds) - -// val f = Promise.successful("foo") - - val future = Future { - "Hello" + "World" - } //> future : scala.concurrent.Future[String] = scala.concurrent.impl.Promise$De - //| faultPromise@610ac287 - - future foreach println - - future onComplete { - case Success(result) => println("RESULT: " + result) - case Failure(failure) => println("FAIL: " + failure) - } //> HelloWorld - - - case class Email( - subject: String, - text: String, - sender: String, - recipient: String) - - type EmailFilter = Email => Boolean - - def newMailsForUser(mails: Seq[Email], f: EmailFilter) = mails.filter(f) - //> newMailsForUser: (mails: Seq[org.bigbluebutton.apps.protocol.futuretesting.E - //| mail], f: org.bigbluebutton.apps.protocol.futuretesting.Email => Boolean)Seq - //| [org.bigbluebutton.apps.protocol.futuretesting.Email] - - val sentByOneOf: Set[String] => EmailFilter = - senders => email => senders.contains(email.sender) - //> RESULT: HelloWorld - //| sentByOneOf : Set[String] => (org.bigbluebutton.apps.protocol.futuretesting - //| .Email => Boolean) = - val notSentByAnyOf: Set[String] => EmailFilter = - senders => email => !senders.contains(email.sender) - //> notSentByAnyOf : Set[String] => (org.bigbluebutton.apps.protocol.futuretes - //| ting.Email => Boolean) = - val minimumSize: Int => EmailFilter = n => email => email.text.size >= n - //> minimumSize : Int => (org.bigbluebutton.apps.protocol.futuretesting.Email - //| => Boolean) = - val maximumSize: Int => EmailFilter = n => email => email.text.size <= n - //> maximumSize : Int => (org.bigbluebutton.apps.protocol.futuretesting.Email - //| => Boolean) = - - val emailFilter: EmailFilter = notSentByAnyOf(Set("johndoe@example.com")) - //> emailFilter : org.bigbluebutton.apps.protocol.futuretesting.Email => Boole - //| an = - val mails = Email( - subject = "It's me again, your stalker friend!", - text = "Hello my friend! How are you?", - sender = "johndoe@example.com", - recipient = "me@example.com") :: Nil - //> mails : List[org.bigbluebutton.apps.protocol.futuretesting.Email] = List(E - //| mail(It's me again, your stalker friend!,Hello my friend! How are you?,john - //| doe@example.com,me@example.com)) - newMailsForUser(mails, emailFilter) //> res0: Seq[org.bigbluebutton.apps.protocol.futuretesting.Email] = List() - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc deleted file mode 100644 index a0babcd52f..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/joinuserrep.sc +++ /dev/null @@ -1,118 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json._ -import spray.json.DefaultJsonProtocol -import org.bigbluebutton.apps.models.UsersApp.JoinedUser -import org.bigbluebutton.apps.models.UsersApp.User -import org.bigbluebutton.apps.models.Role -import org.bigbluebutton.apps.models.UsersApp.{WebIdentity, CallerId, VoiceIdentity} -import org.bigbluebutton.apps.protocol.UserMessages.{JoinUserReply, JoinUserResponse} - -object joinuserrep { - - import UserMessagesProtocol._ - import HeaderAndPayloadJsonSupport._ - import DefaultJsonProtocol._ - - val replyHeader = ReplyHeader("replyChannel", "abc123") - //> replyHeader : org.bigbluebutton.apps.protocol.ReplyHeader = ReplyHeader(rep - //| lyChannel,abc123) - val headerMeeting = HeaderMeeting("English 101", "english_101", Some("english_101-12345")) - //> headerMeeting : org.bigbluebutton.apps.protocol.HeaderMeeting = HeaderMeeti - //| ng(English 101,english_101,Some(english_101-12345)) - val headerEvent = HeaderEvent("CreateMeetingRequest", 123456, "web-api", Some(replyHeader)) - //> headerEvent : org.bigbluebutton.apps.protocol.HeaderEvent = HeaderEvent(Cre - //| ateMeetingRequest,123456,web-api,Some(ReplyHeader(replyChannel,abc123))) - val header = Header(headerEvent, headerMeeting)//> header : org.bigbluebutton.apps.protocol.Header = Header(HeaderEvent(Create - //| MeetingRequest,123456,web-api,Some(ReplyHeader(replyChannel,abc123))),Header - //| Meeting(English 101,english_101,Some(english_101-12345))) - header.toJson //> res0: spray.json.JsValue = {"event":{"name":"CreateMeetingRequest","timestam - //| p":123456,"source":"web-api","reply":{"to":"replyChannel","correlationId":"a - //| bc123"}},"meeting":{"name":"English 101","externalId":"english_101","session - //| Id":"english_101-12345"}} - - - - val user = User("user1", "Guga", Role.MODERATOR, 85115, "Welcome to English 101", - "http://www.example.com", "http://www.example.com/avatar.png") - //> user : org.bigbluebutton.apps.models.UsersApp.User = User(user1,Guga,MODER - //| ATOR,85115,Welcome to English 101,http://www.example.com,http://www.example - //| .com/avatar.png) - - val webId = WebIdentity("RichWeb") //> webId : org.bigbluebutton.apps.models.UsersApp.WebIdentity = WebIdentity(R - //| ichWeb) - val callerId = CallerId("Richard", "6135207610")//> callerId : org.bigbluebutton.apps.models.UsersApp.CallerId = CallerId(Rich - //| ard,6135207610) - val voiceId = VoiceIdentity("Richard", callerId)//> voiceId : org.bigbluebutton.apps.models.UsersApp.VoiceIdentity = VoiceIden - //| tity(Richard,CallerId(Richard,6135207610)) - -// val juser = JoinedUser("user1", "usertoken", user, false, None, None) -// juser.toJson -// val jurPayload = JoinUserReplyPayload(false, "Successfully joined user.", None) - -// val jur = JoinUserReply(header, jurPayload) -// jur.toJson - - val juser1 = JoinedUser("user1", "usertoken", user, false, Some(webId), Some(voiceId)) - //> juser1 : org.bigbluebutton.apps.models.UsersApp.JoinedUser = JoinedUser(us - //| er1,usertoken,User(user1,Guga,MODERATOR,85115,Welcome to English 101,http:/ - //| /www.example.com,http://www.example.com/avatar.png),false,Some(WebIdentity( - //| RichWeb)),Some(VoiceIdentity(Richard,CallerId(Richard,6135207610)))) - - juser1.toJson //> res1: spray.json.JsValue = {"id":"user1","token":"usertoken","user":{"exter - //| nalId":"user1","name":"Guga","role":"MODERATOR","pin":85115,"welcomeMessage - //| ":"Welcome to English 101","logoutUrl":"http://www.example.com","avatarUrl" - //| :"http://www.example.com/avatar.png"},"isPresenter":false,"webIdent":{"name - //| ":"RichWeb"},"voiceIdent":{"name":"Richard","callerId":{"name":"Richard","n - //| umber":"6135207610"}}} - -// val jur1Payload = JoinUserReplyPayload( true, "Successfully joined user.", Some(juser1)) -// val jur1 = JoinUserReply(header, jur1Payload) -// jur1.toJson - - - val statusCode = StatusCode(StatusCodes.NOT_FOUND.id, - StatusCodes.NOT_FOUND.toString()) - //> statusCode : org.bigbluebutton.apps.protocol.StatusCode = StatusCode(404,N - //| ot Found) - val errorCode = ErrorCode(ErrorCodes.INVALID_TOKEN.id, - ErrorCodes.INVALID_TOKEN.toString()) - //> errorCode : org.bigbluebutton.apps.protocol.ErrorCode = ErrorCode(1,Invali - //| d or expired token) - val response = Response(status = statusCode, - errors = Some(Seq(errorCode))) - //> response : org.bigbluebutton.apps.protocol.Response = Response(StatusCode( - //| 404,Not Found),Some(List(ErrorCode(1,Invalid or expired token)))) - - val jur2 = JoinUserResponse(response, "mytoken", Some(juser1)) - //> jur2 : org.bigbluebutton.apps.protocol.UserMessages.JoinUserResponse = Joi - //| nUserResponse(Response(StatusCode(404,Not Found),Some(List(ErrorCode(1,Inva - //| lid or expired token)))),mytoken,Some(JoinedUser(user1,usertoken,User(user1 - //| ,Guga,MODERATOR,85115,Welcome to English 101,http://www.example.com,http:// - //| www.example.com/avatar.png),false,Some(WebIdentity(RichWeb)),Some(VoiceIden - //| tity(Richard,CallerId(Richard,6135207610)))))) - - val finalReply = JoinUserReply(header, jur2).toJson - //> finalReply : spray.json.JsValue = {"header":{"event":{"name":"CreateMeetin - //| gRequest","timestamp":123456,"source":"web-api","reply":{"to":"replyChannel - //| ","correlationId":"abc123"}},"meeting":{"name":"English 101","externalId":" - //| english_101","sessionId":"english_101-12345"}},"payload":{"response":{"stat - //| us":{"code":404,"message":"Not Found"},"errors":[{"code":1,"message":"Inval - //| id or expired token"}]},"token":"mytoken","joinedUser":{"id":"user1","token - //| ":"usertoken","user":{"externalId":"user1","name":"Guga","role":"MODERATOR" - //| ,"pin":85115,"welcomeMessage":"Welcome to English 101","logoutUrl":"http:// - //| www.example.com","avatarUrl":"http://www.example.com/avatar.png"},"isPresen - //| ter":false,"webIdent":{"name":"RichWeb"},"voiceIdent":{"name":"Richard","ca - //| llerId":{"name":"Richard","number":"6135207610"}}}}} - val failure = JsString( - """Malformed message: [{"meeting1":{"name":"English 101","externalId":"english_101","record":true,"welcomeMessage":"Welcome to English 101","logoutUrl":"http://www.bigbluebutton.org","avatarUrl":"http://www.gravatar.com/bigbluebutton","users":{"max":20,"hardLimit":false},"duration":{"length":120,"allowExtend":false,"warnBefore":30},"voiceConf":{"pin":123456,"number":85115},"phoneNumbers":[{"number":"613-520-7600","description":"Ottawa"},{"number":"1-888-555-7890","description":"NA Toll-Free"}],"metadata":{"customerId":"acme-customer","customerName":"ACME"}}}]""") - //> failure : spray.json.JsString = "Malformed message: [{\"meeting1\":{\"name - //| \":\"English 101\",\"externalId\":\"english_101\",\"record\":true,\"welcome - //| Message\":\"Welcome to English 101\",\"logoutUrl\":\"http://www.bigbluebutt - //| on.org\",\"avatarUrl\":\"http://www.gravatar.com/bigbluebutton\",\"users\": - //| {\"max\":20,\"hardLimit\":false},\"duration\":{\"length\":120,\"allowExtend - //| \":false,\"warnBefore\":30},\"voiceConf\":{\"pin\":123456,\"number\":85115} - //| ,\"phoneNumbers\":[{\"number\":\"613-520-7600\",\"description\":\"Ottawa\"} - //| ,{\"number\":\"1-888-555-7890\",\"description\":\"NA Toll-Free\"}],\"metada - //| ta\":{\"customerId\":\"acme-customer\",\"customerName\":\"ACME\"}}}]" -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc deleted file mode 100644 index 05215061b7..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/protocol/whiteboardmsgws.sc +++ /dev/null @@ -1,134 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json._ -import org.bigbluebutton.apps.models._ - - - -object whiteboardmsgws { - val wbmsg = """ -{ - - "id": "user1-shape-1", - "correlationId": "q779ogycfmxk-13-1383262166102", - "type": "text", - "data": { - "coordinate": { - "firstX": 0.016025641025641028, - "firstY": 0.982905982905983, - "lastX": 1.33, - "lastY": 2.45 - }, - "font": { - "color": 0, - "size": 18 - }, - "background": true, - "backgroundColor": 16777215, - "text": "He" - }, - "by": { - "id": "user1", - "name": "Guga" - } - -} - """ //> wbmsg : String = " - //| { - //| - //| "id": "user1-shape-1", - //| "correlationId": "q779ogycfmxk-13-1383262166102", - //| "type": "text", - //| "data": { - //| "coordinate": { - //| "firstX": 0.016025641025641028, - //| "firstY": 0.982905982905983, - //| "lastX": 1.33, - //| "lastY": 2.45 - //| }, - //| "font": { - //| "color": 0, - //| "size": 18 - //| }, - //| "background": true, - //| "backgroundColor": 16777215, - //| "text": "He" - //| }, - //| "by": { - //| "id": "user1", - //| "name": "Guga" - //| } - //| - //| } - //| " - - case class Shape(id: String, correlationId: String, data: Map[String, String], by: Map[String, String]) - - object ShapeJsonProtocol extends DefaultJsonProtocol { - implicit val shapeFormat = jsonFormat4(Shape) - } - - import ShapeJsonProtocol._ - - val jsonAst = JsonParser(wbmsg) //> jsonAst : spray.json.JsValue = {"id":"user1-shape-1","correlationId":"q779 - //| ogycfmxk-13-1383262166102","type":"text","data":{"coordinate":{"firstX":0.0 - //| 16025641025641028,"firstY":0.982905982905983,"lastX":1.33,"lastY":2.45},"fo - //| nt":{"color":0,"size":18},"background":true,"backgroundColor":16777215,"tex - //| t":"He"},"by":{"id":"user1","name":"Guga"}} - val jsonObj = jsonAst.asJsObject //> jsonObj : spray.json.JsObject = {"id":"user1-shape-1","correlationId":"q77 - //| 9ogycfmxk-13-1383262166102","type":"text","data":{"coordinate":{"firstX":0. - //| 016025641025641028,"firstY":0.982905982905983,"lastX":1.33,"lastY":2.45},"f - //| ont":{"color":0,"size":18},"background":true,"backgroundColor":16777215,"te - //| xt":"He"},"by":{"id":"user1","name":"Guga"}} - val typeObj = jsonObj.fields.get("type").get //> typeObj : spray.json.JsValue = "text" - val dataObj = jsonObj.fields.get("data").get.asJsObject - //> dataObj : spray.json.JsObject = {"coordinate":{"firstX":0.0160256410256410 - //| 28,"firstY":0.982905982905983,"lastX":1.33,"lastY":2.45},"font":{"color":0, - //| "size":18},"background":true,"backgroundColor":16777215,"text":"He"} - - val userJoinMessage = """ - { - "name": "user_join", - "timestamp": 123456, - "meeting": { - "id": "english_101", - "name": "English 101", - "session": "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1383210136298" - }, - "payload": { - "token": "user1-token-1" - } - } - - """ //> userJoinMessage : String = " - //| { - //| "name": "user_join", - //| "timestamp": 123456, - //| "meeting": { - //| "id": "english_101", - //| "name": "English 101", - //| "session": "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-138321013629 - //| 8" - //| }, - //| "payload": { - //| "token": "user1-token-1" - //| } - //| } - //| - //| " - val userJoinAst = JsonParser(userJoinMessage).asJsObject - //> userJoinAst : spray.json.JsObject = {"name":"user_join","timestamp":123456 - //| ,"meeting":{"id":"english_101","name":"English 101","session":"183f0bf3a098 - //| 2a127bdb8161e0c44eb696b3e75c-1383210136298"},"payload":{"token":"user1-toke - //| n-1"}} - val tokenObj = userJoinAst.fields.get("payload").get.asJsObject - //> tokenObj : spray.json.JsObject = {"token":"user1-token-1"} - val tokenVal = tokenObj.fields.get("token").get.prettyPrint - //> tokenVal : String = "user1-token-1" - - - - - - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc deleted file mode 100644 index ee72606983..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/users/data/usersmsgWS.sc +++ /dev/null @@ -1,114 +0,0 @@ -package org.bigbluebutton.apps.users.data - -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.apps.protocol._ - -object usersmsgWS1 { - - object Role extends Enumeration { - type RoleType = Value - val MODERATOR = Value("MODERATOR") - val VIEWER = Value("VIEWER") - } - case class Session(id: String, meetingId: String, meetingName: String) - case class WebIdentity(handRaised: Boolean = false) - - case class CallerId(name: String, number: String) - case class VoiceIdentity(callerId: CallerId, muted: Boolean = false, - locked: Boolean = false, talking: Boolean = false, - metadata: Map[String, String]) - - case class UserIdAndName(id: String, name: String) - - object SystemUser extends UserIdAndName(id = "system", name = "System") - - case class JoinedUser(id: String, token: String, user: User, - isPresenter: Boolean = false, - webIdentity: WebIdentity, - voiceIdentity: VoiceIdentity) - - case class RegisteredUser(token: String, user: User) - - case class User(externalId: String, name: String, - role: Role.RoleType, pin: Int, welcomeMessage: String, - logoutUrl: String, avatarUrl: String) - - case class Presenter(presenter: UserIdAndName, assignedBy: UserIdAndName) - case class UserJoined(session: Session, token: String, joinedUser: JoinedUser) - - val eng101Session = Session("english_101-1234", "english_101", "English 101") - //> eng101Session : org.bigbluebutton.apps.users.data.usersmsgWS1.Session = Se - //| ssion(english_101-1234,english_101,English 101) - val userJuan = User("userjuan", "Juan Tamad", - Role.MODERATOR, 12345, - "Welcome Juan", - "http://www.umaliska.don", - "http://www.mukhamo.com/unggoy")//> userJuan : org.bigbluebutton.apps.users.data.usersmsgWS1.User = User(userj - //| uan,Juan Tamad,MODERATOR,12345,Welcome Juan,http://www.umaliska.don,http:// - //| www.mukhamo.com/unggoy) - val juanWebIdentity = WebIdentity(false) //> juanWebIdentity : org.bigbluebutton.apps.users.data.usersmsgWS1.WebIdentit - //| y = WebIdentity(false) - val juanCallerId = CallerId("Juan Tamad", "011-63-917-555-1234") - //> juanCallerId : org.bigbluebutton.apps.users.data.usersmsgWS1.CallerId = Ca - //| llerId(Juan Tamad,011-63-917-555-1234) - val juanVoiceMeta = Map("userid" -> "1", "conference_num" -> "85115") - //> juanVoiceMeta : scala.collection.immutable.Map[String,String] = Map(userid - //| -> 1, conference_num -> 85115) - val juanVoiceIdentity = VoiceIdentity(juanCallerId, false, - false, false, juanVoiceMeta) - //> juanVoiceIdentity : org.bigbluebutton.apps.users.data.usersmsgWS1.VoiceIde - //| ntity = VoiceIdentity(CallerId(Juan Tamad,011-63-917-555-1234),false,false, - //| false,Map(userid -> 1, conference_num -> 85115)) - - val joinedUserJuan = JoinedUser("juanid", "juanToken", userJuan, - true, juanWebIdentity, juanVoiceIdentity) - //> joinedUserJuan : org.bigbluebutton.apps.users.data.usersmsgWS1.JoinedUser - //| = JoinedUser(juanid,juanToken,User(userjuan,Juan Tamad,MODERATOR,12345,Welc - //| ome Juan,http://www.umaliska.don,http://www.mukhamo.com/unggoy),true,WebIde - //| ntity(false),VoiceIdentity(CallerId(Juan Tamad,011-63-917-555-1234),false,f - //| alse,false,Map(userid -> 1, conference_num -> 85115))) - -object UserMessagesProtocol1 extends DefaultJsonProtocol { - implicit object RoleJsonFormat extends JsonFormat[Role.RoleType] { - def write(obj: Role.RoleType): JsValue = JsString(obj.toString) - - def read(json: JsValue): Role.RoleType = json match { - case JsString(str) => Role.withName(str) - case _ => throw new DeserializationException("Enum string expected") - } - } - - implicit val webIdentityFormat = jsonFormat1(WebIdentity) - implicit val callerIdFormat = jsonFormat2(CallerId) - implicit val voiceIdentityFormat = jsonFormat5(VoiceIdentity) - - implicit val userFormat = jsonFormat7(User) - implicit val joinedUserFormat = jsonFormat6(JoinedUser) - - implicit val userIdAndNameFormat = jsonFormat2(UserIdAndName) - implicit val sessionFormat = jsonFormat3(Session) - implicit val userJoinedFormat = jsonFormat3(UserJoined) -} - - import UserMessagesProtocol1._ - val userJoinedMsg = UserJoined(eng101Session, "juanToken", joinedUserJuan).toJson - //> userJoinedMsg : spray.json.JsValue = {"session":{"id":"english_101-1234"," - //| meetingId":"english_101","meetingName":"English 101"},"token":"juanToken"," - //| joinedUser":{"id":"juanid","token":"juanToken","user":{"externalId":"userju - //| an","name":"Juan Tamad","role":"MODERATOR","pin":12345,"welcomeMessage":"We - //| lcome Juan","logoutUrl":"http://www.umaliska.don","avatarUrl":"http://www.m - //| ukhamo.com/unggoy"},"isPresenter":true,"webIdentity":{"handRaised":false}," - //| voiceIdentity":{"callerId":{"name":"Juan Tamad","number":"011-63-917-555-12 - //| 34"},"muted":false,"locked":false,"talking":false,"metadata":{"userid":"1", - //| "conference_num":"85115"}}}} - val ujmJson = userJoinedMsg.toJson //> ujmJson : spray.json.JsValue = {"session":{"id":"english_101-1234","meetin - //| gId":"english_101","meetingName":"English 101"},"token":"juanToken","joined - //| User":{"id":"juanid","token":"juanToken","user":{"externalId":"userjuan","n - //| ame":"Juan Tamad","role":"MODERATOR","pin":12345,"welcomeMessage":"Welcome - //| Juan","logoutUrl":"http://www.umaliska.don","avatarUrl":"http://www.mukhamo - //| .com/unggoy"},"isPresenter":true,"webIdentity":{"handRaised":false},"voiceI - //| dentity":{"callerId":{"name":"Juan Tamad","number":"011-63-917-555-1234"}," - //| muted":false,"locked":false,"talking":false,"metadata":{"userid":"1","confe - //| rence_num":"85115"}}}} -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc deleted file mode 100644 index 7dc9f8ea5b..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/apps/whiteboard/data/sequencews.sc +++ /dev/null @@ -1,26 +0,0 @@ -package org.bigbluebutton.apps.whiteboard.data - -import org.bigbluebutton.apps.users.data.UserIdAndName - - - -object sequencews1 { - val nums = Seq(1,2,3,4,5) //> nums : Seq[Int] = List(1, 2, 3, 4, 5) - - val isEven : PartialFunction[Int, Int] = { case x if x % 2 == 0 => x} - //> isEven : PartialFunction[Int,Int] = - nums collect isEven //> res0: Seq[Int] = List(2, 4) - - val user = UserIdAndName("me", "me") //> user : org.bigbluebutton.apps.users.data.UserIdAndName = UserIdAndName(me,m - //| e) - - val f = Foo1("bar") //> f : org.bigbluebutton.apps.whiteboard.data.Foo1 = Foo1(bar) - var desc = new ShapeDescriptor("shape1", "cor1", ShapeTypes.SCRIBBLE, user, 0) - //> desc : org.bigbluebutton.apps.whiteboard.data.ShapeDescriptor = ShapeDescri - //| ptor(shape1,cor1,SCRIBBLE,UserIdAndName(me,me),0) -// val isShape : PartialFunction[Shape, Option[Shape]] = { -// case x @ Scribble(desc, _, _) => if (desc.id == x.descriptor.id) Some(x) else None -// } - - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala deleted file mode 100644 index b64759c108..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala +++ /dev/null @@ -1,2116 +0,0 @@ -package org.bigbluebutton.endpoint - -/** - * This file contains messages received and sent from/to pubsub by bbb-apps. - */ -trait JsonMessagesFixtures { - -/** - * Message received from pubsub to create a meeting. - * - * meeting_descriptor: different default values for features of the meeting. - */ - val CreateMeetingRequestJson = -""" - { - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "create_meeting_request", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting_descriptor": { - "name": "English 101", - "external_id": "english_101", - "record": true, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.bigbluebutton.org", - "avatar_url": "http://www.gravatar.com/bigbluebutton", - "max_users": 20, - "duration": { - "length_in_minutes": 120, - "allow_extend": false, - "max_minutes": 240 - }, - "voice_conference": { - "pin": 123456, - "number": 85115 - }, - "phone_numbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": { - "customer_id": "acme-customer", - "customer_name": "ACME" - } - } - } - } -""" - -/** - * Message response to the create meeting request. - * - * session: the session id for this newly created meeting. - * result: the result of the request and relevant message. - * meeting_descriptor: the meeting_descriptor passed on the create request. - * - */ - - val CreateMeetingResponseJson = -""" -{ - "header": { - "destination": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "create_meeting_response", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-1234", - "result": { - "success": true, - "message": "Success" - }, - "meeting_descriptor": { - "name": "English 101", - "external_id": "english_101", - "record": true, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.bigbluebutton.org", - "avatar_url": "http://www.gravatar.com/bigbluebutton", - "max_users": 20, - "duration": { - "length_in_minutes": 120, - "allow_extend": false, - "max_minutes": 240 - }, - "voice_conference": { - "pin": 123456, - "number": 85115 - }, - "phone_numbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": { - "customer_id": "acme-customer", - "customer_name": "ACME" - } - } - } -} -""" - -/** - * Broadcast message to pubsub about the newly created meeting. - * Interested parties who keep track of running meeting listen for this - * event and initialize their own data in preparation for users joining - * the meeting. - * - */ - val MeetingCreatedEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "meeting_created_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-1234", - "meeting_descriptor": { - "name": "English 101", - "external_id": "english_101", - "record": true, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.bigbluebutton.org", - "avatar_url": "http://www.gravatar.com/bigbluebutton", - "max_users": 20, - "duration": { - "length_in_minutes": 120, - "allow_extend": false, - "max_minutes": 240 - }, - "voice_conference": { - "pin": 123456, - "number": 85115 - }, - "phone_numbers": [ - { - "number": "613-520-7600", - "description": "Ottawa" - }, - { - "number": "1-888-555-7890", - "description": "NA Toll-Free" - } - ], - "metadata": { - "customer_id": "acme-customer", - "customer_name": "ACME" - } - } - } -} - """ - -/** - * Message received from the pubsub to end the meeting. - * - * force: true/false - kick everyone out and end the meeting - * warn_users: true/false - notify users and wait for a few seconds - * before kicking everyone out. - */ - val EndMeetingRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "end_meeting_request", - "timestamp": "2013-12-23T08: 50Z", - "source": "bbb-web" - }, - "payload": { - "meeting": { - "name": "English101", - "id": "english_101" - }, - "session": "english_101-12345", - "force": true, - "warn_users": true - } -} - """ - -/** - * Response to the end meeting request. - */ - val EndMeetingResponseJson = """ -{ - "header": { - "destination": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "end_meeting_response", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "result": { - "success": true, - "message": "Ending the meeting. Please wait several seconds to complete the request." - } - } -} - """ - -/** - * Notify users that the meeting is about to end. This message gets sent when - * an end meeting request is received and as a notice that a meeting is about - * to reach its duration. - * - * time_left, time_unit: time left before the users will be kicked out. - * allow_extend: allow moderators to extend the meeting up to max duration. - * - */ - val EndMeetingWarningEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "end_meeting_warning_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "time_left": 30, - "time_unit": "seconds", - "allow_extend": false - } -} - """ - -/** - * Broadcast message that the meeting has ended and that all users have been - * kicked out. Interested parties should clean up their data. - * - */ - val MeetingEndedEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "meeting_ended_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345" - } -} - """ - -/** - * Received from the pubsub that a user is about to join the meeting. - */ - val RegisterUserRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "register_user_request", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-web" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user_descriptor": { - "external_id": "user1", - "name": "Guga", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.example.com", - "avatar_url": "http://www.example.com/avatar.png", - "metadata": { - "student_id": "54321", - "program": "engineering" - } - } - } -} - """ - -/** - * Response to the register user request. - * - * user_token: auth token the user needs to pass when joining the meeting. - * - */ - val RegisterUserResponseJson = """ -{ - "header": { - "destination": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "register_user_response", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user_token": "guga-token", - "result": { - "success": true, - "message": "Success" - }, - "user_descriptor": { - "external_id": "user1", - "name": "Guga", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.example.com", - "avatar_url": "http://www.example.com/avatar.png", - "metadata": { - "student_id": "54321", - "program": "engineering" - } - } - } -} - """ - -/** - * Broadcast to pubsub that a user is about to join the meeting. - */ - val UserRegisteredEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_registered_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-1234", - "user_descriptor": { - "external_id": "user1", - "name": "Guga", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome to English 101", - "logout_url": "http://www.example.com", - "avatar_url": "http://www.example.com/avatar.png", - "metadata": { - "student_id": "54321", - "program": "engineering" - } - } - } -} - """ - -/** - * Received when a user joins the meeting. - * - * token: auth token returned on the register user response. - */ - val UserJoinRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "user_join_request", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "token": "user1-token-1" - } -} - """ - -/** - * Response to the user join request when the token is valid. - * - * The information about the user is returned with the user id. - */ - val UserJoinResponseJson = """ -{ - "header": { - "destination": { - "to": "apps_channel", - "correlation_id": "abc-corelid" - }, - "name": "user_join_response", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "id": "english_101", - "name": "English 101" - }, - "session": "english_101-1234", - "result": { - "success": true, - "message": "Success" - }, - "user": { - "id": "juan-user1", - "external_id": "juan-ext-user1", - "name": "Juan Tamad", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome Juan", - "logout_url": "http://www.umaliska.don", - "avatar_url": "http://www.mukhamo.com/unggoy", - "metadata": { - "student_id": "54321", - "program": "engineering" - } - } - } -} - """ - -/** - * Broadcast message to interested parties that a user has joined the meeting. - * - */ - val UserJoinedEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_joined_event", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user": { - "id": "juanid", - "external_id": "userjuan", - "name": "Juan Tamad", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome Juan", - "logout_url": "http://www.umaliska.don", - "avatar_url": "http://www.mukhamo.com/unggoy", - "is_presenter": true, - "status": { - "hand_raised": false, - "muted": false, - "locked": false, - "talking": false - }, - "caller_id": { - "name": "Juan Tamad", - "number": "011-63-917-555-1234" - }, - "media_streams": [ - { - "media_type": "audio", - "uri": "http://cdn.bigbluebutton.org/stream/a1234", - "metadata": { - "foo": "bar" - } - }, - { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - { - "media_type": "screen", - "uri": "http://cdn.bigbluebutton.org/stream/s1234", - "metadata": { - "foo": "bar" - } - } - ], - "metadata": { - "student_id": "54321", - "program": "engineering" - } - } - } -} - """ - -/** - * Received message that a user has left the meeting. - */ - val UserLeaveEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_leave_event", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user": { - "id": "juanid", - "name": "Juan Tamad" - } - } -} - """ - -/** - * Broadcast message that a user has left the meeting. - */ - val UserLeftEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_left_event", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user": { - "id": "juanid", - "name": "Juan Tamad" - } - } -} - """ - -/** - * Received messages to get all the users in a meeting. - */ - val GetUsersRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "get_users_request", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-web" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "requester": { - "id": "juanid", - "name": "Juan Tamad" - } - } -} - """ - -/** - * Response to the get users request. - */ - val GetUsersResponseJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "get_users_response", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "users": [ - { - "id": "juanid", - "external_id": "userjuan", - "name": "Juan Tamad", - "role": "MODERATOR", - "pin": 12345, - "welcome_message": "Welcome Juan", - "logout_url": "http://www.umaliska.don", - "avatar_url": "http://www.mukhamo.com/unggoy", - "is_presenter": true, - "status": { - "hand_raised": false, - "muted": false, - "locked": false, - "talking": false - }, - "caller_id": { - "name": "Juan Tamad", - "number": "011-63-917-555-1234" - }, - "media_streams": [ - { - "media_type": "audio", - "uri": "http://cdn.bigbluebutton.org/stream/a1234", - "metadata": { - "foo": "bar" - } - }, - { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - { - "media_type": "screen", - "uri": "http://cdn.bigbluebutton.org/stream/s1234", - "metadata": { - "foo": "bar" - } - } - ], - "metadata": { - "student_id": "54321", - "program": "engineering" - } - } - ] - } -} - """ - -/** - * Received message that a user has raised hand. - */ - val RaiseUserHandRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "raise_user_hand_request", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "requester": { - "id": "juanid", - "name": "Juan Tamad" - }, - "raise": true - } -} - """ - -/** - * Broadcast message that a user has raise her/his hand. - */ - val UserRaisedHandEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_raised_hand_event", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "requester": { - "id": "juanid", - "name": "Juan Tamad" - }, - "raised": true - } -} - """ - -/** - * Received message to assign a user as a presenter. - */ - val AssignPresenterRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "assign_presenter_request", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "presenter": { - "id": "user1", - "name": "Guga" - }, - "assigned_by": { - "id": "user2", - "name": "Juan" - } - } -} - """ - -/** - * Broadcast message that a new presenter has been assigned. - */ - val PresenterAssignedEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "presenter_assigned_event", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "presenter": { - "id": "user1", - "name": "Guga" - }, - "assigned_by": { - "id": "user2", - "name": "Juan" - } - } -} - """ - -/** - * Received message to mute a user. - */ - val MuteUserRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "mute_user_request", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user": { - "id": "user1", - "name": "Guga" - }, - "requester": { - "id": "user2", - "name": "Juan" - }, - "mute": true - } -} - """ - -/** - * Broadcast message that a request to mute a user has been received. - */ - val MuteUserRequestEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "mute_user_request_event", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "user": { - "id": "user1", - "name": "Guga" - }, - "requester": { - "id": "user2", - "name": "Juan" - }, - "mute": true - } -} - """ - -/** - * Broadcast message to the voice conference provider (FreeSWITCH) to mute - * a user. - */ - val MuteVoiceUserRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "mute_voice_user_request", - "timestamp": "2013-12-23T08:50Z", - "source": "web-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "mute": true, - "user_metadata": { - "id": "user1", - "name": "Guga" - }, - "voice_metadata": { - "FreeSWITCH-IPv4": "192.168.0.166", - "Conference-Name": "72382", - "Conference-Unique-ID": "480d3f7c-224f-11e0-ae04-fbe97e271da0", - "conference_member_id": "1" - } - } -} - """ - -/** - * Message from FreeSWITCH that the user has been muted. - */ - val VoiceUserMutedEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "voice_user_muted_event", - "timestamp": "2013-12-23T08:50Z", - "source": "fs-esl" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "muted": true, - "user_metadata": { - "id": "user1", - "name": "Guga" - }, - "voice_metadata": { - "FreeSWITCH-IPv4": "192.168.0.166", - "Conference-Name": "72382", - "Conference-Unique-ID": "480d3f7c-224f-11e0-ae04-fbe97e271da0", - "conference_member_id": "1" - } - } -} - """ - -/** - * Broadcast messages to interested parties that the user is now muted. - */ - val UserMutedEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_muted_event", - "timestamp": "2013-12-23T08:50Z", - "source": "fs-esl" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "muted": true, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val UserPublishStreamRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "user_publish_stream_request", - "timestamp": "2013-12-23T08:50Z", - "source": "fs-esl" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val PublishStreamRequestJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "reply": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "publish_stream_request", - "timestamp": "2013-12-23T08:50Z", - "source": "fs-esl" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val PublishStreamResponseJson = """ -{ - "header": { - "destination": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "publish_stream_response", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-api" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val UserPublishStreamResponseJson = """ -{ - "header": { - "destination": { - "to": "apps_channel", - "correlation_id": "abc" - }, - "name": "user_publish_stream_response", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val PublishedStreamEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "published_stream_event", - "timestamp": "2013-12-23T08:50Z", - "source": "media-server" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val UserPublishedStreamEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_published_stream_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val UnpublishedStreamEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "unpublished_stream_event", - "timestamp": "2013-12-23T08:50Z", - "source": "media-server" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val UserUnpublishedStreamEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "user_unpublished_stream_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "meeting": { - "name": "English 101", - "id": "english_101" - }, - "session": "english_101-12345", - "media": { - "media_type": "video", - "uri": "http://cdn.bigbluebutton.org/stream/v1234", - "metadata": { - "foo": "bar" - } - }, - "user": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val PublicChatMessageEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "public_chat_message_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "chat_message": { - "correlation_id": "user1-msg1", - "timestamp": "2013-12-23T08:50Z", - "from": { - "id": "user1", - "name": "Richard" - }, - "message": { - "text": "Hello world!", - "lang": "en_US" - }, - "font": { - "color": 16711680, - "size": 14, - "font_type": "Arial" - } - } - } -} - """ - -val BroadcastPublicChatMessageEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_public_chat_message_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "chat_message": { - "id": "msg1234", - "server_timestamp": "2013-12-23T08:50Z", - "correlation_id": "user1-msg1", - "user_timestamp": "2013-12-23T08:50Z", - "from": { - "id": "user1", - "name": "Richard" - }, - "message": { - "text": "Hello world!", - "lang": "en_US" - }, - "font": { - "color": 16711680, - "size": 14, - "font_type": "Arial" - }, - "translations": [ - { - "lang": "es_LA", - "text": "Hola Mundo!" - } - ] - } - } -} - """ - -val PrivateChatMessageEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "private_chat_message_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "chat_message": { - "correlation_id": "user1-msg1", - "timestamp": "2013-12-23T08:50Z", - "from": { - "id": "user1", - "name": "Richard" - }, - "to": { - "id": "user2", - "name": "Guga" - }, - "message": { - "text": "Hello world!", - "lang": "en_US" - }, - "font": { - "color": 16711680, - "size": 14, - "font_type": "Arial" - } - } - } -} - """ - -val BroadcastPrivateChatMessageEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_private_chat_message_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "chat_message": { - "id": "msg1234", - "server_timestamp": "2013-12-23T08:50Z", - "correlation_id": "user1-msg1", - "user_timestamp": "2013-12-23T08:50Z", - "from": { - "id": "user1", - "name": "Richard" - }, - "to": { - "id": "user2", - "name": "Guga" - }, - "message": { - "text": "Hello world!", - "lang": "en_US" - }, - "font": { - "color": 16711680, - "size": 14, - "font_type": "Arial" - }, - "translations": [ - { - "lang": "es_LA", - "text": "Hola Mundo!" - } - ] - } - } -} - """ - -val WhiteboardDrawLineEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "line", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val WhiteboardUpdateLineEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_update_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "line", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 2.33, - "last_y": 3.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val WhiteboardDrawScribbleEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "scribble", - "data": { - "points": [ - { - "x": 0.016025641025641028, - "y": 0.982905982905983 - }, - { - "x": 2.33, - "y": 3.45 - } - ], - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardDrawRectangleEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "rectangle", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "square": false - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardUpdateRectangleEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_update_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "rectangle", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 2.33, - "last_y": 3.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "square": false - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardDrawEllipseEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "ellipse", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "circle": false - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardUpdateEllipseleEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_update_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "ellipse", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 2.33, - "last_y": 3.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "circle": false - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardDrawTriangleEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "triangle", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardUpdateTriangleleEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_update_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "triangle", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 2.33, - "last_y": 3.45 - }, - "line": { - "line_type": "solid", - "color": 0, - "weight": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardDrawTextEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "text", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "font": { - "style": "arial", - "color": 0, - "size": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "text": "He" - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val WhiteboardUpdateTextEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_draw_update_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "shape_type": "text", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "font": { - "style": "arial", - "color": 0, - "size": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "text": "He" - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val BroadcastWhiteboardDrawTextEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_whiteboard_draw_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "timestamp": "2013-12-23T08:50Z", - "zorder": 100, - "shape_type": "text", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "font": { - "style": "arial", - "color": 0, - "size": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "text": "He" - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - val BroadcastWhiteboardUpdateTextEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_whiteboard_draw_update_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "presentation_id/page_num", - "shape_id": "q779ogycfmxk-13-1383262166102", - "timestamp": "2013-12-23T08:50Z", - "zorder": 100, - "shape_type": "text", - "data": { - "coordinate": { - "first_x": 0.016025641025641028, - "first_y": 0.982905982905983, - "last_x": 1.33, - "last_y": 2.45 - }, - "font": { - "style": "arial", - "color": 0, - "size": 18 - }, - "background": { - "visible": true, - "color": 16777215, - "alpha": 0 - }, - "text": "He" - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - - - -val WhiteboardCursorEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "whiteboard_cursor_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "user1-shape-1", - "cursor": { - "x": 0.54, - "y": 0.98 - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val BroadcastWhiteboardCursorEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_whiteboard_cursor_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "whiteboard_id": "user1-shape-1", - "cursor": { - "x": 0.54, - "y": 0.98 - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val SharePresentationEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "share_presentation_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "presentation": { - "id": "pres-123", - "name": "Flight School" - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - """ - -val BroadcastSharePresentationEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_share_presentation_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "presentation": { - "id": "pres-123", - "name": "Flight School" - }, - "page": { - "id": "pres-123/1", - "uri": "http://www.example.com/presentations/pres-123/1.swf", - "position": { - "x_offset": 0, - "y_offset": 0, - "width_ratio": 100, - "height_ratio": 100 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - - """ - -val ResizeAndMovePagePageEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "resize_and_move_page_presentation_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "presentation": { - "id": "pres-123", - "name": "Flight School" - }, - "page": { - "id": "pres-123/1", - "uri": "http://www.example.com/presentations/pres-123/1.swf", - "position": { - "x_offset": 0, - "y_offset": 0, - "width_ratio": 100, - "height_ratio": 100 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - - """ - -val BroadcastResizeAndMovePagePageEventJson = """ -{ - "header": { - "destination": { - "to": "apps_channel" - }, - "name": "broadcast_resize_and_move_page_presentation_event", - "timestamp": "2013-12-23T08:50Z", - "source": "bbb-apps" - }, - "payload": { - "presentation": { - "id": "pres-123", - "name": "Flight School" - }, - "page": { - "id": "pres-123/1", - "uri": "http://www.example.com/presentations/pres-123/1.swf", - "position": { - "x_offset": 0, - "y_offset": 0, - "width_ratio": 100, - "height_ratio": 100 - } - }, - "by": { - "id": "user1", - "name": "Guga" - } - } -} - - """ -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala deleted file mode 100644 index 636c09487e..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageHandlerActorSpec.scala +++ /dev/null @@ -1,41 +0,0 @@ -package org.bigbluebutton.endpoint -import akka.actor.ActorSystem -import akka.testkit.{DefaultTimeout, ImplicitSender, TestKit, TestProbe, TestActorRef} -import scala.concurrent.duration._ -import org.scalatest.{WordSpecLike, BeforeAndAfterAll, Matchers} -import org.bigbluebutton.apps.users.messages.UserJoinRequest - -class MessageHandlerActorSpec extends - TestKit(ActorSystem("MessageHandlerActorSpec")) with DefaultTimeout with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll with UsersMessageTestFixtures { - - val messageMarshallerProbe = TestProbe() - val bbbAppsProbe = TestProbe() - val messageHandlerActor = TestActorRef[MessageHandlerActor]( - MessageHandlerActor.props( - bbbAppsProbe.ref, messageMarshallerProbe.ref)) - - override def afterAll { - shutdown(system) - } - - "The MessageHandlerActor"should { - "Send a UserJoinResponseMessage message when receiving a user join request message" in { - messageHandlerActor ! userJoinRequestMessage - - bbbAppsProbe.expectMsgPF(500 millis) { - case ujr:UserJoinRequest => { - ujr.token shouldBe juanUserToken - bbbAppsProbe.reply(userJoinSuccessResponse) - } - case _ => fail("Expected a UserJoinRequest message.") - } - - messageMarshallerProbe.expectMsgPF(500 millis) { - case ujr:UserJoinResponseMessage => { - ujr.response.result.success shouldBe true - } - case _ => fail("Expected a UserJoinResponseMessage message.") - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala deleted file mode 100644 index dfe8b26da8..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageMarshallingActorSpec.scala +++ /dev/null @@ -1,38 +0,0 @@ -package org.bigbluebutton.endpoint -import akka.actor.ActorSystem -import akka.testkit.{DefaultTimeout, ImplicitSender, TestKit, TestProbe, TestActorRef} -import scala.concurrent.duration._ -import org.scalatest.{WordSpecLike, BeforeAndAfterAll, Matchers} -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.endpoint.redis.JsonMessage - -class MessageMarshallingActorSpec extends - TestKit(ActorSystem("MessageMarshallingActorSpec")) - with DefaultTimeout with ImplicitSender with WordSpecLike - with Matchers with BeforeAndAfterAll - with UsersMessageTestFixtures { - - val pubsubProbe = TestProbe() - val marshallingActor = TestActorRef[MessageMarshallingActor]( - MessageMarshallingActor.props( - pubsubProbe.ref)) - - override def afterAll { - shutdown(system) - } - - "The MessageMarshallingActor" should { - "Send a UserJoinResponse message when receiving a user join JSON message" in { - marshallingActor ! userJoinResponseMessage - - pubsubProbe.expectMsgPF(500 millis) { - case ujr:JsonMessage => { - ujr.message should include (juanExtUserId) - } - case _ => fail("Expected a JsonMessage message.") - } - } - - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala deleted file mode 100644 index efc50c0001..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/MessageUnmarshallingActorSpec.scala +++ /dev/null @@ -1,70 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.ActorSystem -import akka.testkit.{DefaultTimeout, ImplicitSender, TestKit, TestProbe, TestActorRef} -import scala.concurrent.duration._ -import org.scalatest.{WordSpecLike, BeforeAndAfterAll, Matchers} -import org.bigbluebutton.apps.AppsTestFixtures - -class MessageUnmarshallingActorSpec extends - TestKit(ActorSystem("MessageUnmarshallingActorSpec")) - with DefaultTimeout with ImplicitSender with WordSpecLike - with Matchers with BeforeAndAfterAll - with UsersMessageTestFixtures - with JsonMessagesFixtures with AppsTestFixtures { - - val messageHandlerProbe = TestProbe() - val unmarshallingActor = TestActorRef[MessageUnmarshallingActor]( - MessageUnmarshallingActor.props( - messageHandlerProbe.ref)) - - override def afterAll { - shutdown(system) - } - - "The MessageUnmarshallingActor" should { - "Send a UserJoinRequest message when receiving a user join JSON message" in { - unmarshallingActor ! UserJoinRequestJson - - messageHandlerProbe.expectMsgPF(500 millis) { - case ujr:UserJoinRequestFormat => { - ujr.payload.token should be ("user1-token-1") - } - case _ => fail("Should have returned UserJoinRequestMessage") - } - } - - "Send a UserLeave message when receiving a user leave JSON message" in { - unmarshallingActor ! UserLeaveEventJson - - messageHandlerProbe.expectMsgPF(500 millis) { - case ujr:UserLeaveMessage => { - ujr.payload.user.id should be ("juanid") - } - case _ => fail("Should have returned UserLeaveMessage") - } - } - - "Send a GetUsers message when receiving a get users JSON message" in { - unmarshallingActor ! GetUsersRequestJson - - messageHandlerProbe.expectMsgPF(500 millis) { - case ujr:GetUsersRequestMessage => { - ujr.payload.requester.id should be ("juanid") - } - case _ => fail("Should have returned GetUsersRequest") - } - } - - "Send an AssignPresenter message when receiving assign presenter JSON message" in { - unmarshallingActor ! AssignPresenterRequestJson - - messageHandlerProbe.expectMsgPF(500 millis) { - case ujr:AssignPresenterMessage => { - ujr.payload.presenter.id should be ("user1") - } - case _ => fail("Should have returned AssignPresenter") - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala deleted file mode 100644 index 90acd20f7a..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageJsonConversionSpec.scala +++ /dev/null @@ -1,124 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.UnitSpec -import spray.json.JsonParser -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import spray.json.lenses.JsonLenses._ -import spray.json.lenses._ -import org.bigbluebutton.endpoint.UserMessagesProtocol._ -import org.bigbluebutton.apps.AppsTestFixtures - -class UsersMessageJsonConversionSpec extends UnitSpec - with JsonMessagesFixtures with AppsTestFixtures { - - "A CreateMeetingRequestJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(CreateMeetingRequestJson) - val message = ujrm.convertTo[CreateMeetingRequestFormat] - - message.payload.meeting_descriptor.external_id should be (eng101MeetingId) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val meetingIdLens = ("payload" /"meeting_descriptor" / "external_id") - val meetingId = jsonMessage.extract[String](meetingIdLens) - meetingId should be (eng101MeetingId) - } - - "A CreateMeetingResponseJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(CreateMeetingResponseJson) - val message = ujrm.convertTo[CreateMeetingResponseFormat] - - message.payload.session should be (Some(eng101SessionId)) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val sessionIdLens = ("payload" /"session") - val sessionId = jsonMessage.extract[String](sessionIdLens) - sessionId should be (eng101SessionId) - } - - "A MeetingCreatedEvent Message" should "be un/marshalled" in { - val ujrm = JsonParser(MeetingCreatedEventJson) - val message = ujrm.convertTo[MeetingCreatedEventFormat] - - message.payload.session should be (eng101SessionId) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val sessionIdLens = ("payload" /"session") - val sessionId = jsonMessage.extract[String](sessionIdLens) - sessionId should be (eng101SessionId) - } - - "A RegisterUserRequestJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(RegisterUserRequestJson) - val message = ujrm.convertTo[RegisterUserRequestFormat] - - val user1Id = "user1" - message.payload.user_descriptor.external_id should be (user1Id) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val userIdLens = ("payload" / "user_descriptor" / "external_id") - val userId = jsonMessage.extract[String](userIdLens) - userId should be (user1Id) - } - - "A RegisterUserResponseJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(RegisterUserResponseJson) - val message = ujrm.convertTo[RegisterUserResponseFormat] - - val userToken = "guga-token" - message.payload.user_token should be (Some(userToken)) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val userTokenLens = ("payload" / "user_token") - val userId = jsonMessage.extract[String](userTokenLens) - userId should be (userToken) - } - - "A UserRegisteredEventJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(UserRegisteredEventJson) - val message = ujrm.convertTo[UserRegisteredEventFormat] - - message.payload.session should be (eng101SessionId) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val sessionLens = ("payload" / "session") - val sessionId = jsonMessage.extract[String](sessionLens) - sessionId should be (eng101SessionId) - } - - "A UserJoinResponseJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(UserJoinResponseJson) - val message = ujrm.convertTo[UserJoinResponseFormat] - - message.payload.user match { - case Some(u) => u.id should be (juanUserId) - case None => fail("Should have user field") - } - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val userIdLens = ("payload" / "user" / "id") - val userId = jsonMessage.extract[String](userIdLens) - userId should be (juanUserId) - } - - "A UserJoinedEventJson Message" should "be un/marshalled" in { - val ujrm = JsonParser(UserJoinedEventJson) - val message = ujrm.convertTo[UserJoinedEventFormat] - - val user1Id = "juanid" - message.payload.user.id should be (user1Id) - - import spray.json.DefaultJsonProtocol._ - val jsonMessage = message.toJson - val userIdLens = ("payload" / "user" / "id") - val userId = jsonMessage.extract[String](userIdLens) - userId should be (user1Id) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala deleted file mode 100644 index 7942bd928e..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/UsersMessageTestFixtures.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.AppsTestFixtures -import org.bigbluebutton.apps.protocol.Destination -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.users.messages.UserJoinResponse -import org.bigbluebutton.apps.users.messages.Result -import org.bigbluebutton.apps.protocol.ReplyDestination - -trait UsersMessageTestFixtures extends AppsTestFixtures { - val userJoinSuccessResponse = UserJoinResponse(eng101Session, Result(true, "Success"), - Some(joinedUserJuan)) - val userJoinFailResponse = UserJoinResponse(eng101Session, Result(false, "Success"), None) - - val userJoinRequestPayload = UserJoinRequestPayloadFormat(eng101MeetingIdAndName, eng101SessionId, juanUserToken) - - val destination = Destination("apps_channel", None) - val replyTo = ReplyDestination("apps_channel", "abc-corelid") - val userJoinReqHeader = Header(destination, InMsgNameConst.UserJoinRequest, - "2013-12-23T08:50Z", "web-api", - Some(replyTo)) - val userJoinRequestMessage = UserJoinRequestFormat(userJoinReqHeader, userJoinRequestPayload) - - val userJoinRespHeader = Header(Destination(replyTo.to, - Some(replyTo.correlation_id)), - InMsgNameConst.UserJoinResponse, - "2013-12-23T08:50Z", "web-api", None) - val userJoinResponseMessage = UserJoinResponseMessage(userJoinRespHeader, userJoinSuccessResponse) - - val userFormat = UserFormat(juanUserId, juanUser.externalId, juanUser.name, - juanUser.role, juanUser.pin, juanUser.welcomeMessage, - juanUser.logoutUrl, juanUser.avatarUrl) - val userJoinResponseJsonPayload = UserJoinResponseFormatPayload( - eng101MeetingIdAndName, - eng101SessionId, - ResultFormat(true, "Success"), Some(userFormat)) - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc deleted file mode 100644 index 57e6800fe0..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/JsonLens.sc +++ /dev/null @@ -1,81 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.apps.users.protocol.UserMessagesProtocol._ -import org.bigbluebutton.apps.users.protocol.UserJoinResponseJsonMessage -import spray.json.lenses.JsonLenses._ -import spray.json.lenses._ - -object JsonLens extends UsersMessageTestFixtures - with UsersMessageJsonTestFixtures { - -val userJoinResponseMessage2 = UserJoinResponseJsonMessage(userJoinRespHeader, userJoinResponseJsonPayload).toJson - //> userJoinResponseMessage2 : spray.json.JsValue = {"header":{"destination":{" - //| to":"apps_channel","correlation_id":"abc-corelid"},"name":"user_join_respons - //| e","timestamp":"2013-12-23T08:50Z","source":"web-api"},"payload":{"meeting": - //| {"id":"english_101","name":"English 101"},"session":"english_101-1234","resu - //| lt":{"success":true,"message":"Success"},"user":{"id":"juan-user1","external - //| _id":"juan-ext-user1","name":"Juan Tamad","role":"MODERATOR","pin":12345,"we - //| lcome_message":"Welcome Juan","logout_url":"http://www.umaliska.don","avatar - //| _url":"http://www.mukhamo.com/unggoy"}}} -val userJoinResponseMessageJson = JsonParser(user_join_response_Message) - //> userJoinResponseMessageJson : spray.json.JsValue = {"header":{"destination" - //| :{"to":"apps_channel","correlation_id":"abc-corelid"},"name":"user_join_resp - //| onse","timestamp":"2013-12-23T08:50Z","source":"web-api"},"payload":{"meetin - //| g":{"id":"english_101","name":"English 101"},"session":"english_101-1234","r - //| esult":{"success":true,"message":"Success"},"user":{"id":"juan-user1","exter - //| nal_id":"juan-ext-user1","name":"Juan Tamad","role":"MODERATOR","pin":12345, - //| "welcome_message":"Welcome Juan","logout_url":"http://www.umaliska.don","ava - //| tar_url":"http://www.mukhamo.com/unggoy"}}} -val foo = userJoinResponseMessageJson.convertTo[UserJoinResponseJsonMessage] - //> foo : org.bigbluebutton.apps.users.protocol.UserJoinResponseJsonMessage = U - //| serJoinResponseJsonMessage(Header(Destination(apps_channel,Some(abc-corelid) - //| ),user_join_response,2013-12-23T08:50Z,web-api,None),UserJoinResponseJsonPay - //| load(MeetingIdAndName(english_101,English 101),english_101-1234,Result(true, - //| Success),Some(UserFormat(juan-user1,juan-ext-user1,Juan Tamad,MODERATOR,1234 - //| 5,Welcome Juan,http://www.umaliska.don,http://www.mukhamo.com/unggoy)))) -val jsonFoo = foo.toJson //> jsonFoo : spray.json.JsValue = {"header":{"destination":{"to":"apps_channel - //| ","correlation_id":"abc-corelid"},"name":"user_join_response","timestamp":"2 - //| 013-12-23T08:50Z","source":"web-api"},"payload":{"meeting":{"id":"english_10 - //| 1","name":"English 101"},"session":"english_101-1234","result":{"success":tr - //| ue,"message":"Success"},"user":{"id":"juan-user1","external_id":"juan-ext-us - //| er1","name":"Juan Tamad","role":"MODERATOR","pin":12345,"welcome_message":"W - //| elcome Juan","logout_url":"http://www.umaliska.don","avatar_url":"http://www - //| .mukhamo.com/unggoy"}}} - -import spray.json.DefaultJsonProtocol._ -val userIdLens = ("payload" / "user" / "id") //> userIdLens : spray.json.lenses.Lens[spray.json.lenses.Id] = spray.json.lens - //| es.JsonLenses$$anon$1@25c22d44 -val userId = jsonFoo.extract[String](userIdLens) //> userId : String = juan-user1 - - val json = """ -{ "store": { - "book": [ - { "category": "reference", - "author": "Nigel Rees", - "title": "Sayings of the Century", - "price": 8.95 - }, - { "category": "fiction", - "author": "Evelyn Waugh", - "title": "Sword of Honour", - "price": 12.99, - "isbn": "0-553-21311-3" - } - ], - "bicycle": { - "color": "red", - "price": 19.95 - } - } -}""".asJson //> json : spray.json.JsValue = {"store":{"book":[{"category":"reference","aut - //| hor":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category - //| ":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99 - //| ,"isbn":"0-553-21311-3"}],"bicycle":{"color":"red","price":19.95}}} - - -val allAuthors = 'store / 'book / * / 'author //> allAuthors : spray.json.lenses.Lens[Seq] = spray.json.lenses.JsonLenses$$a - //| non$1@2f290d08 -val authorNames = json.extract[String](allAuthors)//> authorNames : Seq[String] = List(Nigel Rees, Evelyn Waugh) -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc b/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc deleted file mode 100644 index 3212068106..0000000000 --- a/labs/akka-bbb-apps/src/test/scala/org/bigbluebutton/endpoint/redis/MessageTestWorksheet.sc +++ /dev/null @@ -1,15 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import spray.json._ -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.apps.users.protocol.UserMessagesProtocol._ -import org.bigbluebutton.apps.users.protocol.UserJoinResponseJsonMessage -import spray.json.lenses.JsonLenses._ -import spray.json.lenses._ - -object MessageTestWorksheet extends UsersMessageTestFixtures - with UsersMessageJsonTestFixtures { - - - -} \ No newline at end of file From a0c4ee2128f818f3198860c9e61b11509babf5b8 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 20:10:01 +0000 Subject: [PATCH 17/30] - restructure packages --- .../messages/SendPrivateChatMessage.java | 2 +- .../messages/SendPublicChatMessage.java | 2 +- .../bigbluebutton/common/messages/Util.java | 2 +- .../service/chat/ChatKeyUtil.java | 2 +- .../service/chat/ChatMessageListener.java | 2 +- .../service/lock/LockMessageListener.java | 2 +- .../participants/ParticipantsListener.java | 2 +- .../ConversionUpdatesProcessor.java | 2 +- .../PresentationMessageListener.java | 2 +- .../presentation/PreuploadedPresentation.java | 2 +- .../PreuploadedPresentationsUtil.java | 2 +- .../GenericObjectPoolConfigWrapper.java | 2 +- .../service/recorder/RecordEvent.java | 2 +- .../service/recorder/Recorder.java | 2 +- .../service/recorder/RecorderApplication.java | 2 +- .../service/recorder/RedisDispatcher.java | 2 +- .../chat/AbstractChatRecordEvent.java | 4 ++-- .../recorder/chat/PublicChatRecordEvent.java | 2 +- .../AbstractParticipantRecordEvent.java | 4 ++-- .../AssignPresenterRecordEvent.java | 2 +- .../ParticipantEndAndKickAllRecordEvent.java | 2 +- .../ParticipantJoinRecordEvent.java | 2 +- .../ParticipantLeftRecordEvent.java | 2 +- .../ParticipantStatusChangeRecordEvent.java | 2 +- .../participants/RecordStatusRecordEvent.java | 2 +- .../AbstractPresentationRecordEvent.java | 4 ++-- ...rsionCompletedPresentationRecordEvent.java | 2 +- .../presentation/CursorUpdateRecordEvent.java | 2 +- .../GenerateSlidePresentationRecordEvent.java | 2 +- .../GotoSlidePresentationRecordEvent.java | 2 +- ...vePresentationPresentationRecordEvent.java | 2 +- ...zeAndMoveSlidePresentationRecordEvent.java | 2 +- ...rePresentationPresentationRecordEvent.java | 2 +- .../service/voice/VoiceKeyUtil.java | 2 +- .../service/voice/VoiceMessageListener.java | 2 +- .../service/whiteboard/WhiteboardKeyUtil.java | 2 +- .../whiteboard/WhiteboardListener.java | 2 +- .../redis/AbstractWhiteboardRecordEvent.java | 4 ++-- .../redis/AddShapeWhiteboardRecordEvent.java | 2 +- .../redis/AddTextWhiteboardRecordEvent.java | 2 +- .../redis/ClearPageWhiteboardRecordEvent.java | 2 +- .../ModifyTextWhiteboardRecordEvent.java | 2 +- .../ToggleGridWhiteboardRecordEvent.java | 2 +- .../redis/UndoShapeWhiteboardRecordEvent.java | 2 +- .../voice/AbstractVoiceRecordEvent.java | 4 ++-- .../voice/ConferenceServerListener.java | 2 +- .../voice/ConferenceServiceProvider.java | 2 +- .../FreeswitchConferenceEventListener.java | 17 +++++++++-------- .../voice/IVoiceConferenceService.java | 2 +- .../ParticipantJoinedVoiceRecordEvent.java | 2 +- .../ParticipantLeftVoiceRecordEvent.java | 2 +- .../ParticipantLockedVoiceRecordEvent.java | 2 +- .../ParticipantMutedVoiceRecordEvent.java | 2 +- .../ParticipantTalkingVoiceRecordEvent.java | 2 +- .../voice/StartRecordingVoiceRecordEvent.java | 2 +- .../voice/VoiceEventRecorder.java | 19 ++++++++++--------- .../voice/commands/ConferenceCommand.java | 2 +- .../commands/ConferenceCommandResult.java | 2 +- .../commands/EjectParticipantCommand.java | 2 +- .../commands/GetParticipantsCommand.java | 2 +- .../commands/MuteParticipantCommand.java | 2 +- .../voice/events/ConferenceEventListener.java | 2 +- .../voice/events/UnknownConferenceEvent.java | 2 +- .../voice/events/VoiceConferenceEvent.java | 2 +- .../events/VoiceStartRecordingEvent.java | 2 +- .../voice/events/VoiceUserJoinedEvent.java | 2 +- .../voice/events/VoiceUserLeftEvent.java | 2 +- .../voice/events/VoiceUserLockedEvent.java | 2 +- .../voice/events/VoiceUserMutedEvent.java | 2 +- .../voice/events/VoiceUserTalkingEvent.java | 2 +- .../voice/freeswitch/ConnectionManager.java | 17 +++++++++-------- .../voice/freeswitch/ESLEventListener.java | 15 ++++++++------- .../freeswitch/FreeswitchApplication.java | 19 ++++++++++--------- .../actions/BroadcastConferenceCommand.java | 4 ++-- .../actions/EjectAllUsersCommand.java | 2 +- .../actions/EjectParticipantCommand.java | 2 +- .../freeswitch/actions/FreeswitchCommand.java | 2 +- .../actions/MuteParticipantCommand.java | 2 +- .../actions/PopulateRoomCommand.java | 10 +++++----- .../actions/RecordConferenceCommand.java | 4 ++-- .../freeswitch/response/ConferenceMember.java | 2 +- .../response/ConferenceMemberFlags.java | 2 +- .../XMLResponseConferenceListParser.java | 2 +- .../service/recording/RedisListRecorder.java | 5 ++++- .../voice/freeswitch/HeartbeatMonitor.scala | 5 ----- .../voice/freeswitch/HeartbeatMonitor.scala | 5 +++++ 86 files changed, 144 insertions(+), 136 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/chat/ChatKeyUtil.java (89%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/chat/ChatMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/lock/LockMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/participants/ParticipantsListener.java (99%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/presentation/ConversionUpdatesProcessor.java (95%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/presentation/PresentationMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/presentation/PreuploadedPresentation.java (74%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/presentation/PreuploadedPresentationsUtil.java (93%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/GenericObjectPoolConfigWrapper.java (95%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/RecordEvent.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/Recorder.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/RecorderApplication.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/RedisDispatcher.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/chat/AbstractChatRecordEvent.java (86%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/chat/PublicChatRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/AbstractParticipantRecordEvent.java (85%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/AssignPresenterRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/ParticipantJoinRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/ParticipantLeftRecordEvent.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/ParticipantStatusChangeRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/participants/RecordStatusRecordEvent.java (94%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/AbstractPresentationRecordEvent.java (85%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/CursorUpdateRecordEvent.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/GotoSlidePresentationRecordEvent.java (93%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java (93%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/recorder/presentation/SharePresentationPresentationRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/voice/VoiceKeyUtil.java (69%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/voice/VoiceMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/WhiteboardKeyUtil.java (88%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/WhiteboardListener.java (98%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java (89%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{conference => core}/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/AbstractVoiceRecordEvent.java (87%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ConferenceServerListener.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ConferenceServiceProvider.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/FreeswitchConferenceEventListener.java (86%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/IVoiceConferenceService.java (90%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ParticipantJoinedVoiceRecordEvent.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ParticipantLeftVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ParticipantLockedVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ParticipantMutedVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ParticipantTalkingVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/StartRecordingVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/VoiceEventRecorder.java (86%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/ConferenceCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/ConferenceCommandResult.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/EjectParticipantCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/GetParticipantsCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/MuteParticipantCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/ConferenceEventListener.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/UnknownConferenceEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceConferenceEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceStartRecordingEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserJoinedEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserLeftEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserLockedEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserMutedEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserTalkingEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/ConnectionManager.java (88%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/ESLEventListener.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/FreeswitchApplication.java (89%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/BroadcastConferenceCommand.java (88%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/EjectAllUsersCommand.java (91%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/EjectParticipantCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/FreeswitchCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/MuteParticipantCommand.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/PopulateRoomCommand.java (88%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/RecordConferenceCommand.java (88%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/response/ConferenceMember.java (96%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/response/ConferenceMemberFlags.java (95%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/response/XMLResponseConferenceListParser.java (98%) delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java index aa048b3dc8..28c8502a41 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java @@ -3,7 +3,7 @@ package org.bigbluebutton.common.messages; import java.util.HashMap; import java.util.Map; -import org.bigbluebutton.conference.service.chat.ChatKeyUtil; +import org.bigbluebutton.core.service.chat.ChatKeyUtil; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java index e3af4428e8..0d06b8f82d 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java @@ -3,7 +3,7 @@ package org.bigbluebutton.common.messages; import java.util.HashMap; import java.util.Map; -import org.bigbluebutton.conference.service.chat.ChatKeyUtil; +import org.bigbluebutton.core.service.chat.ChatKeyUtil; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java index c89714d17c..464b6091a7 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/Util.java @@ -5,7 +5,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.bigbluebutton.conference.service.chat.ChatKeyUtil; +import org.bigbluebutton.core.service.chat.ChatKeyUtil; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatKeyUtil.java similarity index 89% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatKeyUtil.java index babdde091d..0b4b762cf2 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatKeyUtil.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatKeyUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.chat; +package org.bigbluebutton.core.service.chat; public class ChatKeyUtil { public static final String CHAT_TYPE = "chatType"; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatMessageListener.java index abce5e8ae7..6451d90060 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/chat/ChatMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.chat; +package org.bigbluebutton.core.service.chat; import org.bigbluebutton.common.messages.GetChatHistoryRequestMessage; import org.bigbluebutton.common.messages.MessagingConstants; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/lock/LockMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/lock/LockMessageListener.java index 68bed8ba77..5db541774a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/lock/LockMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/lock/LockMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.lock; +package org.bigbluebutton.core.service.lock; import org.bigbluebutton.common.messages.GetLockSettingsMessage; import org.bigbluebutton.common.messages.LockUserMessage; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/participants/ParticipantsListener.java similarity index 99% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/participants/ParticipantsListener.java index 3a85319705..20a2ed1fb1 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/participants/ParticipantsListener.java @@ -1,5 +1,5 @@ -package org.bigbluebutton.conference.service.participants; +package org.bigbluebutton.core.service.participants; import org.bigbluebutton.common.messages.AssignPresenterRequestMessage; import org.bigbluebutton.common.messages.BroadcastLayoutRequestMessage; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/ConversionUpdatesProcessor.java similarity index 95% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/ConversionUpdatesProcessor.java index e94293e2a9..d0c316de32 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/ConversionUpdatesProcessor.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/ConversionUpdatesProcessor.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.presentation; +package org.bigbluebutton.core.service.presentation; import org.bigbluebutton.core.api.IBigBlueButtonInGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PresentationMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PresentationMessageListener.java index 55ecb5424b..0f75638e1c 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PresentationMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PresentationMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.presentation; +package org.bigbluebutton.core.service.presentation; import java.util.HashMap; import java.util.Map; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentation.java similarity index 74% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentation.java index 0c05f23f20..b254d676a6 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentation.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentation.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.presentation; +package org.bigbluebutton.core.service.presentation; public class PreuploadedPresentation { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentationsUtil.java old mode 100644 new mode 100755 similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentationsUtil.java index 94266c37f1..862efba8c0 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/presentation/PreuploadedPresentationsUtil.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentationsUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.presentation; +package org.bigbluebutton.core.service.presentation; import java.io.File; import java.io.FileFilter; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/GenericObjectPoolConfigWrapper.java similarity index 95% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/GenericObjectPoolConfigWrapper.java index 416b341293..122c9eca64 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/GenericObjectPoolConfigWrapper.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/GenericObjectPoolConfigWrapper.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder; +package org.bigbluebutton.core.service.recorder; import org.apache.commons.pool.impl.GenericObjectPool; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecordEvent.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecordEvent.java index a8cf016b6e..4cb36c9593 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder; +package org.bigbluebutton.core.service.recorder; import java.util.HashMap; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/Recorder.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/Recorder.java index f5a24578ba..4517fc4fcd 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/Recorder.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/Recorder.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder; +package org.bigbluebutton.core.service.recorder; /** * diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecorderApplication.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecorderApplication.java index 3d8032ec34..08e526ca1c 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RecorderApplication.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RecorderApplication.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder; +package org.bigbluebutton.core.service.recorder; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RedisDispatcher.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RedisDispatcher.java index 414883b09f..f6401731f8 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/RedisDispatcher.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/RedisDispatcher.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder; +package org.bigbluebutton.core.service.recorder; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/AbstractChatRecordEvent.java similarity index 86% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/AbstractChatRecordEvent.java index f07a52713c..dab3f0fbf7 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/AbstractChatRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/AbstractChatRecordEvent.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.chat; +package org.bigbluebutton.core.service.recorder.chat; -import org.bigbluebutton.conference.service.recorder.RecordEvent; +import org.bigbluebutton.core.service.recorder.RecordEvent; public abstract class AbstractChatRecordEvent extends RecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/PublicChatRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/PublicChatRecordEvent.java index d3db884a58..314adb2834 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/chat/PublicChatRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/chat/PublicChatRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.chat; +package org.bigbluebutton.core.service.recorder.chat; public class PublicChatRecordEvent extends AbstractChatRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AbstractParticipantRecordEvent.java similarity index 85% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AbstractParticipantRecordEvent.java index 48c735b0a4..88530df7fe 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AbstractParticipantRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AbstractParticipantRecordEvent.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; -import org.bigbluebutton.conference.service.recorder.RecordEvent; +import org.bigbluebutton.core.service.recorder.RecordEvent; public abstract class AbstractParticipantRecordEvent extends RecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AssignPresenterRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AssignPresenterRecordEvent.java index f23c441914..919ce0626b 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/AssignPresenterRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/AssignPresenterRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java index 46de9dd422..eb68c1c320 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantEndAndKickAllRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; public class ParticipantEndAndKickAllRecordEvent extends AbstractParticipantRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantJoinRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantJoinRecordEvent.java index fe22c8c7d2..38aec79a81 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantJoinRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantJoinRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; public class ParticipantJoinRecordEvent extends AbstractParticipantRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantLeftRecordEvent.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantLeftRecordEvent.java index 90812dd22d..7852393453 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantLeftRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantLeftRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; public class ParticipantLeftRecordEvent extends AbstractParticipantRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantStatusChangeRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantStatusChangeRecordEvent.java index e8c6e9048b..bcb3d18438 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/ParticipantStatusChangeRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/ParticipantStatusChangeRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; public class ParticipantStatusChangeRecordEvent extends AbstractParticipantRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/RecordStatusRecordEvent.java old mode 100644 new mode 100755 similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/RecordStatusRecordEvent.java index a00e60fafc..9101549b53 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/participants/RecordStatusRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/participants/RecordStatusRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.participants; +package org.bigbluebutton.core.service.recorder.participants; public class RecordStatusRecordEvent extends AbstractParticipantRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/AbstractPresentationRecordEvent.java similarity index 85% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/AbstractPresentationRecordEvent.java index fc26c2243e..0fee7f570e 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/AbstractPresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/AbstractPresentationRecordEvent.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; -import org.bigbluebutton.conference.service.recorder.RecordEvent; +import org.bigbluebutton.core.service.recorder.RecordEvent; public abstract class AbstractPresentationRecordEvent extends RecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java index a134d7e4c1..8f091d82f8 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ConversionCompletedPresentationRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class ConversionCompletedPresentationRecordEvent extends AbstractPresentationRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/CursorUpdateRecordEvent.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/CursorUpdateRecordEvent.java index 9964bbf617..64828a5962 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/CursorUpdateRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/CursorUpdateRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class CursorUpdateRecordEvent extends AbstractPresentationRecordEvent{ diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java index 171fdb9a09..9e85e50c88 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GenerateSlidePresentationRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class GenerateSlidePresentationRecordEvent extends AbstractPresentationRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GotoSlidePresentationRecordEvent.java old mode 100644 new mode 100755 similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GotoSlidePresentationRecordEvent.java index a58f2d3b1a..e87439248b --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/GotoSlidePresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/GotoSlidePresentationRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class GotoSlidePresentationRecordEvent extends AbstractPresentationRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java index 01d371cc7d..306c01e276 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/RemovePresentationPresentationRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class RemovePresentationPresentationRecordEvent extends AbstractPresentationRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java old mode 100644 new mode 100755 similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java index bf55a97ce2..c88dddec8e --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/ResizeAndMoveSlidePresentationRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class ResizeAndMoveSlidePresentationRecordEvent extends AbstractPresentationRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/SharePresentationPresentationRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/SharePresentationPresentationRecordEvent.java index 0efd6273fc..61e8d3e943 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/recorder/presentation/SharePresentationPresentationRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/presentation/SharePresentationPresentationRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.recorder.presentation; +package org.bigbluebutton.core.service.recorder.presentation; public class SharePresentationPresentationRecordEvent extends AbstractPresentationRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceKeyUtil.java old mode 100644 new mode 100755 similarity index 69% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceKeyUtil.java index 9bc1fd75bc..89316be6bc --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceKeyUtil.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceKeyUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.voice; +package org.bigbluebutton.core.service.voice; public class VoiceKeyUtil { public static final String MUTE = "mute"; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceMessageListener.java index 293ebf0677..79a9b71617 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/voice/VoiceMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.voice; +package org.bigbluebutton.core.service.voice; import org.bigbluebutton.common.messages.MessagingConstants; import org.bigbluebutton.core.api.IBigBlueButtonInGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardKeyUtil.java similarity index 88% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardKeyUtil.java index 7d635ba285..59189937d1 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardKeyUtil.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardKeyUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.conference.service.whiteboard; +package org.bigbluebutton.core.service.whiteboard; public class WhiteboardKeyUtil { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardListener.java similarity index 98% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardListener.java index 56733e28d2..fa9218b38c 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardListener.java @@ -1,5 +1,5 @@ -package org.bigbluebutton.conference.service.whiteboard; +package org.bigbluebutton.core.service.whiteboard; import org.bigbluebutton.common.messages.ClearWhiteboardRequestMessage; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java old mode 100644 new mode 100755 similarity index 89% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java index aed2b1c94b..1f69f0df58 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AbstractWhiteboardRecordEvent.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; -import org.bigbluebutton.conference.service.recorder.RecordEvent; +import org.bigbluebutton.core.service.recorder.RecordEvent; public abstract class AbstractWhiteboardRecordEvent extends RecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java index fa667798c6..f0684d73c1 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddShapeWhiteboardRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; import java.util.ArrayList; import java.util.Map; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java index fc3c0b4fcf..a20b3e0be9 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/AddTextWhiteboardRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; import java.util.ArrayList; import java.util.Map; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java index 583d374470..0136c3721d 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ClearPageWhiteboardRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; public class ClearPageWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java index ca6f398f3b..b681bf14aa 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ModifyTextWhiteboardRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; import java.util.ArrayList; import java.util.Map; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java index 1b68d43f7a..2fd83aed62 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/ToggleGridWhiteboardRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; public class ToggleGridWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java index 0d9cbd4ef6..0cc4cda4c7 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/redis/UndoShapeWhiteboardRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.conference.service.whiteboard.redis; +package org.bigbluebutton.core.service.whiteboard.redis; public class UndoShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/AbstractVoiceRecordEvent.java similarity index 87% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/AbstractVoiceRecordEvent.java index 9f03321ce0..8637314896 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/AbstractVoiceRecordEvent.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; -import org.bigbluebutton.conference.service.recorder.RecordEvent; +import org.bigbluebutton.core.service.recorder.RecordEvent; public abstract class AbstractVoiceRecordEvent extends RecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java index 1e4616ef56..ed86e5bf5a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public interface ConferenceServerListener { public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java index ffebb366ee..f6bcf46aac 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public interface ConferenceServiceProvider { public void populateRoom(String room); diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java old mode 100644 new mode 100755 similarity index 86% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java index f24a4de2e5..fb30de3eea --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java @@ -16,20 +16,21 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; public class FreeswitchConferenceEventListener implements ConferenceEventListener { private static final int SENDERTHREADS = 1; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java similarity index 90% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java index f26f38b458..d9391a0df1 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public interface IVoiceConferenceService { void voiceUserJoined(String userId, String webUserId, String conference, diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantJoinedVoiceRecordEvent.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantJoinedVoiceRecordEvent.java index 7417a522af..d054aeca0b 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantJoinedVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLeftVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLeftVoiceRecordEvent.java index 0b3bfaa25c..945505bb56 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLeftVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLockedVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLockedVoiceRecordEvent.java index ff7be6cbd5..b4a51a5dae 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLockedVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantMutedVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantMutedVoiceRecordEvent.java index eb23d6bc70..f868bcaa63 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantMutedVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantTalkingVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantTalkingVoiceRecordEvent.java index e0b2814349..b748ab3dca 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantTalkingVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/StartRecordingVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/StartRecordingVoiceRecordEvent.java index 7c46b0f0bf..d06a37b387 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/StartRecordingVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/VoiceEventRecorder.java similarity index 86% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/VoiceEventRecorder.java index 3ce7b114ed..f7c26ab0b7 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/VoiceEventRecorder.java @@ -16,17 +16,18 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.conference.service.recorder.RecorderApplication; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +import org.bigbluebutton.core.service.recorder.RecorderApplication; +import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserLockedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; public class VoiceEventRecorder { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java index d0402213cc..e4b93d716e 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public abstract class ConferenceCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java index e9b6c0f3be..ab7e12c09f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class ConferenceCommandResult { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java index 140b26a75f..c0b6784d8f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class EjectParticipantCommand extends ConferenceCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java index ff774f702d..2d4ddd704f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class GetParticipantsCommand extends ConferenceCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java index 789a355cde..bfa54b092f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class MuteParticipantCommand extends ConferenceCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java index 15800e757d..f277d8c4eb 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public interface ConferenceEventListener { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java index 735180a415..af959fad11 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class UnknownConferenceEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java index d1ee12a966..cf8bd96cfb 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public abstract class VoiceConferenceEvent { private final String room; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java index 0e2b8bcc90..91bbc1dbab 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceStartRecordingEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java index 1a721c5015..29dd0c8661 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserJoinedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java index f5371e5620..7591db0153 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserLeftEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java index 414be991c6..0cfc456dfe 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserLockedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java index 203e93743c..003493b0f9 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserMutedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java index 3ecd6759e4..5bd778062e 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserTalkingEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java similarity index 88% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java index 8c149344e9..59ec85ff0b 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java @@ -16,19 +16,20 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch; +package org.bigbluebutton.freeswitch.voice.freeswitch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; import org.freeswitch.esl.client.inbound.Client; import org.freeswitch.esl.client.inbound.InboundConnectionFailure; import org.freeswitch.esl.client.manager.ManagerConnection; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java index 8e800f488d..1bfd7c249a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java @@ -1,16 +1,17 @@ -package org.bigbluebutton.webconference.voice.freeswitch; +package org.bigbluebutton.freeswitch.voice.freeswitch; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; + +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; import org.freeswitch.esl.client.IEslEventListener; import org.freeswitch.esl.client.transport.event.EslEvent; import org.jboss.netty.channel.ExceptionEvent; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java similarity index 89% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java index 267343d4c8..3a31fe7ba3 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch; +package org.bigbluebutton.freeswitch.voice.freeswitch; import java.io.File; import java.util.concurrent.BlockingQueue; @@ -24,14 +24,15 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +import org.bigbluebutton.freeswitch.voice.ConferenceServiceProvider; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.FreeswitchCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; public class FreeswitchApplication implements ConferenceServiceProvider { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java similarity index 88% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java index c0aa4d35b3..45ef88764f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; import org.freeswitch.esl.client.transport.message.EslMessage; public class BroadcastConferenceCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java similarity index 91% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java index e4826d72ea..4c24b28758 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public class EjectAllUsersCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java index 0924b164eb..e46deef3e4 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public class EjectParticipantCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java index db9800fa93..4efd29f95e 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public abstract class FreeswitchCommand { public static final String SPACE = " "; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java index a54ab6dacc..fdd7b343eb 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public class MuteParticipantCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java similarity index 88% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java index 7d6c462f58..03f7a32296 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java @@ -16,14 +16,14 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; import org.freeswitch.esl.client.transport.message.EslMessage; import org.apache.commons.lang3.StringUtils; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; -import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.freeswitch.response.ConferenceMember; +import org.bigbluebutton.freeswitch.voice.freeswitch.response.XMLResponseConferenceListParser; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/RecordConferenceCommand.java similarity index 88% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/RecordConferenceCommand.java index b7fc0d633d..ab2bd64c1c 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/RecordConferenceCommand.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/RecordConferenceCommand.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; import org.freeswitch.esl.client.transport.message.EslMessage; public class RecordConferenceCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java similarity index 96% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java index 4e6caf9050..915a265217 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.webconference.voice.freeswitch.response; +package org.bigbluebutton.freeswitch.voice.freeswitch.response; /** * diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java similarity index 95% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java index be507e2c0d..f571f5da4f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.webconference.voice.freeswitch.response; +package org.bigbluebutton.freeswitch.voice.freeswitch.response; /** * diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java similarity index 98% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java index e99dcafa89..397e7ce42a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.response; +package org.bigbluebutton.freeswitch.voice.freeswitch.response; import java.util.ArrayList; import java.util.Iterator; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java index 80ca642a18..7c700ce5de 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/service/recording/RedisListRecorder.java @@ -4,8 +4,11 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; -import org.bigbluebutton.conference.service.recorder.RecordEvent; + +import org.bigbluebutton.core.service.recorder.RecordEvent; + import com.google.gson.Gson; + import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala deleted file mode 100755 index a4e615328d..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/conference/voice/freeswitch/HeartbeatMonitor.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.conference.voice.freeswitch - -class HeartbeatMonitor() { - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala new file mode 100755 index 0000000000..7beaddb032 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.voice.freeswitch + +class HeartbeatMonitor() { + +} \ No newline at end of file From acebdaf695acecde8b11982f2c49407dc0972f70 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 20:30:17 +0000 Subject: [PATCH 18/30] - setup fs esl --- .../redis/MeetingMessageHandler.java | 112 -------- .../service/messaging/Constants.java | 96 ------- .../messaging/CreateMeetingMessage.java | 37 --- .../messaging/DestroyMeetingMessage.java | 12 - .../service/messaging/EndMeetingMessage.java | 12 - .../messaging/GetAllMeetingsRequest.java | 12 - .../service/messaging/IMessage.java | 5 - .../service/messaging/KeepAliveMessage.java | 12 - .../service/messaging/MessageBuilder.java | 36 --- .../messaging/MessageFromJsonConverter.java | 89 ------- .../service/messaging/MessagingConstants.java | 59 ----- .../service/messaging/MessagingService.java | 27 -- .../messaging/RegisterUserMessage.java | 73 ------ .../messaging/UserConnectedToGlobalAudio.java | 59 ----- .../UserDisconnectedFromGlobalAudio.java | 56 ---- .../messaging/ValidateAuthTokenMessage.java | 20 -- .../messaging/redis/MessageDistributor.java | 25 -- .../messaging/redis/MessageHandler.java | 23 -- .../messaging/redis/MessageReceiver.java | 85 ------ .../messaging/redis/MessageSender.java | 70 ----- .../messaging/redis/MessageToSend.java | 19 -- .../messaging/redis/ReceivedMessage.java | 28 -- .../redis/ReceivedMessageHandler.java | 68 ----- .../core/api/IBigBlueButtonInGW.java | 119 --------- .../bigbluebutton/core/api/IDispatcher.java | 6 - .../bigbluebutton/core/api/IOutMessage.java | 5 - .../core/api/MessageOutGateway.java | 21 -- .../core/api/OutMessageListener2.java | 6 - .../voice/ConferenceServerListener.java | 2 +- .../voice/ConferenceServiceProvider.java | 2 +- .../FreeswitchConferenceEventListener.java | 17 +- .../voice/IVoiceConferenceService.java | 2 +- .../voice/commands/ConferenceCommand.java | 2 +- .../commands/ConferenceCommandResult.java | 2 +- .../commands/EjectParticipantCommand.java | 2 +- .../commands/GetParticipantsCommand.java | 2 +- .../commands/MuteParticipantCommand.java | 2 +- .../voice/events/ConferenceEventListener.java | 2 +- .../voice/events/UnknownConferenceEvent.java | 2 +- .../voice/events/VoiceConferenceEvent.java | 2 +- .../events/VoiceStartRecordingEvent.java | 2 +- .../voice/events/VoiceUserJoinedEvent.java | 2 +- .../voice/events/VoiceUserLeftEvent.java | 2 +- .../voice/events/VoiceUserLockedEvent.java | 2 +- .../voice/events/VoiceUserMutedEvent.java | 2 +- .../voice/events/VoiceUserTalkingEvent.java | 2 +- .../voice/freeswitch/ConnectionManager.java | 26 +- .../voice/freeswitch/ESLEventListener.java | 38 ++- .../freeswitch/FreeswitchApplication.java | 29 +- .../actions/BroadcastConferenceCommand.java | 4 +- .../actions/EjectAllUsersCommand.java | 2 +- .../actions/EjectParticipantCommand.java | 2 +- .../freeswitch/actions/FreeswitchCommand.java | 2 +- .../actions/MuteParticipantCommand.java | 2 +- .../actions/PopulateRoomCommand.java | 25 +- .../actions/RecordConferenceCommand.java | 6 +- .../freeswitch/response/ConferenceMember.java | 2 +- .../response/ConferenceMemberFlags.java | 2 +- .../XMLResponseConferenceListParser.java | 12 +- .../voice/AbstractVoiceRecordEvent.java | 32 --- .../ParticipantJoinedVoiceRecordEvent.java | 51 ---- .../ParticipantLeftVoiceRecordEvent.java | 31 --- .../ParticipantLockedVoiceRecordEvent.java | 35 --- .../ParticipantMutedVoiceRecordEvent.java | 35 --- .../ParticipantTalkingVoiceRecordEvent.java | 36 --- .../voice/StartRecordingVoiceRecordEvent.java | 38 --- .../voice/VoiceEventRecorder.java | 141 ---------- .../voice/freeswitch/HeartbeatMonitor.scala | 5 + .../freeswitch/FreeswitchConference.scala | 54 ++++ .../FreeswitchConferenceActor.scala | 248 ++++++++++++++++++ .../FreeswitchConferenceService.scala | 123 +++++++++ .../freeswitch/FreeswitchManagerProxy.scala | 32 +++ .../freeswitch/FsInGwWrapper.scala | 12 + 73 files changed, 574 insertions(+), 1694 deletions(-) delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java delete mode 100644 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ConferenceServerListener.java (94%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/ConferenceServiceProvider.java (94%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/FreeswitchConferenceEventListener.java (86%) mode change 100644 => 100755 rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/IVoiceConferenceService.java (90%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/ConferenceCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/ConferenceCommandResult.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/EjectParticipantCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/GetParticipantsCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/commands/MuteParticipantCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/ConferenceEventListener.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/UnknownConferenceEvent.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceConferenceEvent.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceStartRecordingEvent.java (93%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserJoinedEvent.java (93%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserLeftEvent.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserLockedEvent.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserMutedEvent.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/events/VoiceUserTalkingEvent.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/ConnectionManager.java (82%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/ESLEventListener.java (79%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/FreeswitchApplication.java (84%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/BroadcastConferenceCommand.java (88%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/EjectAllUsersCommand.java (91%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/EjectParticipantCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/FreeswitchCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/MuteParticipantCommand.java (92%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/PopulateRoomCommand.java (80%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/actions/RecordConferenceCommand.java (87%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/response/ConferenceMember.java (96%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/response/ConferenceMemberFlags.java (95%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/{webconference => freeswitch}/voice/freeswitch/response/XMLResponseConferenceListParser.java (90%) delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java deleted file mode 100755 index a98e4f430c..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.bigbluebutton.conference.meeting.messaging.redis; - -import java.util.HashMap; -import java.util.Map; -import org.bigbluebutton.conference.service.messaging.CreateMeetingMessage; -import org.bigbluebutton.conference.service.messaging.DestroyMeetingMessage; -import org.bigbluebutton.conference.service.messaging.EndMeetingMessage; -import org.bigbluebutton.conference.service.messaging.IMessage; -import org.bigbluebutton.conference.service.messaging.KeepAliveMessage; -import org.bigbluebutton.conference.service.messaging.MessageFromJsonConverter; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import org.bigbluebutton.conference.service.messaging.RegisterUserMessage; -import org.bigbluebutton.conference.service.messaging.UserConnectedToGlobalAudio; -import org.bigbluebutton.conference.service.messaging.UserDisconnectedFromGlobalAudio; -import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage; -import org.bigbluebutton.conference.service.messaging.GetAllMeetingsRequest; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; -import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import com.google.gson.Gson; - -public class MeetingMessageHandler implements MessageHandler { - - private IBigBlueButtonInGW bbbGW; - - @Override - public void handleMessage(String pattern, String channel, String message) { -// System.out.println("Checking message: " + pattern + " " + channel + " " + message); - if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { -// System.out.println("Meeting message: " + channel + " " + message); - IMessage msg = MessageFromJsonConverter.convert(message); - - if (msg != null) { - if (msg instanceof EndMeetingMessage) { - EndMeetingMessage emm = (EndMeetingMessage) msg; -// log.info("Received end meeting request. Meeting id [{}]", emm.meetingId); - bbbGW.endMeeting(emm.meetingId); - } else if (msg instanceof CreateMeetingMessage) { - CreateMeetingMessage emm = (CreateMeetingMessage) msg; -// log.info("Received create meeting request. Meeting id [{}]", emm.id); - bbbGW.createMeeting2(emm.id, emm.externalId, emm.name, emm.record, emm.voiceBridge, - emm.duration, emm.autoStartRecording, emm.allowStartStopRecording, - emm.moderatorPass, emm.viewerPass, emm.createTime, emm.createDate); - } else if (msg instanceof RegisterUserMessage) { - RegisterUserMessage emm = (RegisterUserMessage) msg; -// log.info("Received register user request. Meeting id [{}], userid=[{}], token=[{}]", emm.meetingID, emm.internalUserId, emm.authToken); - bbbGW.registerUser(emm.meetingID, emm.internalUserId, emm.fullname, emm.role, emm.externUserID, emm.authToken); - } else if (msg instanceof DestroyMeetingMessage) { - DestroyMeetingMessage emm = (DestroyMeetingMessage) msg; -// log.info("Received destroy meeting request. Meeting id [{}]", emm.meetingId); - bbbGW.destroyMeeting(emm.meetingId); - } else if (msg instanceof ValidateAuthTokenMessage) { - ValidateAuthTokenMessage emm = (ValidateAuthTokenMessage) msg; -// log.info("Received ValidateAuthTokenMessage token request. Meeting id [{}]", emm.meetingId); -// log.warn("TODO: Need to pass sessionId on ValidateAuthTokenMessage message."); - String sessionId = "tobeimplemented"; - bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo, sessionId); - } else if (msg instanceof UserConnectedToGlobalAudio) { - UserConnectedToGlobalAudio emm = (UserConnectedToGlobalAudio) msg; - - Map logData = new HashMap(); - logData.put("voiceConf", emm.voiceConf); - logData.put("userId", emm.userid); - logData.put("username", emm.name); - logData.put("event", "user_connected_to_global_audio"); - logData.put("description", "User connected to global audio."); - - Gson gson = new Gson(); - String logStr = gson.toJson(logData); - -// log.info("User connected to global audio: data={}", logStr); - - bbbGW.userConnectedToGlobalAudio(emm.voiceConf, emm.userid, emm.name); - } else if (msg instanceof UserDisconnectedFromGlobalAudio) { - UserDisconnectedFromGlobalAudio emm = (UserDisconnectedFromGlobalAudio) msg; - - Map logData = new HashMap(); - logData.put("voiceConf", emm.voiceConf); - logData.put("userId", emm.userid); - logData.put("username", emm.name); - logData.put("event", "user_disconnected_from_global_audio"); - logData.put("description", "User disconnected from global audio."); - - Gson gson = new Gson(); - String logStr = gson.toJson(logData); - -// log.info("User disconnected from global audio: data={}", logStr); - bbbGW.userDisconnectedFromGlobalAudio(emm.voiceConf, emm.userid, emm.name); - } - else if (msg instanceof GetAllMeetingsRequest) { - GetAllMeetingsRequest emm = (GetAllMeetingsRequest) msg; -// log.info("Received GetAllMeetingsRequest"); - bbbGW.getAllMeetings("no_need_of_a_meeting_id"); - } - } - } else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) { - IMessage msg = MessageFromJsonConverter.convert(message); - - if (msg != null) { - if (msg instanceof KeepAliveMessage) { - KeepAliveMessage emm = (KeepAliveMessage) msg; -// log.debug("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId); - bbbGW.isAliveAudit(emm.keepAliveId); - } - } - } - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { - this.bbbGW = bbbGW; - } - -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java deleted file mode 100644 index 8b324b248c..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/Constants.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class Constants { - public static final String NAME = "name"; - public static final String HEADER = "header"; - public static final String PAYLOAD = "payload"; - public static final String MEETING_ID = "meeting_id"; - public static final String EXTERNAL_MEETING_ID = "external_meeting_id"; - public static final String TIMESTAMP = "timestamp"; - public static final String USER_ID = "userid"; - public static final String RECORDED = "recorded"; - public static final String MEETING_NAME = "meeting_name"; - public static final String VOICE_CONF = "voice_conf"; - public static final String DURATION = "duration"; - public static final String AUTH_TOKEN = "auth_token"; - public static final String ROLE = "role"; - public static final String EXT_USER_ID = "external_user_id"; - public static final String REQUESTER_ID = "requester_id"; - public static final String REPLY_TO = "reply_to"; - public static final String LOWERED_BY = "lowered_by"; - public static final String STREAM = "stream"; - public static final String LOCKED = "locked"; - public static final String SETTINGS = "settings"; - public static final String LOCK = "lock"; - public static final String EXCEPT_USERS = "except_users"; - public static final String STATUS = "status"; - public static final String VALUE = "value"; - public static final String NEW_PRESENTER_ID = "new_presenter_id"; - public static final String NEW_PRESENTER_NAME = "new_presenter_name"; - public static final String ASSIGNED_BY = "assigned_by"; - public static final String RECORDING = "recording"; - public static final String AUTO_START_RECORDING = "auto_start_recording"; - public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording"; - public static final String LAYOUT_ID = "layout_id"; - public static final String POLL = "poll"; - public static final String POLL_ID = "poll_id"; - public static final String FORCE = "force"; - public static final String RESPONSE = "response"; - public static final String PRESENTATION_ID = "presentation_id"; - public static final String X_OFFSET = "x_offset"; - public static final String Y_OFFSET = "y_offset"; - public static final String WIDTH_RATIO = "width_ratio"; - public static final String HEIGHT_RATIO = "height_ratio"; - public static final String PAGE = "page"; - public static final String SHARE = "share"; - public static final String PRESENTATIONS = "presentations"; - public static final String MESSAGE_KEY = "message_key"; - public static final String CODE = "code"; - public static final String PRESENTATION_NAME = "presentation_name"; - public static final String NUM_PAGES = "num_pages"; - public static final String MAX_NUM_PAGES = "max_num_pages"; - public static final String PAGES_COMPLETED = "pages_completed"; - public static final String MUTE = "mute"; - public static final String CALLER_ID_NUM = "caller_id_num"; - public static final String CALLER_ID_NAME = "caller_id_name"; - public static final String TALKING = "talking"; - public static final String USER = "user"; - public static final String MUTED = "muted"; - public static final String VOICE_USER = "voice_user"; - public static final String RECORDING_FILE = "recording_file"; - public static final String ANNOTATION = "annotation"; - public static final String WHITEBOARD_ID = "whiteboard_id"; - public static final String ENABLE = "enable"; - public static final String PRESENTER = "presenter"; - public static final String USERS = "users"; - public static final String RAISE_HAND = "raise_hand"; - public static final String HAS_STREAM = "has_stream"; - public static final String WEBCAM_STREAM = "webcam_stream"; - public static final String PHONE_USER = "phone_user"; - public static final String PERMISSIONS = "permissions"; - public static final String VALID = "valid"; - public static final String CHAT_HISTORY = "chat_history"; - public static final String MESSAGE = "message"; - public static final String SET_BY_USER_ID = "set_by_user_id"; - public static final String POLLS = "polls"; - public static final String REASON = "reason"; - public static final String RESPONDER = "responder"; - public static final String PRESENTATION_INFO = "presentation_info"; - public static final String SHAPES = "shapes"; - public static final String SHAPE = "shape"; - public static final String SHAPE_ID = "shape_id"; - public static final String PRESENTATION = "presentation"; - public static final String ID = "id"; - public static final String CURRENT = "current"; - public static final String PAGES = "pages"; - public static final String WEB_USER_ID = "web_user_id"; - public static final String JOINED = "joined"; - public static final String X_PERCENT = "x_percent"; - public static final String Y_PERCENT = "y_percent"; - public static final String KEEP_ALIVE_ID = "keep_alive_id"; - public static final String INTERNAL_USER_ID = "internal_user_id"; - public static final String MODERATOR_PASS = "moderator_pass"; - public static final String VIEWER_PASS = "viewer_pass"; - public static final String CREATE_TIME = "create_time"; - public static final String CREATE_DATE = "create_date"; -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java deleted file mode 100644 index 4db244c13d..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/CreateMeetingMessage.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class CreateMeetingMessage implements IMessage { - public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; - public static final String VERSION = "0.0.1"; - - public final String id; - public final String externalId; - public final String name; - public final Boolean record; - public final String voiceBridge; - public final Long duration; - public final Boolean autoStartRecording; - public final Boolean allowStartStopRecording; - public final String moderatorPass; - public final String viewerPass; - public final Long createTime; - public final String createDate; - - public CreateMeetingMessage(String id, String externalId, String name, Boolean record, String voiceBridge, - Long duration, Boolean autoStartRecording, - Boolean allowStartStopRecording, String moderatorPass, - String viewerPass, Long createTime, String createDate) { - this.id = id; - this.externalId = externalId; - this.name = name; - this.record = record; - this.voiceBridge = voiceBridge; - this.duration = duration; - this.autoStartRecording = autoStartRecording; - this.allowStartStopRecording = allowStartStopRecording; - this.moderatorPass = moderatorPass; - this.viewerPass = viewerPass; - this.createTime = createTime; - this.createDate = createDate; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java deleted file mode 100755 index 01106c1730..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/DestroyMeetingMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class DestroyMeetingMessage implements IMessage { - public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - - public DestroyMeetingMessage(String meetingId) { - this.meetingId = meetingId; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java deleted file mode 100755 index 3a02401421..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/EndMeetingMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class EndMeetingMessage implements IMessage { - public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - - public EndMeetingMessage(String meetingId) { - this.meetingId = meetingId; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java deleted file mode 100644 index baa1cd4099..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/GetAllMeetingsRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class GetAllMeetingsRequest implements IMessage { - public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - - public GetAllMeetingsRequest(String meetingId) { - this.meetingId = meetingId; - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java deleted file mode 100755 index 2414f55a30..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/IMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public interface IMessage { - -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java deleted file mode 100644 index 6cebf71a4a..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/KeepAliveMessage.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class KeepAliveMessage implements IMessage { - public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; - public static final String VERSION = "0.0.1"; - - public final String keepAliveId; - - public KeepAliveMessage(String keepAliveId) { - this.keepAliveId = keepAliveId; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java deleted file mode 100755 index 2137a063b5..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageBuilder.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.concurrent.TimeUnit; - -import com.google.gson.Gson; - -public class MessageBuilder { - public final static String VERSION = "version"; - - public static long generateTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - public static java.util.HashMap buildHeader(String name, String version, String replyTo) { - java.util.HashMap header = new java.util.HashMap(); - header.put(Constants.NAME, name); - header.put(VERSION, version); - header.put(Constants.TIMESTAMP, generateTimestamp()); - if (replyTo != null && replyTo != "") - header.put(Constants.REPLY_TO, replyTo); - - return header; - } - - - public static String buildJson(java.util.HashMap header, - java.util.HashMap payload) { - - java.util.HashMap> message = new java.util.HashMap>(); - message.put(Constants.HEADER, header); - message.put(Constants.PAYLOAD, payload); - - Gson gson = new Gson(); - return gson.toJson(message); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java deleted file mode 100755 index 4efc79d5dc..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessageFromJsonConverter.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class MessageFromJsonConverter { - - public static IMessage convert(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - switch (messageName) { - case CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT: - return processCreateMeeting(payload); - case DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT: - return processDestroyMeeting(payload); - case EndMeetingMessage.END_MEETING_REQUEST_EVENT: - return processEndMeetingMessage(payload); - case KeepAliveMessage.KEEP_ALIVE_REQUEST: - return processKeepAlive(payload); - case RegisterUserMessage.REGISTER_USER: - System.out.println("Registering a user"); - return RegisterUserMessage.fromJson(message); - case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN: - return processValidateAuthTokenMessage(header, payload); - case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO: - return UserConnectedToGlobalAudio.fromJson(message); - case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO: - return UserDisconnectedFromGlobalAudio.fromJson(message); - case GetAllMeetingsRequest.GET_ALL_MEETINGS_REQUEST_EVENT: - return new GetAllMeetingsRequest("the_string_is_not_used_anywhere"); - } - } - } - return null; - } - - private static IMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - String userid = payload.get(Constants.USER_ID).getAsString(); - String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); - String replyTo = header.get(Constants.REPLY_TO).getAsString(); - String sessionId = "tobeimplemented"; - return new ValidateAuthTokenMessage(id, userid, authToken, replyTo, - sessionId); - } - - private static IMessage processCreateMeeting(JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString(); - String name = payload.get(Constants.NAME).getAsString(); - Boolean record = payload.get(Constants.RECORDED).getAsBoolean(); - String voiceBridge = payload.get(Constants.VOICE_CONF).getAsString(); - Long duration = payload.get(Constants.DURATION).getAsLong(); - Boolean autoStartRecording = payload.get(Constants.AUTO_START_RECORDING).getAsBoolean(); - Boolean allowStartStopRecording = payload.get(Constants.ALLOW_START_STOP_RECORDING).getAsBoolean(); - String moderatorPassword = payload.get(Constants.MODERATOR_PASS).getAsString(); - String viewerPassword = payload.get(Constants.VIEWER_PASS).getAsString(); - Long createTime = payload.get(Constants.CREATE_TIME).getAsLong(); - String createDate = payload.get(Constants.CREATE_DATE).getAsString(); - - return new CreateMeetingMessage(id, externalId, name, record, voiceBridge, - duration, autoStartRecording, allowStartStopRecording, - moderatorPassword, viewerPassword, createTime, createDate); - } - - private static IMessage processDestroyMeeting(JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - return new DestroyMeetingMessage(id); - } - - private static IMessage processEndMeetingMessage(JsonObject payload) { - String id = payload.get(Constants.MEETING_ID).getAsString(); - return new EndMeetingMessage(id); - } - - private static IMessage processKeepAlive(JsonObject payload) { - String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString(); - return new KeepAliveMessage(id); - } - - //private static IMessage processGetAllMeetings(JsonObject) -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java deleted file mode 100644 index 7e6a0258b9..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java +++ /dev/null @@ -1,59 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.messaging; - -public class MessagingConstants { - - public static final String FROM_BBB_APPS_CHANNEL = "bigbluebutton:from-bbb-apps"; - public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*"; - public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system"; - public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting"; - public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation"; - public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling"; - public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users"; - public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat"; - public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard"; - - public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps"; - public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*"; - public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting"; - public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system"; - public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation"; - public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling"; - public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users"; - public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat"; - public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; - public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; - - public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent"; - public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent"; - public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent"; - public static final String MEETING_STARTED_EVENT = "meeting_created_message"; - public static final String MEETING_ENDED_EVENT = "meeting_ended_event"; - public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event"; - public static final String USER_JOINED_EVENT = "UserJoinedEvent"; - public static final String USER_LEFT_EVENT = "UserLeftEvent"; - public static final String USER_LEFT_VOICE_REQUEST = "user_left_voice_request"; - public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; - public static final String SEND_POLLS_EVENT = "SendPollsEvent"; - public static final String RECORD_STATUS_EVENT = "RecordStatusEvent"; - public static final String SEND_PUBLIC_CHAT_MESSAGE_REQUEST = "send_public_chat_message_request"; - public static final String SEND_PRIVATE_CHAT_MESSAGE_REQUEST = "send_private_chat_message_request"; - public static final String MUTE_USER_REQUEST = "mute_user_request"; -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java deleted file mode 100755 index 8721b188ca..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingService.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.messaging; - -import redis.clients.jedis.Jedis; - -public interface MessagingService { - public void send(String channel, String message); - public Jedis createRedisClient(); - public void dropRedisClient(Jedis jedis); -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java deleted file mode 100644 index 9e7dfe5259..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/RegisterUserMessage.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class RegisterUserMessage implements IMessage { - public static final String REGISTER_USER = "register_user_request"; - public final String VERSION = "0.0.1"; - - public final String meetingID; - public final String internalUserId; - public final String fullname; - public final String role; - public final String externUserID; - public final String authToken; - - public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) { - this.meetingID = meetingID; - this.internalUserId = internalUserId; - this.fullname = fullname; - this.role = role; - this.externUserID = externUserID; - this.authToken = authToken; - } - - public String toJson() { - HashMap payload = new HashMap(); - - payload.put(Constants.MEETING_ID, meetingID); - payload.put(Constants.INTERNAL_USER_ID, internalUserId); - payload.put(Constants.NAME, fullname); - payload.put(Constants.ROLE, role); - payload.put(Constants.EXT_USER_ID, externUserID); - payload.put(Constants.AUTH_TOKEN, authToken); - - java.util.HashMap header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - public static RegisterUserMessage fromJson(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (REGISTER_USER.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.NAME) - && payload.has(Constants.ROLE) - && payload.has(Constants.EXT_USER_ID) - && payload.has(Constants.AUTH_TOKEN)) { - - String meetingID = payload.get(Constants.MEETING_ID).getAsString(); - String fullname = payload.get(Constants.NAME).getAsString(); - String role = payload.get(Constants.ROLE).getAsString(); - String externUserID = payload.get(Constants.EXT_USER_ID).getAsString(); - String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); - - //use externalUserId twice - once for external, once for internal - return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken); - } - } - } - } - System.out.println("Failed to parse RegisterUserMessage"); - return null; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java deleted file mode 100644 index 3ae49d0faf..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserConnectedToGlobalAudio.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.HashMap; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class UserConnectedToGlobalAudio implements IMessage { - public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio"; - public static final String VERSION = "0.0.1"; - - public final String voiceConf; - public final String name; - public final String userid; - - - - public UserConnectedToGlobalAudio(String voiceConf, String userid, String name) { - this.voiceConf = voiceConf; - this.userid = userid; - this.name = name; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.VOICE_CONF, voiceConf); - payload.put(Constants.USER_ID, userid); - payload.put(Constants.NAME, name); - - java.util.HashMap header = MessageBuilder.buildHeader(USER_CONNECTED_TO_GLOBAL_AUDIO, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - - public static UserConnectedToGlobalAudio fromJson(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (USER_CONNECTED_TO_GLOBAL_AUDIO.equals(messageName)) { - if (payload.has(Constants.VOICE_CONF) - && payload.has(Constants.USER_ID) - && payload.has(Constants.NAME)) { - String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); - String userid = payload.get(Constants.USER_ID).getAsString(); - String name = payload.get(Constants.NAME).getAsString(); - return new UserConnectedToGlobalAudio(voiceConf, userid, name); - } - } - } - } - return null; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java deleted file mode 100755 index 314e0a798d..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/UserDisconnectedFromGlobalAudio.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class UserDisconnectedFromGlobalAudio implements IMessage { - public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio"; - public static final String VERSION = "0.0.1"; - - public final String voiceConf; - public final String name; - public final String userid; - - public UserDisconnectedFromGlobalAudio(String voiceConf, String userid, String name) { - this.voiceConf = voiceConf; - this.userid = userid; - this.name = name; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.VOICE_CONF, voiceConf); - payload.put(Constants.USER_ID, userid); - payload.put(Constants.NAME, name); - - java.util.HashMap header = MessageBuilder.buildHeader(USER_DISCONNECTED_FROM_GLOBAL_AUDIO, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - - public static UserDisconnectedFromGlobalAudio fromJson(String message) { - JsonParser parser = new JsonParser(); - JsonObject obj = (JsonObject) parser.parse(message); - - if (obj.has("header") && obj.has("payload")) { - JsonObject header = (JsonObject) obj.get("header"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (USER_DISCONNECTED_FROM_GLOBAL_AUDIO.equals(messageName)) { - if (payload.has(Constants.VOICE_CONF) - && payload.has(Constants.USER_ID) - && payload.has(Constants.NAME)) { - String voiceConf = payload.get(Constants.VOICE_CONF).getAsString(); - String userid = payload.get(Constants.USER_ID).getAsString(); - String name = payload.get(Constants.NAME).getAsString(); - return new UserDisconnectedFromGlobalAudio(voiceConf, userid, name); - } - } - } - } - return null; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java deleted file mode 100755 index 3f036d96dc..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/ValidateAuthTokenMessage.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.conference.service.messaging; - -public class ValidateAuthTokenMessage implements IMessage { - public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - public final String userId; - public final String token; - public final String replyTo; - public final String sessionId; - - public ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo, String sessionId) { - this.meetingId = meetingId; - this.userId = userId; - this.token = token; - this.replyTo = replyTo; - this.sessionId = sessionId; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java deleted file mode 100755 index d8518438ea..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageDistributor.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.Set; - -public class MessageDistributor { - private ReceivedMessageHandler handler; - private Set listeners; - - public void setMessageListeners(Set listeners) { - this.listeners = listeners; - } - - public void setMessageHandler(ReceivedMessageHandler handler) { - this.handler = handler; - if (handler != null) { - handler.setMessageDistributor(this); - } - } - - public void notifyListeners(String pattern, String channel, String message) { - for (MessageHandler listener : listeners) { - listener.handleMessage(pattern, channel, message); - } - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java deleted file mode 100755 index 64e25cb510..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.conference.service.messaging.redis; - -public interface MessageHandler { - void handleMessage(String pattern, String channel, String message); -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java deleted file mode 100755 index b051b9e86b..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageReceiver.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import org.bigbluebutton.conference.service.messaging.MessagingConstants; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPubSub; - -public class MessageReceiver { - private ReceivedMessageHandler handler; - - private JedisPool redisPool; - private volatile boolean receiveMessage = false; - - private final Executor msgReceiverExec = Executors.newSingleThreadExecutor(); - - public void stop() { - receiveMessage = false; - } - - public void start() { -// log.info("Ready to receive messages from Redis pubsub."); - try { - receiveMessage = true; - final Jedis jedis = redisPool.getResource(); - - Runnable messageReceiver = new Runnable() { - public void run() { - if (receiveMessage) { - jedis.psubscribe(new PubSubListener(), MessagingConstants.TO_BBB_APPS_PATTERN); - } - } - }; - msgReceiverExec.execute(messageReceiver); - } catch (Exception e) { -// log.error("Error subscribing to channels: " + e.getMessage()); - } - } - - public void setRedisPool(JedisPool redisPool){ - this.redisPool = redisPool; - } - - public void setMessageHandler(ReceivedMessageHandler handler) { - this.handler = handler; - } - - private class PubSubListener extends JedisPubSub { - - public PubSubListener() { - super(); - } - - @Override - public void onMessage(String channel, String message) { - // Not used. - } - - @Override - public void onPMessage(String pattern, String channel, String message) { - handler.handleMessage(pattern, channel, message); - } - - @Override - public void onPSubscribe(String pattern, int subscribedChannels) { -// log.debug("Subscribed to the pattern: " + pattern); - } - - @Override - public void onPUnsubscribe(String pattern, int subscribedChannels) { - // Not used. - } - - @Override - public void onSubscribe(String channel, int subscribedChannels) { - // Not used. - } - - @Override - public void onUnsubscribe(String channel, int subscribedChannels) { - // Not used. - } - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java deleted file mode 100755 index 477c1165fa..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageSender.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -public class MessageSender { - private JedisPool redisPool; - private volatile boolean sendMessage = false; - - private final Executor msgSenderExec = Executors.newSingleThreadExecutor(); - private final Executor runExec = Executors.newSingleThreadExecutor(); - private BlockingQueue messages = new LinkedBlockingQueue(); - - public void stop() { - sendMessage = false; - } - - public void start() { -// log.info("Redis message publisher starting!"); - try { - sendMessage = true; - - Runnable messageSender = new Runnable() { - public void run() { - while (sendMessage) { - try { - MessageToSend msg = messages.take(); - publish(msg.getChannel(), msg.getMessage()); - } catch (InterruptedException e) { -// log.warn("Failed to get message from queue."); - } - } - } - }; - msgSenderExec.execute(messageSender); - } catch (Exception e) { -// log.error("Error subscribing to channels: " + e.getMessage()); - } - } - - public void send(String channel, String message) { - MessageToSend msg = new MessageToSend(channel, message); - messages.add(msg); - } - - private void publish(final String channel, final String message) { - Runnable task = new Runnable() { - public void run() { - Jedis jedis = redisPool.getResource(); - try { - jedis.publish(channel, message); - } catch(Exception e){ -// log.warn("Cannot publish the message to redis", e); - } finally { - redisPool.returnResource(jedis); - } - } - }; - - runExec.execute(task); - } - - public void setRedisPool(JedisPool redisPool){ - this.redisPool = redisPool; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java deleted file mode 100755 index e01dfc84e1..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/MessageToSend.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -public class MessageToSend { - private final String channel; - private final String message; - - public MessageToSend(String channel, String message) { - this.channel = channel; - this.message = message; - } - - public String getChannel() { - return channel; - } - - public String getMessage() { - return message; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java deleted file mode 100755 index 9319407276..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessage.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -public class ReceivedMessage { - - private final String pattern; - private final String channel; - private final String message; - - public ReceivedMessage(String pattern, String channel, String message) { - this.pattern = pattern; - this.channel = channel; - this.message = message; - } - - public String getPattern() { - return pattern; - } - - public String getChannel() { - return channel; - } - - public String getMessage() { - return message; - } - - -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java deleted file mode 100755 index 6350be0fc9..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/conference/service/messaging/redis/ReceivedMessageHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.bigbluebutton.conference.service.messaging.redis; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; - -public class ReceivedMessageHandler { - - private BlockingQueue receivedMessages = new LinkedBlockingQueue(); - - private volatile boolean processMessage = false; - - private final Executor msgProcessorExec = Executors.newSingleThreadExecutor(); - private final Executor runExec = Executors.newSingleThreadExecutor(); - - private MessageDistributor handler; - - public void stop() { - processMessage = false; - } - - public void start() { -// log.info("Ready to handle messages from Redis pubsub!"); - - try { - processMessage = true; - - Runnable messageProcessor = new Runnable() { - public void run() { - while (processMessage) { - try { - ReceivedMessage msg = receivedMessages.take(); - processMessage(msg); - } catch (InterruptedException e) { -// log.warn("Error while taking received message from queue."); - } - } - } - }; - msgProcessorExec.execute(messageProcessor); - } catch (Exception e) { -// log.error("Error subscribing to channels: " + e.getMessage()); - } - } - - private void processMessage(final ReceivedMessage msg) { - Runnable task = new Runnable() { - public void run() { - if (handler != null) { - handler.notifyListeners(msg.getPattern(), msg.getChannel(), msg.getMessage()); - } else { -// log.info("No listeners interested in messages from Redis!"); - } - } - }; - runExec.execute(task); - } - - public void handleMessage(String pattern, String channel, String message) { - ReceivedMessage rm = new ReceivedMessage(pattern, channel, message); - receivedMessages.add(rm); - } - - public void setMessageDistributor(MessageDistributor h) { - this.handler = h; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java deleted file mode 100755 index 8dd2dbb26c..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.bigbluebutton.core.api; - -import java.util.Map; - - -public interface IBigBlueButtonInGW { - - void isAliveAudit(String aliveID); - void statusMeetingAudit(String meetingID); - void endMeeting(String meetingID); - void endAllMeetings(); - void createMeeting2(String meetingID, String externalMeetingID, String meetingName, boolean recorded, - String voiceBridge, long duration, boolean autoStartRecording, - boolean allowStartStopRecording, String moderatorPass, String viewerPass, - long createTime, String createDate); - void destroyMeeting(String meetingID); - void getAllMeetings(String meetingID); - void lockSettings(String meetingID, Boolean locked, Map lockSettigs); - - - // Lock - void initLockSettings(String meetingID, Map settings); - void sendLockSettings(String meetingID, String userId, Map settings); - void getLockSettings(String meetingId, String userId); - void lockUser(String meetingId, String requesterID, boolean lock, String internalUserID); - - - // Users - void validateAuthToken(String meetingId, String userId, String token, String correlationId, String sessionId); - void registerUser(String roomName, String userid, String username, String role, String externUserID, String authToken); - void userRaiseHand(String meetingId, String userId); - void lowerHand(String meetingId, String userId, String loweredBy); - void shareWebcam(String meetingId, String userId, String stream); - void unshareWebcam(String meetingId, String userId, String stream); - void setUserStatus(String meetingID, String userID, String status, Object value); - void getUsers(String meetingID, String requesterID); - void userLeft(String meetingID, String userID, String sessionId); - void userJoin(String meetingID, String userID, String authToken); - void getCurrentPresenter(String meetingID, String requesterID); - void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy); - void setRecordingStatus(String meetingId, String userId, Boolean recording); - void getRecordingStatus(String meetingId, String userId); - void userConnectedToGlobalAudio(String voiceConf, String userid, String name); - void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name); - - // Voice - void initAudioSettings(String meetingID, String requesterID, Boolean muted); - void muteAllExceptPresenter(String meetingID, String requesterID, Boolean mute); - void muteAllUsers(String meetingID, String requesterID, Boolean mute); - void isMeetingMuted(String meetingID, String requesterID); - void muteUser(String meetingID, String requesterID, String userID, Boolean mute); - void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock); - void ejectUserFromVoice(String meetingID, String userId, String ejectedBy); - void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy); - void voiceUserJoined(String meetingId, String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); - void voiceUserLeft(String meetingId, String userId); - void voiceUserLocked(String meetingId, String userId, Boolean locked); - void voiceUserMuted(String meetingId, String userId, Boolean muted); - void voiceUserTalking(String meetingId, String userId, Boolean talking); - void voiceRecording(String meetingId, String recordingFile, - String timestamp, Boolean recording); - - // Presentation - void clear(String meetingID); - void removePresentation(String meetingID, String presentationID); - void getPresentationInfo(String meetingID, String requesterID, String replyTo); - void sendCursorUpdate(String meetingID, double xPercent, double yPercent); - void resizeAndMoveSlide(String meetingID, double xOffset, double yOffset, double widthRatio, double heightRatio); - void gotoSlide(String meetingID, String page); - void sharePresentation(String meetingID, String presentationID, boolean share); - void getSlideInfo(String meetingID, String requesterID, String replyTo); - - void sendConversionUpdate(String messageKey, String meetingId, - String code, String presId, String presName); - - void sendPageCountError(String messageKey, String meetingId, - String code, String presId, int numberOfPages, - int maxNumberPages, String presName); - - void sendSlideGenerated(String messageKey, String meetingId, - String code, String presId, int numberOfPages, - int pagesCompleted, String presName); - - void sendConversionCompleted(String messageKey, String meetingId, - String code, String presId, int numPages, String presName, String presBaseUrl); - - // Polling - void getPolls(String meetingID, String requesterID); - void createPoll(String meetingID, String requesterID, String msg); - void updatePoll(String meetingID, String requesterID, String msg); - void startPoll(String meetingID, String requesterID, String msg); - void stopPoll(String meetingID, String requesterID, String msg); - void removePoll(String meetingID, String requesterID, String msg); - void respondPoll(String meetingID, String requesterID, String msg); - void preCreatedPoll(String meetingID, String msg); - - // Layout - void getCurrentLayout(String meetingID, String requesterID); - void broadcastLayout(String meetingID, String requesterID, String layout); - void lockLayout(String meetingID, String setById, - boolean lock, boolean viewersOnly, - scala.Option layout); - - // Chat - void getChatHistory(String meetingID, String requesterID, String replyTo); - void sendPublicMessage(String meetingID, String requesterID, Map message); - void sendPrivateMessage(String meetingID, String requesterID, Map message); - - // Whiteboard - void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map annotation); - void requestWhiteboardAnnotationHistory(String meetingID, String requesterID, String whiteboardId, String replyTo); - void clearWhiteboard(String meetingID, String requesterID, String whiteboardId); - void undoWhiteboard(String meetingID, String requesterID, String whiteboardId); - void enableWhiteboard(String meetingID, String requesterID, Boolean enable); - void isWhiteboardEnabled(String meetingID, String requesterID, String replyTo); - -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java deleted file mode 100755 index fa1b97c3c6..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IDispatcher.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface IDispatcher { - - void dispatch(String jsonMessage); -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java deleted file mode 100755 index 94939235e2..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/IOutMessage.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface IOutMessage { - -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java deleted file mode 100755 index 93573a265e..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.bigbluebutton.core.api; - -import java.util.Set; - - -public class MessageOutGateway { - - private Set listeners; - - public void send(IOutMessage msg) { -// log.debug("before listeners send. check message:" + msg); - for (OutMessageListener2 l : listeners) { -// log.debug("listener " + l); - l.handleMessage(msg); - } - } - - public void setListeners(Set listeners) { - this.listeners = listeners; - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java deleted file mode 100755 index ec6d099a45..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/core/api/OutMessageListener2.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.bigbluebutton.core.api; - -public interface OutMessageListener2 { - - void handleMessage(IOutMessage msg); -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java similarity index 94% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java index 1e4616ef56..ed86e5bf5a 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServerListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public interface ConferenceServerListener { public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java similarity index 94% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java index ffebb366ee..f6bcf46aac 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ConferenceServiceProvider.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public interface ConferenceServiceProvider { public void populateRoom(String room); diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java old mode 100644 new mode 100755 similarity index 86% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java index f24a4de2e5..fb30de3eea --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/FreeswitchConferenceEventListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java @@ -16,20 +16,21 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; + +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; public class FreeswitchConferenceEventListener implements ConferenceEventListener { private static final int SENDERTHREADS = 1; diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java similarity index 90% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java index f26f38b458..d9391a0df1 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/IVoiceConferenceService.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.webconference.voice; +package org.bigbluebutton.freeswitch.voice; public interface IVoiceConferenceService { void voiceUserJoined(String userId, String webUserId, String conference, diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java index d0402213cc..e4b93d716e 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public abstract class ConferenceCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java index e9b6c0f3be..ab7e12c09f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/ConferenceCommandResult.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class ConferenceCommandResult { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java index 140b26a75f..c0b6784d8f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/EjectParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class EjectParticipantCommand extends ConferenceCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java index ff774f702d..2d4ddd704f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/GetParticipantsCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class GetParticipantsCommand extends ConferenceCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java index 789a355cde..bfa54b092f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/commands/MuteParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.commands; +package org.bigbluebutton.freeswitch.voice.commands; public class MuteParticipantCommand extends ConferenceCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java index 15800e757d..f277d8c4eb 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/ConferenceEventListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public interface ConferenceEventListener { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java index 735180a415..af959fad11 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/UnknownConferenceEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class UnknownConferenceEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java index d1ee12a966..cf8bd96cfb 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceConferenceEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public abstract class VoiceConferenceEvent { private final String room; diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java similarity index 93% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java index 0e2b8bcc90..91bbc1dbab 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceStartRecordingEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceStartRecordingEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java similarity index 93% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java index 1a721c5015..29dd0c8661 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserJoinedEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserJoinedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java index f5371e5620..7591db0153 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLeftEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserLeftEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java index 414be991c6..0cfc456dfe 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserLockedEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserLockedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java index 203e93743c..003493b0f9 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserMutedEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserMutedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java index 3ecd6759e4..5bd778062e 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/events/VoiceUserTalkingEvent.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.events; +package org.bigbluebutton.freeswitch.voice.events; public class VoiceUserTalkingEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java similarity index 82% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java index f3dcd0fc59..59ec85ff0b 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ConnectionManager.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java @@ -16,25 +16,27 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch; +package org.bigbluebutton.freeswitch.voice.freeswitch; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; import org.freeswitch.esl.client.inbound.Client; import org.freeswitch.esl.client.inbound.InboundConnectionFailure; import org.freeswitch.esl.client.manager.ManagerConnection; import org.freeswitch.esl.client.transport.message.EslMessage; public class ConnectionManager { + private static final String EVENT_NAME = "Event-Name"; private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); @@ -51,12 +53,12 @@ public class ConnectionManager { try { Client c = manager.getESLClient(); if (! c.canSend()) { -// log.info("Attempting to connect to FreeSWITCH ESL"); + System.out.println("Attempting to connect to FreeSWITCH ESL"); subscribed = false; manager.connect(); } else { if (!subscribed) { -// log.info("Subscribing for ESL events."); + System.out.println("Subscribing for ESL events."); c.cancelEventSubscriptions(); c.addEventListener(eslEventListener); c.setEventSubscriptions( "plain", "all" ); @@ -68,13 +70,11 @@ public class ConnectionManager { } } catch (InboundConnectionFailure e) { System.out.println("Failed to connect to ESL"); -// log.error("Failed to connect to ESL"); } } public void start() { -// log.info("Starting FreeSWITCH ESL connection manager."); - System.out.println("***************** Starting FreeSWITCH ESL connection manager."); + System.out.println("Starting FreeSWITCH ESL connection manager."); ConnectThread connector = new ConnectThread(); connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java similarity index 79% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java index 3f627965c3..1bfd7c249a 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/ESLEventListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java @@ -1,16 +1,17 @@ -package org.bigbluebutton.webconference.voice.freeswitch; +package org.bigbluebutton.freeswitch.voice.freeswitch; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; + +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; import org.freeswitch.esl.client.IEslEventListener; import org.freeswitch.esl.client.transport.event.EslEvent; import org.jboss.netty.channel.ExceptionEvent; @@ -31,7 +32,7 @@ public class ESLEventListener implements IEslEventListener { @Override public void backgroundJobResultReceived(EslEvent event) { -// log.debug( "Background job result received [{}]", event ); + System.out.println( "Background job result received [" + event + "]"); } @Override @@ -55,11 +56,11 @@ public class ESLEventListener implements IEslEventListener { String voiceUserId = callerIdName; -// log.info("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); + System.out.println("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); if (gapMatcher.matches()) { -// log.debug("Ignoring GLOBAL AUDIO USER [{}]", callerIdName); + System.out.println("Ignoring GLOBAL AUDIO USER [" + callerIdName + "]"); return; } @@ -76,7 +77,7 @@ public class ESLEventListener implements IEslEventListener { @Override public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { Integer memberId = this.getMemberIdFromEvent(event); -// log.info("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + System.out.println("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); conferenceEventListener.handleConferenceEvent(pl); } @@ -85,7 +86,7 @@ public class ESLEventListener implements IEslEventListener { public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { Integer memberId = this.getMemberIdFromEvent(event); System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); -// log.info("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + System.out.println("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); conferenceEventListener.handleConferenceEvent(pm); } @@ -94,7 +95,7 @@ public class ESLEventListener implements IEslEventListener { public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { Integer memberId = this.getMemberIdFromEvent(event); System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); -// log.info("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); + System.out.println("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); conferenceEventListener.handleConferenceEvent(pm); } @@ -117,7 +118,6 @@ public class ESLEventListener implements IEslEventListener { pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); conferenceEventListener.handleConferenceEvent(pt); } else { -// log.debug("Unknown conference Action [{}]", action); System.out.println("Unknown conference Action [" + action + "]"); } } @@ -140,15 +140,14 @@ public class ESLEventListener implements IEslEventListener { return; } - // if (log.isDebugEnabled()) - // log.debug("Handling conferenceEventRecord " + action); + System.out.println("Handling conferenceEventRecord " + action); if (action.equals(START_RECORDING_EVENT)) { VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); sre.setRecordingFilename(getRecordFilenameFromEvent(event)); sre.setTimestamp(genTimestamp().toString()); -// log.info("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + System.out.println("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); conferenceEventListener.handleConferenceEvent(sre); } else if (action.equals(STOP_RECORDING_EVENT)) { @@ -156,11 +155,10 @@ public class ESLEventListener implements IEslEventListener { srev.setRecordingFilename(getRecordFilenameFromEvent(event)); srev.setTimestamp(genTimestamp().toString()); -// log.info("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); + System.out.println("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); conferenceEventListener.handleConferenceEvent(srev); } else { -// if (log.isDebugEnabled()) -// log.warn("Processing UNKNOWN conference Action {}", action); + System.out.println("Processing UNKNOWN conference Action " + action + "]"); } } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java similarity index 84% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java index d0abdcc759..3a31fe7ba3 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch; +package org.bigbluebutton.freeswitch.voice.freeswitch; import java.io.File; import java.util.concurrent.BlockingQueue; @@ -24,17 +24,18 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.bigbluebutton.webconference.voice.ConferenceServiceProvider; -import org.bigbluebutton.webconference.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.FreeswitchCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.webconference.voice.freeswitch.actions.RecordConferenceCommand; + +import org.bigbluebutton.freeswitch.voice.ConferenceServiceProvider; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.FreeswitchCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; public class FreeswitchApplication implements ConferenceServiceProvider { - + private static final int SENDERTHREADS = 1; private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); @@ -149,20 +150,20 @@ public class FreeswitchApplication implements ConferenceServiceProvider { public void run() { if (command instanceof PopulateRoomCommand) { PopulateRoomCommand cmd = (PopulateRoomCommand) command; -// log.debug("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); manager.getUsers(cmd); } else if (command instanceof MuteParticipantCommand) { MuteParticipantCommand cmd = (MuteParticipantCommand) command; -// log.debug("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); manager.mute(cmd); } else if (command instanceof EjectParticipantCommand) { EjectParticipantCommand cmd = (EjectParticipantCommand) command; -// log.debug("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); manager.eject(cmd); } else if (command instanceof EjectAllUsersCommand) { EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; -// log.debug("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); manager.ejectAll(cmd); } else if (command instanceof RecordConferenceCommand) { manager.record((RecordConferenceCommand) command); diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java similarity index 88% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java index c0aa4d35b3..45ef88764f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/BroadcastConferenceCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java @@ -16,9 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; import org.freeswitch.esl.client.transport.message.EslMessage; public class BroadcastConferenceCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java similarity index 91% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java index e4826d72ea..4c24b28758 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectAllUsersCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public class EjectAllUsersCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java index 0924b164eb..e46deef3e4 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/EjectParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public class EjectParticipantCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java index db9800fa93..4efd29f95e 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/FreeswitchCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public abstract class FreeswitchCommand { public static final String SPACE = " "; diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java similarity index 92% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java index a54ab6dacc..fdd7b343eb 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/MuteParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; public class MuteParticipantCommand extends FreeswitchCommand { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java similarity index 80% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java index 0697ac610c..03f7a32296 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/actions/PopulateRoomCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java @@ -16,22 +16,24 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; import org.freeswitch.esl.client.transport.message.EslMessage; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.freeswitch.response.XMLResponseConferenceListParser; -import org.bigbluebutton.webconference.voice.freeswitch.response.ConferenceMember; +import org.apache.commons.lang3.StringUtils; +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.freeswitch.voice.freeswitch.response.ConferenceMember; +import org.bigbluebutton.freeswitch.voice.freeswitch.response.XMLResponseConferenceListParser; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.StringUtils; + import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; + import org.xml.sax.SAXException; public class PopulateRoomCommand extends FreeswitchCommand { @@ -56,7 +58,7 @@ public class PopulateRoomCommand extends FreeswitchCommand { //E.g. Conference 85115 not found if(!firstLine.startsWith(". * */ -package org.bigbluebutton.webconference.voice.freeswitch.actions; +package org.bigbluebutton.freeswitch.voice.freeswitch.actions; -import org.bigbluebutton.webconference.voice.events.ConferenceEventListener; +import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; import org.freeswitch.esl.client.transport.message.EslMessage; -import org.slf4j.Logger; public class RecordConferenceCommand extends FreeswitchCommand { + private boolean record; private String recordPath; diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java similarity index 96% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java index 4e6caf9050..915a265217 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMember.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.webconference.voice.freeswitch.response; +package org.bigbluebutton.freeswitch.voice.freeswitch.response; /** * diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java similarity index 95% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java index be507e2c0d..f571f5da4f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/ConferenceMemberFlags.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java @@ -17,7 +17,7 @@ * */ -package org.bigbluebutton.webconference.voice.freeswitch.response; +package org.bigbluebutton.freeswitch.voice.freeswitch.response; /** * diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java similarity index 90% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java index 0411d85d5e..397e7ce42a 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/response/XMLResponseConferenceListParser.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java @@ -16,12 +16,11 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.webconference.voice.freeswitch.response; +package org.bigbluebutton.freeswitch.voice.freeswitch.response; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.slf4j.Logger; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; @@ -47,10 +46,9 @@ public class XMLResponseConferenceListParser extends DefaultHandler { } public void printConferneceMemebers() { -// log.info("Number of Members found in room [{}] was ({}).", room, myConfrenceMembers.size()); Iterator it = myConfrenceMembers.iterator(); while(it.hasNext()) { - // log.info("room [{}] member: [{}]", room, it.next().toString()); + } } @@ -134,7 +132,7 @@ public class XMLResponseConferenceListParser extends DefaultHandler { try { tempMember.setId(Integer.parseInt(tempVal)); } catch(NumberFormatException nfe) { -// log.error("cannot set ConferenceMember Id value [{}] NFE.", tempVal); + } }else if (qName.equalsIgnoreCase("uuid")) { tempMember.setUUID(tempVal); @@ -146,13 +144,13 @@ public class XMLResponseConferenceListParser extends DefaultHandler { try { tempMember.setJoinTime(Integer.parseInt(tempVal)); } catch(NumberFormatException nfe) { -// log.debug("cannot set setJoinTime value [{}] NFE.", tempVal); + } }else if (qName.equalsIgnoreCase("last_talking")) { try { tempMember.setLastTalking(Integer.parseInt(tempVal)); } catch(NumberFormatException nfe) { -// log.debug("cannot set setLastTalking value [{}] NFE.", tempVal); + } } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java deleted file mode 100755 index 9f03321ce0..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/AbstractVoiceRecordEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import org.bigbluebutton.conference.service.recorder.RecordEvent; - -public abstract class AbstractVoiceRecordEvent extends RecordEvent { - - public AbstractVoiceRecordEvent() { - setModule("VOICE"); - } - - public void setBridge(String bridge) { - eventMap.put("bridge", bridge); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java deleted file mode 100755 index 7417a522af..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantJoinedVoiceRecordEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantJoinedVoiceRecordEvent() { - super(); - setEvent("ParticipantJoinedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setCallerName(String name) { - eventMap.put("callername", name); - } - - public void setCallerNumber(String name) { - eventMap.put("callernumber", name); - } - - public void setMuted(boolean muted) { - eventMap.put("muted", Boolean.toString(muted)); - } - - public void setTalking(boolean talking) { - eventMap.put("talking", Boolean.toString(talking)); - } - - public void setLocked(boolean locked) { - eventMap.put("locked", Boolean.toString(locked)); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java deleted file mode 100755 index 0b3bfaa25c..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLeftVoiceRecordEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantLeftVoiceRecordEvent() { - super(); - setEvent("ParticipantLeftEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java deleted file mode 100755 index ff7be6cbd5..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantLockedVoiceRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantLockedVoiceRecordEvent() { - super(); - setEvent("ParticipantLockedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setLocked(boolean locked) { - eventMap.put("locked", Boolean.toString(locked)); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java deleted file mode 100755 index eb23d6bc70..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantMutedVoiceRecordEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantMutedVoiceRecordEvent() { - super(); - setEvent("ParticipantMutedEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setMuted(boolean muted) { - eventMap.put("muted", Boolean.toString(muted)); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java deleted file mode 100755 index e0b2814349..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/ParticipantTalkingVoiceRecordEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public ParticipantTalkingVoiceRecordEvent() { - super(); - setEvent("ParticipantTalkingEvent"); - } - - public void setParticipant(String p) { - eventMap.put("participant", p); - } - - public void setTalking(boolean talking) { - eventMap.put("talking", Boolean.toString(talking)); - } - -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java deleted file mode 100755 index 7c46b0f0bf..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/StartRecordingVoiceRecordEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { - - public StartRecordingVoiceRecordEvent(boolean record) { - super(); - if (record) - setEvent("StartRecordingEvent"); - else - setEvent("StopRecordingEvent"); - } - - public void setRecordingTimestamp(String timestamp) { - eventMap.put("recordingTimestamp", timestamp); - } - - public void setFilename(String filename) { - eventMap.put("filename", filename); - } -} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java deleted file mode 100755 index 310d5392cd..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/webconference/voice/VoiceEventRecorder.java +++ /dev/null @@ -1,141 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.webconference.voice; - -import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.conference.service.recorder.RecorderApplication; -import org.bigbluebutton.webconference.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserLockedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.webconference.voice.events.VoiceUserTalkingEvent; -import org.bigbluebutton.webconference.voice.events.VoiceStartRecordingEvent; - -public class VoiceEventRecorder { - - private RecorderApplication recorder; - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - public void recordConferenceEvent(VoiceConferenceEvent event, String room) { - if (event instanceof VoiceUserJoinedEvent) { - recordParticipantJoinedEvent(event, room); - } else if (event instanceof VoiceUserLeftEvent) { - recordParticipantLeftEvent(event, room); - } else if (event instanceof VoiceUserMutedEvent) { - recordParticipantMutedEvent(event, room); - } else if (event instanceof VoiceUserTalkingEvent) { - recordParticipantTalkingEvent(event, room); - } else if (event instanceof VoiceUserLockedEvent) { - recordParticipantLockedEvent(event, room); - } else if (event instanceof VoiceStartRecordingEvent) { - recordStartRecordingEvent(event, room); - } else { -// log.debug("Processing UnknownEvent " + event.getClass().getName() + " for room: " + event.getRoom() ); - } - } - - private void recordStartRecordingEvent(VoiceConferenceEvent event, String room) { - VoiceStartRecordingEvent sre = (VoiceStartRecordingEvent) event; - StartRecordingVoiceRecordEvent evt = new StartRecordingVoiceRecordEvent(sre.startRecord()); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setRecordingTimestamp(sre.getTimestamp()); - evt.setFilename(sre.getRecordingFilename()); - System.out.println("*** Recording voice " + sre.startRecord() + " timestamp: " + evt.toMap().get("recordingTimestamp") + " file: " + evt.toMap().get("filename")); - recorder.record(room, evt); - } - - private void recordParticipantJoinedEvent(VoiceConferenceEvent event, String room) { - VoiceUserJoinedEvent pje = (VoiceUserJoinedEvent) event; - - ParticipantJoinedVoiceRecordEvent evt = new ParticipantJoinedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(pje.getUserId().toString()); - evt.setCallerName(pje.getCallerIdName()); - evt.setCallerNumber(pje.getCallerIdName()); - evt.setMuted(pje.getMuted()); - evt.setTalking(pje.getSpeaking()); - - recorder.record(room, evt); - } - - private void recordParticipantLeftEvent(VoiceConferenceEvent event, String room) { - - ParticipantLeftVoiceRecordEvent evt = new ParticipantLeftVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - - - evt.setParticipant(((VoiceUserLeftEvent)event).getUserId().toString()); - - recorder.record(room, evt); - } - - private void recordParticipantMutedEvent(VoiceConferenceEvent event, String room) { - VoiceUserMutedEvent pme = (VoiceUserMutedEvent) event; - - ParticipantMutedVoiceRecordEvent evt = new ParticipantMutedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserMutedEvent)event).getUserId().toString()); - evt.setMuted(pme.isMuted()); - - recorder.record(room, evt); - } - - private void recordParticipantTalkingEvent(VoiceConferenceEvent event, String room) { - VoiceUserTalkingEvent pte = (VoiceUserTalkingEvent) event; - - ParticipantTalkingVoiceRecordEvent evt = new ParticipantTalkingVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserTalkingEvent)event).getUserId().toString()); - evt.setTalking(pte.isTalking()); - - recorder.record(room, evt); - } - - private void recordParticipantLockedEvent(VoiceConferenceEvent event, String room) { - VoiceUserLockedEvent ple = (VoiceUserLockedEvent) event; - - ParticipantLockedVoiceRecordEvent evt = new ParticipantLockedVoiceRecordEvent(); - evt.setMeetingId(room); - evt.setTimestamp(genTimestamp()); - evt.setBridge(event.getRoom()); - evt.setParticipant(((VoiceUserLockedEvent)event).getUserId().toString()); - evt.setLocked(ple.isLocked()); - - recorder.record(room, evt); - } - - public void setRecorderApplication(RecorderApplication recorder) { - this.recorder = recorder; - } -} diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala new file mode 100755 index 0000000000..7beaddb032 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala @@ -0,0 +1,5 @@ +package org.bigbluebutton.core.voice.freeswitch + +class HeartbeatMonitor() { + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala new file mode 100755 index 0000000000..47b35daae4 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala @@ -0,0 +1,54 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.core.api.UserVO +import org.bigbluebutton.core.util._ + +class FreeswitchConference(val conferenceNum: String, + val meetingId: String, + val recorded: Boolean) { + + private var users = new scala.collection.immutable.HashMap[String, UserVO] + + private var recording: Boolean = false + + def addUser(user: UserVO) { + users += user.userID -> user + } + + def removeUser(user: UserVO) { + users -= user.userID + } + + def getWebUserUsingExtId(webUserId: String): Option[UserVO] = { + users.values find { u => + (u.externUserID == webUserId) + } + } + + def getWebUser(webUserId: String): Option[UserVO] = { + users.values find (u => (u.userID == webUserId)) + } + + def getVoiceUser(voiceUserId: String): Option[UserVO] = { + users.values find (u => u.voiceUser.userId == voiceUserId) + } + + def numUsersInVoiceConference: Int = { + val joinedUsers = users.values filter (u => u.voiceUser.joined) + joinedUsers.size + } + + def numUsers = users.size + + def recordingStarted() { + recording = true; + } + + def recordingStopped() { + recording = false + } + + def isRecording(): Boolean = { + recording + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala new file mode 100755 index 0000000000..c10bdd52b1 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala @@ -0,0 +1,248 @@ +package org.bigbluebutton.freeswitch + +import akka.actor._ +import akka.actor.ActorLogging +import org.bigbluebutton.core.api._ +import org.bigbluebutton.core.util._ + +case class FsVoiceUserJoined(userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, muted: Boolean, + speaking: Boolean) + +case class FsVoiceUserLeft(userId: String, conference: String) +case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) +case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) +case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) +case class FsRecording(conference: String, recordingFile: String, + timestamp: String, recording: Boolean) + +object FreeswitchConferenceActor { + def props(system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW): Props = + Props(classOf[FreeswitchConferenceActor], system, fsproxy, bbbInGW) +} + +class FreeswitchConferenceActor(val system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW) extends Actor with ActorLogging { + + private var confs = new scala.collection.immutable.HashMap[String, FreeswitchConference] + + def receive = { + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: StartRecording => handleStartRecording(msg) + case msg: StopRecording => handleStopRecording(msg) + case msg: FsRecording => handleFsRecording(msg) + case msg: FsVoiceUserJoined => handleFsVoiceUserJoined(msg) + case msg: FsVoiceUserLeft => handleFsVoiceUserLeft(msg) + case msg: FsVoiceUserLocked => handleFsVoiceUserLocked(msg) + case msg: FsVoiceUserMuted => handleFsVoiceUserMuted(msg) + case msg: FsVoiceUserTalking => handleFsVoiceUserTalking(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) + case _ => // do nothing + } + + private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + fsproxy.ejectUsers(fc.conferenceNum) + }) + } + + private def handleMeetingCreated(msg: MeetingCreated) { + if (!confs.contains(msg.meetingID)) { + log.info("Meeting created [" + msg.meetingID + "] with voice conf [" + msg.voiceBridge + "]") + val fsconf = new FreeswitchConference(msg.voiceBridge, + msg.meetingID, + msg.recorded) + confs += fsconf.meetingId -> fsconf + } + + fsproxy.getUsers(msg.voiceBridge) + } + + private def handleMeetingEnded(msg: MeetingEnded) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + log.info("Meeting ended [" + msg.meetingID + "]") + fsproxy.ejectUsers(fc.conferenceNum) + confs -= fc.meetingId + }) + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + log.info("Meeting destroyed [" + msg.meetingID + "]") + fsproxy.ejectUsers(fc.conferenceNum) + confs -= fc.meetingId + }) + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach { fc => + log.info("Web user has joined voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") + fc.addUser(msg.user) + if (fc.numUsersInVoiceConference == 1 && fc.recorded) { + log.info("Meeting is recorded. Tell FreeSWITCH to start recording. mid[" + fc.meetingId + "]") + fsproxy.startRecording(fc.conferenceNum, fc.meetingId) + } + } + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + // println("FreeswitchConferenceActor - handleUserLeftVoice mid=[" + msg.meetingID + "]") + + fsconf foreach { fc => + fc.addUser(msg.user) + log.info("Web user has left voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") + if (fc.numUsersInVoiceConference == 0 && fc.recorded) { + log.info("Meeting is recorded. No more users in voice conference. Tell FreeSWITCH to stop recording. mid[" + fc.meetingId + "]") + fsproxy.stopRecording(fc.conferenceNum) + } + } + } + + private def handleUserJoined(msg: UserJoined) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + log.info("Web user id joining meeting id[" + fc.meetingId + "] wid=[" + msg.user.userID + "], extId=[" + msg.user.externUserID + "]") + fc.addUser(msg.user) + }) + } + + private def handleUserLeft(msg: UserLeft) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + fc.removeUser(msg.user) + }) + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + log.debug("Mute user request for wid[" + msg.userId + "] mute=[" + msg.mute + "]") + fsconf foreach (fc => { + val user = fc.getWebUser(msg.userId) + user foreach (u => { + log.debug("Muting user wid[" + msg.userId + "] mute=[" + msg.mute + "]") + fsproxy.muteUser(fc.conferenceNum, u.voiceUser.userId, msg.mute) + }) + }) + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + val fsconf = confs.values find (c => c.meetingId == msg.meetingID) + + fsconf foreach (fc => { + val user = fc.getWebUser(msg.userId) + user foreach (u => { + fsproxy.ejectUser(fc.conferenceNum, u.voiceUser.userId) + }) + }) + } + + private def handleStartRecording(msg: StartRecording) { + + } + + private def handleStopRecording(msg: StopRecording) { + + } + + private def handleFsRecording(msg: FsRecording) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + fsconf foreach { fc => + // Need to filter recording events here to not have duplicate events + if (!fc.isRecording && msg.recording) { + // + fc.recordingStarted + bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) + } else if (fc.isRecording && !msg.recording) { + fc.recordingStopped + bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) + } + } + } + + private def sendNonWebUserJoined(meetingId: String, webUserId: String, msg: FsVoiceUserJoined) { + bbbInGW.voiceUserJoined(meetingId, msg.userId, + webUserId, msg.conference, msg.callerIdNum, msg.callerIdName, + msg.muted, msg.speaking) + } + + private def handleFsVoiceUserJoined(msg: FsVoiceUserJoined) { + log.info("A user has joined the voice conference [" + + msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + log.debug("Meeting [" + fc.meetingId + "] has [" + fc.numUsers + "]") + fc.getWebUserUsingExtId(msg.webUserId) match { + case Some(user) => { + log.info("The user is also in the web client. [" + + msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") + sendNonWebUserJoined(fc.meetingId, user.userID, msg) + } + case None => { + log.info("User is not a web user. Must be a phone caller. [" + + msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") + sendNonWebUserJoined(fc.meetingId, msg.userId, msg) + } + } + }) + } + + private def handleFsVoiceUserLeft(msg: FsVoiceUserLeft) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + user foreach (u => bbbInGW.voiceUserLeft(fc.meetingId, u.userID)) + }) + } + + private def handleFsVoiceUserLocked(msg: FsVoiceUserLocked) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + user foreach (u => bbbInGW.voiceUserLocked(fc.meetingId, u.userID, msg.locked)) + }) + } + + private def handleFsVoiceUserMuted(msg: FsVoiceUserMuted) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + // println("Rx voice user muted for cnum=[" + msg.conference + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + // println("Rx voice user muted for mid=[" + fc.meetingId + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") + user foreach (u => bbbInGW.voiceUserMuted(fc.meetingId, u.userID, msg.muted)) + }) + } + + private def handleFsVoiceUserTalking(msg: FsVoiceUserTalking) { + val fsconf = confs.values find (c => c.conferenceNum == msg.conference) + + fsconf foreach (fc => { + val user = fc.getVoiceUser(msg.userId) + // println("Rx voice user talking for vid[" + msg.userId + "] mute=[" + msg.talking + "]") + user foreach (u => bbbInGW.voiceUserTalking(fc.meetingId, u.userID, msg.talking)) + }) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala new file mode 100755 index 0000000000..4761993aa0 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala @@ -0,0 +1,123 @@ +package org.bigbluebutton.freeswitch + +import akka.actor.{ ActorSystem, Props } +import org.bigbluebutton.webconference.voice.IVoiceConferenceService +import org.bigbluebutton.core.api._ +import org.bigbluebutton.webconference.voice.FreeswitchConferenceEventListener +import akka.actor.ActorRef + +class FreeswitchConferenceService(fsproxy: FreeswitchManagerProxy, + fsListener: FreeswitchConferenceEventListener) + extends IVoiceConferenceService + with OutMessageListener2 { + + fsListener.setVoiceConferenceService(this) + + implicit val system = ActorSystem("bigbluebutton-apps-fsesl") + + var bbbInGW: IBigBlueButtonInGW = _ + var fsActor: ActorRef = _ + + def setIBigBlueButtonInGW(inGW: IBigBlueButtonInGW) { + bbbInGW = inGW + fsActor = system.actorOf( + FreeswitchConferenceActor.props(system, fsproxy, bbbInGW), + "bigbluebutton-fs-actor") + } + + def handleMessage(msg: IOutMessage) { + msg match { + case msg: MeetingCreated => handleMeetingCreated(msg) + case msg: MeetingEnded => handleMeetingEnded(msg) + case msg: MeetingDestroyed => handleMeetingDestroyed(msg) + case msg: UserJoined => handleUserJoined(msg) + case msg: UserLeft => handleUserLeft(msg) + case msg: MuteVoiceUser => handleMuteVoiceUser(msg) + case msg: EjectVoiceUser => handleEjectVoiceUser(msg) + case msg: UserJoinedVoice => handleUserJoinedVoice(msg) + case msg: UserLeftVoice => handleUserLeftVoice(msg) + case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) + case _ => // do nothing + } + } + + private def handleUserLeftVoice(msg: UserLeftVoice) { + fsActor ! msg + } + + private def handleUserJoinedVoice(msg: UserJoinedVoice) { + fsActor ! msg + } + + private def handleMuteVoiceUser(msg: MuteVoiceUser) { + fsActor ! msg + } + + private def handleEjectVoiceUser(msg: EjectVoiceUser) { + fsActor ! msg + } + + private def handleUserLeft(msg: UserLeft) { + fsActor ! msg + } + + private def handleUserJoined(msg: UserJoined) { + fsActor ! msg + } + + private def handleMeetingCreated(msg: MeetingCreated) { + fsActor ! msg + } + + private def handleMeetingEnded(msg: MeetingEnded) { + fsActor ! msg + } + + private def handleMeetingDestroyed(msg: MeetingDestroyed) { + fsActor ! msg + } + + private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { + fsActor ! msg + } + + def voiceStartedRecording(conference: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) + fsActor ! fsRec + } + + def voiceUserJoined(userId: String, webUserId: String, conference: String, + callerIdNum: String, callerIdName: String, + muted: java.lang.Boolean, talking: java.lang.Boolean) { + // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") + val vuj = new FsVoiceUserJoined(userId, webUserId, + conference, callerIdNum, + callerIdName, muted, + talking) + fsActor ! vuj + } + + def voiceUserLeft(userId: String, conference: String) { + // println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") + val vul = new FsVoiceUserLeft(userId, conference) + fsActor ! vul + } + + def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { + val vul = new FsVoiceUserLocked(userId, conference, locked) + fsActor ! vul + } + + def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") + val vum = new FsVoiceUserMuted(userId, conference, muted) + fsActor ! vum + } + + def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") + val vut = new FsVoiceUserTalking(userId, conference, talking) + fsActor ! vut + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala new file mode 100755 index 0000000000..993e77f699 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala @@ -0,0 +1,32 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.webconference.voice.freeswitch.FreeswitchApplication + +class FreeswitchManagerProxy(fsApp: FreeswitchApplication) { + + def getUsers(conference: String) { + fsApp.populateRoom(conference) + } + + def ejectUsers(conference: String) { + fsApp.ejectAll(conference) + } + + def muteUser(conference: String, userId: String, mute: Boolean) { + println("Forwarding mute request to fsApp") + fsApp.mute(conference, userId, mute) + } + + def ejectUser(conference: String, userId: String) { + println("Forwarding eject user request to fsApp") + fsApp.eject(conference, userId) + } + + def startRecording(conference: String, meetingId: String) { + fsApp.record(conference, meetingId) + } + + def stopRecording(conference: String) { + + } +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala new file mode 100755 index 0000000000..60f07a7211 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala @@ -0,0 +1,12 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.core.api.IBigBlueButtonInGW + +/** + * Workaround to get away from circular dependency injection. + */ +class FsInGwWrapper(inGW: IBigBlueButtonInGW, + fsConfService: FreeswitchConferenceService) { + + fsConfService.setIBigBlueButtonInGW(inGW) +} \ No newline at end of file From b9fb309d45ab3fae3dec20b5e16b799a6dfde0dc Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 20:36:56 +0000 Subject: [PATCH 19/30] - split fs-esl from bbb-apps --- .../voice/AbstractVoiceRecordEvent.java | 2 +- .../ParticipantJoinedVoiceRecordEvent.java | 2 +- .../ParticipantLeftVoiceRecordEvent.java | 2 +- .../ParticipantLockedVoiceRecordEvent.java | 2 +- .../ParticipantMutedVoiceRecordEvent.java | 2 +- .../ParticipantTalkingVoiceRecordEvent.java | 2 +- .../voice/StartRecordingVoiceRecordEvent.java | 2 +- .../recorder}/voice/VoiceEventRecorder.java | 4 +- .../voice/ConferenceServerListener.java | 26 --- .../voice/ConferenceServiceProvider.java | 28 --- .../FreeswitchConferenceEventListener.java | 116 ---------- .../voice/IVoiceConferenceService.java | 13 -- .../voice/commands/ConferenceCommand.java | 40 ---- .../commands/ConferenceCommandResult.java | 56 ----- .../commands/EjectParticipantCommand.java | 34 --- .../commands/GetParticipantsCommand.java | 27 --- .../commands/MuteParticipantCommand.java | 40 ---- .../voice/freeswitch/ConnectionManager.java | 154 ------------- .../voice/freeswitch/ESLEventListener.java | 202 ----------------- .../freeswitch/FreeswitchApplication.java | 203 ------------------ .../actions/BroadcastConferenceCommand.java | 50 ----- .../actions/EjectAllUsersCommand.java | 31 --- .../actions/EjectParticipantCommand.java | 34 --- .../freeswitch/actions/FreeswitchCommand.java | 45 ---- .../actions/MuteParticipantCommand.java | 40 ---- .../actions/PopulateRoomCommand.java | 115 ---------- .../actions/RecordConferenceCommand.java | 50 ----- .../freeswitch/response/ConferenceMember.java | 88 -------- .../response/ConferenceMemberFlags.java | 54 ----- .../XMLResponseConferenceListParser.java | 158 -------------- .../redis/AppsRedisPublisherActor.scala | 45 ++++ .../redis/AppsRedisSubscriberActor.scala | 41 ++++ .../endpoint/redis/Message.scala | 3 + .../endpoint/redis/RedisPubSubActor.scala | 39 ++++ 34 files changed, 136 insertions(+), 1614 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/AbstractVoiceRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/ParticipantJoinedVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/ParticipantLeftVoiceRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/ParticipantLockedVoiceRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/ParticipantMutedVoiceRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/ParticipantTalkingVoiceRecordEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/StartRecordingVoiceRecordEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core/service/recorder}/voice/VoiceEventRecorder.java (96%) delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/RecordConferenceCommand.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java delete mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala create mode 100644 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/AbstractVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/AbstractVoiceRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/AbstractVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/AbstractVoiceRecordEvent.java index 8637314896..f439a95991 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/AbstractVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/AbstractVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; import org.bigbluebutton.core.service.recorder.RecordEvent; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantJoinedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantJoinedVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantJoinedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantJoinedVoiceRecordEvent.java index d054aeca0b..0a412f4753 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantJoinedVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantJoinedVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; public class ParticipantJoinedVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLeftVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLeftVoiceRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLeftVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLeftVoiceRecordEvent.java index 945505bb56..f60efae55f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLeftVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLeftVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; public class ParticipantLeftVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLockedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLockedVoiceRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLockedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLockedVoiceRecordEvent.java index b4a51a5dae..24086b9dbb 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantLockedVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantLockedVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; public class ParticipantLockedVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantMutedVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantMutedVoiceRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantMutedVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantMutedVoiceRecordEvent.java index f868bcaa63..6ca327d213 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantMutedVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantMutedVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; public class ParticipantMutedVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantTalkingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantTalkingVoiceRecordEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantTalkingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantTalkingVoiceRecordEvent.java index b748ab3dca..8930a8a5cd 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ParticipantTalkingVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/ParticipantTalkingVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; public class ParticipantTalkingVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/StartRecordingVoiceRecordEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/StartRecordingVoiceRecordEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/StartRecordingVoiceRecordEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/StartRecordingVoiceRecordEvent.java index d06a37b387..5b6d27e365 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/StartRecordingVoiceRecordEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/StartRecordingVoiceRecordEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; public class StartRecordingVoiceRecordEvent extends AbstractVoiceRecordEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java similarity index 96% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/VoiceEventRecorder.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java index f7c26ab0b7..0e85a4d0fe 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/VoiceEventRecorder.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java @@ -16,10 +16,9 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice; +package org.bigbluebutton.core.service.recorder.voice; import java.util.concurrent.TimeUnit; - import org.bigbluebutton.core.service.recorder.RecorderApplication; import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; @@ -29,7 +28,6 @@ import org.bigbluebutton.freeswitch.voice.events.VoiceUserLockedEvent; import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; - public class VoiceEventRecorder { private RecorderApplication recorder; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java deleted file mode 100755 index ed86e5bf5a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServerListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice; - -public interface ConferenceServerListener { - public void joined(String room, Integer participant, String name, Boolean muted, Boolean talking); - public void left(String room, Integer participant); - public void muted(String room, Integer participant, Boolean muted); - public void talking(String room, Integer participant, Boolean talking); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java deleted file mode 100755 index f6bcf46aac..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice; - -public interface ConferenceServiceProvider { - public void populateRoom(String room); - public void mute(String room, String participant, Boolean mute); - public void eject(String room, String participant); - public void ejectAll(String room); - public void record(String room, String meetingid); - public void broadcast(String room, String meetingid); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java deleted file mode 100755 index fb30de3eea..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java +++ /dev/null @@ -1,116 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice; - -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; - -public class FreeswitchConferenceEventListener implements ConferenceEventListener { - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - - private volatile boolean sendMessages = false; - private IVoiceConferenceService vcs; - - public void setVoiceConferenceService(IVoiceConferenceService vcs) { - this.vcs = vcs; - } - - private void queueMessage(VoiceConferenceEvent event) { - try { - messages.offer(event, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private void sendMessageToBigBlueButton(final VoiceConferenceEvent event) { - Runnable task = new Runnable() { - public void run() { - if (event instanceof VoiceUserJoinedEvent) { - System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); - VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; - vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), - evt.getCallerIdNum(), evt.getCallerIdName(), - evt.getMuted(), evt.getSpeaking()); - } else if (event instanceof VoiceUserLeftEvent) { - System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); - VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; - vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); - } else if (event instanceof VoiceUserMutedEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); - VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; - vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); - } else if (event instanceof VoiceUserTalkingEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); - VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; - vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); - } else if (event instanceof VoiceStartRecordingEvent) { - VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; - System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); - vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); - } - } - }; - - runExec.execute(task); - } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - VoiceConferenceEvent message; - try { - message = messages.take(); - sendMessageToBigBlueButton(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - - public void handleConferenceEvent(VoiceConferenceEvent event) { - queueMessage(event); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java deleted file mode 100755 index d9391a0df1..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.freeswitch.voice; - -public interface IVoiceConferenceService { - void voiceUserJoined(String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); - void voiceUserLeft(String meetingId, String userId); - void voiceUserLocked(String meetingId, String userId, Boolean locked); - void voiceUserMuted(String meetingId, String userId, Boolean muted); - void voiceUserTalking(String meetingId, String userId, Boolean talking); - void voiceStartedRecording(String conference, String recordingFile, - String timestamp, Boolean recording); -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java deleted file mode 100755 index e4b93d716e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.commands; - -public abstract class ConferenceCommand { - - private final String room; - private final Integer requesterId; - - public ConferenceCommand(String room, Integer requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public String getRoom() { - return room; - } - - public Integer getRequesterId() { - return requesterId; - } - - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java deleted file mode 100755 index ab7e12c09f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/ConferenceCommandResult.java +++ /dev/null @@ -1,56 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.commands; - -public class ConferenceCommandResult { - - private final String room; - private final Integer requesterId; - private boolean success = false; - private String message = ""; - - public ConferenceCommandResult(String room, Integer requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getRoom() { - return room; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Integer getRequesterId() { - return requesterId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java deleted file mode 100755 index c0b6784d8f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.commands; - -public class EjectParticipantCommand extends ConferenceCommand { - - private final Integer participantId; - - public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { - super(room, requesterId); - this.participantId = participantId; - } - - public Integer getParticipantId() { - return participantId; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java deleted file mode 100755 index 2d4ddd704f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.commands; - -public class GetParticipantsCommand extends ConferenceCommand { - - public GetParticipantsCommand(String room, Integer requesterId) { - super(room, requesterId); - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java deleted file mode 100755 index bfa54b092f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.commands; - -public class MuteParticipantCommand extends ConferenceCommand { - - private final Integer participantId; - private final boolean mute; - - public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { - super(room, requesterId); - this.participantId = participantId; - this.mute = mute; - } - - public Integer getParticipantId() { - return participantId; - } - - public boolean isMute() { - return mute; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java deleted file mode 100755 index 59ec85ff0b..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java +++ /dev/null @@ -1,154 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch; - -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; -import org.freeswitch.esl.client.inbound.Client; -import org.freeswitch.esl.client.inbound.InboundConnectionFailure; -import org.freeswitch.esl.client.manager.ManagerConnection; -import org.freeswitch.esl.client.transport.message.EslMessage; - -public class ConnectionManager { - - private static final String EVENT_NAME = "Event-Name"; - - private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); - - private ManagerConnection manager; - private ScheduledFuture connectTask; - - private volatile boolean subscribed = false; - - private ConferenceEventListener conferenceEventListener; - private ESLEventListener eslEventListener; - - private void connect() { - try { - Client c = manager.getESLClient(); - if (! c.canSend()) { - System.out.println("Attempting to connect to FreeSWITCH ESL"); - subscribed = false; - manager.connect(); - } else { - if (!subscribed) { - System.out.println("Subscribing for ESL events."); - c.cancelEventSubscriptions(); - c.addEventListener(eslEventListener); - c.setEventSubscriptions( "plain", "all" ); - c.addEventFilter( EVENT_NAME, "heartbeat" ); - c.addEventFilter( EVENT_NAME, "custom" ); - c.addEventFilter( EVENT_NAME, "background_job" ); - subscribed = true; - } - } - } catch (InboundConnectionFailure e) { - System.out.println("Failed to connect to ESL"); - } - } - - public void start() { - System.out.println("Starting FreeSWITCH ESL connection manager."); - ConnectThread connector = new ConnectThread(); - connectTask = (ScheduledFuture) connExec.scheduleAtFixedRate(connector, 5, 5, TimeUnit.SECONDS); - } - - public void stop() { - if (connectTask != null) { - connectTask.cancel(true); - } - } - - private class ConnectThread implements Runnable { - public void run() { - connect(); - } - } - - - public void broadcast(BroadcastConferenceCommand rcc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); - rcc.handleResponse(response, conferenceEventListener); - } - } - - public void getUsers(PopulateRoomCommand prc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); - prc.handleResponse(response, conferenceEventListener); - } - } - - public void mute(MuteParticipantCommand mpc) { - System.out.println("Got mute request from FSApplication."); - Client c = manager.getESLClient(); - if (c.canSend()) { - System.out.println("Issuing command to FS ESL."); - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void eject(EjectParticipantCommand mpc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void ejectAll(EjectAllUsersCommand mpc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); - } - } - - public void record(RecordConferenceCommand rcc) { - Client c = manager.getESLClient(); - if (c.canSend()) { - EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); - rcc.handleResponse(response, conferenceEventListener); - } - } - - public void setManagerConnection(ManagerConnection manager) { - this.manager = manager; - } - - public void setESLEventListener(ESLEventListener listener) { - this.eslEventListener = listener; - } - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java deleted file mode 100755 index 1bfd7c249a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.bigbluebutton.freeswitch.voice.freeswitch; - - -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; -import org.freeswitch.esl.client.IEslEventListener; -import org.freeswitch.esl.client.transport.event.EslEvent; -import org.jboss.netty.channel.ExceptionEvent; - -public class ESLEventListener implements IEslEventListener { - - private static final String START_TALKING_EVENT = "start-talking"; - private static final String STOP_TALKING_EVENT = "stop-talking"; - private static final String START_RECORDING_EVENT = "start-recording"; - private static final String STOP_RECORDING_EVENT = "stop-recording"; - - private ConferenceEventListener conferenceEventListener; - - @Override - public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { - //Ignored, Noop - } - - @Override - public void backgroundJobResultReceived(EslEvent event) { - System.out.println( "Background job result received [" + event + "]"); - } - - @Override - public void exceptionCaught(ExceptionEvent e) { -// setChanged(); -// notifyObservers(e); - } - - private static final Pattern GLOBAL_AUDION_PATTERN = Pattern.compile("(GLOBAL_AUDIO)_(.*)$"); - private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); - - @Override - public void conferenceEventJoin(String uniqueId, String confName, int confSize, EslEvent event) { - - Integer memberId = this.getMemberIdFromEvent(event); - Map headers = event.getEventHeaders(); - String callerId = this.getCallerIdFromEvent(event); - String callerIdName = this.getCallerIdNameFromEvent(event); - boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue - boolean speaking = headers.get("Talking").equals("true") ? true : false; - - String voiceUserId = callerIdName; - - System.out.println("User joined voice conference, user=[" + callerIdName + "], conf=[" + confName + "]"); - - Matcher gapMatcher = GLOBAL_AUDION_PATTERN.matcher(callerIdName); - if (gapMatcher.matches()) { - System.out.println("Ignoring GLOBAL AUDIO USER [" + callerIdName + "]"); - return; - } - - Matcher matcher = CALLERNAME_PATTERN.matcher(callerIdName); - if (matcher.matches()) { - voiceUserId = matcher.group(1).trim(); - callerIdName = matcher.group(2).trim(); - } - - VoiceUserJoinedEvent pj = new VoiceUserJoinedEvent(voiceUserId, memberId.toString(), confName, callerId, callerIdName, muted, speaking); - conferenceEventListener.handleConferenceEvent(pj); - } - - @Override - public void conferenceEventLeave(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("User left voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserLeftEvent pl = new VoiceUserLeftEvent(memberId.toString(), confName); - conferenceEventListener.handleConferenceEvent(pl); - } - - @Override - public void conferenceEventMute(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("******************** Received Conference Muted Event from FreeSWITCH user[" + memberId.toString() + "]"); - System.out.println("User muted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, true); - conferenceEventListener.handleConferenceEvent(pm); - } - - @Override - public void conferenceEventUnMute(String uniqueId, String confName, int confSize, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - System.out.println("******************** Received ConferenceUnmuted Event from FreeSWITCH user[" + memberId.toString() + "]"); - System.out.println("User unmuted voice conference, user=[" + memberId.toString() + "], conf=[" + confName + "]"); - VoiceUserMutedEvent pm = new VoiceUserMutedEvent(memberId.toString(), confName, false); - conferenceEventListener.handleConferenceEvent(pm); - } - - @Override - public void conferenceEventAction(String uniqueId, String confName, int confSize, String action, EslEvent event) { - Integer memberId = this.getMemberIdFromEvent(event); - VoiceUserTalkingEvent pt; - - System.out.println("******************** Receive conference Action [" + action + "]"); - - if (action == null) { - return; - } - - if (action.equals(START_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, true); - conferenceEventListener.handleConferenceEvent(pt); - } else if (action.equals(STOP_TALKING_EVENT)) { - pt = new VoiceUserTalkingEvent(memberId.toString(), confName, false); - conferenceEventListener.handleConferenceEvent(pt); - } else { - System.out.println("Unknown conference Action [" + action + "]"); - } - } - - @Override - public void conferenceEventTransfer(String uniqueId, String confName, int confSize, EslEvent event) { - //Ignored, Noop - } - - @Override - public void conferenceEventThreadRun(String uniqueId, String confName, int confSize, EslEvent event) { - - } - - //@Override - public void conferenceEventRecord(String uniqueId, String confName, int confSize, EslEvent event) { - String action = event.getEventHeaders().get("Action"); - - if(action == null) { - return; - } - - System.out.println("Handling conferenceEventRecord " + action); - - if (action.equals(START_RECORDING_EVENT)) { - VoiceStartRecordingEvent sre = new VoiceStartRecordingEvent(confName, true); - sre.setRecordingFilename(getRecordFilenameFromEvent(event)); - sre.setTimestamp(genTimestamp().toString()); - - System.out.println("Voice conference recording started. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); - - conferenceEventListener.handleConferenceEvent(sre); - } else if (action.equals(STOP_RECORDING_EVENT)) { - VoiceStartRecordingEvent srev = new VoiceStartRecordingEvent(confName, false); - srev.setRecordingFilename(getRecordFilenameFromEvent(event)); - srev.setTimestamp(genTimestamp().toString()); - - System.out.println("Voice conference recording stopped. file=[" + getRecordFilenameFromEvent(event) + "], conf=[" + confName + "]"); - conferenceEventListener.handleConferenceEvent(srev); - } else { - System.out.println("Processing UNKNOWN conference Action " + action + "]"); - } - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void eventReceived(EslEvent event) { - System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]"); -// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) { -//// setChanged(); -// notifyObservers(event); -// return; -// } - } - - private Integer getMemberIdFromEvent(EslEvent e) { - return new Integer(e.getEventHeaders().get("Member-ID")); - } - - private String getCallerIdFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Number"); - } - - private String getCallerIdNameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Name"); - } - - private String getRecordFilenameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Path"); - } - - /*private String getRecordTimestampFromEvent(EslEvent e) { - return e.getEventHeaders().get("Event-Date-Timestamp"); - }*/ - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java deleted file mode 100755 index 3a31fe7ba3..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java +++ /dev/null @@ -1,203 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch; - -import java.io.File; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.freeswitch.voice.ConferenceServiceProvider; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.FreeswitchCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; - -public class FreeswitchApplication implements ConferenceServiceProvider { - - private static final int SENDERTHREADS = 1; - private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); - private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); - private BlockingQueue messages = new LinkedBlockingQueue(); - private ConnectionManager manager; - - private String icecastProtocol = "shout"; - private String icecastHost = "localhost"; - private int icecastPort = 8000; - private String icecastUsername = "source"; - private String icecastPassword = "hackme"; - private String icecastStreamExtension = ".mp3"; - private Boolean icecastBroadcast = false; - - private final String USER = "0"; /* not used for now */ - - private volatile boolean sendMessages = false; - - private void queueMessage(FreeswitchCommand command) { - try { - messages.offer(command, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public void populateRoom(String room) { - PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); - queueMessage(prc); - } - - public void mute(String room, String participant, Boolean mute) { - MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); - queueMessage(mpc); - } - - public void eject(String room, String participant) { - EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); - queueMessage(mpc); - } - - @Override - public void ejectAll(String room) { - EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); - queueMessage(mpc); - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void record(String room, String meetingid){ - String RECORD_DIR = "/var/freeswitch/meetings"; - String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; - - RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); - queueMessage(rcc); - } - - @Override - public void broadcast(String room, String meetingid) { - if (icecastBroadcast) { - broadcastToIcecast(room, meetingid); - } - } - - private void broadcastToIcecast(String room, String meetingid) { - String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort - + File.separatorChar + meetingid + "." + icecastStreamExtension; - - BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); - queueMessage(rcc); - } - - public void setConnectionManager(ConnectionManager manager) { - this.manager = manager; - } - - public void setIcecastProtocol(String protocol) { - icecastProtocol = protocol; - } - - public void setIcecastHost(String host) { - icecastHost = host; - } - - public void setIcecastPort(int port) { - icecastPort = port; - } - - public void setIcecastUsername(String username) { - icecastUsername = username; - } - - public void setIcecastPassword(String password) { - icecastPassword = password; - } - - public void setIcecastBroadcast(Boolean broadcast) { - icecastBroadcast = broadcast; - } - - public void setIcecastStreamExtension(String ext) { - icecastStreamExtension = ext; - } - - private void sendMessageToFreeswitch(final FreeswitchCommand command) { - Runnable task = new Runnable() { - public void run() { - if (command instanceof PopulateRoomCommand) { - PopulateRoomCommand cmd = (PopulateRoomCommand) command; - System.out.println("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); - manager.getUsers(cmd); - } else if (command instanceof MuteParticipantCommand) { - MuteParticipantCommand cmd = (MuteParticipantCommand) command; - System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.mute(cmd); - } else if (command instanceof EjectParticipantCommand) { - EjectParticipantCommand cmd = (EjectParticipantCommand) command; - System.out.println("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.eject(cmd); - } else if (command instanceof EjectAllUsersCommand) { - EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; - System.out.println("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); - manager.ejectAll(cmd); - } else if (command instanceof RecordConferenceCommand) { - manager.record((RecordConferenceCommand) command); - } else if (command instanceof BroadcastConferenceCommand) { - manager.broadcast((BroadcastConferenceCommand) command); - } - } - }; - - runExec.execute(task); - } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - FreeswitchCommand message; - try { - message = messages.take(); - sendMessageToFreeswitch(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - } - }; - msgSenderExec.execute(sender); - } - - public void stop() { - sendMessages = false; - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java deleted file mode 100755 index 45ef88764f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/BroadcastConferenceCommand.java +++ /dev/null @@ -1,50 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.freeswitch.esl.client.transport.message.EslMessage; - -public class BroadcastConferenceCommand extends FreeswitchCommand { - private boolean record; - private String icecastPath; - - public BroadcastConferenceCommand(String room, String requesterId, boolean record, String icecastPath){ - super(room, requesterId); - this.record = record; - this.icecastPath = icecastPath; - } - - - @Override - public String getCommandArgs() { - String action = "norecord"; - if (record) - action = "record"; - - return SPACE + getRoom() + SPACE + action + SPACE + icecastPath; - } - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java deleted file mode 100755 index 4c24b28758..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectAllUsersCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -public class EjectAllUsersCommand extends FreeswitchCommand { - - public EjectAllUsersCommand(String room, String requesterId) { - super(room, requesterId); - } - - @Override - public String getCommandArgs() { - return room + " kick all"; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java deleted file mode 100755 index e46deef3e4..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -public class EjectParticipantCommand extends FreeswitchCommand { - - private final String participant; - - public EjectParticipantCommand(String room, String participant, String requesterId) { - super(room, requesterId); - this.participant = participant; - } - - @Override - public String getCommandArgs() { - return room + " kick " + participant; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java deleted file mode 100755 index 4efd29f95e..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/FreeswitchCommand.java +++ /dev/null @@ -1,45 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -public abstract class FreeswitchCommand { - public static final String SPACE = " "; - - protected final String room; - protected final String requesterId; - - public FreeswitchCommand(String room, String requesterId) { - this.room = room; - this.requesterId = requesterId; - } - - public String getCommand() { - return "conference"; //conference is default, override if needed. - } - - public abstract String getCommandArgs(); - - public String getRoom() { - return room; - } - - public String getRequesterId() { - return requesterId; - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java deleted file mode 100755 index fdd7b343eb..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java +++ /dev/null @@ -1,40 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -public class MuteParticipantCommand extends FreeswitchCommand { - - private final String participant; - private final Boolean mute; - - public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { - super(room, requesterId); - this.participant = participant; - this.mute = mute; - } - - @Override - public String getCommandArgs() { - String action = "unmute"; - if (mute) action = "mute"; - - return room + SPACE + action + SPACE + participant; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java deleted file mode 100755 index 03f7a32296..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java +++ /dev/null @@ -1,115 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -import org.freeswitch.esl.client.transport.message.EslMessage; -import org.apache.commons.lang3.StringUtils; -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.freeswitch.voice.freeswitch.response.ConferenceMember; -import org.bigbluebutton.freeswitch.voice.freeswitch.response.XMLResponseConferenceListParser; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.xml.sax.SAXException; - -public class PopulateRoomCommand extends FreeswitchCommand { - - public PopulateRoomCommand(String room, String requesterId) { - super(room, requesterId); - } - - @Override - public String getCommandArgs() { - return getRoom() + SPACE + "xml_list"; - } - - private static final Pattern CALLERNAME_PATTERN = Pattern.compile("(.*)-bbbID-(.*)$"); - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - String firstLine = response.getBodyLines().get(0); - - //E.g. Conference 85115 not found - - if(!firstLine.startsWith(". -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.actions; - -import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; -import org.freeswitch.esl.client.transport.message.EslMessage; - -public class RecordConferenceCommand extends FreeswitchCommand { - - private boolean record; - private String recordPath; - - public RecordConferenceCommand(String room, String requesterId, boolean record, String recordPath){ - super(room, requesterId); - this.record = record; - this.recordPath = recordPath; - } - - - @Override - public String getCommandArgs() { - String action = "norecord"; - if (record) - action = "record"; - - return SPACE + getRoom() + SPACE + action + SPACE + recordPath; - } - - public void handleResponse(EslMessage response, ConferenceEventListener eventListener) { - - //Test for Known Conference - - } -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java deleted file mode 100755 index 915a265217..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMember.java +++ /dev/null @@ -1,88 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.freeswitch.voice.freeswitch.response; - -/** - * - * @author leif - */ -public class ConferenceMember { - - protected Integer memberId; - protected ConferenceMemberFlags flags; - protected String uuid; - protected String callerIdName; - protected String callerId; - protected Integer joinTime; - protected Integer lastTalking; - - public Integer getId() { - return memberId; - } - - public ConferenceMemberFlags getFlags() { - return flags; - } - - public String getCallerId() { - return callerId; - } - - public String getCallerIdName() { - return callerIdName; - } - - public boolean getMuted() { - return flags.getIsMuted(); - } - - public boolean getSpeaking() { - return flags.getIsSpeaking(); - } - - public void setFlags(ConferenceMemberFlags flags) { - this.flags = flags; - } - - public void setId(int parseInt) { - memberId = parseInt; - } - - public void setUUID(String tempVal) { - this.uuid = tempVal; - } - - public void setCallerIdName(String tempVal) { - this.callerIdName = tempVal; - } - - public void setCallerId(String tempVal) { - this.callerId = tempVal; - } - - public void setJoinTime(int parseInt) { - this.joinTime = parseInt; - } - - void setLastTalking(int parseInt) { - this.lastTalking = parseInt; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java deleted file mode 100755 index f571f5da4f..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/ConferenceMemberFlags.java +++ /dev/null @@ -1,54 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ - -package org.bigbluebutton.freeswitch.voice.freeswitch.response; - -/** - * - * @author leif - */ -public class ConferenceMemberFlags { - //private boolean canHear = false; - private boolean canSpeak = false; - private boolean talking = false; - //private boolean hasVideo = false; - //private boolean hasFloor = false; - //private boolean isModerator = false; - //private boolean endConference = false; - - boolean getIsSpeaking() { - return talking; - } - - boolean getIsMuted() { - if(canSpeak == true) { - return false; - } - return true; - } - - void setCanSpeak(String tempVal) { - canSpeak = tempVal.equals("true") ? true : false; - } - - void setTalking(String tempVal) { - talking = tempVal.equals("true") ? true : false; - } - -} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java deleted file mode 100755 index 397e7ce42a..0000000000 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/response/XMLResponseConferenceListParser.java +++ /dev/null @@ -1,158 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice.freeswitch.response; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * - * @author leif - */ -public class XMLResponseConferenceListParser extends DefaultHandler { - private List myConfrenceMembers; - private String tempVal; - private ConferenceMember tempMember; - private ConferenceMemberFlags tempFlags; - private String room; - private boolean inFlags = false; - - public XMLResponseConferenceListParser() { - myConfrenceMembers = new ArrayList(); - } - - public String getConferenceRoom() { - return room; - } - - public void printConferneceMemebers() { - Iterator it = myConfrenceMembers.iterator(); - while(it.hasNext()) { - - } - } - - public List getConferenceList() { - return myConfrenceMembers; - } - - /* - - - - - - 6 - - true - true - false - false - true - false - false - - 3a16f061-0df6-45d5-b401-d8e977e08a5c - 1001 - 1001 - 65 - 4 - - - - - - */ - - - //SAX Event Handlers - @Override - public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { - //reset - inFlags = false; - tempVal = ""; - if(qName.equalsIgnoreCase("member")) { - //create a new instance of ConferenceMember - tempMember = new ConferenceMember(); - } - - if(qName.equalsIgnoreCase("flags")) { - //create a new instance of ConferenceMember - tempFlags = new ConferenceMemberFlags(); - inFlags = true; - } - - if(qName.equalsIgnoreCase("conference")) { - room = attributes.getValue("name"); - } - } - - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - tempVal = new String(ch,start,length); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - - if(qName.equalsIgnoreCase("member")) { - //add it to the list - myConfrenceMembers.add(tempMember); - }else if(qName.equalsIgnoreCase("flags")) { - tempMember.setFlags(tempFlags); - inFlags = false; - }else if(inFlags) { - if (qName.equalsIgnoreCase("can_speak")) { - tempFlags.setCanSpeak(tempVal); - }else if (qName.equalsIgnoreCase("talking")) { - tempFlags.setTalking(tempVal); - } - }else if (qName.equalsIgnoreCase("id")) { - try { - tempMember.setId(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { - - } - }else if (qName.equalsIgnoreCase("uuid")) { - tempMember.setUUID(tempVal); - }else if (qName.equalsIgnoreCase("caller_id_name")) { - tempMember.setCallerIdName(tempVal); - }else if (qName.equalsIgnoreCase("caller_id_number")) { - tempMember.setCallerId(tempVal); - }else if (qName.equalsIgnoreCase("join_time")) { - try { - tempMember.setJoinTime(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { - - } - }else if (qName.equalsIgnoreCase("last_talking")) { - try { - tempMember.setLastTalking(Integer.parseInt(tempVal)); - } catch(NumberFormatException nfe) { - - } - } - - } -} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala new file mode 100644 index 0000000000..17d146942a --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala @@ -0,0 +1,45 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import redis.RedisClient +import scala.concurrent.duration._ +import scala.concurrent.ExecutionContext.Implicits.global +import akka.actor.ActorSystem +import scala.concurrent.Await +import akka.actor.Actor +import org.bigbluebutton.SystemConfiguration + +object AppsRedisPublisherActor extends SystemConfiguration { + + val channels = Seq("time") + val patterns = Seq("pattern.*") + + def props(system: ActorSystem): Props = + Props(classOf[AppsRedisPublisherActor], + system, redisHost, redisPort) +} + +class AppsRedisPublisherActor(val system: ActorSystem, + val host: String, val port: Int) extends Actor { + + val redis = RedisClient(host, port)(system) + + val futurePong = redis.ping() + println("Ping sent!") + futurePong.map(pong => { + println(s"Redis replied with a $pong") + }) + + Await.result(futurePong, 5 seconds) + + def publish(channel: String, msg: String) { + println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") + // redis.publish("time", System.currentTimeMillis()) + } + + def receive = { + //case msg: JsonMessage => publish(msg.channel, msg.message) + case msg: String => println("PUBLISH TO [channel]: \n [" + msg + "]") + } + +} diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala new file mode 100644 index 0000000000..24424bc00e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -0,0 +1,41 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import java.net.InetSocketAddress +import redis.actors.RedisSubscriberActor +import redis.api.pubsub.{ PMessage, Message } +import scala.concurrent.duration._ +import akka.actor.ActorRef +import akka.actor.actorRef2Scala +import org.bigbluebutton.SystemConfiguration + +object AppsRedisSubscriberActor extends SystemConfiguration { + + val channels = Seq("time") + val patterns = Seq("pattern.*") + + def props(bbbAppsActor: ActorRef): Props = + Props(classOf[AppsRedisSubscriberActor], + bbbAppsActor, redisHost, redisPort, channels, patterns). + withDispatcher("rediscala.rediscala-client-worker-dispatcher") +} + +class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, + redisPort: Int, + channels: Seq[String] = Nil, patterns: Seq[String] = Nil) + extends RedisSubscriberActor( + new InetSocketAddress(redisHost, redisPort), + channels, patterns) { + + def onMessage(message: Message) { + log.debug(s"message received: $message") + } + + def onPMessage(pmessage: PMessage) { + log.debug(s"pattern message received: $pmessage") + } + + def handleMessage(msg: String) { + log.warning("**** TODO: Handle pubsub messages. ****") + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala new file mode 100644 index 0000000000..336601f401 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala @@ -0,0 +1,3 @@ +package org.bigbluebutton.endpoint.redis + +case class JsonMessage(channel: String, message: String) \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala new file mode 100644 index 0000000000..22bea5fde4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala @@ -0,0 +1,39 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import java.net.InetSocketAddress +import redis.actors.RedisSubscriberActor +import redis.api.pubsub.{ PMessage, Message } +import redis.RedisClient +import scala.concurrent.duration._ +import scala.concurrent.ExecutionContext.Implicits.global + +class RedisPubSubActor { + implicit val akkaSystem = akka.actor.ActorSystem() + + val redis = RedisClient() + + // publish after 2 seconds every 2 or 5 seconds + akkaSystem.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) + akkaSystem.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("pattern.match", "pattern value")) + // shutdown Akka in 20 seconds + akkaSystem.scheduler.scheduleOnce(20 seconds)(akkaSystem.shutdown()) + + val channels = Seq("time") + val patterns = Seq("pattern.*") + // create SubscribeActor instance + akkaSystem.actorOf(Props(classOf[SubscribeActor], channels, patterns).withDispatcher("rediscala.rediscala-client-worker-dispatcher")) + +} + +class SubscribeActor(channels: Seq[String] = Nil, patterns: Seq[String] = Nil) + extends RedisSubscriberActor(new InetSocketAddress("localhost", 6379), channels, patterns) { + + def onMessage(message: Message) { + println(s"message received: $message") + } + + def onPMessage(pmessage: PMessage) { + println(s"pattern message received: $pmessage") + } +} \ No newline at end of file From 29d55fcec18ee133da59f433b5da7f0c316bb3ef Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 20:44:39 +0000 Subject: [PATCH 20/30] - remove fs-esl --- .../recorder/voice/VoiceEventRecorder.java | 15 +- .../voice/events/ConferenceEventListener.java | 2 +- .../voice/events/UnknownConferenceEvent.java | 2 +- .../voice/events/VoiceConferenceEvent.java | 2 +- .../events/VoiceStartRecordingEvent.java | 2 +- .../voice/events/VoiceUserJoinedEvent.java | 2 +- .../voice/events/VoiceUserLeftEvent.java | 2 +- .../voice/events/VoiceUserLockedEvent.java | 2 +- .../voice/events/VoiceUserMutedEvent.java | 2 +- .../voice/events/VoiceUserTalkingEvent.java | 2 +- .../core/voice/VoiceConferenceActor.scala | 14 - .../core/voice/VoiceConferenceService.scala | 19 -- .../voice/freeswitch/HeartbeatMonitor.scala | 5 - .../freeswitch/FreeswitchConference.scala | 54 ---- .../FreeswitchConferenceActor.scala | 248 ------------------ .../FreeswitchConferenceService.scala | 123 --------- .../freeswitch/FreeswitchManagerProxy.scala | 32 --- .../freeswitch/FsInGwWrapper.scala | 12 - 18 files changed, 17 insertions(+), 523 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/ConferenceEventListener.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/UnknownConferenceEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceConferenceEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceStartRecordingEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceUserJoinedEvent.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceUserLeftEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceUserLockedEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceUserMutedEvent.java (92%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/{freeswitch => core}/voice/events/VoiceUserTalkingEvent.java (93%) delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java index 0e85a4d0fe..2867aa2dd5 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/recorder/voice/VoiceEventRecorder.java @@ -19,14 +19,15 @@ package org.bigbluebutton.core.service.recorder.voice; import java.util.concurrent.TimeUnit; + import org.bigbluebutton.core.service.recorder.RecorderApplication; -import org.bigbluebutton.freeswitch.voice.events.VoiceConferenceEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceStartRecordingEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserJoinedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserLeftEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserLockedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserMutedEvent; -import org.bigbluebutton.freeswitch.voice.events.VoiceUserTalkingEvent; +import org.bigbluebutton.core.voice.events.VoiceConferenceEvent; +import org.bigbluebutton.core.voice.events.VoiceStartRecordingEvent; +import org.bigbluebutton.core.voice.events.VoiceUserJoinedEvent; +import org.bigbluebutton.core.voice.events.VoiceUserLeftEvent; +import org.bigbluebutton.core.voice.events.VoiceUserLockedEvent; +import org.bigbluebutton.core.voice.events.VoiceUserMutedEvent; +import org.bigbluebutton.core.voice.events.VoiceUserTalkingEvent; public class VoiceEventRecorder { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/ConferenceEventListener.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/ConferenceEventListener.java index f277d8c4eb..f881e3dc9e 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/ConferenceEventListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/ConferenceEventListener.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public interface ConferenceEventListener { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/UnknownConferenceEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/UnknownConferenceEvent.java index af959fad11..f08352d57d 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/UnknownConferenceEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/UnknownConferenceEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class UnknownConferenceEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceConferenceEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceConferenceEvent.java index cf8bd96cfb..1a25b882e6 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceConferenceEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceConferenceEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public abstract class VoiceConferenceEvent { private final String room; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceStartRecordingEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceStartRecordingEvent.java index 91bbc1dbab..b786b612e6 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceStartRecordingEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceStartRecordingEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class VoiceStartRecordingEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserJoinedEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserJoinedEvent.java index 29dd0c8661..5f90a1737a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserJoinedEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserJoinedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class VoiceUserJoinedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLeftEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLeftEvent.java index 7591db0153..9b164e5e49 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLeftEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLeftEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class VoiceUserLeftEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLockedEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLockedEvent.java index 0cfc456dfe..ae1d6dbe00 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserLockedEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserLockedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class VoiceUserLockedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserMutedEvent.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserMutedEvent.java index 003493b0f9..29542f13e9 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserMutedEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserMutedEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class VoiceUserMutedEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserTalkingEvent.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserTalkingEvent.java index 5bd778062e..65e56591c5 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/freeswitch/voice/events/VoiceUserTalkingEvent.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/voice/events/VoiceUserTalkingEvent.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.freeswitch.voice.events; +package org.bigbluebutton.core.voice.events; public class VoiceUserTalkingEvent extends VoiceConferenceEvent { diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala deleted file mode 100755 index 81c8cc3513..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceActor.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.bigbluebutton.core.voice - -import akka.actor._ -import akka.actor.ActorLogging - -case class MuteAllUsers(meetingId: String, except: Option[Seq[String]]) -case class MuteUser(meetingId: String, userId: String) -case class UnmuteUser(meetingId: String, userId: String) -case class EjectVoiceUser(meetingId: String, userId: String) - -class VoiceConferenceActor(val meetingId: String, - val voiceConf: String) { //extends Actor { - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala deleted file mode 100755 index f2121ff9f6..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/VoiceConferenceService.scala +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.core.voice - -import org.bigbluebutton.core.api._ -import org.bigbluebutton.freeswitch.FreeswitchManagerProxy - -class VoiceConferenceService(fsproxy: FreeswitchManagerProxy, - bbbInGW: IBigBlueButtonInGW) - extends OutMessageListener2 { - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - } - } - - private def handleMeetingCreated(msg: MeetingCreated) { - - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala deleted file mode 100755 index 7beaddb032..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.voice.freeswitch - -class HeartbeatMonitor() { - -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala deleted file mode 100755 index 47b35daae4..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.util._ - -class FreeswitchConference(val conferenceNum: String, - val meetingId: String, - val recorded: Boolean) { - - private var users = new scala.collection.immutable.HashMap[String, UserVO] - - private var recording: Boolean = false - - def addUser(user: UserVO) { - users += user.userID -> user - } - - def removeUser(user: UserVO) { - users -= user.userID - } - - def getWebUserUsingExtId(webUserId: String): Option[UserVO] = { - users.values find { u => - (u.externUserID == webUserId) - } - } - - def getWebUser(webUserId: String): Option[UserVO] = { - users.values find (u => (u.userID == webUserId)) - } - - def getVoiceUser(voiceUserId: String): Option[UserVO] = { - users.values find (u => u.voiceUser.userId == voiceUserId) - } - - def numUsersInVoiceConference: Int = { - val joinedUsers = users.values filter (u => u.voiceUser.joined) - joinedUsers.size - } - - def numUsers = users.size - - def recordingStarted() { - recording = true; - } - - def recordingStopped() { - recording = false - } - - def isRecording(): Boolean = { - recording - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala deleted file mode 100755 index c10bdd52b1..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala +++ /dev/null @@ -1,248 +0,0 @@ -package org.bigbluebutton.freeswitch - -import akka.actor._ -import akka.actor.ActorLogging -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.util._ - -case class FsVoiceUserJoined(userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, muted: Boolean, - speaking: Boolean) - -case class FsVoiceUserLeft(userId: String, conference: String) -case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) -case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) -case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) -case class FsRecording(conference: String, recordingFile: String, - timestamp: String, recording: Boolean) - -object FreeswitchConferenceActor { - def props(system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW): Props = - Props(classOf[FreeswitchConferenceActor], system, fsproxy, bbbInGW) -} - -class FreeswitchConferenceActor(val system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW) extends Actor with ActorLogging { - - private var confs = new scala.collection.immutable.HashMap[String, FreeswitchConference] - - def receive = { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: FsRecording => handleFsRecording(msg) - case msg: FsVoiceUserJoined => handleFsVoiceUserJoined(msg) - case msg: FsVoiceUserLeft => handleFsVoiceUserLeft(msg) - case msg: FsVoiceUserLocked => handleFsVoiceUserLocked(msg) - case msg: FsVoiceUserMuted => handleFsVoiceUserMuted(msg) - case msg: FsVoiceUserTalking => handleFsVoiceUserTalking(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) - case _ => // do nothing - } - - private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - fsproxy.ejectUsers(fc.conferenceNum) - }) - } - - private def handleMeetingCreated(msg: MeetingCreated) { - if (!confs.contains(msg.meetingID)) { - log.info("Meeting created [" + msg.meetingID + "] with voice conf [" + msg.voiceBridge + "]") - val fsconf = new FreeswitchConference(msg.voiceBridge, - msg.meetingID, - msg.recorded) - confs += fsconf.meetingId -> fsconf - } - - fsproxy.getUsers(msg.voiceBridge) - } - - private def handleMeetingEnded(msg: MeetingEnded) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Meeting ended [" + msg.meetingID + "]") - fsproxy.ejectUsers(fc.conferenceNum) - confs -= fc.meetingId - }) - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Meeting destroyed [" + msg.meetingID + "]") - fsproxy.ejectUsers(fc.conferenceNum) - confs -= fc.meetingId - }) - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach { fc => - log.info("Web user has joined voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") - fc.addUser(msg.user) - if (fc.numUsersInVoiceConference == 1 && fc.recorded) { - log.info("Meeting is recorded. Tell FreeSWITCH to start recording. mid[" + fc.meetingId + "]") - fsproxy.startRecording(fc.conferenceNum, fc.meetingId) - } - } - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - // println("FreeswitchConferenceActor - handleUserLeftVoice mid=[" + msg.meetingID + "]") - - fsconf foreach { fc => - fc.addUser(msg.user) - log.info("Web user has left voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") - if (fc.numUsersInVoiceConference == 0 && fc.recorded) { - log.info("Meeting is recorded. No more users in voice conference. Tell FreeSWITCH to stop recording. mid[" + fc.meetingId + "]") - fsproxy.stopRecording(fc.conferenceNum) - } - } - } - - private def handleUserJoined(msg: UserJoined) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Web user id joining meeting id[" + fc.meetingId + "] wid=[" + msg.user.userID + "], extId=[" + msg.user.externUserID + "]") - fc.addUser(msg.user) - }) - } - - private def handleUserLeft(msg: UserLeft) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - fc.removeUser(msg.user) - }) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - log.debug("Mute user request for wid[" + msg.userId + "] mute=[" + msg.mute + "]") - fsconf foreach (fc => { - val user = fc.getWebUser(msg.userId) - user foreach (u => { - log.debug("Muting user wid[" + msg.userId + "] mute=[" + msg.mute + "]") - fsproxy.muteUser(fc.conferenceNum, u.voiceUser.userId, msg.mute) - }) - }) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - val user = fc.getWebUser(msg.userId) - user foreach (u => { - fsproxy.ejectUser(fc.conferenceNum, u.voiceUser.userId) - }) - }) - } - - private def handleStartRecording(msg: StartRecording) { - - } - - private def handleStopRecording(msg: StopRecording) { - - } - - private def handleFsRecording(msg: FsRecording) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - fsconf foreach { fc => - // Need to filter recording events here to not have duplicate events - if (!fc.isRecording && msg.recording) { - // - fc.recordingStarted - bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) - } else if (fc.isRecording && !msg.recording) { - fc.recordingStopped - bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) - } - } - } - - private def sendNonWebUserJoined(meetingId: String, webUserId: String, msg: FsVoiceUserJoined) { - bbbInGW.voiceUserJoined(meetingId, msg.userId, - webUserId, msg.conference, msg.callerIdNum, msg.callerIdName, - msg.muted, msg.speaking) - } - - private def handleFsVoiceUserJoined(msg: FsVoiceUserJoined) { - log.info("A user has joined the voice conference [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - log.debug("Meeting [" + fc.meetingId + "] has [" + fc.numUsers + "]") - fc.getWebUserUsingExtId(msg.webUserId) match { - case Some(user) => { - log.info("The user is also in the web client. [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - sendNonWebUserJoined(fc.meetingId, user.userID, msg) - } - case None => { - log.info("User is not a web user. Must be a phone caller. [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - sendNonWebUserJoined(fc.meetingId, msg.userId, msg) - } - } - }) - } - - private def handleFsVoiceUserLeft(msg: FsVoiceUserLeft) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - user foreach (u => bbbInGW.voiceUserLeft(fc.meetingId, u.userID)) - }) - } - - private def handleFsVoiceUserLocked(msg: FsVoiceUserLocked) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - user foreach (u => bbbInGW.voiceUserLocked(fc.meetingId, u.userID, msg.locked)) - }) - } - - private def handleFsVoiceUserMuted(msg: FsVoiceUserMuted) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - // println("Rx voice user muted for cnum=[" + msg.conference + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - // println("Rx voice user muted for mid=[" + fc.meetingId + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") - user foreach (u => bbbInGW.voiceUserMuted(fc.meetingId, u.userID, msg.muted)) - }) - } - - private def handleFsVoiceUserTalking(msg: FsVoiceUserTalking) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - // println("Rx voice user talking for vid[" + msg.userId + "] mute=[" + msg.talking + "]") - user foreach (u => bbbInGW.voiceUserTalking(fc.meetingId, u.userID, msg.talking)) - }) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala deleted file mode 100755 index 4761993aa0..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala +++ /dev/null @@ -1,123 +0,0 @@ -package org.bigbluebutton.freeswitch - -import akka.actor.{ ActorSystem, Props } -import org.bigbluebutton.webconference.voice.IVoiceConferenceService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.webconference.voice.FreeswitchConferenceEventListener -import akka.actor.ActorRef - -class FreeswitchConferenceService(fsproxy: FreeswitchManagerProxy, - fsListener: FreeswitchConferenceEventListener) - extends IVoiceConferenceService - with OutMessageListener2 { - - fsListener.setVoiceConferenceService(this) - - implicit val system = ActorSystem("bigbluebutton-apps-fsesl") - - var bbbInGW: IBigBlueButtonInGW = _ - var fsActor: ActorRef = _ - - def setIBigBlueButtonInGW(inGW: IBigBlueButtonInGW) { - bbbInGW = inGW - fsActor = system.actorOf( - FreeswitchConferenceActor.props(system, fsproxy, bbbInGW), - "bigbluebutton-fs-actor") - } - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) - case _ => // do nothing - } - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - fsActor ! msg - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - fsActor ! msg - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - fsActor ! msg - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - fsActor ! msg - } - - private def handleUserLeft(msg: UserLeft) { - fsActor ! msg - } - - private def handleUserJoined(msg: UserJoined) { - fsActor ! msg - } - - private def handleMeetingCreated(msg: MeetingCreated) { - fsActor ! msg - } - - private def handleMeetingEnded(msg: MeetingEnded) { - fsActor ! msg - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - fsActor ! msg - } - - private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { - fsActor ! msg - } - - def voiceStartedRecording(conference: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) - fsActor ! fsRec - } - - def voiceUserJoined(userId: String, webUserId: String, conference: String, - callerIdNum: String, callerIdName: String, - muted: java.lang.Boolean, talking: java.lang.Boolean) { - // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") - val vuj = new FsVoiceUserJoined(userId, webUserId, - conference, callerIdNum, - callerIdName, muted, - talking) - fsActor ! vuj - } - - def voiceUserLeft(userId: String, conference: String) { - // println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") - val vul = new FsVoiceUserLeft(userId, conference) - fsActor ! vul - } - - def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { - val vul = new FsVoiceUserLocked(userId, conference, locked) - fsActor ! vul - } - - def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") - val vum = new FsVoiceUserMuted(userId, conference, muted) - fsActor ! vum - } - - def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") - val vut = new FsVoiceUserTalking(userId, conference, talking) - fsActor ! vut - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala deleted file mode 100755 index 993e77f699..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.webconference.voice.freeswitch.FreeswitchApplication - -class FreeswitchManagerProxy(fsApp: FreeswitchApplication) { - - def getUsers(conference: String) { - fsApp.populateRoom(conference) - } - - def ejectUsers(conference: String) { - fsApp.ejectAll(conference) - } - - def muteUser(conference: String, userId: String, mute: Boolean) { - println("Forwarding mute request to fsApp") - fsApp.mute(conference, userId, mute) - } - - def ejectUser(conference: String, userId: String) { - println("Forwarding eject user request to fsApp") - fsApp.eject(conference, userId) - } - - def startRecording(conference: String, meetingId: String) { - fsApp.record(conference, meetingId) - } - - def stopRecording(conference: String) { - - } -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala deleted file mode 100755 index 60f07a7211..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.core.api.IBigBlueButtonInGW - -/** - * Workaround to get away from circular dependency injection. - */ -class FsInGwWrapper(inGW: IBigBlueButtonInGW, - fsConfService: FreeswitchConferenceService) { - - fsConfService.setIBigBlueButtonInGW(inGW) -} \ No newline at end of file From f6b35ef6b5979a9fbbb2a1d2850b3f0b132a77cf Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 20:55:39 +0000 Subject: [PATCH 21/30] - restructure message receivers --- .../chat => pubsub/receivers}/ChatMessageListener.java | 2 +- .../receivers}/ConversionUpdatesProcessor.java | 2 +- .../lock => pubsub/receivers}/LockMessageListener.java | 2 +- .../receivers}/ParticipantsListener.java | 2 +- .../receivers}/PresentationMessageListener.java | 2 +- .../receivers}/PreuploadedPresentation.java | 2 +- .../receivers}/PreuploadedPresentationsUtil.java | 2 +- .../voice => pubsub/receivers}/VoiceMessageListener.java | 4 +++- .../whiteboard => pubsub/receivers}/WhiteboardListener.java | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/chat => pubsub/receivers}/ChatMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/presentation => pubsub/receivers}/ConversionUpdatesProcessor.java (95%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/lock => pubsub/receivers}/LockMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/participants => pubsub/receivers}/ParticipantsListener.java (99%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/presentation => pubsub/receivers}/PresentationMessageListener.java (97%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/presentation => pubsub/receivers}/PreuploadedPresentation.java (75%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/presentation => pubsub/receivers}/PreuploadedPresentationsUtil.java (93%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/voice => pubsub/receivers}/VoiceMessageListener.java (94%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/{service/whiteboard => pubsub/receivers}/WhiteboardListener.java (98%) diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageListener.java index 6451d90060..f89beee09b 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/chat/ChatMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.service.chat; +package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.GetChatHistoryRequestMessage; import org.bigbluebutton.common.messages.MessagingConstants; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java similarity index 95% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/ConversionUpdatesProcessor.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java index d0c316de32..5465832f6a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/ConversionUpdatesProcessor.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.core.service.presentation; +package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.core.api.IBigBlueButtonInGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/lock/LockMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/lock/LockMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageListener.java index 5db541774a..16d0bf3248 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/lock/LockMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.service.lock; +package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.GetLockSettingsMessage; import org.bigbluebutton.common.messages.LockUserMessage; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/participants/ParticipantsListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ParticipantsListener.java similarity index 99% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/participants/ParticipantsListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ParticipantsListener.java index 20a2ed1fb1..da6d9e6557 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/participants/ParticipantsListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ParticipantsListener.java @@ -1,5 +1,5 @@ -package org.bigbluebutton.core.service.participants; +package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.AssignPresenterRequestMessage; import org.bigbluebutton.common.messages.BroadcastLayoutRequestMessage; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java similarity index 97% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PresentationMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java index 0f75638e1c..b755e00a7f 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PresentationMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.service.presentation; +package org.bigbluebutton.core.pubsub.receivers; import java.util.HashMap; import java.util.Map; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentation.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentation.java similarity index 75% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentation.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentation.java index b254d676a6..d864921355 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentation.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentation.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.service.presentation; +package org.bigbluebutton.core.pubsub.receivers; public class PreuploadedPresentation { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentationsUtil.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentationsUtil.java similarity index 93% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentationsUtil.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentationsUtil.java index 862efba8c0..21ec40982a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/presentation/PreuploadedPresentationsUtil.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PreuploadedPresentationsUtil.java @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.service.presentation; +package org.bigbluebutton.core.pubsub.receivers; import java.io.File; import java.io.FileFilter; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageListener.java similarity index 94% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageListener.java index 79a9b71617..c0fdc74d95 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/voice/VoiceMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageListener.java @@ -1,8 +1,10 @@ -package org.bigbluebutton.core.service.voice; +package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.MessagingConstants; import org.bigbluebutton.core.api.IBigBlueButtonInGW; import org.bigbluebutton.core.pubsub.redis.MessageHandler; +import org.bigbluebutton.core.service.voice.VoiceKeyUtil; + import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardListener.java similarity index 98% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardListener.java index fa9218b38c..7aea4f92d9 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/service/whiteboard/WhiteboardListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardListener.java @@ -1,5 +1,5 @@ -package org.bigbluebutton.core.service.whiteboard; +package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.ClearWhiteboardRequestMessage; From 712499747a9f574df5f6c80a66188736164df482 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 28 May 2015 22:00:30 +0000 Subject: [PATCH 22/30] - setup redis scala --- ...Listener.java => ChatMessageReceiver.java} | 2 +- ...Listener.java => LockMessageReceiver.java} | 2 +- .../receivers/MeetingMessageReceiver.java | 117 ++++++++++++++++++ ...istener.java => UsersMessageReceiver.java} | 2 +- ...istener.java => VoiceMessageReceiver.java} | 2 +- ...er.java => WhiteboardMessageReceiver.java} | 2 +- .../src/main/resources/application.conf | 8 ++ .../main/scala/org/bigbluebutton/Boot.scala | 9 ++ ...Config.scala => SystemConfiguration.scala} | 0 .../core/BigBlueButtonActor.scala | 1 + .../core/SystemConfiguration.scala | 20 --- .../redis/AppsRedisPublisherActor.scala | 7 +- .../redis/AppsRedisSubscriberActor.scala | 8 +- 13 files changed, 150 insertions(+), 30 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/{ChatMessageListener.java => ChatMessageReceiver.java} (96%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/{LockMessageListener.java => LockMessageReceiver.java} (96%) create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/{ParticipantsListener.java => UsersMessageReceiver.java} (99%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/{VoiceMessageListener.java => VoiceMessageReceiver.java} (96%) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/{WhiteboardListener.java => WhiteboardMessageReceiver.java} (98%) mode change 100644 => 100755 labs/akka-bbb-apps/src/main/resources/application.conf rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/{SystemConfig.scala => SystemConfiguration.scala} (100%) mode change 100644 => 100755 delete mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala mode change 100644 => 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala mode change 100644 => 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java similarity index 96% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java index f89beee09b..7b778ad590 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java @@ -9,7 +9,7 @@ import com.google.gson.JsonParser; import com.google.gson.JsonObject; import org.bigbluebutton.core.api.IBigBlueButtonInGW; -public class ChatMessageListener implements MessageHandler{ +public class ChatMessageReceiver implements MessageHandler{ private IBigBlueButtonInGW bbbGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java similarity index 96% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java index 16d0bf3248..c971cd23c6 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java @@ -9,7 +9,7 @@ import org.bigbluebutton.core.api.IBigBlueButtonInGW; import com.google.gson.JsonParser; import com.google.gson.JsonObject; -public class LockMessageListener implements MessageHandler { +public class LockMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java new file mode 100755 index 0000000000..9af6ee69bd --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java @@ -0,0 +1,117 @@ +package org.bigbluebutton.core.pubsub.receivers; + +import java.util.HashMap; +import java.util.Map; +import org.bigbluebutton.common.messages.CreateMeetingMessage; +import org.bigbluebutton.common.messages.DestroyMeetingMessage; +import org.bigbluebutton.common.messages.EndMeetingMessage; +import org.bigbluebutton.common.messages.GetAllMeetingsRequest; +import org.bigbluebutton.common.messages.IPublishedMessage; +import org.bigbluebutton.common.messages.KeepAliveMessage; +import org.bigbluebutton.common.messages.MessageFromJsonConverter; +import org.bigbluebutton.common.messages.MessagingConstants; +import org.bigbluebutton.common.messages.RegisterUserMessage; +import org.bigbluebutton.common.messages.UserConnectedToGlobalAudio; +import org.bigbluebutton.common.messages.UserDisconnectedFromGlobalAudio; +import org.bigbluebutton.common.messages.ValidateAuthTokenMessage; +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import com.google.gson.Gson; + +public class MeetingMessageReceiver { + private IBigBlueButtonInGW bbbGW; + + public void handleMessage(String pattern, String channel, String message) { +// System.out.println("Checking message: " + pattern + " " + channel + " " + message); + if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { + System.out.println("Meeting message: " + channel + " " + message); + IPublishedMessage msg = MessageFromJsonConverter.convert(message); + + if (msg != null) { + if (msg instanceof EndMeetingMessage) { + EndMeetingMessage emm = (EndMeetingMessage) msg; + System.out.println("Received end meeting request. Meeting id [" + emm.meetingId + "]"); + bbbGW.endMeeting(emm.meetingId); + } else if (msg instanceof CreateMeetingMessage) { + CreateMeetingMessage emm = (CreateMeetingMessage) msg; + System.out.println("Received create meeting request. Meeting id [" + emm.id + "]"); + bbbGW.createMeeting2(emm.id, emm.externalId, emm.name, emm.record, emm.voiceBridge, + emm.duration, emm.autoStartRecording, emm.allowStartStopRecording, + emm.moderatorPass, emm.viewerPass, emm.createTime, emm.createDate); + } else if (msg instanceof RegisterUserMessage) { + RegisterUserMessage emm = (RegisterUserMessage) msg; + //System.out.println("Received register user request. Meeting id [{}], userid=[{}], token=[{}]", emm.meetingID, emm.internalUserId, emm.authToken); + bbbGW.registerUser(emm.meetingID, emm.internalUserId, emm.fullname, emm.role, emm.externUserID, emm.authToken); + } else if (msg instanceof DestroyMeetingMessage) { + DestroyMeetingMessage emm = (DestroyMeetingMessage) msg; + //System.out.println("Received destroy meeting request. Meeting id [{}]", emm.meetingId); + bbbGW.destroyMeeting(emm.meetingId); + } else if (msg instanceof ValidateAuthTokenMessage) { + ValidateAuthTokenMessage emm = (ValidateAuthTokenMessage) msg; + System.out.println("Received ValidateAuthTokenMessage token request. Meeting id [" + emm.meetingId + "]"); + + //System.out.println("Received ValidateAuthTokenMessage token request. Meeting id [{}]", emm.meetingId); + System.out.println("TODO: Need to pass sessionId on ValidateAuthTokenMessage message."); + String sessionId = "tobeimplemented"; + bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo, sessionId); + } else if (msg instanceof UserConnectedToGlobalAudio) { + UserConnectedToGlobalAudio emm = (UserConnectedToGlobalAudio) msg; + + Map logData = new HashMap(); + logData.put("voiceConf", emm.voiceConf); + logData.put("userId", emm.userid); + logData.put("username", emm.name); + logData.put("event", "user_connected_to_global_audio"); + logData.put("description", "User connected to global audio."); + + Gson gson = new Gson(); + String logStr = gson.toJson(logData); + + //System.out.println("User connected to global audio: data={}", logStr); + + bbbGW.userConnectedToGlobalAudio(emm.voiceConf, emm.userid, emm.name); + } else if (msg instanceof UserDisconnectedFromGlobalAudio) { + UserDisconnectedFromGlobalAudio emm = (UserDisconnectedFromGlobalAudio) msg; + + Map logData = new HashMap(); + logData.put("voiceConf", emm.voiceConf); + logData.put("userId", emm.userid); + logData.put("username", emm.name); + logData.put("event", "user_disconnected_from_global_audio"); + logData.put("description", "User disconnected from global audio."); + + Gson gson = new Gson(); + String logStr = gson.toJson(logData); + + //System.out.println("User disconnected from global audio: data={}", logStr); + bbbGW.userDisconnectedFromGlobalAudio(emm.voiceConf, emm.userid, emm.name); + } + else if (msg instanceof GetAllMeetingsRequest) { + GetAllMeetingsRequest emm = (GetAllMeetingsRequest) msg; + //System.out.println("Received GetAllMeetingsRequest"); + bbbGW.getAllMeetings("no_need_of_a_meeting_id"); + } else { + System.out.println("Unknown message: [" + message + "]"); + } + } else { + System.out.println("Failed to decode message: [" + message + "]"); + } + } else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) { + IPublishedMessage msg = MessageFromJsonConverter.convert(message); + + if (msg != null) { + if (msg instanceof KeepAliveMessage) { + KeepAliveMessage emm = (KeepAliveMessage) msg; +// log.debug("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId); + bbbGW.isAliveAudit(emm.keepAliveId); + } + } else { + System.out.println("Unknown message: [" + message + "]"); + } + } + } + + public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ParticipantsListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java similarity index 99% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ParticipantsListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java index da6d9e6557..7315fbf230 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ParticipantsListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java @@ -29,7 +29,7 @@ import org.bigbluebutton.core.api.IBigBlueButtonInGW; import com.google.gson.JsonParser; import com.google.gson.JsonObject; -public class ParticipantsListener implements MessageHandler{ +public class UsersMessageReceiver implements MessageHandler{ private IBigBlueButtonInGW bbbInGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java similarity index 96% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java index c0fdc74d95..070334dc25 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java @@ -8,7 +8,7 @@ import org.bigbluebutton.core.service.voice.VoiceKeyUtil; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class VoiceMessageListener implements MessageHandler { +public class VoiceMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbGW; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java similarity index 98% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardListener.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java index 7aea4f92d9..0e66907694 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java @@ -15,7 +15,7 @@ import org.bigbluebutton.core.pubsub.redis.MessageHandler; import com.google.gson.JsonParser; import com.google.gson.JsonObject; -public class WhiteboardListener implements MessageHandler { +public class WhiteboardMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbInGW; diff --git a/labs/akka-bbb-apps/src/main/resources/application.conf b/labs/akka-bbb-apps/src/main/resources/application.conf old mode 100644 new mode 100755 index 89ab866646..ae3afad203 --- a/labs/akka-bbb-apps/src/main/resources/application.conf +++ b/labs/akka-bbb-apps/src/main/resources/application.conf @@ -6,6 +6,14 @@ akka { } loglevel = DEBUG stdout-loglevel = "DEBUG" + + rediscala-client-worker-dispatcher { + mailbox-type = "akka.dispatch.SingleConsumerOnlyUnboundedMailbox" + # Throughput defines the maximum number of messages to be + # processed per actor before the thread jumps to the next actor. + # Set to 1 for as fair as possible. + throughput = 512 + } } spray.can.server { diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala index 89b7c84f32..f77838d309 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala @@ -5,9 +5,18 @@ import scala.concurrent.duration._ import redis.RedisClient import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global +import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor +import org.bigbluebutton.endpoint.redis.AppsRedisSubscriberActor object Boot extends App with SystemConfiguration { implicit val system = ActorSystem("bigbluebutton-apps-system") + val redisPublisherActor = system.actorOf( + AppsRedisPublisherActor.props(system), + "redis-publisher") + + val redisSubscriberActor = system.actorOf( + AppsRedisSubscriberActor.props(), + "redis-subscriber") } \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala old mode 100644 new mode 100755 similarity index 100% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfig.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index 8e18ec0e0b..b064d552df 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -11,6 +11,7 @@ import org.bigbluebutton.core.util._ import org.bigbluebutton.core.api.ValidateAuthTokenTimedOut import scala.util.Success import scala.util.Failure +import org.bigbluebutton.SystemConfiguration object BigBlueButtonActor extends SystemConfiguration { def props(system: ActorSystem, outGW: MessageOutGateway): Props = diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala deleted file mode 100755 index 66d8192f65..0000000000 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/SystemConfiguration.scala +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton.core - -import com.typesafe.config.ConfigFactory -import scala.util.Try - -trait SystemConfiguration { - - val config = ConfigFactory.load() - - lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") - - lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) - - lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") - - lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) - - lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") - lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") -} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala old mode 100644 new mode 100755 index 17d146942a..0b890f7e80 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala @@ -16,7 +16,8 @@ object AppsRedisPublisherActor extends SystemConfiguration { def props(system: ActorSystem): Props = Props(classOf[AppsRedisPublisherActor], - system, redisHost, redisPort) + system, redisHost, redisPort). + withDispatcher("akka.rediscala-client-worker-dispatcher") } class AppsRedisPublisherActor(val system: ActorSystem, @@ -32,6 +33,10 @@ class AppsRedisPublisherActor(val system: ActorSystem, Await.result(futurePong, 5 seconds) + // publish after 2 seconds every 2 or 5 seconds + system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) + system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("pattern.match", "pattern value")) + def publish(channel: String, msg: String) { println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") // redis.publish("time", System.currentTimeMillis()) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala old mode 100644 new mode 100755 index 24424bc00e..0b2137164e --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -14,13 +14,13 @@ object AppsRedisSubscriberActor extends SystemConfiguration { val channels = Seq("time") val patterns = Seq("pattern.*") - def props(bbbAppsActor: ActorRef): Props = + def props(): Props = Props(classOf[AppsRedisSubscriberActor], - bbbAppsActor, redisHost, redisPort, channels, patterns). - withDispatcher("rediscala.rediscala-client-worker-dispatcher") + redisHost, redisPort, + channels, patterns).withDispatcher("akka.rediscala-client-worker-dispatcher") } -class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, +class AppsRedisSubscriberActor(redisHost: String, redisPort: Int, channels: Seq[String] = Nil, patterns: Seq[String] = Nil) extends RedisSubscriberActor( From 63336e371734df0e656a49f270c23d375105ce15 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 29 May 2015 15:52:46 +0000 Subject: [PATCH 23/30] - restructure packages and wire up classes --- .../core/api/MessageOutGateway.java | 13 ++--- .../pubsub/receivers/ChatMessageReceiver.java | 2 +- .../receivers/ConversionUpdatesProcessor.java | 4 ++ .../pubsub/receivers/LockMessageReceiver.java | 2 +- .../receivers/MeetingMessageReceiver.java | 8 +++- .../PresentationMessageListener.java | 12 ++--- .../receivers/RedisMessageReceiver.java | 47 +++++++++++++++++++ .../receivers/UsersMessageReceiver.java | 2 +- .../receivers/VoiceMessageReceiver.java | 2 +- .../receivers/WhiteboardMessageReceiver.java | 2 +- .../src/main/resources/application.conf | 10 +++- .../main/scala/org/bigbluebutton/Boot.scala | 18 +++++-- .../core/BigBlueButtonGateway.scala | 7 +-- .../core/BigBlueButtonInGW.scala | 3 +- .../bigbluebutton/core/CollectorActor.scala | 10 ++-- .../senders}/ChatEventRedisPublisher.scala | 2 +- .../senders}/ChatEventRedisRecorder.scala | 2 +- .../senders}/ChatMessageToJsonConverter.scala | 2 +- .../senders}/MeetingEventRedisPublisher.scala | 2 +- .../MeetingMessageToJsonConverter.scala | 2 +- .../PesentationMessageToJsonConverter.scala | 2 +- .../PresentationEventRedisPublisher.scala | 2 +- .../PresentationEventRedisRecorder.scala | 2 +- .../senders}/UsersEventRedisPublisher.scala | 2 +- .../senders}/UsersEventRedisRecorder.scala | 2 +- .../UsersMessageToJsonConverter.scala | 2 +- .../WhiteboardEventRedisPublisher.scala | 2 +- .../WhiteboardEventRedisRecorder.scala | 2 +- .../WhiteboardMessageToJsonConverter.scala | 2 +- .../redis/AppsRedisPublisherActor.scala | 4 +- .../redis/AppsRedisSubscriberActor.scala | 12 +++-- 31 files changed, 128 insertions(+), 58 deletions(-) create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/chat/redis => pubsub/senders}/ChatEventRedisPublisher.scala (94%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/chat/redis => pubsub/senders}/ChatEventRedisRecorder.scala (92%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/chat/redis => pubsub/senders}/ChatMessageToJsonConverter.scala (96%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{meeting => pubsub/senders}/MeetingEventRedisPublisher.scala (96%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{meeting => pubsub/senders}/MeetingMessageToJsonConverter.scala (96%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/presentation/redis => pubsub/senders}/PesentationMessageToJsonConverter.scala (97%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/presentation/redis => pubsub/senders}/PresentationEventRedisPublisher.scala (97%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/presentation/redis => pubsub/senders}/PresentationEventRedisRecorder.scala (96%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/users/redis => pubsub/senders}/UsersEventRedisPublisher.scala (97%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/users/redis => pubsub/senders}/UsersEventRedisRecorder.scala (96%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/users/redis => pubsub/senders}/UsersMessageToJsonConverter.scala (97%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/whiteboard/redis => pubsub/senders}/WhiteboardEventRedisPublisher.scala (95%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/whiteboard/redis => pubsub/senders}/WhiteboardEventRedisRecorder.scala (96%) mode change 100644 => 100755 rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{apps/whiteboard/redis => pubsub/senders}/WhiteboardMessageToJsonConverter.scala (96%) diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java index ca8617bf72..e5e7e4082b 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java @@ -1,18 +1,19 @@ package org.bigbluebutton.core.api; -import java.util.Set; +import java.util.ArrayList; +import java.util.List; public class MessageOutGateway { - private Set listeners; + private List listeners; + + public MessageOutGateway() { + listeners = new ArrayList(); + } public void send(IOutMessage msg) { for (OutMessageListener2 l : listeners) { l.handleMessage(msg); } } - - public void setListeners(Set listeners) { - this.listeners = listeners; - } } diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java index 7b778ad590..f4107547f1 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java @@ -13,7 +13,7 @@ public class ChatMessageReceiver implements MessageHandler{ private IBigBlueButtonInGW bbbGW; - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + public ChatMessageReceiver(IBigBlueButtonInGW bbbGW) { this.bbbGW = bbbGW; } diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java index 5465832f6a..18915d896d 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ConversionUpdatesProcessor.java @@ -24,6 +24,10 @@ public class ConversionUpdatesProcessor { private IBigBlueButtonInGW bbbInGW; + public ConversionUpdatesProcessor(IBigBlueButtonInGW bbbInGW) { + this.bbbInGW = bbbInGW; + } + public void sendConversionUpdate(String messageKey, String conference, String code, String presId, String presName) { bbbInGW.sendConversionUpdate(messageKey, conference, diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java index c971cd23c6..12f2c502a6 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java @@ -13,7 +13,7 @@ public class LockMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbGW; - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + public LockMessageReceiver(IBigBlueButtonInGW bbbGW) { this.bbbGW = bbbGW; } diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java index 9af6ee69bd..0dcd6d5dd0 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java @@ -15,11 +15,17 @@ import org.bigbluebutton.common.messages.UserConnectedToGlobalAudio; import org.bigbluebutton.common.messages.UserDisconnectedFromGlobalAudio; import org.bigbluebutton.common.messages.ValidateAuthTokenMessage; import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; + import com.google.gson.Gson; -public class MeetingMessageReceiver { +public class MeetingMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbGW; + public MeetingMessageReceiver(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + } + public void handleMessage(String pattern, String channel, String message) { // System.out.println("Checking message: " + pattern + " " + channel + " " + message); if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java index b755e00a7f..533ea92bcc 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java @@ -2,7 +2,6 @@ package org.bigbluebutton.core.pubsub.receivers; import java.util.HashMap; import java.util.Map; - import org.bigbluebutton.common.messages.GetPresentationInfoMessage; import org.bigbluebutton.common.messages.GetSlideInfoMessage; import org.bigbluebutton.common.messages.GoToSlideMessage; @@ -15,10 +14,10 @@ import org.bigbluebutton.common.messages.SendCursorUpdateMessage; import org.bigbluebutton.common.messages.SendPageCountErrorMessage; import org.bigbluebutton.common.messages.SendSlideGeneratedMessage; import org.bigbluebutton.common.messages.SharePresentationMessage; -import org.bigbluebutton.conference.service.messaging.redis.MessageHandler; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; import com.google.gson.JsonParser; import com.google.gson.JsonObject; @@ -37,13 +36,10 @@ public class PresentationMessageListener implements MessageHandler { private ConversionUpdatesProcessor conversionUpdatesProcessor; private IBigBlueButtonInGW bbbInGW; - - public void setConversionUpdatesProcessor(ConversionUpdatesProcessor p) { - conversionUpdatesProcessor = p; - } - - public void setBigBlueButtonInGW(IBigBlueButtonInGW inGW) { + + public PresentationMessageListener(IBigBlueButtonInGW inGW) { bbbInGW = inGW; + conversionUpdatesProcessor = new ConversionUpdatesProcessor(bbbInGW); } private void sendConversionUpdate(String messageKey, String conference, diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java new file mode 100755 index 0000000000..a86a63cf5e --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java @@ -0,0 +1,47 @@ +package org.bigbluebutton.core.pubsub.receivers; + +import java.util.ArrayList; +import java.util.List; + +import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import org.bigbluebutton.core.pubsub.redis.MessageHandler; + +public class RedisMessageReceiver { + private List receivers; + private IBigBlueButtonInGW bbbGW; + + public RedisMessageReceiver(IBigBlueButtonInGW bbbGW) { + this.bbbGW = bbbGW; + receivers = new ArrayList(); + setupReceivers(); + } + + private void setupReceivers() { + ChatMessageReceiver chatRx = new ChatMessageReceiver(bbbGW); + receivers.add(chatRx); + + LockMessageReceiver lockRx = new LockMessageReceiver(bbbGW); + receivers.add(lockRx); + + PresentationMessageListener presRx = new PresentationMessageListener(bbbGW); + receivers.add(presRx); + + UsersMessageReceiver usersRx = new UsersMessageReceiver(bbbGW); + receivers.add(usersRx); + + VoiceMessageReceiver voiceRx = new VoiceMessageReceiver(bbbGW); + receivers.add(voiceRx); + + WhiteboardMessageReceiver whiteboardRx = new WhiteboardMessageReceiver(bbbGW); + receivers.add(whiteboardRx); + + MeetingMessageReceiver meetingRx = new MeetingMessageReceiver(bbbGW); + receivers.add(meetingRx); + } + + public void handleMessage(String pattern, String channel, String message) { + for (MessageHandler l : receivers) { + l.handleMessage(pattern, channel, message); + } + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java index 7315fbf230..68283dd50b 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java @@ -33,7 +33,7 @@ public class UsersMessageReceiver implements MessageHandler{ private IBigBlueButtonInGW bbbInGW; - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) { + public UsersMessageReceiver(IBigBlueButtonInGW bbbInGW) { this.bbbInGW = bbbInGW; } diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java index 070334dc25..44c2eaa6a7 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java @@ -12,7 +12,7 @@ public class VoiceMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbGW; - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) { + public VoiceMessageReceiver(IBigBlueButtonInGW bbbGW) { this.bbbGW = bbbGW; } diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java index 0e66907694..35e3a27be9 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java @@ -19,7 +19,7 @@ public class WhiteboardMessageReceiver implements MessageHandler { private IBigBlueButtonInGW bbbInGW; - public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbInGW) { + public WhiteboardMessageReceiver(IBigBlueButtonInGW bbbInGW) { this.bbbInGW = bbbInGW; } diff --git a/labs/akka-bbb-apps/src/main/resources/application.conf b/labs/akka-bbb-apps/src/main/resources/application.conf index ae3afad203..87c4b355f1 100755 --- a/labs/akka-bbb-apps/src/main/resources/application.conf +++ b/labs/akka-bbb-apps/src/main/resources/application.conf @@ -7,7 +7,15 @@ akka { loglevel = DEBUG stdout-loglevel = "DEBUG" - rediscala-client-worker-dispatcher { + rediscala-publish-worker-dispatcher { + mailbox-type = "akka.dispatch.SingleConsumerOnlyUnboundedMailbox" + # Throughput defines the maximum number of messages to be + # processed per actor before the thread jumps to the next actor. + # Set to 1 for as fair as possible. + throughput = 512 + } + + rediscala-subscriber-worker-dispatcher { mailbox-type = "akka.dispatch.SingleConsumerOnlyUnboundedMailbox" # Throughput defines the maximum number of messages to be # processed per actor before the thread jumps to the next actor. diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala index f77838d309..7a004e0e70 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala @@ -7,16 +7,26 @@ import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor import org.bigbluebutton.endpoint.redis.AppsRedisSubscriberActor +import org.bigbluebutton.core.api.MessageOutGateway +import org.bigbluebutton.core.api.IBigBlueButtonInGW +import org.bigbluebutton.core.BigBlueButtonGateway +import org.bigbluebutton.core.BigBlueButtonInGW +import org.bigbluebutton.core.pubsub.receivers.RedisMessageReceiver object Boot extends App with SystemConfiguration { implicit val system = ActorSystem("bigbluebutton-apps-system") + val outGW = new MessageOutGateway() + val bbbGW = new BigBlueButtonGateway(system, outGW) + + val bbbInGW = new BigBlueButtonInGW(bbbGW) + + val redisMsgReceiver = new RedisMessageReceiver(bbbInGW) + val redisPublisherActor = system.actorOf( - AppsRedisPublisherActor.props(system), - "redis-publisher") + AppsRedisPublisherActor.props(system), "redis-publisher") val redisSubscriberActor = system.actorOf( - AppsRedisSubscriberActor.props(), - "redis-subscriber") + AppsRedisSubscriberActor.props(redisMsgReceiver), "redis-subscriber") } \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala index d91834b215..f5a8a72335 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala @@ -4,13 +4,10 @@ import org.bigbluebutton.core.api._ import java.util.concurrent.CountDownLatch import akka.actor.{ ActorSystem, Props } -class BigBlueButtonGateway(outGW: MessageOutGateway) { - - implicit val system = ActorSystem("bigbluebutton-apps-system") +class BigBlueButtonGateway(system: ActorSystem, outGW: MessageOutGateway) { val bbbActor = system.actorOf( - BigBlueButtonActor.props(system, outGW), - "bigbluebutton-actor") + BigBlueButtonActor.props(system, outGW), "bigbluebutton-actor") def accept(msg: InMessage): Unit = { bbbActor ! msg diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala index 9560dc3f89..5ec213f9ef 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -1,7 +1,6 @@ package org.bigbluebutton.core import org.bigbluebutton.core.api._ -import org.bigbluebutton.conference.service.presentation.PreuploadedPresentationsUtil import scala.collection.JavaConversions._ import org.bigbluebutton.core.apps.layout.LayoutInGateway import org.bigbluebutton.core.apps.chat.ChatInGateway @@ -13,7 +12,7 @@ import scala.collection.mutable.ArrayBuffer import org.bigbluebutton.core.apps.presentation.Page import org.bigbluebutton.core.apps.presentation.Presentation -class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway, presUtil: PreuploadedPresentationsUtil) extends IBigBlueButtonInGW { +class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW { // Meeting def createMeeting2(meetingID: String, externalMeetingID: String, meetingName: String, record: Boolean, diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala index f1b4f3bd6f..037858b0c2 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala @@ -10,11 +10,11 @@ import scala.collection.JavaConversions._ import java.util.ArrayList import org.bigbluebutton.core.apps.presentation.Page import org.bigbluebutton.core.apps.presentation.Presentation -import org.bigbluebutton.core.apps.chat.redis.ChatMessageToJsonConverter -import org.bigbluebutton.core.apps.presentation.redis.PesentationMessageToJsonConverter -import org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardMessageToJsonConverter -import org.bigbluebutton.core.meeting.MeetingMessageToJsonConverter -import org.bigbluebutton.core.apps.users.redis.UsersMessageToJsonConverter +import org.bigbluebutton.core.pubsub.senders.ChatMessageToJsonConverter +import org.bigbluebutton.core.pubsub.senders.PesentationMessageToJsonConverter +import org.bigbluebutton.core.pubsub.senders.WhiteboardMessageToJsonConverter +import org.bigbluebutton.core.pubsub.senders.MeetingMessageToJsonConverter +import org.bigbluebutton.core.pubsub.senders.UsersMessageToJsonConverter class CollectorActor(dispatcher: IDispatcher) extends Actor { diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala similarity index 94% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala index 81940bf350..d2b6c0bea5 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.chat.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api.OutMessageListener2 import org.bigbluebutton.conference.service.messaging.redis.MessageSender diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisRecorder.scala similarity index 92% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisRecorder.scala index c30ac8989a..969f59eb3c 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.chat.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala index d434664ef8..f57e3cb537 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/redis/ChatMessageToJsonConverter.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.chat.redis +package org.bigbluebutton.core.pubsub.senders import scala.collection.mutable.HashMap import org.bigbluebutton.conference.service.chat.ChatKeyUtil diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala index 8b801eae80..e039e3cdf2 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.meeting +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.conference.service.messaging.redis.MessageSender import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingMessageToJsonConverter.scala old mode 100644 new mode 100755 similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingMessageToJsonConverter.scala index 2dba6e981f..231e7333d4 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/meeting/MeetingMessageToJsonConverter.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingMessageToJsonConverter.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.meeting +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.messaging.Util import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PesentationMessageToJsonConverter.scala similarity index 97% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PesentationMessageToJsonConverter.scala index 2ab3d5794c..5f09b203c2 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PesentationMessageToJsonConverter.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PesentationMessageToJsonConverter.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.presentation.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api._ import org.bigbluebutton.core.messaging.Util diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala similarity index 97% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala index 1bfb58d14f..d8c2d1aba3 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.presentation.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api.OutMessageListener2 import org.bigbluebutton.core.apps.presentation.Page diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisRecorder.scala old mode 100644 new mode 100755 similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisRecorder.scala index e74ae53ae2..9d60a62a33 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/redis/PresentationEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.presentation.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api.OutMessageListener2 diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala similarity index 97% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala index 1700984b96..e15d9f34a9 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.users.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.conference.service.messaging.redis.MessageSender import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisRecorder.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisRecorder.scala index 713a505691..9a15792785 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.users.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala similarity index 97% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala index ebc42c4f17..046be6d67f 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.users.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api._ import org.bigbluebutton.common.messages.MessagingConstants diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala similarity index 95% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala index 272ab7c5d9..6d859bebc8 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.whiteboard.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api._ import scala.collection.JavaConversions._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisRecorder.scala old mode 100644 new mode 100755 similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisRecorder.scala index 6520e72e3b..408f1efa3b --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.whiteboard.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardMessageToJsonConverter.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardMessageToJsonConverter.scala index 6a9db85067..f1a4ee2155 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/redis/WhiteboardMessageToJsonConverter.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardMessageToJsonConverter.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.apps.whiteboard.redis +package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api._ import org.bigbluebutton.core.messaging.Util diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala index 0b890f7e80..b06f643704 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala @@ -17,7 +17,7 @@ object AppsRedisPublisherActor extends SystemConfiguration { def props(system: ActorSystem): Props = Props(classOf[AppsRedisPublisherActor], system, redisHost, redisPort). - withDispatcher("akka.rediscala-client-worker-dispatcher") + withDispatcher("akka.rediscala-publish-worker-dispatcher") } class AppsRedisPublisherActor(val system: ActorSystem, @@ -35,7 +35,7 @@ class AppsRedisPublisherActor(val system: ActorSystem, // publish after 2 seconds every 2 or 5 seconds system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) - system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("pattern.match", "pattern value")) + // system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value")) def publish(channel: String, msg: String) { println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala index 0b2137164e..8f7887243a 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -8,19 +8,20 @@ import scala.concurrent.duration._ import akka.actor.ActorRef import akka.actor.actorRef2Scala import org.bigbluebutton.SystemConfiguration +import org.bigbluebutton.core.pubsub.receivers.RedisMessageReceiver object AppsRedisSubscriberActor extends SystemConfiguration { val channels = Seq("time") - val patterns = Seq("pattern.*") + val patterns = Seq("bigbluebutton:to-bbb-apps:*") - def props(): Props = - Props(classOf[AppsRedisSubscriberActor], + def props(msgReceiver: RedisMessageReceiver): Props = + Props(classOf[AppsRedisSubscriberActor], msgReceiver, redisHost, redisPort, - channels, patterns).withDispatcher("akka.rediscala-client-worker-dispatcher") + channels, patterns).withDispatcher("akka.rediscala-subscriber-worker-dispatcher") } -class AppsRedisSubscriberActor(redisHost: String, +class AppsRedisSubscriberActor(msgReceiver: RedisMessageReceiver, redisHost: String, redisPort: Int, channels: Seq[String] = Nil, patterns: Seq[String] = Nil) extends RedisSubscriberActor( @@ -33,6 +34,7 @@ class AppsRedisSubscriberActor(redisHost: String, def onPMessage(pmessage: PMessage) { log.debug(s"pattern message received: $pmessage") + msgReceiver.handleMessage(pmessage.patternMatched, pmessage.channel, pmessage.data) } def handleMessage(msg: String) { From 8a437df7a9a180e8bcf29712167f6c66acbbbbfb Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 29 May 2015 17:03:03 +0000 Subject: [PATCH 24/30] - send recieve messages thru redis --- .../core/api/MessageOutGateway.java | 5 ++- .../pubsub/receivers/ChatMessageReceiver.java | 3 +- .../pubsub/receivers/LockMessageReceiver.java | 2 +- .../receivers/MeetingMessageReceiver.java | 2 +- .../{redis => receivers}/MessageHandler.java | 2 +- .../PresentationMessageListener.java | 5 ++- .../receivers/RedisMessageReceiver.java | 1 - .../receivers/UsersMessageReceiver.java | 2 +- .../receivers/VoiceMessageReceiver.java | 1 - .../receivers/WhiteboardMessageReceiver.java | 1 - .../core/pubsub/redis/MessageDistributor.java | 2 ++ .../main/scala/org/bigbluebutton/Boot.scala | 27 ++++++++++++--- .../bigbluebutton/core/MessageSender.scala | 10 ++++++ .../senders/ChatEventRedisPublisher.scala | 2 +- .../senders/MeetingEventRedisPublisher.scala | 2 +- .../PresentationEventRedisPublisher.scala | 2 +- .../senders/UsersEventRedisPublisher.scala | 2 +- .../WhiteboardEventRedisPublisher.scala | 2 +- .../endpoint/redis/RedisPublisher.scala | 33 +++++++++++++++++++ 19 files changed, 84 insertions(+), 22 deletions(-) rename labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/{redis => receivers}/MessageHandler.java (92%) create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSender.scala create mode 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java index e5e7e4082b..87b081d0c1 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/MessageOutGateway.java @@ -1,14 +1,13 @@ package org.bigbluebutton.core.api; -import java.util.ArrayList; import java.util.List; public class MessageOutGateway { private List listeners; - public MessageOutGateway() { - listeners = new ArrayList(); + public MessageOutGateway(List listeners) { + this.listeners = listeners; } public void send(IOutMessage msg) { diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java index f4107547f1..b106bb1bd3 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java @@ -4,9 +4,10 @@ import org.bigbluebutton.common.messages.GetChatHistoryRequestMessage; import org.bigbluebutton.common.messages.MessagingConstants; import org.bigbluebutton.common.messages.SendPrivateChatMessage; import org.bigbluebutton.common.messages.SendPublicChatMessage; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; + import com.google.gson.JsonParser; import com.google.gson.JsonObject; + import org.bigbluebutton.core.api.IBigBlueButtonInGW; public class ChatMessageReceiver implements MessageHandler{ diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java index 12f2c502a6..87b187d5df 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/LockMessageReceiver.java @@ -4,8 +4,8 @@ import org.bigbluebutton.common.messages.GetLockSettingsMessage; import org.bigbluebutton.common.messages.LockUserMessage; import org.bigbluebutton.common.messages.MessagingConstants; import org.bigbluebutton.common.messages.SendLockSettingsMessage; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; import org.bigbluebutton.core.api.IBigBlueButtonInGW; + import com.google.gson.JsonParser; import com.google.gson.JsonObject; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java index 0dcd6d5dd0..f8323010ac 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java @@ -2,6 +2,7 @@ package org.bigbluebutton.core.pubsub.receivers; import java.util.HashMap; import java.util.Map; + import org.bigbluebutton.common.messages.CreateMeetingMessage; import org.bigbluebutton.common.messages.DestroyMeetingMessage; import org.bigbluebutton.common.messages.EndMeetingMessage; @@ -15,7 +16,6 @@ import org.bigbluebutton.common.messages.UserConnectedToGlobalAudio; import org.bigbluebutton.common.messages.UserDisconnectedFromGlobalAudio; import org.bigbluebutton.common.messages.ValidateAuthTokenMessage; import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; import com.google.gson.Gson; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MessageHandler.java similarity index 92% rename from labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java rename to labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MessageHandler.java index c35931287e..e34e2bbc25 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageHandler.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MessageHandler.java @@ -16,7 +16,7 @@ * with BigBlueButton; if not, see . * */ -package org.bigbluebutton.core.pubsub.redis; +package org.bigbluebutton.core.pubsub.receivers; public interface MessageHandler { void handleMessage(String pattern, String channel, String message); diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java index 533ea92bcc..08b3c5b8e2 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PresentationMessageListener.java @@ -2,6 +2,7 @@ package org.bigbluebutton.core.pubsub.receivers; import java.util.HashMap; import java.util.Map; + import org.bigbluebutton.common.messages.GetPresentationInfoMessage; import org.bigbluebutton.common.messages.GetSlideInfoMessage; import org.bigbluebutton.common.messages.GoToSlideMessage; @@ -14,10 +15,12 @@ import org.bigbluebutton.common.messages.SendCursorUpdateMessage; import org.bigbluebutton.common.messages.SendPageCountErrorMessage; import org.bigbluebutton.common.messages.SendSlideGeneratedMessage; import org.bigbluebutton.common.messages.SharePresentationMessage; + import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; + import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; + import com.google.gson.JsonParser; import com.google.gson.JsonObject; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java index a86a63cf5e..e4f3a5d5db 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; public class RedisMessageReceiver { private List receivers; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java index 68283dd50b..6ec01c2a76 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java @@ -24,8 +24,8 @@ import org.bigbluebutton.common.messages.UserLoweredHandMessage; import org.bigbluebutton.common.messages.UserRaisedHandMessage; import org.bigbluebutton.common.messages.UserShareWebcamRequestMessage; import org.bigbluebutton.common.messages.UserUnshareWebcamRequestMessage; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; import org.bigbluebutton.core.api.IBigBlueButtonInGW; + import com.google.gson.JsonParser; import com.google.gson.JsonObject; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java index 44c2eaa6a7..1a3ad5f484 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/VoiceMessageReceiver.java @@ -2,7 +2,6 @@ package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.MessagingConstants; import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; import org.bigbluebutton.core.service.voice.VoiceKeyUtil; import com.google.gson.JsonObject; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java index 35e3a27be9..c6cfadee3d 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java @@ -10,7 +10,6 @@ import org.bigbluebutton.common.messages.RequestWhiteboardAnnotationHistoryReque import org.bigbluebutton.common.messages.SendWhiteboardAnnotationRequestMessage; import org.bigbluebutton.common.messages.UndoWhiteboardRequest; import org.bigbluebutton.core.api.IBigBlueButtonInGW; -import org.bigbluebutton.core.pubsub.redis.MessageHandler; import com.google.gson.JsonParser; import com.google.gson.JsonObject; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java index 24f3fc9cf9..4d1e16b825 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/redis/MessageDistributor.java @@ -2,6 +2,8 @@ package org.bigbluebutton.core.pubsub.redis; import java.util.Set; +import org.bigbluebutton.core.pubsub.receivers.MessageHandler; + public class MessageDistributor { private ReceivedMessageHandler handler; private Set listeners; diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala index 7a004e0e70..c89272e37a 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala @@ -5,28 +5,45 @@ import scala.concurrent.duration._ import redis.RedisClient import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global -import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor +import org.bigbluebutton.endpoint.redis.RedisPublisher import org.bigbluebutton.endpoint.redis.AppsRedisSubscriberActor import org.bigbluebutton.core.api.MessageOutGateway import org.bigbluebutton.core.api.IBigBlueButtonInGW import org.bigbluebutton.core.BigBlueButtonGateway import org.bigbluebutton.core.BigBlueButtonInGW +import org.bigbluebutton.core.MessageSender import org.bigbluebutton.core.pubsub.receivers.RedisMessageReceiver +import org.bigbluebutton.core.api.OutMessageListener2 +import org.bigbluebutton.core.pubsub.senders._ object Boot extends App with SystemConfiguration { implicit val system = ActorSystem("bigbluebutton-apps-system") - val outGW = new MessageOutGateway() + val redisPublisher = new RedisPublisher(system) + val msgSender = new MessageSender(redisPublisher) + + val chatSender = new ChatEventRedisPublisher(msgSender) + val meetingSender = new MeetingEventRedisPublisher(msgSender) + val presSender = new PresentationEventRedisPublisher(msgSender) + val userSender = new UsersEventRedisPublisher(msgSender) + val whiteboardSender = new WhiteboardEventRedisPublisher(msgSender) + + val senders = new java.util.ArrayList[OutMessageListener2]() + senders.add(chatSender) + senders.add(meetingSender) + senders.add(presSender) + senders.add(userSender) + senders.add(whiteboardSender) + + val outGW = new MessageOutGateway(senders) + val bbbGW = new BigBlueButtonGateway(system, outGW) val bbbInGW = new BigBlueButtonInGW(bbbGW) val redisMsgReceiver = new RedisMessageReceiver(bbbInGW) - val redisPublisherActor = system.actorOf( - AppsRedisPublisherActor.props(system), "redis-publisher") - val redisSubscriberActor = system.actorOf( AppsRedisSubscriberActor.props(redisMsgReceiver), "redis-subscriber") } \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSender.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSender.scala new file mode 100755 index 0000000000..250b1b3fba --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSender.scala @@ -0,0 +1,10 @@ +package org.bigbluebutton.core + +import org.bigbluebutton.endpoint.redis.RedisPublisher + +class MessageSender(publisher: RedisPublisher) { + + def send(channel: String, data: String) { + publisher.publish(channel, data) + } +} \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala index d2b6c0bea5..f1ffe8f311 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisPublisher.scala @@ -1,7 +1,7 @@ package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api.OutMessageListener2 -import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.MessageSender import org.bigbluebutton.core.api._ import com.google.gson.Gson import scala.collection.mutable.HashMap diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala index e039e3cdf2..535260aa78 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/MeetingEventRedisPublisher.scala @@ -1,6 +1,6 @@ package org.bigbluebutton.core.pubsub.senders -import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.MessageSender import org.bigbluebutton.core.api._ import scala.collection.immutable.HashMap import com.google.gson.Gson diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala index d8c2d1aba3..fc5817b0a9 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisPublisher.scala @@ -2,7 +2,7 @@ package org.bigbluebutton.core.pubsub.senders import org.bigbluebutton.core.api.OutMessageListener2 import org.bigbluebutton.core.apps.presentation.Page -import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.MessageSender import org.bigbluebutton.core.api._ import org.bigbluebutton.common.messages.MessagingConstants import org.bigbluebutton.common.messages.PresentationRemovedMessage diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala index e15d9f34a9..10dc6d70bd 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala @@ -1,6 +1,6 @@ package org.bigbluebutton.core.pubsub.senders -import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.MessageSender import org.bigbluebutton.core.api._ import org.bigbluebutton.common.messages.MessagingConstants import com.google.gson.Gson diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala index 6d859bebc8..e43df073da 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisPublisher.scala @@ -4,7 +4,7 @@ import org.bigbluebutton.core.api._ import scala.collection.JavaConversions._ import org.bigbluebutton.conference.service.whiteboard.WhiteboardKeyUtil import scala.collection.immutable.StringOps -import org.bigbluebutton.conference.service.messaging.redis.MessageSender +import org.bigbluebutton.core.MessageSender import org.bigbluebutton.common.messages.MessagingConstants import com.google.gson.Gson; diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala new file mode 100755 index 0000000000..df8c7818a3 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala @@ -0,0 +1,33 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import redis.RedisClient +import scala.concurrent.duration._ +import scala.concurrent.ExecutionContext.Implicits.global +import akka.actor.ActorSystem +import scala.concurrent.Await +import akka.actor.Actor +import org.bigbluebutton.SystemConfiguration + +class RedisPublisher(val system: ActorSystem) extends SystemConfiguration { + + val redis = RedisClient(redisHost, redisPort)(system) + + val futurePong = redis.ping() + println("Ping sent!") + futurePong.map(pong => { + println(s"Redis replied with a $pong") + }) + + Await.result(futurePong, 5 seconds) + + // publish after 2 seconds every 2 or 5 seconds + system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) + // system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value")) + + def publish(channel: String, data: String) { + println("PUBLISH TO [" + channel + "]: \n [" + data + "]") + redis.publish(channel, data) + } + +} From a5bd34f8d94fcc8d2f5174e7c33ab9406d181e99 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 29 May 2015 19:06:00 +0000 Subject: [PATCH 25/30] - wire bbb fs esl --- labs/akka-bbb-apps/build.sbt | 1 - .../main/scala/org/bigbluebutton/Boot.scala | 6 +- .../FreeswitchConferenceEventListener.java | 6 +- .../voice/freeswitch/ConnectionManager.java | 27 +- .../voice/freeswitch/ESLEventListener.java | 14 +- .../freeswitch/FreeswitchApplication.java | 261 +++++++----------- .../src/main/resources/application.conf | 22 +- .../main/scala/org/bigbluebutton/Boot.scala | 29 +- .../org/bigbluebutton/SystemConfig.scala | 20 -- .../bigbluebutton/SystemConfiguration.scala | 18 ++ .../endpoint/redis/RedisPublisher.scala | 33 +++ .../freeswitch/VoiceConferenceService.scala | 48 ++++ 12 files changed, 255 insertions(+), 230 deletions(-) mode change 100644 => 100755 labs/akka-bbb-fs/src/main/resources/application.conf delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfiguration.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala create mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala diff --git a/labs/akka-bbb-apps/build.sbt b/labs/akka-bbb-apps/build.sbt index 2fbfbf15f9..b17eafe18b 100755 --- a/labs/akka-bbb-apps/build.sbt +++ b/labs/akka-bbb-apps/build.sbt @@ -56,7 +56,6 @@ libraryDependencies ++= { "org.apache.commons" % "commons-lang3" % "3.2" )} -libraryDependencies += "org.freeswitch" % "fs-esl-client" % "0.8.2" from "http://blindside.googlecode.com/svn/repository/org/freeswitch/fs-esl-client/0.8.2/fs-esl-client-0.8.2.jar" seq(Revolver.settings: _*) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala index c89272e37a..5774cfea23 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/Boot.scala @@ -37,13 +37,9 @@ object Boot extends App with SystemConfiguration { senders.add(whiteboardSender) val outGW = new MessageOutGateway(senders) - val bbbGW = new BigBlueButtonGateway(system, outGW) - val bbbInGW = new BigBlueButtonInGW(bbbGW) - val redisMsgReceiver = new RedisMessageReceiver(bbbInGW) - val redisSubscriberActor = system.actorOf( - AppsRedisSubscriberActor.props(redisMsgReceiver), "redis-subscriber") + val redisSubscriberActor = system.actorOf(AppsRedisSubscriberActor.props(redisMsgReceiver), "redis-subscriber") } \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java index fb30de3eea..638770574c 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java @@ -38,10 +38,10 @@ public class FreeswitchConferenceEventListener implements ConferenceEventListene private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); private BlockingQueue messages = new LinkedBlockingQueue(); - private volatile boolean sendMessages = false; - private IVoiceConferenceService vcs; + private volatile boolean sendMessages = false; + private final IVoiceConferenceService vcs; - public void setVoiceConferenceService(IVoiceConferenceService vcs) { + public FreeswitchConferenceEventListener(IVoiceConferenceService vcs) { this.vcs = vcs; } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java index 59ec85ff0b..8d6662d8fa 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java @@ -41,13 +41,19 @@ public class ConnectionManager { private static final ScheduledExecutorService connExec = Executors.newSingleThreadScheduledExecutor(); - private ManagerConnection manager; + private final ManagerConnection manager; private ScheduledFuture connectTask; private volatile boolean subscribed = false; - private ConferenceEventListener conferenceEventListener; - private ESLEventListener eslEventListener; + private final ConferenceEventListener conferenceEventListener; + private final ESLEventListener eslEventListener; + + public ConnectionManager(ManagerConnection connManager, ESLEventListener eventListener, ConferenceEventListener confListener) { + this.manager = connManager; + this.eslEventListener = eventListener; + this.conferenceEventListener = confListener; + } private void connect() { try { @@ -137,18 +143,5 @@ public class ConnectionManager { EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs()); rcc.handleResponse(response, conferenceEventListener); } - } - - public void setManagerConnection(ManagerConnection manager) { - this.manager = manager; - } - - public void setESLEventListener(ESLEventListener listener) { - this.eslEventListener = listener; - } - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } - + } } \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java index 1bfd7c249a..7e6c2b4a34 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ESLEventListener.java @@ -23,7 +23,11 @@ public class ESLEventListener implements IEslEventListener { private static final String START_RECORDING_EVENT = "start-recording"; private static final String STOP_RECORDING_EVENT = "stop-recording"; - private ConferenceEventListener conferenceEventListener; + private final ConferenceEventListener conferenceEventListener; + + public ESLEventListener(ConferenceEventListener conferenceEventListener) { + this.conferenceEventListener = conferenceEventListener; + } @Override public void conferenceEventPlayFile(String uniqueId, String confName, int confSize, EslEvent event) { @@ -191,12 +195,4 @@ public class ESLEventListener implements IEslEventListener { private String getRecordFilenameFromEvent(EslEvent e) { return e.getEventHeaders().get("Path"); } - - /*private String getRecordTimestampFromEvent(EslEvent e) { - return e.getEventHeaders().get("Event-Date-Timestamp"); - }*/ - - public void setConferenceEventListener(ConferenceEventListener listener) { - this.conferenceEventListener = listener; - } } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java index 3a31fe7ba3..8157bddb80 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java @@ -24,8 +24,6 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; - -import org.bigbluebutton.freeswitch.voice.ConferenceServiceProvider; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; @@ -34,170 +32,117 @@ import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantComm import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; -public class FreeswitchApplication implements ConferenceServiceProvider { +public class FreeswitchApplication { private static final int SENDERTHREADS = 1; private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS); private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS); private BlockingQueue messages = new LinkedBlockingQueue(); - private ConnectionManager manager; - - private String icecastProtocol = "shout"; - private String icecastHost = "localhost"; - private int icecastPort = 8000; - private String icecastUsername = "source"; - private String icecastPassword = "hackme"; - private String icecastStreamExtension = ".mp3"; - private Boolean icecastBroadcast = false; - - private final String USER = "0"; /* not used for now */ - - private volatile boolean sendMessages = false; - - private void queueMessage(FreeswitchCommand command) { - try { - messages.offer(command, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public void populateRoom(String room) { - PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); - queueMessage(prc); - } - - public void mute(String room, String participant, Boolean mute) { - MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); - queueMessage(mpc); - } - - public void eject(String room, String participant) { - EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); - queueMessage(mpc); - } - - @Override - public void ejectAll(String room) { - EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); - queueMessage(mpc); - } - - private Long genTimestamp() { - return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); - } - - @Override - public void record(String room, String meetingid){ - String RECORD_DIR = "/var/freeswitch/meetings"; - String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; - - RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); - queueMessage(rcc); - } - - @Override - public void broadcast(String room, String meetingid) { - if (icecastBroadcast) { - broadcastToIcecast(room, meetingid); - } - } - - private void broadcastToIcecast(String room, String meetingid) { - String shoutPath = icecastProtocol + "://" + icecastUsername + ":" + icecastPassword + "@" + icecastHost + ":" + icecastPort - + File.separatorChar + meetingid + "." + icecastStreamExtension; - - BroadcastConferenceCommand rcc = new BroadcastConferenceCommand(room, USER, true, shoutPath); - queueMessage(rcc); - } - - public void setConnectionManager(ConnectionManager manager) { - this.manager = manager; - } - - public void setIcecastProtocol(String protocol) { - icecastProtocol = protocol; - } - - public void setIcecastHost(String host) { - icecastHost = host; - } - - public void setIcecastPort(int port) { - icecastPort = port; - } - - public void setIcecastUsername(String username) { - icecastUsername = username; - } - - public void setIcecastPassword(String password) { - icecastPassword = password; - } - - public void setIcecastBroadcast(Boolean broadcast) { - icecastBroadcast = broadcast; - } - - public void setIcecastStreamExtension(String ext) { - icecastStreamExtension = ext; - } - - private void sendMessageToFreeswitch(final FreeswitchCommand command) { - Runnable task = new Runnable() { - public void run() { - if (command instanceof PopulateRoomCommand) { - PopulateRoomCommand cmd = (PopulateRoomCommand) command; - System.out.println("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); - manager.getUsers(cmd); - } else if (command instanceof MuteParticipantCommand) { - MuteParticipantCommand cmd = (MuteParticipantCommand) command; - System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.mute(cmd); - } else if (command instanceof EjectParticipantCommand) { - EjectParticipantCommand cmd = (EjectParticipantCommand) command; - System.out.println("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); - manager.eject(cmd); - } else if (command instanceof EjectAllUsersCommand) { - EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; - System.out.println("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); - manager.ejectAll(cmd); - } else if (command instanceof RecordConferenceCommand) { - manager.record((RecordConferenceCommand) command); - } else if (command instanceof BroadcastConferenceCommand) { - manager.broadcast((BroadcastConferenceCommand) command); - } - } - }; - runExec.execute(task); + private final ConnectionManager manager; + + private final String USER = "0"; /* not used for now */ + + private volatile boolean sendMessages = false; + + public FreeswitchApplication(ConnectionManager manager) { + this.manager = manager; } - - public void start() { - sendMessages = true; - Runnable sender = new Runnable() { - public void run() { - while (sendMessages) { - FreeswitchCommand message; - try { - message = messages.take(); - sendMessageToFreeswitch(message); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } + + private void queueMessage(FreeswitchCommand command) { + try { + messages.offer(command, 5, TimeUnit.SECONDS); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } - }; - msgSenderExec.execute(sender); - } + } + + public void populateRoom(String room) { + PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); + queueMessage(prc); + } - public void stop() { - sendMessages = false; - } + public void mute(String room, String participant, Boolean mute) { + MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); + queueMessage(mpc); + } + + public void eject(String room, String participant) { + EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); + queueMessage(mpc); + } + + public void ejectAll(String room) { + EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); + queueMessage(mpc); + } + + private Long genTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public void record(String room, String meetingid){ + String RECORD_DIR = "/var/freeswitch/meetings"; + String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; + + RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); + queueMessage(rcc); + } + + private void sendMessageToFreeswitch(final FreeswitchCommand command) { + Runnable task = new Runnable() { + public void run() { + if (command instanceof PopulateRoomCommand) { + PopulateRoomCommand cmd = (PopulateRoomCommand) command; + System.out.println("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); + manager.getUsers(cmd); + } else if (command instanceof MuteParticipantCommand) { + MuteParticipantCommand cmd = (MuteParticipantCommand) command; + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.mute(cmd); + } else if (command instanceof EjectParticipantCommand) { + EjectParticipantCommand cmd = (EjectParticipantCommand) command; + System.out.println("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); + manager.eject(cmd); + } else if (command instanceof EjectAllUsersCommand) { + EjectAllUsersCommand cmd = (EjectAllUsersCommand) command; + System.out.println("Sending EjectAllUsersCommand for conference = [" + cmd.getRoom() + "]"); + manager.ejectAll(cmd); + } else if (command instanceof RecordConferenceCommand) { + manager.record((RecordConferenceCommand) command); + } else if (command instanceof BroadcastConferenceCommand) { + manager.broadcast((BroadcastConferenceCommand) command); + } + } + }; + + runExec.execute(task); + } + + public void start() { + sendMessages = true; + Runnable sender = new Runnable() { + public void run() { + while (sendMessages) { + FreeswitchCommand message; + try { + message = messages.take(); + sendMessageToFreeswitch(message); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + } + }; + msgSenderExec.execute(sender); + } + + public void stop() { + sendMessages = false; + } } \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/resources/application.conf b/labs/akka-bbb-fs/src/main/resources/application.conf old mode 100644 new mode 100755 index 89ab866646..0dcca5464b --- a/labs/akka-bbb-fs/src/main/resources/application.conf +++ b/labs/akka-bbb-fs/src/main/resources/application.conf @@ -8,16 +8,18 @@ akka { stdout-loglevel = "DEBUG" } -spray.can.server { - request-timeout = 10s + +freeswitch { + esl { + host="127.0.0.1" + port=8021 + password="ClueCon" + } } -service { - host = "192.168.153.144" - port = 8989 +redis { + host="127.0.0.1" + port=6379 + password="" } - -api { - channel = "bbb-apps-channel" - source = "bigbluebutton-apps" -} + diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala index 245ccd7ffc..fdbe161235 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala @@ -5,17 +5,32 @@ import scala.concurrent.duration._ import redis.RedisClient import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global -//import org.bigbluebutton.apps.MeetingManager -import org.bigbluebutton.endpoint.redis.AppsRedisPublisherActor +import org.freeswitch.esl.client.manager.DefaultManagerConnection +import org.bigbluebutton.endpoint.redis.RedisPublisher +import org.bigbluebutton.freeswitch.VoiceConferenceService +import org.bigbluebutton.freeswitch.voice.FreeswitchConferenceEventListener +import org.bigbluebutton.freeswitch.voice.freeswitch.{ ESLEventListener, ConnectionManager, FreeswitchApplication } +import org.bigbluebutton.freeswitch.voice.IVoiceConferenceService object Boot extends App with SystemConfiguration { - implicit val system = ActorSystem("bigbluebutton-apps-system") + implicit val system = ActorSystem("bigbluebutton-fsesl-system") - val redisPublisherActor = system.actorOf( - AppsRedisPublisherActor.props(system), - "redis-publisher") + val redisPublisher = new RedisPublisher(system) - // val meetingManager = system.actorOf(MeetingManager.props(redisPublisherActor), "meeting-manager") + val eslConnection = new DefaultManagerConnection(eslHost, eslPort, eslPassword); + + val voiceConfService = new VoiceConferenceService(redisPublisher) + + val fsConfEventListener = new FreeswitchConferenceEventListener(voiceConfService) + fsConfEventListener.start() + + val eslEventListener = new ESLEventListener(fsConfEventListener) + val connManager = new ConnectionManager(eslConnection, eslEventListener, fsConfEventListener) + + connManager.start() + + val fsApplication = new FreeswitchApplication(connManager) + fsApplication.start() } \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala deleted file mode 100644 index 3fbdbc4b52..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfig.scala +++ /dev/null @@ -1,20 +0,0 @@ -package org.bigbluebutton - -import com.typesafe.config.ConfigFactory -import scala.util.Try - -trait SystemConfiguration { - - val config = ConfigFactory.load() - - lazy val serviceHost = Try(config.getString("service.host")).getOrElse("127.0.0.1") - - lazy val servicePort = Try(config.getInt("service.port")).getOrElse(8080) - - lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") - - lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) - - lazy val apiSourceName = Try(config.getString("api.source")).getOrElse("bigbluebutton-apps") - lazy val apiChannel = Try(config.getString("api.channel")).getOrElse("bbb-apps-channel") -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfiguration.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfiguration.scala new file mode 100755 index 0000000000..cb7a5ac605 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/SystemConfiguration.scala @@ -0,0 +1,18 @@ +package org.bigbluebutton + +import com.typesafe.config.ConfigFactory +import scala.util.Try + +trait SystemConfiguration { + + val config = ConfigFactory.load() + + lazy val eslHost = Try(config.getString("freeswitch.esl.host")).getOrElse("127.0.0.1") + lazy val eslPort = Try(config.getInt("freeswitch.esl.port")).getOrElse(8021) + lazy val eslPassword = Try(config.getString("freeswitch.esl.password")).getOrElse("ClueCon") + + lazy val redisHost = Try(config.getString("redis.host")).getOrElse("127.0.0.1") + lazy val redisPort = Try(config.getInt("redis.port")).getOrElse(6379) + lazy val redisPassword = Try(config.getString("redis.password")).getOrElse("") + +} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala new file mode 100755 index 0000000000..df8c7818a3 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala @@ -0,0 +1,33 @@ +package org.bigbluebutton.endpoint.redis + +import akka.actor.Props +import redis.RedisClient +import scala.concurrent.duration._ +import scala.concurrent.ExecutionContext.Implicits.global +import akka.actor.ActorSystem +import scala.concurrent.Await +import akka.actor.Actor +import org.bigbluebutton.SystemConfiguration + +class RedisPublisher(val system: ActorSystem) extends SystemConfiguration { + + val redis = RedisClient(redisHost, redisPort)(system) + + val futurePong = redis.ping() + println("Ping sent!") + futurePong.map(pong => { + println(s"Redis replied with a $pong") + }) + + Await.result(futurePong, 5 seconds) + + // publish after 2 seconds every 2 or 5 seconds + system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) + // system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value")) + + def publish(channel: String, data: String) { + println("PUBLISH TO [" + channel + "]: \n [" + data + "]") + redis.publish(channel, data) + } + +} diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala new file mode 100755 index 0000000000..1afd5ad5ab --- /dev/null +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala @@ -0,0 +1,48 @@ +package org.bigbluebutton.freeswitch + +import org.bigbluebutton.freeswitch.voice.IVoiceConferenceService +import org.bigbluebutton.core.api._ +import org.bigbluebutton.endpoint.redis.RedisPublisher + +class VoiceConferenceService(sender: RedisPublisher) extends IVoiceConferenceService { + + def voiceStartedRecording(conference: String, recordingFile: String, + timestamp: String, recording: java.lang.Boolean) { + val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) + + } + + def voiceUserJoined(userId: String, webUserId: String, conference: String, + callerIdNum: String, callerIdName: String, + muted: java.lang.Boolean, talking: java.lang.Boolean) { + // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") + val vuj = new FsVoiceUserJoined(userId, webUserId, + conference, callerIdNum, + callerIdName, muted, + talking) + + } + + def voiceUserLeft(userId: String, conference: String) { + // println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") + val vul = new FsVoiceUserLeft(userId, conference) + + } + + def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { + val vul = new FsVoiceUserLocked(userId, conference, locked) + + } + + def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") + val vum = new FsVoiceUserMuted(userId, conference, muted) + + } + + def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") + val vut = new FsVoiceUserTalking(userId, conference, talking) + + } +} \ No newline at end of file From 855ab9673f3d0f472eee83e253832ea703af8d8e Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 29 May 2015 19:48:29 +0000 Subject: [PATCH 26/30] - receive redis messages - cleanup --- .../receivers/RedisMessageReceiver.java | 16 ++ .../voice/ConferenceServiceProvider.java | 28 -- .../src/main/resources/application.conf | 8 + .../main/scala/org/bigbluebutton/Boot.scala | 6 +- .../redis/AppsRedisSubscriberActor.scala | 14 +- .../freeswitch/FreeswitchConference.scala | 54 ---- .../FreeswitchConferenceActor.scala | 248 ------------------ .../FreeswitchConferenceService.scala | 123 --------- .../freeswitch/FreeswitchManagerProxy.scala | 32 --- .../freeswitch/FsInGwWrapper.scala | 12 - .../freeswitch/VoiceConferenceService.scala | 12 + 11 files changed, 49 insertions(+), 504 deletions(-) create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java delete mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java mode change 100644 => 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java new file mode 100755 index 0000000000..cb15361c82 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java @@ -0,0 +1,16 @@ +package org.bigbluebutton.freeswitch.pubsub.receivers; + +import org.bigbluebutton.freeswitch.voice.freeswitch.FreeswitchApplication; + +public class RedisMessageReceiver { + + private final FreeswitchApplication fsApp; + + public RedisMessageReceiver(FreeswitchApplication fsApp) { + this.fsApp = fsApp; + } + + public void handleMessage(String pattern, String channel, String message) { + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java deleted file mode 100755 index f6bcf46aac..0000000000 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/ConferenceServiceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 3.0 of the License, or (at your option) any later -* version. -* -* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with BigBlueButton; if not, see . -* -*/ -package org.bigbluebutton.freeswitch.voice; - -public interface ConferenceServiceProvider { - public void populateRoom(String room); - public void mute(String room, String participant, Boolean mute); - public void eject(String room, String participant); - public void ejectAll(String room); - public void record(String room, String meetingid); - public void broadcast(String room, String meetingid); -} diff --git a/labs/akka-bbb-fs/src/main/resources/application.conf b/labs/akka-bbb-fs/src/main/resources/application.conf index 0dcca5464b..6ab401499c 100755 --- a/labs/akka-bbb-fs/src/main/resources/application.conf +++ b/labs/akka-bbb-fs/src/main/resources/application.conf @@ -6,6 +6,14 @@ akka { } loglevel = DEBUG stdout-loglevel = "DEBUG" + + rediscala-subscriber-worker-dispatcher { + mailbox-type = "akka.dispatch.SingleConsumerOnlyUnboundedMailbox" + # Throughput defines the maximum number of messages to be + # processed per actor before the thread jumps to the next actor. + # Set to 1 for as fair as possible. + throughput = 512 + } } diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala index fdbe161235..723dc089b8 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/Boot.scala @@ -6,11 +6,12 @@ import redis.RedisClient import scala.concurrent.{ Future, Await } import scala.concurrent.ExecutionContext.Implicits.global import org.freeswitch.esl.client.manager.DefaultManagerConnection -import org.bigbluebutton.endpoint.redis.RedisPublisher +import org.bigbluebutton.endpoint.redis.{ RedisPublisher, AppsRedisSubscriberActor } import org.bigbluebutton.freeswitch.VoiceConferenceService import org.bigbluebutton.freeswitch.voice.FreeswitchConferenceEventListener import org.bigbluebutton.freeswitch.voice.freeswitch.{ ESLEventListener, ConnectionManager, FreeswitchApplication } import org.bigbluebutton.freeswitch.voice.IVoiceConferenceService +import org.bigbluebutton.freeswitch.pubsub.receivers.RedisMessageReceiver object Boot extends App with SystemConfiguration { @@ -33,4 +34,7 @@ object Boot extends App with SystemConfiguration { val fsApplication = new FreeswitchApplication(connManager) fsApplication.start() + val redisMsgReceiver = new RedisMessageReceiver(fsApplication) + + val redisSubscriberActor = system.actorOf(AppsRedisSubscriberActor.props(redisMsgReceiver), "redis-subscriber") } \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala old mode 100644 new mode 100755 index 24424bc00e..11d2d2535f --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -8,19 +8,20 @@ import scala.concurrent.duration._ import akka.actor.ActorRef import akka.actor.actorRef2Scala import org.bigbluebutton.SystemConfiguration +import org.bigbluebutton.freeswitch.pubsub.receivers.RedisMessageReceiver object AppsRedisSubscriberActor extends SystemConfiguration { val channels = Seq("time") - val patterns = Seq("pattern.*") + val patterns = Seq("bigbluebutton:to-bbb-apps:*") - def props(bbbAppsActor: ActorRef): Props = - Props(classOf[AppsRedisSubscriberActor], - bbbAppsActor, redisHost, redisPort, channels, patterns). - withDispatcher("rediscala.rediscala-client-worker-dispatcher") + def props(msgReceiver: RedisMessageReceiver): Props = + Props(classOf[AppsRedisSubscriberActor], msgReceiver, + redisHost, redisPort, + channels, patterns).withDispatcher("akka.rediscala-subscriber-worker-dispatcher") } -class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, +class AppsRedisSubscriberActor(msgReceiver: RedisMessageReceiver, redisHost: String, redisPort: Int, channels: Seq[String] = Nil, patterns: Seq[String] = Nil) extends RedisSubscriberActor( @@ -33,6 +34,7 @@ class AppsRedisSubscriberActor(bbbAppsActor: ActorRef, redisHost: String, def onPMessage(pmessage: PMessage) { log.debug(s"pattern message received: $pmessage") + msgReceiver.handleMessage(pmessage.patternMatched, pmessage.channel, pmessage.data) } def handleMessage(msg: String) { diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala deleted file mode 100755 index 47b35daae4..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConference.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.core.api.UserVO -import org.bigbluebutton.core.util._ - -class FreeswitchConference(val conferenceNum: String, - val meetingId: String, - val recorded: Boolean) { - - private var users = new scala.collection.immutable.HashMap[String, UserVO] - - private var recording: Boolean = false - - def addUser(user: UserVO) { - users += user.userID -> user - } - - def removeUser(user: UserVO) { - users -= user.userID - } - - def getWebUserUsingExtId(webUserId: String): Option[UserVO] = { - users.values find { u => - (u.externUserID == webUserId) - } - } - - def getWebUser(webUserId: String): Option[UserVO] = { - users.values find (u => (u.userID == webUserId)) - } - - def getVoiceUser(voiceUserId: String): Option[UserVO] = { - users.values find (u => u.voiceUser.userId == voiceUserId) - } - - def numUsersInVoiceConference: Int = { - val joinedUsers = users.values filter (u => u.voiceUser.joined) - joinedUsers.size - } - - def numUsers = users.size - - def recordingStarted() { - recording = true; - } - - def recordingStopped() { - recording = false - } - - def isRecording(): Boolean = { - recording - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala deleted file mode 100755 index c10bdd52b1..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceActor.scala +++ /dev/null @@ -1,248 +0,0 @@ -package org.bigbluebutton.freeswitch - -import akka.actor._ -import akka.actor.ActorLogging -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.util._ - -case class FsVoiceUserJoined(userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, muted: Boolean, - speaking: Boolean) - -case class FsVoiceUserLeft(userId: String, conference: String) -case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) -case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) -case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) -case class FsRecording(conference: String, recordingFile: String, - timestamp: String, recording: Boolean) - -object FreeswitchConferenceActor { - def props(system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW): Props = - Props(classOf[FreeswitchConferenceActor], system, fsproxy, bbbInGW) -} - -class FreeswitchConferenceActor(val system: ActorSystem, fsproxy: FreeswitchManagerProxy, bbbInGW: IBigBlueButtonInGW) extends Actor with ActorLogging { - - private var confs = new scala.collection.immutable.HashMap[String, FreeswitchConference] - - def receive = { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: StartRecording => handleStartRecording(msg) - case msg: StopRecording => handleStopRecording(msg) - case msg: FsRecording => handleFsRecording(msg) - case msg: FsVoiceUserJoined => handleFsVoiceUserJoined(msg) - case msg: FsVoiceUserLeft => handleFsVoiceUserLeft(msg) - case msg: FsVoiceUserLocked => handleFsVoiceUserLocked(msg) - case msg: FsVoiceUserMuted => handleFsVoiceUserMuted(msg) - case msg: FsVoiceUserTalking => handleFsVoiceUserTalking(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) - case _ => // do nothing - } - - private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - fsproxy.ejectUsers(fc.conferenceNum) - }) - } - - private def handleMeetingCreated(msg: MeetingCreated) { - if (!confs.contains(msg.meetingID)) { - log.info("Meeting created [" + msg.meetingID + "] with voice conf [" + msg.voiceBridge + "]") - val fsconf = new FreeswitchConference(msg.voiceBridge, - msg.meetingID, - msg.recorded) - confs += fsconf.meetingId -> fsconf - } - - fsproxy.getUsers(msg.voiceBridge) - } - - private def handleMeetingEnded(msg: MeetingEnded) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Meeting ended [" + msg.meetingID + "]") - fsproxy.ejectUsers(fc.conferenceNum) - confs -= fc.meetingId - }) - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Meeting destroyed [" + msg.meetingID + "]") - fsproxy.ejectUsers(fc.conferenceNum) - confs -= fc.meetingId - }) - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach { fc => - log.info("Web user has joined voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") - fc.addUser(msg.user) - if (fc.numUsersInVoiceConference == 1 && fc.recorded) { - log.info("Meeting is recorded. Tell FreeSWITCH to start recording. mid[" + fc.meetingId + "]") - fsproxy.startRecording(fc.conferenceNum, fc.meetingId) - } - } - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - // println("FreeswitchConferenceActor - handleUserLeftVoice mid=[" + msg.meetingID + "]") - - fsconf foreach { fc => - fc.addUser(msg.user) - log.info("Web user has left voice. mid[" + fc.meetingId + "] wid=[" + msg.user.userID + "], vid=[" + msg.user.voiceUser.userId + "]") - if (fc.numUsersInVoiceConference == 0 && fc.recorded) { - log.info("Meeting is recorded. No more users in voice conference. Tell FreeSWITCH to stop recording. mid[" + fc.meetingId + "]") - fsproxy.stopRecording(fc.conferenceNum) - } - } - } - - private def handleUserJoined(msg: UserJoined) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - log.info("Web user id joining meeting id[" + fc.meetingId + "] wid=[" + msg.user.userID + "], extId=[" + msg.user.externUserID + "]") - fc.addUser(msg.user) - }) - } - - private def handleUserLeft(msg: UserLeft) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - fc.removeUser(msg.user) - }) - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - log.debug("Mute user request for wid[" + msg.userId + "] mute=[" + msg.mute + "]") - fsconf foreach (fc => { - val user = fc.getWebUser(msg.userId) - user foreach (u => { - log.debug("Muting user wid[" + msg.userId + "] mute=[" + msg.mute + "]") - fsproxy.muteUser(fc.conferenceNum, u.voiceUser.userId, msg.mute) - }) - }) - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val fsconf = confs.values find (c => c.meetingId == msg.meetingID) - - fsconf foreach (fc => { - val user = fc.getWebUser(msg.userId) - user foreach (u => { - fsproxy.ejectUser(fc.conferenceNum, u.voiceUser.userId) - }) - }) - } - - private def handleStartRecording(msg: StartRecording) { - - } - - private def handleStopRecording(msg: StopRecording) { - - } - - private def handleFsRecording(msg: FsRecording) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - fsconf foreach { fc => - // Need to filter recording events here to not have duplicate events - if (!fc.isRecording && msg.recording) { - // - fc.recordingStarted - bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) - } else if (fc.isRecording && !msg.recording) { - fc.recordingStopped - bbbInGW.voiceRecording(fc.meetingId, msg.recordingFile, msg.timestamp, msg.recording) - } - } - } - - private def sendNonWebUserJoined(meetingId: String, webUserId: String, msg: FsVoiceUserJoined) { - bbbInGW.voiceUserJoined(meetingId, msg.userId, - webUserId, msg.conference, msg.callerIdNum, msg.callerIdName, - msg.muted, msg.speaking) - } - - private def handleFsVoiceUserJoined(msg: FsVoiceUserJoined) { - log.info("A user has joined the voice conference [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - log.debug("Meeting [" + fc.meetingId + "] has [" + fc.numUsers + "]") - fc.getWebUserUsingExtId(msg.webUserId) match { - case Some(user) => { - log.info("The user is also in the web client. [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - sendNonWebUserJoined(fc.meetingId, user.userID, msg) - } - case None => { - log.info("User is not a web user. Must be a phone caller. [" + - msg.conference + "] user=[" + msg.callerIdName + "] wid=[" + msg.webUserId + "]") - sendNonWebUserJoined(fc.meetingId, msg.userId, msg) - } - } - }) - } - - private def handleFsVoiceUserLeft(msg: FsVoiceUserLeft) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - user foreach (u => bbbInGW.voiceUserLeft(fc.meetingId, u.userID)) - }) - } - - private def handleFsVoiceUserLocked(msg: FsVoiceUserLocked) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - user foreach (u => bbbInGW.voiceUserLocked(fc.meetingId, u.userID, msg.locked)) - }) - } - - private def handleFsVoiceUserMuted(msg: FsVoiceUserMuted) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - // println("Rx voice user muted for cnum=[" + msg.conference + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - // println("Rx voice user muted for mid=[" + fc.meetingId + "] vid[" + msg.userId + "] mute=[" + msg.muted + "]") - user foreach (u => bbbInGW.voiceUserMuted(fc.meetingId, u.userID, msg.muted)) - }) - } - - private def handleFsVoiceUserTalking(msg: FsVoiceUserTalking) { - val fsconf = confs.values find (c => c.conferenceNum == msg.conference) - - fsconf foreach (fc => { - val user = fc.getVoiceUser(msg.userId) - // println("Rx voice user talking for vid[" + msg.userId + "] mute=[" + msg.talking + "]") - user foreach (u => bbbInGW.voiceUserTalking(fc.meetingId, u.userID, msg.talking)) - }) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala deleted file mode 100755 index 4761993aa0..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchConferenceService.scala +++ /dev/null @@ -1,123 +0,0 @@ -package org.bigbluebutton.freeswitch - -import akka.actor.{ ActorSystem, Props } -import org.bigbluebutton.webconference.voice.IVoiceConferenceService -import org.bigbluebutton.core.api._ -import org.bigbluebutton.webconference.voice.FreeswitchConferenceEventListener -import akka.actor.ActorRef - -class FreeswitchConferenceService(fsproxy: FreeswitchManagerProxy, - fsListener: FreeswitchConferenceEventListener) - extends IVoiceConferenceService - with OutMessageListener2 { - - fsListener.setVoiceConferenceService(this) - - implicit val system = ActorSystem("bigbluebutton-apps-fsesl") - - var bbbInGW: IBigBlueButtonInGW = _ - var fsActor: ActorRef = _ - - def setIBigBlueButtonInGW(inGW: IBigBlueButtonInGW) { - bbbInGW = inGW - fsActor = system.actorOf( - FreeswitchConferenceActor.props(system, fsproxy, bbbInGW), - "bigbluebutton-fs-actor") - } - - def handleMessage(msg: IOutMessage) { - msg match { - case msg: MeetingCreated => handleMeetingCreated(msg) - case msg: MeetingEnded => handleMeetingEnded(msg) - case msg: MeetingDestroyed => handleMeetingDestroyed(msg) - case msg: UserJoined => handleUserJoined(msg) - case msg: UserLeft => handleUserLeft(msg) - case msg: MuteVoiceUser => handleMuteVoiceUser(msg) - case msg: EjectVoiceUser => handleEjectVoiceUser(msg) - case msg: UserJoinedVoice => handleUserJoinedVoice(msg) - case msg: UserLeftVoice => handleUserLeftVoice(msg) - case msg: EjectAllVoiceUsers => handleEjectAllVoiceUsers(msg) - case _ => // do nothing - } - } - - private def handleUserLeftVoice(msg: UserLeftVoice) { - fsActor ! msg - } - - private def handleUserJoinedVoice(msg: UserJoinedVoice) { - fsActor ! msg - } - - private def handleMuteVoiceUser(msg: MuteVoiceUser) { - fsActor ! msg - } - - private def handleEjectVoiceUser(msg: EjectVoiceUser) { - fsActor ! msg - } - - private def handleUserLeft(msg: UserLeft) { - fsActor ! msg - } - - private def handleUserJoined(msg: UserJoined) { - fsActor ! msg - } - - private def handleMeetingCreated(msg: MeetingCreated) { - fsActor ! msg - } - - private def handleMeetingEnded(msg: MeetingEnded) { - fsActor ! msg - } - - private def handleMeetingDestroyed(msg: MeetingDestroyed) { - fsActor ! msg - } - - private def handleEjectAllVoiceUsers(msg: EjectAllVoiceUsers) { - fsActor ! msg - } - - def voiceStartedRecording(conference: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) - fsActor ! fsRec - } - - def voiceUserJoined(userId: String, webUserId: String, conference: String, - callerIdNum: String, callerIdName: String, - muted: java.lang.Boolean, talking: java.lang.Boolean) { - // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") - val vuj = new FsVoiceUserJoined(userId, webUserId, - conference, callerIdNum, - callerIdName, muted, - talking) - fsActor ! vuj - } - - def voiceUserLeft(userId: String, conference: String) { - // println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") - val vul = new FsVoiceUserLeft(userId, conference) - fsActor ! vul - } - - def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { - val vul = new FsVoiceUserLocked(userId, conference, locked) - fsActor ! vul - } - - def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") - val vum = new FsVoiceUserMuted(userId, conference, muted) - fsActor ! vum - } - - def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") - val vut = new FsVoiceUserTalking(userId, conference, talking) - fsActor ! vut - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala deleted file mode 100755 index 993e77f699..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FreeswitchManagerProxy.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.webconference.voice.freeswitch.FreeswitchApplication - -class FreeswitchManagerProxy(fsApp: FreeswitchApplication) { - - def getUsers(conference: String) { - fsApp.populateRoom(conference) - } - - def ejectUsers(conference: String) { - fsApp.ejectAll(conference) - } - - def muteUser(conference: String, userId: String, mute: Boolean) { - println("Forwarding mute request to fsApp") - fsApp.mute(conference, userId, mute) - } - - def ejectUser(conference: String, userId: String) { - println("Forwarding eject user request to fsApp") - fsApp.eject(conference, userId) - } - - def startRecording(conference: String, meetingId: String) { - fsApp.record(conference, meetingId) - } - - def stopRecording(conference: String) { - - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala deleted file mode 100755 index 60f07a7211..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/FsInGwWrapper.scala +++ /dev/null @@ -1,12 +0,0 @@ -package org.bigbluebutton.freeswitch - -import org.bigbluebutton.core.api.IBigBlueButtonInGW - -/** - * Workaround to get away from circular dependency injection. - */ -class FsInGwWrapper(inGW: IBigBlueButtonInGW, - fsConfService: FreeswitchConferenceService) { - - fsConfService.setIBigBlueButtonInGW(inGW) -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala index 1afd5ad5ab..e4d56e7faf 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala @@ -4,6 +4,18 @@ import org.bigbluebutton.freeswitch.voice.IVoiceConferenceService import org.bigbluebutton.core.api._ import org.bigbluebutton.endpoint.redis.RedisPublisher +case class FsVoiceUserJoined(userId: String, webUserId: String, + conference: String, callerIdNum: String, + callerIdName: String, muted: Boolean, + speaking: Boolean) + +case class FsVoiceUserLeft(userId: String, conference: String) +case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) +case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) +case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) +case class FsRecording(conference: String, recordingFile: String, + timestamp: String, recording: Boolean) + class VoiceConferenceService(sender: RedisPublisher) extends IVoiceConferenceService { def voiceStartedRecording(conference: String, recordingFile: String, From 04b5e4fca30a352cebd8bce9519a11cca95af983 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Mon, 1 Jun 2015 21:44:45 +0000 Subject: [PATCH 27/30] - implement voice messages --- ...ctAllUsersFromVoiceConfRequestMessage.java | 56 ++++++++ .../EjectUserFromVoiceConfRequestMessage.java | 62 +++++++++ .../GetUsersFromVoiceConfRequestMessage.java | 56 ++++++++ .../common/messages/MessagingConstants.java | 7 + .../MuteUserInVoiceConfRequestMessage.java | 68 +++++++++ .../RecordVoiceConfRequestMessage.java | 62 +++++++++ ...StartRecordingVoiceConfRequestMessage.java | 56 ++++++++ .../StopRecordingVoiceConfRequestMessage.java | 62 +++++++++ .../messages/UserJoinedVoiceConfMessage.java | 87 ++++++++++++ .../messages/UserLeftVoiceConfMessage.java | 56 ++++++++ .../UserLockedInVoiceConfMessage.java | 62 +++++++++ .../messages/UserMutedInVoiceConfMessage.java | 62 +++++++++ .../UserTalkingInVoiceConfMessage.java | 62 +++++++++ .../VoiceConfRecordingStartedMessage.java | 69 ++++++++++ .../core/api/IBigBlueButtonInGW.java | 5 +- .../receivers/UsersMessageReceiver.java | 79 +++++++++++ .../core/BigBlueButtonActor.scala | 47 ++++++- .../core/BigBlueButtonGateway.scala | 26 +++- .../core/BigBlueButtonInGW.scala | 32 ++--- .../bigbluebutton/core/CollectorActor.scala | 32 +++-- .../org/bigbluebutton/core/MeetingActor.scala | 18 ++- .../bigbluebutton/core/api/Constants.scala | 2 + .../bigbluebutton/core/api/InMessages.scala | 41 ++---- .../bigbluebutton/core/api/OutMessages.scala | 4 + .../bigbluebutton/core/api/ValueObjects.scala | 3 +- .../core/apps/users/UsersApp.scala | 55 ++++---- .../core/apps/voice/VoiceInGateway.scala | 37 +++-- .../senders/UsersEventRedisPublisher.scala | 10 +- .../senders/UsersMessageToJsonConverter.scala | 4 + .../ChatEventRedisRecorder.scala | 2 +- .../PresentationEventRedisRecorder.scala | 2 +- .../UsersEventRedisRecorder.scala | 2 +- .../WhiteboardEventRedisRecorder.scala | 2 +- .../redis/AppsRedisSubscriberActor.scala | 2 +- .../freeswitch/pubsub/messages/Constants.java | 130 ++++++++++++++++++ ...ctAllUsersFromVoiceConfRequestMessage.java | 56 ++++++++ .../EjectUserFromVoiceConfRequestMessage.java | 62 +++++++++ .../GetUsersFromVoiceConfRequestMessage.java | 56 ++++++++ .../pubsub/messages/MessageBuilder.java | 36 +++++ .../MuteUserInVoiceConfRequestMessage.java | 68 +++++++++ .../RecordVoiceConfRequestMessage.java | 62 +++++++++ ...StartRecordingVoiceConfRequestMessage.java | 56 ++++++++ .../StopRecordingVoiceConfRequestMessage.java | 62 +++++++++ .../messages/UserJoinedVoiceConfMessage.java | 87 ++++++++++++ .../messages/UserLeftVoiceConfMessage.java | 56 ++++++++ .../UserLockedInVoiceConfMessage.java | 62 +++++++++ .../messages/UserMutedInVoiceConfMessage.java | 62 +++++++++ .../UserTalkingInVoiceConfMessage.java | 62 +++++++++ .../VoiceConfRecordingStartedMessage.java | 69 ++++++++++ .../receivers/RedisMessageReceiver.java | 61 ++++++++ .../FreeswitchConferenceEventListener.java | 39 +++--- .../voice/IVoiceConferenceService.java | 17 ++- ...pantCommand.java => EjectUserCommand.java} | 4 +- ...pantsCommand.java => GetUsersCommand.java} | 4 +- ...ipantCommand.java => MuteUserCommand.java} | 4 +- .../voice/commands/RecordCommand.java | 27 ++++ .../voice/freeswitch/ConnectionManager.java | 12 +- .../freeswitch/FreeswitchApplication.java | 43 +++--- ...pantCommand.java => EjectUserCommand.java} | 4 +- ...omCommand.java => GetAllUsersCommand.java} | 4 +- ...ipantCommand.java => MuteUserCommand.java} | 4 +- .../endpoint/redis/RedisPublisher.scala | 2 +- .../freeswitch/VoiceConferenceService.scala | 62 ++++----- 63 files changed, 2268 insertions(+), 237 deletions(-) create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectAllUsersFromVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersFromVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserInVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StartRecordingVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StopRecordingVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceConfMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceConfMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedInVoiceConfMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserMutedInVoiceConfMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserTalkingInVoiceConfMessage.java create mode 100755 labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/VoiceConfRecordingStartedMessage.java mode change 100644 => 100755 labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{pubsub/senders => recorders}/ChatEventRedisRecorder.scala (92%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{pubsub/senders => recorders}/PresentationEventRedisRecorder.scala (96%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{pubsub/senders => recorders}/UsersEventRedisRecorder.scala (96%) rename labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/{pubsub/senders => recorders}/WhiteboardEventRedisRecorder.scala (96%) create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/Constants.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectAllUsersFromVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectUserFromVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/GetUsersFromVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MessageBuilder.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MuteUserInVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/RecordVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StartRecordingVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserJoinedVoiceConfMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLeftVoiceConfMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLockedInVoiceConfMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserMutedInVoiceConfMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserTalkingInVoiceConfMessage.java create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/VoiceConfRecordingStartedMessage.java rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/{EjectParticipantCommand.java => EjectUserCommand.java} (84%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/{GetParticipantsCommand.java => GetUsersCommand.java} (85%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/{MuteParticipantCommand.java => MuteUserCommand.java} (84%) create mode 100755 labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/RecordCommand.java rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/{EjectParticipantCommand.java => EjectUserCommand.java} (85%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/{PopulateRoomCommand.java => GetAllUsersCommand.java} (94%) rename labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/{MuteParticipantCommand.java => MuteUserCommand.java} (86%) diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectAllUsersFromVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectAllUsersFromVoiceConfRequestMessage.java new file mode 100755 index 0000000000..28ba956a06 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectAllUsersFromVoiceConfRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class EjectAllUsersFromVoiceConfRequestMessage { + public static final String EJECT_ALL_VOICE_USERS_REQUEST = "eject_all_users_from_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + + public final String meetingId; + public final String voiceConfId; + + public EjectAllUsersFromVoiceConfRequestMessage(String meetingId, String voiceConfId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + + java.util.HashMap header = MessageBuilder.buildHeader(EJECT_ALL_VOICE_USERS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static EjectAllUsersFromVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (EJECT_ALL_VOICE_USERS_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + return new EjectAllUsersFromVoiceConfRequestMessage(id, voiceConfId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceConfRequestMessage.java new file mode 100755 index 0000000000..d9fd401687 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/EjectUserFromVoiceConfRequestMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class EjectUserFromVoiceConfRequestMessage { + public static final String EJECT_VOICE_USER_REQUEST = "eject_user_from_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + + public final String meetingId; + public final String voiceConfId; + public final String voiceUserId; + + public EjectUserFromVoiceConfRequestMessage(String meetingId, String voiceConfId, String voiceUserId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + + java.util.HashMap header = MessageBuilder.buildHeader(EJECT_VOICE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static EjectUserFromVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (EJECT_VOICE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + return new EjectUserFromVoiceConfRequestMessage(id, voiceConfId, voiceUserId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersFromVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersFromVoiceConfRequestMessage.java new file mode 100755 index 0000000000..8e295656c0 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/GetUsersFromVoiceConfRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class GetUsersFromVoiceConfRequestMessage { + public static final String GET_VOICE_USERS_REQUEST = "get_users_from_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + + public final String meetingId; + public final String voiceConfId; + + public GetUsersFromVoiceConfRequestMessage(String meetingId, String voiceConfId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_VOICE_USERS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static GetUsersFromVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_VOICE_USERS_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + return new GetUsersFromVoiceConfRequestMessage(id, voiceConfId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java index d762cac491..96f8d341c3 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java @@ -41,6 +41,13 @@ public class MessagingConstants { public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; + public static final String TO_VOICE_CONF_CHANNEL = "bigbluebutton:to-voice-conf"; + public static final String TO_VOICE_CONF_PATTERN = TO_VOICE_CONF_CHANNEL + ":*"; + public static final String TO_VOICE_CONF_SYSTEM_CHAN = TO_VOICE_CONF_CHANNEL + ":system"; + public static final String FROM_VOICE_CONF_CHANNEL = "bigbluebutton:from-voice-conf"; + public static final String FROM_VOICE_CONF_PATTERN = FROM_VOICE_CONF_CHANNEL + ":*"; + public static final String FROM_VOICE_CONF_SYSTEM_CHAN = FROM_VOICE_CONF_CHANNEL + ":system"; + public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent"; public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent"; public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent"; diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserInVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserInVoiceConfRequestMessage.java new file mode 100755 index 0000000000..4f45cef8e1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/MuteUserInVoiceConfRequestMessage.java @@ -0,0 +1,68 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class MuteUserInVoiceConfRequestMessage { + public static final String MUTE_VOICE_USER_REQUEST = "mute_user_in_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String MUTE = "mute"; + + public final String meetingId; + public final String voiceConfId; + public final String voiceUserId; + public final Boolean mute; + + public MuteUserInVoiceConfRequestMessage(String meetingId, String voiceConfId, String voiceUserId, Boolean mute) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.mute = mute; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(MUTE, mute); + + java.util.HashMap header = MessageBuilder.buildHeader(MUTE_VOICE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MuteUserInVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MUTE_VOICE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(MUTE)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean mute = payload.get(MUTE).getAsBoolean(); + return new MuteUserInVoiceConfRequestMessage(id, voiceConfId, voiceUserId, mute); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordVoiceConfRequestMessage.java new file mode 100755 index 0000000000..4158afea22 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/RecordVoiceConfRequestMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class RecordVoiceConfRequestMessage { + public static final String RECORD_VOICE_CONF_REQUEST = "record_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String RECORD = "record"; + + public final String meetingId; + public final String voiceConfId; + public final Boolean record; + + public RecordVoiceConfRequestMessage(String meetingId, String voiceConfId, Boolean record) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.record = record; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(RECORD, record); + + java.util.HashMap header = MessageBuilder.buildHeader(RECORD_VOICE_CONF_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static RecordVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(RECORD)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + Boolean record = payload.get(RECORD).getAsBoolean(); + return new RecordVoiceConfRequestMessage(id, voiceConfId, record); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StartRecordingVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StartRecordingVoiceConfRequestMessage.java new file mode 100755 index 0000000000..12e706f858 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StartRecordingVoiceConfRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class StartRecordingVoiceConfRequestMessage { + public static final String START_RECORD_VOICE_CONF_REQUEST = "start_recording__voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + + public final String meetingId; + public final String voiceConfId; + + public StartRecordingVoiceConfRequestMessage(String meetingId, String voiceConfId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + + java.util.HashMap header = MessageBuilder.buildHeader(START_RECORD_VOICE_CONF_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static StartRecordingVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (START_RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + return new StartRecordingVoiceConfRequestMessage(id, voiceConfId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StopRecordingVoiceConfRequestMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StopRecordingVoiceConfRequestMessage.java new file mode 100755 index 0000000000..fb84f12ef6 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/StopRecordingVoiceConfRequestMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class StopRecordingVoiceConfRequestMessage { + public static final String RECORD_VOICE_CONF_REQUEST = "stop_recording_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String RECORD_STREAM = "record_stream"; + + public final String meetingId; + public final String voiceConfId; + public final String recordStream; + + public StopRecordingVoiceConfRequestMessage(String meetingId, String voiceConfId, String recordStream) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.recordStream = recordStream; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(RECORD_STREAM, recordStream); + + java.util.HashMap header = MessageBuilder.buildHeader(RECORD_VOICE_CONF_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static StopRecordingVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(RECORD_STREAM)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String recordStream = payload.get(RECORD_STREAM).getAsString(); + return new StopRecordingVoiceConfRequestMessage(id, voiceConfId, recordStream); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceConfMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceConfMessage.java new file mode 100755 index 0000000000..cf8319dab0 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserJoinedVoiceConfMessage.java @@ -0,0 +1,87 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserJoinedVoiceConfMessage { + public static final String USER_JOINED_VOICE_CONF = "user_joined_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String USER_ID = "user_id"; + public static final String CALLER_ID_NAME = "caller_id_name"; + public static final String CALLER_ID_NUM = "caller_id_num"; + public static final String MUTED = "muted"; + public static final String TALKING = "talking"; + + public final String voiceConfId; + public final String voiceUserId; + public final String userId; + public final String callerIdName; + public final String callerIdNum; + public final Boolean muted; + public final Boolean talking; + + public UserJoinedVoiceConfMessage(String voiceConfId, String voiceUserId, String userId, + String callerIdName, String callerIdNum, Boolean muted, Boolean talking) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.userId = userId; + this.callerIdName = callerIdName; + this.callerIdNum = callerIdNum; + this.muted = muted; + this.talking = talking; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(USER_ID, userId); + payload.put(CALLER_ID_NAME, callerIdName); + payload.put(CALLER_ID_NUM, callerIdNum); + payload.put(MUTED, muted); + payload.put(TALKING, talking); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_JOINED_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserJoinedVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_JOINED_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(USER_ID) + && payload.has(CALLER_ID_NAME) + && payload.has(CALLER_ID_NUM) + && payload.has(MUTED) + && payload.has(TALKING)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + String userId = payload.get(USER_ID).getAsString(); + String callerIdName = payload.get(CALLER_ID_NAME).getAsString(); + String callerIdNum = payload.get(CALLER_ID_NUM).getAsString(); + Boolean muted = payload.get(MUTED).getAsBoolean(); + Boolean talking = payload.get(TALKING).getAsBoolean(); + return new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, callerIdName, callerIdNum, muted, talking); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceConfMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceConfMessage.java new file mode 100755 index 0000000000..fe94818eb4 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLeftVoiceConfMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLeftVoiceConfMessage { + public static final String USER_LEFT_VOICE_CONF = "user_left_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + + public final String voiceConfId; + public final String voiceUserId; + + public UserLeftVoiceConfMessage(String voiceConfId, String voiceUserId) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LEFT_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLeftVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LEFT_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + return new UserLeftVoiceConfMessage(voiceConfId, voiceUserId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedInVoiceConfMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedInVoiceConfMessage.java new file mode 100755 index 0000000000..d9fb7b85e1 --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserLockedInVoiceConfMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLockedInVoiceConfMessage { + public static final String USER_LOCKED_IN_VOICE_CONF = "user_locked_in_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String LOCKED = "locked"; + + public final String voiceConfId; + public final String voiceUserId; + public final Boolean locked; + + public UserLockedInVoiceConfMessage(String voiceConfId, String voiceUserId, Boolean locked) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.locked = locked; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(LOCKED, locked); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LOCKED_IN_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLockedInVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LOCKED_IN_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(LOCKED)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean locked = payload.get(LOCKED).getAsBoolean(); + return new UserLockedInVoiceConfMessage(voiceConfId, voiceUserId, locked); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserMutedInVoiceConfMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserMutedInVoiceConfMessage.java new file mode 100755 index 0000000000..cb87b8c98b --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserMutedInVoiceConfMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserMutedInVoiceConfMessage { + public static final String USER_MUTED_IN_VOICE_CONF = "user_muted_in_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String MUTED = "muted"; + + public final String voiceConfId; + public final String voiceUserId; + public final Boolean muted; + + public UserMutedInVoiceConfMessage(String voiceConfId, String voiceUserId, Boolean muted) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.muted = muted; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(MUTED, muted); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_MUTED_IN_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserMutedInVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_MUTED_IN_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(MUTED)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean muted = payload.get(MUTED).getAsBoolean(); + return new UserMutedInVoiceConfMessage(voiceConfId, voiceUserId, muted); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserTalkingInVoiceConfMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserTalkingInVoiceConfMessage.java new file mode 100755 index 0000000000..461337e16d --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/UserTalkingInVoiceConfMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserTalkingInVoiceConfMessage { + public static final String USER_TALKING_IN_VOICE_CONF = "user_talking_in_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String TALKING = "talking"; + + public final String voiceConfId; + public final String voiceUserId; + public final Boolean talking; + + public UserTalkingInVoiceConfMessage(String voiceConfId, String voiceUserId, Boolean talking) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.talking = talking; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(TALKING, talking); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_TALKING_IN_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserTalkingInVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_TALKING_IN_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(TALKING)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean talking = payload.get(TALKING).getAsBoolean(); + return new UserTalkingInVoiceConfMessage(voiceConfId, voiceUserId, talking); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/VoiceConfRecordingStartedMessage.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/VoiceConfRecordingStartedMessage.java new file mode 100755 index 0000000000..6bd2dd455c --- /dev/null +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/common/messages/VoiceConfRecordingStartedMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class VoiceConfRecordingStartedMessage { + public static final String VOICE_CONF_RECORDING_STARTED = "voice_conf_recording_started_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String RECORD_STREAM = "record_stream"; + public static final String RECORDING = "recording"; + public static final String TIMESTAMP = "timestamp"; + + public final String voiceConfId; + public final String recordStream; + public final Boolean recording; + public final String timestamp; + + public VoiceConfRecordingStartedMessage(String voiceConfId, + String recordStream, Boolean recording, String timestamp) { + this.voiceConfId = voiceConfId; + this.recordStream = recordStream; + this.recording = recording; + this.timestamp = timestamp; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(RECORD_STREAM, recordStream); + payload.put(RECORDING, recording); + payload.put(TIMESTAMP, timestamp); + + java.util.HashMap header = MessageBuilder.buildHeader(VOICE_CONF_RECORDING_STARTED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static VoiceConfRecordingStartedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (VOICE_CONF_RECORDING_STARTED.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(RECORD_STREAM) + && payload.has(RECORDING) + && payload.has(TIMESTAMP)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String recordStream = payload.get(RECORD_STREAM).getAsString(); + Boolean recording = payload.get(RECORDING).getAsBoolean(); + String timestamp = payload.get(TIMESTAMP).getAsString(); + return new VoiceConfRecordingStartedMessage(voiceConfId, recordStream, recording, timestamp); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java index 87c17e28c1..f72392105a 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -52,9 +52,8 @@ public interface IBigBlueButtonInGW { void lockMuteUser(String meetingID, String requesterID, String userID, Boolean lock); void ejectUserFromVoice(String meetingID, String userId, String ejectedBy); void ejectUserFromMeeting(String meetingId, String userId, String ejectedBy); - void voiceUserJoined(String meetingId, String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); + void voiceUserJoined(String voiceConfId, String voiceUserId, String userId, String callerIdName, + String callerIdNum, Boolean muted, Boolean talking); void voiceUserLeft(String meetingId, String userId); void voiceUserLocked(String meetingId, String userId, Boolean locked); void voiceUserMuted(String meetingId, String userId, Boolean muted); diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java index 6ec01c2a76..2b09f0d328 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/UsersMessageReceiver.java @@ -19,11 +19,17 @@ import org.bigbluebutton.common.messages.MuteAllRequestMessage; import org.bigbluebutton.common.messages.MuteUserRequestMessage; import org.bigbluebutton.common.messages.SetRecordingStatusRequestMessage; import org.bigbluebutton.common.messages.SetUserStatusRequestMessage; +import org.bigbluebutton.common.messages.UserJoinedVoiceConfMessage; import org.bigbluebutton.common.messages.UserLeavingMessage; +import org.bigbluebutton.common.messages.UserLeftVoiceConfMessage; +import org.bigbluebutton.common.messages.UserLockedInVoiceConfMessage; import org.bigbluebutton.common.messages.UserLoweredHandMessage; +import org.bigbluebutton.common.messages.UserMutedInVoiceConfMessage; import org.bigbluebutton.common.messages.UserRaisedHandMessage; import org.bigbluebutton.common.messages.UserShareWebcamRequestMessage; +import org.bigbluebutton.common.messages.UserTalkingInVoiceConfMessage; import org.bigbluebutton.common.messages.UserUnshareWebcamRequestMessage; +import org.bigbluebutton.common.messages.VoiceConfRecordingStartedMessage; import org.bigbluebutton.core.api.IBigBlueButtonInGW; import com.google.gson.JsonParser; @@ -119,6 +125,79 @@ public class UsersMessageReceiver implements MessageHandler{ } } } + } else if (channel.equalsIgnoreCase(MessagingConstants.FROM_VOICE_CONF_SYSTEM_CHAN)) { + System.out.println("Voice message: " + channel + " " + message); + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + switch (messageName) { + case UserJoinedVoiceConfMessage.USER_JOINED_VOICE_CONF: + processUserJoinedVoiceConfMessage(message); + break; + case UserLeftVoiceConfMessage.USER_LEFT_VOICE_CONF: + processUserLeftVoiceConfMessage(message); + break; + case UserLockedInVoiceConfMessage.USER_LOCKED_IN_VOICE_CONF: + processUserLockedInVoiceConfMessage(message); + break; + case UserMutedInVoiceConfMessage.USER_MUTED_IN_VOICE_CONF: + processUserMutedInVoiceConfMessage(message); + break; + case UserTalkingInVoiceConfMessage.USER_TALKING_IN_VOICE_CONF: + processUserTalkingInVoiceConfMessage(message); + break; + case VoiceConfRecordingStartedMessage.VOICE_CONF_RECORDING_STARTED: + processVoiceConfRecordingStartedMessage(message); + break; + } + } + } + } + } + + private void processUserJoinedVoiceConfMessage(String json) { + UserJoinedVoiceConfMessage msg = UserJoinedVoiceConfMessage.fromJson(json); + if (msg != null) { + bbbInGW.voiceUserJoined(msg.voiceConfId, msg.voiceUserId, msg.userId, msg.callerIdName, msg.callerIdNum, msg.muted, msg.talking); + } + } + + private void processUserLeftVoiceConfMessage(String json) { + UserLeftVoiceConfMessage msg = UserLeftVoiceConfMessage.fromJson(json); + if (msg != null) { + bbbInGW.voiceUserLeft(msg.voiceConfId, msg.voiceUserId); + } + } + + private void processUserLockedInVoiceConfMessage(String json) { + UserLockedInVoiceConfMessage msg = UserLockedInVoiceConfMessage.fromJson(json); + if (msg != null) { + bbbInGW.voiceUserLocked(msg.voiceConfId, msg.voiceUserId, msg.locked); + } + } + + private void processUserMutedInVoiceConfMessage(String json) { + UserMutedInVoiceConfMessage msg = UserMutedInVoiceConfMessage.fromJson(json); + if (msg != null) { + bbbInGW.voiceUserMuted(msg.voiceConfId, msg.voiceUserId, msg.muted); + } + } + + private void processUserTalkingInVoiceConfMessage(String json) { + UserTalkingInVoiceConfMessage msg = UserTalkingInVoiceConfMessage.fromJson(json); + if (msg != null) { + bbbInGW.voiceUserTalking(msg.voiceConfId, msg.voiceUserId, msg.talking); + } + } + + private void processVoiceConfRecordingStartedMessage(String json) { + VoiceConfRecordingStartedMessage msg = VoiceConfRecordingStartedMessage.fromJson(json); + if (msg != null) { + bbbInGW.voiceRecording(msg.voiceConfId, msg.recordStream, msg.timestamp, msg.recording); } } diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index b064d552df..ce50e5002e 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -23,7 +23,6 @@ class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) exte implicit def executionContext = actorRefFactory.dispatcher implicit val timeout = Timeout(5 seconds) - //private var meetings = new HashMap[String, MeetingActor] private var meetings = new collection.immutable.HashMap[String, RunningMeeting] def receive = { @@ -32,10 +31,56 @@ class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway) exte case msg: KeepAliveMessage => handleKeepAliveMessage(msg) case msg: ValidateAuthToken => handleValidateAuthToken(msg) case msg: GetAllMeetingsRequest => handleGetAllMeetingsRequest(msg) + case msg: UserJoinedVoiceConfMessage => handleUserJoinedVoiceConfMessage(msg) + case msg: UserLeftVoiceConfMessage => handleUserLeftVoiceConfMessage(msg) + case msg: UserLockedInVoiceConfMessage => handleUserLockedInVoiceConfMessage(msg) + case msg: UserMutedInVoiceConfMessage => handleUserMutedInVoiceConfMessage(msg) + case msg: UserTalkingInVoiceConfMessage => handleUserTalkingInVoiceConfMessage(msg) + case msg: VoiceConfRecordingStartedMessage => handleVoiceConfRecordingStartedMessage(msg) case msg: InMessage => handleMeetingMessage(msg) case _ => // do nothing } + private def findMeetingWithVoiceConfId(voiceConfId: String): Option[RunningMeeting] = { + meetings.values.find(m => m.voiceBridge == voiceConfId) + } + + private def handleUserJoinedVoiceConfMessage(msg: UserJoinedVoiceConfMessage) { + val rm = findMeetingWithVoiceConfId(msg.voiceConfId) + + rm foreach { m => m.actorRef ! msg } + } + + private def handleUserLeftVoiceConfMessage(msg: UserLeftVoiceConfMessage) { + val rm = findMeetingWithVoiceConfId(msg.voiceConfId) + + rm foreach { m => m.actorRef ! msg } + } + + private def handleUserLockedInVoiceConfMessage(msg: UserLockedInVoiceConfMessage) { + val rm = findMeetingWithVoiceConfId(msg.voiceConfId) + + rm foreach { m => m.actorRef ! msg } + } + + private def handleUserMutedInVoiceConfMessage(msg: UserMutedInVoiceConfMessage) { + val rm = findMeetingWithVoiceConfId(msg.voiceConfId) + + rm foreach { m => m.actorRef ! msg } + } + + private def handleVoiceConfRecordingStartedMessage(msg: VoiceConfRecordingStartedMessage) { + val rm = findMeetingWithVoiceConfId(msg.voiceConfId) + + rm foreach { m => m.actorRef ! msg } + } + + private def handleUserTalkingInVoiceConfMessage(msg: UserTalkingInVoiceConfMessage) { + val rm = findMeetingWithVoiceConfId(msg.voiceConfId) + + rm foreach { m => m.actorRef ! msg } + } + private def handleValidateAuthToken(msg: ValidateAuthToken) { meetings.get(msg.meetingID) foreach { m => val future = m.actorRef.ask(msg)(5 seconds) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala index f5a8a72335..d59d48ea4b 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonGateway.scala @@ -6,8 +6,7 @@ import akka.actor.{ ActorSystem, Props } class BigBlueButtonGateway(system: ActorSystem, outGW: MessageOutGateway) { - val bbbActor = system.actorOf( - BigBlueButtonActor.props(system, outGW), "bigbluebutton-actor") + val bbbActor = system.actorOf(BigBlueButtonActor.props(system, outGW), "bigbluebutton-actor") def accept(msg: InMessage): Unit = { bbbActor ! msg @@ -17,4 +16,27 @@ class BigBlueButtonGateway(system: ActorSystem, outGW: MessageOutGateway) { bbbActor ! msg } + def acceptUserJoinedVoiceConfMessage(msg: UserJoinedVoiceConfMessage) { + bbbActor ! msg + } + + def acceptUserLeftVoiceConfMessage(msg: UserLeftVoiceConfMessage) { + bbbActor ! msg + } + + def acceptUserLockedInVoiceConfMessage(msg: UserLockedInVoiceConfMessage) { + bbbActor ! msg + } + + def acceptUserMutedInVoiceConfMessage(msg: UserMutedInVoiceConfMessage) { + bbbActor ! msg + } + + def acceptUserTalkingInVoiceConfMessage(msg: UserTalkingInVoiceConfMessage) { + bbbActor ! msg + } + + def acceptVoiceConfRecordingStartedMessage(msg: VoiceConfRecordingStartedMessage) { + bbbActor ! msg + } } diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala index 5ec213f9ef..fe6e45cd00 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -397,35 +397,29 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW voiceGW.ejectUserFromVoice(meetingId, userId, ejectedBy) } - def voiceUserJoined(meetingId: String, userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, - muted: java.lang.Boolean, speaking: java.lang.Boolean) { + def voiceUserJoined(voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, + callerIdNum: String, muted: java.lang.Boolean, talking: java.lang.Boolean) { - voiceGW.voiceUserJoined(meetingId, userId, webUserId, - conference, callerIdNum, - callerIdName, muted, speaking) + voiceGW.voiceUserJoined(voiceConfId, voiceUserId, userId, callerIdName, callerIdNum, muted, talking) } - def voiceUserLeft(meetingId: String, userId: String) { - voiceGW.voiceUserLeft(meetingId, userId) + def voiceUserLeft(voiceConfId: String, voiceUserId: String) { + voiceGW.voiceUserLeft(voiceConfId, voiceUserId) } - def voiceUserLocked(meetingId: String, userId: String, locked: java.lang.Boolean) { - voiceGW.voiceUserLocked(meetingId, userId, locked) + def voiceUserLocked(voiceConfId: String, voiceUserId: String, locked: java.lang.Boolean) { + voiceGW.voiceUserLocked(voiceConfId, voiceUserId, locked) } - def voiceUserMuted(meetingId: String, userId: String, muted: java.lang.Boolean) { - voiceGW.voiceUserMuted(meetingId, userId, muted) + def voiceUserMuted(voiceConfId: String, voiceUserId: String, muted: java.lang.Boolean) { + voiceGW.voiceUserMuted(voiceConfId, voiceUserId, muted) } - def voiceUserTalking(meetingId: String, userId: String, talking: java.lang.Boolean) { - voiceGW.voiceUserTalking(meetingId, userId, talking) + def voiceUserTalking(voiceConfId: String, voiceUserId: String, talking: java.lang.Boolean) { + voiceGW.voiceUserTalking(voiceConfId, voiceUserId, talking) } - def voiceRecording(meetingId: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - voiceGW.voiceRecording(meetingId, recordingFile, - timestamp, recording) + def voiceRecording(voiceConfId: String, recordingFile: String, timestamp: String, recording: java.lang.Boolean) { + voiceGW.voiceRecording(voiceConfId, recordingFile, timestamp, recording) } } diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala index 037858b0c2..efc68df975 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala @@ -68,12 +68,12 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { case msg: LockUserRequest => handleLockUserRequest(msg) case msg: EjectUserFromVoiceRequest => handleEjectUserFromVoiceRequest(msg) case msg: VoiceUserJoinedMessage => handleVoiceUserJoinedMessage(msg) - case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - case msg: VoiceUserLocked => handleVoiceUserLocked(msg) - case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - case msg: VoiceUserTalking => handleVoiceUserTalking(msg) - case msg: VoiceRecording => handleVoiceRecording(msg) + // case msg: VoiceUserJoined => handleVoiceUserJoined(msg) + // case msg: VoiceUserLeft => handleVoiceUserLeft(msg) + // case msg: VoiceUserLocked => handleVoiceUserLocked(msg) + // case msg: VoiceUserMuted => handleVoiceUserMuted(msg) + // case msg: VoiceUserTalking => handleVoiceUserTalking(msg) + // case msg: VoiceRecording => handleVoiceRecording(msg) case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) @@ -945,6 +945,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { dispatcher.dispatch(buildJson(header, payload)) } + /* private def handleVoiceUserJoined(msg: VoiceUserJoined) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -958,7 +959,9 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { // println("***** DISPATCHING VOICE USER JOINED *****************") dispatcher.dispatch(buildJson(header, payload)) } +*/ + /* private def handleVoiceUserLeft(msg: VoiceUserLeft) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -972,7 +975,9 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { // println("***** DISPATCHING VOICE USER LEFT *****************") dispatcher.dispatch(buildJson(header, payload)) } +*/ + /* private def handleVoiceUserLocked(msg: VoiceUserLocked) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -987,7 +992,8 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { // println("***** DISPATCHING VOICE USER LOCKED *****************") dispatcher.dispatch(buildJson(header, payload)) } - +*/ + /* private def handleVoiceUserMuted(msg: VoiceUserMuted) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -1002,7 +1008,8 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { // println("***** DISPATCHING VOICE USER MUTED *****************") dispatcher.dispatch(buildJson(header, payload)) } - +*/ + /* private def handleVoiceUserTalking(msg: VoiceUserTalking) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -1017,7 +1024,8 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { // println("***** DISPATCHING VOICE USER TALKING *****************") dispatcher.dispatch(buildJson(header, payload)) } - +*/ + /* private def handleVoiceRecording(msg: VoiceRecording) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -1033,7 +1041,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { // println("***** DISPATCHING VOICE RECORDING *****************") dispatcher.dispatch(buildJson(header, payload)) } - +*/ private def handleSendWhiteboardAnnotationRequest(msg: SendWhiteboardAnnotationRequest) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) @@ -1429,7 +1437,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { payload.put(Constants.MEETING_ID, msg.meetingID) payload.put(Constants.RECORDED, msg.recorded) payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.VOICE_CONF_ID, msg.voiceConfId) payload.put(Constants.MUTE, msg.mute) val header = new java.util.HashMap[String, Any]() @@ -1478,7 +1486,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { payload.put(Constants.MEETING_ID, msg.meetingID) payload.put(Constants.RECORDED, msg.recorded) payload.put(Constants.USER_ID, msg.userId) - payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.VOICE_CONF_ID, msg.voiceConfId) val header = new java.util.HashMap[String, Any]() header.put(Constants.NAME, MessageNames.EJECT_VOICE_USER) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala index 0897ae2438..d6e781fcb0 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -66,10 +66,11 @@ class MeetingActor(val meetingID: String, val externalMeetingID: String, val mee case "MonitorNumberOfWebUsers" => handleMonitorNumberOfWebUsers() case msg: ValidateAuthToken => handleValidateAuthToken(msg) case msg: RegisterUser => handleRegisterUser(msg) - case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - case msg: VoiceUserTalking => handleVoiceUserTalking(msg) + case msg: UserJoinedVoiceConfMessage => handleUserJoinedVoiceConfMessage(msg) + case msg: UserLeftVoiceConfMessage => handleUserLeftVoiceConfMessage(msg) + case msg: UserMutedInVoiceConfMessage => handleUserMutedInVoiceConfMessage(msg) + case msg: UserTalkingInVoiceConfMessage => handleUserTalkingInVoiceConfMessage(msg) + case msg: VoiceConfRecordingStartedMessage => handleVoiceConfRecordingStartedMessage(msg) case msg: UserJoining => handleUserJoin(msg) case msg: UserLeaving => handleUserLeft(msg) case msg: AssignPresenter => handleAssignPresenter(msg) @@ -119,7 +120,6 @@ class MeetingActor(val meetingID: String, val externalMeetingID: String, val mee case msg: IsWhiteboardEnabledRequest => handleIsWhiteboardEnabledRequest(msg) case msg: SetRecordingStatus => handleSetRecordingStatus(msg) case msg: GetRecordingStatus => handleGetRecordingStatus(msg) - case msg: VoiceRecording => handleVoiceRecording(msg) case msg: EndMeeting => handleEndMeeting(msg) case StopMeetingActor => //exit @@ -206,14 +206,12 @@ class MeetingActor(val meetingID: String, val externalMeetingID: String, val mee outGW.send(new DisconnectAllUsers(msg.meetingID)) } - private def handleVoiceRecording(msg: VoiceRecording) { + private def handleVoiceConfRecordingStartedMessage(msg: VoiceConfRecordingStartedMessage) { if (msg.recording) { outGW.send(new VoiceRecordingStarted(meetingID, - recorded, msg.recordingFile, - msg.timestamp, voiceBridge)) + recorded, msg.recordStream, msg.timestamp, voiceBridge)) } else { - outGW.send(new VoiceRecordingStopped(meetingID, recorded, - msg.recordingFile, msg.timestamp, voiceBridge)) + outGW.send(new VoiceRecordingStopped(meetingID, recorded, msg.recordStream, msg.timestamp, voiceBridge)) } } diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala index 867bec3a53..0fedd00ed6 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala @@ -57,6 +57,8 @@ object Constants { val TALKING = "talking" val USER = "user" val MUTED = "muted" + val VOICE_CONF_ID = "voice_conf_id" + val VOICE_USER_ID = "voice_user_id" val VOICE_USER = "voice_user" val RECORDING_FILE = "recording_file" val ANNOTATION = "annotation" diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala index 6b93e92e35..1778dc4efd 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -311,34 +311,21 @@ case class VoiceUserJoinedMessage( muted: Boolean, talking: Boolean) extends InMessage -case class VoiceUserJoined( - meetingID: String, - voiceUser: VoiceUser) extends InMessage +case class UserJoinedVoiceConfMessage( + voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, + callerIdNum: String, muted: Boolean, talking: Boolean) -case class VoiceUserLeft( - meetingID: String, - userId: String) extends InMessage - -case class VoiceUserLocked( - meetingID: String, - userId: String, - locked: Boolean) extends InMessage - -case class VoiceUserMuted( - meetingID: String, - userId: String, - muted: Boolean) extends InMessage - -case class VoiceUserTalking( - meetingID: String, - userId: String, - talking: Boolean) extends InMessage - -case class VoiceRecording( - meetingID: String, - recordingFile: String, - timestamp: String, - recording: Boolean) extends InMessage +case class UserLeftVoiceConfMessage(voiceConfId: String, voiceUserId: String) +case class UserLockedInVoiceConfMessage(voiceConfId: String, voiceUserId: String, locked: Boolean) +case class UserMutedInVoiceConfMessage(voiceConfId: String, voiceUserId: String, muted: Boolean) +case class UserTalkingInVoiceConfMessage(voiceConfId: String, voiceUserId: String, talking: Boolean) +case class VoiceConfRecordingStartedMessage(voiceConfId: String, recordStream: String, recording: Boolean, timestamp: String) +//case class VoiceUserJoined(meetingID: String, voiceUser: VoiceUser) extends InMessage +//case class VoiceUserLeft(meetingID: String, userId: String) extends InMessage +//case class VoiceUserLocked(meetingID: String, userId: String, locked: Boolean) extends InMessage +//case class VoiceUserMuted(meetingID: String, userId: String, muted: Boolean) extends InMessage +//case class VoiceUserTalking( meetingID: String, userId: String, talking: Boolean) extends InMessage +//case class VoiceRecording(meetingID: String, recordingFile: String, timestamp: String, recording: Boolean) extends InMessage // Whiteboard case class SendWhiteboardAnnotationRequest( diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala index de4be709e3..20c8bbd712 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala @@ -228,6 +228,8 @@ case class MuteVoiceUser( recorded: Boolean, requesterID: String, userId: String, + voiceConfId: String, + voiceUserId: String, mute: Boolean, version: String = Versions.V_0_0_1) extends IOutMessage @@ -250,6 +252,8 @@ case class EjectVoiceUser( recorded: Boolean, requesterID: String, userId: String, + voiceConfId: String, + voiceUserId: String, version: String = Versions.V_0_0_1) extends IOutMessage case class UserJoinedVoice( diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala index 82de5a8a5a..a4e6b8dce3 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala @@ -71,7 +71,8 @@ case class UserVO( voiceUser: VoiceUser, listenOnly: Boolean) -case class VoiceUser(userId: String, +case class VoiceUser( + userId: String, webUserId: String, callerName: String, callerNum: String, diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala index 578f05f25e..00af261dfb 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala @@ -59,7 +59,7 @@ trait UsersApp { outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) usersWhoAreNotPresenter foreach { u => - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, voiceBridge, u.voiceUser.userId, msg.mute)) } } @@ -67,7 +67,7 @@ trait UsersApp { meetingMuted = msg.mute outGW.send(new MeetingMuted(meetingID, recorded, meetingMuted)) users.getUsers foreach { u => - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, voiceBridge, u.voiceUser.userId, msg.mute)) } } @@ -125,7 +125,7 @@ trait UsersApp { case Some(u) => { // println("Sending mute user request uid=[" + msg.userID + "] mute=[" + msg.mute + "]") log.info("Muting user: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, msg.mute)) + outGW.send(new MuteVoiceUser(meetingID, recorded, msg.requesterID, u.userID, voiceBridge, u.voiceUser.userId, msg.mute)) } case None => { log.info("Could not find user to mute: mid=[" + meetingID + "] uid=[" + msg.userID + "]") @@ -140,7 +140,7 @@ trait UsersApp { case Some(u) => { if (u.voiceUser.joined) { log.info("Ejecting user from voice: mid=[" + meetingID + "] uid=[" + u.userID + "]") - outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, u.userID)) + outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, u.userID, voiceBridge, u.voiceUser.userId)) } } case None => // do nothing @@ -226,7 +226,7 @@ trait UsersApp { def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) { users.getUser(msg.userId) foreach { user => if (user.voiceUser.joined) { - outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, msg.userId)) + outGW.send(new EjectVoiceUser(meetingID, recorded, msg.ejectedBy, msg.userId, voiceBridge, user.voiceUser.userId)) } users.removeUser(msg.userId) @@ -326,49 +326,49 @@ trait UsersApp { permissions.lockOnJoin && !role.equals(Role.MODERATOR) } - def handleUserJoinedVoiceFromPhone(msg: VoiceUserJoined) = { - val user = users.getUserWithVoiceUserId(msg.voiceUser.userId) match { + def handleUserJoinedVoiceFromPhone(msg: UserJoinedVoiceConfMessage) = { + val user = users.getUserWithVoiceUserId(msg.voiceUserId) match { case Some(user) => { - log.info("Voice user=[" + msg.voiceUser.userId + "] is already in conf=[" + voiceBridge + "]. Must be duplicate message.") + log.info("Voice user=[" + msg.voiceUserId + "] is already in conf=[" + voiceBridge + "]. Must be duplicate message.") } case None => { // No current web user. This means that the user called in through // the phone. We need to generate a new user as we are not able // to match with a web user. val webUserId = users.generateWebUserId - val vu = new VoiceUser(msg.voiceUser.userId, webUserId, - msg.voiceUser.callerName, msg.voiceUser.callerNum, + val vu = new VoiceUser(msg.voiceUserId, webUserId, msg.callerIdName, msg.callerIdNum, true, false, false, false) val sessionId = "PHONE-" + webUserId; - val uvo = new UserVO(webUserId, webUserId, msg.voiceUser.callerName, + val uvo = new UserVO(webUserId, webUserId, msg.callerIdName, Role.VIEWER, raiseHand = false, presenter = false, hasStream = false, locked = getInitialLockStatus(Role.VIEWER), webcamStreams = new ListSet[String](), phoneUser = true, vu, listenOnly = false) users.addUser(uvo) - log.info("New user joined voice for user [" + uvo.name + "] userid=[" + msg.voiceUser.webUserId + "]") + log.info("New user joined voice for user [" + uvo.name + "] userid=[" + webUserId + "]") outGW.send(new UserJoined(meetingID, recorded, uvo, sessionId)) outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, uvo)) if (meetingMuted) - outGW.send(new MuteVoiceUser(meetingID, recorded, uvo.userID, uvo.userID, meetingMuted)) + outGW.send(new MuteVoiceUser(meetingID, recorded, uvo.userID, uvo.userID, voiceBridge, vu.userId, meetingMuted)) } } } - def handleVoiceUserJoined(msg: VoiceUserJoined) = { - val user = users.getUser(msg.voiceUser.webUserId) match { + def handleUserJoinedVoiceConfMessage(msg: UserJoinedVoiceConfMessage) = { + val user = users.getUser(msg.userId) match { case Some(user) => { - val nu = user.copy(voiceUser = msg.voiceUser) + val vu = new VoiceUser(msg.voiceUserId, msg.userId, msg.callerIdName, msg.callerIdNum, true, false, msg.muted, msg.talking) + val nu = user.copy(voiceUser = vu) users.addUser(nu) - log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.voiceUser.webUserId + "]") + log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.userId + "]") outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) if (meetingMuted) - outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, meetingMuted)) + outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, voiceBridge, nu.voiceUser.userId, meetingMuted)) } case None => { handleUserJoinedVoiceFromPhone(msg) @@ -376,28 +376,27 @@ trait UsersApp { } } - def handleVoiceUserLeft(msg: VoiceUserLeft) { - users.getUser(msg.userId) foreach { user => - val vu = new VoiceUser(user.userID, user.userID, user.name, user.name, - false, false, false, false) + def handleUserLeftVoiceConfMessage(msg: UserLeftVoiceConfMessage) { + users.getUserWithVoiceUserId(msg.voiceUserId) foreach { user => + val vu = new VoiceUser(user.userID, user.userID, user.name, user.name, false, false, false, false) val nu = user.copy(voiceUser = vu) users.addUser(nu) // println("Received voice user left =[" + user.name + "] wid=[" + msg.userId + "]" ) - log.info("Received user left voice for user [" + nu.name + "] userid=[" + msg.userId + "]") + log.info("Received user left voice for user [" + nu.name + "] userid=[" + msg.voiceUserId + "]") outGW.send(new UserLeftVoice(meetingID, recorded, voiceBridge, nu)) if (user.phoneUser) { if (users.hasUser(user.userID)) { val userLeaving = users.removeUser(user.userID) - userLeaving foreach (u => outGW.send(new UserLeft(msg.meetingID, recorded, u))) + userLeaving foreach (u => outGW.send(new UserLeft(meetingID, recorded, u))) } } } } - def handleVoiceUserMuted(msg: VoiceUserMuted) { - users.getUser(msg.userId) foreach { user => + def handleUserMutedInVoiceConfMessage(msg: UserMutedInVoiceConfMessage) { + users.getUserWithVoiceUserId(msg.voiceUserId) foreach { user => val talking: Boolean = if (msg.muted) false else user.voiceUser.talking val nv = user.voiceUser.copy(muted = msg.muted, talking = talking) val nu = user.copy(voiceUser = nv) @@ -407,8 +406,8 @@ trait UsersApp { } } - def handleVoiceUserTalking(msg: VoiceUserTalking) { - users.getUser(msg.userId) foreach { user => + def handleUserTalkingInVoiceConfMessage(msg: UserTalkingInVoiceConfMessage) { + users.getUserWithVoiceUserId(msg.voiceUserId) foreach { user => val nv = user.voiceUser.copy(talking = msg.talking) val nu = user.copy(voiceUser = nv) users.addUser(nu) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala old mode 100644 new mode 100755 index f06efed41d..baa6e3ed37 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala @@ -29,37 +29,34 @@ class VoiceInGateway(bbbGW: BigBlueButtonGateway) { bbbGW.accept(new EjectUserFromVoiceRequest(meetingID, userId, ejectedBy)) } - def voiceUserJoined(meetingId: String, userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, - muted: Boolean, talking: Boolean) { + def voiceUserJoined(voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, + callerIdNum: String, muted: Boolean, talking: Boolean) { // println("VoiceInGateway: Got voiceUserJoined message for meeting [" + meetingId + "] user[" + callerIdName + "]") - val voiceUser = new VoiceUser(userId, webUserId, - callerIdName, callerIdNum, - true, false, muted, talking) - bbbGW.accept(new VoiceUserJoined(meetingId, voiceUser)) + val voiceUser = new VoiceUser(voiceUserId, userId, callerIdName, callerIdNum, true, false, muted, talking) + val msg = new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, callerIdName, + callerIdNum, muted, talking) + + bbbGW.acceptUserJoinedVoiceConfMessage(msg) } - def voiceUserLeft(meetingId: String, userId: String) { + def voiceUserLeft(voiceConfId: String, voiceUserId: String) { // println("VoiceInGateway: Got voiceUserLeft message for meeting [" + meetingId + "] user[" + userId + "]") - bbbGW.accept(new VoiceUserLeft(meetingId, userId)) + bbbGW.acceptUserLeftVoiceConfMessage(new UserLeftVoiceConfMessage(voiceConfId, voiceUserId)) } - def voiceUserLocked(meetingId: String, userId: String, locked: Boolean) { - bbbGW.accept(new VoiceUserLocked(meetingId, userId, locked)) + def voiceUserLocked(voiceConfId: String, voiceUserId: String, locked: Boolean) { + bbbGW.acceptUserLockedInVoiceConfMessage(new UserLockedInVoiceConfMessage(voiceConfId, voiceUserId, locked)) } - def voiceUserMuted(meetingId: String, userId: String, muted: Boolean) { - bbbGW.accept(new VoiceUserMuted(meetingId, userId, muted)) + def voiceUserMuted(voiceConfId: String, voiceUserId: String, muted: Boolean) { + bbbGW.acceptUserMutedInVoiceConfMessage(new UserMutedInVoiceConfMessage(voiceConfId, voiceUserId, muted)) } - def voiceUserTalking(meetingId: String, userId: String, talking: Boolean) { - bbbGW.accept(new VoiceUserTalking(meetingId, userId, talking)) + def voiceUserTalking(voiceConfId: String, voiceUserId: String, talking: Boolean) { + bbbGW.acceptUserTalkingInVoiceConfMessage(new UserTalkingInVoiceConfMessage(voiceConfId, voiceUserId, talking)) } - def voiceRecording(meetingId: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - bbbGW.accept(new VoiceRecording(meetingId, recordingFile, - timestamp, recording)) + def voiceRecording(voiceConfId: String, recordingFile: String, timestamp: String, recording: java.lang.Boolean) { + bbbGW.acceptVoiceConfRecordingStartedMessage(new VoiceConfRecordingStartedMessage(voiceConfId, recordingFile, recording, timestamp)) } } \ No newline at end of file diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala index 10dc6d70bd..c6687bf951 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisPublisher.scala @@ -7,6 +7,7 @@ import com.google.gson.Gson import org.bigbluebutton.common.messages.GetCurrentLayoutReplyMessage import org.bigbluebutton.common.messages.BroadcastLayoutMessage import org.bigbluebutton.common.messages.LockLayoutMessage +import org.bigbluebutton.common.messages.{ MuteUserInVoiceConfRequestMessage, EjectUserFromVoiceConfRequestMessage } class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListener2 { @@ -178,13 +179,14 @@ class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListene } private def handleMuteVoiceUser(msg: MuteVoiceUser) { - val json = UsersMessageToJsonConverter.muteVoiceUserToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + val m = new MuteUserInVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId, msg.voiceUserId, msg.mute) + service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, m.toJson()) } private def handleEjectVoiceUser(msg: EjectVoiceUser) { - val json = UsersMessageToJsonConverter.ejectVoiceUserToJson(msg) - service.send(MessagingConstants.FROM_USERS_CHANNEL, json) + val m = new EjectUserFromVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId, msg.voiceUserId) + service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, m.toJson()) + } private def handleUserLeftVoice(msg: UserLeftVoice) { diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala index 046be6d67f..dd97ded14b 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersMessageToJsonConverter.scala @@ -294,6 +294,8 @@ object UsersMessageToJsonConverter { payload.put(Constants.MUTE, msg.mute) payload.put(Constants.USER_ID, msg.userId) payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.VOICE_CONF_ID, msg.voiceConfId) + payload.put(Constants.VOICE_USER_ID, msg.voiceUserId) val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) Util.buildJson(header, payload) @@ -305,6 +307,8 @@ object UsersMessageToJsonConverter { payload.put(Constants.RECORDED, msg.recorded) payload.put(Constants.USER_ID, msg.userId) payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.VOICE_CONF_ID, msg.voiceConfId) + payload.put(Constants.VOICE_USER_ID, msg.voiceUserId) val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None) Util.buildJson(header, payload) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/ChatEventRedisRecorder.scala similarity index 92% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/ChatEventRedisRecorder.scala index 969f59eb3c..da50c45501 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/ChatEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.pubsub.senders +package org.bigbluebutton.core.recorders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/PresentationEventRedisRecorder.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/PresentationEventRedisRecorder.scala index 9d60a62a33..12600928d8 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/PresentationEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/PresentationEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.pubsub.senders +package org.bigbluebutton.core.recorders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api.OutMessageListener2 diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/UsersEventRedisRecorder.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/UsersEventRedisRecorder.scala index 9a15792785..3d9e31d038 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/UsersEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/UsersEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.pubsub.senders +package org.bigbluebutton.core.recorders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisRecorder.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/WhiteboardEventRedisRecorder.scala similarity index 96% rename from labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisRecorder.scala rename to labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/WhiteboardEventRedisRecorder.scala index 408f1efa3b..9bad10a45b 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/WhiteboardEventRedisRecorder.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/recorders/WhiteboardEventRedisRecorder.scala @@ -1,4 +1,4 @@ -package org.bigbluebutton.core.pubsub.senders +package org.bigbluebutton.core.recorders import org.bigbluebutton.conference.service.recorder.RecorderApplication import org.bigbluebutton.core.api._ diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala index 8f7887243a..c7929f536c 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -13,7 +13,7 @@ import org.bigbluebutton.core.pubsub.receivers.RedisMessageReceiver object AppsRedisSubscriberActor extends SystemConfiguration { val channels = Seq("time") - val patterns = Seq("bigbluebutton:to-bbb-apps:*") + val patterns = Seq("bigbluebutton:to-bbb-apps:*", "bigbluebutton:from-voice-conf:*") def props(msgReceiver: RedisMessageReceiver): Props = Props(classOf[AppsRedisSubscriberActor], msgReceiver, diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/Constants.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/Constants.java new file mode 100755 index 0000000000..96e28ed3f2 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/Constants.java @@ -0,0 +1,130 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +public class Constants { + public static final String NAME = "name"; + public static final String HEADER = "header"; + public static final String PAYLOAD = "payload"; + public static final String MEETING_ID = "meeting_id"; + public static final String EXTERNAL_MEETING_ID = "external_meeting_id"; + public static final String TIMESTAMP = "timestamp"; + public static final String USER_ID = "userid"; + public static final String RECORDED = "recorded"; + public static final String MEETING_NAME = "meeting_name"; + public static final String MEETING_MUTED = "meetingMuted"; + public static final String VOICE_CONF = "voice_conf"; + public static final String DURATION = "duration"; + public static final String AUTH_TOKEN = "auth_token"; + public static final String ROLE = "role"; + public static final String EXT_USER_ID = "external_user_id"; + public static final String EXTERN_USERID = "extern_userid"; + public static final String REQUESTER_ID = "requester_id"; + public static final String REPLY_TO = "reply_to"; + public static final String LOWERED_BY = "lowered_by"; + public static final String STREAM = "stream"; + public static final String LOCKED = "locked"; + public static final String SETTINGS = "settings"; + public static final String LOCK = "lock"; + public static final String EXCEPT_USERS = "except_users"; + public static final String STATUS = "status"; + public static final String VALUE = "value"; + public static final String NEW_PRESENTER_ID = "new_presenter_id"; + public static final String NEW_PRESENTER_NAME = "new_presenter_name"; + public static final String ASSIGNED_BY = "assigned_by"; + public static final String RECORDING = "recording"; + public static final String AUTO_START_RECORDING = "auto_start_recording"; + public static final String ALLOW_START_STOP_RECORDING = "allow_start_stop_recording"; + public static final String LAYOUT_ID = "layout_id"; + public static final String LISTENONLY = "listenOnly"; + public static final String LISTEN_ONLY = "listen_only"; + public static final String POLL = "poll"; + public static final String POLL_ID = "poll_id"; + public static final String FORCE = "force"; + public static final String RESPONSE = "response"; + public static final String PRESENTATION_ID = "presentation_id"; + public static final String X_OFFSET = "x_offset"; + public static final String Y_OFFSET = "y_offset"; + public static final String WIDTH_RATIO = "width_ratio"; + public static final String HEIGHT_RATIO = "height_ratio"; + public static final String PAGE = "page"; + public static final String SHARE = "share"; + public static final String PRESENTATIONS = "presentations"; + public static final String MESSAGE_KEY = "message_key"; + public static final String CODE = "code"; + public static final String PRESENTATION_NAME = "presentation_name"; + public static final String NUM_PAGES = "num_pages"; + public static final String MAX_NUM_PAGES = "max_num_pages"; + public static final String PAGES_COMPLETED = "pages_completed"; + public static final String MUTE = "mute"; + public static final String CALLER_ID_NUM = "caller_id_num"; + public static final String CALLER_ID_NAME = "caller_id_name"; + public static final String CALLERNUM = "callernum"; + public static final String CALLERNAME = "callername"; + public static final String TALKING = "talking"; + public static final String USER = "user"; + public static final String MUTED = "muted"; + public static final String VOICE_USER = "voice_user"; + public static final String VOICEUSER = "voiceUser"; + public static final String RECORDING_FILE = "recording_file"; + public static final String ANNOTATION = "annotation"; + public static final String WHITEBOARD_ID = "whiteboard_id"; + public static final String ENABLE = "enable"; + public static final String PRESENTER = "presenter"; + public static final String USERS = "users"; + public static final String RAISE_HAND = "raise_hand"; + public static final String HAS_STREAM = "has_stream"; + public static final String WEBCAM_STREAM = "webcam_stream"; + public static final String PHONE_USER = "phone_user"; + public static final String PERMISSIONS = "permissions"; + public static final String VALID = "valid"; + public static final String CHAT_HISTORY = "chat_history"; + public static final String MESSAGE = "message"; + public static final String SET_BY_USER_ID = "set_by_user_id"; + public static final String POLLS = "polls"; + public static final String REASON = "reason"; + public static final String RESPONDER = "responder"; + public static final String PRESENTATION_INFO = "presentation_info"; + public static final String SHAPES = "shapes"; + public static final String SHAPE = "shape"; + public static final String SHAPE_ID = "shape_id"; + public static final String PRESENTATION = "presentation"; + public static final String ID = "id"; + public static final String CURRENT = "current"; + public static final String PAGES = "pages"; + public static final String WEB_USER_ID = "web_user_id"; + public static final String WEB_USERID = "web_userid"; + public static final String JOINED = "joined"; + public static final String X_PERCENT = "x_percent"; + public static final String Y_PERCENT = "y_percent"; + public static final String KEEP_ALIVE_ID = "keep_alive_id"; + public static final String INTERNAL_USER_ID = "internal_user_id"; + public static final String MODERATOR_PASS = "moderator_pass"; + public static final String VIEWER_PASS = "viewer_pass"; + public static final String CREATE_TIME = "create_time"; + public static final String CREATE_DATE = "create_date"; + public static final String PRESENTATION_BASE_URL = "presentation_base_url"; + public static final String DISABLE_CAMERA = "disable_camera"; + public static final String LOCK_ON_JOIN_CONFIGURABLE = "lock_on_join_configurable"; + public static final String DISABLE_MICROPHONE = "disable_microphone"; + public static final String DISABLE_PRIVATE_CHAT = "disable_private_chat"; + public static final String DISABLE_PUBLIC_CHAT = "disable_public_chat"; + public static final String LOCK_ON_JOIN = "lock_on_join"; + public static final String LOCKED_LAYOUT = "locked_layout"; + public static final String CHAT_TYPE = "chat_type"; + public static final String TO_USERNAME = "to_username"; + public static final String FROM_USERNAME = "from_username"; + public static final String FROM_USERID = "from_userid"; + public static final String FROM_TZ_OFFSET = "from_tz_offset"; + public static final String FROM_COLOR = "from_color"; + public static final String TO_USERID = "to_userid"; + public static final String FROM_TIME = "from_time"; + public static final String PERM_DISABLE_CAM = "disableCam"; + public static final String PERM_DISABLE_MIC = "disableMic"; + public static final String PERM_DISABLE_PRIVCHAT = "disablePrivChat"; + public static final String PERM_DISABLE_PUBCHAT = "disablePubChat"; + public static final String PERM_LOCKED_LAYOUT = "lockedLayout"; + public static final String PERM_LOCK_ON_JOIN = "lockOnJoin"; + public static final String PERM_LOCK_ON_JOIN_CONFIG = "lockOnJoinConfigurable"; + public static final String ENABLED = "enabled"; +} + + diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectAllUsersFromVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectAllUsersFromVoiceConfRequestMessage.java new file mode 100755 index 0000000000..100326ca17 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectAllUsersFromVoiceConfRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class EjectAllUsersFromVoiceConfRequestMessage { + public static final String EJECT_ALL_VOICE_USERS_REQUEST = "eject_all_users_from_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + + public final String meetingId; + public final String voiceConfId; + + public EjectAllUsersFromVoiceConfRequestMessage(String meetingId, String voiceConfId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + + java.util.HashMap header = MessageBuilder.buildHeader(EJECT_ALL_VOICE_USERS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static EjectAllUsersFromVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (EJECT_ALL_VOICE_USERS_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + return new EjectAllUsersFromVoiceConfRequestMessage(id, voiceConfId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectUserFromVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectUserFromVoiceConfRequestMessage.java new file mode 100755 index 0000000000..8b2db7d1de --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/EjectUserFromVoiceConfRequestMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class EjectUserFromVoiceConfRequestMessage { + public static final String EJECT_VOICE_USER_REQUEST = "eject_user_from_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + + public final String meetingId; + public final String voiceConfId; + public final String voiceUserId; + + public EjectUserFromVoiceConfRequestMessage(String meetingId, String voiceConfId, String voiceUserId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + + java.util.HashMap header = MessageBuilder.buildHeader(EJECT_VOICE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static EjectUserFromVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (EJECT_VOICE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + return new EjectUserFromVoiceConfRequestMessage(id, voiceConfId, voiceUserId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/GetUsersFromVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/GetUsersFromVoiceConfRequestMessage.java new file mode 100755 index 0000000000..16dd72400b --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/GetUsersFromVoiceConfRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class GetUsersFromVoiceConfRequestMessage { + public static final String GET_VOICE_USERS_REQUEST = "get_users_from_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + + public final String meetingId; + public final String voiceConfId; + + public GetUsersFromVoiceConfRequestMessage(String meetingId, String voiceConfId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + + java.util.HashMap header = MessageBuilder.buildHeader(GET_VOICE_USERS_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static GetUsersFromVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (GET_VOICE_USERS_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + return new GetUsersFromVoiceConfRequestMessage(id, voiceConfId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MessageBuilder.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MessageBuilder.java new file mode 100755 index 0000000000..0bd78cb3ca --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MessageBuilder.java @@ -0,0 +1,36 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.concurrent.TimeUnit; + +import com.google.gson.Gson; + +public class MessageBuilder { + public final static String VERSION = "version"; + + public static long generateTimestamp() { + return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + } + + public static java.util.HashMap buildHeader(String name, String version, String replyTo) { + java.util.HashMap header = new java.util.HashMap(); + header.put(Constants.NAME, name); + header.put(VERSION, version); + header.put(Constants.TIMESTAMP, generateTimestamp()); + if (replyTo != null && replyTo != "") + header.put(Constants.REPLY_TO, replyTo); + + return header; + } + + + public static String buildJson(java.util.HashMap header, + java.util.HashMap payload) { + + java.util.HashMap> message = new java.util.HashMap>(); + message.put(Constants.HEADER, header); + message.put(Constants.PAYLOAD, payload); + + Gson gson = new Gson(); + return gson.toJson(message); + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MuteUserInVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MuteUserInVoiceConfRequestMessage.java new file mode 100755 index 0000000000..2be732529b --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/MuteUserInVoiceConfRequestMessage.java @@ -0,0 +1,68 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class MuteUserInVoiceConfRequestMessage { + public static final String MUTE_VOICE_USER_REQUEST = "mute_user_in_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String MUTE = "mute"; + + public final String meetingId; + public final String voiceConfId; + public final String voiceUserId; + public final Boolean mute; + + public MuteUserInVoiceConfRequestMessage(String meetingId, String voiceConfId, String voiceUserId, Boolean mute) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.mute = mute; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(MUTE, mute); + + java.util.HashMap header = MessageBuilder.buildHeader(MUTE_VOICE_USER_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static MuteUserInVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (MUTE_VOICE_USER_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(MUTE)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean mute = payload.get(MUTE).getAsBoolean(); + return new MuteUserInVoiceConfRequestMessage(id, voiceConfId, voiceUserId, mute); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/RecordVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/RecordVoiceConfRequestMessage.java new file mode 100755 index 0000000000..0e49c23c89 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/RecordVoiceConfRequestMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class RecordVoiceConfRequestMessage { + public static final String RECORD_VOICE_CONF_REQUEST = "record_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String RECORD = "record"; + + public final String meetingId; + public final String voiceConfId; + public final Boolean record; + + public RecordVoiceConfRequestMessage(String meetingId, String voiceConfId, Boolean record) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.record = record; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(RECORD, record); + + java.util.HashMap header = MessageBuilder.buildHeader(RECORD_VOICE_CONF_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static RecordVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(RECORD)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + Boolean record = payload.get(RECORD).getAsBoolean(); + return new RecordVoiceConfRequestMessage(id, voiceConfId, record); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StartRecordingVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StartRecordingVoiceConfRequestMessage.java new file mode 100755 index 0000000000..b3ef7ad6c5 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StartRecordingVoiceConfRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class StartRecordingVoiceConfRequestMessage { + public static final String START_RECORD_VOICE_CONF_REQUEST = "start_recording__voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + + public final String meetingId; + public final String voiceConfId; + + public StartRecordingVoiceConfRequestMessage(String meetingId, String voiceConfId) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + + java.util.HashMap header = MessageBuilder.buildHeader(START_RECORD_VOICE_CONF_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static StartRecordingVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (START_RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + return new StartRecordingVoiceConfRequestMessage(id, voiceConfId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java new file mode 100755 index 0000000000..3cf464a210 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class StopRecordingVoiceConfRequestMessage { + public static final String RECORD_VOICE_CONF_REQUEST = "stop_recording_voice_conf_request_message"; + public static final String VERSION = "0.0.1"; + + public static final String MEETING_ID = "meeting_id"; + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String RECORD_STREAM = "record_stream"; + + public final String meetingId; + public final String voiceConfId; + public final String recordStream; + + public StopRecordingVoiceConfRequestMessage(String meetingId, String voiceConfId, String recordStream) { + this.meetingId = meetingId; + this.voiceConfId = voiceConfId; + this.recordStream = recordStream; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(MEETING_ID, meetingId); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(RECORD_STREAM, recordStream); + + java.util.HashMap header = MessageBuilder.buildHeader(RECORD_VOICE_CONF_REQUEST, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static StopRecordingVoiceConfRequestMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (payload.has(MEETING_ID) + && payload.has(VOICE_CONF_ID) + && payload.has(RECORD_STREAM)) { + String id = payload.get(MEETING_ID).getAsString(); + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String recordStream = payload.get(RECORD_STREAM).getAsString(); + return new StopRecordingVoiceConfRequestMessage(id, voiceConfId, recordStream); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserJoinedVoiceConfMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserJoinedVoiceConfMessage.java new file mode 100755 index 0000000000..964b0762cd --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserJoinedVoiceConfMessage.java @@ -0,0 +1,87 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserJoinedVoiceConfMessage { + public static final String USER_JOINED_VOICE_CONF = "user_joined_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String USER_ID = "user_id"; + public static final String CALLER_ID_NAME = "caller_id_name"; + public static final String CALLER_ID_NUM = "caller_id_num"; + public static final String MUTED = "muted"; + public static final String TALKING = "talking"; + + public final String voiceConfId; + public final String voiceUserId; + public final String userId; + public final String callerIdName; + public final String callerIdNum; + public final Boolean muted; + public final Boolean talking; + + public UserJoinedVoiceConfMessage(String voiceConfId, String voiceUserId, String userId, + String callerIdName, String callerIdNum, Boolean muted, Boolean talking) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.userId = userId; + this.callerIdName = callerIdName; + this.callerIdNum = callerIdNum; + this.muted = muted; + this.talking = talking; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(USER_ID, userId); + payload.put(CALLER_ID_NAME, callerIdName); + payload.put(CALLER_ID_NUM, callerIdNum); + payload.put(MUTED, muted); + payload.put(TALKING, talking); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_JOINED_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserJoinedVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_JOINED_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(USER_ID) + && payload.has(CALLER_ID_NAME) + && payload.has(CALLER_ID_NUM) + && payload.has(MUTED) + && payload.has(TALKING)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + String userId = payload.get(USER_ID).getAsString(); + String callerIdName = payload.get(CALLER_ID_NAME).getAsString(); + String callerIdNum = payload.get(CALLER_ID_NUM).getAsString(); + Boolean muted = payload.get(MUTED).getAsBoolean(); + Boolean talking = payload.get(TALKING).getAsBoolean(); + return new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, callerIdName, callerIdNum, muted, talking); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLeftVoiceConfMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLeftVoiceConfMessage.java new file mode 100755 index 0000000000..cdf1eb3568 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLeftVoiceConfMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLeftVoiceConfMessage { + public static final String USER_LEFT_VOICE_CONF = "user_left_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + + public final String voiceConfId; + public final String voiceUserId; + + public UserLeftVoiceConfMessage(String voiceConfId, String voiceUserId) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LEFT_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLeftVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LEFT_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + return new UserLeftVoiceConfMessage(voiceConfId, voiceUserId); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLockedInVoiceConfMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLockedInVoiceConfMessage.java new file mode 100755 index 0000000000..ef8d356956 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserLockedInVoiceConfMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserLockedInVoiceConfMessage { + public static final String USER_LOCKED_IN_VOICE_CONF = "user_locked_in_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String LOCKED = "locked"; + + public final String voiceConfId; + public final String voiceUserId; + public final Boolean locked; + + public UserLockedInVoiceConfMessage(String voiceConfId, String voiceUserId, Boolean locked) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.locked = locked; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(LOCKED, locked); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_LOCKED_IN_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserLockedInVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_LOCKED_IN_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(LOCKED)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean locked = payload.get(LOCKED).getAsBoolean(); + return new UserLockedInVoiceConfMessage(voiceConfId, voiceUserId, locked); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserMutedInVoiceConfMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserMutedInVoiceConfMessage.java new file mode 100755 index 0000000000..50b450baf3 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserMutedInVoiceConfMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserMutedInVoiceConfMessage { + public static final String USER_MUTED_IN_VOICE_CONF = "user_muted_in_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String MUTED = "muted"; + + public final String voiceConfId; + public final String voiceUserId; + public final Boolean muted; + + public UserMutedInVoiceConfMessage(String voiceConfId, String voiceUserId, Boolean muted) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.muted = muted; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(MUTED, muted); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_MUTED_IN_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserMutedInVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_MUTED_IN_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(MUTED)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean muted = payload.get(MUTED).getAsBoolean(); + return new UserMutedInVoiceConfMessage(voiceConfId, voiceUserId, muted); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserTalkingInVoiceConfMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserTalkingInVoiceConfMessage.java new file mode 100755 index 0000000000..18bd6f2d36 --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/UserTalkingInVoiceConfMessage.java @@ -0,0 +1,62 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class UserTalkingInVoiceConfMessage { + public static final String USER_TALKING_IN_VOICE_CONF = "user_talking_in_voice_conf_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String VOICE_USER_ID = "voice_user_id"; + public static final String TALKING = "talking"; + + public final String voiceConfId; + public final String voiceUserId; + public final Boolean talking; + + public UserTalkingInVoiceConfMessage(String voiceConfId, String voiceUserId, Boolean talking) { + this.voiceConfId = voiceConfId; + this.voiceUserId = voiceUserId; + this.talking = talking; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(VOICE_USER_ID, voiceUserId); + payload.put(TALKING, talking); + + java.util.HashMap header = MessageBuilder.buildHeader(USER_TALKING_IN_VOICE_CONF, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static UserTalkingInVoiceConfMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (USER_TALKING_IN_VOICE_CONF.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(VOICE_USER_ID) + && payload.has(TALKING)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String voiceUserId = payload.get(VOICE_USER_ID).getAsString(); + Boolean talking = payload.get(TALKING).getAsBoolean(); + return new UserTalkingInVoiceConfMessage(voiceConfId, voiceUserId, talking); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/VoiceConfRecordingStartedMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/VoiceConfRecordingStartedMessage.java new file mode 100755 index 0000000000..522e6ec3af --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/VoiceConfRecordingStartedMessage.java @@ -0,0 +1,69 @@ +package org.bigbluebutton.freeswitch.pubsub.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + + +public class VoiceConfRecordingStartedMessage { + public static final String VOICE_CONF_RECORDING_STARTED = "voice_conf_recording_started_message"; + public static final String VERSION = "0.0.1"; + + public static final String VOICE_CONF_ID = "voice_conf_id"; + public static final String RECORD_STREAM = "record_stream"; + public static final String RECORDING = "recording"; + public static final String TIMESTAMP = "timestamp"; + + public final String voiceConfId; + public final String recordStream; + public final Boolean recording; + public final String timestamp; + + public VoiceConfRecordingStartedMessage(String voiceConfId, + String recordStream, Boolean recording, String timestamp) { + this.voiceConfId = voiceConfId; + this.recordStream = recordStream; + this.recording = recording; + this.timestamp = timestamp; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(VOICE_CONF_ID, voiceConfId); + payload.put(RECORD_STREAM, recordStream); + payload.put(RECORDING, recording); + payload.put(TIMESTAMP, timestamp); + + java.util.HashMap header = MessageBuilder.buildHeader(VOICE_CONF_RECORDING_STARTED, VERSION, null); + + return MessageBuilder.buildJson(header, payload); + } + + public static VoiceConfRecordingStartedMessage fromJson(String message) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + JsonObject payload = (JsonObject) obj.get("payload"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + if (VOICE_CONF_RECORDING_STARTED.equals(messageName)) { + if (payload.has(VOICE_CONF_ID) + && payload.has(RECORD_STREAM) + && payload.has(RECORDING) + && payload.has(TIMESTAMP)) { + String voiceConfId = payload.get(VOICE_CONF_ID).getAsString(); + String recordStream = payload.get(RECORD_STREAM).getAsString(); + Boolean recording = payload.get(RECORDING).getAsBoolean(); + String timestamp = payload.get(TIMESTAMP).getAsString(); + return new VoiceConfRecordingStartedMessage(voiceConfId, recordStream, recording, timestamp); + } + } + } + } + return null; + + } +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java index cb15361c82..e89f2dece2 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java @@ -1,8 +1,20 @@ package org.bigbluebutton.freeswitch.pubsub.receivers; +import org.bigbluebutton.freeswitch.pubsub.messages.EjectAllUsersFromVoiceConfRequestMessage; +import org.bigbluebutton.freeswitch.pubsub.messages.EjectUserFromVoiceConfRequestMessage; +import org.bigbluebutton.freeswitch.pubsub.messages.GetUsersFromVoiceConfRequestMessage; +import org.bigbluebutton.freeswitch.pubsub.messages.MuteUserInVoiceConfRequestMessage; +import org.bigbluebutton.freeswitch.pubsub.messages.RecordVoiceConfRequestMessage; import org.bigbluebutton.freeswitch.voice.freeswitch.FreeswitchApplication; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + public class RedisMessageReceiver { + + public static final String TO_VOICE_CONF_CHANNEL = "bigbluebutton:to-voice-conf"; + public static final String TO_VOICE_CONF_PATTERN = TO_VOICE_CONF_CHANNEL + ":*"; + public static final String TO_VOICE_CONF_SYSTEM_CHAN = TO_VOICE_CONF_CHANNEL + ":system"; private final FreeswitchApplication fsApp; @@ -11,6 +23,55 @@ public class RedisMessageReceiver { } public void handleMessage(String pattern, String channel, String message) { + if (channel.equalsIgnoreCase(TO_VOICE_CONF_SYSTEM_CHAN)) { + JsonParser parser = new JsonParser(); + JsonObject obj = (JsonObject) parser.parse(message); + if (obj.has("header") && obj.has("payload")) { + JsonObject header = (JsonObject) obj.get("header"); + + if (header.has("name")) { + String messageName = header.get("name").getAsString(); + switch (messageName) { + case EjectAllUsersFromVoiceConfRequestMessage.EJECT_ALL_VOICE_USERS_REQUEST: + processEjectAllVoiceUsersRequestMessage(message); + break; + case EjectUserFromVoiceConfRequestMessage.EJECT_VOICE_USER_REQUEST: + processEjectVoiceUserRequestMessage(message); + break; + case GetUsersFromVoiceConfRequestMessage.GET_VOICE_USERS_REQUEST: + processGetVoiceUsersRequestMessage(message); + break; + case MuteUserInVoiceConfRequestMessage.MUTE_VOICE_USER_REQUEST: + processMuteVoiceUserRequestMessage(message); + break; + case RecordVoiceConfRequestMessage.RECORD_VOICE_CONF_REQUEST: + processRecordVoiceConfRequestMessage(message); + break; + } + } + } + } + } + + private void processEjectAllVoiceUsersRequestMessage(String json) { + EjectAllUsersFromVoiceConfRequestMessage msg = EjectAllUsersFromVoiceConfRequestMessage.fromJson(json); + fsApp.ejectAll(msg.voiceConfId); + } + + private void processEjectVoiceUserRequestMessage(String json) { + EjectUserFromVoiceConfRequestMessage msg = EjectUserFromVoiceConfRequestMessage.fromJson(json); + } + + private void processGetVoiceUsersRequestMessage(String json) { + GetUsersFromVoiceConfRequestMessage msg = GetUsersFromVoiceConfRequestMessage.fromJson(json); + } + + private void processMuteVoiceUserRequestMessage(String json) { + MuteUserInVoiceConfRequestMessage msg = MuteUserInVoiceConfRequestMessage.fromJson(json); + } + + private void processRecordVoiceConfRequestMessage(String json) { + RecordVoiceConfRequestMessage msg = RecordVoiceConfRequestMessage.fromJson(json); } } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java index 638770574c..69326c4956 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/FreeswitchConferenceEventListener.java @@ -60,26 +60,25 @@ public class FreeswitchConferenceEventListener implements ConferenceEventListene if (event instanceof VoiceUserJoinedEvent) { System.out.println("************** FreeswitchConferenceEventListener received voiceUserJoined "); VoiceUserJoinedEvent evt = (VoiceUserJoinedEvent) event; - vcs.voiceUserJoined(evt.getVoiceUserId(), evt.getUserId(), evt.getRoom(), - evt.getCallerIdNum(), evt.getCallerIdName(), - evt.getMuted(), evt.getSpeaking()); - } else if (event instanceof VoiceUserLeftEvent) { - System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); - VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; - vcs.voiceUserLeft(evt.getUserId(), evt.getRoom()); - } else if (event instanceof VoiceUserMutedEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); - VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; - vcs.voiceUserMuted(evt.getUserId(), evt.getRoom(), evt.isMuted()); - } else if (event instanceof VoiceUserTalkingEvent) { - System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); - VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; - vcs.voiceUserTalking(evt.getUserId(), evt.getRoom(), evt.isTalking()); - } else if (event instanceof VoiceStartRecordingEvent) { - VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; - System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); - vcs.voiceStartedRecording(evt.getRoom(), evt.getRecordingFilename(), evt.getTimestamp(), evt.startRecord()); - } + vcs.userJoinedVoiceConf(evt.getRoom(), evt.getVoiceUserId(), evt.getUserId(), evt.getCallerIdName(), + evt.getCallerIdNum(), evt.getMuted(), evt.getSpeaking()); + } else if (event instanceof VoiceUserLeftEvent) { + System.out.println("************** FreeswitchConferenceEventListener received VoiceUserLeftEvent "); + VoiceUserLeftEvent evt = (VoiceUserLeftEvent) event; + vcs.userLeftVoiceConf(evt.getRoom(), evt.getUserId()); + } else if (event instanceof VoiceUserMutedEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserMutedEvent "); + VoiceUserMutedEvent evt = (VoiceUserMutedEvent) event; + vcs.userMutedInVoiceConf(evt.getRoom(), evt.getUserId(), evt.isMuted()); + } else if (event instanceof VoiceUserTalkingEvent) { + System.out.println("************** FreeswitchConferenceEventListener VoiceUserTalkingEvent "); + VoiceUserTalkingEvent evt = (VoiceUserTalkingEvent) event; + vcs.userTalkingInVoiceConf(evt.getRoom(), evt.getUserId(), evt.isTalking()); + } else if (event instanceof VoiceStartRecordingEvent) { + VoiceStartRecordingEvent evt = (VoiceStartRecordingEvent) event; + System.out.println("************** FreeswitchConferenceEventListener VoiceStartRecordingEvent recording=[" + evt.startRecord() + "]"); + vcs.voiceConfRecordingStarted(evt.getRoom(), evt.getRecordingFilename(), evt.startRecord(), evt.getTimestamp()); + } } }; diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java index d9391a0df1..6bf57784ff 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/IVoiceConferenceService.java @@ -1,13 +1,12 @@ package org.bigbluebutton.freeswitch.voice; public interface IVoiceConferenceService { - void voiceUserJoined(String userId, String webUserId, String conference, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking); - void voiceUserLeft(String meetingId, String userId); - void voiceUserLocked(String meetingId, String userId, Boolean locked); - void voiceUserMuted(String meetingId, String userId, Boolean muted); - void voiceUserTalking(String meetingId, String userId, Boolean talking); - void voiceStartedRecording(String conference, String recordingFile, - String timestamp, Boolean recording); + void voiceConfRecordingStarted(String voiceConfId, String recordStream, Boolean recording, String timestamp); + void userJoinedVoiceConf(String voiceConfId, String voiceUserId, String userId, String callerIdName, + String callerIdNum, Boolean muted, Boolean speaking); + void userLeftVoiceConf(String voiceConfId, String voiceUserId); + void userLockedInVoiceConf(String voiceConfId, String voiceUserId, Boolean locked); + void userMutedInVoiceConf(String voiceConfId, String voiceUserId, Boolean muted); + void userTalkingInVoiceConf(String voiceConfId, String voiceUserId, Boolean talking); + } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectUserCommand.java similarity index 84% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectUserCommand.java index c0b6784d8f..3c29e2b63c 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/EjectUserCommand.java @@ -18,11 +18,11 @@ */ package org.bigbluebutton.freeswitch.voice.commands; -public class EjectParticipantCommand extends ConferenceCommand { +public class EjectUserCommand extends ConferenceCommand { private final Integer participantId; - public EjectParticipantCommand(String room, Integer requesterId, Integer participantId) { + public EjectUserCommand(String room, Integer requesterId, Integer participantId) { super(room, requesterId); this.participantId = participantId; } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetUsersCommand.java similarity index 85% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetUsersCommand.java index 2d4ddd704f..13d21a4fb0 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetParticipantsCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/GetUsersCommand.java @@ -18,9 +18,9 @@ */ package org.bigbluebutton.freeswitch.voice.commands; -public class GetParticipantsCommand extends ConferenceCommand { +public class GetUsersCommand extends ConferenceCommand { - public GetParticipantsCommand(String room, Integer requesterId) { + public GetUsersCommand(String room, Integer requesterId) { super(room, requesterId); } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteUserCommand.java similarity index 84% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteUserCommand.java index bfa54b092f..62d2ece84c 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/MuteUserCommand.java @@ -18,12 +18,12 @@ */ package org.bigbluebutton.freeswitch.voice.commands; -public class MuteParticipantCommand extends ConferenceCommand { +public class MuteUserCommand extends ConferenceCommand { private final Integer participantId; private final boolean mute; - public MuteParticipantCommand(String room, Integer requesterId, Integer participantId, boolean mute) { + public MuteUserCommand(String room, Integer requesterId, Integer participantId, boolean mute) { super(room, requesterId); this.participantId = participantId; this.mute = mute; diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/RecordCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/RecordCommand.java new file mode 100755 index 0000000000..bb60598dae --- /dev/null +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/commands/RecordCommand.java @@ -0,0 +1,27 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.freeswitch.voice.commands; + +public class RecordCommand extends ConferenceCommand { + + public RecordCommand(String room, Integer requesterId) { + super(room, requesterId); + } + +} diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java index 8d6662d8fa..517fb257f7 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/ConnectionManager.java @@ -26,9 +26,9 @@ import java.util.concurrent.TimeUnit; import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectUserCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteUserCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.GetAllUsersCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; import org.freeswitch.esl.client.inbound.Client; import org.freeswitch.esl.client.inbound.InboundConnectionFailure; @@ -106,7 +106,7 @@ public class ConnectionManager { } } - public void getUsers(PopulateRoomCommand prc) { + public void getUsers(GetAllUsersCommand prc) { Client c = manager.getESLClient(); if (c.canSend()) { EslMessage response = c.sendSyncApiCommand(prc.getCommand(), prc.getCommandArgs()); @@ -114,7 +114,7 @@ public class ConnectionManager { } } - public void mute(MuteParticipantCommand mpc) { + public void mute(MuteUserCommand mpc) { System.out.println("Got mute request from FSApplication."); Client c = manager.getESLClient(); if (c.canSend()) { @@ -123,7 +123,7 @@ public class ConnectionManager { } } - public void eject(EjectParticipantCommand mpc) { + public void eject(EjectUserCommand mpc) { Client c = manager.getESLClient(); if (c.canSend()) { c.sendAsyncApiCommand( mpc.getCommand(), mpc.getCommandArgs()); diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java index 8157bddb80..e8a4e11ecf 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/FreeswitchApplication.java @@ -26,10 +26,10 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.BroadcastConferenceCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectAllUsersCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectParticipantCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.EjectUserCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.FreeswitchCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteParticipantCommand; -import org.bigbluebutton.freeswitch.voice.freeswitch.actions.PopulateRoomCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.MuteUserCommand; +import org.bigbluebutton.freeswitch.voice.freeswitch.actions.GetAllUsersCommand; import org.bigbluebutton.freeswitch.voice.freeswitch.actions.RecordConferenceCommand; public class FreeswitchApplication { @@ -58,23 +58,23 @@ public class FreeswitchApplication { } } - public void populateRoom(String room) { - PopulateRoomCommand prc = new PopulateRoomCommand(room, USER); + public void getAllUsers(String voiceConfId) { + GetAllUsersCommand prc = new GetAllUsersCommand(voiceConfId, USER); queueMessage(prc); } - public void mute(String room, String participant, Boolean mute) { - MuteParticipantCommand mpc = new MuteParticipantCommand(room, participant, mute, USER); + public void muteUser(String voiceConfId, String voiceUserId, Boolean mute) { + MuteUserCommand mpc = new MuteUserCommand(voiceConfId, voiceUserId, mute, USER); queueMessage(mpc); } - public void eject(String room, String participant) { - EjectParticipantCommand mpc = new EjectParticipantCommand(room, participant, USER); + public void eject(String voiceConfId, String voiceUserId) { + EjectUserCommand mpc = new EjectUserCommand(voiceConfId, voiceUserId, USER); queueMessage(mpc); } - public void ejectAll(String room) { - EjectAllUsersCommand mpc = new EjectAllUsersCommand(room, USER); + public void ejectAll(String voiceConfId) { + EjectAllUsersCommand mpc = new EjectAllUsersCommand(voiceConfId, USER); queueMessage(mpc); } @@ -82,28 +82,33 @@ public class FreeswitchApplication { return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); } - public void record(String room, String meetingid){ + public void startRecording(String voiceConfId, String meetingid){ String RECORD_DIR = "/var/freeswitch/meetings"; String voicePath = RECORD_DIR + File.separatorChar + meetingid + "-" + genTimestamp() + ".wav"; - RecordConferenceCommand rcc = new RecordConferenceCommand(room, USER, true, voicePath); + RecordConferenceCommand rcc = new RecordConferenceCommand(voiceConfId, USER, true, voicePath); queueMessage(rcc); } + + public void stopRecording(String voiceConfId, String meetingid, String voicePath){ + RecordConferenceCommand rcc = new RecordConferenceCommand(voiceConfId, USER, false, voicePath); + queueMessage(rcc); + } private void sendMessageToFreeswitch(final FreeswitchCommand command) { Runnable task = new Runnable() { public void run() { - if (command instanceof PopulateRoomCommand) { - PopulateRoomCommand cmd = (PopulateRoomCommand) command; + if (command instanceof GetAllUsersCommand) { + GetAllUsersCommand cmd = (GetAllUsersCommand) command; System.out.println("Sending PopulateRoomCommand for conference = [" + cmd.getRoom() + "]"); manager.getUsers(cmd); - } else if (command instanceof MuteParticipantCommand) { - MuteParticipantCommand cmd = (MuteParticipantCommand) command; + } else if (command instanceof MuteUserCommand) { + MuteUserCommand cmd = (MuteUserCommand) command; System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); System.out.println("Sending MuteParticipantCommand for conference = [" + cmd.getRoom() + "]"); manager.mute(cmd); - } else if (command instanceof EjectParticipantCommand) { - EjectParticipantCommand cmd = (EjectParticipantCommand) command; + } else if (command instanceof EjectUserCommand) { + EjectUserCommand cmd = (EjectUserCommand) command; System.out.println("Sending EjectParticipantCommand for conference = [" + cmd.getRoom() + "]"); manager.eject(cmd); } else if (command instanceof EjectAllUsersCommand) { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectUserCommand.java similarity index 85% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectUserCommand.java index e46deef3e4..aa5315710f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/EjectUserCommand.java @@ -18,11 +18,11 @@ */ package org.bigbluebutton.freeswitch.voice.freeswitch.actions; -public class EjectParticipantCommand extends FreeswitchCommand { +public class EjectUserCommand extends FreeswitchCommand { private final String participant; - public EjectParticipantCommand(String room, String participant, String requesterId) { + public EjectUserCommand(String room, String participant, String requesterId) { super(room, requesterId); this.participant = participant; } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/GetAllUsersCommand.java similarity index 94% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/GetAllUsersCommand.java index 03f7a32296..00482e01f1 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/PopulateRoomCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/GetAllUsersCommand.java @@ -36,9 +36,9 @@ import javax.xml.parsers.SAXParserFactory; import org.xml.sax.SAXException; -public class PopulateRoomCommand extends FreeswitchCommand { +public class GetAllUsersCommand extends FreeswitchCommand { - public PopulateRoomCommand(String room, String requesterId) { + public GetAllUsersCommand(String room, String requesterId) { super(room, requesterId); } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteUserCommand.java similarity index 86% rename from labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java rename to labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteUserCommand.java index fdd7b343eb..e015535302 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteParticipantCommand.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/voice/freeswitch/actions/MuteUserCommand.java @@ -18,12 +18,12 @@ */ package org.bigbluebutton.freeswitch.voice.freeswitch.actions; -public class MuteParticipantCommand extends FreeswitchCommand { +public class MuteUserCommand extends FreeswitchCommand { private final String participant; private final Boolean mute; - public MuteParticipantCommand(String room, String participant, Boolean mute, String requesterId) { + public MuteUserCommand(String room, String participant, Boolean mute, String requesterId) { super(room, requesterId); this.participant = participant; this.mute = mute; diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala index df8c7818a3..74fbb7d2a7 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala @@ -22,7 +22,7 @@ class RedisPublisher(val system: ActorSystem) extends SystemConfiguration { Await.result(futurePong, 5 seconds) // publish after 2 seconds every 2 or 5 seconds - system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) + //system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) // system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value")) def publish(channel: String, data: String) { diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala index e4d56e7faf..8fc68d55dc 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala @@ -3,58 +3,44 @@ package org.bigbluebutton.freeswitch import org.bigbluebutton.freeswitch.voice.IVoiceConferenceService import org.bigbluebutton.core.api._ import org.bigbluebutton.endpoint.redis.RedisPublisher - -case class FsVoiceUserJoined(userId: String, webUserId: String, - conference: String, callerIdNum: String, - callerIdName: String, muted: Boolean, - speaking: Boolean) - -case class FsVoiceUserLeft(userId: String, conference: String) -case class FsVoiceUserLocked(userId: String, conference: String, locked: Boolean) -case class FsVoiceUserMuted(userId: String, conference: String, muted: Boolean) -case class FsVoiceUserTalking(userId: String, conference: String, talking: Boolean) -case class FsRecording(conference: String, recordingFile: String, - timestamp: String, recording: Boolean) +import org.bigbluebutton.freeswitch.pubsub.messages._ class VoiceConferenceService(sender: RedisPublisher) extends IVoiceConferenceService { - def voiceStartedRecording(conference: String, recordingFile: String, - timestamp: String, recording: java.lang.Boolean) { - val fsRec = new FsRecording(conference, recordingFile, timestamp, recording) + val FROM_VOICE_CONF_SYSTEM_CHAN = "bigbluebutton:from-voice-conf:system"; + def voiceConfRecordingStarted(voiceConfId: String, recordStream: String, recording: java.lang.Boolean, timestamp: String) { + val msg = new VoiceConfRecordingStartedMessage(voiceConfId, recordStream, recording, timestamp) + sender.publish(FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()) } - def voiceUserJoined(userId: String, webUserId: String, conference: String, - callerIdNum: String, callerIdName: String, - muted: java.lang.Boolean, talking: java.lang.Boolean) { + def userJoinedVoiceConf(voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, + callerIdNum: String, muted: java.lang.Boolean, talking: java.lang.Boolean) { // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") - val vuj = new FsVoiceUserJoined(userId, webUserId, - conference, callerIdNum, - callerIdName, muted, - talking) - + val msg = new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, + callerIdName, callerIdNum, muted, talking) + sender.publish(FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()) } - def voiceUserLeft(userId: String, conference: String) { + def userLeftVoiceConf(voiceConfId: String, voiceUserId: String) { // println("******** FreeswitchConferenceService received voiceUserLeft vui=[" + userId + "] conference=[" + conference + "]") - val vul = new FsVoiceUserLeft(userId, conference) + val msg = new UserLeftVoiceConfMessage(voiceConfId, voiceUserId) + sender.publish(FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()) + } + + def userLockedInVoiceConf(voiceConfId: String, voiceUserId: String, locked: java.lang.Boolean) { } - def voiceUserLocked(userId: String, conference: String, locked: java.lang.Boolean) { - val vul = new FsVoiceUserLocked(userId, conference, locked) - + def userMutedInVoiceConf(voiceConfId: String, voiceUserId: String, muted: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + voiceUserId + "] muted=[" + muted + "]") + val msg = new UserMutedInVoiceConfMessage(voiceConfId, voiceUserId, muted) + sender.publish(FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()) } - def voiceUserMuted(userId: String, conference: String, muted: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserMuted vui=[" + userId + "] muted=[" + muted + "]") - val vum = new FsVoiceUserMuted(userId, conference, muted) - - } - - def voiceUserTalking(userId: String, conference: String, talking: java.lang.Boolean) { - println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + userId + "] talking=[" + talking + "]") - val vut = new FsVoiceUserTalking(userId, conference, talking) - + def userTalkingInVoiceConf(voiceConfId: String, voiceUserId: String, talking: java.lang.Boolean) { + println("******** FreeswitchConferenceService received voiceUserTalking vui=[" + voiceUserId + "] talking=[" + talking + "]") + val msg = new UserTalkingInVoiceConfMessage(voiceConfId, voiceUserId, talking) + sender.publish(FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()) } } \ No newline at end of file From db379d85fc0db9c13ac223db0a21b584e192552e Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Tue, 2 Jun 2015 16:53:44 +0000 Subject: [PATCH 28/30] - handle voice messages in FS --- .../scala/org/bigbluebutton/core/CollectorActor.scala | 6 ------ .../org/bigbluebutton/core/apps/users/UsersApp.scala | 9 +++++++-- .../bigbluebutton/core/apps/voice/VoiceInGateway.scala | 2 +- .../pubsub/receivers/RedisMessageReceiver.java | 4 ++++ .../endpoint/redis/AppsRedisSubscriberActor.scala | 2 +- .../freeswitch/VoiceConferenceService.scala | 3 +-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala index efc68df975..a36cc44f67 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala @@ -68,12 +68,6 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { case msg: LockUserRequest => handleLockUserRequest(msg) case msg: EjectUserFromVoiceRequest => handleEjectUserFromVoiceRequest(msg) case msg: VoiceUserJoinedMessage => handleVoiceUserJoinedMessage(msg) - // case msg: VoiceUserJoined => handleVoiceUserJoined(msg) - // case msg: VoiceUserLeft => handleVoiceUserLeft(msg) - // case msg: VoiceUserLocked => handleVoiceUserLocked(msg) - // case msg: VoiceUserMuted => handleVoiceUserMuted(msg) - // case msg: VoiceUserTalking => handleVoiceUserTalking(msg) - // case msg: VoiceRecording => handleVoiceRecording(msg) case msg: SendWhiteboardAnnotationRequest => handleSendWhiteboardAnnotationRequest(msg) case msg: GetWhiteboardShapesRequest => handleGetWhiteboardShapesRequest(msg) case msg: ClearWhiteboardRequest => handleClearWhiteboardRequest(msg) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala index 00af261dfb..ba8916aa92 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala @@ -359,12 +359,17 @@ trait UsersApp { } def handleUserJoinedVoiceConfMessage(msg: UserJoinedVoiceConfMessage) = { - val user = users.getUser(msg.userId) match { + log.info("Received user joined voice for user [" + msg.callerIdName + "] userid=[" + msg.userId + "]") + + users.getUsers foreach { tu => + println("*** Users [" + tu + "]") + } + users.getUserWithExternalId(msg.userId) match { case Some(user) => { val vu = new VoiceUser(msg.voiceUserId, msg.userId, msg.callerIdName, msg.callerIdNum, true, false, msg.muted, msg.talking) val nu = user.copy(voiceUser = vu) users.addUser(nu) - log.info("Received user joined voice for user [" + nu.name + "] userid=[" + msg.userId + "]") + log.info("User joined voice for user [" + nu.name + "] userid=[" + msg.userId + "]") outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) if (meetingMuted) diff --git a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala index baa6e3ed37..6c4482b25a 100755 --- a/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala +++ b/labs/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceInGateway.scala @@ -32,7 +32,7 @@ class VoiceInGateway(bbbGW: BigBlueButtonGateway) { def voiceUserJoined(voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, callerIdNum: String, muted: Boolean, talking: Boolean) { // println("VoiceInGateway: Got voiceUserJoined message for meeting [" + meetingId + "] user[" + callerIdName + "]") - val voiceUser = new VoiceUser(voiceUserId, userId, callerIdName, callerIdNum, true, false, muted, talking) + val msg = new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, callerIdName, callerIdNum, muted, talking) diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java index e89f2dece2..a49216e9b6 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java @@ -61,17 +61,21 @@ public class RedisMessageReceiver { private void processEjectVoiceUserRequestMessage(String json) { EjectUserFromVoiceConfRequestMessage msg = EjectUserFromVoiceConfRequestMessage.fromJson(json); + fsApp.eject(msg.voiceConfId, msg.voiceUserId); } private void processGetVoiceUsersRequestMessage(String json) { GetUsersFromVoiceConfRequestMessage msg = GetUsersFromVoiceConfRequestMessage.fromJson(json); + fsApp.getAllUsers(msg.voiceConfId); } private void processMuteVoiceUserRequestMessage(String json) { MuteUserInVoiceConfRequestMessage msg = MuteUserInVoiceConfRequestMessage.fromJson(json); + fsApp.muteUser(msg.voiceConfId, msg.voiceUserId, msg.mute); } private void processRecordVoiceConfRequestMessage(String json) { RecordVoiceConfRequestMessage msg = RecordVoiceConfRequestMessage.fromJson(json); + //fsApp. } } diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala index 11d2d2535f..7bfa252ef8 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -13,7 +13,7 @@ import org.bigbluebutton.freeswitch.pubsub.receivers.RedisMessageReceiver object AppsRedisSubscriberActor extends SystemConfiguration { val channels = Seq("time") - val patterns = Seq("bigbluebutton:to-bbb-apps:*") + val patterns = Seq("bigbluebutton:to-voice-conf:*") def props(msgReceiver: RedisMessageReceiver): Props = Props(classOf[AppsRedisSubscriberActor], msgReceiver, diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala index 8fc68d55dc..d48fe932be 100755 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala +++ b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/freeswitch/VoiceConferenceService.scala @@ -17,8 +17,7 @@ class VoiceConferenceService(sender: RedisPublisher) extends IVoiceConferenceSer def userJoinedVoiceConf(voiceConfId: String, voiceUserId: String, userId: String, callerIdName: String, callerIdNum: String, muted: java.lang.Boolean, talking: java.lang.Boolean) { // println("******** FreeswitchConferenceService received voiceUserJoined vui=[" + userId + "] wui=[" + webUserId + "]") - val msg = new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, - callerIdName, callerIdNum, muted, talking) + val msg = new UserJoinedVoiceConfMessage(voiceConfId, voiceUserId, userId, callerIdName, callerIdNum, muted, talking) sender.publish(FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()) } From d75003ee1c701ae597eb1a6424c674dd1af6185c Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Tue, 2 Jun 2015 17:53:25 +0000 Subject: [PATCH 29/30] - clean up --- .../apps/protocol/InMessage.scala | 54 --------- .../bigbluebutton/apps/protocol/Message.scala | 64 ----------- .../apps/protocol/OutMessages.scala | 31 ----- .../apps/protocol/Protocol.scala | 75 ------------ .../voice/freeswitch/HeartbeatMonitor.scala | 5 - .../endpoint/InMessageFormatters.scala | 37 ------ .../endpoint/InMessageHandlerActor.scala | 32 ------ .../endpoint/MessageFormats.scala | 90 --------------- .../endpoint/MessageMarshallingActor.scala | 23 ---- .../endpoint/MessageNameConstants.scala | 47 -------- .../endpoint/MessageUmarshallingActor.scala | 93 --------------- .../endpoint/OutMessageFormatters.scala | 14 --- .../endpoint/OutMsgBuilderActor.scala | 21 ---- .../org/bigbluebutton/endpoint/Protocol.scala | 107 ------------------ .../redis/AppsRedisPublisherActor.scala | 45 -------- .../endpoint/redis/Message.scala | 3 - .../endpoint/redis/RedisPubSubActor.scala | 39 ------- 17 files changed, 780 deletions(-) delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala delete mode 100755 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala delete mode 100644 labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala deleted file mode 100644 index c00384aaea..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/InMessage.scala +++ /dev/null @@ -1,54 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import org.bigbluebutton.apps.users.data.UserIdAndName - -trait InMessage - -// Poll Messages -case class PreCreatedPoll(meetingID: String, poll: PollVO) extends InMessage -case class CreatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage -case class UpdatePoll(meetingID: String, requesterID: String, poll: PollVO) extends InMessage -case class GetPolls(meetingID: String, requesterID: String) extends InMessage -case class DestroyPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class RemovePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class SharePoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class ShowPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class HidePollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class StopPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class StartPoll(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class ClearPoll(meetingID: String, requesterID: String, pollID: String, force: Boolean = false) extends InMessage -case class GetPollResult(meetingID: String, requesterID: String, pollID: String) extends InMessage -case class RespondToPoll(meetingID: String, requesterID: String, response: PollResponseVO) extends InMessage - -case class ResponseVO(id: String, text: String, responders: Array[Responder] = Array[Responder]()) -case class QuestionVO(id: String, multiResponse: Boolean, question: String, responses: Array[ResponseVO]) -case class PollVO(id: String, title: String, questions: Array[QuestionVO], started: Boolean = false, stopped: Boolean = false) -case class QuestionResponsesVO(val questionID: String, val responseIDs: Array[String]) -case class PollResponseVO(val pollID: String, val responses: Array[QuestionResponsesVO]) -case class ResponderVO(responseID: String, user: Responder) -case class Responder(val userID: String, name: String) - -case class SendVoiceUsersRequest(meetingID: String, requesterID: String) extends InMessage -case class MuteMeetingRequest(meetingID: String, requesterID: String, mute: Boolean) extends InMessage -case class IsMeetingMutedRequest(meetingID: String, requesterID: String) extends InMessage -case class MuteUserRequest(meetingID: String, requesterID: String, userID: String, mute: Boolean) extends InMessage -case class LockUserRequest(meetingID: String, requesterID: String, userID: String, lock: Boolean) extends InMessage -case class EjectUserRequest(meetingID: String, requesterID: String, userID: String) extends InMessage -case class VoiceUserJoinedMessage(meetingID: String, user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, - muted: Boolean, talking: Boolean) extends InMessage - -case class VoiceUserLeftMessage(meetingID: String, user: String, voiceConfId: String) extends InMessage -case class VoiceUserMutedMessage(meetingID: String, user: String, voiceConfId: String, muted: Boolean) extends InMessage -case class VoiceUserTalkingMessage(meetingID: String, user: String, voiceConfId: String, talking: Boolean) extends InMessage -case class VoiceStartedRecordingMessage(meetingID: String, voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends InMessage - -// Need these extra classes since InMessage needs meetingID as parameter and -// our messages from FreeSWITCH doesn't have it. -trait VoiceMessage -case class VoiceUserJoined(user: String, voiceConfId: String, callerIdNum: String, callerIdName: String, muted: Boolean, speaking: Boolean) extends VoiceMessage - -case class VoiceUserLeft(user: String, voiceConfId: String) extends VoiceMessage -case class VoiceUserMuted(user: String, voiceConfId: String, muted: Boolean) extends VoiceMessage -case class VoiceUserTalking(user: String, voiceConfId: String, talking: Boolean) extends VoiceMessage -case class VoiceStartedRecording(voiceConfId: String, filename: String, timestamp: String, record: Boolean) extends VoiceMessage - diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala deleted file mode 100644 index 8ccd7dbb65..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Message.scala +++ /dev/null @@ -1,64 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json.DefaultJsonProtocol -import spray.json.JsValue -import spray.json.JsObject -import spray.json.JsonParser -import Message._ - -import org.parboiled.errors.ParsingException - -object Message { - case class Meeting(id: String, name: String, session: String) - case class MessageHeader(name: String, timestamp: Long, meeting: Meeting) - case class MessageEvent(header: MessageHeader, payload: JsValue) -} - -object MessageHeaderJsonProtocol extends DefaultJsonProtocol { - implicit val meetingFormat = jsonFormat3(Meeting) - implicit val messageHeaderFormat = jsonFormat3(MessageHeader) -} - -import MessageHeaderJsonProtocol._ - -object MessageHandler { - def extractMessageHeader(msg: JsObject): Option[MessageHeader] = { - msg.fields.get("header") match { - case Some(header) => { - val h = header.convertTo[MessageHeader] - Some(h) - } - case None => None - } - } - - def extractPayload(msg: JsObject): Option[JsValue] = { - msg.fields.get("payload") - } - - def processMessage(msg: String): Option[JsObject] = { - try { - val msgObject = JsonParser(msg).asJsObject - Some(msgObject) - } catch { - case e: ParsingException => None - } - } - - def forwardMessage(header: MessageHeader, payload: JsValue) { - - } - - def handleMessage(jsonMsg: String) { - val jsonObj = processMessage(jsonMsg) - if (jsonObj != None) { - val msgObj = jsonObj get - val header = extractMessageHeader(msgObj) - val payload = extractPayload(msgObj) - - if (header != None && payload != None) { - forwardMessage(header get, payload get) - } - } - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala deleted file mode 100644 index c7060c6fd1..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/OutMessages.scala +++ /dev/null @@ -1,31 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.MeetingDescriptor -import spray.json.DefaultJsonProtocol -import org.bigbluebutton.apps.Duration -import org.bigbluebutton.apps.PhoneNumber -import org.bigbluebutton.apps.MeetingDescriptor - -/* -object MyJsonProtocol extends DefaultJsonProtocol { - implicit val sessionFormat = jsonFormat3(Session) - implicit val usersDefFormat = jsonFormat2(MaxUsers) - implicit val durationDefFormat = jsonFormat3(MeetingDuration) - implicit val voiceConfDefFormat = jsonFormat2(VoiceConfAndPin) - implicit val phoneNumberDefFormat = jsonFormat2(PhoneNumber) - implicit val meetingDefFormat = jsonFormat11(MeetingDescriptor) -} -*/ -case class CreateMeetingRequestReply(created: Boolean, message: String, session: Session) - -case class MeetingHeader(name: String, externalId: String, session: String) - -case class UserRegistered(meeting: MeetingHeader, user: RegisteredUser) -case class EndAndKickAll(meeting: MeetingHeader) -case class GetUsersReply(meeting: MeetingHeader, users: Seq[JoinedUser]) -case class PresenterAssigned(meeting: MeetingHeader, newPresenter: UserIdAndName, assignedBy: UserIdAndName) -case class UserJoined(meeting: MeetingHeader, user: JoinedUser) -case class UserLeft(meeting: MeetingHeader, user: UserIdAndName) -case class UserStatusChange(meeting: MeetingHeader, user: UserIdAndName, status: String, value: Object) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala deleted file mode 100644 index 9d01448b6b..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/apps/protocol/Protocol.scala +++ /dev/null @@ -1,75 +0,0 @@ -package org.bigbluebutton.apps.protocol - -import spray.json.JsValue -import org.bigbluebutton.apps.users.data.{ RegisterUser, JoinedUser } -import spray.json.DefaultJsonProtocol -import spray.httpx.SprayJsonSupport - -case class Destination(to: String, correlation_id: Option[String]) -case class ReplyDestination(to: String, correlation_id: String) - -case class Header(destination: Destination, name: String, - timestamp: String, source: String, - reply: Option[ReplyDestination]) - -case class HeaderMeeting(name: String, id: String, session: Option[String]) - -case class HeaderAndJsonMessage(header: Header, jsonMessage: String) -case class ReplyStatus(status: String, message: String, error: Option[Int]) - -case class StatusCode(code: Int, message: String) -case class ErrorCode(code: Int, message: String, details: Option[String] = None) -case class Response(status: StatusCode, errors: Option[Seq[ErrorCode]] = None) - -case class ResponsePayload(response: Response) -case class JsonResponse(header: Header, payload: Option[ResponsePayload] = None) - -case class MessageProcessException(message: String) extends Exception(message) - -object HeaderAndPayloadJsonSupport extends DefaultJsonProtocol with SprayJsonSupport { - implicit val statusCodeFormat = jsonFormat2(StatusCode) - implicit val errorCodeFormat = jsonFormat3(ErrorCode) - implicit val responseFormat = jsonFormat2(Response) - implicit val headerDestinationFormat = jsonFormat2(Destination) - implicit val headerMeetingFormat = jsonFormat3(HeaderMeeting) - implicit val replyDestinationFormat = jsonFormat2(ReplyDestination) - implicit val headerFormat = jsonFormat5(Header) - implicit val headerAndPayloadFormat = jsonFormat2(HeaderAndJsonMessage) - implicit val responsePayloadFormat = jsonFormat1(ResponsePayload) - implicit val jsonResponseFormat = jsonFormat2(JsonResponse) -} - -object StatusCodes extends Enumeration { - type StatusCodeType = Value - - val OK = Value(200, "OK") - val NOT_MODIFIED = Value(304, "Not Modified") - val BAD_REQUEST = Value(400, "Bad Request") - val UNAUTHORIZED = Value(401, "Unauthorized") - val FORBIDDEN = Value(403, "Forbidden") - val NOT_FOUND = Value(404, "Not Found") - val NOT_ACCEPTABLE = Value(406, "Not Acceptable") - val INTERNAL_SERVER_ERROR = Value(500, "Internal Server Error") - val BAD_GATEWAY = Value(502, "Bad Gateway") - val SERVICE_UNAVAILABLE = Value(503, "Service Unavailable") -} - -object StatusCodeBuilder { - def buildStatus(codeType: StatusCodes.StatusCodeType): StatusCode = { - StatusCode(codeType.id, codeType.toString()) - } -} - -object ErrorCodes extends Enumeration { - type ErrorCodeType = Value - - val INVALID_TOKEN = Value(1, "Invalid or expired token") - val INVALID_MESSAGE = Value(2, "Invalid message") - -} - -object ErrorCodeBuilder { - def buildError(codeType: ErrorCodes.ErrorCodeType, details: String): ErrorCode = { - ErrorCode(codeType.id, codeType.toString(), Some(details)) - } -} diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala deleted file mode 100755 index 7beaddb032..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/core/voice/freeswitch/HeartbeatMonitor.scala +++ /dev/null @@ -1,5 +0,0 @@ -package org.bigbluebutton.core.voice.freeswitch - -class HeartbeatMonitor() { - -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala deleted file mode 100644 index e154a9c78b..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageFormatters.scala +++ /dev/null @@ -1,37 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.MeetingIdAndName -import org.bigbluebutton.apps.users.data.UserIdAndName - -sealed abstract class InMsgFormatter - -case class CreateMeetingRequestFormat(header: Header, - payload: CreateMeetingRequestPayloadFormat) extends InMsgFormatter - -case class CreateMeetingResponseFormat(header: Header, - payload: CreateMeetingResponsePayloadFormat) extends InMsgFormatter - -case class RegisterUserRequestFormat(header: Header, - payload: RegisterUserRequestPayloadFormat) extends InMsgFormatter - -case class RegisterUserResponseFormat(header: Header, - payload: RegisterUserResponsePayloadFormat) extends InMsgFormatter - -case class UserRegisteredEventFormat(header: Header, - payload: UserRegisteredEventPayloadFormat) extends InMsgFormatter - -case class UserJoinRequestFormat(header: Header, - payload: UserJoinRequestPayloadFormat) extends InMsgFormatter - -case class UserJoinedEventFormat(header: Header, - payload: UserJoinedEventPayloadFormat) extends InMsgFormatter - -case class UserLeaveMessage(header: Header, - payload: UserLeavePayload) extends InMsgFormatter - -case class GetUsersRequestMessage(header: Header, - payload: GetUsersRequestPayload) extends InMsgFormatter - -case class AssignPresenterMessage(header: Header, - payload: AssignPresenterPayload) extends InMsgFormatter diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala deleted file mode 100755 index 3d1d31d76d..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/InMessageHandlerActor.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.util.Timeout -import scala.concurrent.duration._ -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } -import org.bigbluebutton.apps.users.protocol.UsersMessageHandler - -/** - * This actor is responsible for handling messages from the pubsub. - */ -object MessageHandlerActor { - def props(bbbAppsActor: ActorRef, messageMarshallingActor: ActorRef): Props = - Props(classOf[MessageHandlerActor], bbbAppsActor, messageMarshallingActor) -} - -class MessageHandlerActor private (val bbbAppsActor: ActorRef, - val messageMarshallingActor: ActorRef) extends Actor - with ActorLogging { - - /** RefFactory for actor request-response (ask pattern) **/ - def actorRefFactory = context - - /** Required for actor request-response (ask pattern) **/ - implicit def executionContext = actorRefFactory.dispatcher - implicit val timeout = Timeout(5 seconds) - - def receive = { - case msg: UserJoinRequestFormat => //handleUserJoinRequestMessage(msg) - - case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala deleted file mode 100644 index bb36c3b1b2..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageFormats.scala +++ /dev/null @@ -1,90 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.protocol._ -import org.bigbluebutton.apps.Role -import org.bigbluebutton.apps.users.messages.UserJoined -import org.bigbluebutton.apps.Session -import org.bigbluebutton.apps.MeetingIdAndName -import org.bigbluebutton.apps.users.messages.Result -import org.bigbluebutton.apps.users.messages.UserJoinResponse - -case class ResultFormat(success: Boolean, message: String) - -case class UserFormat(id: String, external_id: String, name: String, - role: Role.RoleType, pin: Int, welcome_message: String, - logout_url: String, avatar_url: String) - -case class DurationFormat(length_in_minutes: Int, allow_extend: Boolean, max_minutes: Int) - -case class VoiceConferenceFormat(pin: Int, number: Int) - -case class PhoneNumberFormat(number: String, description: String) - -case class MeetingDescriptorFormat(name: String, external_id: String, - record: Boolean, welcome_message: String, logout_url: String, - avatar_url: String, max_users: Int, duration: DurationFormat, - voice_conference: VoiceConferenceFormat, - phone_numbers: Seq[PhoneNumberFormat], - metadata: Map[String, String]) - -case class CreateMeetingRequestPayloadFormat(meeting_descriptor: MeetingDescriptorFormat) - -case class CreateMeetingResponsePayloadFormat(meeting: MeetingIdAndName, - session: Option[String], result: ResultFormat, - meeting_descriptor: MeetingDescriptorFormat) - -case class MeetingCreatedEventPayloadFormat(meeting: MeetingIdAndName, - session: String, meeting_descriptor: MeetingDescriptorFormat) - -case class UserDescriptorFormat(external_id: String, name: String, - role: Role.RoleType, pin: Int, - welcome_message: String, - logout_url: String, avatar_url: String, - metadata: Map[String, String]) - -case class RegisterUserRequestPayloadFormat(meeting: MeetingIdAndName, - session: String, user_descriptor: UserDescriptorFormat) - -case class RegisterUserResponsePayloadFormat(meeting: MeetingIdAndName, - session: String, user_token: Option[String], - result: ResultFormat, user_descriptor: UserDescriptorFormat) - -case class UserRegisteredEventPayloadFormat(meeting: MeetingIdAndName, - session: String, user_descriptor: UserDescriptorFormat) - -case class StatusFormat(hand_raised: Boolean, muted: Boolean, - locked: Boolean, talking: Boolean) - -case class CallerIdFormat(name: String, number: String) - -case class MediaStreamFormat(media_type: String, uri: String, - metadata: Map[String, String]) - -case class JoinedUserFormat(id: String, external_id: String, name: String, - role: Role.RoleType, pin: Int, welcome_message: String, - logout_url: String, avatar_url: String, is_presenter: Boolean, - status: StatusFormat, caller_id: CallerIdFormat, - media_streams: Seq[MediaStreamFormat]) - -case class UserJoinedEventPayloadFormat(meeting: MeetingIdAndName, - session: String, user: JoinedUserFormat) - -case class UserJoinResponseMessage(header: Header, response: UserJoinResponse) - -case class JoinUserResponse(response: Response, token: String, joinedUser: Option[JoinedUser]) - -case class JoinUserReply(header: Header, payload: JoinUserResponse) - -case class UserJoinRequestPayloadFormat(meeting: MeetingIdAndName, - session: String, token: String) - -case class UserLeavePayload(meeting: MeetingIdAndName, - session: String, user: UserIdAndName) - -case class GetUsersRequestPayload(meeting: MeetingIdAndName, - session: String, requester: UserIdAndName) - -case class AssignPresenterPayload(meeting: MeetingIdAndName, - session: String, presenter: UserIdAndName, - assigned_by: UserIdAndName) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala deleted file mode 100755 index d94d5c8e4c..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageMarshallingActor.scala +++ /dev/null @@ -1,23 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } -import org.bigbluebutton.apps.users.protocol.UsersMessageMarshalling - -/** - * This Actor is responsible for converting messages into JSON string - * to be published into the pubsub. - */ -object MessageMarshallingActor { - def props(pubsubActor: ActorRef): Props = - Props(classOf[MessageMarshallingActor], pubsubActor) -} - -class MessageMarshallingActor private (val pubsubActor: ActorRef) extends Actor - with ActorLogging { - - def receive = { - case msg: UserJoinResponseMessage => //marshallUserJoinResponseMessage(msg) - - case unknownMsg => log.error("Cannot marshall unknown message: [{}]", unknownMsg) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala deleted file mode 100644 index c3a29bb97b..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageNameConstants.scala +++ /dev/null @@ -1,47 +0,0 @@ -package org.bigbluebutton.endpoint - -object InMsgNameConst { - val CreateMeetingRequest = "create_meeting_request" - val CreateMeetingResponse = "create_meeting_response" - val MeetingCreatedEvent = "meeting_created_event" - val EndMeetingRequest = "end_meeting_request" - val EndMeetingResponse = "end_meeting_response" - val EndMeetingWarningEvent = "end_meeting_warning_event" - val MeetingEndEvent = "meeting_end_event" - val MeetingEndedEvent = "meeting_ended_event" - val ExtendMeetingRequest = "extend_meeting_request" - val ExtendMeetingResponse = "extend_meeting_response" - val MeetingExtendedEvent = "meeting_extended_event" - - val RegisterUserRequest = "register_user_request" - val RegisterUserResponse = "register_user_response" - val UserRegisteredEvent = "user_registered_event" - val UserJoinRequest = "user_join_request" - val UserJoinResponse = "user_join_response" - val UserJoinedEvent = "user_joined_event" - val UserLeaveEvent = "user_leave_event" - val UserLeftEvent = "user_left_event" - val GetUsersRequest = "get_users_request" - val GetUsersResponse = "get_users_response" - val RaiseUserHandRequest = "raise_user_hand_request" - val UserRaisedHandEvent = "user_raised_hand_event" - val AssignPresenterRequest = "assign_presenter_request" - val PresenterAssignedEvent = "presenter_assigned_event" - val MuteUserRequest = "mute_user_request" - val MuteUserRequestEvent = "mute_user_request_event" - val MuteVoiceUserRequest = "mute_voice_user_request" - val VoiceUserMutedEvent = "voice_user_muted_event" - val UserMutedEvent = "user_muted_event" - val EjectUserRequest = "eject_user_request" - val UserEjectedEvent = "user_ejected_event" - val EjectUserFromVoiceRequest = "eject_user_from_voice_request" - val EjectVoiceUserRequest = "eject_voice_user_request" - val VoiceUserEjectedEvent = "voice_user_ejected_event" - val LockUserRequest = "lock_user_request" - val LockVoiceUserRequest = "lock_voice_user_request" - val VoiceUserLockedEvent = "voice_user_locked_event" - val UserLockedEvent = "user_locked_event" - val LockAllUsersRequest = "lock_all_users_request" - val AllUsersLockedEvent = "all_users_locked_event" -} - diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala deleted file mode 100755 index 0e24e14a5a..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/MessageUmarshallingActor.scala +++ /dev/null @@ -1,93 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } -import spray.json.{ JsObject, JsonParser, DeserializationException } -import org.parboiled.errors.ParsingException -import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport._ -import org.bigbluebutton.apps.protocol._ -import scala.util.{ Try, Success, Failure } -import org.bigbluebutton.apps.users.protocol.UsersMessageUnmarshalling - -object MessageUnmarshallingActor { - def props(messageHandlerActor: ActorRef): Props = - Props(classOf[MessageUnmarshallingActor], messageHandlerActor) -} - -class MessageUnmarshallingActor private (val messageHandlerActor: ActorRef) extends Actor - with ActorLogging { - - def receive = { - case msg: String => handleMessage(msg) - case badMsg => log.error("Unhandled message: [{}", badMsg) - } - - def handleMessage(msg: String) = { - unmarshall(msg) match { - case Success(validMsg) => forwardMessage(validMsg) - case Failure(ex) => log.error("Unhandled message: [{}]", ex) - } - } - - def forwardMessage(msg: HeaderAndJsonMessage) = { - msg.header.name match { - case InMsgNameConst.UserJoinRequest => - //handleUserJoin(msg) - case InMsgNameConst.UserLeaveEvent => - //handleUserLeave(msg) - case InMsgNameConst.GetUsersRequest => - //handleGetUsers(msg) - case InMsgNameConst.AssignPresenterRequest => - //handleAssignPresenter(msg) - - case _ => - log.error("Unknown message name: [{}]", msg.header.name) - } - } - - def header(msg: JsObject): Header = { - try { - msg.fields.get("header") match { - case Some(header) => - header.convertTo[Header] - case None => - throw MessageProcessException("Cannot get header: [" + msg + "]") - } - } catch { - case e: DeserializationException => - throw MessageProcessException("Failed to deserialize header: [" + msg + "]") - } - } - - def payload(msg: JsObject): JsObject = { - msg.fields.get("payload") match { - case Some(payload) => - payload.asJsObject - case None => - throw MessageProcessException("Cannot get payload information: [" + msg + "]") - } - } - - def toJsObject(msg: String): JsObject = { - try { - JsonParser(msg).asJsObject - } catch { - case e: ParsingException => { - log.error("Cannot parse message: {}", msg) - throw MessageProcessException("Cannot parse JSON message: [" + msg + "]") - } - } - } - - def toHeaderAndJsonMessage(header: Header, message: String): HeaderAndJsonMessage = { - HeaderAndJsonMessage(header, message) - } - - def unmarshall(jsonMsg: String): Try[HeaderAndJsonMessage] = { - for { - jsonObj <- Try(toJsObject(jsonMsg)) - header <- Try(header(jsonObj)) - message = toHeaderAndJsonMessage(header, jsonMsg) - } yield message - } - -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala deleted file mode 100644 index 6a992824ab..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMessageFormatters.scala +++ /dev/null @@ -1,14 +0,0 @@ -package org.bigbluebutton.endpoint - -import org.bigbluebutton.apps.protocol.Header -import org.bigbluebutton.apps.MeetingIdAndName - -sealed abstract class OutMsgFormatter - -case class MeetingCreatedEventFormat(header: Header, - payload: MeetingCreatedEventPayloadFormat) -case class UserJoinResponseFormat(header: Header, - payload: UserJoinResponseFormatPayload) extends OutMsgFormatter -case class UserJoinResponseFormatPayload(meeting: MeetingIdAndName, - session: String, result: ResultFormat, - user: Option[UserFormat]) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala deleted file mode 100644 index f3ef70ec93..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/OutMsgBuilderActor.scala +++ /dev/null @@ -1,21 +0,0 @@ -package org.bigbluebutton.endpoint - -import akka.actor.{ Actor, ActorRef, ActorLogging, Props } - -/** - * This Actor is responsible for building formatted messages that - * will be sent to the pubsub. - */ -object OutMsgBuilderActor { - def props(pubsubActor: ActorRef): Props = - Props(classOf[OutMsgBuilderActor], pubsubActor) -} - -class OutMsgBuilderActor private (val bbbAppsActor: ActorRef, - val messageMarshallingActor: ActorRef) extends Actor - with ActorLogging { - - def receive = { - case unknownMsg => log.error("Cannot handle unknown message: [{}]", unknownMsg) - } -} \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala deleted file mode 100644 index 29e5fa498f..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/Protocol.scala +++ /dev/null @@ -1,107 +0,0 @@ -package org.bigbluebutton.endpoint - -import spray.json.{ DefaultJsonProtocol, JsValue, JsString, DeserializationException, JsonFormat } -import spray.json.DefaultJsonProtocol._ -import org.bigbluebutton.apps.users.data._ -import org.bigbluebutton.apps.protocol._ -import org.bigbluebutton.apps.Role -import org.bigbluebutton.apps.MeetingIdAndName -import org.bigbluebutton.apps.protocol.HeaderAndPayloadJsonSupport.headerFormat - -/** JSON Conversion Protocol **/ -object UserMessagesProtocol extends DefaultJsonProtocol { - import HeaderAndPayloadJsonSupport._ - - implicit object RoleJsonFormat extends JsonFormat[Role.RoleType] { - def write(obj: Role.RoleType): JsValue = JsString(obj.toString) - - def read(json: JsValue): Role.RoleType = json match { - case JsString(str) => Role.withName(str) - case _ => throw new DeserializationException("Enum string expected") - } - } - - /* - implicit val webIdentityFormat = - jsonFormat1(WebIdentity) - implicit val callerIdFormat = - jsonFormat2(CallerId) - implicit val voiceIdentityFormat = - jsonFormat5(VoiceIdentity) -*/ - implicit val userFormat = - jsonFormat8(UserFormat) - implicit val userIdAndNameFormat = - jsonFormat2(UserIdAndName) - implicit val meetingIdAndNameFormat = - jsonFormat2(MeetingIdAndName) - implicit val userJoinRequestPayloadFormat = - jsonFormat3(UserJoinRequestPayloadFormat) - implicit val userJoinRequestMessageFormat = - jsonFormat2(UserJoinRequestFormat) - implicit val resultFormat = - jsonFormat2(ResultFormat) - implicit val userJoinResponsePayloadFormat = - jsonFormat4(UserJoinResponseFormatPayload) - implicit val userJoinResponseJsonMessageFormat = - jsonFormat2(UserJoinResponseFormat) - implicit val userLeavePayloadFormat = - jsonFormat3(UserLeavePayload) - implicit val userLeaveMessageFormat = - jsonFormat2(UserLeaveMessage) - implicit val getUsersRequestPayloadFormat = - jsonFormat3(GetUsersRequestPayload) - implicit val getUsersRequestMessageFormat = - jsonFormat2(GetUsersRequestMessage) - implicit val assignPresenterPayloadFormat = - jsonFormat4(AssignPresenterPayload) - implicit val assignPresenterMessageFormat = - jsonFormat2(AssignPresenterMessage) - implicit val durationFormat = - jsonFormat3(DurationFormat) - implicit val voiceConferenceFormat = - jsonFormat2(VoiceConferenceFormat) - implicit val phoneNumberFormat = - jsonFormat2(PhoneNumberFormat) - implicit val meetingDescriptorFormat = - jsonFormat11(MeetingDescriptorFormat) - implicit val createMeetingRequestPayloadFormat = - jsonFormat1(CreateMeetingRequestPayloadFormat) - implicit val createMeetingRequestMessageFormat = - jsonFormat2(CreateMeetingRequestFormat) - implicit val createMeetingResponsePayloadFormat = - jsonFormat4(CreateMeetingResponsePayloadFormat) - implicit val createMeetingResponseFormat = - jsonFormat2(CreateMeetingResponseFormat) - implicit val meetingCreatedEventPayloadFormat = - jsonFormat3(MeetingCreatedEventPayloadFormat) - implicit val meetingCreatedEventFormat = - jsonFormat2(MeetingCreatedEventFormat) - implicit val userDescriptorFormat = - jsonFormat8(UserDescriptorFormat) - implicit val registerUserRequestPayloadFormat = - jsonFormat3(RegisterUserRequestPayloadFormat) - implicit val registerUserRequestFormat = - jsonFormat2(RegisterUserRequestFormat) - implicit val registerUserResponsePayloadFormat = - jsonFormat5(RegisterUserResponsePayloadFormat) - implicit val registerUserResponseFormat = - jsonFormat2(RegisterUserResponseFormat) - implicit val userRegisteredEventPayloadFormat = - jsonFormat3(UserRegisteredEventPayloadFormat) - implicit val userRegisteredEventFormat = - jsonFormat2(UserRegisteredEventFormat) - implicit val statusFormat = - jsonFormat4(StatusFormat) - implicit val callerIdFormat = - jsonFormat2(CallerIdFormat) - implicit val mediaStreamFormat = - jsonFormat3(MediaStreamFormat) - implicit val joinedUserFormat = - jsonFormat12(JoinedUserFormat) - implicit val userJoinedEventPayloadFormat = - jsonFormat3(UserJoinedEventPayloadFormat) - implicit val userJoinedEventFormat = jsonFormat2(UserJoinedEventFormat) - -} - diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala deleted file mode 100644 index 17d146942a..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisPublisherActor.scala +++ /dev/null @@ -1,45 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import akka.actor.Props -import redis.RedisClient -import scala.concurrent.duration._ -import scala.concurrent.ExecutionContext.Implicits.global -import akka.actor.ActorSystem -import scala.concurrent.Await -import akka.actor.Actor -import org.bigbluebutton.SystemConfiguration - -object AppsRedisPublisherActor extends SystemConfiguration { - - val channels = Seq("time") - val patterns = Seq("pattern.*") - - def props(system: ActorSystem): Props = - Props(classOf[AppsRedisPublisherActor], - system, redisHost, redisPort) -} - -class AppsRedisPublisherActor(val system: ActorSystem, - val host: String, val port: Int) extends Actor { - - val redis = RedisClient(host, port)(system) - - val futurePong = redis.ping() - println("Ping sent!") - futurePong.map(pong => { - println(s"Redis replied with a $pong") - }) - - Await.result(futurePong, 5 seconds) - - def publish(channel: String, msg: String) { - println("PUBLISH TO [" + channel + "]: \n [" + msg + "]") - // redis.publish("time", System.currentTimeMillis()) - } - - def receive = { - //case msg: JsonMessage => publish(msg.channel, msg.message) - case msg: String => println("PUBLISH TO [channel]: \n [" + msg + "]") - } - -} diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala deleted file mode 100644 index 336601f401..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/Message.scala +++ /dev/null @@ -1,3 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -case class JsonMessage(channel: String, message: String) \ No newline at end of file diff --git a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala b/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala deleted file mode 100644 index 22bea5fde4..0000000000 --- a/labs/akka-bbb-fs/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPubSubActor.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.bigbluebutton.endpoint.redis - -import akka.actor.Props -import java.net.InetSocketAddress -import redis.actors.RedisSubscriberActor -import redis.api.pubsub.{ PMessage, Message } -import redis.RedisClient -import scala.concurrent.duration._ -import scala.concurrent.ExecutionContext.Implicits.global - -class RedisPubSubActor { - implicit val akkaSystem = akka.actor.ActorSystem() - - val redis = RedisClient() - - // publish after 2 seconds every 2 or 5 seconds - akkaSystem.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) - akkaSystem.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("pattern.match", "pattern value")) - // shutdown Akka in 20 seconds - akkaSystem.scheduler.scheduleOnce(20 seconds)(akkaSystem.shutdown()) - - val channels = Seq("time") - val patterns = Seq("pattern.*") - // create SubscribeActor instance - akkaSystem.actorOf(Props(classOf[SubscribeActor], channels, patterns).withDispatcher("rediscala.rediscala-client-worker-dispatcher")) - -} - -class SubscribeActor(channels: Seq[String] = Nil, patterns: Seq[String] = Nil) - extends RedisSubscriberActor(new InetSocketAddress("localhost", 6379), channels, patterns) { - - def onMessage(message: Message) { - println(s"message received: $message") - } - - def onPMessage(pmessage: PMessage) { - println(s"pattern message received: $pmessage") - } -} \ No newline at end of file From 28fac526875288e8b3063bd7c161bdf3894bda3c Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Tue, 2 Jun 2015 17:53:43 +0000 Subject: [PATCH 30/30] - add start/stop recording messages --- .../receivers/WhiteboardMessageReceiver.java | 6 ------ .../StopRecordingVoiceConfRequestMessage.java | 6 +++--- .../receivers/RedisMessageReceiver.java | 20 ++++++++++++++----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java index c6cfadee3d..f27955494d 100755 --- a/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java +++ b/labs/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/WhiteboardMessageReceiver.java @@ -35,27 +35,21 @@ public class WhiteboardMessageReceiver implements MessageHandler { if (header.has("name")) { String messageName = header.get("name").getAsString(); if (UndoWhiteboardRequest.UNDO_WHITEBOARD_REQUEST.equals(messageName)) { - System.out.println("inListener:UNDO_WHITEBOARD_REQUEST"); UndoWhiteboardRequest msg = UndoWhiteboardRequest.fromJson(message); bbbInGW.undoWhiteboard(msg.meetingId, msg.requesterId, msg.whiteboardId); } else if (ClearWhiteboardRequestMessage.CLEAR_WHITEBOARD_REQUEST.equals(messageName)) { - System.out.println("inListener:CLEAR_WHITEBOARD_REQUEST"); ClearWhiteboardRequestMessage msg = ClearWhiteboardRequestMessage.fromJson(message); bbbInGW.clearWhiteboard(msg.meetingId, msg.requesterId, msg.whiteboardId); } else if (RequestWhiteboardAnnotationHistoryRequestMessage.REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST.equals(messageName)) { - System.out.println("inListener:REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST"); RequestWhiteboardAnnotationHistoryRequestMessage msg = RequestWhiteboardAnnotationHistoryRequestMessage.fromJson(message); bbbInGW.requestWhiteboardAnnotationHistory(msg.meetingId, msg.requesterId, msg.whiteboardId, msg.replyTo); } else if (IsWhiteboardEnabledRequestMessage.IS_WHITEBOARD_ENABLED_REQUEST.equals(messageName)) { - System.out.println("inListener: IS_WHITEBOARD_ENABLED_REQUEST"); IsWhiteboardEnabledRequestMessage msg = IsWhiteboardEnabledRequestMessage.fromJson(message); bbbInGW.isWhiteboardEnabled(msg.meetingId, msg.requesterId, msg.replyTo); } else if (EnableWhiteboardRequestMessage.ENABLE_WHITEBOARD_REQUEST.equals(messageName)) { - System.out.println("inListener: ENABLE_WHITEBOARD_REQUEST"); EnableWhiteboardRequestMessage msg = EnableWhiteboardRequestMessage.fromJson(message); bbbInGW.enableWhiteboard(msg.meetingId, msg.requesterId, msg.enable); } else if (SendWhiteboardAnnotationRequestMessage.SEND_WHITEBOARD_ANNOTATION_REQUEST.equals(messageName)) { - System.out.println("inListener: SEND_WHITEBOARD_ANNOTATION_REQUEST"); SendWhiteboardAnnotationRequestMessage msg = SendWhiteboardAnnotationRequestMessage.fromJson(message); bbbInGW.sendWhiteboardAnnotation(msg.meetingId, msg.requesterId, msg.annotation); } diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java index 3cf464a210..5c44191d0f 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/messages/StopRecordingVoiceConfRequestMessage.java @@ -6,7 +6,7 @@ import com.google.gson.JsonParser; public class StopRecordingVoiceConfRequestMessage { - public static final String RECORD_VOICE_CONF_REQUEST = "stop_recording_voice_conf_request_message"; + public static final String STOP_RECORD_VOICE_CONF_REQUEST = "stop_recording_voice_conf_request_message"; public static final String VERSION = "0.0.1"; public static final String MEETING_ID = "meeting_id"; @@ -29,7 +29,7 @@ public class StopRecordingVoiceConfRequestMessage { payload.put(VOICE_CONF_ID, voiceConfId); payload.put(RECORD_STREAM, recordStream); - java.util.HashMap header = MessageBuilder.buildHeader(RECORD_VOICE_CONF_REQUEST, VERSION, null); + java.util.HashMap header = MessageBuilder.buildHeader(STOP_RECORD_VOICE_CONF_REQUEST, VERSION, null); return MessageBuilder.buildJson(header, payload); } @@ -44,7 +44,7 @@ public class StopRecordingVoiceConfRequestMessage { if (header.has("name")) { String messageName = header.get("name").getAsString(); - if (RECORD_VOICE_CONF_REQUEST.equals(messageName)) { + if (STOP_RECORD_VOICE_CONF_REQUEST.equals(messageName)) { if (payload.has(MEETING_ID) && payload.has(VOICE_CONF_ID) && payload.has(RECORD_STREAM)) { diff --git a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java index a49216e9b6..7d4d2b2778 100755 --- a/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java +++ b/labs/akka-bbb-fs/src/main/java/org/bigbluebutton/freeswitch/pubsub/receivers/RedisMessageReceiver.java @@ -5,6 +5,8 @@ import org.bigbluebutton.freeswitch.pubsub.messages.EjectUserFromVoiceConfReques import org.bigbluebutton.freeswitch.pubsub.messages.GetUsersFromVoiceConfRequestMessage; import org.bigbluebutton.freeswitch.pubsub.messages.MuteUserInVoiceConfRequestMessage; import org.bigbluebutton.freeswitch.pubsub.messages.RecordVoiceConfRequestMessage; +import org.bigbluebutton.freeswitch.pubsub.messages.StartRecordingVoiceConfRequestMessage; +import org.bigbluebutton.freeswitch.pubsub.messages.StopRecordingVoiceConfRequestMessage; import org.bigbluebutton.freeswitch.voice.freeswitch.FreeswitchApplication; import com.google.gson.JsonObject; @@ -45,8 +47,11 @@ public class RedisMessageReceiver { case MuteUserInVoiceConfRequestMessage.MUTE_VOICE_USER_REQUEST: processMuteVoiceUserRequestMessage(message); break; - case RecordVoiceConfRequestMessage.RECORD_VOICE_CONF_REQUEST: - processRecordVoiceConfRequestMessage(message); + case StartRecordingVoiceConfRequestMessage.START_RECORD_VOICE_CONF_REQUEST: + processStartRecordingVoiceConfRequestMessage(message); + break; + case StopRecordingVoiceConfRequestMessage.STOP_RECORD_VOICE_CONF_REQUEST: + processStopRecordingVoiceConfRequestMessage(message); break; } } @@ -74,8 +79,13 @@ public class RedisMessageReceiver { fsApp.muteUser(msg.voiceConfId, msg.voiceUserId, msg.mute); } - private void processRecordVoiceConfRequestMessage(String json) { - RecordVoiceConfRequestMessage msg = RecordVoiceConfRequestMessage.fromJson(json); - //fsApp. + private void processStartRecordingVoiceConfRequestMessage(String json) { + StartRecordingVoiceConfRequestMessage msg = StartRecordingVoiceConfRequestMessage.fromJson(json); + fsApp.startRecording(msg.voiceConfId, msg.meetingId); + } + + private void processStopRecordingVoiceConfRequestMessage(String json) { + StopRecordingVoiceConfRequestMessage msg = StopRecordingVoiceConfRequestMessage.fromJson(json); + fsApp.stopRecording(msg.voiceConfId, msg.meetingId, msg.recordStream); } }