auto start/stop video rec based on meeting isRecorded
This commit is contained in:
parent
922ab7cc04
commit
09e907d2ba
@ -35,9 +35,11 @@ public class DeskShareMessageReceiver implements MessageHandler {
|
||||
|
||||
if (DeskShareStartedEventMessage.DESKSHARE_STARTED_MESSAGE.equals(messageName)) {
|
||||
DeskShareStartedEventMessage msg = DeskShareStartedEventMessage.fromJson(message);
|
||||
System.out.println("^^^^^^^DESKSHARE STARTED^^^^^^");
|
||||
bbbGW.deskShareStarted(msg.conferenceName, msg.callerId, msg.callerIdName);
|
||||
} else if (DeskShareStoppedEventMessage.DESK_SHARE_STOPPED_MESSAGE.equals(messageName)) {
|
||||
DeskShareStoppedEventMessage msg = DeskShareStoppedEventMessage.fromJson(message);
|
||||
System.out.println("^^^^^^^DESKSHARE STOPPED^^^^^^");
|
||||
bbbGW.deskShareStopped(msg.conferenceName, msg.callerId, msg.callerIdName);
|
||||
}
|
||||
// else if (DeskShareViewerJoinedEventMessage.DESK_SHARE_VIEWER_JOINED_MESSAGE.equals(messageName)) {
|
||||
|
@ -52,6 +52,11 @@ class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway, voic
|
||||
}
|
||||
|
||||
private def findMeetingWithVoiceConfId(voiceConfId: String): Option[RunningMeeting] = {
|
||||
// println("searching meeeting with voiceConfId=" + voiceConfId)
|
||||
// meetings.values.find(m => {
|
||||
// println("^^^^^^" + m.mProps.voiceBridge)
|
||||
// m.mProps.voiceBridge == voiceConfId
|
||||
// })
|
||||
meetings.values.find(m => m.mProps.voiceBridge == voiceConfId)
|
||||
}
|
||||
|
||||
@ -275,7 +280,10 @@ class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway, voic
|
||||
var originalConfId = msg.conferenceName.replace(DESKSHARE_CONFERENCE_NAME_SUFFIX, "")
|
||||
println("originalConfId=" + originalConfId)
|
||||
findMeetingWithVoiceConfId(originalConfId) foreach { m =>
|
||||
m.actorRef ! msg
|
||||
{
|
||||
println("FOREACH" + m.toString())
|
||||
m.actorRef ! msg
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println("\n\n\nERROR in handleDeskShareStartedMessage in BBBActor \n\n\n")
|
||||
@ -284,7 +292,28 @@ class BigBlueButtonActor(val system: ActorSystem, outGW: MessageOutGateway, voic
|
||||
}
|
||||
|
||||
private def handleDeskShareStoppedRequest(msg: DeskShareStoppedRequest) {
|
||||
//TODO
|
||||
|
||||
println("DeskShareStoppedRequest in BBBActor")
|
||||
val DESKSHARE_CONFERENCE_NAME_SUFFIX = "-DESKSHARE"
|
||||
// find in which meeting ....
|
||||
|
||||
println("\n\n\n\nBBBActor: handleDeskShareStoppedRequest\n\n\n\n")
|
||||
println(msg.conferenceName)
|
||||
println(msg.callerId)
|
||||
println(msg.callerIdName)
|
||||
|
||||
if (msg.conferenceName.endsWith(DESKSHARE_CONFERENCE_NAME_SUFFIX)) {
|
||||
var originalConfId = msg.conferenceName.replace(DESKSHARE_CONFERENCE_NAME_SUFFIX, "")
|
||||
println("originalConfId=" + originalConfId)
|
||||
findMeetingWithVoiceConfId(originalConfId) foreach { m =>
|
||||
{
|
||||
println("FOREACH" + m.toString())
|
||||
m.actorRef ! msg
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println("\n\n\nERROR in handleDeskShareStoppedMessage in BBBActor \n\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,10 +62,14 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: MessageOutGateway)
|
||||
handleUserTalkingInVoiceConfMessage(msg)
|
||||
case msg: VoiceConfRecordingStartedMessage =>
|
||||
handleVoiceConfRecordingStartedMessage(msg)
|
||||
case msg: DeskShareRecordingStartedRequest =>
|
||||
handleDeskShareRecordingStartedRequest(msg)
|
||||
case msg: DeskShareRecordingStoppedRequest =>
|
||||
handleDeskShareRecordingStoppedRequest(msg)
|
||||
// case msg: DeskShareRecordingStartedRequest =>
|
||||
// handleDeskShareRecordingStartedRequest(msg)
|
||||
// case msg: DeskShareRecordingStoppedRequest =>
|
||||
// handleDeskShareRecordingStoppedRequest(msg)
|
||||
case msg: DeskShareStartedRequest =>
|
||||
handleDeskShareStartedRequest(msg)
|
||||
case msg: DeskShareStoppedRequest =>
|
||||
handleDeskShareStoppedRequest(msg)
|
||||
case msg: UserJoining =>
|
||||
handleUserJoin(msg)
|
||||
case msg: UserLeaving =>
|
||||
@ -231,7 +235,7 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: MessageOutGateway)
|
||||
}
|
||||
|
||||
def handleMonitorNumberOfWebUsers() {
|
||||
println("BACK TIMER")
|
||||
// println("BACK TIMER")
|
||||
if (users.numWebUsers == 0 && meetingModel.lastWebUserLeftOn > 0) {
|
||||
if (timeNowInMinutes - meetingModel.lastWebUserLeftOn > 2) {
|
||||
log.info("MonitorNumberOfWebUsers empty for meeting [" + mProps.meetingID + "]. Ejecting all users from voice.")
|
||||
@ -305,45 +309,39 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: MessageOutGateway)
|
||||
|
||||
// If the meeting is recorded, tell FS to record video
|
||||
private def handleDeskShareStartedRequest(msg: DeskShareStartedRequest) {
|
||||
//TODO
|
||||
println("\n\n\nMeetingActor-handleDeskShareStartedRequest-start\n")
|
||||
println("\n\n\nMeetingActor-handleDeskShareStartedRequest\n")
|
||||
println("isRecording=" + meetingModel.isRecording())
|
||||
println("\n\n\nMeetingActor-handleDeskShareStartedRequest-end\n")
|
||||
|
||||
if (meetingModel.isRecording()) {
|
||||
println("IS RECORDING")
|
||||
// outGW.send(new DeskShareStartRecording())//TODO
|
||||
val timestamp = System.currentTimeMillis().toString()
|
||||
// val filepath = "/var/freeswitch/meetings/" + mProps.meetingID + "-" + timestamp + ".mp4"
|
||||
val filepath = "/home/debian/" + mProps.meetingID + "-" + timestamp + ".mp4"
|
||||
meetingModel.recordingStarted()
|
||||
meetingModel.setVoiceRecordingFilename(filepath)
|
||||
outGW.send(new DeskShareStartRecording(msg.conferenceName, filepath, timestamp))
|
||||
} else {
|
||||
println("IS NOT RECORDING")
|
||||
}
|
||||
// if (mProps.allowStartStopRecording && meetingModel.isRecording() != msg.recording) {
|
||||
// if (msg.recording) {
|
||||
// meetingModel.recordingStarted()
|
||||
// } else {
|
||||
// meetingModel.recordingStopped()
|
||||
// }
|
||||
// log.debug("Sending recording status for meeting [" + mProps.meetingID + "], recording=[" + msg.recording + "]")
|
||||
// outGW.send(new RecordingStatusChanged(mProps.meetingID, mProps.recorded, msg.userId, msg.recording))
|
||||
// }
|
||||
|
||||
// if (msg.recording) {
|
||||
// meetingModel.setVoiceRecordingFilename(msg.recordStream)
|
||||
// outGW.send(new VoiceRecordingStarted(mProps.meetingID, mProps.recorded, msg.recordStream, msg.timestamp, mProps.voiceBridge))
|
||||
// } else {
|
||||
// meetingModel.setVoiceRecordingFilename("")
|
||||
// outGW.send(new VoiceRecordingStopped(mProps.meetingID, mProps.recorded, msg.recordStream, msg.timestamp, mProps.voiceBridge))
|
||||
// }
|
||||
|
||||
// conferenceName: String, filename: String, timestamp: String
|
||||
outGW.send(new DeskShareStartedReply(msg.conferenceName, msg.callerId, msg.callerIdName))
|
||||
}
|
||||
|
||||
private def handleDeskShareStoppedRequest(msg: DeskShareStoppedRequest) {
|
||||
//TODO
|
||||
println("\n\n\nMeetingActor-handleDeskShareStoppedRequest\n")
|
||||
println("isRecording=" + meetingModel.isRecording())
|
||||
|
||||
if (meetingModel.isRecording()) {
|
||||
println("STOPPING WHEN IT IS RECORDING")
|
||||
val timestamp = System.currentTimeMillis().toString()
|
||||
|
||||
meetingModel.recordingStopped()
|
||||
outGW.send(new DeskShareStopRecording(msg.conferenceName, meetingModel.getVoiceRecordingFilename(), timestamp))
|
||||
} else {
|
||||
println("ERROR: STOP REC BUT IT WAS NOT RECORDING?!")
|
||||
}
|
||||
}
|
||||
|
||||
private def handleDeskShareRecordingStartedRequest(msg: DeskShareRecordingStartedRequest) {
|
||||
|
||||
//TODO
|
||||
}
|
||||
|
||||
private def handleDeskShareRecordingStoppedRequest(msg: DeskShareRecordingStoppedRequest) {
|
||||
|
@ -113,10 +113,12 @@ case class IsWhiteboardEnabledReply(meetingID: String, recorded: Boolean, reques
|
||||
case class GetAllMeetingsReply(meetings: Array[MeetingInfo]) extends IOutMessage
|
||||
|
||||
// DeskShare
|
||||
case class DeskShareStartedReply(conferenceName: String, callerId: String, callerIdName: String) extends IOutMessage
|
||||
case class DeskShareStoppedReply(conferenceName: String, callerId: String, callerIdName: String) extends IOutMessage
|
||||
case class DeskShareRecordingStartedReply(conferenceName: String, filename: String, timestamp: String) extends IOutMessage
|
||||
case class DeskShareRecordingStoppedReply(conferenceName: String, filename: String, timestamp: String) extends IOutMessage
|
||||
//case class DeskShareStartedReply(conferenceName: String, callerId: String, callerIdName: String) extends IOutMessage
|
||||
//case class DeskShareStoppedReply(conferenceName: String, callerId: String, callerIdName: String) extends IOutMessage
|
||||
//case class DeskShareRecordingStartedReply(conferenceName: String, filename: String, timestamp: String) extends IOutMessage
|
||||
//case class DeskShareRecordingStoppedReply(conferenceName: String, filename: String, timestamp: String) extends IOutMessage
|
||||
case class DeskShareStartRecording(conferenceName: String, filename: String, timestamp: String) extends IOutMessage
|
||||
case class DeskShareStopRecording(conferenceName: String, filename: String, timestamp: String) extends IOutMessage
|
||||
|
||||
// Value Objects
|
||||
case class MeetingVO(id: String, recorded: Boolean)
|
||||
|
@ -0,0 +1,34 @@
|
||||
package org.bigbluebutton.core.pubsub.senders
|
||||
|
||||
import org.bigbluebutton.core.api.OutMessageListener2
|
||||
import org.bigbluebutton.core.MessageSender
|
||||
import org.bigbluebutton.core.api._
|
||||
import com.google.gson.Gson
|
||||
import scala.collection.mutable.HashMap
|
||||
import collection.JavaConverters._
|
||||
import scala.collection.JavaConversions._
|
||||
import java.util.ArrayList
|
||||
import org.bigbluebutton.common.messages.MessagingConstants
|
||||
import org.bigbluebutton.core.messaging.Util
|
||||
|
||||
class DeskShareEventRedisPublisher(service: MessageSender) extends OutMessageListener2 {
|
||||
def handleMessage(msg: IOutMessage) {
|
||||
msg match {
|
||||
case msg: DeskShareStartRecording => handleDeskShareStartRecording(msg)
|
||||
case msg: DeskShareStopRecording => handleDeskShareStopRecording(msg)
|
||||
case _ => // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
private def handleDeskShareStartRecording(msg: DeskShareStartRecording) {
|
||||
println("_______handleDeskShareStartRecording____________")
|
||||
val json = DeskShareMessageToJsonConverter.getDeskShareStartRecordingToJson(msg)
|
||||
service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, json)
|
||||
}
|
||||
|
||||
private def handleDeskShareStopRecording(msg: DeskShareStopRecording) {
|
||||
println("_______handleDeskShareStopRecording____________")
|
||||
val json = DeskShareMessageToJsonConverter.getDeskShareStopRecordingToJson(msg)
|
||||
service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, json)
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.bigbluebutton.core.pubsub.senders
|
||||
|
||||
import org.bigbluebutton.core.api._
|
||||
import org.bigbluebutton.common.messages.DeskShareStartRecordingEventMessage
|
||||
import org.bigbluebutton.common.messages.DeskShareStopRecordingEventMessage
|
||||
|
||||
object DeskShareMessageToJsonConverter {
|
||||
|
||||
val UNKNOWN = "unknown"
|
||||
|
||||
def getDeskShareStartRecordingToJson(msg: DeskShareStartRecording): String = {
|
||||
println("^^^^^getDeskShareStartRecordingToJson in DeskShareMessageToJsonConverter")
|
||||
val newMsg = new DeskShareStartRecordingEventMessage(msg.conferenceName, msg.filename, msg.timestamp)
|
||||
newMsg.toJson()
|
||||
}
|
||||
|
||||
def getDeskShareStopRecordingToJson(msg: DeskShareStopRecording): String = {
|
||||
println("^^^^^getDeskShareStopRecordingToJson in DeskShareMessageToJsonConverter")
|
||||
val newMsg = new DeskShareStopRecordingEventMessage(msg.conferenceName, msg.filename, msg.timestamp)
|
||||
newMsg.toJson()
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.bigbluebutton.core.recorders
|
||||
|
||||
import org.bigbluebutton.core.api._
|
||||
import scala.collection.JavaConversions._
|
||||
import org.bigbluebutton.core.service.recorder.RecorderApplication
|
||||
import org.bigbluebutton.core.recorders.events.PublicChatRecordEvent
|
||||
|
||||
class DeskShareEventRedisRecorder(recorder: RecorderApplication) extends OutMessageListener2 {
|
||||
def handleMessage(msg: IOutMessage) {
|
||||
msg match {
|
||||
case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg)
|
||||
case _ => // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) {
|
||||
println("____TODO____DeskShareEventRedisRecorder")
|
||||
// if (msg.recorded) {
|
||||
// }
|
||||
}
|
||||
}
|
@ -1,12 +1,14 @@
|
||||
package org.bigbluebutton.freeswitch.pubsub.receivers;
|
||||
|
||||
|
||||
import org.bigbluebutton.common.messages.DeskShareStopRecordingEventMessage;
|
||||
import org.bigbluebutton.common.messages.EjectAllUsersFromVoiceConfRequestMessage;
|
||||
import org.bigbluebutton.common.messages.EjectUserFromVoiceConfRequestMessage;
|
||||
import org.bigbluebutton.common.messages.GetUsersFromVoiceConfRequestMessage;
|
||||
import org.bigbluebutton.common.messages.MuteUserInVoiceConfRequestMessage;
|
||||
import org.bigbluebutton.common.messages.StartRecordingVoiceConfRequestMessage;
|
||||
import org.bigbluebutton.common.messages.StopRecordingVoiceConfRequestMessage;
|
||||
import org.bigbluebutton.common.messages.DeskShareStartRecordingEventMessage;
|
||||
import org.bigbluebutton.freeswitch.voice.freeswitch.FreeswitchApplication;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
@ -55,12 +57,30 @@ public class RedisMessageReceiver {
|
||||
case StopRecordingVoiceConfRequestMessage.STOP_RECORD_VOICE_CONF_REQUEST:
|
||||
processStopRecordingVoiceConfRequestMessage(message);
|
||||
break;
|
||||
case DeskShareStartRecordingEventMessage.DESKSHARE_START_RECORDING_MESSAGE:
|
||||
processDeskShareStartRecordingEventMessage(message);
|
||||
break;
|
||||
case DeskShareStopRecordingEventMessage.DESKSHARE_STOP_RECORDING_MESSAGE:
|
||||
processDeskShareStopRecordingEventMessage(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void processDeskShareStartRecordingEventMessage(String json) {
|
||||
System.out.println("^^^FS^processDeskShareStartRecordingEventMessage");
|
||||
DeskShareStartRecordingEventMessage msg = DeskShareStartRecordingEventMessage.fromJson(json);
|
||||
fsApp.deskShareRecording(msg.conferenceName, msg.filename, true);
|
||||
}
|
||||
|
||||
private void processDeskShareStopRecordingEventMessage(String json) {
|
||||
System.out.println("^^^FS^processDeskShareStopRecordingEventMessage");
|
||||
DeskShareStopRecordingEventMessage msg = DeskShareStopRecordingEventMessage.fromJson(json);
|
||||
fsApp.deskShareRecording(msg.conferenceName, msg.filename, false);
|
||||
}
|
||||
|
||||
private void processEjectAllVoiceUsersRequestMessage(String json) {
|
||||
EjectAllUsersFromVoiceConfRequestMessage msg = EjectAllUsersFromVoiceConfRequestMessage.fromJson(json);
|
||||
fsApp.ejectAll(msg.voiceConfId);
|
||||
|
@ -98,9 +98,9 @@ public class FreeswitchApplication {
|
||||
queueMessage(rcc);
|
||||
}
|
||||
|
||||
public void deskShareRecording(String voiceConfId, String meetingid, String filePath){
|
||||
DeskShareRecordCommand dsrc = new DeskShareRecordCommand(voiceConfId, USER, true, filePath);
|
||||
System.out.println("______in FS app deskShareRecording______");
|
||||
public void deskShareRecording(String voiceConfId, String filePath, Boolean record){
|
||||
DeskShareRecordCommand dsrc = new DeskShareRecordCommand(voiceConfId, USER, record, filePath);
|
||||
System.out.println("______in FS app deskShareRecording__" + dsrc.getCommand() + "____");
|
||||
queueMessage(dsrc);
|
||||
}
|
||||
|
||||
@ -128,6 +128,7 @@ public class FreeswitchApplication {
|
||||
manager.record((RecordConferenceCommand) command);
|
||||
} else if (command instanceof DeskShareRecordCommand) {
|
||||
System.out.println("Sending DeskShareRecordCommand for conference = [" + command.getRoom() + "]");
|
||||
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$Sending DeskShareRECORDCommand for conference = [" + command.getRoom() + "]");
|
||||
manager.record((DeskShareRecordCommand)command);
|
||||
} else if (command instanceof DeskShareBroadcastRTMPCommand) {
|
||||
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$Sending DeskShareBroadcastRTMPCommand for conference = [" + command.getRoom() + "]");
|
||||
|
Loading…
Reference in New Issue
Block a user