mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: uniqueSessionId
parent
c1984b5071
commit
4f1f50a2d5
|
@ -22,12 +22,14 @@ import com.google.gson.JsonObject;
|
||||||
public class CDREvent {
|
public class CDREvent {
|
||||||
|
|
||||||
protected String sessionId;
|
protected String sessionId;
|
||||||
|
protected String uniqueSessionId;
|
||||||
protected Long timeStamp;
|
protected Long timeStamp;
|
||||||
protected CDREventName eventName;
|
protected CDREventName eventName;
|
||||||
|
|
||||||
public CDREvent(CDREventName eventName, String sessionId, Long timeStamp) {
|
public CDREvent(CDREventName eventName, String sessionId, String uniqueSessionId, Long timeStamp) {
|
||||||
this.eventName = eventName;
|
this.eventName = eventName;
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
|
this.uniqueSessionId = uniqueSessionId;
|
||||||
this.timeStamp = timeStamp;
|
this.timeStamp = timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +37,10 @@ public class CDREvent {
|
||||||
return this.sessionId;
|
return this.sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUniqueSessionId() {
|
||||||
|
return this.uniqueSessionId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getTimestamp() {
|
public Long getTimestamp() {
|
||||||
return this.timeStamp;
|
return this.timeStamp;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +54,9 @@ public class CDREvent {
|
||||||
if (sessionId != null) {
|
if (sessionId != null) {
|
||||||
json.addProperty("sessionId", this.sessionId);
|
json.addProperty("sessionId", this.sessionId);
|
||||||
}
|
}
|
||||||
|
if (uniqueSessionId != null) {
|
||||||
|
json.addProperty("uniqueSessionId", this.uniqueSessionId);
|
||||||
|
}
|
||||||
json.addProperty("timestamp", this.timeStamp);
|
json.addProperty("timestamp", this.timeStamp);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,13 @@ public class CDREventEnd extends CDREvent {
|
||||||
protected Integer duration;
|
protected Integer duration;
|
||||||
protected EndReason reason;
|
protected EndReason reason;
|
||||||
|
|
||||||
public CDREventEnd(CDREventName eventName, String sessionId, Long timestamp) {
|
public CDREventEnd(CDREventName eventName, String sessionId, String uniqueSessionId, Long timestamp) {
|
||||||
super(eventName, sessionId, timestamp);
|
super(eventName, sessionId, uniqueSessionId, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDREventEnd(CDREventName eventName, String sessionId, Long startTime, EndReason reason, Long timestamp) {
|
public CDREventEnd(CDREventName eventName, String sessionId, String uniqueSessionId, Long startTime,
|
||||||
super(eventName, sessionId, timestamp);
|
EndReason reason, Long timestamp) {
|
||||||
|
super(eventName, sessionId, uniqueSessionId, timestamp);
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
this.duration = (int) ((this.timeStamp - this.startTime) / 1000);
|
this.duration = (int) ((this.timeStamp - this.startTime) / 1000);
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
|
|
|
@ -12,9 +12,10 @@ public class CDREventFilterEvent extends CDREvent {
|
||||||
private String streamId;
|
private String streamId;
|
||||||
private String filterType;
|
private String filterType;
|
||||||
|
|
||||||
public CDREventFilterEvent(String sessionId, String connectionId, String streamId, String filterType,
|
public CDREventFilterEvent(String sessionId, String uniqueSessionId, String connectionId, String streamId,
|
||||||
GenericMediaEvent event) {
|
String filterType, GenericMediaEvent event) {
|
||||||
super(CDREventName.filterEventDispatched, sessionId, Long.parseLong(event.getTimestampMillis()));
|
super(CDREventName.filterEventDispatched, sessionId, uniqueSessionId,
|
||||||
|
Long.parseLong(event.getTimestampMillis()));
|
||||||
this.event = event;
|
this.event = event;
|
||||||
this.connectionId = connectionId;
|
this.connectionId = connectionId;
|
||||||
this.streamId = streamId;
|
this.streamId = streamId;
|
||||||
|
|
|
@ -9,9 +9,8 @@ public class CDREventNodeCrashed extends CDREvent {
|
||||||
private Kms kms;
|
private Kms kms;
|
||||||
private String environmentId;
|
private String environmentId;
|
||||||
|
|
||||||
public CDREventNodeCrashed(CDREventName eventName, String sessionId, Long timeStamp, Kms kms,
|
public CDREventNodeCrashed(CDREventName eventName, Long timeStamp, Kms kms, String environmentId) {
|
||||||
String environmentId) {
|
super(eventName, null, null, timeStamp);
|
||||||
super(eventName, sessionId, timeStamp);
|
|
||||||
this.kms = kms;
|
this.kms = kms;
|
||||||
this.environmentId = environmentId;
|
this.environmentId = environmentId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,15 @@ public class CDREventParticipant extends CDREventEnd {
|
||||||
|
|
||||||
// participantJoined
|
// participantJoined
|
||||||
public CDREventParticipant(Participant participant) {
|
public CDREventParticipant(Participant participant) {
|
||||||
super(CDREventName.participantJoined, participant.getSessionId(), participant.getActiveAt());
|
super(CDREventName.participantJoined, participant.getSessionId(), participant.getUniqueSessionId(),
|
||||||
|
participant.getActiveAt());
|
||||||
this.participant = participant;
|
this.participant = participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
// participantLeft
|
// participantLeft
|
||||||
public CDREventParticipant(CDREventParticipant event, EndReason reason, Long timestamp) {
|
public CDREventParticipant(CDREventParticipant event, EndReason reason, Long timestamp) {
|
||||||
super(CDREventName.participantLeft, event.getSessionId(), event.getTimestamp(), reason, timestamp);
|
super(CDREventName.participantLeft, event.getSessionId(), event.getUniqueSessionId(), event.getTimestamp(),
|
||||||
|
reason, timestamp);
|
||||||
this.participant = event.participant;
|
this.participant = event.participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,15 @@ public class CDREventRecording extends CDREventEnd {
|
||||||
|
|
||||||
// recordingStarted
|
// recordingStarted
|
||||||
public CDREventRecording(Recording recording) {
|
public CDREventRecording(Recording recording) {
|
||||||
super(CDREventName.recordingStarted, recording.getSessionId(), recording.getCreatedAt());
|
super(CDREventName.recordingStarted, recording.getSessionId(), recording.getUniqueSessionId(),
|
||||||
|
recording.getCreatedAt());
|
||||||
this.recording = recording;
|
this.recording = recording;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recordingStopped
|
// recordingStopped
|
||||||
public CDREventRecording(CDREventRecording event, Recording recording, EndReason reason, Long timestamp) {
|
public CDREventRecording(CDREventRecording event, Recording recording, EndReason reason, Long timestamp) {
|
||||||
super(CDREventName.recordingStopped, event == null ? recording.getSessionId() : event.getSessionId(),
|
super(CDREventName.recordingStopped, event == null ? recording.getSessionId() : event.getSessionId(),
|
||||||
|
event == null ? recording.getUniqueSessionId() : event.getUniqueSessionId(),
|
||||||
event == null ? recording.getCreatedAt() : event.getTimestamp(), reason, timestamp);
|
event == null ? recording.getCreatedAt() : event.getTimestamp(), reason, timestamp);
|
||||||
this.recording = recording;
|
this.recording = recording;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ public class CDREventRecordingStatus extends CDREventEnd {
|
||||||
|
|
||||||
public CDREventRecordingStatus(Recording recording, Long startTime, EndReason reason, Long timestamp,
|
public CDREventRecordingStatus(Recording recording, Long startTime, EndReason reason, Long timestamp,
|
||||||
Status status) {
|
Status status) {
|
||||||
super(CDREventName.recordingStatusChanged, recording.getSessionId(), startTime, reason, timestamp);
|
super(CDREventName.recordingStatusChanged, recording.getSessionId(), recording.getUniqueSessionId(), startTime,
|
||||||
|
reason, timestamp);
|
||||||
this.recording = recording;
|
this.recording = recording;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,15 @@ public class CDREventSession extends CDREventEnd {
|
||||||
|
|
||||||
// sessionCreated
|
// sessionCreated
|
||||||
public CDREventSession(Session session) {
|
public CDREventSession(Session session) {
|
||||||
super(CDREventName.sessionCreated, session.getSessionId(), session.getStartTime());
|
super(CDREventName.sessionCreated, session.getSessionId(), session.getUniqueSessionId(),
|
||||||
|
session.getStartTime());
|
||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sessionDestroyed
|
// sessionDestroyed
|
||||||
public CDREventSession(CDREventSession event, EndReason reason, Long timestamp) {
|
public CDREventSession(CDREventSession event, EndReason reason, Long timestamp) {
|
||||||
super(CDREventName.sessionDestroyed, event.getSessionId(), event.getTimestamp(), reason, timestamp);
|
super(CDREventName.sessionDestroyed, event.getSessionId(), event.getUniqueSessionId(), event.getTimestamp(),
|
||||||
|
reason, timestamp);
|
||||||
this.session = event.session;
|
this.session = event.session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,9 @@ public class CDREventSignal extends CDREvent {
|
||||||
private String type;
|
private String type;
|
||||||
private String data;
|
private String data;
|
||||||
|
|
||||||
public CDREventSignal(String sessionId, String from, String[] to, String type, String data) {
|
public CDREventSignal(String sessionId, String uniqueSessionId, String from, String[] to, String type,
|
||||||
super(CDREventName.signalSent, sessionId, System.currentTimeMillis());
|
String data) {
|
||||||
|
super(CDREventName.signalSent, sessionId, uniqueSessionId, System.currentTimeMillis());
|
||||||
this.from = from;
|
this.from = from;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
|
@ -32,9 +32,9 @@ public class CDREventWebrtcConnection extends CDREventEnd implements Comparable<
|
||||||
String receivingFrom;
|
String receivingFrom;
|
||||||
|
|
||||||
// webrtcConnectionCreated
|
// webrtcConnectionCreated
|
||||||
public CDREventWebrtcConnection(String sessionId, String streamId, Participant participant,
|
public CDREventWebrtcConnection(String sessionId, String uniqueSessionId, String streamId, Participant participant,
|
||||||
MediaOptions mediaOptions, String receivingFrom, Long timestamp) {
|
MediaOptions mediaOptions, String receivingFrom, Long timestamp) {
|
||||||
super(CDREventName.webrtcConnectionCreated, sessionId, timestamp);
|
super(CDREventName.webrtcConnectionCreated, sessionId, uniqueSessionId, timestamp);
|
||||||
this.streamId = streamId;
|
this.streamId = streamId;
|
||||||
this.participant = participant;
|
this.participant = participant;
|
||||||
this.mediaOptions = mediaOptions;
|
this.mediaOptions = mediaOptions;
|
||||||
|
@ -43,7 +43,8 @@ public class CDREventWebrtcConnection extends CDREventEnd implements Comparable<
|
||||||
|
|
||||||
// webrtcConnectionDestroyed
|
// webrtcConnectionDestroyed
|
||||||
public CDREventWebrtcConnection(CDREventWebrtcConnection event, EndReason reason, Long timestamp) {
|
public CDREventWebrtcConnection(CDREventWebrtcConnection event, EndReason reason, Long timestamp) {
|
||||||
super(CDREventName.webrtcConnectionDestroyed, event.getSessionId(), event.getTimestamp(), reason, timestamp);
|
super(CDREventName.webrtcConnectionDestroyed, event.getSessionId(), event.getUniqueSessionId(),
|
||||||
|
event.getTimestamp(), reason, timestamp);
|
||||||
this.streamId = event.streamId;
|
this.streamId = event.streamId;
|
||||||
this.participant = event.participant;
|
this.participant = event.participant;
|
||||||
this.mediaOptions = event.mediaOptions;
|
this.mediaOptions = event.mediaOptions;
|
||||||
|
@ -67,7 +68,7 @@ public class CDREventWebrtcConnection extends CDREventEnd implements Comparable<
|
||||||
} else {
|
} else {
|
||||||
json.addProperty("connection", "OUTBOUND");
|
json.addProperty("connection", "OUTBOUND");
|
||||||
if (mediaOptions instanceof KurentoMediaOptions) {
|
if (mediaOptions instanceof KurentoMediaOptions) {
|
||||||
KurentoMediaOptions kMediaOptions = (KurentoMediaOptions)mediaOptions;
|
KurentoMediaOptions kMediaOptions = (KurentoMediaOptions) mediaOptions;
|
||||||
if (kMediaOptions.rtspUri != null) {
|
if (kMediaOptions.rtspUri != null) {
|
||||||
json.addProperty("rtspUri", kMediaOptions.rtspUri);
|
json.addProperty("rtspUri", kMediaOptions.rtspUri);
|
||||||
json.addProperty("adaptativeBitrate", kMediaOptions.adaptativeBitrate);
|
json.addProperty("adaptativeBitrate", kMediaOptions.adaptativeBitrate);
|
||||||
|
|
|
@ -105,10 +105,10 @@ public class CallDetailRecord {
|
||||||
sessionManager.getFinalUsers(sessionId).get(participant.getFinalUserId()).setConnection(eventParticipantEnd);
|
sessionManager.getFinalUsers(sessionId).get(participant.getFinalUserId()).setConnection(eventParticipantEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordNewPublisher(Participant participant, String sessionId, String streamId,
|
public void recordNewPublisher(Participant participant, String streamId, MediaOptions mediaOptions,
|
||||||
MediaOptions mediaOptions, Long timestamp) {
|
Long timestamp) {
|
||||||
CDREventWebrtcConnection publisher = new CDREventWebrtcConnection(sessionId, streamId, participant,
|
CDREventWebrtcConnection publisher = new CDREventWebrtcConnection(participant.getSessionId(),
|
||||||
mediaOptions, null, timestamp);
|
participant.getUniqueSessionId(), streamId, participant, mediaOptions, null, timestamp);
|
||||||
this.publications.put(participant.getParticipantPublicId(), publisher);
|
this.publications.put(participant.getParticipantPublicId(), publisher);
|
||||||
this.log(publisher);
|
this.log(publisher);
|
||||||
}
|
}
|
||||||
|
@ -126,11 +126,11 @@ public class CallDetailRecord {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordNewSubscriber(Participant participant, String sessionId, String streamId, String senderPublicId,
|
public void recordNewSubscriber(Participant participant, String streamId, String senderPublicId, Long timestamp) {
|
||||||
Long timestamp) {
|
|
||||||
CDREventWebrtcConnection publisher = this.publications.get(senderPublicId);
|
CDREventWebrtcConnection publisher = this.publications.get(senderPublicId);
|
||||||
CDREventWebrtcConnection subscriber = new CDREventWebrtcConnection(sessionId, streamId, participant,
|
CDREventWebrtcConnection subscriber = new CDREventWebrtcConnection(participant.getSessionId(),
|
||||||
publisher.mediaOptions, senderPublicId, timestamp);
|
participant.getUniqueSessionId(), streamId, participant, publisher.mediaOptions, senderPublicId,
|
||||||
|
timestamp);
|
||||||
this.subscriptions.putIfAbsent(participant.getParticipantPublicId(), new ConcurrentSkipListSet<>());
|
this.subscriptions.putIfAbsent(participant.getParticipantPublicId(), new ConcurrentSkipListSet<>());
|
||||||
this.subscriptions.get(participant.getParticipantPublicId()).add(subscriber);
|
this.subscriptions.get(participant.getParticipantPublicId()).add(subscriber);
|
||||||
this.log(subscriber);
|
this.log(subscriber);
|
||||||
|
@ -180,16 +180,17 @@ public class CallDetailRecord {
|
||||||
this.log(new CDREventRecordingStatus(recording, recording.getCreatedAt(), finalReason, timestamp, status));
|
this.log(new CDREventRecordingStatus(recording, recording.getCreatedAt(), finalReason, timestamp, status));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordFilterEventDispatched(String sessionId, String connectionId, String streamId, String filterType,
|
public void recordFilterEventDispatched(String sessionId, String uniqueSessionId, String connectionId,
|
||||||
GenericMediaEvent event) {
|
String streamId, String filterType, GenericMediaEvent event) {
|
||||||
this.log(new CDREventFilterEvent(sessionId, connectionId, streamId, filterType, event));
|
this.log(new CDREventFilterEvent(sessionId, uniqueSessionId, connectionId, streamId, filterType, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordSignalSent(String sessionId, String from, String[] to, String type, String data) {
|
public void recordSignalSent(String sessionId, String uniqueSessionId, String from, String[] to, String type,
|
||||||
|
String data) {
|
||||||
if (from != null) {
|
if (from != null) {
|
||||||
type = type.replaceFirst("^signal:", "");
|
type = type.replaceFirst("^signal:", "");
|
||||||
}
|
}
|
||||||
this.log(new CDREventSignal(sessionId, from, to, type, data));
|
this.log(new CDREventSignal(sessionId, uniqueSessionId, from, to, type, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void log(CDREvent event) {
|
protected void log(CDREvent event) {
|
||||||
|
@ -224,8 +225,7 @@ public class CallDetailRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordNodeCrashed(Kms kms, String environmentId, long timeOfKurentoDisconnection) {
|
public void recordNodeCrashed(Kms kms, String environmentId, long timeOfKurentoDisconnection) {
|
||||||
CDREvent e = new CDREventNodeCrashed(CDREventName.nodeCrashed, null, timeOfKurentoDisconnection, kms,
|
CDREvent e = new CDREventNodeCrashed(CDREventName.nodeCrashed, timeOfKurentoDisconnection, kms, environmentId);
|
||||||
environmentId);
|
|
||||||
this.log(e);
|
this.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class WebrtcDebugEvent {
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("sessionId", participant.getSessionId());
|
json.addProperty("sessionId", participant.getSessionId());
|
||||||
|
json.addProperty("uniqueSessionId", participant.getUniqueSessionId());
|
||||||
json.addProperty("user", participant.getFinalUserId());
|
json.addProperty("user", participant.getFinalUserId());
|
||||||
json.addProperty("connectionId", participant.getParticipantPublicId());
|
json.addProperty("connectionId", participant.getParticipantPublicId());
|
||||||
json.addProperty("endpoint", this.endpoint);
|
json.addProperty("endpoint", this.endpoint);
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class Participant {
|
||||||
protected String participantPrivateId; // ID to identify the user on server (org.kurento.jsonrpc.Session.id)
|
protected String participantPrivateId; // ID to identify the user on server (org.kurento.jsonrpc.Session.id)
|
||||||
protected String participantPublicId; // ID to identify the user on clients
|
protected String participantPublicId; // ID to identify the user on clients
|
||||||
protected String sessionId; // ID of the session to which the participant belongs
|
protected String sessionId; // ID of the session to which the participant belongs
|
||||||
|
protected String uniqueSessionId;
|
||||||
protected ParticipantStatus status; // Status of the connection
|
protected ParticipantStatus status; // Status of the connection
|
||||||
protected Long activeAt; // Timestamp when this connection entered status "active"
|
protected Long activeAt; // Timestamp when this connection entered status "active"
|
||||||
protected String clientMetadata = ""; // Metadata provided on client side
|
protected String clientMetadata = ""; // Metadata provided on client side
|
||||||
|
@ -76,12 +77,13 @@ public class Participant {
|
||||||
public Lock singleRecordingLock = new ReentrantLock();
|
public Lock singleRecordingLock = new ReentrantLock();
|
||||||
|
|
||||||
public Participant(String finalUserId, String participantPrivateId, String participantPublicId, String sessionId,
|
public Participant(String finalUserId, String participantPrivateId, String participantPublicId, String sessionId,
|
||||||
Token token, String clientMetadata, GeoLocation location, String platform, EndpointType endpointType,
|
String uniqueSessionId, Token token, String clientMetadata, GeoLocation location, String platform,
|
||||||
Long activeAt) {
|
EndpointType endpointType, Long activeAt) {
|
||||||
this.finalUserId = finalUserId;
|
this.finalUserId = finalUserId;
|
||||||
this.participantPrivateId = participantPrivateId;
|
this.participantPrivateId = participantPrivateId;
|
||||||
this.participantPublicId = participantPublicId;
|
this.participantPublicId = participantPublicId;
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
|
this.uniqueSessionId = uniqueSessionId;
|
||||||
this.status = ParticipantStatus.active;
|
this.status = ParticipantStatus.active;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
if (activeAt != null) {
|
if (activeAt != null) {
|
||||||
|
@ -121,6 +123,10 @@ public class Participant {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUniqueSessionId() {
|
||||||
|
return uniqueSessionId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getActiveAt() {
|
public Long getActiveAt() {
|
||||||
return this.activeAt;
|
return this.activeAt;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +216,8 @@ public class Participant {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIpcam() {
|
public boolean isIpcam() {
|
||||||
return this.platform != null && this.platform.equals("IPCAM") && this.participantPrivateId.startsWith(IdentifierPrefixes.IPCAM_ID);
|
return this.platform != null && this.platform.equals("IPCAM")
|
||||||
|
&& this.participantPrivateId.startsWith(IdentifierPrefixes.IPCAM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPublisherStreamId() {
|
public String getPublisherStreamId() {
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class Session implements SessionInterface {
|
||||||
protected ConcurrentMap<String, Token> tokens = new ConcurrentHashMap<>();
|
protected ConcurrentMap<String, Token> tokens = new ConcurrentHashMap<>();
|
||||||
protected final ConcurrentMap<String, Participant> participants = new ConcurrentHashMap<>();
|
protected final ConcurrentMap<String, Participant> participants = new ConcurrentHashMap<>();
|
||||||
protected String sessionId;
|
protected String sessionId;
|
||||||
|
protected String uniqueSessionId;
|
||||||
protected SessionProperties sessionProperties;
|
protected SessionProperties sessionProperties;
|
||||||
protected Long startTime;
|
protected Long startTime;
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@ public class Session implements SessionInterface {
|
||||||
public Session(Session previousSession) {
|
public Session(Session previousSession) {
|
||||||
this.sessionId = previousSession.getSessionId();
|
this.sessionId = previousSession.getSessionId();
|
||||||
this.startTime = previousSession.getStartTime();
|
this.startTime = previousSession.getStartTime();
|
||||||
|
this.uniqueSessionId = previousSession.getUniqueSessionId();
|
||||||
this.sessionProperties = previousSession.getSessionProperties();
|
this.sessionProperties = previousSession.getSessionProperties();
|
||||||
this.openviduConfig = previousSession.openviduConfig;
|
this.openviduConfig = previousSession.openviduConfig;
|
||||||
this.recordingManager = previousSession.recordingManager;
|
this.recordingManager = previousSession.recordingManager;
|
||||||
|
@ -101,6 +103,7 @@ public class Session implements SessionInterface {
|
||||||
RecordingManager recordingManager) {
|
RecordingManager recordingManager) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
this.startTime = System.currentTimeMillis();
|
this.startTime = System.currentTimeMillis();
|
||||||
|
this.uniqueSessionId = sessionId + "_" + this.startTime;
|
||||||
this.sessionProperties = sessionProperties;
|
this.sessionProperties = sessionProperties;
|
||||||
this.openviduConfig = openviduConfig;
|
this.openviduConfig = openviduConfig;
|
||||||
this.recordingManager = recordingManager;
|
this.recordingManager = recordingManager;
|
||||||
|
@ -110,6 +113,10 @@ public class Session implements SessionInterface {
|
||||||
return this.sessionId;
|
return this.sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUniqueSessionId() {
|
||||||
|
return this.uniqueSessionId;
|
||||||
|
}
|
||||||
|
|
||||||
public SessionProperties getSessionProperties() {
|
public SessionProperties getSessionProperties() {
|
||||||
return this.sessionProperties;
|
return this.sessionProperties;
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,7 +322,7 @@ public class SessionEventsHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSendMessage(Participant participant, JsonObject message, Set<Participant> participants,
|
public void onSendMessage(Participant participant, JsonObject message, Set<Participant> participants,
|
||||||
String sessionId, Integer transactionId, OpenViduException error) {
|
String sessionId, String uniqueSessionId, Integer transactionId, OpenViduException error) {
|
||||||
|
|
||||||
boolean isRpcCall = transactionId != null;
|
boolean isRpcCall = transactionId != null;
|
||||||
if (isRpcCall) {
|
if (isRpcCall) {
|
||||||
|
@ -391,7 +391,7 @@ public class SessionEventsHandler {
|
||||||
rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, new JsonObject());
|
rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, new JsonObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
CDR.recordSignalSent(sessionId, from, toSet.toArray(new String[toSet.size()]), type, data);
|
CDR.recordSignalSent(sessionId, uniqueSessionId, from, toSet.toArray(new String[toSet.size()]), type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStreamPropertyChanged(Participant participant, Integer transactionId, Set<Participant> participants,
|
public void onStreamPropertyChanged(Participant participant, Integer transactionId, Set<Participant> participants,
|
||||||
|
@ -561,10 +561,10 @@ public class SessionEventsHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFilterEventDispatched(String sessionId, String connectionId, String streamId, String filterType,
|
public void onFilterEventDispatched(String sessionId, String uniqueSessionId, String connectionId, String streamId, String filterType,
|
||||||
GenericMediaEvent event, Set<Participant> participants, Set<String> subscribedParticipants) {
|
GenericMediaEvent event, Set<Participant> participants, Set<String> subscribedParticipants) {
|
||||||
|
|
||||||
CDR.recordFilterEventDispatched(sessionId, connectionId, streamId, filterType, event);
|
CDR.recordFilterEventDispatched(sessionId, uniqueSessionId, connectionId, streamId, filterType, event);
|
||||||
|
|
||||||
JsonObject params = new JsonObject();
|
JsonObject params = new JsonObject();
|
||||||
params.addProperty(ProtocolElements.FILTEREVENTLISTENER_CONNECTIONID_PARAM, connectionId);
|
params.addProperty(ProtocolElements.FILTEREVENTLISTENER_CONNECTIONID_PARAM, connectionId);
|
||||||
|
|
|
@ -113,10 +113,11 @@ public abstract class SessionManager {
|
||||||
|
|
||||||
public abstract void unsubscribe(Participant participant, String senderName, Integer transactionId);
|
public abstract void unsubscribe(Participant participant, String senderName, Integer transactionId);
|
||||||
|
|
||||||
public void sendMessage(String message, String sessionId) {
|
public void sendMessage(String message, Session session) {
|
||||||
try {
|
try {
|
||||||
JsonObject messageJson = JsonParser.parseString(message).getAsJsonObject();
|
JsonObject messageJson = JsonParser.parseString(message).getAsJsonObject();
|
||||||
sessionEventsHandler.onSendMessage(null, messageJson, getParticipants(sessionId), sessionId, null, null);
|
sessionEventsHandler.onSendMessage(null, messageJson, getParticipants(session.getSessionId()),
|
||||||
|
session.getSessionId(), session.getUniqueSessionId(), null, null);
|
||||||
} catch (JsonSyntaxException | IllegalStateException e) {
|
} catch (JsonSyntaxException | IllegalStateException e) {
|
||||||
throw new OpenViduException(Code.SIGNAL_FORMAT_INVALID_ERROR_CODE,
|
throw new OpenViduException(Code.SIGNAL_FORMAT_INVALID_ERROR_CODE,
|
||||||
"Provided signal object '" + message + "' has not a valid JSON format");
|
"Provided signal object '" + message + "' has not a valid JSON format");
|
||||||
|
@ -127,7 +128,7 @@ public abstract class SessionManager {
|
||||||
try {
|
try {
|
||||||
JsonObject messageJson = JsonParser.parseString(message).getAsJsonObject();
|
JsonObject messageJson = JsonParser.parseString(message).getAsJsonObject();
|
||||||
sessionEventsHandler.onSendMessage(participant, messageJson, getParticipants(participant.getSessionId()),
|
sessionEventsHandler.onSendMessage(participant, messageJson, getParticipants(participant.getSessionId()),
|
||||||
participant.getSessionId(), transactionId, null);
|
participant.getSessionId(), participant.getUniqueSessionId(), transactionId, null);
|
||||||
} catch (JsonSyntaxException | IllegalStateException e) {
|
} catch (JsonSyntaxException | IllegalStateException e) {
|
||||||
throw new OpenViduException(Code.SIGNAL_FORMAT_INVALID_ERROR_CODE,
|
throw new OpenViduException(Code.SIGNAL_FORMAT_INVALID_ERROR_CODE,
|
||||||
"Provided signal object '" + message + "' has not a valid JSON format");
|
"Provided signal object '" + message + "' has not a valid JSON format");
|
||||||
|
@ -358,13 +359,15 @@ public abstract class SessionManager {
|
||||||
this.insecureUsers.put(participantPrivateId, true);
|
this.insecureUsers.put(participantPrivateId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Participant newParticipant(String sessionId, String participantPrivateId, Token token,
|
public Participant newParticipant(Session session, String participantPrivateId, Token token, String clientMetadata,
|
||||||
String clientMetadata, GeoLocation location, String platform, String finalUserId) {
|
GeoLocation location, String platform, String finalUserId) {
|
||||||
|
|
||||||
|
String sessionId = session.getSessionId();
|
||||||
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
||||||
|
|
||||||
Participant p = new Participant(finalUserId, participantPrivateId, token.getConnectionId(), sessionId,
|
Participant p = new Participant(finalUserId, participantPrivateId, token.getConnectionId(), sessionId,
|
||||||
token, clientMetadata, location, platform, EndpointType.WEBRTC_ENDPOINT, null);
|
session.getUniqueSessionId(), token, clientMetadata, location, platform,
|
||||||
|
EndpointType.WEBRTC_ENDPOINT, null);
|
||||||
|
|
||||||
this.sessionidParticipantpublicidParticipant.get(sessionId).put(p.getParticipantPublicId(), p);
|
this.sessionidParticipantpublicidParticipant.get(sessionId).put(p.getParticipantPublicId(), p);
|
||||||
|
|
||||||
|
@ -381,11 +384,13 @@ public abstract class SessionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Participant newRecorderParticipant(String sessionId, String participantPrivateId, Token token,
|
public Participant newRecorderParticipant(Session session, String participantPrivateId, Token token,
|
||||||
String clientMetadata) {
|
String clientMetadata) {
|
||||||
|
String sessionId = session.getSessionId();
|
||||||
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
||||||
Participant p = new Participant(null, participantPrivateId, ProtocolElements.RECORDER_PARTICIPANT_PUBLICID,
|
Participant p = new Participant(null, participantPrivateId, ProtocolElements.RECORDER_PARTICIPANT_PUBLICID,
|
||||||
sessionId, token, clientMetadata, null, null, EndpointType.WEBRTC_ENDPOINT, null);
|
sessionId, session.getUniqueSessionId(), token, clientMetadata, null, null,
|
||||||
|
EndpointType.WEBRTC_ENDPOINT, null);
|
||||||
this.sessionidParticipantpublicidParticipant.get(sessionId)
|
this.sessionidParticipantpublicidParticipant.get(sessionId)
|
||||||
.put(ProtocolElements.RECORDER_PARTICIPANT_PUBLICID, p);
|
.put(ProtocolElements.RECORDER_PARTICIPANT_PUBLICID, p);
|
||||||
return p;
|
return p;
|
||||||
|
@ -394,11 +399,12 @@ public abstract class SessionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Participant newIpcamParticipant(String sessionId, String ipcamId, Token token, GeoLocation location,
|
public Participant newIpcamParticipant(Session session, String ipcamId, Token token, GeoLocation location,
|
||||||
String platform) {
|
String platform) {
|
||||||
|
String sessionId = session.getSessionId();
|
||||||
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
|
||||||
Participant p = new Participant(ipcamId, ipcamId, ipcamId, sessionId, token, null, location, platform,
|
Participant p = new Participant(ipcamId, ipcamId, ipcamId, sessionId, session.getUniqueSessionId(), token,
|
||||||
EndpointType.PLAYER_ENDPOINT, null);
|
null, location, platform, EndpointType.PLAYER_ENDPOINT, null);
|
||||||
this.sessionidParticipantpublicidParticipant.get(sessionId).put(ipcamId, p);
|
this.sessionidParticipantpublicidParticipant.get(sessionId).put(ipcamId, p);
|
||||||
return p;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -79,9 +79,9 @@ public class KurentoParticipant extends Participant {
|
||||||
KurentoParticipantEndpointConfig endpointConfig, OpenviduConfig openviduConfig,
|
KurentoParticipantEndpointConfig endpointConfig, OpenviduConfig openviduConfig,
|
||||||
RecordingManager recordingManager) {
|
RecordingManager recordingManager) {
|
||||||
super(participant.getFinalUserId(), participant.getParticipantPrivateId(), participant.getParticipantPublicId(),
|
super(participant.getFinalUserId(), participant.getParticipantPrivateId(), participant.getParticipantPublicId(),
|
||||||
kurentoSession.getSessionId(), participant.getToken(), participant.getClientMetadata(),
|
kurentoSession.getSessionId(), kurentoSession.getUniqueSessionId(), participant.getToken(),
|
||||||
participant.getLocation(), participant.getPlatform(), participant.getEndpointType(),
|
participant.getClientMetadata(), participant.getLocation(), participant.getPlatform(),
|
||||||
participant.getActiveAt());
|
participant.getEndpointType(), participant.getActiveAt());
|
||||||
this.endpointConfig = endpointConfig;
|
this.endpointConfig = endpointConfig;
|
||||||
this.openviduConfig = openviduConfig;
|
this.openviduConfig = openviduConfig;
|
||||||
this.recordingManager = recordingManager;
|
this.recordingManager = recordingManager;
|
||||||
|
@ -190,8 +190,8 @@ public class KurentoParticipant extends Participant {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
endpointConfig.getCdr().recordNewPublisher(this, session.getSessionId(), publisher.getStreamId(),
|
endpointConfig.getCdr().recordNewPublisher(this, publisher.getStreamId(), publisher.getMediaOptions(),
|
||||||
publisher.getMediaOptions(), publisher.createdAt());
|
publisher.createdAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdpResponse;
|
return sdpResponse;
|
||||||
|
@ -278,8 +278,8 @@ public class KurentoParticipant extends Participant {
|
||||||
|
|
||||||
if (!silent
|
if (!silent
|
||||||
&& !ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {
|
&& !ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {
|
||||||
endpointConfig.getCdr().recordNewSubscriber(this, this.session.getSessionId(),
|
endpointConfig.getCdr().recordNewSubscriber(this, sender.getPublisherStreamId(),
|
||||||
sender.getPublisherStreamId(), sender.getParticipantPublicId(), subscriber.createdAt());
|
sender.getParticipantPublicId(), subscriber.createdAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdpAnswer;
|
return sdpAnswer;
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
this.newTokenForInsecureUser(session, token, connectionProperties);
|
this.newTokenForInsecureUser(session, token, connectionProperties);
|
||||||
final Token tokenObj = session.consumeToken(token);
|
final Token tokenObj = session.consumeToken(token);
|
||||||
|
|
||||||
Participant ipcamParticipant = this.newIpcamParticipant(sessionId, rtspConnectionId, tokenObj, location,
|
Participant ipcamParticipant = this.newIpcamParticipant(session, rtspConnectionId, tokenObj, location,
|
||||||
mediaOptions.getTypeOfVideo());
|
mediaOptions.getTypeOfVideo());
|
||||||
|
|
||||||
// Store a "fake" final user for the IpCam connection
|
// Store a "fake" final user for the IpCam connection
|
||||||
|
@ -1246,13 +1246,14 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
PublisherEndpoint pub = kParticipant.getPublisher();
|
PublisherEndpoint pub = kParticipant.getPublisher();
|
||||||
if (!pub.isListenerAddedToFilterEvent(eventType)) {
|
if (!pub.isListenerAddedToFilterEvent(eventType)) {
|
||||||
final String sessionId = kParticipant.getSessionId();
|
final String sessionId = kParticipant.getSessionId();
|
||||||
|
final String uniqueSessionId = kParticipant.getUniqueSessionId();
|
||||||
final String connectionId = kParticipant.getParticipantPublicId();
|
final String connectionId = kParticipant.getParticipantPublicId();
|
||||||
final String streamId = kParticipant.getPublisherStreamId();
|
final String streamId = kParticipant.getPublisherStreamId();
|
||||||
final String filterType = kParticipant.getPublisherMediaOptions().getFilter().getType();
|
final String filterType = kParticipant.getPublisherMediaOptions().getFilter().getType();
|
||||||
try {
|
try {
|
||||||
ListenerSubscription listener = pub.getFilter().addEventListener(eventType, event -> {
|
ListenerSubscription listener = pub.getFilter().addEventListener(eventType, event -> {
|
||||||
sessionEventsHandler.onFilterEventDispatched(sessionId, connectionId, streamId, filterType, event,
|
sessionEventsHandler.onFilterEventDispatched(sessionId, uniqueSessionId, connectionId, streamId,
|
||||||
kParticipant.getSession().getParticipants(),
|
filterType, event, kParticipant.getSession().getParticipants(),
|
||||||
kParticipant.getPublisher().getPartipantsListentingToFilterEvent(eventType));
|
kParticipant.getPublisher().getPartipantsListentingToFilterEvent(eventType));
|
||||||
});
|
});
|
||||||
pub.storeListener(eventType, listener);
|
pub.storeListener(eventType, listener);
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class KmsEvent {
|
||||||
json.remove("timestampMillis");
|
json.remove("timestampMillis");
|
||||||
json.addProperty("timestamp", timestamp);
|
json.addProperty("timestamp", timestamp);
|
||||||
json.addProperty("sessionId", participant.getSessionId());
|
json.addProperty("sessionId", participant.getSessionId());
|
||||||
|
json.addProperty("uniqueSessionId", participant.getUniqueSessionId());
|
||||||
json.addProperty("user", participant.getFinalUserId());
|
json.addProperty("user", participant.getFinalUserId());
|
||||||
// TODO: remove deprecated "connection" when possible
|
// TODO: remove deprecated "connection" when possible
|
||||||
json.addProperty("connection", participant.getParticipantPublicId());
|
json.addProperty("connection", participant.getParticipantPublicId());
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class Recording {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String sessionId;
|
private String sessionId;
|
||||||
|
private String uniqueSessionId;
|
||||||
private long createdAt; // milliseconds (UNIX Epoch time)
|
private long createdAt; // milliseconds (UNIX Epoch time)
|
||||||
private long size = 0; // bytes
|
private long size = 0; // bytes
|
||||||
private double duration = 0; // seconds
|
private double duration = 0; // seconds
|
||||||
|
@ -42,8 +43,9 @@ public class Recording {
|
||||||
|
|
||||||
public AtomicBoolean recordingNotificationSent = new AtomicBoolean(false);
|
public AtomicBoolean recordingNotificationSent = new AtomicBoolean(false);
|
||||||
|
|
||||||
public Recording(String sessionId, String id, RecordingProperties recordingProperties) {
|
public Recording(String sessionId, String uniqueSessionId, String id, RecordingProperties recordingProperties) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
|
this.uniqueSessionId = uniqueSessionId;
|
||||||
this.createdAt = System.currentTimeMillis();
|
this.createdAt = System.currentTimeMillis();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.status = io.openvidu.java.client.Recording.Status.started;
|
this.status = io.openvidu.java.client.Recording.Status.started;
|
||||||
|
@ -128,8 +130,8 @@ public class Recording {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(String sessionId) {
|
public String getUniqueSessionId() {
|
||||||
this.sessionId = sessionId;
|
return uniqueSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreatedAt() {
|
public long getCreatedAt() {
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
|
||||||
private String runContainer(Session session, RecordingProperties properties) throws Exception {
|
private String runContainer(Session session, RecordingProperties properties) throws Exception {
|
||||||
log.info("Starting COMPOSED_QUICK_START container for session id: {}", session.getSessionId());
|
log.info("Starting COMPOSED_QUICK_START container for session id: {}", session.getSessionId());
|
||||||
|
|
||||||
Recording recording = new Recording(session.getSessionId(), null, properties);
|
Recording recording = new Recording(session.getSessionId(), session.getUniqueSessionId(), null, properties);
|
||||||
String layoutUrl = this.getLayoutUrl(recording);
|
String layoutUrl = this.getLayoutUrl(recording);
|
||||||
|
|
||||||
List<String> envs = new ArrayList<>();
|
List<String> envs = new ArrayList<>();
|
||||||
|
|
|
@ -84,7 +84,8 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
throws OpenViduException {
|
throws OpenViduException {
|
||||||
|
|
||||||
// Instantiate and store recording object
|
// Instantiate and store recording object
|
||||||
Recording recording = new Recording(session.getSessionId(), recordingId, properties);
|
Recording recording = new Recording(session.getSessionId(), session.getUniqueSessionId(), recordingId,
|
||||||
|
properties);
|
||||||
this.recordingManager.recordingToStarting(recording);
|
this.recordingManager.recordingToStarting(recording);
|
||||||
|
|
||||||
if (properties.hasVideo()) {
|
if (properties.hasVideo()) {
|
||||||
|
|
|
@ -92,7 +92,8 @@ public class SingleStreamRecordingService extends RecordingService {
|
||||||
properties.hasVideo() ? (properties.hasAudio() ? "video+audio" : "video-only") : "audioOnly",
|
properties.hasVideo() ? (properties.hasAudio() ? "video+audio" : "video-only") : "audioOnly",
|
||||||
recordingId, session.getSessionId());
|
recordingId, session.getSessionId());
|
||||||
|
|
||||||
Recording recording = new Recording(session.getSessionId(), recordingId, properties);
|
Recording recording = new Recording(session.getSessionId(), session.getUniqueSessionId(), recordingId,
|
||||||
|
properties);
|
||||||
this.recordingManager.recordingToStarting(recording);
|
this.recordingManager.recordingToStarting(recording);
|
||||||
|
|
||||||
activeRecorders.put(recording.getId(), new ConcurrentHashMap<>());
|
activeRecorders.put(recording.getId(), new ConcurrentHashMap<>());
|
||||||
|
|
|
@ -638,7 +638,7 @@ public class SessionRestController {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sessionManager.sendMessage(completeMessage.toString(), sessionId);
|
sessionManager.sendMessage(completeMessage.toString(), session);
|
||||||
} catch (OpenViduException e) {
|
} catch (OpenViduException e) {
|
||||||
return this.generateErrorResponse("\"to\" array has no valid connection identifiers", "/signal",
|
return this.generateErrorResponse("\"to\" array has no valid connection identifiers", "/signal",
|
||||||
HttpStatus.NOT_ACCEPTABLE);
|
HttpStatus.NOT_ACCEPTABLE);
|
||||||
|
|
|
@ -274,10 +274,10 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
||||||
}
|
}
|
||||||
Participant participant;
|
Participant participant;
|
||||||
if (generateRecorderParticipant) {
|
if (generateRecorderParticipant) {
|
||||||
participant = sessionManager.newRecorderParticipant(sessionId, participantPrivateId,
|
participant = sessionManager.newRecorderParticipant(session, participantPrivateId, tokenObj,
|
||||||
tokenObj, clientMetadata);
|
clientMetadata);
|
||||||
} else {
|
} else {
|
||||||
participant = sessionManager.newParticipant(sessionId, participantPrivateId, tokenObj,
|
participant = sessionManager.newParticipant(session, participantPrivateId, tokenObj,
|
||||||
clientMetadata, location, platform,
|
clientMetadata, location, platform,
|
||||||
httpSession.getId().substring(0, Math.min(16, httpSession.getId().length())));
|
httpSession.getId().substring(0, Math.min(16, httpSession.getId().length())));
|
||||||
log.info("New Connection {} in Session {} with IP {} and platform {}",
|
log.info("New Connection {} in Session {} with IP {} and platform {}",
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class SessionSummary {
|
||||||
json.addProperty("createdAt", this.eventSessionEnd.getStartTime());
|
json.addProperty("createdAt", this.eventSessionEnd.getStartTime());
|
||||||
json.addProperty("destroyedAt", this.eventSessionEnd.getTimestamp());
|
json.addProperty("destroyedAt", this.eventSessionEnd.getTimestamp());
|
||||||
json.addProperty("sessionId", this.eventSessionEnd.getSessionId());
|
json.addProperty("sessionId", this.eventSessionEnd.getSessionId());
|
||||||
|
json.addProperty("uniqueSessionId", this.eventSessionEnd.getUniqueSessionId());
|
||||||
json.addProperty("customSessionId", this.eventSessionEnd.getSession().getSessionProperties().customSessionId());
|
json.addProperty("customSessionId", this.eventSessionEnd.getSession().getSessionProperties().customSessionId());
|
||||||
json.addProperty("mediaMode", this.eventSessionEnd.getSession().getSessionProperties().mediaMode().name());
|
json.addProperty("mediaMode", this.eventSessionEnd.getSession().getSessionProperties().mediaMode().name());
|
||||||
json.addProperty("recordingMode",
|
json.addProperty("recordingMode",
|
||||||
|
|
|
@ -37,6 +37,7 @@ import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import io.openvidu.java.client.ConnectionProperties;
|
import io.openvidu.java.client.ConnectionProperties;
|
||||||
import io.openvidu.server.core.Participant;
|
import io.openvidu.server.core.Participant;
|
||||||
|
import io.openvidu.server.core.Session;
|
||||||
import io.openvidu.server.core.SessionManager;
|
import io.openvidu.server.core.SessionManager;
|
||||||
import io.openvidu.server.core.Token;
|
import io.openvidu.server.core.Token;
|
||||||
import io.openvidu.server.kurento.kms.KmsManager;
|
import io.openvidu.server.kurento.kms.KmsManager;
|
||||||
|
@ -71,7 +72,7 @@ public class SessionGarbageCollectorIntegrationTest {
|
||||||
|
|
||||||
JsonObject jsonResponse;
|
JsonObject jsonResponse;
|
||||||
|
|
||||||
getSessionId();
|
getSession();
|
||||||
jsonResponse = listSessions();
|
jsonResponse = listSessions();
|
||||||
|
|
||||||
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
|
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
|
||||||
|
@ -81,14 +82,14 @@ public class SessionGarbageCollectorIntegrationTest {
|
||||||
jsonResponse = listSessions();
|
jsonResponse = listSessions();
|
||||||
Assert.assertEquals("Wrong number of sessions", 0, jsonResponse.get("numberOfElements").getAsInt());
|
Assert.assertEquals("Wrong number of sessions", 0, jsonResponse.get("numberOfElements").getAsInt());
|
||||||
|
|
||||||
getSessionId();
|
getSession();
|
||||||
getSessionId();
|
getSession();
|
||||||
String sessionId = getSessionId();
|
Session session = getSession();
|
||||||
jsonResponse = listSessions();
|
jsonResponse = listSessions();
|
||||||
Assert.assertEquals("Wrong number of sessions", 3, jsonResponse.get("numberOfElements").getAsInt());
|
Assert.assertEquals("Wrong number of sessions", 3, jsonResponse.get("numberOfElements").getAsInt());
|
||||||
|
|
||||||
String token = getToken(sessionId);
|
String token = getToken(session);
|
||||||
joinParticipant(sessionId, token);
|
joinParticipant(session, token);
|
||||||
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|
||||||
|
@ -96,14 +97,16 @@ public class SessionGarbageCollectorIntegrationTest {
|
||||||
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
|
Assert.assertEquals("Wrong number of sessions", 1, jsonResponse.get("numberOfElements").getAsInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSessionId() {
|
private Session getSession() {
|
||||||
String stringResponse = (String) sessionRestController.initializeSession(new HashMap<>()).getBody();
|
String stringResponse = (String) sessionRestController.initializeSession(new HashMap<>()).getBody();
|
||||||
return new Gson().fromJson(stringResponse, JsonObject.class).get("id").getAsString();
|
JsonObject json = new Gson().fromJson(stringResponse, JsonObject.class);
|
||||||
|
String sessionId = json.get("id").getAsString();
|
||||||
|
return new Session(sessionId, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getToken(String sessionId) {
|
private String getToken(Session session) {
|
||||||
String stringResponse = (String) sessionRestController.initializeConnection(sessionId, new HashMap<>())
|
String stringResponse = (String) sessionRestController
|
||||||
.getBody();
|
.initializeConnection(session.getSessionId(), new HashMap<>()).getBody();
|
||||||
return new Gson().fromJson(stringResponse, JsonObject.class).get("token").getAsString();
|
return new Gson().fromJson(stringResponse, JsonObject.class).get("token").getAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,15 +115,15 @@ public class SessionGarbageCollectorIntegrationTest {
|
||||||
return new Gson().fromJson(stringResponse, JsonObject.class);
|
return new Gson().fromJson(stringResponse, JsonObject.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void joinParticipant(String sessionId, String token) {
|
private void joinParticipant(Session session, String token) {
|
||||||
ConnectionProperties connectionProperties = new ConnectionProperties.Builder().data("SERVER_METADATA").build();
|
ConnectionProperties connectionProperties = new ConnectionProperties.Builder().data("SERVER_METADATA").build();
|
||||||
Token t = new Token(token, sessionId, connectionProperties, null);
|
Token t = new Token(token, session.getSessionId(), connectionProperties, null);
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
String participantPrivateId = "PARTICIPANT_PRIVATE_ID_" + uuid;
|
String participantPrivateId = "PARTICIPANT_PRIVATE_ID_" + uuid;
|
||||||
String finalUserId = "FINAL_USER_ID_" + uuid;
|
String finalUserId = "FINAL_USER_ID_" + uuid;
|
||||||
Participant participant = sessionManager.newParticipant(sessionId, participantPrivateId, t, "CLIENT_METADATA",
|
Participant participant = sessionManager.newParticipant(session, participantPrivateId, t, "CLIENT_METADATA",
|
||||||
null, "Chrome", finalUserId);
|
null, "Chrome", finalUserId);
|
||||||
sessionManager.joinRoom(participant, sessionId, null);
|
sessionManager.joinRoom(participant, session.getSessionId(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue