@webex/plugin-meetings 3.12.0-webex-services-ready.3 → 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
@@ -1,4 +1,6 @@
1
1
  import {isEqual, assignWith, cloneDeep, isEmpty} from 'lodash';
2
+ import uuid from 'uuid';
3
+ import {webexTrackingIdSequenceNumbers} from '@webex/webex-core';
2
4
 
3
5
  import LoggerProxy from '../common/logs/logger-proxy';
4
6
  import EventsScope from '../common/events/events-scope';
@@ -37,6 +39,7 @@ import HashTreeParser, {
37
39
  LocusInfoUpdate,
38
40
  LocusInfoUpdateType,
39
41
  Metadata,
42
+ SyncLatencyTracker,
40
43
  } from '../hashTree/hashTreeParser';
41
44
  import {HashTreeObject, ObjectType, ObjectTypeToLocusKeyMap} from '../hashTree/types';
42
45
  import {isMetadata, isSelf} from '../hashTree/utils';
@@ -46,6 +49,7 @@ import {MEETING_KEY} from '../meetings/meetings.types';
46
49
  import MeetingCollection from '../meetings/collection';
47
50
 
48
51
  export type LocusLLMEvent = {
52
+ trackingId?: string;
49
53
  data: {
50
54
  eventType: typeof LOCUSEVENT.HASH_TREE_DATA_UPDATED;
51
55
  stateElementsMessage: HashTreeMessage;
@@ -94,6 +98,11 @@ export type HashTreeParserEntry = {
94
98
  initializedFromHashTree: boolean;
95
99
  };
96
100
 
101
+ export type LocusInfoCallbacks = {
102
+ updateMeeting: (object: any) => void;
103
+ syncLatencyTracker?: SyncLatencyTracker;
104
+ };
105
+
97
106
  /**
98
107
  * Gets the replacement information
99
108
  *
@@ -262,7 +271,6 @@ export default class LocusInfo extends EventsScope {
262
271
  locusParser: any;
263
272
  meetingId: any;
264
273
  parsedLocus: any;
265
- updateMeeting: any;
266
274
  webex: any;
267
275
  aclUrl: any;
268
276
  baseSequence: any;
@@ -286,24 +294,27 @@ export default class LocusInfo extends EventsScope {
286
294
  hashTreeParsers: Map<string, HashTreeParserEntry>;
287
295
  hashTreeObjectId2ParticipantId: Map<number, string>; // mapping of hash tree object ids to participant ids
288
296
  classicVsHashTreeMismatchMetricCounter = 0;
297
+ private callbacks: LocusInfoCallbacks;
298
+ private destroyMeetingSuspended = false;
289
299
 
290
300
  /**
291
301
  * Constructor
292
- * @param {function} updateMeeting callback to update the meeting object from an object
302
+ * @param {Object} callbacks callbacks used by LocusInfo
303
+ * @param {function} callbacks.updateMeeting callback to update the meeting object from an object
293
304
  * @param {object} webex
294
305
  * @param {string} meetingId
295
306
  * @returns {undefined}
296
307
  */
297
- constructor(updateMeeting, webex, meetingId) {
308
+ constructor(callbacks: LocusInfoCallbacks, webex: any, meetingId: any) {
298
309
  super();
299
310
  this.parsedLocus = {
300
311
  states: [],
301
312
  };
313
+ this.callbacks = callbacks;
302
314
  this.webex = webex;
303
315
  this.emitChange = false;
304
316
  this.compareAndUpdateFlags = {};
305
317
  this.meetingId = meetingId;
306
- this.updateMeeting = updateMeeting;
307
318
  this.locusParser = new LocusDeltaParser();
308
319
  this.hashTreeParsers = new Map();
309
320
  this.hashTreeObjectId2ParticipantId = new Map();
@@ -554,9 +565,26 @@ export default class LocusInfo extends EventsScope {
554
565
  initialLocus,
555
566
  metadata,
556
567
  webexRequest: this.webex.request.bind(this.webex),
557
- locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
568
+ callbacks: {
569
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
570
+ syncLatencyTracker: this.callbacks.syncLatencyTracker,
571
+ // Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
572
+ // webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
573
+ // ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
574
+ // back to a uuid on the rare chance the interceptor hasn't issued any request yet (and so
575
+ // isn't in the map). The value is opaque to the metrics layer and is forced onto the
576
+ // /hashtree and /sync request headers.
577
+ generateTrackingId: () => {
578
+ const interceptor = [...webexTrackingIdSequenceNumbers.keys()].find(
579
+ (candidate) => candidate?.webex === this.webex
580
+ );
581
+
582
+ return `${this.webex.sessionId}_${interceptor ? interceptor.sequence : uuid.v4()}`;
583
+ },
584
+ },
558
585
  debugId: `HT-${locusUrl.split('/')?.pop()?.substring(0, 4)}`,
559
586
  excludedDataSets: this.webex.config.meetings.locus?.excludedDataSets,
587
+ syncLatencyMeetingId: this.meetingId,
560
588
  });
561
589
 
562
590
  // When a new HashTreeParser is created, previous one should be stopped.
@@ -1752,7 +1780,7 @@ export default class LocusInfo extends EventsScope {
1752
1780
  // @ts-ignore
1753
1781
  const partner = this.getLocusPartner(this.participants, this.self);
1754
1782
 
1755
- this.updateMeeting({partner});
1783
+ this.callbacks.updateMeeting({partner});
1756
1784
 
1757
1785
  // Check if guest user needs to be checked here
1758
1786
 
@@ -1773,8 +1801,19 @@ export default class LocusInfo extends EventsScope {
1773
1801
  options: {
1774
1802
  meetingId: this.meetingId,
1775
1803
  },
1804
+ payload: {
1805
+ eventData: {
1806
+ joinInProgress: this.destroyMeetingSuspended,
1807
+ },
1808
+ },
1776
1809
  });
1777
1810
 
1811
+ if (this.destroyMeetingSuspended) {
1812
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1813
+ meetingId: this.meetingId,
1814
+ reason: 'CALL_INACTIVE',
1815
+ });
1816
+ }
1778
1817
  this.emitScoped(
1779
1818
  {
1780
1819
  file: 'locus-info',
@@ -1799,7 +1838,18 @@ export default class LocusInfo extends EventsScope {
1799
1838
  options: {
1800
1839
  meetingId: this.meetingId,
1801
1840
  },
1841
+ payload: {
1842
+ eventData: {
1843
+ joinInProgress: this.destroyMeetingSuspended,
1844
+ },
1845
+ },
1802
1846
  });
1847
+ if (this.destroyMeetingSuspended) {
1848
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1849
+ meetingId: this.meetingId,
1850
+ reason: 'PARTNER_LEFT',
1851
+ });
1852
+ }
1803
1853
  this.emitScoped(
1804
1854
  {
1805
1855
  file: 'locus-info',
@@ -1826,8 +1876,19 @@ export default class LocusInfo extends EventsScope {
1826
1876
  options: {
1827
1877
  meetingId: this.meetingId,
1828
1878
  },
1879
+ payload: {
1880
+ eventData: {
1881
+ joinInProgress: this.destroyMeetingSuspended,
1882
+ },
1883
+ },
1829
1884
  });
1830
1885
 
1886
+ if (this.destroyMeetingSuspended) {
1887
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1888
+ meetingId: this.meetingId,
1889
+ reason: 'SELF_LEFT',
1890
+ });
1891
+ }
1831
1892
  this.emitScoped(
1832
1893
  {
1833
1894
  file: 'locus-info',
@@ -1842,50 +1903,81 @@ export default class LocusInfo extends EventsScope {
1842
1903
  }
1843
1904
  } else if (this.parsedLocus.fullState?.type === _MEETING_) {
1844
1905
  if (this.fullState && MeetingsUtil.isWholeMeetingEnded(this.fullState)) {
1845
- LoggerProxy.logger.warn(
1846
- 'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive'
1847
- );
1848
-
1849
- // @ts-ignore
1850
- this.webex.internal.newMetrics.submitClientEvent({
1851
- name: 'client.call.remote-ended',
1852
- options: {
1906
+ if (this.destroyMeetingSuspended) {
1907
+ LoggerProxy.logger.info(
1908
+ 'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (MEETING_INACTIVE_TERMINATING) because destroyMeeting is suspended'
1909
+ );
1910
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1853
1911
  meetingId: this.meetingId,
1854
- },
1855
- });
1856
- this.emitScoped(
1857
- {
1858
- file: 'locus-info',
1859
- function: 'isMeetingActive',
1860
- },
1861
- EVENTS.DESTROY_MEETING,
1862
- {
1863
- reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1864
- shouldLeave: false,
1865
- }
1866
- );
1912
+ reason: 'MEETING_INACTIVE_TERMINATING',
1913
+ });
1914
+ } else {
1915
+ LoggerProxy.logger.warn(
1916
+ 'Locus-info:index#isMeetingActive --> Meeting is ending due to inactive'
1917
+ );
1918
+
1919
+ // @ts-ignore
1920
+ this.webex.internal.newMetrics.submitClientEvent({
1921
+ name: 'client.call.remote-ended',
1922
+ options: {
1923
+ meetingId: this.meetingId,
1924
+ },
1925
+ });
1926
+
1927
+ this.emitScoped(
1928
+ {
1929
+ file: 'locus-info',
1930
+ function: 'isMeetingActive',
1931
+ },
1932
+ EVENTS.DESTROY_MEETING,
1933
+ {
1934
+ reason: MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1935
+ shouldLeave: false,
1936
+ }
1937
+ );
1938
+ }
1867
1939
  }
1868
1940
  // If you are guest and you are removed from the meeting
1869
1941
  // You wont get any further events
1870
1942
  else if (this.parsedLocus.self && this.parsedLocus.self.removed) {
1871
- // Check if we need to send an event
1872
- this.emitScoped(
1873
- {
1874
- file: 'locus-info',
1875
- function: 'isMeetingActive',
1876
- },
1877
- EVENTS.DESTROY_MEETING,
1878
- {
1879
- reason: MEETING_REMOVED_REASON.SELF_REMOVED,
1880
- shouldLeave: false,
1881
- }
1882
- );
1943
+ if (this.destroyMeetingSuspended) {
1944
+ LoggerProxy.logger.info(
1945
+ 'Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (SELF_REMOVED) because destroyMeeting is suspended'
1946
+ );
1947
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DESTROY_MEETING_WHILE_SUSPENDED, {
1948
+ meetingId: this.meetingId,
1949
+ reason: 'SELF_REMOVED',
1950
+ });
1951
+ } else {
1952
+ this.emitScoped(
1953
+ {
1954
+ file: 'locus-info',
1955
+ function: 'isMeetingActive',
1956
+ },
1957
+ EVENTS.DESTROY_MEETING,
1958
+ {
1959
+ reason: MEETING_REMOVED_REASON.SELF_REMOVED,
1960
+ shouldLeave: false,
1961
+ }
1962
+ );
1963
+ }
1883
1964
  }
1884
1965
  } else {
1885
1966
  LoggerProxy.logger.warn('Locus-info:index#isMeetingActive --> Meeting Type is unknown.');
1886
1967
  }
1887
1968
  }
1888
1969
 
1970
+ /**
1971
+ * Suspends or resumes the emission of DESTROY_MEETING events in certain situations.
1972
+ * Used by joinWithMedia to prevent meeting destruction during retry flows.
1973
+ * @param {boolean} suspend - true to suppress, false to resume
1974
+ * @returns {undefined}
1975
+ * @memberof LocusInfo
1976
+ */
1977
+ suspendDestroyMeeting(suspend: boolean) {
1978
+ this.destroyMeetingSuspended = suspend;
1979
+ }
1980
+
1889
1981
  /**
1890
1982
  * checks if the host permissions have changed while in the meeting
1891
1983
  * This would be the case if your role as host or moderator has been updated
@@ -2237,7 +2329,7 @@ export default class LocusInfo extends EventsScope {
2237
2329
  if (hasEntryExitToneChanged) {
2238
2330
  const {entryExitTone} = current;
2239
2331
 
2240
- this.updateMeeting({entryExitTone});
2332
+ this.callbacks.updateMeeting({entryExitTone});
2241
2333
 
2242
2334
  this.emitScoped(
2243
2335
  {
@@ -2256,7 +2348,7 @@ export default class LocusInfo extends EventsScope {
2256
2348
  if (hasVideoEnabledChanged) {
2257
2349
  const {videoEnabled} = current;
2258
2350
 
2259
- this.updateMeeting({unmuteVideoAllowed: videoEnabled});
2351
+ this.callbacks.updateMeeting({unmuteVideoAllowed: videoEnabled});
2260
2352
 
2261
2353
  this.emitScoped(
2262
2354
  {
@@ -2348,14 +2440,14 @@ export default class LocusInfo extends EventsScope {
2348
2440
  updateConversationUrl(conversationUrl: string, info: any) {
2349
2441
  if (conversationUrl && !isEqual(this.conversationUrl, conversationUrl)) {
2350
2442
  this.conversationUrl = conversationUrl;
2351
- this.updateMeeting({conversationUrl});
2443
+ this.callbacks.updateMeeting({conversationUrl});
2352
2444
  } else if (
2353
2445
  info &&
2354
2446
  info.conversationUrl &&
2355
2447
  !isEqual(this.conversationUrl, info.conversationUrl)
2356
2448
  ) {
2357
2449
  this.conversationUrl = info.conversationUrl;
2358
- this.updateMeeting({conversationUrl: info.conversationUrl});
2450
+ this.callbacks.updateMeeting({conversationUrl: info.conversationUrl});
2359
2451
  }
2360
2452
  }
2361
2453
 
@@ -2417,7 +2509,7 @@ export default class LocusInfo extends EventsScope {
2417
2509
  if (fullState && !isEqual(this.fullState, fullState)) {
2418
2510
  const result = FullState.getFullState(this.fullState, fullState);
2419
2511
 
2420
- this.updateMeeting(result.current);
2512
+ this.callbacks.updateMeeting(result.current);
2421
2513
 
2422
2514
  if (result.updates.meetingStateChangedTo) {
2423
2515
  this.emitScoped(
@@ -2461,7 +2553,7 @@ export default class LocusInfo extends EventsScope {
2461
2553
  if (host && !isEqual(this.host, host)) {
2462
2554
  const parsedHosts = HostUtils.getHosts(this.host, host);
2463
2555
 
2464
- this.updateMeeting(parsedHosts.current);
2556
+ this.callbacks.updateMeeting(parsedHosts.current);
2465
2557
  this.parsedLocus.host = parsedHosts.current;
2466
2558
  if (parsedHosts.updates.isNewHost) {
2467
2559
  this.compareAndUpdateFlags.compareSelfAndHost = true;
@@ -2529,7 +2621,7 @@ export default class LocusInfo extends EventsScope {
2529
2621
  this.info = infoToParse;
2530
2622
  this.parsedLocus.info = parsedInfo.current;
2531
2623
  // Parses the info and adds necessary values
2532
- this.updateMeeting(parsedInfo.current);
2624
+ this.callbacks.updateMeeting(parsedInfo.current);
2533
2625
 
2534
2626
  this.emitScoped(
2535
2627
  {
@@ -2558,7 +2650,7 @@ export default class LocusInfo extends EventsScope {
2558
2650
 
2559
2651
  const parsedEmbeddedApps = EmbeddedAppsUtils.parse(embeddedApps);
2560
2652
 
2561
- this.updateMeeting({embeddedApps: parsedEmbeddedApps});
2653
+ this.callbacks.updateMeeting({embeddedApps: parsedEmbeddedApps});
2562
2654
 
2563
2655
  this.emitScoped(
2564
2656
  {
@@ -2583,7 +2675,7 @@ export default class LocusInfo extends EventsScope {
2583
2675
  if (mediaShares && (!isEqual(this.mediaShares, mediaShares) || forceUpdate)) {
2584
2676
  const parsedMediaShares = MediaSharesUtils.getMediaShares(this.mediaShares, mediaShares);
2585
2677
 
2586
- this.updateMeeting(parsedMediaShares.current);
2678
+ this.callbacks.updateMeeting(parsedMediaShares.current);
2587
2679
  this.parsedLocus.mediaShares = parsedMediaShares.current;
2588
2680
  this.mediaShares = mediaShares;
2589
2681
  this.emitScoped(
@@ -2629,7 +2721,7 @@ export default class LocusInfo extends EventsScope {
2629
2721
  this.participants // using this.participants instead of locus.participants here, because with delta DTOs locus.participants will only contain a small subset of participants
2630
2722
  );
2631
2723
 
2632
- this.updateMeeting(parsedSelves.current);
2724
+ this.callbacks.updateMeeting(parsedSelves.current);
2633
2725
  this.parsedLocus.self = parsedSelves.current;
2634
2726
 
2635
2727
  const element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
@@ -2647,7 +2739,7 @@ export default class LocusInfo extends EventsScope {
2647
2739
  );
2648
2740
 
2649
2741
  if (result?.sipUri) {
2650
- this.updateMeeting(result);
2742
+ this.callbacks.updateMeeting(result);
2651
2743
  }
2652
2744
 
2653
2745
  if (parsedSelves.updates.moderatorChanged) {
@@ -2914,7 +3006,7 @@ export default class LocusInfo extends EventsScope {
2914
3006
  updateLocusUrl(url: string, isMainLocus = true) {
2915
3007
  if (url && this.url !== url) {
2916
3008
  this.url = url;
2917
- this.updateMeeting({locusUrl: url});
3009
+ this.callbacks.updateMeeting({locusUrl: url});
2918
3010
  this.emitScoped(
2919
3011
  {
2920
3012
  file: 'locus-info',
@@ -455,10 +455,14 @@ export default class MediaProperties {
455
455
  *
456
456
  * @param {string} issueType
457
457
  * @param {string} issueSubType
458
- * @param {string} correlationId
458
+ * @param {Object} metadata
459
459
  * @returns {void}
460
460
  */
461
- public sendMediaIssueMetric(issueType: string, issueSubType: string, correlationId) {
461
+ public sendMediaIssueMetric(
462
+ issueType: string,
463
+ issueSubType: string,
464
+ metadata: {correlationId: string; isMultistream: boolean}
465
+ ) {
462
466
  const key = `${issueType}_${issueSubType}`;
463
467
 
464
468
  const count = (this.mediaIssueCounters[key] || 0) + 1;
@@ -466,7 +470,7 @@ export default class MediaProperties {
466
470
  this.mediaIssueCounters[key] = count;
467
471
 
468
472
  this.throttledSendMediaIssueMetric({
469
- correlationId,
473
+ ...metadata,
470
474
  ...this.mediaIssueCounters,
471
475
  });
472
476
  }