@webex/plugin-meetings 3.12.0-webex-services-ready.2 → 3.12.0-webex-services-ready.4

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.
Files changed (54) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/events.js +29 -14
  4. package/dist/breakouts/events.js.map +1 -1
  5. package/dist/breakouts/index.js +65 -2
  6. package/dist/breakouts/index.js.map +1 -1
  7. package/dist/constants.js +2 -1
  8. package/dist/constants.js.map +1 -1
  9. package/dist/hashTree/hashTreeParser.js +193 -23
  10. package/dist/hashTree/hashTreeParser.js.map +1 -1
  11. package/dist/interpretation/index.js +1 -1
  12. package/dist/interpretation/siLanguage.js +1 -1
  13. package/dist/locus-info/index.js +141 -56
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/media/properties.js +3 -5
  16. package/dist/media/properties.js.map +1 -1
  17. package/dist/meeting/index.js +351 -52
  18. package/dist/meeting/index.js.map +1 -1
  19. package/dist/meetings/index.js +25 -0
  20. package/dist/meetings/index.js.map +1 -1
  21. package/dist/metrics/constants.js +3 -1
  22. package/dist/metrics/constants.js.map +1 -1
  23. package/dist/roap/turnDiscovery.js +8 -1
  24. package/dist/roap/turnDiscovery.js.map +1 -1
  25. package/dist/types/constants.d.ts +1 -0
  26. package/dist/types/hashTree/hashTreeParser.d.ts +51 -3
  27. package/dist/types/locus-info/index.d.ts +19 -4
  28. package/dist/types/media/properties.d.ts +5 -2
  29. package/dist/types/meeting/index.d.ts +63 -1
  30. package/dist/types/meetings/index.d.ts +8 -0
  31. package/dist/types/metrics/constants.d.ts +2 -0
  32. package/dist/webinar/index.js +4 -4
  33. package/dist/webinar/index.js.map +1 -1
  34. package/package.json +23 -23
  35. package/src/breakouts/events.ts +33 -11
  36. package/src/breakouts/index.ts +79 -1
  37. package/src/constants.ts +1 -0
  38. package/src/hashTree/hashTreeParser.ts +254 -18
  39. package/src/locus-info/index.ts +143 -51
  40. package/src/media/properties.ts +7 -3
  41. package/src/meeting/index.ts +329 -25
  42. package/src/meetings/index.ts +35 -1
  43. package/src/metrics/constants.ts +2 -0
  44. package/src/roap/turnDiscovery.ts +9 -1
  45. package/src/webinar/index.ts +2 -2
  46. package/test/unit/spec/breakouts/events.ts +120 -2
  47. package/test/unit/spec/breakouts/index.ts +142 -2
  48. package/test/unit/spec/hashTree/hashTreeParser.ts +556 -3
  49. package/test/unit/spec/locus-info/index.js +148 -5
  50. package/test/unit/spec/media/properties.ts +23 -23
  51. package/test/unit/spec/meeting/index.js +832 -126
  52. package/test/unit/spec/meetings/index.js +116 -12
  53. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  54. package/test/unit/spec/webinar/index.ts +3 -3
@@ -33,7 +33,7 @@ import {
33
33
  MediaCodecMimeType,
34
34
  } from '@webex/internal-media-core';
35
35
 
36
- import {DataChannelTokenType} from '@webex/internal-plugin-llm';
36
+ import {DataChannelTokenType, type RegisterAndConnectTiming} from '@webex/internal-plugin-llm';
37
37
 
38
38
  import {
39
39
  LocalStream,
@@ -742,6 +742,7 @@ export default class Meeting extends StatelessWebexPlugin {
742
742
  isMoveToInProgress = false;
743
743
  registrationIdStatus: string;
744
744
  brbState: BrbState;
745
+ private emittedBreakoutJoinResponseMoveIds: Set<string> = new Set();
745
746
  private promisesWaitingForPropUpdate: Record<string, Defer> = {};
746
747
 
747
748
  voiceaListenerCallbacks: object = {
@@ -1394,7 +1395,48 @@ export default class Meeting extends StatelessWebexPlugin {
1394
1395
  * @memberof Meeting
1395
1396
  */
1396
1397
  // @ts-ignore - Fix type
1397
- this.locusInfo = new LocusInfo(this.updateMeetingObject.bind(this), this.webex, this.id);
1398
+ this.locusInfo = new LocusInfo(
1399
+ {
1400
+ updateMeeting: this.updateMeetingObject.bind(this),
1401
+ syncLatencyTracker: {
1402
+ // Compute/store latency timestamps live on CallDiagnosticLatencies, while
1403
+ // submitting the client.locus.sync.complete CA event is owned by the metrics
1404
+ // facade. Wire each method to the layer that owns that responsibility.
1405
+ saveLatency: (...args) =>
1406
+ // @ts-ignore
1407
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveLatency(...args),
1408
+ saveTimestamp: (saveTimestampOptions: {
1409
+ key: string;
1410
+ value?: number;
1411
+ options: {meetingId: string; dataSetName: string; trackingId?: string};
1412
+ }) => {
1413
+ // @ts-ignore
1414
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp(
1415
+ saveTimestampOptions
1416
+ );
1417
+
1418
+ // The /sync response is one of the two milestones (the other is the LLM message) that
1419
+ // complete client.locus.sync.complete. Try to complete now: the metric is emitted only
1420
+ // once both the LLM message and the /sync response have arrived (either can come first).
1421
+ if (
1422
+ saveTimestampOptions.key === 'internal.client.locus.sync.response' &&
1423
+ saveTimestampOptions.options?.trackingId
1424
+ ) {
1425
+ this.tryCompleteLocusSyncLatency(
1426
+ saveTimestampOptions.options.meetingId,
1427
+ saveTimestampOptions.options.trackingId
1428
+ );
1429
+ }
1430
+ },
1431
+ clearLocusSyncLatency: (...args) =>
1432
+ // @ts-ignore
1433
+ this.webex.internal.newMetrics.callDiagnosticLatencies.clearLocusSyncLatency(...args),
1434
+ },
1435
+ },
1436
+ // @ts-ignore
1437
+ this.webex,
1438
+ this.id
1439
+ );
1398
1440
 
1399
1441
  // We had to add listeners first before setting up the locus instance
1400
1442
  /**
@@ -2380,6 +2422,89 @@ export default class Meeting extends StatelessWebexPlugin {
2380
2422
  });
2381
2423
  }
2382
2424
 
2425
+ /**
2426
+ * Handles the LLM state-update message that resulted from a Locus /sync. Records the LLM arrival
2427
+ * time (the milestone that gates client.locus.sync.complete - the metric is emitted only for LLM
2428
+ * flows) and then tries to complete the metric.
2429
+ * @param {string} meetingId meeting id
2430
+ * @param {string} trackingId sync tracking id echoed back on the LLM message
2431
+ * @returns {void}
2432
+ * @private
2433
+ * @memberof Meeting
2434
+ */
2435
+ private onLocusSyncLlmMessage(meetingId: string, trackingId: string) {
2436
+ // @ts-ignore
2437
+ this.webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived(
2438
+ meetingId,
2439
+ trackingId
2440
+ );
2441
+
2442
+ this.tryCompleteLocusSyncLatency(meetingId, trackingId);
2443
+ }
2444
+
2445
+ /**
2446
+ * Attempts to complete the Locus sync latency metric and emit client.locus.sync.complete. The
2447
+ * metric is emitted only once BOTH the /sync response and the resulting LLM message have arrived
2448
+ * (in either order); until then the record is kept so the missing milestone can still land. Both
2449
+ * trigger points (the LLM message handler and the /sync response timestamp) call this, so the
2450
+ * metric fires as soon as the second milestone is in.
2451
+ * @param {string} meetingId meeting id
2452
+ * @param {string} trackingId sync tracking id used to match the pending record
2453
+ * @returns {void}
2454
+ * @private
2455
+ * @memberof Meeting
2456
+ */
2457
+ private tryCompleteLocusSyncLatency(meetingId: string, trackingId: string) {
2458
+ const completed =
2459
+ // @ts-ignore
2460
+ this.webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency(
2461
+ meetingId,
2462
+ trackingId
2463
+ );
2464
+
2465
+ if (completed) {
2466
+ this.emitLocusSyncCompleteMetric(meetingId, completed);
2467
+ }
2468
+ }
2469
+
2470
+ /**
2471
+ * Submits the client.locus.sync.complete Call Analyzer event for a completed Locus sync latency
2472
+ * measurement.
2473
+ * @param {string} meetingId meeting id
2474
+ * @param {object} completed completed sync latency payload from the metrics plugin
2475
+ * @returns {void}
2476
+ * @private
2477
+ * @memberof Meeting
2478
+ */
2479
+ private emitLocusSyncCompleteMetric(
2480
+ meetingId: string,
2481
+ completed: {dataSet: string; syncLatency: object}
2482
+ ) {
2483
+ // @ts-ignore
2484
+ const llmWebsocketUrl = this.webex.internal.llm?.getWebSocketUrl?.() || undefined;
2485
+
2486
+ // Per the LLM sync-latency spec, the event carries the LLM websocket url identifier,
2487
+ // the llmInfo.dataSet (main, atd-active or atd-unmuted) and the syncLatency block.
2488
+ const clientEvent = {
2489
+ name: 'client.locus.sync.complete',
2490
+ payload: {
2491
+ identifiers: {
2492
+ llmWebsocketUrl,
2493
+ },
2494
+ llmInfo: {
2495
+ dataSet: completed.dataSet,
2496
+ },
2497
+ syncLatency: completed.syncLatency,
2498
+ },
2499
+ options: {
2500
+ meetingId,
2501
+ },
2502
+ };
2503
+
2504
+ // @ts-ignore
2505
+ this.webex.internal.newMetrics.submitClientEvent(clientEvent);
2506
+ }
2507
+
2383
2508
  /**
2384
2509
  * Proxy function for all the listener set ups
2385
2510
  * @returns {undefined}
@@ -3270,7 +3395,7 @@ export default class Meeting extends StatelessWebexPlugin {
3270
3395
  }
3271
3396
 
3272
3397
  LoggerProxy.logger.info(
3273
- `Meeting:index#setUpLocusInfoMediaInactiveListener --> this.shareStatus=${this.shareStatus} newShareStatus=${newShareStatus}`
3398
+ `Meeting:index#setUpLocusMediaSharesListener --> this.shareStatus=${this.shareStatus} newShareStatus=${newShareStatus}`
3274
3399
  );
3275
3400
 
3276
3401
  if (newShareStatus !== this.shareStatus) {
@@ -5326,6 +5451,7 @@ export default class Meeting extends StatelessWebexPlugin {
5326
5451
  );
5327
5452
 
5328
5453
  this.receiveSlotManager.reset();
5454
+
5329
5455
  this.mediaProperties.webrtcMediaConnection.close();
5330
5456
  this.mediaProperties.unsetPeerConnection();
5331
5457
  this.sendSlotManager.reset();
@@ -5624,9 +5750,6 @@ export default class Meeting extends StatelessWebexPlugin {
5624
5750
 
5625
5751
  LoggerProxy.logger.info('Meeting:index#joinWithMedia called');
5626
5752
 
5627
- let joined = false;
5628
- let joinResponse = prevJoinResponse;
5629
-
5630
5753
  /* Before we do anything, check if RTCPeerConnection is available. Normally this is checked
5631
5754
  by addMediaInternal() itself when creating the media connection, but since joinWithMedia()
5632
5755
  is a convenience method that does both join() and addMedia(), we want to fail fast here
@@ -5639,9 +5762,20 @@ export default class Meeting extends StatelessWebexPlugin {
5639
5762
  );
5640
5763
  }
5641
5764
 
5765
+ /* While we're trying to join, we may fail and be doing a retry. In that case,
5766
+ we sometimes get dropped by Locus as a result of the 1st failed attempt.
5767
+ That notification from Locus needs to be ignored, otherwise it causes the meeting to be
5768
+ cleaned up and prevents the retry from running correctly.
5769
+ */
5770
+ this.locusInfo.suspendDestroyMeeting(true);
5771
+
5772
+ let joined = false;
5773
+ let joinResponse = prevJoinResponse;
5774
+
5642
5775
  const shouldJoin =
5643
5776
  !joinResponse || // first try, when the join response is empty
5644
5777
  (prevError && prevError instanceof UserNotJoinedError) || // last try failed with UserNotJoinedError
5778
+ this.isErrorMeaningLocusDroppedUs(prevError) ||
5645
5779
  MeetingUtil.isUserInLeftState(this.locusInfo); // locus dropped the connection before we can re-try addMedia
5646
5780
 
5647
5781
  try {
@@ -5705,6 +5839,8 @@ export default class Meeting extends StatelessWebexPlugin {
5705
5839
 
5706
5840
  this.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
5707
5841
 
5842
+ this.locusInfo.suspendDestroyMeeting(false);
5843
+
5708
5844
  return {
5709
5845
  join: joinResponse,
5710
5846
  media: mediaResponse,
@@ -5717,10 +5853,12 @@ export default class Meeting extends StatelessWebexPlugin {
5717
5853
 
5718
5854
  this.roap.abortTurnDiscovery();
5719
5855
 
5720
- // let's do a retry
5856
+ // let's do a retry (but not on 1-1 calls, because the flow would get too complicated)
5721
5857
  let shouldRetry =
5722
- retryCount < 1 ||
5723
- (error instanceof UserNotJoinedError && retryCount < JOIN_WITH_MEDIA_RETRY_MAX_COUNT);
5858
+ !MeetingsUtil.isOneOnOneCall(this.locusInfo.parsedLocus) &&
5859
+ (retryCount < 1 ||
5860
+ ((error instanceof UserNotJoinedError || this.isErrorMeaningLocusDroppedUs(error)) &&
5861
+ retryCount < JOIN_WITH_MEDIA_RETRY_MAX_COUNT));
5724
5862
 
5725
5863
  if (
5726
5864
  CallDiagnosticUtils.isSdpOfferCreationError(error) ||
@@ -5791,6 +5929,8 @@ export default class Meeting extends StatelessWebexPlugin {
5791
5929
  prevError: undefined,
5792
5930
  };
5793
5931
 
5932
+ this.locusInfo.suspendDestroyMeeting(false);
5933
+
5794
5934
  throw firstError ?? error;
5795
5935
  }
5796
5936
  }
@@ -6034,7 +6174,18 @@ export default class Meeting extends StatelessWebexPlugin {
6034
6174
  storeEventForDebugging('llm', event.data);
6035
6175
  }
6036
6176
 
6177
+ const {trackingId} = event;
6178
+
6037
6179
  this.locusInfo.parse(this, event.data);
6180
+
6181
+ // Only the client whose /sync request tracking id matches the tracking id echoed back on this
6182
+ // LLM message should emit client.locus.sync.complete. The tracking id lives at the top level
6183
+ // of the received LLM event envelope. When it is absent there is nothing to correlate, so
6184
+ // skip. onLocusSyncLlmMessage records the LLM arrival time and is a no-op unless a stored
6185
+ // record for this meeting matches the tracking id.
6186
+ if (trackingId) {
6187
+ this.onLocusSyncLlmMessage(this.id, trackingId);
6188
+ }
6038
6189
  } else {
6039
6190
  LoggerProxy.logger.warn(
6040
6191
  `Meeting:index#processLocusLLMEvent --> Unknown event type: ${event.data.eventType}`
@@ -6180,10 +6331,11 @@ export default class Meeting extends StatelessWebexPlugin {
6180
6331
  */
6181
6332
  private restoreLLMSubscriptionsIfNeeded(): void {
6182
6333
  try {
6183
- // @ts-ignore
6184
- const isCaptionBoxOn = this.webex.internal.voicea?.getIsCaptionBoxOn?.();
6334
+ const keepTranscriptionSubscribed =
6335
+ // @ts-ignore
6336
+ this.webex.internal.voicea?.getKeepTranscriptionSubscribed?.();
6185
6337
 
6186
- if (!isCaptionBoxOn) {
6338
+ if (!keepTranscriptionSubscribed) {
6187
6339
  return;
6188
6340
  }
6189
6341
 
@@ -6443,7 +6595,7 @@ export default class Meeting extends StatelessWebexPlugin {
6443
6595
  this.webex.internal.llm.off('online', this.handleLLMOnline);
6444
6596
  // @ts-ignore
6445
6597
  this.webex.internal.llm.on('online', this.handleLLMOnline);
6446
- this.updateLLMConnection()
6598
+ this.updateLLMConnection({isInitialJoinPhase: true})
6447
6599
  .catch((error) => {
6448
6600
  LoggerProxy.logger.error(
6449
6601
  'Meeting:index#join --> Transcription Socket Connection Failed',
@@ -6714,9 +6866,11 @@ export default class Meeting extends StatelessWebexPlugin {
6714
6866
  /**
6715
6867
  * Connects to low latency mercury and reconnects if the address has changed
6716
6868
  * It will also disconnect if called when the meeting has ended
6869
+ * @param {Object} [options]
6870
+ * @param {boolean} [options.isInitialJoinPhase] true when called from initial join flow
6717
6871
  * @returns {Promise}
6718
6872
  */
6719
- async updateLLMConnection() {
6873
+ async updateLLMConnection({isInitialJoinPhase = false}: {isInitialJoinPhase?: boolean} = {}) {
6720
6874
  // @ts-ignore - Fix type
6721
6875
  const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
6722
6876
 
@@ -6854,10 +7008,114 @@ export default class Meeting extends StatelessWebexPlugin {
6854
7008
 
6855
7009
  this.startLLMHealthCheckTimer();
6856
7010
 
7011
+ if (registerAndConnectResult) {
7012
+ if (isInitialJoinPhase) {
7013
+ this.sendLLMConnectMetric(registerAndConnectResult);
7014
+ }
7015
+
7016
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7017
+ meeting: this,
7018
+ llmLatency: registerAndConnectResult,
7019
+ });
7020
+ }
7021
+
6857
7022
  return Promise.resolve(registerAndConnectResult);
7023
+ })
7024
+ .catch((error) => {
7025
+ // Prefer the partial timing registerAndConnect attaches when register succeeded but the
7026
+ // websocket connect() failed, so a ws failure isn't misreported as register never completing.
7027
+ const llmLatency = {
7028
+ clientLLMDatachannelResponseTime: error?.timing?.clientLLMDatachannelResponseTime ?? 0,
7029
+ clientLLMWebSocketConnectTime: 0,
7030
+ };
7031
+
7032
+ if (isInitialJoinPhase) {
7033
+ this.sendLLMConnectMetric(llmLatency, error);
7034
+ }
7035
+
7036
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7037
+ meeting: this,
7038
+ llmLatency,
7039
+ error,
7040
+ });
7041
+
7042
+ return Promise.reject(error);
6858
7043
  });
6859
7044
  }
6860
7045
 
7046
+ /**
7047
+ * Ensures breakout join response metric with LLM latency is emitted only once per breakout move id.
7048
+ * @param {string | undefined} breakoutMoveId
7049
+ * @param {boolean} [hasLLMLatency=false]
7050
+ * @returns {boolean}
7051
+ */
7052
+ private shouldEmitBreakoutJoinResponseMetric(
7053
+ breakoutMoveId?: string,
7054
+ hasLLMLatency = false
7055
+ ): boolean {
7056
+ if (!breakoutMoveId) {
7057
+ return false;
7058
+ }
7059
+
7060
+ if (!hasLLMLatency) {
7061
+ // When automatic LLM is enabled, updateLLMConnection will emit this same breakout join
7062
+ // response after the LLM connection finishes, including llmLatency and llmWebsocketUrl.
7063
+ // Suppress the earlier non-LLM event to avoid sending two events for the same move id,
7064
+ // where the first one would be missing the LLM-specific fields we want to validate.
7065
+ // @ts-ignore - config coming from registerPlugin
7066
+ return !this.config.enableAutomaticLLM;
7067
+ }
7068
+
7069
+ if (this.emittedBreakoutJoinResponseMoveIds.has(breakoutMoveId)) {
7070
+ return false;
7071
+ }
7072
+
7073
+ this.emittedBreakoutJoinResponseMoveIds.add(breakoutMoveId);
7074
+
7075
+ return true;
7076
+ }
7077
+
7078
+ /**
7079
+ * Sends LLM connect latencies for initial join flow.
7080
+ * @param {RegisterAndConnectTiming} timings
7081
+ * @param {any} [error]
7082
+ * @returns {void}
7083
+ */
7084
+ private sendLLMConnectMetric(timings: RegisterAndConnectTiming, error?: any) {
7085
+ // @ts-ignore
7086
+ const llmWebsocketUrl = this.webex.internal.llm.getWebSocketUrl?.() || undefined;
7087
+ const {clientLLMDatachannelResponseTime = 0, clientLLMWebSocketConnectTime} = timings || {};
7088
+
7089
+ const llmLatency: any = {
7090
+ clientLLMDatachannelResponseTime,
7091
+ };
7092
+
7093
+ if (clientLLMWebSocketConnectTime !== undefined) {
7094
+ llmLatency.clientLLMWebSocketConnectTime = clientLLMWebSocketConnectTime;
7095
+ }
7096
+
7097
+ const payload: any = {
7098
+ identifiers: {
7099
+ llmWebsocketUrl,
7100
+ },
7101
+ llmLatency,
7102
+ };
7103
+
7104
+ const options: any = {
7105
+ meetingId: this.id,
7106
+ ...(error && {rawError: error}),
7107
+ };
7108
+
7109
+ const metricEvent = {
7110
+ name: 'client.llm.connect.response',
7111
+ payload,
7112
+ options,
7113
+ };
7114
+
7115
+ // @ts-ignore
7116
+ this.webex.internal.newMetrics.submitClientEvent(metricEvent);
7117
+ }
7118
+
6861
7119
  /**
6862
7120
  * Use phone for meeting audio
6863
7121
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -7285,16 +7543,32 @@ export default class Meeting extends StatelessWebexPlugin {
7285
7543
  // @ts-ignore
7286
7544
  const cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
7287
7545
 
7546
+ // Compute the offer->answer latency from when the local SDP offer was generated up to now,
7547
+ // rather than from the stored remote-sdp-received timestamp. That stored timestamp uses
7548
+ // saveFirstTimestampOnly, so if waitForRemoteSDPAnswer() already timed out and submitted a
7549
+ // remote-sdp-received event, the stored value would be pinned to the timeout time and would
7550
+ // under-report an answer that arrives late. This handler fires exactly when the answer is
7551
+ // processed, so Date.now() is the accurate "received" time.
7552
+ // (submitClientEvent below still records the remote-sdp-received timestamp used by the CA
7553
+ // join-time metric, so we don't need to save it here.)
7554
+ const localSdpGeneratedTimestamp = cdl.latencyTimestamps.get(
7555
+ 'client.media-engine.local-sdp-generated'
7556
+ );
7557
+ const localSDPGenRemoteSDPRecv =
7558
+ localSdpGeneratedTimestamp !== undefined
7559
+ ? Date.now() - localSdpGeneratedTimestamp
7560
+ : undefined;
7561
+
7288
7562
  // @ts-ignore
7289
7563
  this.webex.internal.newMetrics.submitClientEvent({
7290
7564
  name: 'client.media-engine.remote-sdp-received',
7565
+ payload: {
7566
+ eventData: {
7567
+ localSDPGenRemoteSDPRecv,
7568
+ },
7569
+ },
7291
7570
  options: {meetingId: this.id},
7292
7571
  });
7293
- Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ROAP_OFFER_TO_ANSWER_LATENCY, {
7294
- correlation_id: this.correlationId,
7295
- latency: cdl.getLocalSDPGenRemoteSDPRecv(),
7296
- meetingId: this.id,
7297
- });
7298
7572
 
7299
7573
  if (this.deferSDPAnswer) {
7300
7574
  this.deferSDPAnswer.resolve();
@@ -7913,6 +8187,23 @@ export default class Meeting extends StatelessWebexPlugin {
7913
8187
  return `MC-${this.id.substring(0, 4)}`;
7914
8188
  }
7915
8189
 
8190
+ /**
8191
+ * Checks if the error indicates that Locus dropped us from the meeting,
8192
+ * either directly on the error or wrapped inside an AddMediaFailed cause.
8193
+ * This method is meant to be called only with errors thrown by Meeting.addMediaInternal()
8194
+ *
8195
+ * @param {Error} error
8196
+ * @returns {boolean}
8197
+ */
8198
+ private isErrorMeaningLocusDroppedUs(error: Error | undefined): boolean {
8199
+ const statusCode = (error as any)?.statusCode;
8200
+ const causeStatusCode = (error as any)?.cause?.statusCode;
8201
+
8202
+ return (
8203
+ statusCode === 409 || statusCode === 403 || causeStatusCode === 409 || causeStatusCode === 403
8204
+ );
8205
+ }
8206
+
7916
8207
  /**
7917
8208
  * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
7918
8209
  * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
@@ -8012,6 +8303,7 @@ export default class Meeting extends StatelessWebexPlugin {
8012
8303
  this.mediaProperties.mediaDirection.receiveShare,
8013
8304
  ];
8014
8305
 
8306
+ this.sendSlotManager.reset();
8015
8307
  this.sendSlotManager.createSlot(mc, MediaType.VideoMain, videoEnabled);
8016
8308
  this.sendSlotManager.createSlot(mc, MediaType.AudioMain, audioEnabled);
8017
8309
  this.sendSlotManager.createSlot(mc, MediaType.VideoSlides, shareEnabled);
@@ -8202,12 +8494,12 @@ export default class Meeting extends StatelessWebexPlugin {
8202
8494
  return !member.isSelf && !member.isPairedWithSelf && !member.isAudioMuted;
8203
8495
  });
8204
8496
 
8205
- if (atLeastOneUnmutedOtherMember) {
8206
- this.mediaProperties.sendMediaIssueMetric(
8207
- 'inbound_audio',
8208
- data.issueSubType,
8209
- this.correlationId
8210
- );
8497
+ // we also ignore any issues while we're waiting in the lobby, as we're not receiving any audio yet
8498
+ if (atLeastOneUnmutedOtherMember && !this.isUserUnadmitted) {
8499
+ this.mediaProperties.sendMediaIssueMetric('inbound_audio', data.issueSubType, {
8500
+ correlationId: this.correlationId,
8501
+ isMultistream: this.isMultistream,
8502
+ });
8211
8503
 
8212
8504
  Trigger.trigger(
8213
8505
  this,
@@ -8674,6 +8966,18 @@ export default class Meeting extends StatelessWebexPlugin {
8674
8966
  * @memberof Meeting
8675
8967
  */
8676
8968
  private waitForSelfUrlChange(): Promise<void> {
8969
+ if (this.joinWithMediaRetryInfo.retryCount > 0) {
8970
+ /* During joinWithMedia() retries we can get 403/409 from Locus and it doesn't mean
8971
+ * that the selfUrl will change, it is usually caused by Locus dropping us as a result of
8972
+ * media connection failure during joinWithMedia's earlier media connection attempt,
8973
+ * so we don't want to wait for selfUrl change as this would only slow down the join process. */
8974
+ LoggerProxy.logger.info(
8975
+ 'Meeting:index#waitForSelfUrlChange --> joinWithMedia retry in progress, will not wait for selfUrl change'
8976
+ );
8977
+
8978
+ return Promise.resolve();
8979
+ }
8980
+
8677
8981
  if (!this.promisesWaitingForPropUpdate.selfUrl) {
8678
8982
  const pendingSelfUrlUpdate = new Defer();
8679
8983
 
@@ -1,5 +1,6 @@
1
1
  /* eslint no-shadow: ["error", { "allow": ["eventType"] }] */
2
- import {cloneDeep, clone, set} from 'lodash';
2
+ import {cloneDeep, clone, set, once} from 'lodash';
3
+ import {WasmRuntimeProbe} from '@webex/web-capabilities';
3
4
  import '@webex/internal-plugin-mercury';
4
5
  import '@webex/internal-plugin-conversation';
5
6
  import '@webex/internal-plugin-metrics';
@@ -210,6 +211,37 @@ export default class Meetings extends WebexPlugin {
210
211
  namespace = MEETINGS;
211
212
  registrationStatus: MeetingRegistrationStatus;
212
213
 
214
+ /**
215
+ * Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
216
+ * where real-time WASM effects (e.g. background noise removal) run poorly.
217
+ *
218
+ * @param {string} correlationId - correlation id to report the result against
219
+ * @returns {void}
220
+ */
221
+ private emitWasmRuntimePerformance = once((correlationId: string): void => {
222
+ // This check is designed to swallow any probe/metrics failure so it can never break meeting
223
+ // creation, while still reporting the status so we can track browsers with WASM issues.
224
+ WasmRuntimeProbe.check()
225
+ .then((result) => {
226
+ LoggerProxy.logger.log(
227
+ `Meetings:index#emitWasmRuntimePerformance --> WASM runtime performance status: ${result.status}, ratio: ${result.ratio}, wasmMs: ${result.wasmMs}, jsMs: ${result.jsMs}`
228
+ );
229
+
230
+ return Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.WASM_RUNTIME_PERFORMANCE, {
231
+ status: result.status,
232
+ ratio: result.ratio,
233
+ wasmMs: result.wasmMs,
234
+ jsMs: result.jsMs,
235
+ correlation_id: correlationId,
236
+ });
237
+ })
238
+ .catch((error) => {
239
+ LoggerProxy.logger.error(
240
+ `Meetings:index#emitWasmRuntimePerformance --> ERROR, failed to probe or report WASM runtime performance: ${error.message}`
241
+ );
242
+ });
243
+ });
244
+
213
245
  /**
214
246
  * Initializes the Meetings Plugin
215
247
  * @constructor
@@ -1635,6 +1667,8 @@ export default class Meetings extends WebexPlugin {
1635
1667
  });
1636
1668
  }
1637
1669
  });
1670
+
1671
+ this.emitWasmRuntimePerformance(createdMeeting.correlationId);
1638
1672
  } else {
1639
1673
  LoggerProxy.logger.error(
1640
1674
  `Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ${meeting}`
@@ -100,6 +100,8 @@ const BEHAVIORAL_METRICS = {
100
100
  HASH_TREE_SYNC_FAILURE: 'js_sdk_hash_tree_sync_failure',
101
101
  HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED: 'js_sdk_hash_tree_heartbeat_watchdog_expired',
102
102
  HASH_TREE_EMPTY_LOCUS_STATE_ELEMENTS: 'js_sdk_hash_tree_empty_locus_state_elements',
103
+ DESTROY_MEETING_WHILE_SUSPENDED: 'js_sdk_destroy_meeting_while_suspended',
104
+ WASM_RUNTIME_PERFORMANCE: 'js_sdk_wasm_runtime_performance',
103
105
  };
104
106
 
105
107
  export {BEHAVIORAL_METRICS as default};
@@ -229,9 +229,17 @@ export default class TurnDiscovery {
229
229
  * @returns {TurnDiscoveryResult}
230
230
  */
231
231
  private handleTurnDiscoveryFailure(meeting: Meeting, error: Error): TurnDiscoveryResult {
232
+ // if we got a 409/403 from Locus, it means we've been dropped from the meeting,
233
+ // so there's no point continuing with the media connection attempt
234
+ if ((error as any).statusCode === 409 || (error as any).statusCode === 403) {
235
+ this.defer = undefined;
236
+ throw error;
237
+ }
238
+
232
239
  // we catch any errors and resolve with no turn information so that the normal call join flow can continue without TURN
233
240
  LoggerProxy.logger.info(
234
- `Roap:turnDiscovery#doTurnDiscovery --> TURN discovery failed, continuing without TURN: ${error}`
241
+ `Roap:turnDiscovery#doTurnDiscovery --> TURN discovery failed, continuing without TURN:`,
242
+ error
235
243
  );
236
244
 
237
245
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.TURN_DISCOVERY_FAILURE, {
@@ -335,7 +335,7 @@ const Webinar = WebexPlugin.extend({
335
335
  this.meetingId
336
336
  );
337
337
 
338
- const isCaptionBoxOn = this.webex.internal.voicea.getIsCaptionBoxOn();
338
+ const keepTranscriptionSubscribed = this.webex.internal.voicea.getKeepTranscriptionSubscribed();
339
339
 
340
340
  if (!practiceSessionDatachannelUrl) {
341
341
  return undefined;
@@ -468,7 +468,7 @@ const Webinar = WebexPlugin.extend({
468
468
  }
469
469
  // @ts-ignore - Fix type
470
470
  this.webex.internal.voicea?.announce?.();
471
- if (isCaptionBoxOn) {
471
+ if (keepTranscriptionSubscribed) {
472
472
  this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
473
473
  }
474
474
  LoggerProxy.logger.info(