@webex/plugin-meetings 3.12.0-next.10 → 3.12.0-next.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +9 -0
- package/dist/aiEnableRequest/index.js +15 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/index.js +26 -2
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +49 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/constants.js +35 -9
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/constants.js +11 -1
- package/dist/controls-options-manager/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +67 -29
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/util.js +91 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/hashTree/constants.js +4 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +880 -382
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +20 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +75 -15
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +23 -8
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +10 -1
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/interpretation.types.js +7 -0
- package/dist/interpretation/interpretation.types.js.map +1 -0
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +4 -1
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +401 -115
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +36 -5
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/types.js +19 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +15 -2
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +8 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +1 -0
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +5 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1389 -821
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +229 -82
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +10 -1
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +5 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +35 -2
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +2 -2
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +231 -118
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +6 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +39 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +116 -18
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +10 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +30 -0
- package/dist/member/util.js.map +1 -1
- package/dist/members/index.js +101 -43
- package/dist/members/index.js.map +1 -1
- package/dist/members/util.js +8 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +6 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/codec/constants.js +63 -0
- package/dist/multistream/codec/constants.js.map +1 -0
- package/dist/multistream/mediaRequestManager.js +62 -15
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +9 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +121 -83
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/recording-controller/index.js +1 -3
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/roap/turnDiscovery.js +8 -1
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/types/common/errors/webex-errors.d.ts +32 -2
- package/dist/types/config.d.ts +2 -2
- package/dist/types/constants.d.ts +12 -1
- package/dist/types/controls-options-manager/constants.d.ts +6 -1
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +146 -17
- package/dist/types/hashTree/utils.d.ts +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +59 -6
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +21 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
- package/dist/types/media/properties.d.ts +1 -0
- package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
- package/dist/types/meeting/index.d.ts +121 -10
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +1 -0
- package/dist/types/meeting/util.d.ts +9 -0
- package/dist/types/meetings/index.d.ts +30 -18
- package/dist/types/meetings/meetings.types.d.ts +15 -0
- package/dist/types/meetings/request.d.ts +14 -0
- package/dist/types/member/index.d.ts +1 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +9 -0
- package/dist/types/members/index.d.ts +15 -2
- package/dist/types/members/util.d.ts +1 -5
- package/dist/types/metrics/constants.d.ts +5 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +3 -0
- package/dist/webinar/index.js +305 -159
- package/dist/webinar/index.js.map +1 -1
- package/package.json +22 -22
- package/src/aiEnableRequest/index.ts +16 -0
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/index.ts +31 -0
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +2 -2
- package/src/constants.ts +20 -3
- package/src/controls-options-manager/constants.ts +14 -1
- package/src/controls-options-manager/index.ts +87 -28
- package/src/controls-options-manager/util.ts +81 -1
- package/src/hashTree/constants.ts +7 -0
- package/src/hashTree/hashTreeParser.ts +578 -193
- package/src/hashTree/utils.ts +19 -0
- package/src/index.ts +6 -0
- package/src/interceptors/dataChannelAuthToken.ts +88 -12
- package/src/interceptors/locusRetry.ts +25 -4
- package/src/interpretation/index.ts +27 -9
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/controlsUtils.ts +3 -1
- package/src/locus-info/index.ts +415 -136
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/types.ts +25 -1
- package/src/media/MediaConnectionAwaiter.ts +21 -4
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +1 -0
- package/src/meeting/in-meeting-actions.ts +8 -0
- package/src/meeting/index.ts +644 -98
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +11 -0
- package/src/meeting/util.ts +47 -5
- package/src/meeting-info/meeting-info-v2.ts +4 -2
- package/src/meetings/index.ts +133 -78
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +117 -4
- package/src/member/index.ts +10 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +29 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/constants.ts +5 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +119 -28
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/reactions.type.ts +3 -0
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/index.ts +214 -36
- package/test/unit/spec/aiEnableRequest/index.ts +86 -0
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/index.ts +49 -0
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +1848 -318
- package/test/unit/spec/hashTree/utils.ts +37 -0
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
- package/test/unit/spec/interceptors/locusRetry.ts +205 -4
- package/test/unit/spec/interpretation/index.ts +26 -4
- package/test/unit/spec/locus-info/controlsUtils.js +172 -57
- package/test/unit/spec/locus-info/index.js +645 -80
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
- package/test/unit/spec/meeting/index.js +2119 -98
- package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
- package/test/unit/spec/meeting/muteState.js +81 -0
- package/test/unit/spec/meeting/request.js +12 -0
- package/test/unit/spec/meeting/utils.js +157 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
- package/test/unit/spec/meetings/index.js +363 -36
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +402 -51
- package/test/unit/spec/member/index.js +7 -0
- package/test/unit/spec/member/util.js +89 -0
- package/test/unit/spec/members/index.js +216 -0
- package/test/unit/spec/members/request.js +37 -1
- package/test/unit/spec/members/utils.js +63 -0
- package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/recording-controller/index.js +9 -8
- package/test/unit/spec/roap/turnDiscovery.ts +20 -0
- package/test/unit/spec/webinar/index.ts +329 -28
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
ONLINE,
|
|
35
35
|
OFFLINE,
|
|
36
36
|
ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT,
|
|
37
|
+
LOCUS_LLM_EVENT,
|
|
38
|
+
LLM_PRACTICE_SESSION,
|
|
39
|
+
RECORDING_STATE,
|
|
37
40
|
} from '@webex/plugin-meetings/src/constants';
|
|
38
41
|
import {
|
|
39
42
|
ConnectionState,
|
|
@@ -91,6 +94,7 @@ import {
|
|
|
91
94
|
MeetingNotActiveError,
|
|
92
95
|
UserInLobbyError,
|
|
93
96
|
AddMediaFailed,
|
|
97
|
+
MediaConnectionTimedOutError,
|
|
94
98
|
} from '../../../../src/common/errors/webex-errors';
|
|
95
99
|
import WebExMeetingsErrors from '../../../../src/common/errors/webex-meetings-error';
|
|
96
100
|
import ParameterError from '../../../../src/common/errors/parameter';
|
|
@@ -261,11 +265,26 @@ describe('plugin-meetings', () => {
|
|
|
261
265
|
webex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
262
266
|
webex.meetings.reachability = {
|
|
263
267
|
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
268
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
264
269
|
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
265
270
|
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
266
271
|
stopReachability: sinon.stub(),
|
|
267
272
|
isSubnetReachable: sinon.stub().returns(true),
|
|
268
273
|
};
|
|
274
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
275
|
+
.stub()
|
|
276
|
+
.callsFake((ownerMeetingId, sessionId) => {
|
|
277
|
+
const currentOwner = webex.internal.llm.getOwnerMeetingId
|
|
278
|
+
? webex.internal.llm.getOwnerMeetingId(sessionId)
|
|
279
|
+
: undefined;
|
|
280
|
+
const canAssertOwnership = !!ownerMeetingId;
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
currentOwner,
|
|
284
|
+
canAssertOwnership,
|
|
285
|
+
isOwner: !currentOwner || !canAssertOwnership || currentOwner === ownerMeetingId,
|
|
286
|
+
};
|
|
287
|
+
});
|
|
269
288
|
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
270
289
|
webex.internal.llm.on = sinon.stub();
|
|
271
290
|
webex.internal.voicea.announce = sinon.stub();
|
|
@@ -417,6 +436,161 @@ describe('plugin-meetings', () => {
|
|
|
417
436
|
assert.instanceOf(meeting.mediaRequestManagers.screenShareVideo, MediaRequestManager);
|
|
418
437
|
});
|
|
419
438
|
|
|
439
|
+
it('getIngressPayloadType on webrtcMediaConnection is invoked for H264 when sending multistream video requests', () => {
|
|
440
|
+
const getIngressPayloadType = sinon.stub().returns(97);
|
|
441
|
+
|
|
442
|
+
meeting.isMultistream = true;
|
|
443
|
+
meeting.mediaProperties.webrtcMediaConnection = {
|
|
444
|
+
getIngressPayloadType,
|
|
445
|
+
requestMedia: sinon.stub(),
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const fakeReceiveSlot = {
|
|
449
|
+
on: sinon.stub(),
|
|
450
|
+
off: sinon.stub(),
|
|
451
|
+
sourceState: 'live',
|
|
452
|
+
mediaType: MediaType.VideoMain,
|
|
453
|
+
wcmeReceiveSlot: {id: 'fake-wcme-slot'},
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
meeting.mediaRequestManagers.video.addRequest(
|
|
457
|
+
{
|
|
458
|
+
policyInfo: {
|
|
459
|
+
policy: 'receiver-selected',
|
|
460
|
+
csi: 42,
|
|
461
|
+
},
|
|
462
|
+
receiveSlots: [fakeReceiveSlot],
|
|
463
|
+
codecInfo: {
|
|
464
|
+
codec: 'h264',
|
|
465
|
+
maxFs: 3600,
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
true
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
assert.calledOnceWithExactly(
|
|
472
|
+
getIngressPayloadType,
|
|
473
|
+
MediaType.VideoMain,
|
|
474
|
+
MediaCodecMimeType.H264
|
|
475
|
+
);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('getIngressPayloadType on webrtcMediaConnection is invoked for H264 and AV1 for slides video when AV1 slides support is enabled', () => {
|
|
479
|
+
const localWebex = new MockWebex({
|
|
480
|
+
children: {
|
|
481
|
+
meetings: Meetings,
|
|
482
|
+
credentials: Credentials,
|
|
483
|
+
support: Support,
|
|
484
|
+
llm: LLM,
|
|
485
|
+
mercury: Mercury,
|
|
486
|
+
},
|
|
487
|
+
config: {
|
|
488
|
+
credentials: {
|
|
489
|
+
client_id: 'mock-client-id',
|
|
490
|
+
},
|
|
491
|
+
meetings: {
|
|
492
|
+
reconnection: {
|
|
493
|
+
enabled: false,
|
|
494
|
+
},
|
|
495
|
+
mediaSettings: {},
|
|
496
|
+
metrics: {},
|
|
497
|
+
stats: {},
|
|
498
|
+
experimental: {enableUnifiedMeetings: true},
|
|
499
|
+
degradationPreferences: {maxMacroblocksLimit: 8192},
|
|
500
|
+
enableAv1SlidesSupport: true,
|
|
501
|
+
},
|
|
502
|
+
metrics: {
|
|
503
|
+
type: ['behavioral'],
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
localWebex.internal.newMetrics.callDiagnosticMetrics.clearErrorCache = sinon.stub();
|
|
509
|
+
localWebex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId =
|
|
510
|
+
sinon.stub();
|
|
511
|
+
localWebex.internal.support.submitLogs = sinon.stub().returns(Promise.resolve());
|
|
512
|
+
localWebex.internal.services = {get: sinon.stub().returns('locus-url')};
|
|
513
|
+
localWebex.credentials.getOrgId = sinon.stub().returns('fake-org-id');
|
|
514
|
+
localWebex.internal.metrics.submitClientMetrics = sinon.stub().returns(Promise.resolve());
|
|
515
|
+
localWebex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
516
|
+
localWebex.meetings.reachability = {
|
|
517
|
+
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
518
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
519
|
+
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
520
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
521
|
+
stopReachability: sinon.stub(),
|
|
522
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
523
|
+
};
|
|
524
|
+
localWebex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
525
|
+
localWebex.internal.llm.on = sinon.stub();
|
|
526
|
+
localWebex.internal.voicea.announce = sinon.stub();
|
|
527
|
+
localWebex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
528
|
+
{},
|
|
529
|
+
{parent: localWebex}
|
|
530
|
+
);
|
|
531
|
+
|
|
532
|
+
Metrics.initialSetup(localWebex);
|
|
533
|
+
|
|
534
|
+
const localMeeting = new Meeting(
|
|
535
|
+
{
|
|
536
|
+
userId: uuid1,
|
|
537
|
+
resource: uuid2,
|
|
538
|
+
deviceUrl: uuid3,
|
|
539
|
+
locus: {url: url1},
|
|
540
|
+
destination: testDestination,
|
|
541
|
+
destinationType: DESTINATION_TYPE.MEETING_ID,
|
|
542
|
+
correlationId,
|
|
543
|
+
selfId: uuid1,
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
parent: localWebex,
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
const getIngressPayloadType = sinon.stub().callsFake((_mediaType, codecMimeType) => {
|
|
551
|
+
if (codecMimeType === MediaCodecMimeType.H264) {
|
|
552
|
+
return 97;
|
|
553
|
+
}
|
|
554
|
+
if (codecMimeType === MediaCodecMimeType.AV1) {
|
|
555
|
+
return 98;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return undefined;
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
localMeeting.isMultistream = true;
|
|
562
|
+
localMeeting.mediaProperties.webrtcMediaConnection = {
|
|
563
|
+
getIngressPayloadType,
|
|
564
|
+
requestMedia: sinon.stub(),
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const fakeReceiveSlot = {
|
|
568
|
+
on: sinon.stub(),
|
|
569
|
+
off: sinon.stub(),
|
|
570
|
+
sourceState: 'live',
|
|
571
|
+
mediaType: MediaType.VideoSlides,
|
|
572
|
+
wcmeReceiveSlot: {id: 'fake-wcme-slides-slot'},
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
localMeeting.mediaRequestManagers.screenShareVideo.addRequest(
|
|
576
|
+
{
|
|
577
|
+
policyInfo: {
|
|
578
|
+
policy: 'receiver-selected',
|
|
579
|
+
csi: 42,
|
|
580
|
+
},
|
|
581
|
+
receiveSlots: [fakeReceiveSlot],
|
|
582
|
+
codecInfo: {
|
|
583
|
+
codec: 'h264',
|
|
584
|
+
maxFs: 3600,
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
true
|
|
588
|
+
);
|
|
589
|
+
|
|
590
|
+
assert.calledWith(getIngressPayloadType, MediaType.VideoSlides, MediaCodecMimeType.H264);
|
|
591
|
+
assert.calledWith(getIngressPayloadType, MediaType.VideoSlides, MediaCodecMimeType.AV1);
|
|
592
|
+
});
|
|
593
|
+
|
|
420
594
|
it('uses meeting id as correlation id if not provided in constructor', () => {
|
|
421
595
|
const newMeeting = new Meeting(
|
|
422
596
|
{
|
|
@@ -712,6 +886,67 @@ describe('plugin-meetings', () => {
|
|
|
712
886
|
assert.deepEqual(args, [[uuid1], locusUrls]);
|
|
713
887
|
});
|
|
714
888
|
});
|
|
889
|
+
describe('#transfer', () => {
|
|
890
|
+
it('should have #transfer', () => {
|
|
891
|
+
assert.exists(meeting.transfer);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
it('should transfer host using the current locus when the target member is in the current session', async () => {
|
|
895
|
+
sinon.stub(meeting.members.membersCollection, 'get').withArgs(uuid2).returns({isInMeeting: true});
|
|
896
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
897
|
+
|
|
898
|
+
await meeting.transfer(uuid2, false);
|
|
899
|
+
|
|
900
|
+
assert.calledOnceWithExactly(meeting.members.transferHostToMember, uuid2, false);
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
it('should transfer host using breakout locus when the target member is joined in a breakout session', async () => {
|
|
904
|
+
sinon.stub(meeting.members.membersCollection, 'get').withArgs(uuid2).returns({isInMeeting: false});
|
|
905
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
906
|
+
meeting.breakouts.breakouts = {
|
|
907
|
+
models: [
|
|
908
|
+
{
|
|
909
|
+
members: {
|
|
910
|
+
membersCollection: {
|
|
911
|
+
get: sinon.stub().withArgs(uuid2).returns({isInMeeting: true}),
|
|
912
|
+
},
|
|
913
|
+
},
|
|
914
|
+
breakoutRosterLocus: {url: 'https://example.com/breakout-locus'},
|
|
915
|
+
},
|
|
916
|
+
],
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
await meeting.transfer(uuid2, false);
|
|
920
|
+
|
|
921
|
+
assert.calledOnceWithExactly(
|
|
922
|
+
meeting.members.transferHostToMember,
|
|
923
|
+
uuid2,
|
|
924
|
+
false,
|
|
925
|
+
'https://example.com/breakout-locus'
|
|
926
|
+
);
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
it('should not use breakout locus when the breakout member is not in meeting', async () => {
|
|
930
|
+
sinon.stub(meeting.members.membersCollection, 'get').withArgs(uuid2).returns({isInMeeting: false});
|
|
931
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
932
|
+
meeting.breakouts.breakouts = {
|
|
933
|
+
models: [
|
|
934
|
+
{
|
|
935
|
+
members: {
|
|
936
|
+
membersCollection: {
|
|
937
|
+
get: sinon.stub().withArgs(uuid2).returns({isInMeeting: false}),
|
|
938
|
+
},
|
|
939
|
+
},
|
|
940
|
+
breakoutRosterLocus: {url: 'https://example.com/breakout-locus'},
|
|
941
|
+
},
|
|
942
|
+
],
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
await meeting.transfer(uuid2, false);
|
|
946
|
+
|
|
947
|
+
assert.calledOnceWithExactly(meeting.members.transferHostToMember, uuid2, false, undefined);
|
|
948
|
+
});
|
|
949
|
+
});
|
|
715
950
|
describe('#getMembers', () => {
|
|
716
951
|
it('should have #getMembers', () => {
|
|
717
952
|
assert.exists(meeting.getMembers);
|
|
@@ -741,6 +976,8 @@ describe('plugin-meetings', () => {
|
|
|
741
976
|
let addMediaInternalStub;
|
|
742
977
|
let supportsRTCPeerConnectionStub;
|
|
743
978
|
|
|
979
|
+
let suspendDestroyMeetingStub;
|
|
980
|
+
|
|
744
981
|
beforeEach(() => {
|
|
745
982
|
supportsRTCPeerConnectionStub = sinon
|
|
746
983
|
.stub(WebCapabilities, 'supportsRTCPeerConnection')
|
|
@@ -761,6 +998,7 @@ describe('plugin-meetings', () => {
|
|
|
761
998
|
.stub(meeting.roap, 'handleTurnDiscoveryHttpResponse')
|
|
762
999
|
.resolves({turnServerInfo: fakeTurnServerInfo, turnDiscoverySkippedReason: undefined});
|
|
763
1000
|
abortTurnDiscoveryStub = sinon.stub(meeting.roap, 'abortTurnDiscovery');
|
|
1001
|
+
suspendDestroyMeetingStub = sinon.stub(meeting.locusInfo, 'suspendDestroyMeeting');
|
|
764
1002
|
});
|
|
765
1003
|
|
|
766
1004
|
it('should work as expected', async () => {
|
|
@@ -783,8 +1021,9 @@ describe('plugin-meetings', () => {
|
|
|
783
1021
|
assert.calledOnceWithExactly(
|
|
784
1022
|
meeting.addMediaInternal,
|
|
785
1023
|
sinon.match.any,
|
|
786
|
-
fakeTurnServerInfo,
|
|
787
1024
|
false,
|
|
1025
|
+
fakeTurnServerInfo,
|
|
1026
|
+
undefined,
|
|
788
1027
|
mediaOptions
|
|
789
1028
|
);
|
|
790
1029
|
|
|
@@ -792,9 +1031,14 @@ describe('plugin-meetings', () => {
|
|
|
792
1031
|
|
|
793
1032
|
// resets joinWithMediaRetryInfo
|
|
794
1033
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
795
|
-
|
|
1034
|
+
retryCount: 0,
|
|
796
1035
|
prevJoinResponse: undefined,
|
|
797
1036
|
});
|
|
1037
|
+
|
|
1038
|
+
// suspendDestroyMeeting should be called with true at start and false on success
|
|
1039
|
+
assert.calledTwice(suspendDestroyMeetingStub);
|
|
1040
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1041
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, false);
|
|
798
1042
|
});
|
|
799
1043
|
|
|
800
1044
|
it("should not call handleTurnDiscoveryHttpResponse if we don't send a TURN discovery request with join", async () => {
|
|
@@ -816,8 +1060,9 @@ describe('plugin-meetings', () => {
|
|
|
816
1060
|
assert.calledOnceWithExactly(
|
|
817
1061
|
meeting.addMediaInternal,
|
|
818
1062
|
sinon.match.any,
|
|
819
|
-
undefined,
|
|
820
1063
|
false,
|
|
1064
|
+
undefined,
|
|
1065
|
+
undefined,
|
|
821
1066
|
mediaOptions
|
|
822
1067
|
);
|
|
823
1068
|
|
|
@@ -851,8 +1096,9 @@ describe('plugin-meetings', () => {
|
|
|
851
1096
|
assert.calledOnceWithExactly(
|
|
852
1097
|
meeting.addMediaInternal,
|
|
853
1098
|
sinon.match.any,
|
|
854
|
-
undefined,
|
|
855
1099
|
false,
|
|
1100
|
+
undefined,
|
|
1101
|
+
undefined,
|
|
856
1102
|
mediaOptions
|
|
857
1103
|
);
|
|
858
1104
|
|
|
@@ -864,7 +1110,12 @@ describe('plugin-meetings', () => {
|
|
|
864
1110
|
meeting.join = sinon.stub().returns(Promise.reject(error));
|
|
865
1111
|
meeting.locusUrl = null; // when join fails, we end up with null locusUrl
|
|
866
1112
|
|
|
867
|
-
await assert.isRejected(
|
|
1113
|
+
const thrownError = await assert.isRejected(
|
|
1114
|
+
meeting.joinWithMedia({mediaOptions: {allowMediaInLobby: true}})
|
|
1115
|
+
);
|
|
1116
|
+
|
|
1117
|
+
// should throw the first attempt's error
|
|
1118
|
+
assert.equal(thrownError, error);
|
|
868
1119
|
|
|
869
1120
|
assert.calledTwice(abortTurnDiscoveryStub);
|
|
870
1121
|
|
|
@@ -902,9 +1153,84 @@ describe('plugin-meetings', () => {
|
|
|
902
1153
|
|
|
903
1154
|
// resets joinWithMediaRetryInfo
|
|
904
1155
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
905
|
-
|
|
1156
|
+
retryCount: 0,
|
|
906
1157
|
prevJoinResponse: undefined,
|
|
1158
|
+
firstError: undefined,
|
|
1159
|
+
prevError: undefined,
|
|
907
1160
|
});
|
|
1161
|
+
|
|
1162
|
+
// suspendDestroyMeeting(true) called at start of each attempt, (false) only on final failure
|
|
1163
|
+
// 1st attempt: suspendDestroyMeeting(true), 2nd attempt (retry): suspendDestroyMeeting(true), final failure: suspendDestroyMeeting(false)
|
|
1164
|
+
assert.calledThrice(suspendDestroyMeetingStub);
|
|
1165
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1166
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, true);
|
|
1167
|
+
assert.calledWith(suspendDestroyMeetingStub.thirdCall, false);
|
|
1168
|
+
});
|
|
1169
|
+
|
|
1170
|
+
it('should re-join on retry when join() fails on first attempt, and throw the first error if join fails again', async () => {
|
|
1171
|
+
const firstJoinError = new Error('first join error');
|
|
1172
|
+
const secondJoinError = new Error('second join error');
|
|
1173
|
+
|
|
1174
|
+
meeting.join = sinon
|
|
1175
|
+
.stub()
|
|
1176
|
+
.onFirstCall()
|
|
1177
|
+
.rejects(firstJoinError)
|
|
1178
|
+
.onSecondCall()
|
|
1179
|
+
.rejects(secondJoinError);
|
|
1180
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1181
|
+
|
|
1182
|
+
const thrownError = await assert.isRejected(
|
|
1183
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1184
|
+
);
|
|
1185
|
+
|
|
1186
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
1187
|
+
assert.calledTwice(meeting.join);
|
|
1188
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1189
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1190
|
+
|
|
1191
|
+
// should throw the first attempt's error, not the second
|
|
1192
|
+
assert.equal(thrownError, firstJoinError);
|
|
1193
|
+
|
|
1194
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1195
|
+
assert.calledWith(
|
|
1196
|
+
Metrics.sendBehavioralMetric.firstCall,
|
|
1197
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1198
|
+
sinon.match({reason: firstJoinError.message, isRetry: false}),
|
|
1199
|
+
sinon.match.any
|
|
1200
|
+
);
|
|
1201
|
+
assert.calledWith(
|
|
1202
|
+
Metrics.sendBehavioralMetric.secondCall,
|
|
1203
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1204
|
+
sinon.match({reason: secondJoinError.message, isRetry: true}),
|
|
1205
|
+
sinon.match.any
|
|
1206
|
+
);
|
|
1207
|
+
|
|
1208
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1209
|
+
retryCount: 0,
|
|
1210
|
+
prevJoinResponse: undefined,
|
|
1211
|
+
firstError: undefined,
|
|
1212
|
+
prevError: undefined,
|
|
1213
|
+
});
|
|
1214
|
+
});
|
|
1215
|
+
|
|
1216
|
+
it('should NOT call join() again on retry when join() succeeded but addMediaInternal() failed', async () => {
|
|
1217
|
+
const addMediaError = new Error('addMedia error');
|
|
1218
|
+
|
|
1219
|
+
meeting.addMediaInternal = sinon
|
|
1220
|
+
.stub()
|
|
1221
|
+
.onFirstCall()
|
|
1222
|
+
.rejects(addMediaError)
|
|
1223
|
+
.onSecondCall()
|
|
1224
|
+
.resolves(test4);
|
|
1225
|
+
|
|
1226
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1227
|
+
|
|
1228
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1229
|
+
|
|
1230
|
+
// join() should only be called once — the successful join result is reused on retry
|
|
1231
|
+
assert.calledOnce(meeting.join);
|
|
1232
|
+
// TURN discovery request is only generated once (on the first attempt alongside join)
|
|
1233
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
908
1234
|
});
|
|
909
1235
|
|
|
910
1236
|
it('should resolve if join() fails the first time but succeeds the second time', async () => {
|
|
@@ -948,7 +1274,7 @@ describe('plugin-meetings', () => {
|
|
|
948
1274
|
|
|
949
1275
|
// resets joinWithMediaRetryInfo
|
|
950
1276
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
951
|
-
|
|
1277
|
+
retryCount: 0,
|
|
952
1278
|
prevJoinResponse: undefined,
|
|
953
1279
|
});
|
|
954
1280
|
});
|
|
@@ -1017,6 +1343,127 @@ describe('plugin-meetings', () => {
|
|
|
1017
1343
|
);
|
|
1018
1344
|
});
|
|
1019
1345
|
|
|
1346
|
+
it('should throw the first attempt error when retry also fails with a different error', async () => {
|
|
1347
|
+
const firstError = new Error('first attempt error');
|
|
1348
|
+
const secondError = new Error('second attempt error');
|
|
1349
|
+
|
|
1350
|
+
const addMediaInternalResults = [];
|
|
1351
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1352
|
+
const defer = new Defer();
|
|
1353
|
+
addMediaInternalResults.push(defer);
|
|
1354
|
+
return defer.promise;
|
|
1355
|
+
});
|
|
1356
|
+
|
|
1357
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1358
|
+
|
|
1359
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1360
|
+
|
|
1361
|
+
await testUtils.flushPromises();
|
|
1362
|
+
|
|
1363
|
+
// 1st attempt fails
|
|
1364
|
+
addMediaInternalResults[0].reject(firstError);
|
|
1365
|
+
await testUtils.flushPromises();
|
|
1366
|
+
|
|
1367
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1368
|
+
assert.notCalled(leaveStub);
|
|
1369
|
+
|
|
1370
|
+
// 2nd (final) attempt fails
|
|
1371
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1372
|
+
const thrownError = await assert.isRejected(result);
|
|
1373
|
+
|
|
1374
|
+
// should throw the first error, not the second
|
|
1375
|
+
assert.equal(thrownError, firstError);
|
|
1376
|
+
|
|
1377
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1378
|
+
assert.calledOnce(leaveStub);
|
|
1379
|
+
|
|
1380
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
it('should throw the UserNotJoinedError as firstError when it occurs on the 1st attempt and 2nd attempt fails differently', async () => {
|
|
1384
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1385
|
+
const secondError = new Error('second attempt error');
|
|
1386
|
+
|
|
1387
|
+
const addMediaInternalResults = [];
|
|
1388
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1389
|
+
const defer = new Defer();
|
|
1390
|
+
addMediaInternalResults.push(defer);
|
|
1391
|
+
return defer.promise;
|
|
1392
|
+
});
|
|
1393
|
+
|
|
1394
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1395
|
+
|
|
1396
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1397
|
+
|
|
1398
|
+
await testUtils.flushPromises();
|
|
1399
|
+
|
|
1400
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1401
|
+
addMediaInternalResults[0].reject(userNotJoinedError);
|
|
1402
|
+
await testUtils.flushPromises();
|
|
1403
|
+
|
|
1404
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1405
|
+
assert.notCalled(leaveStub);
|
|
1406
|
+
|
|
1407
|
+
// 2nd (final) attempt fails
|
|
1408
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1409
|
+
const thrownError = await assert.isRejected(result);
|
|
1410
|
+
|
|
1411
|
+
// should throw the first (UserNotJoinedError), not the second
|
|
1412
|
+
assert.equal(thrownError, userNotJoinedError);
|
|
1413
|
+
|
|
1414
|
+
// join() called twice: original + re-join triggered by UserNotJoinedError in prevError
|
|
1415
|
+
assert.calledTwice(meeting.join);
|
|
1416
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1417
|
+
assert.calledOnce(leaveStub);
|
|
1418
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1419
|
+
});
|
|
1420
|
+
|
|
1421
|
+
it('should throw the first UserNotJoinedError when it occurs on both 1st and 2nd attempts and a 3rd attempt also fails', async () => {
|
|
1422
|
+
const firstUserNotJoinedError = new UserNotJoinedError('first');
|
|
1423
|
+
const secondUserNotJoinedError = new UserNotJoinedError('second');
|
|
1424
|
+
const thirdError = new Error('third attempt error');
|
|
1425
|
+
|
|
1426
|
+
const addMediaInternalResults = [];
|
|
1427
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1428
|
+
const defer = new Defer();
|
|
1429
|
+
addMediaInternalResults.push(defer);
|
|
1430
|
+
return defer.promise;
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1434
|
+
|
|
1435
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1436
|
+
|
|
1437
|
+
await testUtils.flushPromises();
|
|
1438
|
+
|
|
1439
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1440
|
+
addMediaInternalResults[0].reject(firstUserNotJoinedError);
|
|
1441
|
+
await testUtils.flushPromises();
|
|
1442
|
+
|
|
1443
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1444
|
+
assert.notCalled(leaveStub);
|
|
1445
|
+
|
|
1446
|
+
// 2nd attempt fails with UserNotJoinedError again — triggers another re-join
|
|
1447
|
+
addMediaInternalResults[1].reject(secondUserNotJoinedError);
|
|
1448
|
+
await testUtils.flushPromises();
|
|
1449
|
+
|
|
1450
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1451
|
+
assert.notCalled(leaveStub);
|
|
1452
|
+
|
|
1453
|
+
// 3rd (final) attempt fails
|
|
1454
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1455
|
+
const thrownError = await assert.isRejected(result);
|
|
1456
|
+
|
|
1457
|
+
// should throw the very first error across all 3 attempts
|
|
1458
|
+
assert.equal(thrownError, firstUserNotJoinedError);
|
|
1459
|
+
|
|
1460
|
+
// join() called 3 times: original + 2 re-joins triggered by prevError being UserNotJoinedError
|
|
1461
|
+
assert.calledThrice(meeting.join);
|
|
1462
|
+
// leave() should only be called after the last (3rd) attempt
|
|
1463
|
+
assert.calledOnce(leaveStub);
|
|
1464
|
+
assert.calledThrice(Metrics.sendBehavioralMetric);
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1020
1467
|
it('should call leave() if addMediaInternal() fails with a browser media error (TypeError)', async () => {
|
|
1021
1468
|
const addMediaError = new Error('fake addMedia error');
|
|
1022
1469
|
addMediaError.name = 'TypeError'; // This makes it a browser media error
|
|
@@ -1212,8 +1659,9 @@ describe('plugin-meetings', () => {
|
|
|
1212
1659
|
assert.calledWith(
|
|
1213
1660
|
meeting.addMediaInternal.firstCall,
|
|
1214
1661
|
sinon.match.any,
|
|
1215
|
-
fakeTurnServerInfo,
|
|
1216
1662
|
false,
|
|
1663
|
+
fakeTurnServerInfo,
|
|
1664
|
+
undefined,
|
|
1217
1665
|
mediaOptions
|
|
1218
1666
|
);
|
|
1219
1667
|
|
|
@@ -1221,8 +1669,9 @@ describe('plugin-meetings', () => {
|
|
|
1221
1669
|
assert.calledWith(
|
|
1222
1670
|
meeting.addMediaInternal.secondCall,
|
|
1223
1671
|
sinon.match.any,
|
|
1224
|
-
undefined,
|
|
1225
1672
|
true,
|
|
1673
|
+
undefined,
|
|
1674
|
+
undefined,
|
|
1226
1675
|
mediaOptions
|
|
1227
1676
|
);
|
|
1228
1677
|
|
|
@@ -1240,7 +1689,7 @@ describe('plugin-meetings', () => {
|
|
|
1240
1689
|
|
|
1241
1690
|
meeting.addMediaInternal = sinon
|
|
1242
1691
|
.stub()
|
|
1243
|
-
.callsFake((icePhaseCallback,
|
|
1692
|
+
.callsFake((icePhaseCallback, _forceTurnDiscovery, _turnServerInfo) => {
|
|
1244
1693
|
const defer = new Defer();
|
|
1245
1694
|
|
|
1246
1695
|
icePhaseCallbacks.push(icePhaseCallback);
|
|
@@ -1264,7 +1713,8 @@ describe('plugin-meetings', () => {
|
|
|
1264
1713
|
|
|
1265
1714
|
await testUtils.flushPromises();
|
|
1266
1715
|
|
|
1267
|
-
// check the callback works correctly on the 2nd attempt
|
|
1716
|
+
// check the callback works correctly on the 2nd attempt:
|
|
1717
|
+
// retryCount=1 with a non-UserNotJoinedError is terminal, so icePhase must be JOIN_MEETING_FINAL
|
|
1268
1718
|
assert.equal(icePhaseCallbacks.length, 2);
|
|
1269
1719
|
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1270
1720
|
|
|
@@ -1274,6 +1724,118 @@ describe('plugin-meetings', () => {
|
|
|
1274
1724
|
await assert.isRejected(result);
|
|
1275
1725
|
});
|
|
1276
1726
|
|
|
1727
|
+
it('should allow an additional retry when UserNotJoinedError occurs and return JOIN_MEETING_FINAL on the 3rd attempt', async () => {
|
|
1728
|
+
const genericError = new Error('generic error');
|
|
1729
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1730
|
+
const thirdError = new Error('third error');
|
|
1731
|
+
|
|
1732
|
+
const icePhaseCallbacks = [];
|
|
1733
|
+
const addMediaInternalResults = [];
|
|
1734
|
+
|
|
1735
|
+
meeting.addMediaInternal = sinon
|
|
1736
|
+
.stub()
|
|
1737
|
+
.callsFake((icePhaseCallback) => {
|
|
1738
|
+
const defer = new Defer();
|
|
1739
|
+
|
|
1740
|
+
icePhaseCallbacks.push(icePhaseCallback);
|
|
1741
|
+
addMediaInternalResults.push(defer);
|
|
1742
|
+
return defer.promise;
|
|
1743
|
+
});
|
|
1744
|
+
|
|
1745
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1746
|
+
|
|
1747
|
+
const result = meeting.joinWithMedia({
|
|
1748
|
+
joinOptions,
|
|
1749
|
+
mediaOptions,
|
|
1750
|
+
});
|
|
1751
|
+
|
|
1752
|
+
await testUtils.flushPromises();
|
|
1753
|
+
|
|
1754
|
+
// 1st attempt: retryCount=0 → JOIN_MEETING_RETRY
|
|
1755
|
+
assert.equal(icePhaseCallbacks.length, 1);
|
|
1756
|
+
assert.equal(icePhaseCallbacks[0](), 'JOIN_MEETING_RETRY');
|
|
1757
|
+
addMediaInternalResults[0].reject(genericError);
|
|
1758
|
+
|
|
1759
|
+
await testUtils.flushPromises();
|
|
1760
|
+
|
|
1761
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1762
|
+
assert.notCalled(leaveStub);
|
|
1763
|
+
|
|
1764
|
+
// 2nd attempt: retryCount=1 → JOIN_MEETING_FINAL
|
|
1765
|
+
// (In real usage this callback is never invoked when UserNotJoinedError is thrown,
|
|
1766
|
+
// because UserNotJoinedError is thrown before waitForMediaConnectionConnected() is reached.)
|
|
1767
|
+
assert.equal(icePhaseCallbacks.length, 2);
|
|
1768
|
+
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1769
|
+
addMediaInternalResults[1].reject(userNotJoinedError);
|
|
1770
|
+
|
|
1771
|
+
await testUtils.flushPromises();
|
|
1772
|
+
|
|
1773
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1774
|
+
assert.notCalled(leaveStub);
|
|
1775
|
+
|
|
1776
|
+
// 3rd attempt: retryCount=2 → JOIN_MEETING_FINAL
|
|
1777
|
+
assert.equal(icePhaseCallbacks.length, 3);
|
|
1778
|
+
assert.equal(icePhaseCallbacks[2](), 'JOIN_MEETING_FINAL');
|
|
1779
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1780
|
+
|
|
1781
|
+
const thrownError = await assert.isRejected(result);
|
|
1782
|
+
|
|
1783
|
+
// should throw the first error
|
|
1784
|
+
assert.equal(thrownError, genericError);
|
|
1785
|
+
|
|
1786
|
+
// leave() should only be called once, after the last (3rd) attempt
|
|
1787
|
+
assert.calledOnce(leaveStub);
|
|
1788
|
+
});
|
|
1789
|
+
|
|
1790
|
+
it('should re-join when retrying after a UserNotJoinedError', async () => {
|
|
1791
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1792
|
+
|
|
1793
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1794
|
+
|
|
1795
|
+
meeting.addMediaInternal = sinon
|
|
1796
|
+
.stub()
|
|
1797
|
+
.onFirstCall()
|
|
1798
|
+
.rejects(userNotJoinedError)
|
|
1799
|
+
.onSecondCall()
|
|
1800
|
+
.resolves(test4);
|
|
1801
|
+
|
|
1802
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1803
|
+
|
|
1804
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1805
|
+
|
|
1806
|
+
// join() should be called twice — once for the first attempt, once for the re-join after UserNotJoinedError
|
|
1807
|
+
assert.calledTwice(meeting.join);
|
|
1808
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1809
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1810
|
+
// leave() should never be called when retrying after UserNotJoinedError
|
|
1811
|
+
assert.notCalled(leaveStub);
|
|
1812
|
+
});
|
|
1813
|
+
|
|
1814
|
+
it('should re-join when isUserInLeftState returns true on retry', async () => {
|
|
1815
|
+
const addMediaError = new Error('addMedia error');
|
|
1816
|
+
|
|
1817
|
+
sinon.stub(MeetingUtil, 'isUserInLeftState').returns(true);
|
|
1818
|
+
|
|
1819
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1820
|
+
|
|
1821
|
+
meeting.addMediaInternal = sinon
|
|
1822
|
+
.stub()
|
|
1823
|
+
.onFirstCall()
|
|
1824
|
+
.rejects(addMediaError)
|
|
1825
|
+
.onSecondCall()
|
|
1826
|
+
.resolves(test4);
|
|
1827
|
+
|
|
1828
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1829
|
+
|
|
1830
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1831
|
+
|
|
1832
|
+
// join() should be called twice — once for the first attempt, once because the user is in left state
|
|
1833
|
+
assert.calledTwice(meeting.join);
|
|
1834
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1835
|
+
// leave() should never be called when retrying after isUserInLeftState returns true
|
|
1836
|
+
assert.notCalled(leaveStub);
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1277
1839
|
[
|
|
1278
1840
|
{
|
|
1279
1841
|
errorName: 'SdpOfferCreationError',
|
|
@@ -1341,6 +1903,7 @@ describe('plugin-meetings', () => {
|
|
|
1341
1903
|
sinon.match.any,
|
|
1342
1904
|
sinon.match.any,
|
|
1343
1905
|
sinon.match.any,
|
|
1906
|
+
sinon.match.any,
|
|
1344
1907
|
sinon.match.has('videoEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1345
1908
|
);
|
|
1346
1909
|
});
|
|
@@ -1361,6 +1924,7 @@ describe('plugin-meetings', () => {
|
|
|
1361
1924
|
sinon.match.any,
|
|
1362
1925
|
sinon.match.any,
|
|
1363
1926
|
sinon.match.any,
|
|
1927
|
+
sinon.match.any,
|
|
1364
1928
|
sinon.match.has('audioEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1365
1929
|
);
|
|
1366
1930
|
});
|
|
@@ -1382,6 +1946,7 @@ describe('plugin-meetings', () => {
|
|
|
1382
1946
|
sinon.match.any,
|
|
1383
1947
|
sinon.match.any,
|
|
1384
1948
|
sinon.match.any,
|
|
1949
|
+
sinon.match.any,
|
|
1385
1950
|
sinon.match({
|
|
1386
1951
|
sendVideo: true,
|
|
1387
1952
|
receiveVideo: false,
|
|
@@ -1391,6 +1956,97 @@ describe('plugin-meetings', () => {
|
|
|
1391
1956
|
);
|
|
1392
1957
|
});
|
|
1393
1958
|
|
|
1959
|
+
describe('shouldRetryMediaWithOnlyTurnTLS', () => {
|
|
1960
|
+
it('should pass iceTransportPolicy=relay for multistream when previous error is DTLS failure over UDP and TLS is reachable', async () => {
|
|
1961
|
+
meeting.isMultistream = true;
|
|
1962
|
+
const dtlsError = new AddMediaFailed({iceConnected: true, connectionType: 'UDP'});
|
|
1963
|
+
|
|
1964
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon.stub().resolves(true);
|
|
1965
|
+
|
|
1966
|
+
addMediaInternalStub.onFirstCall().rejects(dtlsError);
|
|
1967
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
1968
|
+
|
|
1969
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1970
|
+
|
|
1971
|
+
assert.calledWith(
|
|
1972
|
+
meeting.addMediaInternal.secondCall,
|
|
1973
|
+
sinon.match.any,
|
|
1974
|
+
sinon.match.any,
|
|
1975
|
+
sinon.match.any,
|
|
1976
|
+
'relay',
|
|
1977
|
+
mediaOptions
|
|
1978
|
+
);
|
|
1979
|
+
});
|
|
1980
|
+
|
|
1981
|
+
[
|
|
1982
|
+
{
|
|
1983
|
+
title: 'TLS is not reachable',
|
|
1984
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
1985
|
+
tlsReachable: false,
|
|
1986
|
+
isMultistream: true,
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
title: 'error is not AddMediaFailed',
|
|
1990
|
+
prevError: new Error('generic error'),
|
|
1991
|
+
tlsReachable: true,
|
|
1992
|
+
isMultistream: true,
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
title: 'error is AddMediaFailed but not DTLS failure',
|
|
1996
|
+
prevError: new AddMediaFailed({iceConnected: false, connectionType: 'UDP'}),
|
|
1997
|
+
tlsReachable: true,
|
|
1998
|
+
isMultistream: true,
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
title: 'error is DTLS failure but connectionType is not UDP',
|
|
2002
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'TURN-TLS'}),
|
|
2003
|
+
tlsReachable: true,
|
|
2004
|
+
isMultistream: true,
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
title: 'isMultistream is false',
|
|
2008
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
2009
|
+
tlsReachable: true,
|
|
2010
|
+
isMultistream: false,
|
|
2011
|
+
},
|
|
2012
|
+
].forEach(({title, prevError, tlsReachable, isMultistream}) => {
|
|
2013
|
+
it(`should pass iceTransportPolicy=undefined when ${title}`, async () => {
|
|
2014
|
+
meeting.join = sinon.stub().callsFake(() => {
|
|
2015
|
+
meeting.isMultistream = isMultistream;
|
|
2016
|
+
return Promise.resolve(fakeJoinResult);
|
|
2017
|
+
});
|
|
2018
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon.stub().resolves(tlsReachable);
|
|
2019
|
+
|
|
2020
|
+
addMediaInternalStub.onFirstCall().rejects(prevError);
|
|
2021
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
2022
|
+
|
|
2023
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2024
|
+
|
|
2025
|
+
assert.calledWith(
|
|
2026
|
+
meeting.addMediaInternal.secondCall,
|
|
2027
|
+
sinon.match.any,
|
|
2028
|
+
sinon.match.any,
|
|
2029
|
+
sinon.match.any,
|
|
2030
|
+
undefined,
|
|
2031
|
+
mediaOptions
|
|
2032
|
+
);
|
|
2033
|
+
});
|
|
2034
|
+
});
|
|
2035
|
+
|
|
2036
|
+
it('should pass iceTransportPolicy=undefined on first attempt (no prevError)', async () => {
|
|
2037
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2038
|
+
|
|
2039
|
+
assert.calledWith(
|
|
2040
|
+
meeting.addMediaInternal.firstCall,
|
|
2041
|
+
sinon.match.any,
|
|
2042
|
+
sinon.match.any,
|
|
2043
|
+
sinon.match.any,
|
|
2044
|
+
undefined,
|
|
2045
|
+
mediaOptions
|
|
2046
|
+
);
|
|
2047
|
+
});
|
|
2048
|
+
});
|
|
2049
|
+
|
|
1394
2050
|
it('should throw immediately if RTCPeerConnection is not available', async () => {
|
|
1395
2051
|
supportsRTCPeerConnectionStub.returns(CapabilityState.NOT_CAPABLE);
|
|
1396
2052
|
|
|
@@ -1402,9 +2058,87 @@ describe('plugin-meetings', () => {
|
|
|
1402
2058
|
Errors.WebrtcApiNotAvailableError
|
|
1403
2059
|
);
|
|
1404
2060
|
|
|
2061
|
+
assert.notCalled(suspendDestroyMeetingStub);
|
|
1405
2062
|
assert.notCalled(meeting.join);
|
|
1406
2063
|
assert.notCalled(meeting.addMediaInternal);
|
|
1407
2064
|
});
|
|
2065
|
+
|
|
2066
|
+
[
|
|
2067
|
+
{description: '409 error from join()', statusCode: 409, useCause: false},
|
|
2068
|
+
{description: '403 error from join()', statusCode: 403, useCause: false},
|
|
2069
|
+
{description: '409 error in cause (e.g. AddMediaFailed)', statusCode: 409, useCause: true},
|
|
2070
|
+
{description: '403 error in cause (e.g. AddMediaFailed)', statusCode: 403, useCause: true},
|
|
2071
|
+
].forEach(({description, statusCode, useCause}) => {
|
|
2072
|
+
it(`should re-join on retry when ${description}`, async () => {
|
|
2073
|
+
const error = useCause
|
|
2074
|
+
? Object.assign(new Error('wrapped error'), {cause: {statusCode}})
|
|
2075
|
+
: Object.assign(new Error('locus error'), {statusCode});
|
|
2076
|
+
|
|
2077
|
+
meeting.addMediaInternal = sinon
|
|
2078
|
+
.stub()
|
|
2079
|
+
.onFirstCall()
|
|
2080
|
+
.rejects(error)
|
|
2081
|
+
.onSecondCall()
|
|
2082
|
+
.resolves(test4);
|
|
2083
|
+
|
|
2084
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2085
|
+
|
|
2086
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
2087
|
+
|
|
2088
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
2089
|
+
assert.calledTwice(meeting.join);
|
|
2090
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
2091
|
+
});
|
|
2092
|
+
});
|
|
2093
|
+
|
|
2094
|
+
it('should allow up to JOIN_WITH_MEDIA_RETRY_MAX_COUNT retries for 409 errors', async () => {
|
|
2095
|
+
const error409 = Object.assign(new Error('locus dropped us'), {statusCode: 409});
|
|
2096
|
+
|
|
2097
|
+
meeting.addMediaInternal = sinon.stub().rejects(error409);
|
|
2098
|
+
meeting.join = sinon.stub().callsFake(() => Promise.resolve(fakeJoinResult));
|
|
2099
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
2100
|
+
|
|
2101
|
+
await assert.isRejected(
|
|
2102
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
2103
|
+
);
|
|
2104
|
+
|
|
2105
|
+
// JOIN_WITH_MEDIA_RETRY_MAX_COUNT is 2, so we expect 3 attempts total (initial + 2 retries)
|
|
2106
|
+
assert.callCount(meeting.join, 3);
|
|
2107
|
+
assert.callCount(meeting.addMediaInternal, 3);
|
|
2108
|
+
});
|
|
2109
|
+
|
|
2110
|
+
it('should not retry on 1-1 calls', async () => {
|
|
2111
|
+
const addMediaError = new Error('addMedia error');
|
|
2112
|
+
|
|
2113
|
+
sinon.stub(MeetingsUtil, 'isOneOnOneCall').returns(true);
|
|
2114
|
+
|
|
2115
|
+
meeting.addMediaInternal = sinon.stub().rejects(addMediaError);
|
|
2116
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
2117
|
+
|
|
2118
|
+
await assert.isRejected(
|
|
2119
|
+
meeting.joinWithMedia({joinOptions, mediaOptions}),
|
|
2120
|
+
addMediaError
|
|
2121
|
+
);
|
|
2122
|
+
|
|
2123
|
+
// should not retry - only 1 attempt
|
|
2124
|
+
assert.calledOnce(meeting.join);
|
|
2125
|
+
assert.calledOnce(meeting.addMediaInternal);
|
|
2126
|
+
assert.calledOnceWithExactly(
|
|
2127
|
+
Metrics.sendBehavioralMetric,
|
|
2128
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
2129
|
+
{
|
|
2130
|
+
correlation_id: meeting.correlationId,
|
|
2131
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
2132
|
+
reason: addMediaError.message,
|
|
2133
|
+
stack: addMediaError.stack,
|
|
2134
|
+
leaveErrorReason: undefined,
|
|
2135
|
+
isRetry: false,
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
type: addMediaError.name,
|
|
2139
|
+
}
|
|
2140
|
+
);
|
|
2141
|
+
});
|
|
1408
2142
|
});
|
|
1409
2143
|
describe('#isTranscriptionSupported', () => {
|
|
1410
2144
|
it('should return false if the feature is not supported for the meeting', () => {
|
|
@@ -1977,6 +2711,113 @@ describe('plugin-meetings', () => {
|
|
|
1977
2711
|
fakeProcessedReaction
|
|
1978
2712
|
);
|
|
1979
2713
|
});
|
|
2714
|
+
|
|
2715
|
+
[
|
|
2716
|
+
{
|
|
2717
|
+
title: 'should skip a reaction when the default relay route does not match the LLM binding',
|
|
2718
|
+
isPracticeSessionConnected: false,
|
|
2719
|
+
route: 'wrong-default-route',
|
|
2720
|
+
defaultBinding: 'default-route',
|
|
2721
|
+
practiceBinding: 'practice-route',
|
|
2722
|
+
shouldProcess: false,
|
|
2723
|
+
expectedSessionLabel: 'default session',
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
title: 'should process a reaction when the default relay route matches the LLM binding',
|
|
2727
|
+
isPracticeSessionConnected: false,
|
|
2728
|
+
route: 'default-route',
|
|
2729
|
+
defaultBinding: 'default-route',
|
|
2730
|
+
practiceBinding: 'practice-route',
|
|
2731
|
+
shouldProcess: true,
|
|
2732
|
+
},
|
|
2733
|
+
{
|
|
2734
|
+
title:
|
|
2735
|
+
'should process a reaction when the practice-session relay route matches the practice-session LLM binding',
|
|
2736
|
+
isPracticeSessionConnected: true,
|
|
2737
|
+
route: 'practice-route',
|
|
2738
|
+
defaultBinding: 'default-route',
|
|
2739
|
+
practiceBinding: 'practice-route',
|
|
2740
|
+
shouldProcess: true,
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
title:
|
|
2744
|
+
'should skip a reaction when the practice-session relay route does not match the practice-session LLM binding',
|
|
2745
|
+
isPracticeSessionConnected: true,
|
|
2746
|
+
route: 'default-route',
|
|
2747
|
+
defaultBinding: 'default-route',
|
|
2748
|
+
practiceBinding: 'practice-route',
|
|
2749
|
+
shouldProcess: false,
|
|
2750
|
+
expectedSessionLabel: 'practice session',
|
|
2751
|
+
},
|
|
2752
|
+
].forEach(
|
|
2753
|
+
({
|
|
2754
|
+
title,
|
|
2755
|
+
isPracticeSessionConnected,
|
|
2756
|
+
route,
|
|
2757
|
+
defaultBinding,
|
|
2758
|
+
practiceBinding,
|
|
2759
|
+
shouldProcess,
|
|
2760
|
+
expectedSessionLabel,
|
|
2761
|
+
}) => {
|
|
2762
|
+
it(title, () => {
|
|
2763
|
+
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2764
|
+
meeting.config.receiveReactions = true;
|
|
2765
|
+
const fakeSendersName = 'Fake reactors name';
|
|
2766
|
+
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2767
|
+
webex.internal.llm.isConnected = sinon.stub().callsFake((llmSessionId) => {
|
|
2768
|
+
return llmSessionId === LLM_PRACTICE_SESSION && isPracticeSessionConnected;
|
|
2769
|
+
});
|
|
2770
|
+
webex.internal.llm.getBinding = sinon.stub().callsFake((llmSessionId) => {
|
|
2771
|
+
if (llmSessionId === LLM_PRACTICE_SESSION) {
|
|
2772
|
+
return practiceBinding;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
return defaultBinding;
|
|
2776
|
+
});
|
|
2777
|
+
const fakeReactionPayload = {
|
|
2778
|
+
type: 'fake_type',
|
|
2779
|
+
codepoints: 'fake_codepoints',
|
|
2780
|
+
shortcodes: 'fake_shortcodes',
|
|
2781
|
+
};
|
|
2782
|
+
const fakeSenderPayload = {
|
|
2783
|
+
participantId: 'fake_participant_id',
|
|
2784
|
+
};
|
|
2785
|
+
const fakeRelayEvent = {
|
|
2786
|
+
headers: {route},
|
|
2787
|
+
data: {
|
|
2788
|
+
relayType: REACTION_RELAY_TYPES.REACTION,
|
|
2789
|
+
reaction: fakeReactionPayload,
|
|
2790
|
+
sender: fakeSenderPayload,
|
|
2791
|
+
},
|
|
2792
|
+
};
|
|
2793
|
+
const fakeProcessedReaction = {
|
|
2794
|
+
reaction: fakeReactionPayload,
|
|
2795
|
+
sender: {
|
|
2796
|
+
id: fakeSenderPayload.participantId,
|
|
2797
|
+
name: fakeSendersName,
|
|
2798
|
+
},
|
|
2799
|
+
};
|
|
2800
|
+
|
|
2801
|
+
TriggerProxy.trigger.resetHistory();
|
|
2802
|
+
meeting.processRelayEvent(fakeRelayEvent);
|
|
2803
|
+
|
|
2804
|
+
if (shouldProcess) {
|
|
2805
|
+
assert.calledWith(
|
|
2806
|
+
TriggerProxy.trigger,
|
|
2807
|
+
sinon.match.instanceOf(Meeting),
|
|
2808
|
+
{
|
|
2809
|
+
file: 'meeting/index',
|
|
2810
|
+
function: 'join',
|
|
2811
|
+
},
|
|
2812
|
+
EVENT_TRIGGERS.MEETING_RECEIVE_REACTIONS,
|
|
2813
|
+
fakeProcessedReaction
|
|
2814
|
+
);
|
|
2815
|
+
} else {
|
|
2816
|
+
assert.notCalled(TriggerProxy.trigger);
|
|
2817
|
+
}
|
|
2818
|
+
});
|
|
2819
|
+
}
|
|
2820
|
+
);
|
|
1980
2821
|
});
|
|
1981
2822
|
|
|
1982
2823
|
describe('#handleLLMOnline', () => {
|
|
@@ -2016,6 +2857,14 @@ describe('plugin-meetings', () => {
|
|
|
2016
2857
|
|
|
2017
2858
|
assert.notCalled(webex.internal.voicea.updateSubchannelSubscriptions);
|
|
2018
2859
|
});
|
|
2860
|
+
|
|
2861
|
+
it('calls syncAllHashTreeDatasets on locusInfo', () => {
|
|
2862
|
+
sinon.stub(meeting.locusInfo, 'syncAllHashTreeDatasets').resolves();
|
|
2863
|
+
|
|
2864
|
+
meeting.handleLLMOnline();
|
|
2865
|
+
|
|
2866
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
2867
|
+
});
|
|
2019
2868
|
});
|
|
2020
2869
|
|
|
2021
2870
|
describe('#join', () => {
|
|
@@ -2096,6 +2945,8 @@ describe('plugin-meetings', () => {
|
|
|
2096
2945
|
regionCode: 'EU',
|
|
2097
2946
|
},
|
|
2098
2947
|
preferTranscoding: !enableMultistream,
|
|
2948
|
+
getCurrentSelfUrl: sinon.match.func,
|
|
2949
|
+
waitForSelfUrlChange: sinon.match.func,
|
|
2099
2950
|
},
|
|
2100
2951
|
{
|
|
2101
2952
|
parent: meeting.webex,
|
|
@@ -2614,9 +3465,11 @@ describe('plugin-meetings', () => {
|
|
|
2614
3465
|
retriedWithTurnServer: false,
|
|
2615
3466
|
isMultistream: false,
|
|
2616
3467
|
isJoinWithMediaRetry: false,
|
|
3468
|
+
iceTransportPolicy: 'all',
|
|
2617
3469
|
signalingState: 'unknown',
|
|
2618
3470
|
connectionState: 'unknown',
|
|
2619
3471
|
iceConnectionState: 'unknown',
|
|
3472
|
+
connectionType: 'udp',
|
|
2620
3473
|
someReachabilityMetric1: 'some value1',
|
|
2621
3474
|
someReachabilityMetric2: 'some value2',
|
|
2622
3475
|
selectedCandidatePairChanges: 2,
|
|
@@ -2742,9 +3595,11 @@ describe('plugin-meetings', () => {
|
|
|
2742
3595
|
retriedWithTurnServer: false,
|
|
2743
3596
|
isMultistream: false,
|
|
2744
3597
|
isJoinWithMediaRetry: false,
|
|
3598
|
+
iceTransportPolicy: 'all',
|
|
2745
3599
|
signalingState: 'unknown',
|
|
2746
3600
|
connectionState: 'unknown',
|
|
2747
3601
|
iceConnectionState: 'unknown',
|
|
3602
|
+
connectionType: 'udp',
|
|
2748
3603
|
someReachabilityMetric1: 'some value1',
|
|
2749
3604
|
someReachabilityMetric2: 'some value2',
|
|
2750
3605
|
selectedCandidatePairChanges: 2,
|
|
@@ -3493,50 +4348,215 @@ describe('plugin-meetings', () => {
|
|
|
3493
4348
|
assert.deepEqual(sendBehavioralMetricCalls[1].args, [
|
|
3494
4349
|
BEHAVIORAL_METRICS.TURN_DISCOVERY_LATENCY,
|
|
3495
4350
|
{
|
|
3496
|
-
correlation_id: meeting.correlationId,
|
|
3497
|
-
turnServerUsed: true,
|
|
3498
|
-
retriedWithTurnServer: true,
|
|
3499
|
-
latency: undefined,
|
|
4351
|
+
correlation_id: meeting.correlationId,
|
|
4352
|
+
turnServerUsed: true,
|
|
4353
|
+
retriedWithTurnServer: true,
|
|
4354
|
+
latency: undefined,
|
|
4355
|
+
},
|
|
4356
|
+
]);
|
|
4357
|
+
assert.deepEqual(sendBehavioralMetricCalls[2].args, [
|
|
4358
|
+
BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE,
|
|
4359
|
+
{
|
|
4360
|
+
correlation_id: meeting.correlationId,
|
|
4361
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
4362
|
+
reason: errorThrown.message,
|
|
4363
|
+
stack: errorThrown.stack,
|
|
4364
|
+
code: errorThrown.code,
|
|
4365
|
+
turnDiscoverySkippedReason: undefined,
|
|
4366
|
+
turnServerUsed: true,
|
|
4367
|
+
retriedWithTurnServer: true,
|
|
4368
|
+
isMultistream: false,
|
|
4369
|
+
isJoinWithMediaRetry: false,
|
|
4370
|
+
iceTransportPolicy: 'all',
|
|
4371
|
+
signalingState: 'unknown',
|
|
4372
|
+
connectionState: 'unknown',
|
|
4373
|
+
iceConnectionState: 'unknown',
|
|
4374
|
+
connectionType: 'udp',
|
|
4375
|
+
selectedCandidatePairChanges: 2,
|
|
4376
|
+
numTransports: 1,
|
|
4377
|
+
iceCandidatesCount: 0,
|
|
4378
|
+
subnet_reachable: null,
|
|
4379
|
+
selected_cluster: null,
|
|
4380
|
+
selected_subnet: null,
|
|
4381
|
+
ipver: 1,
|
|
4382
|
+
},
|
|
4383
|
+
]);
|
|
4384
|
+
|
|
4385
|
+
// Check that doTurnDiscovery is called with th4 correct value of isForced
|
|
4386
|
+
const doTurnDiscoveryCalls = meeting.roap.doTurnDiscovery.getCalls();
|
|
4387
|
+
assert.equal(doTurnDiscoveryCalls.length, 2);
|
|
4388
|
+
assert.deepEqual(doTurnDiscoveryCalls[0].args, [meeting, false, false]);
|
|
4389
|
+
assert.deepEqual(doTurnDiscoveryCalls[1].args.slice(1), [true, true]);
|
|
4390
|
+
|
|
4391
|
+
// Some clean up steps happens twice
|
|
4392
|
+
assert.calledTwice(forceRtcMetricsSend);
|
|
4393
|
+
assert.calledTwice(closeMediaConnectionStub);
|
|
4394
|
+
assert.isNull(meeting.mediaProperties.webrtcMediaConnection);
|
|
4395
|
+
|
|
4396
|
+
assert.isOk(errorThrown);
|
|
4397
|
+
});
|
|
4398
|
+
|
|
4399
|
+
[
|
|
4400
|
+
{iceConnected: true, title: 'iceConnected=true'},
|
|
4401
|
+
{iceConnected: false, title: 'iceConnected=false'},
|
|
4402
|
+
].forEach(({iceConnected, title}) => {
|
|
4403
|
+
it(`should propagate ${title} from waitForMediaConnectionConnected rejection to AddMediaFailed`, async () => {
|
|
4404
|
+
webex.meetings.reachability = {
|
|
4405
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4406
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4407
|
+
stopReachability: sinon.stub(),
|
|
4408
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4409
|
+
};
|
|
4410
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4411
|
+
sinon.stub().returns({fatal: true});
|
|
4412
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4413
|
+
|
|
4414
|
+
meeting.meetingState = 'ACTIVE';
|
|
4415
|
+
const rejectedResult = {iceConnected};
|
|
4416
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
4417
|
+
.stub()
|
|
4418
|
+
.rejects(rejectedResult);
|
|
4419
|
+
|
|
4420
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4421
|
+
turnServerInfo: {urls: ['turns:fake:443'], username: 'u', password: 'p'},
|
|
4422
|
+
turnDiscoverySkippedReason: undefined,
|
|
4423
|
+
});
|
|
4424
|
+
|
|
4425
|
+
const forceRtcMetricsSend = sinon.stub().resolves();
|
|
4426
|
+
Media.createMediaConnection = sinon.stub().returns({
|
|
4427
|
+
close: sinon.stub(),
|
|
4428
|
+
forceRtcMetricsSend,
|
|
4429
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4430
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4431
|
+
on: sinon.stub(),
|
|
4432
|
+
});
|
|
4433
|
+
|
|
4434
|
+
let thrownError;
|
|
4435
|
+
await meeting.addMedia({mediaSettings: {}}).catch((err) => {
|
|
4436
|
+
thrownError = err;
|
|
4437
|
+
});
|
|
4438
|
+
|
|
4439
|
+
assert.instanceOf(thrownError, AddMediaFailed);
|
|
4440
|
+
assert.equal(thrownError.iceConnected, iceConnected);
|
|
4441
|
+
// the AddMediaFailed cause should be the MediaConnectionTimedOutError, which in turn should
|
|
4442
|
+
// preserve the original rejected result as its cause, so that the web client
|
|
4443
|
+
// can find the CA-reported error in the eventErrorCache via the cause chain
|
|
4444
|
+
assert.instanceOf(thrownError.cause, MediaConnectionTimedOutError);
|
|
4445
|
+
assert.equal(thrownError.cause.cause, rejectedResult);
|
|
4446
|
+
});
|
|
4447
|
+
});
|
|
4448
|
+
|
|
4449
|
+
describe('iceTransportPolicy=relay handling', () => {
|
|
4450
|
+
let createMediaConnectionStub;
|
|
4451
|
+
|
|
4452
|
+
beforeEach(() => {
|
|
4453
|
+
webex.meetings.reachability = {
|
|
4454
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4455
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(true),
|
|
4456
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4457
|
+
stopReachability: sinon.stub(),
|
|
4458
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4459
|
+
};
|
|
4460
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4461
|
+
sinon.stub().returns({fatal: true});
|
|
4462
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4463
|
+
|
|
4464
|
+
meeting.meetingState = 'ACTIVE';
|
|
4465
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().resolves();
|
|
4466
|
+
|
|
4467
|
+
createMediaConnectionStub = sinon.stub().returns({
|
|
4468
|
+
close: sinon.stub(),
|
|
4469
|
+
forceRtcMetricsSend: sinon.stub().resolves(),
|
|
4470
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4471
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4472
|
+
on: sinon.stub(),
|
|
4473
|
+
});
|
|
4474
|
+
Media.createMediaConnection = createMediaConnectionStub;
|
|
4475
|
+
});
|
|
4476
|
+
|
|
4477
|
+
[
|
|
4478
|
+
{
|
|
4479
|
+
title: 'should drop iceTransportPolicy=relay when TURN discovery returns no turn server info',
|
|
4480
|
+
turnServerInfo: undefined,
|
|
4481
|
+
turnDiscoverySkippedReason: 'reachability',
|
|
3500
4482
|
},
|
|
3501
|
-
]);
|
|
3502
|
-
assert.deepEqual(sendBehavioralMetricCalls[2].args, [
|
|
3503
|
-
BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE,
|
|
3504
4483
|
{
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
reason: errorThrown.message,
|
|
3508
|
-
stack: errorThrown.stack,
|
|
3509
|
-
code: errorThrown.code,
|
|
4484
|
+
title: 'should drop iceTransportPolicy=relay when TURN discovery returns turnServerInfo with empty urls',
|
|
4485
|
+
turnServerInfo: {urls: [], username: 'u', password: 'p'},
|
|
3510
4486
|
turnDiscoverySkippedReason: undefined,
|
|
3511
|
-
turnServerUsed: true,
|
|
3512
|
-
retriedWithTurnServer: true,
|
|
3513
|
-
isMultistream: false,
|
|
3514
|
-
isJoinWithMediaRetry: false,
|
|
3515
|
-
signalingState: 'unknown',
|
|
3516
|
-
connectionState: 'unknown',
|
|
3517
|
-
iceConnectionState: 'unknown',
|
|
3518
|
-
selectedCandidatePairChanges: 2,
|
|
3519
|
-
numTransports: 1,
|
|
3520
|
-
iceCandidatesCount: 0,
|
|
3521
|
-
subnet_reachable: null,
|
|
3522
|
-
selected_cluster: null,
|
|
3523
|
-
selected_subnet: null,
|
|
3524
|
-
ipver: 1,
|
|
3525
4487
|
},
|
|
3526
|
-
])
|
|
4488
|
+
].forEach(({title, turnServerInfo, turnDiscoverySkippedReason}) => {
|
|
4489
|
+
it(title, async () => {
|
|
4490
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4491
|
+
turnServerInfo,
|
|
4492
|
+
turnDiscoverySkippedReason,
|
|
4493
|
+
});
|
|
3527
4494
|
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
4495
|
+
await meeting.addMediaInternal(
|
|
4496
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4497
|
+
false,
|
|
4498
|
+
undefined,
|
|
4499
|
+
'relay',
|
|
4500
|
+
{mediaSettings: {}}
|
|
4501
|
+
);
|
|
3533
4502
|
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
assert.isNull(meeting.mediaProperties.webrtcMediaConnection);
|
|
4503
|
+
assert.calledOnce(createMediaConnectionStub);
|
|
4504
|
+
const config = createMediaConnectionStub.firstCall.args[3];
|
|
4505
|
+
assert.isUndefined(config.iceTransportPolicy);
|
|
3538
4506
|
|
|
3539
|
-
|
|
4507
|
+
const successCall = Metrics.sendBehavioralMetric.getCalls().find(
|
|
4508
|
+
(call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS
|
|
4509
|
+
);
|
|
4510
|
+
assert.isDefined(successCall);
|
|
4511
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'all');
|
|
4512
|
+
});
|
|
4513
|
+
});
|
|
4514
|
+
|
|
4515
|
+
it('should send ADD_MEDIA_SUCCESS metric with iceTransportPolicy=relay when relay is used', async () => {
|
|
4516
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4517
|
+
turnServerInfo: {urls: ['turns:turn-server:443?transport=tcp'], username: 'u', password: 'p'},
|
|
4518
|
+
turnDiscoverySkippedReason: undefined,
|
|
4519
|
+
});
|
|
4520
|
+
|
|
4521
|
+
await meeting.addMediaInternal(
|
|
4522
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4523
|
+
false,
|
|
4524
|
+
undefined,
|
|
4525
|
+
'relay',
|
|
4526
|
+
{mediaSettings: {}}
|
|
4527
|
+
);
|
|
4528
|
+
|
|
4529
|
+
const successCall = Metrics.sendBehavioralMetric.getCalls().find(
|
|
4530
|
+
(call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS
|
|
4531
|
+
);
|
|
4532
|
+
assert.isDefined(successCall);
|
|
4533
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'relay');
|
|
4534
|
+
});
|
|
4535
|
+
|
|
4536
|
+
it('should send ADD_MEDIA_FAILURE metric with iceTransportPolicy=relay when relay attempt fails', async () => {
|
|
4537
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4538
|
+
turnServerInfo: {urls: ['turns:turn-server:443?transport=tcp'], username: 'u', password: 'p'},
|
|
4539
|
+
turnDiscoverySkippedReason: undefined,
|
|
4540
|
+
});
|
|
4541
|
+
|
|
4542
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().rejects(
|
|
4543
|
+
new MediaConnectionTimedOutError('timed out', true)
|
|
4544
|
+
);
|
|
4545
|
+
|
|
4546
|
+
await assert.isRejected(meeting.addMediaInternal(
|
|
4547
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4548
|
+
false,
|
|
4549
|
+
undefined,
|
|
4550
|
+
'relay',
|
|
4551
|
+
{mediaSettings: {}}
|
|
4552
|
+
));
|
|
4553
|
+
|
|
4554
|
+
const failureCall = Metrics.sendBehavioralMetric.getCalls().find(
|
|
4555
|
+
(call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE
|
|
4556
|
+
);
|
|
4557
|
+
assert.isDefined(failureCall);
|
|
4558
|
+
assert.equal(failureCall.args[1].iceTransportPolicy, 'relay');
|
|
4559
|
+
});
|
|
3540
4560
|
});
|
|
3541
4561
|
|
|
3542
4562
|
it('should resolve if waitForMediaConnectionConnected() rejects the first time but resolves the second time', async () => {
|
|
@@ -3728,6 +4748,7 @@ describe('plugin-meetings', () => {
|
|
|
3728
4748
|
isMultistream: false,
|
|
3729
4749
|
retriedWithTurnServer: true,
|
|
3730
4750
|
isJoinWithMediaRetry: false,
|
|
4751
|
+
iceTransportPolicy: 'all',
|
|
3731
4752
|
iceCandidatesCount: 0,
|
|
3732
4753
|
subnet_reachable: null,
|
|
3733
4754
|
selected_cluster: null,
|
|
@@ -3891,6 +4912,7 @@ describe('plugin-meetings', () => {
|
|
|
3891
4912
|
isMultistream: false,
|
|
3892
4913
|
retriedWithTurnServer: false,
|
|
3893
4914
|
isJoinWithMediaRetry: false,
|
|
4915
|
+
iceTransportPolicy: 'all',
|
|
3894
4916
|
someReachabilityMetric1: 'some value1',
|
|
3895
4917
|
someReachabilityMetric2: 'some value2',
|
|
3896
4918
|
iceCandidatesCount: 3,
|
|
@@ -3956,9 +4978,11 @@ describe('plugin-meetings', () => {
|
|
|
3956
4978
|
retriedWithTurnServer: false,
|
|
3957
4979
|
isMultistream: false,
|
|
3958
4980
|
isJoinWithMediaRetry: false,
|
|
4981
|
+
iceTransportPolicy: 'all',
|
|
3959
4982
|
signalingState: 'unknown',
|
|
3960
4983
|
connectionState: 'unknown',
|
|
3961
4984
|
iceConnectionState: 'unknown',
|
|
4985
|
+
connectionType: 'udp',
|
|
3962
4986
|
selectedCandidatePairChanges: 2,
|
|
3963
4987
|
numTransports: 1,
|
|
3964
4988
|
subnet_reachable: null,
|
|
@@ -4019,9 +5043,11 @@ describe('plugin-meetings', () => {
|
|
|
4019
5043
|
retriedWithTurnServer: false,
|
|
4020
5044
|
isMultistream: false,
|
|
4021
5045
|
isJoinWithMediaRetry: false,
|
|
5046
|
+
iceTransportPolicy: 'all',
|
|
4022
5047
|
signalingState: 'unknown',
|
|
4023
5048
|
connectionState: 'unknown',
|
|
4024
5049
|
iceConnectionState: 'unknown',
|
|
5050
|
+
connectionType: 'udp',
|
|
4025
5051
|
selectedCandidatePairChanges: 2,
|
|
4026
5052
|
numTransports: 1,
|
|
4027
5053
|
'701_error': 2,
|
|
@@ -4083,6 +5109,7 @@ describe('plugin-meetings', () => {
|
|
|
4083
5109
|
isMultistream: false,
|
|
4084
5110
|
retriedWithTurnServer: false,
|
|
4085
5111
|
isJoinWithMediaRetry: false,
|
|
5112
|
+
iceTransportPolicy: 'all',
|
|
4086
5113
|
iceCandidatesCount: 0,
|
|
4087
5114
|
reachability_public_udp_success: 5,
|
|
4088
5115
|
subnet_reachable: false,
|
|
@@ -4148,9 +5175,11 @@ describe('plugin-meetings', () => {
|
|
|
4148
5175
|
retriedWithTurnServer: false,
|
|
4149
5176
|
isMultistream: false,
|
|
4150
5177
|
isJoinWithMediaRetry: false,
|
|
5178
|
+
iceTransportPolicy: 'all',
|
|
4151
5179
|
signalingState: 'unknown',
|
|
4152
5180
|
connectionState: 'unknown',
|
|
4153
5181
|
iceConnectionState: 'unknown',
|
|
5182
|
+
connectionType: 'udp',
|
|
4154
5183
|
selectedCandidatePairChanges: 2,
|
|
4155
5184
|
numTransports: 1,
|
|
4156
5185
|
reachability_public_udp_success: 5,
|
|
@@ -4534,6 +5563,297 @@ describe('plugin-meetings', () => {
|
|
|
4534
5563
|
},
|
|
4535
5564
|
});
|
|
4536
5565
|
});
|
|
5566
|
+
|
|
5567
|
+
describe('handles STATS_UPDATE event for SRTP cipher detection', () => {
|
|
5568
|
+
it('emits MEETING_SRTP_CIPHER_UPDATED event when srtpCipher is found in transport stats', async () => {
|
|
5569
|
+
const fakeStats = new Map([
|
|
5570
|
+
[
|
|
5571
|
+
'transport-1',
|
|
5572
|
+
{
|
|
5573
|
+
type: 'transport',
|
|
5574
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5575
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5576
|
+
},
|
|
5577
|
+
],
|
|
5578
|
+
[
|
|
5579
|
+
'outbound-rtp-1',
|
|
5580
|
+
{
|
|
5581
|
+
type: 'outbound-rtp',
|
|
5582
|
+
ssrc: 12345,
|
|
5583
|
+
},
|
|
5584
|
+
],
|
|
5585
|
+
]);
|
|
5586
|
+
|
|
5587
|
+
statsAnalyzerStub.emit(
|
|
5588
|
+
{file: 'test', function: 'test'},
|
|
5589
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5590
|
+
{stats: fakeStats}
|
|
5591
|
+
);
|
|
5592
|
+
|
|
5593
|
+
assert.calledWith(
|
|
5594
|
+
TriggerProxy.trigger,
|
|
5595
|
+
sinon.match.instanceOf(Meeting),
|
|
5596
|
+
{
|
|
5597
|
+
file: 'meeting/index',
|
|
5598
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5599
|
+
},
|
|
5600
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5601
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
5602
|
+
);
|
|
5603
|
+
|
|
5604
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5605
|
+
});
|
|
5606
|
+
|
|
5607
|
+
it('updates meeting.mediaProperties.srtpCipher when cipher changes', async () => {
|
|
5608
|
+
const firstStats = new Map([
|
|
5609
|
+
[
|
|
5610
|
+
'transport-1',
|
|
5611
|
+
{
|
|
5612
|
+
type: 'transport',
|
|
5613
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5614
|
+
},
|
|
5615
|
+
],
|
|
5616
|
+
]);
|
|
5617
|
+
|
|
5618
|
+
statsAnalyzerStub.emit(
|
|
5619
|
+
{file: 'test', function: 'test'},
|
|
5620
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5621
|
+
{stats: firstStats}
|
|
5622
|
+
);
|
|
5623
|
+
|
|
5624
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5625
|
+
|
|
5626
|
+
const secondStats = new Map([
|
|
5627
|
+
[
|
|
5628
|
+
'transport-1',
|
|
5629
|
+
{
|
|
5630
|
+
type: 'transport',
|
|
5631
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5632
|
+
},
|
|
5633
|
+
],
|
|
5634
|
+
]);
|
|
5635
|
+
|
|
5636
|
+
TriggerProxy.trigger.resetHistory();
|
|
5637
|
+
|
|
5638
|
+
statsAnalyzerStub.emit(
|
|
5639
|
+
{file: 'test', function: 'test'},
|
|
5640
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5641
|
+
{stats: secondStats}
|
|
5642
|
+
);
|
|
5643
|
+
|
|
5644
|
+
assert.calledWith(
|
|
5645
|
+
TriggerProxy.trigger,
|
|
5646
|
+
sinon.match.instanceOf(Meeting),
|
|
5647
|
+
{
|
|
5648
|
+
file: 'meeting/index',
|
|
5649
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5650
|
+
},
|
|
5651
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5652
|
+
{srtpCipher: 'AEAD_AES_256_GCM'}
|
|
5653
|
+
);
|
|
5654
|
+
|
|
5655
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AEAD_AES_256_GCM');
|
|
5656
|
+
});
|
|
5657
|
+
|
|
5658
|
+
it('does not emit event when srtpCipher has not changed', async () => {
|
|
5659
|
+
const firstStats = new Map([
|
|
5660
|
+
[
|
|
5661
|
+
'transport-1',
|
|
5662
|
+
{
|
|
5663
|
+
type: 'transport',
|
|
5664
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5665
|
+
},
|
|
5666
|
+
],
|
|
5667
|
+
]);
|
|
5668
|
+
|
|
5669
|
+
statsAnalyzerStub.emit(
|
|
5670
|
+
{file: 'test', function: 'test'},
|
|
5671
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5672
|
+
{stats: firstStats}
|
|
5673
|
+
);
|
|
5674
|
+
|
|
5675
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5676
|
+
|
|
5677
|
+
TriggerProxy.trigger.resetHistory();
|
|
5678
|
+
|
|
5679
|
+
// Emit same cipher again
|
|
5680
|
+
statsAnalyzerStub.emit(
|
|
5681
|
+
{file: 'test', function: 'test'},
|
|
5682
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5683
|
+
{stats: firstStats}
|
|
5684
|
+
);
|
|
5685
|
+
|
|
5686
|
+
// Should not trigger event again
|
|
5687
|
+
assert.neverCalledWith(
|
|
5688
|
+
TriggerProxy.trigger,
|
|
5689
|
+
sinon.match.instanceOf(Meeting),
|
|
5690
|
+
sinon.match.any,
|
|
5691
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5692
|
+
sinon.match.any
|
|
5693
|
+
);
|
|
5694
|
+
|
|
5695
|
+
// Cipher should remain the same
|
|
5696
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5697
|
+
});
|
|
5698
|
+
|
|
5699
|
+
it('does not emit event when stats contain no transport with srtpCipher', async () => {
|
|
5700
|
+
const fakeStats = new Map([
|
|
5701
|
+
[
|
|
5702
|
+
'outbound-rtp-1',
|
|
5703
|
+
{
|
|
5704
|
+
type: 'outbound-rtp',
|
|
5705
|
+
ssrc: 12345,
|
|
5706
|
+
},
|
|
5707
|
+
],
|
|
5708
|
+
[
|
|
5709
|
+
'inbound-rtp-1',
|
|
5710
|
+
{
|
|
5711
|
+
type: 'inbound-rtp',
|
|
5712
|
+
ssrc: 67890,
|
|
5713
|
+
},
|
|
5714
|
+
],
|
|
5715
|
+
]);
|
|
5716
|
+
|
|
5717
|
+
statsAnalyzerStub.emit(
|
|
5718
|
+
{file: 'test', function: 'test'},
|
|
5719
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5720
|
+
{stats: fakeStats}
|
|
5721
|
+
);
|
|
5722
|
+
|
|
5723
|
+
assert.neverCalledWith(
|
|
5724
|
+
TriggerProxy.trigger,
|
|
5725
|
+
sinon.match.instanceOf(Meeting),
|
|
5726
|
+
sinon.match.any,
|
|
5727
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5728
|
+
sinon.match.any
|
|
5729
|
+
);
|
|
5730
|
+
|
|
5731
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5732
|
+
});
|
|
5733
|
+
|
|
5734
|
+
it('does not emit event when transport stat has no srtpCipher property', async () => {
|
|
5735
|
+
const fakeStats = new Map([
|
|
5736
|
+
[
|
|
5737
|
+
'transport-1',
|
|
5738
|
+
{
|
|
5739
|
+
type: 'transport',
|
|
5740
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5741
|
+
// no srtpCipher property
|
|
5742
|
+
},
|
|
5743
|
+
],
|
|
5744
|
+
]);
|
|
5745
|
+
|
|
5746
|
+
statsAnalyzerStub.emit(
|
|
5747
|
+
{file: 'test', function: 'test'},
|
|
5748
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5749
|
+
{stats: fakeStats}
|
|
5750
|
+
);
|
|
5751
|
+
|
|
5752
|
+
assert.neverCalledWith(
|
|
5753
|
+
TriggerProxy.trigger,
|
|
5754
|
+
sinon.match.instanceOf(Meeting),
|
|
5755
|
+
sinon.match.any,
|
|
5756
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5757
|
+
sinon.match.any
|
|
5758
|
+
);
|
|
5759
|
+
|
|
5760
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5761
|
+
});
|
|
5762
|
+
|
|
5763
|
+
it('uses first transport with srtpCipher when multiple transports exist', async () => {
|
|
5764
|
+
const fakeStats = new Map([
|
|
5765
|
+
[
|
|
5766
|
+
'transport-1',
|
|
5767
|
+
{
|
|
5768
|
+
type: 'transport',
|
|
5769
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5770
|
+
},
|
|
5771
|
+
],
|
|
5772
|
+
[
|
|
5773
|
+
'transport-2',
|
|
5774
|
+
{
|
|
5775
|
+
type: 'transport',
|
|
5776
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5777
|
+
},
|
|
5778
|
+
],
|
|
5779
|
+
[
|
|
5780
|
+
'outbound-rtp-1',
|
|
5781
|
+
{
|
|
5782
|
+
type: 'outbound-rtp',
|
|
5783
|
+
ssrc: 12345,
|
|
5784
|
+
},
|
|
5785
|
+
],
|
|
5786
|
+
]);
|
|
5787
|
+
|
|
5788
|
+
statsAnalyzerStub.emit(
|
|
5789
|
+
{file: 'test', function: 'test'},
|
|
5790
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5791
|
+
{stats: fakeStats}
|
|
5792
|
+
);
|
|
5793
|
+
|
|
5794
|
+
assert.calledWith(
|
|
5795
|
+
TriggerProxy.trigger,
|
|
5796
|
+
sinon.match.instanceOf(Meeting),
|
|
5797
|
+
{
|
|
5798
|
+
file: 'meeting/index',
|
|
5799
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5800
|
+
},
|
|
5801
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5802
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
5803
|
+
);
|
|
5804
|
+
|
|
5805
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5806
|
+
});
|
|
5807
|
+
|
|
5808
|
+
it('handles empty stats map without errors', async () => {
|
|
5809
|
+
const emptyStats = new Map();
|
|
5810
|
+
|
|
5811
|
+
statsAnalyzerStub.emit(
|
|
5812
|
+
{file: 'test', function: 'test'},
|
|
5813
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5814
|
+
{stats: emptyStats}
|
|
5815
|
+
);
|
|
5816
|
+
|
|
5817
|
+
assert.neverCalledWith(
|
|
5818
|
+
TriggerProxy.trigger,
|
|
5819
|
+
sinon.match.instanceOf(Meeting),
|
|
5820
|
+
sinon.match.any,
|
|
5821
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5822
|
+
sinon.match.any
|
|
5823
|
+
);
|
|
5824
|
+
|
|
5825
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5826
|
+
});
|
|
5827
|
+
|
|
5828
|
+
it('logs cipher change when cipher is updated', async () => {
|
|
5829
|
+
const loggerSpy = sinon.spy(LoggerProxy.logger, 'info');
|
|
5830
|
+
|
|
5831
|
+
meeting.mediaProperties.srtpCipher = 'AES_CM_128_HMAC_SHA1_80';
|
|
5832
|
+
|
|
5833
|
+
const newStats = new Map([
|
|
5834
|
+
[
|
|
5835
|
+
'transport-1',
|
|
5836
|
+
{
|
|
5837
|
+
type: 'transport',
|
|
5838
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5839
|
+
},
|
|
5840
|
+
],
|
|
5841
|
+
]);
|
|
5842
|
+
|
|
5843
|
+
statsAnalyzerStub.emit(
|
|
5844
|
+
{file: 'test', function: 'test'},
|
|
5845
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5846
|
+
{stats: newStats}
|
|
5847
|
+
);
|
|
5848
|
+
|
|
5849
|
+
assert.calledWithMatch(
|
|
5850
|
+
loggerSpy,
|
|
5851
|
+
sinon.match(/SRTP cipher changed from AES_CM_128_HMAC_SHA1_80 to AEAD_AES_256_GCM/)
|
|
5852
|
+
);
|
|
5853
|
+
|
|
5854
|
+
loggerSpy.restore();
|
|
5855
|
+
});
|
|
5856
|
+
});
|
|
4537
5857
|
});
|
|
4538
5858
|
|
|
4539
5859
|
describe('handles StatsMonitor events', () => {
|
|
@@ -6192,13 +7512,14 @@ describe('plugin-meetings', () => {
|
|
|
6192
7512
|
sinon.stub(meeting.locusMediaRequest, 'downgradeFromMultistreamToTranscoded');
|
|
6193
7513
|
});
|
|
6194
7514
|
|
|
6195
|
-
const runCheck = async (turnServerInfo, forceTurnDiscovery) => {
|
|
7515
|
+
const runCheck = async (turnServerInfo, forceTurnDiscovery, iceTransportPolicy) => {
|
|
6196
7516
|
// we're calling addMediaInternal() with mic stream,
|
|
6197
7517
|
// so that we also verify that audioMute, videoMute info is correctly sent to backend
|
|
6198
7518
|
const addMediaPromise = meeting.addMediaInternal(
|
|
6199
7519
|
() => '',
|
|
6200
|
-
turnServerInfo,
|
|
6201
7520
|
forceTurnDiscovery,
|
|
7521
|
+
turnServerInfo,
|
|
7522
|
+
iceTransportPolicy,
|
|
6202
7523
|
{
|
|
6203
7524
|
localStreams: {microphone: fakeMicrophoneStream},
|
|
6204
7525
|
}
|
|
@@ -6252,6 +7573,10 @@ describe('plugin-meetings', () => {
|
|
|
6252
7573
|
// at this point the meeting should have been downgraded to transcoded
|
|
6253
7574
|
assert.equal(meeting.isMultistream, false);
|
|
6254
7575
|
|
|
7576
|
+
// iceTransportPolicy must be reset to undefined on downgrade to transcoded,
|
|
7577
|
+
// otherwise the transcoded retry could gather direct candidates while metrics report relay
|
|
7578
|
+
assert.isUndefined(meeting.addMediaData.iceTransportPolicy);
|
|
7579
|
+
|
|
6255
7580
|
// old stats analyzer stopped and new one created
|
|
6256
7581
|
assert.calledOnce(initialStatsAnalyzer.stopAnalyzer);
|
|
6257
7582
|
assert.calledOnceWithExactly(
|
|
@@ -6342,6 +7667,11 @@ describe('plugin-meetings', () => {
|
|
|
6342
7667
|
true
|
|
6343
7668
|
);
|
|
6344
7669
|
});
|
|
7670
|
+
|
|
7671
|
+
it('resets iceTransportPolicy to undefined when falling back from multistream (relay) to transcoded', async () => {
|
|
7672
|
+
// simulate a relay-only retry falling back to transcoded and verify iceTransportPolicy is reset
|
|
7673
|
+
await runCheck(undefined, false, 'relay');
|
|
7674
|
+
});
|
|
6345
7675
|
});
|
|
6346
7676
|
}
|
|
6347
7677
|
})
|
|
@@ -6429,6 +7759,9 @@ describe('plugin-meetings', () => {
|
|
|
6429
7759
|
|
|
6430
7760
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
6431
7761
|
webex.internal.llm.off = sinon.stub();
|
|
7762
|
+
webex.internal.mercury.off = sinon.stub();
|
|
7763
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
7764
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
6432
7765
|
|
|
6433
7766
|
// A meeting needs to be joined to leave
|
|
6434
7767
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -6452,6 +7785,67 @@ describe('plugin-meetings', () => {
|
|
|
6452
7785
|
assert.calledOnce(meeting.clearMeetingData);
|
|
6453
7786
|
});
|
|
6454
7787
|
|
|
7788
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
7789
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
7790
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
7791
|
+
|
|
7792
|
+
await meeting.leave();
|
|
7793
|
+
|
|
7794
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
7795
|
+
// annotation) must be detached before the /leave request so that
|
|
7796
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
7797
|
+
// (per Locus team recommendation).
|
|
7798
|
+
assert.callOrder(
|
|
7799
|
+
webex.internal.llm.off,
|
|
7800
|
+
webex.internal.mercury.off,
|
|
7801
|
+
meeting.stopTranscription,
|
|
7802
|
+
meeting.annotation.deregisterEvents,
|
|
7803
|
+
meeting.meetingRequest.leaveMeeting
|
|
7804
|
+
);
|
|
7805
|
+
assert.calledWithExactly(
|
|
7806
|
+
webex.internal.llm.off,
|
|
7807
|
+
'event:relay.event',
|
|
7808
|
+
meeting.processRelayEvent
|
|
7809
|
+
);
|
|
7810
|
+
assert.calledWithExactly(
|
|
7811
|
+
webex.internal.llm.off,
|
|
7812
|
+
LOCUS_LLM_EVENT,
|
|
7813
|
+
meeting.processLocusLLMEvent
|
|
7814
|
+
);
|
|
7815
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
7816
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
7817
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
7818
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
7819
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
7820
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
7821
|
+
assert.isUndefined(meeting.transcription);
|
|
7822
|
+
});
|
|
7823
|
+
|
|
7824
|
+
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
7825
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
7826
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
7827
|
+
meeting.meetingRequest.leaveMeeting = sinon
|
|
7828
|
+
.stub()
|
|
7829
|
+
.returns(Promise.reject(new Error('leave failed')));
|
|
7830
|
+
|
|
7831
|
+
await meeting.leave().catch(() => {});
|
|
7832
|
+
|
|
7833
|
+
assert.calledWithExactly(
|
|
7834
|
+
webex.internal.llm.off,
|
|
7835
|
+
'event:relay.event',
|
|
7836
|
+
meeting.processRelayEvent
|
|
7837
|
+
);
|
|
7838
|
+
assert.calledWithExactly(
|
|
7839
|
+
webex.internal.llm.off,
|
|
7840
|
+
LOCUS_LLM_EVENT,
|
|
7841
|
+
meeting.processLocusLLMEvent
|
|
7842
|
+
);
|
|
7843
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
7844
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
7845
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
7846
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
7847
|
+
});
|
|
7848
|
+
|
|
6455
7849
|
it('should reset call diagnostic latencies correctly', async () => {
|
|
6456
7850
|
const leave = meeting.leave();
|
|
6457
7851
|
|
|
@@ -8459,6 +9853,9 @@ describe('plugin-meetings', () => {
|
|
|
8459
9853
|
|
|
8460
9854
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
8461
9855
|
webex.internal.llm.off = sinon.stub();
|
|
9856
|
+
webex.internal.mercury.off = sinon.stub();
|
|
9857
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
9858
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
8462
9859
|
|
|
8463
9860
|
// A meeting needs to be joined to end
|
|
8464
9861
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -8468,18 +9865,78 @@ describe('plugin-meetings', () => {
|
|
|
8468
9865
|
sandbox.restore();
|
|
8469
9866
|
sandbox = null;
|
|
8470
9867
|
});
|
|
8471
|
-
it('should end the meeting for all and return promise', async () => {
|
|
8472
|
-
const endMeetingForAll = meeting.endMeetingForAll();
|
|
9868
|
+
it('should end the meeting for all and return promise', async () => {
|
|
9869
|
+
const endMeetingForAll = meeting.endMeetingForAll();
|
|
9870
|
+
|
|
9871
|
+
assert.exists(endMeetingForAll.then);
|
|
9872
|
+
await endMeetingForAll;
|
|
9873
|
+
assert.calledOnce(meeting?.meetingRequest?.endMeetingForAll);
|
|
9874
|
+
assert.calledOnce(meeting?.cleanupLocalStreams);
|
|
9875
|
+
assert.calledOnce(meeting?.closeRemoteStreams);
|
|
9876
|
+
assert.calledOnce(meeting?.closePeerConnections);
|
|
9877
|
+
assert.calledOnce(meeting?.unsetRemoteStreams);
|
|
9878
|
+
assert.calledOnce(meeting?.unsetPeerConnections);
|
|
9879
|
+
assert.calledOnce(meeting?.clearMeetingData);
|
|
9880
|
+
});
|
|
9881
|
+
|
|
9882
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
9883
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
9884
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
9885
|
+
|
|
9886
|
+
await meeting.endMeetingForAll();
|
|
9887
|
+
|
|
9888
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
9889
|
+
// annotation) must be detached before the /end request so that
|
|
9890
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
9891
|
+
// (per Locus team recommendation).
|
|
9892
|
+
assert.callOrder(
|
|
9893
|
+
webex.internal.llm.off,
|
|
9894
|
+
webex.internal.mercury.off,
|
|
9895
|
+
meeting.stopTranscription,
|
|
9896
|
+
meeting.annotation.deregisterEvents,
|
|
9897
|
+
meeting.meetingRequest.endMeetingForAll
|
|
9898
|
+
);
|
|
9899
|
+
assert.calledWithExactly(
|
|
9900
|
+
webex.internal.llm.off,
|
|
9901
|
+
'event:relay.event',
|
|
9902
|
+
meeting.processRelayEvent
|
|
9903
|
+
);
|
|
9904
|
+
assert.calledWithExactly(
|
|
9905
|
+
webex.internal.llm.off,
|
|
9906
|
+
LOCUS_LLM_EVENT,
|
|
9907
|
+
meeting.processLocusLLMEvent
|
|
9908
|
+
);
|
|
9909
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
9910
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
9911
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
9912
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
9913
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
9914
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
9915
|
+
});
|
|
8473
9916
|
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
9917
|
+
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
9918
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
9919
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
9920
|
+
meeting.meetingRequest.endMeetingForAll = sinon
|
|
9921
|
+
.stub()
|
|
9922
|
+
.returns(Promise.reject(new Error('end failed')));
|
|
9923
|
+
|
|
9924
|
+
await meeting.endMeetingForAll().catch(() => {});
|
|
9925
|
+
|
|
9926
|
+
assert.calledWithExactly(
|
|
9927
|
+
webex.internal.llm.off,
|
|
9928
|
+
'event:relay.event',
|
|
9929
|
+
meeting.processRelayEvent
|
|
9930
|
+
);
|
|
9931
|
+
assert.calledWithExactly(
|
|
9932
|
+
webex.internal.llm.off,
|
|
9933
|
+
LOCUS_LLM_EVENT,
|
|
9934
|
+
meeting.processLocusLLMEvent
|
|
9935
|
+
);
|
|
9936
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
9937
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
9938
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
9939
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8483
9940
|
});
|
|
8484
9941
|
});
|
|
8485
9942
|
|
|
@@ -10417,7 +11874,7 @@ describe('plugin-meetings', () => {
|
|
|
10417
11874
|
);
|
|
10418
11875
|
done();
|
|
10419
11876
|
});
|
|
10420
|
-
it('listens to the self admitted guest event
|
|
11877
|
+
it('listens to the self admitted guest event and waits for token prefetch before reconnecting LLM', async () => {
|
|
10421
11878
|
meeting.stopKeepAlive = sinon.stub();
|
|
10422
11879
|
meeting.updateLLMConnection = sinon.stub();
|
|
10423
11880
|
let resolvePrefetch;
|
|
@@ -10443,7 +11900,7 @@ describe('plugin-meetings', () => {
|
|
|
10443
11900
|
'meeting:self:guestAdmitted',
|
|
10444
11901
|
{payload: test1}
|
|
10445
11902
|
);
|
|
10446
|
-
assert.
|
|
11903
|
+
assert.notCalled(meeting.updateLLMConnection);
|
|
10447
11904
|
assert.calledOnceWithExactly(meeting.rtcMetrics.sendNextMetrics);
|
|
10448
11905
|
|
|
10449
11906
|
assert.calledOnceWithExactly(
|
|
@@ -10456,6 +11913,7 @@ describe('plugin-meetings', () => {
|
|
|
10456
11913
|
|
|
10457
11914
|
resolvePrefetch(false);
|
|
10458
11915
|
await Promise.resolve();
|
|
11916
|
+
await Promise.resolve();
|
|
10459
11917
|
|
|
10460
11918
|
assert.calledOnce(meeting.updateLLMConnection);
|
|
10461
11919
|
});
|
|
@@ -10971,6 +12429,92 @@ describe('plugin-meetings', () => {
|
|
|
10971
12429
|
);
|
|
10972
12430
|
});
|
|
10973
12431
|
|
|
12432
|
+
const recordingTestCases = [
|
|
12433
|
+
{
|
|
12434
|
+
description: 'triggers MEETING_STARTED_RECORDING when state is RECORDING',
|
|
12435
|
+
state: RECORDING_STATE.RECORDING,
|
|
12436
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12437
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12438
|
+
},
|
|
12439
|
+
{
|
|
12440
|
+
description: 'triggers MEETING_STOPPED_RECORDING when state is IDLE',
|
|
12441
|
+
state: RECORDING_STATE.IDLE,
|
|
12442
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STOPPED_RECORDING,
|
|
12443
|
+
expectedRecordingState: RECORDING_STATE.IDLE,
|
|
12444
|
+
},
|
|
12445
|
+
{
|
|
12446
|
+
description: 'triggers MEETING_PAUSED_RECORDING when state is PAUSED',
|
|
12447
|
+
state: RECORDING_STATE.PAUSED,
|
|
12448
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_PAUSED_RECORDING,
|
|
12449
|
+
expectedRecordingState: RECORDING_STATE.PAUSED,
|
|
12450
|
+
},
|
|
12451
|
+
{
|
|
12452
|
+
description:
|
|
12453
|
+
'triggers MEETING_RESUMED_RECORDING and sets state to RECORDING when state is RESUMED',
|
|
12454
|
+
state: RECORDING_STATE.RESUMED,
|
|
12455
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_RESUMED_RECORDING,
|
|
12456
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12457
|
+
},
|
|
12458
|
+
];
|
|
12459
|
+
|
|
12460
|
+
recordingTestCases.forEach(({description, state, expectedEvent, expectedRecordingState}) => {
|
|
12461
|
+
it(`listens to CONTROLS_RECORDING_UPDATED - ${description}`, async () => {
|
|
12462
|
+
const modifiedBy = 'user-id-123';
|
|
12463
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12464
|
+
|
|
12465
|
+
await meeting.locusInfo.emitScoped(
|
|
12466
|
+
{function: 'test', file: 'test'},
|
|
12467
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12468
|
+
{state, modifiedBy, lastModified, modifiedByServiceAppName: undefined, modifiedByServiceAppId: undefined}
|
|
12469
|
+
);
|
|
12470
|
+
|
|
12471
|
+
assert.deepEqual(meeting.recording, {
|
|
12472
|
+
state: expectedRecordingState,
|
|
12473
|
+
modifiedBy,
|
|
12474
|
+
lastModified,
|
|
12475
|
+
modifiedByServiceAppName: undefined,
|
|
12476
|
+
modifiedByServiceAppId: undefined,
|
|
12477
|
+
});
|
|
12478
|
+
|
|
12479
|
+
assert.calledWith(
|
|
12480
|
+
TriggerProxy.trigger,
|
|
12481
|
+
meeting,
|
|
12482
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12483
|
+
expectedEvent,
|
|
12484
|
+
meeting.recording
|
|
12485
|
+
);
|
|
12486
|
+
});
|
|
12487
|
+
});
|
|
12488
|
+
|
|
12489
|
+
it('listens to CONTROLS_RECORDING_UPDATED and includes modifiedByServiceAppName and modifiedByServiceAppId when present', async () => {
|
|
12490
|
+
const modifiedBy = 'user-id-123';
|
|
12491
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12492
|
+
const modifiedByServiceAppName = 'My Bot';
|
|
12493
|
+
const modifiedByServiceAppId = 'app-id-123';
|
|
12494
|
+
|
|
12495
|
+
await meeting.locusInfo.emitScoped(
|
|
12496
|
+
{function: 'test', file: 'test'},
|
|
12497
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12498
|
+
{state: RECORDING_STATE.RECORDING, modifiedBy, lastModified, modifiedByServiceAppName, modifiedByServiceAppId}
|
|
12499
|
+
);
|
|
12500
|
+
|
|
12501
|
+
assert.deepEqual(meeting.recording, {
|
|
12502
|
+
state: RECORDING_STATE.RECORDING,
|
|
12503
|
+
modifiedBy,
|
|
12504
|
+
lastModified,
|
|
12505
|
+
modifiedByServiceAppName,
|
|
12506
|
+
modifiedByServiceAppId,
|
|
12507
|
+
});
|
|
12508
|
+
|
|
12509
|
+
assert.calledWith(
|
|
12510
|
+
TriggerProxy.trigger,
|
|
12511
|
+
meeting,
|
|
12512
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12513
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12514
|
+
meeting.recording
|
|
12515
|
+
);
|
|
12516
|
+
});
|
|
12517
|
+
|
|
10974
12518
|
it('listens to the locus interpretation update event', () => {
|
|
10975
12519
|
const interpretation = {
|
|
10976
12520
|
siLanguages: [{languageCode: 20, languageName: 'en'}],
|
|
@@ -11024,6 +12568,7 @@ describe('plugin-meetings', () => {
|
|
|
11024
12568
|
meeting.annotation.locusUrlUpdate = sinon.stub();
|
|
11025
12569
|
meeting.simultaneousInterpretation.locusUrlUpdate = sinon.stub();
|
|
11026
12570
|
meeting.webinar.locusUrlUpdate = sinon.stub();
|
|
12571
|
+
meeting.aiEnableRequest.locusUrlUpdate = sinon.stub();
|
|
11027
12572
|
|
|
11028
12573
|
meeting.locusInfo.emit(
|
|
11029
12574
|
{function: 'test', file: 'test'},
|
|
@@ -11038,6 +12583,7 @@ describe('plugin-meetings', () => {
|
|
|
11038
12583
|
assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
|
|
11039
12584
|
assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
|
|
11040
12585
|
assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
|
|
12586
|
+
assert.calledWith(meeting.aiEnableRequest.locusUrlUpdate, newLocusUrl);
|
|
11041
12587
|
assert.equal(meeting.locusUrl, newLocusUrl);
|
|
11042
12588
|
assert(meeting.locusId, '12345');
|
|
11043
12589
|
|
|
@@ -11353,6 +12899,109 @@ describe('plugin-meetings', () => {
|
|
|
11353
12899
|
});
|
|
11354
12900
|
});
|
|
11355
12901
|
|
|
12902
|
+
describe('#finalizeMeetingAfterInitialLocusSetup', () => {
|
|
12903
|
+
it('refreshes destination from synced locus when destination type is LOCUS_ID', () => {
|
|
12904
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12905
|
+
|
|
12906
|
+
meeting.destinationType = DESTINATION_TYPE.LOCUS_ID;
|
|
12907
|
+
meeting.destination = {info: {topic: 'old'}};
|
|
12908
|
+
|
|
12909
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
12910
|
+
|
|
12911
|
+
assert.equal(meeting.destination, syncedLocus);
|
|
12912
|
+
});
|
|
12913
|
+
|
|
12914
|
+
it('does not refresh destination when destination type is not LOCUS_ID', () => {
|
|
12915
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12916
|
+
const originalDestination = {destination: 'original-destination'};
|
|
12917
|
+
|
|
12918
|
+
meeting.destinationType = DESTINATION_TYPE.CONVERSATION_URL;
|
|
12919
|
+
meeting.destination = originalDestination;
|
|
12920
|
+
|
|
12921
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
12922
|
+
|
|
12923
|
+
assert.equal(meeting.destination, originalDestination);
|
|
12924
|
+
});
|
|
12925
|
+
|
|
12926
|
+
it('fetches meeting info when meetingInfo is empty and destination has info', () => {
|
|
12927
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12928
|
+
|
|
12929
|
+
meeting.meetingInfo = {};
|
|
12930
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12931
|
+
|
|
12932
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12933
|
+
|
|
12934
|
+
assert.calledOnceWithExactly(fetchMeetingInfoStub, {});
|
|
12935
|
+
});
|
|
12936
|
+
|
|
12937
|
+
it('does not fetch meeting info when destination has no info', () => {
|
|
12938
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12939
|
+
|
|
12940
|
+
meeting.meetingInfo = {};
|
|
12941
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123'};
|
|
12942
|
+
|
|
12943
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12944
|
+
|
|
12945
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12946
|
+
});
|
|
12947
|
+
|
|
12948
|
+
it('does not fetch meeting info when meetingInfo is already populated', () => {
|
|
12949
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12950
|
+
|
|
12951
|
+
meeting.meetingInfo = {meetingJoinUrl: 'https://example.com/join/abc'};
|
|
12952
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12953
|
+
|
|
12954
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12955
|
+
|
|
12956
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12957
|
+
});
|
|
12958
|
+
|
|
12959
|
+
it('does not fetch meeting info when delayed fetch timer is already scheduled', () => {
|
|
12960
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12961
|
+
|
|
12962
|
+
meeting.meetingInfo = {};
|
|
12963
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12964
|
+
meeting.fetchMeetingInfoTimeoutId = 42;
|
|
12965
|
+
|
|
12966
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12967
|
+
|
|
12968
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12969
|
+
});
|
|
12970
|
+
|
|
12971
|
+
['CALL', 'SIP_BRIDGE', 'SPACE_SHARE'].forEach((fullStateType) => {
|
|
12972
|
+
it(`does not fetch meeting info when destination is a 1:1 call (fullState.type ${fullStateType})`, () => {
|
|
12973
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12974
|
+
|
|
12975
|
+
meeting.meetingInfo = {};
|
|
12976
|
+
meeting.destination = {
|
|
12977
|
+
url: 'https://locus.example.com/locus/123',
|
|
12978
|
+
info: {topic: 'x'},
|
|
12979
|
+
};
|
|
12980
|
+
|
|
12981
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({fullState: {type: fullStateType}});
|
|
12982
|
+
|
|
12983
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12984
|
+
});
|
|
12985
|
+
});
|
|
12986
|
+
|
|
12987
|
+
it('swallows async fetchMeetingInfo errors and logs info', async () => {
|
|
12988
|
+
const error = new Error('fetch failed');
|
|
12989
|
+
|
|
12990
|
+
meeting.meetingInfo = {};
|
|
12991
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12992
|
+
sinon.stub(meeting, 'fetchMeetingInfo').returns(Promise.reject(error));
|
|
12993
|
+
const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
|
|
12994
|
+
|
|
12995
|
+
await meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12996
|
+
|
|
12997
|
+
assert.calledOnce(loggerInfoStub);
|
|
12998
|
+
assert.match(
|
|
12999
|
+
loggerInfoStub.firstCall.args[0],
|
|
13000
|
+
/Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: fetch failed/
|
|
13001
|
+
);
|
|
13002
|
+
});
|
|
13003
|
+
});
|
|
13004
|
+
|
|
11356
13005
|
describe('#emailInput', () => {
|
|
11357
13006
|
it('should set the email input', () => {
|
|
11358
13007
|
assert.notOk(meeting.emailInput);
|
|
@@ -11955,6 +13604,7 @@ describe('plugin-meetings', () => {
|
|
|
11955
13604
|
let showAutoEndMeetingWarningSpy;
|
|
11956
13605
|
let canAttendeeRequestAiAssistantEnabledSpy;
|
|
11957
13606
|
let attendeeRequestAiAssistantDeclinedAllSpy;
|
|
13607
|
+
let isAnonymizeDisplayNamesEnabledSpy;
|
|
11958
13608
|
// Due to import tree issues, hasHints must be stubed within the scope of the `it`.
|
|
11959
13609
|
|
|
11960
13610
|
beforeEach(() => {
|
|
@@ -12003,6 +13653,10 @@ describe('plugin-meetings', () => {
|
|
|
12003
13653
|
MeetingUtil,
|
|
12004
13654
|
'attendeeRequestAiAssistantDeclinedAll'
|
|
12005
13655
|
);
|
|
13656
|
+
isAnonymizeDisplayNamesEnabledSpy = sinon.spy(
|
|
13657
|
+
MeetingUtil,
|
|
13658
|
+
'isAnonymizeDisplayNamesEnabled'
|
|
13659
|
+
);
|
|
12006
13660
|
});
|
|
12007
13661
|
|
|
12008
13662
|
afterEach(() => {
|
|
@@ -12011,6 +13665,7 @@ describe('plugin-meetings', () => {
|
|
|
12011
13665
|
showAutoEndMeetingWarningSpy.restore();
|
|
12012
13666
|
canAttendeeRequestAiAssistantEnabledSpy.restore();
|
|
12013
13667
|
attendeeRequestAiAssistantDeclinedAllSpy.restore();
|
|
13668
|
+
isAnonymizeDisplayNamesEnabledSpy.restore();
|
|
12014
13669
|
});
|
|
12015
13670
|
|
|
12016
13671
|
forEach(
|
|
@@ -12568,6 +14223,7 @@ describe('plugin-meetings', () => {
|
|
|
12568
14223
|
meeting.roles
|
|
12569
14224
|
);
|
|
12570
14225
|
assert.calledWith(attendeeRequestAiAssistantDeclinedAllSpy, userDisplayHints);
|
|
14226
|
+
assert.calledWith(isAnonymizeDisplayNamesEnabledSpy, userDisplayHints);
|
|
12571
14227
|
|
|
12572
14228
|
assert.calledWith(ControlsOptionsUtil.hasHints, {
|
|
12573
14229
|
requiredHints: [DISPLAY_HINTS.MUTE_ALL],
|
|
@@ -12782,6 +14438,10 @@ describe('plugin-meetings', () => {
|
|
|
12782
14438
|
describe('#saveDataChannelToken', () => {
|
|
12783
14439
|
beforeEach(() => {
|
|
12784
14440
|
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
14441
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
14442
|
+
.stub()
|
|
14443
|
+
.returns({currentOwner: undefined, isOwner: true});
|
|
14444
|
+
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
12785
14445
|
});
|
|
12786
14446
|
|
|
12787
14447
|
it('saves datachannelToken into LLM as Default', () => {
|
|
@@ -12794,7 +14454,8 @@ describe('plugin-meetings', () => {
|
|
|
12794
14454
|
assert.calledWithExactly(
|
|
12795
14455
|
webex.internal.llm.setDatachannelToken,
|
|
12796
14456
|
'default-token',
|
|
12797
|
-
'llm-default-session'
|
|
14457
|
+
'llm-default-session',
|
|
14458
|
+
meeting.id
|
|
12798
14459
|
);
|
|
12799
14460
|
});
|
|
12800
14461
|
|
|
@@ -12808,7 +14469,8 @@ describe('plugin-meetings', () => {
|
|
|
12808
14469
|
assert.calledWithExactly(
|
|
12809
14470
|
webex.internal.llm.setDatachannelToken,
|
|
12810
14471
|
'ps-token',
|
|
12811
|
-
'llm-practice-session'
|
|
14472
|
+
'llm-practice-session',
|
|
14473
|
+
meeting.id
|
|
12812
14474
|
);
|
|
12813
14475
|
});
|
|
12814
14476
|
|
|
@@ -12826,12 +14488,14 @@ describe('plugin-meetings', () => {
|
|
|
12826
14488
|
assert.calledWithExactly(
|
|
12827
14489
|
webex.internal.llm.setDatachannelToken,
|
|
12828
14490
|
'default-token',
|
|
12829
|
-
'llm-default-session'
|
|
14491
|
+
'llm-default-session',
|
|
14492
|
+
meeting.id
|
|
12830
14493
|
);
|
|
12831
14494
|
assert.calledWithExactly(
|
|
12832
14495
|
webex.internal.llm.setDatachannelToken,
|
|
12833
14496
|
'ps-token',
|
|
12834
|
-
'llm-practice-session'
|
|
14497
|
+
'llm-practice-session',
|
|
14498
|
+
meeting.id
|
|
12835
14499
|
);
|
|
12836
14500
|
});
|
|
12837
14501
|
|
|
@@ -12852,17 +14516,42 @@ describe('plugin-meetings', () => {
|
|
|
12852
14516
|
|
|
12853
14517
|
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
12854
14518
|
});
|
|
14519
|
+
|
|
14520
|
+
it('writes token with meeting id as owner', () => {
|
|
14521
|
+
meeting.saveDataChannelToken({
|
|
14522
|
+
locus: {
|
|
14523
|
+
self: {datachannelToken: 'default-token'},
|
|
14524
|
+
},
|
|
14525
|
+
});
|
|
14526
|
+
|
|
14527
|
+
assert.calledOnceWithExactly(
|
|
14528
|
+
webex.internal.llm.setDatachannelToken,
|
|
14529
|
+
'default-token',
|
|
14530
|
+
'llm-default-session',
|
|
14531
|
+
meeting.id
|
|
14532
|
+
);
|
|
14533
|
+
});
|
|
12855
14534
|
});
|
|
12856
14535
|
|
|
12857
14536
|
describe('#clearDataChannelToken', () => {
|
|
12858
14537
|
beforeEach(() => {
|
|
12859
|
-
webex.internal.llm.
|
|
14538
|
+
webex.internal.llm.clearDatachannelToken = sinon.stub();
|
|
12860
14539
|
});
|
|
12861
14540
|
|
|
12862
|
-
it('
|
|
14541
|
+
it('delegates default and practice token clears to llm with meeting ownership id', () => {
|
|
12863
14542
|
meeting.clearDataChannelToken();
|
|
12864
14543
|
|
|
12865
|
-
assert.
|
|
14544
|
+
assert.calledWithExactly(
|
|
14545
|
+
webex.internal.llm.clearDatachannelToken,
|
|
14546
|
+
'llm-default-session',
|
|
14547
|
+
meeting.id
|
|
14548
|
+
);
|
|
14549
|
+
assert.calledWithExactly(
|
|
14550
|
+
webex.internal.llm.clearDatachannelToken,
|
|
14551
|
+
'llm-practice-session',
|
|
14552
|
+
meeting.id
|
|
14553
|
+
);
|
|
14554
|
+
assert.callCount(webex.internal.llm.clearDatachannelToken, 2);
|
|
12866
14555
|
});
|
|
12867
14556
|
});
|
|
12868
14557
|
|
|
@@ -12872,6 +14561,7 @@ describe('plugin-meetings', () => {
|
|
|
12872
14561
|
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
12873
14562
|
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
12874
14563
|
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
14564
|
+
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
12875
14565
|
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
12876
14566
|
webex.internal.llm.on = sinon.stub();
|
|
12877
14567
|
webex.internal.llm.off = sinon.stub();
|
|
@@ -12889,7 +14579,7 @@ describe('plugin-meetings', () => {
|
|
|
12889
14579
|
meeting.joinedWith = {state: 'any other state'};
|
|
12890
14580
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12891
14581
|
|
|
12892
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14582
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
12893
14583
|
|
|
12894
14584
|
const result = await meeting.updateLLMConnection();
|
|
12895
14585
|
|
|
@@ -12901,6 +14591,7 @@ describe('plugin-meetings', () => {
|
|
|
12901
14591
|
it('returns undefined if llm is already connected and the locus url is unchanged', async () => {
|
|
12902
14592
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12903
14593
|
meeting.locusInfo = {
|
|
14594
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12904
14595
|
url: 'a url',
|
|
12905
14596
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12906
14597
|
};
|
|
@@ -12937,7 +14628,7 @@ describe('plugin-meetings', () => {
|
|
|
12937
14628
|
});
|
|
12938
14629
|
it('connects if not already connected', async () => {
|
|
12939
14630
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12940
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14631
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
12941
14632
|
|
|
12942
14633
|
const result = await meeting.updateLLMConnection();
|
|
12943
14634
|
|
|
@@ -12948,7 +14639,14 @@ describe('plugin-meetings', () => {
|
|
|
12948
14639
|
'a datachannel url',
|
|
12949
14640
|
undefined
|
|
12950
14641
|
);
|
|
14642
|
+
assert.calledOnceWithExactly(
|
|
14643
|
+
webex.internal.llm.setRefreshHandler,
|
|
14644
|
+
sinon.match.func,
|
|
14645
|
+
'llm-default-session',
|
|
14646
|
+
meeting.id
|
|
14647
|
+
);
|
|
12951
14648
|
assert.equal(result, 'something');
|
|
14649
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
12952
14650
|
});
|
|
12953
14651
|
it('disconnects if the locus url has changed', async () => {
|
|
12954
14652
|
meeting.joinedWith = {state: 'JOINED'};
|
|
@@ -12957,6 +14655,7 @@ describe('plugin-meetings', () => {
|
|
|
12957
14655
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12958
14656
|
|
|
12959
14657
|
meeting.locusInfo = {
|
|
14658
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12960
14659
|
url: 'a different url',
|
|
12961
14660
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12962
14661
|
self: {},
|
|
@@ -12967,7 +14666,7 @@ describe('plugin-meetings', () => {
|
|
|
12967
14666
|
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
|
|
12968
14667
|
code: 3050,
|
|
12969
14668
|
reason: 'done (permanent)',
|
|
12970
|
-
});
|
|
14669
|
+
}, 'llm-default-session', meeting.id);
|
|
12971
14670
|
|
|
12972
14671
|
assert.calledWithExactly(
|
|
12973
14672
|
webex.internal.llm.registerAndConnect,
|
|
@@ -13010,6 +14709,7 @@ describe('plugin-meetings', () => {
|
|
|
13010
14709
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
13011
14710
|
|
|
13012
14711
|
meeting.locusInfo = {
|
|
14712
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13013
14713
|
url: 'a url',
|
|
13014
14714
|
info: {datachannelUrl: 'a different datachannel url'},
|
|
13015
14715
|
self: {},
|
|
@@ -13020,7 +14720,7 @@ describe('plugin-meetings', () => {
|
|
|
13020
14720
|
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
|
|
13021
14721
|
code: 3050,
|
|
13022
14722
|
reason: 'done (permanent)',
|
|
13023
|
-
});
|
|
14723
|
+
}, 'llm-default-session', meeting.id);
|
|
13024
14724
|
|
|
13025
14725
|
assert.calledWithExactly(
|
|
13026
14726
|
webex.internal.llm.registerAndConnect,
|
|
@@ -13061,14 +14761,14 @@ describe('plugin-meetings', () => {
|
|
|
13061
14761
|
webex.internal.llm.isConnected.returns(true);
|
|
13062
14762
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
13063
14763
|
|
|
13064
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14764
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
13065
14765
|
|
|
13066
14766
|
const result = await meeting.updateLLMConnection();
|
|
13067
14767
|
|
|
13068
14768
|
assert.calledWith(webex.internal.llm.disconnectLLM, {
|
|
13069
14769
|
code: 3050,
|
|
13070
14770
|
reason: 'done (permanent)',
|
|
13071
|
-
});
|
|
14771
|
+
}, 'llm-default-session', meeting.id);
|
|
13072
14772
|
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
13073
14773
|
assert.equal(result, undefined);
|
|
13074
14774
|
assert.isFalse(
|
|
@@ -13084,6 +14784,7 @@ describe('plugin-meetings', () => {
|
|
|
13084
14784
|
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
13085
14785
|
|
|
13086
14786
|
meeting.locusInfo = {
|
|
14787
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13087
14788
|
url: 'a different url',
|
|
13088
14789
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13089
14790
|
self: {},
|
|
@@ -13115,6 +14816,7 @@ describe('plugin-meetings', () => {
|
|
|
13115
14816
|
it('still need connect main session data channel when PS started', async () => {
|
|
13116
14817
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13117
14818
|
meeting.locusInfo = {
|
|
14819
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13118
14820
|
url: 'a url',
|
|
13119
14821
|
info: {
|
|
13120
14822
|
datachannelUrl: 'a datachannel url',
|
|
@@ -13135,11 +14837,14 @@ describe('plugin-meetings', () => {
|
|
|
13135
14837
|
it('passes dataChannelToken from LLM to registerAndConnect', async () => {
|
|
13136
14838
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13137
14839
|
meeting.locusInfo = {
|
|
14840
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13138
14841
|
url: 'a url',
|
|
13139
14842
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13140
14843
|
};
|
|
13141
14844
|
|
|
13142
|
-
webex.internal.llm.getDatachannelToken
|
|
14845
|
+
webex.internal.llm.getDatachannelToken
|
|
14846
|
+
.withArgs('llm-default-session', meeting.id)
|
|
14847
|
+
.returns('token-123');
|
|
13143
14848
|
|
|
13144
14849
|
await meeting.updateLLMConnection();
|
|
13145
14850
|
|
|
@@ -13154,6 +14859,7 @@ describe('plugin-meetings', () => {
|
|
|
13154
14859
|
it('passes undefined token when LLM has no token stored', async () => {
|
|
13155
14860
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13156
14861
|
meeting.locusInfo = {
|
|
14862
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13157
14863
|
url: 'a url',
|
|
13158
14864
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13159
14865
|
};
|
|
@@ -13175,6 +14881,7 @@ describe('plugin-meetings', () => {
|
|
|
13175
14881
|
it('does not pass token when data channel with jwt token is disabled', async () => {
|
|
13176
14882
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13177
14883
|
meeting.locusInfo = {
|
|
14884
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13178
14885
|
url: 'a url',
|
|
13179
14886
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13180
14887
|
};
|
|
@@ -13193,6 +14900,197 @@ describe('plugin-meetings', () => {
|
|
|
13193
14900
|
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
13194
14901
|
});
|
|
13195
14902
|
|
|
14903
|
+
describe('ownership tag', () => {
|
|
14904
|
+
beforeEach(() => {
|
|
14905
|
+
// Make the owner stub dynamic so setOwnerMeetingId() writes
|
|
14906
|
+
// propagate back to getOwnerMeetingId() reads. This mirrors the
|
|
14907
|
+
// real LLM singleton behavior so the finally-block release in
|
|
14908
|
+
// cleanupLLMConneciton is reflected in subsequent reads.
|
|
14909
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub().returns(undefined);
|
|
14910
|
+
webex.internal.llm.setOwnerMeetingId = sinon.stub().callsFake((id) => {
|
|
14911
|
+
webex.internal.llm.getOwnerMeetingId.returns(id);
|
|
14912
|
+
});
|
|
14913
|
+
});
|
|
14914
|
+
|
|
14915
|
+
it('skips disconnect and reconnect when LLM is connected and owned by another meeting (regardless of URL)', async () => {
|
|
14916
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14917
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14918
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
14919
|
+
// Locus/datachannel URL mismatch is the *normal* case when
|
|
14920
|
+
// another meeting owns the live socket -- each meeting has its
|
|
14921
|
+
// own locus URL. URL mismatch must NOT trigger a reclaim,
|
|
14922
|
+
// because doing so would tear down the owning meeting's healthy
|
|
14923
|
+
// LLM socket and break its data channel.
|
|
14924
|
+
webex.internal.llm.getLocusUrl.returns('owner-locus-url');
|
|
14925
|
+
webex.internal.llm.getDatachannelUrl.returns('owner-dc-url');
|
|
14926
|
+
meeting.locusInfo = {
|
|
14927
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14928
|
+
url: 'a different url',
|
|
14929
|
+
info: {datachannelUrl: 'a different datachannel url'},
|
|
14930
|
+
self: {},
|
|
14931
|
+
};
|
|
14932
|
+
|
|
14933
|
+
const result = await meeting.updateLLMConnection();
|
|
14934
|
+
|
|
14935
|
+
assert.equal(result, undefined);
|
|
14936
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
14937
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
14938
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
14939
|
+
assert.notCalled(meeting.startLLMHealthCheckTimer);
|
|
14940
|
+
});
|
|
14941
|
+
|
|
14942
|
+
|
|
14943
|
+
it('clears stale owner tag in cleanup finally block even when disconnectLLM rejects', async () => {
|
|
14944
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14945
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14946
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
14947
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14948
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
14949
|
+
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
14950
|
+
meeting.locusInfo = {
|
|
14951
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14952
|
+
url: 'a different url',
|
|
14953
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14954
|
+
self: {},
|
|
14955
|
+
};
|
|
14956
|
+
|
|
14957
|
+
try {
|
|
14958
|
+
await meeting.updateLLMConnection();
|
|
14959
|
+
} catch (e) {
|
|
14960
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
14961
|
+
}
|
|
14962
|
+
|
|
14963
|
+
// The owner-eligible finally branch must release the tag so a
|
|
14964
|
+
// subsequent reconnect attempt from any meeting is not blocked.
|
|
14965
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId, undefined);
|
|
14966
|
+
});
|
|
14967
|
+
|
|
14968
|
+
it('does not clear owner tag when ownership changes during cleanup disconnect await', async () => {
|
|
14969
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14970
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14971
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
14972
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14973
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
14974
|
+
webex.internal.llm.disconnectLLM.callsFake(async () => {
|
|
14975
|
+
webex.internal.llm.getOwnerMeetingId.returns('new-owner-id');
|
|
14976
|
+
throw new Error('disconnect failed');
|
|
14977
|
+
});
|
|
14978
|
+
meeting.locusInfo = {
|
|
14979
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14980
|
+
url: 'a different url',
|
|
14981
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14982
|
+
self: {},
|
|
14983
|
+
};
|
|
14984
|
+
|
|
14985
|
+
try {
|
|
14986
|
+
await meeting.updateLLMConnection();
|
|
14987
|
+
} catch (e) {
|
|
14988
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
14989
|
+
}
|
|
14990
|
+
|
|
14991
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
14992
|
+
assert.equal(webex.internal.llm.getOwnerMeetingId(), 'new-owner-id');
|
|
14993
|
+
});
|
|
14994
|
+
|
|
14995
|
+
it('proceeds normally when LLM is connected and owned by this meeting with URL change', async () => {
|
|
14996
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14997
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14998
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
14999
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15000
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15001
|
+
meeting.locusInfo = {
|
|
15002
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15003
|
+
url: 'a different url',
|
|
15004
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15005
|
+
self: {},
|
|
15006
|
+
};
|
|
15007
|
+
|
|
15008
|
+
await meeting.updateLLMConnection();
|
|
15009
|
+
|
|
15010
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
15011
|
+
code: 3050,
|
|
15012
|
+
reason: 'done (permanent)',
|
|
15013
|
+
}, 'llm-default-session', meeting.id);
|
|
15014
|
+
assert.calledWithExactly(
|
|
15015
|
+
webex.internal.llm.registerAndConnect,
|
|
15016
|
+
'a different url',
|
|
15017
|
+
'a datachannel url',
|
|
15018
|
+
undefined
|
|
15019
|
+
);
|
|
15020
|
+
// setOwnerMeetingId is called twice: first with undefined in
|
|
15021
|
+
// cleanupLLMConneciton's finally block (so a failed disconnect
|
|
15022
|
+
// cannot leave a stale owner), then with this meeting's id
|
|
15023
|
+
// after registerAndConnect resolves.
|
|
15024
|
+
assert.calledTwice(webex.internal.llm.setOwnerMeetingId);
|
|
15025
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.firstCall, undefined);
|
|
15026
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.lastCall, meeting.id);
|
|
15027
|
+
});
|
|
15028
|
+
|
|
15029
|
+
it('claims ownership after successful registerAndConnect on initial connect', async () => {
|
|
15030
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15031
|
+
webex.internal.llm.isConnected.returns(false);
|
|
15032
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15033
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
15034
|
+
|
|
15035
|
+
await meeting.updateLLMConnection();
|
|
15036
|
+
|
|
15037
|
+
assert.calledOnce(webex.internal.llm.registerAndConnect);
|
|
15038
|
+
assert.calledOnceWithExactly(
|
|
15039
|
+
webex.internal.llm.setRefreshHandler,
|
|
15040
|
+
sinon.match.func,
|
|
15041
|
+
'llm-default-session',
|
|
15042
|
+
meeting.id
|
|
15043
|
+
);
|
|
15044
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15045
|
+
});
|
|
15046
|
+
|
|
15047
|
+
it('proceeds to connect when LLM is not connected even if another ownerId lingers', async () => {
|
|
15048
|
+
// Defensive path: if the LLM reports not-connected but an old
|
|
15049
|
+
// ownerId is still present (e.g. race before a successful
|
|
15050
|
+
// connections.delete), this meeting can still claim a fresh
|
|
15051
|
+
// connection.
|
|
15052
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15053
|
+
webex.internal.llm.isConnected.returns(false);
|
|
15054
|
+
webex.internal.llm.getOwnerMeetingId.returns('stale-owner-id');
|
|
15055
|
+
webex.internal.llm.getDatachannelToken.onFirstCall().returns(undefined);
|
|
15056
|
+
webex.internal.llm.getDatachannelToken.onSecondCall().returns('recovered-token');
|
|
15057
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
15058
|
+
|
|
15059
|
+
await meeting.updateLLMConnection();
|
|
15060
|
+
|
|
15061
|
+
assert.calledTwice(webex.internal.llm.getDatachannelToken);
|
|
15062
|
+
assert.calledWithExactly(
|
|
15063
|
+
webex.internal.llm.getDatachannelToken.firstCall,
|
|
15064
|
+
'llm-default-session',
|
|
15065
|
+
meeting.id
|
|
15066
|
+
);
|
|
15067
|
+
assert.calledWithExactly(
|
|
15068
|
+
webex.internal.llm.getDatachannelToken.secondCall,
|
|
15069
|
+
'llm-default-session'
|
|
15070
|
+
);
|
|
15071
|
+
assert.calledOnceWithExactly(
|
|
15072
|
+
webex.internal.llm.registerAndConnect,
|
|
15073
|
+
'a url',
|
|
15074
|
+
'a datachannel url',
|
|
15075
|
+
'recovered-token'
|
|
15076
|
+
);
|
|
15077
|
+
assert.calledWithExactly(
|
|
15078
|
+
webex.internal.llm.setRefreshHandler.firstCall,
|
|
15079
|
+
sinon.match.func,
|
|
15080
|
+
'llm-default-session',
|
|
15081
|
+
undefined
|
|
15082
|
+
);
|
|
15083
|
+
assert.calledTwice(webex.internal.llm.setRefreshHandler);
|
|
15084
|
+
assert.calledWithExactly(
|
|
15085
|
+
webex.internal.llm.setRefreshHandler.secondCall,
|
|
15086
|
+
sinon.match.func,
|
|
15087
|
+
'llm-default-session',
|
|
15088
|
+
meeting.id
|
|
15089
|
+
);
|
|
15090
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15091
|
+
});
|
|
15092
|
+
});
|
|
15093
|
+
|
|
13196
15094
|
describe('#clearMeetingData', () => {
|
|
13197
15095
|
beforeEach(() => {
|
|
13198
15096
|
webex.internal.llm.isConnected = sinon.stub().returns(true);
|
|
@@ -13211,7 +15109,7 @@ describe('plugin-meetings', () => {
|
|
|
13211
15109
|
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
13212
15110
|
code: 3050,
|
|
13213
15111
|
reason: 'done (permanent)',
|
|
13214
|
-
});
|
|
15112
|
+
}, 'llm-default-session', meeting.id);
|
|
13215
15113
|
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
13216
15114
|
assert.calledWithExactly(
|
|
13217
15115
|
webex.internal.llm.off,
|
|
@@ -13224,10 +15122,13 @@ describe('plugin-meetings', () => {
|
|
|
13224
15122
|
meeting.processLocusLLMEvent
|
|
13225
15123
|
);
|
|
13226
15124
|
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
13227
|
-
assert.calledOnce(meeting.stopTranscription);
|
|
13228
|
-
assert.isUndefined(meeting.transcription);
|
|
13229
15125
|
assert.calledOnce(meeting.clearDataChannelToken);
|
|
13230
|
-
|
|
15126
|
+
// stopTranscription and annotation.deregisterEvents are not
|
|
15127
|
+
// called here: they run in stopListeningForMeetingEvents()
|
|
15128
|
+
// before /leave to avoid double-emitting
|
|
15129
|
+
// MEETING_STOPPED_RECEIVING_TRANSCRIPTION.
|
|
15130
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15131
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
13231
15132
|
});
|
|
13232
15133
|
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
13233
15134
|
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
@@ -13246,19 +15147,65 @@ describe('plugin-meetings', () => {
|
|
|
13246
15147
|
meeting.processLocusLLMEvent
|
|
13247
15148
|
);
|
|
13248
15149
|
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
13249
|
-
assert.calledOnce(meeting.stopTranscription);
|
|
13250
|
-
assert.isUndefined(meeting.transcription);
|
|
13251
15150
|
assert.calledOnce(meeting.clearDataChannelToken);
|
|
13252
|
-
assert.
|
|
15151
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15152
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
13253
15153
|
});
|
|
13254
|
-
it('always calls stopTranscription even when transcription is undefined', async () => {
|
|
13255
|
-
meeting.transcription = undefined;
|
|
13256
15154
|
|
|
13257
|
-
|
|
15155
|
+
describe('ownership tag', () => {
|
|
15156
|
+
beforeEach(() => {
|
|
15157
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15158
|
+
});
|
|
13258
15159
|
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
15160
|
+
it('skips disconnectLLM but still removes this meeting listeners when another meeting owns the LLM', async () => {
|
|
15161
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15162
|
+
|
|
15163
|
+
await meeting.clearMeetingData();
|
|
15164
|
+
|
|
15165
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15166
|
+
// clearDataChannelToken is always delegated; llm enforces
|
|
15167
|
+
// ownership and no-ops for non-owners internally.
|
|
15168
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15169
|
+
// Listeners owned by *this* Meeting instance must still be
|
|
15170
|
+
// removed so a leaving subordinate meeting stops receiving
|
|
15171
|
+
// relay/locus events from the shared singleton.
|
|
15172
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15173
|
+
assert.calledWithExactly(
|
|
15174
|
+
webex.internal.llm.off,
|
|
15175
|
+
'event:relay.event',
|
|
15176
|
+
meeting.processRelayEvent
|
|
15177
|
+
);
|
|
15178
|
+
assert.calledWithExactly(
|
|
15179
|
+
webex.internal.llm.off,
|
|
15180
|
+
'event:locus.state_message',
|
|
15181
|
+
meeting.processLocusLLMEvent
|
|
15182
|
+
);
|
|
15183
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15184
|
+
});
|
|
15185
|
+
|
|
15186
|
+
it('calls disconnectLLM and clears data channel token when this meeting is the owner', async () => {
|
|
15187
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15188
|
+
|
|
15189
|
+
await meeting.clearMeetingData();
|
|
15190
|
+
|
|
15191
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
15192
|
+
code: 3050,
|
|
15193
|
+
reason: 'done (permanent)',
|
|
15194
|
+
}, 'llm-default-session', meeting.id);
|
|
15195
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15196
|
+
});
|
|
15197
|
+
|
|
15198
|
+
it('calls disconnectLLM and clears data channel token when no owner is recorded (first-claim / legacy)', async () => {
|
|
15199
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15200
|
+
|
|
15201
|
+
await meeting.clearMeetingData();
|
|
15202
|
+
|
|
15203
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
15204
|
+
code: 3050,
|
|
15205
|
+
reason: 'done (permanent)',
|
|
15206
|
+
}, 'llm-default-session', meeting.id);
|
|
15207
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15208
|
+
});
|
|
13262
15209
|
});
|
|
13263
15210
|
});
|
|
13264
15211
|
});
|
|
@@ -13298,6 +15245,71 @@ describe('plugin-meetings', () => {
|
|
|
13298
15245
|
});
|
|
13299
15246
|
});
|
|
13300
15247
|
|
|
15248
|
+
describe('#waitForSelfUrlChange', () => {
|
|
15249
|
+
let waitForSelfUrlChange;
|
|
15250
|
+
let locusMediaRequestStub;
|
|
15251
|
+
|
|
15252
|
+
beforeEach(async () => {
|
|
15253
|
+
locusMediaRequestStub = sinon
|
|
15254
|
+
.stub(LocusMediaRequestModule, 'LocusMediaRequest')
|
|
15255
|
+
.returns({id: 'fake LocusMediaRequest instance'});
|
|
15256
|
+
|
|
15257
|
+
meeting.setLocus = sinon.stub().returns(true);
|
|
15258
|
+
webex.meetings.registered = true;
|
|
15259
|
+
sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve('JOIN_RESULT'));
|
|
15260
|
+
sinon.stub(meeting, 'updateLLMConnection').returns(Promise.resolve());
|
|
15261
|
+
|
|
15262
|
+
await meeting.join();
|
|
15263
|
+
|
|
15264
|
+
waitForSelfUrlChange = locusMediaRequestStub.firstCall.args[0].waitForSelfUrlChange;
|
|
15265
|
+
});
|
|
15266
|
+
|
|
15267
|
+
it('should resolve immediately when joinWithMediaRetryInfo.retryCount > 0', async () => {
|
|
15268
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 1, prevJoinResponse: undefined};
|
|
15269
|
+
|
|
15270
|
+
const result = waitForSelfUrlChange();
|
|
15271
|
+
|
|
15272
|
+
assert.instanceOf(result, Promise);
|
|
15273
|
+
await result;
|
|
15274
|
+
});
|
|
15275
|
+
|
|
15276
|
+
it('should not resolve before the timeout when retryCount is 0', async () => {
|
|
15277
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15278
|
+
|
|
15279
|
+
let resolved = false;
|
|
15280
|
+
waitForSelfUrlChange().then(() => {
|
|
15281
|
+
resolved = true;
|
|
15282
|
+
});
|
|
15283
|
+
|
|
15284
|
+
await testUtils.flushPromises();
|
|
15285
|
+
assert.isFalse(resolved);
|
|
15286
|
+
});
|
|
15287
|
+
|
|
15288
|
+
it('should resolve after the 5s timeout when retryCount is 0', async () => {
|
|
15289
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15290
|
+
|
|
15291
|
+
let resolved = false;
|
|
15292
|
+
const promise = waitForSelfUrlChange();
|
|
15293
|
+
promise.then(() => {
|
|
15294
|
+
resolved = true;
|
|
15295
|
+
});
|
|
15296
|
+
|
|
15297
|
+
fakeClock.tick(5000);
|
|
15298
|
+
await promise;
|
|
15299
|
+
|
|
15300
|
+
assert.isTrue(resolved);
|
|
15301
|
+
});
|
|
15302
|
+
|
|
15303
|
+
it('should return the same promise when called multiple times', () => {
|
|
15304
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15305
|
+
|
|
15306
|
+
const firstPromise = waitForSelfUrlChange();
|
|
15307
|
+
const secondPromise = waitForSelfUrlChange();
|
|
15308
|
+
|
|
15309
|
+
assert.equal(firstPromise, secondPromise);
|
|
15310
|
+
});
|
|
15311
|
+
});
|
|
15312
|
+
|
|
13301
15313
|
describe('preferred video device', () => {
|
|
13302
15314
|
describe('#getVideoDeviceId', () => {
|
|
13303
15315
|
it('returns the preferred video device', () => {
|
|
@@ -15012,16 +17024,25 @@ describe('plugin-meetings', () => {
|
|
|
15012
17024
|
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
15013
17025
|
});
|
|
15014
17026
|
|
|
15015
|
-
it('should
|
|
17027
|
+
it('should send a custom reaction type not in the known list', async () => {
|
|
15016
17028
|
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
15017
17029
|
|
|
15018
|
-
|
|
15019
|
-
meeting.sendReaction('invalid_reaction', 'light'),
|
|
15020
|
-
Error,
|
|
15021
|
-
'invalid_reaction is not a valid reaction.'
|
|
15022
|
-
);
|
|
17030
|
+
const reactionPromise = meeting.sendReaction('custom_reaction', 'light');
|
|
15023
17031
|
|
|
15024
|
-
assert.
|
|
17032
|
+
assert.exists(reactionPromise.then);
|
|
17033
|
+
await reactionPromise;
|
|
17034
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
17035
|
+
reactionChannelUrl: 'Fake URL',
|
|
17036
|
+
reaction: {
|
|
17037
|
+
type: 'custom_reaction',
|
|
17038
|
+
tone: {
|
|
17039
|
+
type: 'light_skin_tone',
|
|
17040
|
+
codepoints: '1F3FB',
|
|
17041
|
+
shortcodes: ':skin-tone-2:',
|
|
17042
|
+
},
|
|
17043
|
+
},
|
|
17044
|
+
participantId: meeting.members.selfId,
|
|
17045
|
+
});
|
|
15025
17046
|
});
|
|
15026
17047
|
|
|
15027
17048
|
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|
|
@@ -16045,4 +18066,4 @@ describe('plugin-meetings', () => {
|
|
|
16045
18066
|
assert.calledOnceWithExactly(meeting.meetingRequest.cancelSipCallOut, participantId);
|
|
16046
18067
|
});
|
|
16047
18068
|
});
|
|
16048
|
-
});
|
|
18069
|
+
});
|