@webex/plugin-meetings 3.11.0-webex-services-ready.1 → 3.12.0-metrics-init-fix-2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +9 -0
- package/dist/aiEnableRequest/index.js +197 -0
- package/dist/aiEnableRequest/index.js.map +1 -0
- package/dist/aiEnableRequest/utils.js +36 -0
- package/dist/aiEnableRequest/utils.js.map +1 -0
- package/dist/annotation/index.js +14 -5
- 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 +90 -3
- 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 +8 -3
- package/dist/config.js.map +1 -1
- package/dist/constants.js +60 -11
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/constants.js +11 -1
- package/dist/controls-options-manager/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +67 -29
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/util.js +91 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/hashTree/constants.js +16 -2
- package/dist/hashTree/constants.js.map +1 -1
- package/dist/hashTree/hashTree.js +18 -0
- package/dist/hashTree/hashTree.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +1655 -538
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/types.js +4 -2
- package/dist/hashTree/types.js.map +1 -1
- package/dist/hashTree/utils.js +52 -0
- package/dist/hashTree/utils.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/constant.js +12 -0
- package/dist/interceptors/constant.js.map +1 -0
- package/dist/interceptors/dataChannelAuthToken.js +350 -0
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
- package/dist/interceptors/index.js +7 -0
- package/dist/interceptors/index.js.map +1 -1
- package/dist/interceptors/locusRetry.js +23 -8
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interceptors/utils.js +27 -0
- package/dist/interceptors/utils.js.map +1 -0
- package/dist/interpretation/index.js +11 -2
- 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 +9 -4
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +911 -211
- 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/selfUtils.js +1 -0
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/locus-info/types.js +19 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +72 -3
- 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 +8 -7
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +11 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +2266 -1069
- 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 +55 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/meeting/util.js +168 -5
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +2 -2
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +369 -162
- 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 +20 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +40 -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 +12 -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 +64 -68
- 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 +11 -0
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +116 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +121 -83
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/reconnection-manager/index.js +0 -1
- package/dist/reconnection-manager/index.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/aiEnableRequest/index.d.ts +5 -0
- package/dist/types/aiEnableRequest/utils.d.ts +2 -0
- package/dist/types/common/errors/webex-errors.d.ts +32 -2
- package/dist/types/config.d.ts +6 -2
- package/dist/types/constants.d.ts +35 -1
- package/dist/types/controls-options-manager/constants.d.ts +6 -1
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +3 -0
- package/dist/types/hashTree/hashTree.d.ts +7 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
- package/dist/types/hashTree/types.d.ts +3 -0
- package/dist/types/hashTree/utils.d.ts +24 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/constant.d.ts +5 -0
- package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
- package/dist/types/interceptors/index.d.ts +2 -1
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interceptors/utils.d.ts +1 -0
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +126 -15
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +28 -1
- package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
- package/dist/types/media/properties.d.ts +8 -3
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +245 -16
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +17 -1
- package/dist/types/meeting/request.type.d.ts +5 -0
- package/dist/types/meeting/util.d.ts +40 -0
- package/dist/types/meetings/index.d.ts +42 -20
- 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 +2 -0
- package/dist/types/member/types.d.ts +1 -0
- package/dist/types/member/util.d.ts +14 -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 +11 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
- package/dist/types/multistream/sendSlotManager.d.ts +23 -1
- package/dist/types/reachability/clusterReachability.d.ts +3 -3
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +4 -0
- package/dist/types/webinar/utils.d.ts +6 -0
- package/dist/webinar/index.js +585 -164
- package/dist/webinar/index.js.map +1 -1
- package/dist/webinar/utils.js +25 -0
- package/dist/webinar/utils.js.map +1 -0
- package/package.json +24 -23
- package/src/aiEnableRequest/README.md +84 -0
- package/src/aiEnableRequest/index.ts +186 -0
- package/src/aiEnableRequest/utils.ts +25 -0
- package/src/annotation/index.ts +27 -7
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/events.ts +33 -11
- package/src/breakouts/index.ts +110 -1
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +6 -2
- package/src/constants.ts +49 -3
- package/src/controls-options-manager/constants.ts +14 -1
- package/src/controls-options-manager/index.ts +87 -28
- package/src/controls-options-manager/util.ts +81 -1
- package/src/hashTree/constants.ts +17 -0
- package/src/hashTree/hashTree.ts +17 -0
- package/src/hashTree/hashTreeParser.ts +1482 -361
- package/src/hashTree/types.ts +4 -0
- package/src/hashTree/utils.ts +45 -0
- package/src/index.ts +14 -1
- package/src/interceptors/constant.ts +6 -0
- package/src/interceptors/dataChannelAuthToken.ts +246 -0
- package/src/interceptors/index.ts +2 -1
- package/src/interceptors/locusRetry.ts +25 -4
- package/src/interceptors/utils.ts +16 -0
- package/src/interpretation/index.ts +29 -11
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/controlsUtils.ts +14 -1
- package/src/locus-info/index.ts +975 -203
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/selfUtils.ts +1 -0
- package/src/locus-info/types.ts +33 -1
- package/src/media/MediaConnectionAwaiter.ts +62 -5
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +11 -4
- package/src/meeting/in-meeting-actions.ts +20 -0
- package/src/meeting/index.ts +1258 -166
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +53 -0
- package/src/meeting/request.type.ts +6 -0
- package/src/meeting/util.ts +207 -7
- package/src/meeting-info/meeting-info-v2.ts +4 -2
- package/src/meetings/index.ts +319 -117
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +117 -4
- package/src/member/index.ts +20 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +41 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/constants.ts +12 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +117 -76
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +13 -0
- package/src/multistream/sendSlotManager.ts +97 -3
- package/src/reachability/clusterReachability.ts +3 -2
- package/src/reachability/index.ts +47 -16
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/util.ts +36 -0
- package/src/reactions/reactions.type.ts +4 -0
- package/src/reconnection-manager/index.ts +0 -1
- package/src/recording-controller/index.ts +1 -2
- package/src/roap/turnDiscovery.ts +9 -1
- package/src/webinar/index.ts +448 -11
- package/src/webinar/utils.ts +16 -0
- package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
- package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
- package/test/unit/spec/annotation/index.ts +69 -7
- 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 +191 -2
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -0
- package/test/unit/spec/hashTree/hashTree.ts +66 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
- package/test/unit/spec/hashTree/utils.ts +125 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
- package/test/unit/spec/interceptors/locusRetry.ts +205 -4
- package/test/unit/spec/interceptors/utils.ts +75 -0
- package/test/unit/spec/interpretation/index.ts +26 -4
- package/test/unit/spec/locus-info/controlsUtils.js +200 -56
- package/test/unit/spec/locus-info/index.js +1848 -164
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +35 -26
- package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
- package/test/unit/spec/meeting/index.js +3611 -334
- 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 +82 -0
- package/test/unit/spec/meeting/utils.js +595 -27
- package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
- package/test/unit/spec/meetings/index.js +1138 -86
- 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 +35 -4
- package/test/unit/spec/member/util.js +154 -27
- 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 +503 -122
- package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
- package/test/unit/spec/reachability/index.ts +128 -46
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/reconnection-manager/index.js +4 -8
- 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 +837 -39
- package/test/unit/spec/webinar/utils.ts +39 -0
|
@@ -34,10 +34,14 @@ import {
|
|
|
34
34
|
ONLINE,
|
|
35
35
|
OFFLINE,
|
|
36
36
|
ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT,
|
|
37
|
+
LOCUS_LLM_EVENT,
|
|
38
|
+
LLM_PRACTICE_SESSION,
|
|
39
|
+
RECORDING_STATE,
|
|
37
40
|
} from '@webex/plugin-meetings/src/constants';
|
|
38
41
|
import {
|
|
39
42
|
ConnectionState,
|
|
40
43
|
MediaConnectionEventNames,
|
|
44
|
+
MediaCodecMimeType,
|
|
41
45
|
StatsAnalyzerEventNames,
|
|
42
46
|
StatsMonitorEventNames,
|
|
43
47
|
Errors,
|
|
@@ -82,6 +86,7 @@ import Mercury from '@webex/internal-plugin-mercury';
|
|
|
82
86
|
import Breakouts from '@webex/plugin-meetings/src/breakouts';
|
|
83
87
|
import SimultaneousInterpretation from '@webex/plugin-meetings/src/interpretation';
|
|
84
88
|
import Webinar from '@webex/plugin-meetings/src/webinar';
|
|
89
|
+
import AIEnableRequest from '@webex/plugin-meetings/src/aiEnableRequest';
|
|
85
90
|
import {REACTION_RELAY_TYPES} from '../../../../src/reactions/constants';
|
|
86
91
|
import locus from '../fixture/locus';
|
|
87
92
|
import {
|
|
@@ -89,6 +94,7 @@ import {
|
|
|
89
94
|
MeetingNotActiveError,
|
|
90
95
|
UserInLobbyError,
|
|
91
96
|
AddMediaFailed,
|
|
97
|
+
MediaConnectionTimedOutError,
|
|
92
98
|
} from '../../../../src/common/errors/webex-errors';
|
|
93
99
|
import WebExMeetingsErrors from '../../../../src/common/errors/webex-meetings-error';
|
|
94
100
|
import ParameterError from '../../../../src/common/errors/parameter';
|
|
@@ -123,7 +129,6 @@ import {EVENT_TRIGGERS as VOICEAEVENTS} from '@webex/internal-plugin-voicea';
|
|
|
123
129
|
import {createBrbState} from '@webex/plugin-meetings/src/meeting/brbState';
|
|
124
130
|
import JoinForbiddenError from '../../../../src/common/errors/join-forbidden-error';
|
|
125
131
|
import {EventEmitter} from 'stream';
|
|
126
|
-
|
|
127
132
|
describe('plugin-meetings', () => {
|
|
128
133
|
const logger = {
|
|
129
134
|
info: () => {},
|
|
@@ -260,12 +265,29 @@ describe('plugin-meetings', () => {
|
|
|
260
265
|
webex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
261
266
|
webex.meetings.reachability = {
|
|
262
267
|
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
268
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
263
269
|
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
264
270
|
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
265
271
|
stopReachability: sinon.stub(),
|
|
266
272
|
isSubnetReachable: sinon.stub().returns(true),
|
|
267
273
|
};
|
|
274
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
275
|
+
.stub()
|
|
276
|
+
.callsFake((ownerMeetingId, sessionId) => {
|
|
277
|
+
const currentOwner = webex.internal.llm.getOwnerMeetingId
|
|
278
|
+
? webex.internal.llm.getOwnerMeetingId(sessionId)
|
|
279
|
+
: undefined;
|
|
280
|
+
const canAssertOwnership = !!ownerMeetingId;
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
currentOwner,
|
|
284
|
+
canAssertOwnership,
|
|
285
|
+
isOwner: !currentOwner || !canAssertOwnership || currentOwner === ownerMeetingId,
|
|
286
|
+
};
|
|
287
|
+
});
|
|
288
|
+
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
268
289
|
webex.internal.llm.on = sinon.stub();
|
|
290
|
+
webex.internal.voicea.announce = sinon.stub();
|
|
269
291
|
webex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
270
292
|
{},
|
|
271
293
|
{parent: webex}
|
|
@@ -376,6 +398,7 @@ describe('plugin-meetings', () => {
|
|
|
376
398
|
assert.instanceOf(meeting.breakouts, Breakouts);
|
|
377
399
|
assert.instanceOf(meeting.simultaneousInterpretation, SimultaneousInterpretation);
|
|
378
400
|
assert.instanceOf(meeting.webinar, Webinar);
|
|
401
|
+
assert.instanceOf(meeting.aiEnableRequest, AIEnableRequest);
|
|
379
402
|
});
|
|
380
403
|
|
|
381
404
|
it('should call the callback with the meeting that has id already set', () => {
|
|
@@ -413,6 +436,161 @@ describe('plugin-meetings', () => {
|
|
|
413
436
|
assert.instanceOf(meeting.mediaRequestManagers.screenShareVideo, MediaRequestManager);
|
|
414
437
|
});
|
|
415
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
|
+
|
|
416
594
|
it('uses meeting id as correlation id if not provided in constructor', () => {
|
|
417
595
|
const newMeeting = new Meeting(
|
|
418
596
|
{
|
|
@@ -708,6 +886,81 @@ describe('plugin-meetings', () => {
|
|
|
708
886
|
assert.deepEqual(args, [[uuid1], locusUrls]);
|
|
709
887
|
});
|
|
710
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
|
+
});
|
|
711
964
|
describe('#getMembers', () => {
|
|
712
965
|
it('should have #getMembers', () => {
|
|
713
966
|
assert.exists(meeting.getMembers);
|
|
@@ -737,8 +990,12 @@ describe('plugin-meetings', () => {
|
|
|
737
990
|
let addMediaInternalStub;
|
|
738
991
|
let supportsRTCPeerConnectionStub;
|
|
739
992
|
|
|
993
|
+
let suspendDestroyMeetingStub;
|
|
994
|
+
|
|
740
995
|
beforeEach(() => {
|
|
741
|
-
supportsRTCPeerConnectionStub = sinon
|
|
996
|
+
supportsRTCPeerConnectionStub = sinon
|
|
997
|
+
.stub(WebCapabilities, 'supportsRTCPeerConnection')
|
|
998
|
+
.returns(CapabilityState.CAPABLE);
|
|
742
999
|
|
|
743
1000
|
meeting.join = sinon.stub().callsFake((joinOptions) => {
|
|
744
1001
|
meeting.isMultistream = joinOptions.enableMultistream;
|
|
@@ -755,6 +1012,7 @@ describe('plugin-meetings', () => {
|
|
|
755
1012
|
.stub(meeting.roap, 'handleTurnDiscoveryHttpResponse')
|
|
756
1013
|
.resolves({turnServerInfo: fakeTurnServerInfo, turnDiscoverySkippedReason: undefined});
|
|
757
1014
|
abortTurnDiscoveryStub = sinon.stub(meeting.roap, 'abortTurnDiscovery');
|
|
1015
|
+
suspendDestroyMeetingStub = sinon.stub(meeting.locusInfo, 'suspendDestroyMeeting');
|
|
758
1016
|
});
|
|
759
1017
|
|
|
760
1018
|
it('should work as expected', async () => {
|
|
@@ -777,8 +1035,9 @@ describe('plugin-meetings', () => {
|
|
|
777
1035
|
assert.calledOnceWithExactly(
|
|
778
1036
|
meeting.addMediaInternal,
|
|
779
1037
|
sinon.match.any,
|
|
780
|
-
fakeTurnServerInfo,
|
|
781
1038
|
false,
|
|
1039
|
+
fakeTurnServerInfo,
|
|
1040
|
+
undefined,
|
|
782
1041
|
mediaOptions
|
|
783
1042
|
);
|
|
784
1043
|
|
|
@@ -786,9 +1045,14 @@ describe('plugin-meetings', () => {
|
|
|
786
1045
|
|
|
787
1046
|
// resets joinWithMediaRetryInfo
|
|
788
1047
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
789
|
-
|
|
1048
|
+
retryCount: 0,
|
|
790
1049
|
prevJoinResponse: undefined,
|
|
791
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);
|
|
792
1056
|
});
|
|
793
1057
|
|
|
794
1058
|
it("should not call handleTurnDiscoveryHttpResponse if we don't send a TURN discovery request with join", async () => {
|
|
@@ -810,8 +1074,9 @@ describe('plugin-meetings', () => {
|
|
|
810
1074
|
assert.calledOnceWithExactly(
|
|
811
1075
|
meeting.addMediaInternal,
|
|
812
1076
|
sinon.match.any,
|
|
813
|
-
undefined,
|
|
814
1077
|
false,
|
|
1078
|
+
undefined,
|
|
1079
|
+
undefined,
|
|
815
1080
|
mediaOptions
|
|
816
1081
|
);
|
|
817
1082
|
|
|
@@ -845,8 +1110,9 @@ describe('plugin-meetings', () => {
|
|
|
845
1110
|
assert.calledOnceWithExactly(
|
|
846
1111
|
meeting.addMediaInternal,
|
|
847
1112
|
sinon.match.any,
|
|
848
|
-
undefined,
|
|
849
1113
|
false,
|
|
1114
|
+
undefined,
|
|
1115
|
+
undefined,
|
|
850
1116
|
mediaOptions
|
|
851
1117
|
);
|
|
852
1118
|
|
|
@@ -858,7 +1124,12 @@ describe('plugin-meetings', () => {
|
|
|
858
1124
|
meeting.join = sinon.stub().returns(Promise.reject(error));
|
|
859
1125
|
meeting.locusUrl = null; // when join fails, we end up with null locusUrl
|
|
860
1126
|
|
|
861
|
-
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);
|
|
862
1133
|
|
|
863
1134
|
assert.calledTwice(abortTurnDiscoveryStub);
|
|
864
1135
|
|
|
@@ -896,11 +1167,86 @@ describe('plugin-meetings', () => {
|
|
|
896
1167
|
|
|
897
1168
|
// resets joinWithMediaRetryInfo
|
|
898
1169
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
899
|
-
|
|
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 re-join on retry when join() fails on first attempt, and throw the first error if join fails again', async () => {
|
|
1185
|
+
const firstJoinError = new Error('first join error');
|
|
1186
|
+
const secondJoinError = new Error('second join error');
|
|
1187
|
+
|
|
1188
|
+
meeting.join = sinon
|
|
1189
|
+
.stub()
|
|
1190
|
+
.onFirstCall()
|
|
1191
|
+
.rejects(firstJoinError)
|
|
1192
|
+
.onSecondCall()
|
|
1193
|
+
.rejects(secondJoinError);
|
|
1194
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1195
|
+
|
|
1196
|
+
const thrownError = await assert.isRejected(
|
|
1197
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1198
|
+
);
|
|
1199
|
+
|
|
1200
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
1201
|
+
assert.calledTwice(meeting.join);
|
|
1202
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1203
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1204
|
+
|
|
1205
|
+
// should throw the first attempt's error, not the second
|
|
1206
|
+
assert.equal(thrownError, firstJoinError);
|
|
1207
|
+
|
|
1208
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1209
|
+
assert.calledWith(
|
|
1210
|
+
Metrics.sendBehavioralMetric.firstCall,
|
|
1211
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1212
|
+
sinon.match({reason: firstJoinError.message, isRetry: false}),
|
|
1213
|
+
sinon.match.any
|
|
1214
|
+
);
|
|
1215
|
+
assert.calledWith(
|
|
1216
|
+
Metrics.sendBehavioralMetric.secondCall,
|
|
1217
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1218
|
+
sinon.match({reason: secondJoinError.message, isRetry: true}),
|
|
1219
|
+
sinon.match.any
|
|
1220
|
+
);
|
|
1221
|
+
|
|
1222
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1223
|
+
retryCount: 0,
|
|
900
1224
|
prevJoinResponse: undefined,
|
|
1225
|
+
firstError: undefined,
|
|
1226
|
+
prevError: undefined,
|
|
901
1227
|
});
|
|
902
1228
|
});
|
|
903
1229
|
|
|
1230
|
+
it('should NOT call join() again on retry when join() succeeded but addMediaInternal() failed', async () => {
|
|
1231
|
+
const addMediaError = new Error('addMedia error');
|
|
1232
|
+
|
|
1233
|
+
meeting.addMediaInternal = sinon
|
|
1234
|
+
.stub()
|
|
1235
|
+
.onFirstCall()
|
|
1236
|
+
.rejects(addMediaError)
|
|
1237
|
+
.onSecondCall()
|
|
1238
|
+
.resolves(test4);
|
|
1239
|
+
|
|
1240
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1241
|
+
|
|
1242
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1243
|
+
|
|
1244
|
+
// join() should only be called once — the successful join result is reused on retry
|
|
1245
|
+
assert.calledOnce(meeting.join);
|
|
1246
|
+
// TURN discovery request is only generated once (on the first attempt alongside join)
|
|
1247
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
1248
|
+
});
|
|
1249
|
+
|
|
904
1250
|
it('should resolve if join() fails the first time but succeeds the second time', async () => {
|
|
905
1251
|
const error = new Error('fake');
|
|
906
1252
|
meeting.join = sinon
|
|
@@ -942,7 +1288,7 @@ describe('plugin-meetings', () => {
|
|
|
942
1288
|
|
|
943
1289
|
// resets joinWithMediaRetryInfo
|
|
944
1290
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
945
|
-
|
|
1291
|
+
retryCount: 0,
|
|
946
1292
|
prevJoinResponse: undefined,
|
|
947
1293
|
});
|
|
948
1294
|
});
|
|
@@ -1011,33 +1357,174 @@ describe('plugin-meetings', () => {
|
|
|
1011
1357
|
);
|
|
1012
1358
|
});
|
|
1013
1359
|
|
|
1014
|
-
it('should
|
|
1360
|
+
it('should throw the first attempt error when retry also fails with a different error', async () => {
|
|
1361
|
+
const firstError = new Error('first attempt error');
|
|
1362
|
+
const secondError = new Error('second attempt error');
|
|
1363
|
+
|
|
1364
|
+
const addMediaInternalResults = [];
|
|
1365
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1366
|
+
const defer = new Defer();
|
|
1367
|
+
addMediaInternalResults.push(defer);
|
|
1368
|
+
return defer.promise;
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1372
|
+
|
|
1373
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1374
|
+
|
|
1375
|
+
await testUtils.flushPromises();
|
|
1376
|
+
|
|
1377
|
+
// 1st attempt fails
|
|
1378
|
+
addMediaInternalResults[0].reject(firstError);
|
|
1379
|
+
await testUtils.flushPromises();
|
|
1380
|
+
|
|
1381
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1382
|
+
assert.notCalled(leaveStub);
|
|
1383
|
+
|
|
1384
|
+
// 2nd (final) attempt fails
|
|
1385
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1386
|
+
const thrownError = await assert.isRejected(result);
|
|
1387
|
+
|
|
1388
|
+
// should throw the first error, not the second
|
|
1389
|
+
assert.equal(thrownError, firstError);
|
|
1390
|
+
|
|
1391
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1392
|
+
assert.calledOnce(leaveStub);
|
|
1393
|
+
|
|
1394
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1395
|
+
});
|
|
1396
|
+
|
|
1397
|
+
it('should throw the UserNotJoinedError as firstError when it occurs on the 1st attempt and 2nd attempt fails differently', async () => {
|
|
1398
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1399
|
+
const secondError = new Error('second attempt error');
|
|
1400
|
+
|
|
1401
|
+
const addMediaInternalResults = [];
|
|
1402
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1403
|
+
const defer = new Defer();
|
|
1404
|
+
addMediaInternalResults.push(defer);
|
|
1405
|
+
return defer.promise;
|
|
1406
|
+
});
|
|
1407
|
+
|
|
1408
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1409
|
+
|
|
1410
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1411
|
+
|
|
1412
|
+
await testUtils.flushPromises();
|
|
1413
|
+
|
|
1414
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1415
|
+
addMediaInternalResults[0].reject(userNotJoinedError);
|
|
1416
|
+
await testUtils.flushPromises();
|
|
1417
|
+
|
|
1418
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1419
|
+
assert.notCalled(leaveStub);
|
|
1420
|
+
|
|
1421
|
+
// 2nd (final) attempt fails
|
|
1422
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1423
|
+
const thrownError = await assert.isRejected(result);
|
|
1424
|
+
|
|
1425
|
+
// should throw the first (UserNotJoinedError), not the second
|
|
1426
|
+
assert.equal(thrownError, userNotJoinedError);
|
|
1427
|
+
|
|
1428
|
+
// join() called twice: original + re-join triggered by UserNotJoinedError in prevError
|
|
1429
|
+
assert.calledTwice(meeting.join);
|
|
1430
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1431
|
+
assert.calledOnce(leaveStub);
|
|
1432
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
it('should throw the first UserNotJoinedError when it occurs on both 1st and 2nd attempts and a 3rd attempt also fails', async () => {
|
|
1436
|
+
const firstUserNotJoinedError = new UserNotJoinedError('first');
|
|
1437
|
+
const secondUserNotJoinedError = new UserNotJoinedError('second');
|
|
1438
|
+
const thirdError = new Error('third attempt error');
|
|
1439
|
+
|
|
1440
|
+
const addMediaInternalResults = [];
|
|
1441
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1442
|
+
const defer = new Defer();
|
|
1443
|
+
addMediaInternalResults.push(defer);
|
|
1444
|
+
return defer.promise;
|
|
1445
|
+
});
|
|
1446
|
+
|
|
1447
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1448
|
+
|
|
1449
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1450
|
+
|
|
1451
|
+
await testUtils.flushPromises();
|
|
1452
|
+
|
|
1453
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1454
|
+
addMediaInternalResults[0].reject(firstUserNotJoinedError);
|
|
1455
|
+
await testUtils.flushPromises();
|
|
1456
|
+
|
|
1457
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1458
|
+
assert.notCalled(leaveStub);
|
|
1459
|
+
|
|
1460
|
+
// 2nd attempt fails with UserNotJoinedError again — triggers another re-join
|
|
1461
|
+
addMediaInternalResults[1].reject(secondUserNotJoinedError);
|
|
1462
|
+
await testUtils.flushPromises();
|
|
1463
|
+
|
|
1464
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1465
|
+
assert.notCalled(leaveStub);
|
|
1466
|
+
|
|
1467
|
+
// 3rd (final) attempt fails
|
|
1468
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1469
|
+
const thrownError = await assert.isRejected(result);
|
|
1470
|
+
|
|
1471
|
+
// should throw the very first error across all 3 attempts
|
|
1472
|
+
assert.equal(thrownError, firstUserNotJoinedError);
|
|
1473
|
+
|
|
1474
|
+
// join() called 3 times: original + 2 re-joins triggered by prevError being UserNotJoinedError
|
|
1475
|
+
assert.calledThrice(meeting.join);
|
|
1476
|
+
// leave() should only be called after the last (3rd) attempt
|
|
1477
|
+
assert.calledOnce(leaveStub);
|
|
1478
|
+
assert.calledThrice(Metrics.sendBehavioralMetric);
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
it('should call leave() if addMediaInternal() fails with a browser media error (TypeError)', async () => {
|
|
1015
1482
|
const addMediaError = new Error('fake addMedia error');
|
|
1016
|
-
addMediaError.name = 'TypeError';
|
|
1483
|
+
addMediaError.name = 'TypeError'; // This makes it a browser media error
|
|
1017
1484
|
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
body: {
|
|
1021
|
-
errorCode: 2729,
|
|
1022
|
-
message: 'fake addMedia error',
|
|
1023
|
-
name: 'TypeError'
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
meeting.addMediaInternal.rejects(addMediaError);
|
|
1028
|
-
sinon.stub(meeting, 'leave').resolves();
|
|
1485
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1486
|
+
meeting.addMediaInternal = sinon.stub().rejects(addMediaError);
|
|
1029
1487
|
|
|
1030
|
-
|
|
1488
|
+
// When a browser media error occurs, it gets transformed into a special structure
|
|
1489
|
+
const rejectedError = await assert.isRejected(
|
|
1031
1490
|
meeting.joinWithMedia({
|
|
1032
1491
|
joinOptions,
|
|
1033
1492
|
mediaOptions,
|
|
1034
|
-
})
|
|
1035
|
-
rejectError
|
|
1493
|
+
})
|
|
1036
1494
|
);
|
|
1037
1495
|
|
|
1496
|
+
// Verify the error was transformed with errorCode 2729
|
|
1497
|
+
assert.equal(rejectedError.error.body.errorCode, 2729);
|
|
1498
|
+
assert.equal(rejectedError.error.body.message, 'fake addMedia error');
|
|
1499
|
+
assert.equal(rejectedError.error.body.name, 'TypeError');
|
|
1500
|
+
|
|
1038
1501
|
assert.calledOnce(meeting.join);
|
|
1039
1502
|
assert.calledOnce(meeting.addMediaInternal);
|
|
1503
|
+
assert.calledOnce(leaveStub);
|
|
1504
|
+
assert.calledOnceWithExactly(leaveStub, {
|
|
1505
|
+
resourceId: undefined,
|
|
1506
|
+
reason: 'joinWithMedia failure',
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1509
|
+
// Browser media errors don't retry, so behavioral metric is sent only once
|
|
1510
|
+
// NOTE: The error gets transformed, so the metric receives undefined for message/stack/name
|
|
1511
|
+
// because they're now nested in error.body instead of at the top level
|
|
1040
1512
|
assert.calledOnce(Metrics.sendBehavioralMetric);
|
|
1513
|
+
assert.calledWith(
|
|
1514
|
+
Metrics.sendBehavioralMetric,
|
|
1515
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1516
|
+
{
|
|
1517
|
+
correlation_id: meeting.correlationId,
|
|
1518
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
1519
|
+
reason: undefined, // transformed error doesn't have .message at top level
|
|
1520
|
+
stack: undefined, // transformed error doesn't have .stack at top level
|
|
1521
|
+
leaveErrorReason: undefined,
|
|
1522
|
+
isRetry: false,
|
|
1523
|
+
},
|
|
1524
|
+
{
|
|
1525
|
+
type: undefined, // transformed error doesn't have .name at top level
|
|
1526
|
+
}
|
|
1527
|
+
);
|
|
1041
1528
|
});
|
|
1042
1529
|
|
|
1043
1530
|
it('should not call leave() if addMediaInternal() fails the first time and succeeds the second time and should only call join() once', async () => {
|
|
@@ -1186,8 +1673,9 @@ describe('plugin-meetings', () => {
|
|
|
1186
1673
|
assert.calledWith(
|
|
1187
1674
|
meeting.addMediaInternal.firstCall,
|
|
1188
1675
|
sinon.match.any,
|
|
1189
|
-
fakeTurnServerInfo,
|
|
1190
1676
|
false,
|
|
1677
|
+
fakeTurnServerInfo,
|
|
1678
|
+
undefined,
|
|
1191
1679
|
mediaOptions
|
|
1192
1680
|
);
|
|
1193
1681
|
|
|
@@ -1195,8 +1683,9 @@ describe('plugin-meetings', () => {
|
|
|
1195
1683
|
assert.calledWith(
|
|
1196
1684
|
meeting.addMediaInternal.secondCall,
|
|
1197
1685
|
sinon.match.any,
|
|
1198
|
-
undefined,
|
|
1199
1686
|
true,
|
|
1687
|
+
undefined,
|
|
1688
|
+
undefined,
|
|
1200
1689
|
mediaOptions
|
|
1201
1690
|
);
|
|
1202
1691
|
|
|
@@ -1214,7 +1703,7 @@ describe('plugin-meetings', () => {
|
|
|
1214
1703
|
|
|
1215
1704
|
meeting.addMediaInternal = sinon
|
|
1216
1705
|
.stub()
|
|
1217
|
-
.callsFake((icePhaseCallback,
|
|
1706
|
+
.callsFake((icePhaseCallback, _forceTurnDiscovery, _turnServerInfo) => {
|
|
1218
1707
|
const defer = new Defer();
|
|
1219
1708
|
|
|
1220
1709
|
icePhaseCallbacks.push(icePhaseCallback);
|
|
@@ -1238,7 +1727,8 @@ describe('plugin-meetings', () => {
|
|
|
1238
1727
|
|
|
1239
1728
|
await testUtils.flushPromises();
|
|
1240
1729
|
|
|
1241
|
-
// check the callback works correctly on the 2nd attempt
|
|
1730
|
+
// check the callback works correctly on the 2nd attempt:
|
|
1731
|
+
// retryCount=1 with a non-UserNotJoinedError is terminal, so icePhase must be JOIN_MEETING_FINAL
|
|
1242
1732
|
assert.equal(icePhaseCallbacks.length, 2);
|
|
1243
1733
|
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1244
1734
|
|
|
@@ -1248,9 +1738,125 @@ describe('plugin-meetings', () => {
|
|
|
1248
1738
|
await assert.isRejected(result);
|
|
1249
1739
|
});
|
|
1250
1740
|
|
|
1741
|
+
it('should allow an additional retry when UserNotJoinedError occurs and return JOIN_MEETING_FINAL on the 3rd attempt', async () => {
|
|
1742
|
+
const genericError = new Error('generic error');
|
|
1743
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1744
|
+
const thirdError = new Error('third error');
|
|
1745
|
+
|
|
1746
|
+
const icePhaseCallbacks = [];
|
|
1747
|
+
const addMediaInternalResults = [];
|
|
1748
|
+
|
|
1749
|
+
meeting.addMediaInternal = sinon.stub().callsFake((icePhaseCallback) => {
|
|
1750
|
+
const defer = new Defer();
|
|
1751
|
+
|
|
1752
|
+
icePhaseCallbacks.push(icePhaseCallback);
|
|
1753
|
+
addMediaInternalResults.push(defer);
|
|
1754
|
+
return defer.promise;
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1757
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1758
|
+
|
|
1759
|
+
const result = meeting.joinWithMedia({
|
|
1760
|
+
joinOptions,
|
|
1761
|
+
mediaOptions,
|
|
1762
|
+
});
|
|
1763
|
+
|
|
1764
|
+
await testUtils.flushPromises();
|
|
1765
|
+
|
|
1766
|
+
// 1st attempt: retryCount=0 → JOIN_MEETING_RETRY
|
|
1767
|
+
assert.equal(icePhaseCallbacks.length, 1);
|
|
1768
|
+
assert.equal(icePhaseCallbacks[0](), 'JOIN_MEETING_RETRY');
|
|
1769
|
+
addMediaInternalResults[0].reject(genericError);
|
|
1770
|
+
|
|
1771
|
+
await testUtils.flushPromises();
|
|
1772
|
+
|
|
1773
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1774
|
+
assert.notCalled(leaveStub);
|
|
1775
|
+
|
|
1776
|
+
// 2nd attempt: retryCount=1 → JOIN_MEETING_FINAL
|
|
1777
|
+
// (In real usage this callback is never invoked when UserNotJoinedError is thrown,
|
|
1778
|
+
// because UserNotJoinedError is thrown before waitForMediaConnectionConnected() is reached.)
|
|
1779
|
+
assert.equal(icePhaseCallbacks.length, 2);
|
|
1780
|
+
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1781
|
+
addMediaInternalResults[1].reject(userNotJoinedError);
|
|
1782
|
+
|
|
1783
|
+
await testUtils.flushPromises();
|
|
1784
|
+
|
|
1785
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1786
|
+
assert.notCalled(leaveStub);
|
|
1787
|
+
|
|
1788
|
+
// 3rd attempt: retryCount=2 → JOIN_MEETING_FINAL
|
|
1789
|
+
assert.equal(icePhaseCallbacks.length, 3);
|
|
1790
|
+
assert.equal(icePhaseCallbacks[2](), 'JOIN_MEETING_FINAL');
|
|
1791
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1792
|
+
|
|
1793
|
+
const thrownError = await assert.isRejected(result);
|
|
1794
|
+
|
|
1795
|
+
// should throw the first error
|
|
1796
|
+
assert.equal(thrownError, genericError);
|
|
1797
|
+
|
|
1798
|
+
// leave() should only be called once, after the last (3rd) attempt
|
|
1799
|
+
assert.calledOnce(leaveStub);
|
|
1800
|
+
});
|
|
1801
|
+
|
|
1802
|
+
it('should re-join when retrying after a UserNotJoinedError', async () => {
|
|
1803
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1804
|
+
|
|
1805
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1806
|
+
|
|
1807
|
+
meeting.addMediaInternal = sinon
|
|
1808
|
+
.stub()
|
|
1809
|
+
.onFirstCall()
|
|
1810
|
+
.rejects(userNotJoinedError)
|
|
1811
|
+
.onSecondCall()
|
|
1812
|
+
.resolves(test4);
|
|
1813
|
+
|
|
1814
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1815
|
+
|
|
1816
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1817
|
+
|
|
1818
|
+
// join() should be called twice — once for the first attempt, once for the re-join after UserNotJoinedError
|
|
1819
|
+
assert.calledTwice(meeting.join);
|
|
1820
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1821
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1822
|
+
// leave() should never be called when retrying after UserNotJoinedError
|
|
1823
|
+
assert.notCalled(leaveStub);
|
|
1824
|
+
});
|
|
1825
|
+
|
|
1826
|
+
it('should re-join when isUserInLeftState returns true on retry', async () => {
|
|
1827
|
+
const addMediaError = new Error('addMedia error');
|
|
1828
|
+
|
|
1829
|
+
sinon.stub(MeetingUtil, 'isUserInLeftState').returns(true);
|
|
1830
|
+
|
|
1831
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1832
|
+
|
|
1833
|
+
meeting.addMediaInternal = sinon
|
|
1834
|
+
.stub()
|
|
1835
|
+
.onFirstCall()
|
|
1836
|
+
.rejects(addMediaError)
|
|
1837
|
+
.onSecondCall()
|
|
1838
|
+
.resolves(test4);
|
|
1839
|
+
|
|
1840
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1841
|
+
|
|
1842
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1843
|
+
|
|
1844
|
+
// join() should be called twice — once for the first attempt, once because the user is in left state
|
|
1845
|
+
assert.calledTwice(meeting.join);
|
|
1846
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1847
|
+
// leave() should never be called when retrying after isUserInLeftState returns true
|
|
1848
|
+
assert.notCalled(leaveStub);
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1251
1851
|
[
|
|
1252
|
-
{
|
|
1253
|
-
|
|
1852
|
+
{
|
|
1853
|
+
errorName: 'SdpOfferCreationError',
|
|
1854
|
+
description: 'if we fail to create the offer on first attempt',
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
errorName: 'WebrtcApiNotAvailableError',
|
|
1858
|
+
description: 'if RTCPeerConnection is not available',
|
|
1859
|
+
},
|
|
1254
1860
|
].forEach(({errorName, description}) => {
|
|
1255
1861
|
it(`should not attempt a retry ${description}`, async () => {
|
|
1256
1862
|
const addMediaError = new Error('fake addMedia error');
|
|
@@ -1290,7 +1896,7 @@ describe('plugin-meetings', () => {
|
|
|
1290
1896
|
resourceId: undefined,
|
|
1291
1897
|
reason: 'joinWithMedia failure',
|
|
1292
1898
|
});
|
|
1293
|
-
})
|
|
1899
|
+
});
|
|
1294
1900
|
});
|
|
1295
1901
|
|
|
1296
1902
|
it('should ignore sendVideo/receiveVideo when videoEnabled is false', async () => {
|
|
@@ -1309,6 +1915,7 @@ describe('plugin-meetings', () => {
|
|
|
1309
1915
|
sinon.match.any,
|
|
1310
1916
|
sinon.match.any,
|
|
1311
1917
|
sinon.match.any,
|
|
1918
|
+
sinon.match.any,
|
|
1312
1919
|
sinon.match.has('videoEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1313
1920
|
);
|
|
1314
1921
|
});
|
|
@@ -1329,6 +1936,7 @@ describe('plugin-meetings', () => {
|
|
|
1329
1936
|
sinon.match.any,
|
|
1330
1937
|
sinon.match.any,
|
|
1331
1938
|
sinon.match.any,
|
|
1939
|
+
sinon.match.any,
|
|
1332
1940
|
sinon.match.has('audioEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1333
1941
|
);
|
|
1334
1942
|
});
|
|
@@ -1350,6 +1958,7 @@ describe('plugin-meetings', () => {
|
|
|
1350
1958
|
sinon.match.any,
|
|
1351
1959
|
sinon.match.any,
|
|
1352
1960
|
sinon.match.any,
|
|
1961
|
+
sinon.match.any,
|
|
1353
1962
|
sinon.match({
|
|
1354
1963
|
sendVideo: true,
|
|
1355
1964
|
receiveVideo: false,
|
|
@@ -1359,6 +1968,101 @@ describe('plugin-meetings', () => {
|
|
|
1359
1968
|
);
|
|
1360
1969
|
});
|
|
1361
1970
|
|
|
1971
|
+
describe('shouldRetryMediaWithOnlyTurnTLS', () => {
|
|
1972
|
+
it('should pass iceTransportPolicy=relay for multistream when previous error is DTLS failure over UDP and TLS is reachable', async () => {
|
|
1973
|
+
meeting.isMultistream = true;
|
|
1974
|
+
const dtlsError = new AddMediaFailed({iceConnected: true, connectionType: 'UDP'});
|
|
1975
|
+
|
|
1976
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon
|
|
1977
|
+
.stub()
|
|
1978
|
+
.resolves(true);
|
|
1979
|
+
|
|
1980
|
+
addMediaInternalStub.onFirstCall().rejects(dtlsError);
|
|
1981
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
1982
|
+
|
|
1983
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1984
|
+
|
|
1985
|
+
assert.calledWith(
|
|
1986
|
+
meeting.addMediaInternal.secondCall,
|
|
1987
|
+
sinon.match.any,
|
|
1988
|
+
sinon.match.any,
|
|
1989
|
+
sinon.match.any,
|
|
1990
|
+
'relay',
|
|
1991
|
+
mediaOptions
|
|
1992
|
+
);
|
|
1993
|
+
});
|
|
1994
|
+
|
|
1995
|
+
[
|
|
1996
|
+
{
|
|
1997
|
+
title: 'TLS is not reachable',
|
|
1998
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
1999
|
+
tlsReachable: false,
|
|
2000
|
+
isMultistream: true,
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
title: 'error is not AddMediaFailed',
|
|
2004
|
+
prevError: new Error('generic error'),
|
|
2005
|
+
tlsReachable: true,
|
|
2006
|
+
isMultistream: true,
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
title: 'error is AddMediaFailed but not DTLS failure',
|
|
2010
|
+
prevError: new AddMediaFailed({iceConnected: false, connectionType: 'UDP'}),
|
|
2011
|
+
tlsReachable: true,
|
|
2012
|
+
isMultistream: true,
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
title: 'error is DTLS failure but connectionType is not UDP',
|
|
2016
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'TURN-TLS'}),
|
|
2017
|
+
tlsReachable: true,
|
|
2018
|
+
isMultistream: true,
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
title: 'isMultistream is false',
|
|
2022
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
2023
|
+
tlsReachable: true,
|
|
2024
|
+
isMultistream: false,
|
|
2025
|
+
},
|
|
2026
|
+
].forEach(({title, prevError, tlsReachable, isMultistream}) => {
|
|
2027
|
+
it(`should pass iceTransportPolicy=undefined when ${title}`, async () => {
|
|
2028
|
+
meeting.join = sinon.stub().callsFake(() => {
|
|
2029
|
+
meeting.isMultistream = isMultistream;
|
|
2030
|
+
return Promise.resolve(fakeJoinResult);
|
|
2031
|
+
});
|
|
2032
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon
|
|
2033
|
+
.stub()
|
|
2034
|
+
.resolves(tlsReachable);
|
|
2035
|
+
|
|
2036
|
+
addMediaInternalStub.onFirstCall().rejects(prevError);
|
|
2037
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
2038
|
+
|
|
2039
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2040
|
+
|
|
2041
|
+
assert.calledWith(
|
|
2042
|
+
meeting.addMediaInternal.secondCall,
|
|
2043
|
+
sinon.match.any,
|
|
2044
|
+
sinon.match.any,
|
|
2045
|
+
sinon.match.any,
|
|
2046
|
+
undefined,
|
|
2047
|
+
mediaOptions
|
|
2048
|
+
);
|
|
2049
|
+
});
|
|
2050
|
+
});
|
|
2051
|
+
|
|
2052
|
+
it('should pass iceTransportPolicy=undefined on first attempt (no prevError)', async () => {
|
|
2053
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2054
|
+
|
|
2055
|
+
assert.calledWith(
|
|
2056
|
+
meeting.addMediaInternal.firstCall,
|
|
2057
|
+
sinon.match.any,
|
|
2058
|
+
sinon.match.any,
|
|
2059
|
+
sinon.match.any,
|
|
2060
|
+
undefined,
|
|
2061
|
+
mediaOptions
|
|
2062
|
+
);
|
|
2063
|
+
});
|
|
2064
|
+
});
|
|
2065
|
+
|
|
1362
2066
|
it('should throw immediately if RTCPeerConnection is not available', async () => {
|
|
1363
2067
|
supportsRTCPeerConnectionStub.returns(CapabilityState.NOT_CAPABLE);
|
|
1364
2068
|
|
|
@@ -1370,9 +2074,97 @@ describe('plugin-meetings', () => {
|
|
|
1370
2074
|
Errors.WebrtcApiNotAvailableError
|
|
1371
2075
|
);
|
|
1372
2076
|
|
|
2077
|
+
assert.notCalled(suspendDestroyMeetingStub);
|
|
1373
2078
|
assert.notCalled(meeting.join);
|
|
1374
2079
|
assert.notCalled(meeting.addMediaInternal);
|
|
1375
2080
|
});
|
|
2081
|
+
|
|
2082
|
+
[
|
|
2083
|
+
{description: '409 error from join()', statusCode: 409, useCause: false},
|
|
2084
|
+
{description: '403 error from join()', statusCode: 403, useCause: false},
|
|
2085
|
+
{
|
|
2086
|
+
description: '409 error in cause (e.g. AddMediaFailed)',
|
|
2087
|
+
statusCode: 409,
|
|
2088
|
+
useCause: true,
|
|
2089
|
+
},
|
|
2090
|
+
{
|
|
2091
|
+
description: '403 error in cause (e.g. AddMediaFailed)',
|
|
2092
|
+
statusCode: 403,
|
|
2093
|
+
useCause: true,
|
|
2094
|
+
},
|
|
2095
|
+
].forEach(({description, statusCode, useCause}) => {
|
|
2096
|
+
it(`should re-join on retry when ${description}`, async () => {
|
|
2097
|
+
const error = useCause
|
|
2098
|
+
? Object.assign(new Error('wrapped error'), {cause: {statusCode}})
|
|
2099
|
+
: Object.assign(new Error('locus error'), {statusCode});
|
|
2100
|
+
|
|
2101
|
+
meeting.addMediaInternal = sinon
|
|
2102
|
+
.stub()
|
|
2103
|
+
.onFirstCall()
|
|
2104
|
+
.rejects(error)
|
|
2105
|
+
.onSecondCall()
|
|
2106
|
+
.resolves(test4);
|
|
2107
|
+
|
|
2108
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2109
|
+
|
|
2110
|
+
assert.deepEqual(result, {
|
|
2111
|
+
join: fakeJoinResult,
|
|
2112
|
+
media: test4,
|
|
2113
|
+
multistreamEnabled: true,
|
|
2114
|
+
});
|
|
2115
|
+
|
|
2116
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
2117
|
+
assert.calledTwice(meeting.join);
|
|
2118
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
2119
|
+
});
|
|
2120
|
+
});
|
|
2121
|
+
|
|
2122
|
+
it('should allow up to JOIN_WITH_MEDIA_RETRY_MAX_COUNT retries for 409 errors', async () => {
|
|
2123
|
+
const error409 = Object.assign(new Error('locus dropped us'), {statusCode: 409});
|
|
2124
|
+
|
|
2125
|
+
meeting.addMediaInternal = sinon.stub().rejects(error409);
|
|
2126
|
+
meeting.join = sinon.stub().callsFake(() => Promise.resolve(fakeJoinResult));
|
|
2127
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
2128
|
+
|
|
2129
|
+
await assert.isRejected(meeting.joinWithMedia({joinOptions, mediaOptions}));
|
|
2130
|
+
|
|
2131
|
+
// JOIN_WITH_MEDIA_RETRY_MAX_COUNT is 2, so we expect 3 attempts total (initial + 2 retries)
|
|
2132
|
+
assert.callCount(meeting.join, 3);
|
|
2133
|
+
assert.callCount(meeting.addMediaInternal, 3);
|
|
2134
|
+
});
|
|
2135
|
+
|
|
2136
|
+
it('should not retry on 1-1 calls', async () => {
|
|
2137
|
+
const addMediaError = new Error('addMedia error');
|
|
2138
|
+
|
|
2139
|
+
sinon.stub(MeetingsUtil, 'isOneOnOneCall').returns(true);
|
|
2140
|
+
|
|
2141
|
+
meeting.addMediaInternal = sinon.stub().rejects(addMediaError);
|
|
2142
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
2143
|
+
|
|
2144
|
+
await assert.isRejected(
|
|
2145
|
+
meeting.joinWithMedia({joinOptions, mediaOptions}),
|
|
2146
|
+
addMediaError
|
|
2147
|
+
);
|
|
2148
|
+
|
|
2149
|
+
// should not retry - only 1 attempt
|
|
2150
|
+
assert.calledOnce(meeting.join);
|
|
2151
|
+
assert.calledOnce(meeting.addMediaInternal);
|
|
2152
|
+
assert.calledOnceWithExactly(
|
|
2153
|
+
Metrics.sendBehavioralMetric,
|
|
2154
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
2155
|
+
{
|
|
2156
|
+
correlation_id: meeting.correlationId,
|
|
2157
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
2158
|
+
reason: addMediaError.message,
|
|
2159
|
+
stack: addMediaError.stack,
|
|
2160
|
+
leaveErrorReason: undefined,
|
|
2161
|
+
isRetry: false,
|
|
2162
|
+
},
|
|
2163
|
+
{
|
|
2164
|
+
type: addMediaError.name,
|
|
2165
|
+
}
|
|
2166
|
+
);
|
|
2167
|
+
});
|
|
1376
2168
|
});
|
|
1377
2169
|
describe('#isTranscriptionSupported', () => {
|
|
1378
2170
|
it('should return false if the feature is not supported for the meeting', () => {
|
|
@@ -1521,6 +2313,22 @@ describe('plugin-meetings', () => {
|
|
|
1521
2313
|
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
|
|
1522
2314
|
);
|
|
1523
2315
|
});
|
|
2316
|
+
|
|
2317
|
+
it('should stop listening to voicea events even when transcription is undefined', () => {
|
|
2318
|
+
meeting.transcription = undefined;
|
|
2319
|
+
meeting.stopTranscription();
|
|
2320
|
+
assert.equal(webex.internal.voicea.off.callCount, 4);
|
|
2321
|
+
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2322
|
+
assert.calledWith(
|
|
2323
|
+
TriggerProxy.trigger,
|
|
2324
|
+
sinon.match.instanceOf(Meeting),
|
|
2325
|
+
{
|
|
2326
|
+
file: 'meeting/index',
|
|
2327
|
+
function: 'triggerStopReceivingTranscriptionEvent',
|
|
2328
|
+
},
|
|
2329
|
+
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
|
|
2330
|
+
);
|
|
2331
|
+
});
|
|
1524
2332
|
});
|
|
1525
2333
|
|
|
1526
2334
|
describe('#setCaptionLanguage', () => {
|
|
@@ -1882,38 +2690,220 @@ describe('plugin-meetings', () => {
|
|
|
1882
2690
|
fakeProcessedReaction
|
|
1883
2691
|
);
|
|
1884
2692
|
});
|
|
1885
|
-
});
|
|
1886
|
-
|
|
1887
|
-
describe('#handleLLMOnline', () => {
|
|
1888
|
-
beforeEach(() => {
|
|
1889
|
-
webex.internal.llm.off = sinon.stub();
|
|
1890
|
-
});
|
|
1891
2693
|
|
|
1892
|
-
it('
|
|
1893
|
-
|
|
1894
|
-
|
|
2694
|
+
it('should process if participantId does not exist in membersCollection but has displayName in Webinar', () => {
|
|
2695
|
+
LoggerProxy.logger.warn = sinon.stub();
|
|
2696
|
+
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2697
|
+
meeting.config.receiveReactions = true;
|
|
2698
|
+
meeting.locusInfo.info = {isWebinar: true};
|
|
2699
|
+
const fakeSendersName = 'Fake reactors name';
|
|
2700
|
+
const fakeReactionPayload = {
|
|
2701
|
+
type: 'fake_type',
|
|
2702
|
+
codepoints: 'fake_codepoints',
|
|
2703
|
+
shortcodes: 'fake_shortcodes',
|
|
2704
|
+
tone: {
|
|
2705
|
+
type: 'fake_tone_type',
|
|
2706
|
+
codepoints: 'fake_tone_codepoints',
|
|
2707
|
+
shortcodes: 'fake_tone_shortcodes',
|
|
2708
|
+
},
|
|
2709
|
+
};
|
|
2710
|
+
const fakeSenderPayload = {
|
|
2711
|
+
displayName: 'Fake reactors name',
|
|
2712
|
+
participantId: 'fake_participant_id',
|
|
2713
|
+
};
|
|
2714
|
+
const fakeProcessedReaction = {
|
|
2715
|
+
reaction: fakeReactionPayload,
|
|
2716
|
+
sender: {
|
|
2717
|
+
id: fakeSenderPayload.participantId,
|
|
2718
|
+
name: fakeSendersName,
|
|
2719
|
+
},
|
|
2720
|
+
};
|
|
2721
|
+
const fakeRelayEvent = {
|
|
2722
|
+
data: {
|
|
2723
|
+
relayType: REACTION_RELAY_TYPES.REACTION,
|
|
2724
|
+
reaction: fakeReactionPayload,
|
|
2725
|
+
sender: fakeSenderPayload,
|
|
2726
|
+
},
|
|
2727
|
+
};
|
|
2728
|
+
meeting.processRelayEvent(fakeRelayEvent);
|
|
1895
2729
|
assert.calledWith(
|
|
1896
2730
|
TriggerProxy.trigger,
|
|
1897
2731
|
sinon.match.instanceOf(Meeting),
|
|
1898
2732
|
{
|
|
1899
2733
|
file: 'meeting/index',
|
|
1900
|
-
function: '
|
|
2734
|
+
function: 'join',
|
|
1901
2735
|
},
|
|
1902
|
-
EVENT_TRIGGERS.
|
|
2736
|
+
EVENT_TRIGGERS.MEETING_RECEIVE_REACTIONS,
|
|
2737
|
+
fakeProcessedReaction
|
|
1903
2738
|
);
|
|
1904
2739
|
});
|
|
1905
|
-
});
|
|
1906
2740
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2741
|
+
[
|
|
2742
|
+
{
|
|
2743
|
+
title:
|
|
2744
|
+
'should skip a reaction when the default relay route does not match the LLM binding',
|
|
2745
|
+
isPracticeSessionConnected: false,
|
|
2746
|
+
route: 'wrong-default-route',
|
|
2747
|
+
defaultBinding: 'default-route',
|
|
2748
|
+
practiceBinding: 'practice-route',
|
|
2749
|
+
shouldProcess: false,
|
|
2750
|
+
expectedSessionLabel: 'default session',
|
|
2751
|
+
},
|
|
2752
|
+
{
|
|
2753
|
+
title: 'should process a reaction when the default relay route matches the LLM binding',
|
|
2754
|
+
isPracticeSessionConnected: false,
|
|
2755
|
+
route: 'default-route',
|
|
2756
|
+
defaultBinding: 'default-route',
|
|
2757
|
+
practiceBinding: 'practice-route',
|
|
2758
|
+
shouldProcess: true,
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
title:
|
|
2762
|
+
'should process a reaction when the practice-session relay route matches the practice-session LLM binding',
|
|
2763
|
+
isPracticeSessionConnected: true,
|
|
2764
|
+
route: 'practice-route',
|
|
2765
|
+
defaultBinding: 'default-route',
|
|
2766
|
+
practiceBinding: 'practice-route',
|
|
2767
|
+
shouldProcess: true,
|
|
2768
|
+
},
|
|
2769
|
+
{
|
|
2770
|
+
title:
|
|
2771
|
+
'should skip a reaction when the practice-session relay route does not match the practice-session LLM binding',
|
|
2772
|
+
isPracticeSessionConnected: true,
|
|
2773
|
+
route: 'default-route',
|
|
2774
|
+
defaultBinding: 'default-route',
|
|
2775
|
+
practiceBinding: 'practice-route',
|
|
2776
|
+
shouldProcess: false,
|
|
2777
|
+
expectedSessionLabel: 'practice session',
|
|
2778
|
+
},
|
|
2779
|
+
].forEach(
|
|
2780
|
+
({
|
|
2781
|
+
title,
|
|
2782
|
+
isPracticeSessionConnected,
|
|
2783
|
+
route,
|
|
2784
|
+
defaultBinding,
|
|
2785
|
+
practiceBinding,
|
|
2786
|
+
shouldProcess,
|
|
2787
|
+
expectedSessionLabel,
|
|
2788
|
+
}) => {
|
|
2789
|
+
it(title, () => {
|
|
2790
|
+
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2791
|
+
meeting.config.receiveReactions = true;
|
|
2792
|
+
const fakeSendersName = 'Fake reactors name';
|
|
2793
|
+
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2794
|
+
webex.internal.llm.isConnected = sinon.stub().callsFake((llmSessionId) => {
|
|
2795
|
+
return llmSessionId === LLM_PRACTICE_SESSION && isPracticeSessionConnected;
|
|
2796
|
+
});
|
|
2797
|
+
webex.internal.llm.getBinding = sinon.stub().callsFake((llmSessionId) => {
|
|
2798
|
+
if (llmSessionId === LLM_PRACTICE_SESSION) {
|
|
2799
|
+
return practiceBinding;
|
|
2800
|
+
}
|
|
1911
2801
|
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2802
|
+
return defaultBinding;
|
|
2803
|
+
});
|
|
2804
|
+
const fakeReactionPayload = {
|
|
2805
|
+
type: 'fake_type',
|
|
2806
|
+
codepoints: 'fake_codepoints',
|
|
2807
|
+
shortcodes: 'fake_shortcodes',
|
|
2808
|
+
};
|
|
2809
|
+
const fakeSenderPayload = {
|
|
2810
|
+
participantId: 'fake_participant_id',
|
|
2811
|
+
};
|
|
2812
|
+
const fakeRelayEvent = {
|
|
2813
|
+
headers: {route},
|
|
2814
|
+
data: {
|
|
2815
|
+
relayType: REACTION_RELAY_TYPES.REACTION,
|
|
2816
|
+
reaction: fakeReactionPayload,
|
|
2817
|
+
sender: fakeSenderPayload,
|
|
2818
|
+
},
|
|
2819
|
+
};
|
|
2820
|
+
const fakeProcessedReaction = {
|
|
2821
|
+
reaction: fakeReactionPayload,
|
|
2822
|
+
sender: {
|
|
2823
|
+
id: fakeSenderPayload.participantId,
|
|
2824
|
+
name: fakeSendersName,
|
|
2825
|
+
},
|
|
2826
|
+
};
|
|
1915
2827
|
|
|
1916
|
-
|
|
2828
|
+
TriggerProxy.trigger.resetHistory();
|
|
2829
|
+
meeting.processRelayEvent(fakeRelayEvent);
|
|
2830
|
+
|
|
2831
|
+
if (shouldProcess) {
|
|
2832
|
+
assert.calledWith(
|
|
2833
|
+
TriggerProxy.trigger,
|
|
2834
|
+
sinon.match.instanceOf(Meeting),
|
|
2835
|
+
{
|
|
2836
|
+
file: 'meeting/index',
|
|
2837
|
+
function: 'join',
|
|
2838
|
+
},
|
|
2839
|
+
EVENT_TRIGGERS.MEETING_RECEIVE_REACTIONS,
|
|
2840
|
+
fakeProcessedReaction
|
|
2841
|
+
);
|
|
2842
|
+
} else {
|
|
2843
|
+
assert.notCalled(TriggerProxy.trigger);
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
);
|
|
2848
|
+
});
|
|
2849
|
+
|
|
2850
|
+
describe('#handleLLMOnline', () => {
|
|
2851
|
+
beforeEach(() => {
|
|
2852
|
+
webex.internal.llm.off = sinon.stub();
|
|
2853
|
+
webex.internal.voicea.getKeepTranscriptionSubscribed = sinon.stub().returns(false);
|
|
2854
|
+
webex.internal.voicea.updateSubchannelSubscriptions = sinon.stub();
|
|
2855
|
+
});
|
|
2856
|
+
|
|
2857
|
+
it('emits transcription connected events', () => {
|
|
2858
|
+
meeting.handleLLMOnline();
|
|
2859
|
+
assert.calledWith(
|
|
2860
|
+
TriggerProxy.trigger,
|
|
2861
|
+
sinon.match.instanceOf(Meeting),
|
|
2862
|
+
{
|
|
2863
|
+
file: 'meeting/index',
|
|
2864
|
+
function: 'handleLLMOnline',
|
|
2865
|
+
},
|
|
2866
|
+
EVENT_TRIGGERS.MEETING_TRANSCRIPTION_CONNECTED
|
|
2867
|
+
);
|
|
2868
|
+
});
|
|
2869
|
+
|
|
2870
|
+
it('restores transcription subscription when caption intent is enabled', () => {
|
|
2871
|
+
webex.internal.voicea.getKeepTranscriptionSubscribed.returns(true);
|
|
2872
|
+
|
|
2873
|
+
meeting.handleLLMOnline();
|
|
2874
|
+
|
|
2875
|
+
assert.calledOnceWithExactly(webex.internal.voicea.updateSubchannelSubscriptions, {
|
|
2876
|
+
subscribe: ['transcription'],
|
|
2877
|
+
});
|
|
2878
|
+
});
|
|
2879
|
+
|
|
2880
|
+
it('does not restore transcription subscription when caption intent is disabled', () => {
|
|
2881
|
+
webex.internal.voicea.getKeepTranscriptionSubscribed.returns(false);
|
|
2882
|
+
|
|
2883
|
+
meeting.handleLLMOnline();
|
|
2884
|
+
|
|
2885
|
+
assert.notCalled(webex.internal.voicea.updateSubchannelSubscriptions);
|
|
2886
|
+
});
|
|
2887
|
+
|
|
2888
|
+
it('calls syncAllHashTreeDatasets on locusInfo', () => {
|
|
2889
|
+
sinon.stub(meeting.locusInfo, 'syncAllHashTreeDatasets').resolves();
|
|
2890
|
+
|
|
2891
|
+
meeting.handleLLMOnline();
|
|
2892
|
+
|
|
2893
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
2894
|
+
});
|
|
2895
|
+
});
|
|
2896
|
+
|
|
2897
|
+
describe('#join', () => {
|
|
2898
|
+
let sandbox = null;
|
|
2899
|
+
let setCorrelationIdSpy;
|
|
2900
|
+
const joinMeetingResult = 'JOIN_MEETINGS_OPTION_RESULT';
|
|
2901
|
+
|
|
2902
|
+
beforeEach(() => {
|
|
2903
|
+
sandbox = sinon.createSandbox();
|
|
2904
|
+
});
|
|
2905
|
+
|
|
2906
|
+
afterEach(() => {
|
|
1917
2907
|
sandbox.restore();
|
|
1918
2908
|
sandbox = null;
|
|
1919
2909
|
});
|
|
@@ -1921,6 +2911,7 @@ describe('plugin-meetings', () => {
|
|
|
1921
2911
|
it('should have #join', () => {
|
|
1922
2912
|
assert.exists(meeting.join);
|
|
1923
2913
|
});
|
|
2914
|
+
|
|
1924
2915
|
beforeEach(() => {
|
|
1925
2916
|
setCorrelationIdSpy = sinon.spy(meeting, 'setCorrelationId');
|
|
1926
2917
|
meeting.setLocus = sinon.stub().returns(true);
|
|
@@ -1981,6 +2972,8 @@ describe('plugin-meetings', () => {
|
|
|
1981
2972
|
regionCode: 'EU',
|
|
1982
2973
|
},
|
|
1983
2974
|
preferTranscoding: !enableMultistream,
|
|
2975
|
+
getCurrentSelfUrl: sinon.match.func,
|
|
2976
|
+
waitForSelfUrlChange: sinon.match.func,
|
|
1984
2977
|
},
|
|
1985
2978
|
{
|
|
1986
2979
|
parent: meeting.webex,
|
|
@@ -2074,7 +3067,6 @@ describe('plugin-meetings', () => {
|
|
|
2074
3067
|
await meeting.join().catch(() => {
|
|
2075
3068
|
assert.calledOnce(MeetingUtil.joinMeeting);
|
|
2076
3069
|
|
|
2077
|
-
// Assert that client.locus.join.response error event is not sent from this function, it is now emitted from MeetingUtil.joinMeeting
|
|
2078
3070
|
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
2079
3071
|
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
2080
3072
|
name: 'client.call.initiated',
|
|
@@ -2106,6 +3098,7 @@ describe('plugin-meetings', () => {
|
|
|
2106
3098
|
});
|
|
2107
3099
|
});
|
|
2108
3100
|
});
|
|
3101
|
+
|
|
2109
3102
|
describe('lmm, transcription & permissionTokenRefresh decoupling', () => {
|
|
2110
3103
|
beforeEach(() => {
|
|
2111
3104
|
sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve(joinMeetingResult));
|
|
@@ -2176,7 +3169,6 @@ describe('plugin-meetings', () => {
|
|
|
2176
3169
|
const locusInfoParseStub = sinon.stub(meeting.locusInfo, 'parse');
|
|
2177
3170
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
2178
3171
|
|
|
2179
|
-
// Set up llm.on stub to capture the registered listener when updateLLMConnection is called
|
|
2180
3172
|
let locusLLMEventListener;
|
|
2181
3173
|
meeting.webex.internal.llm.on = sinon.stub().callsFake((eventName, callback) => {
|
|
2182
3174
|
if (eventName === 'event:locus.state_message') {
|
|
@@ -2185,16 +3177,12 @@ describe('plugin-meetings', () => {
|
|
|
2185
3177
|
});
|
|
2186
3178
|
meeting.webex.internal.llm.off = sinon.stub();
|
|
2187
3179
|
|
|
2188
|
-
// we need the real meeting.updateLLMConnection not the mock
|
|
2189
3180
|
meeting.updateLLMConnection.restore();
|
|
2190
3181
|
|
|
2191
|
-
// Call updateLLMConnection to register the listener
|
|
2192
3182
|
await meeting.updateLLMConnection();
|
|
2193
3183
|
|
|
2194
|
-
// Verify the listener was registered and we captured it
|
|
2195
3184
|
assert.isDefined(locusLLMEventListener, 'LLM event listener should be registered');
|
|
2196
3185
|
|
|
2197
|
-
// Now trigger the event
|
|
2198
3186
|
const eventData = {
|
|
2199
3187
|
eventType: 'locus.state_message',
|
|
2200
3188
|
stateElementsMessage: {
|
|
@@ -2214,13 +3202,10 @@ describe('plugin-meetings', () => {
|
|
|
2214
3202
|
sinon.stub(meeting.webex.internal.llm, 'hasEverConnected').value(true);
|
|
2215
3203
|
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({});
|
|
2216
3204
|
|
|
2217
|
-
// Restore the real updateLLMConnection
|
|
2218
3205
|
meeting.updateLLMConnection.restore();
|
|
2219
3206
|
|
|
2220
|
-
// Call updateLLMConnection to start the timer
|
|
2221
3207
|
await meeting.updateLLMConnection();
|
|
2222
3208
|
|
|
2223
|
-
// Fast forward time by 3 minutes
|
|
2224
3209
|
fakeClock.tick(3 * 60 * 1000);
|
|
2225
3210
|
|
|
2226
3211
|
assert.calledWith(
|
|
@@ -2233,6 +3218,221 @@ describe('plugin-meetings', () => {
|
|
|
2233
3218
|
);
|
|
2234
3219
|
});
|
|
2235
3220
|
|
|
3221
|
+
it('emits breakout join response metric only once per breakoutMoveId', async () => {
|
|
3222
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3223
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3224
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3225
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3226
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3227
|
+
});
|
|
3228
|
+
|
|
3229
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3230
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3231
|
+
meeting.breakouts.set('sessionType', 'BREAKOUT');
|
|
3232
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3233
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3234
|
+
sessionId: 'session-id-1',
|
|
3235
|
+
groupId: 'group-id-1',
|
|
3236
|
+
});
|
|
3237
|
+
|
|
3238
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3239
|
+
meeting.updateLLMConnection.restore();
|
|
3240
|
+
|
|
3241
|
+
await meeting.updateLLMConnection();
|
|
3242
|
+
await meeting.updateLLMConnection();
|
|
3243
|
+
|
|
3244
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3245
|
+
.getCalls()
|
|
3246
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3247
|
+
|
|
3248
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3249
|
+
assert.equal(joinResponseCalls[0].args[0].options.meetingId, meeting.id);
|
|
3250
|
+
});
|
|
3251
|
+
|
|
3252
|
+
it('does not emit breakout join response metric when breakout session is missing', async () => {
|
|
3253
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3254
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3255
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3256
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3257
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3258
|
+
});
|
|
3259
|
+
|
|
3260
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3261
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3262
|
+
|
|
3263
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3264
|
+
meeting.updateLLMConnection.restore();
|
|
3265
|
+
|
|
3266
|
+
await meeting.updateLLMConnection();
|
|
3267
|
+
|
|
3268
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3269
|
+
.getCalls()
|
|
3270
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3271
|
+
|
|
3272
|
+
assert.lengthOf(joinResponseCalls, 0);
|
|
3273
|
+
});
|
|
3274
|
+
|
|
3275
|
+
it('does not emit failed breakout join response metric when breakout session is missing', async () => {
|
|
3276
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3277
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3278
|
+
sinon
|
|
3279
|
+
.stub(meeting.webex.internal.llm, 'registerAndConnect')
|
|
3280
|
+
.rejects(new Error('failed to connect LLM'));
|
|
3281
|
+
|
|
3282
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3283
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3284
|
+
|
|
3285
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3286
|
+
meeting.updateLLMConnection.restore();
|
|
3287
|
+
|
|
3288
|
+
try {
|
|
3289
|
+
await meeting.updateLLMConnection();
|
|
3290
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
3291
|
+
} catch (error) {
|
|
3292
|
+
assert.equal(error.message, 'failed to connect LLM');
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3296
|
+
.getCalls()
|
|
3297
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3298
|
+
|
|
3299
|
+
assert.lengthOf(joinResponseCalls, 0);
|
|
3300
|
+
});
|
|
3301
|
+
|
|
3302
|
+
it('emits llm breakout join response metric after suppressing join response without llmLatency', async () => {
|
|
3303
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3304
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3305
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3306
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3307
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3308
|
+
});
|
|
3309
|
+
|
|
3310
|
+
meeting.config.enableAutomaticLLM = true;
|
|
3311
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3312
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3313
|
+
meeting.breakouts.set('sessionType', 'BREAKOUT');
|
|
3314
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3315
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3316
|
+
sessionId: 'session-id-1',
|
|
3317
|
+
groupId: 'group-id-1',
|
|
3318
|
+
});
|
|
3319
|
+
|
|
3320
|
+
assert.isFalse(meeting.shouldEmitBreakoutJoinResponseMetric('move-id-1'));
|
|
3321
|
+
|
|
3322
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3323
|
+
meeting.updateLLMConnection.restore();
|
|
3324
|
+
|
|
3325
|
+
await meeting.updateLLMConnection();
|
|
3326
|
+
|
|
3327
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3328
|
+
.getCalls()
|
|
3329
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3330
|
+
|
|
3331
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3332
|
+
assert.deepEqual(joinResponseCalls[0].args[0].payload.llmLatency, {
|
|
3333
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3334
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3335
|
+
});
|
|
3336
|
+
});
|
|
3337
|
+
|
|
3338
|
+
it('emits breakout join response metric with llmLatency when returning to main session', async () => {
|
|
3339
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3340
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3341
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({
|
|
3342
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3343
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3344
|
+
});
|
|
3345
|
+
|
|
3346
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3347
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3348
|
+
meeting.breakouts.set('sessionType', 'MAIN');
|
|
3349
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3350
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3351
|
+
sessionId: 'session-id-1',
|
|
3352
|
+
groupId: 'group-id-1',
|
|
3353
|
+
});
|
|
3354
|
+
|
|
3355
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3356
|
+
meeting.updateLLMConnection.restore();
|
|
3357
|
+
|
|
3358
|
+
await meeting.updateLLMConnection();
|
|
3359
|
+
|
|
3360
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3361
|
+
.getCalls()
|
|
3362
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3363
|
+
|
|
3364
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3365
|
+
assert.deepEqual(joinResponseCalls[0].args[0].payload.llmLatency, {
|
|
3366
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3367
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3368
|
+
});
|
|
3369
|
+
});
|
|
3370
|
+
|
|
3371
|
+
it('uses the partial datachannel timing from the error when the websocket connect fails', async () => {
|
|
3372
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3373
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3374
|
+
const connectError = new Error('failed to connect LLM');
|
|
3375
|
+
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3376
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').rejects(connectError);
|
|
3377
|
+
|
|
3378
|
+
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3379
|
+
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
3380
|
+
meeting.breakouts.set('sessionType', 'BREAKOUT');
|
|
3381
|
+
meeting.breakouts.set('status', 'OPEN');
|
|
3382
|
+
meeting.breakouts.set('currentBreakoutSession', {
|
|
3383
|
+
sessionId: 'session-id-1',
|
|
3384
|
+
groupId: 'group-id-1',
|
|
3385
|
+
});
|
|
3386
|
+
|
|
3387
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3388
|
+
meeting.updateLLMConnection.restore();
|
|
3389
|
+
|
|
3390
|
+
try {
|
|
3391
|
+
await meeting.updateLLMConnection();
|
|
3392
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
3393
|
+
} catch (error) {
|
|
3394
|
+
assert.equal(error, connectError);
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
const joinResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3398
|
+
.getCalls()
|
|
3399
|
+
.filter((call) => call.args[0]?.name === 'client.breakout-session.join.response');
|
|
3400
|
+
|
|
3401
|
+
assert.lengthOf(joinResponseCalls, 1);
|
|
3402
|
+
assert.deepEqual(joinResponseCalls[0].args[0].payload.llmLatency, {
|
|
3403
|
+
clientLLMDatachannelResponseTime: 42,
|
|
3404
|
+
clientLLMWebSocketConnectTime: 0,
|
|
3405
|
+
});
|
|
3406
|
+
});
|
|
3407
|
+
|
|
3408
|
+
it('reports the partial datachannel timing on client.llm.connect.response when the websocket connect fails during initial join', async () => {
|
|
3409
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3410
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3411
|
+
const connectError = new Error('failed to connect LLM');
|
|
3412
|
+
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3413
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').rejects(connectError);
|
|
3414
|
+
|
|
3415
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3416
|
+
meeting.updateLLMConnection.restore();
|
|
3417
|
+
|
|
3418
|
+
try {
|
|
3419
|
+
await meeting.updateLLMConnection({isInitialJoinPhase: true});
|
|
3420
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
3421
|
+
} catch (error) {
|
|
3422
|
+
assert.equal(error, connectError);
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3425
|
+
const connectResponseCalls = webex.internal.newMetrics.submitClientEvent
|
|
3426
|
+
.getCalls()
|
|
3427
|
+
.filter((call) => call.args[0]?.name === 'client.llm.connect.response');
|
|
3428
|
+
|
|
3429
|
+
assert.lengthOf(connectResponseCalls, 1);
|
|
3430
|
+
assert.deepEqual(connectResponseCalls[0].args[0].payload.llmLatency, {
|
|
3431
|
+
clientLLMDatachannelResponseTime: 42,
|
|
3432
|
+
clientLLMWebSocketConnectTime: 0,
|
|
3433
|
+
});
|
|
3434
|
+
});
|
|
3435
|
+
|
|
2236
3436
|
it('clears the LLM health check timer when disconnecting LLM', async () => {
|
|
2237
3437
|
const isJoinedStub = sinon.stub(meeting, 'isJoined');
|
|
2238
3438
|
sinon.stub(meeting.webex.internal.llm, 'isConnected');
|
|
@@ -2245,18 +3445,14 @@ describe('plugin-meetings', () => {
|
|
|
2245
3445
|
.stub(meeting.webex.internal.llm, 'getDatachannelUrl')
|
|
2246
3446
|
.returns('https://datachannel1.example.com');
|
|
2247
3447
|
|
|
2248
|
-
// Restore the real updateLLMConnection
|
|
2249
3448
|
meeting.updateLLMConnection.restore();
|
|
2250
3449
|
|
|
2251
|
-
// First, connect LLM and start the timer
|
|
2252
3450
|
isJoinedStub.returns(true);
|
|
2253
3451
|
meeting.webex.internal.llm.isConnected.returns(false);
|
|
2254
3452
|
await meeting.updateLLMConnection();
|
|
2255
3453
|
|
|
2256
|
-
// Verify timer was started
|
|
2257
3454
|
assert.exists(meeting.llmHealthCheckTimer);
|
|
2258
3455
|
|
|
2259
|
-
// Now simulate that we're no longer joined
|
|
2260
3456
|
isJoinedStub.returns(false);
|
|
2261
3457
|
meeting.webex.internal.llm.isConnected.returns(true);
|
|
2262
3458
|
|
|
@@ -2264,10 +3460,8 @@ describe('plugin-meetings', () => {
|
|
|
2264
3460
|
|
|
2265
3461
|
assert.calledOnce(meeting.webex.internal.llm.disconnectLLM);
|
|
2266
3462
|
|
|
2267
|
-
// Verify the timer was cleared (should be undefined)
|
|
2268
3463
|
assert.isUndefined(meeting.llmHealthCheckTimer);
|
|
2269
3464
|
|
|
2270
|
-
// Fast forward time to ensure no metric is sent
|
|
2271
3465
|
Metrics.sendBehavioralMetric.resetHistory();
|
|
2272
3466
|
fakeClock.tick(3 * 60 * 1000);
|
|
2273
3467
|
|
|
@@ -2302,7 +3496,6 @@ describe('plugin-meetings', () => {
|
|
|
2302
3496
|
.stub()
|
|
2303
3497
|
.rejects(new CaptchaError('bad captcha'));
|
|
2304
3498
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2305
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil, 'joinMeetingOptions');
|
|
2306
3499
|
|
|
2307
3500
|
try {
|
|
2308
3501
|
await meeting.join();
|
|
@@ -2316,8 +3509,7 @@ describe('plugin-meetings', () => {
|
|
|
2316
3509
|
);
|
|
2317
3510
|
assert.instanceOf(error, CaptchaError);
|
|
2318
3511
|
assert.equal(error.message, 'bad captcha');
|
|
2319
|
-
|
|
2320
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3512
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2321
3513
|
}
|
|
2322
3514
|
});
|
|
2323
3515
|
|
|
@@ -2326,7 +3518,6 @@ describe('plugin-meetings', () => {
|
|
|
2326
3518
|
.stub()
|
|
2327
3519
|
.rejects(new PasswordError('bad password'));
|
|
2328
3520
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2329
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil.joinMeetingOptions);
|
|
2330
3521
|
|
|
2331
3522
|
try {
|
|
2332
3523
|
await meeting.join();
|
|
@@ -2340,8 +3531,7 @@ describe('plugin-meetings', () => {
|
|
|
2340
3531
|
);
|
|
2341
3532
|
assert.instanceOf(error, PasswordError);
|
|
2342
3533
|
assert.equal(error.message, 'bad password');
|
|
2343
|
-
|
|
2344
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3534
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2345
3535
|
}
|
|
2346
3536
|
});
|
|
2347
3537
|
|
|
@@ -2350,7 +3540,6 @@ describe('plugin-meetings', () => {
|
|
|
2350
3540
|
.stub()
|
|
2351
3541
|
.rejects(new PermissionError('bad permission'));
|
|
2352
3542
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2353
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil.joinMeetingOptions);
|
|
2354
3543
|
|
|
2355
3544
|
try {
|
|
2356
3545
|
await meeting.join();
|
|
@@ -2364,8 +3553,7 @@ describe('plugin-meetings', () => {
|
|
|
2364
3553
|
);
|
|
2365
3554
|
assert.instanceOf(error, PermissionError);
|
|
2366
3555
|
assert.equal(error.message, 'bad permission');
|
|
2367
|
-
|
|
2368
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3556
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2369
3557
|
}
|
|
2370
3558
|
});
|
|
2371
3559
|
});
|
|
@@ -2518,9 +3706,11 @@ describe('plugin-meetings', () => {
|
|
|
2518
3706
|
retriedWithTurnServer: false,
|
|
2519
3707
|
isMultistream: false,
|
|
2520
3708
|
isJoinWithMediaRetry: false,
|
|
3709
|
+
iceTransportPolicy: 'all',
|
|
2521
3710
|
signalingState: 'unknown',
|
|
2522
3711
|
connectionState: 'unknown',
|
|
2523
3712
|
iceConnectionState: 'unknown',
|
|
3713
|
+
connectionType: 'udp',
|
|
2524
3714
|
someReachabilityMetric1: 'some value1',
|
|
2525
3715
|
someReachabilityMetric2: 'some value2',
|
|
2526
3716
|
selectedCandidatePairChanges: 2,
|
|
@@ -2646,9 +3836,11 @@ describe('plugin-meetings', () => {
|
|
|
2646
3836
|
retriedWithTurnServer: false,
|
|
2647
3837
|
isMultistream: false,
|
|
2648
3838
|
isJoinWithMediaRetry: false,
|
|
3839
|
+
iceTransportPolicy: 'all',
|
|
2649
3840
|
signalingState: 'unknown',
|
|
2650
3841
|
connectionState: 'unknown',
|
|
2651
3842
|
iceConnectionState: 'unknown',
|
|
3843
|
+
connectionType: 'udp',
|
|
2652
3844
|
someReachabilityMetric1: 'some value1',
|
|
2653
3845
|
someReachabilityMetric2: 'some value2',
|
|
2654
3846
|
selectedCandidatePairChanges: 2,
|
|
@@ -3028,6 +4220,115 @@ describe('plugin-meetings', () => {
|
|
|
3028
4220
|
checkWorking({allowMediaInLobby: true});
|
|
3029
4221
|
});
|
|
3030
4222
|
|
|
4223
|
+
const setupLobbyTest = () => {
|
|
4224
|
+
meeting.roap.doTurnDiscovery = sinon
|
|
4225
|
+
.stub()
|
|
4226
|
+
.resolves({turnServerInfo: undefined, turnDiscoverySkippedReason: undefined});
|
|
4227
|
+
|
|
4228
|
+
meeting.meetingState = 'ACTIVE';
|
|
4229
|
+
meeting.locusInfo.parsedLocus = {self: {state: 'IDLE'}};
|
|
4230
|
+
meeting.isUserUnadmitted = true;
|
|
4231
|
+
|
|
4232
|
+
// Mock locusMediaRequest
|
|
4233
|
+
meeting.locusMediaRequest = {
|
|
4234
|
+
send: sinon.stub().resolves(),
|
|
4235
|
+
isConfluenceCreated: sinon.stub().returns(false),
|
|
4236
|
+
};
|
|
4237
|
+
|
|
4238
|
+
sinon.stub(RemoteMediaManagerModule, 'RemoteMediaManager').returns({
|
|
4239
|
+
start: sinon.stub().resolves(),
|
|
4240
|
+
on: sinon.stub(),
|
|
4241
|
+
logAllReceiveSlots: sinon.stub(),
|
|
4242
|
+
});
|
|
4243
|
+
|
|
4244
|
+
meeting.isMultistream = true;
|
|
4245
|
+
|
|
4246
|
+
const createFakeStream = (id) => ({
|
|
4247
|
+
on: sinon.stub(),
|
|
4248
|
+
off: sinon.stub(),
|
|
4249
|
+
userMuted: false,
|
|
4250
|
+
systemMuted: false,
|
|
4251
|
+
get muted() {
|
|
4252
|
+
return this.userMuted || this.systemMuted;
|
|
4253
|
+
},
|
|
4254
|
+
setUnmuteAllowed: sinon.stub(),
|
|
4255
|
+
setUserMuted: sinon.stub(),
|
|
4256
|
+
outputStream: {
|
|
4257
|
+
getTracks: () => [{id}],
|
|
4258
|
+
},
|
|
4259
|
+
getSettings: sinon.stub().returns({}),
|
|
4260
|
+
});
|
|
4261
|
+
|
|
4262
|
+
return {
|
|
4263
|
+
fakeMicrophoneStream: createFakeStream('fake mic'),
|
|
4264
|
+
fakeCameraStream: createFakeStream('fake camera'),
|
|
4265
|
+
};
|
|
4266
|
+
};
|
|
4267
|
+
|
|
4268
|
+
it('should not publish any local streams when in the lobby and allowPublishMediaInLobby is false', async () => {
|
|
4269
|
+
const {fakeMicrophoneStream, fakeCameraStream} = setupLobbyTest();
|
|
4270
|
+
|
|
4271
|
+
const publishStreamStub = sinon.stub();
|
|
4272
|
+
fakeMediaConnection.createSendSlot = sinon.stub().returns({
|
|
4273
|
+
publishStream: publishStreamStub,
|
|
4274
|
+
unpublishStream: sinon.stub(),
|
|
4275
|
+
setNamedMediaGroups: sinon.stub(),
|
|
4276
|
+
});
|
|
4277
|
+
sinon.spy(meeting.sendSlotManager, 'reset');
|
|
4278
|
+
|
|
4279
|
+
await meeting.addMedia({
|
|
4280
|
+
allowMediaInLobby: true,
|
|
4281
|
+
allowPublishMediaInLobby: false,
|
|
4282
|
+
audioEnabled: true,
|
|
4283
|
+
videoEnabled: true,
|
|
4284
|
+
localStreams: {
|
|
4285
|
+
microphone: fakeMicrophoneStream,
|
|
4286
|
+
camera: fakeCameraStream,
|
|
4287
|
+
},
|
|
4288
|
+
});
|
|
4289
|
+
|
|
4290
|
+
assert.calledOnce(meeting.sendSlotManager.reset);
|
|
4291
|
+
assert.notCalled(publishStreamStub);
|
|
4292
|
+
});
|
|
4293
|
+
|
|
4294
|
+
it('should publish local streams when in the lobby and allowPublishMediaInLobby is true', async () => {
|
|
4295
|
+
const {fakeMicrophoneStream, fakeCameraStream} = setupLobbyTest();
|
|
4296
|
+
|
|
4297
|
+
const audioSlot = {
|
|
4298
|
+
publishStream: sinon.stub(),
|
|
4299
|
+
unpublishStream: sinon.stub(),
|
|
4300
|
+
setNamedMediaGroups: sinon.stub(),
|
|
4301
|
+
};
|
|
4302
|
+
const videoSlot = {
|
|
4303
|
+
publishStream: sinon.stub(),
|
|
4304
|
+
unpublishStream: sinon.stub(),
|
|
4305
|
+
setNamedMediaGroups: sinon.stub(),
|
|
4306
|
+
};
|
|
4307
|
+
|
|
4308
|
+
fakeMediaConnection.createSendSlot = sinon.stub().callsFake((mediaType) => {
|
|
4309
|
+
if (mediaType === 'AUDIO-MAIN') {
|
|
4310
|
+
return audioSlot;
|
|
4311
|
+
}
|
|
4312
|
+
return videoSlot;
|
|
4313
|
+
});
|
|
4314
|
+
sinon.spy(meeting.sendSlotManager, 'reset');
|
|
4315
|
+
|
|
4316
|
+
await meeting.addMedia({
|
|
4317
|
+
allowMediaInLobby: true,
|
|
4318
|
+
allowPublishMediaInLobby: true,
|
|
4319
|
+
audioEnabled: true,
|
|
4320
|
+
videoEnabled: true,
|
|
4321
|
+
localStreams: {
|
|
4322
|
+
microphone: fakeMicrophoneStream,
|
|
4323
|
+
camera: fakeCameraStream,
|
|
4324
|
+
},
|
|
4325
|
+
});
|
|
4326
|
+
|
|
4327
|
+
assert.calledOnce(meeting.sendSlotManager.reset);
|
|
4328
|
+
assert.calledOnceWithExactly(audioSlot.publishStream, fakeMicrophoneStream);
|
|
4329
|
+
assert.calledOnceWithExactly(videoSlot.publishStream, fakeCameraStream);
|
|
4330
|
+
});
|
|
4331
|
+
|
|
3031
4332
|
it('should create rtcMetrics and pass them to Media.createMediaConnection()', async () => {
|
|
3032
4333
|
const setIntervalOriginal = window.setInterval;
|
|
3033
4334
|
window.setInterval = sinon.stub().returns(1);
|
|
@@ -3046,11 +4347,13 @@ describe('plugin-meetings', () => {
|
|
|
3046
4347
|
|
|
3047
4348
|
meeting.meetingState = 'ACTIVE';
|
|
3048
4349
|
meeting.isMultistream = true;
|
|
4350
|
+
sinon.spy(meeting.sendSlotManager, 'reset');
|
|
3049
4351
|
|
|
3050
4352
|
await meeting.addMedia({
|
|
3051
4353
|
mediaSettings: {},
|
|
3052
4354
|
});
|
|
3053
4355
|
|
|
4356
|
+
assert.calledOnce(meeting.sendSlotManager.reset);
|
|
3054
4357
|
// check that rtcMetrics was passed to Media.createMediaConnection
|
|
3055
4358
|
assert.calledOnce(Media.createMediaConnection);
|
|
3056
4359
|
assert.calledWith(
|
|
@@ -3311,9 +4614,11 @@ describe('plugin-meetings', () => {
|
|
|
3311
4614
|
retriedWithTurnServer: true,
|
|
3312
4615
|
isMultistream: false,
|
|
3313
4616
|
isJoinWithMediaRetry: false,
|
|
4617
|
+
iceTransportPolicy: 'all',
|
|
3314
4618
|
signalingState: 'unknown',
|
|
3315
4619
|
connectionState: 'unknown',
|
|
3316
4620
|
iceConnectionState: 'unknown',
|
|
4621
|
+
connectionType: 'udp',
|
|
3317
4622
|
selectedCandidatePairChanges: 2,
|
|
3318
4623
|
numTransports: 1,
|
|
3319
4624
|
iceCandidatesCount: 0,
|
|
@@ -3338,40 +4643,207 @@ describe('plugin-meetings', () => {
|
|
|
3338
4643
|
assert.isOk(errorThrown);
|
|
3339
4644
|
});
|
|
3340
4645
|
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
4646
|
+
[
|
|
4647
|
+
{iceConnected: true, title: 'iceConnected=true'},
|
|
4648
|
+
{iceConnected: false, title: 'iceConnected=false'},
|
|
4649
|
+
].forEach(({iceConnected, title}) => {
|
|
4650
|
+
it(`should propagate ${title} from waitForMediaConnectionConnected rejection to AddMediaFailed`, async () => {
|
|
4651
|
+
webex.meetings.reachability = {
|
|
4652
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4653
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4654
|
+
stopReachability: sinon.stub(),
|
|
4655
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4656
|
+
};
|
|
4657
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4658
|
+
sinon.stub().returns({fatal: true});
|
|
4659
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4660
|
+
|
|
4661
|
+
meeting.meetingState = 'ACTIVE';
|
|
4662
|
+
const rejectedResult = {iceConnected};
|
|
4663
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
3345
4664
|
.stub()
|
|
3346
|
-
.
|
|
3347
|
-
.rejects()
|
|
3348
|
-
.onCall(1)
|
|
3349
|
-
.resolves(true)
|
|
3350
|
-
.onCall(2)
|
|
3351
|
-
.resolves(false),
|
|
3352
|
-
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
3353
|
-
stopReachability: sinon.stub(),
|
|
3354
|
-
isSubnetReachable: sinon.stub().returns(true),
|
|
3355
|
-
};
|
|
3356
|
-
const getErrorPayloadForClientErrorCodeStub =
|
|
3357
|
-
(webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
3358
|
-
sinon.stub().returns(FAKE_ERROR));
|
|
3359
|
-
const MOCK_CLIENT_ERROR_CODE = 2004;
|
|
3360
|
-
const generateClientErrorCodeForIceFailureStub = sinon
|
|
3361
|
-
.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure')
|
|
3362
|
-
.returns(MOCK_CLIENT_ERROR_CODE);
|
|
3363
|
-
const FAKE_TURN_URL = 'turns:webex.com:3478';
|
|
3364
|
-
const FAKE_TURN_USER = 'some-turn-username';
|
|
3365
|
-
const FAKE_TURN_PASSWORD = 'some-password';
|
|
3366
|
-
let errorThrown = undefined;
|
|
4665
|
+
.rejects(rejectedResult);
|
|
3367
4666
|
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
4667
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4668
|
+
turnServerInfo: {urls: ['turns:fake:443'], username: 'u', password: 'p'},
|
|
4669
|
+
turnDiscoverySkippedReason: undefined,
|
|
4670
|
+
});
|
|
4671
|
+
|
|
4672
|
+
const forceRtcMetricsSend = sinon.stub().resolves();
|
|
4673
|
+
Media.createMediaConnection = sinon.stub().returns({
|
|
4674
|
+
close: sinon.stub(),
|
|
4675
|
+
forceRtcMetricsSend,
|
|
4676
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4677
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4678
|
+
on: sinon.stub(),
|
|
4679
|
+
});
|
|
4680
|
+
|
|
4681
|
+
let thrownError;
|
|
4682
|
+
await meeting.addMedia({mediaSettings: {}}).catch((err) => {
|
|
4683
|
+
thrownError = err;
|
|
4684
|
+
});
|
|
4685
|
+
|
|
4686
|
+
assert.instanceOf(thrownError, AddMediaFailed);
|
|
4687
|
+
assert.equal(thrownError.iceConnected, iceConnected);
|
|
4688
|
+
// the AddMediaFailed cause should be the MediaConnectionTimedOutError, which in turn should
|
|
4689
|
+
// preserve the original rejected result as its cause, so that the web client
|
|
4690
|
+
// can find the CA-reported error in the eventErrorCache via the cause chain
|
|
4691
|
+
assert.instanceOf(thrownError.cause, MediaConnectionTimedOutError);
|
|
4692
|
+
assert.equal(thrownError.cause.cause, rejectedResult);
|
|
4693
|
+
});
|
|
4694
|
+
});
|
|
4695
|
+
|
|
4696
|
+
describe('iceTransportPolicy=relay handling', () => {
|
|
4697
|
+
let createMediaConnectionStub;
|
|
4698
|
+
|
|
4699
|
+
beforeEach(() => {
|
|
4700
|
+
webex.meetings.reachability = {
|
|
4701
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4702
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(true),
|
|
4703
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4704
|
+
stopReachability: sinon.stub(),
|
|
4705
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4706
|
+
};
|
|
4707
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4708
|
+
sinon.stub().returns({fatal: true});
|
|
4709
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4710
|
+
|
|
4711
|
+
meeting.meetingState = 'ACTIVE';
|
|
4712
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().resolves();
|
|
4713
|
+
|
|
4714
|
+
createMediaConnectionStub = sinon.stub().returns({
|
|
4715
|
+
close: sinon.stub(),
|
|
4716
|
+
forceRtcMetricsSend: sinon.stub().resolves(),
|
|
4717
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4718
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4719
|
+
on: sinon.stub(),
|
|
4720
|
+
});
|
|
4721
|
+
Media.createMediaConnection = createMediaConnectionStub;
|
|
4722
|
+
});
|
|
4723
|
+
|
|
4724
|
+
[
|
|
4725
|
+
{
|
|
4726
|
+
title:
|
|
4727
|
+
'should drop iceTransportPolicy=relay when TURN discovery returns no turn server info',
|
|
4728
|
+
turnServerInfo: undefined,
|
|
4729
|
+
turnDiscoverySkippedReason: 'reachability',
|
|
4730
|
+
},
|
|
4731
|
+
{
|
|
4732
|
+
title:
|
|
4733
|
+
'should drop iceTransportPolicy=relay when TURN discovery returns turnServerInfo with empty urls',
|
|
4734
|
+
turnServerInfo: {urls: [], username: 'u', password: 'p'},
|
|
4735
|
+
turnDiscoverySkippedReason: undefined,
|
|
4736
|
+
},
|
|
4737
|
+
].forEach(({title, turnServerInfo, turnDiscoverySkippedReason}) => {
|
|
4738
|
+
it(title, async () => {
|
|
4739
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4740
|
+
turnServerInfo,
|
|
4741
|
+
turnDiscoverySkippedReason,
|
|
4742
|
+
});
|
|
4743
|
+
|
|
4744
|
+
await meeting.addMediaInternal(
|
|
4745
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4746
|
+
false,
|
|
4747
|
+
undefined,
|
|
4748
|
+
'relay',
|
|
4749
|
+
{mediaSettings: {}}
|
|
4750
|
+
);
|
|
4751
|
+
|
|
4752
|
+
assert.calledOnce(createMediaConnectionStub);
|
|
4753
|
+
const config = createMediaConnectionStub.firstCall.args[3];
|
|
4754
|
+
assert.isUndefined(config.iceTransportPolicy);
|
|
4755
|
+
|
|
4756
|
+
const successCall = Metrics.sendBehavioralMetric
|
|
4757
|
+
.getCalls()
|
|
4758
|
+
.find((call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS);
|
|
4759
|
+
assert.isDefined(successCall);
|
|
4760
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'all');
|
|
4761
|
+
});
|
|
4762
|
+
});
|
|
4763
|
+
|
|
4764
|
+
it('should send ADD_MEDIA_SUCCESS metric with iceTransportPolicy=relay when relay is used', async () => {
|
|
4765
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4766
|
+
turnServerInfo: {
|
|
4767
|
+
urls: ['turns:turn-server:443?transport=tcp'],
|
|
4768
|
+
username: 'u',
|
|
4769
|
+
password: 'p',
|
|
4770
|
+
},
|
|
4771
|
+
turnDiscoverySkippedReason: undefined,
|
|
4772
|
+
});
|
|
4773
|
+
|
|
4774
|
+
await meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, 'relay', {
|
|
4775
|
+
mediaSettings: {},
|
|
4776
|
+
});
|
|
4777
|
+
|
|
4778
|
+
const successCall = Metrics.sendBehavioralMetric
|
|
4779
|
+
.getCalls()
|
|
4780
|
+
.find((call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS);
|
|
4781
|
+
assert.isDefined(successCall);
|
|
4782
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'relay');
|
|
4783
|
+
});
|
|
4784
|
+
|
|
4785
|
+
it('should send ADD_MEDIA_FAILURE metric with iceTransportPolicy=relay when relay attempt fails', async () => {
|
|
4786
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4787
|
+
turnServerInfo: {
|
|
4788
|
+
urls: ['turns:turn-server:443?transport=tcp'],
|
|
4789
|
+
username: 'u',
|
|
4790
|
+
password: 'p',
|
|
4791
|
+
},
|
|
4792
|
+
turnDiscoverySkippedReason: undefined,
|
|
4793
|
+
});
|
|
4794
|
+
|
|
4795
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
4796
|
+
.stub()
|
|
4797
|
+
.rejects(new MediaConnectionTimedOutError('timed out', true));
|
|
4798
|
+
|
|
4799
|
+
await assert.isRejected(
|
|
4800
|
+
meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, 'relay', {
|
|
4801
|
+
mediaSettings: {},
|
|
4802
|
+
})
|
|
4803
|
+
);
|
|
4804
|
+
|
|
4805
|
+
const failureCall = Metrics.sendBehavioralMetric
|
|
4806
|
+
.getCalls()
|
|
4807
|
+
.find((call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE);
|
|
4808
|
+
assert.isDefined(failureCall);
|
|
4809
|
+
assert.equal(failureCall.args[1].iceTransportPolicy, 'relay');
|
|
4810
|
+
});
|
|
4811
|
+
});
|
|
4812
|
+
|
|
4813
|
+
it('should resolve if waitForMediaConnectionConnected() rejects the first time but resolves the second time', async () => {
|
|
4814
|
+
const FAKE_ERROR = {fatal: true};
|
|
4815
|
+
webex.meetings.reachability = {
|
|
4816
|
+
isWebexMediaBackendUnreachable: sinon
|
|
4817
|
+
.stub()
|
|
4818
|
+
.onCall(0)
|
|
4819
|
+
.rejects()
|
|
4820
|
+
.onCall(1)
|
|
4821
|
+
.resolves(true)
|
|
4822
|
+
.onCall(2)
|
|
4823
|
+
.resolves(false),
|
|
4824
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4825
|
+
stopReachability: sinon.stub(),
|
|
4826
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4827
|
+
};
|
|
4828
|
+
const getErrorPayloadForClientErrorCodeStub =
|
|
4829
|
+
(webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4830
|
+
sinon.stub().returns(FAKE_ERROR));
|
|
4831
|
+
const MOCK_CLIENT_ERROR_CODE = 2004;
|
|
4832
|
+
const generateClientErrorCodeForIceFailureStub = sinon
|
|
4833
|
+
.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure')
|
|
4834
|
+
.returns(MOCK_CLIENT_ERROR_CODE);
|
|
4835
|
+
const FAKE_TURN_URL = 'turns:webex.com:3478';
|
|
4836
|
+
const FAKE_TURN_USER = 'some-turn-username';
|
|
4837
|
+
const FAKE_TURN_PASSWORD = 'some-password';
|
|
4838
|
+
let errorThrown = undefined;
|
|
4839
|
+
|
|
4840
|
+
meeting.meetingState = 'ACTIVE';
|
|
4841
|
+
meeting.roap.doTurnDiscovery = sinon
|
|
4842
|
+
.stub()
|
|
4843
|
+
.onFirstCall()
|
|
4844
|
+
.returns({
|
|
4845
|
+
turnServerInfo: undefined,
|
|
4846
|
+
turnDiscoverySkippedReason: 'reachability',
|
|
3375
4847
|
})
|
|
3376
4848
|
.onSecondCall()
|
|
3377
4849
|
.returns({
|
|
@@ -3527,6 +4999,7 @@ describe('plugin-meetings', () => {
|
|
|
3527
4999
|
isMultistream: false,
|
|
3528
5000
|
retriedWithTurnServer: true,
|
|
3529
5001
|
isJoinWithMediaRetry: false,
|
|
5002
|
+
iceTransportPolicy: 'all',
|
|
3530
5003
|
iceCandidatesCount: 0,
|
|
3531
5004
|
subnet_reachable: null,
|
|
3532
5005
|
selected_cluster: null,
|
|
@@ -3690,6 +5163,7 @@ describe('plugin-meetings', () => {
|
|
|
3690
5163
|
isMultistream: false,
|
|
3691
5164
|
retriedWithTurnServer: false,
|
|
3692
5165
|
isJoinWithMediaRetry: false,
|
|
5166
|
+
iceTransportPolicy: 'all',
|
|
3693
5167
|
someReachabilityMetric1: 'some value1',
|
|
3694
5168
|
someReachabilityMetric2: 'some value2',
|
|
3695
5169
|
iceCandidatesCount: 3,
|
|
@@ -3755,9 +5229,11 @@ describe('plugin-meetings', () => {
|
|
|
3755
5229
|
retriedWithTurnServer: false,
|
|
3756
5230
|
isMultistream: false,
|
|
3757
5231
|
isJoinWithMediaRetry: false,
|
|
5232
|
+
iceTransportPolicy: 'all',
|
|
3758
5233
|
signalingState: 'unknown',
|
|
3759
5234
|
connectionState: 'unknown',
|
|
3760
5235
|
iceConnectionState: 'unknown',
|
|
5236
|
+
connectionType: 'udp',
|
|
3761
5237
|
selectedCandidatePairChanges: 2,
|
|
3762
5238
|
numTransports: 1,
|
|
3763
5239
|
subnet_reachable: null,
|
|
@@ -3818,9 +5294,11 @@ describe('plugin-meetings', () => {
|
|
|
3818
5294
|
retriedWithTurnServer: false,
|
|
3819
5295
|
isMultistream: false,
|
|
3820
5296
|
isJoinWithMediaRetry: false,
|
|
5297
|
+
iceTransportPolicy: 'all',
|
|
3821
5298
|
signalingState: 'unknown',
|
|
3822
5299
|
connectionState: 'unknown',
|
|
3823
5300
|
iceConnectionState: 'unknown',
|
|
5301
|
+
connectionType: 'udp',
|
|
3824
5302
|
selectedCandidatePairChanges: 2,
|
|
3825
5303
|
numTransports: 1,
|
|
3826
5304
|
'701_error': 2,
|
|
@@ -3882,6 +5360,7 @@ describe('plugin-meetings', () => {
|
|
|
3882
5360
|
isMultistream: false,
|
|
3883
5361
|
retriedWithTurnServer: false,
|
|
3884
5362
|
isJoinWithMediaRetry: false,
|
|
5363
|
+
iceTransportPolicy: 'all',
|
|
3885
5364
|
iceCandidatesCount: 0,
|
|
3886
5365
|
reachability_public_udp_success: 5,
|
|
3887
5366
|
subnet_reachable: false,
|
|
@@ -3947,9 +5426,11 @@ describe('plugin-meetings', () => {
|
|
|
3947
5426
|
retriedWithTurnServer: false,
|
|
3948
5427
|
isMultistream: false,
|
|
3949
5428
|
isJoinWithMediaRetry: false,
|
|
5429
|
+
iceTransportPolicy: 'all',
|
|
3950
5430
|
signalingState: 'unknown',
|
|
3951
5431
|
connectionState: 'unknown',
|
|
3952
5432
|
iceConnectionState: 'unknown',
|
|
5433
|
+
connectionType: 'udp',
|
|
3953
5434
|
selectedCandidatePairChanges: 2,
|
|
3954
5435
|
numTransports: 1,
|
|
3955
5436
|
reachability_public_udp_success: 5,
|
|
@@ -4333,6 +5814,297 @@ describe('plugin-meetings', () => {
|
|
|
4333
5814
|
},
|
|
4334
5815
|
});
|
|
4335
5816
|
});
|
|
5817
|
+
|
|
5818
|
+
describe('handles STATS_UPDATE event for SRTP cipher detection', () => {
|
|
5819
|
+
it('emits MEETING_SRTP_CIPHER_UPDATED event when srtpCipher is found in transport stats', async () => {
|
|
5820
|
+
const fakeStats = new Map([
|
|
5821
|
+
[
|
|
5822
|
+
'transport-1',
|
|
5823
|
+
{
|
|
5824
|
+
type: 'transport',
|
|
5825
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5826
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5827
|
+
},
|
|
5828
|
+
],
|
|
5829
|
+
[
|
|
5830
|
+
'outbound-rtp-1',
|
|
5831
|
+
{
|
|
5832
|
+
type: 'outbound-rtp',
|
|
5833
|
+
ssrc: 12345,
|
|
5834
|
+
},
|
|
5835
|
+
],
|
|
5836
|
+
]);
|
|
5837
|
+
|
|
5838
|
+
statsAnalyzerStub.emit(
|
|
5839
|
+
{file: 'test', function: 'test'},
|
|
5840
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5841
|
+
{stats: fakeStats}
|
|
5842
|
+
);
|
|
5843
|
+
|
|
5844
|
+
assert.calledWith(
|
|
5845
|
+
TriggerProxy.trigger,
|
|
5846
|
+
sinon.match.instanceOf(Meeting),
|
|
5847
|
+
{
|
|
5848
|
+
file: 'meeting/index',
|
|
5849
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5850
|
+
},
|
|
5851
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5852
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
5853
|
+
);
|
|
5854
|
+
|
|
5855
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5856
|
+
});
|
|
5857
|
+
|
|
5858
|
+
it('updates meeting.mediaProperties.srtpCipher when cipher changes', async () => {
|
|
5859
|
+
const firstStats = new Map([
|
|
5860
|
+
[
|
|
5861
|
+
'transport-1',
|
|
5862
|
+
{
|
|
5863
|
+
type: 'transport',
|
|
5864
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5865
|
+
},
|
|
5866
|
+
],
|
|
5867
|
+
]);
|
|
5868
|
+
|
|
5869
|
+
statsAnalyzerStub.emit(
|
|
5870
|
+
{file: 'test', function: 'test'},
|
|
5871
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5872
|
+
{stats: firstStats}
|
|
5873
|
+
);
|
|
5874
|
+
|
|
5875
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5876
|
+
|
|
5877
|
+
const secondStats = new Map([
|
|
5878
|
+
[
|
|
5879
|
+
'transport-1',
|
|
5880
|
+
{
|
|
5881
|
+
type: 'transport',
|
|
5882
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5883
|
+
},
|
|
5884
|
+
],
|
|
5885
|
+
]);
|
|
5886
|
+
|
|
5887
|
+
TriggerProxy.trigger.resetHistory();
|
|
5888
|
+
|
|
5889
|
+
statsAnalyzerStub.emit(
|
|
5890
|
+
{file: 'test', function: 'test'},
|
|
5891
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5892
|
+
{stats: secondStats}
|
|
5893
|
+
);
|
|
5894
|
+
|
|
5895
|
+
assert.calledWith(
|
|
5896
|
+
TriggerProxy.trigger,
|
|
5897
|
+
sinon.match.instanceOf(Meeting),
|
|
5898
|
+
{
|
|
5899
|
+
file: 'meeting/index',
|
|
5900
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5901
|
+
},
|
|
5902
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5903
|
+
{srtpCipher: 'AEAD_AES_256_GCM'}
|
|
5904
|
+
);
|
|
5905
|
+
|
|
5906
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AEAD_AES_256_GCM');
|
|
5907
|
+
});
|
|
5908
|
+
|
|
5909
|
+
it('does not emit event when srtpCipher has not changed', async () => {
|
|
5910
|
+
const firstStats = new Map([
|
|
5911
|
+
[
|
|
5912
|
+
'transport-1',
|
|
5913
|
+
{
|
|
5914
|
+
type: 'transport',
|
|
5915
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5916
|
+
},
|
|
5917
|
+
],
|
|
5918
|
+
]);
|
|
5919
|
+
|
|
5920
|
+
statsAnalyzerStub.emit(
|
|
5921
|
+
{file: 'test', function: 'test'},
|
|
5922
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5923
|
+
{stats: firstStats}
|
|
5924
|
+
);
|
|
5925
|
+
|
|
5926
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5927
|
+
|
|
5928
|
+
TriggerProxy.trigger.resetHistory();
|
|
5929
|
+
|
|
5930
|
+
// Emit same cipher again
|
|
5931
|
+
statsAnalyzerStub.emit(
|
|
5932
|
+
{file: 'test', function: 'test'},
|
|
5933
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5934
|
+
{stats: firstStats}
|
|
5935
|
+
);
|
|
5936
|
+
|
|
5937
|
+
// Should not trigger event again
|
|
5938
|
+
assert.neverCalledWith(
|
|
5939
|
+
TriggerProxy.trigger,
|
|
5940
|
+
sinon.match.instanceOf(Meeting),
|
|
5941
|
+
sinon.match.any,
|
|
5942
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5943
|
+
sinon.match.any
|
|
5944
|
+
);
|
|
5945
|
+
|
|
5946
|
+
// Cipher should remain the same
|
|
5947
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5948
|
+
});
|
|
5949
|
+
|
|
5950
|
+
it('does not emit event when stats contain no transport with srtpCipher', async () => {
|
|
5951
|
+
const fakeStats = new Map([
|
|
5952
|
+
[
|
|
5953
|
+
'outbound-rtp-1',
|
|
5954
|
+
{
|
|
5955
|
+
type: 'outbound-rtp',
|
|
5956
|
+
ssrc: 12345,
|
|
5957
|
+
},
|
|
5958
|
+
],
|
|
5959
|
+
[
|
|
5960
|
+
'inbound-rtp-1',
|
|
5961
|
+
{
|
|
5962
|
+
type: 'inbound-rtp',
|
|
5963
|
+
ssrc: 67890,
|
|
5964
|
+
},
|
|
5965
|
+
],
|
|
5966
|
+
]);
|
|
5967
|
+
|
|
5968
|
+
statsAnalyzerStub.emit(
|
|
5969
|
+
{file: 'test', function: 'test'},
|
|
5970
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5971
|
+
{stats: fakeStats}
|
|
5972
|
+
);
|
|
5973
|
+
|
|
5974
|
+
assert.neverCalledWith(
|
|
5975
|
+
TriggerProxy.trigger,
|
|
5976
|
+
sinon.match.instanceOf(Meeting),
|
|
5977
|
+
sinon.match.any,
|
|
5978
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5979
|
+
sinon.match.any
|
|
5980
|
+
);
|
|
5981
|
+
|
|
5982
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5983
|
+
});
|
|
5984
|
+
|
|
5985
|
+
it('does not emit event when transport stat has no srtpCipher property', async () => {
|
|
5986
|
+
const fakeStats = new Map([
|
|
5987
|
+
[
|
|
5988
|
+
'transport-1',
|
|
5989
|
+
{
|
|
5990
|
+
type: 'transport',
|
|
5991
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5992
|
+
// no srtpCipher property
|
|
5993
|
+
},
|
|
5994
|
+
],
|
|
5995
|
+
]);
|
|
5996
|
+
|
|
5997
|
+
statsAnalyzerStub.emit(
|
|
5998
|
+
{file: 'test', function: 'test'},
|
|
5999
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6000
|
+
{stats: fakeStats}
|
|
6001
|
+
);
|
|
6002
|
+
|
|
6003
|
+
assert.neverCalledWith(
|
|
6004
|
+
TriggerProxy.trigger,
|
|
6005
|
+
sinon.match.instanceOf(Meeting),
|
|
6006
|
+
sinon.match.any,
|
|
6007
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6008
|
+
sinon.match.any
|
|
6009
|
+
);
|
|
6010
|
+
|
|
6011
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
6012
|
+
});
|
|
6013
|
+
|
|
6014
|
+
it('uses first transport with srtpCipher when multiple transports exist', async () => {
|
|
6015
|
+
const fakeStats = new Map([
|
|
6016
|
+
[
|
|
6017
|
+
'transport-1',
|
|
6018
|
+
{
|
|
6019
|
+
type: 'transport',
|
|
6020
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
6021
|
+
},
|
|
6022
|
+
],
|
|
6023
|
+
[
|
|
6024
|
+
'transport-2',
|
|
6025
|
+
{
|
|
6026
|
+
type: 'transport',
|
|
6027
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
6028
|
+
},
|
|
6029
|
+
],
|
|
6030
|
+
[
|
|
6031
|
+
'outbound-rtp-1',
|
|
6032
|
+
{
|
|
6033
|
+
type: 'outbound-rtp',
|
|
6034
|
+
ssrc: 12345,
|
|
6035
|
+
},
|
|
6036
|
+
],
|
|
6037
|
+
]);
|
|
6038
|
+
|
|
6039
|
+
statsAnalyzerStub.emit(
|
|
6040
|
+
{file: 'test', function: 'test'},
|
|
6041
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6042
|
+
{stats: fakeStats}
|
|
6043
|
+
);
|
|
6044
|
+
|
|
6045
|
+
assert.calledWith(
|
|
6046
|
+
TriggerProxy.trigger,
|
|
6047
|
+
sinon.match.instanceOf(Meeting),
|
|
6048
|
+
{
|
|
6049
|
+
file: 'meeting/index',
|
|
6050
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
6051
|
+
},
|
|
6052
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6053
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
6054
|
+
);
|
|
6055
|
+
|
|
6056
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
6057
|
+
});
|
|
6058
|
+
|
|
6059
|
+
it('handles empty stats map without errors', async () => {
|
|
6060
|
+
const emptyStats = new Map();
|
|
6061
|
+
|
|
6062
|
+
statsAnalyzerStub.emit(
|
|
6063
|
+
{file: 'test', function: 'test'},
|
|
6064
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6065
|
+
{stats: emptyStats}
|
|
6066
|
+
);
|
|
6067
|
+
|
|
6068
|
+
assert.neverCalledWith(
|
|
6069
|
+
TriggerProxy.trigger,
|
|
6070
|
+
sinon.match.instanceOf(Meeting),
|
|
6071
|
+
sinon.match.any,
|
|
6072
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
6073
|
+
sinon.match.any
|
|
6074
|
+
);
|
|
6075
|
+
|
|
6076
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
6077
|
+
});
|
|
6078
|
+
|
|
6079
|
+
it('logs cipher change when cipher is updated', async () => {
|
|
6080
|
+
const loggerSpy = sinon.spy(LoggerProxy.logger, 'info');
|
|
6081
|
+
|
|
6082
|
+
meeting.mediaProperties.srtpCipher = 'AES_CM_128_HMAC_SHA1_80';
|
|
6083
|
+
|
|
6084
|
+
const newStats = new Map([
|
|
6085
|
+
[
|
|
6086
|
+
'transport-1',
|
|
6087
|
+
{
|
|
6088
|
+
type: 'transport',
|
|
6089
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
6090
|
+
},
|
|
6091
|
+
],
|
|
6092
|
+
]);
|
|
6093
|
+
|
|
6094
|
+
statsAnalyzerStub.emit(
|
|
6095
|
+
{file: 'test', function: 'test'},
|
|
6096
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
6097
|
+
{stats: newStats}
|
|
6098
|
+
);
|
|
6099
|
+
|
|
6100
|
+
assert.calledWithMatch(
|
|
6101
|
+
loggerSpy,
|
|
6102
|
+
sinon.match(/SRTP cipher changed from AES_CM_128_HMAC_SHA1_80 to AEAD_AES_256_GCM/)
|
|
6103
|
+
);
|
|
6104
|
+
|
|
6105
|
+
loggerSpy.restore();
|
|
6106
|
+
});
|
|
6107
|
+
});
|
|
4336
6108
|
});
|
|
4337
6109
|
|
|
4338
6110
|
describe('handles StatsMonitor events', () => {
|
|
@@ -4436,6 +6208,7 @@ describe('plugin-meetings', () => {
|
|
|
4436
6208
|
member2: unmutedMember,
|
|
4437
6209
|
member3: selfMember,
|
|
4438
6210
|
});
|
|
6211
|
+
meeting.isUserUnadmitted = false;
|
|
4439
6212
|
|
|
4440
6213
|
// Reset the stub to clear any previous calls
|
|
4441
6214
|
TriggerProxy.trigger.resetHistory();
|
|
@@ -4455,20 +6228,58 @@ describe('plugin-meetings', () => {
|
|
|
4455
6228
|
meeting.mediaProperties.sendMediaIssueMetric,
|
|
4456
6229
|
'inbound_audio',
|
|
4457
6230
|
fakeEventData.issueSubType,
|
|
4458
|
-
|
|
6231
|
+
{
|
|
6232
|
+
correlationId: meeting.correlationId,
|
|
6233
|
+
isMultistream: meeting.isMultistream,
|
|
6234
|
+
}
|
|
4459
6235
|
);
|
|
4460
6236
|
});
|
|
4461
|
-
});
|
|
4462
|
-
});
|
|
4463
6237
|
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
const FAKE_TURN_USER = 'some-turn-username';
|
|
4467
|
-
const FAKE_TURN_PASSWORD = 'some-password';
|
|
6238
|
+
it('should not trigger event or metric when the user is in the lobby', () => {
|
|
6239
|
+
const fakeEventData = {issueSubType: 'DECODE_RESULTS_IN_ZERO_AUDIO_LEVEL'};
|
|
4468
6240
|
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
6241
|
+
const unmutedMember = {
|
|
6242
|
+
isSelf: false,
|
|
6243
|
+
isPairedWithSelf: false,
|
|
6244
|
+
isAudioMuted: false,
|
|
6245
|
+
};
|
|
6246
|
+
const selfMember = {
|
|
6247
|
+
isSelf: true,
|
|
6248
|
+
isPairedWithSelf: false,
|
|
6249
|
+
isAudioMuted: false,
|
|
6250
|
+
};
|
|
6251
|
+
meeting.members.membersCollection.getAll = sinon.stub().returns({
|
|
6252
|
+
member1: unmutedMember,
|
|
6253
|
+
member2: selfMember,
|
|
6254
|
+
});
|
|
6255
|
+
meeting.isUserUnadmitted = true;
|
|
6256
|
+
|
|
6257
|
+
// Reset the stub to clear any previous calls
|
|
6258
|
+
TriggerProxy.trigger.resetHistory();
|
|
6259
|
+
|
|
6260
|
+
// Emit the event from statsMonitor
|
|
6261
|
+
listeners[StatsMonitorEventNames.INBOUND_AUDIO_ISSUE](fakeEventData);
|
|
6262
|
+
|
|
6263
|
+
assert.neverCalledWith(
|
|
6264
|
+
TriggerProxy.trigger,
|
|
6265
|
+
meeting,
|
|
6266
|
+
sinon.match.object,
|
|
6267
|
+
EVENT_TRIGGERS.MEDIA_INBOUND_AUDIO_ISSUE_DETECTED,
|
|
6268
|
+
fakeEventData
|
|
6269
|
+
);
|
|
6270
|
+
assert.notCalled(meeting.mediaProperties.sendMediaIssueMetric);
|
|
6271
|
+
});
|
|
6272
|
+
});
|
|
6273
|
+
});
|
|
6274
|
+
|
|
6275
|
+
describe('bundlePolicy', () => {
|
|
6276
|
+
const FAKE_TURN_URL = 'turns:webex.com:3478';
|
|
6277
|
+
const FAKE_TURN_USER = 'some-turn-username';
|
|
6278
|
+
const FAKE_TURN_PASSWORD = 'some-password';
|
|
6279
|
+
|
|
6280
|
+
beforeEach(() => {
|
|
6281
|
+
meeting.meetingState = 'ACTIVE';
|
|
6282
|
+
Media.createMediaConnection.resetHistory();
|
|
4472
6283
|
|
|
4473
6284
|
meeting.roap.doTurnDiscovery = sinon.stub().resolves({
|
|
4474
6285
|
turnServerInfo: {
|
|
@@ -5991,13 +7802,14 @@ describe('plugin-meetings', () => {
|
|
|
5991
7802
|
sinon.stub(meeting.locusMediaRequest, 'downgradeFromMultistreamToTranscoded');
|
|
5992
7803
|
});
|
|
5993
7804
|
|
|
5994
|
-
const runCheck = async (turnServerInfo, forceTurnDiscovery) => {
|
|
7805
|
+
const runCheck = async (turnServerInfo, forceTurnDiscovery, iceTransportPolicy) => {
|
|
5995
7806
|
// we're calling addMediaInternal() with mic stream,
|
|
5996
7807
|
// so that we also verify that audioMute, videoMute info is correctly sent to backend
|
|
5997
7808
|
const addMediaPromise = meeting.addMediaInternal(
|
|
5998
7809
|
() => '',
|
|
5999
|
-
turnServerInfo,
|
|
6000
7810
|
forceTurnDiscovery,
|
|
7811
|
+
turnServerInfo,
|
|
7812
|
+
iceTransportPolicy,
|
|
6001
7813
|
{
|
|
6002
7814
|
localStreams: {microphone: fakeMicrophoneStream},
|
|
6003
7815
|
}
|
|
@@ -6051,6 +7863,10 @@ describe('plugin-meetings', () => {
|
|
|
6051
7863
|
// at this point the meeting should have been downgraded to transcoded
|
|
6052
7864
|
assert.equal(meeting.isMultistream, false);
|
|
6053
7865
|
|
|
7866
|
+
// iceTransportPolicy must be reset to undefined on downgrade to transcoded,
|
|
7867
|
+
// otherwise the transcoded retry could gather direct candidates while metrics report relay
|
|
7868
|
+
assert.isUndefined(meeting.addMediaData.iceTransportPolicy);
|
|
7869
|
+
|
|
6054
7870
|
// old stats analyzer stopped and new one created
|
|
6055
7871
|
assert.calledOnce(initialStatsAnalyzer.stopAnalyzer);
|
|
6056
7872
|
assert.calledOnceWithExactly(
|
|
@@ -6141,6 +7957,11 @@ describe('plugin-meetings', () => {
|
|
|
6141
7957
|
true
|
|
6142
7958
|
);
|
|
6143
7959
|
});
|
|
7960
|
+
|
|
7961
|
+
it('resets iceTransportPolicy to undefined when falling back from multistream (relay) to transcoded', async () => {
|
|
7962
|
+
// simulate a relay-only retry falling back to transcoded and verify iceTransportPolicy is reset
|
|
7963
|
+
await runCheck(undefined, false, 'relay');
|
|
7964
|
+
});
|
|
6144
7965
|
});
|
|
6145
7966
|
}
|
|
6146
7967
|
})
|
|
@@ -6218,13 +8039,19 @@ describe('plugin-meetings', () => {
|
|
|
6218
8039
|
meeting.statsAnalyzer = {stopAnalyzer: sinon.stub().resolves()};
|
|
6219
8040
|
meeting.unsetPeerConnections = sinon.stub().returns(true);
|
|
6220
8041
|
meeting.logger.error = sinon.stub().returns(true);
|
|
6221
|
-
meeting.
|
|
8042
|
+
meeting.clearMeetingData = sinon.stub().callsFake(async () => {
|
|
8043
|
+
meeting.audio = null;
|
|
8044
|
+
meeting.video = null;
|
|
8045
|
+
});
|
|
6222
8046
|
webex.internal.voicea.off = sinon.stub().returns(true);
|
|
6223
8047
|
meeting.stopTranscription = sinon.stub();
|
|
6224
8048
|
meeting.transcription = {};
|
|
6225
8049
|
|
|
6226
8050
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
6227
8051
|
webex.internal.llm.off = sinon.stub();
|
|
8052
|
+
webex.internal.mercury.off = sinon.stub();
|
|
8053
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
8054
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
6228
8055
|
|
|
6229
8056
|
// A meeting needs to be joined to leave
|
|
6230
8057
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -6245,9 +8072,68 @@ describe('plugin-meetings', () => {
|
|
|
6245
8072
|
assert.calledOnce(meeting.closePeerConnections);
|
|
6246
8073
|
assert.calledOnce(meeting.unsetRemoteStreams);
|
|
6247
8074
|
assert.calledOnce(meeting.unsetPeerConnections);
|
|
6248
|
-
assert.calledOnce(meeting.
|
|
6249
|
-
|
|
6250
|
-
|
|
8075
|
+
assert.calledOnce(meeting.clearMeetingData);
|
|
8076
|
+
});
|
|
8077
|
+
|
|
8078
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
8079
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8080
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8081
|
+
|
|
8082
|
+
await meeting.leave();
|
|
8083
|
+
|
|
8084
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
8085
|
+
// annotation) must be detached before the /leave request so that
|
|
8086
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
8087
|
+
// (per Locus team recommendation).
|
|
8088
|
+
assert.callOrder(
|
|
8089
|
+
webex.internal.llm.off,
|
|
8090
|
+
webex.internal.mercury.off,
|
|
8091
|
+
meeting.stopTranscription,
|
|
8092
|
+
meeting.annotation.deregisterEvents,
|
|
8093
|
+
meeting.meetingRequest.leaveMeeting
|
|
8094
|
+
);
|
|
8095
|
+
assert.calledWithExactly(
|
|
8096
|
+
webex.internal.llm.off,
|
|
8097
|
+
'event:relay.event',
|
|
8098
|
+
meeting.processRelayEvent
|
|
8099
|
+
);
|
|
8100
|
+
assert.calledWithExactly(
|
|
8101
|
+
webex.internal.llm.off,
|
|
8102
|
+
LOCUS_LLM_EVENT,
|
|
8103
|
+
meeting.processLocusLLMEvent
|
|
8104
|
+
);
|
|
8105
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
8106
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
8107
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
8108
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
8109
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8110
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8111
|
+
assert.isUndefined(meeting.transcription);
|
|
8112
|
+
});
|
|
8113
|
+
|
|
8114
|
+
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
8115
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8116
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8117
|
+
meeting.meetingRequest.leaveMeeting = sinon
|
|
8118
|
+
.stub()
|
|
8119
|
+
.returns(Promise.reject(new Error('leave failed')));
|
|
8120
|
+
|
|
8121
|
+
await meeting.leave().catch(() => {});
|
|
8122
|
+
|
|
8123
|
+
assert.calledWithExactly(
|
|
8124
|
+
webex.internal.llm.off,
|
|
8125
|
+
'event:relay.event',
|
|
8126
|
+
meeting.processRelayEvent
|
|
8127
|
+
);
|
|
8128
|
+
assert.calledWithExactly(
|
|
8129
|
+
webex.internal.llm.off,
|
|
8130
|
+
LOCUS_LLM_EVENT,
|
|
8131
|
+
meeting.processLocusLLMEvent
|
|
8132
|
+
);
|
|
8133
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
8134
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
8135
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8136
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
6251
8137
|
});
|
|
6252
8138
|
|
|
6253
8139
|
it('should reset call diagnostic latencies correctly', async () => {
|
|
@@ -8248,12 +10134,18 @@ describe('plugin-meetings', () => {
|
|
|
8248
10134
|
meeting.statsAnalyzer = {stopAnalyzer: sinon.stub().resolves()};
|
|
8249
10135
|
meeting.unsetPeerConnections = sinon.stub().returns(true);
|
|
8250
10136
|
meeting.logger.error = sinon.stub().returns(true);
|
|
8251
|
-
meeting.
|
|
10137
|
+
meeting.clearMeetingData = sinon.stub().callsFake(async () => {
|
|
10138
|
+
meeting.audio = null;
|
|
10139
|
+
meeting.video = null;
|
|
10140
|
+
});
|
|
8252
10141
|
meeting.transcription = {};
|
|
8253
10142
|
meeting.stopTranscription = sinon.stub();
|
|
8254
10143
|
|
|
8255
10144
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
8256
10145
|
webex.internal.llm.off = sinon.stub();
|
|
10146
|
+
webex.internal.mercury.off = sinon.stub();
|
|
10147
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
10148
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
8257
10149
|
|
|
8258
10150
|
// A meeting needs to be joined to end
|
|
8259
10151
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -8274,10 +10166,67 @@ describe('plugin-meetings', () => {
|
|
|
8274
10166
|
assert.calledOnce(meeting?.closePeerConnections);
|
|
8275
10167
|
assert.calledOnce(meeting?.unsetRemoteStreams);
|
|
8276
10168
|
assert.calledOnce(meeting?.unsetPeerConnections);
|
|
8277
|
-
assert.calledOnce(meeting?.
|
|
10169
|
+
assert.calledOnce(meeting?.clearMeetingData);
|
|
10170
|
+
});
|
|
10171
|
+
|
|
10172
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
10173
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10174
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10175
|
+
|
|
10176
|
+
await meeting.endMeetingForAll();
|
|
10177
|
+
|
|
10178
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
10179
|
+
// annotation) must be detached before the /end request so that
|
|
10180
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
10181
|
+
// (per Locus team recommendation).
|
|
10182
|
+
assert.callOrder(
|
|
10183
|
+
webex.internal.llm.off,
|
|
10184
|
+
webex.internal.mercury.off,
|
|
10185
|
+
meeting.stopTranscription,
|
|
10186
|
+
meeting.annotation.deregisterEvents,
|
|
10187
|
+
meeting.meetingRequest.endMeetingForAll
|
|
10188
|
+
);
|
|
10189
|
+
assert.calledWithExactly(
|
|
10190
|
+
webex.internal.llm.off,
|
|
10191
|
+
'event:relay.event',
|
|
10192
|
+
meeting.processRelayEvent
|
|
10193
|
+
);
|
|
10194
|
+
assert.calledWithExactly(
|
|
10195
|
+
webex.internal.llm.off,
|
|
10196
|
+
LOCUS_LLM_EVENT,
|
|
10197
|
+
meeting.processLocusLLMEvent
|
|
10198
|
+
);
|
|
10199
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
10200
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
10201
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
10202
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
10203
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
10204
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
10205
|
+
});
|
|
10206
|
+
|
|
10207
|
+
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
10208
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10209
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10210
|
+
meeting.meetingRequest.endMeetingForAll = sinon
|
|
10211
|
+
.stub()
|
|
10212
|
+
.returns(Promise.reject(new Error('end failed')));
|
|
8278
10213
|
|
|
8279
|
-
|
|
8280
|
-
|
|
10214
|
+
await meeting.endMeetingForAll().catch(() => {});
|
|
10215
|
+
|
|
10216
|
+
assert.calledWithExactly(
|
|
10217
|
+
webex.internal.llm.off,
|
|
10218
|
+
'event:relay.event',
|
|
10219
|
+
meeting.processRelayEvent
|
|
10220
|
+
);
|
|
10221
|
+
assert.calledWithExactly(
|
|
10222
|
+
webex.internal.llm.off,
|
|
10223
|
+
LOCUS_LLM_EVENT,
|
|
10224
|
+
meeting.processLocusLLMEvent
|
|
10225
|
+
);
|
|
10226
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
10227
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
10228
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
10229
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8281
10230
|
});
|
|
8282
10231
|
});
|
|
8283
10232
|
|
|
@@ -9014,8 +10963,8 @@ describe('plugin-meetings', () => {
|
|
|
9014
10963
|
const fakeMultistreamRoapMediaConnection = {
|
|
9015
10964
|
createSendSlot: () => {
|
|
9016
10965
|
return {
|
|
9017
|
-
|
|
9018
|
-
|
|
10966
|
+
setCustomCodecParameters: sinon.stub().resolves(),
|
|
10967
|
+
markCustomCodecParametersForDeletion: sinon.stub().resolves(),
|
|
9019
10968
|
};
|
|
9020
10969
|
},
|
|
9021
10970
|
};
|
|
@@ -9038,27 +10987,31 @@ describe('plugin-meetings', () => {
|
|
|
9038
10987
|
}
|
|
9039
10988
|
);
|
|
9040
10989
|
|
|
9041
|
-
it('should set
|
|
10990
|
+
it('should set custom codec parameters when shouldEnableMusicMode is true', async () => {
|
|
9042
10991
|
await meeting.enableMusicMode(true);
|
|
9043
10992
|
assert.calledOnceWithExactly(
|
|
9044
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10993
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters,
|
|
10994
|
+
MediaCodecMimeType.OPUS,
|
|
9045
10995
|
{
|
|
9046
10996
|
maxaveragebitrate: '64000',
|
|
9047
10997
|
maxplaybackrate: '48000',
|
|
9048
10998
|
}
|
|
9049
10999
|
);
|
|
9050
11000
|
assert.notCalled(
|
|
9051
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
11001
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion
|
|
9052
11002
|
);
|
|
9053
11003
|
});
|
|
9054
11004
|
|
|
9055
|
-
it('should
|
|
11005
|
+
it('should mark custom codec parameters for deletion when shouldEnableMusicMode is false', async () => {
|
|
9056
11006
|
await meeting.enableMusicMode(false);
|
|
9057
11007
|
assert.calledOnceWithExactly(
|
|
9058
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
11008
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion,
|
|
11009
|
+
MediaCodecMimeType.OPUS,
|
|
9059
11010
|
['maxaveragebitrate', 'maxplaybackrate']
|
|
9060
11011
|
);
|
|
9061
|
-
assert.notCalled(
|
|
11012
|
+
assert.notCalled(
|
|
11013
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters
|
|
11014
|
+
);
|
|
9062
11015
|
});
|
|
9063
11016
|
});
|
|
9064
11017
|
|
|
@@ -9149,7 +11102,10 @@ describe('plugin-meetings', () => {
|
|
|
9149
11102
|
|
|
9150
11103
|
// check that the right things were called by the callback
|
|
9151
11104
|
assert.calledOnceWithExactly(meeting.waitForRemoteSDPAnswer);
|
|
9152
|
-
assert.calledOnceWithExactly(
|
|
11105
|
+
assert.calledOnceWithExactly(
|
|
11106
|
+
meeting.mediaProperties.waitForMediaConnectionConnected,
|
|
11107
|
+
meeting.correlationId
|
|
11108
|
+
);
|
|
9153
11109
|
});
|
|
9154
11110
|
});
|
|
9155
11111
|
|
|
@@ -9783,6 +11739,8 @@ describe('plugin-meetings', () => {
|
|
|
9783
11739
|
});
|
|
9784
11740
|
|
|
9785
11741
|
it('handles REMOTE_SDP_ANSWER_PROCESSED correctly', () => {
|
|
11742
|
+
// capture the start timestamp before any fake timers are installed
|
|
11743
|
+
const localSdpGeneratedTimestamp = Date.now() - 100;
|
|
9786
11744
|
const clock = sinon.useFakeTimers();
|
|
9787
11745
|
sinon.spy(clock, 'clearTimeout');
|
|
9788
11746
|
meeting.deferSDPAnswer = {
|
|
@@ -9790,24 +11748,29 @@ describe('plugin-meetings', () => {
|
|
|
9790
11748
|
};
|
|
9791
11749
|
meeting.sdpResponseTimer = '1234';
|
|
9792
11750
|
|
|
11751
|
+
// latency is computed as Date.now() - the stored local-sdp-generated timestamp,
|
|
11752
|
+
// so it is unaffected by any earlier remote-sdp-received timestamp saved on timeout
|
|
11753
|
+
webex.internal.newMetrics.callDiagnosticLatencies.latencyTimestamps = new Map([
|
|
11754
|
+
['client.media-engine.local-sdp-generated', localSdpGeneratedTimestamp],
|
|
11755
|
+
]);
|
|
11756
|
+
|
|
9793
11757
|
eventListeners[MediaConnectionEventNames.REMOTE_SDP_ANSWER_PROCESSED]();
|
|
9794
11758
|
|
|
9795
11759
|
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
9796
11760
|
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
9797
11761
|
name: 'client.media-engine.remote-sdp-received',
|
|
11762
|
+
payload: {
|
|
11763
|
+
eventData: {
|
|
11764
|
+
localSDPGenRemoteSDPRecv: sinon.match(
|
|
11765
|
+
(value) => typeof value === 'number' && value >= 100 && value < 5000
|
|
11766
|
+
),
|
|
11767
|
+
},
|
|
11768
|
+
},
|
|
9798
11769
|
options: {meetingId: meeting.id},
|
|
9799
11770
|
});
|
|
9800
11771
|
|
|
9801
|
-
|
|
9802
|
-
assert.
|
|
9803
|
-
Metrics.sendBehavioralMetric,
|
|
9804
|
-
BEHAVIORAL_METRICS.ROAP_OFFER_TO_ANSWER_LATENCY,
|
|
9805
|
-
{
|
|
9806
|
-
correlation_id: meeting.correlationId,
|
|
9807
|
-
meetingId: meeting.id,
|
|
9808
|
-
latency: undefined,
|
|
9809
|
-
}
|
|
9810
|
-
);
|
|
11772
|
+
// the high-volume ROAP_OFFER_TO_ANSWER_LATENCY behavioral metric is no longer sent
|
|
11773
|
+
assert.notCalled(Metrics.sendBehavioralMetric);
|
|
9811
11774
|
|
|
9812
11775
|
assert.calledOnce(meeting.deferSDPAnswer.resolve);
|
|
9813
11776
|
assert.calledOnce(clock.clearTimeout);
|
|
@@ -9815,6 +11778,28 @@ describe('plugin-meetings', () => {
|
|
|
9815
11778
|
assert.equal(meeting.sdpResponseTimer, undefined);
|
|
9816
11779
|
});
|
|
9817
11780
|
|
|
11781
|
+
it('sends undefined localSDPGenRemoteSDPRecv when the local-sdp-generated timestamp is missing', () => {
|
|
11782
|
+
meeting.deferSDPAnswer = {
|
|
11783
|
+
resolve: sinon.stub(),
|
|
11784
|
+
};
|
|
11785
|
+
|
|
11786
|
+
// no local-sdp-generated timestamp stored -> latency cannot be computed
|
|
11787
|
+
webex.internal.newMetrics.callDiagnosticLatencies.latencyTimestamps = new Map();
|
|
11788
|
+
|
|
11789
|
+
eventListeners[MediaConnectionEventNames.REMOTE_SDP_ANSWER_PROCESSED]();
|
|
11790
|
+
|
|
11791
|
+
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
11792
|
+
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
11793
|
+
name: 'client.media-engine.remote-sdp-received',
|
|
11794
|
+
payload: {
|
|
11795
|
+
eventData: {
|
|
11796
|
+
localSDPGenRemoteSDPRecv: undefined,
|
|
11797
|
+
},
|
|
11798
|
+
},
|
|
11799
|
+
options: {meetingId: meeting.id},
|
|
11800
|
+
});
|
|
11801
|
+
});
|
|
11802
|
+
|
|
9818
11803
|
it('handles LOCAL_SDP_OFFER_GENERATED correctly', () => {
|
|
9819
11804
|
assert.equal(meeting.deferSDPAnswer, undefined);
|
|
9820
11805
|
|
|
@@ -10210,14 +12195,24 @@ describe('plugin-meetings', () => {
|
|
|
10210
12195
|
);
|
|
10211
12196
|
done();
|
|
10212
12197
|
});
|
|
10213
|
-
it('listens to the self admitted guest event', (
|
|
12198
|
+
it('listens to the self admitted guest event and waits for token prefetch before reconnecting LLM', async () => {
|
|
10214
12199
|
meeting.stopKeepAlive = sinon.stub();
|
|
10215
12200
|
meeting.updateLLMConnection = sinon.stub();
|
|
12201
|
+
let resolvePrefetch;
|
|
12202
|
+
|
|
12203
|
+
meeting.ensureDefaultDatachannelTokenAfterAdmit = sinon.stub().returns(
|
|
12204
|
+
new Promise((resolve) => {
|
|
12205
|
+
resolvePrefetch = resolve;
|
|
12206
|
+
})
|
|
12207
|
+
);
|
|
10216
12208
|
meeting.rtcMetrics = {
|
|
10217
12209
|
sendNextMetrics: sinon.stub(),
|
|
10218
12210
|
};
|
|
12211
|
+
|
|
10219
12212
|
meeting.locusInfo.emit({function: 'test', file: 'test'}, 'SELF_ADMITTED_GUEST', test1);
|
|
12213
|
+
|
|
10220
12214
|
assert.calledOnceWithExactly(meeting.stopKeepAlive);
|
|
12215
|
+
assert.calledOnceWithExactly(meeting.ensureDefaultDatachannelTokenAfterAdmit);
|
|
10221
12216
|
assert.calledThrice(TriggerProxy.trigger);
|
|
10222
12217
|
assert.calledWith(
|
|
10223
12218
|
TriggerProxy.trigger,
|
|
@@ -10226,7 +12221,7 @@ describe('plugin-meetings', () => {
|
|
|
10226
12221
|
'meeting:self:guestAdmitted',
|
|
10227
12222
|
{payload: test1}
|
|
10228
12223
|
);
|
|
10229
|
-
assert.
|
|
12224
|
+
assert.notCalled(meeting.updateLLMConnection);
|
|
10230
12225
|
assert.calledOnceWithExactly(meeting.rtcMetrics.sendNextMetrics);
|
|
10231
12226
|
|
|
10232
12227
|
assert.calledOnceWithExactly(
|
|
@@ -10236,7 +12231,12 @@ describe('plugin-meetings', () => {
|
|
|
10236
12231
|
correlation_id: meeting.correlationId,
|
|
10237
12232
|
}
|
|
10238
12233
|
);
|
|
10239
|
-
|
|
12234
|
+
|
|
12235
|
+
resolvePrefetch(false);
|
|
12236
|
+
await Promise.resolve();
|
|
12237
|
+
await Promise.resolve();
|
|
12238
|
+
|
|
12239
|
+
assert.calledOnce(meeting.updateLLMConnection);
|
|
10240
12240
|
});
|
|
10241
12241
|
|
|
10242
12242
|
it('listens to the breakouts changed event', () => {
|
|
@@ -10323,6 +12323,21 @@ describe('plugin-meetings', () => {
|
|
|
10323
12323
|
EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE
|
|
10324
12324
|
);
|
|
10325
12325
|
});
|
|
12326
|
+
|
|
12327
|
+
it('listens to the self id changed event and updates aiEnableRequest', () => {
|
|
12328
|
+
meeting.aiEnableRequest = {
|
|
12329
|
+
selfParticipantIdUpdate: sinon.stub(),
|
|
12330
|
+
};
|
|
12331
|
+
|
|
12332
|
+
const payload = {selfId: 'participant-test-123'};
|
|
12333
|
+
|
|
12334
|
+
meeting.locusInfo.emit({function: 'test', file: 'test'}, 'SELF_ID_CHANGED', payload);
|
|
12335
|
+
|
|
12336
|
+
assert.calledOnceWithExactly(
|
|
12337
|
+
meeting.aiEnableRequest.selfParticipantIdUpdate,
|
|
12338
|
+
payload.selfId
|
|
12339
|
+
);
|
|
12340
|
+
});
|
|
10326
12341
|
});
|
|
10327
12342
|
|
|
10328
12343
|
describe('#setUpBreakoutsListener', () => {
|
|
@@ -10570,6 +12585,24 @@ describe('plugin-meetings', () => {
|
|
|
10570
12585
|
);
|
|
10571
12586
|
});
|
|
10572
12587
|
|
|
12588
|
+
it('listens to MEETING_CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED', async () => {
|
|
12589
|
+
const aiSummaryNotification = {example: 'value'};
|
|
12590
|
+
|
|
12591
|
+
await meeting.locusInfo.emitScoped(
|
|
12592
|
+
{function: 'test', file: 'test'},
|
|
12593
|
+
LOCUSINFO.EVENTS.CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED,
|
|
12594
|
+
{aiSummaryNotification}
|
|
12595
|
+
);
|
|
12596
|
+
|
|
12597
|
+
assert.calledWith(
|
|
12598
|
+
TriggerProxy.trigger,
|
|
12599
|
+
meeting,
|
|
12600
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12601
|
+
EVENT_TRIGGERS.MEETING_CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED,
|
|
12602
|
+
{aiSummaryNotification}
|
|
12603
|
+
);
|
|
12604
|
+
});
|
|
12605
|
+
|
|
10573
12606
|
it('listens to MEETING_CONTROLS_MEETING_FULL_UPDATED', async () => {
|
|
10574
12607
|
const state = {example: 'value'};
|
|
10575
12608
|
|
|
@@ -10717,6 +12750,106 @@ describe('plugin-meetings', () => {
|
|
|
10717
12750
|
);
|
|
10718
12751
|
});
|
|
10719
12752
|
|
|
12753
|
+
const recordingTestCases = [
|
|
12754
|
+
{
|
|
12755
|
+
description: 'triggers MEETING_STARTED_RECORDING when state is RECORDING',
|
|
12756
|
+
state: RECORDING_STATE.RECORDING,
|
|
12757
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12758
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12759
|
+
},
|
|
12760
|
+
{
|
|
12761
|
+
description: 'triggers MEETING_STOPPED_RECORDING when state is IDLE',
|
|
12762
|
+
state: RECORDING_STATE.IDLE,
|
|
12763
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STOPPED_RECORDING,
|
|
12764
|
+
expectedRecordingState: RECORDING_STATE.IDLE,
|
|
12765
|
+
},
|
|
12766
|
+
{
|
|
12767
|
+
description: 'triggers MEETING_PAUSED_RECORDING when state is PAUSED',
|
|
12768
|
+
state: RECORDING_STATE.PAUSED,
|
|
12769
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_PAUSED_RECORDING,
|
|
12770
|
+
expectedRecordingState: RECORDING_STATE.PAUSED,
|
|
12771
|
+
},
|
|
12772
|
+
{
|
|
12773
|
+
description:
|
|
12774
|
+
'triggers MEETING_RESUMED_RECORDING and sets state to RECORDING when state is RESUMED',
|
|
12775
|
+
state: RECORDING_STATE.RESUMED,
|
|
12776
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_RESUMED_RECORDING,
|
|
12777
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12778
|
+
},
|
|
12779
|
+
];
|
|
12780
|
+
|
|
12781
|
+
recordingTestCases.forEach(
|
|
12782
|
+
({description, state, expectedEvent, expectedRecordingState}) => {
|
|
12783
|
+
it(`listens to CONTROLS_RECORDING_UPDATED - ${description}`, async () => {
|
|
12784
|
+
const modifiedBy = 'user-id-123';
|
|
12785
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12786
|
+
|
|
12787
|
+
await meeting.locusInfo.emitScoped(
|
|
12788
|
+
{function: 'test', file: 'test'},
|
|
12789
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12790
|
+
{
|
|
12791
|
+
state,
|
|
12792
|
+
modifiedBy,
|
|
12793
|
+
lastModified,
|
|
12794
|
+
modifiedByServiceAppName: undefined,
|
|
12795
|
+
modifiedByServiceAppId: undefined,
|
|
12796
|
+
}
|
|
12797
|
+
);
|
|
12798
|
+
|
|
12799
|
+
assert.deepEqual(meeting.recording, {
|
|
12800
|
+
state: expectedRecordingState,
|
|
12801
|
+
modifiedBy,
|
|
12802
|
+
lastModified,
|
|
12803
|
+
modifiedByServiceAppName: undefined,
|
|
12804
|
+
modifiedByServiceAppId: undefined,
|
|
12805
|
+
});
|
|
12806
|
+
|
|
12807
|
+
assert.calledWith(
|
|
12808
|
+
TriggerProxy.trigger,
|
|
12809
|
+
meeting,
|
|
12810
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12811
|
+
expectedEvent,
|
|
12812
|
+
meeting.recording
|
|
12813
|
+
);
|
|
12814
|
+
});
|
|
12815
|
+
}
|
|
12816
|
+
);
|
|
12817
|
+
|
|
12818
|
+
it('listens to CONTROLS_RECORDING_UPDATED and includes modifiedByServiceAppName and modifiedByServiceAppId when present', async () => {
|
|
12819
|
+
const modifiedBy = 'user-id-123';
|
|
12820
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12821
|
+
const modifiedByServiceAppName = 'My Bot';
|
|
12822
|
+
const modifiedByServiceAppId = 'app-id-123';
|
|
12823
|
+
|
|
12824
|
+
await meeting.locusInfo.emitScoped(
|
|
12825
|
+
{function: 'test', file: 'test'},
|
|
12826
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12827
|
+
{
|
|
12828
|
+
state: RECORDING_STATE.RECORDING,
|
|
12829
|
+
modifiedBy,
|
|
12830
|
+
lastModified,
|
|
12831
|
+
modifiedByServiceAppName,
|
|
12832
|
+
modifiedByServiceAppId,
|
|
12833
|
+
}
|
|
12834
|
+
);
|
|
12835
|
+
|
|
12836
|
+
assert.deepEqual(meeting.recording, {
|
|
12837
|
+
state: RECORDING_STATE.RECORDING,
|
|
12838
|
+
modifiedBy,
|
|
12839
|
+
lastModified,
|
|
12840
|
+
modifiedByServiceAppName,
|
|
12841
|
+
modifiedByServiceAppId,
|
|
12842
|
+
});
|
|
12843
|
+
|
|
12844
|
+
assert.calledWith(
|
|
12845
|
+
TriggerProxy.trigger,
|
|
12846
|
+
meeting,
|
|
12847
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12848
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12849
|
+
meeting.recording
|
|
12850
|
+
);
|
|
12851
|
+
});
|
|
12852
|
+
|
|
10720
12853
|
it('listens to the locus interpretation update event', () => {
|
|
10721
12854
|
const interpretation = {
|
|
10722
12855
|
siLanguages: [{languageCode: 20, languageName: 'en'}],
|
|
@@ -10770,6 +12903,7 @@ describe('plugin-meetings', () => {
|
|
|
10770
12903
|
meeting.annotation.locusUrlUpdate = sinon.stub();
|
|
10771
12904
|
meeting.simultaneousInterpretation.locusUrlUpdate = sinon.stub();
|
|
10772
12905
|
meeting.webinar.locusUrlUpdate = sinon.stub();
|
|
12906
|
+
meeting.aiEnableRequest.locusUrlUpdate = sinon.stub();
|
|
10773
12907
|
|
|
10774
12908
|
meeting.locusInfo.emit(
|
|
10775
12909
|
{function: 'test', file: 'test'},
|
|
@@ -10784,6 +12918,7 @@ describe('plugin-meetings', () => {
|
|
|
10784
12918
|
assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
|
|
10785
12919
|
assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
|
|
10786
12920
|
assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
|
|
12921
|
+
assert.calledWith(meeting.aiEnableRequest.locusUrlUpdate, newLocusUrl);
|
|
10787
12922
|
assert.equal(meeting.locusUrl, newLocusUrl);
|
|
10788
12923
|
assert(meeting.locusId, '12345');
|
|
10789
12924
|
|
|
@@ -10842,6 +12977,9 @@ describe('plugin-meetings', () => {
|
|
|
10842
12977
|
meeting.simultaneousInterpretation = {
|
|
10843
12978
|
approvalUrlUpdate: sinon.stub().returns(undefined),
|
|
10844
12979
|
};
|
|
12980
|
+
meeting.aiEnableRequest = {
|
|
12981
|
+
approvalUrlUpdate: sinon.stub().returns(undefined),
|
|
12982
|
+
};
|
|
10845
12983
|
|
|
10846
12984
|
meeting.locusInfo.emit(
|
|
10847
12985
|
{function: 'test', file: 'test'},
|
|
@@ -10861,6 +12999,10 @@ describe('plugin-meetings', () => {
|
|
|
10861
12999
|
meeting.simultaneousInterpretation.approvalUrlUpdate,
|
|
10862
13000
|
newLocusServices.services.approval.url
|
|
10863
13001
|
);
|
|
13002
|
+
assert.calledWith(
|
|
13003
|
+
meeting.aiEnableRequest.approvalUrlUpdate,
|
|
13004
|
+
newLocusServices.services.approval.url
|
|
13005
|
+
);
|
|
10864
13006
|
assert.calledOnce(meeting.recordingController.setSessionId);
|
|
10865
13007
|
done();
|
|
10866
13008
|
});
|
|
@@ -11092,6 +13234,109 @@ describe('plugin-meetings', () => {
|
|
|
11092
13234
|
});
|
|
11093
13235
|
});
|
|
11094
13236
|
|
|
13237
|
+
describe('#finalizeMeetingAfterInitialLocusSetup', () => {
|
|
13238
|
+
it('refreshes destination from synced locus when destination type is LOCUS_ID', () => {
|
|
13239
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13240
|
+
|
|
13241
|
+
meeting.destinationType = DESTINATION_TYPE.LOCUS_ID;
|
|
13242
|
+
meeting.destination = {info: {topic: 'old'}};
|
|
13243
|
+
|
|
13244
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
13245
|
+
|
|
13246
|
+
assert.equal(meeting.destination, syncedLocus);
|
|
13247
|
+
});
|
|
13248
|
+
|
|
13249
|
+
it('does not refresh destination when destination type is not LOCUS_ID', () => {
|
|
13250
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13251
|
+
const originalDestination = {destination: 'original-destination'};
|
|
13252
|
+
|
|
13253
|
+
meeting.destinationType = DESTINATION_TYPE.CONVERSATION_URL;
|
|
13254
|
+
meeting.destination = originalDestination;
|
|
13255
|
+
|
|
13256
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
13257
|
+
|
|
13258
|
+
assert.equal(meeting.destination, originalDestination);
|
|
13259
|
+
});
|
|
13260
|
+
|
|
13261
|
+
it('fetches meeting info when meetingInfo is empty and destination has info', () => {
|
|
13262
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13263
|
+
|
|
13264
|
+
meeting.meetingInfo = {};
|
|
13265
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13266
|
+
|
|
13267
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13268
|
+
|
|
13269
|
+
assert.calledOnceWithExactly(fetchMeetingInfoStub, {});
|
|
13270
|
+
});
|
|
13271
|
+
|
|
13272
|
+
it('does not fetch meeting info when destination has no info', () => {
|
|
13273
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13274
|
+
|
|
13275
|
+
meeting.meetingInfo = {};
|
|
13276
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123'};
|
|
13277
|
+
|
|
13278
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13279
|
+
|
|
13280
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13281
|
+
});
|
|
13282
|
+
|
|
13283
|
+
it('does not fetch meeting info when meetingInfo is already populated', () => {
|
|
13284
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13285
|
+
|
|
13286
|
+
meeting.meetingInfo = {meetingJoinUrl: 'https://example.com/join/abc'};
|
|
13287
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13288
|
+
|
|
13289
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13290
|
+
|
|
13291
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13292
|
+
});
|
|
13293
|
+
|
|
13294
|
+
it('does not fetch meeting info when delayed fetch timer is already scheduled', () => {
|
|
13295
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13296
|
+
|
|
13297
|
+
meeting.meetingInfo = {};
|
|
13298
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13299
|
+
meeting.fetchMeetingInfoTimeoutId = 42;
|
|
13300
|
+
|
|
13301
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13302
|
+
|
|
13303
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13304
|
+
});
|
|
13305
|
+
|
|
13306
|
+
['CALL', 'SIP_BRIDGE', 'SPACE_SHARE'].forEach((fullStateType) => {
|
|
13307
|
+
it(`does not fetch meeting info when destination is a 1:1 call (fullState.type ${fullStateType})`, () => {
|
|
13308
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
13309
|
+
|
|
13310
|
+
meeting.meetingInfo = {};
|
|
13311
|
+
meeting.destination = {
|
|
13312
|
+
url: 'https://locus.example.com/locus/123',
|
|
13313
|
+
info: {topic: 'x'},
|
|
13314
|
+
};
|
|
13315
|
+
|
|
13316
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({fullState: {type: fullStateType}});
|
|
13317
|
+
|
|
13318
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
13319
|
+
});
|
|
13320
|
+
});
|
|
13321
|
+
|
|
13322
|
+
it('swallows async fetchMeetingInfo errors and logs info', async () => {
|
|
13323
|
+
const error = new Error('fetch failed');
|
|
13324
|
+
|
|
13325
|
+
meeting.meetingInfo = {};
|
|
13326
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
13327
|
+
sinon.stub(meeting, 'fetchMeetingInfo').returns(Promise.reject(error));
|
|
13328
|
+
const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
|
|
13329
|
+
|
|
13330
|
+
await meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
13331
|
+
|
|
13332
|
+
assert.calledOnce(loggerInfoStub);
|
|
13333
|
+
assert.match(
|
|
13334
|
+
loggerInfoStub.firstCall.args[0],
|
|
13335
|
+
/Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: fetch failed/
|
|
13336
|
+
);
|
|
13337
|
+
});
|
|
13338
|
+
});
|
|
13339
|
+
|
|
11095
13340
|
describe('#emailInput', () => {
|
|
11096
13341
|
it('should set the email input', () => {
|
|
11097
13342
|
assert.notOk(meeting.emailInput);
|
|
@@ -11266,13 +13511,48 @@ describe('plugin-meetings', () => {
|
|
|
11266
13511
|
});
|
|
11267
13512
|
});
|
|
11268
13513
|
|
|
11269
|
-
describe('
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
13514
|
+
describe('localConstraintsChangeHandler', () => {
|
|
13515
|
+
it('calls updatePreferredBitrateKbps when not multistream', () => {
|
|
13516
|
+
meeting.isMultistream = false;
|
|
13517
|
+
meeting.mediaProperties.webrtcMediaConnection = {
|
|
13518
|
+
updatePreferredBitrateKbps: sinon.stub(),
|
|
13519
|
+
};
|
|
13520
|
+
|
|
13521
|
+
meeting.localConstraintsChangeHandler();
|
|
13522
|
+
|
|
13523
|
+
assert.calledOnce(
|
|
13524
|
+
meeting.mediaProperties.webrtcMediaConnection.updatePreferredBitrateKbps
|
|
13525
|
+
);
|
|
13526
|
+
});
|
|
13527
|
+
|
|
13528
|
+
it('does not call updatePreferredBitrateKbps when multistream', () => {
|
|
13529
|
+
meeting.isMultistream = true;
|
|
13530
|
+
meeting.mediaProperties.webrtcMediaConnection = {
|
|
13531
|
+
updatePreferredBitrateKbps: sinon.stub(),
|
|
13532
|
+
};
|
|
13533
|
+
|
|
13534
|
+
meeting.localConstraintsChangeHandler();
|
|
13535
|
+
|
|
13536
|
+
assert.notCalled(
|
|
13537
|
+
meeting.mediaProperties.webrtcMediaConnection.updatePreferredBitrateKbps
|
|
13538
|
+
);
|
|
13539
|
+
});
|
|
13540
|
+
|
|
13541
|
+
it('does not throw when webrtcMediaConnection is undefined', () => {
|
|
13542
|
+
meeting.isMultistream = false;
|
|
13543
|
+
meeting.mediaProperties.webrtcMediaConnection = undefined;
|
|
13544
|
+
|
|
13545
|
+
assert.doesNotThrow(() => meeting.localConstraintsChangeHandler());
|
|
13546
|
+
});
|
|
13547
|
+
});
|
|
13548
|
+
|
|
13549
|
+
describe('#parseMeetingInfo', () => {
|
|
13550
|
+
const checkParseMeetingInfo = (expectedInfoToParse) => {
|
|
13551
|
+
assert.equal(meeting.conversationUrl, expectedInfoToParse.conversationUrl);
|
|
13552
|
+
assert.equal(meeting.locusUrl, expectedInfoToParse.locusUrl);
|
|
13553
|
+
assert.equal(meeting.sipUri, expectedInfoToParse.sipUri);
|
|
13554
|
+
assert.equal(meeting.meetingNumber, expectedInfoToParse.meetingNumber);
|
|
13555
|
+
assert.equal(meeting.meetingJoinUrl, expectedInfoToParse.meetingJoinUrl);
|
|
11276
13556
|
assert.equal(meeting.owner, expectedInfoToParse.owner);
|
|
11277
13557
|
assert.equal(meeting.permissionToken, expectedInfoToParse.permissionToken);
|
|
11278
13558
|
assert.deepEqual(meeting.selfUserPolicies, expectedInfoToParse.selfUserPolicies);
|
|
@@ -11645,6 +13925,7 @@ describe('plugin-meetings', () => {
|
|
|
11645
13925
|
let canUnsetDisallowUnmuteSpy;
|
|
11646
13926
|
let canUserRaiseHandSpy;
|
|
11647
13927
|
let bothLeaveAndEndMeetingAvailableSpy;
|
|
13928
|
+
let requireHostEndMeetingBeforeLeaveSpy;
|
|
11648
13929
|
let canUserLowerAllHandsSpy;
|
|
11649
13930
|
let canUserLowerSomeoneElsesHandSpy;
|
|
11650
13931
|
let waitingForOthersToJoinSpy;
|
|
@@ -11656,6 +13937,9 @@ describe('plugin-meetings', () => {
|
|
|
11656
13937
|
let canMoveToLobbySpy;
|
|
11657
13938
|
let isSpokenLanguageAutoDetectionEnabledSpy;
|
|
11658
13939
|
let showAutoEndMeetingWarningSpy;
|
|
13940
|
+
let canAttendeeRequestAiAssistantEnabledSpy;
|
|
13941
|
+
let attendeeRequestAiAssistantDeclinedAllSpy;
|
|
13942
|
+
let isAnonymizeDisplayNamesEnabledSpy;
|
|
11659
13943
|
// Due to import tree issues, hasHints must be stubed within the scope of the `it`.
|
|
11660
13944
|
|
|
11661
13945
|
beforeEach(() => {
|
|
@@ -11676,6 +13960,10 @@ describe('plugin-meetings', () => {
|
|
|
11676
13960
|
MeetingUtil,
|
|
11677
13961
|
'bothLeaveAndEndMeetingAvailable'
|
|
11678
13962
|
);
|
|
13963
|
+
requireHostEndMeetingBeforeLeaveSpy = sinon.spy(
|
|
13964
|
+
MeetingUtil,
|
|
13965
|
+
'requireHostEndMeetingBeforeLeave'
|
|
13966
|
+
);
|
|
11679
13967
|
canUserLowerSomeoneElsesHandSpy = sinon.spy(MeetingUtil, 'canUserLowerSomeoneElsesHand');
|
|
11680
13968
|
waitingForOthersToJoinSpy = sinon.spy(MeetingUtil, 'waitingForOthersToJoin');
|
|
11681
13969
|
canSendReactionsSpy = sinon.spy(MeetingUtil, 'canSendReactions');
|
|
@@ -11692,12 +13980,27 @@ describe('plugin-meetings', () => {
|
|
|
11692
13980
|
MeetingUtil,
|
|
11693
13981
|
'isSpokenLanguageAutoDetectionEnabled'
|
|
11694
13982
|
);
|
|
13983
|
+
canAttendeeRequestAiAssistantEnabledSpy = sinon.spy(
|
|
13984
|
+
MeetingUtil,
|
|
13985
|
+
'canAttendeeRequestAiAssistantEnabled'
|
|
13986
|
+
);
|
|
13987
|
+
attendeeRequestAiAssistantDeclinedAllSpy = sinon.spy(
|
|
13988
|
+
MeetingUtil,
|
|
13989
|
+
'attendeeRequestAiAssistantDeclinedAll'
|
|
13990
|
+
);
|
|
13991
|
+
isAnonymizeDisplayNamesEnabledSpy = sinon.spy(
|
|
13992
|
+
MeetingUtil,
|
|
13993
|
+
'isAnonymizeDisplayNamesEnabled'
|
|
13994
|
+
);
|
|
11695
13995
|
});
|
|
11696
13996
|
|
|
11697
13997
|
afterEach(() => {
|
|
11698
13998
|
inMeetingActionsSetSpy.restore();
|
|
11699
13999
|
waitingForOthersToJoinSpy.restore();
|
|
11700
14000
|
showAutoEndMeetingWarningSpy.restore();
|
|
14001
|
+
canAttendeeRequestAiAssistantEnabledSpy.restore();
|
|
14002
|
+
attendeeRequestAiAssistantDeclinedAllSpy.restore();
|
|
14003
|
+
isAnonymizeDisplayNamesEnabledSpy.restore();
|
|
11701
14004
|
});
|
|
11702
14005
|
|
|
11703
14006
|
forEach(
|
|
@@ -12221,6 +14524,7 @@ describe('plugin-meetings', () => {
|
|
|
12221
14524
|
const userDisplayHints = ['LOCK_CONTROL_UNLOCK'];
|
|
12222
14525
|
meeting.userDisplayHints = ['LOCK_CONTROL_UNLOCK'];
|
|
12223
14526
|
meeting.meetingInfo.supportVoIP = true;
|
|
14527
|
+
meeting.roles = [];
|
|
12224
14528
|
|
|
12225
14529
|
meeting.updateMeetingActions();
|
|
12226
14530
|
|
|
@@ -12236,6 +14540,7 @@ describe('plugin-meetings', () => {
|
|
|
12236
14540
|
assert.calledWith(canUnsetDisallowUnmuteSpy, userDisplayHints);
|
|
12237
14541
|
assert.calledWith(canUserRaiseHandSpy, userDisplayHints);
|
|
12238
14542
|
assert.calledWith(bothLeaveAndEndMeetingAvailableSpy, userDisplayHints);
|
|
14543
|
+
assert.calledWith(requireHostEndMeetingBeforeLeaveSpy, userDisplayHints);
|
|
12239
14544
|
assert.calledWith(canUserLowerAllHandsSpy, userDisplayHints);
|
|
12240
14545
|
assert.calledWith(canUserLowerSomeoneElsesHandSpy, userDisplayHints);
|
|
12241
14546
|
assert.calledWith(waitingForOthersToJoinSpy, userDisplayHints);
|
|
@@ -12247,6 +14552,13 @@ describe('plugin-meetings', () => {
|
|
|
12247
14552
|
assert.calledWith(canMoveToLobbySpy, userDisplayHints);
|
|
12248
14553
|
assert.calledWith(showAutoEndMeetingWarningSpy, userDisplayHints);
|
|
12249
14554
|
assert.calledWith(isSpokenLanguageAutoDetectionEnabledSpy, userDisplayHints);
|
|
14555
|
+
assert.calledWith(
|
|
14556
|
+
canAttendeeRequestAiAssistantEnabledSpy,
|
|
14557
|
+
userDisplayHints,
|
|
14558
|
+
meeting.roles
|
|
14559
|
+
);
|
|
14560
|
+
assert.calledWith(attendeeRequestAiAssistantDeclinedAllSpy, userDisplayHints);
|
|
14561
|
+
assert.calledWith(isAnonymizeDisplayNamesEnabledSpy, userDisplayHints);
|
|
12250
14562
|
|
|
12251
14563
|
assert.calledWith(ControlsOptionsUtil.hasHints, {
|
|
12252
14564
|
requiredHints: [DISPLAY_HINTS.MUTE_ALL],
|
|
@@ -12389,235 +14701,1060 @@ describe('plugin-meetings', () => {
|
|
|
12389
14701
|
|
|
12390
14702
|
describe('#handleDataChannelUrlChange', () => {
|
|
12391
14703
|
let updateLLMConnectionSpy;
|
|
14704
|
+
let updatePSDataChannelSpy;
|
|
12392
14705
|
|
|
12393
14706
|
beforeEach(() => {
|
|
12394
14707
|
updateLLMConnectionSpy = sinon.spy(meeting, 'updateLLMConnection');
|
|
14708
|
+
updatePSDataChannelSpy = sinon.stub(meeting.webinar, 'updatePSDataChannel').resolves();
|
|
14709
|
+
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
12395
14710
|
});
|
|
12396
14711
|
|
|
12397
|
-
const check = (
|
|
12398
|
-
|
|
14712
|
+
const check = (
|
|
14713
|
+
url,
|
|
14714
|
+
practiceSessionDatachannelUrl,
|
|
14715
|
+
{expectedMainCalled, expectedPracticeCalled}
|
|
14716
|
+
) => {
|
|
14717
|
+
meeting.handleDataChannelUrlChange(url, practiceSessionDatachannelUrl);
|
|
12399
14718
|
|
|
12400
|
-
if (
|
|
14719
|
+
if (expectedMainCalled) {
|
|
12401
14720
|
assert.calledWith(updateLLMConnectionSpy);
|
|
12402
14721
|
} else {
|
|
12403
14722
|
assert.notCalled(updateLLMConnectionSpy);
|
|
12404
14723
|
}
|
|
14724
|
+
|
|
14725
|
+
if (expectedPracticeCalled) {
|
|
14726
|
+
assert.calledWith(updatePSDataChannelSpy);
|
|
14727
|
+
} else {
|
|
14728
|
+
assert.notCalled(updatePSDataChannelSpy);
|
|
14729
|
+
}
|
|
12405
14730
|
};
|
|
12406
14731
|
|
|
12407
14732
|
it('calls deferred updateLLMConnection if datachannelURL is set and the enableAutomaticLLM is true', () => {
|
|
12408
14733
|
meeting.config.enableAutomaticLLM = true;
|
|
12409
|
-
check('some url', true);
|
|
14734
|
+
check('some url', undefined, {expectedMainCalled: true, expectedPracticeCalled: false});
|
|
12410
14735
|
});
|
|
12411
14736
|
|
|
12412
14737
|
it('does not call updateLLMConnection if datachannelURL is undefined', () => {
|
|
12413
14738
|
meeting.config.enableAutomaticLLM = true;
|
|
12414
|
-
check(undefined,
|
|
14739
|
+
check(undefined, undefined, {
|
|
14740
|
+
expectedMainCalled: false,
|
|
14741
|
+
expectedPracticeCalled: false,
|
|
14742
|
+
});
|
|
12415
14743
|
});
|
|
12416
14744
|
|
|
12417
14745
|
it('does not call updateLLMConnection if enableAutomaticLLM is false', () => {
|
|
12418
|
-
check('some url',
|
|
14746
|
+
check('some url', 'some practice url', {
|
|
14747
|
+
expectedMainCalled: false,
|
|
14748
|
+
expectedPracticeCalled: false,
|
|
14749
|
+
});
|
|
14750
|
+
});
|
|
14751
|
+
|
|
14752
|
+
it('calls updatePSDataChannel when practice-session routing is active', () => {
|
|
14753
|
+
meeting.config.enableAutomaticLLM = true;
|
|
14754
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
14755
|
+
|
|
14756
|
+
check('some url', 'some practice url', {
|
|
14757
|
+
expectedMainCalled: true,
|
|
14758
|
+
expectedPracticeCalled: true,
|
|
14759
|
+
});
|
|
14760
|
+
});
|
|
14761
|
+
|
|
14762
|
+
it('does not call updatePSDataChannel when the main datachannelURL is undefined', () => {
|
|
14763
|
+
meeting.config.enableAutomaticLLM = true;
|
|
14764
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
14765
|
+
|
|
14766
|
+
check(undefined, 'some practice url', {
|
|
14767
|
+
expectedMainCalled: false,
|
|
14768
|
+
expectedPracticeCalled: false,
|
|
14769
|
+
});
|
|
12419
14770
|
});
|
|
12420
14771
|
});
|
|
12421
14772
|
|
|
12422
|
-
describe('#
|
|
12423
|
-
beforeEach(() => {
|
|
12424
|
-
webex.internal.llm.
|
|
12425
|
-
webex.internal.llm.
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
meeting.
|
|
12433
|
-
|
|
12434
|
-
|
|
14773
|
+
describe('#saveDataChannelToken', () => {
|
|
14774
|
+
beforeEach(() => {
|
|
14775
|
+
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
14776
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
14777
|
+
.stub()
|
|
14778
|
+
.returns({currentOwner: undefined, isOwner: true});
|
|
14779
|
+
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
14780
|
+
});
|
|
14781
|
+
|
|
14782
|
+
it('saves datachannelToken into LLM as Default', () => {
|
|
14783
|
+
meeting.saveDataChannelToken({
|
|
14784
|
+
locus: {
|
|
14785
|
+
self: {datachannelToken: 'default-token'},
|
|
14786
|
+
},
|
|
14787
|
+
});
|
|
14788
|
+
|
|
14789
|
+
assert.calledWithExactly(
|
|
14790
|
+
webex.internal.llm.setDatachannelToken,
|
|
14791
|
+
'default-token',
|
|
14792
|
+
'llm-default-session',
|
|
14793
|
+
meeting.id
|
|
14794
|
+
);
|
|
14795
|
+
});
|
|
14796
|
+
|
|
14797
|
+
it('saves practiceSessionDatachannelToken into LLM as PracticeSession', () => {
|
|
14798
|
+
meeting.saveDataChannelToken({
|
|
14799
|
+
locus: {
|
|
14800
|
+
self: {practiceSessionDatachannelToken: 'ps-token'},
|
|
14801
|
+
},
|
|
14802
|
+
});
|
|
14803
|
+
|
|
14804
|
+
assert.calledWithExactly(
|
|
14805
|
+
webex.internal.llm.setDatachannelToken,
|
|
14806
|
+
'ps-token',
|
|
14807
|
+
'llm-practice-session',
|
|
14808
|
+
meeting.id
|
|
14809
|
+
);
|
|
14810
|
+
});
|
|
14811
|
+
|
|
14812
|
+
it('saves both tokens when both are present', () => {
|
|
14813
|
+
meeting.saveDataChannelToken({
|
|
14814
|
+
locus: {
|
|
14815
|
+
self: {
|
|
14816
|
+
datachannelToken: 'default-token',
|
|
14817
|
+
practiceSessionDatachannelToken: 'ps-token',
|
|
14818
|
+
},
|
|
14819
|
+
},
|
|
14820
|
+
});
|
|
14821
|
+
|
|
14822
|
+
assert.calledTwice(webex.internal.llm.setDatachannelToken);
|
|
14823
|
+
assert.calledWithExactly(
|
|
14824
|
+
webex.internal.llm.setDatachannelToken,
|
|
14825
|
+
'default-token',
|
|
14826
|
+
'llm-default-session',
|
|
14827
|
+
meeting.id
|
|
14828
|
+
);
|
|
14829
|
+
assert.calledWithExactly(
|
|
14830
|
+
webex.internal.llm.setDatachannelToken,
|
|
14831
|
+
'ps-token',
|
|
14832
|
+
'llm-practice-session',
|
|
14833
|
+
meeting.id
|
|
14834
|
+
);
|
|
14835
|
+
});
|
|
14836
|
+
|
|
14837
|
+
it('does not call setDatachannelToken when no tokens are present', () => {
|
|
14838
|
+
meeting.saveDataChannelToken({locus: {self: {}}});
|
|
14839
|
+
|
|
14840
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14841
|
+
});
|
|
14842
|
+
|
|
14843
|
+
it('handles undefined join gracefully', () => {
|
|
14844
|
+
meeting.saveDataChannelToken(undefined);
|
|
14845
|
+
|
|
14846
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14847
|
+
});
|
|
14848
|
+
|
|
14849
|
+
it('handles missing locus.self gracefully', () => {
|
|
14850
|
+
meeting.saveDataChannelToken({locus: {}});
|
|
14851
|
+
|
|
14852
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14853
|
+
});
|
|
14854
|
+
|
|
14855
|
+
it('writes token with meeting id as owner', () => {
|
|
14856
|
+
meeting.saveDataChannelToken({
|
|
14857
|
+
locus: {
|
|
14858
|
+
self: {datachannelToken: 'default-token'},
|
|
14859
|
+
},
|
|
14860
|
+
});
|
|
14861
|
+
|
|
14862
|
+
assert.calledOnceWithExactly(
|
|
14863
|
+
webex.internal.llm.setDatachannelToken,
|
|
14864
|
+
'default-token',
|
|
14865
|
+
'llm-default-session',
|
|
14866
|
+
meeting.id
|
|
14867
|
+
);
|
|
14868
|
+
});
|
|
14869
|
+
});
|
|
14870
|
+
|
|
14871
|
+
describe('#clearDataChannelToken', () => {
|
|
14872
|
+
beforeEach(() => {
|
|
14873
|
+
webex.internal.llm.clearDatachannelToken = sinon.stub();
|
|
14874
|
+
});
|
|
14875
|
+
|
|
14876
|
+
it('delegates default and practice token clears to llm with meeting ownership id', () => {
|
|
14877
|
+
meeting.clearDataChannelToken();
|
|
14878
|
+
|
|
14879
|
+
assert.calledWithExactly(
|
|
14880
|
+
webex.internal.llm.clearDatachannelToken,
|
|
14881
|
+
'llm-default-session',
|
|
14882
|
+
meeting.id
|
|
14883
|
+
);
|
|
14884
|
+
assert.calledWithExactly(
|
|
14885
|
+
webex.internal.llm.clearDatachannelToken,
|
|
14886
|
+
'llm-practice-session',
|
|
14887
|
+
meeting.id
|
|
14888
|
+
);
|
|
14889
|
+
assert.callCount(webex.internal.llm.clearDatachannelToken, 2);
|
|
14890
|
+
});
|
|
14891
|
+
});
|
|
14892
|
+
|
|
14893
|
+
describe('#updateLLMConnection', () => {
|
|
14894
|
+
beforeEach(() => {
|
|
14895
|
+
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
14896
|
+
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
14897
|
+
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
14898
|
+
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
14899
|
+
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
14900
|
+
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
14901
|
+
webex.internal.llm.on = sinon.stub();
|
|
14902
|
+
webex.internal.llm.off = sinon.stub();
|
|
14903
|
+
webex.internal.llm.getDatachannelToken = sinon.stub().returns(undefined);
|
|
14904
|
+
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
14905
|
+
|
|
14906
|
+
meeting.processRelayEvent = sinon.stub();
|
|
14907
|
+
meeting.processLocusLLMEvent = sinon.stub();
|
|
14908
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
14909
|
+
meeting.startLLMHealthCheckTimer = sinon.stub();
|
|
14910
|
+
|
|
14911
|
+
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
14912
|
+
});
|
|
14913
|
+
it('does not connect if the call is not joined yet', async () => {
|
|
14914
|
+
meeting.joinedWith = {state: 'any other state'};
|
|
14915
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14916
|
+
|
|
14917
|
+
meeting.locusInfo = {
|
|
14918
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14919
|
+
url: 'a url',
|
|
14920
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14921
|
+
};
|
|
14922
|
+
|
|
14923
|
+
const result = await meeting.updateLLMConnection();
|
|
14924
|
+
|
|
14925
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
14926
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
14927
|
+
assert.equal(result, undefined);
|
|
14928
|
+
assert.notCalled(meeting.webex.internal.llm.on);
|
|
14929
|
+
});
|
|
14930
|
+
it('returns undefined if llm is already connected and the locus url is unchanged', async () => {
|
|
14931
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14932
|
+
meeting.locusInfo = {
|
|
14933
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14934
|
+
url: 'a url',
|
|
14935
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14936
|
+
};
|
|
14937
|
+
|
|
14938
|
+
const result = await meeting.updateLLMConnection();
|
|
14939
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
14940
|
+
assert.calledWithExactly(
|
|
14941
|
+
webex.internal.llm.registerAndConnect,
|
|
14942
|
+
'a url',
|
|
14943
|
+
'a datachannel url',
|
|
14944
|
+
undefined
|
|
14945
|
+
);
|
|
14946
|
+
assert.equal(result, 'something');
|
|
14947
|
+
assert.calledWithExactly(
|
|
14948
|
+
meeting.webex.internal.llm.off,
|
|
14949
|
+
'event:relay.event',
|
|
14950
|
+
meeting.processRelayEvent
|
|
14951
|
+
);
|
|
14952
|
+
assert.calledWithExactly(
|
|
14953
|
+
meeting.webex.internal.llm.off,
|
|
14954
|
+
'event:locus.state_message',
|
|
14955
|
+
meeting.processLocusLLMEvent
|
|
14956
|
+
);
|
|
14957
|
+
assert.calledWithExactly(
|
|
14958
|
+
meeting.webex.internal.llm.on,
|
|
14959
|
+
'event:relay.event',
|
|
14960
|
+
meeting.processRelayEvent
|
|
14961
|
+
);
|
|
14962
|
+
assert.calledWithExactly(
|
|
14963
|
+
meeting.webex.internal.llm.on,
|
|
14964
|
+
'event:locus.state_message',
|
|
14965
|
+
meeting.processLocusLLMEvent
|
|
14966
|
+
);
|
|
14967
|
+
});
|
|
14968
|
+
it('connects if not already connected', async () => {
|
|
14969
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14970
|
+
meeting.locusInfo = {
|
|
14971
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14972
|
+
url: 'a url',
|
|
14973
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14974
|
+
};
|
|
14975
|
+
|
|
14976
|
+
const result = await meeting.updateLLMConnection();
|
|
14977
|
+
|
|
14978
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
14979
|
+
assert.calledWithExactly(
|
|
14980
|
+
webex.internal.llm.registerAndConnect,
|
|
14981
|
+
'a url',
|
|
14982
|
+
'a datachannel url',
|
|
14983
|
+
undefined
|
|
14984
|
+
);
|
|
14985
|
+
assert.calledOnceWithExactly(
|
|
14986
|
+
webex.internal.llm.setRefreshHandler,
|
|
14987
|
+
sinon.match.func,
|
|
14988
|
+
'llm-default-session',
|
|
14989
|
+
meeting.id
|
|
14990
|
+
);
|
|
14991
|
+
assert.equal(result, 'something');
|
|
14992
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
14993
|
+
});
|
|
14994
|
+
it('disconnects if the locus url has changed', async () => {
|
|
14995
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14996
|
+
|
|
14997
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14998
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14999
|
+
|
|
15000
|
+
meeting.locusInfo = {
|
|
15001
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15002
|
+
url: 'a different url',
|
|
15003
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15004
|
+
self: {},
|
|
15005
|
+
};
|
|
15006
|
+
|
|
15007
|
+
const result = await meeting.updateLLMConnection();
|
|
15008
|
+
|
|
15009
|
+
assert.calledWithExactly(
|
|
15010
|
+
webex.internal.llm.disconnectLLM,
|
|
15011
|
+
{
|
|
15012
|
+
code: 3050,
|
|
15013
|
+
reason: 'done (permanent)',
|
|
15014
|
+
},
|
|
15015
|
+
'llm-default-session',
|
|
15016
|
+
meeting.id
|
|
15017
|
+
);
|
|
15018
|
+
|
|
15019
|
+
assert.calledWithExactly(
|
|
15020
|
+
webex.internal.llm.registerAndConnect,
|
|
15021
|
+
'a different url',
|
|
15022
|
+
'a datachannel url',
|
|
15023
|
+
undefined
|
|
15024
|
+
);
|
|
15025
|
+
|
|
15026
|
+
assert.equal(result, 'something');
|
|
15027
|
+
|
|
15028
|
+
assert.calledWithExactly(
|
|
15029
|
+
meeting.webex.internal.llm.off,
|
|
15030
|
+
'event:relay.event',
|
|
15031
|
+
meeting.processRelayEvent
|
|
15032
|
+
);
|
|
15033
|
+
assert.calledWithExactly(
|
|
15034
|
+
meeting.webex.internal.llm.off,
|
|
15035
|
+
'event:locus.state_message',
|
|
15036
|
+
meeting.processLocusLLMEvent
|
|
15037
|
+
);
|
|
15038
|
+
assert.callCount(meeting.webex.internal.llm.off, 4);
|
|
15039
|
+
|
|
15040
|
+
assert.calledWithExactly(
|
|
15041
|
+
meeting.webex.internal.llm.on,
|
|
15042
|
+
'event:relay.event',
|
|
15043
|
+
meeting.processRelayEvent
|
|
15044
|
+
);
|
|
15045
|
+
assert.calledWithExactly(
|
|
15046
|
+
meeting.webex.internal.llm.on,
|
|
15047
|
+
'event:locus.state_message',
|
|
15048
|
+
meeting.processLocusLLMEvent
|
|
15049
|
+
);
|
|
15050
|
+
assert.isFalse(
|
|
15051
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15052
|
+
);
|
|
15053
|
+
});
|
|
15054
|
+
it('disconnects if the data channel url has changed', async () => {
|
|
15055
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15056
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15057
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15058
|
+
|
|
15059
|
+
meeting.locusInfo = {
|
|
15060
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15061
|
+
url: 'a url',
|
|
15062
|
+
info: {datachannelUrl: 'a different datachannel url'},
|
|
15063
|
+
self: {},
|
|
15064
|
+
};
|
|
15065
|
+
|
|
15066
|
+
const result = await meeting.updateLLMConnection();
|
|
15067
|
+
|
|
15068
|
+
assert.calledWithExactly(
|
|
15069
|
+
webex.internal.llm.disconnectLLM,
|
|
15070
|
+
{
|
|
15071
|
+
code: 3050,
|
|
15072
|
+
reason: 'done (permanent)',
|
|
15073
|
+
},
|
|
15074
|
+
'llm-default-session',
|
|
15075
|
+
meeting.id
|
|
15076
|
+
);
|
|
15077
|
+
|
|
15078
|
+
assert.calledWithExactly(
|
|
15079
|
+
webex.internal.llm.registerAndConnect,
|
|
15080
|
+
'a url',
|
|
15081
|
+
'a different datachannel url',
|
|
15082
|
+
undefined
|
|
15083
|
+
);
|
|
15084
|
+
|
|
15085
|
+
assert.equal(result, 'something');
|
|
15086
|
+
|
|
15087
|
+
assert.calledWithExactly(
|
|
15088
|
+
meeting.webex.internal.llm.off,
|
|
15089
|
+
'event:relay.event',
|
|
15090
|
+
meeting.processRelayEvent
|
|
15091
|
+
);
|
|
15092
|
+
assert.calledWithExactly(
|
|
15093
|
+
meeting.webex.internal.llm.off,
|
|
15094
|
+
'event:locus.state_message',
|
|
15095
|
+
meeting.processLocusLLMEvent
|
|
15096
|
+
);
|
|
15097
|
+
|
|
15098
|
+
assert.calledWithExactly(
|
|
15099
|
+
meeting.webex.internal.llm.on,
|
|
15100
|
+
'event:relay.event',
|
|
15101
|
+
meeting.processRelayEvent
|
|
15102
|
+
);
|
|
15103
|
+
assert.calledWithExactly(
|
|
15104
|
+
meeting.webex.internal.llm.on,
|
|
15105
|
+
'event:locus.state_message',
|
|
15106
|
+
meeting.processLocusLLMEvent
|
|
15107
|
+
);
|
|
15108
|
+
assert.isFalse(
|
|
15109
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15110
|
+
);
|
|
15111
|
+
});
|
|
15112
|
+
it('disconnects when the state is not JOINED', async () => {
|
|
15113
|
+
meeting.joinedWith = {state: 'any other state'};
|
|
15114
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15115
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15116
|
+
|
|
15117
|
+
meeting.locusInfo = {
|
|
15118
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15119
|
+
url: 'a url',
|
|
15120
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15121
|
+
};
|
|
15122
|
+
|
|
15123
|
+
const result = await meeting.updateLLMConnection();
|
|
15124
|
+
|
|
15125
|
+
assert.calledWith(
|
|
15126
|
+
webex.internal.llm.disconnectLLM,
|
|
15127
|
+
{
|
|
15128
|
+
code: 3050,
|
|
15129
|
+
reason: 'done (permanent)',
|
|
15130
|
+
},
|
|
15131
|
+
'llm-default-session',
|
|
15132
|
+
meeting.id
|
|
15133
|
+
);
|
|
15134
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15135
|
+
assert.equal(result, undefined);
|
|
15136
|
+
assert.isFalse(
|
|
15137
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15138
|
+
);
|
|
15139
|
+
});
|
|
15140
|
+
it('rethrows disconnect errors during reconnect cleanup after removing relay listeners and timer', async () => {
|
|
15141
|
+
const disconnectError = new Error('disconnect failed');
|
|
15142
|
+
|
|
15143
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15144
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15145
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15146
|
+
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
15147
|
+
|
|
15148
|
+
meeting.locusInfo = {
|
|
15149
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15150
|
+
url: 'a different url',
|
|
15151
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15152
|
+
self: {},
|
|
15153
|
+
};
|
|
15154
|
+
|
|
15155
|
+
try {
|
|
15156
|
+
await meeting.updateLLMConnection();
|
|
15157
|
+
assert.fail('Expected updateLLMConnection to reject when disconnectLLM fails');
|
|
15158
|
+
} catch (error) {
|
|
15159
|
+
assert.equal(error, disconnectError);
|
|
15160
|
+
}
|
|
15161
|
+
|
|
15162
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15163
|
+
assert.calledWithExactly(
|
|
15164
|
+
meeting.webex.internal.llm.off,
|
|
15165
|
+
'event:relay.event',
|
|
15166
|
+
meeting.processRelayEvent
|
|
15167
|
+
);
|
|
15168
|
+
assert.calledWithExactly(
|
|
15169
|
+
meeting.webex.internal.llm.off,
|
|
15170
|
+
'event:locus.state_message',
|
|
15171
|
+
meeting.processLocusLLMEvent
|
|
15172
|
+
);
|
|
15173
|
+
assert.isFalse(
|
|
15174
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15175
|
+
);
|
|
15176
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15177
|
+
});
|
|
15178
|
+
it('still need connect main session data channel when PS started', async () => {
|
|
15179
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15180
|
+
meeting.locusInfo = {
|
|
15181
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15182
|
+
url: 'a url',
|
|
15183
|
+
info: {
|
|
15184
|
+
datachannelUrl: 'a datachannel url',
|
|
15185
|
+
practiceSessionDatachannelUrl: 'ps-url',
|
|
15186
|
+
},
|
|
15187
|
+
};
|
|
15188
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15189
|
+
|
|
15190
|
+
await meeting.updateLLMConnection();
|
|
15191
|
+
|
|
15192
|
+
assert.calledWithExactly(
|
|
15193
|
+
webex.internal.llm.registerAndConnect,
|
|
15194
|
+
'a url',
|
|
15195
|
+
'a datachannel url',
|
|
15196
|
+
undefined
|
|
15197
|
+
);
|
|
15198
|
+
});
|
|
15199
|
+
it('passes dataChannelToken from LLM to registerAndConnect', async () => {
|
|
15200
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15201
|
+
meeting.locusInfo = {
|
|
15202
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15203
|
+
url: 'a url',
|
|
15204
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15205
|
+
};
|
|
15206
|
+
|
|
15207
|
+
webex.internal.llm.getDatachannelToken
|
|
15208
|
+
.withArgs('llm-default-session', meeting.id)
|
|
15209
|
+
.returns('token-123');
|
|
15210
|
+
|
|
15211
|
+
await meeting.updateLLMConnection();
|
|
15212
|
+
|
|
15213
|
+
assert.calledWithExactly(
|
|
15214
|
+
webex.internal.llm.registerAndConnect,
|
|
15215
|
+
'a url',
|
|
15216
|
+
'a datachannel url',
|
|
15217
|
+
'token-123'
|
|
15218
|
+
);
|
|
15219
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15220
|
+
});
|
|
15221
|
+
it('passes undefined token when LLM has no token stored', async () => {
|
|
15222
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15223
|
+
meeting.locusInfo = {
|
|
15224
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15225
|
+
url: 'a url',
|
|
15226
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15227
|
+
};
|
|
15228
|
+
|
|
15229
|
+
webex.internal.llm.getDatachannelToken.returns(undefined);
|
|
15230
|
+
|
|
15231
|
+
await meeting.updateLLMConnection();
|
|
15232
|
+
|
|
15233
|
+
assert.calledWithExactly(
|
|
15234
|
+
webex.internal.llm.registerAndConnect,
|
|
15235
|
+
'a url',
|
|
15236
|
+
'a datachannel url',
|
|
15237
|
+
undefined
|
|
15238
|
+
);
|
|
15239
|
+
|
|
15240
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15241
|
+
});
|
|
15242
|
+
|
|
15243
|
+
it('does not pass token when data channel with jwt token is disabled', async () => {
|
|
15244
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15245
|
+
meeting.locusInfo = {
|
|
15246
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15247
|
+
url: 'a url',
|
|
15248
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15249
|
+
};
|
|
15250
|
+
|
|
15251
|
+
webex.internal.llm.getDatachannelToken.returns(undefined);
|
|
15252
|
+
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
15253
|
+
|
|
15254
|
+
await meeting.updateLLMConnection();
|
|
15255
|
+
|
|
15256
|
+
assert.calledWithExactly(
|
|
15257
|
+
webex.internal.llm.registerAndConnect,
|
|
15258
|
+
'a url',
|
|
15259
|
+
'a datachannel url',
|
|
15260
|
+
undefined
|
|
15261
|
+
);
|
|
15262
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15263
|
+
});
|
|
15264
|
+
|
|
15265
|
+
describe('ownership tag', () => {
|
|
15266
|
+
beforeEach(() => {
|
|
15267
|
+
// Make the owner stub dynamic so setOwnerMeetingId() writes
|
|
15268
|
+
// propagate back to getOwnerMeetingId() reads. This mirrors the
|
|
15269
|
+
// real LLM singleton behavior so the finally-block release in
|
|
15270
|
+
// cleanupLLMConneciton is reflected in subsequent reads.
|
|
15271
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub().returns(undefined);
|
|
15272
|
+
webex.internal.llm.setOwnerMeetingId = sinon.stub().callsFake((id) => {
|
|
15273
|
+
webex.internal.llm.getOwnerMeetingId.returns(id);
|
|
15274
|
+
});
|
|
15275
|
+
});
|
|
15276
|
+
|
|
15277
|
+
it('skips disconnect and reconnect when LLM is connected and owned by another meeting (regardless of URL)', async () => {
|
|
15278
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15279
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15280
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15281
|
+
// Locus/datachannel URL mismatch is the *normal* case when
|
|
15282
|
+
// another meeting owns the live socket -- each meeting has its
|
|
15283
|
+
// own locus URL. URL mismatch must NOT trigger a reclaim,
|
|
15284
|
+
// because doing so would tear down the owning meeting's healthy
|
|
15285
|
+
// LLM socket and break its data channel.
|
|
15286
|
+
webex.internal.llm.getLocusUrl.returns('owner-locus-url');
|
|
15287
|
+
webex.internal.llm.getDatachannelUrl.returns('owner-dc-url');
|
|
15288
|
+
meeting.locusInfo = {
|
|
15289
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15290
|
+
url: 'a different url',
|
|
15291
|
+
info: {datachannelUrl: 'a different datachannel url'},
|
|
15292
|
+
self: {},
|
|
15293
|
+
};
|
|
15294
|
+
|
|
15295
|
+
const result = await meeting.updateLLMConnection();
|
|
15296
|
+
|
|
15297
|
+
assert.equal(result, undefined);
|
|
15298
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15299
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15300
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
15301
|
+
assert.notCalled(meeting.startLLMHealthCheckTimer);
|
|
15302
|
+
});
|
|
15303
|
+
|
|
15304
|
+
it('clears stale owner tag in cleanup finally block even when disconnectLLM rejects', async () => {
|
|
15305
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15306
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15307
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15308
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15309
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15310
|
+
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15311
|
+
meeting.locusInfo = {
|
|
15312
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15313
|
+
url: 'a different url',
|
|
15314
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15315
|
+
self: {},
|
|
15316
|
+
};
|
|
15317
|
+
|
|
15318
|
+
try {
|
|
15319
|
+
await meeting.updateLLMConnection();
|
|
15320
|
+
} catch (e) {
|
|
15321
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
15322
|
+
}
|
|
15323
|
+
|
|
15324
|
+
// The owner-eligible finally branch must release the tag so a
|
|
15325
|
+
// subsequent reconnect attempt from any meeting is not blocked.
|
|
15326
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId, undefined);
|
|
15327
|
+
});
|
|
15328
|
+
|
|
15329
|
+
it('does not clear owner tag when ownership changes during cleanup disconnect await', async () => {
|
|
15330
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15331
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15332
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15333
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15334
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15335
|
+
webex.internal.llm.disconnectLLM.callsFake(async () => {
|
|
15336
|
+
webex.internal.llm.getOwnerMeetingId.returns('new-owner-id');
|
|
15337
|
+
throw new Error('disconnect failed');
|
|
15338
|
+
});
|
|
15339
|
+
meeting.locusInfo = {
|
|
15340
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15341
|
+
url: 'a different url',
|
|
15342
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15343
|
+
self: {},
|
|
15344
|
+
};
|
|
15345
|
+
|
|
15346
|
+
try {
|
|
15347
|
+
await meeting.updateLLMConnection();
|
|
15348
|
+
} catch (e) {
|
|
15349
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
15350
|
+
}
|
|
15351
|
+
|
|
15352
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
15353
|
+
assert.equal(webex.internal.llm.getOwnerMeetingId(), 'new-owner-id');
|
|
15354
|
+
});
|
|
15355
|
+
|
|
15356
|
+
it('proceeds normally when LLM is connected and owned by this meeting with URL change', async () => {
|
|
15357
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15358
|
+
webex.internal.llm.isConnected.returns(true);
|
|
15359
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15360
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15361
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15362
|
+
meeting.locusInfo = {
|
|
15363
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15364
|
+
url: 'a different url',
|
|
15365
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15366
|
+
self: {},
|
|
15367
|
+
};
|
|
15368
|
+
|
|
15369
|
+
await meeting.updateLLMConnection();
|
|
15370
|
+
|
|
15371
|
+
assert.calledOnceWithExactly(
|
|
15372
|
+
webex.internal.llm.disconnectLLM,
|
|
15373
|
+
{
|
|
15374
|
+
code: 3050,
|
|
15375
|
+
reason: 'done (permanent)',
|
|
15376
|
+
},
|
|
15377
|
+
'llm-default-session',
|
|
15378
|
+
meeting.id
|
|
15379
|
+
);
|
|
15380
|
+
assert.calledWithExactly(
|
|
15381
|
+
webex.internal.llm.registerAndConnect,
|
|
15382
|
+
'a different url',
|
|
15383
|
+
'a datachannel url',
|
|
15384
|
+
undefined
|
|
15385
|
+
);
|
|
15386
|
+
// setOwnerMeetingId is called twice: first with undefined in
|
|
15387
|
+
// cleanupLLMConneciton's finally block (so a failed disconnect
|
|
15388
|
+
// cannot leave a stale owner), then with this meeting's id
|
|
15389
|
+
// after registerAndConnect resolves.
|
|
15390
|
+
assert.calledTwice(webex.internal.llm.setOwnerMeetingId);
|
|
15391
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.firstCall, undefined);
|
|
15392
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.lastCall, meeting.id);
|
|
15393
|
+
});
|
|
15394
|
+
|
|
15395
|
+
it('claims ownership after successful registerAndConnect on initial connect', async () => {
|
|
15396
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15397
|
+
webex.internal.llm.isConnected.returns(false);
|
|
15398
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15399
|
+
meeting.locusInfo = {
|
|
15400
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15401
|
+
url: 'a url',
|
|
15402
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15403
|
+
};
|
|
15404
|
+
|
|
15405
|
+
await meeting.updateLLMConnection();
|
|
15406
|
+
|
|
15407
|
+
assert.calledOnce(webex.internal.llm.registerAndConnect);
|
|
15408
|
+
assert.calledOnceWithExactly(
|
|
15409
|
+
webex.internal.llm.setRefreshHandler,
|
|
15410
|
+
sinon.match.func,
|
|
15411
|
+
'llm-default-session',
|
|
15412
|
+
meeting.id
|
|
15413
|
+
);
|
|
15414
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15415
|
+
});
|
|
15416
|
+
|
|
15417
|
+
it('proceeds to connect when LLM is not connected even if another ownerId lingers', async () => {
|
|
15418
|
+
// Defensive path: if the LLM reports not-connected but an old
|
|
15419
|
+
// ownerId is still present (e.g. race before a successful
|
|
15420
|
+
// connections.delete), this meeting can still claim a fresh
|
|
15421
|
+
// connection.
|
|
15422
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15423
|
+
webex.internal.llm.isConnected.returns(false);
|
|
15424
|
+
webex.internal.llm.getOwnerMeetingId.returns('stale-owner-id');
|
|
15425
|
+
webex.internal.llm.getDatachannelToken.onFirstCall().returns(undefined);
|
|
15426
|
+
webex.internal.llm.getDatachannelToken.onSecondCall().returns('recovered-token');
|
|
15427
|
+
meeting.locusInfo = {
|
|
15428
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15429
|
+
url: 'a url',
|
|
15430
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15431
|
+
};
|
|
15432
|
+
|
|
15433
|
+
await meeting.updateLLMConnection();
|
|
15434
|
+
|
|
15435
|
+
assert.calledTwice(webex.internal.llm.getDatachannelToken);
|
|
15436
|
+
assert.calledWithExactly(
|
|
15437
|
+
webex.internal.llm.getDatachannelToken.firstCall,
|
|
15438
|
+
'llm-default-session',
|
|
15439
|
+
meeting.id
|
|
15440
|
+
);
|
|
15441
|
+
assert.calledWithExactly(
|
|
15442
|
+
webex.internal.llm.getDatachannelToken.secondCall,
|
|
15443
|
+
'llm-default-session'
|
|
15444
|
+
);
|
|
15445
|
+
assert.calledOnceWithExactly(
|
|
15446
|
+
webex.internal.llm.registerAndConnect,
|
|
15447
|
+
'a url',
|
|
15448
|
+
'a datachannel url',
|
|
15449
|
+
'recovered-token'
|
|
15450
|
+
);
|
|
15451
|
+
assert.calledWithExactly(
|
|
15452
|
+
webex.internal.llm.setRefreshHandler.firstCall,
|
|
15453
|
+
sinon.match.func,
|
|
15454
|
+
'llm-default-session',
|
|
15455
|
+
undefined
|
|
15456
|
+
);
|
|
15457
|
+
assert.calledTwice(webex.internal.llm.setRefreshHandler);
|
|
15458
|
+
assert.calledWithExactly(
|
|
15459
|
+
webex.internal.llm.setRefreshHandler.secondCall,
|
|
15460
|
+
sinon.match.func,
|
|
15461
|
+
'llm-default-session',
|
|
15462
|
+
meeting.id
|
|
15463
|
+
);
|
|
15464
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15465
|
+
});
|
|
15466
|
+
});
|
|
15467
|
+
|
|
15468
|
+
describe('#clearMeetingData', () => {
|
|
15469
|
+
beforeEach(() => {
|
|
15470
|
+
webex.internal.llm.isConnected = sinon.stub().returns(true);
|
|
15471
|
+
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
15472
|
+
webex.internal.llm.off = sinon.stub();
|
|
15473
|
+
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15474
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15475
|
+
meeting.stopTranscription = sinon.stub();
|
|
15476
|
+
meeting.clearDataChannelToken = sinon.stub();
|
|
15477
|
+
meeting.shareStatus = 'no-share';
|
|
15478
|
+
});
|
|
15479
|
+
|
|
15480
|
+
it('disconnects llm and removes online and relay listeners during meeting data cleanup', async () => {
|
|
15481
|
+
await meeting.clearMeetingData();
|
|
15482
|
+
|
|
15483
|
+
assert.calledOnceWithExactly(
|
|
15484
|
+
webex.internal.llm.disconnectLLM,
|
|
15485
|
+
{
|
|
15486
|
+
code: 3050,
|
|
15487
|
+
reason: 'done (permanent)',
|
|
15488
|
+
},
|
|
15489
|
+
'llm-default-session',
|
|
15490
|
+
meeting.id
|
|
15491
|
+
);
|
|
15492
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15493
|
+
assert.calledWithExactly(
|
|
15494
|
+
webex.internal.llm.off,
|
|
15495
|
+
'event:relay.event',
|
|
15496
|
+
meeting.processRelayEvent
|
|
15497
|
+
);
|
|
15498
|
+
assert.calledWithExactly(
|
|
15499
|
+
webex.internal.llm.off,
|
|
15500
|
+
'event:locus.state_message',
|
|
15501
|
+
meeting.processLocusLLMEvent
|
|
15502
|
+
);
|
|
15503
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15504
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15505
|
+
// stopTranscription and annotation.deregisterEvents are not
|
|
15506
|
+
// called here: they run in stopListeningForMeetingEvents()
|
|
15507
|
+
// before /leave to avoid double-emitting
|
|
15508
|
+
// MEETING_STOPPED_RECEIVING_TRANSCRIPTION.
|
|
15509
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15510
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15511
|
+
});
|
|
15512
|
+
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
15513
|
+
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15514
|
+
|
|
15515
|
+
await meeting.clearMeetingData();
|
|
15516
|
+
|
|
15517
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15518
|
+
assert.calledWithExactly(
|
|
15519
|
+
webex.internal.llm.off,
|
|
15520
|
+
'event:relay.event',
|
|
15521
|
+
meeting.processRelayEvent
|
|
15522
|
+
);
|
|
15523
|
+
assert.calledWithExactly(
|
|
15524
|
+
webex.internal.llm.off,
|
|
15525
|
+
'event:locus.state_message',
|
|
15526
|
+
meeting.processLocusLLMEvent
|
|
15527
|
+
);
|
|
15528
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15529
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15530
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15531
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15532
|
+
});
|
|
15533
|
+
|
|
15534
|
+
describe('ownership tag', () => {
|
|
15535
|
+
beforeEach(() => {
|
|
15536
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15537
|
+
});
|
|
15538
|
+
|
|
15539
|
+
it('skips disconnectLLM but still removes this meeting listeners when another meeting owns the LLM', async () => {
|
|
15540
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15541
|
+
|
|
15542
|
+
await meeting.clearMeetingData();
|
|
15543
|
+
|
|
15544
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15545
|
+
// clearDataChannelToken is always delegated; llm enforces
|
|
15546
|
+
// ownership and no-ops for non-owners internally.
|
|
15547
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15548
|
+
// Listeners owned by *this* Meeting instance must still be
|
|
15549
|
+
// removed so a leaving subordinate meeting stops receiving
|
|
15550
|
+
// relay/locus events from the shared singleton.
|
|
15551
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15552
|
+
assert.calledWithExactly(
|
|
15553
|
+
webex.internal.llm.off,
|
|
15554
|
+
'event:relay.event',
|
|
15555
|
+
meeting.processRelayEvent
|
|
15556
|
+
);
|
|
15557
|
+
assert.calledWithExactly(
|
|
15558
|
+
webex.internal.llm.off,
|
|
15559
|
+
'event:locus.state_message',
|
|
15560
|
+
meeting.processLocusLLMEvent
|
|
15561
|
+
);
|
|
15562
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15563
|
+
});
|
|
15564
|
+
|
|
15565
|
+
it('calls disconnectLLM and clears data channel token when this meeting is the owner', async () => {
|
|
15566
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15567
|
+
|
|
15568
|
+
await meeting.clearMeetingData();
|
|
15569
|
+
|
|
15570
|
+
assert.calledOnceWithExactly(
|
|
15571
|
+
webex.internal.llm.disconnectLLM,
|
|
15572
|
+
{
|
|
15573
|
+
code: 3050,
|
|
15574
|
+
reason: 'done (permanent)',
|
|
15575
|
+
},
|
|
15576
|
+
'llm-default-session',
|
|
15577
|
+
meeting.id
|
|
15578
|
+
);
|
|
15579
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15580
|
+
});
|
|
15581
|
+
|
|
15582
|
+
it('calls disconnectLLM and clears data channel token when no owner is recorded (first-claim / legacy)', async () => {
|
|
15583
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15584
|
+
|
|
15585
|
+
await meeting.clearMeetingData();
|
|
15586
|
+
|
|
15587
|
+
assert.calledOnceWithExactly(
|
|
15588
|
+
webex.internal.llm.disconnectLLM,
|
|
15589
|
+
{
|
|
15590
|
+
code: 3050,
|
|
15591
|
+
reason: 'done (permanent)',
|
|
15592
|
+
},
|
|
15593
|
+
'llm-default-session',
|
|
15594
|
+
meeting.id
|
|
15595
|
+
);
|
|
15596
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15597
|
+
});
|
|
15598
|
+
});
|
|
12435
15599
|
});
|
|
15600
|
+
});
|
|
12436
15601
|
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
15602
|
+
describe('#processLocusLLMEvent', () => {
|
|
15603
|
+
it('routes the LLM event through locusInfo.parse and records the LLM message with the top-level tracking id', () => {
|
|
15604
|
+
const event = {
|
|
15605
|
+
data: {
|
|
15606
|
+
eventType: 'locus.state_message',
|
|
15607
|
+
dataSets: [],
|
|
15608
|
+
},
|
|
15609
|
+
trackingId: 'envelope-tracking-id',
|
|
15610
|
+
};
|
|
12440
15611
|
|
|
12441
|
-
meeting.locusInfo =
|
|
15612
|
+
meeting.locusInfo.parse = sinon.stub();
|
|
15613
|
+
meeting.onLocusSyncLlmMessage = sinon.stub();
|
|
12442
15614
|
|
|
12443
|
-
|
|
15615
|
+
meeting.processLocusLLMEvent(event);
|
|
12444
15616
|
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
assert.
|
|
12448
|
-
|
|
15617
|
+
// The LLM message is parsed without the tracking id - completion is driven from the
|
|
15618
|
+
// meeting's LLM handler, not threaded through locusInfo.
|
|
15619
|
+
assert.calledOnceWithExactly(meeting.locusInfo.parse, meeting, event.data);
|
|
15620
|
+
// Only the client whose /sync request tracking id matches the tracking id echoed back on
|
|
15621
|
+
// the top-level LLM event envelope records the LLM arrival; onLocusSyncLlmMessage is a
|
|
15622
|
+
// no-op otherwise.
|
|
15623
|
+
assert.calledOnceWithExactly(meeting.onLocusSyncLlmMessage, meeting.id, event.trackingId);
|
|
12449
15624
|
});
|
|
12450
15625
|
|
|
12451
|
-
it('
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
15626
|
+
it('does not attempt sync completion when the tracking id is missing', () => {
|
|
15627
|
+
const event = {
|
|
15628
|
+
data: {
|
|
15629
|
+
eventType: 'locus.state_message',
|
|
15630
|
+
dataSets: [],
|
|
15631
|
+
},
|
|
15632
|
+
};
|
|
12456
15633
|
|
|
12457
|
-
meeting.locusInfo =
|
|
15634
|
+
meeting.locusInfo.parse = sinon.stub();
|
|
15635
|
+
meeting.onLocusSyncLlmMessage = sinon.stub();
|
|
12458
15636
|
|
|
12459
|
-
|
|
15637
|
+
meeting.processLocusLLMEvent(event);
|
|
12460
15638
|
|
|
12461
|
-
assert.
|
|
12462
|
-
assert.notCalled(
|
|
12463
|
-
assert.equal(result, undefined);
|
|
12464
|
-
assert.notCalled(meeting.webex.internal.llm.on);
|
|
15639
|
+
assert.calledOnceWithExactly(meeting.locusInfo.parse, meeting, event.data);
|
|
15640
|
+
assert.notCalled(meeting.onLocusSyncLlmMessage);
|
|
12465
15641
|
});
|
|
15642
|
+
});
|
|
12466
15643
|
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
15644
|
+
describe('#onLocusSyncLlmMessage', () => {
|
|
15645
|
+
it('records the LLM arrival time and then tries to complete the metric', () => {
|
|
15646
|
+
webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived =
|
|
15647
|
+
sinon.stub();
|
|
15648
|
+
meeting.tryCompleteLocusSyncLatency = sinon.stub();
|
|
12470
15649
|
|
|
12471
|
-
|
|
15650
|
+
meeting.onLocusSyncLlmMessage('meeting-1', 'sync-tracking-id');
|
|
12472
15651
|
|
|
12473
|
-
assert.
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
meeting.webex.internal.llm.off,
|
|
12478
|
-
'event:relay.event',
|
|
12479
|
-
meeting.processRelayEvent
|
|
12480
|
-
);
|
|
12481
|
-
assert.calledWithExactly(
|
|
12482
|
-
meeting.webex.internal.llm.off,
|
|
12483
|
-
'event:locus.state_message',
|
|
12484
|
-
meeting.processLocusLLMEvent
|
|
15652
|
+
assert.calledOnceWithExactly(
|
|
15653
|
+
webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived,
|
|
15654
|
+
'meeting-1',
|
|
15655
|
+
'sync-tracking-id'
|
|
12485
15656
|
);
|
|
12486
|
-
assert.
|
|
12487
|
-
meeting.
|
|
12488
|
-
'
|
|
12489
|
-
|
|
15657
|
+
assert.calledOnceWithExactly(
|
|
15658
|
+
meeting.tryCompleteLocusSyncLatency,
|
|
15659
|
+
'meeting-1',
|
|
15660
|
+
'sync-tracking-id'
|
|
12490
15661
|
);
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
meeting.
|
|
15662
|
+
// the arrival time must be recorded before completion is attempted
|
|
15663
|
+
assert.callOrder(
|
|
15664
|
+
webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived,
|
|
15665
|
+
meeting.tryCompleteLocusSyncLatency
|
|
12495
15666
|
);
|
|
12496
15667
|
});
|
|
15668
|
+
});
|
|
12497
15669
|
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15670
|
+
describe('#tryCompleteLocusSyncLatency', () => {
|
|
15671
|
+
beforeEach(() => {
|
|
15672
|
+
meeting.emitLocusSyncCompleteMetric = sinon.stub();
|
|
15673
|
+
});
|
|
12503
15674
|
|
|
12504
|
-
|
|
15675
|
+
it('emits the metric when both milestones are in (completion succeeds)', () => {
|
|
15676
|
+
const completed = {dataSet: 'main', syncLatency: {totalTime: 50}};
|
|
15677
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency = sinon
|
|
15678
|
+
.stub()
|
|
15679
|
+
.returns(completed);
|
|
12505
15680
|
|
|
12506
|
-
|
|
15681
|
+
meeting.tryCompleteLocusSyncLatency('meeting-1', 'sync-tracking-id');
|
|
12507
15682
|
|
|
12508
|
-
assert.
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
assert.calledWith(
|
|
12513
|
-
webex.internal.llm.registerAndConnect,
|
|
12514
|
-
'a different url',
|
|
12515
|
-
'a datachannel url'
|
|
12516
|
-
);
|
|
12517
|
-
assert.equal(result, 'something');
|
|
12518
|
-
assert.calledWithExactly(
|
|
12519
|
-
meeting.webex.internal.llm.off,
|
|
12520
|
-
'event:relay.event',
|
|
12521
|
-
meeting.processRelayEvent
|
|
12522
|
-
);
|
|
12523
|
-
assert.calledWithExactly(
|
|
12524
|
-
meeting.webex.internal.llm.off,
|
|
12525
|
-
'event:locus.state_message',
|
|
12526
|
-
meeting.processLocusLLMEvent
|
|
12527
|
-
);
|
|
12528
|
-
assert.callCount(meeting.webex.internal.llm.off, 4);
|
|
12529
|
-
assert.calledWithExactly(
|
|
12530
|
-
meeting.webex.internal.llm.on,
|
|
12531
|
-
'event:relay.event',
|
|
12532
|
-
meeting.processRelayEvent
|
|
12533
|
-
);
|
|
12534
|
-
assert.calledWithExactly(
|
|
12535
|
-
meeting.webex.internal.llm.on,
|
|
12536
|
-
'event:locus.state_message',
|
|
12537
|
-
meeting.processLocusLLMEvent
|
|
15683
|
+
assert.calledOnceWithExactly(
|
|
15684
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency,
|
|
15685
|
+
'meeting-1',
|
|
15686
|
+
'sync-tracking-id'
|
|
12538
15687
|
);
|
|
15688
|
+
assert.calledOnceWithExactly(meeting.emitLocusSyncCompleteMetric, 'meeting-1', completed);
|
|
12539
15689
|
});
|
|
12540
15690
|
|
|
12541
|
-
it('
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
12546
|
-
|
|
12547
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a different datachannel url'}};
|
|
15691
|
+
it('does not emit when completion returns undefined (only one milestone is in)', () => {
|
|
15692
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency = sinon
|
|
15693
|
+
.stub()
|
|
15694
|
+
.returns(undefined);
|
|
12548
15695
|
|
|
12549
|
-
|
|
15696
|
+
meeting.tryCompleteLocusSyncLatency('meeting-1', 'sync-tracking-id');
|
|
12550
15697
|
|
|
12551
|
-
assert.
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
assert.calledWith(
|
|
12556
|
-
webex.internal.llm.registerAndConnect,
|
|
12557
|
-
'a url',
|
|
12558
|
-
'a different datachannel url'
|
|
12559
|
-
);
|
|
12560
|
-
assert.equal(result, 'something');
|
|
12561
|
-
assert.calledWithExactly(
|
|
12562
|
-
meeting.webex.internal.llm.off,
|
|
12563
|
-
'event:relay.event',
|
|
12564
|
-
meeting.processRelayEvent
|
|
12565
|
-
);
|
|
12566
|
-
assert.calledWithExactly(
|
|
12567
|
-
meeting.webex.internal.llm.off,
|
|
12568
|
-
'event:locus.state_message',
|
|
12569
|
-
meeting.processLocusLLMEvent
|
|
12570
|
-
);
|
|
12571
|
-
assert.calledWithExactly(
|
|
12572
|
-
meeting.webex.internal.llm.on,
|
|
12573
|
-
'event:relay.event',
|
|
12574
|
-
meeting.processRelayEvent
|
|
12575
|
-
);
|
|
12576
|
-
assert.calledWithExactly(
|
|
12577
|
-
meeting.webex.internal.llm.on,
|
|
12578
|
-
'event:locus.state_message',
|
|
12579
|
-
meeting.processLocusLLMEvent
|
|
15698
|
+
assert.calledOnceWithExactly(
|
|
15699
|
+
webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency,
|
|
15700
|
+
'meeting-1',
|
|
15701
|
+
'sync-tracking-id'
|
|
12580
15702
|
);
|
|
15703
|
+
assert.notCalled(meeting.emitLocusSyncCompleteMetric);
|
|
12581
15704
|
});
|
|
15705
|
+
});
|
|
12582
15706
|
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
webex.internal.
|
|
12586
|
-
webex.internal.llm.
|
|
12587
|
-
|
|
12588
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
15707
|
+
describe('#emitLocusSyncCompleteMetric', () => {
|
|
15708
|
+
it('submits client.locus.sync.complete with the llm websocket url and sync latency', () => {
|
|
15709
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
15710
|
+
webex.internal.llm.getWebSocketUrl = sinon.stub().returns('wss://llm-websocket-url');
|
|
12589
15711
|
|
|
12590
|
-
|
|
15712
|
+
meeting.emitLocusSyncCompleteMetric('meeting-1', {
|
|
15713
|
+
dataSet: 'main',
|
|
15714
|
+
syncLatency: {totalTime: 50},
|
|
15715
|
+
});
|
|
12591
15716
|
|
|
12592
|
-
assert.
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
15717
|
+
assert.calledOnceWithExactly(webex.internal.newMetrics.submitClientEvent, {
|
|
15718
|
+
name: 'client.locus.sync.complete',
|
|
15719
|
+
payload: {
|
|
15720
|
+
identifiers: {
|
|
15721
|
+
llmWebsocketUrl: 'wss://llm-websocket-url',
|
|
15722
|
+
},
|
|
15723
|
+
llmInfo: {
|
|
15724
|
+
dataSet: 'main',
|
|
15725
|
+
},
|
|
15726
|
+
syncLatency: {totalTime: 50},
|
|
15727
|
+
},
|
|
15728
|
+
options: {
|
|
15729
|
+
meetingId: 'meeting-1',
|
|
15730
|
+
},
|
|
15731
|
+
});
|
|
12605
15732
|
});
|
|
12606
15733
|
|
|
12607
|
-
it('
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
url: 'a url',
|
|
12611
|
-
info: {
|
|
12612
|
-
datachannelUrl: 'a datachannel url',
|
|
12613
|
-
practiceSessionDatachannelUrl: 'a ps datachannel url',
|
|
12614
|
-
},
|
|
12615
|
-
};
|
|
12616
|
-
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(true);
|
|
12617
|
-
await meeting.updateLLMConnection();
|
|
15734
|
+
it('submits with an undefined llm websocket url when it is unavailable', () => {
|
|
15735
|
+
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
15736
|
+
webex.internal.llm.getWebSocketUrl = sinon.stub().returns(undefined);
|
|
12618
15737
|
|
|
12619
|
-
|
|
12620
|
-
|
|
15738
|
+
meeting.emitLocusSyncCompleteMetric('meeting-1', {
|
|
15739
|
+
dataSet: 'main',
|
|
15740
|
+
syncLatency: {totalTime: 50},
|
|
15741
|
+
});
|
|
15742
|
+
|
|
15743
|
+
assert.calledOnceWithExactly(webex.internal.newMetrics.submitClientEvent, {
|
|
15744
|
+
name: 'client.locus.sync.complete',
|
|
15745
|
+
payload: {
|
|
15746
|
+
identifiers: {
|
|
15747
|
+
llmWebsocketUrl: undefined,
|
|
15748
|
+
},
|
|
15749
|
+
llmInfo: {
|
|
15750
|
+
dataSet: 'main',
|
|
15751
|
+
},
|
|
15752
|
+
syncLatency: {totalTime: 50},
|
|
15753
|
+
},
|
|
15754
|
+
options: {
|
|
15755
|
+
meetingId: 'meeting-1',
|
|
15756
|
+
},
|
|
15757
|
+
});
|
|
12621
15758
|
});
|
|
12622
15759
|
});
|
|
12623
15760
|
|
|
@@ -12628,6 +15765,7 @@ describe('plugin-meetings', () => {
|
|
|
12628
15765
|
|
|
12629
15766
|
it('should read the locus object, set on the meeting and return null', () => {
|
|
12630
15767
|
const dataSets = {someFakeStuff: 'dataSet'};
|
|
15768
|
+
const metadata = {some: 'metadata'};
|
|
12631
15769
|
|
|
12632
15770
|
meeting.setLocus({
|
|
12633
15771
|
mediaConnections: [test1],
|
|
@@ -12637,12 +15775,14 @@ describe('plugin-meetings', () => {
|
|
|
12637
15775
|
mediaId: uuid3,
|
|
12638
15776
|
locus: {host: {id: uuid4}},
|
|
12639
15777
|
dataSets,
|
|
15778
|
+
metadata,
|
|
12640
15779
|
});
|
|
12641
15780
|
assert.calledOnce(meeting.locusInfo.initialSetup);
|
|
12642
15781
|
assert.calledWith(meeting.locusInfo.initialSetup, {
|
|
12643
15782
|
trigger: 'join-response',
|
|
12644
15783
|
locus: {host: {id: uuid4}},
|
|
12645
15784
|
dataSets,
|
|
15785
|
+
metadata,
|
|
12646
15786
|
});
|
|
12647
15787
|
assert.equal(meeting.mediaConnections, test1);
|
|
12648
15788
|
assert.equal(meeting.locusUrl, url1);
|
|
@@ -12653,6 +15793,71 @@ describe('plugin-meetings', () => {
|
|
|
12653
15793
|
});
|
|
12654
15794
|
});
|
|
12655
15795
|
|
|
15796
|
+
describe('#waitForSelfUrlChange', () => {
|
|
15797
|
+
let waitForSelfUrlChange;
|
|
15798
|
+
let locusMediaRequestStub;
|
|
15799
|
+
|
|
15800
|
+
beforeEach(async () => {
|
|
15801
|
+
locusMediaRequestStub = sinon
|
|
15802
|
+
.stub(LocusMediaRequestModule, 'LocusMediaRequest')
|
|
15803
|
+
.returns({id: 'fake LocusMediaRequest instance'});
|
|
15804
|
+
|
|
15805
|
+
meeting.setLocus = sinon.stub().returns(true);
|
|
15806
|
+
webex.meetings.registered = true;
|
|
15807
|
+
sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve('JOIN_RESULT'));
|
|
15808
|
+
sinon.stub(meeting, 'updateLLMConnection').returns(Promise.resolve());
|
|
15809
|
+
|
|
15810
|
+
await meeting.join();
|
|
15811
|
+
|
|
15812
|
+
waitForSelfUrlChange = locusMediaRequestStub.firstCall.args[0].waitForSelfUrlChange;
|
|
15813
|
+
});
|
|
15814
|
+
|
|
15815
|
+
it('should resolve immediately when joinWithMediaRetryInfo.retryCount > 0', async () => {
|
|
15816
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 1, prevJoinResponse: undefined};
|
|
15817
|
+
|
|
15818
|
+
const result = waitForSelfUrlChange();
|
|
15819
|
+
|
|
15820
|
+
assert.instanceOf(result, Promise);
|
|
15821
|
+
await result;
|
|
15822
|
+
});
|
|
15823
|
+
|
|
15824
|
+
it('should not resolve before the timeout when retryCount is 0', async () => {
|
|
15825
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15826
|
+
|
|
15827
|
+
let resolved = false;
|
|
15828
|
+
waitForSelfUrlChange().then(() => {
|
|
15829
|
+
resolved = true;
|
|
15830
|
+
});
|
|
15831
|
+
|
|
15832
|
+
await testUtils.flushPromises();
|
|
15833
|
+
assert.isFalse(resolved);
|
|
15834
|
+
});
|
|
15835
|
+
|
|
15836
|
+
it('should resolve after the 5s timeout when retryCount is 0', async () => {
|
|
15837
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15838
|
+
|
|
15839
|
+
let resolved = false;
|
|
15840
|
+
const promise = waitForSelfUrlChange();
|
|
15841
|
+
promise.then(() => {
|
|
15842
|
+
resolved = true;
|
|
15843
|
+
});
|
|
15844
|
+
|
|
15845
|
+
fakeClock.tick(5000);
|
|
15846
|
+
await promise;
|
|
15847
|
+
|
|
15848
|
+
assert.isTrue(resolved);
|
|
15849
|
+
});
|
|
15850
|
+
|
|
15851
|
+
it('should return the same promise when called multiple times', () => {
|
|
15852
|
+
meeting.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
|
|
15853
|
+
|
|
15854
|
+
const firstPromise = waitForSelfUrlChange();
|
|
15855
|
+
const secondPromise = waitForSelfUrlChange();
|
|
15856
|
+
|
|
15857
|
+
assert.equal(firstPromise, secondPromise);
|
|
15858
|
+
});
|
|
15859
|
+
});
|
|
15860
|
+
|
|
12656
15861
|
describe('preferred video device', () => {
|
|
12657
15862
|
describe('#getVideoDeviceId', () => {
|
|
12658
15863
|
it('returns the preferred video device', () => {
|
|
@@ -14184,6 +17389,69 @@ describe('plugin-meetings', () => {
|
|
|
14184
17389
|
assert.calledOnce(meeting.meetingRequest.keepAlive);
|
|
14185
17390
|
});
|
|
14186
17391
|
});
|
|
17392
|
+
describe('#refreshDataChannelToken()', () => {
|
|
17393
|
+
let meeting;
|
|
17394
|
+
|
|
17395
|
+
beforeEach(() => {
|
|
17396
|
+
meeting = Object.create(Meeting.prototype);
|
|
17397
|
+
meeting.locusUrl = 'https://locus.example.com';
|
|
17398
|
+
meeting.meetingRequest = {
|
|
17399
|
+
fetchDatachannelToken: sinon.stub().resolves({
|
|
17400
|
+
body: {datachannelToken: 'mock-token'},
|
|
17401
|
+
}),
|
|
17402
|
+
};
|
|
17403
|
+
meeting.members = {
|
|
17404
|
+
selfId: 'self-123',
|
|
17405
|
+
};
|
|
17406
|
+
meeting.webinar = {
|
|
17407
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
17408
|
+
};
|
|
17409
|
+
});
|
|
17410
|
+
|
|
17411
|
+
it('calls fetchDatachannelToken with correct parameters', async () => {
|
|
17412
|
+
await meeting.refreshDataChannelToken();
|
|
17413
|
+
|
|
17414
|
+
sinon.assert.calledOnce(meeting.meetingRequest.fetchDatachannelToken);
|
|
17415
|
+
|
|
17416
|
+
sinon.assert.calledWith(meeting.meetingRequest.fetchDatachannelToken, {
|
|
17417
|
+
locusUrl: 'https://locus.example.com',
|
|
17418
|
+
requestingParticipantId: 'self-123',
|
|
17419
|
+
isPracticeSession: true,
|
|
17420
|
+
});
|
|
17421
|
+
});
|
|
17422
|
+
|
|
17423
|
+
it('returns the correct structured result', async () => {
|
|
17424
|
+
const result = await meeting.refreshDataChannelToken();
|
|
17425
|
+
|
|
17426
|
+
expect(result).to.deep.equal({
|
|
17427
|
+
body: {
|
|
17428
|
+
datachannelToken: 'mock-token',
|
|
17429
|
+
dataChannelTokenType: 'llm-practice-session',
|
|
17430
|
+
},
|
|
17431
|
+
});
|
|
17432
|
+
});
|
|
17433
|
+
});
|
|
17434
|
+
describe('#getDataChannelTokenType', () => {
|
|
17435
|
+
it('returns PracticeSession when webinar is in practice session mode', () => {
|
|
17436
|
+
meeting.webinar = {
|
|
17437
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
17438
|
+
};
|
|
17439
|
+
|
|
17440
|
+
const result = meeting.getDataChannelTokenType();
|
|
17441
|
+
|
|
17442
|
+
expect(result).to.equal('llm-practice-session');
|
|
17443
|
+
});
|
|
17444
|
+
|
|
17445
|
+
it('returns Default when not in practice session mode', () => {
|
|
17446
|
+
meeting.webinar = {
|
|
17447
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17448
|
+
};
|
|
17449
|
+
|
|
17450
|
+
const result = meeting.getDataChannelTokenType();
|
|
17451
|
+
|
|
17452
|
+
expect(result).to.equal('llm-default-session');
|
|
17453
|
+
});
|
|
17454
|
+
});
|
|
14187
17455
|
describe('#stopKeepAlive', () => {
|
|
14188
17456
|
let clock;
|
|
14189
17457
|
const defaultKeepAliveUrl = 'keep.alive.url';
|
|
@@ -14304,16 +17572,25 @@ describe('plugin-meetings', () => {
|
|
|
14304
17572
|
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
14305
17573
|
});
|
|
14306
17574
|
|
|
14307
|
-
it('should
|
|
17575
|
+
it('should send a custom reaction type not in the known list', async () => {
|
|
14308
17576
|
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
14309
17577
|
|
|
14310
|
-
|
|
14311
|
-
meeting.sendReaction('invalid_reaction', 'light'),
|
|
14312
|
-
Error,
|
|
14313
|
-
'invalid_reaction is not a valid reaction.'
|
|
14314
|
-
);
|
|
17578
|
+
const reactionPromise = meeting.sendReaction('custom_reaction', 'light');
|
|
14315
17579
|
|
|
14316
|
-
assert.
|
|
17580
|
+
assert.exists(reactionPromise.then);
|
|
17581
|
+
await reactionPromise;
|
|
17582
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
17583
|
+
reactionChannelUrl: 'Fake URL',
|
|
17584
|
+
reaction: {
|
|
17585
|
+
type: 'custom_reaction',
|
|
17586
|
+
tone: {
|
|
17587
|
+
type: 'light_skin_tone',
|
|
17588
|
+
codepoints: '1F3FB',
|
|
17589
|
+
shortcodes: ':skin-tone-2:',
|
|
17590
|
+
},
|
|
17591
|
+
},
|
|
17592
|
+
participantId: meeting.members.selfId,
|
|
17593
|
+
});
|
|
14317
17594
|
});
|
|
14318
17595
|
|
|
14319
17596
|
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|