diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 5e950306..221764ef 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -36,7 +36,7 @@ This is an EXTREMELY IMPORTANT STEP. If we are able to replicate the error in an **OpenVidu deployment info** How is your OpenVidu Server instance deployed when you get the bug. A couple of possible examples are listed below: - Docker container as explained in OpenVidu tutorials, run with command `docker run ...` on macOS Catalina 10.15.1 -- AWS deployment as explained in OpenVidu Docs (https://openvidu.io/docs/deployment/deploying-aws/) +- AWS deployment as explained in OpenVidu Docs (https://docs.openvidu.io/en/stable/deployment/deploying-aws/) > **IMPORTANT NOTE**: please, if you think the bug might be related to OpenVidu Server side, specify here if you are also getting the error by using OpenVidu Server Demos instance. This instance is publicly available (use it only for this test, because it is not secure!!!): **URL**: `https://demos.openvidu.io:4443`, **SECRET**: `MY_SECRET` diff --git a/.gitignore b/.gitignore index ef7a2314..965d733d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,10 @@ /target .classpath +.idea .project .settings +*.iml *orig .springBeans *tmp/ diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduException.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduException.java new file mode 100644 index 00000000..b4bd1cdb --- /dev/null +++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduException.java @@ -0,0 +1,35 @@ +/* + * (C) Copyright 2017-2020 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.java.client; + +/** + * Defines a generic OpenVidu exception + */ +public class OpenViduException extends Exception { + + private static final long serialVersionUID = 1L; + + protected OpenViduException(String message) { + super(message); + } + + protected OpenViduException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduHttpException.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduHttpException.java index bec440cd..31bb86fd 100644 --- a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduHttpException.java +++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduHttpException.java @@ -20,7 +20,7 @@ package io.openvidu.java.client; /** * Defines error responses from OpenVidu Server */ -public class OpenViduHttpException extends Exception { +public class OpenViduHttpException extends OpenViduException { private static final long serialVersionUID = 1L; private int status; diff --git a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduJavaClientException.java b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduJavaClientException.java index aa8307a2..7c3f8734 100644 --- a/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduJavaClientException.java +++ b/openvidu-java-client/src/main/java/io/openvidu/java/client/OpenViduJavaClientException.java @@ -20,7 +20,7 @@ package io.openvidu.java.client; /** * Defines unexpected internal errors in OpenVidu Java Client */ -public class OpenViduJavaClientException extends Exception { +public class OpenViduJavaClientException extends OpenViduException { private static final long serialVersionUID = 1L; diff --git a/openvidu-java-client/src/test/java/io/openvidu/java/client/OpenViduHttpExceptionTest.java b/openvidu-java-client/src/test/java/io/openvidu/java/client/OpenViduHttpExceptionTest.java new file mode 100644 index 00000000..15c5d6a4 --- /dev/null +++ b/openvidu-java-client/src/test/java/io/openvidu/java/client/OpenViduHttpExceptionTest.java @@ -0,0 +1,11 @@ +package io.openvidu.java.client; + +import org.junit.Test; + +public class OpenViduHttpExceptionTest { + + @Test(expected = OpenViduException.class) + public void shouldThrowGenericOpenViduException() throws OpenViduHttpException { + throw new OpenViduHttpException(401); + } +} diff --git a/openvidu-java-client/src/test/java/io/openvidu/java/client/OpenViduJavaClientExceptionTest.java b/openvidu-java-client/src/test/java/io/openvidu/java/client/OpenViduJavaClientExceptionTest.java new file mode 100644 index 00000000..23ce0c10 --- /dev/null +++ b/openvidu-java-client/src/test/java/io/openvidu/java/client/OpenViduJavaClientExceptionTest.java @@ -0,0 +1,11 @@ +package io.openvidu.java.client; + +import org.junit.Test; + +public class OpenViduJavaClientExceptionTest { + + @Test(expected = OpenViduException.class) + public void shouldThrowGenericOpenViduException() throws OpenViduJavaClientException { + throw new OpenViduJavaClientException("message"); + } +} diff --git a/openvidu-server/README.md b/openvidu-server/README.md index bff814e0..511f34e8 100644 --- a/openvidu-server/README.md +++ b/openvidu-server/README.md @@ -10,8 +10,8 @@ openvidu-server - **Description**: OpenVidu server side. It receives the remote procedure calls from openvidu-browser and manage all the media streams operations. You don't have to make direct use of it. Just to run it. -- **Docs**: [REST API](https://openvidu.io/docs/reference-docs/REST-API/) +- **Docs**: [REST API](https://docs.openvidu.io/en/stable/reference-docs/REST-API/) -- **Release**: [OpenVidu Artifacts](https://openvidu.io/docs/releases/) +- **Release**: [OpenVidu Artifacts](https://docs.openvidu.io/en/stable/releases/) [OpenViduLogo]: https://secure.gravatar.com/avatar/5daba1d43042f2e4e85849733c8e5702?s=120 diff --git a/openvidu-server/docker/openvidu-docker-compose/.env b/openvidu-server/docker/openvidu-docker-compose/.env index ce7c8632..64aa80bd 100644 --- a/openvidu-server/docker/openvidu-docker-compose/.env +++ b/openvidu-server/docker/openvidu-docker-compose/.env @@ -1,6 +1,6 @@ # OpenVidu configuration # ---------------------- -# Documentation: https://openvidu.io/docs/reference-docs/openvidu-server-params/ +# Documentation: https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/ # NOTE: This file doesn't need to quote assignment values, like most shells do. # All values are stored as-is, even if they contain spaces, so don't quote them. @@ -16,15 +16,14 @@ OPENVIDU_SECRET= # - selfsigned: Self signed certificate. Not recommended for production use. # Users will see an ERROR when connected to web page. # - owncert: Valid certificate purchased in a Internet services company. -# Please put the certificates in same folder as docker-compose.yml -# file with names certificate.key and certificate.cert. +# Please put the certificates files inside folder ./owncert +# with names certificate.key and certificate.cert # - letsencrypt: Generate a new certificate using letsencrypt. Please set the # required contact email for Let's Encrypt in LETSENCRYPT_EMAIL # variable. CERTIFICATE_TYPE=selfsigned -# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for -# notifications +# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for notifications LETSENCRYPT_EMAIL=user@example.com # Parameter "openvidu.recording.path" diff --git a/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml b/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml index a078c047..b80c6ebd 100644 --- a/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml +++ b/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml @@ -7,7 +7,7 @@ # Application based on OpenVidu should be specified in # docker-compose.override.yml file # -# This docker-compose file coordinates all services of OpenVidu CE Plarform. +# This docker-compose file coordinates all services of OpenVidu CE Platform. # # This file will be overridden when update OpenVidu Platform # diff --git a/openvidu-server/docker/openvidu-docker-compose/readme.md b/openvidu-server/docker/openvidu-docker-compose/readme.md index 52287051..3817c4de 100644 --- a/openvidu-server/docker/openvidu-docker-compose/readme.md +++ b/openvidu-server/docker/openvidu-docker-compose/readme.md @@ -76,7 +76,7 @@ The `.env` file looks like this: ``` # OpenVidu configuration # ---------------------- -# Documentation: https://openvidu.io/docs/reference-docs/openvidu-server-params/ +# Documentation: https://docs.openvidu.io/en/stable/reference-docs/openvidu-server-params/ # NOTE: This file doesn't need to quote assignment values, like most shells do. # All values are stored as-is, even if they contain spaces, so don't quote them. @@ -92,15 +92,14 @@ OPENVIDU_SECRET= # - selfsigned: Self signed certificate. Not recommended for production use. # Users will see an ERROR when connected to web page. # - owncert: Valid certificate purchased in a Internet services company. -# Please put the certificates in same folder as docker-compose.yml -# file with names certificate.key and certificate.cert. +# Please put the certificates files inside folder ./owncert +# with names certificate.key and certificate.cert # - letsencrypt: Generate a new certificate using letsencrypt. Please set the # required contact email for Let's Encrypt in LETSENCRYPT_EMAIL # variable. CERTIFICATE_TYPE=selfsigned -# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for -# notifications +# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for notifications LETSENCRYPT_EMAIL=user@example.com ... @@ -112,7 +111,7 @@ LETSENCRYPT_EMAIL=user@example.com ### Videoconference application -By default, the [OpenVidu Call application](https://openvidu.io/docs/demos/openvidu-call/) is deployed alongside OpenVide Platform. It is accesible in the URL: +By default, the [OpenVidu Call application](https://docs.openvidu.io/en/stable/demos/openvidu-call/) is deployed alongside OpenVide Platform. It is accesible in the URL: ``` https://openvidu_domain_or_public_ip/ diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java index 7ccceb2e..eab45ca5 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java @@ -38,11 +38,13 @@ import org.kurento.client.PlayerEndpoint; import org.kurento.client.RtpEndpoint; import org.kurento.client.SdpEndpoint; import org.kurento.client.WebRtcEndpoint; +import org.kurento.client.internal.server.KurentoServerException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonNull; import com.google.gson.JsonObject; import io.openvidu.client.OpenViduException; @@ -536,7 +538,13 @@ public abstract class MediaEndpoint { json.addProperty("createdAt", this.createdAt); json.addProperty("webrtcEndpointName", this.getEndpointName()); if (!this.isPlayerEndpoint()) { - json.addProperty("remoteSdp", ((SdpEndpoint) this.getEndpoint()).getRemoteSessionDescriptor()); + try { + json.addProperty("remoteSdp", ((SdpEndpoint) this.getEndpoint()).getRemoteSessionDescriptor()); + } catch (KurentoServerException e) { + log.error("Error retrieving remote SDP for endpoint {} of stream {}: {}", this.endpointName, + this.streamId, e.getMessage()); + json.add("remoteSdp", JsonNull.INSTANCE); + } json.addProperty("localSdp", ((SdpEndpoint) this.getEndpoint()).getLocalSessionDescriptor()); } json.add("receivedCandidates", new GsonBuilder().create().toJsonTree(this.receivedCandidateList)); diff --git a/openvidu-server/src/main/java/io/openvidu/server/summary/ParticipantSummary.java b/openvidu-server/src/main/java/io/openvidu/server/summary/ParticipantSummary.java index f4627a78..2fa00963 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/summary/ParticipantSummary.java +++ b/openvidu-server/src/main/java/io/openvidu/server/summary/ParticipantSummary.java @@ -20,6 +20,9 @@ package io.openvidu.server.summary; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -29,6 +32,8 @@ import io.openvidu.server.core.Participant; public class ParticipantSummary { + private static final Logger log = LoggerFactory.getLogger(ParticipantSummary.class); + private CDREventParticipant eventParticipantEnd; private Map publishers = new ConcurrentHashMap<>(); private Map subscribers = new ConcurrentHashMap<>(); @@ -53,20 +58,26 @@ public class ParticipantSummary { public JsonObject toJson() { JsonObject json = new JsonObject(); + Participant p = this.eventParticipantEnd.getParticipant(); - json.addProperty("createdAt", this.eventParticipantEnd.getStartTime()); + Long START_TIME = this.eventParticipantEnd.getStartTime(); + if (START_TIME == null) { + log.error("Participant {} startTime is not defined", p.getParticipantPublicId()); + log.error("Setting startTime to (endTime-1)", p.getParticipantPublicId()); + START_TIME = this.eventParticipantEnd.getTimestamp() - 1; + } + json.addProperty("createdAt", START_TIME); json.addProperty("destroyedAt", this.eventParticipantEnd.getTimestamp()); - Participant p = this.eventParticipantEnd.getParticipant(); json.addProperty("connectionId", p.getParticipantPublicId()); json.addProperty("clientData", p.getClientMetadata()); json.addProperty("serverData", p.getServerMetadata()); - long duration = (this.eventParticipantEnd.getTimestamp() - this.eventParticipantEnd.getStartTime()) / 1000; + long duration = (this.eventParticipantEnd.getTimestamp() - START_TIME) / 1000; json.addProperty("duration", duration); json.addProperty("reason", - this.eventParticipantEnd.getReason().name() != null ? this.eventParticipantEnd.getReason().name() : ""); + this.eventParticipantEnd.getReason() != null ? this.eventParticipantEnd.getReason().name() : "NULL"); // Publishers summary JsonObject publishersJson = new JsonObject();