@webex/plugin-meetings 3.7.0 → 3.8.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 (351) hide show
  1. package/dist/annotation/annotation.types.d.ts +42 -0
  2. package/dist/annotation/constants.d.ts +31 -0
  3. package/dist/annotation/index.d.ts +117 -0
  4. package/dist/annotation/index.js +17 -0
  5. package/dist/annotation/index.js.map +1 -1
  6. package/dist/breakouts/breakout.d.ts +8 -0
  7. package/dist/breakouts/breakout.js +1 -1
  8. package/dist/breakouts/collection.d.ts +5 -0
  9. package/dist/breakouts/edit-lock-error.d.ts +15 -0
  10. package/dist/breakouts/events.d.ts +8 -0
  11. package/dist/breakouts/index.d.ts +5 -0
  12. package/dist/breakouts/index.js +1 -1
  13. package/dist/breakouts/request.d.ts +22 -0
  14. package/dist/breakouts/utils.d.ts +15 -0
  15. package/dist/common/browser-detection.d.ts +9 -0
  16. package/dist/common/collection.d.ts +48 -0
  17. package/dist/common/config.d.ts +2 -0
  18. package/dist/common/errors/captcha-error.d.ts +15 -0
  19. package/dist/common/errors/intent-to-join.d.ts +16 -0
  20. package/dist/common/errors/join-forbidden-error.js +52 -0
  21. package/dist/common/errors/join-forbidden-error.js.map +1 -0
  22. package/dist/common/errors/join-meeting.d.ts +17 -0
  23. package/dist/common/errors/{webinar-registration-error.js → join-webinar-error.js} +12 -12
  24. package/dist/common/errors/join-webinar-error.js.map +1 -0
  25. package/dist/common/errors/media.d.ts +15 -0
  26. package/dist/common/errors/multistream-not-supported-error.js +53 -0
  27. package/dist/common/errors/multistream-not-supported-error.js.map +1 -0
  28. package/dist/common/errors/no-meeting-info.d.ts +14 -0
  29. package/dist/common/errors/parameter.d.ts +15 -0
  30. package/dist/common/errors/password-error.d.ts +15 -0
  31. package/dist/common/errors/permission.d.ts +14 -0
  32. package/dist/common/errors/reclaim-host-role-error.js +149 -0
  33. package/dist/common/errors/reclaim-host-role-error.js.map +1 -0
  34. package/dist/common/errors/reclaim-host-role-errors.d.ts +60 -0
  35. package/dist/common/errors/reconnection-in-progress.d.ts +9 -0
  36. package/dist/common/errors/reconnection-in-progress.js +33 -0
  37. package/dist/common/errors/reconnection-in-progress.js.map +1 -0
  38. package/dist/common/errors/reconnection.d.ts +15 -0
  39. package/dist/common/errors/stats.d.ts +15 -0
  40. package/dist/common/errors/webex-errors.d.ts +93 -0
  41. package/dist/common/errors/webex-meetings-error.d.ts +20 -0
  42. package/dist/common/events/events-scope.d.ts +17 -0
  43. package/dist/common/events/events.d.ts +12 -0
  44. package/dist/common/events/trigger-proxy.d.ts +2 -0
  45. package/dist/common/events/util.d.ts +2 -0
  46. package/dist/common/logs/logger-config.d.ts +2 -0
  47. package/dist/common/logs/logger-proxy.d.ts +2 -0
  48. package/dist/common/logs/request.d.ts +36 -0
  49. package/dist/common/queue.d.ts +34 -0
  50. package/dist/config.d.ts +72 -0
  51. package/dist/config.js +2 -1
  52. package/dist/config.js.map +1 -1
  53. package/dist/constants.d.ts +1088 -0
  54. package/dist/constants.js +68 -6
  55. package/dist/constants.js.map +1 -1
  56. package/dist/controls-options-manager/constants.d.ts +4 -0
  57. package/dist/controls-options-manager/enums.d.ts +15 -0
  58. package/dist/controls-options-manager/index.d.ts +136 -0
  59. package/dist/controls-options-manager/types.d.ts +43 -0
  60. package/dist/controls-options-manager/util.d.ts +1 -0
  61. package/dist/index.d.ts +7 -0
  62. package/dist/index.js +16 -11
  63. package/dist/index.js.map +1 -1
  64. package/dist/interceptors/index.d.ts +2 -0
  65. package/dist/interceptors/locusRetry.d.ts +27 -0
  66. package/dist/interpretation/collection.d.ts +5 -0
  67. package/dist/interpretation/index.d.ts +5 -0
  68. package/dist/interpretation/index.js +1 -1
  69. package/dist/interpretation/siLanguage.d.ts +5 -0
  70. package/dist/interpretation/siLanguage.js +1 -1
  71. package/dist/locus-info/controlsUtils.d.ts +2 -0
  72. package/dist/locus-info/embeddedAppsUtils.d.ts +2 -0
  73. package/dist/locus-info/fullState.d.ts +2 -0
  74. package/dist/locus-info/hostUtils.d.ts +2 -0
  75. package/dist/locus-info/index.d.ts +322 -0
  76. package/dist/locus-info/index.js +14 -3
  77. package/dist/locus-info/index.js.map +1 -1
  78. package/dist/locus-info/infoUtils.d.ts +2 -0
  79. package/dist/locus-info/mediaSharesUtils.d.ts +2 -0
  80. package/dist/locus-info/parser.d.ts +272 -0
  81. package/dist/locus-info/selfUtils.d.ts +2 -0
  82. package/dist/locus-info/selfUtils.js +35 -17
  83. package/dist/locus-info/selfUtils.js.map +1 -1
  84. package/dist/media/MediaConnectionAwaiter.js +1 -0
  85. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  86. package/dist/media/index.d.ts +34 -0
  87. package/dist/media/properties.d.ts +93 -0
  88. package/dist/media/properties.js +30 -16
  89. package/dist/media/properties.js.map +1 -1
  90. package/dist/media/util.d.ts +2 -0
  91. package/dist/mediaQualityMetrics/config.d.ts +241 -0
  92. package/dist/mediaQualityMetrics/config.js +502 -0
  93. package/dist/mediaQualityMetrics/config.js.map +1 -0
  94. package/dist/meeting/brbState.js +167 -0
  95. package/dist/meeting/brbState.js.map +1 -0
  96. package/dist/meeting/effectsState.js +260 -0
  97. package/dist/meeting/effectsState.js.map +1 -0
  98. package/dist/meeting/in-meeting-actions.d.ts +167 -0
  99. package/dist/meeting/in-meeting-actions.js +13 -1
  100. package/dist/meeting/in-meeting-actions.js.map +1 -1
  101. package/dist/meeting/index.d.ts +1825 -0
  102. package/dist/meeting/index.js +1331 -1051
  103. package/dist/meeting/index.js.map +1 -1
  104. package/dist/meeting/locusMediaRequest.d.ts +74 -0
  105. package/dist/meeting/locusMediaRequest.js +11 -6
  106. package/dist/meeting/locusMediaRequest.js.map +1 -1
  107. package/dist/meeting/muteState.d.ts +178 -0
  108. package/dist/meeting/muteState.js +1 -6
  109. package/dist/meeting/muteState.js.map +1 -1
  110. package/dist/meeting/request.d.ts +295 -0
  111. package/dist/meeting/request.js +51 -29
  112. package/dist/meeting/request.js.map +1 -1
  113. package/dist/meeting/request.type.d.ts +11 -0
  114. package/dist/meeting/request.type.js.map +1 -1
  115. package/dist/meeting/state.d.ts +9 -0
  116. package/dist/meeting/util.d.ts +119 -0
  117. package/dist/meeting/util.js +103 -67
  118. package/dist/meeting/util.js.map +1 -1
  119. package/dist/meeting/voicea-meeting.d.ts +16 -0
  120. package/dist/meeting-info/collection.d.ts +20 -0
  121. package/dist/meeting-info/index.d.ts +69 -0
  122. package/dist/meeting-info/meeting-info-v2.d.ts +123 -0
  123. package/dist/meeting-info/meeting-info-v2.js +115 -45
  124. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  125. package/dist/meeting-info/request.d.ts +22 -0
  126. package/dist/meeting-info/util.d.ts +2 -0
  127. package/dist/meeting-info/utilv2.d.ts +2 -0
  128. package/dist/meeting-info/utilv2.js +6 -2
  129. package/dist/meeting-info/utilv2.js.map +1 -1
  130. package/dist/meetings/collection.d.ts +40 -0
  131. package/dist/meetings/index.d.ts +390 -0
  132. package/dist/meetings/index.js +107 -55
  133. package/dist/meetings/index.js.map +1 -1
  134. package/dist/meetings/meetings.types.d.ts +4 -0
  135. package/dist/meetings/meetings.types.js +2 -0
  136. package/dist/meetings/meetings.types.js.map +1 -1
  137. package/dist/meetings/request.d.ts +27 -0
  138. package/dist/meetings/util.d.ts +18 -0
  139. package/dist/meetings/util.js +1 -1
  140. package/dist/meetings/util.js.map +1 -1
  141. package/dist/member/index.d.ts +160 -0
  142. package/dist/member/index.js +9 -0
  143. package/dist/member/index.js.map +1 -1
  144. package/dist/member/member.types.js +17 -0
  145. package/dist/member/member.types.js.map +1 -0
  146. package/dist/member/types.d.ts +32 -0
  147. package/dist/member/types.js.map +1 -1
  148. package/dist/member/util.d.ts +2 -0
  149. package/dist/member/util.js +39 -28
  150. package/dist/member/util.js.map +1 -1
  151. package/dist/members/collection.d.ts +29 -0
  152. package/dist/members/index.d.ts +353 -0
  153. package/dist/members/request.d.ts +114 -0
  154. package/dist/members/types.d.ts +25 -0
  155. package/dist/members/util.d.ts +215 -0
  156. package/dist/members/util.js +4 -2
  157. package/dist/members/util.js.map +1 -1
  158. package/dist/metrics/config.js +276 -0
  159. package/dist/metrics/config.js.map +1 -0
  160. package/dist/metrics/constants.d.ts +70 -0
  161. package/dist/metrics/constants.js +6 -1
  162. package/dist/metrics/constants.js.map +1 -1
  163. package/dist/metrics/index.d.ts +45 -0
  164. package/dist/multistream/mediaRequestManager.d.ts +119 -0
  165. package/dist/multistream/receiveSlot.d.ts +68 -0
  166. package/dist/multistream/receiveSlotManager.d.ts +56 -0
  167. package/dist/multistream/remoteMedia.d.ts +72 -0
  168. package/dist/multistream/remoteMedia.js +30 -15
  169. package/dist/multistream/remoteMedia.js.map +1 -1
  170. package/dist/multistream/remoteMediaGroup.d.ts +49 -0
  171. package/dist/multistream/remoteMediaManager.d.ts +300 -0
  172. package/dist/multistream/sendSlotManager.d.ts +69 -0
  173. package/dist/multistream/sendSlotManager.js +24 -0
  174. package/dist/multistream/sendSlotManager.js.map +1 -1
  175. package/dist/networkQualityMonitor/index.d.ts +70 -0
  176. package/dist/networkQualityMonitor/index.js +13 -19
  177. package/dist/networkQualityMonitor/index.js.map +1 -1
  178. package/dist/peer-connection-manager/index.js +671 -0
  179. package/dist/peer-connection-manager/index.js.map +1 -0
  180. package/dist/peer-connection-manager/util.js +109 -0
  181. package/dist/peer-connection-manager/util.js.map +1 -0
  182. package/dist/personal-meeting-room/index.d.ts +47 -0
  183. package/dist/personal-meeting-room/request.d.ts +14 -0
  184. package/dist/personal-meeting-room/util.d.ts +2 -0
  185. package/dist/reachability/clusterReachability.d.ts +109 -0
  186. package/dist/reachability/clusterReachability.js +12 -15
  187. package/dist/reachability/clusterReachability.js.map +1 -1
  188. package/dist/reachability/index.d.ts +105 -0
  189. package/dist/reachability/index.js +461 -136
  190. package/dist/reachability/index.js.map +1 -1
  191. package/dist/reachability/reachability.types.js +7 -0
  192. package/dist/reachability/reachability.types.js.map +1 -0
  193. package/dist/reachability/request.d.ts +39 -0
  194. package/dist/reachability/request.js +21 -8
  195. package/dist/reachability/request.js.map +1 -1
  196. package/dist/reachability/util.d.ts +8 -0
  197. package/dist/reactions/constants.d.ts +3 -0
  198. package/dist/reactions/reactions.d.ts +4 -0
  199. package/dist/reactions/reactions.type.d.ts +52 -0
  200. package/dist/reconnection-manager/index.d.ts +136 -0
  201. package/dist/recording-controller/enums.d.ts +7 -0
  202. package/dist/recording-controller/enums.js +8 -4
  203. package/dist/recording-controller/enums.js.map +1 -1
  204. package/dist/recording-controller/index.d.ts +207 -0
  205. package/dist/recording-controller/index.js +18 -9
  206. package/dist/recording-controller/index.js.map +1 -1
  207. package/dist/recording-controller/util.d.ts +14 -0
  208. package/dist/recording-controller/util.js +13 -9
  209. package/dist/recording-controller/util.js.map +1 -1
  210. package/dist/roap/collection.js +62 -0
  211. package/dist/roap/collection.js.map +1 -0
  212. package/dist/roap/handler.js +275 -0
  213. package/dist/roap/handler.js.map +1 -0
  214. package/dist/roap/index.d.ts +86 -0
  215. package/dist/roap/index.js +15 -15
  216. package/dist/roap/index.js.map +1 -1
  217. package/dist/roap/request.d.ts +39 -0
  218. package/dist/roap/request.js +45 -79
  219. package/dist/roap/request.js.map +1 -1
  220. package/dist/roap/state.js +126 -0
  221. package/dist/roap/state.js.map +1 -0
  222. package/dist/roap/turnDiscovery.d.ts +155 -0
  223. package/dist/roap/turnDiscovery.js +3 -6
  224. package/dist/roap/turnDiscovery.js.map +1 -1
  225. package/dist/roap/util.js +75 -0
  226. package/dist/roap/util.js.map +1 -0
  227. package/dist/rtcMetrics/constants.d.ts +4 -0
  228. package/dist/rtcMetrics/index.d.ts +61 -0
  229. package/dist/statsAnalyzer/global.d.ts +36 -0
  230. package/dist/statsAnalyzer/global.js +126 -0
  231. package/dist/statsAnalyzer/global.js.map +1 -0
  232. package/dist/statsAnalyzer/index.d.ts +217 -0
  233. package/dist/statsAnalyzer/index.js +1013 -0
  234. package/dist/statsAnalyzer/index.js.map +1 -0
  235. package/dist/statsAnalyzer/mqaUtil.d.ts +48 -0
  236. package/dist/statsAnalyzer/mqaUtil.js +179 -0
  237. package/dist/statsAnalyzer/mqaUtil.js.map +1 -0
  238. package/dist/transcription/index.d.ts +64 -0
  239. package/dist/types/annotation/index.d.ts +5 -0
  240. package/dist/types/common/errors/join-forbidden-error.d.ts +15 -0
  241. package/dist/types/common/errors/{webinar-registration-error.d.ts → join-webinar-error.d.ts} +2 -2
  242. package/dist/types/common/errors/multistream-not-supported-error.d.ts +17 -0
  243. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  244. package/dist/types/config.d.ts +1 -0
  245. package/dist/types/constants.d.ts +53 -1
  246. package/dist/types/index.d.ts +3 -3
  247. package/dist/types/locus-info/index.d.ts +2 -1
  248. package/dist/types/mediaQualityMetrics/config.d.ts +241 -0
  249. package/dist/types/meeting/brbState.d.ts +54 -0
  250. package/dist/types/meeting/in-meeting-actions.d.ts +12 -0
  251. package/dist/types/meeting/index.d.ts +64 -14
  252. package/dist/types/meeting/locusMediaRequest.d.ts +6 -3
  253. package/dist/types/meeting/request.d.ts +14 -3
  254. package/dist/types/meeting/request.type.d.ts +6 -0
  255. package/dist/types/meeting/util.d.ts +3 -3
  256. package/dist/types/meeting-info/meeting-info-v2.d.ts +30 -5
  257. package/dist/types/meetings/index.d.ts +20 -2
  258. package/dist/types/meetings/meetings.types.d.ts +8 -0
  259. package/dist/types/member/index.d.ts +1 -0
  260. package/dist/types/member/types.d.ts +7 -0
  261. package/dist/types/members/util.d.ts +2 -0
  262. package/dist/types/metrics/constants.d.ts +6 -1
  263. package/dist/types/multistream/sendSlotManager.d.ts +8 -1
  264. package/dist/types/reachability/clusterReachability.d.ts +1 -10
  265. package/dist/types/reachability/index.d.ts +83 -36
  266. package/dist/types/reachability/reachability.types.d.ts +64 -0
  267. package/dist/types/reachability/request.d.ts +5 -1
  268. package/dist/types/recording-controller/enums.d.ts +5 -2
  269. package/dist/types/recording-controller/index.d.ts +1 -0
  270. package/dist/types/recording-controller/util.d.ts +2 -1
  271. package/dist/types/roap/request.d.ts +1 -13
  272. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  273. package/dist/types/statsAnalyzer/index.d.ts +217 -0
  274. package/dist/types/statsAnalyzer/mqaUtil.d.ts +48 -0
  275. package/dist/webinar/collection.d.ts +16 -0
  276. package/dist/webinar/index.d.ts +5 -0
  277. package/dist/webinar/index.js +390 -7
  278. package/dist/webinar/index.js.map +1 -1
  279. package/package.json +23 -22
  280. package/src/annotation/index.ts +16 -0
  281. package/src/common/errors/join-forbidden-error.ts +26 -0
  282. package/src/common/errors/join-webinar-error.ts +24 -0
  283. package/src/common/errors/multistream-not-supported-error.ts +30 -0
  284. package/src/config.ts +1 -0
  285. package/src/constants.ts +61 -3
  286. package/src/index.ts +5 -3
  287. package/src/locus-info/index.ts +20 -3
  288. package/src/locus-info/selfUtils.ts +24 -6
  289. package/src/media/MediaConnectionAwaiter.ts +2 -0
  290. package/src/media/properties.ts +34 -13
  291. package/src/meeting/brbState.ts +169 -0
  292. package/src/meeting/in-meeting-actions.ts +25 -0
  293. package/src/meeting/index.ts +443 -87
  294. package/src/meeting/locusMediaRequest.ts +11 -8
  295. package/src/meeting/muteState.ts +1 -6
  296. package/src/meeting/request.ts +30 -12
  297. package/src/meeting/request.type.ts +7 -0
  298. package/src/meeting/util.ts +32 -13
  299. package/src/meeting-info/meeting-info-v2.ts +83 -12
  300. package/src/meeting-info/utilv2.ts +17 -3
  301. package/src/meetings/index.ts +79 -20
  302. package/src/meetings/meetings.types.ts +10 -0
  303. package/src/meetings/util.ts +2 -1
  304. package/src/member/index.ts +9 -0
  305. package/src/member/types.ts +8 -0
  306. package/src/member/util.ts +34 -24
  307. package/src/members/util.ts +1 -0
  308. package/src/metrics/constants.ts +6 -1
  309. package/src/multistream/remoteMedia.ts +28 -15
  310. package/src/multistream/sendSlotManager.ts +31 -0
  311. package/src/reachability/clusterReachability.ts +5 -15
  312. package/src/reachability/index.ts +311 -75
  313. package/src/reachability/reachability.types.ts +85 -0
  314. package/src/reachability/request.ts +55 -31
  315. package/src/recording-controller/enums.ts +5 -2
  316. package/src/recording-controller/index.ts +17 -4
  317. package/src/recording-controller/util.ts +20 -5
  318. package/src/roap/index.ts +14 -13
  319. package/src/roap/request.ts +30 -44
  320. package/src/roap/turnDiscovery.ts +2 -4
  321. package/src/webinar/index.ts +235 -9
  322. package/test/unit/spec/annotation/index.ts +46 -1
  323. package/test/unit/spec/locus-info/index.js +292 -60
  324. package/test/unit/spec/locus-info/selfConstant.js +7 -0
  325. package/test/unit/spec/locus-info/selfUtils.js +101 -1
  326. package/test/unit/spec/media/properties.ts +15 -0
  327. package/test/unit/spec/meeting/brbState.ts +114 -0
  328. package/test/unit/spec/meeting/in-meeting-actions.ts +15 -1
  329. package/test/unit/spec/meeting/index.js +851 -107
  330. package/test/unit/spec/meeting/locusMediaRequest.ts +18 -11
  331. package/test/unit/spec/meeting/muteState.js +0 -24
  332. package/test/unit/spec/meeting/request.js +3 -26
  333. package/test/unit/spec/meeting/utils.js +73 -28
  334. package/test/unit/spec/meeting-info/meetinginfov2.js +46 -4
  335. package/test/unit/spec/meeting-info/utilv2.js +26 -0
  336. package/test/unit/spec/meetings/index.js +159 -18
  337. package/test/unit/spec/meetings/utils.js +10 -0
  338. package/test/unit/spec/member/util.js +52 -11
  339. package/test/unit/spec/members/utils.js +95 -0
  340. package/test/unit/spec/multistream/remoteMedia.ts +11 -7
  341. package/test/unit/spec/reachability/clusterReachability.ts +7 -0
  342. package/test/unit/spec/reachability/index.ts +383 -9
  343. package/test/unit/spec/reachability/request.js +48 -12
  344. package/test/unit/spec/recording-controller/index.js +61 -5
  345. package/test/unit/spec/recording-controller/util.js +39 -3
  346. package/test/unit/spec/roap/index.ts +48 -1
  347. package/test/unit/spec/roap/request.ts +51 -109
  348. package/test/unit/spec/roap/turnDiscovery.ts +202 -147
  349. package/test/unit/spec/webinar/index.ts +504 -0
  350. package/dist/common/errors/webinar-registration-error.js.map +0 -1
  351. package/src/common/errors/webinar-registration-error.ts +0 -27
@@ -12,11 +12,11 @@ _Object$defineProperty(exports, "__esModule", {
12
12
  value: true
13
13
  });
14
14
  exports.default = void 0;
15
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
15
16
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
16
17
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
17
18
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
18
19
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
19
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
20
20
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
21
21
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
22
22
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
@@ -43,15 +43,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
43
43
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /*!
44
44
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
45
45
  */ /* eslint-disable class-methods-use-this */
46
- /**
47
- * This is the type that matches what backend expects us to send to them. It is a bit weird, because
48
- * it uses strings instead of booleans and numbers, but that's what they require.
49
- */
50
-
51
- // this is the type that is required by the backend when we send them reachability results
52
-
53
- // this is the type used by Reachability class internally and stored in local storage
54
-
55
46
  // timeouts in seconds
56
47
  var DEFAULT_TIMEOUT = 3;
57
48
  var VIDEO_MESH_TIMEOUT = 1;
@@ -77,6 +68,8 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
77
68
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webex", void 0);
78
69
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reachabilityRequest", void 0);
79
70
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clusterReachability", void 0);
71
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "minRequiredClusters", void 0);
72
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "orpheusApiVersion", void 0);
80
73
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reachabilityDefer", void 0);
81
74
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "vmnTimer", void 0);
82
75
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "publicCloudTimer", void 0);
@@ -101,6 +94,8 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
101
94
  xtls: 0
102
95
  }
103
96
  });
97
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "startTime", undefined);
98
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "totalDuration", undefined);
104
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastTrigger", void 0);
105
100
  _this.webex = webex;
106
101
 
@@ -118,6 +113,8 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
118
113
 
119
114
  /**
120
115
  * Fetches the list of media clusters from the backend
116
+ * @param {string} trigger - explains the reason for starting reachability, used by Orpheus
117
+ * @param {Object} previousReport - last reachability report
121
118
  * @param {boolean} isRetry
122
119
  * @private
123
120
  * @returns {Promise<{clusters: ClusterList, joinCookie: any}>}
@@ -125,45 +122,54 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
125
122
  (0, _createClass2.default)(Reachability, [{
126
123
  key: "getClusters",
127
124
  value: (function () {
128
- var _getClusters = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
125
+ var _getClusters = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(trigger, previousReport) {
129
126
  var isRetry,
130
127
  _yield$this$reachabil,
131
128
  clusters,
132
129
  joinCookie,
130
+ discoveryOptions,
133
131
  _args = arguments;
134
132
  return _regenerator.default.wrap(function _callee$(_context) {
135
133
  while (1) switch (_context.prev = _context.next) {
136
134
  case 0:
137
- isRetry = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;
135
+ isRetry = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
138
136
  _context.prev = 1;
139
137
  _context.next = 4;
140
- return this.reachabilityRequest.getClusters(_util.default.getIpVersion(this.webex));
138
+ return this.reachabilityRequest.getClusters(trigger, _util.default.getIpVersion(this.webex), previousReport);
141
139
  case 4:
142
140
  _yield$this$reachabil = _context.sent;
143
141
  clusters = _yield$this$reachabil.clusters;
144
142
  joinCookie = _yield$this$reachabil.joinCookie;
143
+ discoveryOptions = _yield$this$reachabil.discoveryOptions;
144
+ this.minRequiredClusters = discoveryOptions === null || discoveryOptions === void 0 ? void 0 : discoveryOptions['early-call-min-clusters'];
145
+ this.orpheusApiVersion = discoveryOptions === null || discoveryOptions === void 0 ? void 0 : discoveryOptions['report-version'];
146
+
147
+ // @ts-ignore
148
+ _context.next = 12;
149
+ return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageJoinCookie, (0, _stringify.default)(joinCookie));
150
+ case 12:
145
151
  return _context.abrupt("return", {
146
152
  clusters: clusters,
147
153
  joinCookie: joinCookie
148
154
  });
149
- case 10:
150
- _context.prev = 10;
155
+ case 15:
156
+ _context.prev = 15;
151
157
  _context.t0 = _context["catch"](1);
152
158
  if (!isRetry) {
153
- _context.next = 14;
159
+ _context.next = 19;
154
160
  break;
155
161
  }
156
162
  throw _context.t0;
157
- case 14:
163
+ case 19:
158
164
  _loggerProxy.default.logger.error("Reachability:index#getClusters --> Failed with error: ".concat(_context.t0, ", retrying..."));
159
- return _context.abrupt("return", this.getClusters(true));
160
- case 16:
165
+ return _context.abrupt("return", this.getClusters(trigger, previousReport, true));
166
+ case 21:
161
167
  case "end":
162
168
  return _context.stop();
163
169
  }
164
- }, _callee, this, [[1, 10]]);
170
+ }, _callee, this, [[1, 15]]);
165
171
  }));
166
- function getClusters() {
172
+ function getClusters(_x, _x2) {
167
173
  return _getClusters.apply(this, arguments);
168
174
  }
169
175
  return getClusters;
@@ -180,7 +186,7 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
180
186
  key: "gatherReachability",
181
187
  value: (function () {
182
188
  var _gatherReachability = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(trigger) {
183
- var _yield$this$getCluste, clusters, joinCookie;
189
+ var _yield$this$getCluste, clusters;
184
190
  return _regenerator.default.wrap(function _callee2$(_context2) {
185
191
  while (1) switch (_context2.prev = _context2.next) {
186
192
  case 0:
@@ -192,51 +198,213 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
192
198
  // @ts-ignore
193
199
  this.webex.internal.device.ipNetworkDetector.detect(true);
194
200
  _context2.next = 5;
195
- return this.getClusters();
201
+ return this.getClusters('startup');
196
202
  case 5:
197
203
  _yield$this$getCluste = _context2.sent;
198
204
  clusters = _yield$this$getCluste.clusters;
199
- joinCookie = _yield$this$getCluste.joinCookie;
200
- _context2.next = 10;
201
- return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageJoinCookie, (0, _stringify.default)(joinCookie));
202
- case 10:
203
205
  this.reachabilityDefer = new _common.Defer();
204
206
 
205
207
  // Perform Reachability Check
206
- _context2.next = 13;
208
+ _context2.next = 10;
207
209
  return this.performReachabilityChecks(clusters);
208
- case 13:
210
+ case 10:
209
211
  return _context2.abrupt("return", this.reachabilityDefer.promise);
210
- case 16:
211
- _context2.prev = 16;
212
+ case 13:
213
+ _context2.prev = 13;
212
214
  _context2.t0 = _context2["catch"](0);
213
215
  _loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error:", _context2.t0);
214
216
  return _context2.abrupt("return", {});
215
- case 20:
217
+ case 17:
216
218
  case "end":
217
219
  return _context2.stop();
218
220
  }
219
- }, _callee2, this, [[0, 16]]);
221
+ }, _callee2, this, [[0, 13]]);
220
222
  }));
221
- function gatherReachability(_x) {
223
+ function gatherReachability(_x3) {
222
224
  return _gatherReachability.apply(this, arguments);
223
225
  }
224
226
  return gatherReachability;
225
227
  }()
228
+ /**
229
+ * Gets the last join cookie we got from Orpheus
230
+ *
231
+ * @returns {Promise<Object>} join cookie
232
+ */
233
+ )
234
+ }, {
235
+ key: "getJoinCookie",
236
+ value: (function () {
237
+ var _getJoinCookie = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
238
+ var joinCookieRaw, joinCookie;
239
+ return _regenerator.default.wrap(function _callee3$(_context3) {
240
+ while (1) switch (_context3.prev = _context3.next) {
241
+ case 0:
242
+ _context3.next = 2;
243
+ return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageJoinCookie).catch(function () {});
244
+ case 2:
245
+ joinCookieRaw = _context3.sent;
246
+ if (joinCookieRaw) {
247
+ try {
248
+ joinCookie = JSON.parse(joinCookieRaw);
249
+ } catch (e) {
250
+ _loggerProxy.default.logger.error("MeetingRequest#constructor --> Error in parsing join cookie data: ".concat(e));
251
+ }
252
+ }
253
+ return _context3.abrupt("return", joinCookie);
254
+ case 5:
255
+ case "end":
256
+ return _context3.stop();
257
+ }
258
+ }, _callee3, this);
259
+ }));
260
+ function getJoinCookie() {
261
+ return _getJoinCookie.apply(this, arguments);
262
+ }
263
+ return getJoinCookie;
264
+ }()
265
+ /**
266
+ * Returns the reachability report that needs to be attached to the ROAP messages
267
+ * that we send to the backend.
268
+ *
269
+ * @returns {Promise<Object>}
270
+ */
271
+ )
272
+ }, {
273
+ key: "getReachabilityReport",
274
+ value: (function () {
275
+ var _getReachabilityReport = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
276
+ var reachabilityResult, joinCookie;
277
+ return _regenerator.default.wrap(function _callee4$(_context4) {
278
+ while (1) switch (_context4.prev = _context4.next) {
279
+ case 0:
280
+ _context4.next = 2;
281
+ return this.getReachabilityResults();
282
+ case 2:
283
+ reachabilityResult = _context4.sent;
284
+ _context4.next = 5;
285
+ return this.getJoinCookie();
286
+ case 5:
287
+ joinCookie = _context4.sent;
288
+ if (this.orpheusApiVersion) {
289
+ _context4.next = 8;
290
+ break;
291
+ }
292
+ return _context4.abrupt("return", {
293
+ reachability: reachabilityResult
294
+ });
295
+ case 8:
296
+ return _context4.abrupt("return", {
297
+ reachability: {
298
+ version: 1,
299
+ result: {
300
+ usedDiscoveryOptions: {
301
+ 'early-call-min-clusters': this.minRequiredClusters
302
+ },
303
+ metrics: {
304
+ 'total-duration-ms': this.totalDuration
305
+ },
306
+ tests: reachabilityResult
307
+ }
308
+ },
309
+ joinCookie: joinCookie
310
+ });
311
+ case 9:
312
+ case "end":
313
+ return _context4.stop();
314
+ }
315
+ }, _callee4, this);
316
+ }));
317
+ function getReachabilityReport() {
318
+ return _getReachabilityReport.apply(this, arguments);
319
+ }
320
+ return getReachabilityReport;
321
+ }()
322
+ /**
323
+ * This method is called when we don't succeed in reaching the minimum number of clusters
324
+ * required by Orpheus. It sends the results to Orpheus and gets a new list that it tries to reach again.
325
+ * @returns {Promise<ReachabilityResults>} reachability results
326
+ * @public
327
+ * @memberof Reachability
328
+ */
329
+ )
330
+ }, {
331
+ key: "gatherReachabilityFallback",
332
+ value: (function () {
333
+ var _gatherReachabilityFallback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
334
+ var reachabilityReport, _yield$this$getCluste2, clusters;
335
+ return _regenerator.default.wrap(function _callee5$(_context5) {
336
+ while (1) switch (_context5.prev = _context5.next) {
337
+ case 0:
338
+ _context5.prev = 0;
339
+ _context5.next = 3;
340
+ return this.getReachabilityReport();
341
+ case 3:
342
+ reachabilityReport = _context5.sent;
343
+ _context5.next = 6;
344
+ return this.getClusters('early-call/no-min-reached', reachabilityReport);
345
+ case 6:
346
+ _yield$this$getCluste2 = _context5.sent;
347
+ clusters = _yield$this$getCluste2.clusters;
348
+ // stop all previous reachability checks that might still be going on in the background
349
+ this.abortCurrentChecks();
350
+
351
+ // Perform Reachability Check
352
+ _context5.next = 11;
353
+ return this.performReachabilityChecks(clusters);
354
+ case 11:
355
+ _context5.next = 16;
356
+ break;
357
+ case 13:
358
+ _context5.prev = 13;
359
+ _context5.t0 = _context5["catch"](0);
360
+ _loggerProxy.default.logger.error("Reachability:index#gatherReachabilityFallback --> Error:", _context5.t0);
361
+ case 16:
362
+ case "end":
363
+ return _context5.stop();
364
+ }
365
+ }, _callee5, this, [[0, 13]]);
366
+ }));
367
+ function gatherReachabilityFallback() {
368
+ return _gatherReachabilityFallback.apply(this, arguments);
369
+ }
370
+ return gatherReachabilityFallback;
371
+ }()
372
+ /**
373
+ * Stops all reachability checks that are in progress
374
+ * @public
375
+ * @memberof Reachability
376
+ * @returns {void}
377
+ */
378
+ )
379
+ }, {
380
+ key: "stopReachability",
381
+ value: function stopReachability() {
382
+ // overallTimer is always there only if there is reachability in progress
383
+ if (this.overallTimer) {
384
+ _loggerProxy.default.logger.log('Reachability:index#stopReachability --> stopping reachability checks');
385
+ this.abortCurrentChecks();
386
+ this.emit({
387
+ file: 'reachability',
388
+ function: 'stopReachability'
389
+ }, 'reachability:stopped', {});
390
+ this.sendMetric(true);
391
+ this.resolveReachabilityPromise();
392
+ }
393
+ }
394
+
226
395
  /**
227
396
  * Returns statistics about last reachability results. The returned value is an object
228
397
  * with a flat list of properties so that it can be easily sent with metrics
229
398
  *
230
399
  * @returns {Promise} Promise with metrics values, it never rejects/throws.
231
400
  */
232
- )
233
401
  }, {
234
402
  key: "getReachabilityMetrics",
235
403
  value: (function () {
236
- var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
404
+ var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
237
405
  var stats, updateStats, resultsJson, results;
238
- return _regenerator.default.wrap(function _callee3$(_context3) {
239
- while (1) switch (_context3.prev = _context3.next) {
406
+ return _regenerator.default.wrap(function _callee6$(_context6) {
407
+ while (1) switch (_context6.prev = _context6.next) {
240
408
  case 0:
241
409
  stats = {
242
410
  reachability_public_udp_success: 0,
@@ -266,29 +434,29 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
266
434
  stats["reachability_".concat(clusterType, "_xtls_").concat(_outcome2)] += 1;
267
435
  }
268
436
  };
269
- _context3.prev = 2;
270
- _context3.next = 5;
437
+ _context6.prev = 2;
438
+ _context6.next = 5;
271
439
  return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
272
440
  case 5:
273
- resultsJson = _context3.sent;
441
+ resultsJson = _context6.sent;
274
442
  results = JSON.parse(resultsJson);
275
443
  (0, _values.default)(results).forEach(function (result) {
276
444
  updateStats(result.isVideoMesh ? 'vmn' : 'public', result);
277
445
  });
278
- _context3.next = 13;
446
+ _context6.next = 13;
279
447
  break;
280
448
  case 10:
281
- _context3.prev = 10;
282
- _context3.t0 = _context3["catch"](2);
449
+ _context6.prev = 10;
450
+ _context6.t0 = _context6["catch"](2);
283
451
  // empty storage, that's ok
284
- _loggerProxy.default.logger.warn('Roap:request#getReachabilityMetrics --> Error parsing reachability data: ', _context3.t0);
452
+ _loggerProxy.default.logger.warn('Roap:request#getReachabilityMetrics --> Error parsing reachability data: ', _context6.t0);
285
453
  case 13:
286
- return _context3.abrupt("return", stats);
454
+ return _context6.abrupt("return", stats);
287
455
  case 14:
288
456
  case "end":
289
- return _context3.stop();
457
+ return _context6.stop();
290
458
  }
291
- }, _callee3, this, [[2, 10]]);
459
+ }, _callee6, this, [[2, 10]]);
292
460
  }));
293
461
  function getReachabilityMetrics() {
294
462
  return _getReachabilityMetrics.apply(this, arguments);
@@ -341,17 +509,17 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
341
509
  }, {
342
510
  key: "getReachabilityResults",
343
511
  value: (function () {
344
- var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
512
+ var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
345
513
  var _this2 = this;
346
514
  var results, resultsJson, allClusterResults;
347
- return _regenerator.default.wrap(function _callee4$(_context4) {
348
- while (1) switch (_context4.prev = _context4.next) {
515
+ return _regenerator.default.wrap(function _callee7$(_context7) {
516
+ while (1) switch (_context7.prev = _context7.next) {
349
517
  case 0:
350
- _context4.prev = 0;
351
- _context4.next = 3;
518
+ _context7.prev = 0;
519
+ _context7.next = 3;
352
520
  return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
353
521
  case 3:
354
- resultsJson = _context4.sent;
522
+ resultsJson = _context7.sent;
355
523
  allClusterResults = JSON.parse(resultsJson);
356
524
  results = (0, _lodash.mapValues)(allClusterResults, function (clusterResult) {
357
525
  return {
@@ -366,20 +534,20 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
366
534
  })
367
535
  };
368
536
  });
369
- _context4.next = 11;
537
+ _context7.next = 11;
370
538
  break;
371
539
  case 8:
372
- _context4.prev = 8;
373
- _context4.t0 = _context4["catch"](0);
540
+ _context7.prev = 8;
541
+ _context7.t0 = _context7["catch"](0);
374
542
  // empty storage, that's ok
375
- _loggerProxy.default.logger.warn('Roap:request#attachReachabilityData --> Error parsing reachability data: ', _context4.t0);
543
+ _loggerProxy.default.logger.warn('Reachability:index#getReachabilityResults --> Error parsing reachability data: ', _context7.t0);
376
544
  case 11:
377
- return _context4.abrupt("return", results);
545
+ return _context7.abrupt("return", results);
378
546
  case 12:
379
547
  case "end":
380
- return _context4.stop();
548
+ return _context7.stop();
381
549
  }
382
- }, _callee4, this, [[0, 8]]);
550
+ }, _callee7, this, [[0, 8]]);
383
551
  }));
384
552
  function getReachabilityResults() {
385
553
  return _getReachabilityResults.apply(this, arguments);
@@ -396,16 +564,16 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
396
564
  }, {
397
565
  key: "isAnyPublicClusterReachable",
398
566
  value: (function () {
399
- var _isAnyPublicClusterReachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
567
+ var _isAnyPublicClusterReachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
400
568
  var reachable, reachabilityData, reachabilityResults;
401
- return _regenerator.default.wrap(function _callee5$(_context5) {
402
- while (1) switch (_context5.prev = _context5.next) {
569
+ return _regenerator.default.wrap(function _callee8$(_context8) {
570
+ while (1) switch (_context8.prev = _context8.next) {
403
571
  case 0:
404
572
  reachable = false; // @ts-ignore
405
- _context5.next = 3;
573
+ _context8.next = 3;
406
574
  return this.webex.boundedStorage.get(this.namespace, _constants.REACHABILITY.localStorageResult).catch(function () {});
407
575
  case 3:
408
- reachabilityData = _context5.sent;
576
+ reachabilityData = _context8.sent;
409
577
  if (reachabilityData) {
410
578
  try {
411
579
  reachabilityResults = JSON.parse(reachabilityData);
@@ -414,15 +582,15 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
414
582
  return !result.isVideoMesh && (((_result$udp = result.udp) === null || _result$udp === void 0 ? void 0 : _result$udp.result) === 'reachable' || ((_result$tcp = result.tcp) === null || _result$tcp === void 0 ? void 0 : _result$tcp.result) === 'reachable');
415
583
  });
416
584
  } catch (e) {
417
- _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
585
+ _loggerProxy.default.logger.error("Reachability:index#isAnyPublicClusterReachable --> Error in parsing reachability data: ".concat(e));
418
586
  }
419
587
  }
420
- return _context5.abrupt("return", reachable);
588
+ return _context8.abrupt("return", reachable);
421
589
  case 6:
422
590
  case "end":
423
- return _context5.stop();
591
+ return _context8.stop();
424
592
  }
425
- }, _callee5, this);
593
+ }, _callee8, this);
426
594
  }));
427
595
  function isAnyPublicClusterReachable() {
428
596
  return _isAnyPublicClusterReachable.apply(this, arguments);
@@ -443,16 +611,16 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
443
611
  }, {
444
612
  key: "isWebexMediaBackendUnreachable",
445
613
  value: (function () {
446
- var _isWebexMediaBackendUnreachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
614
+ var _isWebexMediaBackendUnreachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
447
615
  var unreachable, reachabilityData, reachabilityResults, protocols;
448
- return _regenerator.default.wrap(function _callee6$(_context6) {
449
- while (1) switch (_context6.prev = _context6.next) {
616
+ return _regenerator.default.wrap(function _callee9$(_context9) {
617
+ while (1) switch (_context9.prev = _context9.next) {
450
618
  case 0:
451
619
  unreachable = false; // @ts-ignore
452
- _context6.next = 3;
620
+ _context9.next = 3;
453
621
  return this.webex.boundedStorage.get(this.namespace, _constants.REACHABILITY.localStorageResult).catch(function () {});
454
622
  case 3:
455
- reachabilityData = _context6.sent;
623
+ reachabilityData = _context9.sent;
456
624
  if (reachabilityData) {
457
625
  try {
458
626
  reachabilityResults = JSON.parse(reachabilityData);
@@ -487,15 +655,15 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
487
655
  return protocol.tested && !protocol.reachable;
488
656
  });
489
657
  } catch (e) {
490
- _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
658
+ _loggerProxy.default.logger.error("Reachability:index#isWebexMediaBackendUnreachable --> Error in parsing reachability data: ".concat(e));
491
659
  }
492
660
  }
493
- return _context6.abrupt("return", unreachable);
661
+ return _context9.abrupt("return", unreachable);
494
662
  case 6:
495
663
  case "end":
496
- return _context6.stop();
664
+ return _context9.stop();
497
665
  }
498
- }, _callee6, this);
666
+ }, _callee9, this);
499
667
  }));
500
668
  function isWebexMediaBackendUnreachable() {
501
669
  return _isWebexMediaBackendUnreachable.apply(this, arguments);
@@ -540,6 +708,28 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
540
708
  return unreachableList;
541
709
  }
542
710
 
711
+ /**
712
+ * Gets the number of reachable clusters from last run reachability check
713
+ * @returns {number} reachable clusters count
714
+ * @private
715
+ * @memberof Reachability
716
+ */
717
+ }, {
718
+ key: "getNumberOfReachableClusters",
719
+ value: function getNumberOfReachableClusters() {
720
+ var count = 0;
721
+ (0, _entries.default)(this.clusterReachability).forEach(function (_ref3) {
722
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
723
+ key = _ref4[0],
724
+ clusterReachability = _ref4[1];
725
+ var result = clusterReachability.getResult();
726
+ if (result.udp.result === 'reachable' || result.tcp.result === 'reachable' || result.xtls.result === 'reachable') {
727
+ count += 1;
728
+ }
729
+ });
730
+ return count;
731
+ }
732
+
543
733
  /**
544
734
  * Make a log of unreachable clusters.
545
735
  * @returns {undefined}
@@ -550,9 +740,9 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
550
740
  key: "logUnreachableClusters",
551
741
  value: function logUnreachableClusters() {
552
742
  var list = this.getUnreachableClusters();
553
- list.forEach(function (_ref3) {
554
- var name = _ref3.name,
555
- protocol = _ref3.protocol;
743
+ list.forEach(function (_ref5) {
744
+ var name = _ref5.name,
745
+ protocol = _ref5.protocol;
556
746
  _loggerProxy.default.logger.log("Reachability:index#logUnreachableClusters --> failed to reach ".concat(name, " over ").concat(protocol));
557
747
  });
558
748
  }
@@ -583,20 +773,26 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
583
773
 
584
774
  /**
585
775
  * Resolves the promise returned by gatherReachability() method
776
+ * @param {boolean} checkMinRequiredClusters - if true, it will check if we have reached the minimum required clusters and do a fallback if needed
586
777
  * @returns {void}
587
778
  */
588
779
  }, {
589
780
  key: "resolveReachabilityPromise",
590
781
  value: function resolveReachabilityPromise() {
591
782
  var _this$reachabilityDef;
592
- if (this.vmnTimer) {
593
- clearTimeout(this.vmnTimer);
594
- }
595
- if (this.publicCloudTimer) {
596
- clearTimeout(this.publicCloudTimer);
597
- }
783
+ var checkMinRequiredClusters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
784
+ this.totalDuration = performance.now() - this.startTime;
785
+ this.clearTimer('vmnTimer');
786
+ this.clearTimer('publicCloudTimer');
598
787
  this.logUnreachableClusters();
599
788
  (_this$reachabilityDef = this.reachabilityDefer) === null || _this$reachabilityDef === void 0 ? void 0 : _this$reachabilityDef.resolve();
789
+ if (checkMinRequiredClusters) {
790
+ var numReachableClusters = this.getNumberOfReachableClusters();
791
+ if (this.minRequiredClusters && numReachableClusters < this.minRequiredClusters) {
792
+ _loggerProxy.default.logger.log("Reachability:index#resolveReachabilityPromise --> minRequiredClusters not reached (".concat(numReachableClusters, " < ").concat(this.minRequiredClusters, "), doing reachability fallback"));
793
+ this.gatherReachabilityFallback();
794
+ }
795
+ }
600
796
  }
601
797
 
602
798
  /**
@@ -647,16 +843,21 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
647
843
  /**
648
844
  * Sends a metric with all the statistics about how long reachability took
649
845
  *
846
+ * @param {boolean} aborted true if the reachability checks were aborted
650
847
  * @returns {void}
651
848
  */
652
849
  }, {
653
850
  key: "sendMetric",
654
851
  value: (function () {
655
- var _sendMetric = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
656
- var results, stats;
657
- return _regenerator.default.wrap(function _callee7$(_context7) {
658
- while (1) switch (_context7.prev = _context7.next) {
852
+ var _sendMetric = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
853
+ var aborted,
854
+ results,
855
+ stats,
856
+ _args10 = arguments;
857
+ return _regenerator.default.wrap(function _callee10$(_context10) {
858
+ while (1) switch (_context10.prev = _context10.next) {
659
859
  case 0:
860
+ aborted = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : false;
660
861
  results = [];
661
862
  (0, _values.default)(this.clusterReachability).forEach(function (clusterReachability) {
662
863
  results.push(_objectSpread(_objectSpread({}, clusterReachability.getResult()), {}, {
@@ -664,6 +865,7 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
664
865
  }));
665
866
  });
666
867
  stats = {
868
+ aborted: aborted,
667
869
  vmn: {
668
870
  udp: this.getStatistics(results, 'udp', true)
669
871
  },
@@ -685,11 +887,11 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
685
887
  trigger: this.lastTrigger
686
888
  };
687
889
  _metrics.default.sendBehavioralMetric(_constants2.default.REACHABILITY_COMPLETED, _metrics.default.prepareMetricFields(stats));
688
- case 4:
890
+ case 5:
689
891
  case "end":
690
- return _context7.stop();
892
+ return _context10.stop();
691
893
  }
692
- }, _callee7, this);
894
+ }, _callee10, this);
693
895
  }));
694
896
  function sendMetric() {
695
897
  return _sendMetric.apply(this, arguments);
@@ -719,6 +921,8 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
719
921
  _this3.publicCloudTimer = undefined;
720
922
  _loggerProxy.default.logger.log("Reachability:index#startTimers --> Reachability checks timed out (".concat(DEFAULT_TIMEOUT, "s)"));
721
923
 
924
+ // check against minimum required clusters, do a new call if we don't have enough
925
+
722
926
  // resolve the promise, so that the client won't be blocked waiting on meetings.register() for too long
723
927
  _this3.resolveReachabilityPromise();
724
928
  }, DEFAULT_TIMEOUT * 1000);
@@ -743,19 +947,19 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
743
947
  }, {
744
948
  key: "storeResults",
745
949
  value: (function () {
746
- var _storeResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(results) {
747
- return _regenerator.default.wrap(function _callee8$(_context8) {
748
- while (1) switch (_context8.prev = _context8.next) {
950
+ var _storeResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(results) {
951
+ return _regenerator.default.wrap(function _callee11$(_context11) {
952
+ while (1) switch (_context11.prev = _context11.next) {
749
953
  case 0:
750
- _context8.next = 2;
954
+ _context11.next = 2;
751
955
  return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageResult, (0, _stringify.default)(results));
752
956
  case 2:
753
957
  case "end":
754
- return _context8.stop();
958
+ return _context11.stop();
755
959
  }
756
- }, _callee8, this);
960
+ }, _callee11, this);
757
961
  }));
758
- function storeResults(_x2) {
962
+ function storeResults(_x4) {
759
963
  return _storeResults.apply(this, arguments);
760
964
  }
761
965
  return storeResults;
@@ -779,6 +983,35 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
779
983
  this.resultsCount.public.xtls = 0;
780
984
  }
781
985
 
986
+ /**
987
+ * Clears the timer
988
+ *
989
+ * @param {string} timer name of the timer to clear
990
+ * @returns {void}
991
+ */
992
+ }, {
993
+ key: "clearTimer",
994
+ value: function clearTimer(timer) {
995
+ if (this[timer]) {
996
+ clearTimeout(this[timer]);
997
+ this[timer] = undefined;
998
+ }
999
+ }
1000
+
1001
+ /**
1002
+ * Aborts current checks that are in progress
1003
+ *
1004
+ * @returns {void}
1005
+ */
1006
+ }, {
1007
+ key: "abortCurrentChecks",
1008
+ value: function abortCurrentChecks() {
1009
+ this.clearTimer('vmnTimer');
1010
+ this.clearTimer('publicCloudTimer');
1011
+ this.clearTimer('overallTimer');
1012
+ this.abortClusterReachability();
1013
+ }
1014
+
782
1015
  /**
783
1016
  * Performs reachability checks for all clusters
784
1017
  * @param {ClusterList} clusterList
@@ -787,27 +1020,21 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
787
1020
  }, {
788
1021
  key: "performReachabilityChecks",
789
1022
  value: (function () {
790
- var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(clusterList) {
1023
+ var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(clusterList) {
791
1024
  var _this4 = this;
792
1025
  var results, isFirstResult;
793
- return _regenerator.default.wrap(function _callee11$(_context11) {
794
- while (1) switch (_context11.prev = _context11.next) {
1026
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1027
+ while (1) switch (_context14.prev = _context14.next) {
795
1028
  case 0:
796
1029
  results = {};
797
1030
  this.clusterReachability = {};
798
- if (!(!clusterList || !(0, _keys.default)(clusterList).length)) {
799
- _context11.next = 4;
800
- break;
801
- }
802
- return _context11.abrupt("return");
803
- case 4:
1031
+ this.startTime = performance.now();
804
1032
  _loggerProxy.default.logger.log("Reachability:index#performReachabilityChecks --> doing UDP".concat(
805
1033
  // @ts-ignore
806
1034
  this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : '').concat(
807
1035
  // @ts-ignore
808
1036
  this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : '', " reachability checks"));
809
1037
  this.resetResultCounters();
810
- this.startTimers();
811
1038
 
812
1039
  // sanitize the urls in the clusterList
813
1040
  (0, _keys.default)(clusterList).forEach(function (key) {
@@ -855,18 +1082,32 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
855
1082
  tcp: true,
856
1083
  xtls: true
857
1084
  }; // save the initialized results (in case we don't get any "resultReady" events at all)
858
- _context11.next = 11;
1085
+ _context14.next = 9;
859
1086
  return this.storeResults(results);
860
- case 11:
1087
+ case 9:
1088
+ if (!(!clusterList || !(0, _keys.default)(clusterList).length)) {
1089
+ _context14.next = 13;
1090
+ break;
1091
+ }
1092
+ // nothing to do, finish immediately
1093
+ this.resolveReachabilityPromise(false);
1094
+ this.emit({
1095
+ file: 'reachability',
1096
+ function: 'performReachabilityChecks'
1097
+ }, 'reachability:done', {});
1098
+ return _context14.abrupt("return");
1099
+ case 13:
1100
+ this.startTimers();
1101
+
861
1102
  // now start the reachability on all the clusters
862
1103
  (0, _keys.default)(clusterList).forEach(function (key) {
863
1104
  var cluster = clusterList[key];
864
1105
  _this4.clusterReachability[key] = new _clusterReachability.ClusterReachability(key, cluster);
865
1106
  _this4.clusterReachability[key].on(_clusterReachability.Events.resultReady, /*#__PURE__*/function () {
866
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(data) {
1107
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(data) {
867
1108
  var protocol, result, clientMediaIPs, latencyInMilliseconds, areAllResultsReady;
868
- return _regenerator.default.wrap(function _callee9$(_context9) {
869
- while (1) switch (_context9.prev = _context9.next) {
1109
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1110
+ while (1) switch (_context12.prev = _context12.next) {
870
1111
  case 0:
871
1112
  protocol = data.protocol, result = data.result, clientMediaIPs = data.clientMediaIPs, latencyInMilliseconds = data.latencyInMilliseconds;
872
1113
  if (isFirstResult[protocol]) {
@@ -883,12 +1124,11 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
883
1124
  results[key][protocol].result = result;
884
1125
  results[key][protocol].clientMediaIPs = clientMediaIPs;
885
1126
  results[key][protocol].latencyInMilliseconds = latencyInMilliseconds;
886
- _context9.next = 9;
1127
+ _context12.next = 9;
887
1128
  return _this4.storeResults(results);
888
1129
  case 9:
889
1130
  if (areAllResultsReady) {
890
- clearTimeout(_this4.overallTimer);
891
- _this4.overallTimer = undefined;
1131
+ _this4.clearTimer('overallTimer');
892
1132
  _this4.emit({
893
1133
  file: 'reachability',
894
1134
  function: 'performReachabilityChecks'
@@ -899,46 +1139,131 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
899
1139
  }
900
1140
  case 10:
901
1141
  case "end":
902
- return _context9.stop();
1142
+ return _context12.stop();
903
1143
  }
904
- }, _callee9);
1144
+ }, _callee12);
905
1145
  }));
906
- return function (_x4) {
907
- return _ref4.apply(this, arguments);
1146
+ return function (_x6) {
1147
+ return _ref6.apply(this, arguments);
908
1148
  };
909
1149
  }());
910
1150
 
911
1151
  // clientMediaIps can be updated independently from the results, so we need to listen for them too
912
1152
  _this4.clusterReachability[key].on(_clusterReachability.Events.clientMediaIpsUpdated, /*#__PURE__*/function () {
913
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(data) {
914
- return _regenerator.default.wrap(function _callee10$(_context10) {
915
- while (1) switch (_context10.prev = _context10.next) {
1153
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(data) {
1154
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1155
+ while (1) switch (_context13.prev = _context13.next) {
916
1156
  case 0:
917
1157
  results[key][data.protocol].clientMediaIPs = data.clientMediaIPs;
918
- _context10.next = 3;
1158
+ _context13.next = 3;
919
1159
  return _this4.storeResults(results);
920
1160
  case 3:
921
1161
  case "end":
922
- return _context10.stop();
1162
+ return _context13.stop();
923
1163
  }
924
- }, _callee10);
1164
+ }, _callee13);
925
1165
  }));
926
- return function (_x5) {
927
- return _ref5.apply(this, arguments);
1166
+ return function (_x7) {
1167
+ return _ref7.apply(this, arguments);
928
1168
  };
929
1169
  }());
930
1170
  _this4.clusterReachability[key].start(); // not awaiting on purpose
931
1171
  });
932
- case 12:
1172
+ case 15:
933
1173
  case "end":
934
- return _context11.stop();
1174
+ return _context14.stop();
935
1175
  }
936
- }, _callee11, this);
1176
+ }, _callee14, this);
937
1177
  }));
938
- function performReachabilityChecks(_x3) {
1178
+ function performReachabilityChecks(_x5) {
939
1179
  return _performReachabilityChecks.apply(this, arguments);
940
1180
  }
941
1181
  return performReachabilityChecks;
1182
+ }()
1183
+ /**
1184
+ * Returns the clientMediaPreferences object that needs to be sent to the backend
1185
+ * when joining a meeting
1186
+ *
1187
+ * @param {boolean} isMultistream
1188
+ * @param {IP_VERSION} ipver
1189
+ * @returns {Object}
1190
+ */
1191
+ )
1192
+ }, {
1193
+ key: "getClientMediaPreferences",
1194
+ value: (function () {
1195
+ var _getClientMediaPreferences = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(isMultistream, ipver) {
1196
+ var reachabilityReport;
1197
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1198
+ while (1) switch (_context15.prev = _context15.next) {
1199
+ case 0:
1200
+ if (this.orpheusApiVersion) {
1201
+ _context15.next = 7;
1202
+ break;
1203
+ }
1204
+ _context15.t0 = ipver;
1205
+ _context15.next = 4;
1206
+ return this.getJoinCookie();
1207
+ case 4:
1208
+ _context15.t1 = _context15.sent;
1209
+ _context15.t2 = !isMultistream;
1210
+ return _context15.abrupt("return", {
1211
+ ipver: _context15.t0,
1212
+ joinCookie: _context15.t1,
1213
+ preferTranscoding: _context15.t2
1214
+ });
1215
+ case 7:
1216
+ _context15.next = 9;
1217
+ return this.getReachabilityReport();
1218
+ case 9:
1219
+ reachabilityReport = _context15.sent;
1220
+ return _context15.abrupt("return", _objectSpread({
1221
+ ipver: ipver,
1222
+ preferTranscoding: !isMultistream
1223
+ }, reachabilityReport));
1224
+ case 11:
1225
+ case "end":
1226
+ return _context15.stop();
1227
+ }
1228
+ }, _callee15, this);
1229
+ }));
1230
+ function getClientMediaPreferences(_x8, _x9) {
1231
+ return _getClientMediaPreferences.apply(this, arguments);
1232
+ }
1233
+ return getClientMediaPreferences;
1234
+ }()
1235
+ /**
1236
+ * Returns the reachability report that needs to be attached to the ROAP messages
1237
+ * that we send to the backend.
1238
+ * It may return undefined, if reachability is not needed to be attached to ROAP messages (that's the case for v1 or Orpheus API)
1239
+ *
1240
+ * @returns {Promise<ReachabilityReportV0>} object that needs to be attached to Roap messages
1241
+ */
1242
+ )
1243
+ }, {
1244
+ key: "getReachabilityReportToAttachToRoap",
1245
+ value: (function () {
1246
+ var _getReachabilityReportToAttachToRoap = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1247
+ return _regenerator.default.wrap(function _callee16$(_context16) {
1248
+ while (1) switch (_context16.prev = _context16.next) {
1249
+ case 0:
1250
+ if (this.orpheusApiVersion) {
1251
+ _context16.next = 2;
1252
+ break;
1253
+ }
1254
+ return _context16.abrupt("return", this.getReachabilityResults());
1255
+ case 2:
1256
+ return _context16.abrupt("return", undefined);
1257
+ case 3:
1258
+ case "end":
1259
+ return _context16.stop();
1260
+ }
1261
+ }, _callee16, this);
1262
+ }));
1263
+ function getReachabilityReportToAttachToRoap() {
1264
+ return _getReachabilityReportToAttachToRoap.apply(this, arguments);
1265
+ }
1266
+ return getReachabilityReportToAttachToRoap;
942
1267
  }())
943
1268
  }]);
944
1269
  return Reachability;