@webex/plugin-meetings 3.6.0 → 3.7.0-ipv6-multi-turn-urls.2

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 (332) hide show
  1. package/README.md +2 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/index.js +1 -1
  4. package/dist/common/errors/join-webinar-error.js +50 -0
  5. package/dist/common/errors/join-webinar-error.js.map +1 -0
  6. package/dist/config.js +4 -1
  7. package/dist/config.js.map +1 -1
  8. package/dist/constants.js +54 -4
  9. package/dist/constants.js.map +1 -1
  10. package/dist/controls-options-manager/enums.js +1 -0
  11. package/dist/controls-options-manager/enums.js.map +1 -1
  12. package/dist/controls-options-manager/index.js +10 -3
  13. package/dist/controls-options-manager/index.js.map +1 -1
  14. package/dist/controls-options-manager/types.js.map +1 -1
  15. package/dist/controls-options-manager/util.js +12 -0
  16. package/dist/controls-options-manager/util.js.map +1 -1
  17. package/dist/index.js +7 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/interpretation/index.js +1 -1
  20. package/dist/interpretation/siLanguage.js +1 -1
  21. package/dist/locus-info/controlsUtils.js +28 -4
  22. package/dist/locus-info/controlsUtils.js.map +1 -1
  23. package/dist/locus-info/fullState.js +2 -1
  24. package/dist/locus-info/fullState.js.map +1 -1
  25. package/dist/locus-info/index.js +61 -3
  26. package/dist/locus-info/index.js.map +1 -1
  27. package/dist/locus-info/parser.js +5 -1
  28. package/dist/locus-info/parser.js.map +1 -1
  29. package/dist/media/index.js +29 -1
  30. package/dist/media/index.js.map +1 -1
  31. package/dist/meeting/in-meeting-actions.js +29 -1
  32. package/dist/meeting/in-meeting-actions.js.map +1 -1
  33. package/dist/meeting/index.js +807 -540
  34. package/dist/meeting/index.js.map +1 -1
  35. package/dist/meeting/locusMediaRequest.js +2 -6
  36. package/dist/meeting/locusMediaRequest.js.map +1 -1
  37. package/dist/meeting/muteState.js +5 -2
  38. package/dist/meeting/muteState.js.map +1 -1
  39. package/dist/meeting/request.js +21 -29
  40. package/dist/meeting/request.js.map +1 -1
  41. package/dist/meeting/util.js +98 -61
  42. package/dist/meeting/util.js.map +1 -1
  43. package/dist/meeting-info/meeting-info-v2.js +80 -17
  44. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  45. package/dist/meetings/index.js +29 -2
  46. package/dist/meetings/index.js.map +1 -1
  47. package/dist/members/index.js +3 -2
  48. package/dist/members/index.js.map +1 -1
  49. package/dist/members/util.js +13 -7
  50. package/dist/members/util.js.map +1 -1
  51. package/dist/metrics/constants.js +4 -1
  52. package/dist/metrics/constants.js.map +1 -1
  53. package/dist/multistream/remoteMedia.js +34 -15
  54. package/dist/multistream/remoteMedia.js.map +1 -1
  55. package/dist/reachability/clusterReachability.js +12 -15
  56. package/dist/reachability/clusterReachability.js.map +1 -1
  57. package/dist/reachability/index.js +433 -136
  58. package/dist/reachability/index.js.map +1 -1
  59. package/dist/{rtcMetrics/constants.js → reachability/reachability.types.js} +1 -5
  60. package/dist/reachability/reachability.types.js.map +1 -0
  61. package/dist/reachability/request.js +23 -9
  62. package/dist/reachability/request.js.map +1 -1
  63. package/dist/recording-controller/enums.js +8 -4
  64. package/dist/recording-controller/enums.js.map +1 -1
  65. package/dist/recording-controller/index.js +18 -9
  66. package/dist/recording-controller/index.js.map +1 -1
  67. package/dist/recording-controller/util.js +13 -9
  68. package/dist/recording-controller/util.js.map +1 -1
  69. package/dist/roap/index.js +5 -7
  70. package/dist/roap/index.js.map +1 -1
  71. package/dist/roap/request.js +45 -79
  72. package/dist/roap/request.js.map +1 -1
  73. package/dist/roap/turnDiscovery.js +3 -6
  74. package/dist/roap/turnDiscovery.js.map +1 -1
  75. package/dist/{common/errors/parameter.d.ts → types/common/errors/join-webinar-error.d.ts} +4 -5
  76. package/dist/types/config.d.ts +3 -0
  77. package/dist/types/constants.d.ts +43 -0
  78. package/dist/types/controls-options-manager/enums.d.ts +2 -1
  79. package/dist/types/controls-options-manager/index.d.ts +2 -1
  80. package/dist/types/controls-options-manager/types.d.ts +2 -0
  81. package/dist/types/index.d.ts +2 -1
  82. package/dist/types/locus-info/index.d.ts +9 -0
  83. package/dist/types/meeting/in-meeting-actions.d.ts +28 -0
  84. package/dist/types/meeting/index.d.ts +34 -3
  85. package/dist/types/meeting/locusMediaRequest.d.ts +2 -3
  86. package/dist/types/meeting/muteState.d.ts +2 -1
  87. package/dist/types/meeting/request.d.ts +2 -2
  88. package/dist/types/meeting/util.d.ts +2 -2
  89. package/dist/types/meeting-info/meeting-info-v2.d.ts +23 -0
  90. package/dist/types/meetings/index.d.ts +13 -1
  91. package/dist/types/members/index.d.ts +2 -1
  92. package/dist/types/members/util.d.ts +5 -1
  93. package/dist/types/metrics/constants.d.ts +3 -0
  94. package/dist/types/multistream/remoteMedia.d.ts +1 -0
  95. package/dist/types/reachability/clusterReachability.d.ts +1 -10
  96. package/dist/types/reachability/index.d.ts +74 -35
  97. package/dist/types/reachability/reachability.types.d.ts +64 -0
  98. package/dist/types/reachability/request.d.ts +5 -1
  99. package/dist/types/recording-controller/enums.d.ts +5 -2
  100. package/dist/types/recording-controller/index.d.ts +1 -0
  101. package/dist/types/recording-controller/util.d.ts +2 -1
  102. package/dist/types/roap/request.d.ts +1 -13
  103. package/dist/webinar/index.js +382 -19
  104. package/dist/webinar/index.js.map +1 -1
  105. package/package.json +22 -22
  106. package/src/common/errors/join-webinar-error.ts +24 -0
  107. package/src/config.ts +3 -0
  108. package/src/constants.ts +52 -0
  109. package/src/controls-options-manager/enums.ts +1 -0
  110. package/src/controls-options-manager/index.ts +19 -2
  111. package/src/controls-options-manager/types.ts +2 -0
  112. package/src/controls-options-manager/util.ts +12 -0
  113. package/src/index.ts +2 -0
  114. package/src/locus-info/controlsUtils.ts +46 -2
  115. package/src/locus-info/fullState.ts +1 -0
  116. package/src/locus-info/index.ts +60 -0
  117. package/src/locus-info/parser.ts +8 -1
  118. package/src/media/index.ts +15 -0
  119. package/src/meeting/in-meeting-actions.ts +58 -0
  120. package/src/meeting/index.ts +268 -32
  121. package/src/meeting/locusMediaRequest.ts +4 -8
  122. package/src/meeting/muteState.ts +6 -2
  123. package/src/meeting/request.ts +4 -11
  124. package/src/meeting/util.ts +31 -6
  125. package/src/meeting-info/meeting-info-v2.ts +63 -0
  126. package/src/meetings/index.ts +74 -40
  127. package/src/members/index.ts +4 -2
  128. package/src/members/util.ts +4 -1
  129. package/src/metrics/constants.ts +3 -0
  130. package/src/multistream/remoteMedia.ts +33 -15
  131. package/src/reachability/clusterReachability.ts +5 -15
  132. package/src/reachability/index.ts +285 -77
  133. package/src/reachability/reachability.types.ts +85 -0
  134. package/src/reachability/request.ts +55 -30
  135. package/src/recording-controller/enums.ts +5 -2
  136. package/src/recording-controller/index.ts +17 -4
  137. package/src/recording-controller/util.ts +20 -5
  138. package/src/roap/index.ts +4 -5
  139. package/src/roap/request.ts +32 -44
  140. package/src/roap/turnDiscovery.ts +2 -4
  141. package/src/webinar/index.ts +223 -17
  142. package/test/unit/spec/controls-options-manager/index.js +56 -32
  143. package/test/unit/spec/controls-options-manager/util.js +44 -0
  144. package/test/unit/spec/locus-info/controlsUtils.js +80 -4
  145. package/test/unit/spec/locus-info/index.js +88 -2
  146. package/test/unit/spec/meeting/in-meeting-actions.ts +31 -1
  147. package/test/unit/spec/meeting/index.js +407 -82
  148. package/test/unit/spec/meeting/locusMediaRequest.ts +18 -11
  149. package/test/unit/spec/meeting/muteState.js +8 -4
  150. package/test/unit/spec/meeting/request.js +3 -26
  151. package/test/unit/spec/meeting/utils.js +71 -14
  152. package/test/unit/spec/meeting-info/meetinginfov2.js +42 -0
  153. package/test/unit/spec/meetings/index.js +41 -6
  154. package/test/unit/spec/members/index.js +25 -2
  155. package/test/unit/spec/members/request.js +37 -3
  156. package/test/unit/spec/members/utils.js +110 -1
  157. package/test/unit/spec/multistream/remoteMedia.ts +27 -9
  158. package/test/unit/spec/reachability/clusterReachability.ts +7 -0
  159. package/test/unit/spec/reachability/index.ts +265 -1
  160. package/test/unit/spec/reachability/request.js +56 -15
  161. package/test/unit/spec/recording-controller/index.js +61 -5
  162. package/test/unit/spec/recording-controller/util.js +39 -3
  163. package/test/unit/spec/roap/index.ts +1 -1
  164. package/test/unit/spec/roap/request.ts +51 -109
  165. package/test/unit/spec/roap/turnDiscovery.ts +202 -147
  166. package/test/unit/spec/webinar/index.ts +443 -14
  167. package/dist/annotation/annotation.types.d.ts +0 -42
  168. package/dist/annotation/constants.d.ts +0 -31
  169. package/dist/annotation/index.d.ts +0 -117
  170. package/dist/breakouts/breakout.d.ts +0 -8
  171. package/dist/breakouts/collection.d.ts +0 -5
  172. package/dist/breakouts/edit-lock-error.d.ts +0 -15
  173. package/dist/breakouts/events.d.ts +0 -8
  174. package/dist/breakouts/index.d.ts +0 -5
  175. package/dist/breakouts/request.d.ts +0 -22
  176. package/dist/breakouts/utils.d.ts +0 -15
  177. package/dist/common/browser-detection.d.ts +0 -9
  178. package/dist/common/collection.d.ts +0 -48
  179. package/dist/common/config.d.ts +0 -2
  180. package/dist/common/errors/captcha-error.d.ts +0 -15
  181. package/dist/common/errors/intent-to-join.d.ts +0 -16
  182. package/dist/common/errors/join-meeting.d.ts +0 -17
  183. package/dist/common/errors/media.d.ts +0 -15
  184. package/dist/common/errors/no-meeting-info.d.ts +0 -14
  185. package/dist/common/errors/password-error.d.ts +0 -15
  186. package/dist/common/errors/permission.d.ts +0 -14
  187. package/dist/common/errors/reclaim-host-role-error.js +0 -149
  188. package/dist/common/errors/reclaim-host-role-error.js.map +0 -1
  189. package/dist/common/errors/reclaim-host-role-errors.d.ts +0 -60
  190. package/dist/common/errors/reconnection-in-progress.d.ts +0 -9
  191. package/dist/common/errors/reconnection-in-progress.js +0 -33
  192. package/dist/common/errors/reconnection-in-progress.js.map +0 -1
  193. package/dist/common/errors/reconnection.d.ts +0 -15
  194. package/dist/common/errors/stats.d.ts +0 -15
  195. package/dist/common/errors/webex-errors.d.ts +0 -93
  196. package/dist/common/errors/webex-meetings-error.d.ts +0 -20
  197. package/dist/common/events/events-scope.d.ts +0 -17
  198. package/dist/common/events/events.d.ts +0 -12
  199. package/dist/common/events/trigger-proxy.d.ts +0 -2
  200. package/dist/common/events/util.d.ts +0 -2
  201. package/dist/common/logs/logger-config.d.ts +0 -2
  202. package/dist/common/logs/logger-proxy.d.ts +0 -2
  203. package/dist/common/logs/request.d.ts +0 -36
  204. package/dist/common/queue.d.ts +0 -34
  205. package/dist/config.d.ts +0 -72
  206. package/dist/constants.d.ts +0 -1088
  207. package/dist/controls-options-manager/constants.d.ts +0 -4
  208. package/dist/controls-options-manager/enums.d.ts +0 -15
  209. package/dist/controls-options-manager/index.d.ts +0 -136
  210. package/dist/controls-options-manager/types.d.ts +0 -43
  211. package/dist/controls-options-manager/util.d.ts +0 -1
  212. package/dist/index.d.ts +0 -7
  213. package/dist/interceptors/index.d.ts +0 -2
  214. package/dist/interceptors/locusRetry.d.ts +0 -27
  215. package/dist/interpretation/collection.d.ts +0 -5
  216. package/dist/interpretation/index.d.ts +0 -5
  217. package/dist/interpretation/siLanguage.d.ts +0 -5
  218. package/dist/locus-info/controlsUtils.d.ts +0 -2
  219. package/dist/locus-info/embeddedAppsUtils.d.ts +0 -2
  220. package/dist/locus-info/fullState.d.ts +0 -2
  221. package/dist/locus-info/hostUtils.d.ts +0 -2
  222. package/dist/locus-info/index.d.ts +0 -322
  223. package/dist/locus-info/infoUtils.d.ts +0 -2
  224. package/dist/locus-info/mediaSharesUtils.d.ts +0 -2
  225. package/dist/locus-info/parser.d.ts +0 -272
  226. package/dist/locus-info/selfUtils.d.ts +0 -2
  227. package/dist/media/index.d.ts +0 -34
  228. package/dist/media/properties.d.ts +0 -93
  229. package/dist/media/util.d.ts +0 -2
  230. package/dist/mediaQualityMetrics/config.d.ts +0 -241
  231. package/dist/mediaQualityMetrics/config.js +0 -502
  232. package/dist/mediaQualityMetrics/config.js.map +0 -1
  233. package/dist/meeting/effectsState.js +0 -260
  234. package/dist/meeting/effectsState.js.map +0 -1
  235. package/dist/meeting/in-meeting-actions.d.ts +0 -167
  236. package/dist/meeting/index.d.ts +0 -1825
  237. package/dist/meeting/locusMediaRequest.d.ts +0 -74
  238. package/dist/meeting/muteState.d.ts +0 -178
  239. package/dist/meeting/request.d.ts +0 -295
  240. package/dist/meeting/request.type.d.ts +0 -11
  241. package/dist/meeting/state.d.ts +0 -9
  242. package/dist/meeting/util.d.ts +0 -119
  243. package/dist/meeting/voicea-meeting.d.ts +0 -16
  244. package/dist/meeting-info/collection.d.ts +0 -20
  245. package/dist/meeting-info/index.d.ts +0 -69
  246. package/dist/meeting-info/meeting-info-v2.d.ts +0 -123
  247. package/dist/meeting-info/request.d.ts +0 -22
  248. package/dist/meeting-info/util.d.ts +0 -2
  249. package/dist/meeting-info/utilv2.d.ts +0 -2
  250. package/dist/meetings/collection.d.ts +0 -40
  251. package/dist/meetings/index.d.ts +0 -390
  252. package/dist/meetings/meetings.types.d.ts +0 -4
  253. package/dist/meetings/request.d.ts +0 -27
  254. package/dist/meetings/util.d.ts +0 -18
  255. package/dist/member/index.d.ts +0 -160
  256. package/dist/member/member.types.js +0 -17
  257. package/dist/member/member.types.js.map +0 -1
  258. package/dist/member/types.d.ts +0 -32
  259. package/dist/member/util.d.ts +0 -2
  260. package/dist/members/collection.d.ts +0 -29
  261. package/dist/members/index.d.ts +0 -353
  262. package/dist/members/request.d.ts +0 -114
  263. package/dist/members/types.d.ts +0 -25
  264. package/dist/members/util.d.ts +0 -215
  265. package/dist/metrics/config.js +0 -276
  266. package/dist/metrics/config.js.map +0 -1
  267. package/dist/metrics/constants.d.ts +0 -70
  268. package/dist/metrics/index.d.ts +0 -45
  269. package/dist/multistream/mediaRequestManager.d.ts +0 -119
  270. package/dist/multistream/receiveSlot.d.ts +0 -68
  271. package/dist/multistream/receiveSlotManager.d.ts +0 -56
  272. package/dist/multistream/remoteMedia.d.ts +0 -72
  273. package/dist/multistream/remoteMediaGroup.d.ts +0 -49
  274. package/dist/multistream/remoteMediaManager.d.ts +0 -300
  275. package/dist/multistream/sendSlotManager.d.ts +0 -69
  276. package/dist/networkQualityMonitor/index.d.ts +0 -70
  277. package/dist/networkQualityMonitor/index.js +0 -221
  278. package/dist/networkQualityMonitor/index.js.map +0 -1
  279. package/dist/peer-connection-manager/index.js +0 -671
  280. package/dist/peer-connection-manager/index.js.map +0 -1
  281. package/dist/peer-connection-manager/util.js +0 -109
  282. package/dist/peer-connection-manager/util.js.map +0 -1
  283. package/dist/personal-meeting-room/index.d.ts +0 -47
  284. package/dist/personal-meeting-room/request.d.ts +0 -14
  285. package/dist/personal-meeting-room/util.d.ts +0 -2
  286. package/dist/reachability/clusterReachability.d.ts +0 -109
  287. package/dist/reachability/index.d.ts +0 -105
  288. package/dist/reachability/request.d.ts +0 -39
  289. package/dist/reachability/util.d.ts +0 -8
  290. package/dist/reactions/constants.d.ts +0 -3
  291. package/dist/reactions/reactions.d.ts +0 -4
  292. package/dist/reactions/reactions.type.d.ts +0 -52
  293. package/dist/reconnection-manager/index.d.ts +0 -136
  294. package/dist/recording-controller/enums.d.ts +0 -7
  295. package/dist/recording-controller/index.d.ts +0 -207
  296. package/dist/recording-controller/util.d.ts +0 -14
  297. package/dist/roap/collection.js +0 -62
  298. package/dist/roap/collection.js.map +0 -1
  299. package/dist/roap/handler.js +0 -275
  300. package/dist/roap/handler.js.map +0 -1
  301. package/dist/roap/index.d.ts +0 -86
  302. package/dist/roap/request.d.ts +0 -39
  303. package/dist/roap/state.js +0 -126
  304. package/dist/roap/state.js.map +0 -1
  305. package/dist/roap/turnDiscovery.d.ts +0 -155
  306. package/dist/roap/util.js +0 -75
  307. package/dist/roap/util.js.map +0 -1
  308. package/dist/rtcMetrics/constants.d.ts +0 -4
  309. package/dist/rtcMetrics/constants.js.map +0 -1
  310. package/dist/rtcMetrics/index.d.ts +0 -61
  311. package/dist/rtcMetrics/index.js +0 -197
  312. package/dist/rtcMetrics/index.js.map +0 -1
  313. package/dist/statsAnalyzer/global.d.ts +0 -36
  314. package/dist/statsAnalyzer/global.js +0 -126
  315. package/dist/statsAnalyzer/global.js.map +0 -1
  316. package/dist/statsAnalyzer/index.d.ts +0 -217
  317. package/dist/statsAnalyzer/index.js +0 -1013
  318. package/dist/statsAnalyzer/index.js.map +0 -1
  319. package/dist/statsAnalyzer/mqaUtil.d.ts +0 -48
  320. package/dist/statsAnalyzer/mqaUtil.js +0 -179
  321. package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
  322. package/dist/transcription/index.d.ts +0 -64
  323. package/dist/types/common/errors/reconnection-in-progress.d.ts +0 -9
  324. package/dist/types/mediaQualityMetrics/config.d.ts +0 -241
  325. package/dist/types/networkQualityMonitor/index.d.ts +0 -70
  326. package/dist/types/rtcMetrics/constants.d.ts +0 -4
  327. package/dist/types/rtcMetrics/index.d.ts +0 -71
  328. package/dist/types/statsAnalyzer/global.d.ts +0 -36
  329. package/dist/types/statsAnalyzer/index.d.ts +0 -217
  330. package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
  331. package/dist/webinar/collection.d.ts +0 -16
  332. package/dist/webinar/index.d.ts +0 -5
@@ -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,49 +186,189 @@ 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:
187
193
  _context2.prev = 0;
188
194
  this.lastTrigger = trigger;
189
195
 
190
- // kick off ip version detection. For now we don't await it, as we're doing it
191
- // to gather the timings and send them with our reachability metrics
196
+ // kick off ip version detection. We don't await it, as we don't want to waste time
197
+ // and if it fails, that's ok we can still carry on
192
198
  // @ts-ignore
193
- this.webex.internal.device.ipNetworkDetector.detect();
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
+ }()
226
372
  /**
227
373
  * Returns statistics about last reachability results. The returned value is an object
228
374
  * with a flat list of properties so that it can be easily sent with metrics
@@ -233,10 +379,10 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
233
379
  }, {
234
380
  key: "getReachabilityMetrics",
235
381
  value: (function () {
236
- var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
382
+ var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
237
383
  var stats, updateStats, resultsJson, results;
238
- return _regenerator.default.wrap(function _callee3$(_context3) {
239
- while (1) switch (_context3.prev = _context3.next) {
384
+ return _regenerator.default.wrap(function _callee6$(_context6) {
385
+ while (1) switch (_context6.prev = _context6.next) {
240
386
  case 0:
241
387
  stats = {
242
388
  reachability_public_udp_success: 0,
@@ -266,29 +412,29 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
266
412
  stats["reachability_".concat(clusterType, "_xtls_").concat(_outcome2)] += 1;
267
413
  }
268
414
  };
269
- _context3.prev = 2;
270
- _context3.next = 5;
415
+ _context6.prev = 2;
416
+ _context6.next = 5;
271
417
  return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
272
418
  case 5:
273
- resultsJson = _context3.sent;
419
+ resultsJson = _context6.sent;
274
420
  results = JSON.parse(resultsJson);
275
421
  (0, _values.default)(results).forEach(function (result) {
276
422
  updateStats(result.isVideoMesh ? 'vmn' : 'public', result);
277
423
  });
278
- _context3.next = 13;
424
+ _context6.next = 13;
279
425
  break;
280
426
  case 10:
281
- _context3.prev = 10;
282
- _context3.t0 = _context3["catch"](2);
427
+ _context6.prev = 10;
428
+ _context6.t0 = _context6["catch"](2);
283
429
  // empty storage, that's ok
284
- _loggerProxy.default.logger.warn('Roap:request#getReachabilityMetrics --> Error parsing reachability data: ', _context3.t0);
430
+ _loggerProxy.default.logger.warn('Roap:request#getReachabilityMetrics --> Error parsing reachability data: ', _context6.t0);
285
431
  case 13:
286
- return _context3.abrupt("return", stats);
432
+ return _context6.abrupt("return", stats);
287
433
  case 14:
288
434
  case "end":
289
- return _context3.stop();
435
+ return _context6.stop();
290
436
  }
291
- }, _callee3, this, [[2, 10]]);
437
+ }, _callee6, this, [[2, 10]]);
292
438
  }));
293
439
  function getReachabilityMetrics() {
294
440
  return _getReachabilityMetrics.apply(this, arguments);
@@ -341,17 +487,17 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
341
487
  }, {
342
488
  key: "getReachabilityResults",
343
489
  value: (function () {
344
- var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
490
+ var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
345
491
  var _this2 = this;
346
492
  var results, resultsJson, allClusterResults;
347
- return _regenerator.default.wrap(function _callee4$(_context4) {
348
- while (1) switch (_context4.prev = _context4.next) {
493
+ return _regenerator.default.wrap(function _callee7$(_context7) {
494
+ while (1) switch (_context7.prev = _context7.next) {
349
495
  case 0:
350
- _context4.prev = 0;
351
- _context4.next = 3;
496
+ _context7.prev = 0;
497
+ _context7.next = 3;
352
498
  return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
353
499
  case 3:
354
- resultsJson = _context4.sent;
500
+ resultsJson = _context7.sent;
355
501
  allClusterResults = JSON.parse(resultsJson);
356
502
  results = (0, _lodash.mapValues)(allClusterResults, function (clusterResult) {
357
503
  return {
@@ -366,20 +512,20 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
366
512
  })
367
513
  };
368
514
  });
369
- _context4.next = 11;
515
+ _context7.next = 11;
370
516
  break;
371
517
  case 8:
372
- _context4.prev = 8;
373
- _context4.t0 = _context4["catch"](0);
518
+ _context7.prev = 8;
519
+ _context7.t0 = _context7["catch"](0);
374
520
  // empty storage, that's ok
375
- _loggerProxy.default.logger.warn('Roap:request#attachReachabilityData --> Error parsing reachability data: ', _context4.t0);
521
+ _loggerProxy.default.logger.warn('Reachability:index#getReachabilityResults --> Error parsing reachability data: ', _context7.t0);
376
522
  case 11:
377
- return _context4.abrupt("return", results);
523
+ return _context7.abrupt("return", results);
378
524
  case 12:
379
525
  case "end":
380
- return _context4.stop();
526
+ return _context7.stop();
381
527
  }
382
- }, _callee4, this, [[0, 8]]);
528
+ }, _callee7, this, [[0, 8]]);
383
529
  }));
384
530
  function getReachabilityResults() {
385
531
  return _getReachabilityResults.apply(this, arguments);
@@ -396,16 +542,16 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
396
542
  }, {
397
543
  key: "isAnyPublicClusterReachable",
398
544
  value: (function () {
399
- var _isAnyPublicClusterReachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
545
+ var _isAnyPublicClusterReachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
400
546
  var reachable, reachabilityData, reachabilityResults;
401
- return _regenerator.default.wrap(function _callee5$(_context5) {
402
- while (1) switch (_context5.prev = _context5.next) {
547
+ return _regenerator.default.wrap(function _callee8$(_context8) {
548
+ while (1) switch (_context8.prev = _context8.next) {
403
549
  case 0:
404
550
  reachable = false; // @ts-ignore
405
- _context5.next = 3;
551
+ _context8.next = 3;
406
552
  return this.webex.boundedStorage.get(this.namespace, _constants.REACHABILITY.localStorageResult).catch(function () {});
407
553
  case 3:
408
- reachabilityData = _context5.sent;
554
+ reachabilityData = _context8.sent;
409
555
  if (reachabilityData) {
410
556
  try {
411
557
  reachabilityResults = JSON.parse(reachabilityData);
@@ -414,15 +560,15 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
414
560
  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
561
  });
416
562
  } catch (e) {
417
- _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
563
+ _loggerProxy.default.logger.error("Reachability:index#isAnyPublicClusterReachable --> Error in parsing reachability data: ".concat(e));
418
564
  }
419
565
  }
420
- return _context5.abrupt("return", reachable);
566
+ return _context8.abrupt("return", reachable);
421
567
  case 6:
422
568
  case "end":
423
- return _context5.stop();
569
+ return _context8.stop();
424
570
  }
425
- }, _callee5, this);
571
+ }, _callee8, this);
426
572
  }));
427
573
  function isAnyPublicClusterReachable() {
428
574
  return _isAnyPublicClusterReachable.apply(this, arguments);
@@ -443,16 +589,16 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
443
589
  }, {
444
590
  key: "isWebexMediaBackendUnreachable",
445
591
  value: (function () {
446
- var _isWebexMediaBackendUnreachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
592
+ var _isWebexMediaBackendUnreachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
447
593
  var unreachable, reachabilityData, reachabilityResults, protocols;
448
- return _regenerator.default.wrap(function _callee6$(_context6) {
449
- while (1) switch (_context6.prev = _context6.next) {
594
+ return _regenerator.default.wrap(function _callee9$(_context9) {
595
+ while (1) switch (_context9.prev = _context9.next) {
450
596
  case 0:
451
597
  unreachable = false; // @ts-ignore
452
- _context6.next = 3;
598
+ _context9.next = 3;
453
599
  return this.webex.boundedStorage.get(this.namespace, _constants.REACHABILITY.localStorageResult).catch(function () {});
454
600
  case 3:
455
- reachabilityData = _context6.sent;
601
+ reachabilityData = _context9.sent;
456
602
  if (reachabilityData) {
457
603
  try {
458
604
  reachabilityResults = JSON.parse(reachabilityData);
@@ -487,15 +633,15 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
487
633
  return protocol.tested && !protocol.reachable;
488
634
  });
489
635
  } catch (e) {
490
- _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
636
+ _loggerProxy.default.logger.error("Reachability:index#isWebexMediaBackendUnreachable --> Error in parsing reachability data: ".concat(e));
491
637
  }
492
638
  }
493
- return _context6.abrupt("return", unreachable);
639
+ return _context9.abrupt("return", unreachable);
494
640
  case 6:
495
641
  case "end":
496
- return _context6.stop();
642
+ return _context9.stop();
497
643
  }
498
- }, _callee6, this);
644
+ }, _callee9, this);
499
645
  }));
500
646
  function isWebexMediaBackendUnreachable() {
501
647
  return _isWebexMediaBackendUnreachable.apply(this, arguments);
@@ -540,6 +686,28 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
540
686
  return unreachableList;
541
687
  }
542
688
 
689
+ /**
690
+ * Gets the number of reachable clusters from last run reachability check
691
+ * @returns {number} reachable clusters count
692
+ * @private
693
+ * @memberof Reachability
694
+ */
695
+ }, {
696
+ key: "getNumberOfReachableClusters",
697
+ value: function getNumberOfReachableClusters() {
698
+ var count = 0;
699
+ (0, _entries.default)(this.clusterReachability).forEach(function (_ref3) {
700
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
701
+ key = _ref4[0],
702
+ clusterReachability = _ref4[1];
703
+ var result = clusterReachability.getResult();
704
+ if (result.udp.result === 'reachable' || result.tcp.result === 'reachable' || result.xtls.result === 'reachable') {
705
+ count += 1;
706
+ }
707
+ });
708
+ return count;
709
+ }
710
+
543
711
  /**
544
712
  * Make a log of unreachable clusters.
545
713
  * @returns {undefined}
@@ -550,9 +718,9 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
550
718
  key: "logUnreachableClusters",
551
719
  value: function logUnreachableClusters() {
552
720
  var list = this.getUnreachableClusters();
553
- list.forEach(function (_ref3) {
554
- var name = _ref3.name,
555
- protocol = _ref3.protocol;
721
+ list.forEach(function (_ref5) {
722
+ var name = _ref5.name,
723
+ protocol = _ref5.protocol;
556
724
  _loggerProxy.default.logger.log("Reachability:index#logUnreachableClusters --> failed to reach ".concat(name, " over ").concat(protocol));
557
725
  });
558
726
  }
@@ -583,20 +751,26 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
583
751
 
584
752
  /**
585
753
  * Resolves the promise returned by gatherReachability() method
754
+ * @param {boolean} checkMinRequiredClusters - if true, it will check if we have reached the minimum required clusters and do a fallback if needed
586
755
  * @returns {void}
587
756
  */
588
757
  }, {
589
758
  key: "resolveReachabilityPromise",
590
759
  value: function resolveReachabilityPromise() {
591
760
  var _this$reachabilityDef;
592
- if (this.vmnTimer) {
593
- clearTimeout(this.vmnTimer);
594
- }
595
- if (this.publicCloudTimer) {
596
- clearTimeout(this.publicCloudTimer);
597
- }
761
+ var checkMinRequiredClusters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
762
+ this.totalDuration = performance.now() - this.startTime;
763
+ this.clearTimer('vmnTimer');
764
+ this.clearTimer('publicCloudTimer');
598
765
  this.logUnreachableClusters();
599
766
  (_this$reachabilityDef = this.reachabilityDefer) === null || _this$reachabilityDef === void 0 ? void 0 : _this$reachabilityDef.resolve();
767
+ if (checkMinRequiredClusters) {
768
+ var numReachableClusters = this.getNumberOfReachableClusters();
769
+ if (this.minRequiredClusters && numReachableClusters < this.minRequiredClusters) {
770
+ _loggerProxy.default.logger.log("Reachability:index#resolveReachabilityPromise --> minRequiredClusters not reached (".concat(numReachableClusters, " < ").concat(this.minRequiredClusters, "), doing reachability fallback"));
771
+ this.gatherReachabilityFallback();
772
+ }
773
+ }
600
774
  }
601
775
 
602
776
  /**
@@ -652,10 +826,10 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
652
826
  }, {
653
827
  key: "sendMetric",
654
828
  value: (function () {
655
- var _sendMetric = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
829
+ var _sendMetric = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
656
830
  var results, stats;
657
- return _regenerator.default.wrap(function _callee7$(_context7) {
658
- while (1) switch (_context7.prev = _context7.next) {
831
+ return _regenerator.default.wrap(function _callee10$(_context10) {
832
+ while (1) switch (_context10.prev = _context10.next) {
659
833
  case 0:
660
834
  results = [];
661
835
  (0, _values.default)(this.clusterReachability).forEach(function (clusterReachability) {
@@ -687,9 +861,9 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
687
861
  _metrics.default.sendBehavioralMetric(_constants2.default.REACHABILITY_COMPLETED, _metrics.default.prepareMetricFields(stats));
688
862
  case 4:
689
863
  case "end":
690
- return _context7.stop();
864
+ return _context10.stop();
691
865
  }
692
- }, _callee7, this);
866
+ }, _callee10, this);
693
867
  }));
694
868
  function sendMetric() {
695
869
  return _sendMetric.apply(this, arguments);
@@ -719,6 +893,8 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
719
893
  _this3.publicCloudTimer = undefined;
720
894
  _loggerProxy.default.logger.log("Reachability:index#startTimers --> Reachability checks timed out (".concat(DEFAULT_TIMEOUT, "s)"));
721
895
 
896
+ // check against minimum required clusters, do a new call if we don't have enough
897
+
722
898
  // resolve the promise, so that the client won't be blocked waiting on meetings.register() for too long
723
899
  _this3.resolveReachabilityPromise();
724
900
  }, DEFAULT_TIMEOUT * 1000);
@@ -743,19 +919,19 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
743
919
  }, {
744
920
  key: "storeResults",
745
921
  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) {
922
+ var _storeResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(results) {
923
+ return _regenerator.default.wrap(function _callee11$(_context11) {
924
+ while (1) switch (_context11.prev = _context11.next) {
749
925
  case 0:
750
- _context8.next = 2;
926
+ _context11.next = 2;
751
927
  return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageResult, (0, _stringify.default)(results));
752
928
  case 2:
753
929
  case "end":
754
- return _context8.stop();
930
+ return _context11.stop();
755
931
  }
756
- }, _callee8, this);
932
+ }, _callee11, this);
757
933
  }));
758
- function storeResults(_x2) {
934
+ function storeResults(_x4) {
759
935
  return _storeResults.apply(this, arguments);
760
936
  }
761
937
  return storeResults;
@@ -779,6 +955,35 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
779
955
  this.resultsCount.public.xtls = 0;
780
956
  }
781
957
 
958
+ /**
959
+ * Clears the timer
960
+ *
961
+ * @param {string} timer name of the timer to clear
962
+ * @returns {void}
963
+ */
964
+ }, {
965
+ key: "clearTimer",
966
+ value: function clearTimer(timer) {
967
+ if (this[timer]) {
968
+ clearTimeout(this[timer]);
969
+ this[timer] = undefined;
970
+ }
971
+ }
972
+
973
+ /**
974
+ * Aborts current checks that are in progress
975
+ *
976
+ * @returns {void}
977
+ */
978
+ }, {
979
+ key: "abortCurrentChecks",
980
+ value: function abortCurrentChecks() {
981
+ this.clearTimer('vmnTimer');
982
+ this.clearTimer('publicCloudTimer');
983
+ this.clearTimer('overallTimer');
984
+ this.abortClusterReachability();
985
+ }
986
+
782
987
  /**
783
988
  * Performs reachability checks for all clusters
784
989
  * @param {ClusterList} clusterList
@@ -787,27 +992,21 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
787
992
  }, {
788
993
  key: "performReachabilityChecks",
789
994
  value: (function () {
790
- var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(clusterList) {
995
+ var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(clusterList) {
791
996
  var _this4 = this;
792
997
  var results, isFirstResult;
793
- return _regenerator.default.wrap(function _callee11$(_context11) {
794
- while (1) switch (_context11.prev = _context11.next) {
998
+ return _regenerator.default.wrap(function _callee14$(_context14) {
999
+ while (1) switch (_context14.prev = _context14.next) {
795
1000
  case 0:
796
1001
  results = {};
797
1002
  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:
1003
+ this.startTime = performance.now();
804
1004
  _loggerProxy.default.logger.log("Reachability:index#performReachabilityChecks --> doing UDP".concat(
805
1005
  // @ts-ignore
806
1006
  this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : '').concat(
807
1007
  // @ts-ignore
808
1008
  this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : '', " reachability checks"));
809
1009
  this.resetResultCounters();
810
- this.startTimers();
811
1010
 
812
1011
  // sanitize the urls in the clusterList
813
1012
  (0, _keys.default)(clusterList).forEach(function (key) {
@@ -855,18 +1054,32 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
855
1054
  tcp: true,
856
1055
  xtls: true
857
1056
  }; // save the initialized results (in case we don't get any "resultReady" events at all)
858
- _context11.next = 11;
1057
+ _context14.next = 9;
859
1058
  return this.storeResults(results);
860
- case 11:
1059
+ case 9:
1060
+ if (!(!clusterList || !(0, _keys.default)(clusterList).length)) {
1061
+ _context14.next = 13;
1062
+ break;
1063
+ }
1064
+ // nothing to do, finish immediately
1065
+ this.resolveReachabilityPromise(false);
1066
+ this.emit({
1067
+ file: 'reachability',
1068
+ function: 'performReachabilityChecks'
1069
+ }, 'reachability:done', {});
1070
+ return _context14.abrupt("return");
1071
+ case 13:
1072
+ this.startTimers();
1073
+
861
1074
  // now start the reachability on all the clusters
862
1075
  (0, _keys.default)(clusterList).forEach(function (key) {
863
1076
  var cluster = clusterList[key];
864
1077
  _this4.clusterReachability[key] = new _clusterReachability.ClusterReachability(key, cluster);
865
1078
  _this4.clusterReachability[key].on(_clusterReachability.Events.resultReady, /*#__PURE__*/function () {
866
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(data) {
1079
+ var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(data) {
867
1080
  var protocol, result, clientMediaIPs, latencyInMilliseconds, areAllResultsReady;
868
- return _regenerator.default.wrap(function _callee9$(_context9) {
869
- while (1) switch (_context9.prev = _context9.next) {
1081
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1082
+ while (1) switch (_context12.prev = _context12.next) {
870
1083
  case 0:
871
1084
  protocol = data.protocol, result = data.result, clientMediaIPs = data.clientMediaIPs, latencyInMilliseconds = data.latencyInMilliseconds;
872
1085
  if (isFirstResult[protocol]) {
@@ -883,12 +1096,11 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
883
1096
  results[key][protocol].result = result;
884
1097
  results[key][protocol].clientMediaIPs = clientMediaIPs;
885
1098
  results[key][protocol].latencyInMilliseconds = latencyInMilliseconds;
886
- _context9.next = 9;
1099
+ _context12.next = 9;
887
1100
  return _this4.storeResults(results);
888
1101
  case 9:
889
1102
  if (areAllResultsReady) {
890
- clearTimeout(_this4.overallTimer);
891
- _this4.overallTimer = undefined;
1103
+ _this4.clearTimer('overallTimer');
892
1104
  _this4.emit({
893
1105
  file: 'reachability',
894
1106
  function: 'performReachabilityChecks'
@@ -899,46 +1111,131 @@ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
899
1111
  }
900
1112
  case 10:
901
1113
  case "end":
902
- return _context9.stop();
1114
+ return _context12.stop();
903
1115
  }
904
- }, _callee9);
1116
+ }, _callee12);
905
1117
  }));
906
- return function (_x4) {
907
- return _ref4.apply(this, arguments);
1118
+ return function (_x6) {
1119
+ return _ref6.apply(this, arguments);
908
1120
  };
909
1121
  }());
910
1122
 
911
1123
  // clientMediaIps can be updated independently from the results, so we need to listen for them too
912
1124
  _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) {
1125
+ var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(data) {
1126
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1127
+ while (1) switch (_context13.prev = _context13.next) {
916
1128
  case 0:
917
1129
  results[key][data.protocol].clientMediaIPs = data.clientMediaIPs;
918
- _context10.next = 3;
1130
+ _context13.next = 3;
919
1131
  return _this4.storeResults(results);
920
1132
  case 3:
921
1133
  case "end":
922
- return _context10.stop();
1134
+ return _context13.stop();
923
1135
  }
924
- }, _callee10);
1136
+ }, _callee13);
925
1137
  }));
926
- return function (_x5) {
927
- return _ref5.apply(this, arguments);
1138
+ return function (_x7) {
1139
+ return _ref7.apply(this, arguments);
928
1140
  };
929
1141
  }());
930
1142
  _this4.clusterReachability[key].start(); // not awaiting on purpose
931
1143
  });
932
- case 12:
1144
+ case 15:
933
1145
  case "end":
934
- return _context11.stop();
1146
+ return _context14.stop();
935
1147
  }
936
- }, _callee11, this);
1148
+ }, _callee14, this);
937
1149
  }));
938
- function performReachabilityChecks(_x3) {
1150
+ function performReachabilityChecks(_x5) {
939
1151
  return _performReachabilityChecks.apply(this, arguments);
940
1152
  }
941
1153
  return performReachabilityChecks;
1154
+ }()
1155
+ /**
1156
+ * Returns the clientMediaPreferences object that needs to be sent to the backend
1157
+ * when joining a meeting
1158
+ *
1159
+ * @param {boolean} isMultistream
1160
+ * @param {IP_VERSION} ipver
1161
+ * @returns {Object}
1162
+ */
1163
+ )
1164
+ }, {
1165
+ key: "getClientMediaPreferences",
1166
+ value: (function () {
1167
+ var _getClientMediaPreferences = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(isMultistream, ipver) {
1168
+ var reachabilityReport;
1169
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1170
+ while (1) switch (_context15.prev = _context15.next) {
1171
+ case 0:
1172
+ if (this.orpheusApiVersion) {
1173
+ _context15.next = 7;
1174
+ break;
1175
+ }
1176
+ _context15.t0 = ipver;
1177
+ _context15.next = 4;
1178
+ return this.getJoinCookie();
1179
+ case 4:
1180
+ _context15.t1 = _context15.sent;
1181
+ _context15.t2 = !isMultistream;
1182
+ return _context15.abrupt("return", {
1183
+ ipver: _context15.t0,
1184
+ joinCookie: _context15.t1,
1185
+ preferTranscoding: _context15.t2
1186
+ });
1187
+ case 7:
1188
+ _context15.next = 9;
1189
+ return this.getReachabilityReport();
1190
+ case 9:
1191
+ reachabilityReport = _context15.sent;
1192
+ return _context15.abrupt("return", _objectSpread({
1193
+ ipver: ipver,
1194
+ preferTranscoding: !isMultistream
1195
+ }, reachabilityReport));
1196
+ case 11:
1197
+ case "end":
1198
+ return _context15.stop();
1199
+ }
1200
+ }, _callee15, this);
1201
+ }));
1202
+ function getClientMediaPreferences(_x8, _x9) {
1203
+ return _getClientMediaPreferences.apply(this, arguments);
1204
+ }
1205
+ return getClientMediaPreferences;
1206
+ }()
1207
+ /**
1208
+ * Returns the reachability report that needs to be attached to the ROAP messages
1209
+ * that we send to the backend.
1210
+ * It may return undefined, if reachability is not needed to be attached to ROAP messages (that's the case for v1 or Orpheus API)
1211
+ *
1212
+ * @returns {Promise<ReachabilityReportV0>} object that needs to be attached to Roap messages
1213
+ */
1214
+ )
1215
+ }, {
1216
+ key: "getReachabilityReportToAttachToRoap",
1217
+ value: (function () {
1218
+ var _getReachabilityReportToAttachToRoap = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1219
+ return _regenerator.default.wrap(function _callee16$(_context16) {
1220
+ while (1) switch (_context16.prev = _context16.next) {
1221
+ case 0:
1222
+ if (this.orpheusApiVersion) {
1223
+ _context16.next = 2;
1224
+ break;
1225
+ }
1226
+ return _context16.abrupt("return", this.getReachabilityResults());
1227
+ case 2:
1228
+ return _context16.abrupt("return", undefined);
1229
+ case 3:
1230
+ case "end":
1231
+ return _context16.stop();
1232
+ }
1233
+ }, _callee16, this);
1234
+ }));
1235
+ function getReachabilityReportToAttachToRoap() {
1236
+ return _getReachabilityReportToAttachToRoap.apply(this, arguments);
1237
+ }
1238
+ return getReachabilityReportToAttachToRoap;
942
1239
  }())
943
1240
  }]);
944
1241
  return Reachability;