1 FE and 2 openvidu servers

Hi! Im trying to use a 1 Frontend to connect with 2 openvidu server per session.
Scenario:

  • OV server 01 for small classrooms (use this for saving resources)
  • OV server 02 for big classrooms
  • Frontend to connect in this servers.

So its works fine until i have to access one session on OV server 01 and another session on OV server 02.
After connected successfully in one server and running fine, i cant connect on the other server (this is in the same browser - Firefox).
The session is created corretctly in the second server, the publish start the transmission but the subscriber wont see the video image.
Is there anything that prevents access to two different servers?
It seems to be something globally(javascript) defined when publishing starts, because when i close the first transmission and open the transmission on second server its run fine.
Thks!
Doug

Edit 01: I made a test now using Chrome 83.0.4103.97 and works fine. But the publisher and subscriber must use Chrome. Maybe a compatibility problem with Firefox.

Let me see if I have understood the problem correctly:

In the same Firefox browser tab you are not able to send media to 2 different sessions hosted in 2 different OpenVidu deployments. So, if there is a Chrome browser from device “DeviceA” connected to session “SessionA” and a Chrome browser from a different “DeviceB” connected to “SessionB”, and then a Firefox browser from a third “DeviceC” tries to connect to both “SessionA” and “SessionB” at the same time in the same tab, then…

  • Firefox is not able to receive the media sent by DeviceA and/or DeviceB?
  • Firefox cannot send media to DeviceA and/or DeviceB?

Which of these statements are correct?

Hi Pablo! To simplify, all in Firefox:
Device A:

  • An User starts publishing to Session A on Server A.
  • Same User starts publishing to Session B on Server B.

Device B:

  • An user subscribe to Session A on Server A. Starts fine!
  • Same user subscribe to Session B on Server B. This not work. The server establishes a connection but does not start the flow.
  • Only sessions connected on Server A is able to connect by this user.

This same scenario on Chrome works fine.

Some considerations:

  • All connections to the server are created.
  • The append html (inside tag video) on publisher and subscriber are inserted on HTML.
  • If a make a request to api/session on Server B the response show me this user is connected.
  • Using Chrome (Publisher and subscriber) works as espected.
  • Even using Chrome as a publisher and Firefox as a subscriber, Firefox behaves at same way.

Thks again!
Doug

After some investigation I found out that this is an issue commonly encountered by most if not all media servers. I found this other post in the mediasoup forums, where also a Licode developer chimes in to talk about how it happens also to them. The best summary explanation seems to be this message: Firefox DTLS certificate error for second RTCPeerConnection on page · Issue #127 · versatica/mediasoup · GitHub (but read the whole conversation if you are interested in the topic, keeping in mind that in the context of mediasoup, what they call a “worker” is equivalent to one instance of KMS)

Firefox rejects a certificate when this contains the same serial number as another certificate issued by the certificate authority.

There is a related Firefox issue which has been around for 10 years .

Having said this. I’d recommend you @kolychev to use your own certificates if you are using multiple mediasoup workers.

I think the same solution applies to Kurento. Firefox will reject connecting from the same tab to 2 different KMS because they will be using different certificates with different subject names.

The solution would be to provide your own certificate to KMS, and make sure that it is the same in all KMS instances. For that, set a property pemCertificateRSA in the file /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini of all KMS servers:

;; Path (absolute or relative to this config file) to the
;; concatenated certificate (chain) file(s) + private key, in PEM format
pemCertificateRSA=cert+key.pem

I believe this should work and let you use several KMS instances connected to the same Firefox tab. The .pem file is just a concatenation of certificate and private key; you can generate one like this:

cat cert.pem key.pem >cert+key.pem

Please let us know if this works, and we’ll do some needed rewriting of the Kurento docs to explain all this.

Thks for reply j1elo. I will read all conversation and as soon as possible return with test result.
Doug!

Hi j1elo! You hit the nail on the head!
Steps:

  1. Create the private key and certificate with openssl

openssl req -new -x509 -nodes -days 365 -newkey rsa:2048 -sha256 -subj ‘/CN=/O=/C=/’ -keyout kurento.key -out cert.crt

  1. Concat private key and certificate

cat kurento.key cert.crt > mypem.pem

  1. Copy /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini from container to host and edit
    pemCertificateRSA=mypem.pem
  2. Edit docker-compose.yml and add a Volume to map WebRtcEndpoint.conf.ini and mypem.pem

volumes:
- /opt/openvidu/kms/WebRtcEndpoint.conf.ini:/etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
- /opt/openvidu/kms/dtls.pem:/etc/kurento/modules/kurento/mypem.pem

  1. Restart openvidu

Thks again j1elo!

3 Likes

Thanks @doug! Based on your input, I have written some documentation for the pemCertificate* parameters in the settings file: