@webex/plugin-meetings 3.12.0-next.16 → 3.12.0-next.160
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/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +135 -0
- package/ai-docs/ARCHITECTURE.md +207 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/dist/aiEnableRequest/index.js +15 -2
- package/dist/aiEnableRequest/index.js.map +1 -1
- package/dist/annotation/index.js +2 -2
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/events.js +29 -14
- package/dist/breakouts/events.js.map +1 -1
- package/dist/breakouts/index.js +99 -4
- 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 +37 -10
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +46 -10
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/hashTree/constants.js +4 -1
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1096 -391
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/utils.js +20 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +75 -15
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +24 -9
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +55 -12
- 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 +615 -176
- 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 +20 -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 +4 -5
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +7 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +1688 -835
- 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 +37 -3
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +9 -3
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +300 -128
- 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 +7 -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/remoteMediaManager.js +32 -4
- package/dist/multistream/remoteMediaManager.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 +13 -1
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +1 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
- package/dist/types/hashTree/utils.d.ts +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +106 -8
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +22 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
- package/dist/types/media/properties.d.ts +6 -2
- package/dist/types/meeting/in-meeting-actions.d.ts +6 -0
- package/dist/types/meeting/index.d.ts +176 -11
- 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/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +40 -19
- 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 +6 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- 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 +307 -161
- package/dist/webinar/index.js.map +1 -1
- package/package.json +23 -23
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/aiEnableRequest/index.ts +16 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +6 -4
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +122 -2
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +2 -2
- package/src/constants.ts +21 -3
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/controls-options-manager/index.ts +62 -10
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/constants.ts +7 -0
- package/src/hashTree/hashTreeParser.ts +861 -193
- package/src/hashTree/utils.ts +19 -0
- package/src/index.ts +6 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +88 -12
- package/src/interceptors/locusRetry.ts +26 -5
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +65 -10
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/controlsUtils.ts +3 -1
- package/src/locus-info/index.ts +566 -164
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/types.ts +26 -1
- package/src/media/MediaConnectionAwaiter.ts +21 -4
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +8 -3
- package/src/meeting/ai-docs/meeting-spec.md +401 -0
- package/src/meeting/in-meeting-actions.ts +12 -0
- package/src/meeting/index.ts +946 -120
- 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 +51 -7
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +10 -4
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +200 -80
- 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/ai-docs/member-spec.md +196 -0
- package/src/member/index.ts +10 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +29 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/metrics/constants.ts +6 -0
- package/src/multistream/ai-docs/multistream-spec.md +292 -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/remoteMediaManager.ts +23 -1
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reactions/reactions.type.ts +3 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +216 -38
- package/test/unit/spec/aiEnableRequest/index.ts +86 -0
- package/test/unit/spec/annotation/index.ts +3 -3
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/events.ts +120 -2
- package/test/unit/spec/breakouts/index.ts +223 -3
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +139 -32
- package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
- package/test/unit/spec/hashTree/utils.ts +37 -0
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
- package/test/unit/spec/interceptors/locusRetry.ts +234 -5
- package/test/unit/spec/interpretation/index.ts +119 -4
- package/test/unit/spec/locus-info/controlsUtils.js +172 -57
- package/test/unit/spec/locus-info/index.js +1014 -58
- 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/media/properties.ts +23 -23
- package/test/unit/spec/meeting/in-meeting-actions.ts +6 -0
- package/test/unit/spec/meeting/index.js +2838 -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 +189 -17
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +76 -10
- package/test/unit/spec/meetings/index.js +544 -49
- 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/remoteMediaManager.ts +46 -0
- 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 +332 -31
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
ONLINE,
|
|
35
35
|
OFFLINE,
|
|
36
36
|
ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT,
|
|
37
|
+
LOCUS_LLM_EVENT,
|
|
38
|
+
LLM_PRACTICE_SESSION,
|
|
39
|
+
RECORDING_STATE,
|
|
37
40
|
} from '@webex/plugin-meetings/src/constants';
|
|
38
41
|
import {
|
|
39
42
|
ConnectionState,
|
|
@@ -91,6 +94,7 @@ import {
|
|
|
91
94
|
MeetingNotActiveError,
|
|
92
95
|
UserInLobbyError,
|
|
93
96
|
AddMediaFailed,
|
|
97
|
+
MediaConnectionTimedOutError,
|
|
94
98
|
} from '../../../../src/common/errors/webex-errors';
|
|
95
99
|
import WebExMeetingsErrors from '../../../../src/common/errors/webex-meetings-error';
|
|
96
100
|
import ParameterError from '../../../../src/common/errors/parameter';
|
|
@@ -261,11 +265,26 @@ describe('plugin-meetings', () => {
|
|
|
261
265
|
webex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
262
266
|
webex.meetings.reachability = {
|
|
263
267
|
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
268
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
264
269
|
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
265
270
|
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
266
271
|
stopReachability: sinon.stub(),
|
|
267
272
|
isSubnetReachable: sinon.stub().returns(true),
|
|
268
273
|
};
|
|
274
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
275
|
+
.stub()
|
|
276
|
+
.callsFake((ownerMeetingId, sessionId) => {
|
|
277
|
+
const currentOwner = webex.internal.llm.getOwnerMeetingId
|
|
278
|
+
? webex.internal.llm.getOwnerMeetingId(sessionId)
|
|
279
|
+
: undefined;
|
|
280
|
+
const canAssertOwnership = !!ownerMeetingId;
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
currentOwner,
|
|
284
|
+
canAssertOwnership,
|
|
285
|
+
isOwner: !currentOwner || !canAssertOwnership || currentOwner === ownerMeetingId,
|
|
286
|
+
};
|
|
287
|
+
});
|
|
269
288
|
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
270
289
|
webex.internal.llm.on = sinon.stub();
|
|
271
290
|
webex.internal.voicea.announce = sinon.stub();
|
|
@@ -417,6 +436,161 @@ describe('plugin-meetings', () => {
|
|
|
417
436
|
assert.instanceOf(meeting.mediaRequestManagers.screenShareVideo, MediaRequestManager);
|
|
418
437
|
});
|
|
419
438
|
|
|
439
|
+
it('getIngressPayloadType on webrtcMediaConnection is invoked for H264 when sending multistream video requests', () => {
|
|
440
|
+
const getIngressPayloadType = sinon.stub().returns(97);
|
|
441
|
+
|
|
442
|
+
meeting.isMultistream = true;
|
|
443
|
+
meeting.mediaProperties.webrtcMediaConnection = {
|
|
444
|
+
getIngressPayloadType,
|
|
445
|
+
requestMedia: sinon.stub(),
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const fakeReceiveSlot = {
|
|
449
|
+
on: sinon.stub(),
|
|
450
|
+
off: sinon.stub(),
|
|
451
|
+
sourceState: 'live',
|
|
452
|
+
mediaType: MediaType.VideoMain,
|
|
453
|
+
wcmeReceiveSlot: {id: 'fake-wcme-slot'},
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
meeting.mediaRequestManagers.video.addRequest(
|
|
457
|
+
{
|
|
458
|
+
policyInfo: {
|
|
459
|
+
policy: 'receiver-selected',
|
|
460
|
+
csi: 42,
|
|
461
|
+
},
|
|
462
|
+
receiveSlots: [fakeReceiveSlot],
|
|
463
|
+
codecInfo: {
|
|
464
|
+
codec: 'h264',
|
|
465
|
+
maxFs: 3600,
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
true
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
assert.calledOnceWithExactly(
|
|
472
|
+
getIngressPayloadType,
|
|
473
|
+
MediaType.VideoMain,
|
|
474
|
+
MediaCodecMimeType.H264
|
|
475
|
+
);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('getIngressPayloadType on webrtcMediaConnection is invoked for H264 and AV1 for slides video when AV1 slides support is enabled', () => {
|
|
479
|
+
const localWebex = new MockWebex({
|
|
480
|
+
children: {
|
|
481
|
+
meetings: Meetings,
|
|
482
|
+
credentials: Credentials,
|
|
483
|
+
support: Support,
|
|
484
|
+
llm: LLM,
|
|
485
|
+
mercury: Mercury,
|
|
486
|
+
},
|
|
487
|
+
config: {
|
|
488
|
+
credentials: {
|
|
489
|
+
client_id: 'mock-client-id',
|
|
490
|
+
},
|
|
491
|
+
meetings: {
|
|
492
|
+
reconnection: {
|
|
493
|
+
enabled: false,
|
|
494
|
+
},
|
|
495
|
+
mediaSettings: {},
|
|
496
|
+
metrics: {},
|
|
497
|
+
stats: {},
|
|
498
|
+
experimental: {enableUnifiedMeetings: true},
|
|
499
|
+
degradationPreferences: {maxMacroblocksLimit: 8192},
|
|
500
|
+
enableAv1SlidesSupport: true,
|
|
501
|
+
},
|
|
502
|
+
metrics: {
|
|
503
|
+
type: ['behavioral'],
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
localWebex.internal.newMetrics.callDiagnosticMetrics.clearErrorCache = sinon.stub();
|
|
509
|
+
localWebex.internal.newMetrics.callDiagnosticMetrics.clearEventLimitsForCorrelationId =
|
|
510
|
+
sinon.stub();
|
|
511
|
+
localWebex.internal.support.submitLogs = sinon.stub().returns(Promise.resolve());
|
|
512
|
+
localWebex.internal.services = {get: sinon.stub().returns('locus-url')};
|
|
513
|
+
localWebex.credentials.getOrgId = sinon.stub().returns('fake-org-id');
|
|
514
|
+
localWebex.internal.metrics.submitClientMetrics = sinon.stub().returns(Promise.resolve());
|
|
515
|
+
localWebex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
516
|
+
localWebex.meetings.reachability = {
|
|
517
|
+
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
518
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
519
|
+
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
520
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
521
|
+
stopReachability: sinon.stub(),
|
|
522
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
523
|
+
};
|
|
524
|
+
localWebex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
525
|
+
localWebex.internal.llm.on = sinon.stub();
|
|
526
|
+
localWebex.internal.voicea.announce = sinon.stub();
|
|
527
|
+
localWebex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
528
|
+
{},
|
|
529
|
+
{parent: localWebex}
|
|
530
|
+
);
|
|
531
|
+
|
|
532
|
+
Metrics.initialSetup(localWebex);
|
|
533
|
+
|
|
534
|
+
const localMeeting = new Meeting(
|
|
535
|
+
{
|
|
536
|
+
userId: uuid1,
|
|
537
|
+
resource: uuid2,
|
|
538
|
+
deviceUrl: uuid3,
|
|
539
|
+
locus: {url: url1},
|
|
540
|
+
destination: testDestination,
|
|
541
|
+
destinationType: DESTINATION_TYPE.MEETING_ID,
|
|
542
|
+
correlationId,
|
|
543
|
+
selfId: uuid1,
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
parent: localWebex,
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
const getIngressPayloadType = sinon.stub().callsFake((_mediaType, codecMimeType) => {
|
|
551
|
+
if (codecMimeType === MediaCodecMimeType.H264) {
|
|
552
|
+
return 97;
|
|
553
|
+
}
|
|
554
|
+
if (codecMimeType === MediaCodecMimeType.AV1) {
|
|
555
|
+
return 98;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return undefined;
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
localMeeting.isMultistream = true;
|
|
562
|
+
localMeeting.mediaProperties.webrtcMediaConnection = {
|
|
563
|
+
getIngressPayloadType,
|
|
564
|
+
requestMedia: sinon.stub(),
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const fakeReceiveSlot = {
|
|
568
|
+
on: sinon.stub(),
|
|
569
|
+
off: sinon.stub(),
|
|
570
|
+
sourceState: 'live',
|
|
571
|
+
mediaType: MediaType.VideoSlides,
|
|
572
|
+
wcmeReceiveSlot: {id: 'fake-wcme-slides-slot'},
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
localMeeting.mediaRequestManagers.screenShareVideo.addRequest(
|
|
576
|
+
{
|
|
577
|
+
policyInfo: {
|
|
578
|
+
policy: 'receiver-selected',
|
|
579
|
+
csi: 42,
|
|
580
|
+
},
|
|
581
|
+
receiveSlots: [fakeReceiveSlot],
|
|
582
|
+
codecInfo: {
|
|
583
|
+
codec: 'h264',
|
|
584
|
+
maxFs: 3600,
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
true
|
|
588
|
+
);
|
|
589
|
+
|
|
590
|
+
assert.calledWith(getIngressPayloadType, MediaType.VideoSlides, MediaCodecMimeType.H264);
|
|
591
|
+
assert.calledWith(getIngressPayloadType, MediaType.VideoSlides, MediaCodecMimeType.AV1);
|
|
592
|
+
});
|
|
593
|
+
|
|
420
594
|
it('uses meeting id as correlation id if not provided in constructor', () => {
|
|
421
595
|
const newMeeting = new Meeting(
|
|
422
596
|
{
|
|
@@ -712,6 +886,81 @@ describe('plugin-meetings', () => {
|
|
|
712
886
|
assert.deepEqual(args, [[uuid1], locusUrls]);
|
|
713
887
|
});
|
|
714
888
|
});
|
|
889
|
+
describe('#transfer', () => {
|
|
890
|
+
it('should have #transfer', () => {
|
|
891
|
+
assert.exists(meeting.transfer);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
it('should transfer host using the current locus when the target member is in the current session', async () => {
|
|
895
|
+
sinon
|
|
896
|
+
.stub(meeting.members.membersCollection, 'get')
|
|
897
|
+
.withArgs(uuid2)
|
|
898
|
+
.returns({isInMeeting: true});
|
|
899
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
900
|
+
|
|
901
|
+
await meeting.transfer(uuid2, false);
|
|
902
|
+
|
|
903
|
+
assert.calledOnceWithExactly(meeting.members.transferHostToMember, uuid2, false);
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
it('should transfer host using breakout locus when the target member is joined in a breakout session', async () => {
|
|
907
|
+
sinon
|
|
908
|
+
.stub(meeting.members.membersCollection, 'get')
|
|
909
|
+
.withArgs(uuid2)
|
|
910
|
+
.returns({isInMeeting: false});
|
|
911
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
912
|
+
meeting.breakouts.breakouts = {
|
|
913
|
+
models: [
|
|
914
|
+
{
|
|
915
|
+
members: {
|
|
916
|
+
membersCollection: {
|
|
917
|
+
get: sinon.stub().withArgs(uuid2).returns({isInMeeting: true}),
|
|
918
|
+
},
|
|
919
|
+
},
|
|
920
|
+
breakoutRosterLocus: {url: 'https://example.com/breakout-locus'},
|
|
921
|
+
},
|
|
922
|
+
],
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
await meeting.transfer(uuid2, false);
|
|
926
|
+
|
|
927
|
+
assert.calledOnceWithExactly(
|
|
928
|
+
meeting.members.transferHostToMember,
|
|
929
|
+
uuid2,
|
|
930
|
+
false,
|
|
931
|
+
'https://example.com/breakout-locus'
|
|
932
|
+
);
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
it('should not use breakout locus when the breakout member is not in meeting', async () => {
|
|
936
|
+
sinon
|
|
937
|
+
.stub(meeting.members.membersCollection, 'get')
|
|
938
|
+
.withArgs(uuid2)
|
|
939
|
+
.returns({isInMeeting: false});
|
|
940
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
941
|
+
meeting.breakouts.breakouts = {
|
|
942
|
+
models: [
|
|
943
|
+
{
|
|
944
|
+
members: {
|
|
945
|
+
membersCollection: {
|
|
946
|
+
get: sinon.stub().withArgs(uuid2).returns({isInMeeting: false}),
|
|
947
|
+
},
|
|
948
|
+
},
|
|
949
|
+
breakoutRosterLocus: {url: 'https://example.com/breakout-locus'},
|
|
950
|
+
},
|
|
951
|
+
],
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
await meeting.transfer(uuid2, false);
|
|
955
|
+
|
|
956
|
+
assert.calledOnceWithExactly(
|
|
957
|
+
meeting.members.transferHostToMember,
|
|
958
|
+
uuid2,
|
|
959
|
+
false,
|
|
960
|
+
undefined
|
|
961
|
+
);
|
|
962
|
+
});
|
|
963
|
+
});
|
|
715
964
|
describe('#getMembers', () => {
|
|
716
965
|
it('should have #getMembers', () => {
|
|
717
966
|
assert.exists(meeting.getMembers);
|
|
@@ -741,6 +990,8 @@ describe('plugin-meetings', () => {
|
|
|
741
990
|
let addMediaInternalStub;
|
|
742
991
|
let supportsRTCPeerConnectionStub;
|
|
743
992
|
|
|
993
|
+
let suspendDestroyMeetingStub;
|
|
994
|
+
|
|
744
995
|
beforeEach(() => {
|
|
745
996
|
supportsRTCPeerConnectionStub = sinon
|
|
746
997
|
.stub(WebCapabilities, 'supportsRTCPeerConnection')
|
|
@@ -761,6 +1012,7 @@ describe('plugin-meetings', () => {
|
|
|
761
1012
|
.stub(meeting.roap, 'handleTurnDiscoveryHttpResponse')
|
|
762
1013
|
.resolves({turnServerInfo: fakeTurnServerInfo, turnDiscoverySkippedReason: undefined});
|
|
763
1014
|
abortTurnDiscoveryStub = sinon.stub(meeting.roap, 'abortTurnDiscovery');
|
|
1015
|
+
suspendDestroyMeetingStub = sinon.stub(meeting.locusInfo, 'suspendDestroyMeeting');
|
|
764
1016
|
});
|
|
765
1017
|
|
|
766
1018
|
it('should work as expected', async () => {
|
|
@@ -783,8 +1035,9 @@ describe('plugin-meetings', () => {
|
|
|
783
1035
|
assert.calledOnceWithExactly(
|
|
784
1036
|
meeting.addMediaInternal,
|
|
785
1037
|
sinon.match.any,
|
|
786
|
-
fakeTurnServerInfo,
|
|
787
1038
|
false,
|
|
1039
|
+
fakeTurnServerInfo,
|
|
1040
|
+
undefined,
|
|
788
1041
|
mediaOptions
|
|
789
1042
|
);
|
|
790
1043
|
|
|
@@ -792,9 +1045,14 @@ describe('plugin-meetings', () => {
|
|
|
792
1045
|
|
|
793
1046
|
// resets joinWithMediaRetryInfo
|
|
794
1047
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
795
|
-
|
|
1048
|
+
retryCount: 0,
|
|
796
1049
|
prevJoinResponse: undefined,
|
|
797
1050
|
});
|
|
1051
|
+
|
|
1052
|
+
// suspendDestroyMeeting should be called with true at start and false on success
|
|
1053
|
+
assert.calledTwice(suspendDestroyMeetingStub);
|
|
1054
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1055
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, false);
|
|
798
1056
|
});
|
|
799
1057
|
|
|
800
1058
|
it("should not call handleTurnDiscoveryHttpResponse if we don't send a TURN discovery request with join", async () => {
|
|
@@ -816,8 +1074,9 @@ describe('plugin-meetings', () => {
|
|
|
816
1074
|
assert.calledOnceWithExactly(
|
|
817
1075
|
meeting.addMediaInternal,
|
|
818
1076
|
sinon.match.any,
|
|
819
|
-
undefined,
|
|
820
1077
|
false,
|
|
1078
|
+
undefined,
|
|
1079
|
+
undefined,
|
|
821
1080
|
mediaOptions
|
|
822
1081
|
);
|
|
823
1082
|
|
|
@@ -851,8 +1110,9 @@ describe('plugin-meetings', () => {
|
|
|
851
1110
|
assert.calledOnceWithExactly(
|
|
852
1111
|
meeting.addMediaInternal,
|
|
853
1112
|
sinon.match.any,
|
|
854
|
-
undefined,
|
|
855
1113
|
false,
|
|
1114
|
+
undefined,
|
|
1115
|
+
undefined,
|
|
856
1116
|
mediaOptions
|
|
857
1117
|
);
|
|
858
1118
|
|
|
@@ -864,7 +1124,12 @@ describe('plugin-meetings', () => {
|
|
|
864
1124
|
meeting.join = sinon.stub().returns(Promise.reject(error));
|
|
865
1125
|
meeting.locusUrl = null; // when join fails, we end up with null locusUrl
|
|
866
1126
|
|
|
867
|
-
await assert.isRejected(
|
|
1127
|
+
const thrownError = await assert.isRejected(
|
|
1128
|
+
meeting.joinWithMedia({mediaOptions: {allowMediaInLobby: true}})
|
|
1129
|
+
);
|
|
1130
|
+
|
|
1131
|
+
// should throw the first attempt's error
|
|
1132
|
+
assert.equal(thrownError, error);
|
|
868
1133
|
|
|
869
1134
|
assert.calledTwice(abortTurnDiscoveryStub);
|
|
870
1135
|
|
|
@@ -902,11 +1167,158 @@ describe('plugin-meetings', () => {
|
|
|
902
1167
|
|
|
903
1168
|
// resets joinWithMediaRetryInfo
|
|
904
1169
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
905
|
-
|
|
1170
|
+
retryCount: 0,
|
|
1171
|
+
prevJoinResponse: undefined,
|
|
1172
|
+
firstError: undefined,
|
|
1173
|
+
prevError: undefined,
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
// suspendDestroyMeeting(true) called at start of each attempt, (false) only on final failure
|
|
1177
|
+
// 1st attempt: suspendDestroyMeeting(true), 2nd attempt (retry): suspendDestroyMeeting(true), final failure: suspendDestroyMeeting(false)
|
|
1178
|
+
assert.calledThrice(suspendDestroyMeetingStub);
|
|
1179
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1180
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, true);
|
|
1181
|
+
assert.calledWith(suspendDestroyMeetingStub.thirdCall, false);
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
it('should not retry if join() fails because the Locus user capacity is full', async () => {
|
|
1185
|
+
const error = new Error('Error Joining Meeting');
|
|
1186
|
+
error.error = {
|
|
1187
|
+
statusCode: 423,
|
|
1188
|
+
body: {errorCode: 2423001},
|
|
1189
|
+
};
|
|
1190
|
+
meeting.join = sinon.stub().rejects(error);
|
|
1191
|
+
|
|
1192
|
+
const thrownError = await assert.isRejected(
|
|
1193
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1194
|
+
);
|
|
1195
|
+
|
|
1196
|
+
assert.equal(thrownError, error);
|
|
1197
|
+
assert.calledOnce(meeting.join);
|
|
1198
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
1199
|
+
assert.calledOnce(Metrics.sendBehavioralMetric);
|
|
1200
|
+
assert.calledTwice(suspendDestroyMeetingStub);
|
|
1201
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1202
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, false);
|
|
1203
|
+
});
|
|
1204
|
+
|
|
1205
|
+
it('should still retry if join() fails with another HTTP 423 Locus error', async () => {
|
|
1206
|
+
const error = new Error('Error Joining Meeting');
|
|
1207
|
+
error.error = {
|
|
1208
|
+
statusCode: 423,
|
|
1209
|
+
body: {errorCode: 2423028},
|
|
1210
|
+
};
|
|
1211
|
+
meeting.join = sinon.stub().rejects(error);
|
|
1212
|
+
|
|
1213
|
+
const thrownError = await assert.isRejected(
|
|
1214
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1215
|
+
);
|
|
1216
|
+
|
|
1217
|
+
assert.equal(thrownError, error);
|
|
1218
|
+
assert.calledTwice(meeting.join);
|
|
1219
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1220
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
it('should throw the Locus user full error over firstError when the retry hits full capacity', async () => {
|
|
1224
|
+
const firstJoinError = new Error('first join error');
|
|
1225
|
+
const capacityError = new Error('Error Joining Meeting');
|
|
1226
|
+
capacityError.error = {
|
|
1227
|
+
statusCode: 423,
|
|
1228
|
+
body: {errorCode: 2423001},
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
meeting.join = sinon
|
|
1232
|
+
.stub()
|
|
1233
|
+
.onFirstCall()
|
|
1234
|
+
.rejects(firstJoinError)
|
|
1235
|
+
.onSecondCall()
|
|
1236
|
+
.rejects(capacityError);
|
|
1237
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1238
|
+
|
|
1239
|
+
const thrownError = await assert.isRejected(
|
|
1240
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1241
|
+
);
|
|
1242
|
+
|
|
1243
|
+
// join() runs once for the first attempt and once for the re-join
|
|
1244
|
+
assert.calledTwice(meeting.join);
|
|
1245
|
+
// the capacity error must take precedence over the stored firstError
|
|
1246
|
+
assert.equal(thrownError, capacityError);
|
|
1247
|
+
|
|
1248
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1249
|
+
retryCount: 0,
|
|
1250
|
+
prevJoinResponse: undefined,
|
|
1251
|
+
firstError: undefined,
|
|
1252
|
+
prevError: undefined,
|
|
1253
|
+
});
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
it('should re-join on retry when join() fails on first attempt, and throw the first error if join fails again', async () => {
|
|
1257
|
+
const firstJoinError = new Error('first join error');
|
|
1258
|
+
const secondJoinError = new Error('second join error');
|
|
1259
|
+
|
|
1260
|
+
meeting.join = sinon
|
|
1261
|
+
.stub()
|
|
1262
|
+
.onFirstCall()
|
|
1263
|
+
.rejects(firstJoinError)
|
|
1264
|
+
.onSecondCall()
|
|
1265
|
+
.rejects(secondJoinError);
|
|
1266
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1267
|
+
|
|
1268
|
+
const thrownError = await assert.isRejected(
|
|
1269
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1270
|
+
);
|
|
1271
|
+
|
|
1272
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
1273
|
+
assert.calledTwice(meeting.join);
|
|
1274
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1275
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1276
|
+
|
|
1277
|
+
// should throw the first attempt's error, not the second
|
|
1278
|
+
assert.equal(thrownError, firstJoinError);
|
|
1279
|
+
|
|
1280
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1281
|
+
assert.calledWith(
|
|
1282
|
+
Metrics.sendBehavioralMetric.firstCall,
|
|
1283
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1284
|
+
sinon.match({reason: firstJoinError.message, isRetry: false}),
|
|
1285
|
+
sinon.match.any
|
|
1286
|
+
);
|
|
1287
|
+
assert.calledWith(
|
|
1288
|
+
Metrics.sendBehavioralMetric.secondCall,
|
|
1289
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1290
|
+
sinon.match({reason: secondJoinError.message, isRetry: true}),
|
|
1291
|
+
sinon.match.any
|
|
1292
|
+
);
|
|
1293
|
+
|
|
1294
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1295
|
+
retryCount: 0,
|
|
906
1296
|
prevJoinResponse: undefined,
|
|
1297
|
+
firstError: undefined,
|
|
1298
|
+
prevError: undefined,
|
|
907
1299
|
});
|
|
908
1300
|
});
|
|
909
1301
|
|
|
1302
|
+
it('should NOT call join() again on retry when join() succeeded but addMediaInternal() failed', async () => {
|
|
1303
|
+
const addMediaError = new Error('addMedia error');
|
|
1304
|
+
|
|
1305
|
+
meeting.addMediaInternal = sinon
|
|
1306
|
+
.stub()
|
|
1307
|
+
.onFirstCall()
|
|
1308
|
+
.rejects(addMediaError)
|
|
1309
|
+
.onSecondCall()
|
|
1310
|
+
.resolves(test4);
|
|
1311
|
+
|
|
1312
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1313
|
+
|
|
1314
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1315
|
+
|
|
1316
|
+
// join() should only be called once — the successful join result is reused on retry
|
|
1317
|
+
assert.calledOnce(meeting.join);
|
|
1318
|
+
// TURN discovery request is only generated once (on the first attempt alongside join)
|
|
1319
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
1320
|
+
});
|
|
1321
|
+
|
|
910
1322
|
it('should resolve if join() fails the first time but succeeds the second time', async () => {
|
|
911
1323
|
const error = new Error('fake');
|
|
912
1324
|
meeting.join = sinon
|
|
@@ -948,7 +1360,7 @@ describe('plugin-meetings', () => {
|
|
|
948
1360
|
|
|
949
1361
|
// resets joinWithMediaRetryInfo
|
|
950
1362
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
951
|
-
|
|
1363
|
+
retryCount: 0,
|
|
952
1364
|
prevJoinResponse: undefined,
|
|
953
1365
|
});
|
|
954
1366
|
});
|
|
@@ -1017,6 +1429,127 @@ describe('plugin-meetings', () => {
|
|
|
1017
1429
|
);
|
|
1018
1430
|
});
|
|
1019
1431
|
|
|
1432
|
+
it('should throw the first attempt error when retry also fails with a different error', async () => {
|
|
1433
|
+
const firstError = new Error('first attempt error');
|
|
1434
|
+
const secondError = new Error('second attempt error');
|
|
1435
|
+
|
|
1436
|
+
const addMediaInternalResults = [];
|
|
1437
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1438
|
+
const defer = new Defer();
|
|
1439
|
+
addMediaInternalResults.push(defer);
|
|
1440
|
+
return defer.promise;
|
|
1441
|
+
});
|
|
1442
|
+
|
|
1443
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1444
|
+
|
|
1445
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1446
|
+
|
|
1447
|
+
await testUtils.flushPromises();
|
|
1448
|
+
|
|
1449
|
+
// 1st attempt fails
|
|
1450
|
+
addMediaInternalResults[0].reject(firstError);
|
|
1451
|
+
await testUtils.flushPromises();
|
|
1452
|
+
|
|
1453
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1454
|
+
assert.notCalled(leaveStub);
|
|
1455
|
+
|
|
1456
|
+
// 2nd (final) attempt fails
|
|
1457
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1458
|
+
const thrownError = await assert.isRejected(result);
|
|
1459
|
+
|
|
1460
|
+
// should throw the first error, not the second
|
|
1461
|
+
assert.equal(thrownError, firstError);
|
|
1462
|
+
|
|
1463
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1464
|
+
assert.calledOnce(leaveStub);
|
|
1465
|
+
|
|
1466
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1467
|
+
});
|
|
1468
|
+
|
|
1469
|
+
it('should throw the UserNotJoinedError as firstError when it occurs on the 1st attempt and 2nd attempt fails differently', async () => {
|
|
1470
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1471
|
+
const secondError = new Error('second attempt error');
|
|
1472
|
+
|
|
1473
|
+
const addMediaInternalResults = [];
|
|
1474
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1475
|
+
const defer = new Defer();
|
|
1476
|
+
addMediaInternalResults.push(defer);
|
|
1477
|
+
return defer.promise;
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1481
|
+
|
|
1482
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1483
|
+
|
|
1484
|
+
await testUtils.flushPromises();
|
|
1485
|
+
|
|
1486
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1487
|
+
addMediaInternalResults[0].reject(userNotJoinedError);
|
|
1488
|
+
await testUtils.flushPromises();
|
|
1489
|
+
|
|
1490
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1491
|
+
assert.notCalled(leaveStub);
|
|
1492
|
+
|
|
1493
|
+
// 2nd (final) attempt fails
|
|
1494
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1495
|
+
const thrownError = await assert.isRejected(result);
|
|
1496
|
+
|
|
1497
|
+
// should throw the first (UserNotJoinedError), not the second
|
|
1498
|
+
assert.equal(thrownError, userNotJoinedError);
|
|
1499
|
+
|
|
1500
|
+
// join() called twice: original + re-join triggered by UserNotJoinedError in prevError
|
|
1501
|
+
assert.calledTwice(meeting.join);
|
|
1502
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1503
|
+
assert.calledOnce(leaveStub);
|
|
1504
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
it('should throw the first UserNotJoinedError when it occurs on both 1st and 2nd attempts and a 3rd attempt also fails', async () => {
|
|
1508
|
+
const firstUserNotJoinedError = new UserNotJoinedError('first');
|
|
1509
|
+
const secondUserNotJoinedError = new UserNotJoinedError('second');
|
|
1510
|
+
const thirdError = new Error('third attempt error');
|
|
1511
|
+
|
|
1512
|
+
const addMediaInternalResults = [];
|
|
1513
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1514
|
+
const defer = new Defer();
|
|
1515
|
+
addMediaInternalResults.push(defer);
|
|
1516
|
+
return defer.promise;
|
|
1517
|
+
});
|
|
1518
|
+
|
|
1519
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1520
|
+
|
|
1521
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1522
|
+
|
|
1523
|
+
await testUtils.flushPromises();
|
|
1524
|
+
|
|
1525
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1526
|
+
addMediaInternalResults[0].reject(firstUserNotJoinedError);
|
|
1527
|
+
await testUtils.flushPromises();
|
|
1528
|
+
|
|
1529
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1530
|
+
assert.notCalled(leaveStub);
|
|
1531
|
+
|
|
1532
|
+
// 2nd attempt fails with UserNotJoinedError again — triggers another re-join
|
|
1533
|
+
addMediaInternalResults[1].reject(secondUserNotJoinedError);
|
|
1534
|
+
await testUtils.flushPromises();
|
|
1535
|
+
|
|
1536
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1537
|
+
assert.notCalled(leaveStub);
|
|
1538
|
+
|
|
1539
|
+
// 3rd (final) attempt fails
|
|
1540
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1541
|
+
const thrownError = await assert.isRejected(result);
|
|
1542
|
+
|
|
1543
|
+
// should throw the very first error across all 3 attempts
|
|
1544
|
+
assert.equal(thrownError, firstUserNotJoinedError);
|
|
1545
|
+
|
|
1546
|
+
// join() called 3 times: original + 2 re-joins triggered by prevError being UserNotJoinedError
|
|
1547
|
+
assert.calledThrice(meeting.join);
|
|
1548
|
+
// leave() should only be called after the last (3rd) attempt
|
|
1549
|
+
assert.calledOnce(leaveStub);
|
|
1550
|
+
assert.calledThrice(Metrics.sendBehavioralMetric);
|
|
1551
|
+
});
|
|
1552
|
+
|
|
1020
1553
|
it('should call leave() if addMediaInternal() fails with a browser media error (TypeError)', async () => {
|
|
1021
1554
|
const addMediaError = new Error('fake addMedia error');
|
|
1022
1555
|
addMediaError.name = 'TypeError'; // This makes it a browser media error
|
|
@@ -1212,8 +1745,9 @@ describe('plugin-meetings', () => {
|
|
|
1212
1745
|
assert.calledWith(
|
|
1213
1746
|
meeting.addMediaInternal.firstCall,
|
|
1214
1747
|
sinon.match.any,
|
|
1215
|
-
fakeTurnServerInfo,
|
|
1216
1748
|
false,
|
|
1749
|
+
fakeTurnServerInfo,
|
|
1750
|
+
undefined,
|
|
1217
1751
|
mediaOptions
|
|
1218
1752
|
);
|
|
1219
1753
|
|
|
@@ -1221,8 +1755,9 @@ describe('plugin-meetings', () => {
|
|
|
1221
1755
|
assert.calledWith(
|
|
1222
1756
|
meeting.addMediaInternal.secondCall,
|
|
1223
1757
|
sinon.match.any,
|
|
1224
|
-
undefined,
|
|
1225
1758
|
true,
|
|
1759
|
+
undefined,
|
|
1760
|
+
undefined,
|
|
1226
1761
|
mediaOptions
|
|
1227
1762
|
);
|
|
1228
1763
|
|
|
@@ -1240,7 +1775,7 @@ describe('plugin-meetings', () => {
|
|
|
1240
1775
|
|
|
1241
1776
|
meeting.addMediaInternal = sinon
|
|
1242
1777
|
.stub()
|
|
1243
|
-
.callsFake((icePhaseCallback,
|
|
1778
|
+
.callsFake((icePhaseCallback, _forceTurnDiscovery, _turnServerInfo) => {
|
|
1244
1779
|
const defer = new Defer();
|
|
1245
1780
|
|
|
1246
1781
|
icePhaseCallbacks.push(icePhaseCallback);
|
|
@@ -1259,19 +1794,130 @@ describe('plugin-meetings', () => {
|
|
|
1259
1794
|
assert.equal(icePhaseCallbacks.length, 1);
|
|
1260
1795
|
assert.equal(icePhaseCallbacks[0](), 'JOIN_MEETING_RETRY');
|
|
1261
1796
|
|
|
1262
|
-
// now trigger the failure, so that joinWithMedia() does a retry
|
|
1263
|
-
addMediaInternalResults[0].reject(addMediaError);
|
|
1797
|
+
// now trigger the failure, so that joinWithMedia() does a retry
|
|
1798
|
+
addMediaInternalResults[0].reject(addMediaError);
|
|
1799
|
+
|
|
1800
|
+
await testUtils.flushPromises();
|
|
1801
|
+
|
|
1802
|
+
// check the callback works correctly on the 2nd attempt:
|
|
1803
|
+
// retryCount=1 with a non-UserNotJoinedError is terminal, so icePhase must be JOIN_MEETING_FINAL
|
|
1804
|
+
assert.equal(icePhaseCallbacks.length, 2);
|
|
1805
|
+
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1806
|
+
|
|
1807
|
+
// trigger 2nd failure
|
|
1808
|
+
addMediaInternalResults[1].reject(addMediaError);
|
|
1809
|
+
|
|
1810
|
+
await assert.isRejected(result);
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1813
|
+
it('should allow an additional retry when UserNotJoinedError occurs and return JOIN_MEETING_FINAL on the 3rd attempt', async () => {
|
|
1814
|
+
const genericError = new Error('generic error');
|
|
1815
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1816
|
+
const thirdError = new Error('third error');
|
|
1817
|
+
|
|
1818
|
+
const icePhaseCallbacks = [];
|
|
1819
|
+
const addMediaInternalResults = [];
|
|
1820
|
+
|
|
1821
|
+
meeting.addMediaInternal = sinon.stub().callsFake((icePhaseCallback) => {
|
|
1822
|
+
const defer = new Defer();
|
|
1823
|
+
|
|
1824
|
+
icePhaseCallbacks.push(icePhaseCallback);
|
|
1825
|
+
addMediaInternalResults.push(defer);
|
|
1826
|
+
return defer.promise;
|
|
1827
|
+
});
|
|
1828
|
+
|
|
1829
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1830
|
+
|
|
1831
|
+
const result = meeting.joinWithMedia({
|
|
1832
|
+
joinOptions,
|
|
1833
|
+
mediaOptions,
|
|
1834
|
+
});
|
|
1835
|
+
|
|
1836
|
+
await testUtils.flushPromises();
|
|
1837
|
+
|
|
1838
|
+
// 1st attempt: retryCount=0 → JOIN_MEETING_RETRY
|
|
1839
|
+
assert.equal(icePhaseCallbacks.length, 1);
|
|
1840
|
+
assert.equal(icePhaseCallbacks[0](), 'JOIN_MEETING_RETRY');
|
|
1841
|
+
addMediaInternalResults[0].reject(genericError);
|
|
1842
|
+
|
|
1843
|
+
await testUtils.flushPromises();
|
|
1844
|
+
|
|
1845
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1846
|
+
assert.notCalled(leaveStub);
|
|
1847
|
+
|
|
1848
|
+
// 2nd attempt: retryCount=1 → JOIN_MEETING_FINAL
|
|
1849
|
+
// (In real usage this callback is never invoked when UserNotJoinedError is thrown,
|
|
1850
|
+
// because UserNotJoinedError is thrown before waitForMediaConnectionConnected() is reached.)
|
|
1851
|
+
assert.equal(icePhaseCallbacks.length, 2);
|
|
1852
|
+
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1853
|
+
addMediaInternalResults[1].reject(userNotJoinedError);
|
|
1854
|
+
|
|
1855
|
+
await testUtils.flushPromises();
|
|
1856
|
+
|
|
1857
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1858
|
+
assert.notCalled(leaveStub);
|
|
1859
|
+
|
|
1860
|
+
// 3rd attempt: retryCount=2 → JOIN_MEETING_FINAL
|
|
1861
|
+
assert.equal(icePhaseCallbacks.length, 3);
|
|
1862
|
+
assert.equal(icePhaseCallbacks[2](), 'JOIN_MEETING_FINAL');
|
|
1863
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1864
|
+
|
|
1865
|
+
const thrownError = await assert.isRejected(result);
|
|
1866
|
+
|
|
1867
|
+
// should throw the first error
|
|
1868
|
+
assert.equal(thrownError, genericError);
|
|
1869
|
+
|
|
1870
|
+
// leave() should only be called once, after the last (3rd) attempt
|
|
1871
|
+
assert.calledOnce(leaveStub);
|
|
1872
|
+
});
|
|
1873
|
+
|
|
1874
|
+
it('should re-join when retrying after a UserNotJoinedError', async () => {
|
|
1875
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1876
|
+
|
|
1877
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1878
|
+
|
|
1879
|
+
meeting.addMediaInternal = sinon
|
|
1880
|
+
.stub()
|
|
1881
|
+
.onFirstCall()
|
|
1882
|
+
.rejects(userNotJoinedError)
|
|
1883
|
+
.onSecondCall()
|
|
1884
|
+
.resolves(test4);
|
|
1885
|
+
|
|
1886
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1887
|
+
|
|
1888
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1889
|
+
|
|
1890
|
+
// join() should be called twice — once for the first attempt, once for the re-join after UserNotJoinedError
|
|
1891
|
+
assert.calledTwice(meeting.join);
|
|
1892
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1893
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1894
|
+
// leave() should never be called when retrying after UserNotJoinedError
|
|
1895
|
+
assert.notCalled(leaveStub);
|
|
1896
|
+
});
|
|
1897
|
+
|
|
1898
|
+
it('should re-join when isUserInLeftState returns true on retry', async () => {
|
|
1899
|
+
const addMediaError = new Error('addMedia error');
|
|
1900
|
+
|
|
1901
|
+
sinon.stub(MeetingUtil, 'isUserInLeftState').returns(true);
|
|
1902
|
+
|
|
1903
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1264
1904
|
|
|
1265
|
-
|
|
1905
|
+
meeting.addMediaInternal = sinon
|
|
1906
|
+
.stub()
|
|
1907
|
+
.onFirstCall()
|
|
1908
|
+
.rejects(addMediaError)
|
|
1909
|
+
.onSecondCall()
|
|
1910
|
+
.resolves(test4);
|
|
1266
1911
|
|
|
1267
|
-
|
|
1268
|
-
assert.equal(icePhaseCallbacks.length, 2);
|
|
1269
|
-
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1912
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1270
1913
|
|
|
1271
|
-
|
|
1272
|
-
addMediaInternalResults[1].reject(addMediaError);
|
|
1914
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1273
1915
|
|
|
1274
|
-
|
|
1916
|
+
// join() should be called twice — once for the first attempt, once because the user is in left state
|
|
1917
|
+
assert.calledTwice(meeting.join);
|
|
1918
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1919
|
+
// leave() should never be called when retrying after isUserInLeftState returns true
|
|
1920
|
+
assert.notCalled(leaveStub);
|
|
1275
1921
|
});
|
|
1276
1922
|
|
|
1277
1923
|
[
|
|
@@ -1341,6 +1987,7 @@ describe('plugin-meetings', () => {
|
|
|
1341
1987
|
sinon.match.any,
|
|
1342
1988
|
sinon.match.any,
|
|
1343
1989
|
sinon.match.any,
|
|
1990
|
+
sinon.match.any,
|
|
1344
1991
|
sinon.match.has('videoEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1345
1992
|
);
|
|
1346
1993
|
});
|
|
@@ -1361,6 +2008,7 @@ describe('plugin-meetings', () => {
|
|
|
1361
2008
|
sinon.match.any,
|
|
1362
2009
|
sinon.match.any,
|
|
1363
2010
|
sinon.match.any,
|
|
2011
|
+
sinon.match.any,
|
|
1364
2012
|
sinon.match.has('audioEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1365
2013
|
);
|
|
1366
2014
|
});
|
|
@@ -1382,6 +2030,7 @@ describe('plugin-meetings', () => {
|
|
|
1382
2030
|
sinon.match.any,
|
|
1383
2031
|
sinon.match.any,
|
|
1384
2032
|
sinon.match.any,
|
|
2033
|
+
sinon.match.any,
|
|
1385
2034
|
sinon.match({
|
|
1386
2035
|
sendVideo: true,
|
|
1387
2036
|
receiveVideo: false,
|
|
@@ -1391,6 +2040,101 @@ describe('plugin-meetings', () => {
|
|
|
1391
2040
|
);
|
|
1392
2041
|
});
|
|
1393
2042
|
|
|
2043
|
+
describe('shouldRetryMediaWithOnlyTurnTLS', () => {
|
|
2044
|
+
it('should pass iceTransportPolicy=relay for multistream when previous error is DTLS failure over UDP and TLS is reachable', async () => {
|
|
2045
|
+
meeting.isMultistream = true;
|
|
2046
|
+
const dtlsError = new AddMediaFailed({iceConnected: true, connectionType: 'UDP'});
|
|
2047
|
+
|
|
2048
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon
|
|
2049
|
+
.stub()
|
|
2050
|
+
.resolves(true);
|
|
2051
|
+
|
|
2052
|
+
addMediaInternalStub.onFirstCall().rejects(dtlsError);
|
|
2053
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
2054
|
+
|
|
2055
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2056
|
+
|
|
2057
|
+
assert.calledWith(
|
|
2058
|
+
meeting.addMediaInternal.secondCall,
|
|
2059
|
+
sinon.match.any,
|
|
2060
|
+
sinon.match.any,
|
|
2061
|
+
sinon.match.any,
|
|
2062
|
+
'relay',
|
|
2063
|
+
mediaOptions
|
|
2064
|
+
);
|
|
2065
|
+
});
|
|
2066
|
+
|
|
2067
|
+
[
|
|
2068
|
+
{
|
|
2069
|
+
title: 'TLS is not reachable',
|
|
2070
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
2071
|
+
tlsReachable: false,
|
|
2072
|
+
isMultistream: true,
|
|
2073
|
+
},
|
|
2074
|
+
{
|
|
2075
|
+
title: 'error is not AddMediaFailed',
|
|
2076
|
+
prevError: new Error('generic error'),
|
|
2077
|
+
tlsReachable: true,
|
|
2078
|
+
isMultistream: true,
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
title: 'error is AddMediaFailed but not DTLS failure',
|
|
2082
|
+
prevError: new AddMediaFailed({iceConnected: false, connectionType: 'UDP'}),
|
|
2083
|
+
tlsReachable: true,
|
|
2084
|
+
isMultistream: true,
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
title: 'error is DTLS failure but connectionType is not UDP',
|
|
2088
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'TURN-TLS'}),
|
|
2089
|
+
tlsReachable: true,
|
|
2090
|
+
isMultistream: true,
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
title: 'isMultistream is false',
|
|
2094
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
2095
|
+
tlsReachable: true,
|
|
2096
|
+
isMultistream: false,
|
|
2097
|
+
},
|
|
2098
|
+
].forEach(({title, prevError, tlsReachable, isMultistream}) => {
|
|
2099
|
+
it(`should pass iceTransportPolicy=undefined when ${title}`, async () => {
|
|
2100
|
+
meeting.join = sinon.stub().callsFake(() => {
|
|
2101
|
+
meeting.isMultistream = isMultistream;
|
|
2102
|
+
return Promise.resolve(fakeJoinResult);
|
|
2103
|
+
});
|
|
2104
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon
|
|
2105
|
+
.stub()
|
|
2106
|
+
.resolves(tlsReachable);
|
|
2107
|
+
|
|
2108
|
+
addMediaInternalStub.onFirstCall().rejects(prevError);
|
|
2109
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
2110
|
+
|
|
2111
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2112
|
+
|
|
2113
|
+
assert.calledWith(
|
|
2114
|
+
meeting.addMediaInternal.secondCall,
|
|
2115
|
+
sinon.match.any,
|
|
2116
|
+
sinon.match.any,
|
|
2117
|
+
sinon.match.any,
|
|
2118
|
+
undefined,
|
|
2119
|
+
mediaOptions
|
|
2120
|
+
);
|
|
2121
|
+
});
|
|
2122
|
+
});
|
|
2123
|
+
|
|
2124
|
+
it('should pass iceTransportPolicy=undefined on first attempt (no prevError)', async () => {
|
|
2125
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2126
|
+
|
|
2127
|
+
assert.calledWith(
|
|
2128
|
+
meeting.addMediaInternal.firstCall,
|
|
2129
|
+
sinon.match.any,
|
|
2130
|
+
sinon.match.any,
|
|
2131
|
+
sinon.match.any,
|
|
2132
|
+
undefined,
|
|
2133
|
+
mediaOptions
|
|
2134
|
+
);
|
|
2135
|
+
});
|
|
2136
|
+
});
|
|
2137
|
+
|
|
1394
2138
|
it('should throw immediately if RTCPeerConnection is not available', async () => {
|
|
1395
2139
|
supportsRTCPeerConnectionStub.returns(CapabilityState.NOT_CAPABLE);
|
|
1396
2140
|
|
|
@@ -1402,9 +2146,97 @@ describe('plugin-meetings', () => {
|
|
|
1402
2146
|
Errors.WebrtcApiNotAvailableError
|
|
1403
2147
|
);
|
|
1404
2148
|
|
|
2149
|
+
assert.notCalled(suspendDestroyMeetingStub);
|
|
1405
2150
|
assert.notCalled(meeting.join);
|
|
1406
2151
|
assert.notCalled(meeting.addMediaInternal);
|
|
1407
2152
|
});
|
|
2153
|
+
|
|
2154
|
+
[
|
|
2155
|
+
{description: '409 error from join()', statusCode: 409, useCause: false},
|
|
2156
|
+
{description: '403 error from join()', statusCode: 403, useCause: false},
|
|
2157
|
+
{
|
|
2158
|
+
description: '409 error in cause (e.g. AddMediaFailed)',
|
|
2159
|
+
statusCode: 409,
|
|
2160
|
+
useCause: true,
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
description: '403 error in cause (e.g. AddMediaFailed)',
|
|
2164
|
+
statusCode: 403,
|
|
2165
|
+
useCause: true,
|
|
2166
|
+
},
|
|
2167
|
+
].forEach(({description, statusCode, useCause}) => {
|
|
2168
|
+
it(`should re-join on retry when ${description}`, async () => {
|
|
2169
|
+
const error = useCause
|
|
2170
|
+
? Object.assign(new Error('wrapped error'), {cause: {statusCode}})
|
|
2171
|
+
: Object.assign(new Error('locus error'), {statusCode});
|
|
2172
|
+
|
|
2173
|
+
meeting.addMediaInternal = sinon
|
|
2174
|
+
.stub()
|
|
2175
|
+
.onFirstCall()
|
|
2176
|
+
.rejects(error)
|
|
2177
|
+
.onSecondCall()
|
|
2178
|
+
.resolves(test4);
|
|
2179
|
+
|
|
2180
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2181
|
+
|
|
2182
|
+
assert.deepEqual(result, {
|
|
2183
|
+
join: fakeJoinResult,
|
|
2184
|
+
media: test4,
|
|
2185
|
+
multistreamEnabled: true,
|
|
2186
|
+
});
|
|
2187
|
+
|
|
2188
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
2189
|
+
assert.calledTwice(meeting.join);
|
|
2190
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
2191
|
+
});
|
|
2192
|
+
});
|
|
2193
|
+
|
|
2194
|
+
it('should allow up to JOIN_WITH_MEDIA_RETRY_MAX_COUNT retries for 409 errors', async () => {
|
|
2195
|
+
const error409 = Object.assign(new Error('locus dropped us'), {statusCode: 409});
|
|
2196
|
+
|
|
2197
|
+
meeting.addMediaInternal = sinon.stub().rejects(error409);
|
|
2198
|
+
meeting.join = sinon.stub().callsFake(() => Promise.resolve(fakeJoinResult));
|
|
2199
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
2200
|
+
|
|
2201
|
+
await assert.isRejected(meeting.joinWithMedia({joinOptions, mediaOptions}));
|
|
2202
|
+
|
|
2203
|
+
// JOIN_WITH_MEDIA_RETRY_MAX_COUNT is 2, so we expect 3 attempts total (initial + 2 retries)
|
|
2204
|
+
assert.callCount(meeting.join, 3);
|
|
2205
|
+
assert.callCount(meeting.addMediaInternal, 3);
|
|
2206
|
+
});
|
|
2207
|
+
|
|
2208
|
+
it('should not retry on 1-1 calls', async () => {
|
|
2209
|
+
const addMediaError = new Error('addMedia error');
|
|
2210
|
+
|
|
2211
|
+
sinon.stub(MeetingsUtil, 'isOneOnOneCall').returns(true);
|
|
2212
|
+
|
|
2213
|
+
meeting.addMediaInternal = sinon.stub().rejects(addMediaError);
|
|
2214
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
2215
|
+
|
|
2216
|
+
await assert.isRejected(
|
|
2217
|
+
meeting.joinWithMedia({joinOptions, mediaOptions}),
|
|
2218
|
+
addMediaError
|
|
2219
|
+
);
|
|
2220
|
+
|
|
2221
|
+
// should not retry - only 1 attempt
|
|
2222
|
+
assert.calledOnce(meeting.join);
|
|
2223
|
+
assert.calledOnce(meeting.addMediaInternal);
|
|
2224
|
+
assert.calledOnceWithExactly(
|
|
2225
|
+
Metrics.sendBehavioralMetric,
|
|
2226
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
2227
|
+
{
|
|
2228
|
+
correlation_id: meeting.correlationId,
|
|
2229
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
2230
|
+
reason: addMediaError.message,
|
|
2231
|
+
stack: addMediaError.stack,
|
|
2232
|
+
leaveErrorReason: undefined,
|
|
2233
|
+
isRetry: false,
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
type: addMediaError.name,
|
|
2237
|
+
}
|
|
2238
|
+
);
|
|
2239
|
+
});
|
|
1408
2240
|
});
|
|
1409
2241
|
describe('#isTranscriptionSupported', () => {
|
|
1410
2242
|
it('should return false if the feature is not supported for the meeting', () => {
|
|
@@ -1977,12 +2809,120 @@ describe('plugin-meetings', () => {
|
|
|
1977
2809
|
fakeProcessedReaction
|
|
1978
2810
|
);
|
|
1979
2811
|
});
|
|
2812
|
+
|
|
2813
|
+
[
|
|
2814
|
+
{
|
|
2815
|
+
title:
|
|
2816
|
+
'should skip a reaction when the default relay route does not match the LLM binding',
|
|
2817
|
+
isPracticeSessionConnected: false,
|
|
2818
|
+
route: 'wrong-default-route',
|
|
2819
|
+
defaultBinding: 'default-route',
|
|
2820
|
+
practiceBinding: 'practice-route',
|
|
2821
|
+
shouldProcess: false,
|
|
2822
|
+
expectedSessionLabel: 'default session',
|
|
2823
|
+
},
|
|
2824
|
+
{
|
|
2825
|
+
title: 'should process a reaction when the default relay route matches the LLM binding',
|
|
2826
|
+
isPracticeSessionConnected: false,
|
|
2827
|
+
route: 'default-route',
|
|
2828
|
+
defaultBinding: 'default-route',
|
|
2829
|
+
practiceBinding: 'practice-route',
|
|
2830
|
+
shouldProcess: true,
|
|
2831
|
+
},
|
|
2832
|
+
{
|
|
2833
|
+
title:
|
|
2834
|
+
'should process a reaction when the practice-session relay route matches the practice-session LLM binding',
|
|
2835
|
+
isPracticeSessionConnected: true,
|
|
2836
|
+
route: 'practice-route',
|
|
2837
|
+
defaultBinding: 'default-route',
|
|
2838
|
+
practiceBinding: 'practice-route',
|
|
2839
|
+
shouldProcess: true,
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
title:
|
|
2843
|
+
'should skip a reaction when the practice-session relay route does not match the practice-session LLM binding',
|
|
2844
|
+
isPracticeSessionConnected: true,
|
|
2845
|
+
route: 'default-route',
|
|
2846
|
+
defaultBinding: 'default-route',
|
|
2847
|
+
practiceBinding: 'practice-route',
|
|
2848
|
+
shouldProcess: false,
|
|
2849
|
+
expectedSessionLabel: 'practice session',
|
|
2850
|
+
},
|
|
2851
|
+
].forEach(
|
|
2852
|
+
({
|
|
2853
|
+
title,
|
|
2854
|
+
isPracticeSessionConnected,
|
|
2855
|
+
route,
|
|
2856
|
+
defaultBinding,
|
|
2857
|
+
practiceBinding,
|
|
2858
|
+
shouldProcess,
|
|
2859
|
+
expectedSessionLabel,
|
|
2860
|
+
}) => {
|
|
2861
|
+
it(title, () => {
|
|
2862
|
+
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2863
|
+
meeting.config.receiveReactions = true;
|
|
2864
|
+
const fakeSendersName = 'Fake reactors name';
|
|
2865
|
+
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2866
|
+
webex.internal.llm.isConnected = sinon.stub().callsFake((llmSessionId) => {
|
|
2867
|
+
return llmSessionId === LLM_PRACTICE_SESSION && isPracticeSessionConnected;
|
|
2868
|
+
});
|
|
2869
|
+
webex.internal.llm.getBinding = sinon.stub().callsFake((llmSessionId) => {
|
|
2870
|
+
if (llmSessionId === LLM_PRACTICE_SESSION) {
|
|
2871
|
+
return practiceBinding;
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
return defaultBinding;
|
|
2875
|
+
});
|
|
2876
|
+
const fakeReactionPayload = {
|
|
2877
|
+
type: 'fake_type',
|
|
2878
|
+
codepoints: 'fake_codepoints',
|
|
2879
|
+
shortcodes: 'fake_shortcodes',
|
|
2880
|
+
};
|
|
2881
|
+
const fakeSenderPayload = {
|
|
2882
|
+
participantId: 'fake_participant_id',
|
|
2883
|
+
};
|
|
2884
|
+
const fakeRelayEvent = {
|
|
2885
|
+
headers: {route},
|
|
2886
|
+
data: {
|
|
2887
|
+
relayType: REACTION_RELAY_TYPES.REACTION,
|
|
2888
|
+
reaction: fakeReactionPayload,
|
|
2889
|
+
sender: fakeSenderPayload,
|
|
2890
|
+
},
|
|
2891
|
+
};
|
|
2892
|
+
const fakeProcessedReaction = {
|
|
2893
|
+
reaction: fakeReactionPayload,
|
|
2894
|
+
sender: {
|
|
2895
|
+
id: fakeSenderPayload.participantId,
|
|
2896
|
+
name: fakeSendersName,
|
|
2897
|
+
},
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
TriggerProxy.trigger.resetHistory();
|
|
2901
|
+
meeting.processRelayEvent(fakeRelayEvent);
|
|
2902
|
+
|
|
2903
|
+
if (shouldProcess) {
|
|
2904
|
+
assert.calledWith(
|
|
2905
|
+
TriggerProxy.trigger,
|
|
2906
|
+
sinon.match.instanceOf(Meeting),
|
|
2907
|
+
{
|
|
2908
|
+
file: 'meeting/index',
|
|
2909
|
+
function: 'join',
|
|
2910
|
+
},
|
|
2911
|
+
EVENT_TRIGGERS.MEETING_RECEIVE_REACTIONS,
|
|
2912
|
+
fakeProcessedReaction
|
|
2913
|
+
);
|
|
2914
|
+
} else {
|
|
2915
|
+
assert.notCalled(TriggerProxy.trigger);
|
|
2916
|
+
}
|
|
2917
|
+
});
|
|
2918
|
+
}
|
|
2919
|
+
);
|
|
1980
2920
|
});
|
|
1981
2921
|
|
|
1982
2922
|
describe('#handleLLMOnline', () => {
|
|
1983
2923
|
beforeEach(() => {
|
|
1984
2924
|
webex.internal.llm.off = sinon.stub();
|
|
1985
|
-
webex.internal.voicea.
|
|
2925
|
+
webex.internal.voicea.getKeepTranscriptionSubscribed = sinon.stub().returns(false);
|
|
1986
2926
|
webex.internal.voicea.updateSubchannelSubscriptions = sinon.stub();
|
|
1987
2927
|
});
|
|
1988
2928
|
|
|
@@ -2000,7 +2940,7 @@ describe('plugin-meetings', () => {
|
|
|
2000
2940
|
});
|
|
2001
2941
|
|
|
2002
2942
|
it('restores transcription subscription when caption intent is enabled', () => {
|
|
2003
|
-
webex.internal.voicea.
|
|
2943
|
+
webex.internal.voicea.getKeepTranscriptionSubscribed.returns(true);
|
|
2004
2944
|
|
|
2005
2945
|
meeting.handleLLMOnline();
|
|
2006
2946
|
|
|
@@ -2010,12 +2950,20 @@ describe('plugin-meetings', () => {
|
|
|
2010
2950
|
});
|
|
2011
2951
|
|
|
2012
2952
|
it('does not restore transcription subscription when caption intent is disabled', () => {
|
|
2013
|
-
webex.internal.voicea.
|
|
2953
|
+
webex.internal.voicea.getKeepTranscriptionSubscribed.returns(false);
|
|
2014
2954
|
|
|
2015
2955
|
meeting.handleLLMOnline();
|
|
2016
2956
|
|
|
2017
2957
|
assert.notCalled(webex.internal.voicea.updateSubchannelSubscriptions);
|
|
2018
2958
|
});
|
|
2959
|
+
|
|
2960
|
+
it('calls syncAllHashTreeDatasets on locusInfo', () => {
|
|
2961
|
+
sinon.stub(meeting.locusInfo, 'syncAllHashTreeDatasets').resolves();
|
|
2962
|
+
|
|
2963
|
+
meeting.handleLLMOnline();
|
|
2964
|
+
|
|
2965
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
2966
|
+
});
|
|
2019
2967
|
});
|
|
2020
2968
|
|
|
2021
2969
|
describe('#join', () => {
|
|
@@ -2096,6 +3044,8 @@ describe('plugin-meetings', () => {
|
|
|
2096
3044
|
regionCode: 'EU',
|
|
2097
3045
|
},
|
|
2098
3046
|
preferTranscoding: !enableMultistream,
|
|
3047
|
+
getCurrentSelfUrl: sinon.match.func,
|
|
3048
|
+
waitForSelfUrlChange: sinon.match.func,
|
|
2099
3049
|
},
|
|
2100
3050
|
{
|
|
2101
3051
|
parent: meeting.webex,
|
|
@@ -2340,6 +3290,221 @@ describe('plugin-meetings', () => {
|
|
|
2340
3290
|
);
|
|
2341
3291
|
});
|
|
2342
3292
|
|
|
3293
|
+
it('emits breakout join response metric only once per breakoutMoveId', async () => {
|
|
3294
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3295
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3296
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3297
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3298
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3299
|
+
});
|
|
3300
|
+
|
|
3301
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3302
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3303
|
+
meeting.breakouts.set('sessionType', 'BREAKOUT');
|
|
3304
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3305
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3306
|
+
sessionId: 'session-id-1',
|
|
3307
|
+
groupId: 'group-id-1',
|
|
3308
|
+
});
|
|
3309
|
+
|
|
3310
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3311
|
+
meeting.updateLLMConnection.restore();
|
|
3312
|
+
|
|
3313
|
+
await meeting.updateLLMConnection();
|
|
3314
|
+
await meeting.updateLLMConnection();
|
|
3315
|
+
|
|
3316
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3317
|
+
.getCalls()
|
|
3318
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3319
|
+
|
|
3320
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3321
|
+
assert.equal(joinResponseCalls[0].args[0].options.meetingId, meeting.id);
|
|
3322
|
+
});
|
|
3323
|
+
|
|
3324
|
+
it('does not emit breakout join response metric when breakout session is missing', async () => {
|
|
3325
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3326
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3327
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3328
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3329
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3330
|
+
});
|
|
3331
|
+
|
|
3332
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3333
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3334
|
+
|
|
3335
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3336
|
+
meeting.updateLLMConnection.restore();
|
|
3337
|
+
|
|
3338
|
+
await meeting.updateLLMConnection();
|
|
3339
|
+
|
|
3340
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3341
|
+
.getCalls()
|
|
3342
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3343
|
+
|
|
3344
|
+
assert.lengthOf(joinResponseCalls, 0);
|
|
3345
|
+
});
|
|
3346
|
+
|
|
3347
|
+
it('does not emit failed breakout join response metric when breakout session is missing', async () => {
|
|
3348
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3349
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3350
|
+
sinon
|
|
3351
|
+
.stub(meeting.webex.internal.llm, 'registerAndConnect')
|
|
3352
|
+
.rejects(new Error('failed to connect LLM'));
|
|
3353
|
+
|
|
3354
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3355
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3356
|
+
|
|
3357
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3358
|
+
meeting.updateLLMConnection.restore();
|
|
3359
|
+
|
|
3360
|
+
try {
|
|
3361
|
+
await meeting.updateLLMConnection();
|
|
3362
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
3363
|
+
} catch (error) {
|
|
3364
|
+
assert.equal(error.message, 'failed to connect LLM');
|
|
3365
|
+
}
|
|
3366
|
+
|
|
3367
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3368
|
+
.getCalls()
|
|
3369
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3370
|
+
|
|
3371
|
+
assert.lengthOf(joinResponseCalls, 0);
|
|
3372
|
+
});
|
|
3373
|
+
|
|
3374
|
+
it('emits llm breakout join response metric after suppressing join response without llmLatency', async () => {
|
|
3375
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3376
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3377
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3378
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3379
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3380
|
+
});
|
|
3381
|
+
|
|
3382
|
+
meeting.config.enableAutomaticLLM = true;
|
|
3383
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3384
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3385
|
+
meeting.breakouts.set('sessionType', 'BREAKOUT');
|
|
3386
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3387
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3388
|
+
sessionId: 'session-id-1',
|
|
3389
|
+
groupId: 'group-id-1',
|
|
3390
|
+
});
|
|
3391
|
+
|
|
3392
|
+
assert.isFalse(meeting.shouldEmitBreakoutJoinResponseMetric('move-id-1'));
|
|
3393
|
+
|
|
3394
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3395
|
+
meeting.updateLLMConnection.restore();
|
|
3396
|
+
|
|
3397
|
+
await meeting.updateLLMConnection();
|
|
3398
|
+
|
|
3399
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3400
|
+
.getCalls()
|
|
3401
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3402
|
+
|
|
3403
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3404
|
+
assert.deepEqual(joinResponseCalls[0].args[0].payload.llmLatency, {
|
|
3405
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3406
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3407
|
+
});
|
|
3408
|
+
});
|
|
3409
|
+
|
|
3410
|
+
it('emits breakout join response metric with llmLatency when returning to main session', async () => {
|
|
3411
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3412
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3413
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3414
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3415
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3416
|
+
});
|
|
3417
|
+
|
|
3418
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3419
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3420
|
+
meeting.breakouts.set('sessionType', 'MAIN');
|
|
3421
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3422
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3423
|
+
sessionId: 'session-id-1',
|
|
3424
|
+
groupId: 'group-id-1',
|
|
3425
|
+
});
|
|
3426
|
+
|
|
3427
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3428
|
+
meeting.updateLLMConnection.restore();
|
|
3429
|
+
|
|
3430
|
+
await meeting.updateLLMConnection();
|
|
3431
|
+
|
|
3432
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3433
|
+
.getCalls()
|
|
3434
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3435
|
+
|
|
3436
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3437
|
+
assert.deepEqual(joinResponseCalls[0].args[0].payload.llmLatency, {
|
|
3438
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3439
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3440
|
+
});
|
|
3441
|
+
});
|
|
3442
|
+
|
|
3443
|
+
it('uses the partial datachannel timing from the error when the websocket connect fails', async () => {
|
|
3444
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3445
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3446
|
+
const connectError = new Error('failed to connect LLM');
|
|
3447
|
+
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3448
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').rejects(connectError);
|
|
3449
|
+
|
|
3450
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3451
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3452
|
+
meeting.breakouts.set('sessionType', 'BREAKOUT');
|
|
3453
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3454
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3455
|
+
sessionId: 'session-id-1',
|
|
3456
|
+
groupId: 'group-id-1',
|
|
3457
|
+
});
|
|
3458
|
+
|
|
3459
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3460
|
+
meeting.updateLLMConnection.restore();
|
|
3461
|
+
|
|
3462
|
+
try {
|
|
3463
|
+
await meeting.updateLLMConnection();
|
|
3464
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
3465
|
+
} catch (error) {
|
|
3466
|
+
assert.equal(error, connectError);
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3470
|
+
.getCalls()
|
|
3471
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3472
|
+
|
|
3473
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3474
|
+
assert.deepEqual(joinResponseCalls[0].args[0].payload.llmLatency, {
|
|
3475
|
+
clientLLMDatachannelResponseTime: 42,
|
|
3476
|
+
clientLLMWebSocketConnectTime: 0,
|
|
3477
|
+
});
|
|
3478
|
+
});
|
|
3479
|
+
|
|
3480
|
+
it('reports the partial datachannel timing on client.llm.connect.response when the websocket connect fails during initial join', async () => {
|
|
3481
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3482
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3483
|
+
const connectError = new Error('failed to connect LLM');
|
|
3484
|
+
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3485
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').rejects(connectError);
|
|
3486
|
+
|
|
3487
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3488
|
+
meeting.updateLLMConnection.restore();
|
|
3489
|
+
|
|
3490
|
+
try {
|
|
3491
|
+
await meeting.updateLLMConnection({isInitialJoinPhase: true});
|
|
3492
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
3493
|
+
} catch (error) {
|
|
3494
|
+
assert.equal(error, connectError);
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
const connectResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3498
|
+
.getCalls()
|
|
3499
|
+
.filter((call) => call.args[0]?.name === 'client.llm.connect.response');
|
|
3500
|
+
|
|
3501
|
+
assert.lengthOf(connectResponseCalls, 1);
|
|
3502
|
+
assert.deepEqual(connectResponseCalls[0].args[0].payload.llmLatency, {
|
|
3503
|
+
clientLLMDatachannelResponseTime: 42,
|
|
3504
|
+
clientLLMWebSocketConnectTime: 0,
|
|
3505
|
+
});
|
|
3506
|
+
});
|
|
3507
|
+
|
|
2343
3508
|
it('clears the LLM health check timer when disconnecting LLM', async () => {
|
|
2344
3509
|
const isJoinedStub = sinon.stub(meeting, 'isJoined');
|
|
2345
3510
|
sinon.stub(meeting.webex.internal.llm, 'isConnected');
|
|
@@ -2467,7 +3632,6 @@ describe('plugin-meetings', () => {
|
|
|
2467
3632
|
});
|
|
2468
3633
|
});
|
|
2469
3634
|
|
|
2470
|
-
|
|
2471
3635
|
describe('#addMedia', () => {
|
|
2472
3636
|
const muteStateStub = {
|
|
2473
3637
|
handleClientRequest: sinon.stub().returns(Promise.resolve(true)),
|
|
@@ -2517,6 +3681,41 @@ describe('plugin-meetings', () => {
|
|
|
2517
3681
|
assert.exists(meeting.addMedia);
|
|
2518
3682
|
});
|
|
2519
3683
|
|
|
3684
|
+
it('logs a compact remote media manager configuration', async () => {
|
|
3685
|
+
const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
|
|
3686
|
+
const remoteMediaManagerConfig = {
|
|
3687
|
+
audio: {
|
|
3688
|
+
numOfActiveSpeakerStreams: 3,
|
|
3689
|
+
numOfScreenShareStreams: 1,
|
|
3690
|
+
},
|
|
3691
|
+
video: {
|
|
3692
|
+
preferLiveVideo: true,
|
|
3693
|
+
initialLayoutId: 'initial',
|
|
3694
|
+
layouts: {
|
|
3695
|
+
initial: {activeSpeakerVideoPaneGroups: []},
|
|
3696
|
+
excluded: {activeSpeakerVideoPaneGroups: []},
|
|
3697
|
+
},
|
|
3698
|
+
},
|
|
3699
|
+
};
|
|
3700
|
+
|
|
3701
|
+
const error = await assert.isRejected(
|
|
3702
|
+
meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, undefined, {
|
|
3703
|
+
remoteMediaManagerConfig,
|
|
3704
|
+
})
|
|
3705
|
+
);
|
|
3706
|
+
|
|
3707
|
+
assert.instanceOf(error, MeetingNotActiveError);
|
|
3708
|
+
assert.calledOnceWithExactly(
|
|
3709
|
+
loggerInfoStub,
|
|
3710
|
+
`Meeting:index#addMedia --> called with: options=${JSON.stringify({
|
|
3711
|
+
remoteMediaManagerConfig:
|
|
3712
|
+
RemoteMediaManagerModule.getRemoteMediaManagerConfigForLogging(
|
|
3713
|
+
remoteMediaManagerConfig
|
|
3714
|
+
),
|
|
3715
|
+
})}, turnServerInfo=undefined, forceTurnDiscovery=false, iceTransportPolicy=undefined`
|
|
3716
|
+
);
|
|
3717
|
+
});
|
|
3718
|
+
|
|
2520
3719
|
it('should reject promise if meeting is not active and the meeting in lobby is not enabled', async () => {
|
|
2521
3720
|
const result = await assert.isRejected(meeting.addMedia({allowMediaInLobby: false}));
|
|
2522
3721
|
|
|
@@ -2614,9 +3813,11 @@ describe('plugin-meetings', () => {
|
|
|
2614
3813
|
retriedWithTurnServer: false,
|
|
2615
3814
|
isMultistream: false,
|
|
2616
3815
|
isJoinWithMediaRetry: false,
|
|
3816
|
+
iceTransportPolicy: 'all',
|
|
2617
3817
|
signalingState: 'unknown',
|
|
2618
3818
|
connectionState: 'unknown',
|
|
2619
3819
|
iceConnectionState: 'unknown',
|
|
3820
|
+
connectionType: 'udp',
|
|
2620
3821
|
someReachabilityMetric1: 'some value1',
|
|
2621
3822
|
someReachabilityMetric2: 'some value2',
|
|
2622
3823
|
selectedCandidatePairChanges: 2,
|
|
@@ -2742,9 +3943,11 @@ describe('plugin-meetings', () => {
|
|
|
2742
3943
|
retriedWithTurnServer: false,
|
|
2743
3944
|
isMultistream: false,
|
|
2744
3945
|
isJoinWithMediaRetry: false,
|
|
3946
|
+
iceTransportPolicy: 'all',
|
|
2745
3947
|
signalingState: 'unknown',
|
|
2746
3948
|
connectionState: 'unknown',
|
|
2747
3949
|
iceConnectionState: 'unknown',
|
|
3950
|
+
connectionType: 'udp',
|
|
2748
3951
|
someReachabilityMetric1: 'some value1',
|
|
2749
3952
|
someReachabilityMetric2: 'some value2',
|
|
2750
3953
|
selectedCandidatePairChanges: 2,
|
|
@@ -3178,6 +4381,7 @@ describe('plugin-meetings', () => {
|
|
|
3178
4381
|
unpublishStream: sinon.stub(),
|
|
3179
4382
|
setNamedMediaGroups: sinon.stub(),
|
|
3180
4383
|
});
|
|
4384
|
+
sinon.spy(meeting.sendSlotManager, 'reset');
|
|
3181
4385
|
|
|
3182
4386
|
await meeting.addMedia({
|
|
3183
4387
|
allowMediaInLobby: true,
|
|
@@ -3190,6 +4394,7 @@ describe('plugin-meetings', () => {
|
|
|
3190
4394
|
},
|
|
3191
4395
|
});
|
|
3192
4396
|
|
|
4397
|
+
assert.calledOnce(meeting.sendSlotManager.reset);
|
|
3193
4398
|
assert.notCalled(publishStreamStub);
|
|
3194
4399
|
});
|
|
3195
4400
|
|
|
@@ -3213,6 +4418,7 @@ describe('plugin-meetings', () => {
|
|
|
3213
4418
|
}
|
|
3214
4419
|
return videoSlot;
|
|
3215
4420
|
});
|
|
4421
|
+
sinon.spy(meeting.sendSlotManager, 'reset');
|
|
3216
4422
|
|
|
3217
4423
|
await meeting.addMedia({
|
|
3218
4424
|
allowMediaInLobby: true,
|
|
@@ -3225,6 +4431,7 @@ describe('plugin-meetings', () => {
|
|
|
3225
4431
|
},
|
|
3226
4432
|
});
|
|
3227
4433
|
|
|
4434
|
+
assert.calledOnce(meeting.sendSlotManager.reset);
|
|
3228
4435
|
assert.calledOnceWithExactly(audioSlot.publishStream, fakeMicrophoneStream);
|
|
3229
4436
|
assert.calledOnceWithExactly(videoSlot.publishStream, fakeCameraStream);
|
|
3230
4437
|
});
|
|
@@ -3247,11 +4454,13 @@ describe('plugin-meetings', () => {
|
|
|
3247
4454
|
|
|
3248
4455
|
meeting.meetingState = 'ACTIVE';
|
|
3249
4456
|
meeting.isMultistream = true;
|
|
4457
|
+
sinon.spy(meeting.sendSlotManager, 'reset');
|
|
3250
4458
|
|
|
3251
4459
|
await meeting.addMedia({
|
|
3252
4460
|
mediaSettings: {},
|
|
3253
4461
|
});
|
|
3254
4462
|
|
|
4463
|
+
assert.calledOnce(meeting.sendSlotManager.reset);
|
|
3255
4464
|
// check that rtcMetrics was passed to Media.createMediaConnection
|
|
3256
4465
|
assert.calledOnce(Media.createMediaConnection);
|
|
3257
4466
|
assert.calledWith(
|
|
@@ -3512,9 +4721,11 @@ describe('plugin-meetings', () => {
|
|
|
3512
4721
|
retriedWithTurnServer: true,
|
|
3513
4722
|
isMultistream: false,
|
|
3514
4723
|
isJoinWithMediaRetry: false,
|
|
4724
|
+
iceTransportPolicy: 'all',
|
|
3515
4725
|
signalingState: 'unknown',
|
|
3516
4726
|
connectionState: 'unknown',
|
|
3517
4727
|
iceConnectionState: 'unknown',
|
|
4728
|
+
connectionType: 'udp',
|
|
3518
4729
|
selectedCandidatePairChanges: 2,
|
|
3519
4730
|
numTransports: 1,
|
|
3520
4731
|
iceCandidatesCount: 0,
|
|
@@ -3539,6 +4750,173 @@ describe('plugin-meetings', () => {
|
|
|
3539
4750
|
assert.isOk(errorThrown);
|
|
3540
4751
|
});
|
|
3541
4752
|
|
|
4753
|
+
[
|
|
4754
|
+
{iceConnected: true, title: 'iceConnected=true'},
|
|
4755
|
+
{iceConnected: false, title: 'iceConnected=false'},
|
|
4756
|
+
].forEach(({iceConnected, title}) => {
|
|
4757
|
+
it(`should propagate ${title} from waitForMediaConnectionConnected rejection to AddMediaFailed`, async () => {
|
|
4758
|
+
webex.meetings.reachability = {
|
|
4759
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4760
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4761
|
+
stopReachability: sinon.stub(),
|
|
4762
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4763
|
+
};
|
|
4764
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4765
|
+
sinon.stub().returns({fatal: true});
|
|
4766
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4767
|
+
|
|
4768
|
+
meeting.meetingState = 'ACTIVE';
|
|
4769
|
+
const rejectedResult = {iceConnected};
|
|
4770
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
4771
|
+
.stub()
|
|
4772
|
+
.rejects(rejectedResult);
|
|
4773
|
+
|
|
4774
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4775
|
+
turnServerInfo: {urls: ['turns:fake:443'], username: 'u', password: 'p'},
|
|
4776
|
+
turnDiscoverySkippedReason: undefined,
|
|
4777
|
+
});
|
|
4778
|
+
|
|
4779
|
+
const forceRtcMetricsSend = sinon.stub().resolves();
|
|
4780
|
+
Media.createMediaConnection = sinon.stub().returns({
|
|
4781
|
+
close: sinon.stub(),
|
|
4782
|
+
forceRtcMetricsSend,
|
|
4783
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4784
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4785
|
+
on: sinon.stub(),
|
|
4786
|
+
});
|
|
4787
|
+
|
|
4788
|
+
let thrownError;
|
|
4789
|
+
await meeting.addMedia({mediaSettings: {}}).catch((err) => {
|
|
4790
|
+
thrownError = err;
|
|
4791
|
+
});
|
|
4792
|
+
|
|
4793
|
+
assert.instanceOf(thrownError, AddMediaFailed);
|
|
4794
|
+
assert.equal(thrownError.iceConnected, iceConnected);
|
|
4795
|
+
// the AddMediaFailed cause should be the MediaConnectionTimedOutError, which in turn should
|
|
4796
|
+
// preserve the original rejected result as its cause, so that the web client
|
|
4797
|
+
// can find the CA-reported error in the eventErrorCache via the cause chain
|
|
4798
|
+
assert.instanceOf(thrownError.cause, MediaConnectionTimedOutError);
|
|
4799
|
+
assert.equal(thrownError.cause.cause, rejectedResult);
|
|
4800
|
+
});
|
|
4801
|
+
});
|
|
4802
|
+
|
|
4803
|
+
describe('iceTransportPolicy=relay handling', () => {
|
|
4804
|
+
let createMediaConnectionStub;
|
|
4805
|
+
|
|
4806
|
+
beforeEach(() => {
|
|
4807
|
+
webex.meetings.reachability = {
|
|
4808
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4809
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(true),
|
|
4810
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4811
|
+
stopReachability: sinon.stub(),
|
|
4812
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4813
|
+
};
|
|
4814
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4815
|
+
sinon.stub().returns({fatal: true});
|
|
4816
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4817
|
+
|
|
4818
|
+
meeting.meetingState = 'ACTIVE';
|
|
4819
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().resolves();
|
|
4820
|
+
|
|
4821
|
+
createMediaConnectionStub = sinon.stub().returns({
|
|
4822
|
+
close: sinon.stub(),
|
|
4823
|
+
forceRtcMetricsSend: sinon.stub().resolves(),
|
|
4824
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4825
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4826
|
+
on: sinon.stub(),
|
|
4827
|
+
});
|
|
4828
|
+
Media.createMediaConnection = createMediaConnectionStub;
|
|
4829
|
+
});
|
|
4830
|
+
|
|
4831
|
+
[
|
|
4832
|
+
{
|
|
4833
|
+
title:
|
|
4834
|
+
'should drop iceTransportPolicy=relay when TURN discovery returns no turn server info',
|
|
4835
|
+
turnServerInfo: undefined,
|
|
4836
|
+
turnDiscoverySkippedReason: 'reachability',
|
|
4837
|
+
},
|
|
4838
|
+
{
|
|
4839
|
+
title:
|
|
4840
|
+
'should drop iceTransportPolicy=relay when TURN discovery returns turnServerInfo with empty urls',
|
|
4841
|
+
turnServerInfo: {urls: [], username: 'u', password: 'p'},
|
|
4842
|
+
turnDiscoverySkippedReason: undefined,
|
|
4843
|
+
},
|
|
4844
|
+
].forEach(({title, turnServerInfo, turnDiscoverySkippedReason}) => {
|
|
4845
|
+
it(title, async () => {
|
|
4846
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4847
|
+
turnServerInfo,
|
|
4848
|
+
turnDiscoverySkippedReason,
|
|
4849
|
+
});
|
|
4850
|
+
|
|
4851
|
+
await meeting.addMediaInternal(
|
|
4852
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4853
|
+
false,
|
|
4854
|
+
undefined,
|
|
4855
|
+
'relay',
|
|
4856
|
+
{mediaSettings: {}}
|
|
4857
|
+
);
|
|
4858
|
+
|
|
4859
|
+
assert.calledOnce(createMediaConnectionStub);
|
|
4860
|
+
const config = createMediaConnectionStub.firstCall.args[3];
|
|
4861
|
+
assert.isUndefined(config.iceTransportPolicy);
|
|
4862
|
+
|
|
4863
|
+
const successCall = Metrics.sendBehavioralMetric
|
|
4864
|
+
.getCalls()
|
|
4865
|
+
.find((call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS);
|
|
4866
|
+
assert.isDefined(successCall);
|
|
4867
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'all');
|
|
4868
|
+
});
|
|
4869
|
+
});
|
|
4870
|
+
|
|
4871
|
+
it('should send ADD_MEDIA_SUCCESS metric with iceTransportPolicy=relay when relay is used', async () => {
|
|
4872
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4873
|
+
turnServerInfo: {
|
|
4874
|
+
urls: ['turns:turn-server:443?transport=tcp'],
|
|
4875
|
+
username: 'u',
|
|
4876
|
+
password: 'p',
|
|
4877
|
+
},
|
|
4878
|
+
turnDiscoverySkippedReason: undefined,
|
|
4879
|
+
});
|
|
4880
|
+
|
|
4881
|
+
await meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, 'relay', {
|
|
4882
|
+
mediaSettings: {},
|
|
4883
|
+
});
|
|
4884
|
+
|
|
4885
|
+
const successCall = Metrics.sendBehavioralMetric
|
|
4886
|
+
.getCalls()
|
|
4887
|
+
.find((call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS);
|
|
4888
|
+
assert.isDefined(successCall);
|
|
4889
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'relay');
|
|
4890
|
+
});
|
|
4891
|
+
|
|
4892
|
+
it('should send ADD_MEDIA_FAILURE metric with iceTransportPolicy=relay when relay attempt fails', async () => {
|
|
4893
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4894
|
+
turnServerInfo: {
|
|
4895
|
+
urls: ['turns:turn-server:443?transport=tcp'],
|
|
4896
|
+
username: 'u',
|
|
4897
|
+
password: 'p',
|
|
4898
|
+
},
|
|
4899
|
+
turnDiscoverySkippedReason: undefined,
|
|
4900
|
+
});
|
|
4901
|
+
|
|
4902
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
4903
|
+
.stub()
|
|
4904
|
+
.rejects(new MediaConnectionTimedOutError('timed out', true));
|
|
4905
|
+
|
|
4906
|
+
await assert.isRejected(
|
|
4907
|
+
meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, 'relay', {
|
|
4908
|
+
mediaSettings: {},
|
|
4909
|
+
})
|
|
4910
|
+
);
|
|
4911
|
+
|
|
4912
|
+
const failureCall = Metrics.sendBehavioralMetric
|
|
4913
|
+
.getCalls()
|
|
4914
|
+
.find((call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE);
|
|
4915
|
+
assert.isDefined(failureCall);
|
|
4916
|
+
assert.equal(failureCall.args[1].iceTransportPolicy, 'relay');
|
|
4917
|
+
});
|
|
4918
|
+
});
|
|
4919
|
+
|
|
3542
4920
|
it('should resolve if waitForMediaConnectionConnected() rejects the first time but resolves the second time', async () => {
|
|
3543
4921
|
const FAKE_ERROR = {fatal: true};
|
|
3544
4922
|
webex.meetings.reachability = {
|
|
@@ -3728,6 +5106,7 @@ describe('plugin-meetings', () => {
|
|
|
3728
5106
|
isMultistream: false,
|
|
3729
5107
|
retriedWithTurnServer: true,
|
|
3730
5108
|
isJoinWithMediaRetry: false,
|
|
5109
|
+
iceTransportPolicy: 'all',
|
|
3731
5110
|
iceCandidatesCount: 0,
|
|
3732
5111
|
subnet_reachable: null,
|
|
3733
5112
|
selected_cluster: null,
|
|
@@ -3891,6 +5270,7 @@ describe('plugin-meetings', () => {
|
|
|
3891
5270
|
isMultistream: false,
|
|
3892
5271
|
retriedWithTurnServer: false,
|
|
3893
5272
|
isJoinWithMediaRetry: false,
|
|
5273
|
+
iceTransportPolicy: 'all',
|
|
3894
5274
|
someReachabilityMetric1: 'some value1',
|
|
3895
5275
|
someReachabilityMetric2: 'some value2',
|
|
3896
5276
|
iceCandidatesCount: 3,
|
|
@@ -3956,9 +5336,11 @@ describe('plugin-meetings', () => {
|
|
|
3956
5336
|
retriedWithTurnServer: false,
|
|
3957
5337
|
isMultistream: false,
|
|
3958
5338
|
isJoinWithMediaRetry: false,
|
|
5339
|
+
iceTransportPolicy: 'all',
|
|
3959
5340
|
signalingState: 'unknown',
|
|
3960
5341
|
connectionState: 'unknown',
|
|
3961
5342
|
iceConnectionState: 'unknown',
|
|
5343
|
+
connectionType: 'udp',
|
|
3962
5344
|
selectedCandidatePairChanges: 2,
|
|
3963
5345
|
numTransports: 1,
|
|
3964
5346
|
subnet_reachable: null,
|
|
@@ -4019,9 +5401,11 @@ describe('plugin-meetings', () => {
|
|
|
4019
5401
|
retriedWithTurnServer: false,
|
|
4020
5402
|
isMultistream: false,
|
|
4021
5403
|
isJoinWithMediaRetry: false,
|
|
5404
|
+
iceTransportPolicy: 'all',
|
|
4022
5405
|
signalingState: 'unknown',
|
|
4023
5406
|
connectionState: 'unknown',
|
|
4024
5407
|
iceConnectionState: 'unknown',
|
|
5408
|
+
connectionType: 'udp',
|
|
4025
5409
|
selectedCandidatePairChanges: 2,
|
|
4026
5410
|
numTransports: 1,
|
|
4027
5411
|
'701_error': 2,
|
|
@@ -4083,6 +5467,7 @@ describe('plugin-meetings', () => {
|
|
|
4083
5467
|
isMultistream: false,
|
|
4084
5468
|
retriedWithTurnServer: false,
|
|
4085
5469
|
isJoinWithMediaRetry: false,
|
|
5470
|
+
iceTransportPolicy: 'all',
|
|
4086
5471
|
iceCandidatesCount: 0,
|
|
4087
5472
|
reachability_public_udp_success: 5,
|
|
4088
5473
|
subnet_reachable: false,
|
|
@@ -4148,9 +5533,11 @@ describe('plugin-meetings', () => {
|
|
|
4148
5533
|
retriedWithTurnServer: false,
|
|
4149
5534
|
isMultistream: false,
|
|
4150
5535
|
isJoinWithMediaRetry: false,
|
|
5536
|
+
iceTransportPolicy: 'all',
|
|
4151
5537
|
signalingState: 'unknown',
|
|
4152
5538
|
connectionState: 'unknown',
|
|
4153
5539
|
iceConnectionState: 'unknown',
|
|
5540
|
+
connectionType: 'udp',
|
|
4154
5541
|
selectedCandidatePairChanges: 2,
|
|
4155
5542
|
numTransports: 1,
|
|
4156
5543
|
reachability_public_udp_success: 5,
|
|
@@ -4534,6 +5921,297 @@ describe('plugin-meetings', () => {
|
|
|
4534
5921
|
},
|
|
4535
5922
|
});
|
|
4536
5923
|
});
|
|
5924
|
+
|
|
5925
|
+
describe('handles STATS_UPDATE event for SRTP cipher detection', () => {
|
|
5926
|
+
it('emits MEETING_SRTP_CIPHER_UPDATED event when srtpCipher is found in transport stats', async () => {
|
|
5927
|
+
const fakeStats = new Map([
|
|
5928
|
+
[
|
|
5929
|
+
'transport-1',
|
|
5930
|
+
{
|
|
5931
|
+
type: 'transport',
|
|
5932
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5933
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5934
|
+
},
|
|
5935
|
+
],
|
|
5936
|
+
[
|
|
5937
|
+
'outbound-rtp-1',
|
|
5938
|
+
{
|
|
5939
|
+
type: 'outbound-rtp',
|
|
5940
|
+
ssrc: 12345,
|
|
5941
|
+
},
|
|
5942
|
+
],
|
|
5943
|
+
]);
|
|
5944
|
+
|
|
5945
|
+
statsAnalyzerStub.emit(
|
|
5946
|
+
{file: 'test', function: 'test'},
|
|
5947
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5948
|
+
{stats: fakeStats}
|
|
5949
|
+
);
|
|
5950
|
+
|
|
5951
|
+
assert.calledWith(
|
|
5952
|
+
TriggerProxy.trigger,
|
|
5953
|
+
sinon.match.instanceOf(Meeting),
|
|
5954
|
+
{
|
|
5955
|
+
file: 'meeting/index',
|
|
5956
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5957
|
+
},
|
|
5958
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5959
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
5960
|
+
);
|
|
5961
|
+
|
|
5962
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5963
|
+
});
|
|
5964
|
+
|
|
5965
|
+
it('updates meeting.mediaProperties.srtpCipher when cipher changes', async () => {
|
|
5966
|
+
const firstStats = new Map([
|
|
5967
|
+
[
|
|
5968
|
+
'transport-1',
|
|
5969
|
+
{
|
|
5970
|
+
type: 'transport',
|
|
5971
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5972
|
+
},
|
|
5973
|
+
],
|
|
5974
|
+
]);
|
|
5975
|
+
|
|
5976
|
+
statsAnalyzerStub.emit(
|
|
5977
|
+
{file: 'test', function: 'test'},
|
|
5978
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5979
|
+
{stats: firstStats}
|
|
5980
|
+
);
|
|
5981
|
+
|
|
5982
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5983
|
+
|
|
5984
|
+
const secondStats = new Map([
|
|
5985
|
+
[
|
|
5986
|
+
'transport-1',
|
|
5987
|
+
{
|
|
5988
|
+
type: 'transport',
|
|
5989
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5990
|
+
},
|
|
5991
|
+
],
|
|
5992
|
+
]);
|
|
5993
|
+
|
|
5994
|
+
TriggerProxy.trigger.resetHistory();
|
|
5995
|
+
|
|
5996
|
+
statsAnalyzerStub.emit(
|
|
5997
|
+
{file: 'test', function: 'test'},
|
|
5998
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5999
|
+
{stats: secondStats}
|
|
6000
|
+
);
|
|
6001
|
+
|
|
6002
|
+
assert.calledWith(
|
|
6003
|
+
TriggerProxy.trigger,
|
|
6004
|
+
sinon.match.instanceOf(Meeting),
|
|
6005
|
+
{
|
|
6006
|
+
file: 'meeting/index',
|
|
6007
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
6008
|
+
},
|
|
6009
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6010
|
+
{srtpCipher: 'AEAD_AES_256_GCM'}
|
|
6011
|
+
);
|
|
6012
|
+
|
|
6013
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AEAD_AES_256_GCM');
|
|
6014
|
+
});
|
|
6015
|
+
|
|
6016
|
+
it('does not emit event when srtpCipher has not changed', async () => {
|
|
6017
|
+
const firstStats = new Map([
|
|
6018
|
+
[
|
|
6019
|
+
'transport-1',
|
|
6020
|
+
{
|
|
6021
|
+
type: 'transport',
|
|
6022
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
6023
|
+
},
|
|
6024
|
+
],
|
|
6025
|
+
]);
|
|
6026
|
+
|
|
6027
|
+
statsAnalyzerStub.emit(
|
|
6028
|
+
{file: 'test', function: 'test'},
|
|
6029
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6030
|
+
{stats: firstStats}
|
|
6031
|
+
);
|
|
6032
|
+
|
|
6033
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
6034
|
+
|
|
6035
|
+
TriggerProxy.trigger.resetHistory();
|
|
6036
|
+
|
|
6037
|
+
// Emit same cipher again
|
|
6038
|
+
statsAnalyzerStub.emit(
|
|
6039
|
+
{file: 'test', function: 'test'},
|
|
6040
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6041
|
+
{stats: firstStats}
|
|
6042
|
+
);
|
|
6043
|
+
|
|
6044
|
+
// Should not trigger event again
|
|
6045
|
+
assert.neverCalledWith(
|
|
6046
|
+
TriggerProxy.trigger,
|
|
6047
|
+
sinon.match.instanceOf(Meeting),
|
|
6048
|
+
sinon.match.any,
|
|
6049
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6050
|
+
sinon.match.any
|
|
6051
|
+
);
|
|
6052
|
+
|
|
6053
|
+
// Cipher should remain the same
|
|
6054
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
6055
|
+
});
|
|
6056
|
+
|
|
6057
|
+
it('does not emit event when stats contain no transport with srtpCipher', async () => {
|
|
6058
|
+
const fakeStats = new Map([
|
|
6059
|
+
[
|
|
6060
|
+
'outbound-rtp-1',
|
|
6061
|
+
{
|
|
6062
|
+
type: 'outbound-rtp',
|
|
6063
|
+
ssrc: 12345,
|
|
6064
|
+
},
|
|
6065
|
+
],
|
|
6066
|
+
[
|
|
6067
|
+
'inbound-rtp-1',
|
|
6068
|
+
{
|
|
6069
|
+
type: 'inbound-rtp',
|
|
6070
|
+
ssrc: 67890,
|
|
6071
|
+
},
|
|
6072
|
+
],
|
|
6073
|
+
]);
|
|
6074
|
+
|
|
6075
|
+
statsAnalyzerStub.emit(
|
|
6076
|
+
{file: 'test', function: 'test'},
|
|
6077
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6078
|
+
{stats: fakeStats}
|
|
6079
|
+
);
|
|
6080
|
+
|
|
6081
|
+
assert.neverCalledWith(
|
|
6082
|
+
TriggerProxy.trigger,
|
|
6083
|
+
sinon.match.instanceOf(Meeting),
|
|
6084
|
+
sinon.match.any,
|
|
6085
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6086
|
+
sinon.match.any
|
|
6087
|
+
);
|
|
6088
|
+
|
|
6089
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
6090
|
+
});
|
|
6091
|
+
|
|
6092
|
+
it('does not emit event when transport stat has no srtpCipher property', async () => {
|
|
6093
|
+
const fakeStats = new Map([
|
|
6094
|
+
[
|
|
6095
|
+
'transport-1',
|
|
6096
|
+
{
|
|
6097
|
+
type: 'transport',
|
|
6098
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
6099
|
+
// no srtpCipher property
|
|
6100
|
+
},
|
|
6101
|
+
],
|
|
6102
|
+
]);
|
|
6103
|
+
|
|
6104
|
+
statsAnalyzerStub.emit(
|
|
6105
|
+
{file: 'test', function: 'test'},
|
|
6106
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6107
|
+
{stats: fakeStats}
|
|
6108
|
+
);
|
|
6109
|
+
|
|
6110
|
+
assert.neverCalledWith(
|
|
6111
|
+
TriggerProxy.trigger,
|
|
6112
|
+
sinon.match.instanceOf(Meeting),
|
|
6113
|
+
sinon.match.any,
|
|
6114
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6115
|
+
sinon.match.any
|
|
6116
|
+
);
|
|
6117
|
+
|
|
6118
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
6119
|
+
});
|
|
6120
|
+
|
|
6121
|
+
it('uses first transport with srtpCipher when multiple transports exist', async () => {
|
|
6122
|
+
const fakeStats = new Map([
|
|
6123
|
+
[
|
|
6124
|
+
'transport-1',
|
|
6125
|
+
{
|
|
6126
|
+
type: 'transport',
|
|
6127
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
6128
|
+
},
|
|
6129
|
+
],
|
|
6130
|
+
[
|
|
6131
|
+
'transport-2',
|
|
6132
|
+
{
|
|
6133
|
+
type: 'transport',
|
|
6134
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
6135
|
+
},
|
|
6136
|
+
],
|
|
6137
|
+
[
|
|
6138
|
+
'outbound-rtp-1',
|
|
6139
|
+
{
|
|
6140
|
+
type: 'outbound-rtp',
|
|
6141
|
+
ssrc: 12345,
|
|
6142
|
+
},
|
|
6143
|
+
],
|
|
6144
|
+
]);
|
|
6145
|
+
|
|
6146
|
+
statsAnalyzerStub.emit(
|
|
6147
|
+
{file: 'test', function: 'test'},
|
|
6148
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6149
|
+
{stats: fakeStats}
|
|
6150
|
+
);
|
|
6151
|
+
|
|
6152
|
+
assert.calledWith(
|
|
6153
|
+
TriggerProxy.trigger,
|
|
6154
|
+
sinon.match.instanceOf(Meeting),
|
|
6155
|
+
{
|
|
6156
|
+
file: 'meeting/index',
|
|
6157
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
6158
|
+
},
|
|
6159
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6160
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
6161
|
+
);
|
|
6162
|
+
|
|
6163
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
6164
|
+
});
|
|
6165
|
+
|
|
6166
|
+
it('handles empty stats map without errors', async () => {
|
|
6167
|
+
const emptyStats = new Map();
|
|
6168
|
+
|
|
6169
|
+
statsAnalyzerStub.emit(
|
|
6170
|
+
{file: 'test', function: 'test'},
|
|
6171
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6172
|
+
{stats: emptyStats}
|
|
6173
|
+
);
|
|
6174
|
+
|
|
6175
|
+
assert.neverCalledWith(
|
|
6176
|
+
TriggerProxy.trigger,
|
|
6177
|
+
sinon.match.instanceOf(Meeting),
|
|
6178
|
+
sinon.match.any,
|
|
6179
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6180
|
+
sinon.match.any
|
|
6181
|
+
);
|
|
6182
|
+
|
|
6183
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
6184
|
+
});
|
|
6185
|
+
|
|
6186
|
+
it('logs cipher change when cipher is updated', async () => {
|
|
6187
|
+
const loggerSpy = sinon.spy(LoggerProxy.logger, 'info');
|
|
6188
|
+
|
|
6189
|
+
meeting.mediaProperties.srtpCipher = 'AES_CM_128_HMAC_SHA1_80';
|
|
6190
|
+
|
|
6191
|
+
const newStats = new Map([
|
|
6192
|
+
[
|
|
6193
|
+
'transport-1',
|
|
6194
|
+
{
|
|
6195
|
+
type: 'transport',
|
|
6196
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
6197
|
+
},
|
|
6198
|
+
],
|
|
6199
|
+
]);
|
|
6200
|
+
|
|
6201
|
+
statsAnalyzerStub.emit(
|
|
6202
|
+
{file: 'test', function: 'test'},
|
|
6203
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6204
|
+
{stats: newStats}
|
|
6205
|
+
);
|
|
6206
|
+
|
|
6207
|
+
assert.calledWithMatch(
|
|
6208
|
+
loggerSpy,
|
|
6209
|
+
sinon.match(/SRTP cipher changed from AES_CM_128_HMAC_SHA1_80 to AEAD_AES_256_GCM/)
|
|
6210
|
+
);
|
|
6211
|
+
|
|
6212
|
+
loggerSpy.restore();
|
|
6213
|
+
});
|
|
6214
|
+
});
|
|
4537
6215
|
});
|
|
4538
6216
|
|
|
4539
6217
|
describe('handles StatsMonitor events', () => {
|
|
@@ -4637,6 +6315,51 @@ describe('plugin-meetings', () => {
|
|
|
4637
6315
|
member2: unmutedMember,
|
|
4638
6316
|
member3: selfMember,
|
|
4639
6317
|
});
|
|
6318
|
+
meeting.isUserUnadmitted = false;
|
|
6319
|
+
|
|
6320
|
+
// Reset the stub to clear any previous calls
|
|
6321
|
+
TriggerProxy.trigger.resetHistory();
|
|
6322
|
+
|
|
6323
|
+
// Emit the event from statsMonitor
|
|
6324
|
+
listeners[StatsMonitorEventNames.INBOUND_AUDIO_ISSUE](fakeEventData);
|
|
6325
|
+
|
|
6326
|
+
assert.calledWith(
|
|
6327
|
+
TriggerProxy.trigger,
|
|
6328
|
+
meeting,
|
|
6329
|
+
sinon.match.object,
|
|
6330
|
+
EVENT_TRIGGERS.MEDIA_INBOUND_AUDIO_ISSUE_DETECTED,
|
|
6331
|
+
fakeEventData
|
|
6332
|
+
);
|
|
6333
|
+
|
|
6334
|
+
assert.calledOnceWithExactly(
|
|
6335
|
+
meeting.mediaProperties.sendMediaIssueMetric,
|
|
6336
|
+
'inbound_audio',
|
|
6337
|
+
fakeEventData.issueSubType,
|
|
6338
|
+
{
|
|
6339
|
+
correlationId: meeting.correlationId,
|
|
6340
|
+
isMultistream: meeting.isMultistream,
|
|
6341
|
+
}
|
|
6342
|
+
);
|
|
6343
|
+
});
|
|
6344
|
+
|
|
6345
|
+
it('should not trigger event or metric when the user is in the lobby', () => {
|
|
6346
|
+
const fakeEventData = {issueSubType: 'DECODE_RESULTS_IN_ZERO_AUDIO_LEVEL'};
|
|
6347
|
+
|
|
6348
|
+
const unmutedMember = {
|
|
6349
|
+
isSelf: false,
|
|
6350
|
+
isPairedWithSelf: false,
|
|
6351
|
+
isAudioMuted: false,
|
|
6352
|
+
};
|
|
6353
|
+
const selfMember = {
|
|
6354
|
+
isSelf: true,
|
|
6355
|
+
isPairedWithSelf: false,
|
|
6356
|
+
isAudioMuted: false,
|
|
6357
|
+
};
|
|
6358
|
+
meeting.members.membersCollection.getAll = sinon.stub().returns({
|
|
6359
|
+
member1: unmutedMember,
|
|
6360
|
+
member2: selfMember,
|
|
6361
|
+
});
|
|
6362
|
+
meeting.isUserUnadmitted = true;
|
|
4640
6363
|
|
|
4641
6364
|
// Reset the stub to clear any previous calls
|
|
4642
6365
|
TriggerProxy.trigger.resetHistory();
|
|
@@ -4644,20 +6367,14 @@ describe('plugin-meetings', () => {
|
|
|
4644
6367
|
// Emit the event from statsMonitor
|
|
4645
6368
|
listeners[StatsMonitorEventNames.INBOUND_AUDIO_ISSUE](fakeEventData);
|
|
4646
6369
|
|
|
4647
|
-
assert.
|
|
6370
|
+
assert.neverCalledWith(
|
|
4648
6371
|
TriggerProxy.trigger,
|
|
4649
6372
|
meeting,
|
|
4650
6373
|
sinon.match.object,
|
|
4651
6374
|
EVENT_TRIGGERS.MEDIA_INBOUND_AUDIO_ISSUE_DETECTED,
|
|
4652
6375
|
fakeEventData
|
|
4653
6376
|
);
|
|
4654
|
-
|
|
4655
|
-
assert.calledOnceWithExactly(
|
|
4656
|
-
meeting.mediaProperties.sendMediaIssueMetric,
|
|
4657
|
-
'inbound_audio',
|
|
4658
|
-
fakeEventData.issueSubType,
|
|
4659
|
-
meeting.correlationId
|
|
4660
|
-
);
|
|
6377
|
+
assert.notCalled(meeting.mediaProperties.sendMediaIssueMetric);
|
|
4661
6378
|
});
|
|
4662
6379
|
});
|
|
4663
6380
|
});
|
|
@@ -6192,13 +7909,14 @@ describe('plugin-meetings', () => {
|
|
|
6192
7909
|
sinon.stub(meeting.locusMediaRequest, 'downgradeFromMultistreamToTranscoded');
|
|
6193
7910
|
});
|
|
6194
7911
|
|
|
6195
|
-
const runCheck = async (turnServerInfo, forceTurnDiscovery) => {
|
|
7912
|
+
const runCheck = async (turnServerInfo, forceTurnDiscovery, iceTransportPolicy) => {
|
|
6196
7913
|
// we're calling addMediaInternal() with mic stream,
|
|
6197
7914
|
// so that we also verify that audioMute, videoMute info is correctly sent to backend
|
|
6198
7915
|
const addMediaPromise = meeting.addMediaInternal(
|
|
6199
7916
|
() => '',
|
|
6200
|
-
turnServerInfo,
|
|
6201
7917
|
forceTurnDiscovery,
|
|
7918
|
+
turnServerInfo,
|
|
7919
|
+
iceTransportPolicy,
|
|
6202
7920
|
{
|
|
6203
7921
|
localStreams: {microphone: fakeMicrophoneStream},
|
|
6204
7922
|
}
|
|
@@ -6252,6 +7970,10 @@ describe('plugin-meetings', () => {
|
|
|
6252
7970
|
// at this point the meeting should have been downgraded to transcoded
|
|
6253
7971
|
assert.equal(meeting.isMultistream, false);
|
|
6254
7972
|
|
|
7973
|
+
// iceTransportPolicy must be reset to undefined on downgrade to transcoded,
|
|
7974
|
+
// otherwise the transcoded retry could gather direct candidates while metrics report relay
|
|
7975
|
+
assert.isUndefined(meeting.addMediaData.iceTransportPolicy);
|
|
7976
|
+
|
|
6255
7977
|
// old stats analyzer stopped and new one created
|
|
6256
7978
|
assert.calledOnce(initialStatsAnalyzer.stopAnalyzer);
|
|
6257
7979
|
assert.calledOnceWithExactly(
|
|
@@ -6342,6 +8064,11 @@ describe('plugin-meetings', () => {
|
|
|
6342
8064
|
true
|
|
6343
8065
|
);
|
|
6344
8066
|
});
|
|
8067
|
+
|
|
8068
|
+
it('resets iceTransportPolicy to undefined when falling back from multistream (relay) to transcoded', async () => {
|
|
8069
|
+
// simulate a relay-only retry falling back to transcoded and verify iceTransportPolicy is reset
|
|
8070
|
+
await runCheck(undefined, false, 'relay');
|
|
8071
|
+
});
|
|
6345
8072
|
});
|
|
6346
8073
|
}
|
|
6347
8074
|
})
|
|
@@ -6429,6 +8156,9 @@ describe('plugin-meetings', () => {
|
|
|
6429
8156
|
|
|
6430
8157
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
6431
8158
|
webex.internal.llm.off = sinon.stub();
|
|
8159
|
+
webex.internal.mercury.off = sinon.stub();
|
|
8160
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
8161
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
6432
8162
|
|
|
6433
8163
|
// A meeting needs to be joined to leave
|
|
6434
8164
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -6452,6 +8182,67 @@ describe('plugin-meetings', () => {
|
|
|
6452
8182
|
assert.calledOnce(meeting.clearMeetingData);
|
|
6453
8183
|
});
|
|
6454
8184
|
|
|
8185
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
8186
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8187
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8188
|
+
|
|
8189
|
+
await meeting.leave();
|
|
8190
|
+
|
|
8191
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
8192
|
+
// annotation) must be detached before the /leave request so that
|
|
8193
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
8194
|
+
// (per Locus team recommendation).
|
|
8195
|
+
assert.callOrder(
|
|
8196
|
+
webex.internal.llm.off,
|
|
8197
|
+
webex.internal.mercury.off,
|
|
8198
|
+
meeting.stopTranscription,
|
|
8199
|
+
meeting.annotation.deregisterEvents,
|
|
8200
|
+
meeting.meetingRequest.leaveMeeting
|
|
8201
|
+
);
|
|
8202
|
+
assert.calledWithExactly(
|
|
8203
|
+
webex.internal.llm.off,
|
|
8204
|
+
'event:relay.event',
|
|
8205
|
+
meeting.processRelayEvent
|
|
8206
|
+
);
|
|
8207
|
+
assert.calledWithExactly(
|
|
8208
|
+
webex.internal.llm.off,
|
|
8209
|
+
LOCUS_LLM_EVENT,
|
|
8210
|
+
meeting.processLocusLLMEvent
|
|
8211
|
+
);
|
|
8212
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
8213
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
8214
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
8215
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
8216
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8217
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8218
|
+
assert.isUndefined(meeting.transcription);
|
|
8219
|
+
});
|
|
8220
|
+
|
|
8221
|
+
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
8222
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8223
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8224
|
+
meeting.meetingRequest.leaveMeeting = sinon
|
|
8225
|
+
.stub()
|
|
8226
|
+
.returns(Promise.reject(new Error('leave failed')));
|
|
8227
|
+
|
|
8228
|
+
await meeting.leave().catch(() => {});
|
|
8229
|
+
|
|
8230
|
+
assert.calledWithExactly(
|
|
8231
|
+
webex.internal.llm.off,
|
|
8232
|
+
'event:relay.event',
|
|
8233
|
+
meeting.processRelayEvent
|
|
8234
|
+
);
|
|
8235
|
+
assert.calledWithExactly(
|
|
8236
|
+
webex.internal.llm.off,
|
|
8237
|
+
LOCUS_LLM_EVENT,
|
|
8238
|
+
meeting.processLocusLLMEvent
|
|
8239
|
+
);
|
|
8240
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
8241
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
8242
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8243
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8244
|
+
});
|
|
8245
|
+
|
|
6455
8246
|
it('should reset call diagnostic latencies correctly', async () => {
|
|
6456
8247
|
const leave = meeting.leave();
|
|
6457
8248
|
|
|
@@ -7349,7 +9140,11 @@ describe('plugin-meetings', () => {
|
|
|
7349
9140
|
beforeEach(() => {
|
|
7350
9141
|
meeting.locusId = 'locus-id';
|
|
7351
9142
|
meeting.id = 'meeting-id';
|
|
7352
|
-
FAKE_OPTIONS = {
|
|
9143
|
+
FAKE_OPTIONS = {
|
|
9144
|
+
meetingId: meeting.id,
|
|
9145
|
+
sendCAevents: true,
|
|
9146
|
+
correlationId: meeting.correlationId,
|
|
9147
|
+
};
|
|
7353
9148
|
});
|
|
7354
9149
|
|
|
7355
9150
|
it('calls meetingInfoProvider with all the right parameters and parses the result', async () => {
|
|
@@ -7434,7 +9229,11 @@ describe('plugin-meetings', () => {
|
|
|
7434
9229
|
undefined,
|
|
7435
9230
|
meeting.locusId,
|
|
7436
9231
|
{},
|
|
7437
|
-
{
|
|
9232
|
+
{
|
|
9233
|
+
meetingId: meeting.id,
|
|
9234
|
+
sendCAevents: false,
|
|
9235
|
+
correlationId: meeting.correlationId,
|
|
9236
|
+
}
|
|
7438
9237
|
);
|
|
7439
9238
|
|
|
7440
9239
|
// parseMeeting info
|
|
@@ -7520,7 +9319,11 @@ describe('plugin-meetings', () => {
|
|
|
7520
9319
|
undefined,
|
|
7521
9320
|
'locus-id',
|
|
7522
9321
|
{},
|
|
7523
|
-
{
|
|
9322
|
+
{
|
|
9323
|
+
meetingId: meeting.id,
|
|
9324
|
+
sendCAevents: true,
|
|
9325
|
+
correlationId: meeting.correlationId,
|
|
9326
|
+
}
|
|
7524
9327
|
);
|
|
7525
9328
|
|
|
7526
9329
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -7556,7 +9359,11 @@ describe('plugin-meetings', () => {
|
|
|
7556
9359
|
undefined,
|
|
7557
9360
|
'locus-id',
|
|
7558
9361
|
{},
|
|
7559
|
-
{
|
|
9362
|
+
{
|
|
9363
|
+
meetingId: meeting.id,
|
|
9364
|
+
sendCAevents: true,
|
|
9365
|
+
correlationId: meeting.correlationId,
|
|
9366
|
+
}
|
|
7560
9367
|
);
|
|
7561
9368
|
|
|
7562
9369
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -7585,7 +9392,11 @@ describe('plugin-meetings', () => {
|
|
|
7585
9392
|
undefined,
|
|
7586
9393
|
'locus-id',
|
|
7587
9394
|
{},
|
|
7588
|
-
{
|
|
9395
|
+
{
|
|
9396
|
+
meetingId: meeting.id,
|
|
9397
|
+
sendCAevents: true,
|
|
9398
|
+
correlationId: meeting.correlationId,
|
|
9399
|
+
}
|
|
7589
9400
|
);
|
|
7590
9401
|
|
|
7591
9402
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -7620,7 +9431,11 @@ describe('plugin-meetings', () => {
|
|
|
7620
9431
|
undefined,
|
|
7621
9432
|
'locus-id',
|
|
7622
9433
|
{},
|
|
7623
|
-
{
|
|
9434
|
+
{
|
|
9435
|
+
meetingId: meeting.id,
|
|
9436
|
+
sendCAevents: true,
|
|
9437
|
+
correlationId: meeting.correlationId,
|
|
9438
|
+
}
|
|
7624
9439
|
);
|
|
7625
9440
|
|
|
7626
9441
|
assert.deepEqual(meeting.meetingInfo, {});
|
|
@@ -7666,7 +9481,11 @@ describe('plugin-meetings', () => {
|
|
|
7666
9481
|
undefined,
|
|
7667
9482
|
'locus-id',
|
|
7668
9483
|
{},
|
|
7669
|
-
{
|
|
9484
|
+
{
|
|
9485
|
+
meetingId: meeting.id,
|
|
9486
|
+
sendCAevents: true,
|
|
9487
|
+
correlationId: meeting.correlationId,
|
|
9488
|
+
}
|
|
7670
9489
|
);
|
|
7671
9490
|
|
|
7672
9491
|
assert.deepEqual(meeting.meetingInfo, {});
|
|
@@ -7700,7 +9519,11 @@ describe('plugin-meetings', () => {
|
|
|
7700
9519
|
undefined,
|
|
7701
9520
|
'locus-id',
|
|
7702
9521
|
{},
|
|
7703
|
-
{
|
|
9522
|
+
{
|
|
9523
|
+
meetingId: meeting.id,
|
|
9524
|
+
sendCAevents: true,
|
|
9525
|
+
correlationId: meeting.correlationId,
|
|
9526
|
+
}
|
|
7704
9527
|
);
|
|
7705
9528
|
|
|
7706
9529
|
assert.deepEqual(meeting.meetingInfo, {
|
|
@@ -7753,7 +9576,11 @@ describe('plugin-meetings', () => {
|
|
|
7753
9576
|
undefined,
|
|
7754
9577
|
'locus-id',
|
|
7755
9578
|
{},
|
|
7756
|
-
{
|
|
9579
|
+
{
|
|
9580
|
+
meetingId: meeting.id,
|
|
9581
|
+
sendCAevents: true,
|
|
9582
|
+
correlationId: meeting.correlationId,
|
|
9583
|
+
}
|
|
7757
9584
|
);
|
|
7758
9585
|
|
|
7759
9586
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -8042,7 +9869,11 @@ describe('plugin-meetings', () => {
|
|
|
8042
9869
|
'fake-installed-org-id',
|
|
8043
9870
|
'locus-id',
|
|
8044
9871
|
{extraParam1: 'value1', permissionToken: FAKE_PERMISSION_TOKEN},
|
|
8045
|
-
{
|
|
9872
|
+
{
|
|
9873
|
+
meetingId: meeting.id,
|
|
9874
|
+
sendCAevents: true,
|
|
9875
|
+
correlationId: meeting.correlationId,
|
|
9876
|
+
},
|
|
8046
9877
|
null,
|
|
8047
9878
|
null,
|
|
8048
9879
|
null
|
|
@@ -8090,7 +9921,11 @@ describe('plugin-meetings', () => {
|
|
|
8090
9921
|
'fake-installed-org-id',
|
|
8091
9922
|
'locus-id',
|
|
8092
9923
|
{extraParam1: 'value1', permissionToken: FAKE_PERMISSION_TOKEN},
|
|
8093
|
-
{
|
|
9924
|
+
{
|
|
9925
|
+
meetingId: meeting.id,
|
|
9926
|
+
sendCAevents: true,
|
|
9927
|
+
correlationId: meeting.correlationId,
|
|
9928
|
+
},
|
|
8094
9929
|
null,
|
|
8095
9930
|
null,
|
|
8096
9931
|
null
|
|
@@ -8147,7 +9982,11 @@ describe('plugin-meetings', () => {
|
|
|
8147
9982
|
extraParam1: 'value1',
|
|
8148
9983
|
permissionToken: FAKE_PERMISSION_TOKEN,
|
|
8149
9984
|
},
|
|
8150
|
-
{
|
|
9985
|
+
{
|
|
9986
|
+
meetingId: meeting.id,
|
|
9987
|
+
sendCAevents: true,
|
|
9988
|
+
correlationId: meeting.correlationId,
|
|
9989
|
+
},
|
|
8151
9990
|
null,
|
|
8152
9991
|
null,
|
|
8153
9992
|
null
|
|
@@ -8459,6 +10298,9 @@ describe('plugin-meetings', () => {
|
|
|
8459
10298
|
|
|
8460
10299
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
8461
10300
|
webex.internal.llm.off = sinon.stub();
|
|
10301
|
+
webex.internal.mercury.off = sinon.stub();
|
|
10302
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
10303
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
8462
10304
|
|
|
8463
10305
|
// A meeting needs to be joined to end
|
|
8464
10306
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -8481,6 +10323,66 @@ describe('plugin-meetings', () => {
|
|
|
8481
10323
|
assert.calledOnce(meeting?.unsetPeerConnections);
|
|
8482
10324
|
assert.calledOnce(meeting?.clearMeetingData);
|
|
8483
10325
|
});
|
|
10326
|
+
|
|
10327
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
10328
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10329
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10330
|
+
|
|
10331
|
+
await meeting.endMeetingForAll();
|
|
10332
|
+
|
|
10333
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
10334
|
+
// annotation) must be detached before the /end request so that
|
|
10335
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
10336
|
+
// (per Locus team recommendation).
|
|
10337
|
+
assert.callOrder(
|
|
10338
|
+
webex.internal.llm.off,
|
|
10339
|
+
webex.internal.mercury.off,
|
|
10340
|
+
meeting.stopTranscription,
|
|
10341
|
+
meeting.annotation.deregisterEvents,
|
|
10342
|
+
meeting.meetingRequest.endMeetingForAll
|
|
10343
|
+
);
|
|
10344
|
+
assert.calledWithExactly(
|
|
10345
|
+
webex.internal.llm.off,
|
|
10346
|
+
'event:relay.event',
|
|
10347
|
+
meeting.processRelayEvent
|
|
10348
|
+
);
|
|
10349
|
+
assert.calledWithExactly(
|
|
10350
|
+
webex.internal.llm.off,
|
|
10351
|
+
LOCUS_LLM_EVENT,
|
|
10352
|
+
meeting.processLocusLLMEvent
|
|
10353
|
+
);
|
|
10354
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
10355
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
10356
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
10357
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
10358
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
10359
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
10360
|
+
});
|
|
10361
|
+
|
|
10362
|
+
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
10363
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10364
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10365
|
+
meeting.meetingRequest.endMeetingForAll = sinon
|
|
10366
|
+
.stub()
|
|
10367
|
+
.returns(Promise.reject(new Error('end failed')));
|
|
10368
|
+
|
|
10369
|
+
await meeting.endMeetingForAll().catch(() => {});
|
|
10370
|
+
|
|
10371
|
+
assert.calledWithExactly(
|
|
10372
|
+
webex.internal.llm.off,
|
|
10373
|
+
'event:relay.event',
|
|
10374
|
+
meeting.processRelayEvent
|
|
10375
|
+
);
|
|
10376
|
+
assert.calledWithExactly(
|
|
10377
|
+
webex.internal.llm.off,
|
|
10378
|
+
LOCUS_LLM_EVENT,
|
|
10379
|
+
meeting.processLocusLLMEvent
|
|
10380
|
+
);
|
|
10381
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
10382
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
10383
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
10384
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
10385
|
+
});
|
|
8484
10386
|
});
|
|
8485
10387
|
|
|
8486
10388
|
describe('#moveTo', () => {
|
|
@@ -9262,7 +11164,9 @@ describe('plugin-meetings', () => {
|
|
|
9262
11164
|
MediaCodecMimeType.OPUS,
|
|
9263
11165
|
['maxaveragebitrate', 'maxplaybackrate']
|
|
9264
11166
|
);
|
|
9265
|
-
assert.notCalled(
|
|
11167
|
+
assert.notCalled(
|
|
11168
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters
|
|
11169
|
+
);
|
|
9266
11170
|
});
|
|
9267
11171
|
});
|
|
9268
11172
|
|
|
@@ -9990,6 +11894,8 @@ describe('plugin-meetings', () => {
|
|
|
9990
11894
|
});
|
|
9991
11895
|
|
|
9992
11896
|
it('handles REMOTE_SDP_ANSWER_PROCESSED correctly', () => {
|
|
11897
|
+
// capture the start timestamp before any fake timers are installed
|
|
11898
|
+
const localSdpGeneratedTimestamp = Date.now() - 100;
|
|
9993
11899
|
const clock = sinon.useFakeTimers();
|
|
9994
11900
|
sinon.spy(clock, 'clearTimeout');
|
|
9995
11901
|
meeting.deferSDPAnswer = {
|
|
@@ -9997,24 +11903,29 @@ describe('plugin-meetings', () => {
|
|
|
9997
11903
|
};
|
|
9998
11904
|
meeting.sdpResponseTimer = '1234';
|
|
9999
11905
|
|
|
11906
|
+
// latency is computed as Date.now() - the stored local-sdp-generated timestamp,
|
|
11907
|
+
// so it is unaffected by any earlier remote-sdp-received timestamp saved on timeout
|
|
11908
|
+
webex.internal.newMetrics.callDiagnosticLatencies.latencyTimestamps = new Map([
|
|
11909
|
+
['client.media-engine.local-sdp-generated', localSdpGeneratedTimestamp],
|
|
11910
|
+
]);
|
|
11911
|
+
|
|
10000
11912
|
eventListeners[MediaConnectionEventNames.REMOTE_SDP_ANSWER_PROCESSED]();
|
|
10001
11913
|
|
|
10002
11914
|
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
10003
11915
|
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
10004
11916
|
name: 'client.media-engine.remote-sdp-received',
|
|
11917
|
+
payload: {
|
|
11918
|
+
eventData: {
|
|
11919
|
+
localSDPGenRemoteSDPRecv: sinon.match(
|
|
11920
|
+
(value) => typeof value === 'number' && value >= 100 && value < 5000
|
|
11921
|
+
),
|
|
11922
|
+
},
|
|
11923
|
+
},
|
|
10005
11924
|
options: {meetingId: meeting.id},
|
|
10006
11925
|
});
|
|
10007
11926
|
|
|
10008
|
-
|
|
10009
|
-
assert.
|
|
10010
|
-
Metrics.sendBehavioralMetric,
|
|
10011
|
-
BEHAVIORAL_METRICS.ROAP_OFFER_TO_ANSWER_LATENCY,
|
|
10012
|
-
{
|
|
10013
|
-
correlation_id: meeting.correlationId,
|
|
10014
|
-
meetingId: meeting.id,
|
|
10015
|
-
latency: undefined,
|
|
10016
|
-
}
|
|
10017
|
-
);
|
|
11927
|
+
// the high-volume ROAP_OFFER_TO_ANSWER_LATENCY behavioral metric is no longer sent
|
|
11928
|
+
assert.notCalled(Metrics.sendBehavioralMetric);
|
|
10018
11929
|
|
|
10019
11930
|
assert.calledOnce(meeting.deferSDPAnswer.resolve);
|
|
10020
11931
|
assert.calledOnce(clock.clearTimeout);
|
|
@@ -10022,6 +11933,28 @@ describe('plugin-meetings', () => {
|
|
|
10022
11933
|
assert.equal(meeting.sdpResponseTimer, undefined);
|
|
10023
11934
|
});
|
|
10024
11935
|
|
|
11936
|
+
it('sends undefined localSDPGenRemoteSDPRecv when the local-sdp-generated timestamp is missing', () => {
|
|
11937
|
+
meeting.deferSDPAnswer = {
|
|
11938
|
+
resolve: sinon.stub(),
|
|
11939
|
+
};
|
|
11940
|
+
|
|
11941
|
+
// no local-sdp-generated timestamp stored -> latency cannot be computed
|
|
11942
|
+
webex.internal.newMetrics.callDiagnosticLatencies.latencyTimestamps = new Map();
|
|
11943
|
+
|
|
11944
|
+
eventListeners[MediaConnectionEventNames.REMOTE_SDP_ANSWER_PROCESSED]();
|
|
11945
|
+
|
|
11946
|
+
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
11947
|
+
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
11948
|
+
name: 'client.media-engine.remote-sdp-received',
|
|
11949
|
+
payload: {
|
|
11950
|
+
eventData: {
|
|
11951
|
+
localSDPGenRemoteSDPRecv: undefined,
|
|
11952
|
+
},
|
|
11953
|
+
},
|
|
11954
|
+
options: {meetingId: meeting.id},
|
|
11955
|
+
});
|
|
11956
|
+
});
|
|
11957
|
+
|
|
10025
11958
|
it('handles LOCAL_SDP_OFFER_GENERATED correctly', () => {
|
|
10026
11959
|
assert.equal(meeting.deferSDPAnswer, undefined);
|
|
10027
11960
|
|
|
@@ -10417,16 +12350,16 @@ describe('plugin-meetings', () => {
|
|
|
10417
12350
|
);
|
|
10418
12351
|
done();
|
|
10419
12352
|
});
|
|
10420
|
-
it('listens to the self admitted guest event
|
|
12353
|
+
it('listens to the self admitted guest event and waits for token prefetch before reconnecting LLM', async () => {
|
|
10421
12354
|
meeting.stopKeepAlive = sinon.stub();
|
|
10422
12355
|
meeting.updateLLMConnection = sinon.stub();
|
|
10423
12356
|
let resolvePrefetch;
|
|
10424
12357
|
|
|
10425
|
-
meeting.ensureDefaultDatachannelTokenAfterAdmit = sinon
|
|
10426
|
-
|
|
10427
|
-
.returns(new Promise((resolve) => {
|
|
12358
|
+
meeting.ensureDefaultDatachannelTokenAfterAdmit = sinon.stub().returns(
|
|
12359
|
+
new Promise((resolve) => {
|
|
10428
12360
|
resolvePrefetch = resolve;
|
|
10429
|
-
})
|
|
12361
|
+
})
|
|
12362
|
+
);
|
|
10430
12363
|
meeting.rtcMetrics = {
|
|
10431
12364
|
sendNextMetrics: sinon.stub(),
|
|
10432
12365
|
};
|
|
@@ -10443,7 +12376,7 @@ describe('plugin-meetings', () => {
|
|
|
10443
12376
|
'meeting:self:guestAdmitted',
|
|
10444
12377
|
{payload: test1}
|
|
10445
12378
|
);
|
|
10446
|
-
assert.
|
|
12379
|
+
assert.notCalled(meeting.updateLLMConnection);
|
|
10447
12380
|
assert.calledOnceWithExactly(meeting.rtcMetrics.sendNextMetrics);
|
|
10448
12381
|
|
|
10449
12382
|
assert.calledOnceWithExactly(
|
|
@@ -10456,6 +12389,7 @@ describe('plugin-meetings', () => {
|
|
|
10456
12389
|
|
|
10457
12390
|
resolvePrefetch(false);
|
|
10458
12391
|
await Promise.resolve();
|
|
12392
|
+
await Promise.resolve();
|
|
10459
12393
|
|
|
10460
12394
|
assert.calledOnce(meeting.updateLLMConnection);
|
|
10461
12395
|
});
|
|
@@ -10971,6 +12905,106 @@ describe('plugin-meetings', () => {
|
|
|
10971
12905
|
);
|
|
10972
12906
|
});
|
|
10973
12907
|
|
|
12908
|
+
const recordingTestCases = [
|
|
12909
|
+
{
|
|
12910
|
+
description: 'triggers MEETING_STARTED_RECORDING when state is RECORDING',
|
|
12911
|
+
state: RECORDING_STATE.RECORDING,
|
|
12912
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12913
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12914
|
+
},
|
|
12915
|
+
{
|
|
12916
|
+
description: 'triggers MEETING_STOPPED_RECORDING when state is IDLE',
|
|
12917
|
+
state: RECORDING_STATE.IDLE,
|
|
12918
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STOPPED_RECORDING,
|
|
12919
|
+
expectedRecordingState: RECORDING_STATE.IDLE,
|
|
12920
|
+
},
|
|
12921
|
+
{
|
|
12922
|
+
description: 'triggers MEETING_PAUSED_RECORDING when state is PAUSED',
|
|
12923
|
+
state: RECORDING_STATE.PAUSED,
|
|
12924
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_PAUSED_RECORDING,
|
|
12925
|
+
expectedRecordingState: RECORDING_STATE.PAUSED,
|
|
12926
|
+
},
|
|
12927
|
+
{
|
|
12928
|
+
description:
|
|
12929
|
+
'triggers MEETING_RESUMED_RECORDING and sets state to RECORDING when state is RESUMED',
|
|
12930
|
+
state: RECORDING_STATE.RESUMED,
|
|
12931
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_RESUMED_RECORDING,
|
|
12932
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12933
|
+
},
|
|
12934
|
+
];
|
|
12935
|
+
|
|
12936
|
+
recordingTestCases.forEach(
|
|
12937
|
+
({description, state, expectedEvent, expectedRecordingState}) => {
|
|
12938
|
+
it(`listens to CONTROLS_RECORDING_UPDATED - ${description}`, async () => {
|
|
12939
|
+
const modifiedBy = 'user-id-123';
|
|
12940
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12941
|
+
|
|
12942
|
+
await meeting.locusInfo.emitScoped(
|
|
12943
|
+
{function: 'test', file: 'test'},
|
|
12944
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12945
|
+
{
|
|
12946
|
+
state,
|
|
12947
|
+
modifiedBy,
|
|
12948
|
+
lastModified,
|
|
12949
|
+
modifiedByServiceAppName: undefined,
|
|
12950
|
+
modifiedByServiceAppId: undefined,
|
|
12951
|
+
}
|
|
12952
|
+
);
|
|
12953
|
+
|
|
12954
|
+
assert.deepEqual(meeting.recording, {
|
|
12955
|
+
state: expectedRecordingState,
|
|
12956
|
+
modifiedBy,
|
|
12957
|
+
lastModified,
|
|
12958
|
+
modifiedByServiceAppName: undefined,
|
|
12959
|
+
modifiedByServiceAppId: undefined,
|
|
12960
|
+
});
|
|
12961
|
+
|
|
12962
|
+
assert.calledWith(
|
|
12963
|
+
TriggerProxy.trigger,
|
|
12964
|
+
meeting,
|
|
12965
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12966
|
+
expectedEvent,
|
|
12967
|
+
meeting.recording
|
|
12968
|
+
);
|
|
12969
|
+
});
|
|
12970
|
+
}
|
|
12971
|
+
);
|
|
12972
|
+
|
|
12973
|
+
it('listens to CONTROLS_RECORDING_UPDATED and includes modifiedByServiceAppName and modifiedByServiceAppId when present', async () => {
|
|
12974
|
+
const modifiedBy = 'user-id-123';
|
|
12975
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12976
|
+
const modifiedByServiceAppName = 'My Bot';
|
|
12977
|
+
const modifiedByServiceAppId = 'app-id-123';
|
|
12978
|
+
|
|
12979
|
+
await meeting.locusInfo.emitScoped(
|
|
12980
|
+
{function: 'test', file: 'test'},
|
|
12981
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12982
|
+
{
|
|
12983
|
+
state: RECORDING_STATE.RECORDING,
|
|
12984
|
+
modifiedBy,
|
|
12985
|
+
lastModified,
|
|
12986
|
+
modifiedByServiceAppName,
|
|
12987
|
+
modifiedByServiceAppId,
|
|
12988
|
+
}
|
|
12989
|
+
);
|
|
12990
|
+
|
|
12991
|
+
assert.deepEqual(meeting.recording, {
|
|
12992
|
+
state: RECORDING_STATE.RECORDING,
|
|
12993
|
+
modifiedBy,
|
|
12994
|
+
lastModified,
|
|
12995
|
+
modifiedByServiceAppName,
|
|
12996
|
+
modifiedByServiceAppId,
|
|
12997
|
+
});
|
|
12998
|
+
|
|
12999
|
+
assert.calledWith(
|
|
13000
|
+
TriggerProxy.trigger,
|
|
13001
|
+
meeting,
|
|
13002
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
13003
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
13004
|
+
meeting.recording
|
|
13005
|
+
);
|
|
13006
|
+
});
|
|
13007
|
+
|
|
10974
13008
|
it('listens to the locus interpretation update event', () => {
|
|
10975
13009
|
const interpretation = {
|
|
10976
13010
|
siLanguages: [{languageCode: 20, languageName: 'en'}],
|
|
@@ -11024,6 +13058,7 @@ describe('plugin-meetings', () => {
|
|
|
11024
13058
|
meeting.annotation.locusUrlUpdate = sinon.stub();
|
|
11025
13059
|
meeting.simultaneousInterpretation.locusUrlUpdate = sinon.stub();
|
|
11026
13060
|
meeting.webinar.locusUrlUpdate = sinon.stub();
|
|
13061
|
+
meeting.aiEnableRequest.locusUrlUpdate = sinon.stub();
|
|
11027
13062
|
|
|
11028
13063
|
meeting.locusInfo.emit(
|
|
11029
13064
|
{function: 'test', file: 'test'},
|
|
@@ -11038,6 +13073,7 @@ describe('plugin-meetings', () => {
|
|
|
11038
13073
|
assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
|
|
11039
13074
|
assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
|
|
11040
13075
|
assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
|
|
13076
|
+
assert.calledWith(meeting.aiEnableRequest.locusUrlUpdate, newLocusUrl);
|
|
11041
13077
|
assert.equal(meeting.locusUrl, newLocusUrl);
|
|
11042
13078
|
assert(meeting.locusId, '12345');
|
|
11043
13079
|
|
|
@@ -11353,6 +13389,109 @@ describe('plugin-meetings', () => {
|
|
|
11353
13389
|
});
|
|
11354
13390
|
});
|
|
11355
13391
|
|
|
13392
|
+
describe('#finalizeMeetingAfterInitialLocusSetup', () => {
|
|
13393
|
+
it('refreshes destination from synced locus when destination type is LOCUS_ID', () => {
|
|
13394
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13395
|
+
|
|
13396
|
+
meeting.destinationType = DESTINATION_TYPE.LOCUS_ID;
|
|
13397
|
+
meeting.destination = {info: {topic: 'old'}};
|
|
13398
|
+
|
|
13399
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
13400
|
+
|
|
13401
|
+
assert.equal(meeting.destination, syncedLocus);
|
|
13402
|
+
});
|
|
13403
|
+
|
|
13404
|
+
it('does not refresh destination when destination type is not LOCUS_ID', () => {
|
|
13405
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13406
|
+
const originalDestination = {destination: 'original-destination'};
|
|
13407
|
+
|
|
13408
|
+
meeting.destinationType = DESTINATION_TYPE.CONVERSATION_URL;
|
|
13409
|
+
meeting.destination = originalDestination;
|
|
13410
|
+
|
|
13411
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
13412
|
+
|
|
13413
|
+
assert.equal(meeting.destination, originalDestination);
|
|
13414
|
+
});
|
|
13415
|
+
|
|
13416
|
+
it('fetches meeting info when meetingInfo is empty and destination has info', () => {
|
|
13417
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13418
|
+
|
|
13419
|
+
meeting.meetingInfo = {};
|
|
13420
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13421
|
+
|
|
13422
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13423
|
+
|
|
13424
|
+
assert.calledOnceWithExactly(fetchMeetingInfoStub, {});
|
|
13425
|
+
});
|
|
13426
|
+
|
|
13427
|
+
it('does not fetch meeting info when destination has no info', () => {
|
|
13428
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13429
|
+
|
|
13430
|
+
meeting.meetingInfo = {};
|
|
13431
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123'};
|
|
13432
|
+
|
|
13433
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13434
|
+
|
|
13435
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13436
|
+
});
|
|
13437
|
+
|
|
13438
|
+
it('does not fetch meeting info when meetingInfo is already populated', () => {
|
|
13439
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13440
|
+
|
|
13441
|
+
meeting.meetingInfo = {meetingJoinUrl: 'https://example.com/join/abc'};
|
|
13442
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13443
|
+
|
|
13444
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13445
|
+
|
|
13446
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13447
|
+
});
|
|
13448
|
+
|
|
13449
|
+
it('does not fetch meeting info when delayed fetch timer is already scheduled', () => {
|
|
13450
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13451
|
+
|
|
13452
|
+
meeting.meetingInfo = {};
|
|
13453
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13454
|
+
meeting.fetchMeetingInfoTimeoutId = 42;
|
|
13455
|
+
|
|
13456
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13457
|
+
|
|
13458
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13459
|
+
});
|
|
13460
|
+
|
|
13461
|
+
['CALL', 'SIP_BRIDGE', 'SPACE_SHARE'].forEach((fullStateType) => {
|
|
13462
|
+
it(`does not fetch meeting info when destination is a 1:1 call (fullState.type ${fullStateType})`, () => {
|
|
13463
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13464
|
+
|
|
13465
|
+
meeting.meetingInfo = {};
|
|
13466
|
+
meeting.destination = {
|
|
13467
|
+
url: 'https://locus.example.com/locus/123',
|
|
13468
|
+
info: {topic: 'x'},
|
|
13469
|
+
};
|
|
13470
|
+
|
|
13471
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({fullState: {type: fullStateType}});
|
|
13472
|
+
|
|
13473
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13474
|
+
});
|
|
13475
|
+
});
|
|
13476
|
+
|
|
13477
|
+
it('swallows async fetchMeetingInfo errors and logs info', async () => {
|
|
13478
|
+
const error = new Error('fetch failed');
|
|
13479
|
+
|
|
13480
|
+
meeting.meetingInfo = {};
|
|
13481
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13482
|
+
sinon.stub(meeting, 'fetchMeetingInfo').returns(Promise.reject(error));
|
|
13483
|
+
const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
|
|
13484
|
+
|
|
13485
|
+
await meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13486
|
+
|
|
13487
|
+
assert.calledOnce(loggerInfoStub);
|
|
13488
|
+
assert.match(
|
|
13489
|
+
loggerInfoStub.firstCall.args[0],
|
|
13490
|
+
/Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: fetch failed/
|
|
13491
|
+
);
|
|
13492
|
+
});
|
|
13493
|
+
});
|
|
13494
|
+
|
|
11356
13495
|
describe('#emailInput', () => {
|
|
11357
13496
|
it('should set the email input', () => {
|
|
11358
13497
|
assert.notOk(meeting.emailInput);
|
|
@@ -11955,6 +14094,7 @@ describe('plugin-meetings', () => {
|
|
|
11955
14094
|
let showAutoEndMeetingWarningSpy;
|
|
11956
14095
|
let canAttendeeRequestAiAssistantEnabledSpy;
|
|
11957
14096
|
let attendeeRequestAiAssistantDeclinedAllSpy;
|
|
14097
|
+
let isAnonymizeDisplayNamesEnabledSpy;
|
|
11958
14098
|
// Due to import tree issues, hasHints must be stubed within the scope of the `it`.
|
|
11959
14099
|
|
|
11960
14100
|
beforeEach(() => {
|
|
@@ -12003,6 +14143,10 @@ describe('plugin-meetings', () => {
|
|
|
12003
14143
|
MeetingUtil,
|
|
12004
14144
|
'attendeeRequestAiAssistantDeclinedAll'
|
|
12005
14145
|
);
|
|
14146
|
+
isAnonymizeDisplayNamesEnabledSpy = sinon.spy(
|
|
14147
|
+
MeetingUtil,
|
|
14148
|
+
'isAnonymizeDisplayNamesEnabled'
|
|
14149
|
+
);
|
|
12006
14150
|
});
|
|
12007
14151
|
|
|
12008
14152
|
afterEach(() => {
|
|
@@ -12011,6 +14155,7 @@ describe('plugin-meetings', () => {
|
|
|
12011
14155
|
showAutoEndMeetingWarningSpy.restore();
|
|
12012
14156
|
canAttendeeRequestAiAssistantEnabledSpy.restore();
|
|
12013
14157
|
attendeeRequestAiAssistantDeclinedAllSpy.restore();
|
|
14158
|
+
isAnonymizeDisplayNamesEnabledSpy.restore();
|
|
12014
14159
|
});
|
|
12015
14160
|
|
|
12016
14161
|
forEach(
|
|
@@ -12137,6 +14282,11 @@ describe('plugin-meetings', () => {
|
|
|
12137
14282
|
requiredDisplayHints: [],
|
|
12138
14283
|
requiredPolicies: [SELF_POLICY.SUPPORT_ANNOTATION],
|
|
12139
14284
|
},
|
|
14285
|
+
{
|
|
14286
|
+
actionName: 'isSupportParticipantList',
|
|
14287
|
+
requiredDisplayHints: [],
|
|
14288
|
+
requiredPolicies: [SELF_POLICY.SUPPORT_PARTICIPANT_LIST],
|
|
14289
|
+
},
|
|
12140
14290
|
{
|
|
12141
14291
|
actionName: 'canPollingAndQA',
|
|
12142
14292
|
requiredDisplayHints: [],
|
|
@@ -12568,6 +14718,7 @@ describe('plugin-meetings', () => {
|
|
|
12568
14718
|
meeting.roles
|
|
12569
14719
|
);
|
|
12570
14720
|
assert.calledWith(attendeeRequestAiAssistantDeclinedAllSpy, userDisplayHints);
|
|
14721
|
+
assert.calledWith(isAnonymizeDisplayNamesEnabledSpy, userDisplayHints);
|
|
12571
14722
|
|
|
12572
14723
|
assert.calledWith(ControlsOptionsUtil.hasHints, {
|
|
12573
14724
|
requiredHints: [DISPLAY_HINTS.MUTE_ALL],
|
|
@@ -12782,6 +14933,10 @@ describe('plugin-meetings', () => {
|
|
|
12782
14933
|
describe('#saveDataChannelToken', () => {
|
|
12783
14934
|
beforeEach(() => {
|
|
12784
14935
|
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
14936
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
14937
|
+
.stub()
|
|
14938
|
+
.returns({currentOwner: undefined, isOwner: true});
|
|
14939
|
+
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
12785
14940
|
});
|
|
12786
14941
|
|
|
12787
14942
|
it('saves datachannelToken into LLM as Default', () => {
|
|
@@ -12794,7 +14949,8 @@ describe('plugin-meetings', () => {
|
|
|
12794
14949
|
assert.calledWithExactly(
|
|
12795
14950
|
webex.internal.llm.setDatachannelToken,
|
|
12796
14951
|
'default-token',
|
|
12797
|
-
'llm-default-session'
|
|
14952
|
+
'llm-default-session',
|
|
14953
|
+
meeting.id
|
|
12798
14954
|
);
|
|
12799
14955
|
});
|
|
12800
14956
|
|
|
@@ -12808,7 +14964,8 @@ describe('plugin-meetings', () => {
|
|
|
12808
14964
|
assert.calledWithExactly(
|
|
12809
14965
|
webex.internal.llm.setDatachannelToken,
|
|
12810
14966
|
'ps-token',
|
|
12811
|
-
'llm-practice-session'
|
|
14967
|
+
'llm-practice-session',
|
|
14968
|
+
meeting.id
|
|
12812
14969
|
);
|
|
12813
14970
|
});
|
|
12814
14971
|
|
|
@@ -12826,12 +14983,14 @@ describe('plugin-meetings', () => {
|
|
|
12826
14983
|
assert.calledWithExactly(
|
|
12827
14984
|
webex.internal.llm.setDatachannelToken,
|
|
12828
14985
|
'default-token',
|
|
12829
|
-
'llm-default-session'
|
|
14986
|
+
'llm-default-session',
|
|
14987
|
+
meeting.id
|
|
12830
14988
|
);
|
|
12831
14989
|
assert.calledWithExactly(
|
|
12832
14990
|
webex.internal.llm.setDatachannelToken,
|
|
12833
14991
|
'ps-token',
|
|
12834
|
-
'llm-practice-session'
|
|
14992
|
+
'llm-practice-session',
|
|
14993
|
+
meeting.id
|
|
12835
14994
|
);
|
|
12836
14995
|
});
|
|
12837
14996
|
|
|
@@ -12850,19 +15009,44 @@ describe('plugin-meetings', () => {
|
|
|
12850
15009
|
it('handles missing locus.self gracefully', () => {
|
|
12851
15010
|
meeting.saveDataChannelToken({locus: {}});
|
|
12852
15011
|
|
|
12853
|
-
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15012
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15013
|
+
});
|
|
15014
|
+
|
|
15015
|
+
it('writes token with meeting id as owner', () => {
|
|
15016
|
+
meeting.saveDataChannelToken({
|
|
15017
|
+
locus: {
|
|
15018
|
+
self: {datachannelToken: 'default-token'},
|
|
15019
|
+
},
|
|
15020
|
+
});
|
|
15021
|
+
|
|
15022
|
+
assert.calledOnceWithExactly(
|
|
15023
|
+
webex.internal.llm.setDatachannelToken,
|
|
15024
|
+
'default-token',
|
|
15025
|
+
'llm-default-session',
|
|
15026
|
+
meeting.id
|
|
15027
|
+
);
|
|
12854
15028
|
});
|
|
12855
15029
|
});
|
|
12856
15030
|
|
|
12857
15031
|
describe('#clearDataChannelToken', () => {
|
|
12858
15032
|
beforeEach(() => {
|
|
12859
|
-
webex.internal.llm.
|
|
15033
|
+
webex.internal.llm.clearDatachannelToken = sinon.stub();
|
|
12860
15034
|
});
|
|
12861
15035
|
|
|
12862
|
-
it('
|
|
15036
|
+
it('delegates default and practice token clears to llm with meeting ownership id', () => {
|
|
12863
15037
|
meeting.clearDataChannelToken();
|
|
12864
15038
|
|
|
12865
|
-
assert.
|
|
15039
|
+
assert.calledWithExactly(
|
|
15040
|
+
webex.internal.llm.clearDatachannelToken,
|
|
15041
|
+
'llm-default-session',
|
|
15042
|
+
meeting.id
|
|
15043
|
+
);
|
|
15044
|
+
assert.calledWithExactly(
|
|
15045
|
+
webex.internal.llm.clearDatachannelToken,
|
|
15046
|
+
'llm-practice-session',
|
|
15047
|
+
meeting.id
|
|
15048
|
+
);
|
|
15049
|
+
assert.callCount(webex.internal.llm.clearDatachannelToken, 2);
|
|
12866
15050
|
});
|
|
12867
15051
|
});
|
|
12868
15052
|
|
|
@@ -12872,6 +15056,7 @@ describe('plugin-meetings', () => {
|
|
|
12872
15056
|
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
12873
15057
|
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
12874
15058
|
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
15059
|
+
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
12875
15060
|
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
12876
15061
|
webex.internal.llm.on = sinon.stub();
|
|
12877
15062
|
webex.internal.llm.off = sinon.stub();
|
|
@@ -12889,7 +15074,11 @@ describe('plugin-meetings', () => {
|
|
|
12889
15074
|
meeting.joinedWith = {state: 'any other state'};
|
|
12890
15075
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12891
15076
|
|
|
12892
|
-
meeting.locusInfo = {
|
|
15077
|
+
meeting.locusInfo = {
|
|
15078
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15079
|
+
url: 'a url',
|
|
15080
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15081
|
+
};
|
|
12893
15082
|
|
|
12894
15083
|
const result = await meeting.updateLLMConnection();
|
|
12895
15084
|
|
|
@@ -12901,6 +15090,7 @@ describe('plugin-meetings', () => {
|
|
|
12901
15090
|
it('returns undefined if llm is already connected and the locus url is unchanged', async () => {
|
|
12902
15091
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12903
15092
|
meeting.locusInfo = {
|
|
15093
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12904
15094
|
url: 'a url',
|
|
12905
15095
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12906
15096
|
};
|
|
@@ -12937,7 +15127,11 @@ describe('plugin-meetings', () => {
|
|
|
12937
15127
|
});
|
|
12938
15128
|
it('connects if not already connected', async () => {
|
|
12939
15129
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12940
|
-
meeting.locusInfo = {
|
|
15130
|
+
meeting.locusInfo = {
|
|
15131
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15132
|
+
url: 'a url',
|
|
15133
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15134
|
+
};
|
|
12941
15135
|
|
|
12942
15136
|
const result = await meeting.updateLLMConnection();
|
|
12943
15137
|
|
|
@@ -12948,7 +15142,14 @@ describe('plugin-meetings', () => {
|
|
|
12948
15142
|
'a datachannel url',
|
|
12949
15143
|
undefined
|
|
12950
15144
|
);
|
|
15145
|
+
assert.calledOnceWithExactly(
|
|
15146
|
+
webex.internal.llm.setRefreshHandler,
|
|
15147
|
+
sinon.match.func,
|
|
15148
|
+
'llm-default-session',
|
|
15149
|
+
meeting.id
|
|
15150
|
+
);
|
|
12951
15151
|
assert.equal(result, 'something');
|
|
15152
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
12952
15153
|
});
|
|
12953
15154
|
it('disconnects if the locus url has changed', async () => {
|
|
12954
15155
|
meeting.joinedWith = {state: 'JOINED'};
|
|
@@ -12957,6 +15158,7 @@ describe('plugin-meetings', () => {
|
|
|
12957
15158
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12958
15159
|
|
|
12959
15160
|
meeting.locusInfo = {
|
|
15161
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12960
15162
|
url: 'a different url',
|
|
12961
15163
|
info: {datachannelUrl: 'a datachannel url'},
|
|
12962
15164
|
self: {},
|
|
@@ -12964,10 +15166,15 @@ describe('plugin-meetings', () => {
|
|
|
12964
15166
|
|
|
12965
15167
|
const result = await meeting.updateLLMConnection();
|
|
12966
15168
|
|
|
12967
|
-
assert.calledWithExactly(
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
15169
|
+
assert.calledWithExactly(
|
|
15170
|
+
webex.internal.llm.disconnectLLM,
|
|
15171
|
+
{
|
|
15172
|
+
code: 3050,
|
|
15173
|
+
reason: 'done (permanent)',
|
|
15174
|
+
},
|
|
15175
|
+
'llm-default-session',
|
|
15176
|
+
meeting.id
|
|
15177
|
+
);
|
|
12971
15178
|
|
|
12972
15179
|
assert.calledWithExactly(
|
|
12973
15180
|
webex.internal.llm.registerAndConnect,
|
|
@@ -13010,6 +15217,7 @@ describe('plugin-meetings', () => {
|
|
|
13010
15217
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
13011
15218
|
|
|
13012
15219
|
meeting.locusInfo = {
|
|
15220
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13013
15221
|
url: 'a url',
|
|
13014
15222
|
info: {datachannelUrl: 'a different datachannel url'},
|
|
13015
15223
|
self: {},
|
|
@@ -13017,10 +15225,15 @@ describe('plugin-meetings', () => {
|
|
|
13017
15225
|
|
|
13018
15226
|
const result = await meeting.updateLLMConnection();
|
|
13019
15227
|
|
|
13020
|
-
assert.calledWithExactly(
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
15228
|
+
assert.calledWithExactly(
|
|
15229
|
+
webex.internal.llm.disconnectLLM,
|
|
15230
|
+
{
|
|
15231
|
+
code: 3050,
|
|
15232
|
+
reason: 'done (permanent)',
|
|
15233
|
+
},
|
|
15234
|
+
'llm-default-session',
|
|
15235
|
+
meeting.id
|
|
15236
|
+
);
|
|
13024
15237
|
|
|
13025
15238
|
assert.calledWithExactly(
|
|
13026
15239
|
webex.internal.llm.registerAndConnect,
|
|
@@ -13061,14 +15274,23 @@ describe('plugin-meetings', () => {
|
|
|
13061
15274
|
webex.internal.llm.isConnected.returns(true);
|
|
13062
15275
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
13063
15276
|
|
|
13064
|
-
meeting.locusInfo = {
|
|
15277
|
+
meeting.locusInfo = {
|
|
15278
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15279
|
+
url: 'a url',
|
|
15280
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15281
|
+
};
|
|
13065
15282
|
|
|
13066
15283
|
const result = await meeting.updateLLMConnection();
|
|
13067
15284
|
|
|
13068
|
-
assert.calledWith(
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
15285
|
+
assert.calledWith(
|
|
15286
|
+
webex.internal.llm.disconnectLLM,
|
|
15287
|
+
{
|
|
15288
|
+
code: 3050,
|
|
15289
|
+
reason: 'done (permanent)',
|
|
15290
|
+
},
|
|
15291
|
+
'llm-default-session',
|
|
15292
|
+
meeting.id
|
|
15293
|
+
);
|
|
13072
15294
|
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
13073
15295
|
assert.equal(result, undefined);
|
|
13074
15296
|
assert.isFalse(
|
|
@@ -13084,6 +15306,7 @@ describe('plugin-meetings', () => {
|
|
|
13084
15306
|
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
13085
15307
|
|
|
13086
15308
|
meeting.locusInfo = {
|
|
15309
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13087
15310
|
url: 'a different url',
|
|
13088
15311
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13089
15312
|
self: {},
|
|
@@ -13115,6 +15338,7 @@ describe('plugin-meetings', () => {
|
|
|
13115
15338
|
it('still need connect main session data channel when PS started', async () => {
|
|
13116
15339
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13117
15340
|
meeting.locusInfo = {
|
|
15341
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13118
15342
|
url: 'a url',
|
|
13119
15343
|
info: {
|
|
13120
15344
|
datachannelUrl: 'a datachannel url',
|
|
@@ -13135,11 +15359,14 @@ describe('plugin-meetings', () => {
|
|
|
13135
15359
|
it('passes dataChannelToken from LLM to registerAndConnect', async () => {
|
|
13136
15360
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13137
15361
|
meeting.locusInfo = {
|
|
15362
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13138
15363
|
url: 'a url',
|
|
13139
15364
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13140
15365
|
};
|
|
13141
15366
|
|
|
13142
|
-
webex.internal.llm.getDatachannelToken
|
|
15367
|
+
webex.internal.llm.getDatachannelToken
|
|
15368
|
+
.withArgs('llm-default-session', meeting.id)
|
|
15369
|
+
.returns('token-123');
|
|
13143
15370
|
|
|
13144
15371
|
await meeting.updateLLMConnection();
|
|
13145
15372
|
|
|
@@ -13154,6 +15381,7 @@ describe('plugin-meetings', () => {
|
|
|
13154
15381
|
it('passes undefined token when LLM has no token stored', async () => {
|
|
13155
15382
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13156
15383
|
meeting.locusInfo = {
|
|
15384
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13157
15385
|
url: 'a url',
|
|
13158
15386
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13159
15387
|
};
|
|
@@ -13175,6 +15403,7 @@ describe('plugin-meetings', () => {
|
|
|
13175
15403
|
it('does not pass token when data channel with jwt token is disabled', async () => {
|
|
13176
15404
|
meeting.joinedWith = {state: 'JOINED'};
|
|
13177
15405
|
meeting.locusInfo = {
|
|
15406
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
13178
15407
|
url: 'a url',
|
|
13179
15408
|
info: {datachannelUrl: 'a datachannel url'},
|
|
13180
15409
|
};
|
|
@@ -13193,6 +15422,209 @@ describe('plugin-meetings', () => {
|
|
|
13193
15422
|
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
13194
15423
|
});
|
|
13195
15424
|
|
|
15425
|
+
describe('ownership tag', () => {
|
|
15426
|
+
beforeEach(() => {
|
|
15427
|
+
// Make the owner stub dynamic so setOwnerMeetingId() writes
|
|
15428
|
+
// propagate back to getOwnerMeetingId() reads. This mirrors the
|
|
15429
|
+
// real LLM singleton behavior so the finally-block release in
|
|
15430
|
+
// cleanupLLMConneciton is reflected in subsequent reads.
|
|
15431
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub().returns(undefined);
|
|
15432
|
+
webex.internal.llm.setOwnerMeetingId = sinon.stub().callsFake((id) => {
|
|
15433
|
+
webex.internal.llm.getOwnerMeetingId.returns(id);
|
|
15434
|
+
});
|
|
15435
|
+
});
|
|
15436
|
+
|
|
15437
|
+
it('skips disconnect and reconnect when LLM is connected and owned by another meeting (regardless of URL)', async () => {
|
|
15438
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15439
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15440
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15441
|
+
// Locus/datachannel URL mismatch is the *normal* case when
|
|
15442
|
+
// another meeting owns the live socket -- each meeting has its
|
|
15443
|
+
// own locus URL. URL mismatch must NOT trigger a reclaim,
|
|
15444
|
+
// because doing so would tear down the owning meeting's healthy
|
|
15445
|
+
// LLM socket and break its data channel.
|
|
15446
|
+
webex.internal.llm.getLocusUrl.returns('owner-locus-url');
|
|
15447
|
+
webex.internal.llm.getDatachannelUrl.returns('owner-dc-url');
|
|
15448
|
+
meeting.locusInfo = {
|
|
15449
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15450
|
+
url: 'a different url',
|
|
15451
|
+
info: {datachannelUrl: 'a different datachannel url'},
|
|
15452
|
+
self: {},
|
|
15453
|
+
};
|
|
15454
|
+
|
|
15455
|
+
const result = await meeting.updateLLMConnection();
|
|
15456
|
+
|
|
15457
|
+
assert.equal(result, undefined);
|
|
15458
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15459
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15460
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
15461
|
+
assert.notCalled(meeting.startLLMHealthCheckTimer);
|
|
15462
|
+
});
|
|
15463
|
+
|
|
15464
|
+
it('clears stale owner tag in cleanup finally block even when disconnectLLM rejects', async () => {
|
|
15465
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15466
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15467
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15468
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15469
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15470
|
+
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15471
|
+
meeting.locusInfo = {
|
|
15472
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15473
|
+
url: 'a different url',
|
|
15474
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15475
|
+
self: {},
|
|
15476
|
+
};
|
|
15477
|
+
|
|
15478
|
+
try {
|
|
15479
|
+
await meeting.updateLLMConnection();
|
|
15480
|
+
} catch (e) {
|
|
15481
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
15482
|
+
}
|
|
15483
|
+
|
|
15484
|
+
// The owner-eligible finally branch must release the tag so a
|
|
15485
|
+
// subsequent reconnect attempt from any meeting is not blocked.
|
|
15486
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId, undefined);
|
|
15487
|
+
});
|
|
15488
|
+
|
|
15489
|
+
it('does not clear owner tag when ownership changes during cleanup disconnect await', async () => {
|
|
15490
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15491
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15492
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15493
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15494
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15495
|
+
webex.internal.llm.disconnectLLM.callsFake(async () => {
|
|
15496
|
+
webex.internal.llm.getOwnerMeetingId.returns('new-owner-id');
|
|
15497
|
+
throw new Error('disconnect failed');
|
|
15498
|
+
});
|
|
15499
|
+
meeting.locusInfo = {
|
|
15500
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15501
|
+
url: 'a different url',
|
|
15502
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15503
|
+
self: {},
|
|
15504
|
+
};
|
|
15505
|
+
|
|
15506
|
+
try {
|
|
15507
|
+
await meeting.updateLLMConnection();
|
|
15508
|
+
} catch (e) {
|
|
15509
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
15510
|
+
}
|
|
15511
|
+
|
|
15512
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
15513
|
+
assert.equal(webex.internal.llm.getOwnerMeetingId(), 'new-owner-id');
|
|
15514
|
+
});
|
|
15515
|
+
|
|
15516
|
+
it('proceeds normally when LLM is connected and owned by this meeting with URL change', async () => {
|
|
15517
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15518
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15519
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15520
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15521
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15522
|
+
meeting.locusInfo = {
|
|
15523
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15524
|
+
url: 'a different url',
|
|
15525
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15526
|
+
self: {},
|
|
15527
|
+
};
|
|
15528
|
+
|
|
15529
|
+
await meeting.updateLLMConnection();
|
|
15530
|
+
|
|
15531
|
+
assert.calledOnceWithExactly(
|
|
15532
|
+
webex.internal.llm.disconnectLLM,
|
|
15533
|
+
{
|
|
15534
|
+
code: 3050,
|
|
15535
|
+
reason: 'done (permanent)',
|
|
15536
|
+
},
|
|
15537
|
+
'llm-default-session',
|
|
15538
|
+
meeting.id
|
|
15539
|
+
);
|
|
15540
|
+
assert.calledWithExactly(
|
|
15541
|
+
webex.internal.llm.registerAndConnect,
|
|
15542
|
+
'a different url',
|
|
15543
|
+
'a datachannel url',
|
|
15544
|
+
undefined
|
|
15545
|
+
);
|
|
15546
|
+
// setOwnerMeetingId is called twice: first with undefined in
|
|
15547
|
+
// cleanupLLMConneciton's finally block (so a failed disconnect
|
|
15548
|
+
// cannot leave a stale owner), then with this meeting's id
|
|
15549
|
+
// after registerAndConnect resolves.
|
|
15550
|
+
assert.calledTwice(webex.internal.llm.setOwnerMeetingId);
|
|
15551
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.firstCall, undefined);
|
|
15552
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.lastCall, meeting.id);
|
|
15553
|
+
});
|
|
15554
|
+
|
|
15555
|
+
it('claims ownership after successful registerAndConnect on initial connect', async () => {
|
|
15556
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15557
|
+
webex.internal.llm.isConnected.returns(false);
|
|
15558
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15559
|
+
meeting.locusInfo = {
|
|
15560
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15561
|
+
url: 'a url',
|
|
15562
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15563
|
+
};
|
|
15564
|
+
|
|
15565
|
+
await meeting.updateLLMConnection();
|
|
15566
|
+
|
|
15567
|
+
assert.calledOnce(webex.internal.llm.registerAndConnect);
|
|
15568
|
+
assert.calledOnceWithExactly(
|
|
15569
|
+
webex.internal.llm.setRefreshHandler,
|
|
15570
|
+
sinon.match.func,
|
|
15571
|
+
'llm-default-session',
|
|
15572
|
+
meeting.id
|
|
15573
|
+
);
|
|
15574
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15575
|
+
});
|
|
15576
|
+
|
|
15577
|
+
it('proceeds to connect when LLM is not connected even if another ownerId lingers', async () => {
|
|
15578
|
+
// Defensive path: if the LLM reports not-connected but an old
|
|
15579
|
+
// ownerId is still present (e.g. race before a successful
|
|
15580
|
+
// connections.delete), this meeting can still claim a fresh
|
|
15581
|
+
// connection.
|
|
15582
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15583
|
+
webex.internal.llm.isConnected.returns(false);
|
|
15584
|
+
webex.internal.llm.getOwnerMeetingId.returns('stale-owner-id');
|
|
15585
|
+
webex.internal.llm.getDatachannelToken.onFirstCall().returns(undefined);
|
|
15586
|
+
webex.internal.llm.getDatachannelToken.onSecondCall().returns('recovered-token');
|
|
15587
|
+
meeting.locusInfo = {
|
|
15588
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15589
|
+
url: 'a url',
|
|
15590
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15591
|
+
};
|
|
15592
|
+
|
|
15593
|
+
await meeting.updateLLMConnection();
|
|
15594
|
+
|
|
15595
|
+
assert.calledTwice(webex.internal.llm.getDatachannelToken);
|
|
15596
|
+
assert.calledWithExactly(
|
|
15597
|
+
webex.internal.llm.getDatachannelToken.firstCall,
|
|
15598
|
+
'llm-default-session',
|
|
15599
|
+
meeting.id
|
|
15600
|
+
);
|
|
15601
|
+
assert.calledWithExactly(
|
|
15602
|
+
webex.internal.llm.getDatachannelToken.secondCall,
|
|
15603
|
+
'llm-default-session'
|
|
15604
|
+
);
|
|
15605
|
+
assert.calledOnceWithExactly(
|
|
15606
|
+
webex.internal.llm.registerAndConnect,
|
|
15607
|
+
'a url',
|
|
15608
|
+
'a datachannel url',
|
|
15609
|
+
'recovered-token'
|
|
15610
|
+
);
|
|
15611
|
+
assert.calledWithExactly(
|
|
15612
|
+
webex.internal.llm.setRefreshHandler.firstCall,
|
|
15613
|
+
sinon.match.func,
|
|
15614
|
+
'llm-default-session',
|
|
15615
|
+
undefined
|
|
15616
|
+
);
|
|
15617
|
+
assert.calledTwice(webex.internal.llm.setRefreshHandler);
|
|
15618
|
+
assert.calledWithExactly(
|
|
15619
|
+
webex.internal.llm.setRefreshHandler.secondCall,
|
|
15620
|
+
sinon.match.func,
|
|
15621
|
+
'llm-default-session',
|
|
15622
|
+
meeting.id
|
|
15623
|
+
);
|
|
15624
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15625
|
+
});
|
|
15626
|
+
});
|
|
15627
|
+
|
|
13196
15628
|
describe('#clearMeetingData', () => {
|
|
13197
15629
|
beforeEach(() => {
|
|
13198
15630
|
webex.internal.llm.isConnected = sinon.stub().returns(true);
|
|
@@ -13208,10 +15640,15 @@ describe('plugin-meetings', () => {
|
|
|
13208
15640
|
it('disconnects llm and removes online and relay listeners during meeting data cleanup', async () => {
|
|
13209
15641
|
await meeting.clearMeetingData();
|
|
13210
15642
|
|
|
13211
|
-
assert.calledOnceWithExactly(
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
15643
|
+
assert.calledOnceWithExactly(
|
|
15644
|
+
webex.internal.llm.disconnectLLM,
|
|
15645
|
+
{
|
|
15646
|
+
code: 3050,
|
|
15647
|
+
reason: 'done (permanent)',
|
|
15648
|
+
},
|
|
15649
|
+
'llm-default-session',
|
|
15650
|
+
meeting.id
|
|
15651
|
+
);
|
|
13215
15652
|
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
13216
15653
|
assert.calledWithExactly(
|
|
13217
15654
|
webex.internal.llm.off,
|
|
@@ -13224,10 +15661,13 @@ describe('plugin-meetings', () => {
|
|
|
13224
15661
|
meeting.processLocusLLMEvent
|
|
13225
15662
|
);
|
|
13226
15663
|
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
13227
|
-
assert.calledOnce(meeting.stopTranscription);
|
|
13228
|
-
assert.isUndefined(meeting.transcription);
|
|
13229
15664
|
assert.calledOnce(meeting.clearDataChannelToken);
|
|
13230
|
-
|
|
15665
|
+
// stopTranscription and annotation.deregisterEvents are not
|
|
15666
|
+
// called here: they run in stopListeningForMeetingEvents()
|
|
15667
|
+
// before /leave to avoid double-emitting
|
|
15668
|
+
// MEETING_STOPPED_RECEIVING_TRANSCRIPTION.
|
|
15669
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15670
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
13231
15671
|
});
|
|
13232
15672
|
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
13233
15673
|
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
@@ -13246,19 +15686,234 @@ describe('plugin-meetings', () => {
|
|
|
13246
15686
|
meeting.processLocusLLMEvent
|
|
13247
15687
|
);
|
|
13248
15688
|
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
13249
|
-
assert.calledOnce(meeting.stopTranscription);
|
|
13250
|
-
assert.isUndefined(meeting.transcription);
|
|
13251
15689
|
assert.calledOnce(meeting.clearDataChannelToken);
|
|
13252
|
-
assert.
|
|
15690
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15691
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
13253
15692
|
});
|
|
13254
|
-
it('always calls stopTranscription even when transcription is undefined', async () => {
|
|
13255
|
-
meeting.transcription = undefined;
|
|
13256
15693
|
|
|
13257
|
-
|
|
15694
|
+
describe('ownership tag', () => {
|
|
15695
|
+
beforeEach(() => {
|
|
15696
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15697
|
+
});
|
|
13258
15698
|
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
15699
|
+
it('skips disconnectLLM but still removes this meeting listeners when another meeting owns the LLM', async () => {
|
|
15700
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15701
|
+
|
|
15702
|
+
await meeting.clearMeetingData();
|
|
15703
|
+
|
|
15704
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15705
|
+
// clearDataChannelToken is always delegated; llm enforces
|
|
15706
|
+
// ownership and no-ops for non-owners internally.
|
|
15707
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15708
|
+
// Listeners owned by *this* Meeting instance must still be
|
|
15709
|
+
// removed so a leaving subordinate meeting stops receiving
|
|
15710
|
+
// relay/locus events from the shared singleton.
|
|
15711
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15712
|
+
assert.calledWithExactly(
|
|
15713
|
+
webex.internal.llm.off,
|
|
15714
|
+
'event:relay.event',
|
|
15715
|
+
meeting.processRelayEvent
|
|
15716
|
+
);
|
|
15717
|
+
assert.calledWithExactly(
|
|
15718
|
+
webex.internal.llm.off,
|
|
15719
|
+
'event:locus.state_message',
|
|
15720
|
+
meeting.processLocusLLMEvent
|
|
15721
|
+
);
|
|
15722
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15723
|
+
});
|
|
15724
|
+
|
|
15725
|
+
it('calls disconnectLLM and clears data channel token when this meeting is the owner', async () => {
|
|
15726
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15727
|
+
|
|
15728
|
+
await meeting.clearMeetingData();
|
|
15729
|
+
|
|
15730
|
+
assert.calledOnceWithExactly(
|
|
15731
|
+
webex.internal.llm.disconnectLLM,
|
|
15732
|
+
{
|
|
15733
|
+
code: 3050,
|
|
15734
|
+
reason: 'done (permanent)',
|
|
15735
|
+
},
|
|
15736
|
+
'llm-default-session',
|
|
15737
|
+
meeting.id
|
|
15738
|
+
);
|
|
15739
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15740
|
+
});
|
|
15741
|
+
|
|
15742
|
+
it('calls disconnectLLM and clears data channel token when no owner is recorded (first-claim / legacy)', async () => {
|
|
15743
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15744
|
+
|
|
15745
|
+
await meeting.clearMeetingData();
|
|
15746
|
+
|
|
15747
|
+
assert.calledOnceWithExactly(
|
|
15748
|
+
webex.internal.llm.disconnectLLM,
|
|
15749
|
+
{
|
|
15750
|
+
code: 3050,
|
|
15751
|
+
reason: 'done (permanent)',
|
|
15752
|
+
},
|
|
15753
|
+
'llm-default-session',
|
|
15754
|
+
meeting.id
|
|
15755
|
+
);
|
|
15756
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15757
|
+
});
|
|
15758
|
+
});
|
|
15759
|
+
});
|
|
15760
|
+
});
|
|
15761
|
+
|
|
15762
|
+
describe('#processLocusLLMEvent', () => {
|
|
15763
|
+
it('routes the LLM event through locusInfo.parse and records the LLM message with the top-level tracking id', () => {
|
|
15764
|
+
const event = {
|
|
15765
|
+
data: {
|
|
15766
|
+
eventType: 'locus.state_message',
|
|
15767
|
+
dataSets: [],
|
|
15768
|
+
},
|
|
15769
|
+
trackingId: 'envelope-tracking-id',
|
|
15770
|
+
};
|
|
15771
|
+
|
|
15772
|
+
meeting.locusInfo.parse = sinon.stub();
|
|
15773
|
+
meeting.onLocusSyncLlmMessage = sinon.stub();
|
|
15774
|
+
|
|
15775
|
+
meeting.processLocusLLMEvent(event);
|
|
15776
|
+
|
|
15777
|
+
// The LLM message is parsed without the tracking id - completion is driven from the
|
|
15778
|
+
// meeting's LLM handler, not threaded through locusInfo.
|
|
15779
|
+
assert.calledOnceWithExactly(meeting.locusInfo.parse, meeting, event.data);
|
|
15780
|
+
// Only the client whose /sync request tracking id matches the tracking id echoed back on
|
|
15781
|
+
// the top-level LLM event envelope records the LLM arrival; onLocusSyncLlmMessage is a
|
|
15782
|
+
// no-op otherwise.
|
|
15783
|
+
assert.calledOnceWithExactly(meeting.onLocusSyncLlmMessage, meeting.id, event.trackingId);
|
|
15784
|
+
});
|
|
15785
|
+
|
|
15786
|
+
it('does not attempt sync completion when the tracking id is missing', () => {
|
|
15787
|
+
const event = {
|
|
15788
|
+
data: {
|
|
15789
|
+
eventType: 'locus.state_message',
|
|
15790
|
+
dataSets: [],
|
|
15791
|
+
},
|
|
15792
|
+
};
|
|
15793
|
+
|
|
15794
|
+
meeting.locusInfo.parse = sinon.stub();
|
|
15795
|
+
meeting.onLocusSyncLlmMessage = sinon.stub();
|
|
15796
|
+
|
|
15797
|
+
meeting.processLocusLLMEvent(event);
|
|
15798
|
+
|
|
15799
|
+
assert.calledOnceWithExactly(meeting.locusInfo.parse, meeting, event.data);
|
|
15800
|
+
assert.notCalled(meeting.onLocusSyncLlmMessage);
|
|
15801
|
+
});
|
|
15802
|
+
});
|
|
15803
|
+
|
|
15804
|
+
describe('#onLocusSyncLlmMessage', () => {
|
|
15805
|
+
it('records the LLM arrival time and then tries to complete the metric', () => {
|
|
15806
|
+
webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived =
|
|
15807
|
+
sinon.stub();
|
|
15808
|
+
meeting.tryCompleteLocusSyncLatency = sinon.stub();
|
|
15809
|
+
|
|
15810
|
+
meeting.onLocusSyncLlmMessage('meeting-1', 'sync-tracking-id');
|
|
15811
|
+
|
|
15812
|
+
assert.calledOnceWithExactly(
|
|
15813
|
+
webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived,
|
|
15814
|
+
'meeting-1',
|
|
15815
|
+
'sync-tracking-id'
|
|
15816
|
+
);
|
|
15817
|
+
assert.calledOnceWithExactly(
|
|
15818
|
+
meeting.tryCompleteLocusSyncLatency,
|
|
15819
|
+
'meeting-1',
|
|
15820
|
+
'sync-tracking-id'
|
|
15821
|
+
);
|
|
15822
|
+
// the arrival time must be recorded before completion is attempted
|
|
15823
|
+
assert.callOrder(
|
|
15824
|
+
webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived,
|
|
15825
|
+
meeting.tryCompleteLocusSyncLatency
|
|
15826
|
+
);
|
|
15827
|
+
});
|
|
15828
|
+
});
|
|
15829
|
+
|
|
15830
|
+
describe('#tryCompleteLocusSyncLatency', () => {
|
|
15831
|
+
beforeEach(() => {
|
|
15832
|
+
meeting.emitLocusSyncCompleteMetric = sinon.stub();
|
|
15833
|
+
});
|
|
15834
|
+
|
|
15835
|
+
it('emits the metric when both milestones are in (completion succeeds)', () => {
|
|
15836
|
+
const completed = {dataSet: 'main', syncLatency: {totalTime: 50}};
|
|
15837
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency = sinon
|
|
15838
|
+
.stub()
|
|
15839
|
+
.returns(completed);
|
|
15840
|
+
|
|
15841
|
+
meeting.tryCompleteLocusSyncLatency('meeting-1', 'sync-tracking-id');
|
|
15842
|
+
|
|
15843
|
+
assert.calledOnceWithExactly(
|
|
15844
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency,
|
|
15845
|
+
'meeting-1',
|
|
15846
|
+
'sync-tracking-id'
|
|
15847
|
+
);
|
|
15848
|
+
assert.calledOnceWithExactly(meeting.emitLocusSyncCompleteMetric, 'meeting-1', completed);
|
|
15849
|
+
});
|
|
15850
|
+
|
|
15851
|
+
it('does not emit when completion returns undefined (only one milestone is in)', () => {
|
|
15852
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency = sinon
|
|
15853
|
+
.stub()
|
|
15854
|
+
.returns(undefined);
|
|
15855
|
+
|
|
15856
|
+
meeting.tryCompleteLocusSyncLatency('meeting-1', 'sync-tracking-id');
|
|
15857
|
+
|
|
15858
|
+
assert.calledOnceWithExactly(
|
|
15859
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency,
|
|
15860
|
+
'meeting-1',
|
|
15861
|
+
'sync-tracking-id'
|
|
15862
|
+
);
|
|
15863
|
+
assert.notCalled(meeting.emitLocusSyncCompleteMetric);
|
|
15864
|
+
});
|
|
15865
|
+
});
|
|
15866
|
+
|
|
15867
|
+
describe('#emitLocusSyncCompleteMetric', () => {
|
|
15868
|
+
it('submits client.locus.sync.complete with the llm websocket url and sync latency', () => {
|
|
15869
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
15870
|
+
webex.internal.llm.getWebSocketUrl = sinon.stub().returns('wss://llm-websocket-url');
|
|
15871
|
+
|
|
15872
|
+
meeting.emitLocusSyncCompleteMetric('meeting-1', {
|
|
15873
|
+
dataSet: 'main',
|
|
15874
|
+
syncLatency: {totalTime: 50},
|
|
15875
|
+
});
|
|
15876
|
+
|
|
15877
|
+
assert.calledOnceWithExactly(webex.internal.newMetrics.submitClientEvent, {
|
|
15878
|
+
name: 'client.locus.sync.complete',
|
|
15879
|
+
payload: {
|
|
15880
|
+
identifiers: {
|
|
15881
|
+
llmWebsocketUrl: 'wss://llm-websocket-url',
|
|
15882
|
+
},
|
|
15883
|
+
llmInfo: {
|
|
15884
|
+
dataSet: 'main',
|
|
15885
|
+
},
|
|
15886
|
+
syncLatency: {totalTime: 50},
|
|
15887
|
+
},
|
|
15888
|
+
options: {
|
|
15889
|
+
meetingId: 'meeting-1',
|
|
15890
|
+
},
|
|
15891
|
+
});
|
|
15892
|
+
});
|
|
15893
|
+
|
|
15894
|
+
it('submits with an undefined llm websocket url when it is unavailable', () => {
|
|
15895
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
15896
|
+
webex.internal.llm.getWebSocketUrl = sinon.stub().returns(undefined);
|
|
15897
|
+
|
|
15898
|
+
meeting.emitLocusSyncCompleteMetric('meeting-1', {
|
|
15899
|
+
dataSet: 'main',
|
|
15900
|
+
syncLatency: {totalTime: 50},
|
|
15901
|
+
});
|
|
15902
|
+
|
|
15903
|
+
assert.calledOnceWithExactly(webex.internal.newMetrics.submitClientEvent, {
|
|
15904
|
+
name: 'client.locus.sync.complete',
|
|
15905
|
+
payload: {
|
|
15906
|
+
identifiers: {
|
|
15907
|
+
llmWebsocketUrl: undefined,
|
|
15908
|
+
},
|
|
15909
|
+
llmInfo: {
|
|
15910
|
+
dataSet: 'main',
|
|
15911
|
+
},
|
|
15912
|
+
syncLatency: {totalTime: 50},
|
|
15913
|
+
},
|
|
15914
|
+
options: {
|
|
15915
|
+
meetingId: 'meeting-1',
|
|
15916
|
+
},
|
|
13262
15917
|
});
|
|
13263
15918
|
});
|
|
13264
15919
|
});
|
|
@@ -13298,6 +15953,71 @@ describe('plugin-meetings', () => {
|
|
|
13298
15953
|
});
|
|
13299
15954
|
});
|
|
13300
15955
|
|
|
15956
|
+
describe('#waitForSelfUrlChange', () => {
|
|
15957
|
+
let waitForSelfUrlChange;
|
|
15958
|
+
let locusMediaRequestStub;
|
|
15959
|
+
|
|
15960
|
+
beforeEach(async () => {
|
|
15961
|
+
locusMediaRequestStub = sinon
|
|
15962
|
+
.stub(LocusMediaRequestModule, 'LocusMediaRequest')
|
|
15963
|
+
.returns({id: 'fake LocusMediaRequest instance'});
|
|
15964
|
+
|
|
15965
|
+
meeting.setLocus = sinon.stub().returns(true);
|
|
15966
|
+
webex.meetings.registered = true;
|
|
15967
|
+
sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve('JOIN_RESULT'));
|
|
15968
|
+
sinon.stub(meeting, 'updateLLMConnection').returns(Promise.resolve());
|
|
15969
|
+
|
|
15970
|
+
await meeting.join();
|
|
15971
|
+
|
|
15972
|
+
waitForSelfUrlChange = locusMediaRequestStub.firstCall.args[0].waitForSelfUrlChange;
|
|
15973
|
+
});
|
|
15974
|
+
|
|
15975
|
+
it('should resolve immediately when joinWithMediaRetryInfo.retryCount > 0', async () => {
|
|
15976
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 1, prevJoinResponse: undefined};
|
|
15977
|
+
|
|
15978
|
+
const result = waitForSelfUrlChange();
|
|
15979
|
+
|
|
15980
|
+
assert.instanceOf(result, Promise);
|
|
15981
|
+
await result;
|
|
15982
|
+
});
|
|
15983
|
+
|
|
15984
|
+
it('should not resolve before the timeout when retryCount is 0', async () => {
|
|
15985
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15986
|
+
|
|
15987
|
+
let resolved = false;
|
|
15988
|
+
waitForSelfUrlChange().then(() => {
|
|
15989
|
+
resolved = true;
|
|
15990
|
+
});
|
|
15991
|
+
|
|
15992
|
+
await testUtils.flushPromises();
|
|
15993
|
+
assert.isFalse(resolved);
|
|
15994
|
+
});
|
|
15995
|
+
|
|
15996
|
+
it('should resolve after the 5s timeout when retryCount is 0', async () => {
|
|
15997
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15998
|
+
|
|
15999
|
+
let resolved = false;
|
|
16000
|
+
const promise = waitForSelfUrlChange();
|
|
16001
|
+
promise.then(() => {
|
|
16002
|
+
resolved = true;
|
|
16003
|
+
});
|
|
16004
|
+
|
|
16005
|
+
fakeClock.tick(5000);
|
|
16006
|
+
await promise;
|
|
16007
|
+
|
|
16008
|
+
assert.isTrue(resolved);
|
|
16009
|
+
});
|
|
16010
|
+
|
|
16011
|
+
it('should return the same promise when called multiple times', () => {
|
|
16012
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
16013
|
+
|
|
16014
|
+
const firstPromise = waitForSelfUrlChange();
|
|
16015
|
+
const secondPromise = waitForSelfUrlChange();
|
|
16016
|
+
|
|
16017
|
+
assert.equal(firstPromise, secondPromise);
|
|
16018
|
+
});
|
|
16019
|
+
});
|
|
16020
|
+
|
|
13301
16021
|
describe('preferred video device', () => {
|
|
13302
16022
|
describe('#getVideoDeviceId', () => {
|
|
13303
16023
|
it('returns the preferred video device', () => {
|
|
@@ -15012,16 +17732,25 @@ describe('plugin-meetings', () => {
|
|
|
15012
17732
|
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
15013
17733
|
});
|
|
15014
17734
|
|
|
15015
|
-
it('should
|
|
17735
|
+
it('should send a custom reaction type not in the known list', async () => {
|
|
15016
17736
|
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
15017
17737
|
|
|
15018
|
-
|
|
15019
|
-
meeting.sendReaction('invalid_reaction', 'light'),
|
|
15020
|
-
Error,
|
|
15021
|
-
'invalid_reaction is not a valid reaction.'
|
|
15022
|
-
);
|
|
17738
|
+
const reactionPromise = meeting.sendReaction('custom_reaction', 'light');
|
|
15023
17739
|
|
|
15024
|
-
assert.
|
|
17740
|
+
assert.exists(reactionPromise.then);
|
|
17741
|
+
await reactionPromise;
|
|
17742
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
17743
|
+
reactionChannelUrl: 'Fake URL',
|
|
17744
|
+
reaction: {
|
|
17745
|
+
type: 'custom_reaction',
|
|
17746
|
+
tone: {
|
|
17747
|
+
type: 'light_skin_tone',
|
|
17748
|
+
codepoints: '1F3FB',
|
|
17749
|
+
shortcodes: ':skin-tone-2:',
|
|
17750
|
+
},
|
|
17751
|
+
},
|
|
17752
|
+
participantId: meeting.members.selfId,
|
|
17753
|
+
});
|
|
15025
17754
|
});
|
|
15026
17755
|
|
|
15027
17756
|
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|