openvidu-server: fix lack of media_node_id to ELK summaries

pull/704/head
pabloFuente 2022-03-02 15:01:58 +01:00
parent 773bb11e1b
commit f503d5006b
4 changed files with 12 additions and 10 deletions

View File

@ -32,10 +32,10 @@ public class CDREventSession extends CDREventEnd {
}
// sessionDestroyed
public CDREventSession(CDREventSession event, EndReason reason, Long timestamp) {
public CDREventSession(CDREventSession event, Session session, EndReason reason, Long timestamp) {
super(CDREventName.sessionDestroyed, event.getSessionId(), event.getUniqueSessionId(), event.getTimestamp(),
reason, timestamp);
this.session = event.session;
this.session = session;
}
public Session getSession() {

View File

@ -74,10 +74,11 @@ public class CallDetailRecord {
this.log(e);
}
public void recordSessionDestroyed(String sessionId, EndReason reason) {
public void recordSessionDestroyed(Session session, EndReason reason) {
String sessionId = session.getSessionId();
CDREventSession e = this.sessions.remove(sessionId);
if (e != null) {
CDREventSession eventSessionEnd = new CDREventSession(e, RecordingManager.finalReason(reason),
CDREventSession eventSessionEnd = new CDREventSession(e, session, RecordingManager.finalReason(reason),
System.currentTimeMillis());
this.log(eventSessionEnd);

View File

@ -71,8 +71,8 @@ public class SessionEventsHandler {
CDR.recordSessionCreated(session);
}
public void onSessionClosed(String sessionId, EndReason reason) {
CDR.recordSessionDestroyed(sessionId, reason);
public void onSessionClosed(Session session, EndReason reason) {
CDR.recordSessionDestroyed(session, reason);
}
public void onParticipantJoined(Participant participant, String sessionId, Set<Participant> existingParticipants,

View File

@ -19,8 +19,8 @@ package io.openvidu.server.core;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@ -48,11 +48,11 @@ import io.openvidu.client.OpenViduException;
import io.openvidu.client.OpenViduException.Code;
import io.openvidu.client.internal.ProtocolElements;
import io.openvidu.java.client.ConnectionProperties;
import io.openvidu.java.client.IceServerProperties;
import io.openvidu.java.client.KurentoOptions;
import io.openvidu.java.client.OpenViduRole;
import io.openvidu.java.client.Recording;
import io.openvidu.java.client.SessionProperties;
import io.openvidu.java.client.IceServerProperties;
import io.openvidu.server.cdr.CDREventRecordingStatusChanged;
import io.openvidu.server.config.OpenviduConfig;
import io.openvidu.server.coturn.CoturnCredentialsService;
@ -344,7 +344,8 @@ public abstract class SessionManager {
try {
JsonObject serverMetadataJson = JsonParser.parseString(serverMetadata).getAsJsonObject();
String customConnectionId = serverMetadataJson.get("openviduCustomConnectionId").getAsString();
customConnectionId = customConnectionId.replaceAll("\\W", ""); // Remove all non-word characters: [^A-Za-z0-9_]
// Remove all non-word characters: [^A-Za-z0-9_]
customConnectionId = customConnectionId.replaceAll("\\W", "");
customConnectionId = customConnectionId.replaceAll(IdentifierPrefixes.PARTICIPANT_PUBLIC_ID, "");
tokenObj.setConnectionId(IdentifierPrefixes.PARTICIPANT_PUBLIC_ID + customConnectionId);
} catch (Exception e) {
@ -634,7 +635,7 @@ public abstract class SessionManager {
if (session.close(reason)) {
try {
sessionEventsHandler.onSessionClosed(session.getSessionId(), reason);
sessionEventsHandler.onSessionClosed(session, reason);
} catch (Exception e) {
log.error("Error recording 'sessionDestroyed' event for session {}: {} - {}", session.getSessionId(),
e.getClass().getName(), e.getMessage());