@webex/plugin-meetings 3.11.0-webex-services-ready.1 → 3.12.0-auth-prejoin-fetch.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.
Files changed (294) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +197 -0
  3. package/dist/aiEnableRequest/index.js.map +1 -0
  4. package/dist/aiEnableRequest/utils.js +36 -0
  5. package/dist/aiEnableRequest/utils.js.map +1 -0
  6. package/dist/annotation/index.js +16 -7
  7. package/dist/annotation/index.js.map +1 -1
  8. package/dist/breakouts/breakout.js +8 -3
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/events.js +29 -14
  11. package/dist/breakouts/events.js.map +1 -1
  12. package/dist/breakouts/index.js +99 -4
  13. package/dist/breakouts/index.js.map +1 -1
  14. package/dist/common/errors/webex-errors.js +49 -5
  15. package/dist/common/errors/webex-errors.js.map +1 -1
  16. package/dist/config.js +8 -3
  17. package/dist/config.js.map +1 -1
  18. package/dist/constants.js +60 -11
  19. package/dist/constants.js.map +1 -1
  20. package/dist/controls-options-manager/constants.js +11 -1
  21. package/dist/controls-options-manager/constants.js.map +1 -1
  22. package/dist/controls-options-manager/index.js +67 -29
  23. package/dist/controls-options-manager/index.js.map +1 -1
  24. package/dist/controls-options-manager/util.js +91 -0
  25. package/dist/controls-options-manager/util.js.map +1 -1
  26. package/dist/hashTree/constants.js +16 -2
  27. package/dist/hashTree/constants.js.map +1 -1
  28. package/dist/hashTree/hashTree.js +18 -0
  29. package/dist/hashTree/hashTree.js.map +1 -1
  30. package/dist/hashTree/hashTreeParser.js +1655 -538
  31. package/dist/hashTree/hashTreeParser.js.map +1 -1
  32. package/dist/hashTree/types.js +4 -2
  33. package/dist/hashTree/types.js.map +1 -1
  34. package/dist/hashTree/utils.js +52 -0
  35. package/dist/hashTree/utils.js.map +1 -1
  36. package/dist/index.js +18 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/interceptors/constant.js +12 -0
  39. package/dist/interceptors/constant.js.map +1 -0
  40. package/dist/interceptors/dataChannelAuthToken.js +350 -0
  41. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  42. package/dist/interceptors/index.js +7 -0
  43. package/dist/interceptors/index.js.map +1 -1
  44. package/dist/interceptors/locusRetry.js +23 -8
  45. package/dist/interceptors/locusRetry.js.map +1 -1
  46. package/dist/interceptors/utils.js +27 -0
  47. package/dist/interceptors/utils.js.map +1 -0
  48. package/dist/interpretation/index.js +11 -2
  49. package/dist/interpretation/index.js.map +1 -1
  50. package/dist/interpretation/interpretation.types.js +7 -0
  51. package/dist/interpretation/interpretation.types.js.map +1 -0
  52. package/dist/interpretation/siLanguage.js +1 -1
  53. package/dist/locus-info/controlsUtils.js +9 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +914 -212
  56. package/dist/locus-info/index.js.map +1 -1
  57. package/dist/locus-info/infoUtils.js +36 -5
  58. package/dist/locus-info/infoUtils.js.map +1 -1
  59. package/dist/locus-info/selfUtils.js +1 -0
  60. package/dist/locus-info/selfUtils.js.map +1 -1
  61. package/dist/locus-info/types.js +19 -0
  62. package/dist/locus-info/types.js.map +1 -1
  63. package/dist/media/MediaConnectionAwaiter.js +72 -3
  64. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  65. package/dist/media/index.js +8 -2
  66. package/dist/media/index.js.map +1 -1
  67. package/dist/media/properties.js +8 -7
  68. package/dist/media/properties.js.map +1 -1
  69. package/dist/meeting/in-meeting-actions.js +11 -1
  70. package/dist/meeting/in-meeting-actions.js.map +1 -1
  71. package/dist/meeting/index.js +2347 -1096
  72. package/dist/meeting/index.js.map +1 -1
  73. package/dist/meeting/locusMediaRequest.js +229 -82
  74. package/dist/meeting/locusMediaRequest.js.map +1 -1
  75. package/dist/meeting/muteState.js +10 -1
  76. package/dist/meeting/muteState.js.map +1 -1
  77. package/dist/meeting/request.js +55 -2
  78. package/dist/meeting/request.js.map +1 -1
  79. package/dist/meeting/request.type.js.map +1 -1
  80. package/dist/meeting/util.js +168 -5
  81. package/dist/meeting/util.js.map +1 -1
  82. package/dist/meeting-info/meeting-info-v2.js +100 -38
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +466 -174
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +6 -1
  87. package/dist/meetings/meetings.types.js.map +1 -1
  88. package/dist/meetings/request.js +39 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +116 -18
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +20 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js.map +1 -1
  95. package/dist/member/util.js +40 -0
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/index.js +101 -43
  98. package/dist/members/index.js.map +1 -1
  99. package/dist/members/util.js +8 -1
  100. package/dist/members/util.js.map +1 -1
  101. package/dist/metrics/constants.js +12 -1
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/multistream/codec/constants.js +63 -0
  104. package/dist/multistream/codec/constants.js.map +1 -0
  105. package/dist/multistream/mediaRequestManager.js +64 -68
  106. package/dist/multistream/mediaRequestManager.js.map +1 -1
  107. package/dist/multistream/receiveSlot.js +9 -0
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/remoteMediaManager.js +11 -0
  110. package/dist/multistream/remoteMediaManager.js.map +1 -1
  111. package/dist/multistream/sendSlotManager.js +116 -2
  112. package/dist/multistream/sendSlotManager.js.map +1 -1
  113. package/dist/reachability/clusterReachability.js.map +1 -1
  114. package/dist/reachability/index.js +121 -83
  115. package/dist/reachability/index.js.map +1 -1
  116. package/dist/reachability/reachability.types.js +2 -0
  117. package/dist/reachability/reachability.types.js.map +1 -1
  118. package/dist/reachability/util.js +45 -0
  119. package/dist/reachability/util.js.map +1 -1
  120. package/dist/reactions/reactions.type.js.map +1 -1
  121. package/dist/reconnection-manager/index.js +0 -1
  122. package/dist/reconnection-manager/index.js.map +1 -1
  123. package/dist/recording-controller/index.js +1 -3
  124. package/dist/recording-controller/index.js.map +1 -1
  125. package/dist/roap/turnDiscovery.js +8 -1
  126. package/dist/roap/turnDiscovery.js.map +1 -1
  127. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  128. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  129. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  130. package/dist/types/config.d.ts +6 -2
  131. package/dist/types/constants.d.ts +35 -1
  132. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  133. package/dist/types/controls-options-manager/index.d.ts +16 -0
  134. package/dist/types/hashTree/constants.d.ts +3 -0
  135. package/dist/types/hashTree/hashTree.d.ts +7 -0
  136. package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
  137. package/dist/types/hashTree/types.d.ts +3 -0
  138. package/dist/types/hashTree/utils.d.ts +24 -0
  139. package/dist/types/index.d.ts +4 -0
  140. package/dist/types/interceptors/constant.d.ts +5 -0
  141. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  142. package/dist/types/interceptors/index.d.ts +2 -1
  143. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  144. package/dist/types/interceptors/utils.d.ts +1 -0
  145. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  146. package/dist/types/locus-info/index.d.ts +126 -15
  147. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  148. package/dist/types/locus-info/types.d.ts +28 -1
  149. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  150. package/dist/types/media/properties.d.ts +8 -3
  151. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  152. package/dist/types/meeting/index.d.ts +253 -16
  153. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  154. package/dist/types/meeting/request.d.ts +17 -1
  155. package/dist/types/meeting/request.type.d.ts +5 -0
  156. package/dist/types/meeting/util.d.ts +40 -0
  157. package/dist/types/meeting-info/meeting-info-v2.d.ts +25 -1
  158. package/dist/types/meetings/index.d.ts +54 -21
  159. package/dist/types/meetings/meetings.types.d.ts +30 -1
  160. package/dist/types/meetings/request.d.ts +14 -0
  161. package/dist/types/member/index.d.ts +2 -0
  162. package/dist/types/member/types.d.ts +1 -0
  163. package/dist/types/member/util.d.ts +14 -0
  164. package/dist/types/members/index.d.ts +15 -2
  165. package/dist/types/members/util.d.ts +1 -5
  166. package/dist/types/metrics/constants.d.ts +11 -0
  167. package/dist/types/multistream/codec/constants.d.ts +7 -0
  168. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  169. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  170. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  171. package/dist/types/reachability/index.d.ts +10 -3
  172. package/dist/types/reachability/reachability.types.d.ts +7 -0
  173. package/dist/types/reachability/util.d.ts +17 -0
  174. package/dist/types/reactions/reactions.type.d.ts +4 -0
  175. package/dist/types/webinar/utils.d.ts +6 -0
  176. package/dist/webinar/index.js +585 -164
  177. package/dist/webinar/index.js.map +1 -1
  178. package/dist/webinar/utils.js +25 -0
  179. package/dist/webinar/utils.js.map +1 -0
  180. package/package.json +24 -23
  181. package/src/aiEnableRequest/README.md +84 -0
  182. package/src/aiEnableRequest/index.ts +186 -0
  183. package/src/aiEnableRequest/utils.ts +25 -0
  184. package/src/annotation/index.ts +32 -10
  185. package/src/breakouts/breakout.ts +3 -1
  186. package/src/breakouts/events.ts +33 -11
  187. package/src/breakouts/index.ts +122 -2
  188. package/src/common/errors/webex-errors.ts +50 -3
  189. package/src/config.ts +6 -2
  190. package/src/constants.ts +49 -3
  191. package/src/controls-options-manager/constants.ts +14 -1
  192. package/src/controls-options-manager/index.ts +87 -28
  193. package/src/controls-options-manager/util.ts +81 -1
  194. package/src/hashTree/constants.ts +17 -0
  195. package/src/hashTree/hashTree.ts +17 -0
  196. package/src/hashTree/hashTreeParser.ts +1482 -361
  197. package/src/hashTree/types.ts +4 -0
  198. package/src/hashTree/utils.ts +45 -0
  199. package/src/index.ts +14 -1
  200. package/src/interceptors/constant.ts +6 -0
  201. package/src/interceptors/dataChannelAuthToken.ts +246 -0
  202. package/src/interceptors/index.ts +2 -1
  203. package/src/interceptors/locusRetry.ts +25 -4
  204. package/src/interceptors/utils.ts +16 -0
  205. package/src/interpretation/index.ts +29 -11
  206. package/src/interpretation/interpretation.types.ts +11 -0
  207. package/src/locus-info/controlsUtils.ts +14 -1
  208. package/src/locus-info/index.ts +976 -203
  209. package/src/locus-info/infoUtils.ts +41 -6
  210. package/src/locus-info/selfUtils.ts +1 -0
  211. package/src/locus-info/types.ts +33 -1
  212. package/src/media/MediaConnectionAwaiter.ts +62 -5
  213. package/src/media/index.ts +10 -1
  214. package/src/media/properties.ts +11 -4
  215. package/src/meeting/in-meeting-actions.ts +20 -0
  216. package/src/meeting/index.ts +1300 -180
  217. package/src/meeting/locusMediaRequest.ts +106 -6
  218. package/src/meeting/muteState.ts +10 -1
  219. package/src/meeting/request.ts +53 -0
  220. package/src/meeting/request.type.ts +6 -0
  221. package/src/meeting/util.ts +207 -7
  222. package/src/meeting-info/meeting-info-v2.ts +83 -21
  223. package/src/meetings/index.ts +402 -121
  224. package/src/meetings/meetings.types.ts +36 -1
  225. package/src/meetings/request.ts +43 -0
  226. package/src/meetings/util.ts +117 -4
  227. package/src/member/index.ts +20 -0
  228. package/src/member/types.ts +1 -0
  229. package/src/member/util.ts +41 -0
  230. package/src/members/index.ts +70 -7
  231. package/src/members/util.ts +12 -4
  232. package/src/metrics/constants.ts +12 -0
  233. package/src/multistream/codec/constants.ts +58 -0
  234. package/src/multistream/mediaRequestManager.ts +117 -76
  235. package/src/multistream/receiveSlot.ts +18 -0
  236. package/src/multistream/remoteMediaManager.ts +13 -0
  237. package/src/multistream/sendSlotManager.ts +97 -3
  238. package/src/reachability/clusterReachability.ts +3 -2
  239. package/src/reachability/index.ts +47 -16
  240. package/src/reachability/reachability.types.ts +11 -0
  241. package/src/reachability/util.ts +36 -0
  242. package/src/reactions/reactions.type.ts +4 -0
  243. package/src/reconnection-manager/index.ts +0 -1
  244. package/src/recording-controller/index.ts +1 -2
  245. package/src/roap/turnDiscovery.ts +9 -1
  246. package/src/webinar/index.ts +448 -11
  247. package/src/webinar/utils.ts +16 -0
  248. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  249. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  250. package/test/unit/spec/annotation/index.ts +70 -8
  251. package/test/unit/spec/breakouts/breakout.ts +9 -3
  252. package/test/unit/spec/breakouts/events.ts +120 -2
  253. package/test/unit/spec/breakouts/index.ts +223 -3
  254. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  255. package/test/unit/spec/controls-options-manager/index.js +244 -29
  256. package/test/unit/spec/controls-options-manager/util.js +165 -0
  257. package/test/unit/spec/hashTree/hashTree.ts +66 -0
  258. package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
  259. package/test/unit/spec/hashTree/utils.ts +125 -1
  260. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
  261. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  262. package/test/unit/spec/interceptors/utils.ts +75 -0
  263. package/test/unit/spec/interpretation/index.ts +26 -4
  264. package/test/unit/spec/locus-info/controlsUtils.js +200 -56
  265. package/test/unit/spec/locus-info/index.js +1861 -149
  266. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  267. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  268. package/test/unit/spec/media/index.ts +92 -0
  269. package/test/unit/spec/media/properties.ts +35 -26
  270. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  271. package/test/unit/spec/meeting/index.js +3691 -366
  272. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  273. package/test/unit/spec/meeting/muteState.js +81 -0
  274. package/test/unit/spec/meeting/request.js +82 -0
  275. package/test/unit/spec/meeting/utils.js +595 -27
  276. package/test/unit/spec/meeting-info/meetinginfov2.js +286 -10
  277. package/test/unit/spec/meetings/index.js +1400 -78
  278. package/test/unit/spec/meetings/request.js +141 -0
  279. package/test/unit/spec/meetings/utils.js +402 -51
  280. package/test/unit/spec/member/index.js +35 -4
  281. package/test/unit/spec/member/util.js +154 -27
  282. package/test/unit/spec/members/index.js +216 -0
  283. package/test/unit/spec/members/request.js +37 -1
  284. package/test/unit/spec/members/utils.js +63 -0
  285. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  286. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  287. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  288. package/test/unit/spec/reachability/index.ts +128 -46
  289. package/test/unit/spec/reachability/util.ts +31 -0
  290. package/test/unit/spec/reconnection-manager/index.js +4 -8
  291. package/test/unit/spec/recording-controller/index.js +9 -8
  292. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  293. package/test/unit/spec/webinar/index.ts +837 -39
  294. package/test/unit/spec/webinar/utils.ts +39 -0
@@ -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, isEmpty} 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';
@@ -47,7 +48,7 @@ import {
47
48
  import BEHAVIORAL_METRICS from '../metrics/constants';
48
49
  import MeetingInfo from '../meeting-info';
49
50
  import MeetingInfoV2 from '../meeting-info/meeting-info-v2';
50
- import Meeting, {CallStateForMetrics} from '../meeting';
51
+ import Meeting, {CallStateForMetrics, storeEventForDebugging} from '../meeting';
51
52
  import PersonalMeetingRoom from '../personal-meeting-room';
52
53
  import Reachability from '../reachability';
53
54
  import Request from './request';
@@ -55,10 +56,14 @@ import PasswordError from '../common/errors/password-error';
55
56
  import CaptchaError from '../common/errors/captcha-error';
56
57
  import MeetingCollection from './collection';
57
58
  import {
59
+ FetchSitePreferencesMeViaSiteOptions,
58
60
  MEETING_KEY,
59
61
  INoiseReductionEffect,
60
62
  IVirtualBackgroundEffect,
61
63
  MeetingRegistrationStatus,
64
+ PrefetchedMeetingInfo,
65
+ PrefetchMeetingInfoParams,
66
+ SitePreferencesResponse,
62
67
  } from './meetings.types';
63
68
  import MeetingsUtil from './util';
64
69
  import PermissionError from '../common/errors/permission';
@@ -70,6 +75,9 @@ import {HashTreeMessage} from '../hashTree/hashTreeParser';
70
75
  import {HashTreeObject} from '../hashTree/types';
71
76
  import {isSelf} from '../hashTree/utils';
72
77
 
78
+ import {createLocusFromHashTreeMessage, findMeetingForHashTreeMessage} from '../locus-info';
79
+ import {LocusDTO} from '../locus-info/types';
80
+
73
81
  let mediaLogger;
74
82
 
75
83
  class MediaLogger {
@@ -195,6 +203,8 @@ export default class Meetings extends WebexPlugin {
195
203
  preferredWebexSite: any;
196
204
  reachability: Reachability;
197
205
  registered: any;
206
+ registrationPromise: Promise<void>;
207
+ unregistrationPromise: Promise<void>;
198
208
  request: any;
199
209
  geoHintInfo: any;
200
210
  meetingInfo: any;
@@ -203,6 +213,52 @@ export default class Meetings extends WebexPlugin {
203
213
  namespace = MEETINGS;
204
214
  registrationStatus: MeetingRegistrationStatus;
205
215
 
216
+ /**
217
+ * Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
218
+ * where real-time WASM effects (e.g. background noise removal) run poorly.
219
+ *
220
+ * @param {string} correlationId - correlation id to report the result against
221
+ * @returns {void}
222
+ */
223
+ private emitWasmRuntimePerformance = once((correlationId: string): void => {
224
+ // Probe and telemetry failures must not prevent meeting creation.
225
+ WasmRuntimeProbe.check()
226
+ .then((result) => {
227
+ const {status, capability, reason, measurements} = result;
228
+ const {
229
+ divRatio = null,
230
+ sqrtRatio = null,
231
+ addNsPerOp = null,
232
+ addMedianMs = null,
233
+ divMedianMs = null,
234
+ sqrtMedianMs = null,
235
+ } = measurements ?? {};
236
+ const measurementsLog = JSON.stringify(measurements);
237
+
238
+ LoggerProxy.logger.log(
239
+ `Meetings:index#emitWasmRuntimePerformance --> WASM runtime performance status: ${status}, capability: ${capability}, reason: ${reason}, measurements: ${measurementsLog}`
240
+ );
241
+
242
+ return Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.WASM_RUNTIME_PERFORMANCE, {
243
+ status,
244
+ capability,
245
+ reason,
246
+ divRatio,
247
+ sqrtRatio,
248
+ addNsPerOp,
249
+ addMedianMs,
250
+ divMedianMs,
251
+ sqrtMedianMs,
252
+ correlation_id: correlationId,
253
+ });
254
+ })
255
+ .catch((error) => {
256
+ LoggerProxy.logger.error(
257
+ `Meetings:index#emitWasmRuntimePerformance --> ERROR, failed to probe or report WASM runtime performance: ${error.message}`
258
+ );
259
+ });
260
+ });
261
+
206
262
  /**
207
263
  * Initializes the Meetings Plugin
208
264
  * @constructor
@@ -310,7 +366,7 @@ export default class Meetings extends WebexPlugin {
310
366
  const breakoutLocus = this.meetingCollection.getActiveBreakoutLocus(breakoutUrl);
311
367
 
312
368
  const isSelfJoined = newLocus?.self?.state === _JOINED_;
313
- const isSelfMoved = newLocus?.self?.state === _LEFT_ && newLocus?.self?.reason === _MOVED_;
369
+ const isSelfMoved = MeetingsUtil.isSelfMovedOrBreakoutEnded(newLocus);
314
370
  // @ts-ignore
315
371
  const deviceFromNewLocus = MeetingsUtil.getThisDevice(newLocus, this.webex.internal.device.url);
316
372
  const isResourceMovedOnThisDevice =
@@ -387,7 +443,7 @@ export default class Meetings extends WebexPlugin {
387
443
  private isNeedHandleLocusDTO(meeting: any, newLocus: any) {
388
444
  if (newLocus) {
389
445
  const isNewLocusAsBreakout = MeetingsUtil.isBreakoutLocusDTO(newLocus);
390
- const isSelfMoved = newLocus?.self?.state === _LEFT_ && newLocus?.self?.reason === _MOVED_;
446
+ const isSelfMoved = MeetingsUtil.isSelfMovedOrBreakoutEnded(newLocus);
391
447
  const isSelfMovedToLobby =
392
448
  newLocus?.self?.devices[0]?.intent?.reason === _ON_HOLD_LOBBY_ &&
393
449
  newLocus?.self?.devices[0]?.intent?.type === _WAIT_;
@@ -432,6 +488,17 @@ export default class Meetings extends WebexPlugin {
432
488
  if (existingMeeting) {
433
489
  return existingMeeting;
434
490
  }
491
+ if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
492
+ // need to check if maybe this event indicates a move to/from breakout
493
+ const meetingForHashTreeMessage = findMeetingForHashTreeMessage(
494
+ data?.stateElementsMessage,
495
+ this.meetingCollection
496
+ );
497
+
498
+ if (meetingForHashTreeMessage) {
499
+ return meetingForHashTreeMessage;
500
+ }
501
+ }
435
502
 
436
503
  // if that didn't work, fallback to other fields like correlationId, sipUri, etc
437
504
 
@@ -475,6 +542,10 @@ export default class Meetings extends WebexPlugin {
475
542
  */
476
543
  private handleLocusEvent(data: LocusEvent, useRandomDelayForInfo = false) {
477
544
  let meeting = this.getCorrespondingMeetingByLocus(data);
545
+ // @ts-ignore
546
+ if (this.config.experimental.storeLocusHashTreeEventsForDebugging) {
547
+ storeEventForDebugging('mercury', data);
548
+ }
478
549
 
479
550
  // Special case when locus has got replaced, This only happend once if a replace locus exists
480
551
  // https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-changing-mid-call
@@ -489,8 +560,9 @@ export default class Meetings extends WebexPlugin {
489
560
  }
490
561
 
491
562
  if (meeting && !MeetingsUtil.isBreakoutLocusDTO(data.locus)) {
492
- meeting.locusInfo.updateMainSessionLocusCache(data.locus);
563
+ meeting.locusInfo.updateMainSessionLocusCache(data.locus); // here data.locus will never be a complete locus
493
564
  }
565
+
494
566
  if (!this.isNeedHandleLocusDTO(meeting, data.locus)) {
495
567
  LoggerProxy.logger.log(
496
568
  `Meetings:index#handleLocusEvent --> doesn't need to process locus event`
@@ -520,57 +592,65 @@ export default class Meetings extends WebexPlugin {
520
592
  // };
521
593
  // rather then locus object change to locus url
522
594
 
523
- if (data.eventType !== LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
524
- if (
525
- data.locus &&
526
- data.locus.fullState &&
527
- data.locus.fullState.state === LOCUS.STATE.INACTIVE
528
- ) {
529
- // just ignore the event as its already ended and not active
530
- LoggerProxy.logger.warn(
531
- 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
532
- );
533
-
534
- return;
535
- }
595
+ if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
596
+ // We're about to create a new meeting object from this hash tree message.
597
+ // There is some existing (pre-hash trees) SDK logic here that requires a locus object
598
+ // (at the very minimum we need locus.url to be set)
599
+ // so we try to create locus from the received hash tree message
600
+ // it will not be complete, in most cases it will only have the self part, but that's still better than nothing
601
+ const {locus} = createLocusFromHashTreeMessage(data.stateElementsMessage);
602
+
603
+ data.locus = locus;
604
+ }
536
605
 
537
- // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
538
- // Any future events will be neglected
539
-
540
- if (
541
- data.locus &&
542
- data.locus.self &&
543
- data.locus.self.state === _LEFT_ &&
544
- data.locus.self.removed === true
545
- ) {
546
- // just ignore the event as its already ended and not active
547
- LoggerProxy.logger.warn(
548
- 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
549
- );
606
+ if (
607
+ data.locus &&
608
+ data.locus.fullState &&
609
+ data.locus.fullState.state === LOCUS.STATE.INACTIVE
610
+ ) {
611
+ // just ignore the event as its already ended and not active
612
+ LoggerProxy.logger.warn(
613
+ 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
614
+ );
550
615
 
551
- return;
552
- }
616
+ return;
553
617
  }
554
618
 
555
- if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
556
- // in hash tree messages we don't ge the locus object, but the meeting constructor needs at least locus.url
557
- set(data, 'locus.url', data.stateElementsMessage.locusUrl);
619
+ // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
620
+ // Any future events will be neglected
621
+
622
+ if (
623
+ data.locus &&
624
+ data.locus.self &&
625
+ data.locus.self.state === _LEFT_ &&
626
+ data.locus.self.removed === true
627
+ ) {
628
+ // just ignore the event as its already ended and not active
629
+ LoggerProxy.logger.warn(
630
+ 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
631
+ );
632
+
633
+ return;
558
634
  }
559
635
 
560
636
  this.create(data.locus, DESTINATION_TYPE.LOCUS_ID, useRandomDelayForInfo)
561
637
  .then(async (newMeeting) => {
562
638
  meeting = newMeeting;
563
-
564
639
  try {
565
640
  // It's a new meeting so initialize the locus data
566
- await meeting.locusInfo.initialSetup({
567
- trigger:
568
- data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS
569
- ? 'get-loci-response'
570
- : 'locus-message',
571
- locus: data.locus,
572
- hashTreeMessage: data.stateElementsMessage,
573
- });
641
+ await meeting.locusInfo.initialSetup(
642
+ {
643
+ trigger:
644
+ data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS
645
+ ? 'get-loci-response'
646
+ : 'locus-message',
647
+ locus: data.locus,
648
+ hashTreeMessage: data.stateElementsMessage,
649
+ },
650
+ (locus: LocusDTO) => {
651
+ meeting.finalizeMeetingAfterInitialLocusSetup(locus);
652
+ }
653
+ );
574
654
  } catch (error) {
575
655
  LoggerProxy.logger.warn(
576
656
  `Meetings:index#handleLocusEvent --> Error initializing locus data: ${error.message}`
@@ -624,7 +704,7 @@ export default class Meetings extends WebexPlugin {
624
704
  }
625
705
 
626
706
  /**
627
- * handles locus events through mercury that are not roap
707
+ * handles locus events through mercury that are not roap or approval request events
628
708
  * @param {Object} envelope
629
709
  * @param {Object} envelope.data
630
710
  * @param {String} envelope.data.eventType
@@ -637,7 +717,11 @@ export default class Meetings extends WebexPlugin {
637
717
  // eslint-disable-next-line @typescript-eslint/no-shadow
638
718
  const {eventType} = data;
639
719
 
640
- if (eventType && eventType !== LOCUSEVENT.MESSAGE_ROAP) {
720
+ if (
721
+ eventType &&
722
+ eventType !== LOCUSEVENT.MESSAGE_ROAP &&
723
+ eventType !== LOCUSEVENT.APPROVAL_REQUEST
724
+ ) {
641
725
  this.handleLocusEvent(data, true);
642
726
  }
643
727
  }
@@ -807,97 +891,82 @@ export default class Meetings extends WebexPlugin {
807
891
  }
808
892
 
809
893
  /**
810
- * API to toggle TCP reachability, needs to be called before webex.meetings.register()
811
- * @param {Boolean} newValue
812
- * @private
813
- * @memberof Meetings
814
- * @returns {undefined}
815
- */
816
- private _toggleTcpReachability(newValue: boolean) {
817
- if (typeof newValue !== 'boolean') {
818
- return;
819
- }
820
- // @ts-ignore
821
- if (this.config.experimental.enableTcpReachability !== newValue) {
822
- // @ts-ignore
823
- this.config.experimental.enableTcpReachability = newValue;
824
- }
825
- }
826
-
827
- /**
828
- * API to toggle TLS reachability, needs to be called before webex.meetings.register()
894
+ * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
895
+ *
829
896
  * @param {Boolean} newValue
830
897
  * @private
831
898
  * @memberof Meetings
832
899
  * @returns {undefined}
833
900
  */
834
- private _toggleTlsReachability(newValue: boolean) {
901
+ private _toggleIpv6BackendNativeSupport(newValue: boolean) {
835
902
  if (typeof newValue !== 'boolean') {
836
903
  return;
837
904
  }
838
905
  // @ts-ignore
839
- if (this.config.experimental.enableTlsReachability !== newValue) {
906
+ if (this.config.backendIpv6NativeSupport !== newValue) {
840
907
  // @ts-ignore
841
- this.config.experimental.enableTlsReachability = newValue;
908
+ this.config.backendIpv6NativeSupport = newValue;
842
909
  }
843
910
  }
844
911
 
845
912
  /**
846
- * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
913
+ * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register()
847
914
  *
848
915
  * @param {Boolean} newValue
849
916
  * @private
850
917
  * @memberof Meetings
851
918
  * @returns {undefined}
852
919
  */
853
- private _toggleIpv6BackendNativeSupport(newValue: boolean) {
920
+ private _toggleDisableAudioMainDtx(newValue: boolean) {
854
921
  if (typeof newValue !== 'boolean') {
855
922
  return;
856
923
  }
924
+
857
925
  // @ts-ignore
858
- if (this.config.backendIpv6NativeSupport !== newValue) {
926
+ if (this.config.experimental.disableAudioMainDtx !== newValue) {
859
927
  // @ts-ignore
860
- this.config.backendIpv6NativeSupport = newValue;
928
+ this.config.experimental.disableAudioMainDtx = newValue;
861
929
  }
862
930
  }
863
931
 
864
932
  /**
865
- * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register()
933
+ * API to toggle usage of audio twcc support
866
934
  *
867
935
  * @param {Boolean} newValue
868
936
  * @private
869
937
  * @memberof Meetings
870
938
  * @returns {undefined}
871
939
  */
872
- private _toggleDisableAudioMainDtx(newValue: boolean) {
940
+ private _toggleEnableAudioTwccForMultistream(newValue: boolean) {
873
941
  if (typeof newValue !== 'boolean') {
874
942
  return;
875
943
  }
876
944
 
877
945
  // @ts-ignore
878
- if (this.config.experimental.disableAudioMainDtx !== newValue) {
946
+ if (this.config.enableAudioTwccForMultistream !== newValue) {
879
947
  // @ts-ignore
880
- this.config.experimental.disableAudioMainDtx = newValue;
948
+ this.config.enableAudioTwccForMultistream = newValue;
881
949
  }
882
950
  }
883
951
 
884
952
  /**
885
- * API to toggle usage of audio twcc support
953
+ * API to toggle AV1 codec support for video slides in multistream,
954
+ * needs to be called before webex.meetings.joinWithMedia()
886
955
  *
887
956
  * @param {Boolean} newValue
888
957
  * @private
889
958
  * @memberof Meetings
890
959
  * @returns {undefined}
891
960
  */
892
- private _toggleEnableAudioTwccForMultistream(newValue: boolean) {
961
+ private _toggleEnableAv1SlidesSupport(newValue: boolean) {
893
962
  if (typeof newValue !== 'boolean') {
894
963
  return;
895
964
  }
896
965
 
897
966
  // @ts-ignore
898
- if (this.config.enableAudioTwccForMultistream !== newValue) {
967
+ if (this.config.enableAv1SlidesSupport !== newValue) {
899
968
  // @ts-ignore
900
- this.config.enableAudioTwccForMultistream = newValue;
969
+ this.config.enableAv1SlidesSupport = newValue;
901
970
  }
902
971
  }
903
972
 
@@ -929,9 +998,20 @@ export default class Meetings extends WebexPlugin {
929
998
  * @returns {Promise} A promise that resolves when the step is completed.
930
999
  */
931
1000
  executeRegistrationStep(step: () => Promise<any>, stepName: string) {
932
- return step().then(() => {
933
- this.registrationStatus[stepName] = true;
934
- });
1001
+ return step()
1002
+ .then(() => {
1003
+ LoggerProxy.logger.info(
1004
+ `Meetings:index#executeRegistrationStep --> INFO, ${stepName} completed`
1005
+ );
1006
+ this.registrationStatus[stepName] = true;
1007
+ })
1008
+ .catch((error) => {
1009
+ LoggerProxy.logger.error(
1010
+ `Meetings:index#executeRegistrationStep --> ERROR, ${stepName} failed: ${error.message}`
1011
+ );
1012
+
1013
+ return Promise.reject(error);
1014
+ });
935
1015
  }
936
1016
 
937
1017
  /**
@@ -944,7 +1024,33 @@ export default class Meetings extends WebexPlugin {
944
1024
  * @memberof Meetings
945
1025
  */
946
1026
  public register(deviceRegistrationOptions?: DeviceRegistrationOptions): Promise<any> {
947
- this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1027
+ if (this.unregistrationPromise) {
1028
+ LoggerProxy.logger.info(
1029
+ 'Meetings:index#register --> INFO, Meetings plugin unregistration in progress, waiting to register'
1030
+ );
1031
+
1032
+ this.registrationPromise = this.unregistrationPromise
1033
+ .catch(() => {}) // It doesn't matter what happened during unregistration
1034
+ .finally(() => {
1035
+ LoggerProxy.logger.info(
1036
+ 'Meetings:index#register --> INFO, Meetings plugin unregistration completed, proceeding to register'
1037
+ );
1038
+
1039
+ this.registrationPromise = null;
1040
+
1041
+ return this.register(deviceRegistrationOptions);
1042
+ });
1043
+
1044
+ return this.registrationPromise;
1045
+ }
1046
+
1047
+ if (this.registrationPromise) {
1048
+ LoggerProxy.logger.info(
1049
+ 'Meetings:index#register --> INFO, Meetings plugin registration in progress, returning existing promise'
1050
+ );
1051
+
1052
+ return this.registrationPromise;
1053
+ }
948
1054
 
949
1055
  // @ts-ignore
950
1056
  if (!this.webex.canAuthorize) {
@@ -963,7 +1069,11 @@ export default class Meetings extends WebexPlugin {
963
1069
  return Promise.resolve();
964
1070
  }
965
1071
 
966
- return Promise.all([
1072
+ LoggerProxy.logger.info('Meetings:index#register --> INFO, Registering Meetings plugin');
1073
+
1074
+ this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1075
+
1076
+ this.registrationPromise = Promise.all([
967
1077
  this.executeRegistrationStep(() => this.fetchUserPreferredWebexSite(), 'fetchWebexSite'),
968
1078
  this.executeRegistrationStep(() => this.getGeoHint(), 'getGeoHint'),
969
1079
  this.executeRegistrationStep(
@@ -1022,7 +1132,12 @@ export default class Meetings extends WebexPlugin {
1022
1132
  });
1023
1133
 
1024
1134
  return Promise.reject(error);
1135
+ })
1136
+ .finally(() => {
1137
+ this.registrationPromise = null;
1025
1138
  });
1139
+
1140
+ return this.registrationPromise;
1026
1141
  }
1027
1142
 
1028
1143
  /**
@@ -1034,6 +1149,35 @@ export default class Meetings extends WebexPlugin {
1034
1149
  * @memberof Meetings
1035
1150
  */
1036
1151
  unregister() {
1152
+ if (this.unregistrationPromise) {
1153
+ LoggerProxy.logger.info(
1154
+ 'Meetings:index#unregister --> INFO, Meetings plugin unregistration in progress, returning existing promise'
1155
+ );
1156
+
1157
+ return this.unregistrationPromise;
1158
+ }
1159
+
1160
+ if (this.registrationPromise) {
1161
+ LoggerProxy.logger.info(
1162
+ 'Meetings:index#unregister --> INFO, Meetings plugin registration in progress, waiting to unregister'
1163
+ );
1164
+
1165
+ // Wait for registration to complete (success or failure), then call unregister again
1166
+ this.unregistrationPromise = this.registrationPromise
1167
+ .catch(() => {}) // It doesn't matter what happened during registration
1168
+ .finally(() => {
1169
+ LoggerProxy.logger.info(
1170
+ 'Meetings:index#unregister --> INFO, Meetings plugin registration completed, proceeding to unregister'
1171
+ );
1172
+
1173
+ this.unregistrationPromise = null;
1174
+
1175
+ return this.unregister();
1176
+ });
1177
+
1178
+ return this.unregistrationPromise;
1179
+ }
1180
+
1037
1181
  if (!this.registered) {
1038
1182
  LoggerProxy.logger.info(
1039
1183
  'Meetings:index#unregister --> INFO, Meetings plugin already unregistered'
@@ -1044,10 +1188,14 @@ export default class Meetings extends WebexPlugin {
1044
1188
 
1045
1189
  this.stopListeningForEvents();
1046
1190
 
1047
- return (
1191
+ this.unregistrationPromise =
1048
1192
  // @ts-ignore
1049
1193
  this.webex.internal.mercury
1050
- .disconnect()
1194
+ // Use code 3050 with a non-reconnecting reason to prevent Mercury auto-reconnect
1195
+ // during unregister. Without this, disconnect() defaults to code 1000/"Done" which
1196
+ // force-closes as "Done (forced)" - a normalReconnectReason that triggers auto-reconnect,
1197
+ // causing a race condition with device.unregister().
1198
+ .disconnect({code: 3050, reason: 'meetings unregister'})
1051
1199
  // @ts-ignore
1052
1200
  .then(() => this.webex.internal.device.unregister())
1053
1201
  .catch((error) => {
@@ -1077,7 +1225,11 @@ export default class Meetings extends WebexPlugin {
1077
1225
  this.registered = false;
1078
1226
  this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1079
1227
  })
1080
- );
1228
+ .finally(() => {
1229
+ this.unregistrationPromise = null;
1230
+ });
1231
+
1232
+ return this.unregistrationPromise;
1081
1233
  }
1082
1234
 
1083
1235
  /**
@@ -1290,6 +1442,31 @@ export default class Meetings extends WebexPlugin {
1290
1442
  return this.personalMeetingRoom;
1291
1443
  }
1292
1444
 
1445
+ /**
1446
+ * Fetches site preferences for the provided Webex site, or the preferred Webex site.
1447
+ * This is used to determine capabilities of the site, such as whether scheduling a webinar is supported.
1448
+ *
1449
+ * @param {object} [options]
1450
+ * @param {string} [options.siteUrl] - Webex site URL. Defaults to preferredWebexSite, for example "cisco.webex.com".
1451
+ * @param {string} [options.siteName] - Site name query override. Defaults to the site name derived from siteUrl, for example "cisco" for "cisco.webex.com".
1452
+ * @param {SitePreferenceSelectOption[]} [options.selectOptions] - Preference sections to fetch. Defaults to 'scheduling'.
1453
+ * @returns {Promise<SitePreferencesResponse>} site preferences response body
1454
+ * @throws {ParameterError}
1455
+ * @public
1456
+ * @memberof Meetings
1457
+ * @example
1458
+ * const preferences = await webex.meetings.fetchSitePreferencesMeViaSite();
1459
+ * const supportScheduleWebinar = preferences?.scheduling?.supportScheduleWebinar;
1460
+ */
1461
+ public fetchSitePreferencesMeViaSite(
1462
+ options: FetchSitePreferencesMeViaSiteOptions = {}
1463
+ ): Promise<SitePreferencesResponse> {
1464
+ return this.request.fetchSitePreferencesMeViaSite({
1465
+ ...options,
1466
+ siteUrl: options.siteUrl || this.preferredWebexSite,
1467
+ });
1468
+ }
1469
+
1293
1470
  /**
1294
1471
  * Returns basic information about a meeting that exists or
1295
1472
  * used to exist in the MeetingCollection
@@ -1386,6 +1563,7 @@ export default class Meetings extends WebexPlugin {
1386
1563
  * @param {String} [meetingLookupUrl] - meeting info prefetch url
1387
1564
  * @param {string} sessionCorrelationId - the optional specified sessionCorrelationId (callStateForMetrics.sessionCorrelationId) can be provided instead
1388
1565
  * @param {String} classificationId - If space support classification, it will provide it while start instant meeting
1566
+ * @param {PrefetchedMeetingInfo} prefetchedMeetingInfo - meeting information requested before creating the Meeting
1389
1567
  * @returns {Promise<Meeting>} A new Meeting.
1390
1568
  * @public
1391
1569
  * @memberof Meetings
@@ -1401,8 +1579,15 @@ export default class Meetings extends WebexPlugin {
1401
1579
  meetingInfo = undefined,
1402
1580
  meetingLookupUrl = undefined,
1403
1581
  sessionCorrelationId: string = undefined,
1404
- classificationId: string = undefined
1582
+ classificationId: string = undefined,
1583
+ prefetchedMeetingInfo: PrefetchedMeetingInfo = undefined
1405
1584
  ) {
1585
+ if (meetingInfo && prefetchedMeetingInfo) {
1586
+ return Promise.reject(
1587
+ new Error('meetingInfo and prefetchedMeetingInfo cannot both be provided')
1588
+ );
1589
+ }
1590
+
1406
1591
  // Validate meeting information based on the provided destination and
1407
1592
  // type. This must be performed prior to determining if the meeting is
1408
1593
  // found in the collection, as we mutate the destination for hydra person
@@ -1472,7 +1657,8 @@ export default class Meetings extends WebexPlugin {
1472
1657
  failOnMissingMeetingInfo,
1473
1658
  meetingInfo,
1474
1659
  meetingLookupUrl,
1475
- classificationId
1660
+ classificationId,
1661
+ prefetchedMeetingInfo
1476
1662
  ).then((createdMeeting: any) => {
1477
1663
  // If the meeting was successfully created.
1478
1664
  if (createdMeeting && createdMeeting.on) {
@@ -1507,6 +1693,8 @@ export default class Meetings extends WebexPlugin {
1507
1693
  });
1508
1694
  }
1509
1695
  });
1696
+
1697
+ this.emitWasmRuntimePerformance(createdMeeting.correlationId);
1510
1698
  } else {
1511
1699
  LoggerProxy.logger.error(
1512
1700
  `Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ${meeting}`
@@ -1519,12 +1707,61 @@ export default class Meetings extends WebexPlugin {
1519
1707
  }
1520
1708
  meeting.updateCallStateForMetrics(callStateForMetrics);
1521
1709
 
1710
+ if (prefetchedMeetingInfo && isEmpty(meeting.meetingInfo)) {
1711
+ return meeting.consumePrefetchedMeetingInfo(prefetchedMeetingInfo).then(() => meeting);
1712
+ }
1713
+
1522
1714
  // Return the existing meeting.
1523
1715
  return Promise.resolve(meeting);
1524
1716
  })
1525
1717
  );
1526
1718
  }
1527
1719
 
1720
+ /**
1721
+ * Starts meeting-information retrieval without creating or registering a Meeting.
1722
+ *
1723
+ * @param {PrefetchMeetingInfoParams} params request destination and metric identifiers
1724
+ * @returns {PrefetchedMeetingInfo} opaque handle consumed later by create() or Meeting
1725
+ * @public
1726
+ * @memberof Meetings
1727
+ */
1728
+ public prefetchMeetingInfo({
1729
+ destination,
1730
+ type = null,
1731
+ extraParams = {},
1732
+ preJoinContext,
1733
+ classificationId = undefined,
1734
+ }: PrefetchMeetingInfoParams): PrefetchedMeetingInfo {
1735
+ const sendCAevents = !!preJoinContext.correlationId;
1736
+ // @ts-ignore - parent SDK instance inherited from WebexPlugin
1737
+ const {webex} = this;
1738
+ const meetingInfoProvider = MeetingInfoV2.createPreJoinProvider(webex, preJoinContext);
1739
+ const request = meetingInfoProvider.fetchMeetingInfo(
1740
+ destination,
1741
+ type,
1742
+ null,
1743
+ null,
1744
+ // @ts-ignore - config coming from registerPlugin
1745
+ this.config.installedOrgID,
1746
+ null,
1747
+ extraParams,
1748
+ {
1749
+ sendCAevents,
1750
+ },
1751
+ null,
1752
+ null,
1753
+ classificationId
1754
+ );
1755
+
1756
+ request.catch(() => undefined);
1757
+
1758
+ return {
1759
+ request,
1760
+ provider: meetingInfoProvider,
1761
+ extraParams,
1762
+ };
1763
+ }
1764
+
1528
1765
  /**
1529
1766
  * Enable static meeting links for given conversation url.
1530
1767
  *
@@ -1587,6 +1824,7 @@ export default class Meetings extends WebexPlugin {
1587
1824
  * @param {Object} [meetingInfo] - Pre-fetched complete meeting info
1588
1825
  * @param {String} [meetingLookupUrl] - meeting info prefetch url
1589
1826
  * @param {String} classificationId see create()
1827
+ * @param {PrefetchedMeetingInfo} prefetchedMeetingInfo - meeting information requested before creating the Meeting
1590
1828
  * @returns {Promise} a new meeting instance complete with meeting info and destination
1591
1829
  * @private
1592
1830
  * @memberof Meetings
@@ -1600,7 +1838,8 @@ export default class Meetings extends WebexPlugin {
1600
1838
  failOnMissingMeetingInfo = false,
1601
1839
  meetingInfo = undefined,
1602
1840
  meetingLookupUrl = undefined,
1603
- classificationId = undefined
1841
+ classificationId = undefined,
1842
+ prefetchedMeetingInfo: PrefetchedMeetingInfo = undefined
1604
1843
  ) {
1605
1844
  const meeting = new Meeting(
1606
1845
  {
@@ -1652,10 +1891,16 @@ export default class Meetings extends WebexPlugin {
1652
1891
  extraParams: infoExtraParams,
1653
1892
  sendCAevents: !!callStateForMetrics?.correlationId, // if client sends correlation id as argument of public create(), then it means that this meeting creation is part of a pre-join intent from user
1654
1893
  };
1894
+ const shouldDeferMeetingInfoFetch = type === DESTINATION_TYPE.LOCUS_ID && !destination?.info;
1895
+
1896
+ const isOneOnOneCallLocus =
1897
+ type === DESTINATION_TYPE.LOCUS_ID && MeetingsUtil.isOneOnOneCall(destination);
1655
1898
 
1656
1899
  if (meetingInfo) {
1657
1900
  meeting.injectMeetingInfo(meetingInfo, meetingInfoOptions, meetingLookupUrl);
1658
- } else if (type !== DESTINATION_TYPE.ONE_ON_ONE_CALL) {
1901
+ } else if (prefetchedMeetingInfo) {
1902
+ await meeting.consumePrefetchedMeetingInfo(prefetchedMeetingInfo);
1903
+ } else if (type !== DESTINATION_TYPE.ONE_ON_ONE_CALL && !isOneOnOneCallLocus) {
1659
1904
  // ignore fetchMeetingInfo for 1:1 meetings
1660
1905
  if (enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0) {
1661
1906
  meeting.fetchMeetingInfoTimeoutId = setTimeout(
@@ -1663,8 +1908,12 @@ export default class Meetings extends WebexPlugin {
1663
1908
  waitingTime
1664
1909
  );
1665
1910
  meeting.parseMeetingInfo(undefined, destination);
1666
- } else {
1911
+ } else if (!shouldDeferMeetingInfoFetch) {
1667
1912
  await meeting.fetchMeetingInfo(meetingInfoOptions);
1913
+ } else {
1914
+ LoggerProxy.logger.info(
1915
+ 'Meetings:index#createMeeting --> defer fetchMeetingInfo for incomplete locus, will do it after locus initialSetup'
1916
+ );
1668
1917
  }
1669
1918
  }
1670
1919
  } catch (err) {
@@ -1692,13 +1941,17 @@ export default class Meetings extends WebexPlugin {
1692
1941
  );
1693
1942
  }
1694
1943
  LoggerProxy.logger.debug(
1695
- `Meetings:index#createMeeting --> Debug ${err} fetching /meetingInfo for creation.`
1944
+ `Meetings:index#createMeeting --> Debug ${err} fetching meeting info for creation.`
1696
1945
  );
1697
1946
  } finally {
1698
1947
  // For type LOCUS_ID we need to parse the locus object to get the information
1699
1948
  // about the caller and callee
1700
1949
  // Meeting Added event will be created in `handleLocusEvent`
1701
- if (type !== DESTINATION_TYPE.LOCUS_ID) {
1950
+ // Only emit MEETING_ADDED if the meeting still exists in the collection.
1951
+ // If fetchMeetingInfo failed and the meeting was destroyed in the catch block,
1952
+ // skip emitting to prevent orphaned meeting references on the consumer side.
1953
+ // @ts-ignore - getMeetingByType types value as object but accepts strings (same as handleLocusEvent)
1954
+ if (type !== DESTINATION_TYPE.LOCUS_ID && this.getMeetingByType(_ID_, meeting.id)) {
1702
1955
  if (!meeting.sipUri) {
1703
1956
  meeting.setSipUri(destination);
1704
1957
  }
@@ -1773,23 +2026,23 @@ export default class Meetings extends WebexPlugin {
1773
2026
  * @public
1774
2027
  * @memberof Meetings
1775
2028
  */
1776
- public syncMeetings({keepOnlyLocusMeetings = true} = {}): Promise<void> {
2029
+ public async syncMeetings({
2030
+ keepOnlyLocusMeetings = true,
2031
+ skipHashTreeSync = false,
2032
+ } = {}): Promise<void> {
1777
2033
  // @ts-ignore
1778
2034
  if (this.webex.credentials.isUnverifiedGuest) {
1779
2035
  LoggerProxy.logger.info(
1780
- 'Meetings:index#syncMeetings --> skipping meeting sync as unverified guest'
2036
+ 'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
1781
2037
  );
1782
-
1783
- return Promise.resolve();
1784
- }
1785
-
1786
- return this.request
1787
- .getActiveMeetings()
1788
- .then((locusArray) => {
1789
- const activeLocusUrl = [];
2038
+ } else {
2039
+ try {
2040
+ const locusArray = await this.request.getActiveMeetings();
2041
+ const activeLocusUrl: string[] = [];
1790
2042
 
1791
2043
  if (locusArray?.loci && locusArray.loci.length > 0) {
1792
2044
  const lociToUpdate = this.sortLocusArrayToUpdate(locusArray.loci);
2045
+
1793
2046
  lociToUpdate.forEach((locus) => {
1794
2047
  activeLocusUrl.push(locus.url);
1795
2048
  this.handleLocusEvent({
@@ -1807,21 +2060,50 @@ export default class Meetings extends WebexPlugin {
1807
2060
  // (they had a locusUrl previously but are no longer active) in the sync
1808
2061
  for (const meeting of Object.values(meetingsCollection)) {
1809
2062
  // @ts-ignore
1810
- const {locusUrl} = meeting;
2063
+ const {locusUrl, locusInfo} = meeting;
1811
2064
  if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1812
- // destroy function also uploads logs
1813
- // @ts-ignore
1814
- this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
2065
+ const globalMeetingId = locusInfo?.info?.globalMeetingId;
2066
+
2067
+ if (
2068
+ globalMeetingId &&
2069
+ locusArray?.loci?.some(
2070
+ (locus: LocusDTO) => locus.info?.globalMeetingId === globalMeetingId
2071
+ )
2072
+ ) {
2073
+ // don't destroy the meeting as Locus API still returned some Locus that shares
2074
+ // the same globalMeetingId - that happens for example if a webinar user (who hasn't scheduled it)
2075
+ // is in a breakout and gets moved to a different breakout while we were offline
2076
+ } else {
2077
+ // destroy function also uploads logs
2078
+ // @ts-ignore
2079
+ this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
2080
+ }
1815
2081
  }
1816
2082
  }
1817
2083
  }
1818
- })
1819
- .catch((error) => {
2084
+ } catch (error) {
1820
2085
  LoggerProxy.logger.error(
1821
2086
  `Meetings:index#syncMeetings --> failed to sync meetings, ${error}`
1822
2087
  );
1823
- throw new Error(error);
1824
- });
2088
+ throw error;
2089
+ }
2090
+ }
2091
+
2092
+ if (!skipHashTreeSync) {
2093
+ // Trigger hash tree syncs for all remaining meetings
2094
+ const remainingMeetings = this.meetingCollection.getAll();
2095
+ const syncPromises = [];
2096
+
2097
+ for (const meeting of Object.values(remainingMeetings) as any[]) {
2098
+ if (meeting.locusInfo) {
2099
+ syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
2100
+ }
2101
+ }
2102
+
2103
+ if (syncPromises.length > 0) {
2104
+ await Promise.all(syncPromises);
2105
+ }
2106
+ }
1825
2107
  }
1826
2108
 
1827
2109
  /**
@@ -1837,8 +2119,8 @@ export default class Meetings extends WebexPlugin {
1837
2119
  this.breakoutLocusForHandleLater = [];
1838
2120
  const lociToUpdate = [...mainLoci];
1839
2121
  breakoutLoci.forEach((breakoutLocus) => {
1840
- const associateMainLocus = mainLoci.find(
1841
- (mainLocus) => mainLocus.controls?.breakout?.url === breakoutLocus.controls?.breakout?.url
2122
+ const associateMainLocus = mainLoci.find((mainLocus) =>
2123
+ MeetingsUtil.isMainAssociatedWithBreakout(mainLocus, breakoutLocus)
1842
2124
  );
1843
2125
  const existCorrespondingMeeting = this.getCorrespondingMeetingByLocus({
1844
2126
  eventType: LOCUSEVENT.SDK_NO_EVENT,
@@ -1866,7 +2148,7 @@ export default class Meetings extends WebexPlugin {
1866
2148
  * @public
1867
2149
  * @memberof Meetings
1868
2150
  */
1869
- checkHandleBreakoutLocus(newCreatedLocus) {
2151
+ checkHandleBreakoutLocus(newCreatedLocus: any) {
1870
2152
  if (
1871
2153
  !newCreatedLocus ||
1872
2154
  !this.breakoutLocusForHandleLater ||
@@ -1877,9 +2159,8 @@ export default class Meetings extends WebexPlugin {
1877
2159
  if (MeetingsUtil.isBreakoutLocusDTO(newCreatedLocus)) {
1878
2160
  return;
1879
2161
  }
1880
- const existIndex = this.breakoutLocusForHandleLater.findIndex(
1881
- (breakoutLocus) =>
1882
- breakoutLocus.controls?.breakout?.url === newCreatedLocus.controls?.breakout?.url
2162
+ const existIndex = this.breakoutLocusForHandleLater.findIndex((breakoutLocus: any) =>
2163
+ MeetingsUtil.isMainAssociatedWithBreakout(newCreatedLocus, breakoutLocus)
1883
2164
  );
1884
2165
 
1885
2166
  if (existIndex < 0) {
@@ -1888,7 +2169,7 @@ export default class Meetings extends WebexPlugin {
1888
2169
 
1889
2170
  const associateBreakoutLocus = this.breakoutLocusForHandleLater[existIndex];
1890
2171
  this.handleLocusEvent({
1891
- eventType: LOCUSEVENT.SDK_NO_EVENT,
2172
+ eventType: LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1892
2173
  locus: associateBreakoutLocus,
1893
2174
  locusUrl: associateBreakoutLocus.url,
1894
2175
  });