@webex/plugin-meetings 3.12.0-task-refactor.1 → 3.12.0-webex-services-ready.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) 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 +14 -5
  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/index.js +26 -2
  11. package/dist/breakouts/index.js.map +1 -1
  12. package/dist/common/errors/webex-errors.js +49 -5
  13. package/dist/common/errors/webex-errors.js.map +1 -1
  14. package/dist/config.js +9 -3
  15. package/dist/config.js.map +1 -1
  16. package/dist/constants.js +59 -10
  17. package/dist/constants.js.map +1 -1
  18. package/dist/controls-options-manager/constants.js +11 -1
  19. package/dist/controls-options-manager/constants.js.map +1 -1
  20. package/dist/controls-options-manager/index.js +67 -29
  21. package/dist/controls-options-manager/index.js.map +1 -1
  22. package/dist/controls-options-manager/util.js +91 -0
  23. package/dist/controls-options-manager/util.js.map +1 -1
  24. package/dist/hashTree/constants.js +34 -0
  25. package/dist/hashTree/constants.js.map +1 -0
  26. package/dist/hashTree/hashTree.js +533 -0
  27. package/dist/hashTree/hashTree.js.map +1 -0
  28. package/dist/hashTree/hashTreeParser.js +2068 -36
  29. package/dist/hashTree/hashTreeParser.js.map +1 -1
  30. package/dist/hashTree/types.js +13 -3
  31. package/dist/hashTree/types.js.map +1 -1
  32. package/dist/hashTree/utils.js +111 -0
  33. package/dist/hashTree/utils.js.map +1 -0
  34. package/dist/index.js +18 -2
  35. package/dist/index.js.map +1 -1
  36. package/dist/interceptors/constant.js +12 -0
  37. package/dist/interceptors/constant.js.map +1 -0
  38. package/dist/interceptors/dataChannelAuthToken.js +350 -0
  39. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  40. package/dist/interceptors/index.js +7 -0
  41. package/dist/interceptors/index.js.map +1 -1
  42. package/dist/interceptors/locusRetry.js +23 -8
  43. package/dist/interceptors/locusRetry.js.map +1 -1
  44. package/dist/interceptors/locusRouteToken.js +27 -5
  45. package/dist/interceptors/locusRouteToken.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 +11 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +896 -277
  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 +5 -2
  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 +2075 -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 +2 -2
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +369 -173
  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 +127 -25
  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 +11 -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 +171 -18
  114. package/dist/reachability/clusterReachability.js.map +1 -1
  115. package/dist/reachability/index.js +142 -94
  116. package/dist/reachability/index.js.map +1 -1
  117. package/dist/reachability/reachability.types.js +2 -0
  118. package/dist/reachability/reachability.types.js.map +1 -1
  119. package/dist/reachability/reachabilityPeerConnection.js +1 -1
  120. package/dist/reachability/reachabilityPeerConnection.js.map +1 -1
  121. package/dist/reachability/util.js +45 -0
  122. package/dist/reachability/util.js.map +1 -1
  123. package/dist/reactions/reactions.type.js.map +1 -1
  124. package/dist/reconnection-manager/index.js +0 -1
  125. package/dist/reconnection-manager/index.js.map +1 -1
  126. package/dist/recording-controller/index.js +1 -3
  127. package/dist/recording-controller/index.js.map +1 -1
  128. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  129. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  130. package/dist/types/common/browser-detection.d.ts +1 -0
  131. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  132. package/dist/types/common/events/events-scope.d.ts +1 -0
  133. package/dist/types/common/events/events.d.ts +1 -0
  134. package/dist/types/config.d.ts +7 -2
  135. package/dist/types/constants.d.ts +35 -1
  136. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  137. package/dist/types/controls-options-manager/index.d.ts +16 -0
  138. package/dist/types/hashTree/constants.d.ts +11 -0
  139. package/dist/types/hashTree/hashTree.d.ts +136 -0
  140. package/dist/types/hashTree/hashTreeParser.d.ts +392 -14
  141. package/dist/types/hashTree/types.d.ts +20 -0
  142. package/dist/types/hashTree/utils.d.ts +40 -0
  143. package/dist/types/index.d.ts +4 -0
  144. package/dist/types/interceptors/constant.d.ts +5 -0
  145. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  146. package/dist/types/interceptors/index.d.ts +2 -1
  147. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  148. package/dist/types/interceptors/locusRouteToken.d.ts +2 -0
  149. package/dist/types/interceptors/utils.d.ts +1 -0
  150. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  151. package/dist/types/locus-info/index.d.ts +116 -51
  152. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  153. package/dist/types/locus-info/types.d.ts +48 -12
  154. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  155. package/dist/types/media/properties.d.ts +3 -1
  156. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  157. package/dist/types/meeting/index.d.ts +196 -15
  158. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  159. package/dist/types/meeting/request.d.ts +17 -1
  160. package/dist/types/meeting/request.type.d.ts +5 -0
  161. package/dist/types/meeting/util.d.ts +40 -0
  162. package/dist/types/meeting-info/util.d.ts +1 -0
  163. package/dist/types/meeting-info/utilv2.d.ts +1 -0
  164. package/dist/types/meetings/index.d.ts +34 -20
  165. package/dist/types/meetings/meetings.types.d.ts +15 -0
  166. package/dist/types/meetings/request.d.ts +14 -0
  167. package/dist/types/member/index.d.ts +2 -0
  168. package/dist/types/member/types.d.ts +5 -4
  169. package/dist/types/member/util.d.ts +14 -0
  170. package/dist/types/members/index.d.ts +15 -2
  171. package/dist/types/members/util.d.ts +1 -5
  172. package/dist/types/metrics/constants.d.ts +10 -0
  173. package/dist/types/multistream/codec/constants.d.ts +7 -0
  174. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  175. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  176. package/dist/types/reachability/clusterReachability.d.ts +33 -6
  177. package/dist/types/reachability/index.d.ts +10 -3
  178. package/dist/types/reachability/reachability.types.d.ts +7 -0
  179. package/dist/types/reachability/util.d.ts +17 -0
  180. package/dist/types/reactions/reactions.type.d.ts +4 -0
  181. package/dist/types/recording-controller/util.d.ts +5 -5
  182. package/dist/types/roap/index.d.ts +1 -1
  183. package/dist/types/webinar/utils.d.ts +6 -0
  184. package/dist/webinar/index.js +585 -164
  185. package/dist/webinar/index.js.map +1 -1
  186. package/dist/webinar/utils.js +25 -0
  187. package/dist/webinar/utils.js.map +1 -0
  188. package/package.json +26 -24
  189. package/src/aiEnableRequest/README.md +84 -0
  190. package/src/aiEnableRequest/index.ts +186 -0
  191. package/src/aiEnableRequest/utils.ts +25 -0
  192. package/src/annotation/index.ts +27 -7
  193. package/src/breakouts/breakout.ts +3 -1
  194. package/src/breakouts/index.ts +31 -0
  195. package/src/common/errors/webex-errors.ts +50 -3
  196. package/src/config.ts +7 -2
  197. package/src/constants.ts +49 -3
  198. package/src/controls-options-manager/constants.ts +14 -1
  199. package/src/controls-options-manager/index.ts +87 -28
  200. package/src/controls-options-manager/util.ts +81 -1
  201. package/src/hashTree/constants.ts +26 -0
  202. package/src/hashTree/hashTree.ts +480 -0
  203. package/src/hashTree/hashTreeParser.ts +1911 -29
  204. package/src/hashTree/types.ts +24 -1
  205. package/src/hashTree/utils.ts +98 -0
  206. package/src/index.ts +14 -1
  207. package/src/interceptors/constant.ts +6 -0
  208. package/src/interceptors/dataChannelAuthToken.ts +246 -0
  209. package/src/interceptors/index.ts +2 -1
  210. package/src/interceptors/locusRetry.ts +25 -4
  211. package/src/interceptors/locusRouteToken.ts +22 -5
  212. package/src/interceptors/utils.ts +16 -0
  213. package/src/interpretation/index.ts +29 -11
  214. package/src/interpretation/interpretation.types.ts +11 -0
  215. package/src/locus-info/controlsUtils.ts +20 -1
  216. package/src/locus-info/index.ts +958 -250
  217. package/src/locus-info/infoUtils.ts +41 -6
  218. package/src/locus-info/selfUtils.ts +1 -0
  219. package/src/locus-info/types.ts +51 -12
  220. package/src/media/MediaConnectionAwaiter.ts +62 -5
  221. package/src/media/index.ts +10 -1
  222. package/src/media/properties.ts +4 -1
  223. package/src/meeting/in-meeting-actions.ts +20 -0
  224. package/src/meeting/index.ts +1025 -146
  225. package/src/meeting/locusMediaRequest.ts +106 -6
  226. package/src/meeting/muteState.ts +10 -1
  227. package/src/meeting/request.ts +53 -0
  228. package/src/meeting/request.type.ts +6 -0
  229. package/src/meeting/util.ts +207 -7
  230. package/src/meeting-info/meeting-info-v2.ts +4 -2
  231. package/src/meetings/index.ts +307 -132
  232. package/src/meetings/meetings.types.ts +19 -0
  233. package/src/meetings/request.ts +43 -0
  234. package/src/meetings/util.ts +127 -13
  235. package/src/member/index.ts +20 -0
  236. package/src/member/types.ts +1 -0
  237. package/src/member/util.ts +41 -0
  238. package/src/members/index.ts +70 -7
  239. package/src/members/util.ts +12 -4
  240. package/src/metrics/constants.ts +11 -0
  241. package/src/multistream/codec/constants.ts +58 -0
  242. package/src/multistream/mediaRequestManager.ts +117 -76
  243. package/src/multistream/receiveSlot.ts +18 -0
  244. package/src/multistream/remoteMediaManager.ts +13 -0
  245. package/src/multistream/sendSlotManager.ts +97 -3
  246. package/src/reachability/clusterReachability.ts +156 -29
  247. package/src/reachability/index.ts +62 -17
  248. package/src/reachability/reachability.types.ts +11 -0
  249. package/src/reachability/reachabilityPeerConnection.ts +3 -1
  250. package/src/reachability/util.ts +36 -0
  251. package/src/reactions/reactions.type.ts +4 -0
  252. package/src/reconnection-manager/index.ts +0 -1
  253. package/src/recording-controller/index.ts +1 -2
  254. package/src/webinar/index.ts +448 -11
  255. package/src/webinar/utils.ts +16 -0
  256. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  257. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  258. package/test/unit/spec/annotation/index.ts +69 -7
  259. package/test/unit/spec/breakouts/breakout.ts +9 -3
  260. package/test/unit/spec/breakouts/index.ts +49 -0
  261. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  262. package/test/unit/spec/controls-options-manager/index.js +244 -29
  263. package/test/unit/spec/controls-options-manager/util.js +165 -0
  264. package/test/unit/spec/hashTree/hashTree.ts +721 -0
  265. package/test/unit/spec/hashTree/hashTreeParser.ts +5328 -0
  266. package/test/unit/spec/hashTree/utils.ts +264 -0
  267. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
  268. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  269. package/test/unit/spec/interceptors/locusRouteToken.ts +44 -0
  270. package/test/unit/spec/interceptors/utils.ts +75 -0
  271. package/test/unit/spec/interpretation/index.ts +26 -4
  272. package/test/unit/spec/locus-info/controlsUtils.js +222 -52
  273. package/test/unit/spec/locus-info/index.js +2000 -171
  274. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  275. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  276. package/test/unit/spec/media/index.ts +92 -0
  277. package/test/unit/spec/media/properties.ts +12 -3
  278. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  279. package/test/unit/spec/meeting/index.js +2925 -209
  280. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  281. package/test/unit/spec/meeting/muteState.js +81 -0
  282. package/test/unit/spec/meeting/request.js +82 -0
  283. package/test/unit/spec/meeting/utils.js +595 -27
  284. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  285. package/test/unit/spec/meetings/index.js +1214 -75
  286. package/test/unit/spec/meetings/request.js +141 -0
  287. package/test/unit/spec/meetings/utils.js +453 -52
  288. package/test/unit/spec/member/index.js +35 -4
  289. package/test/unit/spec/member/util.js +154 -27
  290. package/test/unit/spec/members/index.js +216 -0
  291. package/test/unit/spec/members/request.js +37 -1
  292. package/test/unit/spec/members/utils.js +63 -0
  293. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  294. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  295. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  296. package/test/unit/spec/reachability/clusterReachability.ts +125 -1
  297. package/test/unit/spec/reachability/index.ts +154 -49
  298. package/test/unit/spec/reachability/util.ts +31 -0
  299. package/test/unit/spec/reconnection-manager/index.js +4 -8
  300. package/test/unit/spec/recording-controller/index.js +9 -8
  301. package/test/unit/spec/webinar/index.ts +837 -39
  302. package/test/unit/spec/webinar/utils.ts +39 -0
@@ -47,7 +47,7 @@ import {
47
47
  import BEHAVIORAL_METRICS from '../metrics/constants';
48
48
  import MeetingInfo from '../meeting-info';
49
49
  import MeetingInfoV2 from '../meeting-info/meeting-info-v2';
50
- import Meeting, {CallStateForMetrics} from '../meeting';
50
+ import Meeting, {CallStateForMetrics, storeEventForDebugging} from '../meeting';
51
51
  import PersonalMeetingRoom from '../personal-meeting-room';
52
52
  import Reachability from '../reachability';
53
53
  import Request from './request';
@@ -55,10 +55,12 @@ import PasswordError from '../common/errors/password-error';
55
55
  import CaptchaError from '../common/errors/captcha-error';
56
56
  import MeetingCollection from './collection';
57
57
  import {
58
+ FetchSitePreferencesMeViaSiteOptions,
58
59
  MEETING_KEY,
59
60
  INoiseReductionEffect,
60
61
  IVirtualBackgroundEffect,
61
62
  MeetingRegistrationStatus,
63
+ SitePreferencesResponse,
62
64
  } from './meetings.types';
63
65
  import MeetingsUtil from './util';
64
66
  import PermissionError from '../common/errors/permission';
@@ -67,6 +69,11 @@ import {SpaceIDDeprecatedError} from '../common/errors/webex-errors';
67
69
  import NoMeetingInfoError from '../common/errors/no-meeting-info';
68
70
  import JoinForbiddenError from '../common/errors/join-forbidden-error';
69
71
  import {HashTreeMessage} from '../hashTree/hashTreeParser';
72
+ import {HashTreeObject} from '../hashTree/types';
73
+ import {isSelf} from '../hashTree/utils';
74
+
75
+ import {createLocusFromHashTreeMessage, findMeetingForHashTreeMessage} from '../locus-info';
76
+ import {LocusDTO} from '../locus-info/types';
70
77
 
71
78
  let mediaLogger;
72
79
 
@@ -193,6 +200,8 @@ export default class Meetings extends WebexPlugin {
193
200
  preferredWebexSite: any;
194
201
  reachability: Reachability;
195
202
  registered: any;
203
+ registrationPromise: Promise<void>;
204
+ unregistrationPromise: Promise<void>;
196
205
  request: any;
197
206
  geoHintInfo: any;
198
207
  meetingInfo: any;
@@ -308,7 +317,7 @@ export default class Meetings extends WebexPlugin {
308
317
  const breakoutLocus = this.meetingCollection.getActiveBreakoutLocus(breakoutUrl);
309
318
 
310
319
  const isSelfJoined = newLocus?.self?.state === _JOINED_;
311
- const isSelfMoved = newLocus?.self?.state === _LEFT_ && newLocus?.self?.reason === _MOVED_;
320
+ const isSelfMoved = MeetingsUtil.isSelfMovedOrBreakoutEnded(newLocus);
312
321
  // @ts-ignore
313
322
  const deviceFromNewLocus = MeetingsUtil.getThisDevice(newLocus, this.webex.internal.device.url);
314
323
  const isResourceMovedOnThisDevice =
@@ -385,7 +394,7 @@ export default class Meetings extends WebexPlugin {
385
394
  private isNeedHandleLocusDTO(meeting: any, newLocus: any) {
386
395
  if (newLocus) {
387
396
  const isNewLocusAsBreakout = MeetingsUtil.isBreakoutLocusDTO(newLocus);
388
- const isSelfMoved = newLocus?.self?.state === _LEFT_ && newLocus?.self?.reason === _MOVED_;
397
+ const isSelfMoved = MeetingsUtil.isSelfMovedOrBreakoutEnded(newLocus);
389
398
  const isSelfMovedToLobby =
390
399
  newLocus?.self?.devices[0]?.intent?.reason === _ON_HOLD_LOBBY_ &&
391
400
  newLocus?.self?.devices[0]?.intent?.type === _WAIT_;
@@ -420,31 +429,47 @@ export default class Meetings extends WebexPlugin {
420
429
  * @memberof Meetings
421
430
  */
422
431
  getCorrespondingMeetingByLocus(data: LocusEvent) {
423
- if (
424
- data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED &&
425
- data.stateElementsMessage?.locusUrl
426
- ) {
427
- return this.meetingCollection.getByKey(
428
- MEETING_KEY.LOCUS_URL,
429
- data.stateElementsMessage.locusUrl
432
+ const locusUrl =
433
+ data.stateElementsMessage?.locusUrl || // hash tree event
434
+ data.locusUrl; // classic event
435
+
436
+ // first try to find by locusUrl - that's the simplest and quickest way
437
+ const existingMeeting = this.meetingCollection.getByKey(MEETING_KEY.LOCUS_URL, locusUrl);
438
+
439
+ if (existingMeeting) {
440
+ return existingMeeting;
441
+ }
442
+ if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
443
+ // need to check if maybe this event indicates a move to/from breakout
444
+ const meetingForHashTreeMessage = findMeetingForHashTreeMessage(
445
+ data?.stateElementsMessage,
446
+ this.meetingCollection
430
447
  );
448
+
449
+ if (meetingForHashTreeMessage) {
450
+ return meetingForHashTreeMessage;
451
+ }
431
452
  }
432
453
 
433
- // getting meeting by correlationId. This will happen for the new event
434
- // Either the locus
435
- // TODO : Add check for the callBack Address
454
+ // if that didn't work, fallback to other fields like correlationId, sipUri, etc
455
+
456
+ // If the event is a hash tree event, we need to extract "self" object from it
457
+ // We don't care about the version, just need to find the meeting this event is for,
458
+ // so any hash tree object of type "self" will do
459
+ const hashTreeEventSelf = data.stateElementsMessage?.locusStateElements?.find(
460
+ (obj: HashTreeObject) => isSelf(obj)
461
+ )?.data;
462
+
463
+ const self = hashTreeEventSelf || data.locus?.self;
464
+
436
465
  return (
437
- this.meetingCollection.getByKey(MEETING_KEY.LOCUS_URL, data.locusUrl) ||
438
466
  // @ts-ignore
439
467
  this.meetingCollection.getByKey(
440
468
  MEETING_KEY.CORRELATION_ID,
441
469
  // @ts-ignore
442
- MeetingsUtil.checkForCorrelationId(this.webex.internal.device.url, data.locus)
443
- ) ||
444
- this.meetingCollection.getByKey(
445
- MEETING_KEY.SIP_URI,
446
- data.locus?.self?.callbackInfo?.callbackAddress
470
+ MeetingsUtil.getCorrelationIdForDevice(this.webex.internal.device.url, self)
447
471
  ) ||
472
+ this.meetingCollection.getByKey(MEETING_KEY.SIP_URI, self?.callbackInfo?.callbackAddress) ||
448
473
  (data.locus?.info?.isUnifiedSpaceMeeting
449
474
  ? undefined
450
475
  : this.meetingCollection.getByKey(
@@ -468,6 +493,10 @@ export default class Meetings extends WebexPlugin {
468
493
  */
469
494
  private handleLocusEvent(data: LocusEvent, useRandomDelayForInfo = false) {
470
495
  let meeting = this.getCorrespondingMeetingByLocus(data);
496
+ // @ts-ignore
497
+ if (this.config.experimental.storeLocusHashTreeEventsForDebugging) {
498
+ storeEventForDebugging('mercury', data);
499
+ }
471
500
 
472
501
  // Special case when locus has got replaced, This only happend once if a replace locus exists
473
502
  // https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-changing-mid-call
@@ -482,8 +511,9 @@ export default class Meetings extends WebexPlugin {
482
511
  }
483
512
 
484
513
  if (meeting && !MeetingsUtil.isBreakoutLocusDTO(data.locus)) {
485
- meeting.locusInfo.updateMainSessionLocusCache(data.locus);
514
+ meeting.locusInfo.updateMainSessionLocusCache(data.locus); // here data.locus will never be a complete locus
486
515
  }
516
+
487
517
  if (!this.isNeedHandleLocusDTO(meeting, data.locus)) {
488
518
  LoggerProxy.logger.log(
489
519
  `Meetings:index#handleLocusEvent --> doesn't need to process locus event`
@@ -513,57 +543,65 @@ export default class Meetings extends WebexPlugin {
513
543
  // };
514
544
  // rather then locus object change to locus url
515
545
 
516
- if (data.eventType !== LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
517
- if (
518
- data.locus &&
519
- data.locus.fullState &&
520
- data.locus.fullState.state === LOCUS.STATE.INACTIVE
521
- ) {
522
- // just ignore the event as its already ended and not active
523
- LoggerProxy.logger.warn(
524
- 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
525
- );
526
-
527
- return;
528
- }
546
+ if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
547
+ // We're about to create a new meeting object from this hash tree message.
548
+ // There is some existing (pre-hash trees) SDK logic here that requires a locus object
549
+ // (at the very minimum we need locus.url to be set)
550
+ // so we try to create locus from the received hash tree message
551
+ // it will not be complete, in most cases it will only have the self part, but that's still better than nothing
552
+ const {locus} = createLocusFromHashTreeMessage(data.stateElementsMessage);
553
+
554
+ data.locus = locus;
555
+ }
529
556
 
530
- // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
531
- // Any future events will be neglected
532
-
533
- if (
534
- data.locus &&
535
- data.locus.self &&
536
- data.locus.self.state === _LEFT_ &&
537
- data.locus.self.removed === true
538
- ) {
539
- // just ignore the event as its already ended and not active
540
- LoggerProxy.logger.warn(
541
- 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
542
- );
557
+ if (
558
+ data.locus &&
559
+ data.locus.fullState &&
560
+ data.locus.fullState.state === LOCUS.STATE.INACTIVE
561
+ ) {
562
+ // just ignore the event as its already ended and not active
563
+ LoggerProxy.logger.warn(
564
+ 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
565
+ );
543
566
 
544
- return;
545
- }
567
+ return;
546
568
  }
547
569
 
548
- if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
549
- // in hash tree messages we don't ge the locus object, but the meeting constructor needs at least locus.url
550
- set(data, 'locus.url', data.stateElementsMessage.locusUrl);
570
+ // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
571
+ // Any future events will be neglected
572
+
573
+ if (
574
+ data.locus &&
575
+ data.locus.self &&
576
+ data.locus.self.state === _LEFT_ &&
577
+ data.locus.self.removed === true
578
+ ) {
579
+ // just ignore the event as its already ended and not active
580
+ LoggerProxy.logger.warn(
581
+ 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
582
+ );
583
+
584
+ return;
551
585
  }
552
586
 
553
587
  this.create(data.locus, DESTINATION_TYPE.LOCUS_ID, useRandomDelayForInfo)
554
588
  .then(async (newMeeting) => {
555
589
  meeting = newMeeting;
556
-
557
590
  try {
558
591
  // It's a new meeting so initialize the locus data
559
- await meeting.locusInfo.initialSetup({
560
- trigger:
561
- data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS
562
- ? 'get-loci-response'
563
- : 'locus-message',
564
- locus: data.locus,
565
- hashTreeMessage: data.stateElementsMessage,
566
- });
592
+ await meeting.locusInfo.initialSetup(
593
+ {
594
+ trigger:
595
+ data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS
596
+ ? 'get-loci-response'
597
+ : 'locus-message',
598
+ locus: data.locus,
599
+ hashTreeMessage: data.stateElementsMessage,
600
+ },
601
+ (locus: LocusDTO) => {
602
+ meeting.finalizeMeetingAfterInitialLocusSetup(locus);
603
+ }
604
+ );
567
605
  } catch (error) {
568
606
  LoggerProxy.logger.warn(
569
607
  `Meetings:index#handleLocusEvent --> Error initializing locus data: ${error.message}`
@@ -617,7 +655,7 @@ export default class Meetings extends WebexPlugin {
617
655
  }
618
656
 
619
657
  /**
620
- * handles locus events through mercury that are not roap
658
+ * handles locus events through mercury that are not roap or approval request events
621
659
  * @param {Object} envelope
622
660
  * @param {Object} envelope.data
623
661
  * @param {String} envelope.data.eventType
@@ -630,7 +668,11 @@ export default class Meetings extends WebexPlugin {
630
668
  // eslint-disable-next-line @typescript-eslint/no-shadow
631
669
  const {eventType} = data;
632
670
 
633
- if (eventType && eventType !== LOCUSEVENT.MESSAGE_ROAP) {
671
+ if (
672
+ eventType &&
673
+ eventType !== LOCUSEVENT.MESSAGE_ROAP &&
674
+ eventType !== LOCUSEVENT.APPROVAL_REQUEST
675
+ ) {
634
676
  this.handleLocusEvent(data, true);
635
677
  }
636
678
  }
@@ -800,97 +842,82 @@ export default class Meetings extends WebexPlugin {
800
842
  }
801
843
 
802
844
  /**
803
- * API to toggle TCP reachability, needs to be called before webex.meetings.register()
804
- * @param {Boolean} newValue
805
- * @private
806
- * @memberof Meetings
807
- * @returns {undefined}
808
- */
809
- private _toggleTcpReachability(newValue: boolean) {
810
- if (typeof newValue !== 'boolean') {
811
- return;
812
- }
813
- // @ts-ignore
814
- if (this.config.experimental.enableTcpReachability !== newValue) {
815
- // @ts-ignore
816
- this.config.experimental.enableTcpReachability = newValue;
817
- }
818
- }
819
-
820
- /**
821
- * API to toggle TLS reachability, needs to be called before webex.meetings.register()
845
+ * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
846
+ *
822
847
  * @param {Boolean} newValue
823
848
  * @private
824
849
  * @memberof Meetings
825
850
  * @returns {undefined}
826
851
  */
827
- private _toggleTlsReachability(newValue: boolean) {
852
+ private _toggleIpv6BackendNativeSupport(newValue: boolean) {
828
853
  if (typeof newValue !== 'boolean') {
829
854
  return;
830
855
  }
831
856
  // @ts-ignore
832
- if (this.config.experimental.enableTlsReachability !== newValue) {
857
+ if (this.config.backendIpv6NativeSupport !== newValue) {
833
858
  // @ts-ignore
834
- this.config.experimental.enableTlsReachability = newValue;
859
+ this.config.backendIpv6NativeSupport = newValue;
835
860
  }
836
861
  }
837
862
 
838
863
  /**
839
- * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
864
+ * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register()
840
865
  *
841
866
  * @param {Boolean} newValue
842
867
  * @private
843
868
  * @memberof Meetings
844
869
  * @returns {undefined}
845
870
  */
846
- private _toggleIpv6BackendNativeSupport(newValue: boolean) {
871
+ private _toggleDisableAudioMainDtx(newValue: boolean) {
847
872
  if (typeof newValue !== 'boolean') {
848
873
  return;
849
874
  }
875
+
850
876
  // @ts-ignore
851
- if (this.config.backendIpv6NativeSupport !== newValue) {
877
+ if (this.config.experimental.disableAudioMainDtx !== newValue) {
852
878
  // @ts-ignore
853
- this.config.backendIpv6NativeSupport = newValue;
879
+ this.config.experimental.disableAudioMainDtx = newValue;
854
880
  }
855
881
  }
856
882
 
857
883
  /**
858
- * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register()
884
+ * API to toggle usage of audio twcc support
859
885
  *
860
886
  * @param {Boolean} newValue
861
887
  * @private
862
888
  * @memberof Meetings
863
889
  * @returns {undefined}
864
890
  */
865
- private _toggleDisableAudioMainDtx(newValue: boolean) {
891
+ private _toggleEnableAudioTwccForMultistream(newValue: boolean) {
866
892
  if (typeof newValue !== 'boolean') {
867
893
  return;
868
894
  }
869
895
 
870
896
  // @ts-ignore
871
- if (this.config.experimental.disableAudioMainDtx !== newValue) {
897
+ if (this.config.enableAudioTwccForMultistream !== newValue) {
872
898
  // @ts-ignore
873
- this.config.experimental.disableAudioMainDtx = newValue;
899
+ this.config.enableAudioTwccForMultistream = newValue;
874
900
  }
875
901
  }
876
902
 
877
903
  /**
878
- * API to toggle usage of audio twcc support
904
+ * API to toggle AV1 codec support for video slides in multistream,
905
+ * needs to be called before webex.meetings.joinWithMedia()
879
906
  *
880
907
  * @param {Boolean} newValue
881
908
  * @private
882
909
  * @memberof Meetings
883
910
  * @returns {undefined}
884
911
  */
885
- private _toggleEnableAudioTwccForMultistream(newValue: boolean) {
912
+ private _toggleEnableAv1SlidesSupport(newValue: boolean) {
886
913
  if (typeof newValue !== 'boolean') {
887
914
  return;
888
915
  }
889
916
 
890
917
  // @ts-ignore
891
- if (this.config.enableAudioTwccForMultistream !== newValue) {
918
+ if (this.config.enableAv1SlidesSupport !== newValue) {
892
919
  // @ts-ignore
893
- this.config.enableAudioTwccForMultistream = newValue;
920
+ this.config.enableAv1SlidesSupport = newValue;
894
921
  }
895
922
  }
896
923
 
@@ -922,9 +949,20 @@ export default class Meetings extends WebexPlugin {
922
949
  * @returns {Promise} A promise that resolves when the step is completed.
923
950
  */
924
951
  executeRegistrationStep(step: () => Promise<any>, stepName: string) {
925
- return step().then(() => {
926
- this.registrationStatus[stepName] = true;
927
- });
952
+ return step()
953
+ .then(() => {
954
+ LoggerProxy.logger.info(
955
+ `Meetings:index#executeRegistrationStep --> INFO, ${stepName} completed`
956
+ );
957
+ this.registrationStatus[stepName] = true;
958
+ })
959
+ .catch((error) => {
960
+ LoggerProxy.logger.error(
961
+ `Meetings:index#executeRegistrationStep --> ERROR, ${stepName} failed: ${error.message}`
962
+ );
963
+
964
+ return Promise.reject(error);
965
+ });
928
966
  }
929
967
 
930
968
  /**
@@ -937,7 +975,33 @@ export default class Meetings extends WebexPlugin {
937
975
  * @memberof Meetings
938
976
  */
939
977
  public register(deviceRegistrationOptions?: DeviceRegistrationOptions): Promise<any> {
940
- this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
978
+ if (this.unregistrationPromise) {
979
+ LoggerProxy.logger.info(
980
+ 'Meetings:index#register --> INFO, Meetings plugin unregistration in progress, waiting to register'
981
+ );
982
+
983
+ this.registrationPromise = this.unregistrationPromise
984
+ .catch(() => {}) // It doesn't matter what happened during unregistration
985
+ .finally(() => {
986
+ LoggerProxy.logger.info(
987
+ 'Meetings:index#register --> INFO, Meetings plugin unregistration completed, proceeding to register'
988
+ );
989
+
990
+ this.registrationPromise = null;
991
+
992
+ return this.register(deviceRegistrationOptions);
993
+ });
994
+
995
+ return this.registrationPromise;
996
+ }
997
+
998
+ if (this.registrationPromise) {
999
+ LoggerProxy.logger.info(
1000
+ 'Meetings:index#register --> INFO, Meetings plugin registration in progress, returning existing promise'
1001
+ );
1002
+
1003
+ return this.registrationPromise;
1004
+ }
941
1005
 
942
1006
  // @ts-ignore
943
1007
  if (!this.webex.canAuthorize) {
@@ -956,7 +1020,11 @@ export default class Meetings extends WebexPlugin {
956
1020
  return Promise.resolve();
957
1021
  }
958
1022
 
959
- return Promise.all([
1023
+ LoggerProxy.logger.info('Meetings:index#register --> INFO, Registering Meetings plugin');
1024
+
1025
+ this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1026
+
1027
+ this.registrationPromise = Promise.all([
960
1028
  this.executeRegistrationStep(() => this.fetchUserPreferredWebexSite(), 'fetchWebexSite'),
961
1029
  this.executeRegistrationStep(() => this.getGeoHint(), 'getGeoHint'),
962
1030
  this.executeRegistrationStep(
@@ -1015,7 +1083,12 @@ export default class Meetings extends WebexPlugin {
1015
1083
  });
1016
1084
 
1017
1085
  return Promise.reject(error);
1086
+ })
1087
+ .finally(() => {
1088
+ this.registrationPromise = null;
1018
1089
  });
1090
+
1091
+ return this.registrationPromise;
1019
1092
  }
1020
1093
 
1021
1094
  /**
@@ -1027,6 +1100,35 @@ export default class Meetings extends WebexPlugin {
1027
1100
  * @memberof Meetings
1028
1101
  */
1029
1102
  unregister() {
1103
+ if (this.unregistrationPromise) {
1104
+ LoggerProxy.logger.info(
1105
+ 'Meetings:index#unregister --> INFO, Meetings plugin unregistration in progress, returning existing promise'
1106
+ );
1107
+
1108
+ return this.unregistrationPromise;
1109
+ }
1110
+
1111
+ if (this.registrationPromise) {
1112
+ LoggerProxy.logger.info(
1113
+ 'Meetings:index#unregister --> INFO, Meetings plugin registration in progress, waiting to unregister'
1114
+ );
1115
+
1116
+ // Wait for registration to complete (success or failure), then call unregister again
1117
+ this.unregistrationPromise = this.registrationPromise
1118
+ .catch(() => {}) // It doesn't matter what happened during registration
1119
+ .finally(() => {
1120
+ LoggerProxy.logger.info(
1121
+ 'Meetings:index#unregister --> INFO, Meetings plugin registration completed, proceeding to unregister'
1122
+ );
1123
+
1124
+ this.unregistrationPromise = null;
1125
+
1126
+ return this.unregister();
1127
+ });
1128
+
1129
+ return this.unregistrationPromise;
1130
+ }
1131
+
1030
1132
  if (!this.registered) {
1031
1133
  LoggerProxy.logger.info(
1032
1134
  'Meetings:index#unregister --> INFO, Meetings plugin already unregistered'
@@ -1037,10 +1139,14 @@ export default class Meetings extends WebexPlugin {
1037
1139
 
1038
1140
  this.stopListeningForEvents();
1039
1141
 
1040
- return (
1142
+ this.unregistrationPromise =
1041
1143
  // @ts-ignore
1042
1144
  this.webex.internal.mercury
1043
- .disconnect()
1145
+ // Use code 3050 with a non-reconnecting reason to prevent Mercury auto-reconnect
1146
+ // during unregister. Without this, disconnect() defaults to code 1000/"Done" which
1147
+ // force-closes as "Done (forced)" - a normalReconnectReason that triggers auto-reconnect,
1148
+ // causing a race condition with device.unregister().
1149
+ .disconnect({code: 3050, reason: 'meetings unregister'})
1044
1150
  // @ts-ignore
1045
1151
  .then(() => this.webex.internal.device.unregister())
1046
1152
  .catch((error) => {
@@ -1070,7 +1176,11 @@ export default class Meetings extends WebexPlugin {
1070
1176
  this.registered = false;
1071
1177
  this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1072
1178
  })
1073
- );
1179
+ .finally(() => {
1180
+ this.unregistrationPromise = null;
1181
+ });
1182
+
1183
+ return this.unregistrationPromise;
1074
1184
  }
1075
1185
 
1076
1186
  /**
@@ -1283,6 +1393,31 @@ export default class Meetings extends WebexPlugin {
1283
1393
  return this.personalMeetingRoom;
1284
1394
  }
1285
1395
 
1396
+ /**
1397
+ * Fetches site preferences for the provided Webex site, or the preferred Webex site.
1398
+ * This is used to determine capabilities of the site, such as whether scheduling a webinar is supported.
1399
+ *
1400
+ * @param {object} [options]
1401
+ * @param {string} [options.siteUrl] - Webex site URL. Defaults to preferredWebexSite, for example "cisco.webex.com".
1402
+ * @param {string} [options.siteName] - Site name query override. Defaults to the site name derived from siteUrl, for example "cisco" for "cisco.webex.com".
1403
+ * @param {SitePreferenceSelectOption[]} [options.selectOptions] - Preference sections to fetch. Defaults to 'scheduling'.
1404
+ * @returns {Promise<SitePreferencesResponse>} site preferences response body
1405
+ * @throws {ParameterError}
1406
+ * @public
1407
+ * @memberof Meetings
1408
+ * @example
1409
+ * const preferences = await webex.meetings.fetchSitePreferencesMeViaSite();
1410
+ * const supportScheduleWebinar = preferences?.scheduling?.supportScheduleWebinar;
1411
+ */
1412
+ public fetchSitePreferencesMeViaSite(
1413
+ options: FetchSitePreferencesMeViaSiteOptions = {}
1414
+ ): Promise<SitePreferencesResponse> {
1415
+ return this.request.fetchSitePreferencesMeViaSite({
1416
+ ...options,
1417
+ siteUrl: options.siteUrl || this.preferredWebexSite,
1418
+ });
1419
+ }
1420
+
1286
1421
  /**
1287
1422
  * Returns basic information about a meeting that exists or
1288
1423
  * used to exist in the MeetingCollection
@@ -1645,10 +1780,14 @@ export default class Meetings extends WebexPlugin {
1645
1780
  extraParams: infoExtraParams,
1646
1781
  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
1647
1782
  };
1783
+ const shouldDeferMeetingInfoFetch = type === DESTINATION_TYPE.LOCUS_ID && !destination?.info;
1784
+
1785
+ const isOneOnOneCallLocus =
1786
+ type === DESTINATION_TYPE.LOCUS_ID && MeetingsUtil.isOneOnOneCall(destination);
1648
1787
 
1649
1788
  if (meetingInfo) {
1650
1789
  meeting.injectMeetingInfo(meetingInfo, meetingInfoOptions, meetingLookupUrl);
1651
- } else if (type !== DESTINATION_TYPE.ONE_ON_ONE_CALL) {
1790
+ } else if (type !== DESTINATION_TYPE.ONE_ON_ONE_CALL && !isOneOnOneCallLocus) {
1652
1791
  // ignore fetchMeetingInfo for 1:1 meetings
1653
1792
  if (enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0) {
1654
1793
  meeting.fetchMeetingInfoTimeoutId = setTimeout(
@@ -1656,8 +1795,12 @@ export default class Meetings extends WebexPlugin {
1656
1795
  waitingTime
1657
1796
  );
1658
1797
  meeting.parseMeetingInfo(undefined, destination);
1659
- } else {
1798
+ } else if (!shouldDeferMeetingInfoFetch) {
1660
1799
  await meeting.fetchMeetingInfo(meetingInfoOptions);
1800
+ } else {
1801
+ LoggerProxy.logger.info(
1802
+ 'Meetings:index#createMeeting --> defer fetchMeetingInfo for incomplete locus, will do it after locus initialSetup'
1803
+ );
1661
1804
  }
1662
1805
  }
1663
1806
  } catch (err) {
@@ -1691,7 +1834,11 @@ export default class Meetings extends WebexPlugin {
1691
1834
  // For type LOCUS_ID we need to parse the locus object to get the information
1692
1835
  // about the caller and callee
1693
1836
  // Meeting Added event will be created in `handleLocusEvent`
1694
- if (type !== DESTINATION_TYPE.LOCUS_ID) {
1837
+ // Only emit MEETING_ADDED if the meeting still exists in the collection.
1838
+ // If fetchMeetingInfo failed and the meeting was destroyed in the catch block,
1839
+ // skip emitting to prevent orphaned meeting references on the consumer side.
1840
+ // @ts-ignore - getMeetingByType types value as object but accepts strings (same as handleLocusEvent)
1841
+ if (type !== DESTINATION_TYPE.LOCUS_ID && this.getMeetingByType(_ID_, meeting.id)) {
1695
1842
  if (!meeting.sipUri) {
1696
1843
  meeting.setSipUri(destination);
1697
1844
  }
@@ -1766,23 +1913,23 @@ export default class Meetings extends WebexPlugin {
1766
1913
  * @public
1767
1914
  * @memberof Meetings
1768
1915
  */
1769
- public syncMeetings({keepOnlyLocusMeetings = true} = {}): Promise<void> {
1916
+ public async syncMeetings({
1917
+ keepOnlyLocusMeetings = true,
1918
+ skipHashTreeSync = false,
1919
+ } = {}): Promise<void> {
1770
1920
  // @ts-ignore
1771
1921
  if (this.webex.credentials.isUnverifiedGuest) {
1772
1922
  LoggerProxy.logger.info(
1773
- 'Meetings:index#syncMeetings --> skipping meeting sync as unverified guest'
1923
+ 'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
1774
1924
  );
1775
-
1776
- return Promise.resolve();
1777
- }
1778
-
1779
- return this.request
1780
- .getActiveMeetings()
1781
- .then((locusArray) => {
1782
- const activeLocusUrl = [];
1925
+ } else {
1926
+ try {
1927
+ const locusArray = await this.request.getActiveMeetings();
1928
+ const activeLocusUrl: string[] = [];
1783
1929
 
1784
1930
  if (locusArray?.loci && locusArray.loci.length > 0) {
1785
1931
  const lociToUpdate = this.sortLocusArrayToUpdate(locusArray.loci);
1932
+
1786
1933
  lociToUpdate.forEach((locus) => {
1787
1934
  activeLocusUrl.push(locus.url);
1788
1935
  this.handleLocusEvent({
@@ -1800,21 +1947,50 @@ export default class Meetings extends WebexPlugin {
1800
1947
  // (they had a locusUrl previously but are no longer active) in the sync
1801
1948
  for (const meeting of Object.values(meetingsCollection)) {
1802
1949
  // @ts-ignore
1803
- const {locusUrl} = meeting;
1950
+ const {locusUrl, locusInfo} = meeting;
1804
1951
  if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1805
- // destroy function also uploads logs
1806
- // @ts-ignore
1807
- this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1952
+ const globalMeetingId = locusInfo?.info?.globalMeetingId;
1953
+
1954
+ if (
1955
+ globalMeetingId &&
1956
+ locusArray?.loci?.some(
1957
+ (locus: LocusDTO) => locus.info?.globalMeetingId === globalMeetingId
1958
+ )
1959
+ ) {
1960
+ // don't destroy the meeting as Locus API still returned some Locus that shares
1961
+ // the same globalMeetingId - that happens for example if a webinar user (who hasn't scheduled it)
1962
+ // is in a breakout and gets moved to a different breakout while we were offline
1963
+ } else {
1964
+ // destroy function also uploads logs
1965
+ // @ts-ignore
1966
+ this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1967
+ }
1808
1968
  }
1809
1969
  }
1810
1970
  }
1811
- })
1812
- .catch((error) => {
1971
+ } catch (error) {
1813
1972
  LoggerProxy.logger.error(
1814
1973
  `Meetings:index#syncMeetings --> failed to sync meetings, ${error}`
1815
1974
  );
1816
- throw new Error(error);
1817
- });
1975
+ throw error;
1976
+ }
1977
+ }
1978
+
1979
+ if (!skipHashTreeSync) {
1980
+ // Trigger hash tree syncs for all remaining meetings
1981
+ const remainingMeetings = this.meetingCollection.getAll();
1982
+ const syncPromises = [];
1983
+
1984
+ for (const meeting of Object.values(remainingMeetings) as any[]) {
1985
+ if (meeting.locusInfo) {
1986
+ syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
1987
+ }
1988
+ }
1989
+
1990
+ if (syncPromises.length > 0) {
1991
+ await Promise.all(syncPromises);
1992
+ }
1993
+ }
1818
1994
  }
1819
1995
 
1820
1996
  /**
@@ -1830,8 +2006,8 @@ export default class Meetings extends WebexPlugin {
1830
2006
  this.breakoutLocusForHandleLater = [];
1831
2007
  const lociToUpdate = [...mainLoci];
1832
2008
  breakoutLoci.forEach((breakoutLocus) => {
1833
- const associateMainLocus = mainLoci.find(
1834
- (mainLocus) => mainLocus.controls?.breakout?.url === breakoutLocus.controls?.breakout?.url
2009
+ const associateMainLocus = mainLoci.find((mainLocus) =>
2010
+ MeetingsUtil.isMainAssociatedWithBreakout(mainLocus, breakoutLocus)
1835
2011
  );
1836
2012
  const existCorrespondingMeeting = this.getCorrespondingMeetingByLocus({
1837
2013
  eventType: LOCUSEVENT.SDK_NO_EVENT,
@@ -1859,7 +2035,7 @@ export default class Meetings extends WebexPlugin {
1859
2035
  * @public
1860
2036
  * @memberof Meetings
1861
2037
  */
1862
- checkHandleBreakoutLocus(newCreatedLocus) {
2038
+ checkHandleBreakoutLocus(newCreatedLocus: any) {
1863
2039
  if (
1864
2040
  !newCreatedLocus ||
1865
2041
  !this.breakoutLocusForHandleLater ||
@@ -1870,9 +2046,8 @@ export default class Meetings extends WebexPlugin {
1870
2046
  if (MeetingsUtil.isBreakoutLocusDTO(newCreatedLocus)) {
1871
2047
  return;
1872
2048
  }
1873
- const existIndex = this.breakoutLocusForHandleLater.findIndex(
1874
- (breakoutLocus) =>
1875
- breakoutLocus.controls?.breakout?.url === newCreatedLocus.controls?.breakout?.url
2049
+ const existIndex = this.breakoutLocusForHandleLater.findIndex((breakoutLocus: any) =>
2050
+ MeetingsUtil.isMainAssociatedWithBreakout(newCreatedLocus, breakoutLocus)
1876
2051
  );
1877
2052
 
1878
2053
  if (existIndex < 0) {
@@ -1881,7 +2056,7 @@ export default class Meetings extends WebexPlugin {
1881
2056
 
1882
2057
  const associateBreakoutLocus = this.breakoutLocusForHandleLater[existIndex];
1883
2058
  this.handleLocusEvent({
1884
- eventType: LOCUSEVENT.SDK_NO_EVENT,
2059
+ eventType: LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1885
2060
  locus: associateBreakoutLocus,
1886
2061
  locusUrl: associateBreakoutLocus.url,
1887
2062
  });