瀏覽代碼

fix(JingleSession) Remove ice restart option and functionality. (#2586)

release-8443
Jaya Allamsetty 1 年之前
父節點
當前提交
fac989a94d
沒有連結到貢獻者的電子郵件帳戶。

+ 0
- 2
JitsiConference.js 查看文件

106
  * @param {number} [options.config.avgRtpStatsN=15] how many samples are to be
106
  * @param {number} [options.config.avgRtpStatsN=15] how many samples are to be
107
  * collected by {@link AvgRTPStatsReporter}, before arithmetic mean is
107
  * collected by {@link AvgRTPStatsReporter}, before arithmetic mean is
108
  * calculated and submitted to the analytics module.
108
  * calculated and submitted to the analytics module.
109
- * @param {boolean} [options.config.enableIceRestart=false] - enables the ICE
110
- * restart logic.
111
  * @param {boolean} [options.config.p2p.enabled] when set to <tt>true</tt>
109
  * @param {boolean} [options.config.p2p.enabled] when set to <tt>true</tt>
112
  * the peer to peer mode will be enabled. It means that when there are only 2
110
  * the peer to peer mode will be enabled. It means that when there are only 2
113
  * participants in the conference an attempt to make direct connection will be
111
  * participants in the conference an attempt to make direct connection will be

+ 0
- 24
JitsiConferenceEventManager.js 查看文件

42
     this.chatRoomForwarder = new EventEmitterForwarder(chatRoom,
42
     this.chatRoomForwarder = new EventEmitterForwarder(chatRoom,
43
         this.conference.eventEmitter);
43
         this.conference.eventEmitter);
44
 
44
 
45
-    chatRoom.addListener(XMPPEvents.ICE_RESTARTING, jingleSession => {
46
-        if (!jingleSession.isP2P) {
47
-            // If using DataChannel as bridge channel, it must be closed
48
-            // before ICE restart, otherwise Chrome will not trigger "opened"
49
-            // event for the channel established with the new bridge.
50
-            // TODO: This may be bypassed when using a WebSocket as bridge
51
-            // channel.
52
-            conference.rtc.closeBridgeChannel();
53
-        }
54
-
55
-        // else: there are no DataChannels in P2P session (at least for now)
56
-    });
57
-
58
     chatRoom.addListener(XMPPEvents.PARTICIPANT_FEATURES_CHANGED, (from, features) => {
45
     chatRoom.addListener(XMPPEvents.PARTICIPANT_FEATURES_CHANGED, (from, features) => {
59
         const participant = conference.getParticipantById(Strophe.getResourceFromJid(from));
46
         const participant = conference.getParticipantById(Strophe.getResourceFromJid(from));
60
 
47
 
64
         }
51
         }
65
     });
52
     });
66
 
53
 
67
-    chatRoom.addListener(
68
-        XMPPEvents.ICE_RESTART_SUCCESS,
69
-        (jingleSession, offerIq) => {
70
-            // The JVB data chanel needs to be reopened in case the conference
71
-            // has been moved to a new bridge.
72
-            !jingleSession.isP2P
73
-                && conference._setBridgeChannel(
74
-                    offerIq, jingleSession.peerconnection);
75
-        });
76
-
77
-
78
     chatRoom.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
54
     chatRoom.addListener(XMPPEvents.AUDIO_MUTED_BY_FOCUS,
79
         actor => {
55
         actor => {
80
             // TODO: Add a way to differentiate between commands which caused
56
             // TODO: Add a way to differentiate between commands which caused

+ 18
- 35
modules/connectivity/IceFailedHandling.js 查看文件

8
 /**
8
 /**
9
  * This class deals with shenanigans around JVB media session's ICE failed status handling.
9
  * This class deals with shenanigans around JVB media session's ICE failed status handling.
10
  *
10
  *
11
- * If ICE restarts are NOT explicitly enabled by the {@code enableIceRestart} config option, then the conference will
12
- * delay emitting the {@JitsiConferenceErrors.ICE_FAILED} event by 15 seconds. If the network info module reports
13
- * the internet offline status then the time will start counting after the internet comes back online.
14
- *
15
- * If ICE restart are enabled, then a delayed ICE failed notification to Jicofo will be sent, only if the ICE connection
16
- * does not recover soon after or before the XMPP connection is restored (if it was ever broken). If ICE fails while
17
- * the XMPP connection is not broken then the notifications will be sent after 2 seconds delay.
11
+ * If ICE connection is not re-established within 2 secs after the internet comes back online, the client will initiate
12
+ * a session restart via 'session-terminate'. This results in Jicofo re-inviting the participant into the conference by
13
+ * recreating the jvb media session so that there is minimla disruption to the user by default. However, if the
14
+ * 'enableForcedReload' option is set in config.js, the conference will be forcefully reloaded.
18
  */
15
  */
19
 export default class IceFailedHandling {
16
 export default class IceFailedHandling {
20
     /**
17
     /**
36
             return;
33
             return;
37
         }
34
         }
38
 
35
 
39
-        const { enableForcedReload, enableIceRestart } = this._conference.options.config;
40
-        const explicitlyDisabled = typeof enableIceRestart !== 'undefined' && !enableIceRestart;
41
-        const supportsRestartByTerminate = this._conference.room.supportsRestartByTerminate();
42
-        const useTerminateForRestart = supportsRestartByTerminate && !enableIceRestart;
43
-
44
-        logger.info('ICE failed,'
45
-            + ` enableForcedReload: ${enableForcedReload},`
46
-            + ` enableIceRestart: ${enableIceRestart},`
47
-            + ` supports restart by terminate: ${supportsRestartByTerminate}`);
36
+        const { enableForcedReload } = this._conference.options.config;
48
 
37
 
49
-        if (explicitlyDisabled || (!enableIceRestart && !supportsRestartByTerminate) || enableForcedReload) {
50
-            logger.info('ICE failed, but ICE restarts are disabled');
51
-            const reason = enableForcedReload
52
-                ? JitsiConferenceErrors.CONFERENCE_RESTARTED
53
-                : JitsiConferenceErrors.ICE_FAILED;
38
+        logger.info(`ICE failed, enableForcedReload: ${enableForcedReload}`);
54
 
39
 
55
-            this._conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, reason);
40
+        if (enableForcedReload) {
41
+            logger.info('ICE failed, force reloading the conference');
42
+            this._conference.eventEmitter.emit(
43
+                JitsiConferenceEvents.CONFERENCE_FAILED,
44
+                JitsiConferenceErrors.CONFERENCE_RESTARTED);
56
 
45
 
57
             return;
46
             return;
58
         }
47
         }
65
         } else if (jvbConnIceState === 'connected') {
54
         } else if (jvbConnIceState === 'connected') {
66
             logger.info('ICE connection restored - not sending ICE failed');
55
             logger.info('ICE connection restored - not sending ICE failed');
67
         } else {
56
         } else {
68
-            logger.info('Sending ICE failed - the connection did not recover, '
69
-                + `ICE state: ${jvbConnIceState}, `
70
-                + `use 'session-terminate': ${useTerminateForRestart}`);
71
-            if (useTerminateForRestart) {
72
-                this._conference._stopJvbSession({
73
-                    reason: 'connectivity-error',
74
-                    reasonDescription: 'ICE FAILED',
75
-                    requestRestart: true,
76
-                    sendSessionTerminate: true
77
-                });
78
-            } else {
79
-                this._conference.jvbJingleSession.sendIceFailedNotification();
80
-            }
57
+            logger.info(`Sending ICE failed - the connection did not recover, ICE state: ${jvbConnIceState}`);
58
+            this._conference._stopJvbSession({
59
+                reason: 'connectivity-error',
60
+                reasonDescription: 'ICE FAILED',
61
+                requestRestart: true,
62
+                sendSessionTerminate: true
63
+            });
81
         }
64
         }
82
     }
65
     }
83
 
66
 

+ 17
- 80
modules/connectivity/IceFailedHandling.spec.js 查看文件

36
             // eslint-disable-next-line no-empty-function
36
             // eslint-disable-next-line no-empty-function
37
             emit: () => { }
37
             emit: () => { }
38
         };
38
         };
39
-        mockConference.room = {
40
-            supportsRestartByTerminate: () => false
41
-        };
39
+        mockConference.room = {};
42
         mockConference.xmpp = {
40
         mockConference.xmpp = {
43
             ping: () => Promise.resolve()
41
             ping: () => Promise.resolve()
44
         };
42
         };
49
         jasmine.clock().uninstall();
47
         jasmine.clock().uninstall();
50
     });
48
     });
51
 
49
 
52
-    describe('when ICE restarts are disabled', () => {
53
-        beforeEach(() => {
54
-            mockConference.options.config.enableIceRestart = false;
55
-        });
56
-        it('emits ICE failed with 2 seconds delay after XMPP ping comes through', () => {
57
-            iceFailedHandling.start();
58
-
59
-            return nextTick() // tick for ping
60
-                .then(() => {
61
-                    expect(emitEventSpy).not.toHaveBeenCalled();
62
-
63
-                    return nextTick(2500); // tick for the 2 sec ice timeout
64
-                })
65
-                .then(() => {
66
-                    expect(emitEventSpy).toHaveBeenCalled();
67
-                });
68
-        });
69
-        it('cancel method cancels the ICE failed event', () => {
70
-            iceFailedHandling.start();
71
-
72
-            return nextTick(1000) // tick for ping
73
-                .then(() => {
74
-                    expect(emitEventSpy).not.toHaveBeenCalled();
75
-                    iceFailedHandling.cancel();
76
-
77
-                    return nextTick(2500); // tick for ice timeout
78
-                })
79
-                .then(() => {
80
-                    expect(emitEventSpy).not.toHaveBeenCalled();
81
-                });
82
-        });
83
-    });
84
-    describe('when ICE restart are enabled', () => {
85
-        let sendIceFailedSpy;
86
-
87
-        beforeEach(() => {
88
-            mockConference.options.config.enableIceRestart = true;
89
-            mockConference.jvbJingleSession = {
90
-                getIceConnectionState: () => 'failed',
91
-                // eslint-disable-next-line no-empty-function
92
-                sendIceFailedNotification: () => { }
93
-            };
94
-            sendIceFailedSpy = spyOn(mockConference.jvbJingleSession, 'sendIceFailedNotification');
95
-        });
96
-        it('send ICE failed notification to Jicofo', () => {
97
-            iceFailedHandling.start();
98
-
99
-            return nextTick() // tick for ping
100
-                .then(() => nextTick(2500)) // tick for ice timeout
101
-                .then(() => {
102
-                    expect(sendIceFailedSpy).toHaveBeenCalled();
103
-                });
104
-        });
105
-        it('not send ICE failed notification to Jicofo if canceled', () => {
106
-            iceFailedHandling.start();
107
-
108
-            // first it send ping which is async - need next tick
109
-            return nextTick(1000)
110
-                .then(() => {
111
-                    expect(sendIceFailedSpy).not.toHaveBeenCalled();
112
-                    iceFailedHandling.cancel();
113
-
114
-                    return nextTick(3000); // tick for ice timeout
115
-                })
116
-                .then(() => {
117
-                    expect(sendIceFailedSpy).not.toHaveBeenCalled();
118
-                });
119
-        });
120
-    });
121
     describe('if Jingle session restarts are supported', () => {
50
     describe('if Jingle session restarts are supported', () => {
122
         let sendSessionTerminateSpy;
51
         let sendSessionTerminateSpy;
123
 
52
 
124
         beforeEach(() => {
53
         beforeEach(() => {
125
-            mockConference.options.config.enableIceRestart = undefined;
126
-            mockConference.room = {
127
-                supportsRestartByTerminate: () => true
128
-            };
54
+            mockConference.room = {};
129
             mockConference.jvbJingleSession = {
55
             mockConference.jvbJingleSession = {
130
                 getIceConnectionState: () => 'failed',
56
                 getIceConnectionState: () => 'failed',
131
                 // eslint-disable-next-line no-empty-function
57
                 // eslint-disable-next-line no-empty-function
148
                         });
74
                         });
149
                 });
75
                 });
150
         });
76
         });
77
+        it('cancel method cancels the call to terminate session', () => {
78
+            iceFailedHandling.start();
79
+
80
+            return nextTick(1000) // tick for ping
81
+                .then(() => {
82
+                    expect(sendSessionTerminateSpy).not.toHaveBeenCalled();
83
+                    iceFailedHandling.cancel();
84
+
85
+                    return nextTick(2500); // tick for ice timeout
86
+                })
87
+                .then(() => {
88
+                    expect(sendSessionTerminateSpy).not.toHaveBeenCalled();
89
+                });
90
+        });
151
     });
91
     });
152
     describe('when forced reloads are enabled', () => {
92
     describe('when forced reloads are enabled', () => {
153
         beforeEach(() => {
93
         beforeEach(() => {
154
-            mockConference.options.config.enableIceRestart = undefined;
155
             mockConference.options.config.enableForcedReload = true;
94
             mockConference.options.config.enableForcedReload = true;
156
 
95
 
157
-            mockConference.room = {
158
-                supportsRestartByTerminate: () => true
159
-            };
96
+            mockConference.room = {};
160
         });
97
         });
161
 
98
 
162
         it('emits conference restarted when force reloads are enabled', () => {
99
         it('emits conference restarted when force reloads are enabled', () => {

+ 1
- 2
modules/proxyconnection/ProxyConnectionPC.js 查看文件

225
             connectionTimes: [],
225
             connectionTimes: [],
226
             eventEmitter: { emit: emitter },
226
             eventEmitter: { emit: emitter },
227
             removeEventListener: () => { /* no op */ },
227
             removeEventListener: () => { /* no op */ },
228
-            removePresenceListener: () => { /* no-op */ },
229
-            supportsRestartByTerminate: () => false
228
+            removePresenceListener: () => { /* no-op */ }
230
         };
229
         };
231
 
230
 
232
         /**
231
         /**

+ 0
- 15
modules/xmpp/ChatRoom.js 查看文件

816
                     }
816
                     }
817
 
817
 
818
                     this.eventEmitter.emit(XMPPEvents.CONFERENCE_PROPERTIES_CHANGED, properties);
818
                     this.eventEmitter.emit(XMPPEvents.CONFERENCE_PROPERTIES_CHANGED, properties);
819
-
820
-                    // Log if Jicofo supports restart by terminate only once. This conference property does not change
821
-                    // during the call.
822
-                    if (typeof this.restartByTerminateSupported === 'undefined') {
823
-                        this.restartByTerminateSupported = properties['support-terminate-restart'] === 'true';
824
-                        logger.info(`Jicofo supports restart by terminate: ${this.supportsRestartByTerminate()}`);
825
-                    }
826
                 }
819
                 }
827
                 break;
820
                 break;
828
             case 'transcription-status': {
821
             case 'transcription-status': {
913
         this.participantPropertyListener = listener;
906
         this.participantPropertyListener = listener;
914
     }
907
     }
915
 
908
 
916
-    /**
917
-     * Checks if Jicofo supports restarting Jingle session after 'session-terminate'.
918
-     * @returns {boolean}
919
-     */
920
-    supportsRestartByTerminate() {
921
-        return this.restartByTerminateSupported;
922
-    }
923
-
924
     /**
909
     /**
925
      *
910
      *
926
      * @param node
911
      * @param node

+ 3
- 231
modules/xmpp/JingleSessionPC.js 查看文件

197
          * The bridge session's identifier. One Jingle session can during
197
          * The bridge session's identifier. One Jingle session can during
198
          * it's lifetime participate in multiple bridge sessions managed by
198
          * it's lifetime participate in multiple bridge sessions managed by
199
          * Jicofo. A new bridge session is started whenever Jicofo sends
199
          * Jicofo. A new bridge session is started whenever Jicofo sends
200
-         * 'session-initiate' or 'transport-replace'.
200
+         * 'session-initiate'.
201
          *
201
          *
202
          * @type {?string}
202
          * @type {?string}
203
          * @private
203
          * @private
277
 
277
 
278
         /**
278
         /**
279
          * Marks that ICE gathering duration has been reported already. That
279
          * Marks that ICE gathering duration has been reported already. That
280
-         * prevents reporting it again, after eventual 'transport-replace' (JVB
281
-         * conference migration/ICE restart).
280
+         * prevents reporting it again.
282
          * @type {boolean}
281
          * @type {boolean}
283
          * @private
282
          * @private
284
          */
283
          */
544
                 // media connection to the bridge has been restored after an ICE failure by using session-terminate.
543
                 // media connection to the bridge has been restored after an ICE failure by using session-terminate.
545
                 if (this.peerconnection.signalingState === 'stable') {
544
                 if (this.peerconnection.signalingState === 'stable') {
546
                     isStable = true;
545
                     isStable = true;
547
-                    const usesTerminateForRestart = !this.options.enableIceRestart
548
-                        && this.room.supportsRestartByTerminate();
549
-
550
-                    if (this.isReconnect || usesTerminateForRestart) {
551
-                        this.room.eventEmitter.emit(
552
-                            XMPPEvents.CONNECTION_RESTORED, this);
553
-                    }
546
+                    this.room.eventEmitter.emit(XMPPEvents.CONNECTION_RESTORED, this);
554
                 }
547
                 }
555
 
548
 
556
                 // Add a workaround for an issue on chrome in Unified plan when the local endpoint is the offerer.
549
                 // Add a workaround for an issue on chrome in Unified plan when the local endpoint is the offerer.
817
             cand, null, this.newJingleErrorHandler(cand), IQ_TIMEOUT);
810
             cand, null, this.newJingleErrorHandler(cand), IQ_TIMEOUT);
818
     }
811
     }
819
 
812
 
820
-    /**
821
-     * Sends Jingle 'session-info' message which includes custom Jitsi Meet
822
-     * 'ice-state' element with the text value 'failed' to let Jicofo know
823
-     * that the ICE connection has entered the failed state. It can then
824
-     * choose to re-create JVB channels and send 'transport-replace' to
825
-     * retry the connection.
826
-     */
827
-    sendIceFailedNotification() {
828
-        const sessionInfo
829
-            = $iq({
830
-                to: this.remoteJid,
831
-                type: 'set' })
832
-            .c('jingle', { xmlns: 'urn:xmpp:jingle:1',
833
-                action: 'session-info',
834
-                initiator: this.initiatorJid,
835
-                sid: this.sid })
836
-            .c('ice-state', { xmlns: 'http://jitsi.org/protocol/focus' })
837
-            .t('failed')
838
-            .up();
839
-
840
-        this._bridgeSessionId
841
-            && sessionInfo.c(
842
-                'bridge-session', {
843
-                    xmlns: 'http://jitsi.org/protocol/focus',
844
-                    id: this._bridgeSessionId
845
-                });
846
-
847
-        this.connection.sendIQ2(
848
-            sessionInfo, {
849
-                /*
850
-                 * This message will be often sent when there are connectivity
851
-                 * issues, so make it slightly longer than Prosody's default BOSH
852
-                 * inactivity timeout of 60 seconds.
853
-                 */
854
-                timeout: 65
855
-            })
856
-            .catch(this.newJingleErrorHandler(sessionInfo));
857
-    }
858
-
859
     /**
813
     /**
860
      * {@inheritDoc}
814
      * {@inheritDoc}
861
      */
815
      */
1233
         }
1187
         }
1234
     }
1188
     }
1235
 
1189
 
1236
-    /* eslint-enable max-params */
1237
-
1238
-    /**
1239
-     * Although it states "replace transport" it does accept full Jingle offer
1240
-     * which should contain new ICE transport details.
1241
-     * @param jingleOfferElem an element Jingle IQ that contains new offer and
1242
-     *        transport info.
1243
-     * @param success callback called when we succeed to accept new offer.
1244
-     * @param failure function(error) called when we fail to accept new offer.
1245
-     */
1246
-    replaceTransport(jingleOfferElem, success, failure) {
1247
-        if (this.options.enableForcedReload) {
1248
-            const sdp = new SDP(this.peerconnection.localDescription.sdp);
1249
-
1250
-            this.sendTransportAccept(sdp, success, failure);
1251
-            this.room.eventEmitter.emit(XMPPEvents.CONNECTION_RESTARTED, this);
1252
-
1253
-            return;
1254
-        }
1255
-        this.room.eventEmitter.emit(XMPPEvents.ICE_RESTARTING, this);
1256
-
1257
-        // We need to first reject the 'data' section to have the SCTP stack
1258
-        // cleaned up to signal the known data channel is now invalid. After
1259
-        // that the original offer is set to have the SCTP connection
1260
-        // established with the new bridge.
1261
-        const originalOffer = jingleOfferElem.clone();
1262
-
1263
-        jingleOfferElem
1264
-            .find('>content[name=\'data\']')
1265
-            .attr('senders', 'rejected');
1266
-
1267
-        // Remove all remote sources in order to reset the client's state
1268
-        // for the remote MediaStreams. When a conference is moved to
1269
-        // another bridge it will start streaming with a sequence number
1270
-        // that is not in sync with the most recently seen by the client.
1271
-        // The symptoms include frozen or black video and lots of "failed to
1272
-        // unprotect SRTP packets" in Chrome logs.
1273
-        jingleOfferElem
1274
-            .find('>content>description>source')
1275
-            .remove();
1276
-        jingleOfferElem
1277
-            .find('>content>description>ssrc-group')
1278
-            .remove();
1279
-
1280
-        // On the JVB it's not a real ICE restart and all layers are re-initialized from scratch as Jicofo does
1281
-        // the restart by re-allocating new channels. Chrome (or WebRTC stack) needs to have the DTLS transport layer
1282
-        // reset to start a new handshake with fresh DTLS transport on the bridge. Make it think that the DTLS
1283
-        // fingerprint has changed by setting an all zeros key.
1284
-        const newFingerprint = jingleOfferElem.find('>content>transport>fingerprint');
1285
-
1286
-        newFingerprint.attr('hash', 'sha-1');
1287
-        newFingerprint.text('00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00');
1288
-
1289
-        const workFunction = finishedCallback => {
1290
-            // First set an offer with a rejected 'data' section
1291
-            this.setOfferAnswerCycle(
1292
-                jingleOfferElem,
1293
-                () => {
1294
-                    // Now set the original offer(with the 'data' section)
1295
-                    this.setOfferAnswerCycle(
1296
-                        originalOffer,
1297
-                        () => {
1298
-                            const localSDP = new SDP(this.peerconnection.localDescription.sdp);
1299
-
1300
-                            if (typeof this.options.channelLastN === 'number' && this.options.channelLastN >= 0) {
1301
-                                localSDP.initialLastN = this.options.channelLastN;
1302
-                            }
1303
-
1304
-                            this.sendTransportAccept(localSDP, success, failure);
1305
-
1306
-                            this.room.eventEmitter.emit(
1307
-                                XMPPEvents.ICE_RESTART_SUCCESS,
1308
-                                this,
1309
-                                originalOffer);
1310
-
1311
-                            finishedCallback();
1312
-                        }, error => finishedCallback(error)
1313
-                    );
1314
-                }, error => finishedCallback(error)
1315
-            );
1316
-        };
1317
-
1318
-        logger.debug(`${this} Queued ICE restart task`);
1319
-
1320
-        // Queue and execute
1321
-        this.modificationQueue.push(
1322
-            workFunction,
1323
-            error => {
1324
-                if (error) {
1325
-                    if (error instanceof ClearedQueueError) {
1326
-                        // The session might have been terminated before the task was executed, making it obsolete.
1327
-                        logger.debug(`${this} ICE restart task aborted: session terminated`);
1328
-                        success();
1329
-
1330
-                        return;
1331
-                    }
1332
-                    logger.error(`${this} ICE restart task failed: ${error}`);
1333
-                    failure(error);
1334
-                } else {
1335
-                    logger.debug(`${this} ICE restart task done`);
1336
-                    success();
1337
-                }
1338
-            });
1339
-    }
1340
-
1341
     /**
1190
     /**
1342
      * Sends Jingle 'session-accept' message.
1191
      * Sends Jingle 'session-accept' message.
1343
      * @param {function()} success callback called when we receive 'RESULT'
1192
      * @param {function()} success callback called when we receive 'RESULT'
1474
         }
1323
         }
1475
     }
1324
     }
1476
 
1325
 
1477
-    /**
1478
-     * Sends Jingle 'transport-accept' message which is a response to
1479
-     * 'transport-replace'.
1480
-     * @param localSDP the 'SDP' object with local session description
1481
-     * @param success callback called when we receive 'RESULT' packet for
1482
-     *        'transport-replace'
1483
-     * @param failure function(error) called when we receive an error response
1484
-     *        or when the request has timed out.
1485
-     * @private
1486
-     */
1487
-    sendTransportAccept(localSDP, success, failure) {
1488
-        const transportAccept = $iq({ to: this.remoteJid,
1489
-            type: 'set' })
1490
-            .c('jingle', {
1491
-                xmlns: 'urn:xmpp:jingle:1',
1492
-                action: 'transport-accept',
1493
-                initiator: this.initiatorJid,
1494
-                sid: this.sid
1495
-            });
1496
-
1497
-        localSDP.media.forEach((medialines, idx) => {
1498
-            const mline = SDPUtil.parseMLine(medialines.split('\r\n')[0]);
1499
-
1500
-            transportAccept.c('content',
1501
-                {
1502
-                    creator:
1503
-                        this.initiatorJid === this.localJid
1504
-                            ? 'initiator'
1505
-                            : 'responder',
1506
-                    name: mline.media
1507
-                }
1508
-            );
1509
-            localSDP.transportToJingle(idx, transportAccept);
1510
-            transportAccept.up();
1511
-        });
1512
-
1513
-        logger.info(`${this} Sending transport-accept`);
1514
-        logger.debug(transportAccept.tree());
1515
-
1516
-        this.connection.sendIQ(transportAccept,
1517
-            success,
1518
-            this.newJingleErrorHandler(transportAccept, failure),
1519
-            IQ_TIMEOUT);
1520
-    }
1521
-
1522
-    /**
1523
-     * Sends Jingle 'transport-reject' message which is a response to
1524
-     * 'transport-replace'.
1525
-     * @param success callback called when we receive 'RESULT' packet for
1526
-     *        'transport-replace'
1527
-     * @param failure function(error) called when we receive an error response
1528
-     *        or when the request has timed out.
1529
-     *
1530
-     * FIXME method should be marked as private, but there's some spaghetti that
1531
-     *       needs to be fixed prior doing that
1532
-     */
1533
-    sendTransportReject(success, failure) {
1534
-        // Send 'transport-reject', so that the focus will
1535
-        // know that we've failed
1536
-        const transportReject = $iq({ to: this.remoteJid,
1537
-            type: 'set' })
1538
-            .c('jingle', {
1539
-                xmlns: 'urn:xmpp:jingle:1',
1540
-                action: 'transport-reject',
1541
-                initiator: this.initiatorJid,
1542
-                sid: this.sid
1543
-            });
1544
-
1545
-        logger.info(`${this} Sending 'transport-reject'`);
1546
-        logger.debug(transportReject.tree());
1547
-
1548
-        this.connection.sendIQ(transportReject,
1549
-            success,
1550
-            this.newJingleErrorHandler(transportReject, failure),
1551
-            IQ_TIMEOUT);
1552
-    }
1553
-
1554
     /**
1326
     /**
1555
      * Sets the resolution constraint on the local camera track.
1327
      * Sets the resolution constraint on the local camera track.
1556
      * @param {number} maxFrameHeight - The user preferred max frame height.
1328
      * @param {number} maxFrameHeight - The user preferred max frame height.

+ 2
- 39
modules/xmpp/strophe.jingle.js 查看文件

4
 import { $iq, Strophe } from 'strophe.js';
4
 import { $iq, Strophe } from 'strophe.js';
5
 
5
 
6
 import { MediaType } from '../../service/RTC/MediaType';
6
 import { MediaType } from '../../service/RTC/MediaType';
7
-import {
8
-    ACTION_JINGLE_TR_RECEIVED,
9
-    ACTION_JINGLE_TR_SUCCESS,
10
-    createJingleEvent
11
-} from '../../service/statistics/AnalyticsEvents';
12
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
7
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
13
-import Statistics from '../statistics/statistics';
14
 import RandomUtil from '../util/RandomUtil';
8
 import RandomUtil from '../util/RandomUtil';
15
 
9
 
16
 import ConnectionPlugin from './ConnectionPlugin';
10
 import ConnectionPlugin from './ConnectionPlugin';
255
             this.eventEmitter.emit(XMPPEvents.CALL_ENDED, sess, reasonCondition, reasonText);
249
             this.eventEmitter.emit(XMPPEvents.CALL_ENDED, sess, reasonCondition, reasonText);
256
             break;
250
             break;
257
         }
251
         }
258
-        case 'transport-replace': {
259
-            logger.info('(TIME) Start transport replace:\t', now);
260
-            const transport = $(iq).find('jingle>content>transport');
261
-            const candidates = _parseIceCandidates(transport);
262
-            const iceUfrag = $(transport).attr('ufrag');
263
-            const icePwd = $(transport).attr('pwd');
264
-            const dtlsFingerprint = $(transport).find('>fingerprint')?.text();
265
-
266
-            logger.debug(`Received ${action} from ${fromJid} with iceUfrag=${iceUfrag},`
267
-            + ` icePwd=${icePwd}, DTLS fingerprint=${dtlsFingerprint}, candidates=${candidates.join(', ')}`);
268
-
269
-            Statistics.sendAnalytics(createJingleEvent(
270
-                ACTION_JINGLE_TR_RECEIVED,
271
-                {
272
-                    p2p: isP2P,
273
-                    value: now
274
-                }));
275
-
276
-            sess.replaceTransport($(iq).find('>jingle'), () => {
277
-                const successTime = window.performance.now();
278
-
279
-                logger.info('(TIME) Transport replace success:\t', successTime);
280
-                Statistics.sendAnalytics(createJingleEvent(
281
-                    ACTION_JINGLE_TR_SUCCESS,
282
-                    {
283
-                        p2p: isP2P,
284
-                        value: successTime
285
-                    }));
286
-            }, error => {
287
-                logger.error('Transport replace failed', error);
288
-                sess.sendTransportReject();
289
-            });
252
+        case 'transport-replace':
253
+            logger.error(`Ignoring ${action} from ${fromJid} as it is not supported by the client.`);
290
             break;
254
             break;
291
-        }
292
         case 'source-add':
255
         case 'source-add':
293
             sess.addRemoteStream($(iq).find('>jingle>content'));
256
             sess.addRemoteStream($(iq).find('>jingle>content'));
294
             break;
257
             break;

+ 0
- 6
service/statistics/AnalyticsEvents.spec.ts 查看文件

13
         ACTION_JINGLE_SI_RECEIVED,
13
         ACTION_JINGLE_SI_RECEIVED,
14
         ACTION_JINGLE_SI_TIMEOUT,
14
         ACTION_JINGLE_SI_TIMEOUT,
15
         ACTION_JINGLE_TERMINATE,
15
         ACTION_JINGLE_TERMINATE,
16
-        ACTION_JINGLE_TR_RECEIVED,
17
-        ACTION_JINGLE_TR_SUCCESS,
18
         ACTION_P2P_DECLINED,
16
         ACTION_P2P_DECLINED,
19
         ACTION_P2P_ESTABLISHED,
17
         ACTION_P2P_ESTABLISHED,
20
         ACTION_P2P_FAILED,
18
         ACTION_P2P_FAILED,
61
         expect( ACTION_JINGLE_SI_RECEIVED ).toBe( 'session-initiate.received' );
59
         expect( ACTION_JINGLE_SI_RECEIVED ).toBe( 'session-initiate.received' );
62
         expect( ACTION_JINGLE_SI_TIMEOUT ).toBe( 'session-initiate.timeout' );
60
         expect( ACTION_JINGLE_SI_TIMEOUT ).toBe( 'session-initiate.timeout' );
63
         expect( ACTION_JINGLE_TERMINATE ).toBe( 'terminate' );
61
         expect( ACTION_JINGLE_TERMINATE ).toBe( 'terminate' );
64
-        expect( ACTION_JINGLE_TR_RECEIVED ).toBe( 'transport-replace.received' );
65
-        expect( ACTION_JINGLE_TR_SUCCESS ).toBe( 'transport-replace.success' );
66
         expect( ACTION_P2P_DECLINED ).toBe( 'decline' );
62
         expect( ACTION_P2P_DECLINED ).toBe( 'decline' );
67
         expect( ACTION_P2P_ESTABLISHED ).toBe( 'established' );
63
         expect( ACTION_P2P_ESTABLISHED ).toBe( 'established' );
68
         expect( ACTION_P2P_FAILED ).toBe( 'failed' );
64
         expect( ACTION_P2P_FAILED ).toBe( 'failed' );
88
         expect( AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED ).toBe( 'session-initiate.received' );
84
         expect( AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED ).toBe( 'session-initiate.received' );
89
         expect( AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT ).toBe( 'session-initiate.timeout' );
85
         expect( AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT ).toBe( 'session-initiate.timeout' );
90
         expect( AnalyticsEvents.ACTION_JINGLE_TERMINATE ).toBe( 'terminate' );
86
         expect( AnalyticsEvents.ACTION_JINGLE_TERMINATE ).toBe( 'terminate' );
91
-        expect( AnalyticsEvents.ACTION_JINGLE_TR_RECEIVED ).toBe( 'transport-replace.received' );
92
-        expect( AnalyticsEvents.ACTION_JINGLE_TR_SUCCESS ).toBe( 'transport-replace.success' );
93
         expect( AnalyticsEvents.ACTION_P2P_DECLINED ).toBe( 'decline' );
87
         expect( AnalyticsEvents.ACTION_P2P_DECLINED ).toBe( 'decline' );
94
         expect( AnalyticsEvents.ACTION_P2P_ESTABLISHED ).toBe( 'established' );
88
         expect( AnalyticsEvents.ACTION_P2P_ESTABLISHED ).toBe( 'established' );
95
         expect( AnalyticsEvents.ACTION_P2P_FAILED ).toBe( 'failed' );
89
         expect( AnalyticsEvents.ACTION_P2P_FAILED ).toBe( 'failed' );

+ 0
- 14
service/statistics/AnalyticsEvents.ts 查看文件

74
      */
74
      */
75
     ACTION_JINGLE_TERMINATE = 'terminate',
75
     ACTION_JINGLE_TERMINATE = 'terminate',
76
 
76
 
77
-    /**
78
-     * The "action" value for Jingle events which indicates that a transport-replace
79
-     * was received.
80
-     */
81
-    ACTION_JINGLE_TR_RECEIVED = 'transport-replace.received',
82
-
83
-    /**
84
-     * The "action" value for Jingle events which indicates that a transport-replace
85
-     * succeeded (TODO: verify/fix the documentation)
86
-     */
87
-    ACTION_JINGLE_TR_SUCCESS = 'transport-replace.success',
88
-
89
     /**
77
     /**
90
      * The "action" value for P2P events which indicates that P2P session initiate message has been rejected by the client
78
      * The "action" value for P2P events which indicates that P2P session initiate message has been rejected by the client
91
      * because the mandatory requirements were not met.
79
      * because the mandatory requirements were not met.
233
 export const ACTION_JINGLE_SI_RECEIVED = AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED;
221
 export const ACTION_JINGLE_SI_RECEIVED = AnalyticsEvents.ACTION_JINGLE_SI_RECEIVED;
234
 export const ACTION_JINGLE_SI_TIMEOUT = AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT;
222
 export const ACTION_JINGLE_SI_TIMEOUT = AnalyticsEvents.ACTION_JINGLE_SI_TIMEOUT;
235
 export const ACTION_JINGLE_TERMINATE = AnalyticsEvents.ACTION_JINGLE_TERMINATE;
223
 export const ACTION_JINGLE_TERMINATE = AnalyticsEvents.ACTION_JINGLE_TERMINATE;
236
-export const ACTION_JINGLE_TR_RECEIVED = AnalyticsEvents.ACTION_JINGLE_TR_RECEIVED;
237
-export const ACTION_JINGLE_TR_SUCCESS = AnalyticsEvents.ACTION_JINGLE_TR_SUCCESS;
238
 export const ACTION_P2P_DECLINED = AnalyticsEvents.ACTION_P2P_DECLINED;
224
 export const ACTION_P2P_DECLINED = AnalyticsEvents.ACTION_P2P_DECLINED;
239
 export const ACTION_P2P_ESTABLISHED = AnalyticsEvents.ACTION_P2P_ESTABLISHED;
225
 export const ACTION_P2P_ESTABLISHED = AnalyticsEvents.ACTION_P2P_ESTABLISHED;
240
 export const ACTION_P2P_FAILED = AnalyticsEvents.ACTION_P2P_FAILED;
226
 export const ACTION_P2P_FAILED = AnalyticsEvents.ACTION_P2P_FAILED;

+ 0
- 2
service/xmpp/XMPPEvents.spec.ts 查看文件

36
         expect( XMPPEvents.FOCUS_DISCONNECTED ).toBe( 'xmpp.focus_disconnected' );
36
         expect( XMPPEvents.FOCUS_DISCONNECTED ).toBe( 'xmpp.focus_disconnected' );
37
         expect( XMPPEvents.FOCUS_LEFT ).toBe( 'xmpp.focus_left' );
37
         expect( XMPPEvents.FOCUS_LEFT ).toBe( 'xmpp.focus_left' );
38
         expect( XMPPEvents.GRACEFUL_SHUTDOWN ).toBe( 'xmpp.graceful_shutdown' );
38
         expect( XMPPEvents.GRACEFUL_SHUTDOWN ).toBe( 'xmpp.graceful_shutdown' );
39
-        expect( XMPPEvents.ICE_RESTARTING ).toBe( 'rtc.ice_restarting' );
40
-        expect( XMPPEvents.ICE_RESTART_SUCCESS ).toBe( 'rtc.ice_restart_success' );
41
         expect( XMPPEvents.KICKED ).toBe( 'xmpp.kicked' );
39
         expect( XMPPEvents.KICKED ).toBe( 'xmpp.kicked' );
42
         expect( XMPPEvents.LOCAL_ROLE_CHANGED ).toBe( 'xmpp.localrole_changed' );
40
         expect( XMPPEvents.LOCAL_ROLE_CHANGED ).toBe( 'xmpp.localrole_changed' );
43
         expect( XMPPEvents.MEETING_ID_SET ).toBe( 'xmpp.meeting_id_set' );
41
         expect( XMPPEvents.MEETING_ID_SET ).toBe( 'xmpp.meeting_id_set' );

+ 0
- 12
service/xmpp/XMPPEvents.ts 查看文件

87
     FOCUS_LEFT = 'xmpp.focus_left',
87
     FOCUS_LEFT = 'xmpp.focus_left',
88
     GRACEFUL_SHUTDOWN = 'xmpp.graceful_shutdown',
88
     GRACEFUL_SHUTDOWN = 'xmpp.graceful_shutdown',
89
 
89
 
90
-    /**
91
-     * Event fired when 'transport-replace' Jingle message has been received,
92
-     * before the new offer is set on the PeerConnection.
93
-     */
94
-    ICE_RESTARTING = 'rtc.ice_restarting',
95
-
96
-    /**
97
-     * Event fired after the 'transport-replace' message has been processed
98
-     * and the new offer has been set successfully.
99
-     */
100
-    ICE_RESTART_SUCCESS = 'rtc.ice_restart_success',
101
-
102
     /**
90
     /**
103
      * Designates an event indicating that we were kicked from the XMPP MUC.
91
      * Designates an event indicating that we were kicked from the XMPP MUC.
104
      * @param {boolean} isSelfPresence - whether it is for local participant
92
      * @param {boolean} isSelfPresence - whether it is for local participant

+ 0
- 1
types/hand-crafted/JitsiConference.d.ts 查看文件

14
     name: string;
14
     name: string;
15
     config: {
15
     config: {
16
       avgRtpStatsN?: number,
16
       avgRtpStatsN?: number,
17
-      enableIceRestart?: boolean,
18
       p2p?: {
17
       p2p?: {
19
         enabled: boolean,
18
         enabled: boolean,
20
         backToP2PDelay?: number
19
         backToP2PDelay?: number

+ 0
- 1
types/hand-crafted/modules/xmpp/ChatRoom.d.ts 查看文件

21
   onConnStatusChanged: ( status: Strophe.Status ) => void;
21
   onConnStatusChanged: ( status: Strophe.Status ) => void;
22
   onPresence: ( pres: unknown ) => void; // TODO:
22
   onPresence: ( pres: unknown ) => void; // TODO:
23
   setParticipantPropertyListener: ( listener: unknown ) => void; // TODO:
23
   setParticipantPropertyListener: ( listener: unknown ) => void; // TODO:
24
-  supportsRestartByTerminate: () => boolean;
25
   processNode: ( node: unknown, from: unknown ) => void; // TODO:
24
   processNode: ( node: unknown, from: unknown ) => void; // TODO:
26
   sendMessage: ( message: unknown, elementName: string ) => void; // TODO:
25
   sendMessage: ( message: unknown, elementName: string ) => void; // TODO:
27
   sendPrivateMessage: ( id: unknown, message: unknown, elementName: string ) => void; // TODO:
26
   sendPrivateMessage: ( id: unknown, message: unknown, elementName: string ) => void; // TODO:

+ 0
- 4
types/hand-crafted/modules/xmpp/JingleSessionPC.d.ts 查看文件

11
   getRemoteRecvMaxFrameHeight: () => number | undefined;
11
   getRemoteRecvMaxFrameHeight: () => number | undefined;
12
   sendIceCandidate: ( candidate: RTCIceCandidate ) => void;
12
   sendIceCandidate: ( candidate: RTCIceCandidate ) => void;
13
   sendIceCandidates: ( candidates: RTCIceCandidate[] ) => void;
13
   sendIceCandidates: ( candidates: RTCIceCandidate[] ) => void;
14
-  sendIceFailedNotification: () => void;
15
   addIceCandidates: ( elem: unknown ) => void; // TODO:
14
   addIceCandidates: ( elem: unknown ) => void; // TODO:
16
   readSsrcInfo: ( contents: unknown ) => void; // TODO:
15
   readSsrcInfo: ( contents: unknown ) => void; // TODO:
17
   getConfiguredVideoCodec: () => CodecMimeType;
16
   getConfiguredVideoCodec: () => CodecMimeType;
21
   setAnswer: ( jingleAnswer: unknown ) => void; // TODO:
20
   setAnswer: ( jingleAnswer: unknown ) => void; // TODO:
22
   setOfferAnswerCycle: ( jingleOfferAnswerIq: JQuery, success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown, localTracks?: JitsiLocalTrack[] ) => void; // TODO:
21
   setOfferAnswerCycle: ( jingleOfferAnswerIq: JQuery, success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown, localTracks?: JitsiLocalTrack[] ) => void; // TODO:
23
   setVideoCodecs: ( preferred?: CodecMimeType, disabled?: CodecMimeType ) => void;
22
   setVideoCodecs: ( preferred?: CodecMimeType, disabled?: CodecMimeType ) => void;
24
-  replaceTransport: ( jingleOfferElem: unknown, success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown ) => void; // TODO:
25
   sendSessionAccept: ( success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown ) => void; // TODO:
23
   sendSessionAccept: ( success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown ) => void; // TODO:
26
   sendContentModify: () => void;
24
   sendContentModify: () => void;
27
   setReceiverVideoConstraint: ( maxFrameHeight: number ) => void;
25
   setReceiverVideoConstraint: ( maxFrameHeight: number ) => void;
28
-  sendTransportAccept: ( localSDP: unknown, success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown ) => void; // TODO:
29
-  sendTransportReject: ( success: ( params: unknown ) => unknown, failure: ( params: unknown ) => unknown ) => void; // TODO:
30
   setSenderMaxBitrates: () => Promise<void>;
26
   setSenderMaxBitrates: () => Promise<void>;
31
   setSenderVideoConstraint: ( maxFrameHeight: number ) => Promise<unknown>; // TODO:
27
   setSenderVideoConstraint: ( maxFrameHeight: number ) => Promise<unknown>; // TODO:
32
   setSenderVideoDegradationPreference: () => Promise<void>;
28
   setSenderVideoDegradationPreference: () => Promise<void>;

+ 0
- 2
types/hand-crafted/service/statistics/AnalyticsEvents.d.ts 查看文件

10
   ACTION_JINGLE_SI_RECEIVED = 'session-initiate.received',
10
   ACTION_JINGLE_SI_RECEIVED = 'session-initiate.received',
11
   ACTION_JINGLE_SI_TIMEOUT = 'session-initiate.timeout',
11
   ACTION_JINGLE_SI_TIMEOUT = 'session-initiate.timeout',
12
   ACTION_JINGLE_TERMINATE = 'terminate',
12
   ACTION_JINGLE_TERMINATE = 'terminate',
13
-  ACTION_JINGLE_TR_RECEIVED = 'transport-replace.received',
14
-  ACTION_JINGLE_TR_SUCCESS = 'transport-replace.success',
15
   ACTION_P2P_DECLINED = 'decline',
13
   ACTION_P2P_DECLINED = 'decline',
16
   ACTION_P2P_ESTABLISHED = 'established',
14
   ACTION_P2P_ESTABLISHED = 'established',
17
   ACTION_P2P_FAILED = 'failed',
15
   ACTION_P2P_FAILED = 'failed',

+ 0
- 2
types/hand-crafted/service/xmpp/XMPPEvents.d.ts 查看文件

23
   FOCUS_DISCONNECTED = 'xmpp.focus_disconnected',
23
   FOCUS_DISCONNECTED = 'xmpp.focus_disconnected',
24
   FOCUS_LEFT = 'xmpp.focus_left',
24
   FOCUS_LEFT = 'xmpp.focus_left',
25
   GRACEFUL_SHUTDOWN = 'xmpp.graceful_shutdown',
25
   GRACEFUL_SHUTDOWN = 'xmpp.graceful_shutdown',
26
-  ICE_RESTARTING = 'rtc.ice_restarting',
27
-  ICE_RESTART_SUCCESS = 'rtc.ice_restart_success',
28
   KICKED = 'xmpp.kicked',
26
   KICKED = 'xmpp.kicked',
29
   LOCAL_ROLE_CHANGED = 'xmpp.localrole_changed',
27
   LOCAL_ROLE_CHANGED = 'xmpp.localrole_changed',
30
   MEETING_ID_SET = 'xmpp.meeting_id_set',
28
   MEETING_ID_SET = 'xmpp.meeting_id_set',

Loading…
取消
儲存