@webex/plugin-meetings 3.10.0 → 3.11.0

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 (283) hide show
  1. package/dist/annotation/annotation.types.js.map +1 -1
  2. package/dist/annotation/constants.js.map +1 -1
  3. package/dist/annotation/index.js +19 -22
  4. package/dist/annotation/index.js.map +1 -1
  5. package/dist/breakouts/breakout.js +6 -6
  6. package/dist/breakouts/breakout.js.map +1 -1
  7. package/dist/breakouts/collection.js.map +1 -1
  8. package/dist/breakouts/edit-lock-error.js +9 -11
  9. package/dist/breakouts/edit-lock-error.js.map +1 -1
  10. package/dist/breakouts/events.js.map +1 -1
  11. package/dist/breakouts/index.js +126 -127
  12. package/dist/breakouts/index.js.map +1 -1
  13. package/dist/breakouts/request.js +6 -8
  14. package/dist/breakouts/request.js.map +1 -1
  15. package/dist/breakouts/utils.js.map +1 -1
  16. package/dist/common/browser-detection.js.map +1 -1
  17. package/dist/common/collection.js +1 -2
  18. package/dist/common/collection.js.map +1 -1
  19. package/dist/common/config.js.map +1 -1
  20. package/dist/common/errors/captcha-error.js +9 -11
  21. package/dist/common/errors/captcha-error.js.map +1 -1
  22. package/dist/common/errors/intent-to-join.js +10 -12
  23. package/dist/common/errors/intent-to-join.js.map +1 -1
  24. package/dist/common/errors/join-forbidden-error.js +10 -12
  25. package/dist/common/errors/join-forbidden-error.js.map +1 -1
  26. package/dist/common/errors/join-meeting.js +10 -12
  27. package/dist/common/errors/join-meeting.js.map +1 -1
  28. package/dist/common/errors/join-webinar-error.js +9 -11
  29. package/dist/common/errors/join-webinar-error.js.map +1 -1
  30. package/dist/common/errors/media.js +9 -11
  31. package/dist/common/errors/media.js.map +1 -1
  32. package/dist/common/errors/multistream-not-supported-error.js +9 -11
  33. package/dist/common/errors/multistream-not-supported-error.js.map +1 -1
  34. package/dist/common/errors/no-meeting-info.js +9 -11
  35. package/dist/common/errors/no-meeting-info.js.map +1 -1
  36. package/dist/common/errors/parameter.js +11 -14
  37. package/dist/common/errors/parameter.js.map +1 -1
  38. package/dist/common/errors/password-error.js +9 -11
  39. package/dist/common/errors/password-error.js.map +1 -1
  40. package/dist/common/errors/permission.js +9 -11
  41. package/dist/common/errors/permission.js.map +1 -1
  42. package/dist/common/errors/reclaim-host-role-errors.js +32 -38
  43. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -1
  44. package/dist/common/errors/reconnection-not-started.js +5 -6
  45. package/dist/common/errors/reconnection-not-started.js.map +1 -1
  46. package/dist/common/errors/reconnection.js +9 -11
  47. package/dist/common/errors/reconnection.js.map +1 -1
  48. package/dist/common/errors/stats.js +9 -11
  49. package/dist/common/errors/stats.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +38 -27
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/common/errors/webex-meetings-error.js +9 -12
  53. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  54. package/dist/common/events/events-scope.js +9 -10
  55. package/dist/common/events/events-scope.js.map +1 -1
  56. package/dist/common/events/events.js +9 -10
  57. package/dist/common/events/events.js.map +1 -1
  58. package/dist/common/events/trigger-proxy.js.map +1 -1
  59. package/dist/common/events/util.js.map +1 -1
  60. package/dist/common/logs/logger-config.js.map +1 -1
  61. package/dist/common/logs/logger-proxy.js.map +1 -1
  62. package/dist/common/logs/request.js +17 -17
  63. package/dist/common/logs/request.js.map +1 -1
  64. package/dist/common/queue.js +1 -2
  65. package/dist/common/queue.js.map +1 -1
  66. package/dist/config.js +2 -2
  67. package/dist/config.js.map +1 -1
  68. package/dist/constants.js +13 -8
  69. package/dist/constants.js.map +1 -1
  70. package/dist/controls-options-manager/constants.js.map +1 -1
  71. package/dist/controls-options-manager/enums.js.map +1 -1
  72. package/dist/controls-options-manager/index.js +1 -2
  73. package/dist/controls-options-manager/index.js.map +1 -1
  74. package/dist/controls-options-manager/types.js.map +1 -1
  75. package/dist/controls-options-manager/util.js +1 -2
  76. package/dist/controls-options-manager/util.js.map +1 -1
  77. package/dist/hashTree/constants.js +20 -0
  78. package/dist/hashTree/constants.js.map +1 -0
  79. package/dist/hashTree/hashTree.js +515 -0
  80. package/dist/hashTree/hashTree.js.map +1 -0
  81. package/dist/hashTree/hashTreeParser.js +1250 -0
  82. package/dist/hashTree/hashTreeParser.js.map +1 -0
  83. package/dist/hashTree/types.js +23 -0
  84. package/dist/hashTree/types.js.map +1 -0
  85. package/dist/hashTree/utils.js +59 -0
  86. package/dist/hashTree/utils.js.map +1 -0
  87. package/dist/index.js +8 -2
  88. package/dist/index.js.map +1 -1
  89. package/dist/interceptors/index.js.map +1 -1
  90. package/dist/interceptors/locusRetry.js +6 -8
  91. package/dist/interceptors/locusRetry.js.map +1 -1
  92. package/dist/interceptors/locusRouteToken.js +33 -13
  93. package/dist/interceptors/locusRouteToken.js.map +1 -1
  94. package/dist/interpretation/collection.js.map +1 -1
  95. package/dist/interpretation/index.js +1 -2
  96. package/dist/interpretation/index.js.map +1 -1
  97. package/dist/interpretation/siLanguage.js +1 -1
  98. package/dist/interpretation/siLanguage.js.map +1 -1
  99. package/dist/locus-info/controlsUtils.js +5 -3
  100. package/dist/locus-info/controlsUtils.js.map +1 -1
  101. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  102. package/dist/locus-info/fullState.js.map +1 -1
  103. package/dist/locus-info/hostUtils.js.map +1 -1
  104. package/dist/locus-info/index.js +619 -177
  105. package/dist/locus-info/index.js.map +1 -1
  106. package/dist/locus-info/infoUtils.js.map +1 -1
  107. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  108. package/dist/locus-info/parser.js +3 -4
  109. package/dist/locus-info/parser.js.map +1 -1
  110. package/dist/locus-info/selfUtils.js.map +1 -1
  111. package/dist/locus-info/types.js +7 -0
  112. package/dist/locus-info/types.js.map +1 -0
  113. package/dist/media/MediaConnectionAwaiter.js +1 -2
  114. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  115. package/dist/media/index.js +5 -2
  116. package/dist/media/index.js.map +1 -1
  117. package/dist/media/properties.js +15 -17
  118. package/dist/media/properties.js.map +1 -1
  119. package/dist/media/util.js.map +1 -1
  120. package/dist/meeting/brbState.js +8 -9
  121. package/dist/meeting/brbState.js.map +1 -1
  122. package/dist/meeting/connectionStateHandler.js +10 -13
  123. package/dist/meeting/connectionStateHandler.js.map +1 -1
  124. package/dist/meeting/in-meeting-actions.js.map +1 -1
  125. package/dist/meeting/index.js +1632 -1535
  126. package/dist/meeting/index.js.map +1 -1
  127. package/dist/meeting/locusMediaRequest.js +13 -17
  128. package/dist/meeting/locusMediaRequest.js.map +1 -1
  129. package/dist/meeting/muteState.js +11 -12
  130. package/dist/meeting/muteState.js.map +1 -1
  131. package/dist/meeting/request.js +101 -104
  132. package/dist/meeting/request.js.map +1 -1
  133. package/dist/meeting/request.type.js.map +1 -1
  134. package/dist/meeting/state.js.map +1 -1
  135. package/dist/meeting/type.js.map +1 -1
  136. package/dist/meeting/util.js +24 -23
  137. package/dist/meeting/util.js.map +1 -1
  138. package/dist/meeting/voicea-meeting.js +3 -3
  139. package/dist/meeting/voicea-meeting.js.map +1 -1
  140. package/dist/meeting-info/collection.js +7 -10
  141. package/dist/meeting-info/collection.js.map +1 -1
  142. package/dist/meeting-info/index.js +1 -2
  143. package/dist/meeting-info/index.js.map +1 -1
  144. package/dist/meeting-info/meeting-info-v2.js +135 -146
  145. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  146. package/dist/meeting-info/request.js +1 -2
  147. package/dist/meeting-info/request.js.map +1 -1
  148. package/dist/meeting-info/util.js +36 -37
  149. package/dist/meeting-info/util.js.map +1 -1
  150. package/dist/meeting-info/utilv2.js +30 -31
  151. package/dist/meeting-info/utilv2.js.map +1 -1
  152. package/dist/meetings/collection.js +6 -8
  153. package/dist/meetings/collection.js.map +1 -1
  154. package/dist/meetings/index.js +200 -148
  155. package/dist/meetings/index.js.map +1 -1
  156. package/dist/meetings/meetings.types.js.map +1 -1
  157. package/dist/meetings/request.js +6 -8
  158. package/dist/meetings/request.js.map +1 -1
  159. package/dist/meetings/util.js +36 -30
  160. package/dist/meetings/util.js.map +1 -1
  161. package/dist/member/index.js +1 -2
  162. package/dist/member/index.js.map +1 -1
  163. package/dist/member/types.js +6 -3
  164. package/dist/member/types.js.map +1 -1
  165. package/dist/member/util.js.map +1 -1
  166. package/dist/members/collection.js +1 -2
  167. package/dist/members/collection.js.map +1 -1
  168. package/dist/members/index.js +18 -21
  169. package/dist/members/index.js.map +1 -1
  170. package/dist/members/request.js +8 -11
  171. package/dist/members/request.js.map +1 -1
  172. package/dist/members/types.js.map +1 -1
  173. package/dist/members/util.js.map +1 -1
  174. package/dist/metrics/constants.js +4 -1
  175. package/dist/metrics/constants.js.map +1 -1
  176. package/dist/metrics/index.js +3 -4
  177. package/dist/metrics/index.js.map +1 -1
  178. package/dist/multistream/mediaRequestManager.js +1 -2
  179. package/dist/multistream/mediaRequestManager.js.map +1 -1
  180. package/dist/multistream/receiveSlot.js +34 -45
  181. package/dist/multistream/receiveSlot.js.map +1 -1
  182. package/dist/multistream/receiveSlotManager.js +8 -9
  183. package/dist/multistream/receiveSlotManager.js.map +1 -1
  184. package/dist/multistream/remoteMedia.js +12 -15
  185. package/dist/multistream/remoteMedia.js.map +1 -1
  186. package/dist/multistream/remoteMediaGroup.js +1 -2
  187. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  188. package/dist/multistream/remoteMediaManager.js +122 -123
  189. package/dist/multistream/remoteMediaManager.js.map +1 -1
  190. package/dist/multistream/sendSlotManager.js +29 -30
  191. package/dist/multistream/sendSlotManager.js.map +1 -1
  192. package/dist/personal-meeting-room/index.js +16 -19
  193. package/dist/personal-meeting-room/index.js.map +1 -1
  194. package/dist/personal-meeting-room/request.js +7 -10
  195. package/dist/personal-meeting-room/request.js.map +1 -1
  196. package/dist/personal-meeting-room/util.js.map +1 -1
  197. package/dist/reachability/clusterReachability.js +188 -352
  198. package/dist/reachability/clusterReachability.js.map +1 -1
  199. package/dist/reachability/index.js +206 -206
  200. package/dist/reachability/index.js.map +1 -1
  201. package/dist/reachability/reachability.types.js +14 -1
  202. package/dist/reachability/reachability.types.js.map +1 -1
  203. package/dist/reachability/reachabilityPeerConnection.js +445 -0
  204. package/dist/reachability/reachabilityPeerConnection.js.map +1 -0
  205. package/dist/reachability/request.js.map +1 -1
  206. package/dist/reachability/util.js.map +1 -1
  207. package/dist/reactions/constants.js.map +1 -1
  208. package/dist/reactions/reactions.js.map +1 -1
  209. package/dist/reactions/reactions.type.js.map +1 -1
  210. package/dist/reconnection-manager/index.js +178 -176
  211. package/dist/reconnection-manager/index.js.map +1 -1
  212. package/dist/recording-controller/enums.js.map +1 -1
  213. package/dist/recording-controller/index.js +1 -2
  214. package/dist/recording-controller/index.js.map +1 -1
  215. package/dist/recording-controller/util.js.map +1 -1
  216. package/dist/roap/index.js +12 -15
  217. package/dist/roap/index.js.map +1 -1
  218. package/dist/roap/request.js +24 -26
  219. package/dist/roap/request.js.map +1 -1
  220. package/dist/roap/turnDiscovery.js +75 -76
  221. package/dist/roap/turnDiscovery.js.map +1 -1
  222. package/dist/roap/types.js.map +1 -1
  223. package/dist/transcription/index.js +4 -5
  224. package/dist/transcription/index.js.map +1 -1
  225. package/dist/types/common/errors/webex-errors.d.ts +12 -0
  226. package/dist/types/config.d.ts +1 -0
  227. package/dist/types/constants.d.ts +27 -21
  228. package/dist/types/hashTree/constants.d.ts +8 -0
  229. package/dist/types/hashTree/hashTree.d.ts +129 -0
  230. package/dist/types/hashTree/hashTreeParser.d.ts +250 -0
  231. package/dist/types/hashTree/types.d.ts +33 -0
  232. package/dist/types/hashTree/utils.d.ts +16 -0
  233. package/dist/types/index.d.ts +2 -1
  234. package/dist/types/interceptors/locusRouteToken.d.ts +2 -0
  235. package/dist/types/locus-info/index.d.ts +98 -80
  236. package/dist/types/locus-info/types.d.ts +54 -0
  237. package/dist/types/meeting/index.d.ts +35 -9
  238. package/dist/types/meetings/index.d.ts +9 -2
  239. package/dist/types/metrics/constants.d.ts +3 -0
  240. package/dist/types/reachability/clusterReachability.d.ts +33 -84
  241. package/dist/types/reachability/reachability.types.d.ts +12 -1
  242. package/dist/types/reachability/reachabilityPeerConnection.d.ts +111 -0
  243. package/dist/webinar/collection.js +1 -2
  244. package/dist/webinar/collection.js.map +1 -1
  245. package/dist/webinar/index.js +148 -158
  246. package/dist/webinar/index.js.map +1 -1
  247. package/package.json +24 -23
  248. package/src/common/errors/webex-errors.ts +19 -0
  249. package/src/config.ts +1 -0
  250. package/src/constants.ts +15 -2
  251. package/src/hashTree/constants.ts +9 -0
  252. package/src/hashTree/hashTree.ts +463 -0
  253. package/src/hashTree/hashTreeParser.ts +1143 -0
  254. package/src/hashTree/types.ts +39 -0
  255. package/src/hashTree/utils.ts +53 -0
  256. package/src/index.ts +2 -0
  257. package/src/interceptors/locusRouteToken.ts +22 -5
  258. package/src/locus-info/controlsUtils.ts +6 -0
  259. package/src/locus-info/index.ts +641 -164
  260. package/src/locus-info/types.ts +53 -0
  261. package/src/media/index.ts +6 -0
  262. package/src/meeting/index.ts +137 -28
  263. package/src/meeting/util.ts +1 -0
  264. package/src/meetings/index.ts +119 -59
  265. package/src/meetings/util.ts +10 -9
  266. package/src/metrics/constants.ts +3 -0
  267. package/src/reachability/clusterReachability.ts +159 -330
  268. package/src/reachability/index.ts +6 -1
  269. package/src/reachability/reachability.types.ts +15 -1
  270. package/src/reachability/reachabilityPeerConnection.ts +418 -0
  271. package/test/unit/spec/hashTree/hashTree.ts +655 -0
  272. package/test/unit/spec/hashTree/hashTreeParser.ts +1524 -0
  273. package/test/unit/spec/hashTree/utils.ts +140 -0
  274. package/test/unit/spec/interceptors/locusRouteToken.ts +44 -0
  275. package/test/unit/spec/locus-info/controlsUtils.js +27 -1
  276. package/test/unit/spec/locus-info/index.js +879 -16
  277. package/test/unit/spec/media/index.ts +140 -9
  278. package/test/unit/spec/meeting/index.js +299 -94
  279. package/test/unit/spec/meeting/utils.js +78 -1
  280. package/test/unit/spec/meetings/index.js +263 -29
  281. package/test/unit/spec/meetings/utils.js +51 -1
  282. package/test/unit/spec/reachability/clusterReachability.ts +404 -137
  283. package/test/unit/spec/reachability/index.ts +3 -3
@@ -990,7 +990,7 @@ describe('plugin-meetings', () => {
990
990
  {functionName: 'showAutoEndMeetingWarning', displayHint: 'SHOW_AUTO_END_MEETING_WARNING'},
991
991
  ].forEach(({functionName, displayHint}) => {
992
992
  describe(functionName, () => {
993
- it.only('works as expected', () => {
993
+ it('works as expected', () => {
994
994
  assert.deepEqual(MeetingUtil[functionName]([displayHint]), true);
995
995
  assert.deepEqual(MeetingUtil[functionName]([]), false);
996
996
  });
@@ -1433,5 +1433,82 @@ describe('plugin-meetings', () => {
1433
1433
  });
1434
1434
  });
1435
1435
  });
1436
+
1437
+ describe('#parseLocusJoin', () => {
1438
+ let response;
1439
+
1440
+ beforeEach(() => {
1441
+ response = {
1442
+ body: {
1443
+ locus: {
1444
+ url: 'https://locus-a.wbx2.com/locus/api/v1/loci/12345',
1445
+ self: {
1446
+ id: 'selfId123',
1447
+ },
1448
+ },
1449
+ dataSets: [{name: 'dataset1', url: 'http://dataset.com'}],
1450
+ mediaConnections: [
1451
+ {mediaId: 'mediaId456'},
1452
+ {someOtherField: 'value'},
1453
+ ],
1454
+ },
1455
+ };
1456
+ });
1457
+
1458
+ it('works as expected', () => {
1459
+ const result = MeetingUtil.parseLocusJoin(response);
1460
+
1461
+ assert.deepEqual(result, {
1462
+ locus: response.body.locus,
1463
+ dataSets: response.body.dataSets,
1464
+ mediaConnections: response.body.mediaConnections,
1465
+ locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/12345',
1466
+ locusId: '12345',
1467
+ selfId: 'selfId123',
1468
+ mediaId: 'mediaId456',
1469
+ });
1470
+ });
1471
+
1472
+ it('extracts mediaId from the last mediaConnection that has it', () => {
1473
+ response.body.mediaConnections = [
1474
+ {someField: 'noMediaId'},
1475
+ {mediaId: 'firstMediaId'},
1476
+ {mediaId: 'secondMediaId'},
1477
+ ];
1478
+
1479
+ const result = MeetingUtil.parseLocusJoin(response);
1480
+
1481
+ // Note: the implementation uses forEach which doesn't break,
1482
+ // so it will use the last mediaId found, not the first
1483
+ assert.equal(result.mediaId, 'secondMediaId');
1484
+ });
1485
+
1486
+ it('handles empty mediaConnections array', () => {
1487
+ response.body.mediaConnections = [];
1488
+
1489
+ const result = MeetingUtil.parseLocusJoin(response);
1490
+
1491
+ assert.deepEqual(result, {
1492
+ locus: response.body.locus,
1493
+ dataSets: response.body.dataSets,
1494
+ mediaConnections: [],
1495
+ locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/12345',
1496
+ locusId: '12345',
1497
+ selfId: 'selfId123',
1498
+ });
1499
+ assert.isUndefined(result.mediaId);
1500
+ });
1501
+
1502
+ it('handles mediaConnections without mediaId', () => {
1503
+ response.body.mediaConnections = [
1504
+ {someField: 'value1'},
1505
+ {anotherField: 'value2'},
1506
+ ];
1507
+
1508
+ const result = MeetingUtil.parseLocusJoin(response);
1509
+
1510
+ assert.isUndefined(result.mediaId);
1511
+ });
1512
+ });
1436
1513
  });
1437
1514
  });
@@ -690,11 +690,9 @@ describe('plugin-meetings', () => {
690
690
  assert.deepEqual(result.options, {
691
691
  mode: 'BLUR',
692
692
  blurStrength: 'STRONG',
693
- generator: 'worker',
694
693
  quality: 'LOW',
695
694
  authToken: 'fake_token',
696
695
  mirror: false,
697
- canvasResolutionScaling: 1,
698
696
  });
699
697
  assert.exists(result.enable);
700
698
  assert.exists(result.disable);
@@ -916,7 +914,11 @@ describe('plugin-meetings', () => {
916
914
  'LOCUS_ID'
917
915
  );
918
916
  assert.calledWith(initialSetup, {
919
- url: url1,
917
+ trigger: 'get-loci-response',
918
+ locus: {
919
+ url: url1,
920
+ },
921
+ hashTreeMessage: undefined
920
922
  });
921
923
  });
922
924
  });
@@ -1417,21 +1419,53 @@ describe('plugin-meetings', () => {
1417
1419
  );
1418
1420
  assert.calledOnce(initialSetup);
1419
1421
  assert.calledWith(initialSetup, {
1420
- id: uuid1,
1421
- replaces: [
1422
- {
1423
- locusUrl: 'http:locusUrl',
1422
+ trigger: 'locus-message',
1423
+ locus: {
1424
+ id: uuid1,
1425
+ replaces: [
1426
+ {
1427
+ locusUrl: 'http:locusUrl',
1428
+ },
1429
+ ],
1430
+ self: {
1431
+ callBackInfo: {
1432
+ callbackAddress: uri1,
1433
+ },
1434
+ devices: [],
1424
1435
  },
1425
- ],
1426
- self: {
1427
- callBackInfo: {
1428
- callbackAddress: uri1,
1436
+ info: {
1437
+ webExMeetingId,
1429
1438
  },
1430
- devices: [],
1431
1439
  },
1440
+ hashTreeMessage: undefined
1441
+ });
1442
+ });
1443
+ it('should setup the meeting from a hash tree event', async () => {
1444
+ const locus = {
1445
+ id: uuid1,
1446
+ self: {},
1432
1447
  info: {
1433
1448
  webExMeetingId,
1434
1449
  },
1450
+ };
1451
+ const hashTreeMessage = {something: 'hashTreeData'};
1452
+ await webex.meetings.handleLocusEvent({
1453
+ locus,
1454
+ eventType: 'locus.state_message',
1455
+ locusUrl: url1,
1456
+ stateElementsMessage: hashTreeMessage,
1457
+ });
1458
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1459
+ assert.calledWith(
1460
+ webex.meetings.meetingCollection.getByKey,
1461
+ 'meetingNumber',
1462
+ webExMeetingId
1463
+ );
1464
+ assert.calledOnce(initialSetup);
1465
+ assert.calledWith(initialSetup, {
1466
+ trigger: 'locus-message',
1467
+ locus,
1468
+ hashTreeMessage,
1435
1469
  });
1436
1470
  });
1437
1471
  it('should setup the meeting by difference event without replaces', async () => {
@@ -1460,16 +1494,20 @@ describe('plugin-meetings', () => {
1460
1494
  );
1461
1495
  assert.calledOnce(initialSetup);
1462
1496
  assert.calledWith(initialSetup, {
1463
- id: uuid1,
1464
- self: {
1465
- callBackInfo: {
1466
- callbackAddress: uri1,
1497
+ trigger: 'locus-message',
1498
+ locus: {
1499
+ id: uuid1,
1500
+ self: {
1501
+ callBackInfo: {
1502
+ callbackAddress: uri1,
1503
+ },
1504
+ devices: [],
1505
+ },
1506
+ info: {
1507
+ webExMeetingId,
1467
1508
  },
1468
- devices: [],
1469
- },
1470
- info: {
1471
- webExMeetingId,
1472
1509
  },
1510
+ hashTreeMessage: undefined
1473
1511
  });
1474
1512
  });
1475
1513
 
@@ -1532,16 +1570,20 @@ describe('plugin-meetings', () => {
1532
1570
  );
1533
1571
  assert.calledOnce(initialSetup);
1534
1572
  assert.calledWith(initialSetup, {
1535
- id: uuid1,
1536
- self: {
1537
- callBackInfo: {
1538
- callbackAddress: uri1,
1573
+ trigger: 'locus-message',
1574
+ locus: {
1575
+ id: uuid1,
1576
+ self: {
1577
+ callBackInfo: {
1578
+ callbackAddress: uri1,
1579
+ },
1580
+ devices: [],
1581
+ },
1582
+ info: {
1583
+ webExMeetingId,
1539
1584
  },
1540
- devices: [],
1541
- },
1542
- info: {
1543
- webExMeetingId,
1544
1585
  },
1586
+ hashTreeMessage: undefined
1545
1587
  });
1546
1588
  });
1547
1589
 
@@ -2869,7 +2911,7 @@ describe('plugin-meetings', () => {
2869
2911
  conversationUrl: 'conversationUrl1',
2870
2912
  };
2871
2913
 
2872
- sinon.stub(MeetingsUtil, 'checkForCorrelationId').returns('correlationId1');
2914
+ sinon.stub(MeetingsUtil, 'getCorrelationIdForDevice').returns('correlationId1');
2873
2915
  });
2874
2916
  afterEach(() => {
2875
2917
  sinon.restore();
@@ -2975,6 +3017,197 @@ describe('plugin-meetings', () => {
2975
3017
  );
2976
3018
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', '123456');
2977
3019
  });
3020
+
3021
+ describe('when receiving hash tree events', () => {
3022
+ let hashTreeEvent;
3023
+
3024
+ beforeEach(() => {
3025
+ MeetingsUtil.getCorrelationIdForDevice.restore();
3026
+ sinon.spy(MeetingsUtil, 'getCorrelationIdForDevice');
3027
+
3028
+ hashTreeEvent = {
3029
+ eventType: 'locus.state_message',
3030
+ stateElementsMessage: {
3031
+ locusUrl: url1,
3032
+ locusStateElements: [
3033
+ {
3034
+ htMeta: {
3035
+ elementId: {
3036
+ type: 'participant',
3037
+ id: 2,
3038
+ version: 1,
3039
+ },
3040
+ dataSetNames: ['main'],
3041
+ },
3042
+ data: {
3043
+ id: 'participant1',
3044
+ },
3045
+ },
3046
+ {
3047
+ htMeta: {
3048
+ elementId: {
3049
+ type: 'Self',
3050
+ id: 1,
3051
+ version: 1,
3052
+ },
3053
+ dataSetNames: ['self'],
3054
+ },
3055
+ data: {
3056
+ callbackInfo: {
3057
+ callbackAddress: 'address1',
3058
+ },
3059
+ devices: [
3060
+ {
3061
+ url: 'deviceUrl',
3062
+ correlationId: 'correlationId1',
3063
+ },
3064
+ ],
3065
+ },
3066
+ },
3067
+ ],
3068
+ },
3069
+ };
3070
+
3071
+ webex.internal.device.url = 'deviceUrl';
3072
+ });
3073
+
3074
+ it('should find meeting by locusUrl from stateElementsMessage', () => {
3075
+ mockGetByKey('locusUrl');
3076
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3077
+ assert.deepEqual(result, mockReturnMeeting);
3078
+ assert.calledOnceWithExactly(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3079
+ });
3080
+
3081
+ it('should extract self data from locusStateElements and try correlationId when locusUrl not found', () => {
3082
+ mockGetByKey('correlationId');
3083
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3084
+ assert.deepEqual(result, mockReturnMeeting);
3085
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 2);
3086
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3087
+ assert.calledWith(
3088
+ webex.meetings.meetingCollection.getByKey,
3089
+ 'correlationId',
3090
+ 'correlationId1'
3091
+ );
3092
+ assert.calledOnceWithExactly(
3093
+ MeetingsUtil.getCorrelationIdForDevice,
3094
+ 'deviceUrl',
3095
+ hashTreeEvent.stateElementsMessage.locusStateElements[1].data
3096
+ );
3097
+ });
3098
+
3099
+ it('should extract self data from locusStateElements and try sipUri when locusUrl and correlationId not found', () => {
3100
+ mockGetByKey('sipUri');
3101
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3102
+ assert.deepEqual(result, mockReturnMeeting);
3103
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 3);
3104
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3105
+ assert.calledWith(
3106
+ webex.meetings.meetingCollection.getByKey,
3107
+ 'correlationId',
3108
+ 'correlationId1'
3109
+ );
3110
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
3111
+ });
3112
+
3113
+ it('should try all keys when no meeting found', () => {
3114
+ mockGetByKey();
3115
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3116
+ assert.isNull(result);
3117
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
3118
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3119
+ assert.calledWith(
3120
+ webex.meetings.meetingCollection.getByKey,
3121
+ 'correlationId',
3122
+ 'correlationId1'
3123
+ );
3124
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
3125
+ // these remaining 2 will never work for hash trees, but just checking that
3126
+ // the calls are made and we don't crash
3127
+ assert.calledWith(
3128
+ webex.meetings.meetingCollection.getByKey,
3129
+ 'conversationUrl',
3130
+ undefined
3131
+ );
3132
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', undefined);
3133
+ });
3134
+
3135
+ it('should handle hash tree event with no self object', () => {
3136
+ mockGetByKey();
3137
+ hashTreeEvent.stateElementsMessage.locusStateElements = [
3138
+ {
3139
+ htMeta: {
3140
+ elementId: {
3141
+ type: 'participant',
3142
+ id: 2,
3143
+ version: 1,
3144
+ },
3145
+ dataSetNames: ['dataset1'],
3146
+ },
3147
+ data: {
3148
+ id: 'participant1',
3149
+ },
3150
+ },
3151
+ ];
3152
+
3153
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3154
+ assert.isNull(result);
3155
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
3156
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3157
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', false);
3158
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', undefined);
3159
+ // these remaining 2 will never work for hash trees, but just checking that
3160
+ // the calls are made and we don't crash
3161
+ assert.calledWith(
3162
+ webex.meetings.meetingCollection.getByKey,
3163
+ 'conversationUrl',
3164
+ undefined
3165
+ );
3166
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', undefined);
3167
+ });
3168
+
3169
+ it('should handle hash tree event with empty locusStateElements', () => {
3170
+ mockGetByKey();
3171
+ hashTreeEvent.stateElementsMessage.locusStateElements = [];
3172
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3173
+ assert.isNull(result);
3174
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
3175
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3176
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', false);
3177
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', undefined);
3178
+ // these remaining 2 will never work for hash trees, but just checking that
3179
+ // the calls are made and we don't crash
3180
+ assert.calledWith(
3181
+ webex.meetings.meetingCollection.getByKey,
3182
+ 'conversationUrl',
3183
+ undefined
3184
+ );
3185
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', undefined);
3186
+ });
3187
+
3188
+ it('should handle hash tree event with self object but no callbackAddress', () => {
3189
+ mockGetByKey('meetingNumber');
3190
+ delete hashTreeEvent.stateElementsMessage.locusStateElements[1].data.callbackInfo;
3191
+ const result = webex.meetings.getCorrespondingMeetingByLocus(hashTreeEvent);
3192
+ assert.deepEqual(result, mockReturnMeeting);
3193
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
3194
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
3195
+ assert.calledWith(
3196
+ webex.meetings.meetingCollection.getByKey,
3197
+ 'correlationId',
3198
+ 'correlationId1'
3199
+ );
3200
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', undefined);
3201
+ // these remaining 2 will never work for hash trees, but just checking that
3202
+ // the calls are made and we don't crash
3203
+ assert.calledWith(
3204
+ webex.meetings.meetingCollection.getByKey,
3205
+ 'conversationUrl',
3206
+ undefined
3207
+ );
3208
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', undefined);
3209
+ });
3210
+ });
2978
3211
  });
2979
3212
 
2980
3213
  describe('#sortLocusArrayToUpdate', () => {
@@ -3089,6 +3322,7 @@ describe('plugin-meetings', () => {
3089
3322
  },
3090
3323
  });
3091
3324
  assert.calledWith(webex.meetings.handleLocusEvent, {
3325
+ eventType: LOCUSEVENT.SDK_NO_EVENT,
3092
3326
  locus: breakoutLocus,
3093
3327
  locusUrl: breakoutLocus.url,
3094
3328
  });
@@ -299,5 +299,55 @@ describe('plugin-meetings', () => {
299
299
  const sdp2 = 'v=0\r\no=HOMER 0 1 IN IP4 23.89.67.81\r\ns=-\r\nc=IN IP4 23.89.67.81\r\nb=TIAS:128000\r\nt=0 0\r\na=ice-lite\r\n'
300
300
  assert.equal(MeetingsUtil.getMediaServer(sdp2), 'homer');
301
301
  });
302
- })
302
+ });
303
+
304
+ describe('#getCorrelationIdForDevice', () => {
305
+ it('should return correlationId if device with matching url is found', () => {
306
+ const locusSelf = {
307
+ devices: [
308
+ {url: 'deviceUrl1', correlationId: 'correlationId1'},
309
+ {url: 'deviceUrl2', correlationId: 'correlationId2'},
310
+ ],
311
+ };
312
+
313
+ const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', locusSelf);
314
+ assert.equal(correlationId, 'correlationId1');
315
+ });
316
+
317
+ it('should return false if no device with matching url is found', () => {
318
+ const locusSelf = {
319
+ devices: [
320
+ {url: 'deviceUrl1', correlationId: 'correlationId1'},
321
+ {url: 'deviceUrl2', correlationId: 'correlationId2'},
322
+ ],
323
+ };
324
+
325
+ const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl3', locusSelf);
326
+ assert.equal(correlationId, false);
327
+ });
328
+
329
+ it('should return false if device with matching url has no correlationId', () => {
330
+ const locusSelf = {
331
+ devices: [{url: 'deviceUrl1'}, {url: 'deviceUrl2', correlationId: 'correlationId2'}],
332
+ };
333
+
334
+ const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', locusSelf);
335
+ assert.equal(correlationId, false);
336
+ });
337
+
338
+ it('should return false if locusSelf has no devices', () => {
339
+ const locusSelf = {};
340
+
341
+ const correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', locusSelf);
342
+ assert.equal(correlationId, false);
343
+ });
344
+
345
+ it('should return false if locusSelf is null or undefined', () => {
346
+ let correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', null);
347
+ assert.equal(correlationId, false);
348
+
349
+ correlationId = MeetingsUtil.getCorrelationIdForDevice('deviceUrl1', undefined);
350
+ assert.equal(correlationId, false);
351
+ });
352
+ });
303
353
  });