@webex/plugin-meetings 3.12.0-webex-services-ready.4 → 3.13.0-next.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/.sdd/manifest.json +1312 -0
- package/.sdd/templates/.source.json +30 -0
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
- package/.sdd/templates/component-repo/template-map.json +112 -0
- package/AGENTS.md +130 -4
- package/ai-docs/ARCHITECTURE.md +208 -0
- package/ai-docs/CONTRACTS.md +267 -0
- package/ai-docs/DATA_MODEL.md +64 -0
- package/ai-docs/GETTING_STARTED.md +73 -0
- package/ai-docs/GLOSSARY.md +56 -0
- package/ai-docs/REVIEW_CHECKLIST.md +45 -0
- package/ai-docs/RULES.md +79 -0
- package/ai-docs/SECURITY.md +74 -0
- package/ai-docs/SERVICE_STATE.md +59 -0
- package/ai-docs/SPEC_INDEX.md +85 -0
- package/ai-docs/TEST_INDEX.md +45 -0
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
- package/ai-docs/patterns/defensive-error-propagation.md +55 -0
- package/ai-docs/patterns/event-scope-emission.md +46 -0
- package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
- package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
- package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
- package/assets/README.md +28 -0
- package/assets/e2ee-0.0.1.js +2 -0
- package/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/annotation/index.js +55 -19
- package/dist/annotation/index.js.map +1 -1
- package/dist/assets/e2ee-0.0.1.js +2 -0
- package/dist/assets/e2ee-0.0.1.wasm +0 -0
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +39 -5
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +7 -2
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +6 -5
- package/dist/constants.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +101 -48
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +41 -59
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interceptors/locusRetry.js +1 -1
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interpretation/index.js +46 -12
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +236 -80
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js +2 -1
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +225 -175
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/meeting/index.js +355 -299
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +8 -2
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +10 -3
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +72 -31
- package/dist/meetings/index.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +32 -4
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +11 -1
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/common/errors/webex-errors.d.ts +6 -2
- package/dist/types/config.d.ts +1 -0
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locus-info/index.d.ts +45 -1
- package/dist/types/locus-info/types.d.ts +1 -0
- package/dist/types/media/MediaConnectionAwaiter.d.ts +61 -53
- package/dist/types/meeting/index.d.ts +49 -12
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +2 -1
- package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
- package/dist/types/multistream/sendSlotManager.d.ts +5 -1
- package/dist/webinar/index.js +298 -255
- package/dist/webinar/index.js.map +1 -1
- package/package.json +25 -23
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
- package/src/annotation/ai-docs/annotation-spec.md +236 -0
- package/src/annotation/index.ts +61 -29
- package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
- package/src/breakouts/index.ts +35 -2
- package/src/common/errors/webex-errors.ts +8 -2
- package/src/config.ts +5 -1
- package/src/constants.ts +2 -1
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
- package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
- package/src/hashTree/hashTreeParser.ts +67 -3
- package/src/index.ts +1 -0
- package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
- package/src/interceptors/dataChannelAuthToken.ts +48 -77
- package/src/interceptors/locusRetry.ts +1 -1
- package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
- package/src/interpretation/index.ts +38 -1
- package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
- package/src/locus-info/index.ts +156 -35
- package/src/locus-info/types.ts +1 -0
- package/src/media/MediaConnectionAwaiter.ts +223 -207
- package/src/media/ai-docs/media-spec.md +267 -0
- package/src/meeting/ai-docs/meeting-spec.md +404 -0
- package/src/meeting/index.ts +332 -296
- package/src/meeting/util.ts +7 -4
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
- package/src/meeting-info/meeting-info-v2.ts +7 -2
- package/src/meetings/ai-docs/meetings-spec.md +296 -0
- package/src/meetings/index.ts +59 -23
- package/src/member/ai-docs/member-spec.md +196 -0
- package/src/members/ai-docs/members-spec.md +256 -0
- package/src/metrics/ai-docs/metrics-spec.md +185 -0
- package/src/multistream/ai-docs/multistream-spec.md +295 -0
- package/src/multistream/remoteMediaManager.ts +23 -1
- package/src/multistream/sendSlotManager.ts +15 -1
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
- package/src/reachability/ai-docs/reachability-spec.md +261 -0
- package/src/reactions/ai-docs/reactions-spec.md +198 -0
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
- package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
- package/src/roap/ai-docs/roap-spec.md +241 -0
- package/src/webinar/ai-docs/webinar-spec.md +243 -0
- package/src/webinar/index.ts +168 -188
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/index.ts +145 -13
- package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
- package/test/unit/spec/interceptors/locusRetry.ts +29 -1
- package/test/unit/spec/interpretation/index.ts +93 -0
- package/test/unit/spec/locus-info/index.js +397 -0
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +426 -19
- package/test/unit/spec/media/properties.ts +3 -3
- package/test/unit/spec/meeting/index.js +1219 -723
- package/test/unit/spec/meeting/utils.js +52 -18
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +69 -1
- package/test/unit/spec/meetings/index.js +145 -43
- package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
- package/test/unit/spec/webinar/index.ts +886 -718
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
DESTINATION_TYPE,
|
|
27
27
|
MEETING_REMOVED_REASON,
|
|
28
28
|
LOCUSINFO,
|
|
29
|
-
|
|
29
|
+
ICE_CONNECTION_TIMEOUT,
|
|
30
30
|
DISPLAY_HINTS,
|
|
31
31
|
SELF_POLICY,
|
|
32
32
|
IP_VERSION,
|
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
OFFLINE,
|
|
36
36
|
ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT,
|
|
37
37
|
LOCUS_LLM_EVENT,
|
|
38
|
-
LLM_PRACTICE_SESSION,
|
|
39
38
|
RECORDING_STATE,
|
|
40
39
|
} from '@webex/plugin-meetings/src/constants';
|
|
41
40
|
import {
|
|
@@ -287,7 +286,37 @@ describe('plugin-meetings', () => {
|
|
|
287
286
|
});
|
|
288
287
|
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
289
288
|
webex.internal.llm.on = sinon.stub();
|
|
289
|
+
// Factory pattern: createChannel returns a mock channel
|
|
290
|
+
webex.internal.llm.createChannel = sinon.stub().callsFake(() => ({
|
|
291
|
+
registerAndConnect: sinon.stub().resolves({}),
|
|
292
|
+
disconnect: sinon.stub().resolves(),
|
|
293
|
+
isConnected: sinon.stub().returns(false),
|
|
294
|
+
isConnecting: sinon.stub().returns(false),
|
|
295
|
+
getLocusUrl: sinon.stub().returns(undefined),
|
|
296
|
+
getDatachannelUrl: sinon.stub().returns(undefined),
|
|
297
|
+
getDatachannelToken: sinon.stub().returns(undefined),
|
|
298
|
+
setDatachannelToken: sinon.stub(),
|
|
299
|
+
getBinding: sinon.stub().returns(undefined),
|
|
300
|
+
setRefreshHandler: sinon.stub(),
|
|
301
|
+
on: sinon.stub(),
|
|
302
|
+
off: sinon.stub(),
|
|
303
|
+
}));
|
|
290
304
|
webex.internal.voicea.announce = sinon.stub();
|
|
305
|
+
// Factory pattern: createChannel returns a mock voicea channel
|
|
306
|
+
webex.internal.voicea.createChannel = sinon.stub().callsFake(() => ({
|
|
307
|
+
on: sinon.stub(),
|
|
308
|
+
off: sinon.stub(),
|
|
309
|
+
onSpokenLanguageUpdate: sinon.stub(),
|
|
310
|
+
onCaptionServiceIdUpdate: sinon.stub(),
|
|
311
|
+
requestLanguage: sinon.stub(),
|
|
312
|
+
setSpokenLanguage: sinon.stub(),
|
|
313
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
314
|
+
listenToEvents: sinon.stub(),
|
|
315
|
+
deregisterEvents: sinon.stub(),
|
|
316
|
+
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
317
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
318
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
319
|
+
}));
|
|
291
320
|
webex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
292
321
|
{},
|
|
293
322
|
{parent: webex}
|
|
@@ -339,6 +368,27 @@ describe('plugin-meetings', () => {
|
|
|
339
368
|
});
|
|
340
369
|
|
|
341
370
|
describe('meeting index', () => {
|
|
371
|
+
/**
|
|
372
|
+
* Creates a mock LLM channel with sensible defaults that can be overridden.
|
|
373
|
+
* @param {Object} overrides - Properties to override on the mock channel
|
|
374
|
+
* @returns {Object} Mock channel object with sinon stubs
|
|
375
|
+
*/
|
|
376
|
+
const createMockLLMChannel = (overrides = {}) => ({
|
|
377
|
+
registerAndConnect: sinon.stub().resolves({}),
|
|
378
|
+
disconnect: sinon.stub().resolves(),
|
|
379
|
+
isConnected: sinon.stub().returns(false),
|
|
380
|
+
isConnecting: sinon.stub().returns(false),
|
|
381
|
+
getLocusUrl: sinon.stub().returns(undefined),
|
|
382
|
+
getDatachannelUrl: sinon.stub().returns(undefined),
|
|
383
|
+
getDatachannelToken: sinon.stub().returns(undefined),
|
|
384
|
+
setDatachannelToken: sinon.stub(),
|
|
385
|
+
getBinding: sinon.stub().returns(undefined),
|
|
386
|
+
setRefreshHandler: sinon.stub(),
|
|
387
|
+
on: sinon.stub(),
|
|
388
|
+
off: sinon.stub(),
|
|
389
|
+
...overrides,
|
|
390
|
+
});
|
|
391
|
+
|
|
342
392
|
describe('Public Api Contract', () => {
|
|
343
393
|
describe('#constructor', () => {
|
|
344
394
|
it('should have created a meeting object with public properties', () => {
|
|
@@ -524,6 +574,11 @@ describe('plugin-meetings', () => {
|
|
|
524
574
|
localWebex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
525
575
|
localWebex.internal.llm.on = sinon.stub();
|
|
526
576
|
localWebex.internal.voicea.announce = sinon.stub();
|
|
577
|
+
localWebex.internal.voicea.createChannel = sinon.stub().returns({
|
|
578
|
+
on: sinon.stub(),
|
|
579
|
+
off: sinon.stub(),
|
|
580
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
581
|
+
});
|
|
527
582
|
localWebex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
528
583
|
{},
|
|
529
584
|
{parent: localWebex}
|
|
@@ -1181,6 +1236,78 @@ describe('plugin-meetings', () => {
|
|
|
1181
1236
|
assert.calledWith(suspendDestroyMeetingStub.thirdCall, false);
|
|
1182
1237
|
});
|
|
1183
1238
|
|
|
1239
|
+
it('should not retry if join() fails because the Locus user capacity is full', async () => {
|
|
1240
|
+
const error = new Error('Error Joining Meeting');
|
|
1241
|
+
error.error = {
|
|
1242
|
+
statusCode: 423,
|
|
1243
|
+
body: {errorCode: 2423001},
|
|
1244
|
+
};
|
|
1245
|
+
meeting.join = sinon.stub().rejects(error);
|
|
1246
|
+
|
|
1247
|
+
const thrownError = await assert.isRejected(
|
|
1248
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1249
|
+
);
|
|
1250
|
+
|
|
1251
|
+
assert.equal(thrownError, error);
|
|
1252
|
+
assert.calledOnce(meeting.join);
|
|
1253
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
1254
|
+
assert.calledOnce(Metrics.sendBehavioralMetric);
|
|
1255
|
+
assert.calledTwice(suspendDestroyMeetingStub);
|
|
1256
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1257
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, false);
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
it('should still retry if join() fails with another HTTP 423 Locus error', async () => {
|
|
1261
|
+
const error = new Error('Error Joining Meeting');
|
|
1262
|
+
error.error = {
|
|
1263
|
+
statusCode: 423,
|
|
1264
|
+
body: {errorCode: 2423028},
|
|
1265
|
+
};
|
|
1266
|
+
meeting.join = sinon.stub().rejects(error);
|
|
1267
|
+
|
|
1268
|
+
const thrownError = await assert.isRejected(
|
|
1269
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1270
|
+
);
|
|
1271
|
+
|
|
1272
|
+
assert.equal(thrownError, error);
|
|
1273
|
+
assert.calledTwice(meeting.join);
|
|
1274
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1275
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
it('should throw the Locus user full error over firstError when the retry hits full capacity', async () => {
|
|
1279
|
+
const firstJoinError = new Error('first join error');
|
|
1280
|
+
const capacityError = new Error('Error Joining Meeting');
|
|
1281
|
+
capacityError.error = {
|
|
1282
|
+
statusCode: 423,
|
|
1283
|
+
body: {errorCode: 2423001},
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
meeting.join = sinon
|
|
1287
|
+
.stub()
|
|
1288
|
+
.onFirstCall()
|
|
1289
|
+
.rejects(firstJoinError)
|
|
1290
|
+
.onSecondCall()
|
|
1291
|
+
.rejects(capacityError);
|
|
1292
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1293
|
+
|
|
1294
|
+
const thrownError = await assert.isRejected(
|
|
1295
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1296
|
+
);
|
|
1297
|
+
|
|
1298
|
+
// join() runs once for the first attempt and once for the re-join
|
|
1299
|
+
assert.calledTwice(meeting.join);
|
|
1300
|
+
// the capacity error must take precedence over the stored firstError
|
|
1301
|
+
assert.equal(thrownError, capacityError);
|
|
1302
|
+
|
|
1303
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1304
|
+
retryCount: 0,
|
|
1305
|
+
prevJoinResponse: undefined,
|
|
1306
|
+
firstError: undefined,
|
|
1307
|
+
prevError: undefined,
|
|
1308
|
+
});
|
|
1309
|
+
});
|
|
1310
|
+
|
|
1184
1311
|
it('should re-join on retry when join() fails on first attempt, and throw the first error if join fails again', async () => {
|
|
1185
1312
|
const firstJoinError = new Error('first join error');
|
|
1186
1313
|
const secondJoinError = new Error('second join error');
|
|
@@ -1635,8 +1762,12 @@ describe('plugin-meetings', () => {
|
|
|
1635
1762
|
const fakeMediaConnection = {
|
|
1636
1763
|
close: sinon.stub(),
|
|
1637
1764
|
getConnectionState: sinon.stub().returns(ConnectionState.Connected),
|
|
1765
|
+
getPeerConnectionState: sinon.stub().returns('connected'),
|
|
1766
|
+
getIceConnectionState: sinon.stub().returns('completed'),
|
|
1767
|
+
getIceGatheringState: sinon.stub().returns('complete'),
|
|
1638
1768
|
initiateOffer: sinon.stub().resolves({}),
|
|
1639
1769
|
on: sinon.stub(),
|
|
1770
|
+
off: sinon.stub(),
|
|
1640
1771
|
createSendSlot: sinon.stub(),
|
|
1641
1772
|
};
|
|
1642
1773
|
|
|
@@ -2180,41 +2311,53 @@ describe('plugin-meetings', () => {
|
|
|
2180
2311
|
});
|
|
2181
2312
|
|
|
2182
2313
|
describe('#update hesiod llm id', () => {
|
|
2314
|
+
let mockVoiceaChannel;
|
|
2183
2315
|
beforeEach(() => {
|
|
2184
|
-
|
|
2316
|
+
mockVoiceaChannel = {
|
|
2317
|
+
onCaptionServiceIdUpdate: sinon.stub(),
|
|
2318
|
+
on: sinon.stub(),
|
|
2319
|
+
off: sinon.stub(),
|
|
2320
|
+
};
|
|
2321
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2185
2322
|
});
|
|
2186
2323
|
afterEach(() => {
|
|
2187
2324
|
// Restore the original methods after each test
|
|
2188
2325
|
sinon.restore();
|
|
2189
2326
|
});
|
|
2190
|
-
it('should call
|
|
2327
|
+
it('should call voiceaChannel.onCaptionServiceIdUpdate when joined', async () => {
|
|
2191
2328
|
meeting.joinedWith = {state: 'JOINED'};
|
|
2192
2329
|
await meeting.locusInfo.emitScoped(
|
|
2193
2330
|
{function: 'test', file: 'test'},
|
|
2194
2331
|
LOCUSINFO.EVENTS.CONTROLS_MEETING_HESIOD_LLM_ID_UPDATED,
|
|
2195
2332
|
{hesiodLlmId: '123a-456b-789c'}
|
|
2196
2333
|
);
|
|
2197
|
-
assert.calledWith(
|
|
2334
|
+
assert.calledWith(mockVoiceaChannel.onCaptionServiceIdUpdate, '123a-456b-789c');
|
|
2198
2335
|
});
|
|
2199
2336
|
});
|
|
2200
2337
|
|
|
2201
2338
|
describe('#update spoken language', () => {
|
|
2339
|
+
let mockVoiceaChannel;
|
|
2202
2340
|
beforeEach(() => {
|
|
2203
|
-
|
|
2341
|
+
mockVoiceaChannel = {
|
|
2342
|
+
onSpokenLanguageUpdate: sinon.stub(),
|
|
2343
|
+
on: sinon.stub(),
|
|
2344
|
+
off: sinon.stub(),
|
|
2345
|
+
};
|
|
2346
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2204
2347
|
meeting.transcription = {languageOptions: {currentSpokenLanguage: 'en'}};
|
|
2205
2348
|
});
|
|
2206
2349
|
afterEach(() => {
|
|
2207
2350
|
// Restore the original methods after each test
|
|
2208
2351
|
sinon.restore();
|
|
2209
2352
|
});
|
|
2210
|
-
it('should call
|
|
2353
|
+
it('should call voiceaChannel.onSpokenLanguageUpdate when joined', async () => {
|
|
2211
2354
|
meeting.joinedWith = {state: 'JOINED'};
|
|
2212
2355
|
await meeting.locusInfo.emitScoped(
|
|
2213
2356
|
{function: 'test', file: 'test'},
|
|
2214
2357
|
LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIPTION_SPOKEN_LANGUAGE_UPDATED,
|
|
2215
2358
|
{spokenLanguage: 'fr'}
|
|
2216
2359
|
);
|
|
2217
|
-
assert.calledWith(
|
|
2360
|
+
assert.calledWith(mockVoiceaChannel.onSpokenLanguageUpdate, 'fr', meeting.id);
|
|
2218
2361
|
assert.equal(meeting.transcription.languageOptions.currentSpokenLanguage, 'fr');
|
|
2219
2362
|
assert.calledWith(
|
|
2220
2363
|
TriggerProxy.trigger,
|
|
@@ -2224,24 +2367,29 @@ describe('plugin-meetings', () => {
|
|
|
2224
2367
|
);
|
|
2225
2368
|
});
|
|
2226
2369
|
|
|
2227
|
-
it('should also call
|
|
2370
|
+
it('should also call voiceaChannel.onSpokenLanguageUpdate when not joined', async () => {
|
|
2228
2371
|
meeting.joinedWith = {state: 'NOT_JOINED'};
|
|
2229
2372
|
await meeting.locusInfo.emitScoped(
|
|
2230
2373
|
{function: 'test', file: 'test'},
|
|
2231
2374
|
LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIPTION_SPOKEN_LANGUAGE_UPDATED,
|
|
2232
2375
|
{spokenLanguage: 'de'}
|
|
2233
2376
|
);
|
|
2234
|
-
assert.calledWith(
|
|
2377
|
+
assert.calledWith(mockVoiceaChannel.onSpokenLanguageUpdate, 'de');
|
|
2235
2378
|
assert.equal(meeting.transcription.languageOptions.currentSpokenLanguage, 'de');
|
|
2236
2379
|
});
|
|
2237
2380
|
});
|
|
2238
2381
|
|
|
2239
2382
|
describe('#startTranscription', () => {
|
|
2383
|
+
let mockVoiceaChannel;
|
|
2384
|
+
|
|
2240
2385
|
beforeEach(() => {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2386
|
+
mockVoiceaChannel = {
|
|
2387
|
+
on: sinon.stub(),
|
|
2388
|
+
off: sinon.stub(),
|
|
2389
|
+
listenToEvents: sinon.stub(),
|
|
2390
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
2391
|
+
};
|
|
2392
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2245
2393
|
});
|
|
2246
2394
|
|
|
2247
2395
|
it('should subscribe to events for the first time and avoid subscribing for future transcription starts', async () => {
|
|
@@ -2253,16 +2401,14 @@ describe('plugin-meetings', () => {
|
|
|
2253
2401
|
|
|
2254
2402
|
await meeting.startTranscription();
|
|
2255
2403
|
|
|
2256
|
-
assert.equal(
|
|
2404
|
+
assert.equal(mockVoiceaChannel.on.callCount, 4);
|
|
2257
2405
|
assert.equal(meeting.areVoiceaEventsSetup, true);
|
|
2258
|
-
assert.
|
|
2259
|
-
assert.called(webex.internal.voicea.turnOnCaptions);
|
|
2406
|
+
assert.calledOnce(mockVoiceaChannel.turnOnCaptions);
|
|
2260
2407
|
|
|
2261
2408
|
await meeting.startTranscription();
|
|
2262
|
-
assert.equal(
|
|
2409
|
+
assert.equal(mockVoiceaChannel.on.callCount, 4);
|
|
2263
2410
|
assert.equal(meeting.areVoiceaEventsSetup, true);
|
|
2264
|
-
assert.
|
|
2265
|
-
assert.calledTwice(webex.internal.voicea.turnOnCaptions);
|
|
2411
|
+
assert.calledTwice(mockVoiceaChannel.turnOnCaptions);
|
|
2266
2412
|
});
|
|
2267
2413
|
|
|
2268
2414
|
it('should listen to events and turnOnCaptions for all users', async () => {
|
|
@@ -2273,10 +2419,9 @@ describe('plugin-meetings', () => {
|
|
|
2273
2419
|
|
|
2274
2420
|
await meeting.startTranscription();
|
|
2275
2421
|
|
|
2276
|
-
assert.equal(
|
|
2422
|
+
assert.equal(mockVoiceaChannel.on.callCount, 4);
|
|
2277
2423
|
assert.equal(meeting.areVoiceaEventsSetup, true);
|
|
2278
|
-
assert.
|
|
2279
|
-
assert.calledOnce(webex.internal.voicea.turnOnCaptions);
|
|
2424
|
+
assert.calledOnce(mockVoiceaChannel.turnOnCaptions);
|
|
2280
2425
|
});
|
|
2281
2426
|
|
|
2282
2427
|
it("should throw error if request doesn't work", async () => {
|
|
@@ -2291,17 +2436,22 @@ describe('plugin-meetings', () => {
|
|
|
2291
2436
|
});
|
|
2292
2437
|
|
|
2293
2438
|
describe('#stopTranscription', () => {
|
|
2439
|
+
let mockVoiceaChannel;
|
|
2440
|
+
|
|
2294
2441
|
beforeEach(() => {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2442
|
+
mockVoiceaChannel = {
|
|
2443
|
+
on: sinon.stub(),
|
|
2444
|
+
off: sinon.stub(),
|
|
2445
|
+
listenToEvents: sinon.stub(),
|
|
2446
|
+
turnOnCaptions: sinon.stub(),
|
|
2447
|
+
deregisterEvents: sinon.stub(),
|
|
2448
|
+
};
|
|
2449
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2300
2450
|
});
|
|
2301
2451
|
|
|
2302
2452
|
it('should stop listening to voicea events and also trigger a stop event', () => {
|
|
2303
2453
|
meeting.stopTranscription();
|
|
2304
|
-
assert.equal(
|
|
2454
|
+
assert.equal(mockVoiceaChannel.off.callCount, 4);
|
|
2305
2455
|
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2306
2456
|
assert.calledWith(
|
|
2307
2457
|
TriggerProxy.trigger,
|
|
@@ -2317,7 +2467,7 @@ describe('plugin-meetings', () => {
|
|
|
2317
2467
|
it('should stop listening to voicea events even when transcription is undefined', () => {
|
|
2318
2468
|
meeting.transcription = undefined;
|
|
2319
2469
|
meeting.stopTranscription();
|
|
2320
|
-
assert.equal(
|
|
2470
|
+
assert.equal(mockVoiceaChannel.off.callCount, 4);
|
|
2321
2471
|
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2322
2472
|
assert.calledWith(
|
|
2323
2473
|
TriggerProxy.trigger,
|
|
@@ -2332,13 +2482,18 @@ describe('plugin-meetings', () => {
|
|
|
2332
2482
|
});
|
|
2333
2483
|
|
|
2334
2484
|
describe('#setCaptionLanguage', () => {
|
|
2485
|
+
let mockVoiceaChannel;
|
|
2486
|
+
|
|
2335
2487
|
beforeEach(() => {
|
|
2336
2488
|
meeting.isTranscriptionSupported = sinon.stub();
|
|
2337
2489
|
meeting.transcription = {languageOptions: {}};
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2490
|
+
mockVoiceaChannel = {
|
|
2491
|
+
on: sinon.stub(),
|
|
2492
|
+
off: sinon.stub(),
|
|
2493
|
+
setCaptionLanguage: sinon.stub(),
|
|
2494
|
+
requestLanguage: sinon.stub(),
|
|
2495
|
+
};
|
|
2496
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2342
2497
|
});
|
|
2343
2498
|
|
|
2344
2499
|
afterEach(() => {
|
|
@@ -2360,7 +2515,7 @@ describe('plugin-meetings', () => {
|
|
|
2360
2515
|
const languageCode = 'fr';
|
|
2361
2516
|
|
|
2362
2517
|
meeting.setCaptionLanguage(languageCode).then((resolvedLanguageCode) => {
|
|
2363
|
-
assert.calledWith(
|
|
2518
|
+
assert.calledWith(mockVoiceaChannel.requestLanguage, languageCode);
|
|
2364
2519
|
assert.equal(resolvedLanguageCode, languageCode);
|
|
2365
2520
|
assert.equal(
|
|
2366
2521
|
meeting.transcription.languageOptions.currentCaptionLanguage,
|
|
@@ -2369,13 +2524,10 @@ describe('plugin-meetings', () => {
|
|
|
2369
2524
|
done();
|
|
2370
2525
|
});
|
|
2371
2526
|
|
|
2372
|
-
assert.calledOnceWithMatch(
|
|
2373
|
-
webex.internal.voicea.on,
|
|
2374
|
-
VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE
|
|
2375
|
-
);
|
|
2527
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE);
|
|
2376
2528
|
|
|
2377
2529
|
// Trigger the event
|
|
2378
|
-
const voiceaListenerLangugeUpdate =
|
|
2530
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2379
2531
|
voiceaListenerLangugeUpdate({statusCode: 200, languageCode});
|
|
2380
2532
|
});
|
|
2381
2533
|
|
|
@@ -2392,24 +2544,26 @@ describe('plugin-meetings', () => {
|
|
|
2392
2544
|
done();
|
|
2393
2545
|
});
|
|
2394
2546
|
|
|
2395
|
-
assert.calledOnceWithMatch(
|
|
2396
|
-
webex.internal.voicea.on,
|
|
2397
|
-
VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE
|
|
2398
|
-
);
|
|
2547
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE);
|
|
2399
2548
|
|
|
2400
2549
|
// Trigger the event
|
|
2401
|
-
const voiceaListenerLangugeUpdate =
|
|
2550
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2402
2551
|
voiceaListenerLangugeUpdate(rejectPayload);
|
|
2403
2552
|
});
|
|
2404
2553
|
});
|
|
2405
2554
|
|
|
2406
2555
|
describe('#setSpokenLanguage', () => {
|
|
2556
|
+
let mockVoiceaChannel;
|
|
2557
|
+
|
|
2407
2558
|
beforeEach(() => {
|
|
2408
2559
|
meeting.isTranscriptionSupported = sinon.stub();
|
|
2409
2560
|
meeting.transcription = {languageOptions: {}};
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2561
|
+
mockVoiceaChannel = {
|
|
2562
|
+
on: sinon.stub(),
|
|
2563
|
+
off: sinon.stub(),
|
|
2564
|
+
setSpokenLanguage: sinon.stub(),
|
|
2565
|
+
};
|
|
2566
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2413
2567
|
meeting.roles = ['MODERATOR'];
|
|
2414
2568
|
});
|
|
2415
2569
|
|
|
@@ -2442,16 +2596,16 @@ describe('plugin-meetings', () => {
|
|
|
2442
2596
|
const languageCode = 'fr';
|
|
2443
2597
|
|
|
2444
2598
|
meeting.setSpokenLanguage(languageCode).then((resolvedLanguageCode) => {
|
|
2445
|
-
assert.calledWith(
|
|
2599
|
+
assert.calledWith(mockVoiceaChannel.setSpokenLanguage, languageCode);
|
|
2446
2600
|
assert.equal(resolvedLanguageCode, languageCode);
|
|
2447
2601
|
assert.equal(meeting.transcription.languageOptions.currentSpokenLanguage, languageCode);
|
|
2448
2602
|
done();
|
|
2449
2603
|
});
|
|
2450
2604
|
|
|
2451
|
-
assert.calledOnceWithMatch(
|
|
2605
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE);
|
|
2452
2606
|
|
|
2453
2607
|
// Trigger the event
|
|
2454
|
-
const voiceaListenerLangugeUpdate =
|
|
2608
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2455
2609
|
voiceaListenerLangugeUpdate({languageCode});
|
|
2456
2610
|
});
|
|
2457
2611
|
|
|
@@ -2467,10 +2621,10 @@ describe('plugin-meetings', () => {
|
|
|
2467
2621
|
done();
|
|
2468
2622
|
});
|
|
2469
2623
|
|
|
2470
|
-
assert.calledOnceWithMatch(
|
|
2624
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE);
|
|
2471
2625
|
|
|
2472
2626
|
// Trigger the event
|
|
2473
|
-
const voiceaListenerLangugeUpdate =
|
|
2627
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2474
2628
|
voiceaListenerLangugeUpdate(rejectPayload);
|
|
2475
2629
|
});
|
|
2476
2630
|
});
|
|
@@ -2485,11 +2639,39 @@ describe('plugin-meetings', () => {
|
|
|
2485
2639
|
assert.calledWith(meeting.trigger, EVENT_TRIGGERS.MEETING_CAPTION_RECEIVED);
|
|
2486
2640
|
});
|
|
2487
2641
|
|
|
2488
|
-
it('should
|
|
2489
|
-
|
|
2490
|
-
|
|
2642
|
+
it('should retain and emit spoken languages for a host announcement', () => {
|
|
2643
|
+
const payload = {
|
|
2644
|
+
currentSpokenLanguage: 'en',
|
|
2645
|
+
spokenLanguages: ['en', 'fr'],
|
|
2646
|
+
};
|
|
2647
|
+
|
|
2648
|
+
sinon.stub(meeting, 'getCurUserType').returns('host');
|
|
2649
|
+
|
|
2650
|
+
meeting.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT](payload);
|
|
2651
|
+
|
|
2652
|
+
assert.deepEqual(meeting.transcription.languageOptions, payload);
|
|
2653
|
+
assert.calledWithExactly(
|
|
2654
|
+
meeting.trigger,
|
|
2655
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION,
|
|
2656
|
+
payload
|
|
2657
|
+
);
|
|
2658
|
+
});
|
|
2659
|
+
|
|
2660
|
+
it('should emit without spoken languages for a non-host while preserving them internally', () => {
|
|
2661
|
+
const payload = {
|
|
2662
|
+
currentSpokenLanguage: 'en',
|
|
2663
|
+
spokenLanguages: ['en', 'fr'],
|
|
2664
|
+
};
|
|
2665
|
+
|
|
2666
|
+
sinon.stub(meeting, 'getCurUserType').returns('attendee');
|
|
2667
|
+
|
|
2668
|
+
meeting.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT](payload);
|
|
2669
|
+
|
|
2670
|
+
assert.deepEqual(meeting.transcription.languageOptions.spokenLanguages, ['en', 'fr']);
|
|
2671
|
+
assert.calledWithExactly(
|
|
2491
2672
|
meeting.trigger,
|
|
2492
|
-
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION
|
|
2673
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION,
|
|
2674
|
+
{currentSpokenLanguage: 'en'}
|
|
2493
2675
|
);
|
|
2494
2676
|
});
|
|
2495
2677
|
|
|
@@ -2739,68 +2921,111 @@ describe('plugin-meetings', () => {
|
|
|
2739
2921
|
});
|
|
2740
2922
|
|
|
2741
2923
|
[
|
|
2924
|
+
// Main session scenarios (no practice session active)
|
|
2742
2925
|
{
|
|
2743
2926
|
title:
|
|
2744
|
-
'should skip a reaction when the
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2927
|
+
'should skip a reaction when the relay route does not match the LLM binding (main session)',
|
|
2928
|
+
route: 'wrong-route',
|
|
2929
|
+
channelBinding: 'main-binding',
|
|
2930
|
+
practiceSessionConnected: false,
|
|
2931
|
+
practiceSessionBinding: undefined,
|
|
2749
2932
|
shouldProcess: false,
|
|
2750
|
-
expectedSessionLabel: 'default session',
|
|
2751
2933
|
},
|
|
2752
2934
|
{
|
|
2753
|
-
title:
|
|
2754
|
-
|
|
2755
|
-
route: '
|
|
2756
|
-
|
|
2757
|
-
|
|
2935
|
+
title:
|
|
2936
|
+
'should process a reaction when the relay route matches the LLM binding (main session)',
|
|
2937
|
+
route: 'main-binding',
|
|
2938
|
+
channelBinding: 'main-binding',
|
|
2939
|
+
practiceSessionConnected: false,
|
|
2940
|
+
practiceSessionBinding: undefined,
|
|
2758
2941
|
shouldProcess: true,
|
|
2759
2942
|
},
|
|
2760
2943
|
{
|
|
2761
|
-
title:
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2944
|
+
title: 'should process a reaction when no LLM channel exists',
|
|
2945
|
+
route: 'some-route',
|
|
2946
|
+
channelBinding: null, // No channel
|
|
2947
|
+
practiceSessionConnected: false,
|
|
2948
|
+
practiceSessionBinding: undefined,
|
|
2949
|
+
shouldProcess: true,
|
|
2950
|
+
},
|
|
2951
|
+
{
|
|
2952
|
+
title: 'should process a reaction when LLM channel has no binding',
|
|
2953
|
+
route: 'some-route',
|
|
2954
|
+
channelBinding: undefined, // Channel exists but no binding
|
|
2955
|
+
practiceSessionConnected: false,
|
|
2956
|
+
practiceSessionBinding: undefined,
|
|
2957
|
+
shouldProcess: true,
|
|
2958
|
+
},
|
|
2959
|
+
// Practice session active scenarios
|
|
2960
|
+
{
|
|
2961
|
+
title: 'should skip a reaction routed to main binding when practice session is active',
|
|
2962
|
+
route: 'main-binding',
|
|
2963
|
+
channelBinding: 'main-binding',
|
|
2964
|
+
practiceSessionConnected: true,
|
|
2965
|
+
practiceSessionBinding: 'ps-binding',
|
|
2966
|
+
shouldProcess: false,
|
|
2967
|
+
},
|
|
2968
|
+
{
|
|
2969
|
+
title: 'should process a reaction routed to PS binding when practice session is active',
|
|
2970
|
+
route: 'ps-binding',
|
|
2971
|
+
channelBinding: 'main-binding',
|
|
2972
|
+
practiceSessionConnected: true,
|
|
2973
|
+
practiceSessionBinding: 'ps-binding',
|
|
2767
2974
|
shouldProcess: true,
|
|
2768
2975
|
},
|
|
2769
2976
|
{
|
|
2770
2977
|
title:
|
|
2771
|
-
'should skip a reaction
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2978
|
+
'should skip a reaction routed to PS binding when practice session is NOT active',
|
|
2979
|
+
route: 'ps-binding',
|
|
2980
|
+
channelBinding: 'main-binding',
|
|
2981
|
+
practiceSessionConnected: false,
|
|
2982
|
+
practiceSessionBinding: 'ps-binding',
|
|
2776
2983
|
shouldProcess: false,
|
|
2777
|
-
|
|
2984
|
+
},
|
|
2985
|
+
{
|
|
2986
|
+
title:
|
|
2987
|
+
'should process a reaction routed to main binding when practice session is NOT active',
|
|
2988
|
+
route: 'main-binding',
|
|
2989
|
+
channelBinding: 'main-binding',
|
|
2990
|
+
practiceSessionConnected: false,
|
|
2991
|
+
practiceSessionBinding: 'ps-binding',
|
|
2992
|
+
shouldProcess: true,
|
|
2778
2993
|
},
|
|
2779
2994
|
].forEach(
|
|
2780
2995
|
({
|
|
2781
2996
|
title,
|
|
2782
|
-
isPracticeSessionConnected,
|
|
2783
2997
|
route,
|
|
2784
|
-
|
|
2785
|
-
|
|
2998
|
+
channelBinding,
|
|
2999
|
+
practiceSessionConnected,
|
|
3000
|
+
practiceSessionBinding,
|
|
2786
3001
|
shouldProcess,
|
|
2787
|
-
expectedSessionLabel,
|
|
2788
3002
|
}) => {
|
|
2789
3003
|
it(title, () => {
|
|
2790
3004
|
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2791
3005
|
meeting.config.receiveReactions = true;
|
|
2792
3006
|
const fakeSendersName = 'Fake reactors name';
|
|
2793
3007
|
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2794
|
-
webex.internal.llm.isConnected = sinon.stub().callsFake((llmSessionId) => {
|
|
2795
|
-
return llmSessionId === LLM_PRACTICE_SESSION && isPracticeSessionConnected;
|
|
2796
|
-
});
|
|
2797
|
-
webex.internal.llm.getBinding = sinon.stub().callsFake((llmSessionId) => {
|
|
2798
|
-
if (llmSessionId === LLM_PRACTICE_SESSION) {
|
|
2799
|
-
return practiceBinding;
|
|
2800
|
-
}
|
|
2801
3008
|
|
|
2802
|
-
|
|
2803
|
-
|
|
3009
|
+
// Mock the llmChannel on the meeting
|
|
3010
|
+
if (channelBinding === null) {
|
|
3011
|
+
meeting.llmChannel = undefined;
|
|
3012
|
+
} else {
|
|
3013
|
+
meeting.llmChannel = {
|
|
3014
|
+
getBinding: sinon.stub().returns(channelBinding),
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
// Mock the webinar with practice session state
|
|
3019
|
+
meeting.webinar = {
|
|
3020
|
+
_practiceSessionLLMChannel: practiceSessionConnected
|
|
3021
|
+
? {isConnected: sinon.stub().returns(true)}
|
|
3022
|
+
: undefined,
|
|
3023
|
+
isPracticeSessionLLMChannelConnected: sinon
|
|
3024
|
+
.stub()
|
|
3025
|
+
.returns(practiceSessionConnected),
|
|
3026
|
+
getPracticeSessionBinding: sinon.stub().returns(practiceSessionBinding),
|
|
3027
|
+
};
|
|
3028
|
+
|
|
2804
3029
|
const fakeReactionPayload = {
|
|
2805
3030
|
type: 'fake_type',
|
|
2806
3031
|
codepoints: 'fake_codepoints',
|
|
@@ -2848,10 +3073,15 @@ describe('plugin-meetings', () => {
|
|
|
2848
3073
|
});
|
|
2849
3074
|
|
|
2850
3075
|
describe('#handleLLMOnline', () => {
|
|
3076
|
+
let mockVoiceaChannel;
|
|
3077
|
+
|
|
2851
3078
|
beforeEach(() => {
|
|
2852
3079
|
webex.internal.llm.off = sinon.stub();
|
|
2853
|
-
|
|
2854
|
-
|
|
3080
|
+
mockVoiceaChannel = {
|
|
3081
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
3082
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
3083
|
+
};
|
|
3084
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2855
3085
|
});
|
|
2856
3086
|
|
|
2857
3087
|
it('emits transcription connected events', () => {
|
|
@@ -2868,21 +3098,21 @@ describe('plugin-meetings', () => {
|
|
|
2868
3098
|
});
|
|
2869
3099
|
|
|
2870
3100
|
it('restores transcription subscription when caption intent is enabled', () => {
|
|
2871
|
-
|
|
3101
|
+
mockVoiceaChannel.getKeepTranscriptionSubscribed.returns(true);
|
|
2872
3102
|
|
|
2873
3103
|
meeting.handleLLMOnline();
|
|
2874
3104
|
|
|
2875
|
-
assert.calledOnceWithExactly(
|
|
3105
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.updateSubchannelSubscriptions, {
|
|
2876
3106
|
subscribe: ['transcription'],
|
|
2877
3107
|
});
|
|
2878
3108
|
});
|
|
2879
3109
|
|
|
2880
3110
|
it('does not restore transcription subscription when caption intent is disabled', () => {
|
|
2881
|
-
|
|
3111
|
+
mockVoiceaChannel.getKeepTranscriptionSubscribed.returns(false);
|
|
2882
3112
|
|
|
2883
3113
|
meeting.handleLLMOnline();
|
|
2884
3114
|
|
|
2885
|
-
assert.notCalled(
|
|
3115
|
+
assert.notCalled(mockVoiceaChannel.updateSubchannelSubscriptions);
|
|
2886
3116
|
});
|
|
2887
3117
|
|
|
2888
3118
|
it('calls syncAllHashTreeDatasets on locusInfo', () => {
|
|
@@ -2944,7 +3174,10 @@ describe('plugin-meetings', () => {
|
|
|
2944
3174
|
assert.calledOnce(MeetingUtil.joinMeeting);
|
|
2945
3175
|
assert.calledOnce(webex.internal.device.meetingStarted);
|
|
2946
3176
|
assert.equal(result, joinMeetingResult);
|
|
2947
|
-
|
|
3177
|
+
// With factory pattern, event is registered on the channel, not the plugin
|
|
3178
|
+
if (meeting.llmChannel) {
|
|
3179
|
+
assert.calledWith(meeting.llmChannel.on, 'online', meeting.handleLLMOnline);
|
|
3180
|
+
}
|
|
2948
3181
|
});
|
|
2949
3182
|
|
|
2950
3183
|
[true, false].forEach((enableMultistream) => {
|
|
@@ -3105,6 +3338,13 @@ describe('plugin-meetings', () => {
|
|
|
3105
3338
|
});
|
|
3106
3339
|
|
|
3107
3340
|
describe('llm', () => {
|
|
3341
|
+
beforeEach(() => {
|
|
3342
|
+
// Realistic post-sync locusInfo state: updateLLMConnection requires both
|
|
3343
|
+
// of these to be populated before it will create/register a channel.
|
|
3344
|
+
meeting.locusInfo.url = 'https://locus-a.example.com/locus/api/v1/loci/locus-id';
|
|
3345
|
+
meeting.locusInfo.info = {datachannelUrl: 'https://example.com/datachannel-url'};
|
|
3346
|
+
});
|
|
3347
|
+
|
|
3108
3348
|
it('makes sure that join does not wait for update llm connection promise', async () => {
|
|
3109
3349
|
const defer = new Defer();
|
|
3110
3350
|
|
|
@@ -3170,12 +3410,14 @@ describe('plugin-meetings', () => {
|
|
|
3170
3410
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3171
3411
|
|
|
3172
3412
|
let locusLLMEventListener;
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3413
|
+
const mockChannel = createMockLLMChannel({
|
|
3414
|
+
on: sinon.stub().callsFake((eventName, callback) => {
|
|
3415
|
+
if (eventName === 'event:locus.state_message') {
|
|
3416
|
+
locusLLMEventListener = callback;
|
|
3417
|
+
}
|
|
3418
|
+
}),
|
|
3177
3419
|
});
|
|
3178
|
-
|
|
3420
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3179
3421
|
|
|
3180
3422
|
meeting.updateLLMConnection.restore();
|
|
3181
3423
|
|
|
@@ -3198,9 +3440,9 @@ describe('plugin-meetings', () => {
|
|
|
3198
3440
|
|
|
3199
3441
|
it('UpdateLLMConnection sends a metric if not connected after timeout', async () => {
|
|
3200
3442
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3443
|
+
|
|
3444
|
+
const mockChannel = createMockLLMChannel({hasEverConnected: true});
|
|
3445
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3204
3446
|
|
|
3205
3447
|
meeting.updateLLMConnection.restore();
|
|
3206
3448
|
|
|
@@ -3274,10 +3516,10 @@ describe('plugin-meetings', () => {
|
|
|
3274
3516
|
|
|
3275
3517
|
it('does not emit failed breakout join response metric when breakout session is missing', async () => {
|
|
3276
3518
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3519
|
+
const mockChannel = createMockLLMChannel({
|
|
3520
|
+
registerAndConnect: sinon.stub().rejects(new Error('failed to connect LLM')),
|
|
3521
|
+
});
|
|
3522
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3281
3523
|
|
|
3282
3524
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3283
3525
|
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
@@ -3301,11 +3543,13 @@ describe('plugin-meetings', () => {
|
|
|
3301
3543
|
|
|
3302
3544
|
it('emits llm breakout join response metric after suppressing join response without llmLatency', async () => {
|
|
3303
3545
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3546
|
+
const mockChannel = createMockLLMChannel({
|
|
3547
|
+
registerAndConnect: sinon.stub().resolves({
|
|
3548
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3549
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3550
|
+
}),
|
|
3308
3551
|
});
|
|
3552
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3309
3553
|
|
|
3310
3554
|
meeting.config.enableAutomaticLLM = true;
|
|
3311
3555
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
@@ -3337,11 +3581,13 @@ describe('plugin-meetings', () => {
|
|
|
3337
3581
|
|
|
3338
3582
|
it('emits breakout join response metric with llmLatency when returning to main session', async () => {
|
|
3339
3583
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3584
|
+
const mockChannel = createMockLLMChannel({
|
|
3585
|
+
registerAndConnect: sinon.stub().resolves({
|
|
3586
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3587
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3588
|
+
}),
|
|
3344
3589
|
});
|
|
3590
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3345
3591
|
|
|
3346
3592
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3347
3593
|
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
@@ -3370,10 +3616,12 @@ describe('plugin-meetings', () => {
|
|
|
3370
3616
|
|
|
3371
3617
|
it('uses the partial datachannel timing from the error when the websocket connect fails', async () => {
|
|
3372
3618
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3373
|
-
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3374
3619
|
const connectError = new Error('failed to connect LLM');
|
|
3375
3620
|
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3376
|
-
|
|
3621
|
+
const mockChannel = createMockLLMChannel({
|
|
3622
|
+
registerAndConnect: sinon.stub().rejects(connectError),
|
|
3623
|
+
});
|
|
3624
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3377
3625
|
|
|
3378
3626
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3379
3627
|
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
@@ -3407,10 +3655,12 @@ describe('plugin-meetings', () => {
|
|
|
3407
3655
|
|
|
3408
3656
|
it('reports the partial datachannel timing on client.llm.connect.response when the websocket connect fails during initial join', async () => {
|
|
3409
3657
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3410
|
-
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3411
3658
|
const connectError = new Error('failed to connect LLM');
|
|
3412
3659
|
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3413
|
-
|
|
3660
|
+
const mockChannel = createMockLLMChannel({
|
|
3661
|
+
registerAndConnect: sinon.stub().rejects(connectError),
|
|
3662
|
+
});
|
|
3663
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3414
3664
|
|
|
3415
3665
|
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3416
3666
|
meeting.updateLLMConnection.restore();
|
|
@@ -3435,32 +3685,32 @@ describe('plugin-meetings', () => {
|
|
|
3435
3685
|
|
|
3436
3686
|
it('clears the LLM health check timer when disconnecting LLM', async () => {
|
|
3437
3687
|
const isJoinedStub = sinon.stub(meeting, 'isJoined');
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
sinon
|
|
3442
|
-
.stub(meeting.webex.internal.llm, 'getLocusUrl')
|
|
3443
|
-
.returns('https://locus1.example.com');
|
|
3444
|
-
sinon
|
|
3445
|
-
.stub(meeting.webex.internal.llm, 'getDatachannelUrl')
|
|
3446
|
-
.returns('https://datachannel1.example.com');
|
|
3688
|
+
|
|
3689
|
+
const mockChannel = createMockLLMChannel();
|
|
3690
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3447
3691
|
|
|
3448
3692
|
meeting.updateLLMConnection.restore();
|
|
3449
3693
|
|
|
3694
|
+
// First: join and connect
|
|
3450
3695
|
isJoinedStub.returns(true);
|
|
3451
|
-
meeting.webex.internal.llm.isConnected.returns(false);
|
|
3452
3696
|
await meeting.updateLLMConnection();
|
|
3453
3697
|
|
|
3454
3698
|
assert.exists(meeting.llmHealthCheckTimer);
|
|
3455
3699
|
|
|
3700
|
+
// Simulate existing connected channel that will be cleaned up
|
|
3701
|
+
mockChannel.isConnected.returns(true);
|
|
3702
|
+
meeting.llmChannel = mockChannel;
|
|
3703
|
+
|
|
3704
|
+
// Now leave the meeting - this should trigger cleanup
|
|
3456
3705
|
isJoinedStub.returns(false);
|
|
3457
|
-
meeting.
|
|
3706
|
+
meeting.locusInfo.url = 'some-url';
|
|
3707
|
+
meeting.locusInfo.info = {datachannelUrl: 'some-datachannel-url'};
|
|
3458
3708
|
|
|
3459
3709
|
await meeting.updateLLMConnection();
|
|
3460
3710
|
|
|
3461
|
-
|
|
3462
|
-
|
|
3711
|
+
// After cleanup (not joined), timer should be cleared
|
|
3463
3712
|
assert.isUndefined(meeting.llmHealthCheckTimer);
|
|
3713
|
+
assert.calledOnce(mockChannel.disconnect);
|
|
3464
3714
|
|
|
3465
3715
|
Metrics.sendBehavioralMetric.resetHistory();
|
|
3466
3716
|
fakeClock.tick(3 * 60 * 1000);
|
|
@@ -3470,6 +3720,95 @@ describe('plugin-meetings', () => {
|
|
|
3470
3720
|
BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE
|
|
3471
3721
|
);
|
|
3472
3722
|
});
|
|
3723
|
+
|
|
3724
|
+
describe('guards against an unsynced locusInfo url/datachannelUrl', () => {
|
|
3725
|
+
beforeEach(() => {
|
|
3726
|
+
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3727
|
+
meeting.updateLLMConnection.restore();
|
|
3728
|
+
});
|
|
3729
|
+
|
|
3730
|
+
it('does nothing and does not create a channel when locusInfo.url is missing', async () => {
|
|
3731
|
+
meeting.locusInfo.url = undefined;
|
|
3732
|
+
meeting.locusInfo.info = {datachannelUrl: 'https://example.com/datachannel-url'};
|
|
3733
|
+
|
|
3734
|
+
const result = await meeting.updateLLMConnection();
|
|
3735
|
+
|
|
3736
|
+
assert.isUndefined(result);
|
|
3737
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
3738
|
+
assert.isUndefined(meeting.llmChannel);
|
|
3739
|
+
});
|
|
3740
|
+
|
|
3741
|
+
it('does nothing and does not create a channel when locusInfo.info.datachannelUrl is missing', async () => {
|
|
3742
|
+
meeting.locusInfo.url = 'https://locus-a.example.com/locus/api/v1/loci/locus-id';
|
|
3743
|
+
meeting.locusInfo.info = {datachannelUrl: undefined};
|
|
3744
|
+
|
|
3745
|
+
const result = await meeting.updateLLMConnection();
|
|
3746
|
+
|
|
3747
|
+
assert.isUndefined(result);
|
|
3748
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
3749
|
+
assert.isUndefined(meeting.llmChannel);
|
|
3750
|
+
});
|
|
3751
|
+
|
|
3752
|
+
it('does nothing and does not create a channel when locusInfo.info itself is missing', async () => {
|
|
3753
|
+
meeting.locusInfo.url = 'https://locus-a.example.com/locus/api/v1/loci/locus-id';
|
|
3754
|
+
meeting.locusInfo.info = undefined;
|
|
3755
|
+
|
|
3756
|
+
const result = await meeting.updateLLMConnection();
|
|
3757
|
+
|
|
3758
|
+
assert.isUndefined(result);
|
|
3759
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
3760
|
+
assert.isUndefined(meeting.llmChannel);
|
|
3761
|
+
});
|
|
3762
|
+
|
|
3763
|
+
it('disconnects a stale existing channel even when locusInfo has not resynced new urls', async () => {
|
|
3764
|
+
// Simulate a healthy, already-connected channel from a prior,
|
|
3765
|
+
// fully-synced call to updateLLMConnection, holding real URLs.
|
|
3766
|
+
const mockChannel = createMockLLMChannel({
|
|
3767
|
+
isConnected: sinon.stub().returns(true),
|
|
3768
|
+
getLocusUrl: sinon
|
|
3769
|
+
.stub()
|
|
3770
|
+
.returns('https://locus-a.example.com/locus/api/v1/loci/old-locus-id'),
|
|
3771
|
+
getDatachannelUrl: sinon
|
|
3772
|
+
.stub()
|
|
3773
|
+
.returns('https://example.com/old-datachannel-url'),
|
|
3774
|
+
});
|
|
3775
|
+
|
|
3776
|
+
meeting.llmChannel = mockChannel;
|
|
3777
|
+
|
|
3778
|
+
// A later lobby-transition event (e.g. SELF_UNADMITTED_GUEST on rejoin)
|
|
3779
|
+
// fires updateLLMConnection again before locusInfo has resynced the new
|
|
3780
|
+
// session's urls. The stale channel must still be disconnected so it stops
|
|
3781
|
+
// processing events for the prior (now-left) session while the user waits
|
|
3782
|
+
// in the lobby; a new channel must not be created with the empty urls.
|
|
3783
|
+
meeting.locusInfo.url = undefined;
|
|
3784
|
+
meeting.locusInfo.info = {datachannelUrl: undefined};
|
|
3785
|
+
|
|
3786
|
+
const result = await meeting.updateLLMConnection();
|
|
3787
|
+
|
|
3788
|
+
assert.isUndefined(result);
|
|
3789
|
+
assert.calledOnce(mockChannel.disconnect);
|
|
3790
|
+
assert.isUndefined(meeting.llmChannel);
|
|
3791
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
3792
|
+
});
|
|
3793
|
+
|
|
3794
|
+
it('proceeds to create and register a channel once both url and datachannelUrl are present', async () => {
|
|
3795
|
+
const mockChannel = createMockLLMChannel();
|
|
3796
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3797
|
+
|
|
3798
|
+
meeting.locusInfo.url = 'https://locus-a.example.com/locus/api/v1/loci/locus-id';
|
|
3799
|
+
meeting.locusInfo.info = {datachannelUrl: 'https://example.com/datachannel-url'};
|
|
3800
|
+
|
|
3801
|
+
await meeting.updateLLMConnection();
|
|
3802
|
+
|
|
3803
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
3804
|
+
assert.calledOnceWithExactly(
|
|
3805
|
+
mockChannel.registerAndConnect,
|
|
3806
|
+
meeting.locusInfo.url,
|
|
3807
|
+
meeting.locusInfo.info.datachannelUrl,
|
|
3808
|
+
sinon.match.any
|
|
3809
|
+
);
|
|
3810
|
+
});
|
|
3811
|
+
});
|
|
3473
3812
|
});
|
|
3474
3813
|
|
|
3475
3814
|
describe('refreshPermissionToken', () => {
|
|
@@ -3609,6 +3948,41 @@ describe('plugin-meetings', () => {
|
|
|
3609
3948
|
assert.exists(meeting.addMedia);
|
|
3610
3949
|
});
|
|
3611
3950
|
|
|
3951
|
+
it('logs a compact remote media manager configuration', async () => {
|
|
3952
|
+
const loggerInfoStub = sinon.stub(LoggerProxy.logger, 'info');
|
|
3953
|
+
const remoteMediaManagerConfig = {
|
|
3954
|
+
audio: {
|
|
3955
|
+
numOfActiveSpeakerStreams: 3,
|
|
3956
|
+
numOfScreenShareStreams: 1,
|
|
3957
|
+
},
|
|
3958
|
+
video: {
|
|
3959
|
+
preferLiveVideo: true,
|
|
3960
|
+
initialLayoutId: 'initial',
|
|
3961
|
+
layouts: {
|
|
3962
|
+
initial: {activeSpeakerVideoPaneGroups: []},
|
|
3963
|
+
excluded: {activeSpeakerVideoPaneGroups: []},
|
|
3964
|
+
},
|
|
3965
|
+
},
|
|
3966
|
+
};
|
|
3967
|
+
|
|
3968
|
+
const error = await assert.isRejected(
|
|
3969
|
+
meeting.addMediaInternal(() => 'JOIN_MEETING_FINAL', false, undefined, undefined, {
|
|
3970
|
+
remoteMediaManagerConfig,
|
|
3971
|
+
})
|
|
3972
|
+
);
|
|
3973
|
+
|
|
3974
|
+
assert.instanceOf(error, MeetingNotActiveError);
|
|
3975
|
+
assert.calledOnceWithExactly(
|
|
3976
|
+
loggerInfoStub,
|
|
3977
|
+
`Meeting:index#addMedia --> called with: options=${JSON.stringify({
|
|
3978
|
+
remoteMediaManagerConfig:
|
|
3979
|
+
RemoteMediaManagerModule.getRemoteMediaManagerConfigForLogging(
|
|
3980
|
+
remoteMediaManagerConfig
|
|
3981
|
+
),
|
|
3982
|
+
})}, turnServerInfo=undefined, forceTurnDiscovery=false, iceTransportPolicy=undefined`
|
|
3983
|
+
);
|
|
3984
|
+
});
|
|
3985
|
+
|
|
3612
3986
|
it('should reject promise if meeting is not active and the meeting in lobby is not enabled', async () => {
|
|
3613
3987
|
const result = await assert.isRejected(meeting.addMedia({allowMediaInLobby: false}));
|
|
3614
3988
|
|
|
@@ -4416,7 +4790,7 @@ describe('plugin-meetings', () => {
|
|
|
4416
4790
|
mediaSettings: {},
|
|
4417
4791
|
});
|
|
4418
4792
|
|
|
4419
|
-
await clock.tickAsync(
|
|
4793
|
+
await clock.tickAsync(ICE_CONNECTION_TIMEOUT);
|
|
4420
4794
|
await testUtils.flushPromises();
|
|
4421
4795
|
|
|
4422
4796
|
assert.exists(media);
|
|
@@ -4644,9 +5018,10 @@ describe('plugin-meetings', () => {
|
|
|
4644
5018
|
});
|
|
4645
5019
|
|
|
4646
5020
|
[
|
|
4647
|
-
{iceConnected: true, title: '
|
|
4648
|
-
{iceConnected: false, title: '
|
|
4649
|
-
|
|
5021
|
+
{iceConnected: true, iceConnectedAtLeastOnce: true, title: 'ICE connected'},
|
|
5022
|
+
{iceConnected: false, iceConnectedAtLeastOnce: true, title: 'ICE lost connectivity'},
|
|
5023
|
+
{iceConnected: false, iceConnectedAtLeastOnce: false, title: 'ICE never connected'},
|
|
5024
|
+
].forEach(({iceConnected, iceConnectedAtLeastOnce, title}) => {
|
|
4650
5025
|
it(`should propagate ${title} from waitForMediaConnectionConnected rejection to AddMediaFailed`, async () => {
|
|
4651
5026
|
webex.meetings.reachability = {
|
|
4652
5027
|
isWebexMediaBackendUnreachable: sinon.stub().resolves(false),
|
|
@@ -4659,7 +5034,7 @@ describe('plugin-meetings', () => {
|
|
|
4659
5034
|
sinon.stub(CallDiagnosticUtils, 'generateClientErrorCodeForIceFailure').returns(2004);
|
|
4660
5035
|
|
|
4661
5036
|
meeting.meetingState = 'ACTIVE';
|
|
4662
|
-
const rejectedResult = {iceConnected};
|
|
5037
|
+
const rejectedResult = {iceConnected, iceConnectedAtLeastOnce};
|
|
4663
5038
|
meeting.mediaProperties.waitForMediaConnectionConnected = sinon
|
|
4664
5039
|
.stub()
|
|
4665
5040
|
.rejects(rejectedResult);
|
|
@@ -4685,6 +5060,12 @@ describe('plugin-meetings', () => {
|
|
|
4685
5060
|
|
|
4686
5061
|
assert.instanceOf(thrownError, AddMediaFailed);
|
|
4687
5062
|
assert.equal(thrownError.iceConnected, iceConnected);
|
|
5063
|
+
assert.equal(thrownError.iceConnectedAtLeastOnce, iceConnectedAtLeastOnce);
|
|
5064
|
+
assert.equal(thrownError.isDtlsHandshakeFailure, iceConnected);
|
|
5065
|
+
assert.calledWithExactly(
|
|
5066
|
+
webex.internal.newMetrics.submitClientEvent,
|
|
5067
|
+
sinon.match({name: 'client.ice.end', options: sinon.match({rawError: rejectedResult})})
|
|
5068
|
+
);
|
|
4688
5069
|
// the AddMediaFailed cause should be the MediaConnectionTimedOutError, which in turn should
|
|
4689
5070
|
// preserve the original rejected result as its cause, so that the web client
|
|
4690
5071
|
// can find the CA-reported error in the eventErrorCache via the cause chain
|
|
@@ -8078,6 +8459,13 @@ describe('plugin-meetings', () => {
|
|
|
8078
8459
|
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
8079
8460
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8080
8461
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8462
|
+
meeting.areVoiceaEventsSetup = true;
|
|
8463
|
+
|
|
8464
|
+
// Set up llmChannel with mock off function
|
|
8465
|
+
meeting.llmChannel = {
|
|
8466
|
+
off: sinon.stub(),
|
|
8467
|
+
disconnect: sinon.stub().resolves(),
|
|
8468
|
+
};
|
|
8081
8469
|
|
|
8082
8470
|
await meeting.leave();
|
|
8083
8471
|
|
|
@@ -8086,19 +8474,19 @@ describe('plugin-meetings', () => {
|
|
|
8086
8474
|
// in-flight events do not trigger unnecessary Locus syncs
|
|
8087
8475
|
// (per Locus team recommendation).
|
|
8088
8476
|
assert.callOrder(
|
|
8089
|
-
|
|
8477
|
+
meeting.llmChannel.off,
|
|
8090
8478
|
webex.internal.mercury.off,
|
|
8091
8479
|
meeting.stopTranscription,
|
|
8092
8480
|
meeting.annotation.deregisterEvents,
|
|
8093
8481
|
meeting.meetingRequest.leaveMeeting
|
|
8094
8482
|
);
|
|
8095
8483
|
assert.calledWithExactly(
|
|
8096
|
-
|
|
8484
|
+
meeting.llmChannel.off,
|
|
8097
8485
|
'event:relay.event',
|
|
8098
8486
|
meeting.processRelayEvent
|
|
8099
8487
|
);
|
|
8100
8488
|
assert.calledWithExactly(
|
|
8101
|
-
|
|
8489
|
+
meeting.llmChannel.off,
|
|
8102
8490
|
LOCUS_LLM_EVENT,
|
|
8103
8491
|
meeting.processLocusLLMEvent
|
|
8104
8492
|
);
|
|
@@ -8108,25 +8496,35 @@ describe('plugin-meetings', () => {
|
|
|
8108
8496
|
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
8109
8497
|
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8110
8498
|
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8111
|
-
|
|
8499
|
+
// Transcription is reset to initial state (not undefined)
|
|
8500
|
+
assert.isDefined(meeting.transcription);
|
|
8501
|
+
assert.deepEqual(meeting.transcription.captions, []);
|
|
8502
|
+
assert.equal(meeting.transcription.isCaptioning, false);
|
|
8112
8503
|
});
|
|
8113
8504
|
|
|
8114
8505
|
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
8115
8506
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8116
8507
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8508
|
+
meeting.areVoiceaEventsSetup = true;
|
|
8117
8509
|
meeting.meetingRequest.leaveMeeting = sinon
|
|
8118
8510
|
.stub()
|
|
8119
8511
|
.returns(Promise.reject(new Error('leave failed')));
|
|
8120
8512
|
|
|
8513
|
+
// Set up llmChannel with mock off function
|
|
8514
|
+
meeting.llmChannel = {
|
|
8515
|
+
off: sinon.stub(),
|
|
8516
|
+
disconnect: sinon.stub().resolves(),
|
|
8517
|
+
};
|
|
8518
|
+
|
|
8121
8519
|
await meeting.leave().catch(() => {});
|
|
8122
8520
|
|
|
8123
8521
|
assert.calledWithExactly(
|
|
8124
|
-
|
|
8522
|
+
meeting.llmChannel.off,
|
|
8125
8523
|
'event:relay.event',
|
|
8126
8524
|
meeting.processRelayEvent
|
|
8127
8525
|
);
|
|
8128
8526
|
assert.calledWithExactly(
|
|
8129
|
-
|
|
8527
|
+
meeting.llmChannel.off,
|
|
8130
8528
|
LOCUS_LLM_EVENT,
|
|
8131
8529
|
meeting.processLocusLLMEvent
|
|
8132
8530
|
);
|
|
@@ -9033,7 +9431,11 @@ describe('plugin-meetings', () => {
|
|
|
9033
9431
|
beforeEach(() => {
|
|
9034
9432
|
meeting.locusId = 'locus-id';
|
|
9035
9433
|
meeting.id = 'meeting-id';
|
|
9036
|
-
FAKE_OPTIONS = {
|
|
9434
|
+
FAKE_OPTIONS = {
|
|
9435
|
+
meetingId: meeting.id,
|
|
9436
|
+
sendCAevents: true,
|
|
9437
|
+
correlationId: meeting.correlationId,
|
|
9438
|
+
};
|
|
9037
9439
|
});
|
|
9038
9440
|
|
|
9039
9441
|
it('calls meetingInfoProvider with all the right parameters and parses the result', async () => {
|
|
@@ -9118,7 +9520,11 @@ describe('plugin-meetings', () => {
|
|
|
9118
9520
|
undefined,
|
|
9119
9521
|
meeting.locusId,
|
|
9120
9522
|
{},
|
|
9121
|
-
{
|
|
9523
|
+
{
|
|
9524
|
+
meetingId: meeting.id,
|
|
9525
|
+
sendCAevents: false,
|
|
9526
|
+
correlationId: meeting.correlationId,
|
|
9527
|
+
}
|
|
9122
9528
|
);
|
|
9123
9529
|
|
|
9124
9530
|
// parseMeeting info
|
|
@@ -9204,7 +9610,11 @@ describe('plugin-meetings', () => {
|
|
|
9204
9610
|
undefined,
|
|
9205
9611
|
'locus-id',
|
|
9206
9612
|
{},
|
|
9207
|
-
{
|
|
9613
|
+
{
|
|
9614
|
+
meetingId: meeting.id,
|
|
9615
|
+
sendCAevents: true,
|
|
9616
|
+
correlationId: meeting.correlationId,
|
|
9617
|
+
}
|
|
9208
9618
|
);
|
|
9209
9619
|
|
|
9210
9620
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9240,7 +9650,11 @@ describe('plugin-meetings', () => {
|
|
|
9240
9650
|
undefined,
|
|
9241
9651
|
'locus-id',
|
|
9242
9652
|
{},
|
|
9243
|
-
{
|
|
9653
|
+
{
|
|
9654
|
+
meetingId: meeting.id,
|
|
9655
|
+
sendCAevents: true,
|
|
9656
|
+
correlationId: meeting.correlationId,
|
|
9657
|
+
}
|
|
9244
9658
|
);
|
|
9245
9659
|
|
|
9246
9660
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9269,7 +9683,11 @@ describe('plugin-meetings', () => {
|
|
|
9269
9683
|
undefined,
|
|
9270
9684
|
'locus-id',
|
|
9271
9685
|
{},
|
|
9272
|
-
{
|
|
9686
|
+
{
|
|
9687
|
+
meetingId: meeting.id,
|
|
9688
|
+
sendCAevents: true,
|
|
9689
|
+
correlationId: meeting.correlationId,
|
|
9690
|
+
}
|
|
9273
9691
|
);
|
|
9274
9692
|
|
|
9275
9693
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9304,7 +9722,11 @@ describe('plugin-meetings', () => {
|
|
|
9304
9722
|
undefined,
|
|
9305
9723
|
'locus-id',
|
|
9306
9724
|
{},
|
|
9307
|
-
{
|
|
9725
|
+
{
|
|
9726
|
+
meetingId: meeting.id,
|
|
9727
|
+
sendCAevents: true,
|
|
9728
|
+
correlationId: meeting.correlationId,
|
|
9729
|
+
}
|
|
9308
9730
|
);
|
|
9309
9731
|
|
|
9310
9732
|
assert.deepEqual(meeting.meetingInfo, {});
|
|
@@ -9350,7 +9772,11 @@ describe('plugin-meetings', () => {
|
|
|
9350
9772
|
undefined,
|
|
9351
9773
|
'locus-id',
|
|
9352
9774
|
{},
|
|
9353
|
-
{
|
|
9775
|
+
{
|
|
9776
|
+
meetingId: meeting.id,
|
|
9777
|
+
sendCAevents: true,
|
|
9778
|
+
correlationId: meeting.correlationId,
|
|
9779
|
+
}
|
|
9354
9780
|
);
|
|
9355
9781
|
|
|
9356
9782
|
assert.deepEqual(meeting.meetingInfo, {});
|
|
@@ -9384,7 +9810,11 @@ describe('plugin-meetings', () => {
|
|
|
9384
9810
|
undefined,
|
|
9385
9811
|
'locus-id',
|
|
9386
9812
|
{},
|
|
9387
|
-
{
|
|
9813
|
+
{
|
|
9814
|
+
meetingId: meeting.id,
|
|
9815
|
+
sendCAevents: true,
|
|
9816
|
+
correlationId: meeting.correlationId,
|
|
9817
|
+
}
|
|
9388
9818
|
);
|
|
9389
9819
|
|
|
9390
9820
|
assert.deepEqual(meeting.meetingInfo, {
|
|
@@ -9437,7 +9867,11 @@ describe('plugin-meetings', () => {
|
|
|
9437
9867
|
undefined,
|
|
9438
9868
|
'locus-id',
|
|
9439
9869
|
{},
|
|
9440
|
-
{
|
|
9870
|
+
{
|
|
9871
|
+
meetingId: meeting.id,
|
|
9872
|
+
sendCAevents: true,
|
|
9873
|
+
correlationId: meeting.correlationId,
|
|
9874
|
+
}
|
|
9441
9875
|
);
|
|
9442
9876
|
|
|
9443
9877
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9726,7 +10160,11 @@ describe('plugin-meetings', () => {
|
|
|
9726
10160
|
'fake-installed-org-id',
|
|
9727
10161
|
'locus-id',
|
|
9728
10162
|
{extraParam1: 'value1', permissionToken: FAKE_PERMISSION_TOKEN},
|
|
9729
|
-
{
|
|
10163
|
+
{
|
|
10164
|
+
meetingId: meeting.id,
|
|
10165
|
+
sendCAevents: true,
|
|
10166
|
+
correlationId: meeting.correlationId,
|
|
10167
|
+
},
|
|
9730
10168
|
null,
|
|
9731
10169
|
null,
|
|
9732
10170
|
null
|
|
@@ -9774,7 +10212,11 @@ describe('plugin-meetings', () => {
|
|
|
9774
10212
|
'fake-installed-org-id',
|
|
9775
10213
|
'locus-id',
|
|
9776
10214
|
{extraParam1: 'value1', permissionToken: FAKE_PERMISSION_TOKEN},
|
|
9777
|
-
{
|
|
10215
|
+
{
|
|
10216
|
+
meetingId: meeting.id,
|
|
10217
|
+
sendCAevents: true,
|
|
10218
|
+
correlationId: meeting.correlationId,
|
|
10219
|
+
},
|
|
9778
10220
|
null,
|
|
9779
10221
|
null,
|
|
9780
10222
|
null
|
|
@@ -9831,7 +10273,11 @@ describe('plugin-meetings', () => {
|
|
|
9831
10273
|
extraParam1: 'value1',
|
|
9832
10274
|
permissionToken: FAKE_PERMISSION_TOKEN,
|
|
9833
10275
|
},
|
|
9834
|
-
{
|
|
10276
|
+
{
|
|
10277
|
+
meetingId: meeting.id,
|
|
10278
|
+
sendCAevents: true,
|
|
10279
|
+
correlationId: meeting.correlationId,
|
|
10280
|
+
},
|
|
9835
10281
|
null,
|
|
9836
10282
|
null,
|
|
9837
10283
|
null
|
|
@@ -10172,6 +10618,13 @@ describe('plugin-meetings', () => {
|
|
|
10172
10618
|
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
10173
10619
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10174
10620
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10621
|
+
meeting.areVoiceaEventsSetup = true;
|
|
10622
|
+
|
|
10623
|
+
// Set up llmChannel with mock off function
|
|
10624
|
+
meeting.llmChannel = {
|
|
10625
|
+
off: sinon.stub(),
|
|
10626
|
+
disconnect: sinon.stub().resolves(),
|
|
10627
|
+
};
|
|
10175
10628
|
|
|
10176
10629
|
await meeting.endMeetingForAll();
|
|
10177
10630
|
|
|
@@ -10180,19 +10633,19 @@ describe('plugin-meetings', () => {
|
|
|
10180
10633
|
// in-flight events do not trigger unnecessary Locus syncs
|
|
10181
10634
|
// (per Locus team recommendation).
|
|
10182
10635
|
assert.callOrder(
|
|
10183
|
-
|
|
10636
|
+
meeting.llmChannel.off,
|
|
10184
10637
|
webex.internal.mercury.off,
|
|
10185
10638
|
meeting.stopTranscription,
|
|
10186
10639
|
meeting.annotation.deregisterEvents,
|
|
10187
10640
|
meeting.meetingRequest.endMeetingForAll
|
|
10188
10641
|
);
|
|
10189
10642
|
assert.calledWithExactly(
|
|
10190
|
-
|
|
10643
|
+
meeting.llmChannel.off,
|
|
10191
10644
|
'event:relay.event',
|
|
10192
10645
|
meeting.processRelayEvent
|
|
10193
10646
|
);
|
|
10194
10647
|
assert.calledWithExactly(
|
|
10195
|
-
|
|
10648
|
+
meeting.llmChannel.off,
|
|
10196
10649
|
LOCUS_LLM_EVENT,
|
|
10197
10650
|
meeting.processLocusLLMEvent
|
|
10198
10651
|
);
|
|
@@ -10207,19 +10660,26 @@ describe('plugin-meetings', () => {
|
|
|
10207
10660
|
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
10208
10661
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10209
10662
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10663
|
+
meeting.areVoiceaEventsSetup = true;
|
|
10210
10664
|
meeting.meetingRequest.endMeetingForAll = sinon
|
|
10211
10665
|
.stub()
|
|
10212
10666
|
.returns(Promise.reject(new Error('end failed')));
|
|
10213
10667
|
|
|
10668
|
+
// Set up llmChannel with mock off function
|
|
10669
|
+
meeting.llmChannel = {
|
|
10670
|
+
off: sinon.stub(),
|
|
10671
|
+
disconnect: sinon.stub().resolves(),
|
|
10672
|
+
};
|
|
10673
|
+
|
|
10214
10674
|
await meeting.endMeetingForAll().catch(() => {});
|
|
10215
10675
|
|
|
10216
10676
|
assert.calledWithExactly(
|
|
10217
|
-
|
|
10677
|
+
meeting.llmChannel.off,
|
|
10218
10678
|
'event:relay.event',
|
|
10219
10679
|
meeting.processRelayEvent
|
|
10220
10680
|
);
|
|
10221
10681
|
assert.calledWithExactly(
|
|
10222
|
-
|
|
10682
|
+
meeting.llmChannel.off,
|
|
10223
10683
|
LOCUS_LLM_EVENT,
|
|
10224
10684
|
meeting.processLocusLLMEvent
|
|
10225
10685
|
);
|
|
@@ -14772,41 +15232,28 @@ describe('plugin-meetings', () => {
|
|
|
14772
15232
|
|
|
14773
15233
|
describe('#saveDataChannelToken', () => {
|
|
14774
15234
|
beforeEach(() => {
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
.stub()
|
|
14778
|
-
.returns({currentOwner: undefined, isOwner: true});
|
|
14779
|
-
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
15235
|
+
meeting._pendingDatachannelToken = undefined;
|
|
15236
|
+
meeting.webinar._pendingPracticeSessionDatachannelToken = undefined;
|
|
14780
15237
|
});
|
|
14781
15238
|
|
|
14782
|
-
it('saves datachannelToken
|
|
15239
|
+
it('saves datachannelToken to _pendingDatachannelToken', () => {
|
|
14783
15240
|
meeting.saveDataChannelToken({
|
|
14784
15241
|
locus: {
|
|
14785
15242
|
self: {datachannelToken: 'default-token'},
|
|
14786
15243
|
},
|
|
14787
15244
|
});
|
|
14788
15245
|
|
|
14789
|
-
assert.
|
|
14790
|
-
webex.internal.llm.setDatachannelToken,
|
|
14791
|
-
'default-token',
|
|
14792
|
-
'llm-default-session',
|
|
14793
|
-
meeting.id
|
|
14794
|
-
);
|
|
15246
|
+
assert.equal(meeting._pendingDatachannelToken, 'default-token');
|
|
14795
15247
|
});
|
|
14796
15248
|
|
|
14797
|
-
it('saves practiceSessionDatachannelToken
|
|
15249
|
+
it('saves practiceSessionDatachannelToken to webinar._pendingPracticeSessionDatachannelToken', () => {
|
|
14798
15250
|
meeting.saveDataChannelToken({
|
|
14799
15251
|
locus: {
|
|
14800
15252
|
self: {practiceSessionDatachannelToken: 'ps-token'},
|
|
14801
15253
|
},
|
|
14802
15254
|
});
|
|
14803
15255
|
|
|
14804
|
-
assert.
|
|
14805
|
-
webex.internal.llm.setDatachannelToken,
|
|
14806
|
-
'ps-token',
|
|
14807
|
-
'llm-practice-session',
|
|
14808
|
-
meeting.id
|
|
14809
|
-
);
|
|
15256
|
+
assert.equal(meeting.webinar._pendingPracticeSessionDatachannelToken, 'ps-token');
|
|
14810
15257
|
});
|
|
14811
15258
|
|
|
14812
15259
|
it('saves both tokens when both are present', () => {
|
|
@@ -14819,100 +15266,93 @@ describe('plugin-meetings', () => {
|
|
|
14819
15266
|
},
|
|
14820
15267
|
});
|
|
14821
15268
|
|
|
14822
|
-
assert.
|
|
14823
|
-
assert.
|
|
14824
|
-
webex.internal.llm.setDatachannelToken,
|
|
14825
|
-
'default-token',
|
|
14826
|
-
'llm-default-session',
|
|
14827
|
-
meeting.id
|
|
14828
|
-
);
|
|
14829
|
-
assert.calledWithExactly(
|
|
14830
|
-
webex.internal.llm.setDatachannelToken,
|
|
14831
|
-
'ps-token',
|
|
14832
|
-
'llm-practice-session',
|
|
14833
|
-
meeting.id
|
|
14834
|
-
);
|
|
15269
|
+
assert.equal(meeting._pendingDatachannelToken, 'default-token');
|
|
15270
|
+
assert.equal(meeting.webinar._pendingPracticeSessionDatachannelToken, 'ps-token');
|
|
14835
15271
|
});
|
|
14836
15272
|
|
|
14837
|
-
it('does not
|
|
15273
|
+
it('does not set pending tokens when no tokens are present', () => {
|
|
14838
15274
|
meeting.saveDataChannelToken({locus: {self: {}}});
|
|
14839
15275
|
|
|
14840
|
-
assert.
|
|
15276
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15277
|
+
assert.isUndefined(meeting.webinar._pendingPracticeSessionDatachannelToken);
|
|
14841
15278
|
});
|
|
14842
15279
|
|
|
14843
15280
|
it('handles undefined join gracefully', () => {
|
|
14844
15281
|
meeting.saveDataChannelToken(undefined);
|
|
14845
15282
|
|
|
14846
|
-
assert.
|
|
15283
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15284
|
+
assert.isUndefined(meeting.webinar._pendingPracticeSessionDatachannelToken);
|
|
14847
15285
|
});
|
|
14848
15286
|
|
|
14849
15287
|
it('handles missing locus.self gracefully', () => {
|
|
14850
15288
|
meeting.saveDataChannelToken({locus: {}});
|
|
14851
15289
|
|
|
14852
|
-
assert.
|
|
15290
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15291
|
+
assert.isUndefined(meeting.webinar._pendingPracticeSessionDatachannelToken);
|
|
14853
15292
|
});
|
|
14854
15293
|
|
|
14855
|
-
it('
|
|
15294
|
+
it('sets token on llmChannel if it exists', () => {
|
|
15295
|
+
const mockChannel = {
|
|
15296
|
+
setDatachannelToken: sinon.stub(),
|
|
15297
|
+
};
|
|
15298
|
+
meeting.llmChannel = mockChannel;
|
|
15299
|
+
|
|
14856
15300
|
meeting.saveDataChannelToken({
|
|
14857
15301
|
locus: {
|
|
14858
15302
|
self: {datachannelToken: 'default-token'},
|
|
14859
15303
|
},
|
|
14860
15304
|
});
|
|
14861
15305
|
|
|
14862
|
-
assert.calledOnceWithExactly(
|
|
14863
|
-
webex.internal.llm.setDatachannelToken,
|
|
14864
|
-
'default-token',
|
|
14865
|
-
'llm-default-session',
|
|
14866
|
-
meeting.id
|
|
14867
|
-
);
|
|
15306
|
+
assert.calledOnceWithExactly(mockChannel.setDatachannelToken, 'default-token');
|
|
14868
15307
|
});
|
|
14869
15308
|
});
|
|
14870
15309
|
|
|
14871
|
-
describe('#
|
|
15310
|
+
describe('#updateLLMConnection', () => {
|
|
15311
|
+
let mockChannel;
|
|
15312
|
+
let mockVoiceaChannel;
|
|
15313
|
+
|
|
14872
15314
|
beforeEach(() => {
|
|
14873
|
-
|
|
14874
|
-
|
|
15315
|
+
// Create a mock channel that createChannel will return
|
|
15316
|
+
mockChannel = createMockLLMChannel({
|
|
15317
|
+
registerAndConnect: sinon.stub().resolves('something'),
|
|
15318
|
+
});
|
|
14875
15319
|
|
|
14876
|
-
|
|
14877
|
-
|
|
15320
|
+
// Create a mock voicea channel
|
|
15321
|
+
mockVoiceaChannel = {
|
|
15322
|
+
on: sinon.stub(),
|
|
15323
|
+
off: sinon.stub(),
|
|
15324
|
+
onSpokenLanguageUpdate: sinon.stub(),
|
|
15325
|
+
onCaptionServiceIdUpdate: sinon.stub(),
|
|
15326
|
+
requestLanguage: sinon.stub(),
|
|
15327
|
+
setSpokenLanguage: sinon.stub(),
|
|
15328
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
15329
|
+
listenToEvents: sinon.stub(),
|
|
15330
|
+
deregisterEvents: sinon.stub(),
|
|
15331
|
+
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
15332
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
15333
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
15334
|
+
isLLMConnected: sinon.stub().returns(true),
|
|
15335
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
15336
|
+
};
|
|
14878
15337
|
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
'llm-default-session',
|
|
14882
|
-
meeting.id
|
|
14883
|
-
);
|
|
14884
|
-
assert.calledWithExactly(
|
|
14885
|
-
webex.internal.llm.clearDatachannelToken,
|
|
14886
|
-
'llm-practice-session',
|
|
14887
|
-
meeting.id
|
|
14888
|
-
);
|
|
14889
|
-
assert.callCount(webex.internal.llm.clearDatachannelToken, 2);
|
|
14890
|
-
});
|
|
14891
|
-
});
|
|
15338
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
15339
|
+
webex.internal.voicea.createChannel = sinon.stub().returns(mockVoiceaChannel);
|
|
14892
15340
|
|
|
14893
|
-
|
|
14894
|
-
|
|
14895
|
-
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
14896
|
-
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
14897
|
-
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
14898
|
-
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
14899
|
-
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
14900
|
-
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
14901
|
-
webex.internal.llm.on = sinon.stub();
|
|
14902
|
-
webex.internal.llm.off = sinon.stub();
|
|
14903
|
-
webex.internal.llm.getDatachannelToken = sinon.stub().returns(undefined);
|
|
14904
|
-
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
15341
|
+
// voiceaChannel is created in the Meeting constructor
|
|
15342
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
14905
15343
|
|
|
14906
15344
|
meeting.processRelayEvent = sinon.stub();
|
|
14907
15345
|
meeting.processLocusLLMEvent = sinon.stub();
|
|
15346
|
+
meeting.handleLLMOnline = sinon.stub();
|
|
14908
15347
|
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
14909
15348
|
meeting.startLLMHealthCheckTimer = sinon.stub();
|
|
15349
|
+
meeting.annotation.registerChannel = sinon.stub();
|
|
14910
15350
|
|
|
14911
15351
|
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
14912
15352
|
});
|
|
15353
|
+
|
|
14913
15354
|
it('does not connect if the call is not joined yet', async () => {
|
|
14914
15355
|
meeting.joinedWith = {state: 'any other state'};
|
|
14915
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
14916
15356
|
|
|
14917
15357
|
meeting.locusInfo = {
|
|
14918
15358
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -14922,12 +15362,11 @@ describe('plugin-meetings', () => {
|
|
|
14922
15362
|
|
|
14923
15363
|
const result = await meeting.updateLLMConnection();
|
|
14924
15364
|
|
|
14925
|
-
assert.notCalled(webex.internal.llm.
|
|
14926
|
-
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15365
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
14927
15366
|
assert.equal(result, undefined);
|
|
14928
|
-
assert.notCalled(meeting.webex.internal.llm.on);
|
|
14929
15367
|
});
|
|
14930
|
-
|
|
15368
|
+
|
|
15369
|
+
it('creates a channel and connects when joined', async () => {
|
|
14931
15370
|
meeting.joinedWith = {state: 'JOINED'};
|
|
14932
15371
|
meeting.locusInfo = {
|
|
14933
15372
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -14936,36 +15375,45 @@ describe('plugin-meetings', () => {
|
|
|
14936
15375
|
};
|
|
14937
15376
|
|
|
14938
15377
|
const result = await meeting.updateLLMConnection();
|
|
14939
|
-
|
|
15378
|
+
|
|
15379
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
14940
15380
|
assert.calledWithExactly(
|
|
14941
|
-
|
|
15381
|
+
mockChannel.registerAndConnect,
|
|
14942
15382
|
'a url',
|
|
14943
15383
|
'a datachannel url',
|
|
14944
15384
|
undefined
|
|
14945
15385
|
);
|
|
14946
15386
|
assert.equal(result, 'something');
|
|
15387
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
15388
|
+
});
|
|
15389
|
+
|
|
15390
|
+
it('sets up event listeners on the channel after connection', async () => {
|
|
15391
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15392
|
+
meeting.locusInfo = {
|
|
15393
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15394
|
+
url: 'a url',
|
|
15395
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15396
|
+
};
|
|
15397
|
+
|
|
15398
|
+
await meeting.updateLLMConnection();
|
|
15399
|
+
|
|
15400
|
+
assert.calledWithExactly(mockChannel.off, 'event:relay.event', meeting.processRelayEvent);
|
|
15401
|
+
assert.calledWithExactly(mockChannel.on, 'event:relay.event', meeting.processRelayEvent);
|
|
14947
15402
|
assert.calledWithExactly(
|
|
14948
|
-
|
|
14949
|
-
'event:relay.event',
|
|
14950
|
-
meeting.processRelayEvent
|
|
14951
|
-
);
|
|
14952
|
-
assert.calledWithExactly(
|
|
14953
|
-
meeting.webex.internal.llm.off,
|
|
15403
|
+
mockChannel.off,
|
|
14954
15404
|
'event:locus.state_message',
|
|
14955
15405
|
meeting.processLocusLLMEvent
|
|
14956
15406
|
);
|
|
14957
15407
|
assert.calledWithExactly(
|
|
14958
|
-
|
|
14959
|
-
'event:relay.event',
|
|
14960
|
-
meeting.processRelayEvent
|
|
14961
|
-
);
|
|
14962
|
-
assert.calledWithExactly(
|
|
14963
|
-
meeting.webex.internal.llm.on,
|
|
15408
|
+
mockChannel.on,
|
|
14964
15409
|
'event:locus.state_message',
|
|
14965
15410
|
meeting.processLocusLLMEvent
|
|
14966
15411
|
);
|
|
15412
|
+
assert.calledWithExactly(mockChannel.off, 'online', meeting.handleLLMOnline);
|
|
15413
|
+
assert.calledWithExactly(mockChannel.on, 'online', meeting.handleLLMOnline);
|
|
14967
15414
|
});
|
|
14968
|
-
|
|
15415
|
+
|
|
15416
|
+
it('sets refresh handler before registration', async () => {
|
|
14969
15417
|
meeting.joinedWith = {state: 'JOINED'};
|
|
14970
15418
|
meeting.locusInfo = {
|
|
14971
15419
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -14973,146 +15421,127 @@ describe('plugin-meetings', () => {
|
|
|
14973
15421
|
info: {datachannelUrl: 'a datachannel url'},
|
|
14974
15422
|
};
|
|
14975
15423
|
|
|
15424
|
+
await meeting.updateLLMConnection();
|
|
15425
|
+
|
|
15426
|
+
assert.calledOnceWithExactly(mockChannel.setRefreshHandler, sinon.match.func);
|
|
15427
|
+
// Verify setRefreshHandler was called before registerAndConnect
|
|
15428
|
+
assert.isTrue(mockChannel.setRefreshHandler.calledBefore(mockChannel.registerAndConnect));
|
|
15429
|
+
});
|
|
15430
|
+
|
|
15431
|
+
it('skips reconnect when already connected to same URLs', async () => {
|
|
15432
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15433
|
+
meeting.locusInfo = {
|
|
15434
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15435
|
+
url: 'a url',
|
|
15436
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15437
|
+
};
|
|
15438
|
+
|
|
15439
|
+
// Set up existing channel with matching URLs
|
|
15440
|
+
const existingChannel = {
|
|
15441
|
+
isConnected: sinon.stub().returns(true),
|
|
15442
|
+
isConnecting: sinon.stub().returns(false),
|
|
15443
|
+
getLocusUrl: sinon.stub().returns('a url'),
|
|
15444
|
+
getDatachannelUrl: sinon.stub().returns('a datachannel url'),
|
|
15445
|
+
};
|
|
15446
|
+
meeting.llmChannel = existingChannel;
|
|
15447
|
+
|
|
14976
15448
|
const result = await meeting.updateLLMConnection();
|
|
14977
15449
|
|
|
14978
|
-
assert.notCalled(webex.internal.llm.
|
|
14979
|
-
assert.
|
|
14980
|
-
webex.internal.llm.registerAndConnect,
|
|
14981
|
-
'a url',
|
|
14982
|
-
'a datachannel url',
|
|
14983
|
-
undefined
|
|
14984
|
-
);
|
|
14985
|
-
assert.calledOnceWithExactly(
|
|
14986
|
-
webex.internal.llm.setRefreshHandler,
|
|
14987
|
-
sinon.match.func,
|
|
14988
|
-
'llm-default-session',
|
|
14989
|
-
meeting.id
|
|
14990
|
-
);
|
|
14991
|
-
assert.equal(result, 'something');
|
|
14992
|
-
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
15450
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
15451
|
+
assert.equal(result, undefined);
|
|
14993
15452
|
});
|
|
14994
|
-
|
|
15453
|
+
|
|
15454
|
+
it('disconnects and reconnects when locus URL changes', async () => {
|
|
14995
15455
|
meeting.joinedWith = {state: 'JOINED'};
|
|
14996
15456
|
|
|
14997
|
-
|
|
14998
|
-
|
|
15457
|
+
// Set up existing channel with different URL
|
|
15458
|
+
const existingChannel = {
|
|
15459
|
+
isConnected: sinon.stub().returns(true),
|
|
15460
|
+
isConnecting: sinon.stub().returns(false),
|
|
15461
|
+
getLocusUrl: sinon.stub().returns('old url'),
|
|
15462
|
+
getDatachannelUrl: sinon.stub().returns('a datachannel url'),
|
|
15463
|
+
disconnect: sinon.stub().resolves(),
|
|
15464
|
+
off: sinon.stub(),
|
|
15465
|
+
};
|
|
15466
|
+
meeting.llmChannel = existingChannel;
|
|
15467
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
14999
15468
|
|
|
15000
15469
|
meeting.locusInfo = {
|
|
15001
15470
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15002
15471
|
url: 'a different url',
|
|
15003
15472
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15004
|
-
self: {},
|
|
15005
15473
|
};
|
|
15006
15474
|
|
|
15007
15475
|
const result = await meeting.updateLLMConnection();
|
|
15008
15476
|
|
|
15477
|
+
// Should disconnect old channel
|
|
15478
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15479
|
+
// Should create new channel
|
|
15480
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
15481
|
+
// Should connect with new URL
|
|
15009
15482
|
assert.calledWithExactly(
|
|
15010
|
-
|
|
15011
|
-
{
|
|
15012
|
-
code: 3050,
|
|
15013
|
-
reason: 'done (permanent)',
|
|
15014
|
-
},
|
|
15015
|
-
'llm-default-session',
|
|
15016
|
-
meeting.id
|
|
15017
|
-
);
|
|
15018
|
-
|
|
15019
|
-
assert.calledWithExactly(
|
|
15020
|
-
webex.internal.llm.registerAndConnect,
|
|
15483
|
+
mockChannel.registerAndConnect,
|
|
15021
15484
|
'a different url',
|
|
15022
15485
|
'a datachannel url',
|
|
15023
15486
|
undefined
|
|
15024
15487
|
);
|
|
15025
|
-
|
|
15026
|
-
assert.
|
|
15027
|
-
|
|
15028
|
-
assert.calledWithExactly(
|
|
15029
|
-
meeting.webex.internal.llm.off,
|
|
15030
|
-
'event:relay.event',
|
|
15031
|
-
meeting.processRelayEvent
|
|
15032
|
-
);
|
|
15033
|
-
assert.calledWithExactly(
|
|
15034
|
-
meeting.webex.internal.llm.off,
|
|
15035
|
-
'event:locus.state_message',
|
|
15036
|
-
meeting.processLocusLLMEvent
|
|
15037
|
-
);
|
|
15038
|
-
assert.callCount(meeting.webex.internal.llm.off, 4);
|
|
15039
|
-
|
|
15040
|
-
assert.calledWithExactly(
|
|
15041
|
-
meeting.webex.internal.llm.on,
|
|
15042
|
-
'event:relay.event',
|
|
15043
|
-
meeting.processRelayEvent
|
|
15044
|
-
);
|
|
15045
|
-
assert.calledWithExactly(
|
|
15046
|
-
meeting.webex.internal.llm.on,
|
|
15047
|
-
'event:locus.state_message',
|
|
15048
|
-
meeting.processLocusLLMEvent
|
|
15049
|
-
);
|
|
15050
|
-
assert.isFalse(
|
|
15051
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15052
|
-
);
|
|
15488
|
+
// voiceaChannel should be preserved during transient reconnect
|
|
15489
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15490
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15053
15491
|
});
|
|
15054
|
-
|
|
15492
|
+
|
|
15493
|
+
it('disconnects and reconnects when datachannel URL changes', async () => {
|
|
15055
15494
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15056
|
-
|
|
15057
|
-
|
|
15495
|
+
|
|
15496
|
+
// Set up existing channel with different datachannel URL
|
|
15497
|
+
const existingChannel = {
|
|
15498
|
+
isConnected: sinon.stub().returns(true),
|
|
15499
|
+
isConnecting: sinon.stub().returns(false),
|
|
15500
|
+
getLocusUrl: sinon.stub().returns('a url'),
|
|
15501
|
+
getDatachannelUrl: sinon.stub().returns('old datachannel url'),
|
|
15502
|
+
disconnect: sinon.stub().resolves(),
|
|
15503
|
+
off: sinon.stub(),
|
|
15504
|
+
};
|
|
15505
|
+
meeting.llmChannel = existingChannel;
|
|
15506
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15058
15507
|
|
|
15059
15508
|
meeting.locusInfo = {
|
|
15060
15509
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15061
15510
|
url: 'a url',
|
|
15062
15511
|
info: {datachannelUrl: 'a different datachannel url'},
|
|
15063
|
-
self: {},
|
|
15064
15512
|
};
|
|
15065
15513
|
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
assert.calledWithExactly(
|
|
15069
|
-
webex.internal.llm.disconnectLLM,
|
|
15070
|
-
{
|
|
15071
|
-
code: 3050,
|
|
15072
|
-
reason: 'done (permanent)',
|
|
15073
|
-
},
|
|
15074
|
-
'llm-default-session',
|
|
15075
|
-
meeting.id
|
|
15076
|
-
);
|
|
15514
|
+
await meeting.updateLLMConnection();
|
|
15077
15515
|
|
|
15516
|
+
// Should disconnect old channel
|
|
15517
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15518
|
+
// Should create new channel
|
|
15519
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
15520
|
+
// Should connect with new datachannel URL
|
|
15078
15521
|
assert.calledWithExactly(
|
|
15079
|
-
|
|
15522
|
+
mockChannel.registerAndConnect,
|
|
15080
15523
|
'a url',
|
|
15081
15524
|
'a different datachannel url',
|
|
15082
15525
|
undefined
|
|
15083
15526
|
);
|
|
15084
|
-
|
|
15085
|
-
assert.
|
|
15086
|
-
|
|
15087
|
-
assert.calledWithExactly(
|
|
15088
|
-
meeting.webex.internal.llm.off,
|
|
15089
|
-
'event:relay.event',
|
|
15090
|
-
meeting.processRelayEvent
|
|
15091
|
-
);
|
|
15092
|
-
assert.calledWithExactly(
|
|
15093
|
-
meeting.webex.internal.llm.off,
|
|
15094
|
-
'event:locus.state_message',
|
|
15095
|
-
meeting.processLocusLLMEvent
|
|
15096
|
-
);
|
|
15097
|
-
|
|
15098
|
-
assert.calledWithExactly(
|
|
15099
|
-
meeting.webex.internal.llm.on,
|
|
15100
|
-
'event:relay.event',
|
|
15101
|
-
meeting.processRelayEvent
|
|
15102
|
-
);
|
|
15103
|
-
assert.calledWithExactly(
|
|
15104
|
-
meeting.webex.internal.llm.on,
|
|
15105
|
-
'event:locus.state_message',
|
|
15106
|
-
meeting.processLocusLLMEvent
|
|
15107
|
-
);
|
|
15108
|
-
assert.isFalse(
|
|
15109
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15110
|
-
);
|
|
15527
|
+
// voiceaChannel should be preserved during transient reconnect
|
|
15528
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15529
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15111
15530
|
});
|
|
15112
|
-
|
|
15531
|
+
|
|
15532
|
+
it('disconnects when state changes to not joined', async () => {
|
|
15113
15533
|
meeting.joinedWith = {state: 'any other state'};
|
|
15114
|
-
|
|
15115
|
-
|
|
15534
|
+
|
|
15535
|
+
// Set up existing connected channel
|
|
15536
|
+
const existingChannel = {
|
|
15537
|
+
isConnected: sinon.stub().returns(true),
|
|
15538
|
+
isConnecting: sinon.stub().returns(false),
|
|
15539
|
+
getLocusUrl: sinon.stub().returns('a url'),
|
|
15540
|
+
getDatachannelUrl: sinon.stub().returns('a datachannel url'),
|
|
15541
|
+
disconnect: sinon.stub().resolves(),
|
|
15542
|
+
off: sinon.stub(),
|
|
15543
|
+
};
|
|
15544
|
+
meeting.llmChannel = existingChannel;
|
|
15116
15545
|
|
|
15117
15546
|
meeting.locusInfo = {
|
|
15118
15547
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15122,81 +15551,57 @@ describe('plugin-meetings', () => {
|
|
|
15122
15551
|
|
|
15123
15552
|
const result = await meeting.updateLLMConnection();
|
|
15124
15553
|
|
|
15125
|
-
assert.
|
|
15126
|
-
|
|
15127
|
-
{
|
|
15128
|
-
code: 3050,
|
|
15129
|
-
reason: 'done (permanent)',
|
|
15130
|
-
},
|
|
15131
|
-
'llm-default-session',
|
|
15132
|
-
meeting.id
|
|
15133
|
-
);
|
|
15134
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15554
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15555
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
15135
15556
|
assert.equal(result, undefined);
|
|
15136
|
-
assert.isFalse(
|
|
15137
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15138
|
-
);
|
|
15139
15557
|
});
|
|
15140
|
-
it('rethrows disconnect errors during reconnect cleanup after removing relay listeners and timer', async () => {
|
|
15141
|
-
const disconnectError = new Error('disconnect failed');
|
|
15142
15558
|
|
|
15559
|
+
it('passes pending datachannel token to registerAndConnect', async () => {
|
|
15143
15560
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15144
|
-
|
|
15145
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15146
|
-
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
15147
|
-
|
|
15561
|
+
meeting._pendingDatachannelToken = 'pending-token';
|
|
15148
15562
|
meeting.locusInfo = {
|
|
15149
15563
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15150
|
-
url: 'a
|
|
15564
|
+
url: 'a url',
|
|
15151
15565
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15152
|
-
self: {},
|
|
15153
15566
|
};
|
|
15154
15567
|
|
|
15155
|
-
|
|
15156
|
-
await meeting.updateLLMConnection();
|
|
15157
|
-
assert.fail('Expected updateLLMConnection to reject when disconnectLLM fails');
|
|
15158
|
-
} catch (error) {
|
|
15159
|
-
assert.equal(error, disconnectError);
|
|
15160
|
-
}
|
|
15568
|
+
await meeting.updateLLMConnection();
|
|
15161
15569
|
|
|
15162
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15163
|
-
assert.calledWithExactly(
|
|
15164
|
-
meeting.webex.internal.llm.off,
|
|
15165
|
-
'event:relay.event',
|
|
15166
|
-
meeting.processRelayEvent
|
|
15167
|
-
);
|
|
15168
15570
|
assert.calledWithExactly(
|
|
15169
|
-
|
|
15170
|
-
'
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
assert.isFalse(
|
|
15174
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15571
|
+
mockChannel.registerAndConnect,
|
|
15572
|
+
'a url',
|
|
15573
|
+
'a datachannel url',
|
|
15574
|
+
'pending-token'
|
|
15175
15575
|
);
|
|
15176
|
-
|
|
15576
|
+
// Pending token should be set on channel
|
|
15577
|
+
assert.calledWithExactly(mockChannel.setDatachannelToken, 'pending-token');
|
|
15578
|
+
// Pending token should be cleared
|
|
15579
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15177
15580
|
});
|
|
15178
|
-
|
|
15581
|
+
|
|
15582
|
+
it('uses channel token if no pending token', async () => {
|
|
15179
15583
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15584
|
+
mockChannel.getDatachannelToken.returns('channel-token');
|
|
15180
15585
|
meeting.locusInfo = {
|
|
15181
15586
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15182
15587
|
url: 'a url',
|
|
15183
|
-
info: {
|
|
15184
|
-
datachannelUrl: 'a datachannel url',
|
|
15185
|
-
practiceSessionDatachannelUrl: 'ps-url',
|
|
15186
|
-
},
|
|
15588
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15187
15589
|
};
|
|
15188
|
-
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15189
15590
|
|
|
15190
15591
|
await meeting.updateLLMConnection();
|
|
15191
15592
|
|
|
15192
15593
|
assert.calledWithExactly(
|
|
15193
|
-
|
|
15594
|
+
mockChannel.registerAndConnect,
|
|
15194
15595
|
'a url',
|
|
15195
15596
|
'a datachannel url',
|
|
15196
|
-
|
|
15597
|
+
'channel-token'
|
|
15197
15598
|
);
|
|
15198
15599
|
});
|
|
15199
|
-
|
|
15600
|
+
|
|
15601
|
+
it('clears llmChannel on registration failure', async () => {
|
|
15602
|
+
const registerError = new Error('registration failed');
|
|
15603
|
+
mockChannel.registerAndConnect.rejects(registerError);
|
|
15604
|
+
|
|
15200
15605
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15201
15606
|
meeting.locusInfo = {
|
|
15202
15607
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15204,21 +15609,30 @@ describe('plugin-meetings', () => {
|
|
|
15204
15609
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15205
15610
|
};
|
|
15206
15611
|
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
.
|
|
15612
|
+
try {
|
|
15613
|
+
await meeting.updateLLMConnection();
|
|
15614
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
15615
|
+
} catch (error) {
|
|
15616
|
+
assert.equal(error, registerError);
|
|
15617
|
+
}
|
|
15618
|
+
|
|
15619
|
+
assert.isUndefined(meeting.llmChannel);
|
|
15620
|
+
});
|
|
15621
|
+
|
|
15622
|
+
it('starts LLM health check timer after successful connection', async () => {
|
|
15623
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15624
|
+
meeting.locusInfo = {
|
|
15625
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15626
|
+
url: 'a url',
|
|
15627
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15628
|
+
};
|
|
15210
15629
|
|
|
15211
15630
|
await meeting.updateLLMConnection();
|
|
15212
15631
|
|
|
15213
|
-
assert.
|
|
15214
|
-
webex.internal.llm.registerAndConnect,
|
|
15215
|
-
'a url',
|
|
15216
|
-
'a datachannel url',
|
|
15217
|
-
'token-123'
|
|
15218
|
-
);
|
|
15219
|
-
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15632
|
+
assert.calledOnce(meeting.startLLMHealthCheckTimer);
|
|
15220
15633
|
});
|
|
15221
|
-
|
|
15634
|
+
|
|
15635
|
+
it('reuses voiceaChannel after successful connection', async () => {
|
|
15222
15636
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15223
15637
|
meeting.locusInfo = {
|
|
15224
15638
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15226,375 +15640,340 @@ describe('plugin-meetings', () => {
|
|
|
15226
15640
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15227
15641
|
};
|
|
15228
15642
|
|
|
15229
|
-
|
|
15643
|
+
await meeting.updateLLMConnection();
|
|
15644
|
+
|
|
15645
|
+
assert.notCalled(webex.internal.voicea.createChannel);
|
|
15646
|
+
assert.strictEqual(meeting.voiceaChannel, mockVoiceaChannel);
|
|
15647
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockChannel);
|
|
15648
|
+
});
|
|
15649
|
+
|
|
15650
|
+
it('creates and binds a voiceaChannel after the previous channel was cleaned up', async () => {
|
|
15651
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15652
|
+
meeting.voiceaChannel = undefined;
|
|
15653
|
+
meeting.locusInfo = {
|
|
15654
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15655
|
+
url: 'a url',
|
|
15656
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15657
|
+
};
|
|
15230
15658
|
|
|
15231
15659
|
await meeting.updateLLMConnection();
|
|
15232
15660
|
|
|
15233
|
-
assert.
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15661
|
+
assert.calledOnceWithExactly(webex.internal.voicea.createChannel);
|
|
15662
|
+
assert.strictEqual(meeting.voiceaChannel, mockVoiceaChannel);
|
|
15663
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockChannel);
|
|
15664
|
+
});
|
|
15665
|
+
|
|
15666
|
+
it('skips switchLLMChannel when practice session is active', async () => {
|
|
15667
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15668
|
+
meeting.webinar.isPracticeSessionLLMChannelConnected = sinon.stub().returns(true);
|
|
15669
|
+
meeting.locusInfo = {
|
|
15670
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15671
|
+
url: 'a url',
|
|
15672
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15673
|
+
};
|
|
15239
15674
|
|
|
15240
|
-
|
|
15675
|
+
await meeting.updateLLMConnection();
|
|
15676
|
+
|
|
15677
|
+
// switchLLMChannel should NOT be called when practice session is active
|
|
15678
|
+
// because practice session manages its own voicea binding
|
|
15679
|
+
assert.notCalled(mockVoiceaChannel.switchLLMChannel);
|
|
15241
15680
|
});
|
|
15242
15681
|
|
|
15243
|
-
it('
|
|
15682
|
+
it('logs warning when switchLLMChannel fails', async () => {
|
|
15244
15683
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15684
|
+
mockVoiceaChannel.switchLLMChannel.rejects(new Error('switch failed'));
|
|
15245
15685
|
meeting.locusInfo = {
|
|
15246
15686
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15247
15687
|
url: 'a url',
|
|
15248
15688
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15249
15689
|
};
|
|
15250
15690
|
|
|
15251
|
-
|
|
15252
|
-
|
|
15691
|
+
// Should not throw - fire-and-forget behavior
|
|
15692
|
+
const result = await meeting.updateLLMConnection();
|
|
15693
|
+
|
|
15694
|
+
assert.equal(result, 'something');
|
|
15695
|
+
});
|
|
15696
|
+
|
|
15697
|
+
it('starts transcription after LLM connects when Locus transcription is active', async () => {
|
|
15698
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15699
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15700
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15701
|
+
meeting.locusInfo = {
|
|
15702
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15703
|
+
url: 'a url',
|
|
15704
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15705
|
+
controls: {transcribe: {transcribing: true}},
|
|
15706
|
+
};
|
|
15253
15707
|
|
|
15254
15708
|
await meeting.updateLLMConnection();
|
|
15709
|
+
await mockVoiceaChannel.switchLLMChannel.firstCall.returnValue;
|
|
15255
15710
|
|
|
15256
|
-
assert.
|
|
15257
|
-
webex.internal.llm.registerAndConnect,
|
|
15258
|
-
'a url',
|
|
15259
|
-
'a datachannel url',
|
|
15260
|
-
undefined
|
|
15261
|
-
);
|
|
15262
|
-
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15711
|
+
assert.calledOnce(meeting.startTranscription);
|
|
15263
15712
|
});
|
|
15264
15713
|
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
});
|
|
15714
|
+
it('does not start transcription after LLM connects when Locus transcription is inactive', async () => {
|
|
15715
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15716
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15717
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15718
|
+
meeting.locusInfo = {
|
|
15719
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15720
|
+
url: 'a url',
|
|
15721
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15722
|
+
controls: {transcribe: {transcribing: false}},
|
|
15723
|
+
};
|
|
15276
15724
|
|
|
15277
|
-
|
|
15278
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15279
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15280
|
-
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15281
|
-
// Locus/datachannel URL mismatch is the *normal* case when
|
|
15282
|
-
// another meeting owns the live socket -- each meeting has its
|
|
15283
|
-
// own locus URL. URL mismatch must NOT trigger a reclaim,
|
|
15284
|
-
// because doing so would tear down the owning meeting's healthy
|
|
15285
|
-
// LLM socket and break its data channel.
|
|
15286
|
-
webex.internal.llm.getLocusUrl.returns('owner-locus-url');
|
|
15287
|
-
webex.internal.llm.getDatachannelUrl.returns('owner-dc-url');
|
|
15288
|
-
meeting.locusInfo = {
|
|
15289
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15290
|
-
url: 'a different url',
|
|
15291
|
-
info: {datachannelUrl: 'a different datachannel url'},
|
|
15292
|
-
self: {},
|
|
15293
|
-
};
|
|
15725
|
+
await meeting.updateLLMConnection();
|
|
15294
15726
|
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
assert.equal(result, undefined);
|
|
15298
|
-
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15299
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15300
|
-
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
15301
|
-
assert.notCalled(meeting.startLLMHealthCheckTimer);
|
|
15302
|
-
});
|
|
15303
|
-
|
|
15304
|
-
it('clears stale owner tag in cleanup finally block even when disconnectLLM rejects', async () => {
|
|
15305
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15306
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15307
|
-
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15308
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15309
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15310
|
-
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15311
|
-
meeting.locusInfo = {
|
|
15312
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15313
|
-
url: 'a different url',
|
|
15314
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15315
|
-
self: {},
|
|
15316
|
-
};
|
|
15727
|
+
assert.notCalled(meeting.startTranscription);
|
|
15728
|
+
});
|
|
15317
15729
|
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
|
|
15730
|
+
it('does not start transcription when areVoiceaEventsSetup is already true', async () => {
|
|
15731
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15732
|
+
meeting.areVoiceaEventsSetup = true;
|
|
15733
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15734
|
+
meeting.locusInfo = {
|
|
15735
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15736
|
+
url: 'a url',
|
|
15737
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15738
|
+
controls: {transcribe: {transcribing: true}},
|
|
15739
|
+
};
|
|
15323
15740
|
|
|
15324
|
-
|
|
15325
|
-
|
|
15326
|
-
|
|
15327
|
-
|
|
15741
|
+
await meeting.updateLLMConnection();
|
|
15742
|
+
|
|
15743
|
+
assert.notCalled(meeting.startTranscription);
|
|
15744
|
+
});
|
|
15328
15745
|
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15746
|
+
forEach(
|
|
15747
|
+
[
|
|
15748
|
+
{
|
|
15749
|
+
description: 'does not start transcription when voiceaChannel is disconnected',
|
|
15750
|
+
voiceaChannel: {isLLMConnected: sinon.stub().returns(false)},
|
|
15751
|
+
},
|
|
15752
|
+
{
|
|
15753
|
+
description: 'does not start transcription when voiceaChannel is unavailable',
|
|
15754
|
+
voiceaChannel: undefined,
|
|
15755
|
+
},
|
|
15756
|
+
],
|
|
15757
|
+
({description, voiceaChannel}) => {
|
|
15758
|
+
it(description, () => {
|
|
15759
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15760
|
+
meeting.locusInfo = {controls: {transcribe: {transcribing: true}}};
|
|
15761
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15762
|
+
meeting.voiceaChannel = voiceaChannel;
|
|
15763
|
+
|
|
15764
|
+
meeting.startTranscriptionIfNeeded();
|
|
15765
|
+
|
|
15766
|
+
assert.notCalled(meeting.startTranscription);
|
|
15338
15767
|
});
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
url: 'a different url',
|
|
15342
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15343
|
-
self: {},
|
|
15344
|
-
};
|
|
15768
|
+
}
|
|
15769
|
+
);
|
|
15345
15770
|
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15771
|
+
it('registers annotation channel when not in practice session', async () => {
|
|
15772
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15773
|
+
meeting.locusInfo = {
|
|
15774
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15775
|
+
url: 'a url',
|
|
15776
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15777
|
+
};
|
|
15778
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(false);
|
|
15351
15779
|
|
|
15352
|
-
|
|
15353
|
-
assert.equal(webex.internal.llm.getOwnerMeetingId(), 'new-owner-id');
|
|
15354
|
-
});
|
|
15355
|
-
|
|
15356
|
-
it('proceeds normally when LLM is connected and owned by this meeting with URL change', async () => {
|
|
15357
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15358
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15359
|
-
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15360
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15361
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15362
|
-
meeting.locusInfo = {
|
|
15363
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15364
|
-
url: 'a different url',
|
|
15365
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15366
|
-
self: {},
|
|
15367
|
-
};
|
|
15780
|
+
await meeting.updateLLMConnection();
|
|
15368
15781
|
|
|
15369
|
-
|
|
15782
|
+
assert.calledOnceWithExactly(meeting.annotation.registerChannel, mockChannel);
|
|
15783
|
+
});
|
|
15370
15784
|
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
);
|
|
15380
|
-
assert.calledWithExactly(
|
|
15381
|
-
webex.internal.llm.registerAndConnect,
|
|
15382
|
-
'a different url',
|
|
15383
|
-
'a datachannel url',
|
|
15384
|
-
undefined
|
|
15385
|
-
);
|
|
15386
|
-
// setOwnerMeetingId is called twice: first with undefined in
|
|
15387
|
-
// cleanupLLMConneciton's finally block (so a failed disconnect
|
|
15388
|
-
// cannot leave a stale owner), then with this meeting's id
|
|
15389
|
-
// after registerAndConnect resolves.
|
|
15390
|
-
assert.calledTwice(webex.internal.llm.setOwnerMeetingId);
|
|
15391
|
-
assert.calledWith(webex.internal.llm.setOwnerMeetingId.firstCall, undefined);
|
|
15392
|
-
assert.calledWith(webex.internal.llm.setOwnerMeetingId.lastCall, meeting.id);
|
|
15393
|
-
});
|
|
15394
|
-
|
|
15395
|
-
it('claims ownership after successful registerAndConnect on initial connect', async () => {
|
|
15396
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15397
|
-
webex.internal.llm.isConnected.returns(false);
|
|
15398
|
-
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15399
|
-
meeting.locusInfo = {
|
|
15400
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15401
|
-
url: 'a url',
|
|
15402
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15403
|
-
};
|
|
15785
|
+
it('does not register annotation channel when in practice session', async () => {
|
|
15786
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15787
|
+
meeting.locusInfo = {
|
|
15788
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15789
|
+
url: 'a url',
|
|
15790
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15791
|
+
};
|
|
15792
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15404
15793
|
|
|
15405
|
-
|
|
15794
|
+
await meeting.updateLLMConnection();
|
|
15406
15795
|
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
webex.internal.llm.setRefreshHandler,
|
|
15410
|
-
sinon.match.func,
|
|
15411
|
-
'llm-default-session',
|
|
15412
|
-
meeting.id
|
|
15413
|
-
);
|
|
15414
|
-
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15415
|
-
});
|
|
15416
|
-
|
|
15417
|
-
it('proceeds to connect when LLM is not connected even if another ownerId lingers', async () => {
|
|
15418
|
-
// Defensive path: if the LLM reports not-connected but an old
|
|
15419
|
-
// ownerId is still present (e.g. race before a successful
|
|
15420
|
-
// connections.delete), this meeting can still claim a fresh
|
|
15421
|
-
// connection.
|
|
15422
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15423
|
-
webex.internal.llm.isConnected.returns(false);
|
|
15424
|
-
webex.internal.llm.getOwnerMeetingId.returns('stale-owner-id');
|
|
15425
|
-
webex.internal.llm.getDatachannelToken.onFirstCall().returns(undefined);
|
|
15426
|
-
webex.internal.llm.getDatachannelToken.onSecondCall().returns('recovered-token');
|
|
15427
|
-
meeting.locusInfo = {
|
|
15428
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15429
|
-
url: 'a url',
|
|
15430
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15431
|
-
};
|
|
15796
|
+
assert.notCalled(meeting.annotation.registerChannel);
|
|
15797
|
+
});
|
|
15432
15798
|
|
|
15433
|
-
|
|
15799
|
+
it('still need connect main session data channel when PS started', async () => {
|
|
15800
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15801
|
+
meeting.locusInfo = {
|
|
15802
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15803
|
+
url: 'a url',
|
|
15804
|
+
info: {
|
|
15805
|
+
datachannelUrl: 'a datachannel url',
|
|
15806
|
+
practiceSessionDatachannelUrl: 'ps-url',
|
|
15807
|
+
},
|
|
15808
|
+
};
|
|
15809
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15434
15810
|
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
'llm-default-session'
|
|
15444
|
-
);
|
|
15445
|
-
assert.calledOnceWithExactly(
|
|
15446
|
-
webex.internal.llm.registerAndConnect,
|
|
15447
|
-
'a url',
|
|
15448
|
-
'a datachannel url',
|
|
15449
|
-
'recovered-token'
|
|
15450
|
-
);
|
|
15451
|
-
assert.calledWithExactly(
|
|
15452
|
-
webex.internal.llm.setRefreshHandler.firstCall,
|
|
15453
|
-
sinon.match.func,
|
|
15454
|
-
'llm-default-session',
|
|
15455
|
-
undefined
|
|
15456
|
-
);
|
|
15457
|
-
assert.calledTwice(webex.internal.llm.setRefreshHandler);
|
|
15458
|
-
assert.calledWithExactly(
|
|
15459
|
-
webex.internal.llm.setRefreshHandler.secondCall,
|
|
15460
|
-
sinon.match.func,
|
|
15461
|
-
'llm-default-session',
|
|
15462
|
-
meeting.id
|
|
15463
|
-
);
|
|
15464
|
-
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15465
|
-
});
|
|
15811
|
+
await meeting.updateLLMConnection();
|
|
15812
|
+
|
|
15813
|
+
assert.calledWithExactly(
|
|
15814
|
+
mockChannel.registerAndConnect,
|
|
15815
|
+
'a url',
|
|
15816
|
+
'a datachannel url',
|
|
15817
|
+
undefined
|
|
15818
|
+
);
|
|
15466
15819
|
});
|
|
15467
15820
|
|
|
15468
15821
|
describe('#clearMeetingData', () => {
|
|
15822
|
+
let existingChannel;
|
|
15823
|
+
|
|
15469
15824
|
beforeEach(() => {
|
|
15470
|
-
|
|
15471
|
-
|
|
15472
|
-
|
|
15825
|
+
existingChannel = {
|
|
15826
|
+
isConnected: sinon.stub().returns(true),
|
|
15827
|
+
disconnect: sinon.stub().resolves(),
|
|
15828
|
+
off: sinon.stub(),
|
|
15829
|
+
};
|
|
15830
|
+
meeting.llmChannel = existingChannel;
|
|
15831
|
+
|
|
15473
15832
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15474
15833
|
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15475
15834
|
meeting.stopTranscription = sinon.stub();
|
|
15476
|
-
meeting.clearDataChannelToken = sinon.stub();
|
|
15477
15835
|
meeting.shareStatus = 'no-share';
|
|
15478
15836
|
});
|
|
15479
15837
|
|
|
15480
|
-
it('disconnects llm and removes
|
|
15838
|
+
it('disconnects llm channel and removes listeners during meeting data cleanup', async () => {
|
|
15481
15839
|
await meeting.clearMeetingData();
|
|
15482
15840
|
|
|
15483
|
-
assert.
|
|
15484
|
-
|
|
15485
|
-
{
|
|
15486
|
-
code: 3050,
|
|
15487
|
-
reason: 'done (permanent)',
|
|
15488
|
-
},
|
|
15489
|
-
'llm-default-session',
|
|
15490
|
-
meeting.id
|
|
15491
|
-
);
|
|
15492
|
-
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15841
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15842
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15493
15843
|
assert.calledWithExactly(
|
|
15494
|
-
|
|
15844
|
+
existingChannel.off,
|
|
15495
15845
|
'event:relay.event',
|
|
15496
15846
|
meeting.processRelayEvent
|
|
15497
15847
|
);
|
|
15498
15848
|
assert.calledWithExactly(
|
|
15499
|
-
|
|
15849
|
+
existingChannel.off,
|
|
15500
15850
|
'event:locus.state_message',
|
|
15501
15851
|
meeting.processLocusLLMEvent
|
|
15502
15852
|
);
|
|
15503
|
-
assert.
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
// MEETING_STOPPED_RECEIVING_TRANSCRIPTION.
|
|
15509
|
-
assert.notCalled(meeting.stopTranscription);
|
|
15510
|
-
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15511
|
-
});
|
|
15512
|
-
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
15513
|
-
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15853
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15854
|
+
});
|
|
15855
|
+
|
|
15856
|
+
it('continues cleanup when disconnect fails', async () => {
|
|
15857
|
+
existingChannel.disconnect.rejects(new Error('disconnect failed'));
|
|
15514
15858
|
|
|
15515
15859
|
await meeting.clearMeetingData();
|
|
15516
15860
|
|
|
15517
|
-
assert.calledWithExactly(
|
|
15861
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15518
15862
|
assert.calledWithExactly(
|
|
15519
|
-
|
|
15863
|
+
existingChannel.off,
|
|
15520
15864
|
'event:relay.event',
|
|
15521
15865
|
meeting.processRelayEvent
|
|
15522
15866
|
);
|
|
15523
|
-
assert.
|
|
15524
|
-
webex.internal.llm.off,
|
|
15525
|
-
'event:locus.state_message',
|
|
15526
|
-
meeting.processLocusLLMEvent
|
|
15527
|
-
);
|
|
15528
|
-
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15529
|
-
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15530
|
-
assert.notCalled(meeting.stopTranscription);
|
|
15531
|
-
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15867
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15532
15868
|
});
|
|
15533
15869
|
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15537
|
-
});
|
|
15870
|
+
it('handles cleanup when no llmChannel exists', async () => {
|
|
15871
|
+
meeting.llmChannel = undefined;
|
|
15538
15872
|
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
await meeting.clearMeetingData();
|
|
15543
|
-
|
|
15544
|
-
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15545
|
-
// clearDataChannelToken is always delegated; llm enforces
|
|
15546
|
-
// ownership and no-ops for non-owners internally.
|
|
15547
|
-
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15548
|
-
// Listeners owned by *this* Meeting instance must still be
|
|
15549
|
-
// removed so a leaving subordinate meeting stops receiving
|
|
15550
|
-
// relay/locus events from the shared singleton.
|
|
15551
|
-
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15552
|
-
assert.calledWithExactly(
|
|
15553
|
-
webex.internal.llm.off,
|
|
15554
|
-
'event:relay.event',
|
|
15555
|
-
meeting.processRelayEvent
|
|
15556
|
-
);
|
|
15557
|
-
assert.calledWithExactly(
|
|
15558
|
-
webex.internal.llm.off,
|
|
15559
|
-
'event:locus.state_message',
|
|
15560
|
-
meeting.processLocusLLMEvent
|
|
15561
|
-
);
|
|
15562
|
-
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15563
|
-
});
|
|
15873
|
+
// Should not throw
|
|
15874
|
+
await meeting.clearMeetingData();
|
|
15564
15875
|
|
|
15565
|
-
|
|
15566
|
-
|
|
15876
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15877
|
+
});
|
|
15878
|
+
});
|
|
15567
15879
|
|
|
15568
|
-
|
|
15880
|
+
describe('#cleanupLLMConneciton', () => {
|
|
15881
|
+
let existingChannel;
|
|
15569
15882
|
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
|
|
15580
|
-
|
|
15883
|
+
beforeEach(() => {
|
|
15884
|
+
existingChannel = {
|
|
15885
|
+
isConnected: sinon.stub().returns(true),
|
|
15886
|
+
disconnect: sinon.stub().resolves(),
|
|
15887
|
+
off: sinon.stub(),
|
|
15888
|
+
};
|
|
15889
|
+
meeting.llmChannel = existingChannel;
|
|
15890
|
+
|
|
15891
|
+
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15892
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15893
|
+
});
|
|
15894
|
+
|
|
15895
|
+
forEach(
|
|
15896
|
+
[
|
|
15897
|
+
{
|
|
15898
|
+
description: 'destroys voiceaChannel when preserveVoiceaChannel is false (default)',
|
|
15899
|
+
llmChannelDefined: true,
|
|
15900
|
+
options: undefined,
|
|
15901
|
+
expectedVoiceaPreserved: false,
|
|
15902
|
+
},
|
|
15903
|
+
{
|
|
15904
|
+
description:
|
|
15905
|
+
'destroys voiceaChannel when preserveVoiceaChannel is explicitly false',
|
|
15906
|
+
llmChannelDefined: true,
|
|
15907
|
+
options: {preserveVoiceaChannel: false},
|
|
15908
|
+
expectedVoiceaPreserved: false,
|
|
15909
|
+
},
|
|
15910
|
+
{
|
|
15911
|
+
description: 'preserves voiceaChannel when preserveVoiceaChannel is true',
|
|
15912
|
+
llmChannelDefined: true,
|
|
15913
|
+
options: {preserveVoiceaChannel: true},
|
|
15914
|
+
expectedVoiceaPreserved: true,
|
|
15915
|
+
},
|
|
15916
|
+
{
|
|
15917
|
+
description:
|
|
15918
|
+
'cleans up voiceaChannel even when llmChannel is undefined (failed transient reconnect)',
|
|
15919
|
+
llmChannelDefined: false,
|
|
15920
|
+
options: {preserveVoiceaChannel: false},
|
|
15921
|
+
expectedVoiceaPreserved: false,
|
|
15922
|
+
},
|
|
15923
|
+
{
|
|
15924
|
+
description:
|
|
15925
|
+
'preserves voiceaChannel when llmChannel is undefined and preserveVoiceaChannel is true',
|
|
15926
|
+
llmChannelDefined: false,
|
|
15927
|
+
options: {preserveVoiceaChannel: true},
|
|
15928
|
+
expectedVoiceaPreserved: true,
|
|
15929
|
+
},
|
|
15930
|
+
],
|
|
15931
|
+
({description, llmChannelDefined, options, expectedVoiceaPreserved}) => {
|
|
15932
|
+
it(description, async () => {
|
|
15933
|
+
if (!llmChannelDefined) {
|
|
15934
|
+
meeting.llmChannel = undefined;
|
|
15935
|
+
}
|
|
15936
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15581
15937
|
|
|
15582
|
-
|
|
15583
|
-
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15938
|
+
await meeting.cleanupLLMConneciton(options);
|
|
15584
15939
|
|
|
15585
|
-
|
|
15940
|
+
if (expectedVoiceaPreserved) {
|
|
15941
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15942
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15943
|
+
} else {
|
|
15944
|
+
assert.calledOnce(mockVoiceaChannel.deregisterEvents);
|
|
15945
|
+
assert.isUndefined(meeting.voiceaChannel);
|
|
15946
|
+
}
|
|
15947
|
+
assert.isUndefined(meeting.llmChannel);
|
|
15948
|
+
});
|
|
15949
|
+
}
|
|
15950
|
+
);
|
|
15586
15951
|
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15952
|
+
it('passes throwOnError alongside preserveVoiceaChannel', async () => {
|
|
15953
|
+
existingChannel.disconnect.rejects(new Error('disconnect failed'));
|
|
15954
|
+
|
|
15955
|
+
// Should not throw when throwOnError is false
|
|
15956
|
+
await meeting.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: true});
|
|
15957
|
+
|
|
15958
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15959
|
+
assert.isDefined(meeting.voiceaChannel);
|
|
15960
|
+
});
|
|
15961
|
+
|
|
15962
|
+
it('cleans up LLM event listeners regardless of preserveVoiceaChannel', async () => {
|
|
15963
|
+
await meeting.cleanupLLMConneciton({preserveVoiceaChannel: true});
|
|
15964
|
+
|
|
15965
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15966
|
+
assert.calledWithExactly(
|
|
15967
|
+
existingChannel.off,
|
|
15968
|
+
'event:relay.event',
|
|
15969
|
+
meeting.processRelayEvent
|
|
15970
|
+
);
|
|
15971
|
+
assert.calledWithExactly(
|
|
15972
|
+
existingChannel.off,
|
|
15973
|
+
'event:locus.state_message',
|
|
15974
|
+
meeting.processLocusLLMEvent
|
|
15975
|
+
);
|
|
15976
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15598
15977
|
});
|
|
15599
15978
|
});
|
|
15600
15979
|
});
|
|
@@ -17431,6 +17810,123 @@ describe('plugin-meetings', () => {
|
|
|
17431
17810
|
});
|
|
17432
17811
|
});
|
|
17433
17812
|
});
|
|
17813
|
+
describe('#isLLMConnected', () => {
|
|
17814
|
+
it('returns true when main LLM channel is connected and not in practice session', () => {
|
|
17815
|
+
meeting.webinar = {
|
|
17816
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17817
|
+
};
|
|
17818
|
+
meeting.llmChannel = {
|
|
17819
|
+
isConnected: sinon.stub().returns(true),
|
|
17820
|
+
};
|
|
17821
|
+
|
|
17822
|
+
const result = meeting.isLLMConnected();
|
|
17823
|
+
|
|
17824
|
+
expect(result).to.equal(true);
|
|
17825
|
+
});
|
|
17826
|
+
|
|
17827
|
+
it('returns false when main LLM channel is not connected and not in practice session', () => {
|
|
17828
|
+
meeting.webinar = {
|
|
17829
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17830
|
+
};
|
|
17831
|
+
meeting.llmChannel = {
|
|
17832
|
+
isConnected: sinon.stub().returns(false),
|
|
17833
|
+
};
|
|
17834
|
+
|
|
17835
|
+
const result = meeting.isLLMConnected();
|
|
17836
|
+
|
|
17837
|
+
expect(result).to.equal(false);
|
|
17838
|
+
});
|
|
17839
|
+
|
|
17840
|
+
it('returns false when no LLM channel exists and not in practice session', () => {
|
|
17841
|
+
meeting.webinar = {
|
|
17842
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17843
|
+
};
|
|
17844
|
+
meeting.llmChannel = undefined;
|
|
17845
|
+
|
|
17846
|
+
const result = meeting.isLLMConnected();
|
|
17847
|
+
|
|
17848
|
+
expect(result).to.equal(false);
|
|
17849
|
+
});
|
|
17850
|
+
|
|
17851
|
+
it('returns practice session LLM channel status when in practice session', () => {
|
|
17852
|
+
meeting.webinar = {
|
|
17853
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
17854
|
+
isPracticeSessionLLMChannelConnected: sinon.stub().returns(true),
|
|
17855
|
+
};
|
|
17856
|
+
meeting.llmChannel = {
|
|
17857
|
+
isConnected: sinon.stub().returns(false),
|
|
17858
|
+
};
|
|
17859
|
+
|
|
17860
|
+
const result = meeting.isLLMConnected();
|
|
17861
|
+
|
|
17862
|
+
expect(result).to.equal(true);
|
|
17863
|
+
sinon.assert.calledOnce(meeting.webinar.isPracticeSessionLLMChannelConnected);
|
|
17864
|
+
sinon.assert.notCalled(meeting.llmChannel.isConnected);
|
|
17865
|
+
});
|
|
17866
|
+
|
|
17867
|
+
it('returns false when webinar is undefined', () => {
|
|
17868
|
+
meeting.webinar = undefined;
|
|
17869
|
+
meeting.llmChannel = {
|
|
17870
|
+
isConnected: sinon.stub().returns(true),
|
|
17871
|
+
};
|
|
17872
|
+
|
|
17873
|
+
const result = meeting.isLLMConnected();
|
|
17874
|
+
|
|
17875
|
+
expect(result).to.equal(true);
|
|
17876
|
+
});
|
|
17877
|
+
});
|
|
17878
|
+
describe('#getLLMLocusUrl', () => {
|
|
17879
|
+
it('returns locus URL from main LLM channel when not in practice session', () => {
|
|
17880
|
+
meeting.webinar = {
|
|
17881
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17882
|
+
};
|
|
17883
|
+
meeting.llmChannel = {
|
|
17884
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/main'),
|
|
17885
|
+
};
|
|
17886
|
+
|
|
17887
|
+
const result = meeting.getLLMLocusUrl();
|
|
17888
|
+
|
|
17889
|
+
expect(result).to.equal('https://locus.example.com/main');
|
|
17890
|
+
});
|
|
17891
|
+
|
|
17892
|
+
it('returns undefined when no LLM channel exists and not in practice session', () => {
|
|
17893
|
+
meeting.webinar = {
|
|
17894
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17895
|
+
};
|
|
17896
|
+
meeting.llmChannel = undefined;
|
|
17897
|
+
|
|
17898
|
+
const result = meeting.getLLMLocusUrl();
|
|
17899
|
+
|
|
17900
|
+
expect(result).to.be.undefined;
|
|
17901
|
+
});
|
|
17902
|
+
|
|
17903
|
+
it('returns practice session locus URL when in practice session', () => {
|
|
17904
|
+
meeting.webinar = {
|
|
17905
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
17906
|
+
getPracticeSessionLocusUrl: sinon.stub().returns('https://locus.example.com/practice'),
|
|
17907
|
+
};
|
|
17908
|
+
meeting.llmChannel = {
|
|
17909
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/main'),
|
|
17910
|
+
};
|
|
17911
|
+
|
|
17912
|
+
const result = meeting.getLLMLocusUrl();
|
|
17913
|
+
|
|
17914
|
+
expect(result).to.equal('https://locus.example.com/practice');
|
|
17915
|
+
sinon.assert.calledOnce(meeting.webinar.getPracticeSessionLocusUrl);
|
|
17916
|
+
sinon.assert.notCalled(meeting.llmChannel.getLocusUrl);
|
|
17917
|
+
});
|
|
17918
|
+
|
|
17919
|
+
it('returns main channel locus URL when webinar is undefined', () => {
|
|
17920
|
+
meeting.webinar = undefined;
|
|
17921
|
+
meeting.llmChannel = {
|
|
17922
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/main'),
|
|
17923
|
+
};
|
|
17924
|
+
|
|
17925
|
+
const result = meeting.getLLMLocusUrl();
|
|
17926
|
+
|
|
17927
|
+
expect(result).to.equal('https://locus.example.com/main');
|
|
17928
|
+
});
|
|
17929
|
+
});
|
|
17434
17930
|
describe('#getDataChannelTokenType', () => {
|
|
17435
17931
|
it('returns PracticeSession when webinar is in practice session mode', () => {
|
|
17436
17932
|
meeting.webinar = {
|