mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: cdr logger refactoring
parent
42863065d4
commit
a8495a6f54
|
@ -45,6 +45,7 @@ import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
|
import io.openvidu.server.cdr.CDRLoggerFile;
|
||||||
import io.openvidu.server.cdr.CallDetailRecord;
|
import io.openvidu.server.cdr.CallDetailRecord;
|
||||||
import io.openvidu.server.config.OpenviduConfig;
|
import io.openvidu.server.config.OpenviduConfig;
|
||||||
import io.openvidu.server.core.SessionManager;
|
import io.openvidu.server.core.SessionManager;
|
||||||
|
@ -132,7 +133,7 @@ public class OpenViduServer implements JsonRpcConfigurer {
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public CallDetailRecord cdr() {
|
public CallDetailRecord cdr() {
|
||||||
return new CallDetailRecord();
|
return new CallDetailRecord(new CDRLoggerFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -26,16 +26,7 @@ import io.openvidu.server.recording.Recording;
|
||||||
|
|
||||||
public class CDREvent implements Comparable<CDREvent> {
|
public class CDREvent implements Comparable<CDREvent> {
|
||||||
|
|
||||||
static final String SESSION_CREATED = "sessionCreated";
|
protected CDREventName eventName;
|
||||||
static final String SESSION_DESTROYED = "sessionDestroyed";
|
|
||||||
static final String PARTICIPANT_JOINED = "participantJoined";
|
|
||||||
static final String PARTICIPANT_LEFT = "participantLeft";
|
|
||||||
static final String CONNECTION_CREATED = "webrtcConnectionCreated";
|
|
||||||
static final String CONNECTION_DESTROYED = "webrtcConnectionDestroyed";
|
|
||||||
static final String RECORDING_STARTED = "recordingStarted";
|
|
||||||
static final String RECORDING_STOPPED = "recordingStopped";
|
|
||||||
|
|
||||||
protected String eventName;
|
|
||||||
protected String sessionId;
|
protected String sessionId;
|
||||||
protected Long timeStamp;
|
protected Long timeStamp;
|
||||||
private Long startTime;
|
private Long startTime;
|
||||||
|
@ -53,17 +44,17 @@ public class CDREvent implements Comparable<CDREvent> {
|
||||||
private Boolean hasVideo;
|
private Boolean hasVideo;
|
||||||
private RecordingLayout recordingLayout;
|
private RecordingLayout recordingLayout;
|
||||||
|
|
||||||
public CDREvent(String eventName, CDREvent event) {
|
public CDREvent(CDREventName eventName, CDREvent event) {
|
||||||
this(eventName, event.participant, event.sessionId, event.mediaOptions, event.receivingFrom, event.startTime, event.reason);
|
this(eventName, event.participant, event.sessionId, event.mediaOptions, event.receivingFrom, event.startTime, event.reason);
|
||||||
this.duration = (int) (this.timeStamp - this.startTime / 1000);
|
this.duration = (int) (this.timeStamp - this.startTime / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDREvent(String eventName, CDREvent event, String reason) {
|
public CDREvent(CDREventName eventName, CDREvent event, String reason) {
|
||||||
this(eventName, event.participant, event.sessionId, event.mediaOptions, event.receivingFrom, event.startTime, reason);
|
this(eventName, event.participant, event.sessionId, event.mediaOptions, event.receivingFrom, event.startTime, reason);
|
||||||
this.duration = (int) (this.timeStamp - this.startTime / 1000);
|
this.duration = (int) (this.timeStamp - this.startTime / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDREvent(String eventName, String sessionId) {
|
public CDREvent(CDREventName eventName, String sessionId) {
|
||||||
this.eventName = eventName;
|
this.eventName = eventName;
|
||||||
if ((sessionId.indexOf('/')) != -1) {
|
if ((sessionId.indexOf('/')) != -1) {
|
||||||
this.sessionId = sessionId.substring(sessionId.lastIndexOf('/') + 1, sessionId.length());
|
this.sessionId = sessionId.substring(sessionId.lastIndexOf('/') + 1, sessionId.length());
|
||||||
|
@ -74,7 +65,7 @@ public class CDREvent implements Comparable<CDREvent> {
|
||||||
this.startTime = this.timeStamp;
|
this.startTime = this.timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDREvent(String eventName, String sessionId, Recording recording) {
|
public CDREvent(CDREventName eventName, String sessionId, Recording recording) {
|
||||||
this.eventName = eventName;
|
this.eventName = eventName;
|
||||||
if ((sessionId.indexOf('/')) != -1) {
|
if ((sessionId.indexOf('/')) != -1) {
|
||||||
this.sessionId = sessionId.substring(sessionId.lastIndexOf('/') + 1, sessionId.length());
|
this.sessionId = sessionId.substring(sessionId.lastIndexOf('/') + 1, sessionId.length());
|
||||||
|
@ -91,13 +82,13 @@ public class CDREvent implements Comparable<CDREvent> {
|
||||||
this.recordingLayout = recording.getRecordingLayout();
|
this.recordingLayout = recording.getRecordingLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDREvent(String eventName, Participant participant, String sessionId) {
|
public CDREvent(CDREventName eventName, Participant participant, String sessionId) {
|
||||||
this(eventName, sessionId);
|
this(eventName, sessionId);
|
||||||
this.participant = participant;
|
this.participant = participant;
|
||||||
this.startTime = this.timeStamp;
|
this.startTime = this.timeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDREvent(String eventName, Participant participant, String sessionId, MediaOptions mediaOptions,
|
public CDREvent(CDREventName eventName, Participant participant, String sessionId, MediaOptions mediaOptions,
|
||||||
String receivingFrom, Long startTime, String reason) {
|
String receivingFrom, Long startTime, String reason) {
|
||||||
this(eventName, sessionId);
|
this(eventName, sessionId);
|
||||||
this.participant = participant;
|
this.participant = participant;
|
||||||
|
@ -171,7 +162,7 @@ public class CDREvent implements Comparable<CDREvent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject root = new JSONObject();
|
JSONObject root = new JSONObject();
|
||||||
root.put(this.eventName, json);
|
root.put(this.eventName.name(), json);
|
||||||
|
|
||||||
return root.toJSONString();
|
return root.toJSONString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2018 OpenVidu (https://openvidu.io/)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.openvidu.server.cdr;
|
||||||
|
|
||||||
|
public enum CDREventName {
|
||||||
|
|
||||||
|
sessionCreated, sessionDestroyed, participantJoined, participantLeft, webrtcConnectionCreated, webrtcConnectionDestroyed, recordingStarted, recordingStopped
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2018 OpenVidu (https://openvidu.io/)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.openvidu.server.cdr;
|
||||||
|
|
||||||
|
public interface CDRLogger {
|
||||||
|
|
||||||
|
public void log(CDREvent event);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2018 OpenVidu (https://openvidu.io/)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.openvidu.server.cdr;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class CDRLoggerFile implements CDRLogger {
|
||||||
|
|
||||||
|
private Logger log = LoggerFactory.getLogger(CDRLoggerFile.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void log(CDREvent event) {
|
||||||
|
log.info("{}", event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,9 +23,6 @@ import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentSkipListSet;
|
import java.util.concurrent.ConcurrentSkipListSet;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import io.openvidu.server.core.MediaOptions;
|
import io.openvidu.server.core.MediaOptions;
|
||||||
import io.openvidu.server.core.Participant;
|
import io.openvidu.server.core.Participant;
|
||||||
import io.openvidu.server.recording.Recording;
|
import io.openvidu.server.recording.Recording;
|
||||||
|
@ -76,47 +73,51 @@ import io.openvidu.server.recording.Recording;
|
||||||
*/
|
*/
|
||||||
public class CallDetailRecord {
|
public class CallDetailRecord {
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(CallDetailRecord.class);
|
private CDRLogger logger;
|
||||||
|
|
||||||
private Map<String, CDREvent> sessions = new ConcurrentHashMap<>();
|
private Map<String, CDREvent> sessions = new ConcurrentHashMap<>();
|
||||||
private Map<String, CDREvent> participants = new ConcurrentHashMap<>();
|
private Map<String, CDREvent> participants = new ConcurrentHashMap<>();
|
||||||
private Map<String, CDREvent> publications = new ConcurrentHashMap<>();
|
private Map<String, CDREvent> publications = new ConcurrentHashMap<>();
|
||||||
private Map<String, Set<CDREvent>> subscriptions = new ConcurrentHashMap<>();
|
private Map<String, Set<CDREvent>> subscriptions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public CallDetailRecord(CDRLogger logger) {
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
public void recordSessionCreated(String sessionId) {
|
public void recordSessionCreated(String sessionId) {
|
||||||
CDREvent e = new CDREvent(CDREvent.SESSION_CREATED, sessionId);
|
CDREvent e = new CDREvent(CDREventName.sessionCreated, sessionId);
|
||||||
this.sessions.put(sessionId, e);
|
this.sessions.put(sessionId, e);
|
||||||
log.info("{}", e);
|
this.logger.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordSessionDestroyed(String sessionId, String reason) {
|
public void recordSessionDestroyed(String sessionId, String reason) {
|
||||||
CDREvent e = this.sessions.remove(sessionId);
|
CDREvent e = this.sessions.remove(sessionId);
|
||||||
log.info("{}", new CDREvent(CDREvent.SESSION_DESTROYED, e, reason));
|
this.logger.log(new CDREvent(CDREventName.sessionDestroyed, e, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordParticipantJoined(Participant participant, String sessionId) {
|
public void recordParticipantJoined(Participant participant, String sessionId) {
|
||||||
CDREvent e = new CDREvent(CDREvent.PARTICIPANT_JOINED, participant, sessionId);
|
CDREvent e = new CDREvent(CDREventName.participantJoined, participant, sessionId);
|
||||||
this.participants.put(participant.getParticipantPublicId(), e);
|
this.participants.put(participant.getParticipantPublicId(), e);
|
||||||
log.info("{}", e);
|
this.logger.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordParticipantLeft(Participant participant, String sessionId, String reason) {
|
public void recordParticipantLeft(Participant participant, String sessionId, String reason) {
|
||||||
CDREvent e = this.participants.remove(participant.getParticipantPublicId());
|
CDREvent e = this.participants.remove(participant.getParticipantPublicId());
|
||||||
log.info("{}", new CDREvent(CDREvent.PARTICIPANT_LEFT, e, reason));
|
this.logger.log(new CDREvent(CDREventName.participantLeft, e, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordNewPublisher(Participant participant, String sessionId, MediaOptions mediaOptions) {
|
public void recordNewPublisher(Participant participant, String sessionId, MediaOptions mediaOptions) {
|
||||||
CDREvent publisher = new CDREvent(CDREvent.CONNECTION_CREATED, participant, sessionId, mediaOptions, null,
|
CDREvent publisher = new CDREvent(CDREventName.webrtcConnectionCreated, participant, sessionId, mediaOptions,
|
||||||
System.currentTimeMillis(), null);
|
null, System.currentTimeMillis(), null);
|
||||||
this.publications.put(participant.getParticipantPublicId(), publisher);
|
this.publications.put(participant.getParticipantPublicId(), publisher);
|
||||||
log.info("{}", publisher);
|
this.logger.log(publisher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean stopPublisher(String participantPublicId, String reason) {
|
public boolean stopPublisher(String participantPublicId, String reason) {
|
||||||
CDREvent publisher = this.publications.remove(participantPublicId);
|
CDREvent publisher = this.publications.remove(participantPublicId);
|
||||||
if (publisher != null) {
|
if (publisher != null) {
|
||||||
publisher = new CDREvent(CDREvent.CONNECTION_DESTROYED, publisher, reason);
|
publisher = new CDREvent(CDREventName.webrtcConnectionDestroyed, publisher, reason);
|
||||||
log.info("{}", publisher);
|
this.logger.log(publisher);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -124,11 +125,11 @@ public class CallDetailRecord {
|
||||||
|
|
||||||
public void recordNewSubscriber(Participant participant, String sessionId, String senderPublicId) {
|
public void recordNewSubscriber(Participant participant, String sessionId, String senderPublicId) {
|
||||||
CDREvent publisher = this.publications.get(senderPublicId);
|
CDREvent publisher = this.publications.get(senderPublicId);
|
||||||
CDREvent subscriber = new CDREvent(CDREvent.CONNECTION_CREATED, participant, sessionId,
|
CDREvent subscriber = new CDREvent(CDREventName.webrtcConnectionCreated, participant, sessionId,
|
||||||
publisher.getMediaOptions(), publisher.getParticipantPublicId(), System.currentTimeMillis(), null);
|
publisher.getMediaOptions(), publisher.getParticipantPublicId(), System.currentTimeMillis(), null);
|
||||||
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);
|
||||||
log.info("{}", subscriber);
|
this.logger.log(subscriber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean stopSubscriber(String participantPublicId, String senderPublicId, String reason) {
|
public boolean stopSubscriber(String participantPublicId, String senderPublicId, String reason) {
|
||||||
|
@ -139,8 +140,8 @@ public class CallDetailRecord {
|
||||||
subscription = it.next();
|
subscription = it.next();
|
||||||
if (subscription.getReceivingFrom().equals(senderPublicId)) {
|
if (subscription.getReceivingFrom().equals(senderPublicId)) {
|
||||||
it.remove();
|
it.remove();
|
||||||
subscription = new CDREvent(CDREvent.CONNECTION_DESTROYED, subscription, reason);
|
subscription = new CDREvent(CDREventName.webrtcConnectionDestroyed, subscription, reason);
|
||||||
log.info("{}", subscription);
|
this.logger.log(subscription);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,11 +150,11 @@ public class CallDetailRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordRecordingStarted(String sessionId, Recording recording) {
|
public void recordRecordingStarted(String sessionId, Recording recording) {
|
||||||
log.info("{}", new CDREvent(CDREvent.RECORDING_STARTED, sessionId, recording));
|
this.logger.log(new CDREvent(CDREventName.recordingStarted, sessionId, recording));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordRecordingStopped(String sessionId, Recording recording) {
|
public void recordRecordingStopped(String sessionId, Recording recording) {
|
||||||
log.info("{}", new CDREvent(CDREvent.RECORDING_STOPPED, sessionId, recording));
|
this.logger.log(new CDREvent(CDREventName.recordingStopped, sessionId, recording));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,12 +38,14 @@ import org.kurento.client.SdpEndpoint;
|
||||||
import org.kurento.client.internal.server.KurentoServerException;
|
import org.kurento.client.internal.server.KurentoServerException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import io.openvidu.client.OpenViduException;
|
import io.openvidu.client.OpenViduException;
|
||||||
import io.openvidu.client.OpenViduException.Code;
|
import io.openvidu.client.OpenViduException.Code;
|
||||||
import io.openvidu.client.internal.ProtocolElements;
|
import io.openvidu.client.internal.ProtocolElements;
|
||||||
import io.openvidu.server.cdr.CallDetailRecord;
|
import io.openvidu.server.cdr.CallDetailRecord;
|
||||||
import io.openvidu.server.config.InfoHandler;
|
import io.openvidu.server.config.InfoHandler;
|
||||||
|
import io.openvidu.server.config.OpenviduConfig;
|
||||||
import io.openvidu.server.core.MediaOptions;
|
import io.openvidu.server.core.MediaOptions;
|
||||||
import io.openvidu.server.core.Participant;
|
import io.openvidu.server.core.Participant;
|
||||||
import io.openvidu.server.kurento.MutedMediaType;
|
import io.openvidu.server.kurento.MutedMediaType;
|
||||||
|
@ -57,6 +59,9 @@ public class KurentoParticipant extends Participant {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(KurentoParticipant.class);
|
private static final Logger log = LoggerFactory.getLogger(KurentoParticipant.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected OpenviduConfig openviduConfig;
|
||||||
|
|
||||||
private InfoHandler infoHandler;
|
private InfoHandler infoHandler;
|
||||||
private CallDetailRecord CDR;
|
private CallDetailRecord CDR;
|
||||||
|
|
||||||
|
@ -102,7 +107,9 @@ public class KurentoParticipant extends Participant {
|
||||||
this.publisher.getEndpoint().addTag("name", publisherStreamId);
|
this.publisher.getEndpoint().addTag("name", publisherStreamId);
|
||||||
addEndpointListeners(this.publisher);
|
addEndpointListeners(this.publisher);
|
||||||
|
|
||||||
|
if (openviduConfig.isCdrEnabled()) {
|
||||||
CDR.recordNewPublisher(this, this.session.getSessionId(), mediaOptions);
|
CDR.recordNewPublisher(this, this.session.getSessionId(), mediaOptions);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +314,7 @@ public class KurentoParticipant extends Participant {
|
||||||
log.info("PARTICIPANT {}: Is now receiving video from {} in room {}", this.getParticipantPublicId(),
|
log.info("PARTICIPANT {}: Is now receiving video from {} in room {}", this.getParticipantPublicId(),
|
||||||
senderName, this.session.getSessionId());
|
senderName, this.session.getSessionId());
|
||||||
|
|
||||||
if (!ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {
|
if (openviduConfig.isCdrEnabled() && !ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {
|
||||||
CDR.recordNewSubscriber(this, this.session.getSessionId(), sender.getParticipantPublicId());
|
CDR.recordNewSubscriber(this, this.session.getSessionId(), sender.getParticipantPublicId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +475,9 @@ public class KurentoParticipant extends Participant {
|
||||||
this.streaming = false;
|
this.streaming = false;
|
||||||
publisher = null;
|
publisher = null;
|
||||||
|
|
||||||
|
if (openviduConfig.isCdrEnabled()) {
|
||||||
CDR.stopPublisher(this.getParticipantPublicId(), reason);
|
CDR.stopPublisher(this.getParticipantPublicId(), reason);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.warn("PARTICIPANT {}: Trying to release publisher endpoint but is null", getParticipantPublicId());
|
log.warn("PARTICIPANT {}: Trying to release publisher endpoint but is null", getParticipantPublicId());
|
||||||
|
@ -480,7 +489,7 @@ public class KurentoParticipant extends Participant {
|
||||||
subscriber.unregisterErrorListeners();
|
subscriber.unregisterErrorListeners();
|
||||||
releaseElement(senderName, subscriber.getEndpoint());
|
releaseElement(senderName, subscriber.getEndpoint());
|
||||||
|
|
||||||
if (!ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {
|
if (openviduConfig.isCdrEnabled() && !ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(this.getParticipantPublicId())) {
|
||||||
CDR.stopSubscriber(this.getParticipantPublicId(), senderName, reason);
|
CDR.stopSubscriber(this.getParticipantPublicId(), senderName, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,14 @@ import org.kurento.client.KurentoClient;
|
||||||
import org.kurento.client.MediaPipeline;
|
import org.kurento.client.MediaPipeline;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import io.openvidu.client.OpenViduException;
|
import io.openvidu.client.OpenViduException;
|
||||||
import io.openvidu.client.OpenViduException.Code;
|
import io.openvidu.client.OpenViduException.Code;
|
||||||
import io.openvidu.client.internal.ProtocolElements;
|
import io.openvidu.client.internal.ProtocolElements;
|
||||||
import io.openvidu.java.client.SessionProperties;
|
import io.openvidu.java.client.SessionProperties;
|
||||||
import io.openvidu.server.cdr.CallDetailRecord;
|
import io.openvidu.server.cdr.CallDetailRecord;
|
||||||
|
import io.openvidu.server.config.OpenviduConfig;
|
||||||
import io.openvidu.server.core.Participant;
|
import io.openvidu.server.core.Participant;
|
||||||
import io.openvidu.server.core.Session;
|
import io.openvidu.server.core.Session;
|
||||||
|
|
||||||
|
@ -52,6 +54,9 @@ public class KurentoSession implements Session {
|
||||||
private final static Logger log = LoggerFactory.getLogger(Session.class);
|
private final static Logger log = LoggerFactory.getLogger(Session.class);
|
||||||
public static final int ASYNC_LATCH_TIMEOUT = 30;
|
public static final int ASYNC_LATCH_TIMEOUT = 30;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected OpenviduConfig openviduConfig;
|
||||||
|
|
||||||
private final ConcurrentMap<String, KurentoParticipant> participants = new ConcurrentHashMap<>();
|
private final ConcurrentMap<String, KurentoParticipant> participants = new ConcurrentHashMap<>();
|
||||||
private String sessionId;
|
private String sessionId;
|
||||||
private SessionProperties sessionProperties;
|
private SessionProperties sessionProperties;
|
||||||
|
@ -110,7 +115,7 @@ public class KurentoSession implements Session {
|
||||||
|
|
||||||
log.info("SESSION {}: Added participant {}", sessionId, participant);
|
log.info("SESSION {}: Added participant {}", sessionId, participant);
|
||||||
|
|
||||||
if (!ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(participant.getParticipantPublicId())) {
|
if (openviduConfig.isCdrEnabled() && !ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(participant.getParticipantPublicId())) {
|
||||||
CDR.recordParticipantJoined(participant, sessionId);
|
CDR.recordParticipantJoined(participant, sessionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +171,7 @@ public class KurentoSession implements Session {
|
||||||
this.removeParticipant(participant, reason);
|
this.removeParticipant(participant, reason);
|
||||||
participant.close(reason);
|
participant.close(reason);
|
||||||
|
|
||||||
if (!ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(participant.getParticipantPublicId())) {
|
if (openviduConfig.isCdrEnabled() && !ProtocolElements.RECORDER_PARTICIPANT_PUBLICID.equals(participant.getParticipantPublicId())) {
|
||||||
CDR.recordParticipantLeft(participant, participant.getSession().getSessionId(), reason);
|
CDR.recordParticipantLeft(participant, participant.getSession().getSessionId(), reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<pattern>%m\n</pattern>
|
<pattern>%m\n</pattern>
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
<logger name="io.openvidu.server.cdr.CallDetailRecord">
|
<logger name="io.openvidu.server.cdr.CDRLoggerFile">
|
||||||
<level value="INFO" />
|
<level value="INFO" />
|
||||||
<appender-ref ref="CDR" />
|
<appender-ref ref="CDR" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
Loading…
Reference in New Issue