Browse Source

feat: Ignore colibri-ws urls if their domain matches ignoreDomain. (#2214)

tags/v0.0.2
bgrozev 1 year ago
parent
commit
eb7a0cfcc0
No account linked to committer's email address
1 changed files with 21 additions and 5 deletions
  1. 21
    5
      JitsiConference.js

+ 21
- 5
JitsiConference.js View File

@@ -2319,14 +2319,29 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
2319 2319
  * to listen for new WebRTC Data Channels (in the 'datachannel' mode).
2320 2320
  */
2321 2321
 JitsiConference.prototype._setBridgeChannel = function(offerIq, pc) {
2322
+    const ignoreDomain = this.connection?.options?.bridgeChannel?.ignoreDomain;
2322 2323
     let wsUrl = null;
2323
-    const webSocket
2324
-        = $(offerIq)
2325
-            .find('>content>transport>web-socket')
2324
+
2325
+    $(offerIq).find('>content>transport>web-socket')
2326
+        .toArray()
2327
+        .map(e => e.getAttribute('url'))
2328
+        .forEach(url => {
2329
+            if (!wsUrl && (!ignoreDomain || ignoreDomain !== new URL(url).hostname)) {
2330
+                wsUrl = url;
2331
+                logger.info(`Using colibri-ws url ${url}`);
2332
+            } else if (!wsUrl) {
2333
+                logger.info(`Ignoring colibri-ws url with domain ${ignoreDomain}`);
2334
+            }
2335
+        });
2336
+
2337
+    if (!wsUrl) {
2338
+        const firstWsUrl = $(offerIq).find('>content>transport>web-socket')
2326 2339
             .first();
2327 2340
 
2328
-    if (webSocket.length === 1) {
2329
-        wsUrl = webSocket[0].getAttribute('url');
2341
+        if (firstWsUrl.length === 1) {
2342
+            wsUrl = firstWsUrl[0].getAttribute('url');
2343
+            logger.info(`Falling back to ${wsUrl}`);
2344
+        }
2330 2345
     }
2331 2346
 
2332 2347
     if (wsUrl) {
@@ -2334,6 +2349,7 @@ JitsiConference.prototype._setBridgeChannel = function(offerIq, pc) {
2334 2349
         this.rtc.initializeBridgeChannel(null, wsUrl);
2335 2350
     } else {
2336 2351
         // Otherwise, fall back to an attempt to use SCTP.
2352
+        logger.info('No colibri-ws found.');
2337 2353
         this.rtc.initializeBridgeChannel(pc, null);
2338 2354
     }
2339 2355
 };

Loading…
Cancel
Save