@webex/plugin-meetings 3.12.0-task-refactor.1 → 3.12.0-webex-services-ready.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/index.js +26 -2
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +49 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +9 -3
- package/dist/config.js.map +1 -1
- package/dist/constants.js +59 -10
- 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 +34 -0
- package/dist/hashTree/constants.js.map +1 -0
- package/dist/hashTree/hashTree.js +533 -0
- package/dist/hashTree/hashTree.js.map +1 -0
- package/dist/hashTree/hashTreeParser.js +2068 -36
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/types.js +13 -3
- package/dist/hashTree/types.js.map +1 -1
- package/dist/hashTree/utils.js +111 -0
- package/dist/hashTree/utils.js.map +1 -0
- 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/locusRouteToken.js +27 -5
- package/dist/interceptors/locusRouteToken.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 +11 -4
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +896 -277
- 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 +5 -2
- 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 +2075 -1096
- 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 -173
- 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 +127 -25
- 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 +11 -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 +171 -18
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +142 -94
- 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/reachabilityPeerConnection.js +1 -1
- package/dist/reachability/reachabilityPeerConnection.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/types/aiEnableRequest/index.d.ts +5 -0
- package/dist/types/aiEnableRequest/utils.d.ts +2 -0
- package/dist/types/common/browser-detection.d.ts +1 -0
- package/dist/types/common/errors/webex-errors.d.ts +32 -2
- package/dist/types/common/events/events-scope.d.ts +1 -0
- package/dist/types/common/events/events.d.ts +1 -0
- package/dist/types/config.d.ts +7 -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 +11 -0
- package/dist/types/hashTree/hashTree.d.ts +136 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +392 -14
- package/dist/types/hashTree/types.d.ts +20 -0
- package/dist/types/hashTree/utils.d.ts +40 -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/locusRouteToken.d.ts +2 -0
- 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 +116 -51
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +48 -12
- package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
- package/dist/types/media/properties.d.ts +3 -1
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +196 -15
- 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/meeting-info/util.d.ts +1 -0
- package/dist/types/meeting-info/utilv2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +34 -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 +5 -4
- 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 +10 -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 +33 -6
- 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/recording-controller/util.d.ts +5 -5
- package/dist/types/roap/index.d.ts +1 -1
- 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 +26 -24
- 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/index.ts +31 -0
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +7 -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 +26 -0
- package/src/hashTree/hashTree.ts +480 -0
- package/src/hashTree/hashTreeParser.ts +1911 -29
- package/src/hashTree/types.ts +24 -1
- package/src/hashTree/utils.ts +98 -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/locusRouteToken.ts +22 -5
- 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 +20 -1
- package/src/locus-info/index.ts +958 -250
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/selfUtils.ts +1 -0
- package/src/locus-info/types.ts +51 -12
- package/src/media/MediaConnectionAwaiter.ts +62 -5
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +4 -1
- package/src/meeting/in-meeting-actions.ts +20 -0
- package/src/meeting/index.ts +1025 -146
- 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 +307 -132
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +127 -13
- 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 +11 -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 +156 -29
- package/src/reachability/index.ts +62 -17
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/reachabilityPeerConnection.ts +3 -1
- 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/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/index.ts +49 -0
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -0
- package/test/unit/spec/hashTree/hashTree.ts +721 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +5328 -0
- package/test/unit/spec/hashTree/utils.ts +264 -0
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
- package/test/unit/spec/interceptors/locusRetry.ts +205 -4
- package/test/unit/spec/interceptors/locusRouteToken.ts +44 -0
- 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 +222 -52
- package/test/unit/spec/locus-info/index.js +2000 -171
- 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 +12 -3
- package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
- package/test/unit/spec/meeting/index.js +2925 -209
- 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 +1214 -75
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +453 -52
- 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/clusterReachability.ts +125 -1
- package/test/unit/spec/reachability/index.ts +154 -49
- 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/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,
|
|
@@ -46,6 +50,7 @@ import {
|
|
|
46
50
|
MediaType,
|
|
47
51
|
} from '@webex/internal-media-core';
|
|
48
52
|
import {LocalStreamEventNames} from '@webex/media-helpers';
|
|
53
|
+
import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
|
|
49
54
|
import EventsScope from '@webex/plugin-meetings/src/common/events/events-scope';
|
|
50
55
|
import Meetings, {CONSTANTS} from '@webex/plugin-meetings';
|
|
51
56
|
import Meeting from '@webex/plugin-meetings/src/meeting';
|
|
@@ -81,6 +86,7 @@ import Mercury from '@webex/internal-plugin-mercury';
|
|
|
81
86
|
import Breakouts from '@webex/plugin-meetings/src/breakouts';
|
|
82
87
|
import SimultaneousInterpretation from '@webex/plugin-meetings/src/interpretation';
|
|
83
88
|
import Webinar from '@webex/plugin-meetings/src/webinar';
|
|
89
|
+
import AIEnableRequest from '@webex/plugin-meetings/src/aiEnableRequest';
|
|
84
90
|
import {REACTION_RELAY_TYPES} from '../../../../src/reactions/constants';
|
|
85
91
|
import locus from '../fixture/locus';
|
|
86
92
|
import {
|
|
@@ -88,6 +94,7 @@ import {
|
|
|
88
94
|
MeetingNotActiveError,
|
|
89
95
|
UserInLobbyError,
|
|
90
96
|
AddMediaFailed,
|
|
97
|
+
MediaConnectionTimedOutError,
|
|
91
98
|
} from '../../../../src/common/errors/webex-errors';
|
|
92
99
|
import WebExMeetingsErrors from '../../../../src/common/errors/webex-meetings-error';
|
|
93
100
|
import ParameterError from '../../../../src/common/errors/parameter';
|
|
@@ -122,7 +129,6 @@ import {EVENT_TRIGGERS as VOICEAEVENTS} from '@webex/internal-plugin-voicea';
|
|
|
122
129
|
import {createBrbState} from '@webex/plugin-meetings/src/meeting/brbState';
|
|
123
130
|
import JoinForbiddenError from '../../../../src/common/errors/join-forbidden-error';
|
|
124
131
|
import {EventEmitter} from 'stream';
|
|
125
|
-
|
|
126
132
|
describe('plugin-meetings', () => {
|
|
127
133
|
const logger = {
|
|
128
134
|
info: () => {},
|
|
@@ -133,11 +139,15 @@ describe('plugin-meetings', () => {
|
|
|
133
139
|
debug: () => {},
|
|
134
140
|
};
|
|
135
141
|
|
|
142
|
+
let fakeClock;
|
|
143
|
+
|
|
136
144
|
beforeEach(() => {
|
|
137
145
|
sinon.stub(Metrics, 'sendBehavioralMetric');
|
|
146
|
+
fakeClock = sinon.useFakeTimers();
|
|
138
147
|
});
|
|
139
148
|
afterEach(() => {
|
|
140
149
|
sinon.restore();
|
|
150
|
+
fakeClock.restore();
|
|
141
151
|
});
|
|
142
152
|
|
|
143
153
|
before(() => {
|
|
@@ -255,12 +265,29 @@ describe('plugin-meetings', () => {
|
|
|
255
265
|
webex.meetings.uploadLogs = sinon.stub().returns(Promise.resolve());
|
|
256
266
|
webex.meetings.reachability = {
|
|
257
267
|
isAnyPublicClusterReachable: sinon.stub().resolves(true),
|
|
268
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(false),
|
|
258
269
|
getReachabilityResults: sinon.stub().resolves(undefined),
|
|
259
270
|
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
260
271
|
stopReachability: sinon.stub(),
|
|
261
272
|
isSubnetReachable: sinon.stub().returns(true),
|
|
262
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);
|
|
263
289
|
webex.internal.llm.on = sinon.stub();
|
|
290
|
+
webex.internal.voicea.announce = sinon.stub();
|
|
264
291
|
webex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
265
292
|
{},
|
|
266
293
|
{parent: webex}
|
|
@@ -371,6 +398,7 @@ describe('plugin-meetings', () => {
|
|
|
371
398
|
assert.instanceOf(meeting.breakouts, Breakouts);
|
|
372
399
|
assert.instanceOf(meeting.simultaneousInterpretation, SimultaneousInterpretation);
|
|
373
400
|
assert.instanceOf(meeting.webinar, Webinar);
|
|
401
|
+
assert.instanceOf(meeting.aiEnableRequest, AIEnableRequest);
|
|
374
402
|
});
|
|
375
403
|
|
|
376
404
|
it('should call the callback with the meeting that has id already set', () => {
|
|
@@ -408,6 +436,161 @@ describe('plugin-meetings', () => {
|
|
|
408
436
|
assert.instanceOf(meeting.mediaRequestManagers.screenShareVideo, MediaRequestManager);
|
|
409
437
|
});
|
|
410
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
|
+
|
|
411
594
|
it('uses meeting id as correlation id if not provided in constructor', () => {
|
|
412
595
|
const newMeeting = new Meeting(
|
|
413
596
|
{
|
|
@@ -703,6 +886,67 @@ describe('plugin-meetings', () => {
|
|
|
703
886
|
assert.deepEqual(args, [[uuid1], locusUrls]);
|
|
704
887
|
});
|
|
705
888
|
});
|
|
889
|
+
describe('#transfer', () => {
|
|
890
|
+
it('should have #transfer', () => {
|
|
891
|
+
assert.exists(meeting.transfer);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
it('should transfer host using the current locus when the target member is in the current session', async () => {
|
|
895
|
+
sinon.stub(meeting.members.membersCollection, 'get').withArgs(uuid2).returns({isInMeeting: true});
|
|
896
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
897
|
+
|
|
898
|
+
await meeting.transfer(uuid2, false);
|
|
899
|
+
|
|
900
|
+
assert.calledOnceWithExactly(meeting.members.transferHostToMember, uuid2, false);
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
it('should transfer host using breakout locus when the target member is joined in a breakout session', async () => {
|
|
904
|
+
sinon.stub(meeting.members.membersCollection, 'get').withArgs(uuid2).returns({isInMeeting: false});
|
|
905
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
906
|
+
meeting.breakouts.breakouts = {
|
|
907
|
+
models: [
|
|
908
|
+
{
|
|
909
|
+
members: {
|
|
910
|
+
membersCollection: {
|
|
911
|
+
get: sinon.stub().withArgs(uuid2).returns({isInMeeting: true}),
|
|
912
|
+
},
|
|
913
|
+
},
|
|
914
|
+
breakoutRosterLocus: {url: 'https://example.com/breakout-locus'},
|
|
915
|
+
},
|
|
916
|
+
],
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
await meeting.transfer(uuid2, false);
|
|
920
|
+
|
|
921
|
+
assert.calledOnceWithExactly(
|
|
922
|
+
meeting.members.transferHostToMember,
|
|
923
|
+
uuid2,
|
|
924
|
+
false,
|
|
925
|
+
'https://example.com/breakout-locus'
|
|
926
|
+
);
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
it('should not use breakout locus when the breakout member is not in meeting', async () => {
|
|
930
|
+
sinon.stub(meeting.members.membersCollection, 'get').withArgs(uuid2).returns({isInMeeting: false});
|
|
931
|
+
meeting.members.transferHostToMember = sinon.stub().resolves(test1);
|
|
932
|
+
meeting.breakouts.breakouts = {
|
|
933
|
+
models: [
|
|
934
|
+
{
|
|
935
|
+
members: {
|
|
936
|
+
membersCollection: {
|
|
937
|
+
get: sinon.stub().withArgs(uuid2).returns({isInMeeting: false}),
|
|
938
|
+
},
|
|
939
|
+
},
|
|
940
|
+
breakoutRosterLocus: {url: 'https://example.com/breakout-locus'},
|
|
941
|
+
},
|
|
942
|
+
],
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
await meeting.transfer(uuid2, false);
|
|
946
|
+
|
|
947
|
+
assert.calledOnceWithExactly(meeting.members.transferHostToMember, uuid2, false, undefined);
|
|
948
|
+
});
|
|
949
|
+
});
|
|
706
950
|
describe('#getMembers', () => {
|
|
707
951
|
it('should have #getMembers', () => {
|
|
708
952
|
assert.exists(meeting.getMembers);
|
|
@@ -730,8 +974,13 @@ describe('plugin-meetings', () => {
|
|
|
730
974
|
let handleTurnDiscoveryHttpResponseStub;
|
|
731
975
|
let abortTurnDiscoveryStub;
|
|
732
976
|
let addMediaInternalStub;
|
|
977
|
+
let supportsRTCPeerConnectionStub;
|
|
733
978
|
|
|
734
979
|
beforeEach(() => {
|
|
980
|
+
supportsRTCPeerConnectionStub = sinon
|
|
981
|
+
.stub(WebCapabilities, 'supportsRTCPeerConnection')
|
|
982
|
+
.returns(CapabilityState.CAPABLE);
|
|
983
|
+
|
|
735
984
|
meeting.join = sinon.stub().callsFake((joinOptions) => {
|
|
736
985
|
meeting.isMultistream = joinOptions.enableMultistream;
|
|
737
986
|
return Promise.resolve(fakeJoinResult);
|
|
@@ -769,8 +1018,9 @@ describe('plugin-meetings', () => {
|
|
|
769
1018
|
assert.calledOnceWithExactly(
|
|
770
1019
|
meeting.addMediaInternal,
|
|
771
1020
|
sinon.match.any,
|
|
772
|
-
fakeTurnServerInfo,
|
|
773
1021
|
false,
|
|
1022
|
+
fakeTurnServerInfo,
|
|
1023
|
+
undefined,
|
|
774
1024
|
mediaOptions
|
|
775
1025
|
);
|
|
776
1026
|
|
|
@@ -778,7 +1028,7 @@ describe('plugin-meetings', () => {
|
|
|
778
1028
|
|
|
779
1029
|
// resets joinWithMediaRetryInfo
|
|
780
1030
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
781
|
-
|
|
1031
|
+
retryCount: 0,
|
|
782
1032
|
prevJoinResponse: undefined,
|
|
783
1033
|
});
|
|
784
1034
|
});
|
|
@@ -802,8 +1052,9 @@ describe('plugin-meetings', () => {
|
|
|
802
1052
|
assert.calledOnceWithExactly(
|
|
803
1053
|
meeting.addMediaInternal,
|
|
804
1054
|
sinon.match.any,
|
|
805
|
-
undefined,
|
|
806
1055
|
false,
|
|
1056
|
+
undefined,
|
|
1057
|
+
undefined,
|
|
807
1058
|
mediaOptions
|
|
808
1059
|
);
|
|
809
1060
|
|
|
@@ -837,8 +1088,9 @@ describe('plugin-meetings', () => {
|
|
|
837
1088
|
assert.calledOnceWithExactly(
|
|
838
1089
|
meeting.addMediaInternal,
|
|
839
1090
|
sinon.match.any,
|
|
840
|
-
undefined,
|
|
841
1091
|
false,
|
|
1092
|
+
undefined,
|
|
1093
|
+
undefined,
|
|
842
1094
|
mediaOptions
|
|
843
1095
|
);
|
|
844
1096
|
|
|
@@ -850,7 +1102,12 @@ describe('plugin-meetings', () => {
|
|
|
850
1102
|
meeting.join = sinon.stub().returns(Promise.reject(error));
|
|
851
1103
|
meeting.locusUrl = null; // when join fails, we end up with null locusUrl
|
|
852
1104
|
|
|
853
|
-
await assert.isRejected(
|
|
1105
|
+
const thrownError = await assert.isRejected(
|
|
1106
|
+
meeting.joinWithMedia({mediaOptions: {allowMediaInLobby: true}})
|
|
1107
|
+
);
|
|
1108
|
+
|
|
1109
|
+
// should throw the first attempt's error
|
|
1110
|
+
assert.equal(thrownError, error);
|
|
854
1111
|
|
|
855
1112
|
assert.calledTwice(abortTurnDiscoveryStub);
|
|
856
1113
|
|
|
@@ -888,11 +1145,79 @@ describe('plugin-meetings', () => {
|
|
|
888
1145
|
|
|
889
1146
|
// resets joinWithMediaRetryInfo
|
|
890
1147
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
891
|
-
|
|
1148
|
+
retryCount: 0,
|
|
1149
|
+
prevJoinResponse: undefined,
|
|
1150
|
+
firstError: undefined,
|
|
1151
|
+
prevError: undefined,
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
it('should re-join on retry when join() fails on first attempt, and throw the first error if join fails again', async () => {
|
|
1156
|
+
const firstJoinError = new Error('first join error');
|
|
1157
|
+
const secondJoinError = new Error('second join error');
|
|
1158
|
+
|
|
1159
|
+
meeting.join = sinon
|
|
1160
|
+
.stub()
|
|
1161
|
+
.onFirstCall()
|
|
1162
|
+
.rejects(firstJoinError)
|
|
1163
|
+
.onSecondCall()
|
|
1164
|
+
.rejects(secondJoinError);
|
|
1165
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1166
|
+
|
|
1167
|
+
const thrownError = await assert.isRejected(
|
|
1168
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1169
|
+
);
|
|
1170
|
+
|
|
1171
|
+
// join() should be called twice — once for the first attempt, once for the re-join
|
|
1172
|
+
assert.calledTwice(meeting.join);
|
|
1173
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1174
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1175
|
+
|
|
1176
|
+
// should throw the first attempt's error, not the second
|
|
1177
|
+
assert.equal(thrownError, firstJoinError);
|
|
1178
|
+
|
|
1179
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1180
|
+
assert.calledWith(
|
|
1181
|
+
Metrics.sendBehavioralMetric.firstCall,
|
|
1182
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1183
|
+
sinon.match({reason: firstJoinError.message, isRetry: false}),
|
|
1184
|
+
sinon.match.any
|
|
1185
|
+
);
|
|
1186
|
+
assert.calledWith(
|
|
1187
|
+
Metrics.sendBehavioralMetric.secondCall,
|
|
1188
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1189
|
+
sinon.match({reason: secondJoinError.message, isRetry: true}),
|
|
1190
|
+
sinon.match.any
|
|
1191
|
+
);
|
|
1192
|
+
|
|
1193
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1194
|
+
retryCount: 0,
|
|
892
1195
|
prevJoinResponse: undefined,
|
|
1196
|
+
firstError: undefined,
|
|
1197
|
+
prevError: undefined,
|
|
893
1198
|
});
|
|
894
1199
|
});
|
|
895
1200
|
|
|
1201
|
+
it('should NOT call join() again on retry when join() succeeded but addMediaInternal() failed', async () => {
|
|
1202
|
+
const addMediaError = new Error('addMedia error');
|
|
1203
|
+
|
|
1204
|
+
meeting.addMediaInternal = sinon
|
|
1205
|
+
.stub()
|
|
1206
|
+
.onFirstCall()
|
|
1207
|
+
.rejects(addMediaError)
|
|
1208
|
+
.onSecondCall()
|
|
1209
|
+
.resolves(test4);
|
|
1210
|
+
|
|
1211
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1212
|
+
|
|
1213
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1214
|
+
|
|
1215
|
+
// join() should only be called once — the successful join result is reused on retry
|
|
1216
|
+
assert.calledOnce(meeting.join);
|
|
1217
|
+
// TURN discovery request is only generated once (on the first attempt alongside join)
|
|
1218
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
1219
|
+
});
|
|
1220
|
+
|
|
896
1221
|
it('should resolve if join() fails the first time but succeeds the second time', async () => {
|
|
897
1222
|
const error = new Error('fake');
|
|
898
1223
|
meeting.join = sinon
|
|
@@ -934,7 +1259,7 @@ describe('plugin-meetings', () => {
|
|
|
934
1259
|
|
|
935
1260
|
// resets joinWithMediaRetryInfo
|
|
936
1261
|
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
937
|
-
|
|
1262
|
+
retryCount: 0,
|
|
938
1263
|
prevJoinResponse: undefined,
|
|
939
1264
|
});
|
|
940
1265
|
});
|
|
@@ -1003,6 +1328,176 @@ describe('plugin-meetings', () => {
|
|
|
1003
1328
|
);
|
|
1004
1329
|
});
|
|
1005
1330
|
|
|
1331
|
+
it('should throw the first attempt error when retry also fails with a different error', async () => {
|
|
1332
|
+
const firstError = new Error('first attempt error');
|
|
1333
|
+
const secondError = new Error('second attempt error');
|
|
1334
|
+
|
|
1335
|
+
const addMediaInternalResults = [];
|
|
1336
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1337
|
+
const defer = new Defer();
|
|
1338
|
+
addMediaInternalResults.push(defer);
|
|
1339
|
+
return defer.promise;
|
|
1340
|
+
});
|
|
1341
|
+
|
|
1342
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1343
|
+
|
|
1344
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1345
|
+
|
|
1346
|
+
await testUtils.flushPromises();
|
|
1347
|
+
|
|
1348
|
+
// 1st attempt fails
|
|
1349
|
+
addMediaInternalResults[0].reject(firstError);
|
|
1350
|
+
await testUtils.flushPromises();
|
|
1351
|
+
|
|
1352
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1353
|
+
assert.notCalled(leaveStub);
|
|
1354
|
+
|
|
1355
|
+
// 2nd (final) attempt fails
|
|
1356
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1357
|
+
const thrownError = await assert.isRejected(result);
|
|
1358
|
+
|
|
1359
|
+
// should throw the first error, not the second
|
|
1360
|
+
assert.equal(thrownError, firstError);
|
|
1361
|
+
|
|
1362
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1363
|
+
assert.calledOnce(leaveStub);
|
|
1364
|
+
|
|
1365
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
it('should throw the UserNotJoinedError as firstError when it occurs on the 1st attempt and 2nd attempt fails differently', async () => {
|
|
1369
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1370
|
+
const secondError = new Error('second attempt error');
|
|
1371
|
+
|
|
1372
|
+
const addMediaInternalResults = [];
|
|
1373
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1374
|
+
const defer = new Defer();
|
|
1375
|
+
addMediaInternalResults.push(defer);
|
|
1376
|
+
return defer.promise;
|
|
1377
|
+
});
|
|
1378
|
+
|
|
1379
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1380
|
+
|
|
1381
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1382
|
+
|
|
1383
|
+
await testUtils.flushPromises();
|
|
1384
|
+
|
|
1385
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1386
|
+
addMediaInternalResults[0].reject(userNotJoinedError);
|
|
1387
|
+
await testUtils.flushPromises();
|
|
1388
|
+
|
|
1389
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1390
|
+
assert.notCalled(leaveStub);
|
|
1391
|
+
|
|
1392
|
+
// 2nd (final) attempt fails
|
|
1393
|
+
addMediaInternalResults[1].reject(secondError);
|
|
1394
|
+
const thrownError = await assert.isRejected(result);
|
|
1395
|
+
|
|
1396
|
+
// should throw the first (UserNotJoinedError), not the second
|
|
1397
|
+
assert.equal(thrownError, userNotJoinedError);
|
|
1398
|
+
|
|
1399
|
+
// join() called twice: original + re-join triggered by UserNotJoinedError in prevError
|
|
1400
|
+
assert.calledTwice(meeting.join);
|
|
1401
|
+
// leave() should only be called after the last (2nd) attempt
|
|
1402
|
+
assert.calledOnce(leaveStub);
|
|
1403
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
it('should throw the first UserNotJoinedError when it occurs on both 1st and 2nd attempts and a 3rd attempt also fails', async () => {
|
|
1407
|
+
const firstUserNotJoinedError = new UserNotJoinedError('first');
|
|
1408
|
+
const secondUserNotJoinedError = new UserNotJoinedError('second');
|
|
1409
|
+
const thirdError = new Error('third attempt error');
|
|
1410
|
+
|
|
1411
|
+
const addMediaInternalResults = [];
|
|
1412
|
+
meeting.addMediaInternal = sinon.stub().callsFake(() => {
|
|
1413
|
+
const defer = new Defer();
|
|
1414
|
+
addMediaInternalResults.push(defer);
|
|
1415
|
+
return defer.promise;
|
|
1416
|
+
});
|
|
1417
|
+
|
|
1418
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1419
|
+
|
|
1420
|
+
const result = meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1421
|
+
|
|
1422
|
+
await testUtils.flushPromises();
|
|
1423
|
+
|
|
1424
|
+
// 1st attempt fails with UserNotJoinedError — triggers a re-join
|
|
1425
|
+
addMediaInternalResults[0].reject(firstUserNotJoinedError);
|
|
1426
|
+
await testUtils.flushPromises();
|
|
1427
|
+
|
|
1428
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1429
|
+
assert.notCalled(leaveStub);
|
|
1430
|
+
|
|
1431
|
+
// 2nd attempt fails with UserNotJoinedError again — triggers another re-join
|
|
1432
|
+
addMediaInternalResults[1].reject(secondUserNotJoinedError);
|
|
1433
|
+
await testUtils.flushPromises();
|
|
1434
|
+
|
|
1435
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1436
|
+
assert.notCalled(leaveStub);
|
|
1437
|
+
|
|
1438
|
+
// 3rd (final) attempt fails
|
|
1439
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1440
|
+
const thrownError = await assert.isRejected(result);
|
|
1441
|
+
|
|
1442
|
+
// should throw the very first error across all 3 attempts
|
|
1443
|
+
assert.equal(thrownError, firstUserNotJoinedError);
|
|
1444
|
+
|
|
1445
|
+
// join() called 3 times: original + 2 re-joins triggered by prevError being UserNotJoinedError
|
|
1446
|
+
assert.calledThrice(meeting.join);
|
|
1447
|
+
// leave() should only be called after the last (3rd) attempt
|
|
1448
|
+
assert.calledOnce(leaveStub);
|
|
1449
|
+
assert.calledThrice(Metrics.sendBehavioralMetric);
|
|
1450
|
+
});
|
|
1451
|
+
|
|
1452
|
+
it('should call leave() if addMediaInternal() fails with a browser media error (TypeError)', async () => {
|
|
1453
|
+
const addMediaError = new Error('fake addMedia error');
|
|
1454
|
+
addMediaError.name = 'TypeError'; // This makes it a browser media error
|
|
1455
|
+
|
|
1456
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1457
|
+
meeting.addMediaInternal = sinon.stub().rejects(addMediaError);
|
|
1458
|
+
|
|
1459
|
+
// When a browser media error occurs, it gets transformed into a special structure
|
|
1460
|
+
const rejectedError = await assert.isRejected(
|
|
1461
|
+
meeting.joinWithMedia({
|
|
1462
|
+
joinOptions,
|
|
1463
|
+
mediaOptions,
|
|
1464
|
+
})
|
|
1465
|
+
);
|
|
1466
|
+
|
|
1467
|
+
// Verify the error was transformed with errorCode 2729
|
|
1468
|
+
assert.equal(rejectedError.error.body.errorCode, 2729);
|
|
1469
|
+
assert.equal(rejectedError.error.body.message, 'fake addMedia error');
|
|
1470
|
+
assert.equal(rejectedError.error.body.name, 'TypeError');
|
|
1471
|
+
|
|
1472
|
+
assert.calledOnce(meeting.join);
|
|
1473
|
+
assert.calledOnce(meeting.addMediaInternal);
|
|
1474
|
+
assert.calledOnce(leaveStub);
|
|
1475
|
+
assert.calledOnceWithExactly(leaveStub, {
|
|
1476
|
+
resourceId: undefined,
|
|
1477
|
+
reason: 'joinWithMedia failure',
|
|
1478
|
+
});
|
|
1479
|
+
|
|
1480
|
+
// Browser media errors don't retry, so behavioral metric is sent only once
|
|
1481
|
+
// NOTE: The error gets transformed, so the metric receives undefined for message/stack/name
|
|
1482
|
+
// because they're now nested in error.body instead of at the top level
|
|
1483
|
+
assert.calledOnce(Metrics.sendBehavioralMetric);
|
|
1484
|
+
assert.calledWith(
|
|
1485
|
+
Metrics.sendBehavioralMetric,
|
|
1486
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1487
|
+
{
|
|
1488
|
+
correlation_id: meeting.correlationId,
|
|
1489
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
1490
|
+
reason: undefined, // transformed error doesn't have .message at top level
|
|
1491
|
+
stack: undefined, // transformed error doesn't have .stack at top level
|
|
1492
|
+
leaveErrorReason: undefined,
|
|
1493
|
+
isRetry: false,
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
type: undefined, // transformed error doesn't have .name at top level
|
|
1497
|
+
}
|
|
1498
|
+
);
|
|
1499
|
+
});
|
|
1500
|
+
|
|
1006
1501
|
it('should not call leave() if addMediaInternal() fails the first time and succeeds the second time and should only call join() once', async () => {
|
|
1007
1502
|
const addMediaError = new Error('fake addMedia error');
|
|
1008
1503
|
const leaveStub = sinon.stub(meeting, 'leave');
|
|
@@ -1149,8 +1644,9 @@ describe('plugin-meetings', () => {
|
|
|
1149
1644
|
assert.calledWith(
|
|
1150
1645
|
meeting.addMediaInternal.firstCall,
|
|
1151
1646
|
sinon.match.any,
|
|
1152
|
-
fakeTurnServerInfo,
|
|
1153
1647
|
false,
|
|
1648
|
+
fakeTurnServerInfo,
|
|
1649
|
+
undefined,
|
|
1154
1650
|
mediaOptions
|
|
1155
1651
|
);
|
|
1156
1652
|
|
|
@@ -1158,8 +1654,9 @@ describe('plugin-meetings', () => {
|
|
|
1158
1654
|
assert.calledWith(
|
|
1159
1655
|
meeting.addMediaInternal.secondCall,
|
|
1160
1656
|
sinon.match.any,
|
|
1161
|
-
undefined,
|
|
1162
1657
|
true,
|
|
1658
|
+
undefined,
|
|
1659
|
+
undefined,
|
|
1163
1660
|
mediaOptions
|
|
1164
1661
|
);
|
|
1165
1662
|
|
|
@@ -1177,7 +1674,7 @@ describe('plugin-meetings', () => {
|
|
|
1177
1674
|
|
|
1178
1675
|
meeting.addMediaInternal = sinon
|
|
1179
1676
|
.stub()
|
|
1180
|
-
.callsFake((icePhaseCallback,
|
|
1677
|
+
.callsFake((icePhaseCallback, _forceTurnDiscovery, _turnServerInfo) => {
|
|
1181
1678
|
const defer = new Defer();
|
|
1182
1679
|
|
|
1183
1680
|
icePhaseCallbacks.push(icePhaseCallback);
|
|
@@ -1201,7 +1698,8 @@ describe('plugin-meetings', () => {
|
|
|
1201
1698
|
|
|
1202
1699
|
await testUtils.flushPromises();
|
|
1203
1700
|
|
|
1204
|
-
// check the callback works correctly on the 2nd attempt
|
|
1701
|
+
// check the callback works correctly on the 2nd attempt:
|
|
1702
|
+
// retryCount=1 with a non-UserNotJoinedError is terminal, so icePhase must be JOIN_MEETING_FINAL
|
|
1205
1703
|
assert.equal(icePhaseCallbacks.length, 2);
|
|
1206
1704
|
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1207
1705
|
|
|
@@ -1211,43 +1709,166 @@ describe('plugin-meetings', () => {
|
|
|
1211
1709
|
await assert.isRejected(result);
|
|
1212
1710
|
});
|
|
1213
1711
|
|
|
1214
|
-
it('should
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1712
|
+
it('should allow an additional retry when UserNotJoinedError occurs and return JOIN_MEETING_FINAL on the 3rd attempt', async () => {
|
|
1713
|
+
const genericError = new Error('generic error');
|
|
1714
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1715
|
+
const thirdError = new Error('third error');
|
|
1217
1716
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1717
|
+
const icePhaseCallbacks = [];
|
|
1718
|
+
const addMediaInternalResults = [];
|
|
1220
1719
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
}),
|
|
1226
|
-
addMediaError
|
|
1227
|
-
);
|
|
1720
|
+
meeting.addMediaInternal = sinon
|
|
1721
|
+
.stub()
|
|
1722
|
+
.callsFake((icePhaseCallback) => {
|
|
1723
|
+
const defer = new Defer();
|
|
1228
1724
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1725
|
+
icePhaseCallbacks.push(icePhaseCallback);
|
|
1726
|
+
addMediaInternalResults.push(defer);
|
|
1727
|
+
return defer.promise;
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1731
|
+
|
|
1732
|
+
const result = meeting.joinWithMedia({
|
|
1733
|
+
joinOptions,
|
|
1734
|
+
mediaOptions,
|
|
1735
|
+
});
|
|
1736
|
+
|
|
1737
|
+
await testUtils.flushPromises();
|
|
1738
|
+
|
|
1739
|
+
// 1st attempt: retryCount=0 → JOIN_MEETING_RETRY
|
|
1740
|
+
assert.equal(icePhaseCallbacks.length, 1);
|
|
1741
|
+
assert.equal(icePhaseCallbacks[0](), 'JOIN_MEETING_RETRY');
|
|
1742
|
+
addMediaInternalResults[0].reject(genericError);
|
|
1743
|
+
|
|
1744
|
+
await testUtils.flushPromises();
|
|
1745
|
+
|
|
1746
|
+
// leave() should NOT be called after the 1st attempt (intermediate retry)
|
|
1747
|
+
assert.notCalled(leaveStub);
|
|
1748
|
+
|
|
1749
|
+
// 2nd attempt: retryCount=1 → JOIN_MEETING_FINAL
|
|
1750
|
+
// (In real usage this callback is never invoked when UserNotJoinedError is thrown,
|
|
1751
|
+
// because UserNotJoinedError is thrown before waitForMediaConnectionConnected() is reached.)
|
|
1752
|
+
assert.equal(icePhaseCallbacks.length, 2);
|
|
1753
|
+
assert.equal(icePhaseCallbacks[1](), 'JOIN_MEETING_FINAL');
|
|
1754
|
+
addMediaInternalResults[1].reject(userNotJoinedError);
|
|
1755
|
+
|
|
1756
|
+
await testUtils.flushPromises();
|
|
1757
|
+
|
|
1758
|
+
// leave() should NOT be called after the 2nd attempt (intermediate retry)
|
|
1759
|
+
assert.notCalled(leaveStub);
|
|
1760
|
+
|
|
1761
|
+
// 3rd attempt: retryCount=2 → JOIN_MEETING_FINAL
|
|
1762
|
+
assert.equal(icePhaseCallbacks.length, 3);
|
|
1763
|
+
assert.equal(icePhaseCallbacks[2](), 'JOIN_MEETING_FINAL');
|
|
1764
|
+
addMediaInternalResults[2].reject(thirdError);
|
|
1765
|
+
|
|
1766
|
+
const thrownError = await assert.isRejected(result);
|
|
1767
|
+
|
|
1768
|
+
// should throw the first error
|
|
1769
|
+
assert.equal(thrownError, genericError);
|
|
1770
|
+
|
|
1771
|
+
// leave() should only be called once, after the last (3rd) attempt
|
|
1772
|
+
assert.calledOnce(leaveStub);
|
|
1773
|
+
});
|
|
1774
|
+
|
|
1775
|
+
it('should re-join when retrying after a UserNotJoinedError', async () => {
|
|
1776
|
+
const userNotJoinedError = new UserNotJoinedError();
|
|
1777
|
+
|
|
1778
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1779
|
+
|
|
1780
|
+
meeting.addMediaInternal = sinon
|
|
1781
|
+
.stub()
|
|
1782
|
+
.onFirstCall()
|
|
1783
|
+
.rejects(userNotJoinedError)
|
|
1784
|
+
.onSecondCall()
|
|
1785
|
+
.resolves(test4);
|
|
1786
|
+
|
|
1787
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1788
|
+
|
|
1789
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1790
|
+
|
|
1791
|
+
// join() should be called twice — once for the first attempt, once for the re-join after UserNotJoinedError
|
|
1792
|
+
assert.calledTwice(meeting.join);
|
|
1793
|
+
// TURN discovery should be attempted twice (once per join)
|
|
1794
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1795
|
+
// leave() should never be called when retrying after UserNotJoinedError
|
|
1796
|
+
assert.notCalled(leaveStub);
|
|
1797
|
+
});
|
|
1798
|
+
|
|
1799
|
+
it('should re-join when isUserInLeftState returns true on retry', async () => {
|
|
1800
|
+
const addMediaError = new Error('addMedia error');
|
|
1801
|
+
|
|
1802
|
+
sinon.stub(MeetingUtil, 'isUserInLeftState').returns(true);
|
|
1803
|
+
|
|
1804
|
+
const leaveStub = sinon.stub(meeting, 'leave').resolves();
|
|
1805
|
+
|
|
1806
|
+
meeting.addMediaInternal = sinon
|
|
1807
|
+
.stub()
|
|
1808
|
+
.onFirstCall()
|
|
1809
|
+
.rejects(addMediaError)
|
|
1810
|
+
.onSecondCall()
|
|
1811
|
+
.resolves(test4);
|
|
1812
|
+
|
|
1813
|
+
const result = await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1814
|
+
|
|
1815
|
+
assert.deepEqual(result, {join: fakeJoinResult, media: test4, multistreamEnabled: true});
|
|
1816
|
+
|
|
1817
|
+
// join() should be called twice — once for the first attempt, once because the user is in left state
|
|
1818
|
+
assert.calledTwice(meeting.join);
|
|
1819
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1820
|
+
// leave() should never be called when retrying after isUserInLeftState returns true
|
|
1821
|
+
assert.notCalled(leaveStub);
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1824
|
+
[
|
|
1825
|
+
{
|
|
1826
|
+
errorName: 'SdpOfferCreationError',
|
|
1827
|
+
description: 'if we fail to create the offer on first attempt',
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
errorName: 'WebrtcApiNotAvailableError',
|
|
1831
|
+
description: 'if RTCPeerConnection is not available',
|
|
1832
|
+
},
|
|
1833
|
+
].forEach(({errorName, description}) => {
|
|
1834
|
+
it(`should not attempt a retry ${description}`, async () => {
|
|
1835
|
+
const addMediaError = new Error('fake addMedia error');
|
|
1836
|
+
addMediaError.name = errorName;
|
|
1837
|
+
|
|
1838
|
+
meeting.addMediaInternal.rejects(addMediaError);
|
|
1839
|
+
sinon.stub(meeting, 'leave').resolves();
|
|
1840
|
+
|
|
1841
|
+
await assert.isRejected(
|
|
1842
|
+
meeting.joinWithMedia({
|
|
1843
|
+
joinOptions,
|
|
1844
|
+
mediaOptions,
|
|
1845
|
+
}),
|
|
1846
|
+
addMediaError
|
|
1847
|
+
);
|
|
1848
|
+
|
|
1849
|
+
// check that only 1 attempt was done
|
|
1850
|
+
assert.calledOnce(meeting.join);
|
|
1851
|
+
assert.calledOnce(meeting.addMediaInternal);
|
|
1852
|
+
assert.calledOnce(Metrics.sendBehavioralMetric);
|
|
1853
|
+
assert.calledWith(
|
|
1854
|
+
Metrics.sendBehavioralMetric.firstCall,
|
|
1855
|
+
BEHAVIORAL_METRICS.JOIN_WITH_MEDIA_FAILURE,
|
|
1856
|
+
{
|
|
1857
|
+
correlation_id: meeting.correlationId,
|
|
1858
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
1859
|
+
reason: addMediaError.message,
|
|
1860
|
+
stack: addMediaError.stack,
|
|
1861
|
+
leaveErrorReason: undefined,
|
|
1862
|
+
isRetry: false,
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
type: addMediaError.name,
|
|
1866
|
+
}
|
|
1867
|
+
);
|
|
1868
|
+
assert.calledOnceWithExactly(meeting.leave, {
|
|
1869
|
+
resourceId: undefined,
|
|
1870
|
+
reason: 'joinWithMedia failure',
|
|
1871
|
+
});
|
|
1251
1872
|
});
|
|
1252
1873
|
});
|
|
1253
1874
|
|
|
@@ -1267,6 +1888,7 @@ describe('plugin-meetings', () => {
|
|
|
1267
1888
|
sinon.match.any,
|
|
1268
1889
|
sinon.match.any,
|
|
1269
1890
|
sinon.match.any,
|
|
1891
|
+
sinon.match.any,
|
|
1270
1892
|
sinon.match.has('videoEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1271
1893
|
);
|
|
1272
1894
|
});
|
|
@@ -1287,6 +1909,7 @@ describe('plugin-meetings', () => {
|
|
|
1287
1909
|
sinon.match.any,
|
|
1288
1910
|
sinon.match.any,
|
|
1289
1911
|
sinon.match.any,
|
|
1912
|
+
sinon.match.any,
|
|
1290
1913
|
sinon.match.has('audioEnabled', false).and(sinon.match.has('allowMediaInLobby', true))
|
|
1291
1914
|
);
|
|
1292
1915
|
});
|
|
@@ -1308,6 +1931,7 @@ describe('plugin-meetings', () => {
|
|
|
1308
1931
|
sinon.match.any,
|
|
1309
1932
|
sinon.match.any,
|
|
1310
1933
|
sinon.match.any,
|
|
1934
|
+
sinon.match.any,
|
|
1311
1935
|
sinon.match({
|
|
1312
1936
|
sendVideo: true,
|
|
1313
1937
|
receiveVideo: false,
|
|
@@ -1316,6 +1940,112 @@ describe('plugin-meetings', () => {
|
|
|
1316
1940
|
})
|
|
1317
1941
|
);
|
|
1318
1942
|
});
|
|
1943
|
+
|
|
1944
|
+
describe('shouldRetryMediaWithOnlyTurnTLS', () => {
|
|
1945
|
+
it('should pass iceTransportPolicy=relay for multistream when previous error is DTLS failure over UDP and TLS is reachable', async () => {
|
|
1946
|
+
meeting.isMultistream = true;
|
|
1947
|
+
const dtlsError = new AddMediaFailed({iceConnected: true, connectionType: 'UDP'});
|
|
1948
|
+
|
|
1949
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon.stub().resolves(true);
|
|
1950
|
+
|
|
1951
|
+
addMediaInternalStub.onFirstCall().rejects(dtlsError);
|
|
1952
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
1953
|
+
|
|
1954
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
1955
|
+
|
|
1956
|
+
assert.calledWith(
|
|
1957
|
+
meeting.addMediaInternal.secondCall,
|
|
1958
|
+
sinon.match.any,
|
|
1959
|
+
sinon.match.any,
|
|
1960
|
+
sinon.match.any,
|
|
1961
|
+
'relay',
|
|
1962
|
+
mediaOptions
|
|
1963
|
+
);
|
|
1964
|
+
});
|
|
1965
|
+
|
|
1966
|
+
[
|
|
1967
|
+
{
|
|
1968
|
+
title: 'TLS is not reachable',
|
|
1969
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
1970
|
+
tlsReachable: false,
|
|
1971
|
+
isMultistream: true,
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
title: 'error is not AddMediaFailed',
|
|
1975
|
+
prevError: new Error('generic error'),
|
|
1976
|
+
tlsReachable: true,
|
|
1977
|
+
isMultistream: true,
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
title: 'error is AddMediaFailed but not DTLS failure',
|
|
1981
|
+
prevError: new AddMediaFailed({iceConnected: false, connectionType: 'UDP'}),
|
|
1982
|
+
tlsReachable: true,
|
|
1983
|
+
isMultistream: true,
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
title: 'error is DTLS failure but connectionType is not UDP',
|
|
1987
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'TURN-TLS'}),
|
|
1988
|
+
tlsReachable: true,
|
|
1989
|
+
isMultistream: true,
|
|
1990
|
+
},
|
|
1991
|
+
{
|
|
1992
|
+
title: 'isMultistream is false',
|
|
1993
|
+
prevError: new AddMediaFailed({iceConnected: true, connectionType: 'UDP'}),
|
|
1994
|
+
tlsReachable: true,
|
|
1995
|
+
isMultistream: false,
|
|
1996
|
+
},
|
|
1997
|
+
].forEach(({title, prevError, tlsReachable, isMultistream}) => {
|
|
1998
|
+
it(`should pass iceTransportPolicy=undefined when ${title}`, async () => {
|
|
1999
|
+
meeting.join = sinon.stub().callsFake(() => {
|
|
2000
|
+
meeting.isMultistream = isMultistream;
|
|
2001
|
+
return Promise.resolve(fakeJoinResult);
|
|
2002
|
+
});
|
|
2003
|
+
webex.meetings.reachability.isAnyClusterReachableViaProtocol = sinon.stub().resolves(tlsReachable);
|
|
2004
|
+
|
|
2005
|
+
addMediaInternalStub.onFirstCall().rejects(prevError);
|
|
2006
|
+
addMediaInternalStub.onSecondCall().resolves(test4);
|
|
2007
|
+
|
|
2008
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2009
|
+
|
|
2010
|
+
assert.calledWith(
|
|
2011
|
+
meeting.addMediaInternal.secondCall,
|
|
2012
|
+
sinon.match.any,
|
|
2013
|
+
sinon.match.any,
|
|
2014
|
+
sinon.match.any,
|
|
2015
|
+
undefined,
|
|
2016
|
+
mediaOptions
|
|
2017
|
+
);
|
|
2018
|
+
});
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
it('should pass iceTransportPolicy=undefined on first attempt (no prevError)', async () => {
|
|
2022
|
+
await meeting.joinWithMedia({joinOptions, mediaOptions});
|
|
2023
|
+
|
|
2024
|
+
assert.calledWith(
|
|
2025
|
+
meeting.addMediaInternal.firstCall,
|
|
2026
|
+
sinon.match.any,
|
|
2027
|
+
sinon.match.any,
|
|
2028
|
+
sinon.match.any,
|
|
2029
|
+
undefined,
|
|
2030
|
+
mediaOptions
|
|
2031
|
+
);
|
|
2032
|
+
});
|
|
2033
|
+
});
|
|
2034
|
+
|
|
2035
|
+
it('should throw immediately if RTCPeerConnection is not available', async () => {
|
|
2036
|
+
supportsRTCPeerConnectionStub.returns(CapabilityState.NOT_CAPABLE);
|
|
2037
|
+
|
|
2038
|
+
await assert.isRejected(
|
|
2039
|
+
meeting.joinWithMedia({
|
|
2040
|
+
joinOptions,
|
|
2041
|
+
mediaOptions,
|
|
2042
|
+
}),
|
|
2043
|
+
Errors.WebrtcApiNotAvailableError
|
|
2044
|
+
);
|
|
2045
|
+
|
|
2046
|
+
assert.notCalled(meeting.join);
|
|
2047
|
+
assert.notCalled(meeting.addMediaInternal);
|
|
2048
|
+
});
|
|
1319
2049
|
});
|
|
1320
2050
|
describe('#isTranscriptionSupported', () => {
|
|
1321
2051
|
it('should return false if the feature is not supported for the meeting', () => {
|
|
@@ -1330,6 +2060,25 @@ describe('plugin-meetings', () => {
|
|
|
1330
2060
|
});
|
|
1331
2061
|
});
|
|
1332
2062
|
|
|
2063
|
+
describe('#update hesiod llm id', () => {
|
|
2064
|
+
beforeEach(() => {
|
|
2065
|
+
webex.internal.voicea.onCaptionServiceIdUpdate = sinon.stub();
|
|
2066
|
+
});
|
|
2067
|
+
afterEach(() => {
|
|
2068
|
+
// Restore the original methods after each test
|
|
2069
|
+
sinon.restore();
|
|
2070
|
+
});
|
|
2071
|
+
it('should call voicea.onCaptionServiceIdUpdate when joined', async () => {
|
|
2072
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
2073
|
+
await meeting.locusInfo.emitScoped(
|
|
2074
|
+
{function: 'test', file: 'test'},
|
|
2075
|
+
LOCUSINFO.EVENTS.CONTROLS_MEETING_HESIOD_LLM_ID_UPDATED,
|
|
2076
|
+
{hesiodLlmId: '123a-456b-789c'}
|
|
2077
|
+
);
|
|
2078
|
+
assert.calledWith(webex.internal.voicea.onCaptionServiceIdUpdate, '123a-456b-789c');
|
|
2079
|
+
});
|
|
2080
|
+
});
|
|
2081
|
+
|
|
1333
2082
|
describe('#update spoken language', () => {
|
|
1334
2083
|
beforeEach(() => {
|
|
1335
2084
|
webex.internal.voicea.onSpokenLanguageUpdate = sinon.stub();
|
|
@@ -1445,6 +2194,22 @@ describe('plugin-meetings', () => {
|
|
|
1445
2194
|
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
|
|
1446
2195
|
);
|
|
1447
2196
|
});
|
|
2197
|
+
|
|
2198
|
+
it('should stop listening to voicea events even when transcription is undefined', () => {
|
|
2199
|
+
meeting.transcription = undefined;
|
|
2200
|
+
meeting.stopTranscription();
|
|
2201
|
+
assert.equal(webex.internal.voicea.off.callCount, 4);
|
|
2202
|
+
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2203
|
+
assert.calledWith(
|
|
2204
|
+
TriggerProxy.trigger,
|
|
2205
|
+
sinon.match.instanceOf(Meeting),
|
|
2206
|
+
{
|
|
2207
|
+
file: 'meeting/index',
|
|
2208
|
+
function: 'triggerStopReceivingTranscriptionEvent',
|
|
2209
|
+
},
|
|
2210
|
+
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION
|
|
2211
|
+
);
|
|
2212
|
+
});
|
|
1448
2213
|
});
|
|
1449
2214
|
|
|
1450
2215
|
describe('#setCaptionLanguage', () => {
|
|
@@ -1710,14 +2475,59 @@ describe('plugin-meetings', () => {
|
|
|
1710
2475
|
}
|
|
1711
2476
|
);
|
|
1712
2477
|
});
|
|
1713
|
-
});
|
|
2478
|
+
});
|
|
2479
|
+
|
|
2480
|
+
describe('#processRelayEvent', () => {
|
|
2481
|
+
it('should process a Reaction event type', () => {
|
|
2482
|
+
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2483
|
+
meeting.config.receiveReactions = true;
|
|
2484
|
+
const fakeSendersName = 'Fake reactors name';
|
|
2485
|
+
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2486
|
+
const fakeReactionPayload = {
|
|
2487
|
+
type: 'fake_type',
|
|
2488
|
+
codepoints: 'fake_codepoints',
|
|
2489
|
+
shortcodes: 'fake_shortcodes',
|
|
2490
|
+
tone: {
|
|
2491
|
+
type: 'fake_tone_type',
|
|
2492
|
+
codepoints: 'fake_tone_codepoints',
|
|
2493
|
+
shortcodes: 'fake_tone_shortcodes',
|
|
2494
|
+
},
|
|
2495
|
+
};
|
|
2496
|
+
const fakeSenderPayload = {
|
|
2497
|
+
participantId: 'fake_participant_id',
|
|
2498
|
+
};
|
|
2499
|
+
const fakeProcessedReaction = {
|
|
2500
|
+
reaction: fakeReactionPayload,
|
|
2501
|
+
sender: {
|
|
2502
|
+
id: fakeSenderPayload.participantId,
|
|
2503
|
+
name: fakeSendersName,
|
|
2504
|
+
},
|
|
2505
|
+
};
|
|
2506
|
+
const fakeRelayEvent = {
|
|
2507
|
+
data: {
|
|
2508
|
+
relayType: REACTION_RELAY_TYPES.REACTION,
|
|
2509
|
+
reaction: fakeReactionPayload,
|
|
2510
|
+
sender: fakeSenderPayload,
|
|
2511
|
+
},
|
|
2512
|
+
};
|
|
2513
|
+
meeting.processRelayEvent(fakeRelayEvent);
|
|
2514
|
+
assert.calledWith(
|
|
2515
|
+
TriggerProxy.trigger,
|
|
2516
|
+
sinon.match.instanceOf(Meeting),
|
|
2517
|
+
{
|
|
2518
|
+
file: 'meeting/index',
|
|
2519
|
+
function: 'join',
|
|
2520
|
+
},
|
|
2521
|
+
EVENT_TRIGGERS.MEETING_RECEIVE_REACTIONS,
|
|
2522
|
+
fakeProcessedReaction
|
|
2523
|
+
);
|
|
2524
|
+
});
|
|
1714
2525
|
|
|
1715
|
-
|
|
1716
|
-
|
|
2526
|
+
it('should fail quietly if participantId does not exist in membersCollection', () => {
|
|
2527
|
+
LoggerProxy.logger.warn = sinon.stub();
|
|
1717
2528
|
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
1718
2529
|
meeting.config.receiveReactions = true;
|
|
1719
2530
|
const fakeSendersName = 'Fake reactors name';
|
|
1720
|
-
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
1721
2531
|
const fakeReactionPayload = {
|
|
1722
2532
|
type: 'fake_type',
|
|
1723
2533
|
codepoints: 'fake_codepoints',
|
|
@@ -1747,6 +2557,10 @@ describe('plugin-meetings', () => {
|
|
|
1747
2557
|
};
|
|
1748
2558
|
meeting.processRelayEvent(fakeRelayEvent);
|
|
1749
2559
|
assert.calledWith(
|
|
2560
|
+
LoggerProxy.logger.warn,
|
|
2561
|
+
`Meeting:index#processRelayEvent --> Skipping handling of react for ${meeting.id}. participantId fake_participant_id does not exist in membersCollection.`
|
|
2562
|
+
);
|
|
2563
|
+
assert.neverCalledWith(
|
|
1750
2564
|
TriggerProxy.trigger,
|
|
1751
2565
|
sinon.match.instanceOf(Meeting),
|
|
1752
2566
|
{
|
|
@@ -1758,10 +2572,11 @@ describe('plugin-meetings', () => {
|
|
|
1758
2572
|
);
|
|
1759
2573
|
});
|
|
1760
2574
|
|
|
1761
|
-
it('should
|
|
2575
|
+
it('should process if participantId does not exist in membersCollection but has displayName in Webinar', () => {
|
|
1762
2576
|
LoggerProxy.logger.warn = sinon.stub();
|
|
1763
2577
|
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
1764
2578
|
meeting.config.receiveReactions = true;
|
|
2579
|
+
meeting.locusInfo.info = {isWebinar: true};
|
|
1765
2580
|
const fakeSendersName = 'Fake reactors name';
|
|
1766
2581
|
const fakeReactionPayload = {
|
|
1767
2582
|
type: 'fake_type',
|
|
@@ -1774,6 +2589,7 @@ describe('plugin-meetings', () => {
|
|
|
1774
2589
|
},
|
|
1775
2590
|
};
|
|
1776
2591
|
const fakeSenderPayload = {
|
|
2592
|
+
displayName: 'Fake reactors name',
|
|
1777
2593
|
participantId: 'fake_participant_id',
|
|
1778
2594
|
};
|
|
1779
2595
|
const fakeProcessedReaction = {
|
|
@@ -1792,10 +2608,6 @@ describe('plugin-meetings', () => {
|
|
|
1792
2608
|
};
|
|
1793
2609
|
meeting.processRelayEvent(fakeRelayEvent);
|
|
1794
2610
|
assert.calledWith(
|
|
1795
|
-
LoggerProxy.logger.warn,
|
|
1796
|
-
`Meeting:index#processRelayEvent --> Skipping handling of react for ${meeting.id}. participantId fake_participant_id does not exist in membersCollection.`
|
|
1797
|
-
);
|
|
1798
|
-
assert.neverCalledWith(
|
|
1799
2611
|
TriggerProxy.trigger,
|
|
1800
2612
|
sinon.match.instanceOf(Meeting),
|
|
1801
2613
|
{
|
|
@@ -1806,16 +2618,124 @@ describe('plugin-meetings', () => {
|
|
|
1806
2618
|
fakeProcessedReaction
|
|
1807
2619
|
);
|
|
1808
2620
|
});
|
|
2621
|
+
|
|
2622
|
+
[
|
|
2623
|
+
{
|
|
2624
|
+
title: 'should skip a reaction when the default relay route does not match the LLM binding',
|
|
2625
|
+
isPracticeSessionConnected: false,
|
|
2626
|
+
route: 'wrong-default-route',
|
|
2627
|
+
defaultBinding: 'default-route',
|
|
2628
|
+
practiceBinding: 'practice-route',
|
|
2629
|
+
shouldProcess: false,
|
|
2630
|
+
expectedSessionLabel: 'default session',
|
|
2631
|
+
},
|
|
2632
|
+
{
|
|
2633
|
+
title: 'should process a reaction when the default relay route matches the LLM binding',
|
|
2634
|
+
isPracticeSessionConnected: false,
|
|
2635
|
+
route: 'default-route',
|
|
2636
|
+
defaultBinding: 'default-route',
|
|
2637
|
+
practiceBinding: 'practice-route',
|
|
2638
|
+
shouldProcess: true,
|
|
2639
|
+
},
|
|
2640
|
+
{
|
|
2641
|
+
title:
|
|
2642
|
+
'should process a reaction when the practice-session relay route matches the practice-session LLM binding',
|
|
2643
|
+
isPracticeSessionConnected: true,
|
|
2644
|
+
route: 'practice-route',
|
|
2645
|
+
defaultBinding: 'default-route',
|
|
2646
|
+
practiceBinding: 'practice-route',
|
|
2647
|
+
shouldProcess: true,
|
|
2648
|
+
},
|
|
2649
|
+
{
|
|
2650
|
+
title:
|
|
2651
|
+
'should skip a reaction when the practice-session relay route does not match the practice-session LLM binding',
|
|
2652
|
+
isPracticeSessionConnected: true,
|
|
2653
|
+
route: 'default-route',
|
|
2654
|
+
defaultBinding: 'default-route',
|
|
2655
|
+
practiceBinding: 'practice-route',
|
|
2656
|
+
shouldProcess: false,
|
|
2657
|
+
expectedSessionLabel: 'practice session',
|
|
2658
|
+
},
|
|
2659
|
+
].forEach(
|
|
2660
|
+
({
|
|
2661
|
+
title,
|
|
2662
|
+
isPracticeSessionConnected,
|
|
2663
|
+
route,
|
|
2664
|
+
defaultBinding,
|
|
2665
|
+
practiceBinding,
|
|
2666
|
+
shouldProcess,
|
|
2667
|
+
expectedSessionLabel,
|
|
2668
|
+
}) => {
|
|
2669
|
+
it(title, () => {
|
|
2670
|
+
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2671
|
+
meeting.config.receiveReactions = true;
|
|
2672
|
+
const fakeSendersName = 'Fake reactors name';
|
|
2673
|
+
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2674
|
+
webex.internal.llm.isConnected = sinon.stub().callsFake((llmSessionId) => {
|
|
2675
|
+
return llmSessionId === LLM_PRACTICE_SESSION && isPracticeSessionConnected;
|
|
2676
|
+
});
|
|
2677
|
+
webex.internal.llm.getBinding = sinon.stub().callsFake((llmSessionId) => {
|
|
2678
|
+
if (llmSessionId === LLM_PRACTICE_SESSION) {
|
|
2679
|
+
return practiceBinding;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
return defaultBinding;
|
|
2683
|
+
});
|
|
2684
|
+
const fakeReactionPayload = {
|
|
2685
|
+
type: 'fake_type',
|
|
2686
|
+
codepoints: 'fake_codepoints',
|
|
2687
|
+
shortcodes: 'fake_shortcodes',
|
|
2688
|
+
};
|
|
2689
|
+
const fakeSenderPayload = {
|
|
2690
|
+
participantId: 'fake_participant_id',
|
|
2691
|
+
};
|
|
2692
|
+
const fakeRelayEvent = {
|
|
2693
|
+
headers: {route},
|
|
2694
|
+
data: {
|
|
2695
|
+
relayType: REACTION_RELAY_TYPES.REACTION,
|
|
2696
|
+
reaction: fakeReactionPayload,
|
|
2697
|
+
sender: fakeSenderPayload,
|
|
2698
|
+
},
|
|
2699
|
+
};
|
|
2700
|
+
const fakeProcessedReaction = {
|
|
2701
|
+
reaction: fakeReactionPayload,
|
|
2702
|
+
sender: {
|
|
2703
|
+
id: fakeSenderPayload.participantId,
|
|
2704
|
+
name: fakeSendersName,
|
|
2705
|
+
},
|
|
2706
|
+
};
|
|
2707
|
+
|
|
2708
|
+
TriggerProxy.trigger.resetHistory();
|
|
2709
|
+
meeting.processRelayEvent(fakeRelayEvent);
|
|
2710
|
+
|
|
2711
|
+
if (shouldProcess) {
|
|
2712
|
+
assert.calledWith(
|
|
2713
|
+
TriggerProxy.trigger,
|
|
2714
|
+
sinon.match.instanceOf(Meeting),
|
|
2715
|
+
{
|
|
2716
|
+
file: 'meeting/index',
|
|
2717
|
+
function: 'join',
|
|
2718
|
+
},
|
|
2719
|
+
EVENT_TRIGGERS.MEETING_RECEIVE_REACTIONS,
|
|
2720
|
+
fakeProcessedReaction
|
|
2721
|
+
);
|
|
2722
|
+
} else {
|
|
2723
|
+
assert.notCalled(TriggerProxy.trigger);
|
|
2724
|
+
}
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
);
|
|
1809
2728
|
});
|
|
1810
2729
|
|
|
1811
2730
|
describe('#handleLLMOnline', () => {
|
|
1812
2731
|
beforeEach(() => {
|
|
1813
2732
|
webex.internal.llm.off = sinon.stub();
|
|
2733
|
+
webex.internal.voicea.getIsCaptionBoxOn = sinon.stub().returns(false);
|
|
2734
|
+
webex.internal.voicea.updateSubchannelSubscriptions = sinon.stub();
|
|
1814
2735
|
});
|
|
1815
2736
|
|
|
1816
|
-
it('
|
|
2737
|
+
it('emits transcription connected events', () => {
|
|
1817
2738
|
meeting.handleLLMOnline();
|
|
1818
|
-
assert.calledOnceWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
1819
2739
|
assert.calledWith(
|
|
1820
2740
|
TriggerProxy.trigger,
|
|
1821
2741
|
sinon.match.instanceOf(Meeting),
|
|
@@ -1826,6 +2746,32 @@ describe('plugin-meetings', () => {
|
|
|
1826
2746
|
EVENT_TRIGGERS.MEETING_TRANSCRIPTION_CONNECTED
|
|
1827
2747
|
);
|
|
1828
2748
|
});
|
|
2749
|
+
|
|
2750
|
+
it('restores transcription subscription when caption intent is enabled', () => {
|
|
2751
|
+
webex.internal.voicea.getIsCaptionBoxOn.returns(true);
|
|
2752
|
+
|
|
2753
|
+
meeting.handleLLMOnline();
|
|
2754
|
+
|
|
2755
|
+
assert.calledOnceWithExactly(webex.internal.voicea.updateSubchannelSubscriptions, {
|
|
2756
|
+
subscribe: ['transcription'],
|
|
2757
|
+
});
|
|
2758
|
+
});
|
|
2759
|
+
|
|
2760
|
+
it('does not restore transcription subscription when caption intent is disabled', () => {
|
|
2761
|
+
webex.internal.voicea.getIsCaptionBoxOn.returns(false);
|
|
2762
|
+
|
|
2763
|
+
meeting.handleLLMOnline();
|
|
2764
|
+
|
|
2765
|
+
assert.notCalled(webex.internal.voicea.updateSubchannelSubscriptions);
|
|
2766
|
+
});
|
|
2767
|
+
|
|
2768
|
+
it('calls syncAllHashTreeDatasets on locusInfo', () => {
|
|
2769
|
+
sinon.stub(meeting.locusInfo, 'syncAllHashTreeDatasets').resolves();
|
|
2770
|
+
|
|
2771
|
+
meeting.handleLLMOnline();
|
|
2772
|
+
|
|
2773
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
2774
|
+
});
|
|
1829
2775
|
});
|
|
1830
2776
|
|
|
1831
2777
|
describe('#join', () => {
|
|
@@ -1845,6 +2791,7 @@ describe('plugin-meetings', () => {
|
|
|
1845
2791
|
it('should have #join', () => {
|
|
1846
2792
|
assert.exists(meeting.join);
|
|
1847
2793
|
});
|
|
2794
|
+
|
|
1848
2795
|
beforeEach(() => {
|
|
1849
2796
|
setCorrelationIdSpy = sinon.spy(meeting, 'setCorrelationId');
|
|
1850
2797
|
meeting.setLocus = sinon.stub().returns(true);
|
|
@@ -1905,6 +2852,8 @@ describe('plugin-meetings', () => {
|
|
|
1905
2852
|
regionCode: 'EU',
|
|
1906
2853
|
},
|
|
1907
2854
|
preferTranscoding: !enableMultistream,
|
|
2855
|
+
getCurrentSelfUrl: sinon.match.func,
|
|
2856
|
+
waitForSelfUrlChange: sinon.match.func,
|
|
1908
2857
|
},
|
|
1909
2858
|
{
|
|
1910
2859
|
parent: meeting.webex,
|
|
@@ -1998,7 +2947,6 @@ describe('plugin-meetings', () => {
|
|
|
1998
2947
|
await meeting.join().catch(() => {
|
|
1999
2948
|
assert.calledOnce(MeetingUtil.joinMeeting);
|
|
2000
2949
|
|
|
2001
|
-
// Assert that client.locus.join.response error event is not sent from this function, it is now emitted from MeetingUtil.joinMeeting
|
|
2002
2950
|
assert.calledOnce(webex.internal.newMetrics.submitClientEvent);
|
|
2003
2951
|
assert.calledWithMatch(webex.internal.newMetrics.submitClientEvent, {
|
|
2004
2952
|
name: 'client.call.initiated',
|
|
@@ -2030,6 +2978,7 @@ describe('plugin-meetings', () => {
|
|
|
2030
2978
|
});
|
|
2031
2979
|
});
|
|
2032
2980
|
});
|
|
2981
|
+
|
|
2033
2982
|
describe('lmm, transcription & permissionTokenRefresh decoupling', () => {
|
|
2034
2983
|
beforeEach(() => {
|
|
2035
2984
|
sandbox.stub(MeetingUtil, 'joinMeeting').returns(Promise.resolve(joinMeetingResult));
|
|
@@ -2100,7 +3049,6 @@ describe('plugin-meetings', () => {
|
|
|
2100
3049
|
const locusInfoParseStub = sinon.stub(meeting.locusInfo, 'parse');
|
|
2101
3050
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
2102
3051
|
|
|
2103
|
-
// Set up llm.on stub to capture the registered listener when updateLLMConnection is called
|
|
2104
3052
|
let locusLLMEventListener;
|
|
2105
3053
|
meeting.webex.internal.llm.on = sinon.stub().callsFake((eventName, callback) => {
|
|
2106
3054
|
if (eventName === 'event:locus.state_message') {
|
|
@@ -2109,16 +3057,12 @@ describe('plugin-meetings', () => {
|
|
|
2109
3057
|
});
|
|
2110
3058
|
meeting.webex.internal.llm.off = sinon.stub();
|
|
2111
3059
|
|
|
2112
|
-
// we need the real meeting.updateLLMConnection not the mock
|
|
2113
3060
|
meeting.updateLLMConnection.restore();
|
|
2114
3061
|
|
|
2115
|
-
// Call updateLLMConnection to register the listener
|
|
2116
3062
|
await meeting.updateLLMConnection();
|
|
2117
3063
|
|
|
2118
|
-
// Verify the listener was registered and we captured it
|
|
2119
3064
|
assert.isDefined(locusLLMEventListener, 'LLM event listener should be registered');
|
|
2120
3065
|
|
|
2121
|
-
// Now trigger the event
|
|
2122
3066
|
const eventData = {
|
|
2123
3067
|
eventType: 'locus.state_message',
|
|
2124
3068
|
stateElementsMessage: {
|
|
@@ -2131,6 +3075,66 @@ describe('plugin-meetings', () => {
|
|
|
2131
3075
|
|
|
2132
3076
|
assert.calledOnceWithExactly(locusInfoParseStub, meeting, eventData);
|
|
2133
3077
|
});
|
|
3078
|
+
|
|
3079
|
+
it('UpdateLLMConnection sends a metric if not connected after timeout', async () => {
|
|
3080
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3081
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3082
|
+
sinon.stub(meeting.webex.internal.llm, 'hasEverConnected').value(true);
|
|
3083
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({});
|
|
3084
|
+
|
|
3085
|
+
meeting.updateLLMConnection.restore();
|
|
3086
|
+
|
|
3087
|
+
await meeting.updateLLMConnection();
|
|
3088
|
+
|
|
3089
|
+
fakeClock.tick(3 * 60 * 1000);
|
|
3090
|
+
|
|
3091
|
+
assert.calledWith(
|
|
3092
|
+
Metrics.sendBehavioralMetric,
|
|
3093
|
+
BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE,
|
|
3094
|
+
{
|
|
3095
|
+
correlation_id: meeting.correlationId,
|
|
3096
|
+
hasEverConnected: true,
|
|
3097
|
+
}
|
|
3098
|
+
);
|
|
3099
|
+
});
|
|
3100
|
+
|
|
3101
|
+
it('clears the LLM health check timer when disconnecting LLM', async () => {
|
|
3102
|
+
const isJoinedStub = sinon.stub(meeting, 'isJoined');
|
|
3103
|
+
sinon.stub(meeting.webex.internal.llm, 'isConnected');
|
|
3104
|
+
sinon.stub(meeting.webex.internal.llm, 'disconnectLLM').resolves();
|
|
3105
|
+
sinon.stub(meeting.webex.internal.llm, 'registerAndConnect').resolves({});
|
|
3106
|
+
sinon
|
|
3107
|
+
.stub(meeting.webex.internal.llm, 'getLocusUrl')
|
|
3108
|
+
.returns('https://locus1.example.com');
|
|
3109
|
+
sinon
|
|
3110
|
+
.stub(meeting.webex.internal.llm, 'getDatachannelUrl')
|
|
3111
|
+
.returns('https://datachannel1.example.com');
|
|
3112
|
+
|
|
3113
|
+
meeting.updateLLMConnection.restore();
|
|
3114
|
+
|
|
3115
|
+
isJoinedStub.returns(true);
|
|
3116
|
+
meeting.webex.internal.llm.isConnected.returns(false);
|
|
3117
|
+
await meeting.updateLLMConnection();
|
|
3118
|
+
|
|
3119
|
+
assert.exists(meeting.llmHealthCheckTimer);
|
|
3120
|
+
|
|
3121
|
+
isJoinedStub.returns(false);
|
|
3122
|
+
meeting.webex.internal.llm.isConnected.returns(true);
|
|
3123
|
+
|
|
3124
|
+
await meeting.updateLLMConnection();
|
|
3125
|
+
|
|
3126
|
+
assert.calledOnce(meeting.webex.internal.llm.disconnectLLM);
|
|
3127
|
+
|
|
3128
|
+
assert.isUndefined(meeting.llmHealthCheckTimer);
|
|
3129
|
+
|
|
3130
|
+
Metrics.sendBehavioralMetric.resetHistory();
|
|
3131
|
+
fakeClock.tick(3 * 60 * 1000);
|
|
3132
|
+
|
|
3133
|
+
assert.neverCalledWith(
|
|
3134
|
+
Metrics.sendBehavioralMetric,
|
|
3135
|
+
BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE
|
|
3136
|
+
);
|
|
3137
|
+
});
|
|
2134
3138
|
});
|
|
2135
3139
|
|
|
2136
3140
|
describe('refreshPermissionToken', () => {
|
|
@@ -2157,7 +3161,6 @@ describe('plugin-meetings', () => {
|
|
|
2157
3161
|
.stub()
|
|
2158
3162
|
.rejects(new CaptchaError('bad captcha'));
|
|
2159
3163
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2160
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil, 'joinMeetingOptions');
|
|
2161
3164
|
|
|
2162
3165
|
try {
|
|
2163
3166
|
await meeting.join();
|
|
@@ -2171,8 +3174,7 @@ describe('plugin-meetings', () => {
|
|
|
2171
3174
|
);
|
|
2172
3175
|
assert.instanceOf(error, CaptchaError);
|
|
2173
3176
|
assert.equal(error.message, 'bad captcha');
|
|
2174
|
-
|
|
2175
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3177
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2176
3178
|
}
|
|
2177
3179
|
});
|
|
2178
3180
|
|
|
@@ -2181,7 +3183,6 @@ describe('plugin-meetings', () => {
|
|
|
2181
3183
|
.stub()
|
|
2182
3184
|
.rejects(new PasswordError('bad password'));
|
|
2183
3185
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2184
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil.joinMeetingOptions);
|
|
2185
3186
|
|
|
2186
3187
|
try {
|
|
2187
3188
|
await meeting.join();
|
|
@@ -2195,8 +3196,7 @@ describe('plugin-meetings', () => {
|
|
|
2195
3196
|
);
|
|
2196
3197
|
assert.instanceOf(error, PasswordError);
|
|
2197
3198
|
assert.equal(error.message, 'bad password');
|
|
2198
|
-
|
|
2199
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3199
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2200
3200
|
}
|
|
2201
3201
|
});
|
|
2202
3202
|
|
|
@@ -2205,7 +3205,6 @@ describe('plugin-meetings', () => {
|
|
|
2205
3205
|
.stub()
|
|
2206
3206
|
.rejects(new PermissionError('bad permission'));
|
|
2207
3207
|
const stateMachineFailSpy = sinon.spy(meeting.meetingFiniteStateMachine, 'fail');
|
|
2208
|
-
const joinMeetingOptionsSpy = sinon.spy(MeetingUtil.joinMeetingOptions);
|
|
2209
3208
|
|
|
2210
3209
|
try {
|
|
2211
3210
|
await meeting.join();
|
|
@@ -2219,14 +3218,14 @@ describe('plugin-meetings', () => {
|
|
|
2219
3218
|
);
|
|
2220
3219
|
assert.instanceOf(error, PermissionError);
|
|
2221
3220
|
assert.equal(error.message, 'bad permission');
|
|
2222
|
-
|
|
2223
|
-
assert.notCalled(joinMeetingOptionsSpy);
|
|
3221
|
+
assert.notCalled(MeetingUtil.joinMeeting);
|
|
2224
3222
|
}
|
|
2225
3223
|
});
|
|
2226
3224
|
});
|
|
2227
3225
|
});
|
|
2228
3226
|
});
|
|
2229
3227
|
|
|
3228
|
+
|
|
2230
3229
|
describe('#addMedia', () => {
|
|
2231
3230
|
const muteStateStub = {
|
|
2232
3231
|
handleClientRequest: sinon.stub().returns(Promise.resolve(true)),
|
|
@@ -2373,9 +3372,11 @@ describe('plugin-meetings', () => {
|
|
|
2373
3372
|
retriedWithTurnServer: false,
|
|
2374
3373
|
isMultistream: false,
|
|
2375
3374
|
isJoinWithMediaRetry: false,
|
|
3375
|
+
iceTransportPolicy: 'all',
|
|
2376
3376
|
signalingState: 'unknown',
|
|
2377
3377
|
connectionState: 'unknown',
|
|
2378
3378
|
iceConnectionState: 'unknown',
|
|
3379
|
+
connectionType: 'udp',
|
|
2379
3380
|
someReachabilityMetric1: 'some value1',
|
|
2380
3381
|
someReachabilityMetric2: 'some value2',
|
|
2381
3382
|
selectedCandidatePairChanges: 2,
|
|
@@ -2501,9 +3502,11 @@ describe('plugin-meetings', () => {
|
|
|
2501
3502
|
retriedWithTurnServer: false,
|
|
2502
3503
|
isMultistream: false,
|
|
2503
3504
|
isJoinWithMediaRetry: false,
|
|
3505
|
+
iceTransportPolicy: 'all',
|
|
2504
3506
|
signalingState: 'unknown',
|
|
2505
3507
|
connectionState: 'unknown',
|
|
2506
3508
|
iceConnectionState: 'unknown',
|
|
3509
|
+
connectionType: 'udp',
|
|
2507
3510
|
someReachabilityMetric1: 'some value1',
|
|
2508
3511
|
someReachabilityMetric2: 'some value2',
|
|
2509
3512
|
selectedCandidatePairChanges: 2,
|
|
@@ -2883,6 +3886,111 @@ describe('plugin-meetings', () => {
|
|
|
2883
3886
|
checkWorking({allowMediaInLobby: true});
|
|
2884
3887
|
});
|
|
2885
3888
|
|
|
3889
|
+
const setupLobbyTest = () => {
|
|
3890
|
+
meeting.roap.doTurnDiscovery = sinon
|
|
3891
|
+
.stub()
|
|
3892
|
+
.resolves({turnServerInfo: undefined, turnDiscoverySkippedReason: undefined});
|
|
3893
|
+
|
|
3894
|
+
meeting.meetingState = 'ACTIVE';
|
|
3895
|
+
meeting.locusInfo.parsedLocus = {self: {state: 'IDLE'}};
|
|
3896
|
+
meeting.isUserUnadmitted = true;
|
|
3897
|
+
|
|
3898
|
+
// Mock locusMediaRequest
|
|
3899
|
+
meeting.locusMediaRequest = {
|
|
3900
|
+
send: sinon.stub().resolves(),
|
|
3901
|
+
isConfluenceCreated: sinon.stub().returns(false),
|
|
3902
|
+
};
|
|
3903
|
+
|
|
3904
|
+
sinon.stub(RemoteMediaManagerModule, 'RemoteMediaManager').returns({
|
|
3905
|
+
start: sinon.stub().resolves(),
|
|
3906
|
+
on: sinon.stub(),
|
|
3907
|
+
logAllReceiveSlots: sinon.stub(),
|
|
3908
|
+
});
|
|
3909
|
+
|
|
3910
|
+
meeting.isMultistream = true;
|
|
3911
|
+
|
|
3912
|
+
const createFakeStream = (id) => ({
|
|
3913
|
+
on: sinon.stub(),
|
|
3914
|
+
off: sinon.stub(),
|
|
3915
|
+
userMuted: false,
|
|
3916
|
+
systemMuted: false,
|
|
3917
|
+
get muted() {
|
|
3918
|
+
return this.userMuted || this.systemMuted;
|
|
3919
|
+
},
|
|
3920
|
+
setUnmuteAllowed: sinon.stub(),
|
|
3921
|
+
setUserMuted: sinon.stub(),
|
|
3922
|
+
outputStream: {
|
|
3923
|
+
getTracks: () => [{id}],
|
|
3924
|
+
},
|
|
3925
|
+
getSettings: sinon.stub().returns({}),
|
|
3926
|
+
});
|
|
3927
|
+
|
|
3928
|
+
return {
|
|
3929
|
+
fakeMicrophoneStream: createFakeStream('fake mic'),
|
|
3930
|
+
fakeCameraStream: createFakeStream('fake camera'),
|
|
3931
|
+
};
|
|
3932
|
+
};
|
|
3933
|
+
|
|
3934
|
+
it('should not publish any local streams when in the lobby and allowPublishMediaInLobby is false', async () => {
|
|
3935
|
+
const {fakeMicrophoneStream, fakeCameraStream} = setupLobbyTest();
|
|
3936
|
+
|
|
3937
|
+
const publishStreamStub = sinon.stub();
|
|
3938
|
+
fakeMediaConnection.createSendSlot = sinon.stub().returns({
|
|
3939
|
+
publishStream: publishStreamStub,
|
|
3940
|
+
unpublishStream: sinon.stub(),
|
|
3941
|
+
setNamedMediaGroups: sinon.stub(),
|
|
3942
|
+
});
|
|
3943
|
+
|
|
3944
|
+
await meeting.addMedia({
|
|
3945
|
+
allowMediaInLobby: true,
|
|
3946
|
+
allowPublishMediaInLobby: false,
|
|
3947
|
+
audioEnabled: true,
|
|
3948
|
+
videoEnabled: true,
|
|
3949
|
+
localStreams: {
|
|
3950
|
+
microphone: fakeMicrophoneStream,
|
|
3951
|
+
camera: fakeCameraStream,
|
|
3952
|
+
},
|
|
3953
|
+
});
|
|
3954
|
+
|
|
3955
|
+
assert.notCalled(publishStreamStub);
|
|
3956
|
+
});
|
|
3957
|
+
|
|
3958
|
+
it('should publish local streams when in the lobby and allowPublishMediaInLobby is true', async () => {
|
|
3959
|
+
const {fakeMicrophoneStream, fakeCameraStream} = setupLobbyTest();
|
|
3960
|
+
|
|
3961
|
+
const audioSlot = {
|
|
3962
|
+
publishStream: sinon.stub(),
|
|
3963
|
+
unpublishStream: sinon.stub(),
|
|
3964
|
+
setNamedMediaGroups: sinon.stub(),
|
|
3965
|
+
};
|
|
3966
|
+
const videoSlot = {
|
|
3967
|
+
publishStream: sinon.stub(),
|
|
3968
|
+
unpublishStream: sinon.stub(),
|
|
3969
|
+
setNamedMediaGroups: sinon.stub(),
|
|
3970
|
+
};
|
|
3971
|
+
|
|
3972
|
+
fakeMediaConnection.createSendSlot = sinon.stub().callsFake((mediaType) => {
|
|
3973
|
+
if (mediaType === 'AUDIO-MAIN') {
|
|
3974
|
+
return audioSlot;
|
|
3975
|
+
}
|
|
3976
|
+
return videoSlot;
|
|
3977
|
+
});
|
|
3978
|
+
|
|
3979
|
+
await meeting.addMedia({
|
|
3980
|
+
allowMediaInLobby: true,
|
|
3981
|
+
allowPublishMediaInLobby: true,
|
|
3982
|
+
audioEnabled: true,
|
|
3983
|
+
videoEnabled: true,
|
|
3984
|
+
localStreams: {
|
|
3985
|
+
microphone: fakeMicrophoneStream,
|
|
3986
|
+
camera: fakeCameraStream,
|
|
3987
|
+
},
|
|
3988
|
+
});
|
|
3989
|
+
|
|
3990
|
+
assert.calledOnceWithExactly(audioSlot.publishStream, fakeMicrophoneStream);
|
|
3991
|
+
assert.calledOnceWithExactly(videoSlot.publishStream, fakeCameraStream);
|
|
3992
|
+
});
|
|
3993
|
+
|
|
2886
3994
|
it('should create rtcMetrics and pass them to Media.createMediaConnection()', async () => {
|
|
2887
3995
|
const setIntervalOriginal = window.setInterval;
|
|
2888
3996
|
window.setInterval = sinon.stub().returns(1);
|
|
@@ -3147,50 +4255,215 @@ describe('plugin-meetings', () => {
|
|
|
3147
4255
|
assert.deepEqual(sendBehavioralMetricCalls[1].args, [
|
|
3148
4256
|
BEHAVIORAL_METRICS.TURN_DISCOVERY_LATENCY,
|
|
3149
4257
|
{
|
|
3150
|
-
correlation_id: meeting.correlationId,
|
|
3151
|
-
turnServerUsed: true,
|
|
3152
|
-
retriedWithTurnServer: true,
|
|
3153
|
-
latency: undefined,
|
|
4258
|
+
correlation_id: meeting.correlationId,
|
|
4259
|
+
turnServerUsed: true,
|
|
4260
|
+
retriedWithTurnServer: true,
|
|
4261
|
+
latency: undefined,
|
|
4262
|
+
},
|
|
4263
|
+
]);
|
|
4264
|
+
assert.deepEqual(sendBehavioralMetricCalls[2].args, [
|
|
4265
|
+
BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE,
|
|
4266
|
+
{
|
|
4267
|
+
correlation_id: meeting.correlationId,
|
|
4268
|
+
locus_id: meeting.locusUrl.split('/').pop(),
|
|
4269
|
+
reason: errorThrown.message,
|
|
4270
|
+
stack: errorThrown.stack,
|
|
4271
|
+
code: errorThrown.code,
|
|
4272
|
+
turnDiscoverySkippedReason: undefined,
|
|
4273
|
+
turnServerUsed: true,
|
|
4274
|
+
retriedWithTurnServer: true,
|
|
4275
|
+
isMultistream: false,
|
|
4276
|
+
isJoinWithMediaRetry: false,
|
|
4277
|
+
iceTransportPolicy: 'all',
|
|
4278
|
+
signalingState: 'unknown',
|
|
4279
|
+
connectionState: 'unknown',
|
|
4280
|
+
iceConnectionState: 'unknown',
|
|
4281
|
+
connectionType: 'udp',
|
|
4282
|
+
selectedCandidatePairChanges: 2,
|
|
4283
|
+
numTransports: 1,
|
|
4284
|
+
iceCandidatesCount: 0,
|
|
4285
|
+
subnet_reachable: null,
|
|
4286
|
+
selected_cluster: null,
|
|
4287
|
+
selected_subnet: null,
|
|
4288
|
+
ipver: 1,
|
|
4289
|
+
},
|
|
4290
|
+
]);
|
|
4291
|
+
|
|
4292
|
+
// Check that doTurnDiscovery is called with th4 correct value of isForced
|
|
4293
|
+
const doTurnDiscoveryCalls = meeting.roap.doTurnDiscovery.getCalls();
|
|
4294
|
+
assert.equal(doTurnDiscoveryCalls.length, 2);
|
|
4295
|
+
assert.deepEqual(doTurnDiscoveryCalls[0].args, [meeting, false, false]);
|
|
4296
|
+
assert.deepEqual(doTurnDiscoveryCalls[1].args.slice(1), [true, true]);
|
|
4297
|
+
|
|
4298
|
+
// Some clean up steps happens twice
|
|
4299
|
+
assert.calledTwice(forceRtcMetricsSend);
|
|
4300
|
+
assert.calledTwice(closeMediaConnectionStub);
|
|
4301
|
+
assert.isNull(meeting.mediaProperties.webrtcMediaConnection);
|
|
4302
|
+
|
|
4303
|
+
assert.isOk(errorThrown);
|
|
4304
|
+
});
|
|
4305
|
+
|
|
4306
|
+
[
|
|
4307
|
+
{iceConnected: true, title: 'iceConnected=true'},
|
|
4308
|
+
{iceConnected: false, title: 'iceConnected=false'},
|
|
4309
|
+
].forEach(({iceConnected, title}) => {
|
|
4310
|
+
it(`should propagate ${title} from waitForMediaConnectionConnected rejection to AddMediaFailed`, async () => {
|
|
4311
|
+
webex.meetings.reachability = {
|
|
4312
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4313
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4314
|
+
stopReachability: sinon.stub(),
|
|
4315
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4316
|
+
};
|
|
4317
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4318
|
+
sinon.stub().returns({fatal: true});
|
|
4319
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4320
|
+
|
|
4321
|
+
meeting.meetingState = 'ACTIVE';
|
|
4322
|
+
const rejectedResult = {iceConnected};
|
|
4323
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
4324
|
+
.stub()
|
|
4325
|
+
.rejects(rejectedResult);
|
|
4326
|
+
|
|
4327
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4328
|
+
turnServerInfo: {urls: ['turns:fake:443'], username: 'u', password: 'p'},
|
|
4329
|
+
turnDiscoverySkippedReason: undefined,
|
|
4330
|
+
});
|
|
4331
|
+
|
|
4332
|
+
const forceRtcMetricsSend = sinon.stub().resolves();
|
|
4333
|
+
Media.createMediaConnection = sinon.stub().returns({
|
|
4334
|
+
close: sinon.stub(),
|
|
4335
|
+
forceRtcMetricsSend,
|
|
4336
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4337
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4338
|
+
on: sinon.stub(),
|
|
4339
|
+
});
|
|
4340
|
+
|
|
4341
|
+
let thrownError;
|
|
4342
|
+
await meeting.addMedia({mediaSettings: {}}).catch((err) => {
|
|
4343
|
+
thrownError = err;
|
|
4344
|
+
});
|
|
4345
|
+
|
|
4346
|
+
assert.instanceOf(thrownError, AddMediaFailed);
|
|
4347
|
+
assert.equal(thrownError.iceConnected, iceConnected);
|
|
4348
|
+
// the AddMediaFailed cause should be the MediaConnectionTimedOutError, which in turn should
|
|
4349
|
+
// preserve the original rejected result as its cause, so that the web client
|
|
4350
|
+
// can find the CA-reported error in the eventErrorCache via the cause chain
|
|
4351
|
+
assert.instanceOf(thrownError.cause, MediaConnectionTimedOutError);
|
|
4352
|
+
assert.equal(thrownError.cause.cause, rejectedResult);
|
|
4353
|
+
});
|
|
4354
|
+
});
|
|
4355
|
+
|
|
4356
|
+
describe('iceTransportPolicy=relay handling', () => {
|
|
4357
|
+
let createMediaConnectionStub;
|
|
4358
|
+
|
|
4359
|
+
beforeEach(() => {
|
|
4360
|
+
webex.meetings.reachability = {
|
|
4361
|
+
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
4362
|
+
isAnyClusterReachableViaProtocol: sinon.stub().resolves(true),
|
|
4363
|
+
getReachabilityMetrics: sinon.stub().resolves({}),
|
|
4364
|
+
stopReachability: sinon.stub(),
|
|
4365
|
+
isSubnetReachable: sinon.stub().returns(true),
|
|
4366
|
+
};
|
|
4367
|
+
webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode =
|
|
4368
|
+
sinon.stub().returns({fatal: true});
|
|
4369
|
+
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4370
|
+
|
|
4371
|
+
meeting.meetingState = 'ACTIVE';
|
|
4372
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().resolves();
|
|
4373
|
+
|
|
4374
|
+
createMediaConnectionStub = sinon.stub().returns({
|
|
4375
|
+
close: sinon.stub(),
|
|
4376
|
+
forceRtcMetricsSend: sinon.stub().resolves(),
|
|
4377
|
+
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
4378
|
+
initiateOffer: sinon.stub().resolves({}),
|
|
4379
|
+
on: sinon.stub(),
|
|
4380
|
+
});
|
|
4381
|
+
Media.createMediaConnection = createMediaConnectionStub;
|
|
4382
|
+
});
|
|
4383
|
+
|
|
4384
|
+
[
|
|
4385
|
+
{
|
|
4386
|
+
title: 'should drop iceTransportPolicy=relay when TURN discovery returns no turn server info',
|
|
4387
|
+
turnServerInfo: undefined,
|
|
4388
|
+
turnDiscoverySkippedReason: 'reachability',
|
|
3154
4389
|
},
|
|
3155
|
-
]);
|
|
3156
|
-
assert.deepEqual(sendBehavioralMetricCalls[2].args, [
|
|
3157
|
-
BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE,
|
|
3158
4390
|
{
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
reason: errorThrown.message,
|
|
3162
|
-
stack: errorThrown.stack,
|
|
3163
|
-
code: errorThrown.code,
|
|
4391
|
+
title: 'should drop iceTransportPolicy=relay when TURN discovery returns turnServerInfo with empty urls',
|
|
4392
|
+
turnServerInfo: {urls: [], username: 'u', password: 'p'},
|
|
3164
4393
|
turnDiscoverySkippedReason: undefined,
|
|
3165
|
-
turnServerUsed: true,
|
|
3166
|
-
retriedWithTurnServer: true,
|
|
3167
|
-
isMultistream: false,
|
|
3168
|
-
isJoinWithMediaRetry: false,
|
|
3169
|
-
signalingState: 'unknown',
|
|
3170
|
-
connectionState: 'unknown',
|
|
3171
|
-
iceConnectionState: 'unknown',
|
|
3172
|
-
selectedCandidatePairChanges: 2,
|
|
3173
|
-
numTransports: 1,
|
|
3174
|
-
iceCandidatesCount: 0,
|
|
3175
|
-
subnet_reachable: null,
|
|
3176
|
-
selected_cluster: null,
|
|
3177
|
-
selected_subnet: null,
|
|
3178
|
-
ipver: 1,
|
|
3179
4394
|
},
|
|
3180
|
-
])
|
|
4395
|
+
].forEach(({title, turnServerInfo, turnDiscoverySkippedReason}) => {
|
|
4396
|
+
it(title, async () => {
|
|
4397
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4398
|
+
turnServerInfo,
|
|
4399
|
+
turnDiscoverySkippedReason,
|
|
4400
|
+
});
|
|
3181
4401
|
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
4402
|
+
await meeting.addMediaInternal(
|
|
4403
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4404
|
+
false,
|
|
4405
|
+
undefined,
|
|
4406
|
+
'relay',
|
|
4407
|
+
{mediaSettings: {}}
|
|
4408
|
+
);
|
|
3187
4409
|
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
assert.isNull(meeting.mediaProperties.webrtcMediaConnection);
|
|
4410
|
+
assert.calledOnce(createMediaConnectionStub);
|
|
4411
|
+
const config = createMediaConnectionStub.firstCall.args[3];
|
|
4412
|
+
assert.isUndefined(config.iceTransportPolicy);
|
|
3192
4413
|
|
|
3193
|
-
|
|
4414
|
+
const successCall = Metrics.sendBehavioralMetric.getCalls().find(
|
|
4415
|
+
(call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS
|
|
4416
|
+
);
|
|
4417
|
+
assert.isDefined(successCall);
|
|
4418
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'all');
|
|
4419
|
+
});
|
|
4420
|
+
});
|
|
4421
|
+
|
|
4422
|
+
it('should send ADD_MEDIA_SUCCESS metric with iceTransportPolicy=relay when relay is used', async () => {
|
|
4423
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4424
|
+
turnServerInfo: {urls: ['turns:turn-server:443?transport=tcp'], username: 'u', password: 'p'},
|
|
4425
|
+
turnDiscoverySkippedReason: undefined,
|
|
4426
|
+
});
|
|
4427
|
+
|
|
4428
|
+
await meeting.addMediaInternal(
|
|
4429
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4430
|
+
false,
|
|
4431
|
+
undefined,
|
|
4432
|
+
'relay',
|
|
4433
|
+
{mediaSettings: {}}
|
|
4434
|
+
);
|
|
4435
|
+
|
|
4436
|
+
const successCall = Metrics.sendBehavioralMetric.getCalls().find(
|
|
4437
|
+
(call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_SUCCESS
|
|
4438
|
+
);
|
|
4439
|
+
assert.isDefined(successCall);
|
|
4440
|
+
assert.equal(successCall.args[1].iceTransportPolicy, 'relay');
|
|
4441
|
+
});
|
|
4442
|
+
|
|
4443
|
+
it('should send ADD_MEDIA_FAILURE metric with iceTransportPolicy=relay when relay attempt fails', async () => {
|
|
4444
|
+
meeting.roap.doTurnDiscovery = sinon.stub().returns({
|
|
4445
|
+
turnServerInfo: {urls: ['turns:turn-server:443?transport=tcp'], username: 'u', password: 'p'},
|
|
4446
|
+
turnDiscoverySkippedReason: undefined,
|
|
4447
|
+
});
|
|
4448
|
+
|
|
4449
|
+
meeting.mediaProperties.waitForMediaConnectionConnected = sinon.stub().rejects(
|
|
4450
|
+
new MediaConnectionTimedOutError('timed out', true)
|
|
4451
|
+
);
|
|
4452
|
+
|
|
4453
|
+
await assert.isRejected(meeting.addMediaInternal(
|
|
4454
|
+
() => 'JOIN_MEETING_FINAL',
|
|
4455
|
+
false,
|
|
4456
|
+
undefined,
|
|
4457
|
+
'relay',
|
|
4458
|
+
{mediaSettings: {}}
|
|
4459
|
+
));
|
|
4460
|
+
|
|
4461
|
+
const failureCall = Metrics.sendBehavioralMetric.getCalls().find(
|
|
4462
|
+
(call) => call.args[0] === BEHAVIORAL_METRICS.ADD_MEDIA_FAILURE
|
|
4463
|
+
);
|
|
4464
|
+
assert.isDefined(failureCall);
|
|
4465
|
+
assert.equal(failureCall.args[1].iceTransportPolicy, 'relay');
|
|
4466
|
+
});
|
|
3194
4467
|
});
|
|
3195
4468
|
|
|
3196
4469
|
it('should resolve if waitForMediaConnectionConnected() rejects the first time but resolves the second time', async () => {
|
|
@@ -3382,6 +4655,7 @@ describe('plugin-meetings', () => {
|
|
|
3382
4655
|
isMultistream: false,
|
|
3383
4656
|
retriedWithTurnServer: true,
|
|
3384
4657
|
isJoinWithMediaRetry: false,
|
|
4658
|
+
iceTransportPolicy: 'all',
|
|
3385
4659
|
iceCandidatesCount: 0,
|
|
3386
4660
|
subnet_reachable: null,
|
|
3387
4661
|
selected_cluster: null,
|
|
@@ -3545,6 +4819,7 @@ describe('plugin-meetings', () => {
|
|
|
3545
4819
|
isMultistream: false,
|
|
3546
4820
|
retriedWithTurnServer: false,
|
|
3547
4821
|
isJoinWithMediaRetry: false,
|
|
4822
|
+
iceTransportPolicy: 'all',
|
|
3548
4823
|
someReachabilityMetric1: 'some value1',
|
|
3549
4824
|
someReachabilityMetric2: 'some value2',
|
|
3550
4825
|
iceCandidatesCount: 3,
|
|
@@ -3610,9 +4885,11 @@ describe('plugin-meetings', () => {
|
|
|
3610
4885
|
retriedWithTurnServer: false,
|
|
3611
4886
|
isMultistream: false,
|
|
3612
4887
|
isJoinWithMediaRetry: false,
|
|
4888
|
+
iceTransportPolicy: 'all',
|
|
3613
4889
|
signalingState: 'unknown',
|
|
3614
4890
|
connectionState: 'unknown',
|
|
3615
4891
|
iceConnectionState: 'unknown',
|
|
4892
|
+
connectionType: 'udp',
|
|
3616
4893
|
selectedCandidatePairChanges: 2,
|
|
3617
4894
|
numTransports: 1,
|
|
3618
4895
|
subnet_reachable: null,
|
|
@@ -3673,9 +4950,11 @@ describe('plugin-meetings', () => {
|
|
|
3673
4950
|
retriedWithTurnServer: false,
|
|
3674
4951
|
isMultistream: false,
|
|
3675
4952
|
isJoinWithMediaRetry: false,
|
|
4953
|
+
iceTransportPolicy: 'all',
|
|
3676
4954
|
signalingState: 'unknown',
|
|
3677
4955
|
connectionState: 'unknown',
|
|
3678
4956
|
iceConnectionState: 'unknown',
|
|
4957
|
+
connectionType: 'udp',
|
|
3679
4958
|
selectedCandidatePairChanges: 2,
|
|
3680
4959
|
numTransports: 1,
|
|
3681
4960
|
'701_error': 2,
|
|
@@ -3737,6 +5016,7 @@ describe('plugin-meetings', () => {
|
|
|
3737
5016
|
isMultistream: false,
|
|
3738
5017
|
retriedWithTurnServer: false,
|
|
3739
5018
|
isJoinWithMediaRetry: false,
|
|
5019
|
+
iceTransportPolicy: 'all',
|
|
3740
5020
|
iceCandidatesCount: 0,
|
|
3741
5021
|
reachability_public_udp_success: 5,
|
|
3742
5022
|
subnet_reachable: false,
|
|
@@ -3802,9 +5082,11 @@ describe('plugin-meetings', () => {
|
|
|
3802
5082
|
retriedWithTurnServer: false,
|
|
3803
5083
|
isMultistream: false,
|
|
3804
5084
|
isJoinWithMediaRetry: false,
|
|
5085
|
+
iceTransportPolicy: 'all',
|
|
3805
5086
|
signalingState: 'unknown',
|
|
3806
5087
|
connectionState: 'unknown',
|
|
3807
5088
|
iceConnectionState: 'unknown',
|
|
5089
|
+
connectionType: 'udp',
|
|
3808
5090
|
selectedCandidatePairChanges: 2,
|
|
3809
5091
|
numTransports: 1,
|
|
3810
5092
|
reachability_public_udp_success: 5,
|
|
@@ -4188,6 +5470,297 @@ describe('plugin-meetings', () => {
|
|
|
4188
5470
|
},
|
|
4189
5471
|
});
|
|
4190
5472
|
});
|
|
5473
|
+
|
|
5474
|
+
describe('handles STATS_UPDATE event for SRTP cipher detection', () => {
|
|
5475
|
+
it('emits MEETING_SRTP_CIPHER_UPDATED event when srtpCipher is found in transport stats', async () => {
|
|
5476
|
+
const fakeStats = new Map([
|
|
5477
|
+
[
|
|
5478
|
+
'transport-1',
|
|
5479
|
+
{
|
|
5480
|
+
type: 'transport',
|
|
5481
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5482
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5483
|
+
},
|
|
5484
|
+
],
|
|
5485
|
+
[
|
|
5486
|
+
'outbound-rtp-1',
|
|
5487
|
+
{
|
|
5488
|
+
type: 'outbound-rtp',
|
|
5489
|
+
ssrc: 12345,
|
|
5490
|
+
},
|
|
5491
|
+
],
|
|
5492
|
+
]);
|
|
5493
|
+
|
|
5494
|
+
statsAnalyzerStub.emit(
|
|
5495
|
+
{file: 'test', function: 'test'},
|
|
5496
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5497
|
+
{stats: fakeStats}
|
|
5498
|
+
);
|
|
5499
|
+
|
|
5500
|
+
assert.calledWith(
|
|
5501
|
+
TriggerProxy.trigger,
|
|
5502
|
+
sinon.match.instanceOf(Meeting),
|
|
5503
|
+
{
|
|
5504
|
+
file: 'meeting/index',
|
|
5505
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5506
|
+
},
|
|
5507
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5508
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
5509
|
+
);
|
|
5510
|
+
|
|
5511
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5512
|
+
});
|
|
5513
|
+
|
|
5514
|
+
it('updates meeting.mediaProperties.srtpCipher when cipher changes', async () => {
|
|
5515
|
+
const firstStats = new Map([
|
|
5516
|
+
[
|
|
5517
|
+
'transport-1',
|
|
5518
|
+
{
|
|
5519
|
+
type: 'transport',
|
|
5520
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5521
|
+
},
|
|
5522
|
+
],
|
|
5523
|
+
]);
|
|
5524
|
+
|
|
5525
|
+
statsAnalyzerStub.emit(
|
|
5526
|
+
{file: 'test', function: 'test'},
|
|
5527
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5528
|
+
{stats: firstStats}
|
|
5529
|
+
);
|
|
5530
|
+
|
|
5531
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5532
|
+
|
|
5533
|
+
const secondStats = new Map([
|
|
5534
|
+
[
|
|
5535
|
+
'transport-1',
|
|
5536
|
+
{
|
|
5537
|
+
type: 'transport',
|
|
5538
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5539
|
+
},
|
|
5540
|
+
],
|
|
5541
|
+
]);
|
|
5542
|
+
|
|
5543
|
+
TriggerProxy.trigger.resetHistory();
|
|
5544
|
+
|
|
5545
|
+
statsAnalyzerStub.emit(
|
|
5546
|
+
{file: 'test', function: 'test'},
|
|
5547
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5548
|
+
{stats: secondStats}
|
|
5549
|
+
);
|
|
5550
|
+
|
|
5551
|
+
assert.calledWith(
|
|
5552
|
+
TriggerProxy.trigger,
|
|
5553
|
+
sinon.match.instanceOf(Meeting),
|
|
5554
|
+
{
|
|
5555
|
+
file: 'meeting/index',
|
|
5556
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5557
|
+
},
|
|
5558
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5559
|
+
{srtpCipher: 'AEAD_AES_256_GCM'}
|
|
5560
|
+
);
|
|
5561
|
+
|
|
5562
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AEAD_AES_256_GCM');
|
|
5563
|
+
});
|
|
5564
|
+
|
|
5565
|
+
it('does not emit event when srtpCipher has not changed', async () => {
|
|
5566
|
+
const firstStats = new Map([
|
|
5567
|
+
[
|
|
5568
|
+
'transport-1',
|
|
5569
|
+
{
|
|
5570
|
+
type: 'transport',
|
|
5571
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5572
|
+
},
|
|
5573
|
+
],
|
|
5574
|
+
]);
|
|
5575
|
+
|
|
5576
|
+
statsAnalyzerStub.emit(
|
|
5577
|
+
{file: 'test', function: 'test'},
|
|
5578
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5579
|
+
{stats: firstStats}
|
|
5580
|
+
);
|
|
5581
|
+
|
|
5582
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5583
|
+
|
|
5584
|
+
TriggerProxy.trigger.resetHistory();
|
|
5585
|
+
|
|
5586
|
+
// Emit same cipher again
|
|
5587
|
+
statsAnalyzerStub.emit(
|
|
5588
|
+
{file: 'test', function: 'test'},
|
|
5589
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5590
|
+
{stats: firstStats}
|
|
5591
|
+
);
|
|
5592
|
+
|
|
5593
|
+
// Should not trigger event again
|
|
5594
|
+
assert.neverCalledWith(
|
|
5595
|
+
TriggerProxy.trigger,
|
|
5596
|
+
sinon.match.instanceOf(Meeting),
|
|
5597
|
+
sinon.match.any,
|
|
5598
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5599
|
+
sinon.match.any
|
|
5600
|
+
);
|
|
5601
|
+
|
|
5602
|
+
// Cipher should remain the same
|
|
5603
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5604
|
+
});
|
|
5605
|
+
|
|
5606
|
+
it('does not emit event when stats contain no transport with srtpCipher', async () => {
|
|
5607
|
+
const fakeStats = new Map([
|
|
5608
|
+
[
|
|
5609
|
+
'outbound-rtp-1',
|
|
5610
|
+
{
|
|
5611
|
+
type: 'outbound-rtp',
|
|
5612
|
+
ssrc: 12345,
|
|
5613
|
+
},
|
|
5614
|
+
],
|
|
5615
|
+
[
|
|
5616
|
+
'inbound-rtp-1',
|
|
5617
|
+
{
|
|
5618
|
+
type: 'inbound-rtp',
|
|
5619
|
+
ssrc: 67890,
|
|
5620
|
+
},
|
|
5621
|
+
],
|
|
5622
|
+
]);
|
|
5623
|
+
|
|
5624
|
+
statsAnalyzerStub.emit(
|
|
5625
|
+
{file: 'test', function: 'test'},
|
|
5626
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5627
|
+
{stats: fakeStats}
|
|
5628
|
+
);
|
|
5629
|
+
|
|
5630
|
+
assert.neverCalledWith(
|
|
5631
|
+
TriggerProxy.trigger,
|
|
5632
|
+
sinon.match.instanceOf(Meeting),
|
|
5633
|
+
sinon.match.any,
|
|
5634
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5635
|
+
sinon.match.any
|
|
5636
|
+
);
|
|
5637
|
+
|
|
5638
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5639
|
+
});
|
|
5640
|
+
|
|
5641
|
+
it('does not emit event when transport stat has no srtpCipher property', async () => {
|
|
5642
|
+
const fakeStats = new Map([
|
|
5643
|
+
[
|
|
5644
|
+
'transport-1',
|
|
5645
|
+
{
|
|
5646
|
+
type: 'transport',
|
|
5647
|
+
dtlsCipher: 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
|
|
5648
|
+
// no srtpCipher property
|
|
5649
|
+
},
|
|
5650
|
+
],
|
|
5651
|
+
]);
|
|
5652
|
+
|
|
5653
|
+
statsAnalyzerStub.emit(
|
|
5654
|
+
{file: 'test', function: 'test'},
|
|
5655
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5656
|
+
{stats: fakeStats}
|
|
5657
|
+
);
|
|
5658
|
+
|
|
5659
|
+
assert.neverCalledWith(
|
|
5660
|
+
TriggerProxy.trigger,
|
|
5661
|
+
sinon.match.instanceOf(Meeting),
|
|
5662
|
+
sinon.match.any,
|
|
5663
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5664
|
+
sinon.match.any
|
|
5665
|
+
);
|
|
5666
|
+
|
|
5667
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5668
|
+
});
|
|
5669
|
+
|
|
5670
|
+
it('uses first transport with srtpCipher when multiple transports exist', async () => {
|
|
5671
|
+
const fakeStats = new Map([
|
|
5672
|
+
[
|
|
5673
|
+
'transport-1',
|
|
5674
|
+
{
|
|
5675
|
+
type: 'transport',
|
|
5676
|
+
srtpCipher: 'AES_CM_128_HMAC_SHA1_80',
|
|
5677
|
+
},
|
|
5678
|
+
],
|
|
5679
|
+
[
|
|
5680
|
+
'transport-2',
|
|
5681
|
+
{
|
|
5682
|
+
type: 'transport',
|
|
5683
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5684
|
+
},
|
|
5685
|
+
],
|
|
5686
|
+
[
|
|
5687
|
+
'outbound-rtp-1',
|
|
5688
|
+
{
|
|
5689
|
+
type: 'outbound-rtp',
|
|
5690
|
+
ssrc: 12345,
|
|
5691
|
+
},
|
|
5692
|
+
],
|
|
5693
|
+
]);
|
|
5694
|
+
|
|
5695
|
+
statsAnalyzerStub.emit(
|
|
5696
|
+
{file: 'test', function: 'test'},
|
|
5697
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5698
|
+
{stats: fakeStats}
|
|
5699
|
+
);
|
|
5700
|
+
|
|
5701
|
+
assert.calledWith(
|
|
5702
|
+
TriggerProxy.trigger,
|
|
5703
|
+
sinon.match.instanceOf(Meeting),
|
|
5704
|
+
{
|
|
5705
|
+
file: 'meeting/index',
|
|
5706
|
+
function: 'setupStatsAnalyzerEventHandlers',
|
|
5707
|
+
},
|
|
5708
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5709
|
+
{srtpCipher: 'AES_CM_128_HMAC_SHA1_80'}
|
|
5710
|
+
);
|
|
5711
|
+
|
|
5712
|
+
assert.equal(meeting.mediaProperties.srtpCipher, 'AES_CM_128_HMAC_SHA1_80');
|
|
5713
|
+
});
|
|
5714
|
+
|
|
5715
|
+
it('handles empty stats map without errors', async () => {
|
|
5716
|
+
const emptyStats = new Map();
|
|
5717
|
+
|
|
5718
|
+
statsAnalyzerStub.emit(
|
|
5719
|
+
{file: 'test', function: 'test'},
|
|
5720
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5721
|
+
{stats: emptyStats}
|
|
5722
|
+
);
|
|
5723
|
+
|
|
5724
|
+
assert.neverCalledWith(
|
|
5725
|
+
TriggerProxy.trigger,
|
|
5726
|
+
sinon.match.instanceOf(Meeting),
|
|
5727
|
+
sinon.match.any,
|
|
5728
|
+
EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
|
|
5729
|
+
sinon.match.any
|
|
5730
|
+
);
|
|
5731
|
+
|
|
5732
|
+
assert.isUndefined(meeting.mediaProperties.srtpCipher);
|
|
5733
|
+
});
|
|
5734
|
+
|
|
5735
|
+
it('logs cipher change when cipher is updated', async () => {
|
|
5736
|
+
const loggerSpy = sinon.spy(LoggerProxy.logger, 'info');
|
|
5737
|
+
|
|
5738
|
+
meeting.mediaProperties.srtpCipher = 'AES_CM_128_HMAC_SHA1_80';
|
|
5739
|
+
|
|
5740
|
+
const newStats = new Map([
|
|
5741
|
+
[
|
|
5742
|
+
'transport-1',
|
|
5743
|
+
{
|
|
5744
|
+
type: 'transport',
|
|
5745
|
+
srtpCipher: 'AEAD_AES_256_GCM',
|
|
5746
|
+
},
|
|
5747
|
+
],
|
|
5748
|
+
]);
|
|
5749
|
+
|
|
5750
|
+
statsAnalyzerStub.emit(
|
|
5751
|
+
{file: 'test', function: 'test'},
|
|
5752
|
+
StatsAnalyzerEventNames.STATS_UPDATE,
|
|
5753
|
+
{stats: newStats}
|
|
5754
|
+
);
|
|
5755
|
+
|
|
5756
|
+
assert.calledWithMatch(
|
|
5757
|
+
loggerSpy,
|
|
5758
|
+
sinon.match(/SRTP cipher changed from AES_CM_128_HMAC_SHA1_80 to AEAD_AES_256_GCM/)
|
|
5759
|
+
);
|
|
5760
|
+
|
|
5761
|
+
loggerSpy.restore();
|
|
5762
|
+
});
|
|
5763
|
+
});
|
|
4191
5764
|
});
|
|
4192
5765
|
|
|
4193
5766
|
describe('handles StatsMonitor events', () => {
|
|
@@ -5846,13 +7419,14 @@ describe('plugin-meetings', () => {
|
|
|
5846
7419
|
sinon.stub(meeting.locusMediaRequest, 'downgradeFromMultistreamToTranscoded');
|
|
5847
7420
|
});
|
|
5848
7421
|
|
|
5849
|
-
const runCheck = async (turnServerInfo, forceTurnDiscovery) => {
|
|
7422
|
+
const runCheck = async (turnServerInfo, forceTurnDiscovery, iceTransportPolicy) => {
|
|
5850
7423
|
// we're calling addMediaInternal() with mic stream,
|
|
5851
7424
|
// so that we also verify that audioMute, videoMute info is correctly sent to backend
|
|
5852
7425
|
const addMediaPromise = meeting.addMediaInternal(
|
|
5853
7426
|
() => '',
|
|
5854
|
-
turnServerInfo,
|
|
5855
7427
|
forceTurnDiscovery,
|
|
7428
|
+
turnServerInfo,
|
|
7429
|
+
iceTransportPolicy,
|
|
5856
7430
|
{
|
|
5857
7431
|
localStreams: {microphone: fakeMicrophoneStream},
|
|
5858
7432
|
}
|
|
@@ -5906,6 +7480,10 @@ describe('plugin-meetings', () => {
|
|
|
5906
7480
|
// at this point the meeting should have been downgraded to transcoded
|
|
5907
7481
|
assert.equal(meeting.isMultistream, false);
|
|
5908
7482
|
|
|
7483
|
+
// iceTransportPolicy must be reset to undefined on downgrade to transcoded,
|
|
7484
|
+
// otherwise the transcoded retry could gather direct candidates while metrics report relay
|
|
7485
|
+
assert.isUndefined(meeting.addMediaData.iceTransportPolicy);
|
|
7486
|
+
|
|
5909
7487
|
// old stats analyzer stopped and new one created
|
|
5910
7488
|
assert.calledOnce(initialStatsAnalyzer.stopAnalyzer);
|
|
5911
7489
|
assert.calledOnceWithExactly(
|
|
@@ -5996,6 +7574,11 @@ describe('plugin-meetings', () => {
|
|
|
5996
7574
|
true
|
|
5997
7575
|
);
|
|
5998
7576
|
});
|
|
7577
|
+
|
|
7578
|
+
it('resets iceTransportPolicy to undefined when falling back from multistream (relay) to transcoded', async () => {
|
|
7579
|
+
// simulate a relay-only retry falling back to transcoded and verify iceTransportPolicy is reset
|
|
7580
|
+
await runCheck(undefined, false, 'relay');
|
|
7581
|
+
});
|
|
5999
7582
|
});
|
|
6000
7583
|
}
|
|
6001
7584
|
})
|
|
@@ -6073,13 +7656,19 @@ describe('plugin-meetings', () => {
|
|
|
6073
7656
|
meeting.statsAnalyzer = {stopAnalyzer: sinon.stub().resolves()};
|
|
6074
7657
|
meeting.unsetPeerConnections = sinon.stub().returns(true);
|
|
6075
7658
|
meeting.logger.error = sinon.stub().returns(true);
|
|
6076
|
-
meeting.
|
|
7659
|
+
meeting.clearMeetingData = sinon.stub().callsFake(async () => {
|
|
7660
|
+
meeting.audio = null;
|
|
7661
|
+
meeting.video = null;
|
|
7662
|
+
});
|
|
6077
7663
|
webex.internal.voicea.off = sinon.stub().returns(true);
|
|
6078
7664
|
meeting.stopTranscription = sinon.stub();
|
|
6079
7665
|
meeting.transcription = {};
|
|
6080
7666
|
|
|
6081
7667
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
6082
7668
|
webex.internal.llm.off = sinon.stub();
|
|
7669
|
+
webex.internal.mercury.off = sinon.stub();
|
|
7670
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
7671
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
6083
7672
|
|
|
6084
7673
|
// A meeting needs to be joined to leave
|
|
6085
7674
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -6100,9 +7689,68 @@ describe('plugin-meetings', () => {
|
|
|
6100
7689
|
assert.calledOnce(meeting.closePeerConnections);
|
|
6101
7690
|
assert.calledOnce(meeting.unsetRemoteStreams);
|
|
6102
7691
|
assert.calledOnce(meeting.unsetPeerConnections);
|
|
6103
|
-
assert.calledOnce(meeting.
|
|
6104
|
-
|
|
6105
|
-
|
|
7692
|
+
assert.calledOnce(meeting.clearMeetingData);
|
|
7693
|
+
});
|
|
7694
|
+
|
|
7695
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
7696
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
7697
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
7698
|
+
|
|
7699
|
+
await meeting.leave();
|
|
7700
|
+
|
|
7701
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
7702
|
+
// annotation) must be detached before the /leave request so that
|
|
7703
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
7704
|
+
// (per Locus team recommendation).
|
|
7705
|
+
assert.callOrder(
|
|
7706
|
+
webex.internal.llm.off,
|
|
7707
|
+
webex.internal.mercury.off,
|
|
7708
|
+
meeting.stopTranscription,
|
|
7709
|
+
meeting.annotation.deregisterEvents,
|
|
7710
|
+
meeting.meetingRequest.leaveMeeting
|
|
7711
|
+
);
|
|
7712
|
+
assert.calledWithExactly(
|
|
7713
|
+
webex.internal.llm.off,
|
|
7714
|
+
'event:relay.event',
|
|
7715
|
+
meeting.processRelayEvent
|
|
7716
|
+
);
|
|
7717
|
+
assert.calledWithExactly(
|
|
7718
|
+
webex.internal.llm.off,
|
|
7719
|
+
LOCUS_LLM_EVENT,
|
|
7720
|
+
meeting.processLocusLLMEvent
|
|
7721
|
+
);
|
|
7722
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
7723
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
7724
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
7725
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
7726
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
7727
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
7728
|
+
assert.isUndefined(meeting.transcription);
|
|
7729
|
+
});
|
|
7730
|
+
|
|
7731
|
+
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
7732
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
7733
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
7734
|
+
meeting.meetingRequest.leaveMeeting = sinon
|
|
7735
|
+
.stub()
|
|
7736
|
+
.returns(Promise.reject(new Error('leave failed')));
|
|
7737
|
+
|
|
7738
|
+
await meeting.leave().catch(() => {});
|
|
7739
|
+
|
|
7740
|
+
assert.calledWithExactly(
|
|
7741
|
+
webex.internal.llm.off,
|
|
7742
|
+
'event:relay.event',
|
|
7743
|
+
meeting.processRelayEvent
|
|
7744
|
+
);
|
|
7745
|
+
assert.calledWithExactly(
|
|
7746
|
+
webex.internal.llm.off,
|
|
7747
|
+
LOCUS_LLM_EVENT,
|
|
7748
|
+
meeting.processLocusLLMEvent
|
|
7749
|
+
);
|
|
7750
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
7751
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
7752
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
7753
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
6106
7754
|
});
|
|
6107
7755
|
|
|
6108
7756
|
it('should reset call diagnostic latencies correctly', async () => {
|
|
@@ -8103,12 +9751,18 @@ describe('plugin-meetings', () => {
|
|
|
8103
9751
|
meeting.statsAnalyzer = {stopAnalyzer: sinon.stub().resolves()};
|
|
8104
9752
|
meeting.unsetPeerConnections = sinon.stub().returns(true);
|
|
8105
9753
|
meeting.logger.error = sinon.stub().returns(true);
|
|
8106
|
-
meeting.
|
|
9754
|
+
meeting.clearMeetingData = sinon.stub().callsFake(async () => {
|
|
9755
|
+
meeting.audio = null;
|
|
9756
|
+
meeting.video = null;
|
|
9757
|
+
});
|
|
8107
9758
|
meeting.transcription = {};
|
|
8108
9759
|
meeting.stopTranscription = sinon.stub();
|
|
8109
9760
|
|
|
8110
9761
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
8111
9762
|
webex.internal.llm.off = sinon.stub();
|
|
9763
|
+
webex.internal.mercury.off = sinon.stub();
|
|
9764
|
+
meeting.mercuryOnlineHandler = sinon.stub();
|
|
9765
|
+
meeting.mercuryOfflineHandler = sinon.stub();
|
|
8112
9766
|
|
|
8113
9767
|
// A meeting needs to be joined to end
|
|
8114
9768
|
meeting.meetingState = 'ACTIVE';
|
|
@@ -8118,21 +9772,78 @@ describe('plugin-meetings', () => {
|
|
|
8118
9772
|
sandbox.restore();
|
|
8119
9773
|
sandbox = null;
|
|
8120
9774
|
});
|
|
8121
|
-
it('should end the meeting for all and return promise', async () => {
|
|
8122
|
-
const endMeetingForAll = meeting.endMeetingForAll();
|
|
9775
|
+
it('should end the meeting for all and return promise', async () => {
|
|
9776
|
+
const endMeetingForAll = meeting.endMeetingForAll();
|
|
9777
|
+
|
|
9778
|
+
assert.exists(endMeetingForAll.then);
|
|
9779
|
+
await endMeetingForAll;
|
|
9780
|
+
assert.calledOnce(meeting?.meetingRequest?.endMeetingForAll);
|
|
9781
|
+
assert.calledOnce(meeting?.cleanupLocalStreams);
|
|
9782
|
+
assert.calledOnce(meeting?.closeRemoteStreams);
|
|
9783
|
+
assert.calledOnce(meeting?.closePeerConnections);
|
|
9784
|
+
assert.calledOnce(meeting?.unsetRemoteStreams);
|
|
9785
|
+
assert.calledOnce(meeting?.unsetPeerConnections);
|
|
9786
|
+
assert.calledOnce(meeting?.clearMeetingData);
|
|
9787
|
+
});
|
|
9788
|
+
|
|
9789
|
+
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
9790
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
9791
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
9792
|
+
|
|
9793
|
+
await meeting.endMeetingForAll();
|
|
9794
|
+
|
|
9795
|
+
// All llm/mercury consumers (direct listeners, voicea transcription,
|
|
9796
|
+
// annotation) must be detached before the /end request so that
|
|
9797
|
+
// in-flight events do not trigger unnecessary Locus syncs
|
|
9798
|
+
// (per Locus team recommendation).
|
|
9799
|
+
assert.callOrder(
|
|
9800
|
+
webex.internal.llm.off,
|
|
9801
|
+
webex.internal.mercury.off,
|
|
9802
|
+
meeting.stopTranscription,
|
|
9803
|
+
meeting.annotation.deregisterEvents,
|
|
9804
|
+
meeting.meetingRequest.endMeetingForAll
|
|
9805
|
+
);
|
|
9806
|
+
assert.calledWithExactly(
|
|
9807
|
+
webex.internal.llm.off,
|
|
9808
|
+
'event:relay.event',
|
|
9809
|
+
meeting.processRelayEvent
|
|
9810
|
+
);
|
|
9811
|
+
assert.calledWithExactly(
|
|
9812
|
+
webex.internal.llm.off,
|
|
9813
|
+
LOCUS_LLM_EVENT,
|
|
9814
|
+
meeting.processLocusLLMEvent
|
|
9815
|
+
);
|
|
9816
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
9817
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
9818
|
+
assert.isUndefined(meeting.mercuryOnlineHandler);
|
|
9819
|
+
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
9820
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
9821
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
9822
|
+
});
|
|
8123
9823
|
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
assert.calledOnce(meeting?.stopTranscription);
|
|
9824
|
+
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
9825
|
+
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
9826
|
+
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
9827
|
+
meeting.meetingRequest.endMeetingForAll = sinon
|
|
9828
|
+
.stub()
|
|
9829
|
+
.returns(Promise.reject(new Error('end failed')));
|
|
9830
|
+
|
|
9831
|
+
await meeting.endMeetingForAll().catch(() => {});
|
|
8133
9832
|
|
|
8134
|
-
assert.
|
|
8135
|
-
|
|
9833
|
+
assert.calledWithExactly(
|
|
9834
|
+
webex.internal.llm.off,
|
|
9835
|
+
'event:relay.event',
|
|
9836
|
+
meeting.processRelayEvent
|
|
9837
|
+
);
|
|
9838
|
+
assert.calledWithExactly(
|
|
9839
|
+
webex.internal.llm.off,
|
|
9840
|
+
LOCUS_LLM_EVENT,
|
|
9841
|
+
meeting.processLocusLLMEvent
|
|
9842
|
+
);
|
|
9843
|
+
assert.calledWithExactly(webex.internal.mercury.off, ONLINE, onlineHandler);
|
|
9844
|
+
assert.calledWithExactly(webex.internal.mercury.off, OFFLINE, offlineHandler);
|
|
9845
|
+
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
9846
|
+
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8136
9847
|
});
|
|
8137
9848
|
});
|
|
8138
9849
|
|
|
@@ -8869,8 +10580,8 @@ describe('plugin-meetings', () => {
|
|
|
8869
10580
|
const fakeMultistreamRoapMediaConnection = {
|
|
8870
10581
|
createSendSlot: () => {
|
|
8871
10582
|
return {
|
|
8872
|
-
|
|
8873
|
-
|
|
10583
|
+
setCustomCodecParameters: sinon.stub().resolves(),
|
|
10584
|
+
markCustomCodecParametersForDeletion: sinon.stub().resolves(),
|
|
8874
10585
|
};
|
|
8875
10586
|
},
|
|
8876
10587
|
};
|
|
@@ -8893,27 +10604,29 @@ describe('plugin-meetings', () => {
|
|
|
8893
10604
|
}
|
|
8894
10605
|
);
|
|
8895
10606
|
|
|
8896
|
-
it('should set
|
|
10607
|
+
it('should set custom codec parameters when shouldEnableMusicMode is true', async () => {
|
|
8897
10608
|
await meeting.enableMusicMode(true);
|
|
8898
10609
|
assert.calledOnceWithExactly(
|
|
8899
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10610
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters,
|
|
10611
|
+
MediaCodecMimeType.OPUS,
|
|
8900
10612
|
{
|
|
8901
10613
|
maxaveragebitrate: '64000',
|
|
8902
10614
|
maxplaybackrate: '48000',
|
|
8903
10615
|
}
|
|
8904
10616
|
);
|
|
8905
10617
|
assert.notCalled(
|
|
8906
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10618
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion
|
|
8907
10619
|
);
|
|
8908
10620
|
});
|
|
8909
10621
|
|
|
8910
|
-
it('should
|
|
10622
|
+
it('should mark custom codec parameters for deletion when shouldEnableMusicMode is false', async () => {
|
|
8911
10623
|
await meeting.enableMusicMode(false);
|
|
8912
10624
|
assert.calledOnceWithExactly(
|
|
8913
|
-
meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10625
|
+
meeting.sendSlotManager.getSlot(MediaType.AudioMain).markCustomCodecParametersForDeletion,
|
|
10626
|
+
MediaCodecMimeType.OPUS,
|
|
8914
10627
|
['maxaveragebitrate', 'maxplaybackrate']
|
|
8915
10628
|
);
|
|
8916
|
-
assert.notCalled(meeting.sendSlotManager.getSlot(MediaType.AudioMain).
|
|
10629
|
+
assert.notCalled(meeting.sendSlotManager.getSlot(MediaType.AudioMain).setCustomCodecParameters);
|
|
8917
10630
|
});
|
|
8918
10631
|
});
|
|
8919
10632
|
|
|
@@ -9004,7 +10717,10 @@ describe('plugin-meetings', () => {
|
|
|
9004
10717
|
|
|
9005
10718
|
// check that the right things were called by the callback
|
|
9006
10719
|
assert.calledOnceWithExactly(meeting.waitForRemoteSDPAnswer);
|
|
9007
|
-
assert.calledOnceWithExactly(
|
|
10720
|
+
assert.calledOnceWithExactly(
|
|
10721
|
+
meeting.mediaProperties.waitForMediaConnectionConnected,
|
|
10722
|
+
meeting.correlationId
|
|
10723
|
+
);
|
|
9008
10724
|
});
|
|
9009
10725
|
});
|
|
9010
10726
|
|
|
@@ -10065,14 +11781,24 @@ describe('plugin-meetings', () => {
|
|
|
10065
11781
|
);
|
|
10066
11782
|
done();
|
|
10067
11783
|
});
|
|
10068
|
-
it('listens to the self admitted guest event', (
|
|
11784
|
+
it('listens to the self admitted guest event and waits for token prefetch before reconnecting LLM', async () => {
|
|
10069
11785
|
meeting.stopKeepAlive = sinon.stub();
|
|
10070
11786
|
meeting.updateLLMConnection = sinon.stub();
|
|
11787
|
+
let resolvePrefetch;
|
|
11788
|
+
|
|
11789
|
+
meeting.ensureDefaultDatachannelTokenAfterAdmit = sinon
|
|
11790
|
+
.stub()
|
|
11791
|
+
.returns(new Promise((resolve) => {
|
|
11792
|
+
resolvePrefetch = resolve;
|
|
11793
|
+
}));
|
|
10071
11794
|
meeting.rtcMetrics = {
|
|
10072
11795
|
sendNextMetrics: sinon.stub(),
|
|
10073
11796
|
};
|
|
11797
|
+
|
|
10074
11798
|
meeting.locusInfo.emit({function: 'test', file: 'test'}, 'SELF_ADMITTED_GUEST', test1);
|
|
11799
|
+
|
|
10075
11800
|
assert.calledOnceWithExactly(meeting.stopKeepAlive);
|
|
11801
|
+
assert.calledOnceWithExactly(meeting.ensureDefaultDatachannelTokenAfterAdmit);
|
|
10076
11802
|
assert.calledThrice(TriggerProxy.trigger);
|
|
10077
11803
|
assert.calledWith(
|
|
10078
11804
|
TriggerProxy.trigger,
|
|
@@ -10081,7 +11807,7 @@ describe('plugin-meetings', () => {
|
|
|
10081
11807
|
'meeting:self:guestAdmitted',
|
|
10082
11808
|
{payload: test1}
|
|
10083
11809
|
);
|
|
10084
|
-
assert.
|
|
11810
|
+
assert.notCalled(meeting.updateLLMConnection);
|
|
10085
11811
|
assert.calledOnceWithExactly(meeting.rtcMetrics.sendNextMetrics);
|
|
10086
11812
|
|
|
10087
11813
|
assert.calledOnceWithExactly(
|
|
@@ -10091,7 +11817,12 @@ describe('plugin-meetings', () => {
|
|
|
10091
11817
|
correlation_id: meeting.correlationId,
|
|
10092
11818
|
}
|
|
10093
11819
|
);
|
|
10094
|
-
|
|
11820
|
+
|
|
11821
|
+
resolvePrefetch(false);
|
|
11822
|
+
await Promise.resolve();
|
|
11823
|
+
await Promise.resolve();
|
|
11824
|
+
|
|
11825
|
+
assert.calledOnce(meeting.updateLLMConnection);
|
|
10095
11826
|
});
|
|
10096
11827
|
|
|
10097
11828
|
it('listens to the breakouts changed event', () => {
|
|
@@ -10178,6 +11909,21 @@ describe('plugin-meetings', () => {
|
|
|
10178
11909
|
EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE
|
|
10179
11910
|
);
|
|
10180
11911
|
});
|
|
11912
|
+
|
|
11913
|
+
it('listens to the self id changed event and updates aiEnableRequest', () => {
|
|
11914
|
+
meeting.aiEnableRequest = {
|
|
11915
|
+
selfParticipantIdUpdate: sinon.stub(),
|
|
11916
|
+
};
|
|
11917
|
+
|
|
11918
|
+
const payload = {selfId: 'participant-test-123'};
|
|
11919
|
+
|
|
11920
|
+
meeting.locusInfo.emit({function: 'test', file: 'test'}, 'SELF_ID_CHANGED', payload);
|
|
11921
|
+
|
|
11922
|
+
assert.calledOnceWithExactly(
|
|
11923
|
+
meeting.aiEnableRequest.selfParticipantIdUpdate,
|
|
11924
|
+
payload.selfId
|
|
11925
|
+
);
|
|
11926
|
+
});
|
|
10181
11927
|
});
|
|
10182
11928
|
|
|
10183
11929
|
describe('#setUpBreakoutsListener', () => {
|
|
@@ -10425,6 +12171,24 @@ describe('plugin-meetings', () => {
|
|
|
10425
12171
|
);
|
|
10426
12172
|
});
|
|
10427
12173
|
|
|
12174
|
+
it('listens to MEETING_CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED', async () => {
|
|
12175
|
+
const aiSummaryNotification = {example: 'value'};
|
|
12176
|
+
|
|
12177
|
+
await meeting.locusInfo.emitScoped(
|
|
12178
|
+
{function: 'test', file: 'test'},
|
|
12179
|
+
LOCUSINFO.EVENTS.CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED,
|
|
12180
|
+
{aiSummaryNotification}
|
|
12181
|
+
);
|
|
12182
|
+
|
|
12183
|
+
assert.calledWith(
|
|
12184
|
+
TriggerProxy.trigger,
|
|
12185
|
+
meeting,
|
|
12186
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12187
|
+
EVENT_TRIGGERS.MEETING_CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED,
|
|
12188
|
+
{aiSummaryNotification}
|
|
12189
|
+
);
|
|
12190
|
+
});
|
|
12191
|
+
|
|
10428
12192
|
it('listens to MEETING_CONTROLS_MEETING_FULL_UPDATED', async () => {
|
|
10429
12193
|
const state = {example: 'value'};
|
|
10430
12194
|
|
|
@@ -10572,6 +12336,92 @@ describe('plugin-meetings', () => {
|
|
|
10572
12336
|
);
|
|
10573
12337
|
});
|
|
10574
12338
|
|
|
12339
|
+
const recordingTestCases = [
|
|
12340
|
+
{
|
|
12341
|
+
description: 'triggers MEETING_STARTED_RECORDING when state is RECORDING',
|
|
12342
|
+
state: RECORDING_STATE.RECORDING,
|
|
12343
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12344
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12345
|
+
},
|
|
12346
|
+
{
|
|
12347
|
+
description: 'triggers MEETING_STOPPED_RECORDING when state is IDLE',
|
|
12348
|
+
state: RECORDING_STATE.IDLE,
|
|
12349
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_STOPPED_RECORDING,
|
|
12350
|
+
expectedRecordingState: RECORDING_STATE.IDLE,
|
|
12351
|
+
},
|
|
12352
|
+
{
|
|
12353
|
+
description: 'triggers MEETING_PAUSED_RECORDING when state is PAUSED',
|
|
12354
|
+
state: RECORDING_STATE.PAUSED,
|
|
12355
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_PAUSED_RECORDING,
|
|
12356
|
+
expectedRecordingState: RECORDING_STATE.PAUSED,
|
|
12357
|
+
},
|
|
12358
|
+
{
|
|
12359
|
+
description:
|
|
12360
|
+
'triggers MEETING_RESUMED_RECORDING and sets state to RECORDING when state is RESUMED',
|
|
12361
|
+
state: RECORDING_STATE.RESUMED,
|
|
12362
|
+
expectedEvent: EVENT_TRIGGERS.MEETING_RESUMED_RECORDING,
|
|
12363
|
+
expectedRecordingState: RECORDING_STATE.RECORDING,
|
|
12364
|
+
},
|
|
12365
|
+
];
|
|
12366
|
+
|
|
12367
|
+
recordingTestCases.forEach(({description, state, expectedEvent, expectedRecordingState}) => {
|
|
12368
|
+
it(`listens to CONTROLS_RECORDING_UPDATED - ${description}`, async () => {
|
|
12369
|
+
const modifiedBy = 'user-id-123';
|
|
12370
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12371
|
+
|
|
12372
|
+
await meeting.locusInfo.emitScoped(
|
|
12373
|
+
{function: 'test', file: 'test'},
|
|
12374
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12375
|
+
{state, modifiedBy, lastModified, modifiedByServiceAppName: undefined, modifiedByServiceAppId: undefined}
|
|
12376
|
+
);
|
|
12377
|
+
|
|
12378
|
+
assert.deepEqual(meeting.recording, {
|
|
12379
|
+
state: expectedRecordingState,
|
|
12380
|
+
modifiedBy,
|
|
12381
|
+
lastModified,
|
|
12382
|
+
modifiedByServiceAppName: undefined,
|
|
12383
|
+
modifiedByServiceAppId: undefined,
|
|
12384
|
+
});
|
|
12385
|
+
|
|
12386
|
+
assert.calledWith(
|
|
12387
|
+
TriggerProxy.trigger,
|
|
12388
|
+
meeting,
|
|
12389
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12390
|
+
expectedEvent,
|
|
12391
|
+
meeting.recording
|
|
12392
|
+
);
|
|
12393
|
+
});
|
|
12394
|
+
});
|
|
12395
|
+
|
|
12396
|
+
it('listens to CONTROLS_RECORDING_UPDATED and includes modifiedByServiceAppName and modifiedByServiceAppId when present', async () => {
|
|
12397
|
+
const modifiedBy = 'user-id-123';
|
|
12398
|
+
const lastModified = '2026-01-01T00:00:00Z';
|
|
12399
|
+
const modifiedByServiceAppName = 'My Bot';
|
|
12400
|
+
const modifiedByServiceAppId = 'app-id-123';
|
|
12401
|
+
|
|
12402
|
+
await meeting.locusInfo.emitScoped(
|
|
12403
|
+
{function: 'test', file: 'test'},
|
|
12404
|
+
LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
|
|
12405
|
+
{state: RECORDING_STATE.RECORDING, modifiedBy, lastModified, modifiedByServiceAppName, modifiedByServiceAppId}
|
|
12406
|
+
);
|
|
12407
|
+
|
|
12408
|
+
assert.deepEqual(meeting.recording, {
|
|
12409
|
+
state: RECORDING_STATE.RECORDING,
|
|
12410
|
+
modifiedBy,
|
|
12411
|
+
lastModified,
|
|
12412
|
+
modifiedByServiceAppName,
|
|
12413
|
+
modifiedByServiceAppId,
|
|
12414
|
+
});
|
|
12415
|
+
|
|
12416
|
+
assert.calledWith(
|
|
12417
|
+
TriggerProxy.trigger,
|
|
12418
|
+
meeting,
|
|
12419
|
+
{file: 'meeting/index', function: 'setupLocusControlsListener'},
|
|
12420
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECORDING,
|
|
12421
|
+
meeting.recording
|
|
12422
|
+
);
|
|
12423
|
+
});
|
|
12424
|
+
|
|
10575
12425
|
it('listens to the locus interpretation update event', () => {
|
|
10576
12426
|
const interpretation = {
|
|
10577
12427
|
siLanguages: [{languageCode: 20, languageName: 'en'}],
|
|
@@ -10625,6 +12475,7 @@ describe('plugin-meetings', () => {
|
|
|
10625
12475
|
meeting.annotation.locusUrlUpdate = sinon.stub();
|
|
10626
12476
|
meeting.simultaneousInterpretation.locusUrlUpdate = sinon.stub();
|
|
10627
12477
|
meeting.webinar.locusUrlUpdate = sinon.stub();
|
|
12478
|
+
meeting.aiEnableRequest.locusUrlUpdate = sinon.stub();
|
|
10628
12479
|
|
|
10629
12480
|
meeting.locusInfo.emit(
|
|
10630
12481
|
{function: 'test', file: 'test'},
|
|
@@ -10639,6 +12490,7 @@ describe('plugin-meetings', () => {
|
|
|
10639
12490
|
assert.calledWith(meeting.controlsOptionsManager.setLocusUrl, newLocusUrl, false);
|
|
10640
12491
|
assert.calledWith(meeting.simultaneousInterpretation.locusUrlUpdate, newLocusUrl);
|
|
10641
12492
|
assert.calledWith(meeting.webinar.locusUrlUpdate, newLocusUrl);
|
|
12493
|
+
assert.calledWith(meeting.aiEnableRequest.locusUrlUpdate, newLocusUrl);
|
|
10642
12494
|
assert.equal(meeting.locusUrl, newLocusUrl);
|
|
10643
12495
|
assert(meeting.locusId, '12345');
|
|
10644
12496
|
|
|
@@ -10697,6 +12549,9 @@ describe('plugin-meetings', () => {
|
|
|
10697
12549
|
meeting.simultaneousInterpretation = {
|
|
10698
12550
|
approvalUrlUpdate: sinon.stub().returns(undefined),
|
|
10699
12551
|
};
|
|
12552
|
+
meeting.aiEnableRequest = {
|
|
12553
|
+
approvalUrlUpdate: sinon.stub().returns(undefined),
|
|
12554
|
+
};
|
|
10700
12555
|
|
|
10701
12556
|
meeting.locusInfo.emit(
|
|
10702
12557
|
{function: 'test', file: 'test'},
|
|
@@ -10716,6 +12571,10 @@ describe('plugin-meetings', () => {
|
|
|
10716
12571
|
meeting.simultaneousInterpretation.approvalUrlUpdate,
|
|
10717
12572
|
newLocusServices.services.approval.url
|
|
10718
12573
|
);
|
|
12574
|
+
assert.calledWith(
|
|
12575
|
+
meeting.aiEnableRequest.approvalUrlUpdate,
|
|
12576
|
+
newLocusServices.services.approval.url
|
|
12577
|
+
);
|
|
10719
12578
|
assert.calledOnce(meeting.recordingController.setSessionId);
|
|
10720
12579
|
done();
|
|
10721
12580
|
});
|
|
@@ -10947,6 +12806,109 @@ describe('plugin-meetings', () => {
|
|
|
10947
12806
|
});
|
|
10948
12807
|
});
|
|
10949
12808
|
|
|
12809
|
+
describe('#finalizeMeetingAfterInitialLocusSetup', () => {
|
|
12810
|
+
it('refreshes destination from synced locus when destination type is LOCUS_ID', () => {
|
|
12811
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12812
|
+
|
|
12813
|
+
meeting.destinationType = DESTINATION_TYPE.LOCUS_ID;
|
|
12814
|
+
meeting.destination = {info: {topic: 'old'}};
|
|
12815
|
+
|
|
12816
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
12817
|
+
|
|
12818
|
+
assert.equal(meeting.destination, syncedLocus);
|
|
12819
|
+
});
|
|
12820
|
+
|
|
12821
|
+
it('does not refresh destination when destination type is not LOCUS_ID', () => {
|
|
12822
|
+
const syncedLocus = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12823
|
+
const originalDestination = {destination: 'original-destination'};
|
|
12824
|
+
|
|
12825
|
+
meeting.destinationType = DESTINATION_TYPE.CONVERSATION_URL;
|
|
12826
|
+
meeting.destination = originalDestination;
|
|
12827
|
+
|
|
12828
|
+
meeting.finalizeMeetingAfterInitialLocusSetup(syncedLocus);
|
|
12829
|
+
|
|
12830
|
+
assert.equal(meeting.destination, originalDestination);
|
|
12831
|
+
});
|
|
12832
|
+
|
|
12833
|
+
it('fetches meeting info when meetingInfo is empty and destination has info', () => {
|
|
12834
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12835
|
+
|
|
12836
|
+
meeting.meetingInfo = {};
|
|
12837
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12838
|
+
|
|
12839
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12840
|
+
|
|
12841
|
+
assert.calledOnceWithExactly(fetchMeetingInfoStub, {});
|
|
12842
|
+
});
|
|
12843
|
+
|
|
12844
|
+
it('does not fetch meeting info when destination has no info', () => {
|
|
12845
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12846
|
+
|
|
12847
|
+
meeting.meetingInfo = {};
|
|
12848
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123'};
|
|
12849
|
+
|
|
12850
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12851
|
+
|
|
12852
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12853
|
+
});
|
|
12854
|
+
|
|
12855
|
+
it('does not fetch meeting info when meetingInfo is already populated', () => {
|
|
12856
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12857
|
+
|
|
12858
|
+
meeting.meetingInfo = {meetingJoinUrl: 'https://example.com/join/abc'};
|
|
12859
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12860
|
+
|
|
12861
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12862
|
+
|
|
12863
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12864
|
+
});
|
|
12865
|
+
|
|
12866
|
+
it('does not fetch meeting info when delayed fetch timer is already scheduled', () => {
|
|
12867
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12868
|
+
|
|
12869
|
+
meeting.meetingInfo = {};
|
|
12870
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12871
|
+
meeting.fetchMeetingInfoTimeoutId = 42;
|
|
12872
|
+
|
|
12873
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12874
|
+
|
|
12875
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12876
|
+
});
|
|
12877
|
+
|
|
12878
|
+
['CALL', 'SIP_BRIDGE', 'SPACE_SHARE'].forEach((fullStateType) => {
|
|
12879
|
+
it(`does not fetch meeting info when destination is a 1:1 call (fullState.type ${fullStateType})`, () => {
|
|
12880
|
+
const fetchMeetingInfoStub = sinon.stub(meeting, 'fetchMeetingInfo').resolves();
|
|
12881
|
+
|
|
12882
|
+
meeting.meetingInfo = {};
|
|
12883
|
+
meeting.destination = {
|
|
12884
|
+
url: 'https://locus.example.com/locus/123',
|
|
12885
|
+
info: {topic: 'x'},
|
|
12886
|
+
};
|
|
12887
|
+
|
|
12888
|
+
meeting.finalizeMeetingAfterInitialLocusSetup({fullState: {type: fullStateType}});
|
|
12889
|
+
|
|
12890
|
+
assert.notCalled(fetchMeetingInfoStub);
|
|
12891
|
+
});
|
|
12892
|
+
});
|
|
12893
|
+
|
|
12894
|
+
it('swallows async fetchMeetingInfo errors and logs info', async () => {
|
|
12895
|
+
const error = new Error('fetch failed');
|
|
12896
|
+
|
|
12897
|
+
meeting.meetingInfo = {};
|
|
12898
|
+
meeting.destination = {url: 'https://locus.example.com/locus/123', info: {topic: 'x'}};
|
|
12899
|
+
sinon.stub(meeting, 'fetchMeetingInfo').returns(Promise.reject(error));
|
|
12900
|
+
const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
|
|
12901
|
+
|
|
12902
|
+
await meeting.finalizeMeetingAfterInitialLocusSetup({});
|
|
12903
|
+
|
|
12904
|
+
assert.calledOnce(loggerInfoStub);
|
|
12905
|
+
assert.match(
|
|
12906
|
+
loggerInfoStub.firstCall.args[0],
|
|
12907
|
+
/Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: fetch failed/
|
|
12908
|
+
);
|
|
12909
|
+
});
|
|
12910
|
+
});
|
|
12911
|
+
|
|
10950
12912
|
describe('#emailInput', () => {
|
|
10951
12913
|
it('should set the email input', () => {
|
|
10952
12914
|
assert.notOk(meeting.emailInput);
|
|
@@ -11121,6 +13083,41 @@ describe('plugin-meetings', () => {
|
|
|
11121
13083
|
});
|
|
11122
13084
|
});
|
|
11123
13085
|
|
|
13086
|
+
describe('localConstraintsChangeHandler', () => {
|
|
13087
|
+
it('calls updatePreferredBitrateKbps when not multistream', () => {
|
|
13088
|
+
meeting.isMultistream = false;
|
|
13089
|
+
meeting.mediaProperties.webrtcMediaConnection = {
|
|
13090
|
+
updatePreferredBitrateKbps: sinon.stub(),
|
|
13091
|
+
};
|
|
13092
|
+
|
|
13093
|
+
meeting.localConstraintsChangeHandler();
|
|
13094
|
+
|
|
13095
|
+
assert.calledOnce(
|
|
13096
|
+
meeting.mediaProperties.webrtcMediaConnection.updatePreferredBitrateKbps
|
|
13097
|
+
);
|
|
13098
|
+
});
|
|
13099
|
+
|
|
13100
|
+
it('does not call updatePreferredBitrateKbps when multistream', () => {
|
|
13101
|
+
meeting.isMultistream = true;
|
|
13102
|
+
meeting.mediaProperties.webrtcMediaConnection = {
|
|
13103
|
+
updatePreferredBitrateKbps: sinon.stub(),
|
|
13104
|
+
};
|
|
13105
|
+
|
|
13106
|
+
meeting.localConstraintsChangeHandler();
|
|
13107
|
+
|
|
13108
|
+
assert.notCalled(
|
|
13109
|
+
meeting.mediaProperties.webrtcMediaConnection.updatePreferredBitrateKbps
|
|
13110
|
+
);
|
|
13111
|
+
});
|
|
13112
|
+
|
|
13113
|
+
it('does not throw when webrtcMediaConnection is undefined', () => {
|
|
13114
|
+
meeting.isMultistream = false;
|
|
13115
|
+
meeting.mediaProperties.webrtcMediaConnection = undefined;
|
|
13116
|
+
|
|
13117
|
+
assert.doesNotThrow(() => meeting.localConstraintsChangeHandler());
|
|
13118
|
+
});
|
|
13119
|
+
});
|
|
13120
|
+
|
|
11124
13121
|
describe('#parseMeetingInfo', () => {
|
|
11125
13122
|
const checkParseMeetingInfo = (expectedInfoToParse) => {
|
|
11126
13123
|
assert.equal(meeting.conversationUrl, expectedInfoToParse.conversationUrl);
|
|
@@ -11500,6 +13497,7 @@ describe('plugin-meetings', () => {
|
|
|
11500
13497
|
let canUnsetDisallowUnmuteSpy;
|
|
11501
13498
|
let canUserRaiseHandSpy;
|
|
11502
13499
|
let bothLeaveAndEndMeetingAvailableSpy;
|
|
13500
|
+
let requireHostEndMeetingBeforeLeaveSpy;
|
|
11503
13501
|
let canUserLowerAllHandsSpy;
|
|
11504
13502
|
let canUserLowerSomeoneElsesHandSpy;
|
|
11505
13503
|
let waitingForOthersToJoinSpy;
|
|
@@ -11511,6 +13509,9 @@ describe('plugin-meetings', () => {
|
|
|
11511
13509
|
let canMoveToLobbySpy;
|
|
11512
13510
|
let isSpokenLanguageAutoDetectionEnabledSpy;
|
|
11513
13511
|
let showAutoEndMeetingWarningSpy;
|
|
13512
|
+
let canAttendeeRequestAiAssistantEnabledSpy;
|
|
13513
|
+
let attendeeRequestAiAssistantDeclinedAllSpy;
|
|
13514
|
+
let isAnonymizeDisplayNamesEnabledSpy;
|
|
11514
13515
|
// Due to import tree issues, hasHints must be stubed within the scope of the `it`.
|
|
11515
13516
|
|
|
11516
13517
|
beforeEach(() => {
|
|
@@ -11531,6 +13532,10 @@ describe('plugin-meetings', () => {
|
|
|
11531
13532
|
MeetingUtil,
|
|
11532
13533
|
'bothLeaveAndEndMeetingAvailable'
|
|
11533
13534
|
);
|
|
13535
|
+
requireHostEndMeetingBeforeLeaveSpy = sinon.spy(
|
|
13536
|
+
MeetingUtil,
|
|
13537
|
+
'requireHostEndMeetingBeforeLeave'
|
|
13538
|
+
);
|
|
11534
13539
|
canUserLowerSomeoneElsesHandSpy = sinon.spy(MeetingUtil, 'canUserLowerSomeoneElsesHand');
|
|
11535
13540
|
waitingForOthersToJoinSpy = sinon.spy(MeetingUtil, 'waitingForOthersToJoin');
|
|
11536
13541
|
canSendReactionsSpy = sinon.spy(MeetingUtil, 'canSendReactions');
|
|
@@ -11547,12 +13552,27 @@ describe('plugin-meetings', () => {
|
|
|
11547
13552
|
MeetingUtil,
|
|
11548
13553
|
'isSpokenLanguageAutoDetectionEnabled'
|
|
11549
13554
|
);
|
|
13555
|
+
canAttendeeRequestAiAssistantEnabledSpy = sinon.spy(
|
|
13556
|
+
MeetingUtil,
|
|
13557
|
+
'canAttendeeRequestAiAssistantEnabled'
|
|
13558
|
+
);
|
|
13559
|
+
attendeeRequestAiAssistantDeclinedAllSpy = sinon.spy(
|
|
13560
|
+
MeetingUtil,
|
|
13561
|
+
'attendeeRequestAiAssistantDeclinedAll'
|
|
13562
|
+
);
|
|
13563
|
+
isAnonymizeDisplayNamesEnabledSpy = sinon.spy(
|
|
13564
|
+
MeetingUtil,
|
|
13565
|
+
'isAnonymizeDisplayNamesEnabled'
|
|
13566
|
+
);
|
|
11550
13567
|
});
|
|
11551
13568
|
|
|
11552
13569
|
afterEach(() => {
|
|
11553
13570
|
inMeetingActionsSetSpy.restore();
|
|
11554
13571
|
waitingForOthersToJoinSpy.restore();
|
|
11555
13572
|
showAutoEndMeetingWarningSpy.restore();
|
|
13573
|
+
canAttendeeRequestAiAssistantEnabledSpy.restore();
|
|
13574
|
+
attendeeRequestAiAssistantDeclinedAllSpy.restore();
|
|
13575
|
+
isAnonymizeDisplayNamesEnabledSpy.restore();
|
|
11556
13576
|
});
|
|
11557
13577
|
|
|
11558
13578
|
forEach(
|
|
@@ -12076,6 +14096,7 @@ describe('plugin-meetings', () => {
|
|
|
12076
14096
|
const userDisplayHints = ['LOCK_CONTROL_UNLOCK'];
|
|
12077
14097
|
meeting.userDisplayHints = ['LOCK_CONTROL_UNLOCK'];
|
|
12078
14098
|
meeting.meetingInfo.supportVoIP = true;
|
|
14099
|
+
meeting.roles = [];
|
|
12079
14100
|
|
|
12080
14101
|
meeting.updateMeetingActions();
|
|
12081
14102
|
|
|
@@ -12091,6 +14112,7 @@ describe('plugin-meetings', () => {
|
|
|
12091
14112
|
assert.calledWith(canUnsetDisallowUnmuteSpy, userDisplayHints);
|
|
12092
14113
|
assert.calledWith(canUserRaiseHandSpy, userDisplayHints);
|
|
12093
14114
|
assert.calledWith(bothLeaveAndEndMeetingAvailableSpy, userDisplayHints);
|
|
14115
|
+
assert.calledWith(requireHostEndMeetingBeforeLeaveSpy, userDisplayHints);
|
|
12094
14116
|
assert.calledWith(canUserLowerAllHandsSpy, userDisplayHints);
|
|
12095
14117
|
assert.calledWith(canUserLowerSomeoneElsesHandSpy, userDisplayHints);
|
|
12096
14118
|
assert.calledWith(waitingForOthersToJoinSpy, userDisplayHints);
|
|
@@ -12102,6 +14124,13 @@ describe('plugin-meetings', () => {
|
|
|
12102
14124
|
assert.calledWith(canMoveToLobbySpy, userDisplayHints);
|
|
12103
14125
|
assert.calledWith(showAutoEndMeetingWarningSpy, userDisplayHints);
|
|
12104
14126
|
assert.calledWith(isSpokenLanguageAutoDetectionEnabledSpy, userDisplayHints);
|
|
14127
|
+
assert.calledWith(
|
|
14128
|
+
canAttendeeRequestAiAssistantEnabledSpy,
|
|
14129
|
+
userDisplayHints,
|
|
14130
|
+
meeting.roles
|
|
14131
|
+
);
|
|
14132
|
+
assert.calledWith(attendeeRequestAiAssistantDeclinedAllSpy, userDisplayHints);
|
|
14133
|
+
assert.calledWith(isAnonymizeDisplayNamesEnabledSpy, userDisplayHints);
|
|
12105
14134
|
|
|
12106
14135
|
assert.calledWith(ControlsOptionsUtil.hasHints, {
|
|
12107
14136
|
requiredHints: [DISPLAY_HINTS.MUTE_ALL],
|
|
@@ -12244,72 +14273,220 @@ describe('plugin-meetings', () => {
|
|
|
12244
14273
|
|
|
12245
14274
|
describe('#handleDataChannelUrlChange', () => {
|
|
12246
14275
|
let updateLLMConnectionSpy;
|
|
14276
|
+
let updatePSDataChannelSpy;
|
|
12247
14277
|
|
|
12248
14278
|
beforeEach(() => {
|
|
12249
14279
|
updateLLMConnectionSpy = sinon.spy(meeting, 'updateLLMConnection');
|
|
14280
|
+
updatePSDataChannelSpy = sinon.stub(meeting.webinar, 'updatePSDataChannel').resolves();
|
|
14281
|
+
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
12250
14282
|
});
|
|
12251
14283
|
|
|
12252
|
-
const check = (
|
|
12253
|
-
|
|
14284
|
+
const check = (
|
|
14285
|
+
url,
|
|
14286
|
+
practiceSessionDatachannelUrl,
|
|
14287
|
+
{expectedMainCalled, expectedPracticeCalled}
|
|
14288
|
+
) => {
|
|
14289
|
+
meeting.handleDataChannelUrlChange(url, practiceSessionDatachannelUrl);
|
|
12254
14290
|
|
|
12255
|
-
if (
|
|
14291
|
+
if (expectedMainCalled) {
|
|
12256
14292
|
assert.calledWith(updateLLMConnectionSpy);
|
|
12257
14293
|
} else {
|
|
12258
14294
|
assert.notCalled(updateLLMConnectionSpy);
|
|
12259
14295
|
}
|
|
14296
|
+
|
|
14297
|
+
if (expectedPracticeCalled) {
|
|
14298
|
+
assert.calledWith(updatePSDataChannelSpy);
|
|
14299
|
+
} else {
|
|
14300
|
+
assert.notCalled(updatePSDataChannelSpy);
|
|
14301
|
+
}
|
|
12260
14302
|
};
|
|
12261
14303
|
|
|
12262
14304
|
it('calls deferred updateLLMConnection if datachannelURL is set and the enableAutomaticLLM is true', () => {
|
|
12263
14305
|
meeting.config.enableAutomaticLLM = true;
|
|
12264
|
-
check('some url', true);
|
|
14306
|
+
check('some url', undefined, {expectedMainCalled: true, expectedPracticeCalled: false});
|
|
12265
14307
|
});
|
|
12266
14308
|
|
|
12267
14309
|
it('does not call updateLLMConnection if datachannelURL is undefined', () => {
|
|
12268
14310
|
meeting.config.enableAutomaticLLM = true;
|
|
12269
|
-
check(undefined,
|
|
14311
|
+
check(undefined, undefined, {
|
|
14312
|
+
expectedMainCalled: false,
|
|
14313
|
+
expectedPracticeCalled: false,
|
|
14314
|
+
});
|
|
12270
14315
|
});
|
|
12271
14316
|
|
|
12272
14317
|
it('does not call updateLLMConnection if enableAutomaticLLM is false', () => {
|
|
12273
|
-
check('some url',
|
|
14318
|
+
check('some url', 'some practice url', {
|
|
14319
|
+
expectedMainCalled: false,
|
|
14320
|
+
expectedPracticeCalled: false,
|
|
14321
|
+
});
|
|
14322
|
+
});
|
|
14323
|
+
|
|
14324
|
+
it('calls updatePSDataChannel when practice-session routing is active', () => {
|
|
14325
|
+
meeting.config.enableAutomaticLLM = true;
|
|
14326
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
14327
|
+
|
|
14328
|
+
check('some url', 'some practice url', {
|
|
14329
|
+
expectedMainCalled: true,
|
|
14330
|
+
expectedPracticeCalled: true,
|
|
14331
|
+
});
|
|
14332
|
+
});
|
|
14333
|
+
|
|
14334
|
+
it('does not call updatePSDataChannel when the main datachannelURL is undefined', () => {
|
|
14335
|
+
meeting.config.enableAutomaticLLM = true;
|
|
14336
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
14337
|
+
|
|
14338
|
+
check(undefined, 'some practice url', {
|
|
14339
|
+
expectedMainCalled: false,
|
|
14340
|
+
expectedPracticeCalled: false,
|
|
14341
|
+
});
|
|
12274
14342
|
});
|
|
12275
14343
|
});
|
|
12276
14344
|
|
|
12277
|
-
describe('#
|
|
14345
|
+
describe('#saveDataChannelToken', () => {
|
|
12278
14346
|
beforeEach(() => {
|
|
12279
|
-
webex.internal.llm.
|
|
12280
|
-
webex.internal.llm.
|
|
12281
|
-
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
12282
|
-
webex.internal.llm.registerAndConnect = sinon
|
|
14347
|
+
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
14348
|
+
webex.internal.llm.resolveSessionOwnership = sinon
|
|
12283
14349
|
.stub()
|
|
12284
|
-
.returns(
|
|
12285
|
-
webex.internal.llm.
|
|
12286
|
-
meeting.webex.internal.llm.on = sinon.stub();
|
|
12287
|
-
meeting.webex.internal.llm.off = sinon.stub();
|
|
12288
|
-
meeting.processRelayEvent = sinon.stub();
|
|
12289
|
-
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
14350
|
+
.returns({currentOwner: undefined, isOwner: true});
|
|
14351
|
+
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
12290
14352
|
});
|
|
12291
14353
|
|
|
12292
|
-
it('
|
|
12293
|
-
meeting.
|
|
12294
|
-
|
|
14354
|
+
it('saves datachannelToken into LLM as Default', () => {
|
|
14355
|
+
meeting.saveDataChannelToken({
|
|
14356
|
+
locus: {
|
|
14357
|
+
self: {datachannelToken: 'default-token'},
|
|
14358
|
+
},
|
|
14359
|
+
});
|
|
12295
14360
|
|
|
12296
|
-
|
|
14361
|
+
assert.calledWithExactly(
|
|
14362
|
+
webex.internal.llm.setDatachannelToken,
|
|
14363
|
+
'default-token',
|
|
14364
|
+
'llm-default-session',
|
|
14365
|
+
meeting.id
|
|
14366
|
+
);
|
|
14367
|
+
});
|
|
12297
14368
|
|
|
12298
|
-
|
|
14369
|
+
it('saves practiceSessionDatachannelToken into LLM as PracticeSession', () => {
|
|
14370
|
+
meeting.saveDataChannelToken({
|
|
14371
|
+
locus: {
|
|
14372
|
+
self: {practiceSessionDatachannelToken: 'ps-token'},
|
|
14373
|
+
},
|
|
14374
|
+
});
|
|
12299
14375
|
|
|
12300
|
-
assert.
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
14376
|
+
assert.calledWithExactly(
|
|
14377
|
+
webex.internal.llm.setDatachannelToken,
|
|
14378
|
+
'ps-token',
|
|
14379
|
+
'llm-practice-session',
|
|
14380
|
+
meeting.id
|
|
14381
|
+
);
|
|
14382
|
+
});
|
|
14383
|
+
|
|
14384
|
+
it('saves both tokens when both are present', () => {
|
|
14385
|
+
meeting.saveDataChannelToken({
|
|
14386
|
+
locus: {
|
|
14387
|
+
self: {
|
|
14388
|
+
datachannelToken: 'default-token',
|
|
14389
|
+
practiceSessionDatachannelToken: 'ps-token',
|
|
14390
|
+
},
|
|
14391
|
+
},
|
|
14392
|
+
});
|
|
14393
|
+
|
|
14394
|
+
assert.calledTwice(webex.internal.llm.setDatachannelToken);
|
|
14395
|
+
assert.calledWithExactly(
|
|
14396
|
+
webex.internal.llm.setDatachannelToken,
|
|
14397
|
+
'default-token',
|
|
14398
|
+
'llm-default-session',
|
|
14399
|
+
meeting.id
|
|
14400
|
+
);
|
|
14401
|
+
assert.calledWithExactly(
|
|
14402
|
+
webex.internal.llm.setDatachannelToken,
|
|
14403
|
+
'ps-token',
|
|
14404
|
+
'llm-practice-session',
|
|
14405
|
+
meeting.id
|
|
14406
|
+
);
|
|
14407
|
+
});
|
|
14408
|
+
|
|
14409
|
+
it('does not call setDatachannelToken when no tokens are present', () => {
|
|
14410
|
+
meeting.saveDataChannelToken({locus: {self: {}}});
|
|
14411
|
+
|
|
14412
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14413
|
+
});
|
|
14414
|
+
|
|
14415
|
+
it('handles undefined join gracefully', () => {
|
|
14416
|
+
meeting.saveDataChannelToken(undefined);
|
|
14417
|
+
|
|
14418
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14419
|
+
});
|
|
14420
|
+
|
|
14421
|
+
it('handles missing locus.self gracefully', () => {
|
|
14422
|
+
meeting.saveDataChannelToken({locus: {}});
|
|
14423
|
+
|
|
14424
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14425
|
+
});
|
|
14426
|
+
|
|
14427
|
+
it('writes token with meeting id as owner', () => {
|
|
14428
|
+
meeting.saveDataChannelToken({
|
|
14429
|
+
locus: {
|
|
14430
|
+
self: {datachannelToken: 'default-token'},
|
|
14431
|
+
},
|
|
14432
|
+
});
|
|
14433
|
+
|
|
14434
|
+
assert.calledOnceWithExactly(
|
|
14435
|
+
webex.internal.llm.setDatachannelToken,
|
|
14436
|
+
'default-token',
|
|
14437
|
+
'llm-default-session',
|
|
14438
|
+
meeting.id
|
|
14439
|
+
);
|
|
14440
|
+
});
|
|
14441
|
+
});
|
|
14442
|
+
|
|
14443
|
+
describe('#clearDataChannelToken', () => {
|
|
14444
|
+
beforeEach(() => {
|
|
14445
|
+
webex.internal.llm.clearDatachannelToken = sinon.stub();
|
|
12304
14446
|
});
|
|
12305
14447
|
|
|
12306
|
-
it('
|
|
12307
|
-
meeting.
|
|
12308
|
-
|
|
14448
|
+
it('delegates default and practice token clears to llm with meeting ownership id', () => {
|
|
14449
|
+
meeting.clearDataChannelToken();
|
|
14450
|
+
|
|
14451
|
+
assert.calledWithExactly(
|
|
14452
|
+
webex.internal.llm.clearDatachannelToken,
|
|
14453
|
+
'llm-default-session',
|
|
14454
|
+
meeting.id
|
|
14455
|
+
);
|
|
14456
|
+
assert.calledWithExactly(
|
|
14457
|
+
webex.internal.llm.clearDatachannelToken,
|
|
14458
|
+
'llm-practice-session',
|
|
14459
|
+
meeting.id
|
|
14460
|
+
);
|
|
14461
|
+
assert.callCount(webex.internal.llm.clearDatachannelToken, 2);
|
|
14462
|
+
});
|
|
14463
|
+
});
|
|
14464
|
+
|
|
14465
|
+
describe('#updateLLMConnection', () => {
|
|
14466
|
+
beforeEach(() => {
|
|
14467
|
+
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
14468
|
+
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
14469
|
+
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
14470
|
+
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
14471
|
+
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
14472
|
+
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
14473
|
+
webex.internal.llm.on = sinon.stub();
|
|
14474
|
+
webex.internal.llm.off = sinon.stub();
|
|
14475
|
+
webex.internal.llm.getDatachannelToken = sinon.stub().returns(undefined);
|
|
14476
|
+
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
14477
|
+
|
|
14478
|
+
meeting.processRelayEvent = sinon.stub();
|
|
14479
|
+
meeting.processLocusLLMEvent = sinon.stub();
|
|
14480
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
14481
|
+
meeting.startLLMHealthCheckTimer = sinon.stub();
|
|
14482
|
+
|
|
14483
|
+
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
14484
|
+
});
|
|
14485
|
+
it('does not connect if the call is not joined yet', async () => {
|
|
14486
|
+
meeting.joinedWith = {state: 'any other state'};
|
|
12309
14487
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12310
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
12311
14488
|
|
|
12312
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14489
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
12313
14490
|
|
|
12314
14491
|
const result = await meeting.updateLLMConnection();
|
|
12315
14492
|
|
|
@@ -12318,15 +14495,22 @@ describe('plugin-meetings', () => {
|
|
|
12318
14495
|
assert.equal(result, undefined);
|
|
12319
14496
|
assert.notCalled(meeting.webex.internal.llm.on);
|
|
12320
14497
|
});
|
|
12321
|
-
|
|
12322
|
-
it('connects if not already connected', async () => {
|
|
14498
|
+
it('returns undefined if llm is already connected and the locus url is unchanged', async () => {
|
|
12323
14499
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12324
|
-
meeting.locusInfo = {
|
|
14500
|
+
meeting.locusInfo = {
|
|
14501
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14502
|
+
url: 'a url',
|
|
14503
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14504
|
+
};
|
|
12325
14505
|
|
|
12326
14506
|
const result = await meeting.updateLLMConnection();
|
|
12327
|
-
|
|
12328
14507
|
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
12329
|
-
assert.
|
|
14508
|
+
assert.calledWithExactly(
|
|
14509
|
+
webex.internal.llm.registerAndConnect,
|
|
14510
|
+
'a url',
|
|
14511
|
+
'a datachannel url',
|
|
14512
|
+
undefined
|
|
14513
|
+
);
|
|
12330
14514
|
assert.equal(result, 'something');
|
|
12331
14515
|
assert.calledWithExactly(
|
|
12332
14516
|
meeting.webex.internal.llm.off,
|
|
@@ -12349,27 +14533,57 @@ describe('plugin-meetings', () => {
|
|
|
12349
14533
|
meeting.processLocusLLMEvent
|
|
12350
14534
|
);
|
|
12351
14535
|
});
|
|
14536
|
+
it('connects if not already connected', async () => {
|
|
14537
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14538
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14539
|
+
|
|
14540
|
+
const result = await meeting.updateLLMConnection();
|
|
12352
14541
|
|
|
12353
|
-
|
|
14542
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
14543
|
+
assert.calledWithExactly(
|
|
14544
|
+
webex.internal.llm.registerAndConnect,
|
|
14545
|
+
'a url',
|
|
14546
|
+
'a datachannel url',
|
|
14547
|
+
undefined
|
|
14548
|
+
);
|
|
14549
|
+
assert.calledOnceWithExactly(
|
|
14550
|
+
webex.internal.llm.setRefreshHandler,
|
|
14551
|
+
sinon.match.func,
|
|
14552
|
+
'llm-default-session',
|
|
14553
|
+
meeting.id
|
|
14554
|
+
);
|
|
14555
|
+
assert.equal(result, 'something');
|
|
14556
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
14557
|
+
});
|
|
14558
|
+
it('disconnects if the locus url has changed', async () => {
|
|
12354
14559
|
meeting.joinedWith = {state: 'JOINED'};
|
|
14560
|
+
|
|
12355
14561
|
webex.internal.llm.isConnected.returns(true);
|
|
12356
14562
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12357
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
12358
14563
|
|
|
12359
|
-
meeting.locusInfo = {
|
|
14564
|
+
meeting.locusInfo = {
|
|
14565
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14566
|
+
url: 'a different url',
|
|
14567
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14568
|
+
self: {},
|
|
14569
|
+
};
|
|
12360
14570
|
|
|
12361
14571
|
const result = await meeting.updateLLMConnection();
|
|
12362
14572
|
|
|
12363
|
-
assert.
|
|
14573
|
+
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
|
|
12364
14574
|
code: 3050,
|
|
12365
14575
|
reason: 'done (permanent)',
|
|
12366
|
-
});
|
|
12367
|
-
|
|
14576
|
+
}, 'llm-default-session', meeting.id);
|
|
14577
|
+
|
|
14578
|
+
assert.calledWithExactly(
|
|
12368
14579
|
webex.internal.llm.registerAndConnect,
|
|
12369
14580
|
'a different url',
|
|
12370
|
-
'a datachannel url'
|
|
14581
|
+
'a datachannel url',
|
|
14582
|
+
undefined
|
|
12371
14583
|
);
|
|
14584
|
+
|
|
12372
14585
|
assert.equal(result, 'something');
|
|
14586
|
+
|
|
12373
14587
|
assert.calledWithExactly(
|
|
12374
14588
|
meeting.webex.internal.llm.off,
|
|
12375
14589
|
'event:relay.event',
|
|
@@ -12381,6 +14595,7 @@ describe('plugin-meetings', () => {
|
|
|
12381
14595
|
meeting.processLocusLLMEvent
|
|
12382
14596
|
);
|
|
12383
14597
|
assert.callCount(meeting.webex.internal.llm.off, 4);
|
|
14598
|
+
|
|
12384
14599
|
assert.calledWithExactly(
|
|
12385
14600
|
meeting.webex.internal.llm.on,
|
|
12386
14601
|
'event:relay.event',
|
|
@@ -12391,28 +14606,38 @@ describe('plugin-meetings', () => {
|
|
|
12391
14606
|
'event:locus.state_message',
|
|
12392
14607
|
meeting.processLocusLLMEvent
|
|
12393
14608
|
);
|
|
14609
|
+
assert.isFalse(
|
|
14610
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
14611
|
+
);
|
|
12394
14612
|
});
|
|
12395
|
-
|
|
12396
|
-
it('disconnects it first if the data channel url has changed', async () => {
|
|
14613
|
+
it('disconnects if the data channel url has changed', async () => {
|
|
12397
14614
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12398
14615
|
webex.internal.llm.isConnected.returns(true);
|
|
12399
14616
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12400
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
12401
14617
|
|
|
12402
|
-
meeting.locusInfo = {
|
|
14618
|
+
meeting.locusInfo = {
|
|
14619
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14620
|
+
url: 'a url',
|
|
14621
|
+
info: {datachannelUrl: 'a different datachannel url'},
|
|
14622
|
+
self: {},
|
|
14623
|
+
};
|
|
12403
14624
|
|
|
12404
14625
|
const result = await meeting.updateLLMConnection();
|
|
12405
14626
|
|
|
12406
|
-
assert.
|
|
14627
|
+
assert.calledWithExactly(webex.internal.llm.disconnectLLM, {
|
|
12407
14628
|
code: 3050,
|
|
12408
14629
|
reason: 'done (permanent)',
|
|
12409
|
-
});
|
|
12410
|
-
|
|
14630
|
+
}, 'llm-default-session', meeting.id);
|
|
14631
|
+
|
|
14632
|
+
assert.calledWithExactly(
|
|
12411
14633
|
webex.internal.llm.registerAndConnect,
|
|
12412
14634
|
'a url',
|
|
12413
|
-
'a different datachannel url'
|
|
14635
|
+
'a different datachannel url',
|
|
14636
|
+
undefined
|
|
12414
14637
|
);
|
|
14638
|
+
|
|
12415
14639
|
assert.equal(result, 'something');
|
|
14640
|
+
|
|
12416
14641
|
assert.calledWithExactly(
|
|
12417
14642
|
meeting.webex.internal.llm.off,
|
|
12418
14643
|
'event:relay.event',
|
|
@@ -12423,6 +14648,7 @@ describe('plugin-meetings', () => {
|
|
|
12423
14648
|
'event:locus.state_message',
|
|
12424
14649
|
meeting.processLocusLLMEvent
|
|
12425
14650
|
);
|
|
14651
|
+
|
|
12426
14652
|
assert.calledWithExactly(
|
|
12427
14653
|
meeting.webex.internal.llm.on,
|
|
12428
14654
|
'event:relay.event',
|
|
@@ -12433,20 +14659,52 @@ describe('plugin-meetings', () => {
|
|
|
12433
14659
|
'event:locus.state_message',
|
|
12434
14660
|
meeting.processLocusLLMEvent
|
|
12435
14661
|
);
|
|
14662
|
+
assert.isFalse(
|
|
14663
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
14664
|
+
);
|
|
12436
14665
|
});
|
|
12437
|
-
|
|
12438
14666
|
it('disconnects when the state is not JOINED', async () => {
|
|
12439
14667
|
meeting.joinedWith = {state: 'any other state'};
|
|
12440
14668
|
webex.internal.llm.isConnected.returns(true);
|
|
12441
14669
|
webex.internal.llm.getLocusUrl.returns('a url');
|
|
12442
14670
|
|
|
12443
|
-
meeting.locusInfo = {url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14671
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
12444
14672
|
|
|
12445
14673
|
const result = await meeting.updateLLMConnection();
|
|
12446
14674
|
|
|
12447
|
-
assert.calledWith(webex.internal.llm.disconnectLLM,
|
|
14675
|
+
assert.calledWith(webex.internal.llm.disconnectLLM, {
|
|
14676
|
+
code: 3050,
|
|
14677
|
+
reason: 'done (permanent)',
|
|
14678
|
+
}, 'llm-default-session', meeting.id);
|
|
12448
14679
|
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
12449
14680
|
assert.equal(result, undefined);
|
|
14681
|
+
assert.isFalse(
|
|
14682
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
14683
|
+
);
|
|
14684
|
+
});
|
|
14685
|
+
it('rethrows disconnect errors during reconnect cleanup after removing relay listeners and timer', async () => {
|
|
14686
|
+
const disconnectError = new Error('disconnect failed');
|
|
14687
|
+
|
|
14688
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14689
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14690
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14691
|
+
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
14692
|
+
|
|
14693
|
+
meeting.locusInfo = {
|
|
14694
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14695
|
+
url: 'a different url',
|
|
14696
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14697
|
+
self: {},
|
|
14698
|
+
};
|
|
14699
|
+
|
|
14700
|
+
try {
|
|
14701
|
+
await meeting.updateLLMConnection();
|
|
14702
|
+
assert.fail('Expected updateLLMConnection to reject when disconnectLLM fails');
|
|
14703
|
+
} catch (error) {
|
|
14704
|
+
assert.equal(error, disconnectError);
|
|
14705
|
+
}
|
|
14706
|
+
|
|
14707
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
12450
14708
|
assert.calledWithExactly(
|
|
12451
14709
|
meeting.webex.internal.llm.off,
|
|
12452
14710
|
'event:relay.event',
|
|
@@ -12457,22 +14715,405 @@ describe('plugin-meetings', () => {
|
|
|
12457
14715
|
'event:locus.state_message',
|
|
12458
14716
|
meeting.processLocusLLMEvent
|
|
12459
14717
|
);
|
|
14718
|
+
assert.isFalse(
|
|
14719
|
+
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
14720
|
+
);
|
|
14721
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
12460
14722
|
});
|
|
12461
|
-
|
|
12462
|
-
it('connect ps data channel if ps started in webinar', async () => {
|
|
14723
|
+
it('still need connect main session data channel when PS started', async () => {
|
|
12463
14724
|
meeting.joinedWith = {state: 'JOINED'};
|
|
12464
14725
|
meeting.locusInfo = {
|
|
14726
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
12465
14727
|
url: 'a url',
|
|
12466
14728
|
info: {
|
|
12467
14729
|
datachannelUrl: 'a datachannel url',
|
|
12468
|
-
practiceSessionDatachannelUrl: '
|
|
14730
|
+
practiceSessionDatachannelUrl: 'ps-url',
|
|
12469
14731
|
},
|
|
12470
14732
|
};
|
|
12471
|
-
meeting.webinar.isJoinPracticeSessionDataChannel
|
|
14733
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
14734
|
+
|
|
12472
14735
|
await meeting.updateLLMConnection();
|
|
12473
14736
|
|
|
12474
|
-
assert.
|
|
12475
|
-
|
|
14737
|
+
assert.calledWithExactly(
|
|
14738
|
+
webex.internal.llm.registerAndConnect,
|
|
14739
|
+
'a url',
|
|
14740
|
+
'a datachannel url',
|
|
14741
|
+
undefined
|
|
14742
|
+
);
|
|
14743
|
+
});
|
|
14744
|
+
it('passes dataChannelToken from LLM to registerAndConnect', async () => {
|
|
14745
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14746
|
+
meeting.locusInfo = {
|
|
14747
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14748
|
+
url: 'a url',
|
|
14749
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14750
|
+
};
|
|
14751
|
+
|
|
14752
|
+
webex.internal.llm.getDatachannelToken
|
|
14753
|
+
.withArgs('llm-default-session', meeting.id)
|
|
14754
|
+
.returns('token-123');
|
|
14755
|
+
|
|
14756
|
+
await meeting.updateLLMConnection();
|
|
14757
|
+
|
|
14758
|
+
assert.calledWithExactly(
|
|
14759
|
+
webex.internal.llm.registerAndConnect,
|
|
14760
|
+
'a url',
|
|
14761
|
+
'a datachannel url',
|
|
14762
|
+
'token-123'
|
|
14763
|
+
);
|
|
14764
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14765
|
+
});
|
|
14766
|
+
it('passes undefined token when LLM has no token stored', async () => {
|
|
14767
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14768
|
+
meeting.locusInfo = {
|
|
14769
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14770
|
+
url: 'a url',
|
|
14771
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14772
|
+
};
|
|
14773
|
+
|
|
14774
|
+
webex.internal.llm.getDatachannelToken.returns(undefined);
|
|
14775
|
+
|
|
14776
|
+
await meeting.updateLLMConnection();
|
|
14777
|
+
|
|
14778
|
+
assert.calledWithExactly(
|
|
14779
|
+
webex.internal.llm.registerAndConnect,
|
|
14780
|
+
'a url',
|
|
14781
|
+
'a datachannel url',
|
|
14782
|
+
undefined
|
|
14783
|
+
);
|
|
14784
|
+
|
|
14785
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14786
|
+
});
|
|
14787
|
+
|
|
14788
|
+
it('does not pass token when data channel with jwt token is disabled', async () => {
|
|
14789
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14790
|
+
meeting.locusInfo = {
|
|
14791
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14792
|
+
url: 'a url',
|
|
14793
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14794
|
+
};
|
|
14795
|
+
|
|
14796
|
+
webex.internal.llm.getDatachannelToken.returns(undefined);
|
|
14797
|
+
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
14798
|
+
|
|
14799
|
+
await meeting.updateLLMConnection();
|
|
14800
|
+
|
|
14801
|
+
assert.calledWithExactly(
|
|
14802
|
+
webex.internal.llm.registerAndConnect,
|
|
14803
|
+
'a url',
|
|
14804
|
+
'a datachannel url',
|
|
14805
|
+
undefined
|
|
14806
|
+
);
|
|
14807
|
+
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
14808
|
+
});
|
|
14809
|
+
|
|
14810
|
+
describe('ownership tag', () => {
|
|
14811
|
+
beforeEach(() => {
|
|
14812
|
+
// Make the owner stub dynamic so setOwnerMeetingId() writes
|
|
14813
|
+
// propagate back to getOwnerMeetingId() reads. This mirrors the
|
|
14814
|
+
// real LLM singleton behavior so the finally-block release in
|
|
14815
|
+
// cleanupLLMConneciton is reflected in subsequent reads.
|
|
14816
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub().returns(undefined);
|
|
14817
|
+
webex.internal.llm.setOwnerMeetingId = sinon.stub().callsFake((id) => {
|
|
14818
|
+
webex.internal.llm.getOwnerMeetingId.returns(id);
|
|
14819
|
+
});
|
|
14820
|
+
});
|
|
14821
|
+
|
|
14822
|
+
it('skips disconnect and reconnect when LLM is connected and owned by another meeting (regardless of URL)', async () => {
|
|
14823
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14824
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14825
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
14826
|
+
// Locus/datachannel URL mismatch is the *normal* case when
|
|
14827
|
+
// another meeting owns the live socket -- each meeting has its
|
|
14828
|
+
// own locus URL. URL mismatch must NOT trigger a reclaim,
|
|
14829
|
+
// because doing so would tear down the owning meeting's healthy
|
|
14830
|
+
// LLM socket and break its data channel.
|
|
14831
|
+
webex.internal.llm.getLocusUrl.returns('owner-locus-url');
|
|
14832
|
+
webex.internal.llm.getDatachannelUrl.returns('owner-dc-url');
|
|
14833
|
+
meeting.locusInfo = {
|
|
14834
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14835
|
+
url: 'a different url',
|
|
14836
|
+
info: {datachannelUrl: 'a different datachannel url'},
|
|
14837
|
+
self: {},
|
|
14838
|
+
};
|
|
14839
|
+
|
|
14840
|
+
const result = await meeting.updateLLMConnection();
|
|
14841
|
+
|
|
14842
|
+
assert.equal(result, undefined);
|
|
14843
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
14844
|
+
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
14845
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
14846
|
+
assert.notCalled(meeting.startLLMHealthCheckTimer);
|
|
14847
|
+
});
|
|
14848
|
+
|
|
14849
|
+
|
|
14850
|
+
it('clears stale owner tag in cleanup finally block even when disconnectLLM rejects', async () => {
|
|
14851
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14852
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14853
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
14854
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14855
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
14856
|
+
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
14857
|
+
meeting.locusInfo = {
|
|
14858
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14859
|
+
url: 'a different url',
|
|
14860
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14861
|
+
self: {},
|
|
14862
|
+
};
|
|
14863
|
+
|
|
14864
|
+
try {
|
|
14865
|
+
await meeting.updateLLMConnection();
|
|
14866
|
+
} catch (e) {
|
|
14867
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
14868
|
+
}
|
|
14869
|
+
|
|
14870
|
+
// The owner-eligible finally branch must release the tag so a
|
|
14871
|
+
// subsequent reconnect attempt from any meeting is not blocked.
|
|
14872
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId, undefined);
|
|
14873
|
+
});
|
|
14874
|
+
|
|
14875
|
+
it('does not clear owner tag when ownership changes during cleanup disconnect await', async () => {
|
|
14876
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14877
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14878
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
14879
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14880
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
14881
|
+
webex.internal.llm.disconnectLLM.callsFake(async () => {
|
|
14882
|
+
webex.internal.llm.getOwnerMeetingId.returns('new-owner-id');
|
|
14883
|
+
throw new Error('disconnect failed');
|
|
14884
|
+
});
|
|
14885
|
+
meeting.locusInfo = {
|
|
14886
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14887
|
+
url: 'a different url',
|
|
14888
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14889
|
+
self: {},
|
|
14890
|
+
};
|
|
14891
|
+
|
|
14892
|
+
try {
|
|
14893
|
+
await meeting.updateLLMConnection();
|
|
14894
|
+
} catch (e) {
|
|
14895
|
+
/* updateLLMConnection may reject when cleanup throws */
|
|
14896
|
+
}
|
|
14897
|
+
|
|
14898
|
+
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
14899
|
+
assert.equal(webex.internal.llm.getOwnerMeetingId(), 'new-owner-id');
|
|
14900
|
+
});
|
|
14901
|
+
|
|
14902
|
+
it('proceeds normally when LLM is connected and owned by this meeting with URL change', async () => {
|
|
14903
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14904
|
+
webex.internal.llm.isConnected.returns(true);
|
|
14905
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
14906
|
+
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14907
|
+
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
14908
|
+
meeting.locusInfo = {
|
|
14909
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
14910
|
+
url: 'a different url',
|
|
14911
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
14912
|
+
self: {},
|
|
14913
|
+
};
|
|
14914
|
+
|
|
14915
|
+
await meeting.updateLLMConnection();
|
|
14916
|
+
|
|
14917
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
14918
|
+
code: 3050,
|
|
14919
|
+
reason: 'done (permanent)',
|
|
14920
|
+
}, 'llm-default-session', meeting.id);
|
|
14921
|
+
assert.calledWithExactly(
|
|
14922
|
+
webex.internal.llm.registerAndConnect,
|
|
14923
|
+
'a different url',
|
|
14924
|
+
'a datachannel url',
|
|
14925
|
+
undefined
|
|
14926
|
+
);
|
|
14927
|
+
// setOwnerMeetingId is called twice: first with undefined in
|
|
14928
|
+
// cleanupLLMConneciton's finally block (so a failed disconnect
|
|
14929
|
+
// cannot leave a stale owner), then with this meeting's id
|
|
14930
|
+
// after registerAndConnect resolves.
|
|
14931
|
+
assert.calledTwice(webex.internal.llm.setOwnerMeetingId);
|
|
14932
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.firstCall, undefined);
|
|
14933
|
+
assert.calledWith(webex.internal.llm.setOwnerMeetingId.lastCall, meeting.id);
|
|
14934
|
+
});
|
|
14935
|
+
|
|
14936
|
+
it('claims ownership after successful registerAndConnect on initial connect', async () => {
|
|
14937
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14938
|
+
webex.internal.llm.isConnected.returns(false);
|
|
14939
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
14940
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14941
|
+
|
|
14942
|
+
await meeting.updateLLMConnection();
|
|
14943
|
+
|
|
14944
|
+
assert.calledOnce(webex.internal.llm.registerAndConnect);
|
|
14945
|
+
assert.calledOnceWithExactly(
|
|
14946
|
+
webex.internal.llm.setRefreshHandler,
|
|
14947
|
+
sinon.match.func,
|
|
14948
|
+
'llm-default-session',
|
|
14949
|
+
meeting.id
|
|
14950
|
+
);
|
|
14951
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
14952
|
+
});
|
|
14953
|
+
|
|
14954
|
+
it('proceeds to connect when LLM is not connected even if another ownerId lingers', async () => {
|
|
14955
|
+
// Defensive path: if the LLM reports not-connected but an old
|
|
14956
|
+
// ownerId is still present (e.g. race before a successful
|
|
14957
|
+
// connections.delete), this meeting can still claim a fresh
|
|
14958
|
+
// connection.
|
|
14959
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
14960
|
+
webex.internal.llm.isConnected.returns(false);
|
|
14961
|
+
webex.internal.llm.getOwnerMeetingId.returns('stale-owner-id');
|
|
14962
|
+
webex.internal.llm.getDatachannelToken.onFirstCall().returns(undefined);
|
|
14963
|
+
webex.internal.llm.getDatachannelToken.onSecondCall().returns('recovered-token');
|
|
14964
|
+
meeting.locusInfo = {syncAllHashTreeDatasets: sinon.stub().resolves(), url: 'a url', info: {datachannelUrl: 'a datachannel url'}};
|
|
14965
|
+
|
|
14966
|
+
await meeting.updateLLMConnection();
|
|
14967
|
+
|
|
14968
|
+
assert.calledTwice(webex.internal.llm.getDatachannelToken);
|
|
14969
|
+
assert.calledWithExactly(
|
|
14970
|
+
webex.internal.llm.getDatachannelToken.firstCall,
|
|
14971
|
+
'llm-default-session',
|
|
14972
|
+
meeting.id
|
|
14973
|
+
);
|
|
14974
|
+
assert.calledWithExactly(
|
|
14975
|
+
webex.internal.llm.getDatachannelToken.secondCall,
|
|
14976
|
+
'llm-default-session'
|
|
14977
|
+
);
|
|
14978
|
+
assert.calledOnceWithExactly(
|
|
14979
|
+
webex.internal.llm.registerAndConnect,
|
|
14980
|
+
'a url',
|
|
14981
|
+
'a datachannel url',
|
|
14982
|
+
'recovered-token'
|
|
14983
|
+
);
|
|
14984
|
+
assert.calledWithExactly(
|
|
14985
|
+
webex.internal.llm.setRefreshHandler.firstCall,
|
|
14986
|
+
sinon.match.func,
|
|
14987
|
+
'llm-default-session',
|
|
14988
|
+
undefined
|
|
14989
|
+
);
|
|
14990
|
+
assert.calledTwice(webex.internal.llm.setRefreshHandler);
|
|
14991
|
+
assert.calledWithExactly(
|
|
14992
|
+
webex.internal.llm.setRefreshHandler.secondCall,
|
|
14993
|
+
sinon.match.func,
|
|
14994
|
+
'llm-default-session',
|
|
14995
|
+
meeting.id
|
|
14996
|
+
);
|
|
14997
|
+
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
14998
|
+
});
|
|
14999
|
+
});
|
|
15000
|
+
|
|
15001
|
+
describe('#clearMeetingData', () => {
|
|
15002
|
+
beforeEach(() => {
|
|
15003
|
+
webex.internal.llm.isConnected = sinon.stub().returns(true);
|
|
15004
|
+
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
15005
|
+
webex.internal.llm.off = sinon.stub();
|
|
15006
|
+
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15007
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15008
|
+
meeting.stopTranscription = sinon.stub();
|
|
15009
|
+
meeting.clearDataChannelToken = sinon.stub();
|
|
15010
|
+
meeting.shareStatus = 'no-share';
|
|
15011
|
+
});
|
|
15012
|
+
|
|
15013
|
+
it('disconnects llm and removes online and relay listeners during meeting data cleanup', async () => {
|
|
15014
|
+
await meeting.clearMeetingData();
|
|
15015
|
+
|
|
15016
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
15017
|
+
code: 3050,
|
|
15018
|
+
reason: 'done (permanent)',
|
|
15019
|
+
}, 'llm-default-session', meeting.id);
|
|
15020
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15021
|
+
assert.calledWithExactly(
|
|
15022
|
+
webex.internal.llm.off,
|
|
15023
|
+
'event:relay.event',
|
|
15024
|
+
meeting.processRelayEvent
|
|
15025
|
+
);
|
|
15026
|
+
assert.calledWithExactly(
|
|
15027
|
+
webex.internal.llm.off,
|
|
15028
|
+
'event:locus.state_message',
|
|
15029
|
+
meeting.processLocusLLMEvent
|
|
15030
|
+
);
|
|
15031
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15032
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15033
|
+
// stopTranscription and annotation.deregisterEvents are not
|
|
15034
|
+
// called here: they run in stopListeningForMeetingEvents()
|
|
15035
|
+
// before /leave to avoid double-emitting
|
|
15036
|
+
// MEETING_STOPPED_RECEIVING_TRANSCRIPTION.
|
|
15037
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15038
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15039
|
+
});
|
|
15040
|
+
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
15041
|
+
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15042
|
+
|
|
15043
|
+
await meeting.clearMeetingData();
|
|
15044
|
+
|
|
15045
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15046
|
+
assert.calledWithExactly(
|
|
15047
|
+
webex.internal.llm.off,
|
|
15048
|
+
'event:relay.event',
|
|
15049
|
+
meeting.processRelayEvent
|
|
15050
|
+
);
|
|
15051
|
+
assert.calledWithExactly(
|
|
15052
|
+
webex.internal.llm.off,
|
|
15053
|
+
'event:locus.state_message',
|
|
15054
|
+
meeting.processLocusLLMEvent
|
|
15055
|
+
);
|
|
15056
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15057
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15058
|
+
assert.notCalled(meeting.stopTranscription);
|
|
15059
|
+
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15060
|
+
});
|
|
15061
|
+
|
|
15062
|
+
describe('ownership tag', () => {
|
|
15063
|
+
beforeEach(() => {
|
|
15064
|
+
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15065
|
+
});
|
|
15066
|
+
|
|
15067
|
+
it('skips disconnectLLM but still removes this meeting listeners when another meeting owns the LLM', async () => {
|
|
15068
|
+
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15069
|
+
|
|
15070
|
+
await meeting.clearMeetingData();
|
|
15071
|
+
|
|
15072
|
+
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15073
|
+
// clearDataChannelToken is always delegated; llm enforces
|
|
15074
|
+
// ownership and no-ops for non-owners internally.
|
|
15075
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15076
|
+
// Listeners owned by *this* Meeting instance must still be
|
|
15077
|
+
// removed so a leaving subordinate meeting stops receiving
|
|
15078
|
+
// relay/locus events from the shared singleton.
|
|
15079
|
+
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15080
|
+
assert.calledWithExactly(
|
|
15081
|
+
webex.internal.llm.off,
|
|
15082
|
+
'event:relay.event',
|
|
15083
|
+
meeting.processRelayEvent
|
|
15084
|
+
);
|
|
15085
|
+
assert.calledWithExactly(
|
|
15086
|
+
webex.internal.llm.off,
|
|
15087
|
+
'event:locus.state_message',
|
|
15088
|
+
meeting.processLocusLLMEvent
|
|
15089
|
+
);
|
|
15090
|
+
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15091
|
+
});
|
|
15092
|
+
|
|
15093
|
+
it('calls disconnectLLM and clears data channel token when this meeting is the owner', async () => {
|
|
15094
|
+
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15095
|
+
|
|
15096
|
+
await meeting.clearMeetingData();
|
|
15097
|
+
|
|
15098
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
15099
|
+
code: 3050,
|
|
15100
|
+
reason: 'done (permanent)',
|
|
15101
|
+
}, 'llm-default-session', meeting.id);
|
|
15102
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15103
|
+
});
|
|
15104
|
+
|
|
15105
|
+
it('calls disconnectLLM and clears data channel token when no owner is recorded (first-claim / legacy)', async () => {
|
|
15106
|
+
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15107
|
+
|
|
15108
|
+
await meeting.clearMeetingData();
|
|
15109
|
+
|
|
15110
|
+
assert.calledOnceWithExactly(webex.internal.llm.disconnectLLM, {
|
|
15111
|
+
code: 3050,
|
|
15112
|
+
reason: 'done (permanent)',
|
|
15113
|
+
}, 'llm-default-session', meeting.id);
|
|
15114
|
+
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15115
|
+
});
|
|
15116
|
+
});
|
|
12476
15117
|
});
|
|
12477
15118
|
});
|
|
12478
15119
|
|
|
@@ -12483,6 +15124,7 @@ describe('plugin-meetings', () => {
|
|
|
12483
15124
|
|
|
12484
15125
|
it('should read the locus object, set on the meeting and return null', () => {
|
|
12485
15126
|
const dataSets = {someFakeStuff: 'dataSet'};
|
|
15127
|
+
const metadata = {some: 'metadata'};
|
|
12486
15128
|
|
|
12487
15129
|
meeting.setLocus({
|
|
12488
15130
|
mediaConnections: [test1],
|
|
@@ -12492,12 +15134,14 @@ describe('plugin-meetings', () => {
|
|
|
12492
15134
|
mediaId: uuid3,
|
|
12493
15135
|
locus: {host: {id: uuid4}},
|
|
12494
15136
|
dataSets,
|
|
15137
|
+
metadata,
|
|
12495
15138
|
});
|
|
12496
15139
|
assert.calledOnce(meeting.locusInfo.initialSetup);
|
|
12497
15140
|
assert.calledWith(meeting.locusInfo.initialSetup, {
|
|
12498
15141
|
trigger: 'join-response',
|
|
12499
15142
|
locus: {host: {id: uuid4}},
|
|
12500
15143
|
dataSets,
|
|
15144
|
+
metadata,
|
|
12501
15145
|
});
|
|
12502
15146
|
assert.equal(meeting.mediaConnections, test1);
|
|
12503
15147
|
assert.equal(meeting.locusUrl, url1);
|
|
@@ -14039,6 +16683,69 @@ describe('plugin-meetings', () => {
|
|
|
14039
16683
|
assert.calledOnce(meeting.meetingRequest.keepAlive);
|
|
14040
16684
|
});
|
|
14041
16685
|
});
|
|
16686
|
+
describe('#refreshDataChannelToken()', () => {
|
|
16687
|
+
let meeting;
|
|
16688
|
+
|
|
16689
|
+
beforeEach(() => {
|
|
16690
|
+
meeting = Object.create(Meeting.prototype);
|
|
16691
|
+
meeting.locusUrl = 'https://locus.example.com';
|
|
16692
|
+
meeting.meetingRequest = {
|
|
16693
|
+
fetchDatachannelToken: sinon.stub().resolves({
|
|
16694
|
+
body: {datachannelToken: 'mock-token'},
|
|
16695
|
+
}),
|
|
16696
|
+
};
|
|
16697
|
+
meeting.members = {
|
|
16698
|
+
selfId: 'self-123',
|
|
16699
|
+
};
|
|
16700
|
+
meeting.webinar = {
|
|
16701
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
16702
|
+
};
|
|
16703
|
+
});
|
|
16704
|
+
|
|
16705
|
+
it('calls fetchDatachannelToken with correct parameters', async () => {
|
|
16706
|
+
await meeting.refreshDataChannelToken();
|
|
16707
|
+
|
|
16708
|
+
sinon.assert.calledOnce(meeting.meetingRequest.fetchDatachannelToken);
|
|
16709
|
+
|
|
16710
|
+
sinon.assert.calledWith(meeting.meetingRequest.fetchDatachannelToken, {
|
|
16711
|
+
locusUrl: 'https://locus.example.com',
|
|
16712
|
+
requestingParticipantId: 'self-123',
|
|
16713
|
+
isPracticeSession: true,
|
|
16714
|
+
});
|
|
16715
|
+
});
|
|
16716
|
+
|
|
16717
|
+
it('returns the correct structured result', async () => {
|
|
16718
|
+
const result = await meeting.refreshDataChannelToken();
|
|
16719
|
+
|
|
16720
|
+
expect(result).to.deep.equal({
|
|
16721
|
+
body: {
|
|
16722
|
+
datachannelToken: 'mock-token',
|
|
16723
|
+
dataChannelTokenType: 'llm-practice-session',
|
|
16724
|
+
},
|
|
16725
|
+
});
|
|
16726
|
+
});
|
|
16727
|
+
});
|
|
16728
|
+
describe('#getDataChannelTokenType', () => {
|
|
16729
|
+
it('returns PracticeSession when webinar is in practice session mode', () => {
|
|
16730
|
+
meeting.webinar = {
|
|
16731
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
16732
|
+
};
|
|
16733
|
+
|
|
16734
|
+
const result = meeting.getDataChannelTokenType();
|
|
16735
|
+
|
|
16736
|
+
expect(result).to.equal('llm-practice-session');
|
|
16737
|
+
});
|
|
16738
|
+
|
|
16739
|
+
it('returns Default when not in practice session mode', () => {
|
|
16740
|
+
meeting.webinar = {
|
|
16741
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
16742
|
+
};
|
|
16743
|
+
|
|
16744
|
+
const result = meeting.getDataChannelTokenType();
|
|
16745
|
+
|
|
16746
|
+
expect(result).to.equal('llm-default-session');
|
|
16747
|
+
});
|
|
16748
|
+
});
|
|
14042
16749
|
describe('#stopKeepAlive', () => {
|
|
14043
16750
|
let clock;
|
|
14044
16751
|
const defaultKeepAliveUrl = 'keep.alive.url';
|
|
@@ -14159,16 +16866,25 @@ describe('plugin-meetings', () => {
|
|
|
14159
16866
|
assert.notCalled(meeting.meetingRequest.sendReaction);
|
|
14160
16867
|
});
|
|
14161
16868
|
|
|
14162
|
-
it('should
|
|
16869
|
+
it('should send a custom reaction type not in the known list', async () => {
|
|
14163
16870
|
meeting.locusInfo.controls = {reactions: {reactionChannelUrl: 'Fake URL'}};
|
|
14164
16871
|
|
|
14165
|
-
|
|
14166
|
-
meeting.sendReaction('invalid_reaction', 'light'),
|
|
14167
|
-
Error,
|
|
14168
|
-
'invalid_reaction is not a valid reaction.'
|
|
14169
|
-
);
|
|
16872
|
+
const reactionPromise = meeting.sendReaction('custom_reaction', 'light');
|
|
14170
16873
|
|
|
14171
|
-
assert.
|
|
16874
|
+
assert.exists(reactionPromise.then);
|
|
16875
|
+
await reactionPromise;
|
|
16876
|
+
assert.calledOnceWithExactly(meeting.meetingRequest.sendReaction, {
|
|
16877
|
+
reactionChannelUrl: 'Fake URL',
|
|
16878
|
+
reaction: {
|
|
16879
|
+
type: 'custom_reaction',
|
|
16880
|
+
tone: {
|
|
16881
|
+
type: 'light_skin_tone',
|
|
16882
|
+
codepoints: '1F3FB',
|
|
16883
|
+
shortcodes: ':skin-tone-2:',
|
|
16884
|
+
},
|
|
16885
|
+
},
|
|
16886
|
+
participantId: meeting.members.selfId,
|
|
16887
|
+
});
|
|
14172
16888
|
});
|
|
14173
16889
|
|
|
14174
16890
|
it('should send a reaction with default skin tone if provided skinToneType is invalid ', async () => {
|
|
@@ -15192,4 +17908,4 @@ describe('plugin-meetings', () => {
|
|
|
15192
17908
|
assert.calledOnceWithExactly(meeting.meetingRequest.cancelSipCallOut, participantId);
|
|
15193
17909
|
});
|
|
15194
17910
|
});
|
|
15195
|
-
});
|
|
17911
|
+
});
|