Make breakout rooms use the selected slide of the current presentation as default presentation.
This commit is contained in:
parent
87b4b8ca07
commit
0e72d7523d
@ -43,7 +43,6 @@ http {
|
||||
services {
|
||||
bbbWebAPI = "http://192.168.23.33/bigbluebutton/api"
|
||||
sharedSecret = "changeme"
|
||||
defaultPresentationURL = "http://localhost/default.pdf"
|
||||
}
|
||||
|
||||
red5 {
|
||||
|
@ -18,7 +18,6 @@ trait SystemConfiguration {
|
||||
lazy val bbbWebSharedSecret = Try(config.getString("services.sharedSecret")).getOrElse("changeme")
|
||||
lazy val bbbWebModeratorPassword = Try(config.getString("services.moderatorPassword")).getOrElse("changeme")
|
||||
lazy val bbbWebViewerPassword = Try(config.getString("services.viewerPassword")).getOrElse("changeme")
|
||||
lazy val bbbWebDefaultPresentationURL = Try(config.getString("services.defaultPresentationURL")).getOrElse("changeme")
|
||||
lazy val keysExpiresInSec = Try(config.getInt("redis.keyExpiry")).getOrElse(14 * 86400) // 14 days
|
||||
lazy val red5DeskShareIP = Try(config.getString("red5.deskshareip")).getOrElse("127.0.0.1")
|
||||
lazy val red5DeskShareApp = Try(config.getString("red5.deskshareapp")).getOrElse("")
|
||||
|
@ -94,7 +94,7 @@ class JsonMessageSenderActor(val service: MessageSender)
|
||||
private def handleCreateBreakoutRoom(msg: CreateBreakoutRoom) {
|
||||
val payload = new CreateBreakoutRoomRequestPayload(msg.room.breakoutId, msg.room.parentId, msg.room.name,
|
||||
msg.room.voiceConfId, msg.room.viewerPassword, msg.room.moderatorPassword,
|
||||
msg.room.durationInMinutes, msg.room.defaultPresentationURL, msg.room.record)
|
||||
msg.room.durationInMinutes, msg.room.sourcePresentationId, msg.room.sourcePresentationSlide, msg.room.record)
|
||||
val request = new CreateBreakoutRoomRequest(payload)
|
||||
service.send(MessagingConstants.FROM_MEETING_CHANNEL, request.toJson())
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class LiveMeeting(val mProps: MeetingProperties,
|
||||
meetingModel.meetingHasEnded
|
||||
|
||||
/**
|
||||
* See if this meeting has breakout rooms. If so, we also need to end them.
|
||||
* Check if this meeting has breakout rooms. If so, we also need to end them.
|
||||
*/
|
||||
handleEndAllBreakoutRooms(new EndAllBreakoutRooms(msg.meetingId))
|
||||
|
||||
|
@ -33,7 +33,7 @@ object UserMessagesProtocol extends DefaultJsonProtocol {
|
||||
implicit val inMsgHeaderFormat = jsonFormat1(InMessageHeader)
|
||||
implicit val outMsgHeaderFormat = jsonFormat1(OutMsgHeader)
|
||||
implicit val outMsgEnvelopeHeaderFormat = jsonFormat2(OutMsgEnvelopeHeader)
|
||||
implicit val createBreakoutRoomOutMsgPayloadFormat = jsonFormat8(CreateBreakoutRoomOutMsgPayload)
|
||||
implicit val createBreakoutRoomOutMsgPayloadFormat = jsonFormat10(CreateBreakoutRoomOutMsgPayload)
|
||||
implicit val createBreakoutRoomOutMsgEnvelopePayloadFormat = jsonFormat2(CreateBreakoutRoomOutMsgEnvelopePayload)
|
||||
implicit val createBreakoutRoomOutMsgEnvelopeFormat = jsonFormat2(CreateBreakoutRoomOutMsgEnvelope)
|
||||
|
||||
|
@ -5,12 +5,10 @@ case class OutMsgEnvelopeHeader(`type`: MessageType.MessageType, address: String
|
||||
|
||||
trait OutMessage
|
||||
|
||||
case class CreateBreakoutRoomOutMsgEnvelope(header: OutMsgEnvelopeHeader,
|
||||
payload: CreateBreakoutRoomOutMsgEnvelopePayload)
|
||||
case class CreateBreakoutRoomOutMsgEnvelopePayload(header: OutMsgHeader,
|
||||
payload: CreateBreakoutRoomOutMsgPayload)
|
||||
case class CreateBreakoutRoomOutMsgEnvelope(header: OutMsgEnvelopeHeader, payload: CreateBreakoutRoomOutMsgEnvelopePayload)
|
||||
case class CreateBreakoutRoomOutMsgEnvelopePayload(header: OutMsgHeader, payload: CreateBreakoutRoomOutMsgPayload)
|
||||
case class CreateBreakoutRoomOutMsgPayload(breakoutId: String, name: String, parentId: String,
|
||||
voiceConfId: String, durationInMinutes: Int,
|
||||
moderatorPassword: String, viewerPassword: String,
|
||||
defaultPresentationUrl: String)
|
||||
sourcePresentationId: String, sourcePresentationSlide: Int, record: Boolean)
|
||||
|
||||
|
@ -33,7 +33,7 @@ case class CreateBreakoutRoom(meetingId: String, room: BreakoutRoomOutPayload) e
|
||||
case class EndBreakoutRoom(breakoutId: String) extends IOutMessage
|
||||
case class BreakoutRoomOutPayload(breakoutId: String, name: String, parentId: String,
|
||||
voiceConfId: String, durationInMinutes: Int, moderatorPassword: String, viewerPassword: String,
|
||||
defaultPresentationURL: String, record: Boolean)
|
||||
sourcePresentationId: String, sourcePresentationSlide: Int, record: Boolean)
|
||||
case class BreakoutRoomJoinURLOutMessage(meetingId: String, recorded: Boolean, breakoutId: String, userId: String, joinURL: String) extends IOutMessage
|
||||
case class BreakoutRoomStartedOutMessage(meetingId: String, recorded: Boolean, breakout: BreakoutRoomBody) extends IOutMessage
|
||||
case class BreakoutRoomBody(name: String, breakoutId: String)
|
||||
|
@ -20,15 +20,6 @@ trait BreakoutRoomApp extends SystemConfiguration {
|
||||
val outGW: OutMessageGateway
|
||||
val eventBus: IncomingEventBus
|
||||
|
||||
def getDefaultPresentationURL(): String = {
|
||||
var presURL = bbbWebDefaultPresentationURL
|
||||
val page = presModel.getCurrentPage()
|
||||
page foreach { p =>
|
||||
presURL = BreakoutRoomsUtil.fromSWFtoPDF(p.swfUri)
|
||||
}
|
||||
presURL
|
||||
}
|
||||
|
||||
def handleBreakoutRoomsList(msg: BreakoutRoomsListMessage) {
|
||||
val breakoutRooms = breakoutModel.getRooms().toVector map { r => new BreakoutRoomBody(r.name, r.id) }
|
||||
outGW.send(new BreakoutRoomsListOutMessage(mProps.meetingID, breakoutRooms, breakoutModel.pendingRoomsNumber == 0 && breakoutRooms.length > 0));
|
||||
@ -40,17 +31,20 @@ trait BreakoutRoomApp extends SystemConfiguration {
|
||||
log.warning("CreateBreakoutRooms event received while {} are pending to be created for meeting {}", breakoutModel.pendingRoomsNumber, mProps.meetingID)
|
||||
return
|
||||
}
|
||||
|
||||
var i = 0
|
||||
val sourcePresentationId = presModel.getCurrentPresentation().get.id
|
||||
val sourcePresentationSlide = presModel.getCurrentPage().get.num
|
||||
breakoutModel.pendingRoomsNumber = msg.rooms.length;
|
||||
|
||||
for (room <- msg.rooms) {
|
||||
i += 1
|
||||
val presURL = bbbWebDefaultPresentationURL
|
||||
val breakoutMeetingId = BreakoutRoomsUtil.createMeetingId(mProps.meetingID, i)
|
||||
val voiceConfId = BreakoutRoomsUtil.createVoiceConfId(mProps.voiceBridge, i)
|
||||
val r = breakoutModel.createBreakoutRoom(breakoutMeetingId, room.name, voiceConfId, room.users, presURL)
|
||||
val r = breakoutModel.createBreakoutRoom(breakoutMeetingId, room.name, voiceConfId, room.users)
|
||||
val p = new BreakoutRoomOutPayload(r.id, r.name, mProps.meetingID,
|
||||
r.voiceConfId, msg.durationInMinutes, mProps.moderatorPass, mProps.viewerPass,
|
||||
r.defaultPresentationURL, msg.record)
|
||||
sourcePresentationId, sourcePresentationSlide, msg.record)
|
||||
outGW.send(new CreateBreakoutRoom(mProps.meetingID, p))
|
||||
}
|
||||
meetingModel.breakoutRoomsdurationInMinutes = msg.durationInMinutes;
|
||||
@ -85,7 +79,7 @@ trait BreakoutRoomApp extends SystemConfiguration {
|
||||
breakoutModel.getRooms().foreach { room =>
|
||||
breakoutModel.getAssignedUsers(room.id) foreach { users =>
|
||||
users.foreach { u =>
|
||||
log.debug("## Sending Join URL for users: {}", u);
|
||||
log.debug("Sending Join URL for users: {}", u);
|
||||
sendJoinURL(u, room.id)
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import scala.collection.immutable.HashMap
|
||||
|
||||
case class BreakoutUser(id: String, name: String)
|
||||
case class BreakoutRoom(id: String, name: String, voiceConfId: String,
|
||||
assignedUsers: Vector[String], users: Vector[BreakoutUser], defaultPresentationURL: String)
|
||||
assignedUsers: Vector[String], users: Vector[BreakoutUser])
|
||||
|
||||
class BreakoutRoomModel {
|
||||
private var rooms = new collection.immutable.HashMap[String, BreakoutRoom]
|
||||
@ -22,8 +22,8 @@ class BreakoutRoomModel {
|
||||
}
|
||||
|
||||
def createBreakoutRoom(id: String, name: String, voiceConfId: String,
|
||||
assignedUsers: Vector[String], defaultPresentationURL: String): BreakoutRoom = {
|
||||
val room = new BreakoutRoom(id, name, voiceConfId, assignedUsers, Vector(), defaultPresentationURL)
|
||||
assignedUsers: Vector[String]): BreakoutRoom = {
|
||||
val room = new BreakoutRoom(id, name, voiceConfId, assignedUsers, Vector())
|
||||
add(room)
|
||||
}
|
||||
|
||||
|
@ -94,16 +94,10 @@ trait PresentationApp {
|
||||
}
|
||||
|
||||
def handleGotoSlide(msg: GotoSlide) {
|
||||
// println("Received GotoSlide for meeting=[" + msg.meetingID + "] page=[" + msg.page + "]")
|
||||
// println("*** Before change page ****")
|
||||
// printPresentations
|
||||
presModel.changePage(msg.page) foreach { page =>
|
||||
// println("Switching page for meeting=[" + msg.meetingID + "] page=[" + page.id + "]")
|
||||
log.debug("Switching page for meeting=[{}] page=[{}]", msg.meetingID, page.num);
|
||||
outGW.send(new GotoSlideOutMsg(mProps.meetingID, mProps.recorded, page))
|
||||
|
||||
}
|
||||
// println("*** After change page ****")
|
||||
// printPresentations
|
||||
|
||||
usersModel.getCurrentPresenter() foreach { pres =>
|
||||
handleStopPollRequest(StopPollRequest(mProps.meetingID, pres.userID))
|
||||
|
@ -8,12 +8,15 @@ public class CreateBreakoutRoomRequestPayload {
|
||||
public final String viewerPassword;
|
||||
public final String moderatorPassword;
|
||||
public final Integer durationInMinutes; // The duration of the breakout room
|
||||
public final String defaultPresentationURL;
|
||||
public final String sourcePresentationId;
|
||||
public final Integer sourcePresentationSlide;
|
||||
public final Boolean record;
|
||||
|
||||
public CreateBreakoutRoomRequestPayload(String breakoutId, String parentId, String name,
|
||||
String voiceConfId, String viewerPassword, String moderatorPassword,
|
||||
Integer duration, String defaultPresentationURL, Boolean record) {
|
||||
public CreateBreakoutRoomRequestPayload(String breakoutId, String parentId,
|
||||
String name, String voiceConfId, String viewerPassword,
|
||||
String moderatorPassword, Integer duration,
|
||||
String sourcePresentationId, Integer sourcePresentationSlide,
|
||||
Boolean record) {
|
||||
this.breakoutId = breakoutId;
|
||||
this.parentId = parentId;
|
||||
this.name = name;
|
||||
@ -21,7 +24,8 @@ public class CreateBreakoutRoomRequestPayload {
|
||||
this.viewerPassword = viewerPassword;
|
||||
this.moderatorPassword = moderatorPassword;
|
||||
this.durationInMinutes = duration;
|
||||
this.defaultPresentationURL = defaultPresentationURL;
|
||||
this.sourcePresentationId = sourcePresentationId;
|
||||
this.sourcePresentationSlide = sourcePresentationSlide;
|
||||
this.record = record;
|
||||
}
|
||||
}
|
||||
|
@ -9,19 +9,20 @@ import com.google.gson.Gson;
|
||||
public class CreateBreakoutRoomRequestTest {
|
||||
@Test
|
||||
public void testCreateBreakoutRoomRequest() {
|
||||
String breakoutId = "abc123";
|
||||
String breakoutId = "183f0bf3a0982a127bdb8161e0c44eb696b3e75c-1474984695664";
|
||||
String parentId = "abc-123";
|
||||
Integer durationInMinutes = 20;
|
||||
String name = "Breakout room 1";
|
||||
String voiceConfId = "851153";
|
||||
String viewerPassword = "vp";
|
||||
String moderatorPassword = "mp";
|
||||
String defaultPresentationURL = "http://localhost/foo.pdf";
|
||||
String sourcePresentationId = "d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1474984695907";
|
||||
Integer sourePresentationSlide = 5;
|
||||
Boolean record = false;
|
||||
|
||||
CreateBreakoutRoomRequestPayload payload =
|
||||
new CreateBreakoutRoomRequestPayload(breakoutId, parentId, name, voiceConfId,
|
||||
viewerPassword, moderatorPassword, durationInMinutes, defaultPresentationURL, record);
|
||||
viewerPassword, moderatorPassword, durationInMinutes, sourcePresentationId, sourePresentationSlide, record);
|
||||
CreateBreakoutRoomRequest msg = new CreateBreakoutRoomRequest(payload);
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(msg);
|
||||
@ -36,7 +37,8 @@ public class CreateBreakoutRoomRequestTest {
|
||||
Assert.assertEquals(rxMsg.payload.viewerPassword, viewerPassword);
|
||||
Assert.assertEquals(rxMsg.payload.moderatorPassword, moderatorPassword);
|
||||
Assert.assertEquals(rxMsg.payload.durationInMinutes, durationInMinutes);
|
||||
Assert.assertEquals(rxMsg.payload.defaultPresentationURL, defaultPresentationURL);
|
||||
Assert.assertEquals(rxMsg.payload.sourcePresentationId, sourcePresentationId);
|
||||
Assert.assertEquals(rxMsg.payload.sourcePresentationSlide, sourePresentationSlide);
|
||||
Assert.assertEquals(rxMsg.payload.record, record);
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<bean id="presDownloadService" class="org.bigbluebutton.presentation.PresentationUrlDownloadService">
|
||||
<property name="presentationDir" value="${presentationDir}"/>
|
||||
<property name="presentationBaseURL" value="${presentationBaseURL}"/>
|
||||
<property name="pageExtractor" ref="pageExtractor"/>
|
||||
<property name="documentConversionService" ref="documentConversionService"/>
|
||||
</bean>
|
||||
|
||||
|
@ -113,7 +113,8 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
|
||||
public void registerUser(String meetingID, String internalUserId,
|
||||
String fullname, String role, String externUserID, String authToken, String avatarURL) {
|
||||
String fullname, String role, String externUserID,
|
||||
String authToken, String avatarURL) {
|
||||
handle(new RegisterUser(meetingID, internalUserId, fullname, role,
|
||||
externUserID, authToken, avatarURL));
|
||||
}
|
||||
@ -142,19 +143,22 @@ public class MeetingService implements MessageListener {
|
||||
* Remove registered users who did not successfully joined the meeting.
|
||||
*/
|
||||
public void purgeRegisteredUsers() {
|
||||
for (AbstractMap.Entry<String, Meeting> entry : this.meetings.entrySet()) {
|
||||
for (AbstractMap.Entry<String, Meeting> entry : this.meetings
|
||||
.entrySet()) {
|
||||
Long now = System.nanoTime();
|
||||
Meeting meeting = entry.getValue();
|
||||
|
||||
ConcurrentMap<String, User> users = meeting.getUsersMap();
|
||||
|
||||
for (AbstractMap.Entry<String, Long> registeredUser : meeting.getRegisteredUsers().entrySet()) {
|
||||
for (AbstractMap.Entry<String, Long> registeredUser : meeting
|
||||
.getRegisteredUsers().entrySet()) {
|
||||
String registeredUserID = registeredUser.getKey();
|
||||
Long registeredUserDate = registeredUser.getValue();
|
||||
|
||||
long registrationTime = registeredUserDate.longValue();
|
||||
long elapsedTime = now - registrationTime;
|
||||
if ( elapsedTime >= 60000 && !users.containsKey(registeredUserID)) {
|
||||
if (elapsedTime >= 60000
|
||||
&& !users.containsKey(registeredUserID)) {
|
||||
meeting.userUnregistered(registeredUserID);
|
||||
}
|
||||
}
|
||||
@ -319,7 +323,8 @@ public class MeetingService implements MessageListener {
|
||||
m.getName(), m.isRecord(), m.getTelVoice(), m.getDuration(),
|
||||
m.getAutoStartRecording(), m.getAllowStartStopRecording(),
|
||||
m.getModeratorPassword(), m.getViewerPassword(),
|
||||
m.getCreateTime(), formatPrettyDate(m.getCreateTime()), m.isBreakout());
|
||||
m.getCreateTime(), formatPrettyDate(m.getCreateTime()),
|
||||
m.isBreakout());
|
||||
}
|
||||
|
||||
private String formatPrettyDate(Long timestamp) {
|
||||
@ -357,8 +362,10 @@ public class MeetingService implements MessageListener {
|
||||
int dashes = meetingId.split("-", -1).length - 1;
|
||||
for (String key : meetings.keySet()) {
|
||||
int keyDashes = key.split("-", -1).length - 1;
|
||||
if (dashes == 2 && key.equals(meetingId)
|
||||
|| (dashes < 2 && keyDashes < 2 && key.startsWith(meetingId))) {
|
||||
if (dashes == 2
|
||||
&& key.equals(meetingId)
|
||||
|| (dashes < 2 && keyDashes < 2 && key
|
||||
.startsWith(meetingId))) {
|
||||
return (Meeting) meetings.get(key);
|
||||
}
|
||||
}
|
||||
@ -484,7 +491,8 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateRecordings(List<String> idList, Map<String, String> metaParams) {
|
||||
public void updateRecordings(List<String> idList,
|
||||
Map<String, String> metaParams) {
|
||||
recordingService.updateMetaParams(idList, metaParams);
|
||||
}
|
||||
|
||||
@ -527,9 +535,11 @@ public class MeetingService implements MessageListener {
|
||||
params.put("voiceBridge", message.voiceConfId);
|
||||
params.put("duration", message.durationInMinutes.toString());
|
||||
params.put("record", message.record.toString());
|
||||
params.put("welcome", getMeeting(message.parentId).getWelcomeMessageTemplate());
|
||||
params.put("welcome", getMeeting(message.parentId)
|
||||
.getWelcomeMessageTemplate());
|
||||
|
||||
Map<String, String> parentMeetingMetadata = parentMeeting.getMetadata();
|
||||
Map<String, String> parentMeetingMetadata = parentMeeting
|
||||
.getMetadata();
|
||||
|
||||
String metaPrefix = "meta_";
|
||||
for (String key : parentMeetingMetadata.keySet()) {
|
||||
@ -542,10 +552,12 @@ public class MeetingService implements MessageListener {
|
||||
|
||||
handleCreateMeeting(breakout);
|
||||
|
||||
presDownloadService.downloadAndProcessDocument(
|
||||
message.defaultPresentationURL, breakout.getInternalId());
|
||||
presDownloadService.extractPage(message.parentId,
|
||||
message.sourcePresentationId,
|
||||
message.sourcePresentationSlide, breakout.getInternalId());
|
||||
} else {
|
||||
log.error("Failed to create breakout room " + message.breakoutId + ". Parent meeting not found.");
|
||||
log.error("Failed to create breakout room " + message.breakoutId
|
||||
+ ".Reason: Parent meeting not found.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -595,6 +607,8 @@ public class MeetingService implements MessageListener {
|
||||
|
||||
Gson gson = new Gson();
|
||||
String logStr = gson.toJson(logData);
|
||||
|
||||
log.info("Meeting restarted: data={}", logStr);
|
||||
} else {
|
||||
Map<String, Object> logData = new HashMap<String, Object>();
|
||||
logData.put("meetingId", m.getInternalId());
|
||||
@ -750,18 +764,17 @@ public class MeetingService implements MessageListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handle(IMessage message) {
|
||||
receivedMessages.add(message);
|
||||
}
|
||||
|
||||
|
||||
public void setParamsProcessorUtil(ParamsProcessorUtil util) {
|
||||
this.paramsProcessorUtil = util;
|
||||
}
|
||||
|
||||
public void setPresDownloadService(PresentationUrlDownloadService presDownloadService) {
|
||||
public void setPresDownloadService(
|
||||
PresentationUrlDownloadService presDownloadService) {
|
||||
this.presDownloadService = presDownloadService;
|
||||
}
|
||||
|
||||
@ -771,15 +784,18 @@ public class MeetingService implements MessageListener {
|
||||
for (StunServer s : stuns) {
|
||||
log.info("a stun: " + s.url);
|
||||
}
|
||||
Set<TurnEntry> turns = stunTurnService.getStunAndTurnServersFor(message.internalUserId);
|
||||
log.info("\nhere are the (" + turns.size() +") turns for internalUserId:" + message.internalUserId);
|
||||
Set<TurnEntry> turns = stunTurnService
|
||||
.getStunAndTurnServersFor(message.internalUserId);
|
||||
log.info("\nhere are the (" + turns.size()
|
||||
+ ") turns for internalUserId:" + message.internalUserId);
|
||||
for (TurnEntry t : turns) {
|
||||
log.info("a turn: " + t.url + "username/pass=" + t.username + '/' + t.password);
|
||||
log.info("a turn: " + t.url + "username/pass=" + t.username + '/'
|
||||
+ t.password);
|
||||
}
|
||||
messagingService.sendStunTurnInfo(message.meetingId, message.internalUserId, stuns, turns);
|
||||
messagingService.sendStunTurnInfo(message.meetingId,
|
||||
message.internalUserId, stuns, turns);
|
||||
}
|
||||
|
||||
|
||||
public void userJoinedVoice(UserJoinedVoice message) {
|
||||
Meeting m = getMeeting(message.meetingId);
|
||||
if (m != null) {
|
||||
@ -886,7 +902,6 @@ public class MeetingService implements MessageListener {
|
||||
runExec.execute(task);
|
||||
}
|
||||
|
||||
|
||||
public void start() {
|
||||
log.info("Starting Meeting Service.");
|
||||
try {
|
||||
@ -936,7 +951,8 @@ public class MeetingService implements MessageListener {
|
||||
messagingService = mess;
|
||||
}
|
||||
|
||||
public void setExpiredMeetingCleanupTimerTask(ExpiredMeetingCleanupTimerTask c) {
|
||||
public void setExpiredMeetingCleanupTimerTask(
|
||||
ExpiredMeetingCleanupTimerTask c) {
|
||||
cleaner = c;
|
||||
cleaner.setMeetingService(this);
|
||||
cleaner.start();
|
||||
@ -946,11 +962,14 @@ public class MeetingService implements MessageListener {
|
||||
removeMeetingWhenEnded = s;
|
||||
}
|
||||
|
||||
public void setRegisteredUserCleanupTimerTask(RegisteredUserCleanupTimerTask c) {
|
||||
public void setRegisteredUserCleanupTimerTask(
|
||||
RegisteredUserCleanupTimerTask c) {
|
||||
registeredUserCleaner = c;
|
||||
registeredUserCleaner.setMeetingService(this);
|
||||
registeredUserCleaner.start();
|
||||
}
|
||||
|
||||
public void setStunTurnService(StunTurnService s) { stunTurnService = s; }
|
||||
public void setStunTurnService(StunTurnService s) {
|
||||
stunTurnService = s;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,8 @@ public class MeetingMessageHandler implements MessageHandler {
|
||||
msg.payload.viewerPassword,
|
||||
msg.payload.moderatorPassword,
|
||||
msg.payload.durationInMinutes,
|
||||
msg.payload.defaultPresentationURL,
|
||||
msg.payload.sourcePresentationId,
|
||||
msg.payload.sourcePresentationSlide,
|
||||
msg.payload.record
|
||||
)
|
||||
);
|
||||
|
@ -9,13 +9,15 @@ public class CreateBreakoutRoom implements IMessage {
|
||||
public final String viewerPassword;
|
||||
public final String moderatorPassword;
|
||||
public final Integer durationInMinutes; // The duration of the breakout room
|
||||
public final String defaultPresentationURL;
|
||||
public final String sourcePresentationId;
|
||||
public final Integer sourcePresentationSlide;
|
||||
public final Boolean record;
|
||||
|
||||
public CreateBreakoutRoom(String breakoutId, String parentId, String name,
|
||||
String voiceConfId, String viewerPassword,
|
||||
String moderatorPassword, Integer duration,
|
||||
String defaultPresentationURL, Boolean record) {
|
||||
String sourcePresentationId, Integer sourcePresentationSlide,
|
||||
Boolean record) {
|
||||
this.breakoutId = breakoutId;
|
||||
this.parentId = parentId;
|
||||
this.name = name;
|
||||
@ -23,7 +25,8 @@ public class CreateBreakoutRoom implements IMessage {
|
||||
this.viewerPassword = viewerPassword;
|
||||
this.moderatorPassword = moderatorPassword;
|
||||
this.durationInMinutes = duration;
|
||||
this.defaultPresentationURL = defaultPresentationURL;
|
||||
this.sourcePresentationId = sourcePresentationId;
|
||||
this.sourcePresentationSlide = sourcePresentationSlide;
|
||||
this.record = record;
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,18 @@
|
||||
package org.bigbluebutton.presentation;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Timer;
|
||||
import java.io.FilenameFilter;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpException;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PresentationUrlDownloadService {
|
||||
private static Logger log = LoggerFactory.getLogger(PresentationUrlDownloadService.class);
|
||||
private static Logger log = LoggerFactory
|
||||
.getLogger(PresentationUrlDownloadService.class);
|
||||
|
||||
private final int maxRedirects = 5;
|
||||
private PageExtractor pageExtractor;
|
||||
private DocumentConversionService documentConversionService;
|
||||
private String presentationBaseURL;
|
||||
private String presentationDir;
|
||||
@ -28,31 +21,53 @@ public class PresentationUrlDownloadService {
|
||||
documentConversionService.processDocument(uploadedPres);
|
||||
}
|
||||
|
||||
public void processUploadedFile(String meetingId, String presId, String filename, File presFile) {
|
||||
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, filename, presentationBaseURL);
|
||||
public void processUploadedFile(String meetingId, String presId,
|
||||
String filename, File presFile) {
|
||||
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId,
|
||||
presId, filename, presentationBaseURL);
|
||||
uploadedPres.setUploadedFile(presFile);
|
||||
processUploadedPresentation(uploadedPres);
|
||||
}
|
||||
|
||||
public void downloadAndProcessDocument(String address, String meetingId) {
|
||||
log.debug("downloadAndProcessDocument [pres=" + address + ", meeting=" + meetingId + "]");
|
||||
public void extractPage(String sourceMeetingId, String presentationId,
|
||||
Integer presentationSlide, String destinationMeetingId) {
|
||||
|
||||
String presFilename = address.substring(address.lastIndexOf('/') + 1);
|
||||
log.debug("downloadAndProcessDocument [filename=" + presFilename + "]");
|
||||
String filenameExt = getFilenameExt(presFilename);
|
||||
// Construct the source meeting path
|
||||
File sourceMeetingPath = new File(presentationDir + File.separator
|
||||
+ sourceMeetingId + File.separator + sourceMeetingId
|
||||
+ File.separator + presentationId);
|
||||
|
||||
String presId = generatePresentationId(presFilename);
|
||||
File uploadDir = createPresentationDirectory(meetingId, presentationDir, presId);
|
||||
if (uploadDir != null) {
|
||||
String newFilename = createNewFilename(presId, filenameExt);
|
||||
String newFilePath = uploadDir.getAbsolutePath() + File.separatorChar + newFilename;
|
||||
|
||||
if (savePresentation(meetingId, newFilePath, address)) {
|
||||
File pres = new File(newFilePath);
|
||||
processUploadedFile(meetingId, presId, presFilename, pres);
|
||||
} else {
|
||||
log.error("Failed to download presentation=[" + address + "], meeting=[" + meetingId + "]");
|
||||
final String presentationFilter = presentationId;
|
||||
FilenameFilter filter = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.startsWith(presentationFilter);
|
||||
}
|
||||
};
|
||||
|
||||
File[] children = sourceMeetingPath.listFiles(filter);
|
||||
|
||||
if (children.length != 1) {
|
||||
log.error("Not matching file with prefix {} found at {}",
|
||||
sourceMeetingId, sourceMeetingPath);
|
||||
return;
|
||||
} else {
|
||||
File sourcePresentationFile = children[0];
|
||||
String filenameExt = FilenameUtils
|
||||
.getExtension(sourcePresentationFile.getName());
|
||||
String presId = generatePresentationId(presentationId);
|
||||
String newFilename = createNewFilename(presId, filenameExt);
|
||||
|
||||
File uploadDir = createPresentationDirectory(destinationMeetingId,
|
||||
presentationDir, presId);
|
||||
String newFilePath = uploadDir.getAbsolutePath()
|
||||
+ File.separatorChar + newFilename;
|
||||
|
||||
pageExtractor.extractPage(sourcePresentationFile, new File(
|
||||
newFilePath), presentationSlide);
|
||||
|
||||
File pres = new File(newFilePath);
|
||||
processUploadedFile(destinationMeetingId, presId, "default-"
|
||||
+ presentationSlide.toString() + "." + filenameExt, pres);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,16 +76,14 @@ public class PresentationUrlDownloadService {
|
||||
return DigestUtils.shaHex(name) + "-" + timestamp;
|
||||
}
|
||||
|
||||
public String getFilenameExt(String filename) {
|
||||
return filename.substring(filename.lastIndexOf("."));
|
||||
}
|
||||
|
||||
public String createNewFilename(String presId, String fileExt) {
|
||||
return presId + fileExt;
|
||||
return presId + "." + fileExt;
|
||||
}
|
||||
|
||||
public File createPresentationDirectory(String meetingId, String presentationDir, String presentationId) {
|
||||
String meetingPath = presentationDir + File.separatorChar + meetingId + File.separatorChar + meetingId;
|
||||
public File createPresentationDirectory(String meetingId,
|
||||
String presentationDir, String presentationId) {
|
||||
String meetingPath = presentationDir + File.separatorChar + meetingId
|
||||
+ File.separatorChar + meetingId;
|
||||
String presPath = meetingPath + File.separatorChar + presentationId;
|
||||
File dir = new File(presPath);
|
||||
log.debug("Creating dir [{}]", presPath);
|
||||
@ -80,77 +93,8 @@ public class PresentationUrlDownloadService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String followRedirect(String meetingId, String redirectUrl,
|
||||
int redirectCount, String origUrl) {
|
||||
|
||||
if (redirectCount > maxRedirects) {
|
||||
log.error("Max redirect reached for meeting=[{}] with url=[{}]", meetingId, origUrl);
|
||||
return null;
|
||||
}
|
||||
|
||||
URL presUrl;
|
||||
try {
|
||||
presUrl = new URL(redirectUrl);
|
||||
} catch (MalformedURLException e) {
|
||||
log.error("Malformed url=[{}] for meeting=[{}]", redirectUrl, meetingId);
|
||||
return null;
|
||||
}
|
||||
|
||||
HttpURLConnection conn;
|
||||
try {
|
||||
conn = (HttpURLConnection) presUrl.openConnection();
|
||||
conn.setReadTimeout(5000);
|
||||
conn.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
|
||||
conn.addRequestProperty("User-Agent", "Mozilla");
|
||||
|
||||
// normally, 3xx is redirect
|
||||
int status = conn.getResponseCode();
|
||||
if (status != HttpURLConnection.HTTP_OK) {
|
||||
if (status == HttpURLConnection.HTTP_MOVED_TEMP
|
||||
|| status == HttpURLConnection.HTTP_MOVED_PERM
|
||||
|| status == HttpURLConnection.HTTP_SEE_OTHER) {
|
||||
String newUrl = conn.getHeaderField("Location");
|
||||
return followRedirect(meetingId, newUrl, redirectCount + 1, origUrl);
|
||||
} else {
|
||||
log.error("Invalid HTTP response=[{}] for url=[{}] with meeting[{}]", status, redirectUrl, meetingId);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return redirectUrl;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("IOException for url=[{}] with meeting[{}]", redirectUrl, meetingId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean savePresentation(final String meetingId, final String filename,
|
||||
final String urlString) {
|
||||
|
||||
String finalUrl = followRedirect(meetingId, urlString, 0, urlString);
|
||||
|
||||
if (finalUrl == null) return false;
|
||||
|
||||
boolean success = false;
|
||||
GetMethod method = new GetMethod(finalUrl);
|
||||
HttpClient client = new HttpClient();
|
||||
try {
|
||||
int statusCode = client.executeMethod(method);
|
||||
if (statusCode == HttpStatus.SC_OK) {
|
||||
FileUtils.copyInputStreamToFile(
|
||||
method.getResponseBodyAsStream(), new File(filename));
|
||||
log.info("Downloaded presentation at [{}]", finalUrl);
|
||||
success = true;
|
||||
}
|
||||
} catch (HttpException e) {
|
||||
log.error("HttpException while downloading presentation at [{}]", finalUrl);
|
||||
} catch (IOException e) {
|
||||
log.error("IOException while downloading presentation at [{}]", finalUrl);
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
|
||||
return success;
|
||||
public void setPageExtractor(PageExtractor extractor) {
|
||||
this.pageExtractor = extractor;
|
||||
}
|
||||
|
||||
public void setPresentationDir(String presDir) {
|
||||
@ -161,9 +105,9 @@ public class PresentationUrlDownloadService {
|
||||
presentationBaseURL = presentationBaseUrl;
|
||||
}
|
||||
|
||||
public void setDocumentConversionService(DocumentConversionService documentConversionService) {
|
||||
public void setDocumentConversionService(
|
||||
DocumentConversionService documentConversionService) {
|
||||
this.documentConversionService = documentConversionService;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,12 +20,14 @@
|
||||
package org.bigbluebutton.presentation.imp;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bigbluebutton.presentation.PageExtractor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class GhostscriptPageExtractor implements PageExtractor {
|
||||
private static Logger log = LoggerFactory.getLogger(GhostscriptPageExtractor.class);
|
||||
private static Logger log = LoggerFactory
|
||||
.getLogger(GhostscriptPageExtractor.class);
|
||||
|
||||
private String GHOSTSCRIPT_EXEC;
|
||||
private String noPdfMarkWorkaround;
|
||||
@ -38,11 +40,13 @@ public class GhostscriptPageExtractor implements PageExtractor {
|
||||
String DESTINATION = output.getAbsolutePath();
|
||||
String OUTPUT_FILE = "-sOutputFile=" + DESTINATION;
|
||||
|
||||
//extract that specific page and create a temp-pdf(only one page) with GhostScript
|
||||
String COMMAND = GHOSTSCRIPT_EXEC + SPACE + OPTIONS + SPACE + FIRST_PAGE + SPACE + LAST_PAGE + SPACE
|
||||
+ OUTPUT_FILE + SPACE + noPdfMarkWorkaround + SPACE + presentationFile.getAbsolutePath();
|
||||
// extract that specific page and create a temp-pdf(only one page) with
|
||||
// GhostScript
|
||||
String COMMAND = GHOSTSCRIPT_EXEC + SPACE + OPTIONS + SPACE
|
||||
+ FIRST_PAGE + SPACE + LAST_PAGE + SPACE + OUTPUT_FILE + SPACE
|
||||
+ noPdfMarkWorkaround + SPACE
|
||||
+ presentationFile.getAbsolutePath();
|
||||
|
||||
log.debug(COMMAND);
|
||||
return new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user