Merge remote-tracking branch 'upstream/master'

pull/88/head
miguelrcDEV 2018-04-10 09:22:03 +02:00
commit f084eb4c73
36 changed files with 3522 additions and 8659 deletions

View File

@ -203,9 +203,9 @@ function WebRtcPeer(mode, options, callback) {
var pc = options.peerConnection
var sendSource = options.sendSource || 'webcam'
var dataChannelConfig = options.dataChannelConfig
/*var dataChannelConfig = options.dataChannelConfig
var useDataChannels = options.dataChannels || false
var dataChannel
var dataChannel*/
var guid = uuid.v4()
var configuration = recursive({
@ -251,11 +251,11 @@ function WebRtcPeer(mode, options, callback) {
}
},
'dataChannel': {
/*'dataChannel': {
get: function () {
return dataChannel
}
},
},*/
/**
* @member {(external:ImageData|undefined)} currentFrame
@ -283,7 +283,7 @@ function WebRtcPeer(mode, options, callback) {
// Init PeerConnection
if (!pc) {
pc = new RTCPeerConnection(configuration);
if (useDataChannels && !dataChannel) {
/*if (useDataChannels && !dataChannel) {
var dcId = 'WebRtcPeer-' + self.id
var dcOptions = undefined
if (dataChannelConfig) {
@ -298,7 +298,7 @@ function WebRtcPeer(mode, options, callback) {
dataChannel.onbufferedamountlow = dataChannelConfig.onbufferedamountlow;
dataChannel.onerror = dataChannelConfig.onerror || noop;
}
}
}*/
}
pc.addEventListener('icecandidate', function (event) {
@ -438,14 +438,14 @@ function WebRtcPeer(mode, options, callback) {
localVideo.muted = true
}
this.send = function (data) {
/*this.send = function (data) {
if (dataChannel && dataChannel.readyState === 'open') {
dataChannel.send(data)
} else {
logger.warn(
'Trying to send data over a non-existing or closed data channel')
}
}
}*/
/**
* Callback function invoked when a SDP answer is received. Developers are
@ -706,13 +706,13 @@ WebRtcPeer.prototype.dispose = function () {
logger.debug('Disposing WebRtcPeer')
var pc = this.peerConnection
var dc = this.dataChannel
//var dc = this.dataChannel
try {
if (dc) {
/*if (dc) {
if (dc.signalingState === 'closed') return
dc.close()
}
}*/
if (pc) {
if (pc.signalingState === 'closed') return

View File

@ -72,7 +72,6 @@ export class OpenVidu {
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
dataChannel: true,
mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions)
};
cameraOptions = cameraOptionsAux;
@ -94,7 +93,6 @@ export class OpenVidu {
sendVideo: cameraOptions.video,
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
dataChannel: true,
mediaConstraints: {
video: screenConstraints.video,
audio: false
@ -152,7 +150,6 @@ export class OpenVidu {
sendVideo: cameraOptions.video != null ? cameraOptions.video : true,
activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true,
activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true,
dataChannel: true,
mediaConstraints: {
video: screenConstraints.video,
audio: false
@ -179,7 +176,6 @@ export class OpenVidu {
sendVideo: true,
activeAudio: true,
activeVideo: true,
dataChannel: true,
mediaConstraints: {
audio: true,
video: { width: { ideal: 1280 } }

View File

@ -173,7 +173,7 @@ export class Session {
signalMessage['data'] = signal.data ? signal.data : '';
signalMessage['type'] = signal.type ? signal.type : '';
this.openVidu.openVidu.sendMessage(JSON.stringify(signalMessage));
this.openVidu.openVidu.sendMessage(JSON.stringify(signalMessage), completionHandler);
}
}

View File

@ -49,7 +49,6 @@ export class OpenViduInternal {
sendVideo: true,
activeAudio: true,
activeVideo: true,
dataChannel: true,
mediaConstraints: {
audio: true,
video: { width: { ideal: 1280 } }
@ -351,13 +350,12 @@ export class OpenViduInternal {
}
}
//CHAT
sendMessage(message) {
sendMessage(message: any, completionHandler?: Function) {
this.sendRequest('sendMessage', {
message: message
}, function (error, response) {
if (error) {
console.error(error);
}, (error, response) => {
if (!!completionHandler) {
completionHandler(!!error ? new Error(error.message) : null);
}
});
};

View File

@ -116,24 +116,12 @@ export class SessionInternal {
}
else {
if (!token) {
token = this.randomToken();
}
let joinParams = {
token: token,
token: (!!token) ? token : '',
session: this.sessionId,
metadata: this.options.metadata,
secret: this.openVidu.getSecret(),
recorder: this.openVidu.getRecorder(),
dataChannels: false
}
if (this.localParticipant) {
if (Object.keys(this.localParticipant.getStreams()).some(streamId =>
this.remoteStreams[streamId].isDataChannelEnabled())) {
joinParams.dataChannels = true;
}
}
this.openVidu.sendRequest('joinRoom', joinParams, (error, response) => {
@ -654,8 +642,4 @@ export class SessionInternal {
}
}
private randomToken(): string {
return Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2);
}
}

View File

@ -52,7 +52,6 @@ export interface InboundStreamOptions {
export interface OutboundStreamOptions {
activeAudio: boolean;
activeVideo: boolean;
dataChannel: boolean;
mediaConstraints: any;
sendAudio: boolean;
sendVideo: boolean;
@ -74,7 +73,6 @@ export class Stream {
private showMyRemote = false;
private localMirrored = false;
private chanId = 0;
private dataChannelOpened = false;
inboundOptions: InboundStreamOptions;
outboundOptions: OutboundStreamOptions;
@ -196,37 +194,6 @@ export class Stream {
return this.streamId + '_' + this.chanId++;
}
isDataChannelEnabled() {
return this.outboundOptions.dataChannel;
}
isDataChannelOpened() {
return this.dataChannelOpened;
}
onDataChannelOpen(event) {
console.debug('Data channel is opened');
this.dataChannelOpened = true;
}
onDataChannelClosed(event) {
console.debug('Data channel is closed');
this.dataChannelOpened = false;
}
sendData(data) {
if (this.wp === undefined) {
throw new Error('WebRTC peer has not been created yet');
}
if (!this.dataChannelOpened) {
throw new Error('Data channel is not opened');
}
console.info("Sending through data channel: " + data);
this.wp.send(data);
}
getMediaStream() {
return this.mediaStream;
}
@ -490,15 +457,6 @@ export class Stream {
onicecandidate: this.connection.sendIceCandidate.bind(this.connection),
}
if (this.outboundOptions.dataChannel) {
options.dataChannelConfig = {
id: this.getChannelName(),
onopen: this.onDataChannelOpen,
onclose: this.onDataChannelClosed
};
options.dataChannels = true;
}
if (this.displayMyRemote()) {
this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, error => {
if (error) {

View File

@ -17,7 +17,6 @@
package io.openvidu.client;
import static io.openvidu.client.internal.ProtocolElements.CUSTOMREQUEST_METHOD;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_DATACHANNELS_PARAM;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_METHOD;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERID_PARAM;
import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERSTREAMID_PARAM;
@ -121,14 +120,13 @@ public class OpenViduClient {
this.client.close();
}
public Map<String, List<String>> joinRoom(String roomName, String userName, Boolean dataChannels)
public Map<String, List<String>> joinRoom(String roomName, String userName)
throws IOException {
JsonObject params = new JsonObject();
params.addProperty(JOINROOM_ROOM_PARAM, roomName);
params.addProperty(JOINROOM_USER_PARAM, userName);
if (dataChannels != null) {
params.addProperty(JOINROOM_DATACHANNELS_PARAM, dataChannels);
}
JsonElement result = client.sendRequest(JOINROOM_METHOD, params);
Map<String, List<String>> peers = new HashMap<String, List<String>>();
JsonArray jsonPeers = JsonRoomUtils.getResponseProperty(result, "value", JsonArray.class);

View File

@ -45,7 +45,7 @@ public class OpenViduException extends JsonRpcErrorException {
SIGNAL_FORMAT_INVALID_ERROR_CODE(600), SIGNAL_TO_INVALID_ERROR_CODE(601), SIGNAL_MESSAGE_INVALID_ERROR_CODE(
602),
RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(706), RECORDING_LIST_ERROR_CODE(
RECORDING_PATH_NOT_VALID(708), RECORDING_FILE_EMPTY_ERROR(707), RECORDING_DELETE_ERROR_CODE(706), RECORDING_LIST_ERROR_CODE(
705), RECORDING_STOP_ERROR_CODE(704), RECORDING_START_ERROR_CODE(
703), RECORDING_REPORT_ERROR_CODE(702), RECORDING_COMPLETION_ERROR_CODE(701);
@ -73,7 +73,7 @@ public class OpenViduException extends JsonRpcErrorException {
@Override
public String toString() {
return "CODE: " + getCodeValue() + ". EXCEPTION: " + super.toString();
return super.toString();
}
}

View File

@ -38,7 +38,6 @@ public class ProtocolElements {
public static final String JOINROOM_SECRET_PARAM = "secret";
public static final String JOINROOM_RECORDER_PARAM = "recorder";
public static final String JOINROOM_DATACHANNELS_PARAM = "dataChannels";
public static final String JOINROOM_PEERID_PARAM = "id";
public static final String JOINROOM_PEERSTREAMS_PARAM = "streams";
public static final String JOINROOM_PEERSTREAMID_PARAM = "id";

View File

@ -68,7 +68,7 @@ public class OpenViduClientTest {
Map<String, List<String>> joinResult = new HashMap<String, List<String>>();
when(jsonRpcClient.sendRequest(JOINROOM_METHOD, params)).thenReturn(result);
assertThat(client.joinRoom("room", "user", null), is(joinResult));
assertThat(client.joinRoom("room", "user"), is(joinResult));
}
}

View File

@ -107,13 +107,11 @@ if [[ $CURRENT_UID != $USER_ID ]]; then
DURATION=$(su myuser -c "echo '$INFO' | jq '.format.duration | tonumber'")
STATUS="stopped"
# su myuser -c "echo 'TMP=${TMP}, SIZE=${SIZE}, DURATION=${DURATION}, STATUS=${STATUS}, HAS_AUDIO=${HAS_AUDIO}, HAS_VIDEO=${HAS_VIDEO}' > /recordings/.${VIDEO_NAME}.if.vars"
su myuser -c "jq -c -r \".hasAudio=${HAS_AUDIO} | .hasVideo=${HAS_VIDEO} | .duration=${DURATION} | .size=${SIZE} | .status=\\\"${STATUS}\\\"\" \"/recordings/.recording.${VIDEO_NAME}\" > ${TMP} && mv ${TMP} \"/recordings/.recording.${VIDEO_NAME}\""
else
TMP=$(mktemp /recordings/.${VIDEO_NAME}.XXXXXXXXXXXXXXXXXXXXXXX.if.json)
TMP=$(mktemp /recordings/.${VIDEO_NAME}.XXXXXXXXXXXXXXXXXXXXXXX.else.json)
INFO=$(cat /recordings/${VIDEO_NAME}.info | jq '.')
HAS_AUDIO_AUX=$(echo "$INFO" | jq '.streams[] | select(.codec_type == "audio")')
if [ -z "$HAS_AUDIO_AUX" ]; then HAS_AUDIO=false; else HAS_AUDIO=true; fi
@ -123,8 +121,6 @@ else
DURATION=$(echo "$INFO" | jq '.format.duration | tonumber')
STATUS="stopped"
# echo "TMP=${TMP}, SIZE=${SIZE}, DURATION=${DURATION}, STATUS=${STATUS}, HAS_AUDIO=${HAS_AUDIO}, HAS_VIDEO=${HAS_VIDEO}" > /recordings/.${VIDEO_NAME}.if.vars
jq -c -r ".hasAudio=${HAS_AUDIO} | .hasVideo=${HAS_VIDEO} | .duration=${DURATION} | .size=${SIZE} | .status=\"${STATUS}\"" "/recordings/.recording.${VIDEO_NAME}" > ${TMP} && mv ${TMP} "/recordings/.recording.${VIDEO_NAME}"
fi

View File

@ -9,5 +9,5 @@ command=/bin/bash /kms.sh
redirect_stderr=true
[program:openvidu-server]
command=/bin/bash -c "java -jar -Dopenvidu.publicurl=docker-local /openvidu-server-cbx.jar"
command=/bin/bash -c "java -jar -Dspring.profiles.active=docker /openvidu-server.jar"
redirect_stderr=true

View File

@ -5,6 +5,5 @@ pidfile=/var/run/supervisord.pid;
loglevel=debug
[program:openvidu-server]
command=/bin/bash -c "java -jar -Dopenvidu.publicurl=docker-local /openvidu-server-cbx.jar"
command=/bin/bash -c "java -jar -Dspring.profiles.active=docker /openvidu-server.jar"
redirect_stderr=true

View File

@ -10,6 +10,7 @@ import { routing } from './app.routing';
import { AppMaterialModule } from 'app/app.material.module';
import { InfoService } from './services/info.service';
import { RestService } from './services/rest.service';
import { AppComponent } from './app.component';
import { DashboardComponent } from './components/dashboard/dashboard.component';
@ -37,7 +38,7 @@ import { LayoutBestFitComponent } from './components/layouts/layout-best-fit/lay
entryComponents: [
CredentialsDialogComponent,
],
providers: [InfoService],
providers: [InfoService, RestService],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@ -3,6 +3,7 @@ import { MatDialog, MatDialogRef } from '@angular/material';
import { Subscription } from 'rxjs/Subscription';
import { InfoService } from '../../services/info.service';
import { RestService } from '../../services/rest.service';
import { OpenVidu, Session } from 'openvidu-browser';
import { CredentialsDialogComponent } from './credentials-dialog.component';
@ -32,7 +33,9 @@ export class DashboardComponent implements OnInit, OnDestroy {
showSpinner = false;
msgChain = [];
constructor(private infoService: InfoService, public dialog: MatDialog) {
openviduPublicUrl: string;
constructor(private infoService: InfoService, private restService: RestService, public dialog: MatDialog) {
// Subscription to info updated event raised by InfoService
this.infoSubscription = this.infoService.newInfo$.subscribe(
info => {
@ -61,8 +64,15 @@ export class DashboardComponent implements OnInit, OnDestroy {
console.log('Info websocket message');
console.log(event.data);
this.infoService.updateInfo(event.data);
};
this.restService.getOpenViduPublicUrl()
.then(url => {
this.openviduPublicUrl = url.replace('https://', 'wss://').replace('http://', 'ws://');
})
.catch(error => {
console.error(error);
});
}
@HostListener('window:beforeunload')
@ -97,8 +107,18 @@ export class DashboardComponent implements OnInit, OnDestroy {
dialogRef.afterClosed().subscribe(secret => {
if (secret) {
const port = (location.port) ? location.port : '8443';
this.connectToSession('wss://' + location.hostname + ':' + port + '/testSession?secret=' + secret);
if (!this.openviduPublicUrl) {
this.restService.getOpenViduPublicUrl()
.then((url => {
this.openviduPublicUrl = url.replace('https://', 'wss://').replace('http://', 'ws://');
this.connectToSession(this.openviduPublicUrl + 'testSession?secret=' + secret);
}))
.catch(error => {
console.error(error);
});
} else {
this.connectToSession(this.openviduPublicUrl + 'testSession?secret=' + secret);
}
}
});
}
@ -124,12 +144,12 @@ export class DashboardComponent implements OnInit, OnDestroy {
videoActive: true,
quality: 'MEDIUM'
},
e => {
if (!!e) {
console.error(e);
e => {
if (!!e) {
console.error(e);
}
}
}
);
);
publisherRemote.on('accessAllowed', () => {
this.msgChain.push('Camera access allowed');

View File

@ -17,7 +17,7 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
secret: string;
session: Session;
streams = [];
streams: Stream[] = [];
layout: any;
resizeTimeout;
@ -91,7 +91,14 @@ export class LayoutBestFitComponent implements OnInit, OnDestroy {
}
private deleteRemoteStream(stream: Stream): void {
const index = this.streams.indexOf(stream, 0);
let index = -1;
for (let i = 0; i < this.streams.length; i++) {
if (this.streams[i].streamId === stream.streamId) {
index = i;
break;
}
}
if (index > -1) {
this.streams.splice(index, 1);
}

View File

@ -0,0 +1,34 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class RestService {
private openviduPublicUrl: string;
getOpenViduPublicUrl(): Promise<string> {
return new Promise((resolve, reject) => {
if (!!this.openviduPublicUrl) {
resolve(this.openviduPublicUrl);
} else {
const url = location.protocol + '//' + location.hostname + ((!!location.port) ? (':' + location.port) : '') +
'/config/openvidu-publicurl';
const http = new XMLHttpRequest();
http.onreadystatechange = () => {
if (http.readyState === 4) {
if (http.status === 200) {
this.openviduPublicUrl = http.responseText;
resolve(http.responseText);
} else {
reject('Error getting OpenVidu publicurl');
}
};
}
http.open('GET', url, true);
http.send();
}
});
}
}

View File

@ -16,9 +16,11 @@
package io.openvidu.server;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ws.rs.ProcessingException;
import org.kurento.jsonrpc.JsonUtils;
@ -31,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.core.env.Environment;
@ -125,15 +126,37 @@ public class OpenViduServer implements JsonRpcConfigurer {
public CallDetailRecord cdr() {
return new CallDetailRecord();
}
@Bean
@ConditionalOnMissingBean
public OpenviduConfig openviduConfig() {
return new OpenviduConfig();
}
@Bean
@ConditionalOnMissingBean
public ComposedRecordingService composedRecordingService() {
return new ComposedRecordingService();
}
@Override
public void registerJsonRpcHandlers(JsonRpcHandlerRegistry registry) {
registry.addHandler(rpcHandler().withPingWatchdog(true), "/room");
}
private static String getContainerIp() throws IOException, InterruptedException {
return CommandExecutor.execCommand("/bin/sh", "-c", "hostname -i | awk '{print $1}'");
}
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = start(args);
OpenviduConfig openviduConf = context.getBean(OpenviduConfig.class);
log.info("Using /dev/urandom for secure random generation");
System.setProperty("java.security.egd", "file:/dev/./urandom");
SpringApplication.run(OpenViduServer.class, args);
}
@PostConstruct
public void init() throws MalformedURLException, InterruptedException {
OpenviduConfig openviduConf = openviduConfig();
String publicUrl = openviduConf.getOpenViduPublicUrl();
String type = publicUrl;
@ -142,20 +165,25 @@ public class OpenViduServer implements JsonRpcConfigurer {
case "ngrok":
try {
NgrokRestController ngrok = new NgrokRestController();
String ngrokAppUrl = ngrok.getNgrokAppUrl();
if (ngrokAppUrl.isEmpty()) {
ngrokAppUrl = "(No tunnel 'app' found in ngrok.yml)";
}
final String NEW_LINE = System.getProperty("line.separator");
String str = NEW_LINE + " PUBLIC IP " +
String str = NEW_LINE +
NEW_LINE + " APP PUBLIC IP " +
NEW_LINE + "-------------------------" +
NEW_LINE + ngrok.getNgrokAppUrl() +
NEW_LINE + ngrokAppUrl +
NEW_LINE + "-------------------------" +
NEW_LINE;
System.out.println(str);
log.info(str);
OpenViduServer.publicUrl = ngrok.getNgrokServerUrl().replaceFirst("https://", "wss://");
openviduConf.setFinalUrl(ngrok.getNgrokServerUrl());
} catch (Exception e) {
System.err.println("Ngrok URL was configured, but there was an error connecting to ngrok: "
log.error("Ngrok URL was configured, but there was an error connecting to ngrok: "
+ e.getClass().getName() + " " + e.getMessage());
System.err.println("Fallback to local URL");
log.error("Fallback to local URL");
}
break;
@ -164,18 +192,15 @@ public class OpenViduServer implements JsonRpcConfigurer {
OpenViduServer.publicUrl = "wss://" + getContainerIp() + ":" + openviduConf.getServerPort();
openviduConf.setFinalUrl("https://" + getContainerIp() + ":" + openviduConf.getServerPort());
} catch (Exception e) {
System.err.println("Docker container IP was configured, but there was an error obtaining IP: "
log.error("Docker container IP was configured, but there was an error obtaining IP: "
+ e.getClass().getName() + " " + e.getMessage());
System.err.println("Fallback to local URL");
log.error("Fallback to local URL");
}
break;
case "local":
break;
case "docker-local":
break;
default:
URL url = new URL(publicUrl);
@ -213,9 +238,9 @@ public class OpenViduServer implements JsonRpcConfigurer {
boolean recordingModuleEnabled = openviduConf.isRecordingModuleEnabled();
if (recordingModuleEnabled) {
ComposedRecordingService recordingService = context.getBean(ComposedRecordingService.class);
ComposedRecordingService recordingService = composedRecordingService();
recordingService.setRecordingVersion(openviduConf.getOpenViduRecordingVersion());
System.out.println("Recording module required: Downloading openvidu/openvidu-recording:"
log.info("Recording module required: Downloading openvidu/openvidu-recording:"
+ openviduConf.getOpenViduRecordingVersion() + " Docker image (800 MB aprox)");
boolean imageExists = false;
@ -223,28 +248,34 @@ public class OpenViduServer implements JsonRpcConfigurer {
imageExists = recordingService.recordingImageExistsLocally();
} catch (ProcessingException exception) {
String message = "Exception connecting to Docker daemon: ";
if ("docker-local".equals(openviduConf.getOpenViduPublicUrl())) {
message += "make sure you include flag \"-v /var/run/docker.sock:/var/run/docker.sock\" in \"docker run\" command";
if ("docker".equals(openviduConf.getSpringProfile())) {
final String NEW_LINE = System.getProperty("line.separator");
message += "make sure you include the following flags in your \"docker run\" command:" +
NEW_LINE + " -e openvidu.recording.path=/YOUR/PATH/TO/VIDEO/FILES" +
NEW_LINE + " -e MY_UID=$(id -u $USER)" +
NEW_LINE + " -v /var/run/docker.sock:/var/run/docker.sock" +
NEW_LINE + " -v /YOUR/PATH/TO/VIDEO/FILES:/YOUR/PATH/TO/VIDEO/FILES" +
NEW_LINE;
} else {
message += "you need Docker installed in this machine to enable OpenVidu recorder service";
message += "you need Docker installed in this machine to enable OpenVidu recording service";
}
log.error(message);
throw new RuntimeException(message);
}
if (imageExists) {
System.out.println("Docker image already exists locally");
log.info("Docker image already exists locally");
} else {
Thread t = new Thread(() -> {
boolean keep = true;
System.out.print("Downloading ");
log.info("Downloading ");
while (keep) {
System.out.print(".");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
keep = false;
System.out.println("\nDownload complete");
log.info("\nDownload complete");
}
}
});
@ -252,21 +283,12 @@ public class OpenViduServer implements JsonRpcConfigurer {
recordingService.downloadRecordingImage();
t.interrupt();
t.join();
System.out.println("Docker image available");
log.info("Docker image available");
}
recordingService.initRecordingPath();
}
System.out.println("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
}
private static String getContainerIp() throws IOException, InterruptedException {
return CommandExecutor.execCommand("/bin/sh", "-c", "hostname -i | awk '{print $1}'");
}
public static ConfigurableApplicationContext start(String[] args) {
log.info("Using /dev/urandom for secure random generation");
System.setProperty("java.security.egd", "file:/dev/./urandom");
return SpringApplication.run(OpenViduServer.class, args);
log.info("OpenVidu Server using " + type + " URL: [" + OpenViduServer.publicUrl + "]");
}
}

View File

@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
public class OpenviduConfig {
@Value("${openvidu.publicurl}")
private String openviduPublicUrl; // local, docker-local, ngrok, docker, [FINAL_URL]
private String openviduPublicUrl; // local, ngrok, docker, [FINAL_URL]
@Value("${server.port}")
private String serverPort;
@ -29,6 +29,9 @@ public class OpenviduConfig {
@Value("${openvidu.recording.version}")
String openviduRecordingVersion;
@Value("#{'${spring.profiles.active:}'.length() > 0 ? '${spring.profiles.active:}'.split(',') : \"default\"}")
private String springProfile;
private String finalUrl;
@ -80,4 +83,8 @@ public class OpenviduConfig {
return this.openviduRecordingVersion;
}
public String getSpringProfile() {
return springProfile;
}
}

View File

@ -26,6 +26,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET, "/api/recordings").authenticated()
.antMatchers(HttpMethod.GET, "/api/recordings/**").authenticated()
.antMatchers(HttpMethod.DELETE, "/api/recordings/**").authenticated()
.antMatchers(HttpMethod.GET, "/config/**").authenticated()
.antMatchers("/").authenticated();
if (openviduConf.getOpenViduRecordingFreeAccess()) {

View File

@ -149,7 +149,7 @@ public abstract class SessionManager {
public String newSessionId(SessionProperties sessionProperties) {
String sessionId = OpenViduServer.publicUrl;
sessionId += "/" + RandomStringUtils.randomAlphanumeric(16).toLowerCase();
sessionId += "/" + this.generateRandomChain();
this.sessionidTokenTokenobj.put(sessionId, new ConcurrentHashMap<>());
this.sessionidParticipantpublicidParticipant.put(sessionId, new ConcurrentHashMap<>());
@ -159,17 +159,17 @@ public abstract class SessionManager {
return sessionId;
}
public String newToken(String sessionId, ParticipantRole role, String serverMetadata) {
public String newToken(String sessionId, ParticipantRole role, String serverMetadata) throws OpenViduException {
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null
&& this.sessionidTokenTokenobj.get(sessionId) != null) {
if (isMetadataFormatCorrect(serverMetadata)) {
String token = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
String token = this.generateRandomChain();
this.sessionidTokenTokenobj.get(sessionId).put(token, new Token(token, role, serverMetadata));
showTokens();
return token;
} else {
throw new OpenViduException(Code.GENERIC_ERROR_CODE,
"Data invalid format. Max length allowed is 1000 chars");
"Data invalid format. Max length allowed is 10000 chars");
}
} else {
System.out.println("Error: the sessionId [" + sessionId + "] is not valid");
@ -223,8 +223,8 @@ public abstract class SessionManager {
}
public boolean isMetadataFormatCorrect(String metadata) {
// Max 1000 chars
return (metadata.length() <= 1000);
// Max 10000 chars
return (metadata.length() <= 10000);
}
public void newInsecureParticipant(String participantPrivateId) {
@ -234,12 +234,12 @@ public abstract class SessionManager {
public Participant newParticipant(String sessionId, String participantPrivatetId, Token token,
String clientMetadata) {
if (this.sessionidParticipantpublicidParticipant.get(sessionId) != null) {
String participantPublicId = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
String participantPublicId = this.generateRandomChain();
ConcurrentHashMap<String, Participant> participantpublicidParticipant = this.sessionidParticipantpublicidParticipant
.get(sessionId);
while (participantpublicidParticipant.containsKey(participantPublicId)) {
// Avoid random 'participantpublicid' collisions
participantPublicId = RandomStringUtils.randomAlphanumeric(16).toLowerCase();
participantPublicId = this.generateRandomChain();
}
Participant p = new Participant(participantPrivatetId, participantPublicId, token, clientMetadata);
this.sessionidParticipantpublicidParticipant.get(sessionId).put(participantPublicId, p);
@ -267,9 +267,6 @@ public abstract class SessionManager {
if (t != null) {
return t;
} else {
if (isInsecureParticipant(participantPrivateId)) {
return null;
}
throw new OpenViduException(Code.TOKEN_CANNOT_BE_CREATED_ERROR_CODE, sessionId);
}
} else {
@ -288,6 +285,10 @@ public abstract class SessionManager {
public void showAllParticipants() {
log.info("<SESSIONID, PARTICIPANTS>: {}", this.sessionidParticipantpublicidParticipant.toString());
}
public String generateRandomChain() {
return RandomStringUtils.randomAlphanumeric(16).toLowerCase();
}
/**
* Closes all resources. This method has been annotated with the @PreDestroy

View File

@ -35,7 +35,6 @@ public class KurentoParticipant extends Participant {
private InfoHandler infoHandler;
private boolean dataChannels = false;
private boolean webParticipant = true;
private final KurentoSession session;
@ -52,7 +51,7 @@ public class KurentoParticipant extends Participant {
participant.getClientMetadata());
this.session = kurentoSession;
this.pipeline = pipeline;
this.publisher = new PublisherEndpoint(webParticipant, dataChannels, this, participant.getParticipantPublicId(),
this.publisher = new PublisherEndpoint(webParticipant, this, participant.getParticipantPublicId(),
pipeline);
for (Participant other : session.getParticipants()) {
@ -199,7 +198,7 @@ public class KurentoParticipant extends Participant {
log.info("PARTICIPANT {}: unpublishing media stream from room {}", this.getParticipantPublicId(),
this.session.getSessionId());
releasePublisherEndpoint();
this.publisher = new PublisherEndpoint(webParticipant, dataChannels, this, this.getParticipantPublicId(),
this.publisher = new PublisherEndpoint(webParticipant, this, this.getParticipantPublicId(),
pipeline);
log.info(
"PARTICIPANT {}: released publisher endpoint and left it initialized (ready for future streaming)",

View File

@ -53,7 +53,6 @@ public abstract class MediaEndpoint {
private static Logger log;
private boolean web = false;
private boolean dataChannels = false;
private WebRtcEndpoint webEndpoint = null;
private RtpEndpoint endpoint = null;
@ -75,13 +74,12 @@ public abstract class MediaEndpoint {
* Constructor to set the owner, the endpoint's name and the media pipeline.
*
* @param web
* @param dataChannels
* @param owner
* @param endpointName
* @param pipeline
* @param log
*/
public MediaEndpoint(boolean web, boolean dataChannels, KurentoParticipant owner, String endpointName,
public MediaEndpoint(boolean web, KurentoParticipant owner, String endpointName,
MediaPipeline pipeline, Logger log) {
if (log == null) {
MediaEndpoint.log = LoggerFactory.getLogger(MediaEndpoint.class);
@ -89,7 +87,6 @@ public abstract class MediaEndpoint {
MediaEndpoint.log = log;
}
this.web = web;
this.dataChannels = dataChannels;
this.owner = owner;
this.setEndpointName(endpointName);
this.setMediaPipeline(pipeline);
@ -244,9 +241,9 @@ public abstract class MediaEndpoint {
protected void internalEndpointInitialization(final CountDownLatch endpointLatch) {
if (this.isWeb()) {
WebRtcEndpoint.Builder builder = new WebRtcEndpoint.Builder(pipeline);
if (this.dataChannels) {
/*if (this.dataChannels) {
builder.useDataChannels();
}
}*/
builder.buildAsync(new Continuation<WebRtcEndpoint>() {
@Override
public void onSuccess(WebRtcEndpoint result) throws Exception {

View File

@ -55,9 +55,9 @@ public class PublisherEndpoint extends MediaEndpoint {
private Map<String, ListenerSubscription> elementsErrorSubscriptions =
new HashMap<String, ListenerSubscription>();
public PublisherEndpoint(boolean web, boolean dataChannels, KurentoParticipant owner,
public PublisherEndpoint(boolean web, KurentoParticipant owner,
String endpointName, MediaPipeline pipeline) {
super(web, dataChannels, owner, endpointName, pipeline, log);
super(web, owner, endpointName, pipeline, log);
}
@Override

View File

@ -39,7 +39,7 @@ public class SubscriberEndpoint extends MediaEndpoint {
public SubscriberEndpoint(boolean web, KurentoParticipant owner, String endpointName,
MediaPipeline pipeline) {
super(web, false, owner, endpointName, pipeline, log);
super(web, owner, endpointName, pipeline, log);
}
public synchronized String subscribe(String sdpOffer, PublisherEndpoint publisher) {

View File

@ -3,6 +3,9 @@ package io.openvidu.server.recording;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@ -52,7 +55,7 @@ import io.openvidu.server.core.Session;
@Service
public class ComposedRecordingService {
private Logger log = LoggerFactory.getLogger(ComposedRecordingService.class);
private static final Logger log = LoggerFactory.getLogger(ComposedRecordingService.class);
@Autowired
OpenviduConfig openviduConfig;
@ -82,7 +85,7 @@ public class ComposedRecordingService {
String secret = openviduConfig.getOpenViduSecret();
Recording recording = new Recording(session.getSessionId(), videoId, videoId);
this.sessionsRecordings.put(session.getSessionId(), recording);
this.startingRecordings.put(recording.getId(), recording);
@ -119,7 +122,7 @@ public class ComposedRecordingService {
this.sessionsContainers.put(session.getSessionId(), containerId);
recording.setStatus(Recording.Status.started);
this.startedRecordings.put(recording.getId(), recording);
this.startingRecordings.remove(recording.getId());
@ -213,7 +216,8 @@ public class ComposedRecordingService {
throw e;
}
} catch (DockerClientException e) {
log.info("Error on Pulling '{}' image. Probably because the user has stopped the execution", IMAGE_NAME + ":" + IMAGE_TAG);
log.info("Error on Pulling '{}' image. Probably because the user has stopped the execution",
IMAGE_NAME + ":" + IMAGE_TAG);
throw e;
}
}
@ -225,15 +229,15 @@ public class ComposedRecordingService {
public Recording getStartedRecording(String recordingId) {
return this.startedRecordings.get(recordingId);
}
public Recording getStartingRecording(String recordingId) {
return this.startingRecordings.get(recordingId);
}
private String runRecordingContainer(List<String> envs, String containerName) {
Volume volume1 = new Volume("/recordings");
CreateContainerCmd cmd = dockerClient.createContainerCmd(IMAGE_NAME + ":" + IMAGE_TAG).withName(containerName).withEnv(envs)
.withNetworkMode("host").withVolumes(volume1)
CreateContainerCmd cmd = dockerClient.createContainerCmd(IMAGE_NAME + ":" + IMAGE_TAG).withName(containerName)
.withEnv(envs).withNetworkMode("host").withVolumes(volume1)
.withBinds(new Bind(openviduConfig.getOpenViduRecordingPath(), volume1));
CreateContainerResponse container = null;
try {
@ -273,7 +277,7 @@ public class ComposedRecordingService {
public Collection<Recording> getAllRecordings() {
return this.getRecordingEntitiesFromHost();
}
public Collection<Recording> getStartingRecordings() {
return this.startingRecordings.values();
}
@ -289,9 +293,33 @@ public class ComposedRecordingService {
.collect(Collectors.toSet());
}
public File initRecordingPath() throws OpenViduException {
try {
Path path = Files.createDirectories(Paths.get(this.openviduConfig.getOpenViduRecordingPath()));
if (!Files.isWritable(path)) {
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID,
"The recording path '" + this.openviduConfig.getOpenViduRecordingPath()
+ "' is not valid. Reason: OpenVidu Server process needs write permissions");
}
log.info("Recording path: {}", this.openviduConfig.getOpenViduRecordingPath());
return path.toFile();
} catch (IOException e) {
throw new OpenViduException(Code.RECORDING_PATH_NOT_VALID,
"The recording path '" + this.openviduConfig.getOpenViduRecordingPath() + "' is not valid. Reason: "
+ e.getClass().getName());
}
}
private Set<String> getRecordingIdsFromHost() {
File folder = new File(this.openviduConfig.getOpenViduRecordingPath());
File[] files = folder.listFiles();
if (files == null) {
files = initRecordingPath().listFiles();
}
Set<String> fileNamesNoExtension = new HashSet<>();
for (int i = 0; i < files.length; i++) {
if (files[i].isFile() && !files[i].getName().startsWith(RECORDING_ENTITY_FILE)) {
@ -304,6 +332,11 @@ public class ComposedRecordingService {
private Set<Recording> getRecordingEntitiesFromHost() {
File folder = new File(this.openviduConfig.getOpenViduRecordingPath());
File[] files = folder.listFiles();
if (files == null) {
files = initRecordingPath().listFiles();
}
Set<Recording> recordingEntities = new HashSet<>();
for (int i = 0; i < files.length; i++) {
Recording recording = this.getRecordingFromFile(files[i]);
@ -399,7 +432,7 @@ public class ComposedRecordingService {
this.removeDockerContainer(containerId);
throw e;
}
public void setRecordingVersion(String version) {
this.IMAGE_TAG = version;
}

View File

@ -0,0 +1,38 @@
package io.openvidu.server.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import io.openvidu.server.config.OpenviduConfig;
/**
*
* @author Pablo Fuente Pérez
*/
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/config")
public class ConfigRestController {
@Autowired
OpenviduConfig openviduConfig;
@RequestMapping(value = "/openvidu-publicurl", method = RequestMethod.GET)
public String getOpenViduPublicUrl() {
return openviduConfig.getFinalUrl();
}
@RequestMapping(value = "/openvidu-recording", method = RequestMethod.GET)
public Boolean getOpenViduRecordingEnabled() {
return openviduConfig.isRecordingModuleEnabled();
}
@RequestMapping(value = "/openvidu-recording-path", method = RequestMethod.GET)
public String getOpenViduRecordingPath() {
return openviduConfig.getOpenViduRecordingPath();
}
}

View File

@ -140,7 +140,7 @@ public class SessionRestController {
HttpStatus.BAD_REQUEST);
} catch (OpenViduException e) {
return this.generateErrorResponse(
"Metadata [" + params.get("data") + "] unexpected format. Max length allowed is 1000 chars",
"Metadata [" + params.get("data") + "] unexpected format. Max length allowed is 10000 chars",
"/api/tokens", HttpStatus.BAD_REQUEST);
}
}

View File

@ -21,6 +21,7 @@ import io.openvidu.client.internal.ProtocolElements;
import io.openvidu.server.config.OpenviduConfig;
import io.openvidu.server.core.MediaOptions;
import io.openvidu.server.core.Participant;
import io.openvidu.server.core.ParticipantRole;
import io.openvidu.server.core.SessionManager;
import io.openvidu.server.core.Token;
@ -52,7 +53,30 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
log.debug("WebSocket session #{} - Request: {}", participantPrivateId, request);
RpcConnection rpcConnection = notificationService.addTransaction(transaction, request);
RpcConnection rpcConnection;
if (ProtocolElements.JOINROOM_METHOD.equals(request.getMethod())) {
// Store new RpcConnection information if method 'joinRoom'
rpcConnection = notificationService.newRpcConnection(transaction, request);
} else if (notificationService.getRpcConnection(participantPrivateId) == null) {
// Throw exception if any method is called before 'joinRoom'
log.warn(
"No connection found for participant with privateId {} when trying to execute method '{}'. Method 'Session.connect()' must be the first operation called in any session",
participantPrivateId, request.getMethod());
throw new OpenViduException(Code.TRANSPORT_ERROR_CODE,
"No connection found for participant with privateId " + participantPrivateId
+ ". Method 'Session.connect()' must be the first operation called in any session");
}
rpcConnection = notificationService.addTransaction(transaction, request);
String sessionId = rpcConnection.getSessionId();
if (sessionId == null && !ProtocolElements.JOINROOM_METHOD.equals(request.getMethod())) {
log.warn(
"No session information found for participant with privateId {} when trying to execute method '{}'. Method 'Session.connect()' must be the first operation called in any session",
participantPrivateId, request.getMethod());
throw new OpenViduException(Code.TRANSPORT_ERROR_CODE,
"No session information found for participant with privateId " + participantPrivateId
+ ". Method 'Session.connect()' must be the first operation called in any session");
}
transaction.startAsync();
@ -93,19 +117,20 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
String token = getStringParam(request, ProtocolElements.JOINROOM_TOKEN_PARAM);
String secret = getStringParam(request, ProtocolElements.JOINROOM_SECRET_PARAM);
String participantPrivatetId = rpcConnection.getParticipantPrivateId();
boolean recorder = false;
try {
recorder = getBooleanParam(request, ProtocolElements.JOINROOM_RECORDER_PARAM);
} catch (RuntimeException e) {
// Nothing happens. 'recorder' param to false
}
boolean generateRecorderParticipant = false;
if (openviduConfig.isOpenViduSecret(secret)) {
sessionManager.newInsecureParticipant(participantPrivatetId);
token = sessionManager.generateRandomChain();
if (recorder) {
generateRecorderParticipant = true;
}
@ -119,7 +144,7 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
Token tokenObj = sessionManager.consumeToken(sessionId, participantPrivatetId, token);
Participant participant;
if (generateRecorderParticipant) {
participant = sessionManager.newRecorderParticipant(sessionId, participantPrivatetId, tokenObj,
clientMetadata);
@ -127,14 +152,14 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
participant = sessionManager.newParticipant(sessionId, participantPrivatetId, tokenObj,
clientMetadata);
}
rpcConnection.setSessionId(sessionId);
sessionManager.joinRoom(participant, sessionId, request.getId());
} else {
log.error("ERROR: Metadata format is incorrect");
log.error("ERROR: Metadata format set in client-side is incorrect");
throw new OpenViduException(Code.USER_METADATA_FORMAT_INVALID_ERROR_CODE,
"Unable to join room. The metadata received has an invalid format");
"Unable to join room. The metadata received from the client-side has an invalid format (max length allowed is 10000 chars)");
}
} else {
log.error("ERROR: sessionId or token not valid");
@ -259,6 +284,16 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
@Override
public void afterConnectionClosed(Session rpcSession, String status) throws Exception {
log.info("Connection closed for WebSocket session: {} - Status: {}", rpcSession.getSessionId(), status);
RpcConnection rpc = this.notificationService.closeRpcSession(rpcSession.getSessionId());
if (rpc != null && rpc.getSessionId() != null) {
io.openvidu.server.core.Session session = this.sessionManager.getSession(rpc.getSessionId());
if (session != null && session.getParticipantByPrivateId(rpc.getParticipantPrivateId()) != null) {
leaveRoomAfterConnClosed(rpc.getParticipantPrivateId());
}
}
this.notificationService.showRpcConnections();
String rpcSessionId = rpcSession.getSessionId();
if (this.webSocketTransportError.get(rpcSessionId) != null) {
@ -293,21 +328,24 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
public static String getStringParam(Request<JsonObject> request, String key) {
if (request.getParams() == null || request.getParams().get(key) == null) {
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod() + "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod()
+ "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
}
return request.getParams().get(key).getAsString();
}
public static int getIntParam(Request<JsonObject> request, String key) {
if (request.getParams() == null || request.getParams().get(key) == null) {
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod() + "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod()
+ "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
}
return request.getParams().get(key).getAsInt();
}
public static boolean getBooleanParam(Request<JsonObject> request, String key) {
if (request.getParams() == null || request.getParams().get(key) == null) {
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod() + "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
throw new RuntimeException("Request element '" + key + "' is missing in method '" + request.getMethod()
+ "'. CHECK THAT 'openvidu-server' AND 'openvidu-browser' SHARE THE SAME VERSION NUMBER");
}
return request.getParams().get(key).getAsBoolean();
}

View File

@ -18,19 +18,22 @@ public class RpcNotificationService {
private static final Logger log = LoggerFactory.getLogger(RpcNotificationService.class);
private static ConcurrentMap<String, RpcConnection> rpcConnections = new ConcurrentHashMap<>();
private ConcurrentMap<String, RpcConnection> rpcConnections = new ConcurrentHashMap<>();
public RpcConnection newRpcConnection(Transaction t, Request<JsonObject> request) {
String participantPrivateId = t.getSession().getSessionId();
RpcConnection connection = new RpcConnection(t.getSession());
RpcConnection oldConnection = rpcConnections.putIfAbsent(participantPrivateId, connection);
if (oldConnection != null) {
log.warn("Concurrent initialization of rpcSession #{}", participantPrivateId);
connection = oldConnection;
}
return connection;
}
public RpcConnection addTransaction(Transaction t, Request<JsonObject> request) {
String participantPrivateId = t.getSession().getSessionId();
RpcConnection connection = rpcConnections.get(participantPrivateId);
if (connection == null) {
connection = new RpcConnection(t.getSession());
RpcConnection oldConnection = rpcConnections.putIfAbsent(participantPrivateId, connection);
if (oldConnection != null) {
log.warn("Concurrent initialization of rpcSession #{}", participantPrivateId);
connection = oldConnection;
}
}
connection.addTransaction(request.getId(), t);
return connection;
}
@ -82,20 +85,21 @@ public class RpcNotificationService {
}
}
public void closeRpcSession(String participantPrivateId) {
RpcConnection rpcSession = rpcConnections.get(participantPrivateId);
public RpcConnection closeRpcSession(String participantPrivateId) {
RpcConnection rpcSession = rpcConnections.remove(participantPrivateId);
if (rpcSession == null || rpcSession.getSession() == null) {
log.error("No session found for private id {}, unable to cleanup", participantPrivateId);
return;
return null;
}
Session s = rpcSession.getSession();
try {
s.close();
log.info("Closed session for participant with private id {}", participantPrivateId);
return rpcSession;
} catch (IOException e) {
log.error("Error closing session for participant with private id {}", participantPrivateId, e);
}
rpcConnections.remove(participantPrivateId);
return null;
}
private Transaction getAndRemoveTransaction(String participantPrivateId, Integer transactionId) {
@ -111,7 +115,11 @@ public class RpcNotificationService {
}
public void showRpcConnections() {
log.info("<PRIVATE_ID, RPC_CONNECTION>: {}", RpcNotificationService.rpcConnections.toString());
log.info("<PRIVATE_ID, RPC_CONNECTION>: {}", this.rpcConnections.toString());
}
public RpcConnection getRpcConnection(String participantPrivateId) {
return this.rpcConnections.get(participantPrivateId);
}
}

View File

@ -0,0 +1,21 @@
spring.profiles.active=docker
server.address: 0.0.0.0
server.ssl.enabled: true
openvidu.recording.version: 1.8.0
server.port: 8443
server.ssl.key-store: classpath:openvidu-selfsigned.jks
server.ssl.key-store-password: openvidu
server.ssl.key-store-type: JKS
server.ssl.key-alias: openvidu-selfsigned
kms.uris=[\"ws://localhost:8888/kurento\"]
openvidu.secret: MY_SECRET
openvidu.publicurl: local
openvidu.cdr: false
openvidu.recording: false
openvidu.recording.path: /opt/openvidu/recordings
openvidu.recording.free-access: false

View File

@ -1 +1 @@
{"version":3,"sources":["webpack/bootstrap 1569d3edbc6f13a7612a"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t\"inline\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 1569d3edbc6f13a7612a"],"sourceRoot":"webpack:///"}
{"version":3,"sources":["webpack/bootstrap 934236eddc4c2d323572"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA,kDAA0C,oBAAoB,WAAW","file":"inline.bundle.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t\"inline\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 934236eddc4c2d323572"],"sourceRoot":"webpack:///"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -201,7 +201,7 @@ public class FakeParticipant implements Closeable {
public void joinRoom() {
try {
addPeers(jsonRpcClient.joinRoom(room, name, null));
addPeers(jsonRpcClient.joinRoom(room, name));
log.info("Joined room {}: {} peers", room, peerStreams);
if (autoMedia) {
log.debug("Automedia on, publishing and subscribing to as many as {} publishers",

View File

@ -194,6 +194,9 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
this.session.connect(token, this.clientData, (error) => {
if (!error) {
this.changeDetector.detectChanges();
if (this.publishTo) {
this.audioMuted = !this.activeAudio;
@ -428,7 +431,14 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
data: 'Test message',
to: [],
type: 'chat'
});
},
error => {
if (error) {
console.error(error);
} else {
console.log('Message succesfully sent');
}
});
}
recordPublisher(): void {