mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: add sessionId and connectionId identifiers to KMS events
parent
658f76c014
commit
da73d96278
|
@ -21,15 +21,15 @@ import com.google.gson.JsonObject;
|
|||
|
||||
public class Participant {
|
||||
|
||||
private String finalUserId; // ID to match this connection with a final user (HttpSession id)
|
||||
private String participantPrivatetId; // ID to identify the user on server (org.kurento.jsonrpc.Session.id)
|
||||
private String participantPublicId; // ID to identify the user on clients
|
||||
private Long createdAt; // Timestamp when this connection was established
|
||||
private String clientMetadata = ""; // Metadata provided on client side
|
||||
private String serverMetadata = ""; // Metadata provided on server side
|
||||
private Token token; // Token associated to this participant
|
||||
private String location; // Remote IP of the participant
|
||||
private String platform; // Platform used by the participant to connect to the session
|
||||
protected String finalUserId; // ID to match this connection with a final user (HttpSession id)
|
||||
protected String participantPrivatetId; // ID to identify the user on server (org.kurento.jsonrpc.Session.id)
|
||||
protected String participantPublicId; // ID to identify the user on clients
|
||||
protected Long createdAt; // Timestamp when this connection was established
|
||||
protected String clientMetadata = ""; // Metadata provided on client side
|
||||
protected String serverMetadata = ""; // Metadata provided on server side
|
||||
protected Token token; // Token associated to this participant
|
||||
protected String location; // Remote IP of the participant
|
||||
protected String platform; // Platform used by the participant to connect to the session
|
||||
|
||||
protected boolean streaming = false;
|
||||
protected volatile boolean closed;
|
||||
|
|
|
@ -439,8 +439,8 @@ public class KurentoParticipant extends Participant {
|
|||
String msg = "KMS event [MediaFlowInStateChange] -> endpoint: " + endpoint.getEndpointName() + " ("
|
||||
+ typeOfEndpoint + ") | state: " + event.getState() + " | pad: " + event.getPadName()
|
||||
+ " | mediaType: " + event.getMediaType() + " | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsMediaEvent(event, endpoint.getEndpointName(), event.getMediaType(),
|
||||
endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsMediaEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), event.getMediaType(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -451,8 +451,8 @@ public class KurentoParticipant extends Participant {
|
|||
String msg = "KMS event [MediaFlowOutStateChange] -> endpoint: " + endpoint.getEndpointName() + " ("
|
||||
+ typeOfEndpoint + ") | state: " + event.getState() + " | pad: " + event.getPadName()
|
||||
+ " | mediaType: " + event.getMediaType() + " | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsMediaEvent(event, endpoint.getEndpointName(), event.getMediaType(),
|
||||
endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsMediaEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), event.getMediaType(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -462,7 +462,8 @@ public class KurentoParticipant extends Participant {
|
|||
endpoint.getWebEndpoint().addIceGatheringDoneListener(event -> {
|
||||
String msg = "KMS event [IceGatheringDone] -> endpoint: " + endpoint.getEndpointName() + " ("
|
||||
+ typeOfEndpoint + ") | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsEvent(event, endpoint.getEndpointName(), endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -473,7 +474,8 @@ public class KurentoParticipant extends Participant {
|
|||
String msg = "KMS event [ConnectionStateChanged]: -> endpoint: " + endpoint.getEndpointName() + " ("
|
||||
+ typeOfEndpoint + ") | oldState: " + event.getOldState() + " | newState: " + event.getNewState()
|
||||
+ " | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsEvent(event, endpoint.getEndpointName(), endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -486,7 +488,8 @@ public class KurentoParticipant extends Participant {
|
|||
String msg = "KMS event [NewCandidatePairSelected]: -> endpoint: " + endpoint.getEndpointName() + " ("
|
||||
+ typeOfEndpoint + ") | local: " + endpoint.selectedLocalIceCandidate + " | remote: "
|
||||
+ endpoint.selectedRemoteIceCandidate + " | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsEvent(event, endpoint.getEndpointName(), endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -497,8 +500,8 @@ public class KurentoParticipant extends Participant {
|
|||
String msg = "KMS event [MediaTranscodingStateChange]: -> endpoint: " + endpoint.getEndpointName() + " ("
|
||||
+ typeOfEndpoint + ") | state: " + event.getState().name() + " | mediaType: " + event.getMediaType()
|
||||
+ " | binName: " + event.getBinName() + " | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsMediaEvent(event, endpoint.getEndpointName(), event.getMediaType(),
|
||||
endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsMediaEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), event.getMediaType(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -511,7 +514,8 @@ public class KurentoParticipant extends Participant {
|
|||
+ typeOfEndpoint + ") | state: " + event.getState().name() + " | componentId: "
|
||||
+ event.getComponentId() + " | streamId: " + event.getStreamId() + " | timestamp: "
|
||||
+ event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsEvent(event, endpoint.getEndpointName(), endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
@ -523,7 +527,8 @@ public class KurentoParticipant extends Participant {
|
|||
String msg = "KMS event [ERROR]: -> endpoint: " + endpoint.getEndpointName() + " (" + typeOfEndpoint
|
||||
+ ") | errorCode: " + event.getErrorCode() + " | description: " + event.getDescription()
|
||||
+ " | timestamp: " + event.getTimestamp();
|
||||
KmsEvent kmsEvent = new KmsEvent(event, endpoint.getEndpointName(), endpoint.createdAt());
|
||||
KmsEvent kmsEvent = new KmsEvent(event, this.session.getSessionId(), participantPublicId,
|
||||
endpoint.getEndpointName(), endpoint.createdAt());
|
||||
endpoint.kmsEvents.add(kmsEvent);
|
||||
this.CDR.log(kmsEvent);
|
||||
this.infoHandler.sendInfo(msg);
|
||||
|
|
|
@ -27,14 +27,20 @@ public class KmsEvent {
|
|||
|
||||
long timestamp;
|
||||
long msSinceCreation;
|
||||
String sessionId;
|
||||
String connectionId;
|
||||
String endpoint;
|
||||
RaiseBaseEvent event;
|
||||
|
||||
public KmsEvent(RaiseBaseEvent event, String endpointName, long createdAt) {
|
||||
public KmsEvent(RaiseBaseEvent event, String sessionId, String connectionId, String endpointName, long createdAt) {
|
||||
this.event = event;
|
||||
this.sessionId = sessionId;
|
||||
this.connectionId = connectionId;
|
||||
this.endpoint = endpointName;
|
||||
this.timestamp = System.currentTimeMillis();
|
||||
this.timestamp = System.currentTimeMillis(); // TODO: Change to event.getTimestampMillis()
|
||||
this.msSinceCreation = this.timestamp - createdAt;
|
||||
|
||||
this.removeSourceForJsonCompatibility();
|
||||
}
|
||||
|
||||
public JsonObject toJson() {
|
||||
|
@ -50,10 +56,18 @@ public class KmsEvent {
|
|||
json.addProperty("eventType", mediaEvent.getType());
|
||||
}
|
||||
|
||||
json.addProperty("session", sessionId);
|
||||
json.addProperty("connection", connectionId);
|
||||
json.addProperty("endpoint", this.endpoint);
|
||||
json.addProperty("timestamp", timestamp);
|
||||
json.addProperty("msSinceEndpointCreation", msSinceCreation);
|
||||
json.addProperty("endpoint", this.endpoint);
|
||||
return json;
|
||||
}
|
||||
|
||||
private void removeSourceForJsonCompatibility() {
|
||||
// This avoids stack overflow error when transforming RaiseBaseEvent into
|
||||
// JsonObject
|
||||
this.event.setSource(null);
|
||||
}
|
||||
|
||||
}
|
|
@ -26,8 +26,9 @@ public class KmsMediaEvent extends KmsEvent {
|
|||
|
||||
MediaType mediaType;
|
||||
|
||||
public KmsMediaEvent(MediaEvent event, String endpointName, MediaType mediaType, long createdAt) {
|
||||
super(event, endpointName, createdAt);
|
||||
public KmsMediaEvent(MediaEvent event, String sessionId, String connectionId, String endpointName,
|
||||
MediaType mediaType, long createdAt) {
|
||||
super(event, sessionId, connectionId, endpointName, createdAt);
|
||||
this.mediaType = mediaType;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue