@webex/plugin-meetings 3.12.0-next.1 → 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 +13 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +898 -391
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +42 -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 +1444 -772
- 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 +10 -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/multistream/sendSlotManager.js +116 -2
- package/dist/multistream/sendSlotManager.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 +2 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +146 -17
- package/dist/types/hashTree/utils.d.ts +18 -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 +143 -9
- 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 +9 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/multistream/sendSlotManager.d.ts +23 -1
- 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 +485 -234
- 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 +16 -0
- package/src/hashTree/hashTreeParser.ts +596 -204
- package/src/hashTree/utils.ts +36 -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 +790 -136
- 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 +10 -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/multistream/sendSlotManager.ts +97 -3
- 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 +330 -50
- 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 +1911 -143
- package/test/unit/spec/hashTree/utils.ts +125 -1
- 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 +2261 -109
- 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 +366 -39
- 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/multistream/sendSlotManager.ts +135 -36
- 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 +516 -30
|
@@ -34,10 +34,14 @@ 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,
|
|
40
43
|
MediaConnectionEventNames,
|
|
44
|
+
MediaCodecMimeType,
|
|
41
45
|
StatsAnalyzerEventNames,
|
|
42
46
|
StatsMonitorEventNames,
|
|
43
47
|
Errors,
|
|
@@ -90,6 +94,7 @@ import {
|
|
|
90
94
|
MeetingNotActiveError,
|
|
91
95
|
UserInLobbyError,
|
|
92
96
|
AddMediaFailed,
|
|
97
|
+
MediaConnectionTimedOutError,
|
|
93
98
|
} from '../../../../src/common/errors/webex-errors';
|
|
94
99
|
import WebExMeetingsErrors from '../../../../src/common/errors/webex-meetings-error';
|
|
95
100
|
import ParameterError from '../../../../src/common/errors/parameter';
|
|
@@ -260,11 +265,26 @@ describe('plugin-meetings', () => {
|
|
|
260
265
|
webex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
261
266
|
webex.meetings.reachability = {
|
|
262
267
|
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
268
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
263
269
|
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
264
270
|
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
265
271
|
stopReachability: sinon.stub(),
|
|
266
272
|
isSubnetReachable: sinon.stub().returns(true),
|
|
267
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
|
+
});
|
|
268
288
|
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
269
289
|
webex.internal.llm.on = sinon.stub();
|
|
270
290
|
webex.internal.voicea.announce = sinon.stub();
|
|
@@ -416,6 +436,161 @@ describe('plugin-meetings', () => {
|
|
|
416
436
|
assert.instanceOf(meeting.mediaRequestManagers.screenShareVideo, MediaRequestManager);
|
|
417
437
|
});
|
|
418
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
|
+
|
|
419
594
|
it('uses meeting id as correlation id if not provided in constructor', () => {
|
|
420
595
|
const newMeeting = new Meeting(
|
|
421
596
|
{
|
|
@@ -711,6 +886,67 @@ describe('plugin-meetings', () => {
|
|
|
711
886
|
assert.deepEqual(args, [[uuid1], locusUrls]);
|
|
712
887
|
});
|
|
713
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
|
+
});
|
|
714
950
|
describe('#getMembers', () => {
|
|
715
951
|
it('should have #getMembers', () => {
|
|
716
952
|
assert.exists(meeting.getMembers);
|
|
@@ -740,6 +976,8 @@ describe('plugin-meetings', () => {
|
|
|
740
976
|
let addMediaInternalStub;
|
|
741
977
|
let supportsRTCPeerConnectionStub;
|
|
742
978
|
|
|
979
|
+
let suspendDestroyMeetingStub;
|
|
980
|
+
|
|
743
981
|
beforeEach(() => {
|
|
744
982
|
supportsRTCPeerConnectionStub = sinon
|
|
745
983
|
.stub(WebCapabilities, 'supportsRTCPeerConnection')
|
|
@@ -760,6 +998,7 @@ describe('plugin-meetings', () => {
|
|
|
760
998
|
.stub(meeting.roap, 'handleTurnDiscoveryHttpResponse')
|
|
761
999
|
.resolves({turnServerInfo: fakeTurnServerInfo, turnDiscoverySkippedReason: undefined});
|
|
762
1000
|
abortTurnDiscoveryStub = sinon.stub(meeting.roap, 'abortTurnDiscovery');
|
|
1001
|
+
suspendDestroyMeetingStub = sinon.stub(meeting.locusInfo, 'suspendDestroyMeeting');
|
|
763
1002
|
});
|
|
764
1003
|
|
|
765
1004
|
it('should work as expected', async () => {
|
|
@@ -782,8 +1021,9 @@ describe('plugin-meetings', () => {
|
|
|
782
1021
|
assert.calledOnceWithExactly(
|
|
783
1022
|
meeting.addMediaInternal,
|
|
784
1023
|
sinon.match.any,
|
|
785
|
-
fakeTurnServerInfo,
|
|
786
1024
|
false,
|
|
1025
|
+
fakeTurnServerInfo,
|
|
1026
|
+
undefined,
|
|
787
1027
|
mediaOptions
|
|
788
1028
|
);
|
|
789
1029
|
|
|
@@ -791,9 +1031,14 @@ describe('plugin-meetings', () => {
|
|
|
791
1031
|
|
|
792
1032
|
// resets joinWithMediaRetryInfo
|
|
793
1033
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
794
|
-
|
|
1034
|
+
retryCount: 0,
|
|
795
1035
|
prevJoinResponse: undefined,
|
|
796
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);
|
|
797
1042
|
});
|
|
798
1043
|
|
|
799
1044
|
it("should not call handleTurnDiscoveryHttpResponse if we don't send a TURN discovery request with join", async () => {
|
|
@@ -815,8 +1060,9 @@ describe('plugin-meetings', () => {
|
|
|
815
1060
|
assert.calledOnceWithExactly(
|
|
816
1061
|
meeting.addMediaInternal,
|
|
817
1062
|
sinon.match.any,
|
|
818
|
-
undefined,
|
|
819
1063
|
false,
|
|
1064
|
+
undefined,
|
|
1065
|
+
undefined,
|
|
820
1066
|
mediaOptions
|
|
821
1067
|
);
|
|
822
1068
|
|
|
@@ -850,8 +1096,9 @@ describe('plugin-meetings', () => {
|
|
|
850
1096
|
assert.calledOnceWithExactly(
|
|
851
1097
|
meeting.addMediaInternal,
|
|
852
1098
|
sinon.match.any,
|
|
853
|
-
undefined,
|
|
854
1099
|
false,
|
|
1100
|
+
undefined,
|
|
1101
|
+
undefined,
|
|
855
1102
|
mediaOptions
|
|
856
1103
|
);
|
|
857
1104
|
|
|
@@ -863,7 +1110,12 @@ describe('plugin-meetings', () => {
|
|
|
863
1110
|
meeting.join = sinon.stub().returns(Promise.reject(error));
|
|
864
1111
|
meeting.locusUrl = null; // when join fails, we end up with null locusUrl
|
|
865
1112
|
|
|
866
|
-
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);
|
|
867
1119
|
|
|
868
1120
|
assert.calledTwice(abortTurnDiscoveryStub);
|
|
869
1121
|
|
|
@@ -901,9 +1153,84 @@ describe('plugin-meetings', () => {
|
|
|
901
1153
|
|
|
902
1154
|
// resets joinWithMediaRetryInfo
|
|
903
1155
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
904
|
-
|
|
1156
|
+
retryCount: 0,
|
|
905
1157
|
prevJoinResponse: undefined,
|
|
1158
|
+
firstError: undefined,
|
|
1159
|
+
prevError: undefined,
|
|
906
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);
|
|
907
1234
|
});
|
|
908
1235
|
|
|
909
1236
|
it('should resolve if join() fails the first time but succeeds the second time', async () => {
|
|
@@ -947,7 +1274,7 @@ describe('plugin-meetings', () => {
|
|
|
947
1274
|
|
|
948
1275
|
// resets joinWithMediaRetryInfo
|
|
949
1276
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
950
|
-
|
|
1277
|
+
retryCount: 0,
|
|
951
1278
|
prevJoinResponse: undefined,
|
|
952
1279
|
});
|
|
953
1280
|
});
|
|
@@ -1016,6 +1343,127 @@ describe('plugin-meetings', () => {
|
|
|
1016
1343
|
);
|
|
1017
1344
|
});
|
|
1018
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
|
+
|
|
1019
1467
|
it('should call leave() if addMediaInternal() fails with a browser media error (TypeError)', async () => {
|
|
1020
1468
|
const addMediaError = new Error('fake addMedia error');
|
|
1021
1469
|
addMediaError.name = 'TypeError'; // This makes it a browser media error
|
|
@@ -1211,8 +1659,9 @@ describe('plugin-meetings', () => {
|
|
|
1211
1659
|
assert.calledWith(
|
|
1212
1660
|
meeting.addMediaInternal.firstCall,
|
|
1213
1661
|
sinon.match.any,
|
|
1214
|
-
fakeTurnServerInfo,
|
|
1215
1662
|
false,
|
|
1663
|
+
fakeTurnServerInfo,
|
|
1664
|
+
undefined,
|
|
1216
1665
|
mediaOptions
|
|
1217
1666
|
);
|
|
1218
1667
|
|
|
@@ -1220,8 +1669,9 @@ describe('plugin-meetings', () => {
|
|
|
1220
1669
|
assert.calledWith(
|
|
1221
1670
|
meeting.addMediaInternal.secondCall,
|
|
1222
1671
|
sinon.match.any,
|
|
1223
|
-
undefined,
|
|
1224
1672
|
true,
|
|
1673
|
+
undefined,
|
|
1674
|
+
undefined,
|
|
1225
1675
|
mediaOptions
|
|
1226
1676
|
);
|
|
1227
1677
|
|
|
@@ -1239,7 +1689,7 @@ describe('plugin-meetings', () => {
|
|
|
1239
1689
|
|
|
1240
1690
|
meeting.addMediaInternal = sinon
|
|
1241
1691
|
.stub()
|
|
1242
|
-
.callsFake((icePhaseCallback,
|
|
1692
|
+
.callsFake((icePhaseCallback, _forceTurnDiscovery, _turnServerInfo) => {
|
|
1243
1693
|
const defer = new Defer();
|
|
1244
1694
|
|
|
1245
1695
|
icePhaseCallbacks.push(icePhaseCallback);
|
|
@@ -1252,25 +1702,138 @@ describe('plugin-meetings', () => {
|
|
|
1252
1702
|
mediaOptions,
|
|
1253
1703
|
});
|
|
1254
1704
|
|
|
1255
|
-
await testUtils.flushPromises();
|
|
1705
|
+
await testUtils.flushPromises();
|
|
1706
|
+
|
|
1707
|
+
// check the callback works correctly on the 1st attempt
|
|
1708
|
+
assert.equal(icePhaseCallbacks.length, 1);
|
|
1709
|
+
assert.equal(icePhaseCallbacks[0](), 'JOIN_MEETING_RETRY');
|
|
1710
|
+
|
|
1711
|
+
// now trigger the failure, so that joinWithMedia() does a retry
|
|
1712
|
+
addMediaInternalResults[0].reject(addMediaError);
|
|
1713
|
+
|
|
1714
|
+
await testUtils.flushPromises();
|
|
1715
|
+
|
|
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
|
|
1718
|
+
assert.equal(icePhaseCallbacks.length, 2);
|
|
1719
|
+
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1720
|
+
|
|
1721
|
+
// trigger 2nd failure
|
|
1722
|
+
addMediaInternalResults[1].reject(addMediaError);
|
|
1723
|
+
|
|
1724
|
+
await assert.isRejected(result);
|
|
1725
|
+
});
|
|
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});
|
|
1256
1805
|
|
|
1257
|
-
//
|
|
1258
|
-
assert.
|
|
1259
|
-
|
|
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
|
+
});
|
|
1260
1813
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1814
|
+
it('should re-join when isUserInLeftState returns true on retry', async () => {
|
|
1815
|
+
const addMediaError = new Error('addMedia error');
|
|
1263
1816
|
|
|
1264
|
-
|
|
1817
|
+
sinon.stub(MeetingUtil, 'isUserInLeftState').returns(true);
|
|
1265
1818
|
|
|
1266
|
-
|
|
1267
|
-
assert.equal(icePhaseCallbacks.length, 2);
|
|
1268
|
-
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1819
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1269
1820
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1821
|
+
meeting.addMediaInternal = sinon
|
|
1822
|
+
.stub()
|
|
1823
|
+
.onFirstCall()
|
|
1824
|
+
.rejects(addMediaError)
|
|
1825
|
+
.onSecondCall()
|
|
1826
|
+
.resolves(test4);
|
|
1272
1827
|
|
|
1273
|
-
await
|
|
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);
|
|
1274
1837
|
});
|
|
1275
1838
|
|
|
1276
1839
|
[
|
|
@@ -1340,6 +1903,7 @@ describe('plugin-meetings', () => {
|
|
|
1340
1903
|
sinon.match.any,
|
|
1341
1904
|
sinon.match.any,
|
|
1342
1905
|
sinon.match.any,
|
|
1906
|
+
sinon.match.any,
|
|
1343
1907
|
sinon.match.has('videoEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1344
1908
|
);
|
|
1345
1909
|
});
|
|
@@ -1360,6 +1924,7 @@ describe('plugin-meetings', () => {
|
|
|
1360
1924
|
sinon.match.any,
|
|
1361
1925
|
sinon.match.any,
|
|
1362
1926
|
sinon.match.any,
|
|
1927
|
+
sinon.match.any,
|
|
1363
1928
|
sinon.match.has('audioEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1364
1929
|
);
|
|
1365
1930
|
});
|
|
@@ -1381,6 +1946,7 @@ describe('plugin-meetings', () => {
|
|
|
1381
1946
|
sinon.match.any,
|
|
1382
1947
|
sinon.match.any,
|
|
1383
1948
|
sinon.match.any,
|
|
1949
|
+
sinon.match.any,
|
|
1384
1950
|
sinon.match({
|
|
1385
1951
|
sendVideo: true,
|
|
1386
1952
|
receiveVideo: false,
|
|
@@ -1390,6 +1956,97 @@ describe('plugin-meetings', () => {
|
|
|
1390
1956
|
);
|
|
1391
1957
|
});
|
|
1392
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
|
+
|
|
1393
2050
|
it('should throw immediately if RTCPeerConnection is not available', async () => {
|
|
1394
2051
|
supportsRTCPeerConnectionStub.returns(CapabilityState.NOT_CAPABLE);
|
|
1395
2052
|
|
|
@@ -1401,9 +2058,87 @@ describe('plugin-meetings', () => {
|
|
|
1401
2058
|
Errors.WebrtcApiNotAvailableError
|
|
1402
2059
|
);
|
|
1403
2060
|
|
|
2061
|
+
assert.notCalled(suspendDestroyMeetingStub);
|
|
1404
2062
|
assert.notCalled(meeting.join);
|
|
1405
2063
|
assert.notCalled(meeting.addMediaInternal);
|
|
1406
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
|
+
});
|
|
1407
2142
|
});
|
|
1408
2143
|
describe('#isTranscriptionSupported', () => {
|
|
1409
2144
|
it('should return false if the feature is not supported for the meeting', () => {
|
|
@@ -1552,6 +2287,22 @@ describe('plugin-meetings', () => {
|
|
|
1552
2287
|
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
|
|
1553
2288
|
);
|
|
1554
2289
|
});
|
|
2290
|
+
|
|
2291
|
+
it('should stop listening to voicea events even when transcription is undefined', () => {
|
|
2292
|
+
meeting.transcription = undefined;
|
|
2293
|
+
meeting.stopTranscription();
|
|
2294
|
+
assert.equal(webex.internal.voicea.off.callCount, 4);
|
|
2295
|
+
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2296
|
+
assert.calledWith(
|
|
2297
|
+
TriggerProxy.trigger,
|
|
2298
|
+
sinon.match.instanceOf(Meeting),
|
|
2299
|
+
{
|
|
2300
|
+
file: 'meeting/index',
|
|
2301
|
+
function: 'triggerStopReceivingTranscriptionEvent',
|
|
2302
|
+
},
|
|
2303
|
+
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
|
|
2304
|
+
);
|
|
2305
|
+
});
|
|
1555
2306
|
});
|
|
1556
2307
|
|
|
1557
2308
|
describe('#setCaptionLanguage', () => {
|
|
@@ -1960,16 +2711,124 @@ describe('plugin-meetings', () => {
|
|
|
1960
2711
|
fakeProcessedReaction
|
|
1961
2712
|
);
|
|
1962
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
|
+
);
|
|
1963
2821
|
});
|
|
1964
2822
|
|
|
1965
2823
|
describe('#handleLLMOnline', () => {
|
|
1966
2824
|
beforeEach(() => {
|
|
1967
2825
|
webex.internal.llm.off = sinon.stub();
|
|
2826
|
+
webex.internal.voicea.getIsCaptionBoxOn = sinon.stub().returns(false);
|
|
2827
|
+
webex.internal.voicea.updateSubchannelSubscriptions = sinon.stub();
|
|
1968
2828
|
});
|
|
1969
2829
|
|
|
1970
|
-
it('
|
|
2830
|
+
it('emits transcription connected events', () => {
|
|
1971
2831
|
meeting.handleLLMOnline();
|
|
1972
|
-
assert.calledOnceWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
1973
2832
|
assert.calledWith(
|
|
1974
2833
|
TriggerProxy.trigger,
|
|
1975
2834
|
sinon.match.instanceOf(Meeting),
|
|
@@ -1980,6 +2839,32 @@ describe('plugin-meetings', () => {
|
|
|
1980
2839
|
EVENT_TRIGGERS.MEETING_TRANSCRIPTION_CONNECTED
|
|
1981
2840
|
);
|
|
1982
2841
|
});
|
|
2842
|
+
|
|
2843
|
+
it('restores transcription subscription when caption intent is enabled', () => {
|
|
2844
|
+
webex.internal.voicea.getIsCaptionBoxOn.returns(true);
|
|
2845
|
+
|
|
2846
|
+
meeting.handleLLMOnline();
|
|
2847
|
+
|
|
2848
|
+
assert.calledOnceWithExactly(webex.internal.voicea.updateSubchannelSubscriptions, {
|
|
2849
|
+
subscribe: ['transcription'],
|
|
2850
|
+
});
|
|
2851
|
+
});
|
|
2852
|
+
|
|
2853
|
+
it('does not restore transcription subscription when caption intent is disabled', () => {
|
|
2854
|
+
webex.internal.voicea.getIsCaptionBoxOn.returns(false);
|
|
2855
|
+
|
|
2856
|
+
meeting.handleLLMOnline();
|
|
2857
|
+
|
|
2858
|
+
assert.notCalled(webex.internal.voicea.updateSubchannelSubscriptions);
|
|
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
|
+
});
|
|
1983
2868
|
});
|
|
1984
2869
|
|
|
1985
2870
|
describe('#join', () => {
|
|
@@ -1999,6 +2884,7 @@ describe('plugin-meetings', () => {
|
|
|
1999
2884
|
it('should have #join', () => {
|
|
2000
2885
|
assert.exists(meeting.join);
|
|
2001
2886
|
});
|
|
2887
|
+
|
|
2002
2888
|
beforeEach(() => {
|
|
2003
2889
|
setCorrelationIdSpy = sinon.spy(meeting, 'setCorrelationId');
|
|
2004
2890
|
meeting.setLocus = sinon.stub().returns(true);
|
|
@@ -2059,6 +2945,8 @@ describe('plugin-meetings', () => {
|
|
|
2059
2945
|
regionCode: 'EU',
|
|
2060
2946
|
},
|
|
2061
2947
|
preferTranscoding: !enableMultistream,
|
|
2948
|
+
getCurrentSelfUrl: sinon.match.func,
|
|
2949
|
+
waitForSelfUrlChange: sinon.match.func,
|
|
2062
2950
|
},
|
|
2063
2951
|
{
|
|
2064
2952
|
parent: meeting.webex,
|
|
@@ -2152,7 +3040,6 @@ describe('plugin-meetings', () => {
|
|
|
2152
3040
|
await meeting.join().catch(() => {
|
|
2153
3041
|
assert.calledOnce(MeetingUtil.joinMeeting);
|
|
2154
3042
|
|
|
2155
|
-
// Assert that client.locus.join.response error event is not sent from this function, it is now emitted from MeetingUtil.joinMeeting
|
|
2156
3043
|
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
2157
3044
|
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
2158
3045
|
name: 'client.call.initiated',
|
|
@@ -2184,6 +3071,7 @@ describe('plugin-meetings', () => {
|
|
|
2184
3071
|
});
|
|
2185
3072
|
});
|
|
2186
3073
|
});
|
|
3074
|
+
|
|
2187
3075
|
describe('lmm, transcription & permissionTokenRefresh decoupling', () => {
|
|
2188
3076
|
beforeEach(() => {
|
|
2189
3077
|
sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve(joinMeetingResult));
|
|
@@ -2254,7 +3142,6 @@ describe('plugin-meetings', () => {
|
|
|
2254
3142
|
const locusInfoParseStub = sinon.stub(meeting.locusInfo, 'parse');
|
|
2255
3143
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
2256
3144
|
|
|
2257
|
-
// Set up llm.on stub to capture the registered listener when updateLLMConnection is called
|
|
2258
3145
|
let locusLLMEventListener;
|
|
2259
3146
|
meeting.webex.internal.llm.on = sinon.stub().callsFake((eventName, callback) => {
|
|
2260
3147
|
if (eventName === 'event:locus.state_message') {
|
|
@@ -2263,16 +3150,12 @@ describe('plugin-meetings', () => {
|
|
|
2263
3150
|
});
|
|
2264
3151
|
meeting.webex.internal.llm.off = sinon.stub();
|
|
2265
3152
|
|
|
2266
|
-
// we need the real meeting.updateLLMConnection not the mock
|
|
2267
3153
|
meeting.updateLLMConnection.restore();
|
|
2268
3154
|
|
|
2269
|
-
// Call updateLLMConnection to register the listener
|
|
2270
3155
|
await meeting.updateLLMConnection();
|
|
2271
3156
|
|
|
2272
|
-
// Verify the listener was registered and we captured it
|
|
2273
3157
|
assert.isDefined(locusLLMEventListener, 'LLM event listener should be registered');
|
|
2274
3158
|
|
|
2275
|
-
// Now trigger the event
|
|
2276
3159
|
const eventData = {
|
|
2277
3160
|
eventType: 'locus.state_message',
|
|
2278
3161
|
stateElementsMessage: {
|
|
@@ -2292,13 +3175,10 @@ describe('plugin-meetings', () => {
|
|
|
2292
3175
|
sinon.stub(meeting.webex.internal.llm, 'hasEverConnected').value(true);
|
|
2293
3176
|
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({});
|
|
2294
3177
|
|
|
2295
|
-
// Restore the real updateLLMConnection
|
|
2296
3178
|
meeting.updateLLMConnection.restore();
|
|
2297
3179
|
|
|
2298
|
-
// Call updateLLMConnection to start the timer
|
|
2299
3180
|
await meeting.updateLLMConnection();
|
|
2300
3181
|
|
|
2301
|
-
// Fast forward time by 3 minutes
|
|
2302
3182
|
fakeClock.tick(3 * 60 * 1000);
|
|
2303
3183
|
|
|
2304
3184
|
assert.calledWith(
|
|
@@ -2323,18 +3203,14 @@ describe('plugin-meetings', () => {
|
|
|
2323
3203
|
.stub(meeting.webex.internal.llm, 'getDatachannelUrl')
|
|
2324
3204
|
.returns('https://datachannel1.example.com');
|
|
2325
3205
|
|
|
2326
|
-
// Restore the real updateLLMConnection
|
|
2327
3206
|
meeting.updateLLMConnection.restore();
|
|
2328
3207
|
|
|
2329
|
-
// First, connect LLM and start the timer
|
|
2330
3208
|
isJoinedStub.returns(true);
|
|
2331
3209
|
meeting.webex.internal.llm.isConnected.returns(false);
|
|
2332
3210
|
await meeting.updateLLMConnection();
|
|
2333
3211
|
|
|
2334
|
-
// Verify timer was started
|
|
2335
3212
|
assert.exists(meeting.llmHealthCheckTimer);
|
|
2336
3213
|
|
|
2337
|
-
// Now simulate that we're no longer joined
|
|
2338
3214
|
isJoinedStub.returns(false);
|
|
2339
3215
|
meeting.webex.internal.llm.isConnected.returns(true);
|
|
2340
3216
|
|
|
@@ -2342,10 +3218,8 @@ describe('plugin-meetings', () => {
|
|
|
2342
3218
|
|
|
2343
3219
|
assert.calledOnce(meeting.webex.internal.llm.disconnectLLM);
|
|
2344
3220
|
|
|
2345
|
-
// Verify the timer was cleared (should be undefined)
|
|
2346
3221
|
assert.isUndefined(meeting.llmHealthCheckTimer);
|
|
2347
3222
|
|
|
2348
|
-
// Fast forward time to ensure no metric is sent
|
|
2349
3223
|
Metrics.sendBehavioralMetric.resetHistory();
|
|
2350
3224
|
fakeClock.tick(3 * 60 * 1000);
|
|
2351
3225
|
|
|
@@ -2380,7 +3254,6 @@ describe('plugin-meetings', () => {
|
|
|
2380
3254
|
.stub()
|
|
2381
3255
|
.rejects(new CaptchaError('bad captcha'));
|
|
2382
3256
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2383
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil, 'joinMeetingOptions');
|
|
2384
3257
|
|
|
2385
3258
|
try {
|
|
2386
3259
|
await meeting.join();
|
|
@@ -2394,8 +3267,7 @@ describe('plugin-meetings', () => {
|
|
|
2394
3267
|
);
|
|
2395
3268
|
assert.instanceOf(error, CaptchaError);
|
|
2396
3269
|
assert.equal(error.message, 'bad captcha');
|
|
2397
|
-
|
|
2398
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3270
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2399
3271
|
}
|
|
2400
3272
|
});
|
|
2401
3273
|
|
|
@@ -2404,7 +3276,6 @@ describe('plugin-meetings', () => {
|
|
|
2404
3276
|
.stub()
|
|
2405
3277
|
.rejects(new PasswordError('bad password'));
|
|
2406
3278
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2407
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil.joinMeetingOptions);
|
|
2408
3279
|
|
|
2409
3280
|
try {
|
|
2410
3281
|
await meeting.join();
|
|
@@ -2418,8 +3289,7 @@ describe('plugin-meetings', () => {
|
|
|
2418
3289
|
);
|
|
2419
3290
|
assert.instanceOf(error, PasswordError);
|
|
2420
3291
|
assert.equal(error.message, 'bad password');
|
|
2421
|
-
|
|
2422
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3292
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2423
3293
|
}
|
|
2424
3294
|
});
|
|
2425
3295
|
|
|
@@ -2428,7 +3298,6 @@ describe('plugin-meetings', () => {
|
|
|
2428
3298
|
.stub()
|
|
2429
3299
|
.rejects(new PermissionError('bad permission'));
|
|
2430
3300
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2431
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil.joinMeetingOptions);
|
|
2432
3301
|
|
|
2433
3302
|
try {
|
|
2434
3303
|
await meeting.join();
|
|
@@ -2442,14 +3311,14 @@ describe('plugin-meetings', () => {
|
|
|
2442
3311
|
);
|
|
2443
3312
|
assert.instanceOf(error, PermissionError);
|
|
2444
3313
|
assert.equal(error.message, 'bad permission');
|
|
2445
|
-
|
|
2446
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3314
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2447
3315
|
}
|
|
2448
3316
|
});
|
|
2449
3317
|
});
|
|
2450
3318
|
});
|
|
2451
3319
|
});
|
|
2452
3320
|
|
|
3321
|
+
|
|
2453
3322
|
describe('#addMedia', () => {
|
|
2454
3323
|
const muteStateStub = {
|
|
2455
3324
|
handleClientRequest: sinon.stub().returns(Promise.resolve(true)),
|
|
@@ -2596,9 +3465,11 @@ describe('plugin-meetings', () => {
|
|
|
2596
3465
|
retriedWithTurnServer: false,
|
|
2597
3466
|
isMultistream: false,
|
|
2598
3467
|
isJoinWithMediaRetry: false,
|
|
3468
|
+
iceTransportPolicy: 'all',
|
|
2599
3469
|
signalingState: 'unknown',
|
|
2600
3470
|
connectionState: 'unknown',
|
|
2601
3471
|
iceConnectionState: 'unknown',
|
|
3472
|
+
connectionType: 'udp',
|
|
2602
3473
|
someReachabilityMetric1: 'some value1',
|
|
2603
3474
|
someReachabilityMetric2: 'some value2',
|
|
2604
3475
|
selectedCandidatePairChanges: 2,
|
|
@@ -2724,9 +3595,11 @@ describe('plugin-meetings', () => {
|
|
|
2724
3595
|
retriedWithTurnServer: false,
|
|
2725
3596
|
isMultistream: false,
|
|
2726
3597
|
isJoinWithMediaRetry: false,
|
|
3598
|
+
iceTransportPolicy: 'all',
|
|
2727
3599
|
signalingState: 'unknown',
|
|
2728
3600
|
connectionState: 'unknown',
|
|
2729
3601
|
iceConnectionState: 'unknown',
|
|
3602
|
+
connectionType: 'udp',
|
|
2730
3603
|
someReachabilityMetric1: 'some value1',
|
|
2731
3604
|
someReachabilityMetric2: 'some value2',
|
|
2732
3605
|
selectedCandidatePairChanges: 2,
|
|
@@ -3494,9 +4367,11 @@ describe('plugin-meetings', () => {
|
|
|
3494
4367
|
retriedWithTurnServer: true,
|
|
3495
4368
|
isMultistream: false,
|
|
3496
4369
|
isJoinWithMediaRetry: false,
|
|
4370
|
+
iceTransportPolicy: 'all',
|
|
3497
4371
|
signalingState: 'unknown',
|
|
3498
4372
|
connectionState: 'unknown',
|
|
3499
4373
|
iceConnectionState: 'unknown',
|
|
4374
|
+
connectionType: 'udp',
|
|
3500
4375
|
selectedCandidatePairChanges: 2,
|
|
3501
4376
|
numTransports: 1,
|
|
3502
4377
|
iceCandidatesCount: 0,
|
|
@@ -3507,18 +4382,181 @@ describe('plugin-meetings', () => {
|
|
|
3507
4382
|
},
|
|
3508
4383
|
]);
|
|
3509
4384
|
|
|
3510
|
-
// Check that doTurnDiscovery is called with th4 correct value of isForced
|
|
3511
|
-
const doTurnDiscoveryCalls = meeting.roap.doTurnDiscovery.getCalls();
|
|
3512
|
-
assert.equal(doTurnDiscoveryCalls.length, 2);
|
|
3513
|
-
assert.deepEqual(doTurnDiscoveryCalls[0].args, [meeting, false, false]);
|
|
3514
|
-
assert.deepEqual(doTurnDiscoveryCalls[1].args.slice(1), [true, true]);
|
|
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',
|
|
4482
|
+
},
|
|
4483
|
+
{
|
|
4484
|
+
title: 'should drop iceTransportPolicy=relay when TURN discovery returns turnServerInfo with empty urls',
|
|
4485
|
+
turnServerInfo: {urls: [], username: 'u', password: 'p'},
|
|
4486
|
+
turnDiscoverySkippedReason: undefined,
|
|
4487
|
+
},
|
|
4488
|
+
].forEach(({title, turnServerInfo, turnDiscoverySkippedReason}) => {
|
|
4489
|
+
it(title, async () => {
|
|
4490
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4491
|
+
turnServerInfo,
|
|
4492
|
+
turnDiscoverySkippedReason,
|
|
4493
|
+
});
|
|
4494
|
+
|
|
4495
|
+
await meeting.addMediaInternal(
|
|
4496
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4497
|
+
false,
|
|
4498
|
+
undefined,
|
|
4499
|
+
'relay',
|
|
4500
|
+
{mediaSettings: {}}
|
|
4501
|
+
);
|
|
4502
|
+
|
|
4503
|
+
assert.calledOnce(createMediaConnectionStub);
|
|
4504
|
+
const config = createMediaConnectionStub.firstCall.args[3];
|
|
4505
|
+
assert.isUndefined(config.iceTransportPolicy);
|
|
4506
|
+
|
|
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
|
+
});
|
|
3515
4541
|
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
assert.isNull(meeting.mediaProperties.webrtcMediaConnection);
|
|
4542
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().rejects(
|
|
4543
|
+
new MediaConnectionTimedOutError('timed out', true)
|
|
4544
|
+
);
|
|
3520
4545
|
|
|
3521
|
-
|
|
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
|
+
});
|
|
3522
4560
|
});
|
|
3523
4561
|
|
|
3524
4562
|
it('should resolve if waitForMediaConnectionConnected() rejects the first time but resolves the second time', async () => {
|
|
@@ -3710,6 +4748,7 @@ describe('plugin-meetings', () => {
|
|
|
3710
4748
|
isMultistream: false,
|
|
3711
4749
|
retriedWithTurnServer: true,
|
|
3712
4750
|
isJoinWithMediaRetry: false,
|
|
4751
|
+
iceTransportPolicy: 'all',
|
|
3713
4752
|
iceCandidatesCount: 0,
|
|
3714
4753
|
subnet_reachable: null,
|
|
3715
4754
|
selected_cluster: null,
|
|
@@ -3873,6 +4912,7 @@ describe('plugin-meetings', () => {
|
|
|
3873
4912
|
isMultistream: false,
|
|
3874
4913
|
retriedWithTurnServer: false,
|
|
3875
4914
|
isJoinWithMediaRetry: false,
|
|
4915
|
+
iceTransportPolicy: 'all',
|
|
3876
4916
|
someReachabilityMetric1: 'some value1',
|
|
3877
4917
|
someReachabilityMetric2: 'some value2',
|
|
3878
4918
|
iceCandidatesCount: 3,
|
|
@@ -3938,9 +4978,11 @@ describe('plugin-meetings', () => {
|
|
|
3938
4978
|
retriedWithTurnServer: false,
|
|
3939
4979
|
isMultistream: false,
|
|
3940
4980
|
isJoinWithMediaRetry: false,
|
|
4981
|
+
iceTransportPolicy: 'all',
|
|
3941
4982
|
signalingState: 'unknown',
|
|
3942
4983
|
connectionState: 'unknown',
|
|
3943
4984
|
iceConnectionState: 'unknown',
|
|
4985
|
+
connectionType: 'udp',
|
|
3944
4986
|
selectedCandidatePairChanges: 2,
|
|
3945
4987
|
numTransports: 1,
|
|
3946
4988
|
subnet_reachable: null,
|
|
@@ -4001,9 +5043,11 @@ describe('plugin-meetings', () => {
|
|
|
4001
5043
|
retriedWithTurnServer: false,
|
|
4002
5044
|
isMultistream: false,
|
|
4003
5045
|
isJoinWithMediaRetry: false,
|
|
5046
|
+
iceTransportPolicy: 'all',
|
|
4004
5047
|
signalingState: 'unknown',
|
|
4005
5048
|
connectionState: 'unknown',
|
|
4006
5049
|
iceConnectionState: 'unknown',
|
|
5050
|
+
connectionType: 'udp',
|
|
4007
5051
|
selectedCandidatePairChanges: 2,
|
|
4008
5052
|
numTransports: 1,
|
|
4009
5053
|
'701_error': 2,
|
|
@@ -4065,6 +5109,7 @@ describe('plugin-meetings', () => {
|
|
|
4065
5109
|
isMultistream: false,
|
|
4066
5110
|
retriedWithTurnServer: false,
|
|
4067
5111
|
isJoinWithMediaRetry: false,
|
|
5112
|
+
iceTransportPolicy: 'all',
|
|
4068
5113
|
iceCandidatesCount: 0,
|
|
4069
5114
|
reachability_public_udp_success: 5,
|
|
4070
5115
|
subnet_reachable: false,
|
|
@@ -4130,9 +5175,11 @@ describe('plugin-meetings', () => {
|
|
|
4130
5175
|
retriedWithTurnServer: false,
|
|
4131
5176
|
isMultistream: false,
|
|
4132
5177
|
isJoinWithMediaRetry: false,
|
|
5178
|
+
iceTransportPolicy: 'all',
|
|
4133
5179
|
signalingState: 'unknown',
|
|
4134
5180
|
connectionState: 'unknown',
|
|
4135
5181
|
iceConnectionState: 'unknown',
|
|
5182
|
+
connectionType: 'udp',
|
|
4136
5183
|
selectedCandidatePairChanges: 2,
|
|
4137
5184
|
numTransports: 1,
|
|
4138
5185
|
reachability_public_udp_success: 5,
|
|
@@ -4516,6 +5563,297 @@ describe('plugin-meetings', () => {
|
|
|
4516
5563
|
},
|
|
4517
5564
|
});
|
|
4518
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
|
+
});
|
|
4519
5857
|
});
|
|
4520
5858
|
|
|
4521
5859
|
describe('handles StatsMonitor events', () => {
|
|
@@ -6174,13 +7512,14 @@ describe('plugin-meetings', () => {
|
|
|
6174
7512
|
sinon.stub(meeting.locusMediaRequest, 'downgradeFromMultistreamToTranscoded');
|
|
6175
7513
|
});
|
|
6176
7514
|
|
|
6177
|
-
const runCheck = async (turnServerInfo, forceTurnDiscovery) => {
|
|
7515
|
+
const runCheck = async (turnServerInfo, forceTurnDiscovery, iceTransportPolicy) => {
|
|
6178
7516
|
// we're calling addMediaInternal() with mic stream,
|
|
6179
7517
|
// so that we also verify that audioMute, videoMute info is correctly sent to backend
|
|
6180
7518
|
const addMediaPromise = meeting.addMediaInternal(
|
|
6181
7519
|
() => '',
|
|
6182
|
-
turnServerInfo,
|
|
6183
7520
|
forceTurnDiscovery,
|
|
7521
|
+
turnServerInfo,
|
|
7522
|
+
iceTransportPolicy,
|
|
6184
7523
|
{
|
|
6185
7524
|
localStreams: {microphone: fakeMicrophoneStream},
|
|
6186
7525
|
}
|
|
@@ -6234,6 +7573,10 @@ describe('plugin-meetings', () => {
|
|
|
6234
7573
|
// at this point the meeting should have been downgraded to transcoded
|
|
6235
7574
|
assert.equal(meeting.isMultistream, false);
|
|
6236
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
|
+
|
|
6237
7580
|
// old stats analyzer stopped and new one created
|
|
6238
7581
|
assert.calledOnce(initialStatsAnalyzer.stopAnalyzer);
|
|
6239
7582
|
assert.calledOnceWithExactly(
|
|
@@ -6324,6 +7667,11 @@ describe('plugin-meetings', () => {
|
|
|
6324
7667
|
true
|
|
6325
7668
|
);
|
|
6326
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
|
+
});
|
|
6327
7675
|
});
|
|
6328
7676
|
}
|
|
6329
7677
|
})
|
|
@@ -6411,6 +7759,9 @@ describe('plugin-meetings', () => {
|
|
|
6411
7759
|
|
|
6412
7760
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
6413
7761
|
webex.internal.llm.off = sinon.stub();
|
|
7762
|
+
webex.internal.mercury.off = sinon.stub();
|
|
7763
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
7764
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
6414
7765
|
|
|
6415
7766
|
// A meeting needs to be joined to leave
|
|
6416
7767
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -6434,6 +7785,67 @@ describe('plugin-meetings', () => {
|
|
|
6434
7785
|
assert.calledOnce(meeting.clearMeetingData);
|
|
6435
7786
|
});
|
|
6436
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
|
+
|
|
6437
7849
|
it('should reset call diagnostic latencies correctly', async () => {
|
|
6438
7850
|
const leave = meeting.leave();
|
|
6439
7851
|
|
|
@@ -8441,6 +9853,9 @@ describe('plugin-meetings', () => {
|
|
|
8441
9853
|
|
|
8442
9854
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
8443
9855
|
webex.internal.llm.off = sinon.stub();
|
|
9856
|
+
webex.internal.mercury.off = sinon.stub();
|
|
9857
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
9858
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
8444
9859
|
|
|
8445
9860
|
// A meeting needs to be joined to end
|
|
8446
9861
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -8463,6 +9878,66 @@ describe('plugin-meetings', () => {
|
|
|
8463
9878
|
assert.calledOnce(meeting?.unsetPeerConnections);
|
|
8464
9879
|
assert.calledOnce(meeting?.clearMeetingData);
|
|
8465
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
|
+
});
|
|
9916
|
+
|
|
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);
|
|
9940
|
+
});
|
|
8466
9941
|
});
|
|
8467
9942
|
|
|
8468
9943
|
describe('#moveTo', () => {
|
|
@@ -9198,8 +10673,8 @@ describe('plugin-meetings', () => {
|
|
|
9198
10673
|
const fakeMultistreamRoapMediaConnection = {
|
|
9199
10674
|
createSendSlot: () => {
|
|
9200
10675
|
return {
|
|
9201
|
-
|
|
9202
|
-
|
|
10676
|
+
setCustomCodecParameters: sinon.stub().resolves(),
|
|
10677
|
+
markCustomCodecParametersForDeletion: sinon.stub().resolves(),
|
|
9203
10678
|
};
|
|
9204
10679
|
},
|
|
9205
10680
|
};
|
|
@@ -9222,27 +10697,29 @@ describe('plugin-meetings', () => {
|
|
|
9222
10697
|
}
|
|
9223
10698
|
);
|
|
9224
10699
|
|
|
9225
|
-
it('should set
|
|
10700
|
+
it('should set custom codec parameters when shouldEnableMusicMode is true', async () => {
|
|
9226
10701
|
await meeting.enableMusicMode(true);
|
|
9227
10702
|
assert.calledOnceWithExactly(
|
|
9228
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10703
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters,
|
|
10704
|
+
MediaCodecMimeType.OPUS,
|
|
9229
10705
|
{
|
|
9230
10706
|
maxaveragebitrate: '64000',
|
|
9231
10707
|
maxplaybackrate: '48000',
|
|
9232
10708
|
}
|
|
9233
10709
|
);
|
|
9234
10710
|
assert.notCalled(
|
|
9235
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10711
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion
|
|
9236
10712
|
);
|
|
9237
10713
|
});
|
|
9238
10714
|
|
|
9239
|
-
it('should
|
|
10715
|
+
it('should mark custom codec parameters for deletion when shouldEnableMusicMode is false', async () => {
|
|
9240
10716
|
await meeting.enableMusicMode(false);
|
|
9241
10717
|
assert.calledOnceWithExactly(
|
|
9242
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10718
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion,
|
|
10719
|
+
MediaCodecMimeType.OPUS,
|
|
9243
10720
|
['maxaveragebitrate', 'maxplaybackrate']
|
|
9244
10721
|
);
|
|
9245
|
-
assert.notCalled(meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10722
|
+
assert.notCalled(meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters);
|
|
9246
10723
|
});
|
|
9247
10724
|
});
|
|
9248
10725
|
|
|
@@ -10397,14 +11874,24 @@ describe('plugin-meetings', () => {
|
|
|
10397
11874
|
);
|
|
10398
11875
|
done();
|
|
10399
11876
|
});
|
|
10400
|
-
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 () => {
|
|
10401
11878
|
meeting.stopKeepAlive = sinon.stub();
|
|
10402
11879
|
meeting.updateLLMConnection = sinon.stub();
|
|
11880
|
+
let resolvePrefetch;
|
|
11881
|
+
|
|
11882
|
+
meeting.ensureDefaultDatachannelTokenAfterAdmit = sinon
|
|
11883
|
+
.stub()
|
|
11884
|
+
.returns(new Promise((resolve) => {
|
|
11885
|
+
resolvePrefetch = resolve;
|
|
11886
|
+
}));
|
|
10403
11887
|
meeting.rtcMetrics = {
|
|
10404
11888
|
sendNextMetrics: sinon.stub(),
|
|
10405
11889
|
};
|
|
11890
|
+
|
|
10406
11891
|
meeting.locusInfo.emit({function: 'test', file: 'test'}, 'SELF_ADMITTED_GUEST', test1);
|
|
11892
|
+
|
|
10407
11893
|
assert.calledOnceWithExactly(meeting.stopKeepAlive);
|
|
11894
|
+
assert.calledOnceWithExactly(meeting.ensureDefaultDatachannelTokenAfterAdmit);
|
|
10408
11895
|
assert.calledThrice(TriggerProxy.trigger);
|
|
10409
11896
|
assert.calledWith(
|
|
10410
11897
|
TriggerProxy.trigger,
|
|
@@ -10413,7 +11900,7 @@ describe('plugin-meetings', () => {
|
|
|
10413
11900
|
'meeting:self:guestAdmitted',
|
|
10414
11901
|
{payload: test1}
|
|
10415
11902
|
);
|
|
10416
|
-
assert.
|
|
11903
|
+
assert.notCalled(meeting.updateLLMConnection);
|
|
10417
11904
|
assert.calledOnceWithExactly(meeting.rtcMetrics.sendNextMetrics);
|
|
10418
11905
|
|
|
10419
11906
|
assert.calledOnceWithExactly(
|
|
@@ -10423,7 +11910,12 @@ describe('plugin-meetings', () => {
|
|
|
10423
11910
|
correlation_id: meeting.correlationId,
|
|
10424
11911
|
}
|
|
10425
11912
|
);
|
|
10426
|
-
|
|
11913
|
+
|
|
11914
|
+
resolvePrefetch(false);
|
|
11915
|
+
await Promise.resolve();
|
|
11916
|
+
await Promise.resolve();
|
|
11917
|
+
|
|
11918
|
+
assert.calledOnce(meeting.updateLLMConnection);
|
|
10427
11919
|
});
|
|
10428
11920
|
|
|
10429
11921
|
it('listens to the breakouts changed event', () => {
|
|
@@ -10919,21 +12411,107 @@ describe('plugin-meetings', () => {
|
|
|
10919
12411
|
);
|
|
10920
12412
|
});
|
|
10921
12413
|
|
|
10922
|
-
it('listens to CONTROLS_POLLING_QA_CHANGED', async () => {
|
|
10923
|
-
const state = {example: 'value'};
|
|
12414
|
+
it('listens to CONTROLS_POLLING_QA_CHANGED', async () => {
|
|
12415
|
+
const state = {example: 'value'};
|
|
12416
|
+
|
|
12417
|
+
await meeting.locusInfo.emitScoped(
|
|
12418
|
+
{function: 'test', file: 'test'},
|
|
12419
|
+
LOCUSINFO.EVENTS.CONTROLS_POLLING_QA_CHANGED,
|
|
12420
|
+
{state}
|
|
12421
|
+
);
|
|
12422
|
+
|
|
12423
|
+
assert.calledWith(
|
|
12424
|
+
TriggerProxy.trigger,
|
|
12425
|
+
meeting,
|
|
12426
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12427
|
+
EVENT_TRIGGERS.MEETING_CONTROLS_POLLING_QA_UPDATED,
|
|
12428
|
+
{state}
|
|
12429
|
+
);
|
|
12430
|
+
});
|
|
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';
|
|
10924
12494
|
|
|
10925
12495
|
await meeting.locusInfo.emitScoped(
|
|
10926
12496
|
{function: 'test', file: 'test'},
|
|
10927
|
-
LOCUSINFO.EVENTS.
|
|
10928
|
-
{state}
|
|
12497
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12498
|
+
{state: RECORDING_STATE.RECORDING, modifiedBy, lastModified, modifiedByServiceAppName, modifiedByServiceAppId}
|
|
10929
12499
|
);
|
|
10930
12500
|
|
|
12501
|
+
assert.deepEqual(meeting.recording, {
|
|
12502
|
+
state: RECORDING_STATE.RECORDING,
|
|
12503
|
+
modifiedBy,
|
|
12504
|
+
lastModified,
|
|
12505
|
+
modifiedByServiceAppName,
|
|
12506
|
+
modifiedByServiceAppId,
|
|
12507
|
+
});
|
|
12508
|
+
|
|
10931
12509
|
assert.calledWith(
|
|
10932
12510
|
TriggerProxy.trigger,
|
|
10933
12511
|
meeting,
|
|
10934
12512
|
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
10935
|
-
EVENT_TRIGGERS.
|
|
10936
|
-
|
|
12513
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12514
|
+
meeting.recording
|
|
10937
12515
|
);
|
|
10938
12516
|
});
|
|
10939
12517
|
|
|
@@ -10990,6 +12568,7 @@ describe('plugin-meetings', () => {
|
|
|
10990
12568
|
meeting.annotation.locusUrlUpdate = sinon.stub();
|
|
10991
12569
|
meeting.simultaneousInterpretation.locusUrlUpdate = sinon.stub();
|
|
10992
12570
|
meeting.webinar.locusUrlUpdate = sinon.stub();
|
|
12571
|
+
meeting.aiEnableRequest.locusUrlUpdate = sinon.stub();
|
|
10993
12572
|
|
|
10994
12573
|
meeting.locusInfo.emit(
|
|
10995
12574
|
{function: 'test', file: 'test'},
|
|
@@ -11004,6 +12583,7 @@ describe('plugin-meetings', () => {
|
|
|
11004
12583
|
assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
|
|
11005
12584
|
assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
|
|
11006
12585
|
assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
|
|
12586
|
+
assert.calledWith(meeting.aiEnableRequest.locusUrlUpdate, newLocusUrl);
|
|
11007
12587
|
assert.equal(meeting.locusUrl, newLocusUrl);
|
|
11008
12588
|
assert(meeting.locusId, '12345');
|
|
11009
12589
|
|
|
@@ -11319,6 +12899,109 @@ describe('plugin-meetings', () => {
|
|
|
11319
12899
|
});
|
|
11320
12900
|
});
|
|
11321
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
|
+
|
|
11322
13005
|
describe('#emailInput', () => {
|
|
11323
13006
|
it('should set the email input', () => {
|
|
11324
13007
|
assert.notOk(meeting.emailInput);
|
|
@@ -11921,6 +13604,7 @@ describe('plugin-meetings', () => {
|
|
|
11921
13604
|
let showAutoEndMeetingWarningSpy;
|
|
11922
13605
|
let canAttendeeRequestAiAssistantEnabledSpy;
|
|
11923
13606
|
let attendeeRequestAiAssistantDeclinedAllSpy;
|
|
13607
|
+
let isAnonymizeDisplayNamesEnabledSpy;
|
|
11924
13608
|
// Due to import tree issues, hasHints must be stubed within the scope of the `it`.
|
|
11925
13609
|
|
|
11926
13610
|
beforeEach(() => {
|
|
@@ -11969,6 +13653,10 @@ describe('plugin-meetings', () => {
|
|
|
11969
13653
|
MeetingUtil,
|
|
11970
13654
|
'attendeeRequestAiAssistantDeclinedAll'
|
|
11971
13655
|
);
|
|
13656
|
+
isAnonymizeDisplayNamesEnabledSpy = sinon.spy(
|
|
13657
|
+
MeetingUtil,
|
|
13658
|
+
'isAnonymizeDisplayNamesEnabled'
|
|
13659
|
+
);
|
|
11972
13660
|
});
|
|
11973
13661
|
|
|
11974
13662
|
afterEach(() => {
|
|
@@ -11977,6 +13665,7 @@ describe('plugin-meetings', () => {
|
|
|
11977
13665
|
showAutoEndMeetingWarningSpy.restore();
|
|
11978
13666
|
canAttendeeRequestAiAssistantEnabledSpy.restore();
|
|
11979
13667
|
attendeeRequestAiAssistantDeclinedAllSpy.restore();
|
|
13668
|
+
isAnonymizeDisplayNamesEnabledSpy.restore();
|
|
11980
13669
|
});
|
|
11981
13670
|
|
|
11982
13671
|
forEach(
|
|
@@ -12534,6 +14223,7 @@ describe('plugin-meetings', () => {
|
|
|
12534
14223
|
meeting.roles
|
|
12535
14224
|
);
|
|
12536
14225
|
assert.calledWith(attendeeRequestAiAssistantDeclinedAllSpy, userDisplayHints);
|
|
14226
|
+
assert.calledWith(isAnonymizeDisplayNamesEnabledSpy, userDisplayHints);
|
|
12537
14227
|
|
|
12538
14228
|
assert.calledWith(ControlsOptionsUtil.hasHints, {
|
|
12539
14229
|
requiredHints: [DISPLAY_HINTS.MUTE_ALL],
|
|
@@ -12745,12 +14435,133 @@ describe('plugin-meetings', () => {
|
|
|
12745
14435
|
});
|
|
12746
14436
|
});
|
|
12747
14437
|
|
|
14438
|
+
describe('#saveDataChannelToken', () => {
|
|
14439
|
+
beforeEach(() => {
|
|
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);
|
|
14445
|
+
});
|
|
14446
|
+
|
|
14447
|
+
it('saves datachannelToken into LLM as Default', () => {
|
|
14448
|
+
meeting.saveDataChannelToken({
|
|
14449
|
+
locus: {
|
|
14450
|
+
self: {datachannelToken: 'default-token'},
|
|
14451
|
+
},
|
|
14452
|
+
});
|
|
14453
|
+
|
|
14454
|
+
assert.calledWithExactly(
|
|
14455
|
+
webex.internal.llm.setDatachannelToken,
|
|
14456
|
+
'default-token',
|
|
14457
|
+
'llm-default-session',
|
|
14458
|
+
meeting.id
|
|
14459
|
+
);
|
|
14460
|
+
});
|
|
14461
|
+
|
|
14462
|
+
it('saves practiceSessionDatachannelToken into LLM as PracticeSession', () => {
|
|
14463
|
+
meeting.saveDataChannelToken({
|
|
14464
|
+
locus: {
|
|
14465
|
+
self: {practiceSessionDatachannelToken: 'ps-token'},
|
|
14466
|
+
},
|
|
14467
|
+
});
|
|
14468
|
+
|
|
14469
|
+
assert.calledWithExactly(
|
|
14470
|
+
webex.internal.llm.setDatachannelToken,
|
|
14471
|
+
'ps-token',
|
|
14472
|
+
'llm-practice-session',
|
|
14473
|
+
meeting.id
|
|
14474
|
+
);
|
|
14475
|
+
});
|
|
14476
|
+
|
|
14477
|
+
it('saves both tokens when both are present', () => {
|
|
14478
|
+
meeting.saveDataChannelToken({
|
|
14479
|
+
locus: {
|
|
14480
|
+
self: {
|
|
14481
|
+
datachannelToken: 'default-token',
|
|
14482
|
+
practiceSessionDatachannelToken: 'ps-token',
|
|
14483
|
+
},
|
|
14484
|
+
},
|
|
14485
|
+
});
|
|
14486
|
+
|
|
14487
|
+
assert.calledTwice(webex.internal.llm.setDatachannelToken);
|
|
14488
|
+
assert.calledWithExactly(
|
|
14489
|
+
webex.internal.llm.setDatachannelToken,
|
|
14490
|
+
'default-token',
|
|
14491
|
+
'llm-default-session',
|
|
14492
|
+
meeting.id
|
|
14493
|
+
);
|
|
14494
|
+
assert.calledWithExactly(
|
|
14495
|
+
webex.internal.llm.setDatachannelToken,
|
|
14496
|
+
'ps-token',
|
|
14497
|
+
'llm-practice-session',
|
|
14498
|
+
meeting.id
|
|
14499
|
+
);
|
|
14500
|
+
});
|
|
14501
|
+
|
|
14502
|
+
it('does not call setDatachannelToken when no tokens are present', () => {
|
|
14503
|
+
meeting.saveDataChannelToken({locus: {self: {}}});
|
|
14504
|
+
|
|
14505
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14506
|
+
});
|
|
14507
|
+
|
|
14508
|
+
it('handles undefined join gracefully', () => {
|
|
14509
|
+
meeting.saveDataChannelToken(undefined);
|
|
14510
|
+
|
|
14511
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14512
|
+
});
|
|
14513
|
+
|
|
14514
|
+
it('handles missing locus.self gracefully', () => {
|
|
14515
|
+
meeting.saveDataChannelToken({locus: {}});
|
|
14516
|
+
|
|
14517
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
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
|
+
});
|
|
14534
|
+
});
|
|
14535
|
+
|
|
14536
|
+
describe('#clearDataChannelToken', () => {
|
|
14537
|
+
beforeEach(() => {
|
|
14538
|
+
webex.internal.llm.clearDatachannelToken = sinon.stub();
|
|
14539
|
+
});
|
|
14540
|
+
|
|
14541
|
+
it('delegates default and practice token clears to llm with meeting ownership id', () => {
|
|
14542
|
+
meeting.clearDataChannelToken();
|
|
14543
|
+
|
|
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);
|
|
14555
|
+
});
|
|
14556
|
+
});
|
|
14557
|
+
|
|
12748
14558
|
describe('#updateLLMConnection', () => {
|
|
12749
14559
|
beforeEach(() => {
|
|
12750
14560
|
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
12751
14561
|
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
12752
14562
|
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
12753
14563
|
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
14564
|
+
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
12754
14565
|
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
12755
14566
|
webex.internal.llm.on = sinon.stub();
|
|
12756
14567
|
webex.internal.llm.off = sinon.stub();
|
|
@@ -12768,7 +14579,7 @@ describe('plugin-meetings', () => {
|
|
|
12768
14579
|
meeting.joinedWith = {state: 'any other state'};
|
|
12769
14580
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12770
14581
|
|
|
12771
|
-
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'}};
|
|
12772
14583
|
|
|
12773
14584
|
const result = await meeting.updateLLMConnection();
|
|
12774
14585
|
|
|
@@ -12780,6 +14591,7 @@ describe('plugin-meetings', () => {
|
|
|
12780
14591
|
it('returns undefined if llm is already connected and the locus url is unchanged', async () => {
|
|
12781
14592
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12782
14593
|
meeting.locusInfo = {
|
|
14594
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12783
14595
|
url: 'a url',
|
|
12784
14596
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12785
14597
|
};
|
|
@@ -12816,7 +14628,7 @@ describe('plugin-meetings', () => {
|
|
|
12816
14628
|
});
|
|
12817
14629
|
it('connects if not already connected', async () => {
|
|
12818
14630
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12819
|
-
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'}};
|
|
12820
14632
|
|
|
12821
14633
|
const result = await meeting.updateLLMConnection();
|
|
12822
14634
|
|
|
@@ -12827,7 +14639,14 @@ describe('plugin-meetings', () => {
|
|
|
12827
14639
|
'a datachannel url',
|
|
12828
14640
|
undefined
|
|
12829
14641
|
);
|
|
14642
|
+
assert.calledOnceWithExactly(
|
|
14643
|
+
webex.internal.llm.setRefreshHandler,
|
|
14644
|
+
sinon.match.func,
|
|
14645
|
+
'llm-default-session',
|
|
14646
|
+
meeting.id
|
|
14647
|
+
);
|
|
12830
14648
|
assert.equal(result, 'something');
|
|
14649
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
12831
14650
|
});
|
|
12832
14651
|
it('disconnects if the locus url has changed', async () => {
|
|
12833
14652
|
meeting.joinedWith = {state: 'JOINED'};
|
|
@@ -12836,6 +14655,7 @@ describe('plugin-meetings', () => {
|
|
|
12836
14655
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12837
14656
|
|
|
12838
14657
|
meeting.locusInfo = {
|
|
14658
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12839
14659
|
url: 'a different url',
|
|
12840
14660
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12841
14661
|
self: {},
|
|
@@ -12846,7 +14666,7 @@ describe('plugin-meetings', () => {
|
|
|
12846
14666
|
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
|
|
12847
14667
|
code: 3050,
|
|
12848
14668
|
reason: 'done (permanent)',
|
|
12849
|
-
});
|
|
14669
|
+
}, 'llm-default-session', meeting.id);
|
|
12850
14670
|
|
|
12851
14671
|
assert.calledWithExactly(
|
|
12852
14672
|
webex.internal.llm.registerAndConnect,
|
|
@@ -12889,6 +14709,7 @@ describe('plugin-meetings', () => {
|
|
|
12889
14709
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12890
14710
|
|
|
12891
14711
|
meeting.locusInfo = {
|
|
14712
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12892
14713
|
url: 'a url',
|
|
12893
14714
|
info: {datachannelUrl: 'a different datachannel url'},
|
|
12894
14715
|
self: {},
|
|
@@ -12899,7 +14720,7 @@ describe('plugin-meetings', () => {
|
|
|
12899
14720
|
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
|
|
12900
14721
|
code: 3050,
|
|
12901
14722
|
reason: 'done (permanent)',
|
|
12902
|
-
});
|
|
14723
|
+
}, 'llm-default-session', meeting.id);
|
|
12903
14724
|
|
|
12904
14725
|
assert.calledWithExactly(
|
|
12905
14726
|
webex.internal.llm.registerAndConnect,
|
|
@@ -12940,14 +14761,14 @@ describe('plugin-meetings', () => {
|
|
|
12940
14761
|
webex.internal.llm.isConnected.returns(true);
|
|
12941
14762
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12942
14763
|
|
|
12943
|
-
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'}};
|
|
12944
14765
|
|
|
12945
14766
|
const result = await meeting.updateLLMConnection();
|
|
12946
14767
|
|
|
12947
14768
|
assert.calledWith(webex.internal.llm.disconnectLLM, {
|
|
12948
14769
|
code: 3050,
|
|
12949
14770
|
reason: 'done (permanent)',
|
|
12950
|
-
});
|
|
14771
|
+
}, 'llm-default-session', meeting.id);
|
|
12951
14772
|
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
12952
14773
|
assert.equal(result, undefined);
|
|
12953
14774
|
assert.isFalse(
|
|
@@ -12963,6 +14784,7 @@ describe('plugin-meetings', () => {
|
|
|
12963
14784
|
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
12964
14785
|
|
|
12965
14786
|
meeting.locusInfo = {
|
|
14787
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12966
14788
|
url: 'a different url',
|
|
12967
14789
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12968
14790
|
self: {},
|
|
@@ -12994,6 +14816,7 @@ describe('plugin-meetings', () => {
|
|
|
12994
14816
|
it('still need connect main session data channel when PS started', async () => {
|
|
12995
14817
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12996
14818
|
meeting.locusInfo = {
|
|
14819
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12997
14820
|
url: 'a url',
|
|
12998
14821
|
info: {
|
|
12999
14822
|
datachannelUrl: 'a datachannel url',
|
|
@@ -13011,15 +14834,17 @@ describe('plugin-meetings', () => {
|
|
|
13011
14834
|
undefined
|
|
13012
14835
|
);
|
|
13013
14836
|
});
|
|
13014
|
-
it('passes dataChannelToken to registerAndConnect', async () => {
|
|
14837
|
+
it('passes dataChannelToken from LLM to registerAndConnect', async () => {
|
|
13015
14838
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13016
14839
|
meeting.locusInfo = {
|
|
14840
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13017
14841
|
url: 'a url',
|
|
13018
14842
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13019
|
-
self: {datachannelToken: 'token-123'},
|
|
13020
14843
|
};
|
|
13021
14844
|
|
|
13022
|
-
webex.internal.llm.getDatachannelToken
|
|
14845
|
+
webex.internal.llm.getDatachannelToken
|
|
14846
|
+
.withArgs('llm-default-session', meeting.id)
|
|
14847
|
+
.returns('token-123');
|
|
13023
14848
|
|
|
13024
14849
|
await meeting.updateLLMConnection();
|
|
13025
14850
|
|
|
@@ -13029,17 +14854,17 @@ describe('plugin-meetings', () => {
|
|
|
13029
14854
|
'a datachannel url',
|
|
13030
14855
|
'token-123'
|
|
13031
14856
|
);
|
|
13032
|
-
assert.
|
|
14857
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
13033
14858
|
});
|
|
13034
|
-
it('
|
|
14859
|
+
it('passes undefined token when LLM has no token stored', async () => {
|
|
13035
14860
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13036
14861
|
meeting.locusInfo = {
|
|
14862
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13037
14863
|
url: 'a url',
|
|
13038
14864
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13039
|
-
self: {datachannelToken: 'locus-token'},
|
|
13040
14865
|
};
|
|
13041
14866
|
|
|
13042
|
-
webex.internal.llm.getDatachannelToken.
|
|
14867
|
+
webex.internal.llm.getDatachannelToken.returns(undefined);
|
|
13043
14868
|
|
|
13044
14869
|
await meeting.updateLLMConnection();
|
|
13045
14870
|
|
|
@@ -13047,7 +14872,7 @@ describe('plugin-meetings', () => {
|
|
|
13047
14872
|
webex.internal.llm.registerAndConnect,
|
|
13048
14873
|
'a url',
|
|
13049
14874
|
'a datachannel url',
|
|
13050
|
-
|
|
14875
|
+
undefined
|
|
13051
14876
|
);
|
|
13052
14877
|
|
|
13053
14878
|
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
@@ -13056,9 +14881,9 @@ describe('plugin-meetings', () => {
|
|
|
13056
14881
|
it('does not pass token when data channel with jwt token is disabled', async () => {
|
|
13057
14882
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13058
14883
|
meeting.locusInfo = {
|
|
14884
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13059
14885
|
url: 'a url',
|
|
13060
14886
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13061
|
-
self: {datachannelToken: 'token-123'},
|
|
13062
14887
|
};
|
|
13063
14888
|
|
|
13064
14889
|
webex.internal.llm.getDatachannelToken.returns(undefined);
|
|
@@ -13070,9 +14895,200 @@ describe('plugin-meetings', () => {
|
|
|
13070
14895
|
webex.internal.llm.registerAndConnect,
|
|
13071
14896
|
'a url',
|
|
13072
14897
|
'a datachannel url',
|
|
13073
|
-
|
|
14898
|
+
undefined
|
|
13074
14899
|
);
|
|
13075
|
-
assert.
|
|
14900
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14901
|
+
});
|
|
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
|
+
});
|
|
13076
15092
|
});
|
|
13077
15093
|
|
|
13078
15094
|
describe('#clearMeetingData', () => {
|
|
@@ -13083,7 +15099,7 @@ describe('plugin-meetings', () => {
|
|
|
13083
15099
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
13084
15100
|
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
13085
15101
|
meeting.stopTranscription = sinon.stub();
|
|
13086
|
-
meeting.
|
|
15102
|
+
meeting.clearDataChannelToken = sinon.stub();
|
|
13087
15103
|
meeting.shareStatus = 'no-share';
|
|
13088
15104
|
});
|
|
13089
15105
|
|
|
@@ -13093,7 +15109,7 @@ describe('plugin-meetings', () => {
|
|
|
13093
15109
|
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
13094
15110
|
code: 3050,
|
|
13095
15111
|
reason: 'done (permanent)',
|
|
13096
|
-
});
|
|
15112
|
+
}, 'llm-default-session', meeting.id);
|
|
13097
15113
|
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
13098
15114
|
assert.calledWithExactly(
|
|
13099
15115
|
webex.internal.llm.off,
|
|
@@ -13106,8 +15122,13 @@ describe('plugin-meetings', () => {
|
|
|
13106
15122
|
meeting.processLocusLLMEvent
|
|
13107
15123
|
);
|
|
13108
15124
|
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
13109
|
-
assert.calledOnce(meeting.
|
|
13110
|
-
|
|
15125
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
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);
|
|
13111
15132
|
});
|
|
13112
15133
|
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
13113
15134
|
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
@@ -13126,8 +15147,65 @@ describe('plugin-meetings', () => {
|
|
|
13126
15147
|
meeting.processLocusLLMEvent
|
|
13127
15148
|
);
|
|
13128
15149
|
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
13129
|
-
assert.calledOnce(meeting.
|
|
13130
|
-
assert.
|
|
15150
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15151
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15152
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15153
|
+
});
|
|
15154
|
+
|
|
15155
|
+
describe('ownership tag', () => {
|
|
15156
|
+
beforeEach(() => {
|
|
15157
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15158
|
+
});
|
|
15159
|
+
|
|
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
|
+
});
|
|
13131
15209
|
});
|
|
13132
15210
|
});
|
|
13133
15211
|
});
|
|
@@ -13167,6 +15245,71 @@ describe('plugin-meetings', () => {
|
|
|
13167
15245
|
});
|
|
13168
15246
|
});
|
|
13169
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
|
+
|
|
13170
15313
|
describe('preferred video device', () => {
|
|
13171
15314
|
describe('#getVideoDeviceId', () => {
|
|
13172
15315
|
it('returns the preferred video device', () => {
|
|
@@ -14881,16 +17024,25 @@ describe('plugin-meetings', () => {
|
|
|
14881
17024
|
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
14882
17025
|
});
|
|
14883
17026
|
|
|
14884
|
-
it('should
|
|
17027
|
+
it('should send a custom reaction type not in the known list', async () => {
|
|
14885
17028
|
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
14886
17029
|
|
|
14887
|
-
|
|
14888
|
-
meeting.sendReaction('invalid_reaction', 'light'),
|
|
14889
|
-
Error,
|
|
14890
|
-
'invalid_reaction is not a valid reaction.'
|
|
14891
|
-
);
|
|
17030
|
+
const reactionPromise = meeting.sendReaction('custom_reaction', 'light');
|
|
14892
17031
|
|
|
14893
|
-
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
|
+
});
|
|
14894
17046
|
});
|
|
14895
17047
|
|
|
14896
17048
|
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|
|
@@ -15914,4 +18066,4 @@ describe('plugin-meetings', () => {
|
|
|
15914
18066
|
assert.calledOnceWithExactly(meeting.meetingRequest.cancelSipCallOut, participantId);
|
|
15915
18067
|
});
|
|
15916
18068
|
});
|
|
15917
|
-
});
|
|
18069
|
+
});
|