浏览代码

feat(xmpp) drop the useStunTurn option

Always attempt to discover the configured STUN/TURN servers.
dev1
Saúl Ibarra Corretgé 4 年前
父节点
当前提交
f370cccdfb
共有 3 个文件被更改,包括 11 次插入22 次删除
  1. 1
    2
      doc/API.md
  2. 8
    14
      modules/xmpp/strophe.jingle.js
  3. 2
    6
      modules/xmpp/xmpp.js

+ 1
- 2
doc/API.md 查看文件

@@ -218,8 +218,7 @@ This objects represents the server connection. You can create new ```JitsiConnec
218 218
             - domain
219 219
             - muc
220 220
             - anonymousdomain
221
-        4. useStunTurn -
222
-        5. enableLipSync - (optional) boolean property which enables the lipsync feature. Currently works only in Chrome and is disabled by default.
221
+        4. enableLipSync - (optional) boolean property which enables the lipsync feature. Currently works only in Chrome and is disabled by default.
223 222
 
224 223
 2. connect(options) - establish server connection
225 224
     - options - JS Object with ```id``` and ```password``` properties.

+ 8
- 14
modules/xmpp/strophe.jingle.js 查看文件

@@ -375,23 +375,17 @@ export default class JingleConnectionPlugin extends ConnectionPlugin {
375 375
                     iceservers[j] = temp;
376 376
                 }
377 377
 
378
-                if (options.useStunTurn) {
379
-                    let filter;
380
-
381
-                    if (options.useTurnUdp) {
382
-                        filter = s => s.urls.startsWith('turn');
383
-                    } else {
384
-                        // By default we filter out STUN and TURN/UDP and leave only TURN/TCP.
385
-                        filter = s => s.urls.startsWith('turn') && (s.urls.indexOf('transport=tcp') >= 0);
386
-                    }
387
-
388
-                    this.jvbIceConfig.iceServers = iceservers.filter(filter);
389
-                }
378
+                let filter;
390 379
 
391
-                if (options.p2p && options.p2p.useStunTurn) {
392
-                    this.p2pIceConfig.iceServers = iceservers;
380
+                if (options.useTurnUdp) {
381
+                    filter = s => s.urls.startsWith('turn');
382
+                } else {
383
+                    // By default we filter out STUN and TURN/UDP and leave only TURN/TCP.
384
+                    filter = s => s.urls.startsWith('turn') && (s.urls.indexOf('transport=tcp') >= 0);
393 385
                 }
394 386
 
387
+                this.jvbIceConfig.iceServers = iceservers.filter(filter);
388
+                this.p2pIceConfig.iceServers = iceservers;
395 389
             }, err => {
396 390
                 logger.warn('getting turn credentials failed', err);
397 391
                 logger.warn('is mod_turncredentials or similar installed?');

+ 2
- 6
modules/xmpp/xmpp.js 查看文件

@@ -210,12 +210,8 @@ export default class XMPP extends Listenable {
210 210
             now);
211 211
 
212 212
         this.eventEmitter.emit(XMPPEvents.CONNECTION_STATUS_CHANGED, credentials, status, msg);
213
-        if (status === Strophe.Status.CONNECTED
214
-            || status === Strophe.Status.ATTACHED) {
215
-            if (this.options.useStunTurn
216
-                || (this.options.p2p && this.options.p2p.useStunTurn)) {
217
-                this.connection.jingle.getStunAndTurnCredentials();
218
-            }
213
+        if (status === Strophe.Status.CONNECTED || status === Strophe.Status.ATTACHED) {
214
+            this.connection.jingle.getStunAndTurnCredentials();
219 215
 
220 216
             logger.info(`My Jabber ID: ${this.connection.jid}`);
221 217
 

正在加载...
取消
保存