diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java index 892f4ee328..750c4b68f4 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/messaging/MessagingConstants.java @@ -16,4 +16,6 @@ public class MessagingConstants { public static final String USER_JOINED_EVENT = "UserJoinedEvent"; public static final String USER_LEFT_EVENT = "UserLeftEvent"; public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; + public static final String USER_JOINED_VOICE_EVENT = "UserJoinedVoiceEvent"; + public static final String USER_LEFT_VOICE_EVENT = "UserLeftVoiceEvent"; } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Participant.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Participant.java index 194b49af4c..aae9dbdef4 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Participant.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Participant.java @@ -25,6 +25,7 @@ public interface Participant { public boolean isMuted(); public boolean isTalking(); public int getId(); + public String getExternalUserId(); public String getName(); public boolean isMuteLocked(); } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Room.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Room.java index 78e1635a42..8d4d0bffb7 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Room.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/Room.java @@ -35,4 +35,6 @@ public interface Room { public boolean record(); public void recording(boolean rec); public boolean isRecording(); + public String getMeetingId(); + public void setMeetingId(String meetingid); } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ParticipantJoinedEvent.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ParticipantJoinedEvent.java index 13747d1270..1cfa3c691e 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ParticipantJoinedEvent.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/events/ParticipantJoinedEvent.java @@ -25,15 +25,17 @@ public class ParticipantJoinedEvent extends ConferenceEvent { private final String callerIdNum; private final String callerIdName; + private final String callerIdExternalUserId; private final Boolean muted; private final Boolean speaking; private final Boolean locked = false; public ParticipantJoinedEvent(Integer participantId, String room, - String callerIdNum, String callerIdName, - Boolean muted, Boolean speaking) { + String callerIdNum, String callerIdName, String callerIdExternalUserId, + Boolean muted, Boolean speaking) { super(participantId, room); this.callerIdName = callerIdName; + this.callerIdExternalUserId = callerIdExternalUserId; this.callerIdNum = callerIdNum; this.muted = muted; this.speaking = speaking; @@ -47,6 +49,10 @@ public class ParticipantJoinedEvent extends ConferenceEvent { return callerIdName; } + public String getCallerIdExternalUserId() { + return callerIdExternalUserId; + } + public Boolean getMuted() { return muted; } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java index 49e1f8ea1f..4594e91edc 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/freeswitch/FreeswitchApplication.java @@ -193,10 +193,11 @@ public class FreeswitchApplication extends Observable implements ConferenceServi Map headers = event.getEventHeaders(); String callerId = this.getCallerIdFromEvent(event); String callerIdName = this.getCallerIdNameFromEvent(event); + String callerIdExternalUserId = this.getCallerIdExternalUserIdFromEvent(event); boolean muted = headers.get("Speak").equals("true") ? false : true; //Was inverted which was causing a State issue boolean speeking = headers.get("Talking").equals("true") ? true : false; - ParticipantJoinedEvent pj = new ParticipantJoinedEvent(memberId, confName, callerId, callerIdName, muted, speeking); + ParticipantJoinedEvent pj = new ParticipantJoinedEvent(memberId, confName, callerId, callerIdName, callerIdExternalUserId, muted, speeking); conferenceEventListener.handleConferenceEvent(pj); } @@ -365,7 +366,13 @@ public class FreeswitchApplication extends Observable implements ConferenceServi private String getCallerIdNameFromEvent(EslEvent e) { - return e.getEventHeaders().get("Caller-Caller-ID-Name"); + return e.getEventHeaders().get("Caller-Caller-ID-Name").split(";")[0]; + } + + private String getCallerIdExternalUserIdFromEvent(EslEvent e) + { + // TODO: this information should get here in another header section + return e.getEventHeaders().get("Caller-Caller-ID-Name").split(";")[1]; } private String getRecordFilenameFromEvent(EslEvent e) { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/IRoomListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/IRoomListener.java new file mode 100644 index 0000000000..1114cb726a --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/IRoomListener.java @@ -0,0 +1,28 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2010 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 2.1 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.webconference.voice.internal; + +import org.bigbluebutton.webconference.voice.Participant; + +public interface IRoomListener { + public String getName(); + public void participantJoined(Participant participant); + public void participantLeft(Participant participant); +} \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantImp.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantImp.java index af95fd1b4d..5287e3f48f 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantImp.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantImp.java @@ -28,14 +28,16 @@ import net.jcip.annotations.ThreadSafe; @ThreadSafe class ParticipantImp implements Participant { private final int id; + private final String externalUserId; private final String name; private boolean muted = false; private boolean talking = false; private boolean locked = false; - ParticipantImp(int id, String name) { + ParticipantImp(int id, String name, String externalUserId) { this.id = id; this.name = name; + this.externalUserId = externalUserId; } synchronized void setTalking(boolean talking) { @@ -69,4 +71,8 @@ class ParticipantImp implements Participant { public String getName() { return name; } + + public String getExternalUserId() { + return externalUserId; + } } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantUpdatingRoomListener.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantUpdatingRoomListener.java new file mode 100644 index 0000000000..01729c3d15 --- /dev/null +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/ParticipantUpdatingRoomListener.java @@ -0,0 +1,75 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2010 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 2.1 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.webconference.voice.internal; + +import java.util.HashMap; + +import org.bigbluebutton.conference.service.messaging.MessagingConstants; +import org.bigbluebutton.conference.service.messaging.MessagingService; +import org.bigbluebutton.webconference.voice.Room; +import org.bigbluebutton.webconference.voice.Participant; +import org.red5.logging.Red5LoggerFactory; +import org.slf4j.Logger; + +import com.google.gson.Gson; + + +public class ParticipantUpdatingRoomListener implements IRoomListener { + + private static Logger log = Red5LoggerFactory.getLogger(ParticipantUpdatingRoomListener.class, "bigbluebutton"); + + MessagingService messagingService; + private Room room; + + public ParticipantUpdatingRoomListener(Room room, MessagingService messagingService) { + this.room = room; + this.messagingService = messagingService; + } + + public String getName() { + return "VOICE:PARTICIPANT:UPDATE:ROOM"; + } + + public void participantJoined(Participant p) { + if (messagingService != null) { + HashMap map= new HashMap(); + map.put("meetingId", this.room.getMeetingId()); + map.put("messageId", MessagingConstants.USER_JOINED_VOICE_EVENT); + map.put("externalUserId", p.getExternalUserId()); + + Gson gson= new Gson(); + messagingService.send(MessagingConstants.PARTICIPANTS_CHANNEL, gson.toJson(map)); + log.debug("Publishing message participant joined voice in " + this.room.getMeetingId()); + } + } + + public void participantLeft(Participant p) { + if (messagingService != null) { + HashMap map= new HashMap(); + map.put("meetingId", this.room.getMeetingId()); + map.put("messageId", MessagingConstants.USER_LEFT_VOICE_EVENT); + map.put("externalUserId", p.getExternalUserId()); + + Gson gson= new Gson(); + messagingService.send(MessagingConstants.PARTICIPANTS_CHANNEL, gson.toJson(map)); + log.debug("Publishing message participant left voice in " + this.room.getMeetingId()); + } + } +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomImp.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomImp.java index 099f42a0e8..b23bfcbb76 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomImp.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomImp.java @@ -23,10 +23,13 @@ package org.bigbluebutton.webconference.voice.internal; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import org.slf4j.Logger; +import org.red5.logging.Red5LoggerFactory; import org.bigbluebutton.webconference.voice.Participant; import org.bigbluebutton.webconference.voice.Room; @@ -34,6 +37,7 @@ import net.jcip.annotations.ThreadSafe; @ThreadSafe public class RoomImp implements Room { + private static Logger log = Red5LoggerFactory.getLogger( RoomImp.class, "bigbluebutton" ); private final String name; private final ConcurrentMap participants; @@ -42,18 +46,33 @@ public class RoomImp implements Room { private boolean record = false; private String meetingid; private boolean recording = false; + + private transient final Map listeners; public RoomImp(String name,boolean record, String meetingid) { this.name = name; this.record = record; this.meetingid = meetingid; participants = new ConcurrentHashMap(); + listeners = new ConcurrentHashMap(); } public String getName() { return name; } - + + public void addRoomListener(IRoomListener listener) { + if (! listeners.containsKey(listener.getName())) { + log.debug("adding room listener"); + listeners.put(listener.getName(), listener); + } + } + + public void removeRoomListener(IRoomListener listener) { + log.debug("removing room listener"); + listeners.remove(listener); + } + public int numParticipants() { return participants.size(); } @@ -63,8 +82,22 @@ public class RoomImp implements Room { } public Participant add(Participant p) { - return participants.putIfAbsent(p.getId(), p); - } + int key = p.getId(); + if (!participants.containsKey(key)) { + participants.put(key, p); + + log.debug("Informing roomlisteners " + listeners.size()); + for (Iterator it = listeners.values().iterator(); it.hasNext();) { + IRoomListener listener = (IRoomListener) it.next(); + log.debug("calling participantJoined on listener " + listener.getName()); + listener.participantJoined(p); + } + + return p; + } else { + return participants.get(key); + } + } public boolean hasParticipant(Integer id) { return participants.containsKey(id); @@ -72,7 +105,14 @@ public class RoomImp implements Room { public void remove(Integer id) { Participant p = participants.remove(id); - if (p != null) p = null; + if (p != null) { + for (Iterator it = listeners.values().iterator(); it.hasNext();) { + IRoomListener listener = (IRoomListener) it.next(); + log.debug("calling participantLeft on listener " + listener.getName()); + listener.participantLeft(p); + } + p = null; + } } public void mute(boolean mute) { @@ -99,11 +139,11 @@ public class RoomImp implements Room { return recording; } - public String getMeeting() { + public String getMeetingId() { return meetingid; } - public void setMeeting(String meetingid) { + public void setMeetingId(String meetingid) { this.meetingid = meetingid; } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomManager.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomManager.java index 5196d3bd62..f709cb348b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomManager.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/webconference/voice/internal/RoomManager.java @@ -21,6 +21,8 @@ package org.bigbluebutton.webconference.voice.internal; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; +import org.bigbluebutton.conference.Constants; +import org.bigbluebutton.conference.service.messaging.MessagingService; import org.bigbluebutton.webconference.voice.ConferenceService; import org.bigbluebutton.webconference.voice.Participant; import org.bigbluebutton.webconference.voice.VoiceEventRecorder; @@ -34,6 +36,7 @@ import org.bigbluebutton.webconference.voice.events.StartRecordingEvent; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; import net.jcip.annotations.ThreadSafe; +//import org.red5.server.api.IConnection; @ThreadSafe public class RoomManager { @@ -42,14 +45,21 @@ public class RoomManager { private final ConcurrentHashMap rooms; private ConferenceService confService; private VoiceEventRecorder recorder; + private MessagingService messagingService; public RoomManager() { rooms = new ConcurrentHashMap(); } + public void setMessagingService(MessagingService messagingService) { + this.messagingService = messagingService; + this.messagingService.start(); + } + public void createRoom(String name,boolean record, String meetingid) { log.debug("Creating room: " + name); RoomImp r = new RoomImp(name,record,meetingid); + r.addRoomListener(new ParticipantUpdatingRoomListener(r, messagingService)); rooms.putIfAbsent(name, r); } @@ -140,17 +150,18 @@ public class RoomManager { /** * Record the event if the meeting is being recorded. */ - recorder.recordConferenceEvent(event, rm.getMeeting()); + recorder.recordConferenceEvent(event, rm.getMeetingId()); } private void handleParticipantJoinedEvent(ConferenceEvent event, RoomImp rm) { log.debug("Processing ParticipantJoinedEvent for room: " + event.getRoom()); ParticipantJoinedEvent pje = (ParticipantJoinedEvent) event; - ParticipantImp p = new ParticipantImp(pje.getParticipantId(), pje.getCallerIdName()); + ParticipantImp p = new ParticipantImp(pje.getParticipantId(), pje.getCallerIdName(), pje.getCallerIdExternalUserId()); + p.setMuted(pje.getMuted()); p.setTalking(pje.getSpeaking()); - log.debug("Joined [" + p.getId() + "," + p.getName() + "," + p.isMuted() + "," + p.isTalking() + "] to room " + rm.getName()); - + log.debug("Joined [" + p.getId() + "," + p.getName() + "," + p.getExternalUserId() + "," + p.isMuted() + "," + p.isTalking() + "] to room " + rm.getName()); + rm.add(p); if ((rm.numParticipants() == 1) && rm.record() && !rm.isRecording()) { @@ -162,7 +173,7 @@ public class RoomManager { rm.recording(true); log.debug("Starting recording of voice conference"); log.warn(" ** WARNING: Prototyping only. Works only with FreeSWITCH for now. We need to come up with a generic way to trigger recording for both Asterisk and FreeSWITCH."); - confService.recordSession(event.getRoom(), rm.getMeeting()); + confService.recordSession(event.getRoom(), rm.getMeetingId()); } if (rm.isMuted() && !p.isMuted()) { diff --git a/bigbluebutton-apps/src/main/webapp/WEB-INF/bbb-voice-app.xml b/bigbluebutton-apps/src/main/webapp/WEB-INF/bbb-voice-app.xml index 7b71bb9d51..79da2de971 100755 --- a/bigbluebutton-apps/src/main/webapp/WEB-INF/bbb-voice-app.xml +++ b/bigbluebutton-apps/src/main/webapp/WEB-INF/bbb-voice-app.xml @@ -1,33 +1,76 @@ - + http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/util + http://www.springframework.org/schema/util/spring-util-2.0.xsd"> - - - - + + + + - + - - - - - + + + + + - - - + + + + - - - + + + - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index c7ec483e7d..7b9db89ae5 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -1176,6 +1176,7 @@ class ApiController { isPresenter("${att.isPresenter()}") hasVideoStream("${att.hasStream()}") videoStreamName("${att.getStreamName()}") + isListener("${att.isListener()}") } } } diff --git a/bigbluebutton-web/src/java/org/bigbluebutton/api/MeetingService.java b/bigbluebutton-web/src/java/org/bigbluebutton/api/MeetingService.java index f22d9a8712..fd25c10b0d 100755 --- a/bigbluebutton-web/src/java/org/bigbluebutton/api/MeetingService.java +++ b/bigbluebutton-web/src/java/org/bigbluebutton/api/MeetingService.java @@ -323,6 +323,38 @@ public class MeetingService { } log.warn("The meeting " + meetingId + " doesn't exist"); } + + @Override + public void userJoinedVoice(String meetingId, String externalUserId) { + Meeting m = getMeeting(meetingId); + if (m != null) { + User user = m.getUserByExternalId(externalUserId); + if(user != null){ + user.setIsListener(true); + log.debug("The user " + user.getFullname() + " joined the voice meeting in the meeting " + meetingId); + return; + } + log.warn("The participant " + externalUserId + " doesn't exist in the meeting " + meetingId); + return; + } + log.warn("The meeting " + meetingId + " doesn't exist"); + } + + @Override + public void userLeftVoice(String meetingId, String externalUserId) { + Meeting m = getMeeting(meetingId); + if (m != null) { + User user = m.getUserByExternalId(externalUserId); + if(user != null){ + user.setIsListener(false); + log.debug("The user " + user.getFullname() + " left the voice meeting in the meeting " + meetingId); + return; + } + log.warn("The participant " + externalUserId + " doesn't exist in the meeting " + meetingId); + return; + } + log.warn("The meeting " + meetingId + " doesn't exist"); + } } -} \ No newline at end of file +} diff --git a/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/Meeting.java b/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/Meeting.java index dbc94b6a41..93e357fb52 100755 --- a/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/Meeting.java +++ b/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/Meeting.java @@ -175,6 +175,15 @@ public class Meeting { public User getUserById(String id){ return this.users.get(id); } + + public User getUserByExternalId(String externalUserId){ + for (String key : users.keySet()) { + User u = (User) users.get(key); + if (u.getExternalUserId().equals(externalUserId)) + return u; + } + return null; + } public int getNumUsers(){ return this.users.size(); diff --git a/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/User.java b/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/User.java index bdaaa21b31..8ea1ee35f8 100755 --- a/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/User.java +++ b/bigbluebutton-web/src/java/org/bigbluebutton/api/domain/User.java @@ -9,6 +9,7 @@ public class User { private String fullname; private String role; private Map status; + private boolean isListener; public User(String internalUserId, String externalUserId, String fullname, String role) { this.internalUserId = internalUserId; @@ -16,6 +17,7 @@ public class User { this.fullname = fullname; this.role = role; this.status = new ConcurrentHashMap(); + this.isListener = false; } public String getInternalUserId() { @@ -60,6 +62,14 @@ public class User { return this.status; } + public boolean isListener() { + return isListener; + } + + public void setIsListener(boolean isListener) { + this.isListener = isListener; + } + public boolean isPresenter() { String isPresenter = this.status.get("presenter"); if (isPresenter != null) { diff --git a/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessageListener.java b/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessageListener.java index 25cbdd6a3b..aafe7fb581 100755 --- a/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessageListener.java +++ b/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessageListener.java @@ -6,4 +6,6 @@ public interface MessageListener { void userJoined(String meetingId, String internalUserId, String externalUserId, String name, String role); void userLeft(String meetingId, String internalUserId); void updatedStatus(String meetingId, String internalUserId, String status, String value); + void userJoinedVoice(String meetingId, String externalUserId); + void userLeftVoice(String meetingId, String externalUserId); } diff --git a/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessagingConstants.java b/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessagingConstants.java index 47fc64626e..a50989338b 100755 --- a/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessagingConstants.java +++ b/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/MessagingConstants.java @@ -16,4 +16,6 @@ public class MessagingConstants { public static final String USER_JOINED_EVENT = "UserJoinedEvent"; public static final String USER_LEFT_EVENT = "UserLeftEvent"; public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent"; + public static final String USER_JOINED_VOICE_EVENT = "UserJoinedVoiceEvent"; + public static final String USER_LEFT_VOICE_EVENT = "UserLeftVoiceEvent"; } diff --git a/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/RedisMessagingService.java b/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/RedisMessagingService.java index 3fcd5f066d..114db0210c 100755 --- a/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/RedisMessagingService.java +++ b/bigbluebutton-web/src/java/org/bigbluebutton/api/messaging/RedisMessagingService.java @@ -160,6 +160,18 @@ public class RedisMessagingService implements MessagingService { for (MessageListener listener : listeners) { listener.userLeft(meetingId, internalUserId); } + } else if(MessagingConstants.USER_JOINED_VOICE_EVENT.equalsIgnoreCase(messageId)){ + String externalUserId = map.get("externalUserId"); + + for (MessageListener listener : listeners) { + listener.userJoinedVoice(meetingId, externalUserId); + } + } else if(MessagingConstants.USER_LEFT_VOICE_EVENT.equalsIgnoreCase(messageId)){ + String externalUserId = map.get("externalUserId"); + + for (MessageListener listener : listeners) { + listener.userLeftVoice(meetingId, externalUserId); + } } } }