Merge branch 'merge-polling-with-master' of https://github.com/bigbluebutton/bigbluebutton into merge-polling-with-master
This commit is contained in:
commit
daed029107
78
bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java
Executable file → Normal file
78
bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/meeting/messaging/redis/MeetingMessageHandler.java
Executable file → Normal file
@ -2,65 +2,65 @@ 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.ValidateAuthTokenMessage;
|
||||
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
|
||||
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class MeetingMessageHandler implements MessageHandler {
|
||||
private static Logger log = Red5LoggerFactory.getLogger(MeetingMessageHandler.class, "bigbluebutton");
|
||||
|
||||
private static final String KEEP_ALIVE_REQUEST = "KEEP_ALIVE_REQUEST";
|
||||
|
||||
private IBigBlueButtonInGW bbbGW;
|
||||
|
||||
@Override
|
||||
public void handleMessage(String pattern, String channel, String message) {
|
||||
log.debug("Checking message: " + pattern + " " + channel + " " + message);
|
||||
System.out.println("Checking message: " + pattern + " " + channel + " " + message);
|
||||
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) {
|
||||
Gson gson = new Gson();
|
||||
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
|
||||
|
||||
IMessage msg = MessageFromJsonConverter.convert(message);
|
||||
|
||||
String messageId = map.get("messageId");
|
||||
if (messageId != null){
|
||||
if (MessagingConstants.END_MEETING_REQUEST_EVENT.equalsIgnoreCase(messageId)){
|
||||
String meetingId = map.get("meetingId");
|
||||
log.info("Received end meeting request. Meeting id [{}]", meetingId);
|
||||
bbbGW.endMeeting(meetingId);
|
||||
} else if(MessagingConstants.CREATE_MEETING_REQUEST_EVENT.equalsIgnoreCase(messageId)){
|
||||
String meetingID = map.get("meetingID");
|
||||
log.info("Received create meeting request. Meeting id [{}]", meetingID);
|
||||
Boolean record = Boolean.parseBoolean(map.get("record"));
|
||||
String voiceBridge = map.get("voiceBridge");
|
||||
String meetingName = map.get("meetingName");
|
||||
Long duration = Long.parseLong(map.get("duration"));
|
||||
bbbGW.createMeeting2(meetingID, meetingName, record, voiceBridge, duration);
|
||||
} else if(MessagingConstants.DESTROY_MEETING_REQUEST_EVENT.equalsIgnoreCase(messageId)){
|
||||
String meetingID = map.get("meetingID");
|
||||
log.info("Received destroy meeting request. Meeting id [{}]", meetingID);
|
||||
bbbGW.destroyMeeting(meetingID);
|
||||
} else if (MessagingConstants.VALIDATE_AUTH_TOKEN.equals(messageId)) {
|
||||
String meetingId = map.get("meeting_id");
|
||||
String userId = map.get("user_id");
|
||||
String token = map.get("auth_token");
|
||||
String correlationId = map.get("correlation_id");
|
||||
bbbGW.validateAuthToken(meetingId, userId, token, correlationId);
|
||||
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;
|
||||
bbbGW.createMeeting2(emm.id, emm.name, emm.record, emm.voiceBridge, emm.duration);
|
||||
} else if (msg instanceof RegisterUserMessage) {
|
||||
RegisterUserMessage emm = (RegisterUserMessage) msg;
|
||||
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 toekn request. Meeting id [{}]", emm.meetingId);
|
||||
bbbGW.validateAuthToken(emm.meetingId, emm.userId, emm.token, emm.replyTo);
|
||||
}
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) {
|
||||
Gson gson = new Gson();
|
||||
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
|
||||
String messageId = map.get("messageId");
|
||||
if (messageId != null){
|
||||
if(messageId.equalsIgnoreCase(KEEP_ALIVE_REQUEST)){
|
||||
String keepAliveId = map.get("aliveId");
|
||||
bbbGW.isAliveAudit(keepAliveId);
|
||||
}
|
||||
IMessage msg = MessageFromJsonConverter.convert(message);
|
||||
|
||||
if (msg != null) {
|
||||
if (msg instanceof KeepAliveMessage) {
|
||||
KeepAliveMessage emm = (KeepAliveMessage) msg;
|
||||
log.info("Received KeepAliveMessage request. Meeting id [{}]", emm.keepAliveId);
|
||||
bbbGW.isAliveAudit(emm.keepAliveId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,88 @@
|
||||
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 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 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";
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
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 name;
|
||||
public final Boolean record;
|
||||
public final String voiceBridge;
|
||||
public final Long duration;
|
||||
|
||||
public CreateMeetingMessage(String id, String name, Boolean record, String voiceBridge, Long duration) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.record = record;
|
||||
this.voiceBridge = voiceBridge;
|
||||
this.duration = duration;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package org.bigbluebutton.conference.service.messaging;
|
||||
|
||||
public interface IMessage {
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
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 ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN:
|
||||
return processValidateAuthTokenMessage(header, payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
return new ValidateAuthTokenMessage(id, userid, authToken, replyTo);
|
||||
}
|
||||
|
||||
private static IMessage processCreateMeeting(JsonObject payload) {
|
||||
String id = payload.get(Constants.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();
|
||||
|
||||
return new CreateMeetingMessage(id, name, record, voiceBridge, duration);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
8
bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java
Executable file → Normal file
8
bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java
Executable file → Normal file
@ -43,15 +43,13 @@ public class MessagingConstants {
|
||||
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 = "MeetingStartedEvent";
|
||||
public static final String MEETING_ENDED_EVENT = "MeetingEndedEvent";
|
||||
public static final String MEETING_DESTROYED_EVENT = "MeetingDestroyedEvent";
|
||||
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_STATUS_CHANGE_EVENT = "UserStatusChangeEvent";
|
||||
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
|
||||
public static final String RECORD_STATUS_EVENT = "RecordStatusEvent";
|
||||
|
||||
public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token";
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.bigbluebutton.conference.service.messaging;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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 ValidateAuthTokenMessage(String meetingId, String userId, String token, String replyTo) {
|
||||
this.meetingId = meetingId;
|
||||
this.userId = userId;
|
||||
this.token = token;
|
||||
this.replyTo = replyTo;
|
||||
}
|
||||
}
|
@ -53,8 +53,8 @@ public class ParticipantsApplication {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean registerUser(String roomName, String userid, String username, String role, String externUserID, Map status) {
|
||||
bbbInGW.registerUser(roomName, userid, username, role, externUserID);
|
||||
public boolean registerUser(String roomName, String userid, String username, String role, String externUserID) {
|
||||
bbbInGW.registerUser(roomName, userid, username, role, externUserID, userid);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class ParticipantsHandler extends ApplicationAdapter implements IApplicat
|
||||
status.put("presenter", false);
|
||||
status.put("hasStream", false);
|
||||
|
||||
participantsApplication.registerUser(room, userid, username, role, bbbSession.getExternUserID(), status);
|
||||
participantsApplication.registerUser(room, userid, username, role, bbbSession.getExternUserID());
|
||||
}
|
||||
log.warn("Can't send user join as session is null.");
|
||||
}
|
||||
|
2
bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java
Executable file → Normal file
2
bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/participants/ParticipantsListener.java
Executable file → Normal file
@ -44,7 +44,7 @@ public class ParticipantsListener implements MessageHandler{
|
||||
String role = payloadObject.get("role").toString().replace("\"", "");
|
||||
String externUserID = payloadObject.get("external_user_id").toString().replace("\"", "");
|
||||
|
||||
bbbInGW.registerUser(roomName, userID, username, role, externUserID);
|
||||
|
||||
}
|
||||
else if(eventName.equalsIgnoreCase("participant_left")){ //TODO the event name is probably incorrect
|
||||
String userID = payloadObject.get("user_id").toString().replace("\"", "");
|
||||
|
@ -25,7 +25,7 @@ public interface IBigBlueButtonInGW {
|
||||
|
||||
// Users
|
||||
void validateAuthToken(String meetingId, String userId, String token, String correlationId);
|
||||
void registerUser(String roomName, String userid, String username, String role, String externUserID);
|
||||
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);
|
||||
|
5
bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala
Executable file → Normal file
5
bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala
Executable file → Normal file
@ -72,12 +72,13 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW
|
||||
* Message Interface for Users
|
||||
*************************************************************/
|
||||
def validateAuthToken(meetingId: String, userId: String, token: String, correlationId: String) {
|
||||
println("******************** VALIDATE TOKEN [" + token + "] ***************************** ")
|
||||
bbbGW.accept(new ValidateAuthToken(meetingId, userId, token, correlationId))
|
||||
}
|
||||
|
||||
def registerUser(meetingID: String, userID: String, name: String, role: String, extUserID: String):Unit = {
|
||||
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))
|
||||
bbbGW.accept(new RegisterUser(meetingID, userID, name, userRole, extUserID, authToken))
|
||||
}
|
||||
|
||||
def sendLockSettings(meetingID: String, settings: java.util.Map[String, java.lang.Boolean]) {
|
||||
|
@ -15,6 +15,7 @@ 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 {
|
||||
|
||||
@ -1484,17 +1485,8 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor {
|
||||
}
|
||||
|
||||
private def handleUserLeft(msg: UserLeft) {
|
||||
val payload = new java.util.HashMap[String, Any]()
|
||||
payload.put(Constants.MEETING_ID, msg.meetingID)
|
||||
payload.put(Constants.USER, buildUserHashMap(msg.user))
|
||||
payload.put(Constants.RECORDED, msg.recorded)
|
||||
|
||||
val header = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.USER_LEFT)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING USER LEFT *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = UsersMessageToJsonConverter.userLeftToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handlePresenterAssigned(msg: PresenterAssigned) {
|
||||
@ -1562,17 +1554,8 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor {
|
||||
}
|
||||
|
||||
private def handleUserJoined(msg: UserJoined) {
|
||||
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, buildUserHashMap(msg.user))
|
||||
|
||||
val header = new java.util.HashMap[String, Any]()
|
||||
header.put(Constants.NAME, MessageNames.USER_JOINED)
|
||||
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
|
||||
|
||||
println("***** DISPATCHING USER JOINED *****************")
|
||||
dispatcher.dispatch(buildJson(header, payload))
|
||||
val json = UsersMessageToJsonConverter.userJoinedToJson(msg)
|
||||
dispatcher.dispatch(json)
|
||||
}
|
||||
|
||||
private def handleUserRaisedHand(msg: UserRaisedHand) {
|
||||
|
@ -6,7 +6,7 @@ object Constants {
|
||||
val PAYLOAD = "payload"
|
||||
val MEETING_ID = "meeting_id"
|
||||
val TIMESTAMP = "timestamp"
|
||||
val USER_ID = "user_id"
|
||||
val USER_ID = "userid"
|
||||
val RECORDED = "recorded"
|
||||
val MEETING_NAME = "meeting_name"
|
||||
val VOICE_CONF = "voice_conf"
|
||||
|
@ -83,7 +83,8 @@ case class RegisterUser(
|
||||
userID: String,
|
||||
name: String,
|
||||
role: Role,
|
||||
extUserID: String
|
||||
extUserID: String,
|
||||
authToken: String
|
||||
) extends InMessage
|
||||
|
||||
case class UserJoining(
|
||||
|
@ -13,6 +13,7 @@ object MessageNames {
|
||||
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"
|
||||
@ -100,7 +101,6 @@ object MessageNames {
|
||||
val PRESENTER_ASSIGNED = "presenter_assigned_message"
|
||||
val END_AND_KICK_ALL = "end_and_kick_all_message"
|
||||
val GET_USERS_REPLY = "get_users_reply"
|
||||
val VALIDATE_AUTH_TOKEN_REPLY = "validate_auth_token_reply"
|
||||
val USER_JOINED = "user_joined_message"
|
||||
val USER_RAISED_HAND = "user_raised_hand_message"
|
||||
val USER_LOWERED_HAND = "user_lowered_hand_message"
|
||||
|
@ -143,18 +143,21 @@ case class UserLeft(
|
||||
case class PresenterAssigned(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
presenter: Presenter
|
||||
presenter: Presenter,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class EndAndKickAll(
|
||||
meetingID: String,
|
||||
recorded: Boolean
|
||||
recorded: Boolean,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class GetUsersReply(
|
||||
meetingID: String,
|
||||
requesterID: String,
|
||||
users: Array[UserVO]
|
||||
users: Array[UserVO],
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class ValidateAuthTokenReply(
|
||||
@ -162,7 +165,9 @@ case class ValidateAuthTokenReply(
|
||||
requesterId: String,
|
||||
token: String,
|
||||
valid: Boolean,
|
||||
correlationId: String) extends IOutMessage
|
||||
correlationId: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserJoined(
|
||||
meetingID: String,
|
||||
@ -216,42 +221,48 @@ case class MuteVoiceUser(
|
||||
recorded: Boolean,
|
||||
requesterID: String,
|
||||
userId: String,
|
||||
mute: Boolean
|
||||
mute: Boolean,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserVoiceMuted(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
confNum: String,
|
||||
user:UserVO
|
||||
user:UserVO,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserVoiceTalking(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
confNum: String,
|
||||
user:UserVO
|
||||
user:UserVO,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class EjectVoiceUser(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
requesterID: String,
|
||||
userId: String
|
||||
userId: String,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserJoinedVoice(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
confNum: String,
|
||||
user:UserVO
|
||||
user:UserVO,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class UserLeftVoice(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
confNum: String,
|
||||
user:UserVO
|
||||
user:UserVO,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
// Voice
|
||||
@ -259,7 +270,8 @@ case class IsMeetingMutedReply(
|
||||
meetingID: String,
|
||||
recorded: Boolean,
|
||||
requesterID: String,
|
||||
meetingMuted: Boolean
|
||||
meetingMuted: Boolean,
|
||||
version:String = Versions.V_0_0_1
|
||||
) extends IOutMessage
|
||||
|
||||
case class StartRecording(
|
||||
|
@ -47,7 +47,8 @@ case class RegisteredUser (
|
||||
id: String,
|
||||
externId: String,
|
||||
name: String,
|
||||
role: Role.Role
|
||||
role: Role.Role,
|
||||
authToken: String
|
||||
)
|
||||
|
||||
case class Voice(
|
||||
|
3
bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala
Executable file → Normal file
3
bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala
Executable file → Normal file
@ -39,6 +39,7 @@ trait UsersApp {
|
||||
}
|
||||
|
||||
def handleValidateAuthToken(msg: ValidateAuthToken) {
|
||||
println("*************** Got ValidateAuthToken message ********************" )
|
||||
regUsers.get (msg.userId) match {
|
||||
case Some(u) => outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, true, msg.correlationId))
|
||||
case None => outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId))
|
||||
@ -50,7 +51,7 @@ trait UsersApp {
|
||||
// Check first if the meeting has ended and the user refreshed the client to re-connect.
|
||||
sendMeetingHasEnded(msg.userID)
|
||||
} else {
|
||||
val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role)
|
||||
val regUser = new RegisteredUser(msg.userID, msg.extUserID, msg.name, msg.role, msg.authToken)
|
||||
regUsers += msg.userID -> regUser
|
||||
outGW.send(new UserRegistered(meetingID, recorded, regUser))
|
||||
}
|
||||
|
386
bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala
Executable file → Normal file
386
bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersEventRedisPublisher.scala
Executable file → Normal file
@ -30,7 +30,6 @@ class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListene
|
||||
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)
|
||||
@ -47,369 +46,119 @@ class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListene
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.disconnectUserToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.permissionsSettingInitializedToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.newPermissionsSettingToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userLockedToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.usersLockedToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.getPermissionsSettingReplyToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.isMeetingLockedReplyToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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")
|
||||
val json = UsersMessageToJsonConverter.userRegisteredToJson(msg)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userRaisedHandToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userLoweredHandToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userSharedWebcamToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userUnsharedWebcamToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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 handleGetUsersReply(msg: GetUsersReply) {
|
||||
val json = UsersMessageToJsonConverter.getUsersReplyToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userJoinedVoice(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userVoiceMuted(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userVoiceTalking(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.ejectVoiceUserToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.userLeftVoiceToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.isMeetingMutedReplyToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, 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 = UsersMessageToJsonConverter.recordingStatusChangedToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, 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 = UsersMessageToJsonConverter.getRecordingStatusReplyToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
private 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));
|
||||
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) {
|
||||
@ -418,14 +167,8 @@ class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListene
|
||||
}
|
||||
|
||||
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")
|
||||
val json = UsersMessageToJsonConverter.userRegisteredToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
private def handleUserLeft(msg: UserLeft) {
|
||||
@ -433,33 +176,14 @@ class UsersEventRedisPublisher(service: MessageSender) extends OutMessageListene
|
||||
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 handlePresenterAssigned(msg: PresenterAssigned) {
|
||||
val json = UsersMessageToJsonConverter.presenterAssignedToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
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))
|
||||
val json = UsersMessageToJsonConverter.endAndKickAllToJson(msg)
|
||||
service.send(MessagingConstants.FROM_USERS_CHANNEL, json)
|
||||
}
|
||||
|
||||
}
|
@ -36,7 +36,18 @@ object UsersMessageToJsonConverter {
|
||||
|
||||
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)
|
||||
@ -114,7 +125,7 @@ object UsersMessageToJsonConverter {
|
||||
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.USER, registeredUserToMap(msg.user))
|
||||
payload.put(Constants.RECORDED, msg.recorded)
|
||||
|
||||
val header = Util.buildHeader(MessageNames.USER_REGISTERED, msg.version, None)
|
||||
@ -122,7 +133,7 @@ object UsersMessageToJsonConverter {
|
||||
}
|
||||
|
||||
|
||||
def handleUserRaisedHand(msg: UserRaisedHand):String = {
|
||||
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)
|
||||
@ -132,25 +143,21 @@ object UsersMessageToJsonConverter {
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserLoweredHand(msg: UserLoweredHand) {
|
||||
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 = 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))
|
||||
|
||||
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.RAISE_HAND, msg.recorded)
|
||||
payload.put(Constants.USER_ID, msg.userID)
|
||||
payload.put(Constants.STATUS, msg.status)
|
||||
payload.put(Constants.VALUE, msg.value.toString)
|
||||
|
||||
@ -158,196 +165,142 @@ object UsersMessageToJsonConverter {
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserSharedWebcam(msg: UserSharedWebcam) {
|
||||
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 = 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))
|
||||
|
||||
val header = Util.buildHeader(MessageNames.USER_SHARED_WEBCAM, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserUnsharedWebcam(msg: UserUnsharedWebcam) {
|
||||
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 = 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))
|
||||
val header = Util.buildHeader(MessageNames.USER_UNSHARED_WEBCAM, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleGetUsersReply(msg: GetUsersReply) {
|
||||
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.HashMap[String, Object]];
|
||||
// msg.users.foreach(uvo => {
|
||||
// users.add(buildUserHashMap(uvo))
|
||||
// })
|
||||
val users = new java.util.ArrayList[java.util.Map[String, Any]];
|
||||
msg.users.foreach(uvo => {
|
||||
users.add(userToMap(uvo))
|
||||
})
|
||||
|
||||
// payload.put(Constants.USERS, users)
|
||||
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))
|
||||
val header = Util.buildHeader(MessageNames.GET_USERS_REPLY, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserJoinedVoice(msg: UserJoinedVoice) {
|
||||
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, msg.user.toString())
|
||||
payload.put(Constants.USER, userToMap(msg.user))
|
||||
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))
|
||||
val header = Util.buildHeader(MessageNames.USER_JOINED_VOICE, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserVoiceMuted(msg: UserVoiceMuted) {
|
||||
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, msg.user.toString())
|
||||
payload.put(Constants.USER, userToMap(msg.user))
|
||||
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))
|
||||
val header = Util.buildHeader(MessageNames.USER_VOICE_MUTED, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserVoiceTalking(msg: UserVoiceTalking) {
|
||||
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, msg.user.toString())
|
||||
payload.put(Constants.USER, userToMap(msg.user))
|
||||
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))
|
||||
|
||||
val header = Util.buildHeader(MessageNames.USER_VOICE_TALKING, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleEjectVoiceUser(msg: EjectVoiceUser) {
|
||||
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 = 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))
|
||||
val header = Util.buildHeader(MessageNames.EJECT_VOICE_USER, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleUserLeftVoice(msg: UserLeftVoice) {
|
||||
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, msg.user.toString())
|
||||
payload.put(Constants.USER, userToMap(msg.user))
|
||||
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))
|
||||
val header = Util.buildHeader(MessageNames.USER_LEFT_VOICE, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleIsMeetingMutedReply(msg: IsMeetingMutedReply) {
|
||||
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 = 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))
|
||||
|
||||
val header = Util.buildHeader(MessageNames.IS_MEETING_MUTED_REPLY, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleRecordingStatusChanged(msg: RecordingStatusChanged) {
|
||||
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 = 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 header = Util.buildHeader(MessageNames.GET_RECORDING_STATUS_REPLY, msg.version, None)
|
||||
Util.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]()
|
||||
def validateAuthTokenReplyToJson(msg: ValidateAuthTokenReply):String = {
|
||||
val payload = new java.util.HashMap[String, Any]()
|
||||
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));
|
||||
val header = Util.buildHeader(MessageNames.VALIDATE_AUTH_TOKEN_REPLY, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def userJoinedToJson(msg: UserJoined):String = {
|
||||
@ -359,16 +312,6 @@ object UsersMessageToJsonConverter {
|
||||
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]()
|
||||
@ -379,32 +322,24 @@ object UsersMessageToJsonConverter {
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handlePresenterAssigned(msg: PresenterAssigned) {
|
||||
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.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))
|
||||
val header = Util.buildHeader(MessageNames.PRESENTER_ASSIGNED, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
|
||||
def handleEndAndKickAll(msg: EndAndKickAll) {
|
||||
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 = 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))
|
||||
val header = Util.buildHeader(MessageNames.END_AND_KICK_ALL, msg.version, None)
|
||||
Util.buildJson(header, payload)
|
||||
}
|
||||
}
|
@ -29,44 +29,26 @@ class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListe
|
||||
}
|
||||
|
||||
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 json = MeetingMessageToJsonConverter.meetingDestroyedToJson(msg)
|
||||
System.out.println("****\n" + json)
|
||||
//service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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)
|
||||
service.send(MessagingConstants.FROM_SYSTEM_CHANNEL, json)
|
||||
}
|
||||
|
||||
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)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
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)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, json)
|
||||
}
|
||||
|
||||
private def handleStartRecording(msg: StartRecording) {
|
||||
|
@ -94,6 +94,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<set>
|
||||
<ref bean="presentationRed5ClientSender" />
|
||||
<ref bean="presentationRedisRecorder" />
|
||||
<ref bean="presentationRedisPublisher" />
|
||||
<ref bean="usersRed5ClientSender" />
|
||||
<ref bean="usersRedisRecorder" />
|
||||
<ref bean="usersRedisPublisher" />
|
||||
@ -104,19 +105,29 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<ref bean="pollRedisPublisher"/>
|
||||
<ref bean="whiteboardRed5ClientSender"/>
|
||||
<ref bean="whiteboardRedisRecorder"/>
|
||||
<ref bean="whiteboardEventRedisPublisher"/>
|
||||
<ref bean="chatRed5ClientSender"/>
|
||||
<ref bean="chatRedisRecorder"/>
|
||||
<ref bean="chatRedisPublisher"/>
|
||||
<ref bean="fsConfService"/>
|
||||
<ref bean="whiteboardEventRedisPublisher"/>
|
||||
<ref bean="collectorGW"/>
|
||||
</set>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="presentationRed5ClientSender" class="org.bigbluebutton.core.apps.presentation.red5.PresentationClientMessageSender">
|
||||
<constructor-arg index="0" ref="connInvokerService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="presentationRedisRecorder" class="org.bigbluebutton.core.apps.presentation.redis.PresentationEventRedisRecorder">
|
||||
<constructor-arg index="0" ref="recorderApplication"/>
|
||||
</bean>
|
||||
|
||||
<bean id="presentationRedisPublisher" class="org.bigbluebutton.core.apps.presentation.redis.PresentationEventRedisPublisher">
|
||||
<constructor-arg ref="redisMessageSender" />
|
||||
</bean>
|
||||
|
||||
<bean id="usersRedisRecorder" class="org.bigbluebutton.core.apps.users.redis.UsersEventRedisRecorder">
|
||||
<constructor-arg index="0" ref="recorderApplication"/>
|
||||
</bean>
|
||||
@ -125,10 +136,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<constructor-arg index="0" ref="connInvokerService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="presentationRed5ClientSender" class="org.bigbluebutton.core.apps.presentation.red5.PresentationClientMessageSender">
|
||||
<constructor-arg index="0" ref="connInvokerService"/>
|
||||
<bean id="usersRedisPublisher" class="org.bigbluebutton.core.apps.users.redis.UsersEventRedisPublisher">
|
||||
<constructor-arg ref="redisMessageSender" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="pollRed5ClientSender" class="org.bigbluebutton.core.apps.poll.red5.PollClientMessageSender">
|
||||
<constructor-arg index="0" ref="connInvokerService"/>
|
||||
</bean>
|
||||
@ -145,6 +156,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<constructor-arg index="0" ref="recorderApplication"/>
|
||||
</bean>
|
||||
|
||||
<bean id="whiteboardEventRedisPublisher" class="org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardEventRedisPublisher">
|
||||
<constructor-arg ref="redisMessageSender"/>
|
||||
</bean>
|
||||
|
||||
<bean id="chatRed5ClientSender" class="org.bigbluebutton.core.apps.chat.red5.ChatClientMessageSender">
|
||||
<constructor-arg index="0" ref="connInvokerService"/>
|
||||
</bean>
|
||||
@ -152,15 +167,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<bean id="chatRedisRecorder" class="org.bigbluebutton.core.apps.chat.redis.ChatEventRedisRecorder">
|
||||
<constructor-arg index="0" ref="recorderApplication"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="chatRedisPublisher" class="org.bigbluebutton.core.apps.chat.redis.ChatEventRedisPublisher">
|
||||
<constructor-arg ref="redisMessageSender"/>
|
||||
</bean>
|
||||
|
||||
<bean id="meetingEventRedisPublisher" class="org.bigbluebutton.core.meeting.MeetingEventRedisPublisher">
|
||||
<constructor-arg ref="redisMessageSender" />
|
||||
</bean>
|
||||
|
||||
<bean id="usersRedisPublisher" class="org.bigbluebutton.core.apps.users.redis.UsersEventRedisPublisher">
|
||||
<constructor-arg index="0" ref="redisMessageSender"/>
|
||||
</bean>
|
||||
|
||||
<bean id="pollRedisPublisher" class="org.bigbluebutton.core.apps.poll.redis.PollEventRedisPublisher">
|
||||
<constructor-arg index="0" ref="redisMessageSender"/>
|
||||
</bean>
|
||||
@ -177,9 +192,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="bigBlueButtonInGW"> <ref bean="bbbInGW"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="whiteboardEventRedisPublisher" class="org.bigbluebutton.core.apps.whiteboard.redis.WhiteboardEventRedisPublisher">
|
||||
<constructor-arg ref="redisMessageSender"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<import resource="bbb-redis-pool.xml"/>
|
||||
<import resource="bbb-redis-recorder.xml"/>
|
||||
|
17
bigbluebutton-web/build.gradle
Executable file → Normal file
17
bigbluebutton-web/build.gradle
Executable file → Normal file
@ -41,15 +41,16 @@ dependencies {
|
||||
compile 'redis.clients:jedis:2.0.0'
|
||||
compile 'commons-pool:commons-pool:1.5.6'
|
||||
compile 'commons-lang:commons-lang:2.5'
|
||||
compile 'com.google.code.gson:gson:1.7.1'
|
||||
compile 'com.google.code.gson:gson:1.7.1'
|
||||
|
||||
// Logging
|
||||
// compile 'ch.qos.logback:logback-core:1.0.9@jar'
|
||||
// compile 'ch.qos.logback:logback-classic:1.0.9@jar'
|
||||
// compile 'org.slf4j:log4j-over-slf4j:1.7.2@jar'
|
||||
// compile 'org.slf4j:jcl-over-slf4j:1.7.2@jar'
|
||||
// compile 'org.slf4j:jul-to-slf4j:1.7.2@jar'
|
||||
// compile 'org.slf4j:slf4j-api:1.7.2@jar'
|
||||
// Logging
|
||||
// Commenting out as it results in build failure (ralam - may 11, 2014)
|
||||
//compile 'ch.qos.logback:logback-core:1.0.9@jar'
|
||||
//compile 'ch.qos.logback:logback-classic:1.0.9@jar'
|
||||
//compile 'org.slf4j:log4j-over-slf4j:1.7.2@jar'
|
||||
//compile 'org.slf4j:jcl-over-slf4j:1.7.2@jar'
|
||||
//compile 'org.slf4j:jul-to-slf4j:1.7.2@jar'
|
||||
//compile 'org.slf4j:slf4j-api:1.7.2@jar'
|
||||
|
||||
//junit
|
||||
compile 'junit:junit:4.8.2'
|
||||
|
1
bigbluebutton-web/grails-app/conf/BuildConfig.groovy
Executable file → Normal file
1
bigbluebutton-web/grails-app/conf/BuildConfig.groovy
Executable file → Normal file
@ -49,6 +49,7 @@ grails.project.dependency.resolution = {
|
||||
dependencies {
|
||||
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
|
||||
// runtime 'mysql:mysql-connector-java:5.1.24'
|
||||
|
||||
}
|
||||
|
||||
plugins {
|
||||
|
@ -109,7 +109,7 @@ disableRecordingDefault=false
|
||||
#----------------------------------------------------
|
||||
# This URL is where the BBB client is accessible. When a user sucessfully
|
||||
# enters a name and password, she is redirected here to load the client.
|
||||
bigbluebutton.web.serverURL=http://192.168.22.137
|
||||
bigbluebutton.web.serverURL=http://192.168.153.146
|
||||
|
||||
|
||||
#----------------------------------------------------
|
||||
@ -133,7 +133,7 @@ defaultConfigURL=${bigbluebutton.web.serverURL}/client/conf/config.xml
|
||||
apiVersion=0.81
|
||||
|
||||
# Salt which is used by 3rd-party apps to authenticate api calls
|
||||
securitySalt=eb0a69fe5cb03ce81f81ed64b405ec2b
|
||||
securitySalt=856a5d0d0bb3fe37b1e2e6ba3f4d8287
|
||||
|
||||
# Directory where we drop the <meeting-id-recorded>.done file
|
||||
recordStatusDir=/var/bigbluebutton/recording/status/recorded
|
||||
|
30
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
Executable file → Normal file
30
bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
Executable file → Normal file
@ -336,19 +336,19 @@ class ApiController {
|
||||
|
||||
UserSession us = new UserSession();
|
||||
us.internalUserId = internalUserID
|
||||
us.conferencename = meeting.getName()
|
||||
us.meetingID = meeting.getInternalId()
|
||||
us.conferencename = meeting.getName()
|
||||
us.meetingID = meeting.getInternalId()
|
||||
us.externMeetingID = meeting.getExternalId()
|
||||
us.externUserID = externUserID
|
||||
us.fullname = fullName
|
||||
us.role = role
|
||||
us.conference = meeting.getInternalId()
|
||||
us.room = meeting.getInternalId()
|
||||
us.voicebridge = meeting.getTelVoice()
|
||||
us.webvoiceconf = meeting.getWebVoice()
|
||||
us.mode = "LIVE"
|
||||
us.record = meeting.isRecord()
|
||||
us.welcome = meeting.getWelcomeMessage()
|
||||
us.externUserID = externUserID
|
||||
us.fullname = fullName
|
||||
us.role = role
|
||||
us.conference = meeting.getInternalId()
|
||||
us.room = meeting.getInternalId()
|
||||
us.voicebridge = meeting.getTelVoice()
|
||||
us.webvoiceconf = meeting.getWebVoice()
|
||||
us.mode = "LIVE"
|
||||
us.record = meeting.isRecord()
|
||||
us.welcome = meeting.getWelcomeMessage()
|
||||
us.logoutUrl = meeting.getLogoutUrl();
|
||||
us.configXML = configxml;
|
||||
|
||||
@ -370,6 +370,9 @@ class ApiController {
|
||||
|
||||
meetingService.addUserSession(session['user-token'], us);
|
||||
|
||||
// Register user into the meeting.
|
||||
meetingService.registerUser(us.meetingID, us.internalUserId, us.fullname, us.role, us.externUserID, us.internalUserId /* authToken for now */)
|
||||
|
||||
log.info("Session user token for " + us.fullname + " [" + session['user-token'] + "]")
|
||||
session.setMaxInactiveInterval(SESSION_TIMEOUT);
|
||||
|
||||
@ -405,6 +408,9 @@ class ApiController {
|
||||
returncode(RESP_CODE_SUCCESS)
|
||||
messageKey("successfullyJoined")
|
||||
message("You have joined successfully.")
|
||||
meeting_id(us.meetingID)
|
||||
user_id(us.internalUserId)
|
||||
auth_token(us.internalUserId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
bigbluebutton-web/src/java/org/bigbluebutton/api/MeetingService.java
Executable file → Normal file
12
bigbluebutton-web/src/java/org/bigbluebutton/api/MeetingService.java
Executable file → Normal file
@ -80,6 +80,10 @@ public class MeetingService implements MessageListener {
|
||||
sessions.put(token, user);
|
||||
}
|
||||
|
||||
public void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) {
|
||||
messagingService.registerUser(meetingID, internalUserId, fullname, role, externUserID, authToken);
|
||||
}
|
||||
|
||||
public UserSession getUserSession(String token) {
|
||||
return sessions.get(token);
|
||||
}
|
||||
@ -318,6 +322,7 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
|
||||
private void meetingStarted(MeetingStarted message) {
|
||||
log.debug("Meeting [{}] has started.", message.meetingId);
|
||||
Meeting m = getMeeting(message.meetingId);
|
||||
if (m != null) {
|
||||
if (m.getStartTime() == 0) {
|
||||
@ -334,6 +339,7 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
|
||||
private void meetingEnded(MeetingEnded message) {
|
||||
log.debug("Meeting [{}] has ended.", message.meetingId);
|
||||
Meeting m = getMeeting(message.meetingId);
|
||||
if (m != null) {
|
||||
long now = System.currentTimeMillis();
|
||||
@ -345,22 +351,24 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
|
||||
private void userJoined(UserJoined message) {
|
||||
log.debug("User joined in meeting[{}]", message.meetingId);
|
||||
Meeting m = getMeeting(message.meetingId);
|
||||
if (m != null) {
|
||||
User user = new User(message.userId, message.externalUserId, message.name, message.role);
|
||||
m.userJoined(user);
|
||||
log.debug("New user in meeting " + message.meetingId + ":" + user.getFullname());
|
||||
log.debug("New user in meeting [" + message.meetingId + "] user [" + user.getFullname() + "]");
|
||||
return;
|
||||
}
|
||||
log.warn("The meeting " + message.meetingId + " doesn't exist");
|
||||
}
|
||||
|
||||
private void userLeft(UserLeft message) {
|
||||
log.debug("User left from meeting[{}]", message.meetingId);
|
||||
Meeting m = getMeeting(message.meetingId);
|
||||
if (m != null) {
|
||||
User user = m.userLeft(message.userId);
|
||||
if(user != null){
|
||||
log.debug("User removed from meeting " + message.meetingId + ":" + user.getFullname());
|
||||
log.debug("User removed from meeting [" + message.meetingId + "] user [" + user.getFullname() + "]");
|
||||
return;
|
||||
}
|
||||
log.warn("The participant " + message.userId + " doesn't exist in the meeting " + message.meetingId);
|
||||
|
@ -567,7 +567,7 @@ public class ParamsProcessorUtil {
|
||||
|
||||
String baseString = csbuf.toString();
|
||||
|
||||
// System.out.println( "POST basestring = [" + baseString + "]");
|
||||
System.out.println( "POST basestring = [" + baseString + "]");
|
||||
|
||||
log.debug("POST basestring = [" + baseString + "]");
|
||||
|
||||
|
88
bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/Constants.java
Executable file
88
bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/Constants.java
Executable file
@ -0,0 +1,88 @@
|
||||
package org.bigbluebutton.api.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 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 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";
|
||||
}
|
@ -32,59 +32,98 @@ 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
|
||||
|
||||
if (channel.equalsIgnoreCase(MessagingConstants.FROM_MEETING_CHANNEL)) {
|
||||
if (obj.has("header") && obj.has("payload")) {
|
||||
JsonObject header = (JsonObject) obj.get("header");
|
||||
JsonObject payload = (JsonObject) obj.get("payload");
|
||||
|
||||
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");
|
||||
|
||||
for (MessageListener listener : listeners) {
|
||||
if(MessagingConstants.MEETING_STARTED_EVENT.equalsIgnoreCase(messageId)) {
|
||||
String meetingId = map.get("meetingID");
|
||||
listener.handle(new MeetingStarted(meetingId));
|
||||
} else if(MessagingConstants.MEETING_ENDED_EVENT.equalsIgnoreCase(messageId)) {
|
||||
String meetingId = map.get("meetingID");
|
||||
listener.handle(new MeetingEnded(meetingId));
|
||||
} else if (MessagingConstants.MEETING_DESTROYED_EVENT.equalsIgnoreCase(messageId)) {
|
||||
String meetingId = map.get("meetingID");
|
||||
log.info("Received a meeting destroyed message for meeting id=[{}]", meetingId);
|
||||
listener.handle(new MeetingDestroyed(meetingId));
|
||||
}
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_SYSTEM_CHANNEL)) {
|
||||
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
|
||||
String messageId = map.get("messageID");
|
||||
|
||||
for (MessageListener listener : listeners) {
|
||||
if (MessagingConstants.KEEP_ALIVE_REPLY_EVENT.equalsIgnoreCase(messageId)){
|
||||
String pongId = map.get("aliveID");
|
||||
listener.handle(new KeepAliveReply(pongId));
|
||||
}
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_USERS_CHANNEL)) {
|
||||
HashMap<String,String> map = gson.fromJson(message, new TypeToken<Map<String, String>>() {}.getType());
|
||||
String messageId = map.get("messageID");
|
||||
|
||||
for (MessageListener listener : listeners) {
|
||||
if (MessagingConstants.USER_JOINED_EVENT.equalsIgnoreCase(messageId)){
|
||||
String meetingId = map.get("meetingID");
|
||||
String userId = map.get("internalUserID");
|
||||
String externalUserId = map.get("externalUserID");
|
||||
String name = map.get("fullname");
|
||||
String role = map.get("role");
|
||||
listener.handle(new UserJoined(meetingId, userId, externalUserId, name, role));
|
||||
} else if(MessagingConstants.USER_STATUS_CHANGE_EVENT.equalsIgnoreCase(messageId)){
|
||||
String userId = map.get("internalUserID");
|
||||
String status = map.get("status");
|
||||
String value = map.get("value");
|
||||
String meetingId = map.get("meetingID");
|
||||
listener.handle(new UserStatusChanged(meetingId, userId, status, value));
|
||||
} else if(MessagingConstants.USER_LEFT_EVENT.equalsIgnoreCase(messageId)){
|
||||
String userId = map.get("internalUserID");
|
||||
String meetingId = map.get("meetingID");
|
||||
listener.handle(new UserLeft(meetingId, userId));
|
||||
}
|
||||
}
|
||||
if (header.has("name")) {
|
||||
String messageName = header.get("name").getAsString();
|
||||
System.out.println("Received [" + messageName + "] message on channel [" + channel + "].");
|
||||
|
||||
if(MessagingConstants.MEETING_STARTED_EVENT.equalsIgnoreCase(messageName)) {
|
||||
System.out.println("Handling [" + messageName + "] message.");
|
||||
String meetingId = payload.get("meeting_id").getAsString();
|
||||
for (MessageListener listener : listeners) {
|
||||
listener.handle(new MeetingStarted(meetingId));
|
||||
}
|
||||
} else if(MessagingConstants.MEETING_ENDED_EVENT.equalsIgnoreCase(messageName)) {
|
||||
System.out.println("Handling [" + messageName + "] message.");
|
||||
String meetingId = payload.get("meeting_id").getAsString();
|
||||
for (MessageListener listener : listeners) {
|
||||
listener.handle(new MeetingEnded(meetingId));
|
||||
}
|
||||
} else if (MessagingConstants.MEETING_DESTROYED_EVENT.equalsIgnoreCase(messageName)) {
|
||||
System.out.println("Handling [" + messageName + "] message.");
|
||||
String meetingId = payload.get("meeting_id").getAsString();
|
||||
log.info("Received a meeting destroyed message for meeting id=[{}]", meetingId);
|
||||
for (MessageListener listener : listeners) {
|
||||
listener.handle(new MeetingDestroyed(meetingId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_SYSTEM_CHANNEL)) {
|
||||
|
||||
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();
|
||||
System.out.println("Received [" + messageName + "] message on channel [" + channel + "].");
|
||||
for (MessageListener listener : listeners) {
|
||||
if (MessagingConstants.KEEP_ALIVE_REPLY.equalsIgnoreCase(messageName)){
|
||||
String pongId = payload.get("keep_alive_id").getAsString();
|
||||
listener.handle(new KeepAliveReply(pongId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_USERS_CHANNEL)) {
|
||||
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();
|
||||
System.out.println("Received [" + messageName + "] message on channel [" + channel + "].");
|
||||
|
||||
if (MessagingConstants.USER_JOINED_EVENT.equalsIgnoreCase(messageName)) {
|
||||
System.out.println("Handling [" + messageName + "] message.");
|
||||
String meetingId = payload.get("meeting_id").getAsString();
|
||||
JsonObject user = (JsonObject) payload.get("user");
|
||||
|
||||
String userid = user.get("userid").getAsString();
|
||||
String externuserid = user.get("extern_userid").getAsString();
|
||||
String username = user.get("name").getAsString();
|
||||
String role = user.get("role").getAsString();
|
||||
|
||||
for (MessageListener listener : listeners) {
|
||||
listener.handle(new UserJoined(meetingId, userid, externuserid, username, role));
|
||||
}
|
||||
} else if(MessagingConstants.USER_STATUS_CHANGE_EVENT.equalsIgnoreCase(messageName)) {
|
||||
System.out.println("Handling [" + messageName + "] message.");
|
||||
String meetingId = payload.get("meeting_id").getAsString();
|
||||
String userid = payload.get("userid").getAsString();
|
||||
String status = payload.get("status").getAsString();
|
||||
String value = payload.get("value").getAsString();
|
||||
for (MessageListener listener : listeners) {
|
||||
listener.handle(new UserStatusChanged(meetingId, userid, status, value));
|
||||
}
|
||||
} else if (MessagingConstants.USER_LEFT_EVENT.equalsIgnoreCase(messageName)) {
|
||||
System.out.println("Handling [" + messageName + "] message.");
|
||||
String meetingId = payload.get("meeting_id").getAsString();
|
||||
JsonObject user = (JsonObject) payload.get("user");
|
||||
|
||||
String userid = user.get("userid").getAsString();
|
||||
for (MessageListener listener : listeners) {
|
||||
listener.handle(new UserLeft(meetingId, userid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package org.bigbluebutton.api.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<String, Object> buildHeader(String name, String version, String replyTo) {
|
||||
java.util.HashMap<String, Object> header = new java.util.HashMap<String, Object>();
|
||||
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<String, Object> header,
|
||||
java.util.HashMap<String, Object> payload) {
|
||||
|
||||
java.util.HashMap<String, java.util.HashMap<String, Object>> message = new java.util.HashMap<String, java.util.HashMap<String, Object>>();
|
||||
message.put(Constants.HEADER, header);
|
||||
message.put(Constants.PAYLOAD, payload);
|
||||
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package org.bigbluebutton.api.messaging;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bigbluebutton.api.messaging.converters.messages.CreateMeetingMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.KeepAliveMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.RegisterUserMessage;
|
||||
|
||||
public class MessageToJson {
|
||||
|
||||
public static String registerUserToJson(RegisterUserMessage message) {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put(Constants.MEETING_ID, message.meetingID);
|
||||
payload.put(Constants.NAME, message.fullname);
|
||||
payload.put(Constants.USER_ID, message.internalUserId);
|
||||
payload.put(Constants.ROLE, message.role);
|
||||
payload.put(Constants.EXT_USER_ID, message.externUserID);
|
||||
payload.put(Constants.AUTH_TOKEN, message.authToken);
|
||||
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(RegisterUserMessage.REGISTER_USER, message.VERSION, null);
|
||||
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
|
||||
public static String createMeetingMessageToJson(CreateMeetingMessage msg) {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put(Constants.MEETING_ID, msg.id);
|
||||
payload.put(Constants.NAME, msg.name);
|
||||
payload.put(Constants.RECORDED, msg.record);
|
||||
payload.put(Constants.VOICE_CONF, msg.voiceBridge);
|
||||
payload.put(Constants.DURATION, msg.duration);
|
||||
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(CreateMeetingMessage.CREATE_MEETING_REQUEST_EVENT, CreateMeetingMessage.VERSION, null);
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
|
||||
public static String destroyMeetingMessageToJson(DestroyMeetingMessage msg) {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put(Constants.MEETING_ID, msg.meetingId);
|
||||
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(DestroyMeetingMessage.DESTROY_MEETING_REQUEST_EVENT, DestroyMeetingMessage.VERSION, null);
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
|
||||
public static String endMeetingMessageToJson(EndMeetingMessage msg) {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put(Constants.MEETING_ID, msg.meetingId);
|
||||
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(EndMeetingMessage.END_MEETING_REQUEST_EVENT, EndMeetingMessage.VERSION, null);
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
|
||||
public static String keepAliveMessageToJson(KeepAliveMessage msg) {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put(Constants.KEEP_ALIVE_ID, msg.keepAliveId);
|
||||
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(KeepAliveMessage.KEEP_ALIVE_REQUEST, KeepAliveMessage.VERSION, null);
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -21,36 +21,34 @@ package org.bigbluebutton.api.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_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 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_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 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 = "MeetingStartedEvent";
|
||||
public static final String MEETING_ENDED_EVENT = "MeetingEndedEvent";
|
||||
public static final String MEETING_DESTROYED_EVENT = "MeetingDestroyedEvent";
|
||||
public static final String USER_JOINED_EVENT = "UserJoinedEvent";
|
||||
public static final String USER_LEFT_EVENT = "UserLeftEvent";
|
||||
public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent";
|
||||
|
||||
public static final String MEETING_STARTED_EVENT = "meeting_created_message";
|
||||
public static final String MEETING_ENDED_EVENT = "meeting_ended_message";
|
||||
public static final String MEETING_DESTROYED_EVENT = "meeting_destroyed_event";
|
||||
public static final String USER_JOINED_EVENT = "user_joined_message";
|
||||
public static final String USER_LEFT_EVENT = "user_left_message";
|
||||
public static final String USER_STATUS_CHANGE_EVENT = "user_status_changed_message";
|
||||
|
||||
|
||||
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
|
||||
public static final String KEEP_ALIVE_REPLY_EVENT = "KEEP_ALIVE_REPLY";
|
||||
public static final String KEEP_ALIVE_REPLY = "keep_alive_reply";
|
||||
}
|
||||
|
2
bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessagingService.java
Executable file → Normal file
2
bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessagingService.java
Executable file → Normal file
@ -32,4 +32,6 @@ public interface MessagingService {
|
||||
String storeSubscription(String meetingId, String externalMeetingID, String callbackURL);
|
||||
boolean removeSubscription(String meetingId, String subscriptionId);
|
||||
List<Map<String,String>> listSubscriptions(String meetingId);
|
||||
void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken);
|
||||
void sendKeepAlive(String keepAliveId);
|
||||
}
|
||||
|
53
bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/RedisMessagingService.java
Executable file → Normal file
53
bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/RedisMessagingService.java
Executable file → Normal file
@ -27,11 +27,20 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.bigbluebutton.api.messaging.converters.messages.CreateMeetingMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.KeepAliveMessage;
|
||||
import org.bigbluebutton.api.messaging.converters.messages.RegisterUserMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.JedisPubSub;
|
||||
@ -47,37 +56,35 @@ public class RedisMessagingService implements MessagingService {
|
||||
}
|
||||
|
||||
public void destroyMeeting(String meetingID) {
|
||||
HashMap<String,String> map = new HashMap<String, String>();
|
||||
map.put("messageId", MessagingConstants.DESTROY_MEETING_REQUEST_EVENT);
|
||||
map.put("meetingID", meetingID);
|
||||
Gson gson = new Gson();
|
||||
log.info("Sending destroy meeting [{}]", meetingID);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, gson.toJson(map));
|
||||
DestroyMeetingMessage msg = new DestroyMeetingMessage(meetingID);
|
||||
String json = MessageToJson.destroyMeetingMessageToJson(msg);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
|
||||
}
|
||||
|
||||
public void registerUser(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) {
|
||||
RegisterUserMessage msg = new RegisterUserMessage(meetingID, internalUserId, fullname, role, externUserID, authToken);
|
||||
String json = MessageToJson.registerUserToJson(msg);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
|
||||
}
|
||||
|
||||
public void createMeeting(String meetingID, String meetingName, Boolean recorded, String voiceBridge, Long duration) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("messageId", MessagingConstants.CREATE_MEETING_REQUEST_EVENT);
|
||||
map.put("meetingID", meetingID);
|
||||
map.put("meetingName", meetingName);
|
||||
map.put("record", recorded);
|
||||
map.put("voiceBridge", voiceBridge);
|
||||
map.put("duration", duration);
|
||||
|
||||
Gson gson = new Gson();
|
||||
log.info("Sending create meeting [{}] - [{}]", meetingID, voiceBridge);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, gson.toJson(map));
|
||||
CreateMeetingMessage msg = new CreateMeetingMessage(meetingID, meetingName, recorded, voiceBridge, duration);
|
||||
String json = MessageToJson.createMeetingMessageToJson(msg);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
|
||||
}
|
||||
|
||||
public void endMeeting(String meetingId) {
|
||||
HashMap<String,String> map = new HashMap<String, String>();
|
||||
map.put("messageId", MessagingConstants.END_MEETING_REQUEST_EVENT);
|
||||
map.put("meetingId", meetingId);
|
||||
Gson gson = new Gson();
|
||||
log.info("Sending end meeting [{}]", meetingId);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, gson.toJson(map));
|
||||
EndMeetingMessage msg = new EndMeetingMessage(meetingId);
|
||||
String json = MessageToJson.endMeetingMessageToJson(msg);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, json);
|
||||
}
|
||||
|
||||
public void sendKeepAlive(String keepAliveId) {
|
||||
KeepAliveMessage msg = new KeepAliveMessage(keepAliveId);
|
||||
String json = MessageToJson.keepAliveMessageToJson(msg);
|
||||
sender.send(MessagingConstants.TO_SYSTEM_CHANNEL, json);
|
||||
}
|
||||
|
||||
public void send(String channel, String message) {
|
||||
sender.send(channel, message);
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.bigbluebutton.api.messaging.converters.messages;
|
||||
|
||||
|
||||
public class CreateMeetingMessage {
|
||||
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 name;
|
||||
public final Boolean record;
|
||||
public final String voiceBridge;
|
||||
public final Long duration;
|
||||
|
||||
public CreateMeetingMessage(String id, String name, Boolean record, String voiceBridge, Long duration) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.record = record;
|
||||
this.voiceBridge = voiceBridge;
|
||||
this.duration = duration;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.bigbluebutton.api.messaging.converters.messages;
|
||||
|
||||
public class DestroyMeetingMessage {
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.bigbluebutton.api.messaging.converters.messages;
|
||||
|
||||
public class EndMeetingMessage {
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.bigbluebutton.api.messaging.converters.messages;
|
||||
|
||||
public class KeepAliveMessage {
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.bigbluebutton.api.messaging.converters.messages;
|
||||
|
||||
public class RegisterUserMessage {
|
||||
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;
|
||||
}
|
||||
}
|
7
bigbluebutton-web/src/java/org/bigbluebutton/web/services/KeepAliveService.java
Executable file → Normal file
7
bigbluebutton-web/src/java/org/bigbluebutton/web/services/KeepAliveService.java
Executable file → Normal file
@ -127,14 +127,9 @@ public class KeepAliveService implements MessageListener {
|
||||
|
||||
private void processPing(KeepAlivePing msg) {
|
||||
if (pingMessages.size() < maxLives) {
|
||||
HashMap<String,String> map = new HashMap<String,String>();
|
||||
map.put("messageId", KEEP_ALIVE_REQUEST);
|
||||
map.put("aliveId", msg.getId());
|
||||
Gson gson = new Gson();
|
||||
|
||||
pingMessages.add(msg.getId());
|
||||
log.debug("Sending keep alive message to bbb-apps. keep-alive id [{}]", msg.getId());
|
||||
service.send(MessagingConstants.TO_SYSTEM_CHANNEL, gson.toJson(map));
|
||||
service.sendKeepAlive(msg.getId());
|
||||
} else {
|
||||
// BBB-Apps has gone down. Mark it as unavailable and clear
|
||||
// pending ping messages. This allows us to continue to send ping messages
|
||||
|
@ -1,16 +1,15 @@
|
||||
package org.bigbluebutton.api.messaging;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NullMessagingService implements MessagingService {
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@ -41,16 +40,47 @@ public class NullMessagingService implements MessagingService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(MessageListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(MessageListener listener) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void destroyMeeting(String meetingID) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void createMeeting(String meetingID, String meetingName,
|
||||
Boolean recorded, String voiceBridge, Long duration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void sendPolls(String meetingId, String title, String question,
|
||||
String questionType, List<String> answers) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public String storeSubscription(String meetingId, String externalMeetingID,
|
||||
String callbackURL) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean removeSubscription(String meetingId, String subscriptionId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> listSubscriptions(String meetingId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
4
client/bbb-html5-client/config.coffee
Normal file → Executable file
4
client/bbb-html5-client/config.coffee
Normal file → Executable file
@ -27,8 +27,8 @@ config.redis.host = "127.0.0.1"
|
||||
config.redis.post = "6379"
|
||||
config.redis.timeout = 5000
|
||||
config.redis.channels = {}
|
||||
config.redis.channels.fromBBBApps = "from-bbb-apps"
|
||||
config.redis.channels.toBBBApps = "to-bbb-apps"
|
||||
config.redis.channels.fromBBBApps = "bigbluebutton:from-bbb-apps:*"
|
||||
config.redis.channels.toBBBApps = "bigbluebutton:to-bbb-apps:*"
|
||||
config.redis.internalChannels = {}
|
||||
config.redis.internalChannels.receive = "html5-receive"
|
||||
config.redis.internalChannels.reply = "html5-reply"
|
||||
|
@ -27,6 +27,8 @@ module.exports = class ClientProxy
|
||||
|
||||
# Sends a message in `data` to all the clients that should receive it.
|
||||
sendToClients: (data, callback) ->
|
||||
log.debug({ data: data }, "Sending to client")
|
||||
|
||||
# the channel can be the user_id (send to one user only) or the meeting_id
|
||||
# (send to everyone in the meeting)
|
||||
channel = data?.payload?.user_id or data?.payload?.meeting_id
|
||||
|
14
client/bbb-html5-client/lib/redispubsub.coffee
Executable file → Normal file
14
client/bbb-html5-client/lib/redispubsub.coffee
Executable file → Normal file
@ -23,11 +23,11 @@ module.exports = class RedisPubSub
|
||||
else
|
||||
@send(msg, envelope)
|
||||
|
||||
@subClient.on "subscribe", @_onSubscribe
|
||||
@subClient.on "message", @_onMessage
|
||||
@subClient.on "psubscribe", @_onSubscribe
|
||||
@subClient.on "pmessage", @_onMessage
|
||||
|
||||
log.info("RPC: Subscribing message on channel: #{config.redis.channels.fromBBBApps}")
|
||||
@subClient.subscribe(config.redis.channels.fromBBBApps)
|
||||
@subClient.psubscribe(config.redis.channels.fromBBBApps)
|
||||
|
||||
# Sends a message and waits for a reply
|
||||
sendAndWaitForReply: (message, envelope) ->
|
||||
@ -57,7 +57,7 @@ module.exports = class RedisPubSub
|
||||
|
||||
# put the entry in the hash so we can match the response later
|
||||
@pendingRequests[correlationId] = entry
|
||||
message.header.correlation_id = correlationId
|
||||
message.header.replyTo = correlationId
|
||||
|
||||
log.info({ message: message }, "Publishing a message")
|
||||
@pubClient.publish(config.redis.channels.toBBBApps, JSON.stringify(message))
|
||||
@ -69,14 +69,14 @@ module.exports = class RedisPubSub
|
||||
_onSubscribe: (channel, count) =>
|
||||
log.info("Subscribed to #{channel}")
|
||||
|
||||
_onMessage: (channel, jsonMsg) =>
|
||||
log.debug({ channel: channel, message: jsonMsg}, "Received a message from redis")
|
||||
_onMessage: (pattern, channel, jsonMsg) =>
|
||||
log.debug({ pattern: pattern, channel: channel, message: jsonMsg}, "Received a message from redis")
|
||||
# TODO: this has to be in a try/catch block, otherwise the server will
|
||||
# crash if the message has a bad format
|
||||
message = JSON.parse(jsonMsg)
|
||||
|
||||
# retrieve the request entry
|
||||
correlationId = message.header?.correlation_id
|
||||
correlationId = message.header?.replyTo
|
||||
if correlationId? and @pendingRequests?[correlationId]?
|
||||
entry = @pendingRequests[correlationId]
|
||||
# make sure the message in the timeout isn't triggered by clearing it
|
||||
|
36
labs/api/recordings/lib/util.coffee
Executable file → Normal file
36
labs/api/recordings/lib/util.coffee
Executable file → Normal file
@ -1,30 +1,12 @@
|
||||
sha1 = require 'js-sha1'
|
||||
parser1 = require 'xml2json'
|
||||
parser2 = require 'json2xml'
|
||||
|
||||
removeChecksumFromQuery = (query) ->
|
||||
for own propName of query
|
||||
console.log(propName + "=" + query[propName])
|
||||
delete query['checksum']
|
||||
query
|
||||
xml2json = (xmlStr) ->
|
||||
parser1.toJson(xmlStr)
|
||||
|
||||
buildCreateBaseString = (query) ->
|
||||
baseString = ""
|
||||
for own propName of query
|
||||
propVal = query[propName]
|
||||
if (propName == "welcome")
|
||||
propVal = encodeURIComponent(query.welcome).replace(/%20/g, '+').replace(/[!'()]/g, escape).replace(/\*/g, "%2A")
|
||||
baseString += propName + "=" + propVal + "&"
|
||||
console.log(propName + "=" + query[propName])
|
||||
|
||||
console.log("baseString=[" + baseString.slice(0, -1) + "]")
|
||||
|
||||
baseString.slice(0, -1)
|
||||
json2xml = (jsonObj) ->
|
||||
#parser2(jsonObj)
|
||||
parser1.toXml(jsonObj)
|
||||
|
||||
calculateChecksum = (method, baseString, sharedSecret) ->
|
||||
qStr = method + baseString + sharedSecret
|
||||
console.log("[" + qStr + "]")
|
||||
sha1(qStr)
|
||||
|
||||
|
||||
exports.removeChecksumFromQuery = removeChecksumFromQuery
|
||||
exports.buildCreateBaseString = buildCreateBaseString
|
||||
exports.calculateChecksum = calculateChecksum
|
||||
exports.xml2json = xml2json
|
||||
exports.json2xml = json2xml
|
||||
|
3
labs/api/recordings/package.json
Executable file → Normal file
3
labs/api/recordings/package.json
Executable file → Normal file
@ -14,6 +14,9 @@
|
||||
"coffee-script": "1.7.1",
|
||||
"js-sha1": "0.1.1",
|
||||
"bunyan": "0.22.2",
|
||||
"json2xml": "0.1.1",
|
||||
"xml2json": "0.4.0",
|
||||
"easyxml": "0.0.5",
|
||||
"glob": "3.2.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
58
labs/api/recordings/test/utiltests.coffee
Normal file
58
labs/api/recordings/test/utiltests.coffee
Normal file
@ -0,0 +1,58 @@
|
||||
assert = require("assert")
|
||||
|
||||
util = require '../lib/util'
|
||||
|
||||
sampleXml = """
|
||||
<recording>
|
||||
<id>6e35e3b2778883f5db637d7a5dba0a427f692e91-1398363221956</id>
|
||||
<state>available</state>
|
||||
<published>true</published>
|
||||
<start_time>1398363223514</start_time>
|
||||
<end_time>1398363348994</end_time>
|
||||
<playback>
|
||||
<format>presentation</format>
|
||||
<link>http://example.com/playback/presentation/playback.html?meetingID=6e35e3b2778883f5db637d7a5dba0a427f692e91-1398363221956</link>
|
||||
<processing_time>5429</processing_time>
|
||||
<duration>101014</duration>
|
||||
<extension>
|
||||
<custom>... Any XML element, to be passed through into playback format element.</custom>
|
||||
</extension>
|
||||
</playback>
|
||||
<meta>
|
||||
<meetingId>English 101</meetingId>
|
||||
<meetingName>English 101</meetingName>
|
||||
<description>Test recording</description>
|
||||
<title>English 101</title>
|
||||
</meta>
|
||||
</recording>
|
||||
"""
|
||||
|
||||
jsonResult = {
|
||||
"recording": {
|
||||
"id": "6e35e3b2778883f5db637d7a5dba0a427f692e91-1398363221956",
|
||||
"state": "available",
|
||||
"published": true,
|
||||
"start_time": 1398363223514,
|
||||
"end_time": 1398363348994,
|
||||
"playback": {
|
||||
"format": "presentation",
|
||||
"link": "http://example.com/playback/presentation/playback.html?meetingID=6e35e3b2778883f5db637d7a5dba0a427f692e91-1398363221956",
|
||||
"processing_time": 5429,
|
||||
"duration": 101014,
|
||||
"extension": {
|
||||
"custom": "... Any XML element, to be passed through into playback format element."
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"meetingId": "English 101",
|
||||
"meetingName": "English 101",
|
||||
"description": "Test recording",
|
||||
"title": "English 101"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe "util", ->
|
||||
describe 'xml2json()', ->
|
||||
it 'should return a json string', ->
|
||||
assert.deepEqual(jsonResult, JSON.parse(util.xml2json(sampleXml)))
|
34
labs/api/recordings/testjson2xml.coffee
Normal file
34
labs/api/recordings/testjson2xml.coffee
Normal file
@ -0,0 +1,34 @@
|
||||
util = require './lib/util'
|
||||
|
||||
sampleXml = """
|
||||
<recording>
|
||||
<id>6e35e3b2778883f5db637d7a5dba0a427f692e91-1398363221956</id>
|
||||
<state>available</state>
|
||||
<published>true</published>
|
||||
<start_time>1398363223514</start_time>
|
||||
<end_time>1398363348994</end_time>
|
||||
<playback>
|
||||
<format>presentation</format>
|
||||
<link>http://example.com/playback/presentation/playback.html?meetingID=6e35e3b2778883f5db637d7a5dba0a427f692e91-1398363221956</link>
|
||||
<processing_time>5429</processing_time>
|
||||
<duration>101014</duration>
|
||||
<extension>
|
||||
<custom>... Any XML element, to be passed through into playback format element.</custom>
|
||||
</extension>
|
||||
</playback>
|
||||
<meta>
|
||||
<meetingId>English 101</meetingId>
|
||||
<meetingName>English 101</meetingName>
|
||||
<description>Test recording</description>
|
||||
<title>English 101</title>
|
||||
</meta>
|
||||
</recording>
|
||||
"""
|
||||
|
||||
jsonObj = util.xml2json( sampleXml )
|
||||
|
||||
console.log(jsonObj)
|
||||
|
||||
jstr = util.json2xml(JSON.parse(jsonObj))
|
||||
|
||||
console.log(jstr)
|
@ -23,6 +23,7 @@
|
||||
require 'rubygems'
|
||||
require 'redis'
|
||||
require 'builder'
|
||||
require 'yaml'
|
||||
|
||||
module BigBlueButton
|
||||
# Class to wrap Redis so we can mock
|
||||
@ -90,9 +91,10 @@ module BigBlueButton
|
||||
result = xml.instruct! :xml, :version => "1.0", :encoding=>"UTF-8"
|
||||
|
||||
meeting_metadata = @redis.metadata_for(meeting_id)
|
||||
version = YAML::load(File.open('../../core/scripts/bigbluebutton.yml'))["bbb_version"]
|
||||
|
||||
if (meeting_metadata != nil)
|
||||
xml.recording(:meeting_id => meeting_id) {
|
||||
xml.recording(:meeting_id => meeting_id, :bbb_version => version) {
|
||||
xml.metadata(meeting_metadata)
|
||||
msgs = @redis.events_for(meeting_id)
|
||||
msgs.each do |msg|
|
||||
|
@ -443,5 +443,13 @@ module BigBlueButton
|
||||
end
|
||||
matched_rec_events
|
||||
end
|
||||
|
||||
# Version of the bbb server where it was recorded
|
||||
def self.bbb_version(events_xml)
|
||||
events = Nokogiri::XML(File.open(events_xml))
|
||||
recording = events.at_xpath('/recording')
|
||||
recording['bbb_version']
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
bbb_version: '0.90'
|
||||
raw_audio_src: /var/freeswitch/meetings
|
||||
raw_video_src: /usr/share/red5/webapps/video/streams
|
||||
raw_deskshare_src: /var/bigbluebutton/deskshare
|
||||
|
@ -534,9 +534,10 @@ def processSlideEvents
|
||||
slide_start = ( translateTimestamp(slide_timestamp) / 1000 ).round(1)
|
||||
orig_slide_start = ( slide_timestamp.to_f / 1000 ).round(1)
|
||||
slide_number = node.xpath(".//slide")[0].text()
|
||||
slide_number = slide_number.to_i < 0 ? "0" : slide_number
|
||||
slide_src = "presentation/#{$presentation_name}/slide-#{slide_number.to_i + 1}.png"
|
||||
txt_file_path = "presentation/#{$presentation_name}/textfiles/slide-#{slide_number.to_i + 1}.txt"
|
||||
slide_number = slide_number.to_i < 0 ? "0" : slide_number
|
||||
index_add = $version.nil? ? 1 : 0
|
||||
slide_src = "presentation/#{$presentation_name}/slide-#{slide_number.to_i + index_add}.png"
|
||||
txt_file_path = "presentation/#{$presentation_name}/textfiles/slide-#{slide_number.to_i + index_add}.txt"
|
||||
slide_text = File.exist?("#{$process_dir}/#{txt_file_path}") ? txt_file_path : nil
|
||||
image_url = "#{$process_dir}/#{slide_src}"
|
||||
|
||||
@ -888,7 +889,8 @@ if ($playback == "presentation")
|
||||
BigBlueButton::Events.get_start_and_stop_rec_events("#{$process_dir}/events.xml"))
|
||||
|
||||
recording_time = computeRecordingLength()
|
||||
|
||||
|
||||
$version = BigBlueButton::Events.bbb_version("#{$process_dir}/events.xml")
|
||||
BigBlueButton.logger.info("Creating metadata.xml")
|
||||
# Create metadata.xml
|
||||
b = Builder::XmlMarkup.new(:indent => 2)
|
||||
|
Loading…
Reference in New Issue
Block a user