- start formatting json messages for users and meeting
This commit is contained in:
parent
3244383a7e
commit
e915c72331
@ -14,6 +14,7 @@ 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
|
||||
|
||||
class CollectorActor(dispatcher: IDispatcher) extends Actor {
|
||||
|
||||
@ -1322,118 +1323,43 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor {
|
||||
|
||||
// OUT MESSAGES
|
||||
private def handleMeetingCreated(msg: MeetingCreated) {
|
||||
val payload = new java.util.HashMap[String, Any]()
|
||||
payload.put(Constants.MEETING_ID, msg.meetingID)
|
||||
payload.put(Constants.RECORDED, msg.recorded)
|
||||
payload.put(Constants.VOICE_CONF, msg.voiceBridge)
|
||||
|
||||
val header = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.MEETING_CREATED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING MEETING CREATED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleVoiceRecordingStarted(msg: VoiceRecordingStarted) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.VOICE_RECORDING_STARTED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING VOICE RECORDING STARTED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.voiceRecordingStartedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleVoiceRecordingStopped(msg: VoiceRecordingStopped) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.VOICE_RECORDING_STOPPED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING VOICE RECORDING STOPPED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.voiceRecordingStoppedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleRecordingStatusChanged(msg: RecordingStatusChanged) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.RECORDING_STATUS_CHANGED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING RECORDING STATUS CHANGED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.recordingStatusChangedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.GET_RECORDING_STATUS_REPLY)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING GET RECORDING STATUS REPLY *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.getRecordingStatusReplyToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleMeetingEnded(msg: MeetingEnded) {
|
||||
val payload = new java.util.HashMap[String, Any]()
|
||||
payload.put(Constants.MEETING_ID, msg.meetingID)
|
||||
payload.put(Constants.RECORDED, msg.recorded)
|
||||
payload.put(Constants.VOICE_CONF, msg.voiceBridge)
|
||||
|
||||
val header = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.MEETING_ENDED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING MEETING ENDED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.meetingEndedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleMeetingHasEnded(msg: MeetingHasEnded) {
|
||||
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.MEETING_ENDED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING MEETING HAS ENDED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.meetingHasEndedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleMeetingDestroyed(msg: MeetingDestroyed) {
|
||||
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.MEETING_DESTROYED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING MEETING DESTROYED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleDisconnectAllUsers(msg: DisconnectAllUsers) {
|
||||
|
@ -84,5 +84,5 @@ object Constants {
|
||||
val JOINED = "joined"
|
||||
val X_PERCENT = "x_percent"
|
||||
val Y_PERCENT = "y_percent"
|
||||
|
||||
val KEEP_ALIVE_ID = "keep_alive_id"
|
||||
}
|
@ -155,4 +155,7 @@ object MessageNames {
|
||||
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"
|
||||
|
||||
}
|
@ -13,7 +13,8 @@ case class VoiceRecordingStarted(
|
||||
recorded: Boolean,
|
||||
recordingFile: String,
|
||||
timestamp: String,
|
||||
confNum: String
|
||||
confNum: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class VoiceRecordingStopped(
|
||||
@ -21,55 +22,65 @@ case class VoiceRecordingStopped(
|
||||
recorded: Boolean,
|
||||
recordingFile: String,
|
||||
timestamp: String,
|
||||
confNum: String
|
||||
confNum: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class RecordingStatusChanged(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
userId: String,
|
||||
recording: Boolean
|
||||
recording: Boolean,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class GetRecordingStatusReply(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
userId: String,
|
||||
recording: Boolean
|
||||
recording: Boolean,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class MeetingCreated(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
voiceBridge: String
|
||||
voiceBridge: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class MeetingEnded(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
voiceBridge: String
|
||||
voiceBridge: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class MeetingHasEnded(
|
||||
meetingID: String,
|
||||
userId: String
|
||||
userId: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class MeetingDestroyed(
|
||||
meetingID: String
|
||||
meetingID: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class DisconnectAllUsers(
|
||||
meetingID: String
|
||||
meetingID: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class DisconnectUser(
|
||||
meetingID: String,
|
||||
userId: String
|
||||
userId: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class KeepAliveMessageReply(
|
||||
aliveID:String
|
||||
aliveID:String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case object IsAliveMessage extends IOutMessage
|
||||
@ -78,47 +89,55 @@ case object IsAliveMessage extends IOutMessage
|
||||
case class PermissionsSettingInitialized(
|
||||
meetingID: String,
|
||||
locked: Boolean,
|
||||
settings: PermissionsSetting
|
||||
settings: PermissionsSetting,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class NewPermissionsSetting(
|
||||
meetingID: String,
|
||||
settings: PermissionsSetting
|
||||
settings: PermissionsSetting,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserLocked(
|
||||
meetingID: String,
|
||||
userId: String,
|
||||
lock: Boolean
|
||||
lock: Boolean,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UsersLocked(
|
||||
meetingID: String,
|
||||
lock: Boolean,
|
||||
exceptUsers: Seq[String]
|
||||
exceptUsers: Seq[String],
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class GetPermissionsSettingReply(
|
||||
meetingID: String,
|
||||
userId: String
|
||||
userId: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class IsMeetingLockedReply(
|
||||
meetingID: String,
|
||||
userId: String
|
||||
userId: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
// Users
|
||||
case class UserRegistered(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
user: RegisteredUser
|
||||
user: RegisteredUser,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserLeft(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
user:UserVO
|
||||
user:UserVO,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class PresenterAssigned(
|
||||
@ -148,34 +167,39 @@ case class ValidateAuthTokenReply(
|
||||
case class UserJoined(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
user:UserVO
|
||||
user:UserVO,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserRaisedHand(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
userID: String
|
||||
userID: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserLoweredHand(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
userID: String,
|
||||
loweredBy: String
|
||||
loweredBy: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserSharedWebcam(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
userID: String,
|
||||
stream: String
|
||||
stream: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserUnsharedWebcam(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
userID: String,
|
||||
stream: String
|
||||
stream: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserStatusChange(
|
||||
@ -183,7 +207,8 @@ case class UserStatusChange(
|
||||
recorded: Boolean,
|
||||
userID: String,
|
||||
status: String,
|
||||
value: Object
|
||||
value: Object,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class MuteVoiceUser(
|
||||
@ -240,13 +265,15 @@ case class IsMeetingMutedReply(
|
||||
case class StartRecording(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
requesterID: String
|
||||
requesterID: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class StopRecording(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
requesterID: String
|
||||
requesterID: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
// Chat
|
||||
|
@ -7,30 +7,389 @@ import com.google.gson.Gson
|
||||
|
||||
class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListener2 {
|
||||
|
||||
def handleMessage(msg: IOutMessage) {
|
||||
def handleMessage(msg: IOutMessage) {
|
||||
msg match {
|
||||
case msg: UserJoined => handleUserJoined(msg)
|
||||
case msg: UserLeft => handleUserLeft(msg)
|
||||
case msg: UserStatusChange => handleUserStatusChange(msg)
|
||||
case msg: ValidateAuthTokenReply => handleValidateAuthTokenReply(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: UsersLocked => handleUsersLocked(msg)
|
||||
case msg: GetPermissionsSettingReply => handleGetPermissionsSettingReply(msg)
|
||||
case msg: IsMeetingLockedReply => handleIsMeetingLockedReply(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 _ => //println("Unhandled message in UsersClientMessageSender")
|
||||
}
|
||||
}
|
||||
|
||||
private def handleUserStatusChange(msg: UserStatusChange) {
|
||||
val map= new java.util.HashMap[String, String]();
|
||||
map.put("meetingID", msg.meetingID);
|
||||
map.put("messageID", MessagingConstants.USER_STATUS_CHANGE_EVENT);
|
||||
|
||||
map.put("internalUserID", msg.userID);
|
||||
map.put("status", msg.status);
|
||||
map.put("value", msg.value.toString);
|
||||
|
||||
val gson= new Gson();
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, gson.toJson(map));
|
||||
|
||||
private def handleDisconnectAllUsers(msg: DisconnectAllUsers) {
|
||||
val json = UsersMessageToJsonConverter.disconnectAllUsersToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
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.LOCKED, msg.locked)
|
||||
payload.put(Constants.SETTINGS, msg.settings.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)
|
||||
|
||||
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.settings.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)
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER LOCKED *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
private def handleUsersLocked(msg: UsersLocked) {
|
||||
val payload = new java.util.HashMap[String, Any]()
|
||||
payload.put(Constants.MEETING_ID, msg.meetingID)
|
||||
payload.put(Constants.EXCEPT_USERS, msg.exceptUsers.toString())
|
||||
payload.put(Constants.LOCKED, msg.lock)
|
||||
|
||||
val header = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.USERS_LOCKED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING USERS 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)
|
||||
|
||||
println("***** DISPATCHING GET PERMISSIONS SETTING REPLY *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
private def handleIsMeetingLockedReply(msg: IsMeetingLockedReply) {
|
||||
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.IS_MEETING_LOCKED_REPLY)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING IS MEETING LOCKED REPLY *****************")
|
||||
// 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)
|
||||
|
||||
println("***** DISPATCHING USER REGISTERED *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
println("end of USER REGISTERED")
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING ASSIGN PRESENTER *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
private def handleUserStatusChange(msg: UserStatusChange) {
|
||||
val json = UsersMessageToJsonConverter.userStatusChangeToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING MUTE VOICE USER *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER UNSHARED WEBCAM *****************")
|
||||
// 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 java.util.ArrayList[java.util.HashMap[String, Object]];
|
||||
// msg.users.foreach(uvo => {
|
||||
// users.add(userToMap(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)
|
||||
|
||||
println("***** DISPATCHING GET USERS REPLY *****************")
|
||||
// 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)
|
||||
|
||||
println("***** DISPATCHING USER JOINED VOICE *****************")
|
||||
// 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)
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING EJECT VOICE USER *****************")
|
||||
// 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)
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING IS MEETING MUTED REPLY *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
private def handleRecordingStatusChanged(msg: RecordingStatusChanged) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.RECORDING_STATUS_CHANGED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING RECORDING STATUS CHANGED *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
private def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.GET_RECORDING_STATUS_REPLY)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING GET RECORDING STATUS REPLY *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
private def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) {
|
||||
//HEADER
|
||||
var header = new java.util.HashMap[String, Any]()
|
||||
@ -54,160 +413,53 @@ class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListene
|
||||
}
|
||||
|
||||
private def handleUserJoined(msg: UserJoined) {
|
||||
println("UsersEventRedisPublisher: init handleUserJoined")
|
||||
val map= new java.util.HashMap[String, String]();
|
||||
map.put("meetingID", msg.meetingID);
|
||||
map.put("messageID", MessagingConstants.USER_JOINED_EVENT);
|
||||
map.put("internalUserID", msg.user.userID);
|
||||
map.put("externalUserID", msg.user.externUserID);
|
||||
map.put("fullname", msg.user.name);
|
||||
map.put("role", msg.user.role.toString());
|
||||
|
||||
val gson= new Gson();
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, gson.toJson(map));
|
||||
println("UsersEventRedisPublisher: end handleUserJoined")
|
||||
|
||||
//Anton: for user_joined_event ---start------------
|
||||
println("UsersEventRedisPublisher: init handleUserJoined ***Anton")
|
||||
|
||||
//HEADER
|
||||
var header = new java.util.HashMap[String, Any]()
|
||||
header.put("name", "user_joined_event") //not the same as MessagingConstants.USER_JOINED_EVENT
|
||||
header.put("timestamp", "Mon, 31 Mar 2014 14:49:07 GMT")
|
||||
header.put("source", "bbb-web")
|
||||
var destination = new java.util.HashMap[String, String]()
|
||||
destination.put("to", "apps_channel")
|
||||
header.put("destination", destination)
|
||||
|
||||
//PAYLOAD
|
||||
var payload = new java.util.HashMap[String, Object]()
|
||||
|
||||
var meeting = new java.util.HashMap[String, String]()
|
||||
meeting.put("id", msg.meetingID)
|
||||
meeting.put("name", "English 101")
|
||||
payload.put("meeting", meeting)
|
||||
|
||||
payload.put("session", "someSessionId")
|
||||
|
||||
var user = new java.util.HashMap[String, Any]()
|
||||
user.put("id", msg.user.userID)
|
||||
user.put("external_id", msg.user.externUserID)
|
||||
user.put("name", msg.user.name)
|
||||
user.put("role", msg.user.role.toString())
|
||||
user.put("pin", 12345)
|
||||
user.put("welcome_message", "Welcome to English 101")
|
||||
user.put("logout_url", "http://www.example.com")
|
||||
user.put("avatar_url", "http://www.example.com/avatar.png")
|
||||
user.put("is_presenter", true)
|
||||
|
||||
|
||||
var status = new java.util.HashMap[String, Boolean]()
|
||||
status.put("hand_raised", false)
|
||||
status.put("muted", false)
|
||||
status.put("locked", false)
|
||||
status.put("talking", false)
|
||||
user.put("status", status)
|
||||
|
||||
var caller_id = new java.util.HashMap[String, String]()
|
||||
caller_id.put("name", "Juan Tamad")
|
||||
caller_id.put("number", "011-63-917-555-1234")
|
||||
user.put("caller_id", caller_id)
|
||||
|
||||
var media_streams : Array[Object] = new Array[Object](3)
|
||||
var audio = new java.util.HashMap[String, Any]()
|
||||
audio.put("media_type", "audio")
|
||||
audio.put("uri", "http://cdn.bigbluebutton.org/stream/a1234")
|
||||
var meta = new java.util.HashMap[String, String]() //common among the 3 objects
|
||||
meta.put("foo", "bar")
|
||||
audio.put("metadata", meta)
|
||||
|
||||
var video = new java.util.HashMap[String, Any]()
|
||||
video.put("media_type", "video")
|
||||
video.put("uri", "http://cdn.bigbluebutton.org/stream/v1234")
|
||||
video.put("metadata", meta)
|
||||
|
||||
var screen = new java.util.HashMap[String, Any]()
|
||||
screen.put("media_type", "screen")
|
||||
screen.put("uri", "http://cdn.bigbluebutton.org/stream/s1234")
|
||||
screen.put("metadata", meta)
|
||||
|
||||
media_streams(0) = audio
|
||||
media_streams(1) = video
|
||||
media_streams(2) = screen
|
||||
|
||||
user.put("media_streams", media_streams)
|
||||
|
||||
var metadata = new java.util.HashMap[String, String]()
|
||||
metadata.put("student_id", "54321")
|
||||
metadata.put("program", "engineering")
|
||||
user.put("metadata", metadata)
|
||||
|
||||
payload.put("user", user)
|
||||
|
||||
var usrJoinedEvent = new java.util.HashMap[String, Object]()
|
||||
usrJoinedEvent.put("header", header)
|
||||
usrJoinedEvent.put("payload", payload)
|
||||
|
||||
println("UserJoinedEvent**NEW - " + gson.toJson(usrJoinedEvent) + "\n")
|
||||
|
||||
//Should we keep sending the message to both channels?! //TODO
|
||||
// service.send(MessagingConstants.PARTICIPANTS_CHANNEL, gson.toJson(usrJoinedEvent));
|
||||
println("UsersEventRedisPublisher: end handleUserJoined ***Anton")
|
||||
|
||||
// service.send(MessagingConstants.BIGBLUEBUTTON_WEBHOOK_EVENTS, gson.toJson(usrJoinedEvent));
|
||||
//Anton: for user_joined_event ---end------------
|
||||
val json = UsersMessageToJsonConverter.userJoinedToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
private def handleUserLeft(msg: UserLeft) {
|
||||
println("UsersEventRedisPublisher: init handleUserLeft")
|
||||
val map= new java.util.HashMap[String, String]();
|
||||
map.put("meetingID", msg.meetingID);
|
||||
map.put("messageID", MessagingConstants.USER_LEFT_EVENT);
|
||||
map.put("internalUserID", msg.user.userID);
|
||||
|
||||
val gson= new Gson();
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, gson.toJson(map));
|
||||
|
||||
println("UsersEventRedisPublisher: end handleUserLeft")
|
||||
private def handleRegisteredUser(msg: UserRegistered) {
|
||||
val args = new java.util.HashMap[String, Object]();
|
||||
args.put("userId", msg.user.id);
|
||||
|
||||
//
|
||||
//Event handled by the HTML5 client (and node)
|
||||
println("UsersEventRedisPublisher: init handleUserLeft***Anton")
|
||||
|
||||
//HEADER
|
||||
var header = new java.util.HashMap[String, Any]()
|
||||
header.put("name", "user_left_event") //not the same as MessagingConstants.USER_LEFT_EVENT
|
||||
header.put("timestamp", "Mon, 31 Mar 2014 14:49:07 GMT")
|
||||
header.put("source", "web-api")
|
||||
var destination = new java.util.HashMap[String, String]()
|
||||
destination.put("to", "apps_channel")
|
||||
header.put("destination", destination)
|
||||
|
||||
//PAYLOAD
|
||||
var payload = new java.util.HashMap[String, Object]()
|
||||
|
||||
var meeting = new java.util.HashMap[String, String]()
|
||||
meeting.put("id", msg.meetingID)
|
||||
meeting.put("name", "English 101")
|
||||
payload.put("meeting", meeting)
|
||||
|
||||
payload.put("session", "someSessionId")
|
||||
|
||||
var user = new java.util.HashMap[String, Any]()
|
||||
user.put("id", msg.user.userID)
|
||||
user.put("name", msg.user.name)
|
||||
payload.put("user", user)
|
||||
|
||||
|
||||
var usrLeftEvent = new java.util.HashMap[String, Object]()
|
||||
usrLeftEvent.put("header", header)
|
||||
usrLeftEvent.put("payload", payload)
|
||||
|
||||
|
||||
// service.send(MessagingConstants.PARTICIPANTS_CHANNEL, gson.toJson(usrLeftEvent));
|
||||
|
||||
//service.send(MessagingConstants.BIGBLUEBUTTON_WEBHOOK_EVENTS, gson.toJson(usrLeftEvent));
|
||||
|
||||
println("UsersEventRedisPublisher: end handleUserLeft***Anton")
|
||||
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 handleUserLeft(msg: UserLeft) {
|
||||
val json = UsersMessageToJsonConverter.userLeftToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, 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)
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING END AND KICK ALL *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,410 @@
|
||||
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.webcamStream
|
||||
wuser += "phone_user" -> user.phoneUser
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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.LOCKED, msg.locked)
|
||||
payload.put(Constants.SETTINGS, msg.settings.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.SETTINGS, msg.settings.toString()) //#todo not tested
|
||||
|
||||
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 usersLockedToJson(msg: UsersLocked):String = {
|
||||
val payload = new java.util.HashMap[String, Any]()
|
||||
payload.put(Constants.MEETING_ID, msg.meetingID)
|
||||
payload.put(Constants.EXCEPT_USERS, msg.exceptUsers.toString())
|
||||
payload.put(Constants.LOCKED, msg.lock)
|
||||
|
||||
val header = Util.buildHeader(MessageNames.USERS_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 isMeetingLockedReplyToJson(msg: IsMeetingLockedReply):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.IS_MEETING_LOCKED_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, msg.user.toString())
|
||||
payload.put(Constants.RECORDED, msg.recorded)
|
||||
|
||||
val header = Util.buildHeader(MessageNames.USER_REGISTERED, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
|
||||
def handleUserRaisedHand(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 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)
|
||||
|
||||
println("***** DISPATCHING USER LOWERED HAND *****************")
|
||||
// dispatcher.dispatch(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.RAISE_HAND, msg.recorded)
|
||||
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 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)
|
||||
|
||||
println("***** DISPATCHING USER SHARED WEBCAM *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER UNSHARED WEBCAM *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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 java.util.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)
|
||||
|
||||
println("***** DISPATCHING GET USERS REPLY *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER JOINED VOICE *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER VOICE MUTED *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER VOICE TALKING *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING EJECT VOICE USER *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING USER LEFT VOICE *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING IS MEETING MUTED REPLY *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
def handleRecordingStatusChanged(msg: RecordingStatusChanged) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.RECORDING_STATUS_CHANGED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING RECORDING STATUS CHANGED *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
def handleGetRecordingStatusReply(msg: GetRecordingStatusReply) {
|
||||
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 = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.GET_RECORDING_STATUS_REPLY)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING GET RECORDING STATUS REPLY *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
def handleValidateAuthTokenReply(msg: ValidateAuthTokenReply) {
|
||||
//HEADER
|
||||
var header = new java.util.HashMap[String, Any]()
|
||||
header.put("name", "validate_auth_token_reply")
|
||||
header.put("timestamp", System.currentTimeMillis())
|
||||
|
||||
//PAYLOAD
|
||||
var payload = new java.util.HashMap[String, Object]()
|
||||
payload.put("correlation_id", msg.correlationId)
|
||||
payload.put("valid", msg.valid.toString)
|
||||
payload.put("user_id", msg.requesterId)
|
||||
payload.put("token", msg.token)
|
||||
payload.put("meeting_id", msg.meetingID)
|
||||
|
||||
val gson= new Gson();
|
||||
|
||||
var map = new java.util.HashMap[String, Any]()
|
||||
map.put("header", header)
|
||||
map.put("payload", payload)
|
||||
// service.send(MessagingConstants.FROM_USERS_CHANNEL, gson.toJson(map));
|
||||
}
|
||||
|
||||
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 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")
|
||||
}
|
||||
|
||||
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 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)
|
||||
|
||||
println("***** DISPATCHING PRESENTER ASSIGNED *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
println("***** DISPATCHING END AND KICK ALL *****************")
|
||||
// dispatcher.dispatch(buildJson(header, payload))
|
||||
}
|
||||
}
|
@ -1,17 +1,11 @@
|
||||
package org.bigbluebutton.core.meeting
|
||||
|
||||
import org.bigbluebutton.conference.service.messaging.redis.MessageSender
|
||||
import org.bigbluebutton.core.api.OutMessageListener2
|
||||
import org.bigbluebutton.core.api.IOutMessage
|
||||
import org.bigbluebutton.core.api.KeepAliveMessageReply
|
||||
import org.bigbluebutton.core.api.MeetingCreated
|
||||
import org.bigbluebutton.core.api.MeetingEnded
|
||||
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
|
||||
import org.bigbluebutton.core.api.MeetingDestroyed
|
||||
import org.bigbluebutton.core.api.MeetingDestroyed
|
||||
|
||||
class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListener2 {
|
||||
|
||||
@ -19,35 +13,94 @@ class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListe
|
||||
|
||||
def handleMessage(msg: IOutMessage) {
|
||||
msg match {
|
||||
case msg: MeetingCreated => handleMeetingCreated(msg)
|
||||
case msg: MeetingEnded => handleMeetingEnded(msg)
|
||||
case msg: MeetingDestroyed => handleMeetingDestroyed(msg)
|
||||
case msg: KeepAliveMessageReply => handleKeepAliveMessageReply(msg)
|
||||
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 _ => //println("Unhandled message in MeetingEventRedisPublisher")
|
||||
}
|
||||
}
|
||||
|
||||
private def handleMeetingDestroyed(msg: MeetingDestroyed) {
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> MessagingConstants.MEETING_DESTROYED_EVENT, "meetingID" -> msg.meetingID)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, gson.toJson(map.asJava))
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> MessagingConstants.MEETING_DESTROYED_EVENT, "meetingID" -> msg.meetingID)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, gson.toJson(map.asJava))
|
||||
|
||||
val json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg)
|
||||
System.out.println("****\n" + json)
|
||||
//service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply):Unit = {
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> KEEP_ALIVE_REPLY, "aliveID" -> msg.aliveID)
|
||||
service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, gson.toJson(map.asJava))
|
||||
private def handleKeepAliveMessageReply(msg: KeepAliveMessageReply) {
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> KEEP_ALIVE_REPLY, "aliveID" -> msg.aliveID)
|
||||
service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, gson.toJson(map.asJava))
|
||||
|
||||
val json = MeetingMessageToJsonConverter.keepAliveMessageReplyToJson(msg)
|
||||
System.out.println("****\n" + json)
|
||||
//service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, json)
|
||||
}
|
||||
|
||||
private def handleMeetingCreated(msg:MeetingCreated):Unit = {
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> MessagingConstants.MEETING_STARTED_EVENT, "meetingID" -> msg.meetingID)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, gson.toJson(map.asJava))
|
||||
private def handleMeetingCreated(msg:MeetingCreated) {
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> MessagingConstants.MEETING_STARTED_EVENT, "meetingID" -> msg.meetingID)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, gson.toJson(map.asJava))
|
||||
|
||||
|
||||
val json = MeetingMessageToJsonConverter.meetingCreatedToJson(msg)
|
||||
System.out.println("****\n" + json)
|
||||
//service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
private def handleMeetingEnded(msg:MeetingEnded):Unit = {
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> MessagingConstants.MEETING_ENDED_EVENT, "meetingID" -> msg.meetingID)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, gson.toJson(map.asJava))
|
||||
private def handleMeetingEnded(msg:MeetingEnded){
|
||||
val gson = new Gson
|
||||
var map = Map("messageID" -> MessagingConstants.MEETING_ENDED_EVENT, "meetingID" -> msg.meetingID)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, gson.toJson(map.asJava))
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
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)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
@ -33,9 +33,7 @@ public class MeetingMessageHandler implements MessageHandler {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
if (obj.has("header")) return; // we don't currently handle this type of message
|
||||
|
||||
JsonObject messageObject = (JsonObject) obj.get("message");
|
||||
|
||||
|
||||
if (channel.equalsIgnoreCase(MessagingConstants.FROM_MEETING_CHANNEL)) {
|
||||
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
|
||||
String messageId = map.get("messageID");
|
||||
|
@ -0,0 +1,19 @@
|
||||
package org.bigbluebutton.api.messaging.converters;
|
||||
|
||||
import org.bigbluebutton.api.messaging.messages.IMessage;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class MessageFromJsonConverter {
|
||||
|
||||
public IMessage convert(String json) {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(json);
|
||||
if (obj.has("header") && obj.has("payload")) {
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user