Pārlūkot izejas kodu

fix(ice-restart): Force client reloads when call is migrated.

Force the client to reload when the bridge that is handling the media goes down.
This mitigates issues seen on the bridge because of a client re-joining the call with the same endpointId, BWE issues, etc.
This behavior is configurable through 'enableForcedReload' setting in config.js.
dev1
Jaya Allamsetty 4 gadus atpakaļ
vecāks
revīzija
67419ca0c8

+ 13
- 0
JitsiConference.js Parādīt failu

@@ -2621,6 +2621,19 @@ JitsiConference.prototype.isConnectionInterrupted = function() {
2621 2621
         ? this.isP2PConnectionInterrupted : this.isJvbConnectionInterrupted;
2622 2622
 };
2623 2623
 
2624
+/**
2625
+ * Handles {@link XMPPEvents.CONNECTION_RESTARTED} event. This happens when the bridge goes down
2626
+ * and Jicofo moves conferences away to a different bridge.
2627
+ * @param {JingleSessionPC} session
2628
+ * @private
2629
+ */
2630
+JitsiConference.prototype._onConferenceRestarted = function(session) {
2631
+    if (!session.isP2P && this.options.config.enableForcedReload) {
2632
+        this.restartInProgress = true;
2633
+        this.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONFERENCE_RESTARTED);
2634
+    }
2635
+};
2636
+
2624 2637
 /**
2625 2638
  * Handles {@link XMPPEvents.CONNECTION_INTERRUPTED}
2626 2639
  * @param {JingleSessionPC} session

+ 6
- 0
JitsiConferenceErrors.js Parādīt failu

@@ -27,6 +27,12 @@ export const CONFERENCE_MAX_USERS = 'conference.max_users';
27 27
  */
28 28
 export const CONNECTION_ERROR = 'conference.connectionError';
29 29
 
30
+/**
31
+ * Indicates that the client has been forced to restart by jicofo when the
32
+ * conference was migrated from one bridge to another.
33
+ */
34
+export const CONFERENCE_RESTARTED = 'conference.restarted';
35
+
30 36
 /**
31 37
  * Indicates that a connection error is due to not allowed,
32 38
  * occurred when trying to join a conference.

+ 5
- 0
JitsiConferenceEventManager.js Parādīt failu

@@ -185,6 +185,11 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
185 185
         XMPPEvents.BRIDGE_DOWN,
186 186
         () => Statistics.sendAnalytics(createBridgeDownEvent()));
187 187
 
188
+    chatRoom.addListener(XMPPEvents.CONNECTION_RESTARTED,
189
+        jingleSession => {
190
+            conference._onConferenceRestarted(jingleSession);
191
+        });
192
+
188 193
     this.chatRoomForwarder.forward(XMPPEvents.RESERVATION_ERROR,
189 194
         JitsiConferenceEvents.CONFERENCE_FAILED,
190 195
         JitsiConferenceErrors.RESERVATION_ERROR);

+ 5
- 2
modules/connectivity/IceFailedHandling.js Parādīt failu

@@ -33,16 +33,19 @@ export default class IceFailedHandling {
33 33
      * @returns {void}
34 34
      */
35 35
     _actOnIceFailed() {
36
-        const { enableIceRestart } = this._conference.options.config;
36
+        const { enableForcedReload, enableIceRestart } = this._conference.options.config;
37 37
         const explicitlyDisabled = typeof enableIceRestart !== 'undefined' && !enableIceRestart;
38 38
         const supportsRestartByTerminate = this._conference.room.supportsRestartByTerminate();
39 39
         const useTerminateForRestart = supportsRestartByTerminate && !enableIceRestart;
40
+        const reloadClient = this._conference.restartInProgress && enableForcedReload;
40 41
 
41 42
         logger.info('ICE failed,'
43
+            + ` enableForcedReload: ${enableForcedReload},`
42 44
             + ` enableIceRestart: ${enableIceRestart},`
45
+            + ` restartInProgress: ${this._conference.restartInProgress},`
43 46
             + ` supports restart by terminate: ${supportsRestartByTerminate}`);
44 47
 
45
-        if (explicitlyDisabled || (!enableIceRestart && !supportsRestartByTerminate)) {
48
+        if (explicitlyDisabled || (!enableIceRestart && !supportsRestartByTerminate) || reloadClient) {
46 49
             logger.info('ICE failed, but ICE restarts are disabled');
47 50
             this._conference.eventEmitter.emit(
48 51
                 JitsiConferenceEvents.CONFERENCE_FAILED,

+ 8
- 0
modules/xmpp/JingleSessionPC.js Parādīt failu

@@ -1137,6 +1137,14 @@ export default class JingleSessionPC extends JingleSession {
1137 1137
      * @param failure function(error) called when we fail to accept new offer.
1138 1138
      */
1139 1139
     replaceTransport(jingleOfferElem, success, failure) {
1140
+        if (this.options.enableForcedReload) {
1141
+            const sdp = new SDP(this.peerconnection.localDescription.sdp);
1142
+
1143
+            this.sendTransportAccept(sdp, success, failure);
1144
+            this.room.eventEmitter.emit(XMPPEvents.CONNECTION_RESTARTED, this);
1145
+
1146
+            return;
1147
+        }
1140 1148
         this.room.eventEmitter.emit(XMPPEvents.ICE_RESTARTING, this);
1141 1149
 
1142 1150
         // We need to first reject the 'data' section to have the SCTP stack

+ 4
- 0
service/xmpp/XMPPEvents.js Parādīt failu

@@ -50,6 +50,10 @@ const XMPPEvents = {
50 50
     // This should go to the RTC module.
51 51
     CONNECTION_ICE_FAILED: 'xmpp.connection.ice.failed',
52 52
 
53
+    // Designates an event indicating that the call has been migrated to a different
54
+    // bridge and that the client needs to be restarted for a successful transition.
55
+    CONNECTION_RESTARTED: 'xmpp.connection.restart',
56
+
53 57
     /**
54 58
      * Designates an event indicating connection status changes.
55 59
      */

Notiek ielāde…
Atcelt
Saglabāt