diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala
index 0b033cf065..6974fad223 100755
--- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala
+++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala
@@ -9,12 +9,25 @@ import org.bigbluebutton.common2.domain.DefaultProps
body: CreateMeetingReqMsgBody) extends BbbCoreMsg
case class CreateMeetingReqMsgBody(props: DefaultProps)
+ object DestroyMeetingSysCmdMsg { val NAME = "DestroyMeetingSysCmdMsg" }
+ case class DestroyMeetingSysCmdMsg(header: BbbCoreBaseHeader,
+ body: DestroyMeetingSysCmdMsgBody) extends BbbCoreMsg
+ case class DestroyMeetingSysCmdMsgBody(meetingId: String)
+
+ object EndMeetingSysCmdMsg { val NAME = "DestroyMeetingReqMsg" }
+ case class EndMeetingSysCmdMsg(header: BbbCoreBaseHeader,
+ body: EndMeetingSysCmdMsgBody) extends BbbCoreMsg
+ case class EndMeetingSysCmdMsgBody(meetingId: String)
object GetAllMeetingsReqMsg { val NAME = "GetAllMeetingsReqMsg" }
case class GetAllMeetingsReqMsg(header: BbbCoreBaseHeader,
body: GetAllMeetingsReqMsgBody) extends BbbCoreMsg
case class GetAllMeetingsReqMsgBody(requesterId: String)
+ object PubSubPingSysReqMsg { val NAME = "PubSubPingSysReqMsg" }
+ case class PubSubPingSysReqMsg(header: BbbCoreBaseHeader,
+ body: PubSubPingSysReqMsgBody) extends BbbCoreMsg
+ case class PubSubPingSysReqMsgBody(system: String, timestamp: Long)
/** Response Messages **/
object MeetingCreatedEvtMsg { val NAME = "MeetingCreatedEvtMsg"}
@@ -22,12 +35,27 @@ import org.bigbluebutton.common2.domain.DefaultProps
body: MeetingCreatedEvtBody) extends BbbCoreMsg
case class MeetingCreatedEvtBody(props: DefaultProps)
+ object MeetingEndedEvtMsg { val NAME = "MeetingEndedEvtMsg"}
+ case class MeetingEndedEvtMsg(header: BbbCoreBaseHeader,
+ body: MeetingEndedEvtMsgBody) extends BbbCoreMsg
+ case class MeetingEndedEvtMsgBody(meetingId: String)
- object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"}
+ object MeetingDestroyedEvtMsg { val NAME = "MeetingDestroyedEvtMsg"}
+ case class MeetingDestroyedEvtMsg(header: BbbCoreBaseHeader,
+ body: MeetingDestroyedEvtMsgBody) extends BbbCoreMsg
+ case class MeetingDestroyedEvtMsgBody(meetingId: String)
+
+
+
+object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"}
case class SyncGetMeetingInfoRespMsg(header: BbbCoreBaseHeader,
body: SyncGetMeetingInfoRespMsgBody) extends BbbCoreMsg
case class SyncGetMeetingInfoRespMsgBody(props: DefaultProps)
+ object PubSubPongSysRespMsg { val NAME = "PubSubPongSysRespMsg" }
+ case class PubSubPongSysRespMsg(header: BbbCoreBaseHeader,
+ body: PubSubPongSysRespMsgBody) extends BbbCoreMsg
+ case class PubSubPongSysRespMsgBody(system: String, timestamp: Long)
/** System Messages **/
case class AkkaAppsCheckAliveReqBody(timestamp: Long)
diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/IReceivedOldMessageHandler.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/IReceivedOldMessageHandler.java
index 10c99a8683..3123e0d959 100755
--- a/bbb-common-web/src/main/java/org/bigbluebutton/api/IReceivedOldMessageHandler.java
+++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/IReceivedOldMessageHandler.java
@@ -1,5 +1,7 @@
package org.bigbluebutton.api;
+import org.bigbluebutton.api.messaging.messages.IMessage;
+
public interface IReceivedOldMessageHandler {
- void handleMessage(String pattern, String channel, String message);
+ void handleMessage(IMessage msg);
}
diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
index b531f72370..8a6baccdfe 100755
--- a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
+++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
@@ -1,20 +1,19 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
- *
+ *
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
- *
+ *
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
- *
+ *
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see .
- *
*/
package org.bigbluebutton.api;
@@ -42,6 +41,9 @@ import org.bigbluebutton.api.domain.*;
import org.bigbluebutton.api.messaging.MessageListener;
import org.bigbluebutton.api.messaging.MessagingConstants;
import org.bigbluebutton.api.messaging.MessagingService;
+import org.bigbluebutton.api.messaging.RedisStorageService;
+import org.bigbluebutton.api.messaging.converters.messages.DestroyMeetingMessage;
+import org.bigbluebutton.api.messaging.converters.messages.EndMeetingMessage;
import org.bigbluebutton.api.messaging.messages.CreateBreakoutRoom;
import org.bigbluebutton.api.messaging.messages.CreateMeeting;
import org.bigbluebutton.api.messaging.messages.EndBreakoutRoom;
@@ -62,6 +64,8 @@ import org.bigbluebutton.api.messaging.messages.UserStatusChanged;
import org.bigbluebutton.api.messaging.messages.UserUnsharedWebcam;
import org.bigbluebutton.api.pub.IPublisherService;
import org.bigbluebutton.api2.IBbbWebApiGWApp;
+import org.bigbluebutton.common.messages.Constants;
+import org.bigbluebutton.common.messages.SendStunTurnInfoReplyMessage;
import org.bigbluebutton.presentation.PresentationUrlDownloadService;
import org.bigbluebutton.api.messaging.messages.StunTurnInfoRequested;
import org.bigbluebutton.web.services.RegisteredUserCleanupTimerTask;
@@ -74,877 +78,884 @@ import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
public class MeetingService implements MessageListener {
- private static Logger log = LoggerFactory.getLogger(MeetingService.class);
+ private static Logger log = LoggerFactory.getLogger(MeetingService.class);
- private BlockingQueue receivedMessages = new LinkedBlockingQueue();
- private volatile boolean processMessage = false;
+ private BlockingQueue receivedMessages = new LinkedBlockingQueue();
+ private volatile boolean processMessage = false;
- private final Executor msgProcessorExec = Executors
- .newSingleThreadExecutor();
- private final Executor runExec = Executors.newSingleThreadExecutor();
+ private final Executor msgProcessorExec = Executors.newSingleThreadExecutor();
+ private final Executor runExec = Executors.newSingleThreadExecutor();
- /**
- * http://ria101.wordpress.com/2011/12/12/concurrenthashmap-avoid-a-common-
- * misuse/
- */
- private final ConcurrentMap meetings;
- private final ConcurrentMap sessions;
+ /**
+ * http://ria101.wordpress.com/2011/12/12/concurrenthashmap-avoid-a-common-misuse/
+ */
+ private final ConcurrentMap meetings;
+ private final ConcurrentMap sessions;
- private RecordingService recordingService;
- private MessagingService messagingService;
- private RegisteredUserCleanupTimerTask registeredUserCleaner;
- private StunTurnService stunTurnService;
+ private RecordingService recordingService;
+ private RegisteredUserCleanupTimerTask registeredUserCleaner;
+ private StunTurnService stunTurnService;
+ private RedisStorageService storeService;
- private ParamsProcessorUtil paramsProcessorUtil;
- private PresentationUrlDownloadService presDownloadService;
+ private ParamsProcessorUtil paramsProcessorUtil;
+ private PresentationUrlDownloadService presDownloadService;
- private IBbbWebApiGWApp gw;
+ private IBbbWebApiGWApp gw;
- public MeetingService() {
- meetings = new ConcurrentHashMap(8, 0.9f, 1);
- sessions = new ConcurrentHashMap(8, 0.9f, 1);
+ public MeetingService() {
+ meetings = new ConcurrentHashMap(8, 0.9f, 1);
+ sessions = new ConcurrentHashMap(8, 0.9f, 1);
+ }
+
+ public void addUserSession(String token, UserSession user) {
+ sessions.put(token, user);
+ }
+
+ public void registerUser(String meetingID, String internalUserId,
+ String fullname, String role, String externUserID,
+ String authToken, String avatarURL, Boolean guest, Boolean authed) {
+ handle(new RegisterUser(meetingID, internalUserId, fullname, role,
+ externUserID, authToken, avatarURL, guest, authed));
+ }
+
+ public UserSession getUserSession(String token) {
+ return sessions.get(token);
+ }
+
+ public UserSession removeUserSession(String token) {
+ UserSession user = sessions.remove(token);
+ if (user != null) {
+ log.debug("Found user [" + user.fullname + "] token=[" + token
+ + "] to meeting [" + user.meetingID + "]");
}
+ return user;
+ }
- public void addUserSession(String token, UserSession user) {
- sessions.put(token, user);
- }
+ /**
+ * Remove registered users who did not successfully joined the meeting.
+ */
+ public void purgeRegisteredUsers() {
+ for (AbstractMap.Entry entry : this.meetings.entrySet()) {
+ Long now = System.nanoTime();
+ Meeting meeting = entry.getValue();
- public void registerUser(String meetingID, String internalUserId,
- String fullname, String role, String externUserID,
- String authToken, String avatarURL, Boolean guest, Boolean authed) {
- handle(new RegisterUser(meetingID, internalUserId, fullname, role,
- externUserID, authToken, avatarURL, guest, authed));
- }
+ ConcurrentMap users = meeting.getUsersMap();
- public UserSession getUserSession(String token) {
- return sessions.get(token);
- }
+ for (AbstractMap.Entry registeredUser : meeting.getRegisteredUsers().entrySet()) {
+ String registeredUserID = registeredUser.getKey();
+ Long registeredUserDate = registeredUser.getValue();
- public UserSession removeUserSession(String token) {
- UserSession user = sessions.remove(token);
- if (user != null) {
- log.debug("Found user [" + user.fullname + "] token=[" + token
- + "] to meeting [" + user.meetingID + "]");
+ long registrationTime = registeredUserDate.longValue();
+ long elapsedTime = now - registrationTime;
+ if (elapsedTime >= 60000
+ && !users.containsKey(registeredUserID)) {
+ meeting.userUnregistered(registeredUserID);
}
- return user;
+ }
+ }
+ }
+
+ private void kickOffProcessingOfRecording(Meeting m) {
+ if (m.isRecord() && m.getNumUsers() == 0) {
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ logData.put("name", m.getName());
+ logData.put("event", "kick_off_ingest_and_processing");
+ logData.put("description", "Start processing of recording.");
+
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
+
+ log.info("Initiate recording processing: data={}", logStr);
+
+ processRecording(m.getInternalId());
+ }
+ }
+
+ private void processMeetingForRemoval(Meeting m) {
+ kickOffProcessingOfRecording(m);
+ destroyMeeting(m.getInternalId());
+ meetings.remove(m.getInternalId());
+ removeUserSessions(m.getInternalId());
+ }
+
+ private void removeUserSessions(String meetingId) {
+ Iterator> iterator = sessions.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry entry = iterator.next();
+ UserSession userSession = entry.getValue();
+
+ if (userSession.meetingID.equals(meetingId)) {
+ iterator.remove();
+ }
+ }
+ }
+
+ private void destroyMeeting(String meetingId) {
+ gw.destroyMeeting(new DestroyMeetingMessage(meetingId));
+ }
+
+ public Collection getMeetings() {
+ return meetings.isEmpty() ? Collections.emptySet()
+ : Collections.unmodifiableCollection(meetings.values());
+ }
+
+ public Collection getSessions() {
+ return sessions.isEmpty() ? Collections.emptySet()
+ : Collections.unmodifiableCollection(sessions.values());
+ }
+
+ public synchronized boolean createMeeting(Meeting m) {
+ String internalMeetingId = paramsProcessorUtil.convertToInternalMeetingId(m.getExternalId());
+ Meeting existing = getNotEndedMeetingWithId(internalMeetingId);
+ if (existing == null) {
+ meetings.put(m.getInternalId(), m);
+ handle(new CreateMeeting(m));
+ return true;
}
- /**
- * Remove registered users who did not successfully joined the meeting.
- */
- public void purgeRegisteredUsers() {
- for (AbstractMap.Entry entry : this.meetings
- .entrySet()) {
- Long now = System.nanoTime();
- Meeting meeting = entry.getValue();
+ return false;
+ }
- ConcurrentMap users = meeting.getUsersMap();
-
- for (AbstractMap.Entry 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)) {
- meeting.userUnregistered(registeredUserID);
- }
- }
- }
+ private void handleCreateMeeting(Meeting m) {
+ if (m.isBreakout()) {
+ Meeting parent = meetings.get(m.getParentMeetingId());
+ parent.addBreakoutRoom(m.getExternalId());
+ if (parent.isRecord()) {
+ storeService.addBreakoutRoom(parent.getInternalId(), m.getInternalId());
+ }
}
- private void kickOffProcessingOfRecording(Meeting m) {
- if (m.isRecord() && m.getNumUsers() == 0) {
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- logData.put("name", m.getName());
- logData.put("event", "kick_off_ingest_and_processing");
- logData.put("description", "Start processing of recording.");
+ if (m.isRecord()) {
+ Map metadata = new TreeMap();
+ metadata.putAll(m.getMetadata());
+ // TODO: Need a better way to store these values for recordings
+ metadata.put("meetingId", m.getExternalId());
+ metadata.put("meetingName", m.getName());
+ metadata.put("isBreakout", m.isBreakout().toString());
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
+ storeService.recordMeetingInfo(m.getInternalId(), metadata);
- log.info("Initiate recording processing: data={}", logStr);
-
- processRecording(m.getInternalId());
- }
+ if (m.isBreakout()) {
+ Map breakoutMetadata = new TreeMap();
+ breakoutMetadata.put("meetingId", m.getExternalId());
+ breakoutMetadata.put("sequence", m.getSequence().toString());
+ breakoutMetadata.put("parentMeetingId", m.getParentMeetingId());
+ storeService.recordBreakoutInfo(m.getInternalId(), breakoutMetadata);
+ }
}
- private void processMeetingForRemoval(Meeting m) {
- kickOffProcessingOfRecording(m);
- destroyMeeting(m.getInternalId());
- meetings.remove(m.getInternalId());
- removeUserSessions(m.getInternalId());
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ if (m.isBreakout()) {
+ logData.put("sequence", m.getSequence());
+ logData.put("parentMeetingId", m.getParentMeetingId());
+ }
+ logData.put("name", m.getName());
+ logData.put("duration", m.getDuration());
+ logData.put("isBreakout", m.isBreakout());
+ logData.put("record", m.isRecord());
+ logData.put("event", "create_meeting");
+ logData.put("description", "Create meeting.");
+
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
+
+ log.info("Create meeting: data={}", logStr);
+
+ gw.createMeeting(m.getInternalId(), m.getExternalId(),
+ m.getParentMeetingId(), m.getName(), m.isRecord(),
+ m.getTelVoice(), m.getDuration(), m.getAutoStartRecording(),
+ m.getAllowStartStopRecording(), m.getWebcamsOnlyForModerator(),
+ m.getModeratorPassword(), m.getViewerPassword(),
+ m.getCreateTime(), formatPrettyDate(m.getCreateTime()),
+ m.isBreakout(), m.getSequence(), m.getMetadata(), m.getGuestPolicy(), m.getWelcomeMessageTemplate(),
+ m.getWelcomeMessage(), m.getModeratorOnlyMessage(), m.getDialNumber(), m.getMaxUsers());
+
+ }
+
+ private String formatPrettyDate(Long timestamp) {
+ return new Date(timestamp).toString();
+ }
+
+ private void processCreateMeeting(CreateMeeting message) {
+ handleCreateMeeting(message.meeting);
+ }
+
+ private void processRegisterUser(RegisterUser message) {
+ gw.registerUser(message.meetingID,
+ message.internalUserId, message.fullname, message.role,
+ message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed);
+
+ gw.registerUser(message.meetingID,
+ message.internalUserId, message.fullname, message.role,
+ message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed);
+ }
+
+ public Meeting getMeeting(String meetingId) {
+ if (meetingId == null)
+ return null;
+ for (String key : meetings.keySet()) {
+ if (key.startsWith(meetingId))
+ return (Meeting) meetings.get(key);
}
- private void removeUserSessions(String meetingId) {
- Iterator> iterator = sessions.entrySet()
- .iterator();
- while (iterator.hasNext()) {
- Map.Entry entry = iterator.next();
- UserSession userSession = entry.getValue();
+ return null;
+ }
- if (userSession.meetingID.equals(meetingId)) {
- iterator.remove();
- }
- }
+ public Collection getMeetingsWithId(String meetingId) {
+ if (meetingId == null)
+ return Collections.emptySet();
+
+ Collection m = new HashSet();
+
+ for (String key : meetings.keySet()) {
+ if (key.startsWith(meetingId))
+ m.add(meetings.get(key));
}
- private void destroyMeeting(String meetingID) {
- messagingService.destroyMeeting(meetingID);
+ return m;
+ }
+
+ public Meeting getNotEndedMeetingWithId(String meetingId) {
+ if (meetingId == null)
+ return null;
+ for (String key : meetings.keySet()) {
+ if (key.startsWith(meetingId)) {
+ Meeting m = (Meeting) meetings.get(key);
+ if (!m.isForciblyEnded())
+ return m;
+ }
}
- public Collection getMeetings() {
- return meetings.isEmpty() ? Collections. emptySet()
- : Collections.unmodifiableCollection(meetings.values());
- }
+ return null;
+ }
- public Collection getSessions() {
- return sessions.isEmpty() ? Collections. emptySet()
- : Collections.unmodifiableCollection(sessions.values());
- }
+ public List getRecordingsMetadata(List idList, List states) {
+ List recsList = recordingService.getRecordingsMetadata(idList, states);
+ return recsList;
+ }
- public synchronized boolean createMeeting(Meeting m) {
- String internalMeetingId = paramsProcessorUtil.convertToInternalMeetingId(m.getExternalId());
- Meeting existing = getNotEndedMeetingWithId(internalMeetingId);
- if (existing == null) {
- meetings.put(m.getInternalId(), m);
- handle(new CreateMeeting(m));
- return true;
+
+ public Map getRecordings(List idList, List states) {
+ List recsList = recordingService.getRecordings(idList, states);
+ Map recs = reorderRecordings(recsList);
+ return recs;
+ }
+
+ public List filterRecordingsByMetadata(List recsList,
+ Map metadataFilters) {
+ return recordingService.filterRecordingsByMetadata(recsList, metadataFilters);
+ }
+
+ public Map filterRecordingsByMetadata(Map recordings,
+ Map metadataFilters) {
+ return recordingService.filterRecordingsByMetadata(recordings, metadataFilters);
+ }
+
+
+ public Map reorderRecordings(List olds) {
+ Map map = new HashMap();
+ for (Recording r : olds) {
+ if (!map.containsKey(r.getId())) {
+ Map meta = r.getMetadata();
+ String mid = meta.remove("meetingId");
+ String name = meta.remove("meetingName");
+
+ r.setMeetingID(mid);
+ r.setName(name);
+
+ List plays = new ArrayList();
+
+ if (r.getPlaybackFormat() != null) {
+ plays.add(new Playback(r.getPlaybackFormat(), r.getPlaybackLink(),
+ getDurationRecording(r.getPlaybackDuration(), r.getEndTime(),
+ r.getStartTime()), r.getPlaybackSize(), r.getProcessingTime(), r.getPlaybackExtensions()));
}
- return false;
+ r.setPlaybacks(plays);
+
+ ArrayList downloads = new ArrayList();
+
+ if (r.getDownloadFormat() != null) {
+ downloads.add(new Download(r.getDownloadFormat(), r.getDownloadLink(),
+ r.getDownloadMd5(), r.getDownloadKey(),
+ r.getDownloadSize(),
+ getDurationRecording(r.getEndTime(), r.getStartTime())));
+ }
+ r.setDownloads(downloads);
+
+ map.put(r.getId(), r);
+ } else {
+ Recording rec = map.get(r.getId());
+ if (r.getPlaybackFormat() != null) {
+ rec.getPlaybacks().add(new Playback(r.getPlaybackFormat(), r.getPlaybackLink(),
+ getDurationRecording(r.getPlaybackDuration(), r.getEndTime(), r.getStartTime()),
+ r.getPlaybackSize(), r.getProcessingTime(), r.getPlaybackExtensions()));
+ }
+ if (r.getDownloadFormat() != null) {
+ rec.getDownloads().add(new Download(r.getDownloadFormat(), r.getDownloadLink(), r.getDownloadMd5(),
+ r.getDownloadKey(), r.getDownloadSize(), getDurationRecording(r.getEndTime(), r.getStartTime())));
+ }
+ }
}
- private void handleCreateMeeting(Meeting m) {
- if (m.isBreakout()){
- Meeting parent = meetings.get(m.getParentMeetingId());
- parent.addBreakoutRoom(m.getExternalId());
- if (parent.isRecord()) {
- messagingService.addBreakoutRoom(parent.getInternalId(), m.getInternalId());
- }
- }
+ return map;
+ }
- if (m.isRecord()) {
- Map metadata = new TreeMap();
- metadata.putAll(m.getMetadata());
- // TODO: Need a better way to store these values for recordings
- metadata.put("meetingId", m.getExternalId());
- metadata.put("meetingName", m.getName());
- metadata.put("isBreakout", m.isBreakout().toString());
+ private int getDurationRecording(String end, String start) {
+ return getDurationRecording("", end, start);
+ }
- messagingService.recordMeetingInfo(m.getInternalId(), metadata);
+ private int getDurationRecording(String playbackDuration, String end,
+ String start) {
+ int duration;
+ try {
+ if (!playbackDuration.equals("")) {
+ duration = (int) Math
+ .ceil((Long.parseLong(playbackDuration)) / 60000.0);
+ } else {
+ duration = (int) Math.ceil((Long.parseLong(end) - Long
+ .parseLong(start)) / 60000.0);
+ }
+ } catch (Exception e) {
+ log.debug(e.getMessage());
+ duration = 0;
+ }
- if (m.isBreakout()) {
- Map breakoutMetadata = new TreeMap();
- breakoutMetadata.put("meetingId", m.getExternalId());
- breakoutMetadata.put("sequence", m.getSequence().toString());
- breakoutMetadata.put("parentMeetingId", m.getParentMeetingId());
- messagingService.recordBreakoutInfo(m.getInternalId(), breakoutMetadata);
- }
- }
+ return duration;
+ }
+
+ public boolean existsAnyRecording(List idList) {
+ return recordingService.existAnyRecording(idList);
+ }
+
+ public void setPublishRecording(List idList, boolean publish) {
+ for (String id : idList) {
+ if (publish) {
+ recordingService.changeState(id, Recording.STATE_PUBLISHED);
+ } else {
+ recordingService.changeState(id, Recording.STATE_UNPUBLISHED);
+ }
+ }
+ }
+
+ public void deleteRecordings(List idList) {
+ for (String id : idList) {
+ recordingService.changeState(id, Recording.STATE_DELETED);
+ }
+ }
+
+ public void updateRecordings(List idList, Map metaParams) {
+ recordingService.updateMetaParams(idList, metaParams);
+ }
+
+ public void processRecording(String meetingId) {
+ recordingService.startIngestAndProcessing(meetingId);
+ }
+
+ public boolean isMeetingWithVoiceBridgeExist(String voiceBridge) {
+ /*
+ * Collection confs = meetings.values(); for (Meeting c :
+ * confs) { if (voiceBridge == c.getVoiceBridge()) { return true; } }
+ */
+ return false;
+ }
+
+
+ public void endMeeting(String meetingId) {
+ handle(new EndMeeting(meetingId));
+ }
+
+ private void processCreateBreakoutRoom(CreateBreakoutRoom message) {
+ Meeting parentMeeting = getMeeting(message.parentMeetingId);
+ if (parentMeeting != null) {
+
+ Map params = new HashMap();
+ params.put("name", message.name);
+ params.put("meetingID", message.meetingId);
+ params.put("parentMeetingID", message.parentMeetingId);
+ params.put("isBreakout", "true");
+ params.put("sequence", message.sequence.toString());
+ params.put("attendeePW", message.viewerPassword);
+ params.put("moderatorPW", message.moderatorPassword);
+ params.put("voiceBridge", message.voiceConfId);
+ params.put("duration", message.durationInMinutes.toString());
+ params.put("record", message.record.toString());
+ params.put("welcome", getMeeting(message.parentMeetingId).getWelcomeMessageTemplate());
+
+ Map parentMeetingMetadata = parentMeeting.getMetadata();
+
+ String metaPrefix = "meta_";
+ for (String key : parentMeetingMetadata.keySet()) {
+ String metaName = metaPrefix + key;
+ // Inject metadata from parent meeting into the breakout room.
+ params.put(metaName, parentMeetingMetadata.get(key));
+ }
+
+ Meeting breakout = paramsProcessorUtil.processCreateParams(params);
+
+ createMeeting(breakout);
+
+ presDownloadService.extractPresentationPage(message.parentMeetingId,
+ message.sourcePresentationId,
+ message.sourcePresentationSlide, breakout.getInternalId());
+ } else {
+ log.error(
+ "Failed to create breakout room {}.Reason: Parent meeting {} not found.",
+ message.meetingId, message.parentMeetingId);
+ }
+ }
+
+ private void processEndBreakoutRoom(EndBreakoutRoom message) {
+ processEndMeeting(new EndMeeting(message.breakoutMeetingId));
+ }
+
+ private void processEndMeeting(EndMeeting message) {
+ gw.endMeeting(new EndMeetingMessage(message.meetingId));
+ }
+
+ private void processRemoveEndedMeeting(MeetingEnded message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ m.setForciblyEnded(true);
+ processRecording(m.getInternalId());
+ destroyMeeting(m.getInternalId());
+ meetings.remove(m.getInternalId());
+ removeUserSessions(m.getInternalId());
+ }
+ }
+
+ public void addUserCustomData(String meetingId, String userID,
+ Map userCustomData) {
+ Meeting m = getMeeting(meetingId);
+ if (m != null) {
+ m.addUserCustomData(userID, userCustomData);
+ }
+ }
+
+ private void meetingStarted(MeetingStarted message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ if (m.getStartTime() == 0) {
+ long now = System.currentTimeMillis();
+ m.setStartTime(now);
Map logData = new HashMap();
logData.put("meetingId", m.getInternalId());
logData.put("externalMeetingId", m.getExternalId());
- if (m.isBreakout()){
- logData.put("sequence", m.getSequence());
- logData.put("parentMeetingId", m.getParentMeetingId());
+ if (m.isBreakout()) {
+ logData.put("parentMeetingId", m.getParentMeetingId());
}
logData.put("name", m.getName());
logData.put("duration", m.getDuration());
- logData.put("isBreakout", m.isBreakout());
logData.put("record", m.isRecord());
- logData.put("event", "create_meeting");
- logData.put("description", "Create meeting.");
+ logData.put("isBreakout", m.isBreakout());
+ logData.put("event", "meeting_started");
+ logData.put("description", "Meeting has started.");
Gson gson = new Gson();
String logStr = gson.toJson(logData);
- log.info("Create meeting: data={}", logStr);
+ log.info("Meeting started: data={}", logStr);
+ } else {
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ if (m.isBreakout()) {
+ logData.put("parentMeetingId", m.getParentMeetingId());
+ }
+ logData.put("name", m.getName());
+ logData.put("duration", m.getDuration());
+ logData.put("record", m.isRecord());
+ logData.put("isBreakout", m.isBreakout());
+ logData.put("event", "meeting_restarted");
+ logData.put("description", "Meeting has restarted.");
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
- messagingService.createMeeting(m.getInternalId(), m.getExternalId(),
- m.getParentMeetingId(), m.getName(), m.isRecord(),
- m.getTelVoice(), m.getDuration(), m.getAutoStartRecording(),
- m.getAllowStartStopRecording(), m.getWebcamsOnlyForModerator(),
- m.getModeratorPassword(), m.getViewerPassword(),
- m.getCreateTime(), formatPrettyDate(m.getCreateTime()),
- m.isBreakout(), m.getSequence(), m.getMetadata(), m.getGuestPolicy());
-
- gw.createMeeting(m.getInternalId(), m.getExternalId(),
- m.getParentMeetingId(), m.getName(), m.isRecord(),
- m.getTelVoice(), m.getDuration(), m.getAutoStartRecording(),
- m.getAllowStartStopRecording(), m.getWebcamsOnlyForModerator(),
- m.getModeratorPassword(), m.getViewerPassword(),
- m.getCreateTime(), formatPrettyDate(m.getCreateTime()),
- m.isBreakout(), m.getSequence(), m.getMetadata(), m.getGuestPolicy(), m.getWelcomeMessageTemplate(),
- m.getWelcomeMessage(), m.getModeratorOnlyMessage(), m.getDialNumber(), m.getMaxUsers());
-
+ log.info("Meeting restarted: data={}", logStr);
+ }
+ return;
}
+ }
- private String formatPrettyDate(Long timestamp) {
- return new Date(timestamp).toString();
+ private void meetingDestroyed(MeetingDestroyed message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ long now = System.currentTimeMillis();
+ m.setEndTime(now);
+
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ logData.put("name", m.getName());
+ logData.put("duration", m.getDuration());
+ logData.put("record", m.isRecord());
+ logData.put("event", "meeting_destroyed");
+ logData.put("description", "Meeting has been destroyed.");
+
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
+
+ log.info("Meeting destroyed: data={}", logStr);
+
+ return;
}
+ }
- private void processCreateMeeting(CreateMeeting message) {
- handleCreateMeeting(message.meeting);
+ private void meetingEnded(MeetingEnded message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ long now = System.currentTimeMillis();
+ m.setEndTime(now);
+
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ logData.put("name", m.getName());
+ logData.put("duration", m.getDuration());
+ logData.put("record", m.isRecord());
+ logData.put("event", "meeting_destroyed");
+ logData.put("description", "Meeting has been destroyed.");
+
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
+
+ log.info("Meeting destroyed: data={}", logStr);
+
+ processRemoveEndedMeeting(message);
+
+ return;
}
+ }
- private void processRegisterUser(RegisterUser message) {
- messagingService.registerUser(message.meetingID,
- message.internalUserId, message.fullname, message.role,
- message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed);
+ private void userJoined(UserJoined message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ if (m.getNumUsers() == 0) {
+ // First user joins the meeting. Reset the end time to zero
+ // in case the meeting has been rejoined.
+ m.setEndTime(0);
+ }
- gw.registerUser(message.meetingID,
- message.internalUserId, message.fullname, message.role,
- message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed);
+ User user = new User(message.userId, message.externalUserId,
+ message.name, message.role, message.avatarURL, message.guest, message.waitingForAcceptance);
+ m.userJoined(user);
+
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ logData.put("name", m.getName());
+ logData.put("userId", message.userId);
+ logData.put("externalUserId", user.getExternalUserId());
+ logData.put("username", user.getFullname());
+ logData.put("role", user.getRole());
+ logData.put("guest", user.isGuest());
+ logData.put("waitingForAcceptance", user.isWaitingForAcceptance());
+ logData.put("event", MessagingConstants.USER_JOINED_EVENT);
+ logData.put("description", "User joined the meeting.");
+
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
+ log.info("User joined meeting: data={}", logStr);
+
+ return;
}
+ return;
+ }
- public Meeting getMeeting(String meetingId) {
- if (meetingId == null)
- return null;
- for (String key : meetings.keySet()) {
- if (key.startsWith(meetingId))
- return (Meeting) meetings.get(key);
+ private void userLeft(UserLeft message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ User user = m.userLeft(message.userId);
+ if (user != null) {
+
+ Map logData = new HashMap();
+ logData.put("meetingId", m.getInternalId());
+ logData.put("externalMeetingId", m.getExternalId());
+ logData.put("name", m.getName());
+ logData.put("userId", message.userId);
+ logData.put("externalUserId", user.getExternalUserId());
+ logData.put("username", user.getFullname());
+ logData.put("role", user.getRole());
+ logData.put("guest", user.isGuest());
+ logData.put("waitingForAcceptance", user.isWaitingForAcceptance());
+ logData.put("event", MessagingConstants.USER_LEFT_EVENT);
+ logData.put("description", "User left the meeting.");
+
+ Gson gson = new Gson();
+ String logStr = gson.toJson(logData);
+
+ log.info("User left meeting: data={}", logStr);
+
+ if (m.getNumUsers() == 0) {
+ // Last user the meeting. Mark this as the time
+ // the meeting ended.
+ m.setEndTime(System.currentTimeMillis());
}
- return null;
- }
-
- public Collection getMeetingsWithId(String meetingId) {
- if (meetingId == null)
- return Collections. emptySet();
-
- Collection m = new HashSet();
-
- for (String key : meetings.keySet()) {
- if (key.startsWith(meetingId))
- m.add(meetings.get(key));
- }
-
- return m;
- }
-
- public Meeting getNotEndedMeetingWithId(String meetingId) {
- if (meetingId == null)
- return null;
- for (String key : meetings.keySet()) {
- if (key.startsWith(meetingId)) {
- Meeting m = (Meeting) meetings.get(key);
- if (!m.isForciblyEnded())
- return m;
- }
- }
-
- return null;
- }
-
- public List getRecordingsMetadata(List idList, List states) {
- List recsList = recordingService.getRecordingsMetadata(idList, states);
- return recsList;
- }
-
-
- public Map getRecordings(List idList, List states) {
- List recsList = recordingService.getRecordings(idList, states);
- Map recs = reorderRecordings(recsList);
- return recs;
- }
-
- public List filterRecordingsByMetadata(List recsList,
- Map metadataFilters) {
- return recordingService.filterRecordingsByMetadata(recsList, metadataFilters);
- }
-
- public Map filterRecordingsByMetadata(Map recordings,
- Map metadataFilters) {
- return recordingService.filterRecordingsByMetadata(recordings, metadataFilters);
- }
-
-
-
- public Map reorderRecordings(List olds) {
- Map map = new HashMap();
- for (Recording r : olds) {
- if (!map.containsKey(r.getId())) {
- Map meta = r.getMetadata();
- String mid = meta.remove("meetingId");
- String name = meta.remove("meetingName");
-
- r.setMeetingID(mid);
- r.setName(name);
-
- List plays = new ArrayList();
-
- if (r.getPlaybackFormat() != null) {
- plays.add(new Playback(r.getPlaybackFormat(), r.getPlaybackLink(),
- getDurationRecording(r.getPlaybackDuration(), r.getEndTime(),
- r.getStartTime()), r.getPlaybackSize(), r.getProcessingTime(), r.getPlaybackExtensions()));
- }
-
- r.setPlaybacks(plays);
-
- ArrayList downloads = new ArrayList();
-
- if (r.getDownloadFormat() != null) {
- downloads.add(new Download(r.getDownloadFormat(), r.getDownloadLink(),
- r.getDownloadMd5(), r.getDownloadKey(),
- r.getDownloadSize(),
- getDurationRecording(r.getEndTime(), r.getStartTime())));
- }
- r.setDownloads(downloads);
-
- map.put(r.getId(), r);
- } else {
- Recording rec = map.get(r.getId());
- if (r.getPlaybackFormat() != null) {
- rec.getPlaybacks().add(new Playback(r.getPlaybackFormat(), r.getPlaybackLink(),
- getDurationRecording(r.getPlaybackDuration(), r.getEndTime(), r.getStartTime()),
- r.getPlaybackSize(), r.getProcessingTime(), r.getPlaybackExtensions()));
- }
- if (r.getDownloadFormat() != null) {
- rec.getDownloads().add(new Download(r.getDownloadFormat(), r.getDownloadLink(), r.getDownloadMd5(),
- r.getDownloadKey(), r.getDownloadSize(), getDurationRecording(r.getEndTime(), r.getStartTime())));
- }
- }
- }
-
- return map;
- }
-
- private int getDurationRecording(String end, String start) {
- return getDurationRecording("", end, start);
- }
-
- private int getDurationRecording(String playbackDuration, String end,
- String start) {
- int duration;
- try {
- if (!playbackDuration.equals("")) {
- duration = (int) Math
- .ceil((Long.parseLong(playbackDuration)) / 60000.0);
- } else {
- duration = (int) Math.ceil((Long.parseLong(end) - Long
- .parseLong(start)) / 60000.0);
- }
- } catch (Exception e) {
- log.debug(e.getMessage());
- duration = 0;
- }
-
- return duration;
- }
-
- public boolean existsAnyRecording(List idList) {
- return recordingService.existAnyRecording(idList);
- }
-
- public void setPublishRecording(List idList, boolean publish) {
- for (String id : idList) {
- if (publish) {
- recordingService.changeState(id, Recording.STATE_PUBLISHED);
- } else {
- recordingService.changeState(id, Recording.STATE_UNPUBLISHED);
- }
- }
- }
-
- public void deleteRecordings(List idList) {
- for (String id : idList) {
- recordingService.changeState(id, Recording.STATE_DELETED);
- }
- }
-
- public void updateRecordings(List idList, Map metaParams) {
- recordingService.updateMetaParams(idList, metaParams);
- }
-
- public void processRecording(String meetingId) {
- recordingService.startIngestAndProcessing(meetingId);
- }
-
- public boolean isMeetingWithVoiceBridgeExist(String voiceBridge) {
- /*
- * Collection confs = meetings.values(); for (Meeting c :
- * confs) { if (voiceBridge == c.getVoiceBridge()) { return true; } }
- */return false;
- }
-
- public void send(String channel, String message) {
- messagingService.send(channel, message);
- }
-
- public void endMeeting(String meetingId) {
- handle(new EndMeeting(meetingId));
- }
-
- private void processCreateBreakoutRoom(CreateBreakoutRoom message) {
- Meeting parentMeeting = getMeeting(message.parentMeetingId);
- if (parentMeeting != null) {
-
- Map params = new HashMap();
- params.put("name", message.name);
- params.put("meetingID", message.meetingId);
- params.put("parentMeetingID", message.parentMeetingId);
- params.put("isBreakout", "true");
- params.put("sequence", message.sequence.toString());
- params.put("attendeePW", message.viewerPassword);
- params.put("moderatorPW", message.moderatorPassword);
- params.put("voiceBridge", message.voiceConfId);
- params.put("duration", message.durationInMinutes.toString());
- params.put("record", message.record.toString());
- params.put("welcome", getMeeting(message.parentMeetingId)
- .getWelcomeMessageTemplate());
-
- Map parentMeetingMetadata = parentMeeting
- .getMetadata();
-
- String metaPrefix = "meta_";
- for (String key : parentMeetingMetadata.keySet()) {
- String metaName = metaPrefix + key;
- // Inject metadata from parent meeting into the breakout room.
- params.put(metaName, parentMeetingMetadata.get(key));
- }
-
- Meeting breakout = paramsProcessorUtil.processCreateParams(params);
-
- createMeeting(breakout);
-
- presDownloadService.extractPresentationPage(message.parentMeetingId,
- message.sourcePresentationId,
- message.sourcePresentationSlide, breakout.getInternalId());
+ Long userRegistered = m.userUnregistered(message.userId);
+ if (userRegistered != null) {
+ log.info("User unregistered from meeting");
} else {
- log.error(
- "Failed to create breakout room {}.Reason: Parent meeting {} not found.",
- message.meetingId, message.parentMeetingId);
+ log.info("User was not unregistered from meeting because it was not found");
}
- }
- private void processEndBreakoutRoom(EndBreakoutRoom message) {
- processEndMeeting(new EndMeeting(message.breakoutMeetingId));
- }
-
- private void processEndMeeting(EndMeeting message) {
- messagingService.endMeeting(message.meetingId);
- }
-
- private void processRemoveEndedMeeting(MeetingEnded message) {
- Meeting m = getMeeting(message.meetingId);
- if (m != null) {
- m.setForciblyEnded(true);
- processRecording(m.getInternalId());
- destroyMeeting(m.getInternalId());
- meetings.remove(m.getInternalId());
- removeUserSessions(m.getInternalId());
- }
- }
-
- public void addUserCustomData(String meetingId, String userID,
- Map userCustomData) {
- Meeting m = getMeeting(meetingId);
- if (m != null) {
- m.addUserCustomData(userID, userCustomData);
- }
- }
-
- private void meetingStarted(MeetingStarted message) {
- Meeting m = getMeeting(message.meetingId);
- if (m != null) {
- if (m.getStartTime() == 0) {
- long now = System.currentTimeMillis();
- m.setStartTime(now);
-
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- if (m.isBreakout()) {
- logData.put("parentMeetingId", m.getParentMeetingId());
- }
- logData.put("name", m.getName());
- logData.put("duration", m.getDuration());
- logData.put("record", m.isRecord());
- logData.put("isBreakout", m.isBreakout());
- logData.put("event", "meeting_started");
- logData.put("description", "Meeting has started.");
-
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
-
- log.info("Meeting started: data={}", logStr);
- } else {
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- if (m.isBreakout()) {
- logData.put("parentMeetingId", m.getParentMeetingId());
- }
- logData.put("name", m.getName());
- logData.put("duration", m.getDuration());
- logData.put("record", m.isRecord());
- logData.put("isBreakout", m.isBreakout());
- logData.put("event", "meeting_restarted");
- logData.put("description", "Meeting has restarted.");
-
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
-
- log.info("Meeting restarted: data={}", logStr);
- }
- return;
- }
- }
-
- private void meetingDestroyed(MeetingDestroyed message) {
- Meeting m = getMeeting(message.meetingId);
- if (m != null) {
- long now = System.currentTimeMillis();
- m.setEndTime(now);
-
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- logData.put("name", m.getName());
- logData.put("duration", m.getDuration());
- logData.put("record", m.isRecord());
- logData.put("event", "meeting_destroyed");
- logData.put("description", "Meeting has been destroyed.");
-
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
-
- log.info("Meeting destroyed: data={}", logStr);
-
- return;
- }
- }
-
- private void meetingEnded(MeetingEnded message) {
- Meeting m = getMeeting(message.meetingId);
- if (m != null) {
- long now = System.currentTimeMillis();
- m.setEndTime(now);
-
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- logData.put("name", m.getName());
- logData.put("duration", m.getDuration());
- logData.put("record", m.isRecord());
- logData.put("event", "meeting_destroyed");
- logData.put("description", "Meeting has been destroyed.");
-
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
-
- log.info("Meeting destroyed: data={}", logStr);
-
- processRemoveEndedMeeting(message);
-
- return;
- }
- }
-
- private void userJoined(UserJoined message) {
- Meeting m = getMeeting(message.meetingId);
- if (m != null) {
- if (m.getNumUsers() == 0) {
- // First user joins the meeting. Reset the end time to zero
- // in case the meeting has been rejoined.
- m.setEndTime(0);
- }
-
- User user = new User(message.userId, message.externalUserId,
- message.name, message.role, message.avatarURL, message.guest, message.waitingForAcceptance);
- m.userJoined(user);
-
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- logData.put("name", m.getName());
- logData.put("userId", message.userId);
- logData.put("externalUserId", user.getExternalUserId());
- logData.put("username", user.getFullname());
- logData.put("role", user.getRole());
- logData.put("guest", user.isGuest());
- logData.put("waitingForAcceptance", user.isWaitingForAcceptance());
- logData.put("event", MessagingConstants.USER_JOINED_EVENT);
- logData.put("description", "User joined the meeting.");
-
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
- log.info("User joined meeting: data={}", logStr);
-
- return;
- }
return;
+ }
+
+ return;
+ }
+ }
+
+ private void updatedStatus(UserStatusChanged message) {
+ Meeting m = getMeeting(message.meetingId);
+ if (m != null) {
+ User user = m.getUserById(message.userId);
+ if (user != null) {
+ user.setStatus(message.status, message.value);
+ return;
+ }
+ return;
+ }
+ }
+
+ @Override
+ public void handle(IMessage message) {
+ receivedMessages.add(message);
+ }
+
+ public void setParamsProcessorUtil(ParamsProcessorUtil util) {
+ this.paramsProcessorUtil = util;
+ }
+
+ public void setPresDownloadService(
+ PresentationUrlDownloadService presDownloadService) {
+ this.presDownloadService = presDownloadService;
+ }
+
+ private void processStunTurnInfoRequested(StunTurnInfoRequested message) {
+ Set stuns = stunTurnService.getStunServers();
+ log.info("\nhere are the stuns:");
+ for (StunServer s : stuns) {
+ log.info("a stun: " + s.url);
+ }
+ Set turns = stunTurnService.getStunAndTurnServersFor(message.internalUserId);
+
+ log.info("\nhere are the (" + turns.size() + ") turns for internalUserId:" + message.internalUserId);
+ for (TurnEntry t : turns) {
+ log.info("a org.bigbluebutton.web.services.turn: " + t.url + "username/pass=" + t.username + '/'
+ + t.password);
}
- private void userLeft(UserLeft message) {
- Meeting m = getMeeting(message.meetingId);
- if (m != null) {
- User user = m.userLeft(message.userId);
- if (user != null) {
+ ArrayList stunsArrayList = new ArrayList();
+ Iterator stunsIter = stuns.iterator();
- Map logData = new HashMap();
- logData.put("meetingId", m.getInternalId());
- logData.put("externalMeetingId", m.getExternalId());
- logData.put("name", m.getName());
- logData.put("userId", message.userId);
- logData.put("externalUserId", user.getExternalUserId());
- logData.put("username", user.getFullname());
- logData.put("role", user.getRole());
- logData.put("guest", user.isGuest());
- logData.put("waitingForAcceptance", user.isWaitingForAcceptance());
- logData.put("event", MessagingConstants.USER_LEFT_EVENT);
- logData.put("description", "User left the meeting.");
+ while (stunsIter.hasNext()) {
+ StunServer aStun = (StunServer) stunsIter.next();
+ if (aStun != null) {
+ stunsArrayList.add(aStun.url);
+ }
+ }
- Gson gson = new Gson();
- String logStr = gson.toJson(logData);
+ ArrayList