Merge branch 'fix-userid-api'
This commit is contained in:
commit
48d63068b6
@ -100,7 +100,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
|
||||
* Convert the id to Long because it gets converted to ascii decimal
|
||||
* equivalent (i.e. zero (0) becomes 48) if we don't.
|
||||
*/
|
||||
long userid = Long.parseLong(Red5.getConnectionLocal().getClient().getId());
|
||||
long internalUserID = Long.parseLong(Red5.getConnectionLocal().getClient().getId());
|
||||
String sessionName = connection.getScope().getName();
|
||||
|
||||
String voiceBridge = ((String) params[4]).toString();
|
||||
@ -109,18 +109,18 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
|
||||
boolean record = (Boolean)params[5];
|
||||
log.debug("record value - [" + record + "]");
|
||||
|
||||
String externUserID = ((String) params[6]).toString();
|
||||
String externalUserID = ((String) params[6]).toString();
|
||||
|
||||
if (record == true) {
|
||||
recorderApplication.createRecordSession(sessionName);
|
||||
}
|
||||
|
||||
BigBlueButtonSession bbbSession = new BigBlueButtonSession(sessionName, userid, username, role,
|
||||
conference, room, voiceBridge, record, externUserID);
|
||||
BigBlueButtonSession bbbSession = new BigBlueButtonSession(sessionName, internalUserID, username, role,
|
||||
conference, room, voiceBridge, record, externalUserID);
|
||||
connection.setAttribute(Constants.SESSION, bbbSession);
|
||||
|
||||
String debugInfo = "userid=" + userid + ",username=" + username + ",role=" + role + ",conference=" + conference + "," +
|
||||
"session=" + sessionName + ",voiceConf=" + voiceBridge + ",room=" + room + ",externsUserid=" + externUserID;
|
||||
String debugInfo = "internalUserID=" + internalUserID + ",username=" + username + ",role=" + role + ",conference=" + conference + "," +
|
||||
"session=" + sessionName + ",voiceConf=" + voiceBridge + ",room=" + room + ",externalUserid=" + externalUserID;
|
||||
log.debug("User [{}] connected to room [{}]", debugInfo, room);
|
||||
participantsApplication.createRoom(room);
|
||||
super.roomConnect(connection, params);
|
||||
@ -142,7 +142,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
|
||||
public String getMyUserId() {
|
||||
BigBlueButtonSession bbbSession = (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
|
||||
assert bbbSession != null;
|
||||
return Long.toString(bbbSession.getUserid());
|
||||
return Long.toString(bbbSession.getInternalUserID());
|
||||
}
|
||||
|
||||
public void setParticipantsApplication(ParticipantsApplication a) {
|
||||
|
@ -24,16 +24,16 @@ public class BigBlueButtonSession {
|
||||
private final String role;
|
||||
private final String conference;
|
||||
private final String room;
|
||||
private final long userid;
|
||||
private final long internalUserID;
|
||||
private final String sessionName;
|
||||
private final String voiceBridge;
|
||||
private final Boolean record;
|
||||
private final String externUserID;
|
||||
private final String externalUserID;
|
||||
|
||||
public BigBlueButtonSession(String sessionName, long userid, String username,
|
||||
public BigBlueButtonSession(String sessionName, long internalUserID, String username,
|
||||
String role, String conference, String room, String voiceBridge, Boolean record,
|
||||
String externUserID){
|
||||
this.userid = userid;
|
||||
String externalUserID){
|
||||
this.internalUserID = internalUserID;
|
||||
this.sessionName = sessionName;
|
||||
this.username = username;
|
||||
this.role = role;
|
||||
@ -42,7 +42,7 @@ public class BigBlueButtonSession {
|
||||
|
||||
this.voiceBridge = voiceBridge;
|
||||
this.record = record;
|
||||
this.externUserID = externUserID;
|
||||
this.externalUserID = externalUserID;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
@ -61,8 +61,8 @@ public class BigBlueButtonSession {
|
||||
return room;
|
||||
}
|
||||
|
||||
public long getUserid() {
|
||||
return userid;
|
||||
public long getInternalUserID() {
|
||||
return internalUserID;
|
||||
}
|
||||
|
||||
public String getSessionName() {
|
||||
@ -78,6 +78,6 @@ public class BigBlueButtonSession {
|
||||
}
|
||||
|
||||
public String getExternUserID() {
|
||||
return externUserID;
|
||||
return externalUserID;
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ import java.util.ArrayList;
|
||||
|
||||
public interface IRoomListener {
|
||||
public String getName();
|
||||
public void participantStatusChange(Long userid, String status, Object value);
|
||||
public void participantStatusChange(Participant p, String status, Object value);
|
||||
public void participantJoined(Participant participant);
|
||||
public void participantLeft(Long userid);
|
||||
public void participantLeft(Participant participant);
|
||||
public void assignPresenter(ArrayList<String> presenter);
|
||||
public void endAndKickAll();
|
||||
}
|
@ -31,19 +31,19 @@ import java.lang.Long;
|
||||
*/
|
||||
@ThreadSafe
|
||||
public class Participant implements Serializable {
|
||||
private Long userid;
|
||||
private Long internalUserID;
|
||||
private String name;
|
||||
private String role = "VIEWER";
|
||||
private String externUserID;
|
||||
private String externalUserID;
|
||||
|
||||
private final Map status;
|
||||
private Map<String, Object> unmodifiableStatus;
|
||||
|
||||
public Participant(Long userid, String name, String role, String externUserID, Map<String, Object> status) {
|
||||
this.userid = userid;
|
||||
public Participant(Long internalUserID, String name, String role, String externalUserID, Map<String, Object> status) {
|
||||
this.internalUserID = internalUserID;
|
||||
this.name = name;
|
||||
this.role = role;
|
||||
this.externUserID = externUserID;
|
||||
this.externalUserID = externalUserID;
|
||||
this.status = new ConcurrentHashMap<String, Object>(status);
|
||||
unmodifiableStatus = Collections.unmodifiableMap(status);
|
||||
}
|
||||
@ -56,16 +56,16 @@ public class Participant implements Serializable {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Long getUserid() {
|
||||
return userid;
|
||||
public Long getInternalUserID() {
|
||||
return internalUserID;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public String getExternUserID() {
|
||||
return externUserID;
|
||||
public String getExternalUserID() {
|
||||
return externalUserID;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -104,7 +104,7 @@ public class Participant implements Serializable {
|
||||
|
||||
public Map toMap() {
|
||||
Map m = new HashMap();
|
||||
m.put("userid", userid);
|
||||
m.put("userid", internalUserID);
|
||||
m.put("name", name);
|
||||
m.put("role", role);
|
||||
/**
|
||||
|
@ -46,12 +46,14 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
|
||||
return "PARTICIPANT:UPDATE:ROOM";
|
||||
}
|
||||
|
||||
public void participantStatusChange(Long userid, String status, Object value){
|
||||
public void participantStatusChange(Participant p, String status, Object value){
|
||||
if (messagingService != null) {
|
||||
HashMap<String,String> map= new HashMap<String, String>();
|
||||
map.put("meetingId", this.room.getName());
|
||||
map.put("messageId", MessagingConstants.USER_STATUS_CHANGE_EVENT);
|
||||
map.put("userid", userid.toString());
|
||||
|
||||
//In the API, it's shown the externalUserID
|
||||
map.put("userid", p.getExternalUserID());
|
||||
map.put("status", status);
|
||||
map.put("value", value.toString());
|
||||
|
||||
@ -66,7 +68,7 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
|
||||
HashMap<String,String> map= new HashMap<String, String>();
|
||||
map.put("meetingId", this.room.getName());
|
||||
map.put("messageId", MessagingConstants.USER_JOINED_EVENT);
|
||||
map.put("userid", p.getUserid().toString());
|
||||
map.put("userid", p.getExternalUserID());
|
||||
map.put("fullname", p.getName());
|
||||
map.put("role", p.getRole());
|
||||
|
||||
@ -76,12 +78,12 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
|
||||
}
|
||||
}
|
||||
|
||||
public void participantLeft(Long userid) {
|
||||
public void participantLeft(Participant p) {
|
||||
if (messagingService != null) {
|
||||
HashMap<String,String> map= new HashMap<String, String>();
|
||||
map.put("meetingId", this.room.getName());
|
||||
map.put("messageId", MessagingConstants.USER_LEFT_EVENT);
|
||||
map.put("userid", userid.toString());
|
||||
map.put("userid", p.getExternalUserID());
|
||||
|
||||
Gson gson= new Gson();
|
||||
messagingService.send(MessagingConstants.PARTICIPANTS_CHANNEL, gson.toJson(map));
|
||||
|
@ -68,8 +68,8 @@ public class Room implements Serializable {
|
||||
|
||||
public void addParticipant(Participant participant) {
|
||||
synchronized (this) {
|
||||
log.debug("adding participant " + participant.getUserid());
|
||||
participants.put(participant.getUserid(), participant);
|
||||
log.debug("adding participant " + participant.getInternalUserID());
|
||||
participants.put(participant.getInternalUserID(), participant);
|
||||
// unmodifiableMap = Collections.unmodifiableMap(participants)
|
||||
}
|
||||
log.debug("Informing roomlisteners " + listeners.size());
|
||||
@ -82,29 +82,31 @@ public class Room implements Serializable {
|
||||
|
||||
public void removeParticipant(Long userid) {
|
||||
boolean present = false;
|
||||
Participant p = null;
|
||||
synchronized (this) {
|
||||
present = participants.containsKey(userid);
|
||||
if (present) {
|
||||
log.debug("removing participant");
|
||||
participants.remove(userid);
|
||||
p = participants.remove(userid);
|
||||
}
|
||||
}
|
||||
if (present) {
|
||||
for (Iterator it = listeners.values().iterator(); it.hasNext();) {
|
||||
IRoomListener listener = (IRoomListener) it.next();
|
||||
log.debug("calling participantLeft on listener " + listener.getName());
|
||||
listener.participantLeft(userid);
|
||||
listener.participantLeft(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void changeParticipantStatus(Long userid, String status, Object value) {
|
||||
boolean present = false;
|
||||
Participant p = null;
|
||||
synchronized (this) {
|
||||
present = participants.containsKey(userid);
|
||||
if (present) {
|
||||
log.debug("change participant status");
|
||||
Participant p = participants.get(userid);
|
||||
p = participants.get(userid);
|
||||
p.setStatus(status, value);
|
||||
//participants.put(userid, p);
|
||||
//unmodifiableMap = Collections.unmodifiableMap(participants);
|
||||
@ -114,7 +116,7 @@ public class Room implements Serializable {
|
||||
for (Iterator it = listeners.values().iterator(); it.hasNext();) {
|
||||
IRoomListener listener = (IRoomListener) it.next();
|
||||
log.debug("calling participantStatusChange on listener " + listener.getName());
|
||||
listener.participantStatusChange(userid, status, value);
|
||||
listener.participantStatusChange(p, status, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ public class RoomListener implements IRoomListener{
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void participantStatusChange(Long userid, String status, Object value){
|
||||
public void participantStatusChange(Participant p, String status, Object value){
|
||||
List list = new ArrayList();
|
||||
list.add(userid);
|
||||
list.add(p.getInternalUserID());
|
||||
list.add(status);
|
||||
list.add(value);
|
||||
so.sendMessage("participantStatusChange", list);
|
||||
@ -52,9 +52,9 @@ public class RoomListener implements IRoomListener{
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void participantLeft(Long userid) {
|
||||
public void participantLeft(Participant p) {
|
||||
List args = new ArrayList();
|
||||
args.add(userid);
|
||||
args.add(p.getInternalUserID());
|
||||
so.sendMessage("participantLeft", args);
|
||||
}
|
||||
|
||||
|
@ -63,27 +63,27 @@ public class ParticipantsEventSender implements IRoomListener {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void participantJoined(Participant p) {
|
||||
log.debug("A participant has joined " + p.getUserid());
|
||||
log.debug("A participant has joined " + p.getInternalUserID());
|
||||
ArrayList args = new ArrayList();
|
||||
args.add(p.toMap());
|
||||
log.debug("Sending participantJoined " + p.getUserid() + " to client.");
|
||||
log.debug("Sending participantJoined " + p.getExternalUserID() + " to client.");
|
||||
so.sendMessage("participantJoined", args);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void participantLeft(Long userid) {
|
||||
public void participantLeft(Participant p) {
|
||||
ArrayList args = new ArrayList();
|
||||
args.add(userid);
|
||||
args.add(p.getInternalUserID());
|
||||
so.sendMessage("participantLeft", args);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void participantStatusChange(Long userid, String status, Object value) {
|
||||
log.debug("A participant's status has changed " + userid + " " + status + " " + value);
|
||||
public void participantStatusChange(Participant p, String status, Object value) {
|
||||
log.debug("A participant's status has changed " + p.getInternalUserID() + " " + status + " " + value);
|
||||
ArrayList args = new ArrayList();
|
||||
args.add(userid);
|
||||
args.add(p.getInternalUserID());
|
||||
args.add(status);
|
||||
args.add(value);
|
||||
so.sendMessage("participantStatusChange", args);
|
||||
|
@ -115,8 +115,8 @@ public class ParticipantsHandler extends ApplicationAdapter implements IApplicat
|
||||
} else {
|
||||
log.debug("roomLeave - session is NOT null");
|
||||
}
|
||||
Long userid = bbbSession.getUserid();
|
||||
participantsApplication.participantLeft(bbbSession.getSessionName(), userid);
|
||||
Long internalUserID = bbbSession.getInternalUserID();
|
||||
participantsApplication.participantLeft(bbbSession.getSessionName(), internalUserID);
|
||||
}
|
||||
|
||||
private void setupRoom(IScope scope) {
|
||||
@ -161,7 +161,7 @@ public class ParticipantsHandler extends ApplicationAdapter implements IApplicat
|
||||
log.warn("bbb session is null");
|
||||
}
|
||||
|
||||
Long userid = bbbSession.getUserid();
|
||||
Long userid = bbbSession.getInternalUserID();
|
||||
log.debug(APP + ":participantJoin - userid " + userid);
|
||||
String username = bbbSession.getUsername();
|
||||
log.debug(APP + ":participantJoin - username " + username);
|
||||
|
@ -83,7 +83,7 @@ public class ParticipantsService {
|
||||
Map pm = new HashMap();
|
||||
for (Iterator it = pc.iterator(); it.hasNext();) {
|
||||
Participant ap = (Participant) it.next();
|
||||
pm.put(ap.getUserid(), ap.toMap());
|
||||
pm.put(ap.getInternalUserID(), ap.toMap());
|
||||
}
|
||||
participants.put("participants", pm);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class ParticipantsEventRecorder implements IRoomListener {
|
||||
public void participantJoined(Participant p) {
|
||||
ParticipantJoinRecordEvent ev = new ParticipantJoinRecordEvent();
|
||||
ev.setTimestamp(System.currentTimeMillis());
|
||||
ev.setUserId(p.getUserid().toString());
|
||||
ev.setUserId(p.getInternalUserID().toString());
|
||||
ev.setMeetingId(session);
|
||||
ev.setStatus(p.getStatus().toString());
|
||||
ev.setRole(p.getRole());
|
||||
@ -40,20 +40,20 @@ public class ParticipantsEventRecorder implements IRoomListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void participantLeft(Long userid) {
|
||||
public void participantLeft(Participant p) {
|
||||
ParticipantLeftRecordEvent ev = new ParticipantLeftRecordEvent();
|
||||
ev.setTimestamp(System.currentTimeMillis());
|
||||
ev.setUserId(userid.toString());
|
||||
ev.setUserId(p.getInternalUserID().toString());
|
||||
ev.setMeetingId(session);
|
||||
|
||||
recorder.record(session, ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void participantStatusChange(Long userid, String status, Object value) {
|
||||
public void participantStatusChange(Participant p, String status, Object value) {
|
||||
ParticipantStatusChangeRecordEvent ev = new ParticipantStatusChangeRecordEvent();
|
||||
ev.setTimestamp(System.currentTimeMillis());
|
||||
ev.setUserId(userid.toString());
|
||||
ev.setUserId(p.getInternalUserID().toString());
|
||||
ev.setMeetingId(session);
|
||||
ev.setStatus(status);
|
||||
ev.setValue(value.toString());
|
||||
|
Loading…
Reference in New Issue
Block a user