Просмотр исходного кода

feat(visitors): Fire not live connection on jicofo response for visitors.

release-8443
damencho 1 год назад
Родитель
Сommit
ea523fc6ef

+ 3
- 1
JitsiConnectionErrors.spec.ts Просмотреть файл

@@ -5,6 +5,7 @@ import * as exported from "./JitsiConnectionErrors";
5 5
 describe( "/JitsiConnectionErrors members", () => {
6 6
     const {
7 7
         CONNECTION_DROPPED_ERROR,
8
+        NOT_LIVE_ERROR,
8 9
         OTHER_ERROR,
9 10
         PASSWORD_REQUIRED,
10 11
         SERVER_ERROR,
@@ -21,6 +22,7 @@ describe( "/JitsiConnectionErrors members", () => {
21 22
         expect( JitsiConnectionErrors ).toBeDefined();
22 23
 
23 24
         expect( JitsiConnectionErrors.CONNECTION_DROPPED_ERROR ).toBe( 'connection.droppedError' );
25
+        expect( JitsiConnectionErrors.NOT_LIVE_ERROR ).toBe( 'connection.notLiveError' );
24 26
         expect( JitsiConnectionErrors.OTHER_ERROR ).toBe( 'connection.otherError' );
25 27
         expect( JitsiConnectionErrors.PASSWORD_REQUIRED ).toBe( 'connection.passwordRequired' );
26 28
         expect( JitsiConnectionErrors.SERVER_ERROR ).toBe( 'connection.serverError' );
@@ -30,4 +32,4 @@ describe( "/JitsiConnectionErrors members", () => {
30 32
         const keys = Object.keys( others );
31 33
         expect( keys ).withContext( `Extra members: ${ keys.join( ", " ) }` ).toEqual( [] );
32 34
     } );
33
-} );
35
+} );

+ 6
- 0
JitsiConnectionErrors.ts Просмотреть файл

@@ -16,6 +16,11 @@ export enum JitsiConnectionErrors {
16 16
      */
17 17
     CONNECTION_DROPPED_ERROR = 'connection.droppedError',
18 18
 
19
+    /**
20
+     * Not ready error. When the conference error is not ready according to jicofo.
21
+     */
22
+    NOT_LIVE_ERROR = 'connection.notLiveError',
23
+
19 24
     /**
20 25
      * Not specified errors.
21 26
      */
@@ -35,6 +40,7 @@ export enum JitsiConnectionErrors {
35 40
 
36 41
 // exported for backward compatibility
37 42
 export const CONNECTION_DROPPED_ERROR = JitsiConnectionErrors.CONNECTION_DROPPED_ERROR;
43
+export const NOT_LIVE_ERROR = JitsiConnectionErrors.NOT_LIVE_ERROR;
38 44
 export const OTHER_ERROR = JitsiConnectionErrors.OTHER_ERROR;
39 45
 export const PASSWORD_REQUIRED = JitsiConnectionErrors.PASSWORD_REQUIRED;
40 46
 export const SERVER_ERROR = JitsiConnectionErrors.SERVER_ERROR;

+ 17
- 1
modules/xmpp/moderator.js Просмотреть файл

@@ -3,7 +3,8 @@ import { getLogger } from '@jitsi/logger';
3 3
 import $ from 'jquery';
4 4
 import { $iq } from 'strophe.js';
5 5
 
6
-import { CONNECTION_REDIRECTED } from '../../JitsiConnectionEvents';
6
+import { NOT_LIVE_ERROR } from '../../JitsiConnectionErrors';
7
+import { CONNECTION_FAILED, CONNECTION_REDIRECTED } from '../../JitsiConnectionEvents';
7 8
 import Settings from '../settings/Settings';
8 9
 import Listenable from '../util/Listenable';
9 10
 
@@ -276,6 +277,11 @@ export default class Moderator extends Listenable {
276 277
             conferenceRequest.properties.sipGatewayEnabled = 'true';
277 278
         }
278 279
 
280
+        // check for explicit false, all other cases is considered live
281
+        if ($(resultIq).find('>conference>property[name=\'live\'][value=\'false\']').length > 0) {
282
+            conferenceRequest.properties.live = 'false';
283
+        }
284
+
279 285
         return conferenceRequest;
280 286
     }
281 287
 
@@ -387,6 +393,16 @@ export default class Moderator extends Listenable {
387 393
         this.sipGatewayEnabled = conferenceRequest.properties.sipGatewayEnabled;
388 394
         logger.info(`Sip gateway enabled: ${this.sipGatewayEnabled}`);
389 395
 
396
+        if (conferenceRequest.properties.live === 'false' && this.options.preferVisitor) {
397
+            this.getNextTimeout(true);
398
+
399
+            logger.info('Conference is not live.');
400
+
401
+            this.xmpp.eventEmitter.emit(CONNECTION_FAILED, NOT_LIVE_ERROR);
402
+
403
+            return;
404
+        }
405
+
390 406
         if (conferenceRequest.ready) {
391 407
             // Reset the non-error timeout (because we've succeeded here).
392 408
             this.getNextTimeout(true);

+ 1
- 0
types/hand-crafted/JitsiConnectionErrors.d.ts Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 export enum JitsiConnectionErrors {
2 2
   CONNECTION_DROPPED_ERROR = 'connection.droppedError',
3
+  NOT_LIVE_ERROR = 'connection.notLiveError',
3 4
   OTHER_ERROR = 'connection.otherError',
4 5
   PASSWORD_REQUIRED = 'connection.passwordRequired',
5 6
   SERVER_ERROR = 'connection.serverError'

Загрузка…
Отмена
Сохранить