Merge branch 'master' of https://github.com/bigbluebutton/bigbluebutton into merge-leonardo-api-changes

Conflicts:
	akka-bbb-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala
	bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MeetingMessageHandler.java
This commit is contained in:
Richard Alam 2015-08-07 15:06:40 +00:00
commit 839473395a
17 changed files with 468 additions and 57 deletions

View File

@ -100,6 +100,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor {
case msg: UserJoined => handleUserJoined(msg)
case msg: UserRaisedHand => handleUserRaisedHand(msg)
case msg: UserLoweredHand => handleUserLoweredHand(msg)
case msg: UserListeningOnly => handleUserListeningOnly(msg)
case msg: UserSharedWebcam => handleUserSharedWebcam(msg)
case msg: UserUnsharedWebcam => handleUserUnsharedWebcam(msg)
case msg: UserStatusChange => handleUserStatusChange(msg)
@ -143,6 +144,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor {
case msg: GetAllMeetingsReply => handleGetAllMeetingsReply(msg)
case _ => // do nothing
}
private def buildUserHashMap(user: UserVO): java.util.HashMap[String, Object] = {
@ -1377,6 +1379,21 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor {
dispatcher.dispatch(buildJson(header, payload))
}
private def handleUserListeningOnly(msg: UserListeningOnly) {
val payload = new java.util.HashMap[String, Any]()
payload.put(Constants.MEETING_ID, msg.meetingID)
payload.put(Constants.USER_ID, msg.userID)
payload.put(Constants.LISTEN_ONLY, msg.listenOnly)
val header = new java.util.HashMap[String, Any]()
header.put(Constants.NAME, MessageNames.USER_LISTEN_ONLY)
header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp)
header.put(Constants.CURRENT_TIME, TimestampGenerator.getCurrentTime)
// println("***** DISPATCHING USER LISTENING ONLY *****************")
dispatcher.dispatch(buildJson(header, payload))
}
private def handleUserSharedWebcam(msg: UserSharedWebcam) {
val payload = new java.util.HashMap[String, Any]()
payload.put(Constants.MEETING_ID, msg.meetingID)

View File

@ -25,6 +25,6 @@ sanjo:jasmine
pagebakers:ionicons
ewall:foundation
maibaum:foundation-icons
gthacoder:sled
chriswessels:hammer@3.1.1
fastclick
gthacoder:sledjs@0.0.1

View File

@ -22,10 +22,9 @@ duongthienduc:meteor-winston@1.0.0
ejson@1.0.6
ewall:foundation@5.5.2
fastclick@1.0.3
fourseven:scss@3.1.1
francocatena:status@1.1.2
geojson-utils@1.0.3
gthacoder:sled@0.0.1
gthacoder:sledjs@0.0.1
html-tools@1.0.4
htmljs@1.0.4
http@1.1.0
@ -77,6 +76,7 @@ session@1.1.0
spacebars@1.0.6
spacebars-compiler@1.0.6
standard-app-packages@1.0.5
stevezhu:sass@2.0.0
tap:i18n@1.3.2
templating@1.1.1
tracker@1.0.7

View File

@ -1,29 +1,34 @@
<template name="header">
<nav id="navbar" class="myNavbar top-bar" role="navigation">
{{> makeButton btn_class="btn toggleUserlistButton navbarButton sl-hamburger sl-ham-la-cw sl-portrait-mobile sl-portrait-keyboard" rel="tooltip" title="Toggle Userlist" span=true notification="all_chats"}}
{{#if amIInAudio}}
{{#if amIListenOnlyAudio}}
{{> makeButton btn_class="navbarButton leaveAudioButton" i_class="icon fi-volume-none" rel="tooltip" title="Exit Audio"}}
{{else}}
{{#if isCurrentUserMuted}}
<!-- if you are muted the button representing your status will show volume off -->
{{> makeButton btn_class="navbarButton muteIcon" i_class="ion-ios-mic-off" rel="tooltip" title="Unmute"}}
{{else}}
{{#if isCurrentUserTalking}}
<!-- you are talking. Display a high volume/volume up representing voice activity -->
{{> makeButton btn_class="navbarButton muteIcon" i_class="ion-ios-mic" rel="tooltip" title="Mute"}}
{{else}}
<!-- you are not talking. Display low volume/volume down representing no voice activity -->
{{> makeButton btn_class="navbarButton muteIcon" i_class="ion-ios-mic-outline" rel="tooltip" title="Mute"}}
{{/if}}
{{/if}}
{{/if}}
{{/if}}
<span class="navbarTitle">
{{getWhiteboardTitle}}
</span>
{{#if amIInAudio}}
<div class="audioNavbarSection">
{{#if amIListenOnlyAudio}}
{{> makeButton btn_class="navbarButton leaveAudioButton" i_class="icon fi-volume-none" rel="tooltip" title="Exit Audio"}}
{{else}}
{{#if isCurrentUserMuted}}
<!-- if you are muted the button representing your status will show volume off -->
{{> makeButton btn_class="navbarButton muteIcon" i_class="ion-ios-mic-off" rel="tooltip" title="Unmute"}}
{{else}}
{{#if isCurrentUserTalking}}
<!-- you are talking. Display a high volume/volume up representing voice activity -->
{{> makeButton btn_class="navbarButton muteIcon" i_class="ion-ios-mic" rel="tooltip" title="Mute"}}
{{else}}
<!-- you are not talking. Display low volume/volume down representing no voice activity -->
{{> makeButton btn_class="navbarButton muteIcon" i_class="ion-ios-mic-outline" rel="tooltip" title="Mute"}}
{{/if}}
{{/if}}
{{/if}}
</div>
<span class="navbarTitle shiftedTitle">
{{getWhiteboardTitle}}
</span>
{{else}}
<span class="navbarTitle defaultTitle">
{{getWhiteboardTitle}}
</span>
{{/if}}
<div class="rightNavbarSection">
{{> makeButton id="settingsIcon" btn_class="settingsIcon navbarButton" i_class="ion-gear-b" rel="tooltip"
@ -32,9 +37,7 @@
{{> makeButton id="logout" btn_class="signOutIcon navbarButton" i_class="ion-log-out" rel="tooltip"
title="Logout"}}
</div>
<button class="btn toggleMenuButton navbarButton sl-hamburger sl-ham-ra-cw sl-portrait-mobile sl-portrait-keyboard">
<span></span>
</button>
{{> makeButton btn_class="btn toggleMenuButton navbarButton sl-hamburger sl-ham-ra-cw sl-portrait-mobile sl-portrait-keyboard" rel="tooltip" title="Toggle Menu" span=true}}
</nav>
</template>

View File

@ -79,7 +79,9 @@ body {
padding-left: 1% !important;
padding-right: 1% !important;
background-color: white;
border-bottom: 1px solid extract(@lightGrey, 1);
&:not(.toggleMenuButton):not(.toggleUserlistButton) {
border-bottom: 1px solid extract(@lightGrey, 1);
}
}
@media @mobile-portrait-with-keyboard, @mobile-portrait {
height: 100px !important;
@ -131,18 +133,12 @@ body {
color: extract(@white, 1);
font-size: 35px;
height: 72px;
max-width: 70%;
margin-left: auto;
margin-right: auto;
height: 110px;
padding-top: 55px; // half the height
padding-left: 30px;
}
@media @desktop-portrait {
max-width: calc(~'100% - 155px'); // navbar width minus the space for 3 buttons
}
@media @landscape {
max-width: calc(~'100% - 125px'); // navbar width minus the space for 4 buttons
padding-right: 30px;
}
@media @landscape, @desktop-portrait {
color: extract(@darkGrey, 1);
@ -150,6 +146,43 @@ body {
height: 50px;
padding-top: 25px; // half the height
padding-left: 15px;
padding-right: 15px;
}
&.defaultTitle {
@media @landscape, @desktop-portrait {
left: 51.2px;
}
@media @mobile-portrait, @mobile-portrait-with-keyboard {
left: 10%;
}
@media @landscape {
max-width: calc(~'100% - 174px'); // leaves room for 3 buttons (including margins)
}
@media @desktop-portrait {
max-width: calc(~'100% - 102.4px'); // leaves room for 2 buttons
}
@media @mobile-portrait, @mobile-portrait-with-keyboard {
width: 80%;
}
}
&.shiftedTitle {
@media @landscape, @desktop-portrait {
left: 102.4px;
}
@media @mobile-portrait, @mobile-portrait-with-keyboard {
left: 20%;
}
@media @landscape {
max-width: calc(~'100% - 225px'); // leaves room for 4 buttons (including margins)
}
@media @desktop-portrait {
max-width: calc(~'100% - 153.6px'); // leaves for 3 buttons
}
@media @mobile-portrait, @mobile-portrait-with-keyboard {
width: 70%;
}
}
}
}
@ -347,11 +380,11 @@ body {
.signOutIcon {
@media @landscape {
&:hover {
color: #2A5E7C;
}
&:focus {
color: #2A5E7C;
}
color: #2A5E7C;
}
&:focus {
color: #2A5E7C;
}
height: 28px;
width: 75px;
margin-left: 10px;
@ -365,6 +398,29 @@ body {
}
}
.audioNavbarSection {
position: absolute;
top: 0;
@media @landscape, @desktop-portrait {
left: 51.2px;
}
@media @mobile-portrait, @mobile-portrait-with-keyboard {
left: 10%;
width: 10%;
}
.muteIcon:hover {
color: #2A5E7C;
}
}
.muteIcon, .leaveAudioButton {
@media @mobile-portrait, @mobile-portrait-with-keyboard {
display: block;
margin-left: auto;
margin-right: auto;
}
}
.toggleMenuButton {
float: right;
@media @landscape {
@ -382,14 +438,19 @@ body {
z-index: 1001;
}
.toggleUserlistButton {
.toggleUserlistButton, .toggleMenuButton {
outline: none;
&:hover {
span {
background-color: #2A5E7C;
}
}
}
.settingsIcon {
@media @landscape {
&:hover {
color: #2A5E7C;
color: #2A5E7C;
}
&:focus {
color: #2A5E7C;

View File

@ -807,10 +807,16 @@ class ApiController {
meetingName(m.getName())
createTime(m.getCreateTime())
createDate(formatPrettyDate(m.getCreateTime()))
voiceBridge(m.getTelVoice())
dialNumber(m.getDialNumber())
attendeePW(m.getViewerPassword())
moderatorPW(m.getModeratorPassword())
hasBeenForciblyEnded(m.isForciblyEnded() ? "true" : "false")
running(m.isRunning() ? "true" : "false")
participantCount(m.getNumUsers())
listenerCount(m.getNumListenOnly())
voiceParticipantCount(m.getNumVoiceJoined())
videoCount(m.getNumVideos())
duration(m.duration)
hasUserJoined(m.hasUserJoined())
}
@ -1733,6 +1739,7 @@ class ApiController {
// Everything is good so far. Translate the external meeting ids to an internal meeting ids.
ArrayList<String> internalMeetingIds = paramsProcessorUtil.convertToInternalMeetingId(externalMeetingIds);
HashMap<String,Recording> recs = meetingService.getRecordings(internalMeetingIds);
recs = meetingService.filterRecordingsByMetadata(recs, ParamsProcessorUtil.processMetaParam(params));
if (recs.isEmpty()) {
response.addHeader("Cache-Control", "no-cache")
@ -2068,6 +2075,7 @@ class ApiController {
returncode(RESP_CODE_SUCCESS)
meetingName(meeting.getName())
meetingID(meeting.getExternalId())
internalMeetingID(meeting.getInternalId())
createTime(meeting.getCreateTime())
createDate(formatPrettyDate(meeting.getCreateTime()))
voiceBridge(meeting.getTelVoice())
@ -2082,6 +2090,9 @@ class ApiController {
startTime(meeting.getStartTime())
endTime(meeting.getEndTime())
participantCount(meeting.getNumUsers())
listenerCount(meeting.getNumListenOnly())
voiceParticipantCount(meeting.getNumVoiceJoined())
videoCount(meeting.getNumVideos())
maxUsers(meeting.getMaxUsers())
moderatorCount(meeting.getNumModerators())
attendees() {
@ -2090,6 +2101,10 @@ class ApiController {
userID("${att.externalUserId}")
fullName("${att.fullname}")
role("${att.role}")
isPresenter("${att.isPresenter()}")
isListeningOnly("${att.isListeningOnly()}")
hasJoinedVoice("${att.isVoiceJoined()}")
hasVideo("${att.hasVideo()}")
customdata(){
meeting.getUserCustomData(att.externalUserId).each{ k,v ->
"$k"("$v")
@ -2123,6 +2138,8 @@ class ApiController {
attendeePW(meeting.getViewerPassword())
moderatorPW(meeting.getModeratorPassword())
createTime(meeting.getCreateTime())
voiceBridge(meeting.getTelVoice())
dialNumber(meeting.getDialNumber())
createDate(formatPrettyDate(meeting.getCreateTime()))
hasUserJoined(meeting.hasUserJoined())
duration(meeting.duration)

View File

@ -21,6 +21,14 @@ package org.bigbluebutton.api;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ -28,16 +36,14 @@ import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.*;
import org.bigbluebutton.api.domain.Meeting;
import org.bigbluebutton.api.domain.Playback;
import org.bigbluebutton.api.domain.Recording;
import org.bigbluebutton.api.domain.User;
import org.bigbluebutton.api.domain.UserSession;
import org.bigbluebutton.api.messaging.MessageListener;
import org.bigbluebutton.api.messaging.MessagingConstants;
import org.bigbluebutton.api.messaging.MessagingService;
import org.bigbluebutton.api.messaging.ReceivedMessage;
import org.bigbluebutton.api.messaging.messages.CreateMeeting;
import org.bigbluebutton.api.messaging.messages.EndMeeting;
import org.bigbluebutton.api.messaging.messages.IMessage;
@ -47,10 +53,14 @@ import org.bigbluebutton.api.messaging.messages.MeetingStarted;
import org.bigbluebutton.api.messaging.messages.RegisterUser;
import org.bigbluebutton.api.messaging.messages.RemoveExpiredMeetings;
import org.bigbluebutton.api.messaging.messages.UserJoined;
import org.bigbluebutton.api.messaging.messages.UserJoinedVoice;
import org.bigbluebutton.api.messaging.messages.UserLeft;
import org.bigbluebutton.api.messaging.messages.UserLeftVoice;
import org.bigbluebutton.api.messaging.messages.UserListeningOnly;
import org.bigbluebutton.api.messaging.messages.UserSharedWebcam;
import org.bigbluebutton.api.messaging.messages.UserStatusChanged;
import org.bigbluebutton.api.messaging.messages.UserUnsharedWebcam;
import org.bigbluebutton.web.services.ExpiredMeetingCleanupTimerTask;
import org.bigbluebutton.web.services.KeepAliveService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
@ -362,6 +372,10 @@ public class MeetingService implements MessageListener {
return recs;
}
public Map<String, Recording> filterRecordingsByMetadata(Map<String, Recording> recordings, Map<String, String> metadataFilters) {
return recordingService.filterRecordingsByMetadata(recordings, metadataFilters);
}
public HashMap<String,Recording> reorderRecordings(ArrayList<Recording> olds){
HashMap<String,Recording> map= new HashMap<String, Recording>();
for (Recording r:olds) {
@ -626,6 +640,85 @@ public class MeetingService implements MessageListener {
log.warn("The meeting " + message.meetingId + " doesn't exist");
}
public void userJoinedVoice(UserJoinedVoice message) {
Meeting m = getMeeting(message.meetingId);
if (m != null) {
User user = m.getUserById(message.userId);
if(user != null){
user.setVoiceJoined(true);
log.info("User {} joined the voice conference in the meeting {}", user.getFullname(), message.meetingId);
return;
}
log.warn("The participant " + message.userId + " doesn't exist in the meeting " + message.meetingId);
return;
}
log.warn("The meeting " + message.meetingId + " doesn't exist");
}
public void userLeftVoice(UserLeftVoice message) {
Meeting m = getMeeting(message.meetingId);
if (m != null) {
User user = m.getUserById(message.userId);
if(user != null){
user.setVoiceJoined(false);
log.info("User {} left the voice conference in the meeting {}", user.getFullname(), message.meetingId);
return;
}
log.warn("The participant " + message.userId + " doesn't exist in the meeting " + message.meetingId);
return;
}
log.warn("The meeting " + message.meetingId + " doesn't exist");
}
public void userListeningOnly(UserListeningOnly message) {
Meeting m = getMeeting(message.meetingId);
if (m != null) {
User user = m.getUserById(message.userId);
if(user != null){
user.setListeningOnly(message.listenOnly);
if (message.listenOnly) {
log.info("User {} started to listen only in the meeting {}", user.getFullname(), message.meetingId);
} else {
log.info("User {} stopped to listen only in the meeting {}", user.getFullname(), message.meetingId);
}
return;
}
log.warn("The participant " + message.userId + " doesn't exist in the meeting " + message.meetingId);
return;
}
log.warn("The meeting " + message.meetingId + " doesn't exist");
}
public void userSharedWebcam(UserSharedWebcam message) {
Meeting m = getMeeting(message.meetingId);
if (m != null) {
User user = m.getUserById(message.userId);
if(user != null){
user.addStream(message.stream);
log.info("User {} started to stream {} to the meeting {}", user.getFullname(), message.stream, message.meetingId);
return;
}
log.warn("The participant " + message.userId + " doesn't exist in the meeting " + message.meetingId);
return;
}
log.warn("The meeting " + message.meetingId + " doesn't exist");
}
public void userUnsharedWebcam(UserUnsharedWebcam message) {
Meeting m = getMeeting(message.meetingId);
if (m != null) {
User user = m.getUserById(message.userId);
if(user != null){
user.removeStream(message.stream);
log.info("User {} stopped to stream {} to the meeting {}", user.getFullname(), message.stream, message.meetingId);
return;
}
log.warn("The participant " + message.userId + " doesn't exist in the meeting " + message.meetingId);
return;
}
log.warn("The meeting " + message.meetingId + " doesn't exist");
}
private void processMessage(final IMessage message) {
Runnable task = new Runnable() {
public void run() {
@ -644,6 +737,21 @@ public class MeetingService implements MessageListener {
userLeft((UserLeft)message);
} else if (message instanceof UserStatusChanged) {
updatedStatus((UserStatusChanged)message);
} else if (message instanceof UserJoinedVoice) {
log.info("Processing voice user joined message.");
userJoinedVoice((UserJoinedVoice)message);
} else if (message instanceof UserLeftVoice) {
log.info("Processing voice user left message.");
userLeftVoice((UserLeftVoice)message);
} else if (message instanceof UserListeningOnly) {
log.info("Processing user listening only message.");
userListeningOnly((UserListeningOnly)message);
} else if (message instanceof UserSharedWebcam) {
log.info("Processing user shared webcam message.");
userSharedWebcam((UserSharedWebcam)message);
} else if (message instanceof UserUnsharedWebcam) {
log.info("Processing user unshared webcam message.");
userUnsharedWebcam((UserUnsharedWebcam)message);
} else if (message instanceof RemoveExpiredMeetings) {
checkAndRemoveExpiredMeetings();
} else if (message instanceof CreateMeeting) {

View File

@ -23,6 +23,9 @@ import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.bigbluebutton.api.domain.Recording;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -75,6 +78,28 @@ public class RecordingService {
return recs;
}
public boolean recordingMatchesMetadata(Recording recording, Map<String, String> metadataFilters) {
for (Map.Entry<String, String> filter : metadataFilters.entrySet()) {
String metadataValue = recording.getMetadata().get(filter.getKey());
if (metadataValue != null && metadataValue.equals(filter.getValue())) {
// the recording has the metadata specified
// AND the value is the same as the filter
} else {
return false;
}
}
return true;
}
public Map<String, Recording> filterRecordingsByMetadata(Map<String, Recording> recordings, Map<String, String> metadataFilters) {
Map<String, Recording> resultRecordings = new HashMap<String, Recording>();
for (Map.Entry<String, Recording> entry : recordings.entrySet()) {
if (recordingMatchesMetadata(entry.getValue(), metadataFilters))
resultRecordings.put(entry.getKey(), entry.getValue());
}
return resultRecordings;
}
public boolean existAnyRecording(ArrayList<String> idList){
ArrayList<String> publishList=getAllRecordingIds(publishedDir);
ArrayList<String> unpublishList=getAllRecordingIds(unpublishedDir);

View File

@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentMap;
import org.apache.commons.lang.RandomStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.bigbluebutton.api.MeetingService;
public class Meeting {
private static Logger log = LoggerFactory.getLogger(Meeting.class);
@ -316,6 +315,33 @@ public class Meeting {
private boolean hasEnded() {
return endTime > 0;
}
public int getNumListenOnly() {
int sum = 0;
for (String key : users.keySet()) {
User u = (User) users.get(key);
if (u.isListeningOnly()) sum++;
}
return sum;
}
public int getNumVoiceJoined() {
int sum = 0;
for (String key : users.keySet()) {
User u = (User) users.get(key);
if (u.isVoiceJoined()) sum++;
}
return sum;
}
public int getNumVideos() {
int sum = 0;
for (String key : users.keySet()) {
User u = (User) users.get(key);
sum += u.getStreams().size();
}
return sum;
}
public void addUserCustomData(String userID, Map<String, String> data) {
userCustomData.put(userID, data);

View File

@ -19,6 +19,9 @@
package org.bigbluebutton.api.domain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -28,6 +31,9 @@ public class User {
private String fullname;
private String role;
private Map<String,String> status;
private Boolean listeningOnly = false;
private Boolean voiceJoined = false;
private List<String> streams;
public User(String internalUserId, String externalUserId, String fullname, String role) {
this.internalUserId = internalUserId;
@ -35,6 +41,7 @@ public class User {
this.fullname = fullname;
this.role = role;
this.status = new ConcurrentHashMap<String, String>();
this.streams = Collections.synchronizedList(new ArrayList<String>());
}
public String getInternalUserId() {
@ -78,4 +85,44 @@ public class User {
public Map<String,String> getStatus(){
return this.status;
}
public boolean isPresenter() {
String isPresenter = this.status.get("presenter");
if (isPresenter != null) {
return isPresenter.equalsIgnoreCase("true");
}
return false;
}
public void addStream(String stream) {
streams.add(stream);
}
public void removeStream(String stream) {
streams.remove(stream);
}
public List<String> getStreams() {
return streams;
}
public Boolean hasVideo() {
return this.getStreams().size() > 0;
}
public Boolean isListeningOnly() {
return listeningOnly;
}
public void setListeningOnly(Boolean listeningOnly) {
this.listeningOnly = listeningOnly;
}
public Boolean isVoiceJoined() {
return voiceJoined;
}
public void setVoiceJoined(Boolean voiceJoined) {
this.voiceJoined = voiceJoined;
}
}

View File

@ -1,7 +1,5 @@
package org.bigbluebutton.api.messaging;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.bigbluebutton.api.messaging.messages.KeepAliveReply;
@ -9,16 +7,19 @@ import org.bigbluebutton.api.messaging.messages.MeetingDestroyed;
import org.bigbluebutton.api.messaging.messages.MeetingEnded;
import org.bigbluebutton.api.messaging.messages.MeetingStarted;
import org.bigbluebutton.api.messaging.messages.UserJoined;
import org.bigbluebutton.api.messaging.messages.UserJoinedVoice;
import org.bigbluebutton.api.messaging.messages.UserLeft;
import org.bigbluebutton.api.messaging.messages.UserLeftVoice;
import org.bigbluebutton.api.messaging.messages.UserListeningOnly;
import org.bigbluebutton.api.messaging.messages.UserSharedWebcam;
import org.bigbluebutton.api.messaging.messages.UserStatusChanged;
import org.bigbluebutton.api.messaging.messages.UserUnsharedWebcam;
import org.bigbluebutton.common.messages.BbbAppsIsAliveMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
public class MeetingMessageHandler implements MessageHandler {
private static Logger log = LoggerFactory.getLogger(MeetingMessageHandler.class);
@ -30,8 +31,6 @@ public class MeetingMessageHandler implements MessageHandler {
}
public void handleMessage(String pattern, String channel, String message) {
Gson gson = new Gson();
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
@ -123,8 +122,51 @@ public class MeetingMessageHandler implements MessageHandler {
for (MessageListener listener : listeners) {
listener.handle(new UserLeft(meetingId, userid));
}
} else if (MessagingConstants.USER_JOINED_VOICE_EVENT.equalsIgnoreCase(messageName)) {
System.out.println("Handling [" + messageName + "] message.");
String meetingId = payload.get("meeting_id").getAsString();
JsonObject user = (JsonObject) payload.get("user");
String userid = user.get("userid").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserJoinedVoice(meetingId, userid));
}
} else if (MessagingConstants.USER_LEFT_VOICE_EVENT.equalsIgnoreCase(messageName)) {
System.out.println("Handling [" + messageName + "] message.");
String meetingId = payload.get("meeting_id").getAsString();
JsonObject user = (JsonObject) payload.get("user");
String userid = user.get("userid").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserLeftVoice(meetingId, userid));
}
} else if (MessagingConstants.USER_LISTEN_ONLY_EVENT.equalsIgnoreCase(messageName)) {
System.out.println("Handling [" + messageName + "] message.");
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
Boolean listenOnly = payload.get("listen_only").getAsBoolean();
for (MessageListener listener : listeners) {
listener.handle(new UserListeningOnly(meetingId, userid, listenOnly));
}
} else if (MessagingConstants.USER_SHARE_WEBCAM_EVENT.equalsIgnoreCase(messageName)) {
System.out.println("Handling [" + messageName + "] message.");
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
String stream = payload.get("stream").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserSharedWebcam(meetingId, userid, stream));
}
} else if (MessagingConstants.USER_UNSHARE_WEBCAM_EVENT.equalsIgnoreCase(messageName)) {
System.out.println("Handling [" + messageName + "] message.");
String meetingId = payload.get("meeting_id").getAsString();
String userid = payload.get("userid").getAsString();
String stream = payload.get("stream").getAsString();
for (MessageListener listener : listeners) {
listener.handle(new UserUnsharedWebcam(meetingId, userid, stream));
}
}
}
}
}
}
}

View File

@ -47,7 +47,11 @@ public class MessagingConstants {
public static final String USER_JOINED_EVENT = "user_joined_message";
public static final String USER_LEFT_EVENT = "user_left_message";
public static final String USER_STATUS_CHANGE_EVENT = "user_status_changed_message";
public static final String USER_JOINED_VOICE_EVENT = "user_joined_voice_message";
public static final String USER_LEFT_VOICE_EVENT = "user_left_voice_message";
public static final String USER_LISTEN_ONLY_EVENT = "user_listening_only";
public static final String USER_SHARE_WEBCAM_EVENT = "user_shared_webcam_message";
public static final String USER_UNSHARE_WEBCAM_EVENT = "user_unshared_webcam_message";
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
public static final String KEEP_ALIVE_REPLY = "keep_alive_reply";

View File

@ -0,0 +1,11 @@
package org.bigbluebutton.api.messaging.messages;
public class UserJoinedVoice implements IMessage {
public final String userId;
public final String meetingId;
public UserJoinedVoice(String meetingId, String userId) {
this.meetingId = meetingId;
this.userId = userId;
}
}

View File

@ -0,0 +1,11 @@
package org.bigbluebutton.api.messaging.messages;
public class UserLeftVoice implements IMessage {
public final String userId;
public final String meetingId;
public UserLeftVoice(String meetingId, String userId) {
this.meetingId = meetingId;
this.userId = userId;
}
}

View File

@ -0,0 +1,13 @@
package org.bigbluebutton.api.messaging.messages;
public class UserListeningOnly implements IMessage {
public final String userId;
public final String meetingId;
public final Boolean listenOnly;
public UserListeningOnly(String meetingId, String userId, Boolean listenOnly) {
this.meetingId = meetingId;
this.userId = userId;
this.listenOnly = listenOnly;
}
}

View File

@ -0,0 +1,13 @@
package org.bigbluebutton.api.messaging.messages;
public class UserSharedWebcam implements IMessage {
public final String userId;
public final String meetingId;
public final String stream;
public UserSharedWebcam(String meetingId, String userId, String stream) {
this.meetingId = meetingId;
this.userId = userId;
this.stream = stream;
}
}

View File

@ -0,0 +1,13 @@
package org.bigbluebutton.api.messaging.messages;
public class UserUnsharedWebcam implements IMessage {
public final String userId;
public final String meetingId;
public final String stream;
public UserUnsharedWebcam(String meetingId, String userId, String stream) {
this.meetingId = meetingId;
this.userId = userId;
this.stream = stream;
}
}