Pārlūkot izejas kodu

feat(JingleSessionPC): ICE failed notification

Make the client send ICE failed notification to let Jicofo know
that the ICE connection with the bridge has failed. It can then
re-create the channels and send new transport in the
'transport-replace' message to give it another try.

Also adds a bridge session ID so that Jicofo can discard outdated
requests. When a bridge dies multiple clients may send ICE failed
notifications at the same time. Jicofo will detect bridge failure
when processing the first one and it must not act on the following
requests for the broken bridge session which is no longer current.

A bridge session ID will be sent in new 'bridge-session' XML element
which is part of either 'session-initiate' or 'transport-replace'
message. The server's region is moved to this element as well as
it's part of a bridge session.
dev1
paweldomas 6 gadus atpakaļ
vecāks
revīzija
98a7ccd09a
2 mainītis faili ar 63 papildinājumiem un 5 dzēšanām
  1. 4
    1
      JitsiConference.js
  2. 59
    4
      modules/xmpp/JingleSessionPC.js

+ 4
- 1
JitsiConference.js Parādīt failu

@@ -1633,7 +1633,7 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(
1633 1633
 
1634 1634
     const serverRegion
1635 1635
         = $(jingleOffer)
1636
-            .find('>server-region[xmlns="http://jitsi.org/protocol/focus"]')
1636
+            .find('>bridge-session[xmlns="http://jitsi.org/protocol/focus"]')
1637 1637
             .attr('region');
1638 1638
 
1639 1639
     this.eventEmitter.emit(
@@ -2364,6 +2364,9 @@ JitsiConference.prototype._onIceConnectionFailed = function(session) {
2364 2364
 
2365 2365
         }
2366 2366
         this._stopP2PSession('connectivity-error', 'ICE FAILED');
2367
+    } else if (session && this.jvbJingleSession === session) {
2368
+        // Let Jicofo know that the JVB's ICE connection has failed
2369
+        session.sendIceFailedNotification();
2367 2370
     }
2368 2371
 };
2369 2372
 

+ 59
- 4
modules/xmpp/JingleSessionPC.js Parādīt failu

@@ -127,6 +127,17 @@ export default class JingleSessionPC extends JingleSession {
127 127
             localJid,
128 128
             remoteJid, connection, mediaConstraints, iceConfig, isInitiator);
129 129
 
130
+        /**
131
+         * The bridge session's identifier. One Jingle session can during
132
+         * it's lifetime participate in multiple bridge sessions managed by
133
+         * Jicofo. A new bridge session is started whenever Jicofo sends
134
+         * 'session-initiate' or 'transport-replace'.
135
+         *
136
+         * @type {?string}
137
+         * @private
138
+         */
139
+        this._bridgeSessionId = null;
140
+
130 141
         /**
131 142
          * Stores result of {@link window.performance.now()} at the time when
132 143
          * ICE enters 'checking' state.
@@ -473,10 +484,6 @@ export default class JingleSessionPC extends JingleSession {
473 484
             case 'failed':
474 485
                 this.room.eventEmitter.emit(
475 486
                     XMPPEvents.CONNECTION_ICE_FAILED, this);
476
-                this.room.eventEmitter.emit(
477
-                    XMPPEvents.CONFERENCE_SETUP_FAILED,
478
-                    this,
479
-                    new Error('ICE fail'));
480 487
                 break;
481 488
             }
482 489
         };
@@ -631,6 +638,44 @@ export default class JingleSessionPC extends JingleSession {
631 638
             cand, null, this.newJingleErrorHandler(cand), IQ_TIMEOUT);
632 639
     }
633 640
 
641
+    /**
642
+     * Sends Jingle 'session-info' message which includes custom Jitsi Meet
643
+     * 'ice-state' element with the text value 'failed' to let Jicofo know
644
+     * that the ICE connection has entered the failed state. It can then
645
+     * choose to re-create JVB channels and send 'transport-replace' to
646
+     * retry the connection.
647
+     */
648
+    sendIceFailedNotification() {
649
+        const sessionInfo
650
+            = $iq({
651
+                to: this.remoteJid,
652
+                type: 'set' })
653
+            .c('jingle', { xmlns: 'urn:xmpp:jingle:1',
654
+                action: 'session-info',
655
+                initiator: this.initiatorJid,
656
+                sid: this.sid })
657
+            .c('ice-state', { xmlns: 'http://jitsi.org/protocol/focus' })
658
+            .t('failed')
659
+            .up();
660
+
661
+        this._bridgeSessionId
662
+            && sessionInfo.c(
663
+                'bridge-session', {
664
+                    xmlns: 'http://jitsi.org/protocol/focus',
665
+                    id: this._bridgeSessionId
666
+                });
667
+
668
+        this.connection.sendIQ(
669
+            sessionInfo,
670
+            null,
671
+            this.newJingleErrorHandler(sessionInfo),
672
+            /*
673
+             * This message will be often sent when there are connectivity
674
+             * issues, so make it slightly longer than Prosody's default BOSH
675
+             * inactivity timeout of 60 seconds.
676
+             */ 65);
677
+    }
678
+
634 679
     /**
635 680
      * {@inheritDoc}
636 681
      */
@@ -913,6 +958,16 @@ export default class JingleSessionPC extends JingleSession {
913 958
             const oldLocalSdp
914 959
                 = this.peerconnection.localDescription.sdp;
915 960
 
961
+            const bridgeSession
962
+                = $(jingleOfferAnswerIq)
963
+                    .find('>bridge-session['
964
+                        + 'xmlns="http://jitsi.org/protocol/focus"]');
965
+            const bridgeSessionId = bridgeSession.attr('id');
966
+
967
+            if (bridgeSessionId !== this._bridgeSessionId) {
968
+                this._bridgeSessionId = bridgeSessionId;
969
+            }
970
+
916 971
             this._renegotiate(newRemoteSdp.raw)
917 972
                 .then(() => {
918 973
                     if (this.state === JingleSessionState.PENDING) {

Notiek ielāde…
Atcelt
Saglabāt