- start/stop recording voice conf

This commit is contained in:
Richard Alam 2015-06-04 15:53:18 +00:00
parent 153ced0567
commit a67b887a79
9 changed files with 35 additions and 76 deletions

View File

@ -6,7 +6,7 @@ import com.google.gson.JsonParser;
public class StartRecordingVoiceConfRequestMessage { public class StartRecordingVoiceConfRequestMessage {
public static final String START_RECORD_VOICE_CONF_REQUEST = "start_recording__voice_conf_request_message"; public static final String START_RECORD_VOICE_CONF_REQUEST = "start_recording_voice_conf_request_message";
public static final String VERSION = "0.0.1"; public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id"; public static final String MEETING_ID = "meeting_id";

View File

@ -29,7 +29,7 @@ public class MeetingMessageReceiver implements MessageHandler {
public void handleMessage(String pattern, String channel, String message) { public void handleMessage(String pattern, String channel, String message) {
// System.out.println("Checking message: " + pattern + " " + channel + " " + message); // System.out.println("Checking message: " + pattern + " " + channel + " " + message);
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) {
System.out.println("Meeting message: " + channel + " " + message); // System.out.println("Meeting message: " + channel + " " + message);
IPublishedMessage msg = MessageFromJsonConverter.convert(message); IPublishedMessage msg = MessageFromJsonConverter.convert(message);
if (msg != null) { if (msg != null) {

View File

@ -91,67 +91,47 @@ public class PresentationMessageListener implements MessageHandler {
String messageName = header.get("name").getAsString(); String messageName = header.get("name").getAsString();
if (SendConversionUpdateMessage.SEND_CONVERSION_UPDATE.equals(messageName)) { if (SendConversionUpdateMessage.SEND_CONVERSION_UPDATE.equals(messageName)) {
SendConversionUpdateMessage msg = SendConversionUpdateMessage.fromJson(message); SendConversionUpdateMessage msg = SendConversionUpdateMessage.fromJson(message);
System.out.println("in messageHandler - sendConversionCompleted");
// sendConversionUpdate(msg.messageKey, msg.meetingId, msg.code, // sendConversionUpdate(msg.messageKey, msg.meetingId, msg.code,
// msg.presId, msg.presName); // msg.presId, msg.presName);
bbbInGW.sendConversionUpdate(msg.messageKey, msg.meetingId, bbbInGW.sendConversionUpdate(msg.messageKey, msg.meetingId,
msg.code, msg.presId, msg.presName); msg.code, msg.presId, msg.presName);
} else if (ResizeAndMoveSlideMessage.RESIZE_AND_MOVE_SLIDE.equals(messageName)) { } else if (ResizeAndMoveSlideMessage.RESIZE_AND_MOVE_SLIDE.equals(messageName)) {
System.out.println("in messageHandler - resizeAndMoveSlide");
ResizeAndMoveSlideMessage msg = ResizeAndMoveSlideMessage.fromJson(message); ResizeAndMoveSlideMessage msg = ResizeAndMoveSlideMessage.fromJson(message);
bbbInGW.resizeAndMoveSlide(msg.meetingId, msg.xOffset, msg.yOffset, bbbInGW.resizeAndMoveSlide(msg.meetingId, msg.xOffset, msg.yOffset,
msg.widthRatio, msg.heightRatio); msg.widthRatio, msg.heightRatio);
} else if (GetPresentationInfoMessage.GET_PRESENTATION_INFO.equals(messageName)) { } else if (GetPresentationInfoMessage.GET_PRESENTATION_INFO.equals(messageName)) {
System.out.println("in messageHandler - getPresentationInfo");
GetPresentationInfoMessage msg = GetPresentationInfoMessage.fromJson(message); GetPresentationInfoMessage msg = GetPresentationInfoMessage.fromJson(message);
bbbInGW.getPresentationInfo(msg.meetingId, msg.requesterId, msg.replyTo); bbbInGW.getPresentationInfo(msg.meetingId, msg.requesterId, msg.replyTo);
} else if (SendConversionCompletedMessage.SEND_CONVERSION_COMPLETED.equals(messageName)) { } else if (SendConversionCompletedMessage.SEND_CONVERSION_COMPLETED.equals(messageName)) {
System.out.println("in messageHandler - sendConversionCompleted");
SendConversionCompletedMessage msg = SendConversionCompletedMessage.fromJson(message); SendConversionCompletedMessage msg = SendConversionCompletedMessage.fromJson(message);
// sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code, // sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code,
// msg.presId, msg.numPages, msg.presName, msg.presBaseUrl); // msg.presId, msg.numPages, msg.presName, msg.presBaseUrl);
bbbInGW.sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code, bbbInGW.sendConversionCompleted(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numPages, msg.presName, msg.presBaseUrl); msg.presId, msg.numPages, msg.presName, msg.presBaseUrl);
} else if (SendPageCountErrorMessage.SEND_PAGE_COUNT_ERROR.equals(messageName)) { } else if (SendPageCountErrorMessage.SEND_PAGE_COUNT_ERROR.equals(messageName)) {
System.out.println("in messageHandler - sendPageCountError");
SendPageCountErrorMessage msg = SendPageCountErrorMessage.fromJson(message); SendPageCountErrorMessage msg = SendPageCountErrorMessage.fromJson(message);
// sendPageCountError(msg.messageKey, msg.meetingId, msg.code, // sendPageCountError(msg.messageKey, msg.meetingId, msg.code,
// msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName); // msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName);
bbbInGW.sendPageCountError(msg.messageKey, msg.meetingId, msg.code, bbbInGW.sendPageCountError(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName); msg.presId, msg.numberOfPages, msg.maxNumberPages, msg.presName);
} else if (GoToSlideMessage.GO_TO_SLIDE.equals(messageName)) { } else if (GoToSlideMessage.GO_TO_SLIDE.equals(messageName)) {
System.out.println("in messageHandler - goToSlide");
GoToSlideMessage msg = GoToSlideMessage.fromJson(message); GoToSlideMessage msg = GoToSlideMessage.fromJson(message);
bbbInGW.gotoSlide(msg.meetingId, msg.page); bbbInGW.gotoSlide(msg.meetingId, msg.page);
} else if (RemovePresentationMessage.REMOVE_PRESENTATION.equals(messageName)) { } else if (RemovePresentationMessage.REMOVE_PRESENTATION.equals(messageName)) {
System.out.println("in messageHandler - removePresentation");
RemovePresentationMessage msg = RemovePresentationMessage.fromJson(message); RemovePresentationMessage msg = RemovePresentationMessage.fromJson(message);
bbbInGW.removePresentation(msg.meetingId, msg.presentationId); bbbInGW.removePresentation(msg.meetingId, msg.presentationId);
} else if (SendCursorUpdateMessage.SEND_CURSOR_UPDATE.equals(messageName)) { } else if (SendCursorUpdateMessage.SEND_CURSOR_UPDATE.equals(messageName)) {
SendCursorUpdateMessage msg = SendCursorUpdateMessage.fromJson(message); SendCursorUpdateMessage msg = SendCursorUpdateMessage.fromJson(message);
bbbInGW.sendCursorUpdate(msg.meetingId, msg.xPercent, msg.yPercent); bbbInGW.sendCursorUpdate(msg.meetingId, msg.xPercent, msg.yPercent);
} else if (SharePresentationMessage.SHARE_PRESENTATION.equals(messageName)) { } else if (SharePresentationMessage.SHARE_PRESENTATION.equals(messageName)) {
System.out.println("in messageHandler - sharePresentation");
SharePresentationMessage msg = SharePresentationMessage.fromJson(message); SharePresentationMessage msg = SharePresentationMessage.fromJson(message);
bbbInGW.sharePresentation(msg.meetingId, msg.presentationId, msg.share); bbbInGW.sharePresentation(msg.meetingId, msg.presentationId, msg.share);
} else if (GetSlideInfoMessage.GET_SLIDE_INFO.equals(messageName)) { } else if (GetSlideInfoMessage.GET_SLIDE_INFO.equals(messageName)) {
System.out.println("in messageHandler - GetSlideInfo");
GetSlideInfoMessage msg = GetSlideInfoMessage.fromJson(message); GetSlideInfoMessage msg = GetSlideInfoMessage.fromJson(message);
bbbInGW.getSlideInfo(msg.meetingId, msg.requesterId, msg.replyTo); bbbInGW.getSlideInfo(msg.meetingId, msg.requesterId, msg.replyTo);
} else if (SendSlideGeneratedMessage.SEND_SLIDE_GENERATED.equals(messageName)) { } else if (SendSlideGeneratedMessage.SEND_SLIDE_GENERATED.equals(messageName)) {
System.out.println("in messageHandler - SendSlideGenerated");
SendSlideGeneratedMessage msg = SendSlideGeneratedMessage.fromJson(message);
SendSlideGeneratedMessage msg = SendSlideGeneratedMessage.fromJson(message);
bbbInGW.sendSlideGenerated(msg.messageKey, msg.meetingId, msg.code, bbbInGW.sendSlideGenerated(msg.messageKey, msg.meetingId, msg.code,
msg.presId, msg.numberOfPages, msg.pagesCompleted, msg.presName); msg.presId, msg.numberOfPages, msg.pagesCompleted, msg.presName);
} }
@ -199,41 +179,5 @@ public class PresentationMessageListener implements MessageHandler {
} }
} }
} }
// @Override
// public void handleMessage(String pattern, String channel, String message) {
//
// if (channel.equalsIgnoreCase(MessagingConstants.TO_PRESENTATION_CHANNEL)) {
//
// JsonParser parser = new JsonParser();
// JsonObject obj = (JsonObject) parser.parse(message);
//
// if(obj.has("payload") && obj.has("header")) {
//
// JsonObject headerObject = (JsonObject) obj.get("header");
// JsonObject payloadObject = (JsonObject) obj.get("payload");
//
// String eventName = headerObject.get("name").toString().replace("\"", "");
//
// if(eventName.equalsIgnoreCase("presentation_page_changed_message") ||
// eventName.equalsIgnoreCase("presentation_page_resized_message")) {
//
// JsonObject pageObject = (JsonObject) payloadObject.get("page");
// String roomName = payloadObject.get("meeting_id").toString().replace("\"", "");
//
// if(eventName.equalsIgnoreCase("presentation_page_changed_message")) {
// String pageId = pageObject.get("id").toString().replace("\"", "");
// bbbInGW.gotoSlide(roomName, pageId);
// } else if(eventName.equalsIgnoreCase("presentation_page_resized_message")) {
// String xOffset = pageObject.get("x_offset").toString().replace("\"", "");
// String yOffset = pageObject.get("y_offset").toString().replace("\"", "");
// String widthRatio = pageObject.get("width_ratio").toString().replace("\"", "");
// String heightRatio = pageObject.get("height_ratio").toString().replace("\"", "");
// bbbInGW.resizeAndMoveSlide(roomName, Double.parseDouble(xOffset), Double.parseDouble(yOffset), Double.parseDouble(widthRatio), Double.parseDouble(heightRatio));
// }
// }
// }
//
// }
// }
} }

View File

@ -46,7 +46,7 @@ public class UsersMessageReceiver implements MessageHandler{
@Override @Override
public void handleMessage(String pattern, String channel, String message) { public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_USERS_CHANNEL)) { if (channel.equalsIgnoreCase(MessagingConstants.TO_USERS_CHANNEL)) {
System.out.println("Users message: " + channel + " " + message); // System.out.println("Users message: " + channel + " " + message);
JsonParser parser = new JsonParser(); JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message); JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) { if (obj.has("header") && obj.has("payload")) {

View File

@ -357,6 +357,13 @@ trait UsersApp {
} }
} }
def startRecordingVoiceConference() {
if (users.numUsersInVoiceConference == 1 && recorded) {
log.info("********** Send START RECORDING [" + voiceBridge + "]")
outGW.send(new StartRecordingVoiceConf(meetingID, recorded, voiceBridge))
}
}
def handleUserJoinedVoiceConfMessage(msg: UserJoinedVoiceConfMessage) = { def handleUserJoinedVoiceConfMessage(msg: UserJoinedVoiceConfMessage) = {
log.info("Received user joined voice for user [" + msg.callerIdName + "] userid=[" + msg.userId + "]") log.info("Received user joined voice for user [" + msg.callerIdName + "] userid=[" + msg.userId + "]")
@ -368,17 +375,23 @@ trait UsersApp {
log.info("User joined voice for user [" + nu.name + "] userid=[" + msg.userId + "]") log.info("User joined voice for user [" + nu.name + "] userid=[" + msg.userId + "]")
outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu)) outGW.send(new UserJoinedVoice(meetingID, recorded, voiceBridge, nu))
if (meetingMuted) if (meetingMuted) {
outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, voiceBridge, nu.voiceUser.userId, meetingMuted)) outGW.send(new MuteVoiceUser(meetingID, recorded, nu.userID, nu.userID, voiceBridge, nu.voiceUser.userId, meetingMuted))
}
case None =>
{
handleUserJoinedVoiceFromPhone(msg)
} }
if (users.numUsersInVoiceConference == 1 && recorded) { startRecordingVoiceConference()
outGW.send(new StartRecordingVoiceConf(meetingID, recorded, voiceBridge)) }
} case None => {
handleUserJoinedVoiceFromPhone(msg)
startRecordingVoiceConference()
}
}
}
def stopRecordingVoiceConference() {
if (users.numUsersInVoiceConference == 0 && recorded) {
log.info("********** Send STOP RECORDING [" + voiceBridge + "]")
outGW.send(new StopRecordingVoiceConf(meetingID, recorded, voiceBridge, voiceRecordingFilename))
} }
} }
@ -399,9 +412,7 @@ trait UsersApp {
} }
} }
if (users.numUsersInVoiceConference == 0 && recorded) { stopRecordingVoiceConference()
outGW.send(new StopRecordingVoiceConf(meetingID, recorded, voiceBridge, voiceRecordingFilename))
}
} }
} }

View File

@ -35,12 +35,14 @@ class MeetingEventRedisPublisher(service: MessageSender) extends OutMessageListe
private def handleStartRecordingVoiceConf(msg: StartRecordingVoiceConf) { private def handleStartRecordingVoiceConf(msg: StartRecordingVoiceConf) {
val m = new StartRecordingVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId) val m = new StartRecordingVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId)
service.send(MessagingConstants.TO_VOICE_CONF_CHANNEL, m.toJson()) System.out.println("*******************\n" + m.toJson())
service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, m.toJson())
} }
private def handleStopRecordingVoiceConf(msg: StopRecordingVoiceConf) { private def handleStopRecordingVoiceConf(msg: StopRecordingVoiceConf) {
val m = new StopRecordingVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId, msg.recordedStream) val m = new StopRecordingVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId, msg.recordedStream)
service.send(MessagingConstants.TO_VOICE_CONF_CHANNEL, m.toJson()) System.out.println("*******************\n" + m.toJson())
service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, m.toJson())
} }
private def handleMeetingDestroyed(msg: MeetingDestroyed) { private def handleMeetingDestroyed(msg: MeetingDestroyed) {

View File

@ -22,11 +22,11 @@ class RedisPublisher(val system: ActorSystem) extends SystemConfiguration {
Await.result(futurePong, 5 seconds) Await.result(futurePong, 5 seconds)
// publish after 2 seconds every 2 or 5 seconds // publish after 2 seconds every 2 or 5 seconds
system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis())) //system.scheduler.schedule(2 seconds, 2 seconds)(redis.publish("time", System.currentTimeMillis()))
// system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value")) // system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value"))
def publish(channel: String, data: String) { def publish(channel: String, data: String) {
println("PUBLISH TO [" + channel + "]: \n [" + data + "]") // println("PUBLISH TO [" + channel + "]: \n [" + data + "]")
redis.publish(channel, data) redis.publish(channel, data)
} }

View File

@ -6,7 +6,7 @@ import com.google.gson.JsonParser;
public class StartRecordingVoiceConfRequestMessage { public class StartRecordingVoiceConfRequestMessage {
public static final String START_RECORD_VOICE_CONF_REQUEST = "start_recording__voice_conf_request_message"; public static final String START_RECORD_VOICE_CONF_REQUEST = "start_recording_voice_conf_request_message";
public static final String VERSION = "0.0.1"; public static final String VERSION = "0.0.1";
public static final String MEETING_ID = "meeting_id"; public static final String MEETING_ID = "meeting_id";

View File

@ -24,6 +24,8 @@ public class RedisMessageReceiver {
} }
public void handleMessage(String pattern, String channel, String message) { public void handleMessage(String pattern, String channel, String message) {
System.out.println("************* Received: \n" + message + "\n*************************");
if (channel.equalsIgnoreCase(TO_VOICE_CONF_SYSTEM_CHAN)) { if (channel.equalsIgnoreCase(TO_VOICE_CONF_SYSTEM_CHAN)) {
JsonParser parser = new JsonParser(); JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message); JsonObject obj = (JsonObject) parser.parse(message);