@webex/plugin-meetings 3.12.0 → 3.13.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +208 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.wasm +0 -0
  42. package/dist/aiEnableRequest/index.js +15 -2
  43. package/dist/aiEnableRequest/index.js.map +1 -1
  44. package/dist/annotation/index.js +55 -19
  45. package/dist/annotation/index.js.map +1 -1
  46. package/dist/assets/e2ee-0.0.1.js +2 -0
  47. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  48. package/dist/breakouts/breakout.js +8 -3
  49. package/dist/breakouts/breakout.js.map +1 -1
  50. package/dist/breakouts/events.js +29 -14
  51. package/dist/breakouts/events.js.map +1 -1
  52. package/dist/breakouts/index.js +128 -7
  53. package/dist/breakouts/index.js.map +1 -1
  54. package/dist/common/errors/webex-errors.js +54 -5
  55. package/dist/common/errors/webex-errors.js.map +1 -1
  56. package/dist/config.js +4 -2
  57. package/dist/config.js.map +1 -1
  58. package/dist/constants.js +39 -11
  59. package/dist/constants.js.map +1 -1
  60. package/dist/controls-options-manager/constants.js +11 -1
  61. package/dist/controls-options-manager/constants.js.map +1 -1
  62. package/dist/controls-options-manager/index.js +67 -29
  63. package/dist/controls-options-manager/index.js.map +1 -1
  64. package/dist/controls-options-manager/util.js +91 -0
  65. package/dist/controls-options-manager/util.js.map +1 -1
  66. package/dist/hashTree/constants.js +13 -1
  67. package/dist/hashTree/constants.js.map +1 -1
  68. package/dist/hashTree/hashTreeParser.js +1245 -404
  69. package/dist/hashTree/hashTreeParser.js.map +1 -1
  70. package/dist/hashTree/utils.js +42 -0
  71. package/dist/hashTree/utils.js.map +1 -1
  72. package/dist/index.js +8 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/interceptors/dataChannelAuthToken.js +58 -16
  75. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  76. package/dist/interceptors/locusRetry.js +24 -9
  77. package/dist/interceptors/locusRetry.js.map +1 -1
  78. package/dist/interpretation/index.js +55 -12
  79. package/dist/interpretation/index.js.map +1 -1
  80. package/dist/interpretation/interpretation.types.js +7 -0
  81. package/dist/interpretation/interpretation.types.js.map +1 -0
  82. package/dist/interpretation/siLanguage.js +1 -1
  83. package/dist/locus-info/controlsUtils.js +4 -1
  84. package/dist/locus-info/controlsUtils.js.map +1 -1
  85. package/dist/locus-info/index.js +914 -196
  86. package/dist/locus-info/index.js.map +1 -1
  87. package/dist/locus-info/infoUtils.js +36 -5
  88. package/dist/locus-info/infoUtils.js.map +1 -1
  89. package/dist/locus-info/types.js +20 -0
  90. package/dist/locus-info/types.js.map +1 -1
  91. package/dist/media/MediaConnectionAwaiter.js +229 -166
  92. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  93. package/dist/media/index.js +8 -2
  94. package/dist/media/index.js.map +1 -1
  95. package/dist/media/properties.js +4 -5
  96. package/dist/media/properties.js.map +1 -1
  97. package/dist/meeting/in-meeting-actions.js +5 -1
  98. package/dist/meeting/in-meeting-actions.js.map +1 -1
  99. package/dist/meeting/index.js +1931 -887
  100. package/dist/meeting/index.js.map +1 -1
  101. package/dist/meeting/locusMediaRequest.js +229 -82
  102. package/dist/meeting/locusMediaRequest.js.map +1 -1
  103. package/dist/meeting/muteState.js +10 -1
  104. package/dist/meeting/muteState.js.map +1 -1
  105. package/dist/meeting/request.js +5 -2
  106. package/dist/meeting/request.js.map +1 -1
  107. package/dist/meeting/util.js +42 -3
  108. package/dist/meeting/util.js.map +1 -1
  109. package/dist/meeting/voicea-meeting.js +2 -1
  110. package/dist/meeting/voicea-meeting.js.map +1 -1
  111. package/dist/meeting-info/meeting-info-v2.js +12 -5
  112. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  113. package/dist/meetings/index.js +322 -129
  114. package/dist/meetings/index.js.map +1 -1
  115. package/dist/meetings/meetings.types.js +6 -1
  116. package/dist/meetings/meetings.types.js.map +1 -1
  117. package/dist/meetings/request.js +39 -0
  118. package/dist/meetings/request.js.map +1 -1
  119. package/dist/meetings/util.js +116 -18
  120. package/dist/meetings/util.js.map +1 -1
  121. package/dist/member/index.js +10 -0
  122. package/dist/member/index.js.map +1 -1
  123. package/dist/member/types.js.map +1 -1
  124. package/dist/member/util.js +30 -0
  125. package/dist/member/util.js.map +1 -1
  126. package/dist/members/index.js +101 -43
  127. package/dist/members/index.js.map +1 -1
  128. package/dist/members/util.js +8 -1
  129. package/dist/members/util.js.map +1 -1
  130. package/dist/metrics/constants.js +11 -1
  131. package/dist/metrics/constants.js.map +1 -1
  132. package/dist/multistream/codec/constants.js +63 -0
  133. package/dist/multistream/codec/constants.js.map +1 -0
  134. package/dist/multistream/mediaRequestManager.js +62 -15
  135. package/dist/multistream/mediaRequestManager.js.map +1 -1
  136. package/dist/multistream/receiveSlot.js +9 -0
  137. package/dist/multistream/receiveSlot.js.map +1 -1
  138. package/dist/multistream/remoteMediaManager.js +32 -4
  139. package/dist/multistream/remoteMediaManager.js.map +1 -1
  140. package/dist/multistream/sendSlotManager.js +127 -3
  141. package/dist/multistream/sendSlotManager.js.map +1 -1
  142. package/dist/reachability/clusterReachability.js.map +1 -1
  143. package/dist/reachability/index.js +121 -83
  144. package/dist/reachability/index.js.map +1 -1
  145. package/dist/reachability/reachability.types.js +2 -0
  146. package/dist/reachability/reachability.types.js.map +1 -1
  147. package/dist/reachability/util.js +45 -0
  148. package/dist/reachability/util.js.map +1 -1
  149. package/dist/reactions/reactions.type.js.map +1 -1
  150. package/dist/recording-controller/index.js +1 -3
  151. package/dist/recording-controller/index.js.map +1 -1
  152. package/dist/roap/turnDiscovery.js +8 -1
  153. package/dist/roap/turnDiscovery.js.map +1 -1
  154. package/dist/types/annotation/index.d.ts +19 -0
  155. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  156. package/dist/types/config.d.ts +4 -2
  157. package/dist/types/constants.d.ts +15 -2
  158. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  159. package/dist/types/controls-options-manager/index.d.ts +16 -0
  160. package/dist/types/hashTree/constants.d.ts +2 -0
  161. package/dist/types/hashTree/hashTreeParser.d.ts +230 -18
  162. package/dist/types/hashTree/utils.d.ts +18 -0
  163. package/dist/types/index.d.ts +4 -0
  164. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  165. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  166. package/dist/types/locus-info/index.d.ts +151 -15
  167. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  168. package/dist/types/locus-info/types.d.ts +28 -1
  169. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  170. package/dist/types/media/properties.d.ts +6 -2
  171. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  172. package/dist/types/meeting/index.d.ts +247 -13
  173. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  174. package/dist/types/meeting/request.d.ts +1 -0
  175. package/dist/types/meeting/util.d.ts +12 -1
  176. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  177. package/dist/types/meetings/index.d.ts +40 -19
  178. package/dist/types/meetings/meetings.types.d.ts +15 -0
  179. package/dist/types/meetings/request.d.ts +14 -0
  180. package/dist/types/member/index.d.ts +1 -0
  181. package/dist/types/member/types.d.ts +1 -0
  182. package/dist/types/member/util.d.ts +9 -0
  183. package/dist/types/members/index.d.ts +15 -2
  184. package/dist/types/members/util.d.ts +1 -5
  185. package/dist/types/metrics/constants.d.ts +10 -0
  186. package/dist/types/multistream/codec/constants.d.ts +7 -0
  187. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  188. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  189. package/dist/types/multistream/sendSlotManager.d.ts +28 -2
  190. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  191. package/dist/types/reachability/index.d.ts +10 -3
  192. package/dist/types/reachability/reachability.types.d.ts +7 -0
  193. package/dist/types/reachability/util.d.ts +17 -0
  194. package/dist/types/reactions/reactions.type.d.ts +3 -0
  195. package/dist/webinar/index.js +539 -245
  196. package/dist/webinar/index.js.map +1 -1
  197. package/package.json +26 -24
  198. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  199. package/src/aiEnableRequest/index.ts +16 -0
  200. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  201. package/src/annotation/index.ts +61 -29
  202. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  203. package/src/breakouts/breakout.ts +3 -1
  204. package/src/breakouts/events.ts +33 -11
  205. package/src/breakouts/index.ts +145 -3
  206. package/src/common/errors/webex-errors.ts +56 -3
  207. package/src/config.ts +8 -3
  208. package/src/constants.ts +23 -4
  209. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  210. package/src/controls-options-manager/constants.ts +14 -1
  211. package/src/controls-options-manager/index.ts +87 -28
  212. package/src/controls-options-manager/util.ts +81 -1
  213. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  214. package/src/hashTree/constants.ts +16 -0
  215. package/src/hashTree/hashTreeParser.ts +1021 -214
  216. package/src/hashTree/utils.ts +36 -0
  217. package/src/index.ts +7 -0
  218. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  219. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  220. package/src/interceptors/locusRetry.ts +26 -5
  221. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  222. package/src/interpretation/index.ts +65 -10
  223. package/src/interpretation/interpretation.types.ts +11 -0
  224. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  225. package/src/locus-info/controlsUtils.ts +3 -1
  226. package/src/locus-info/index.ts +907 -184
  227. package/src/locus-info/infoUtils.ts +41 -6
  228. package/src/locus-info/types.ts +33 -1
  229. package/src/media/MediaConnectionAwaiter.ts +229 -196
  230. package/src/media/ai-docs/media-spec.md +267 -0
  231. package/src/media/index.ts +10 -1
  232. package/src/media/properties.ts +8 -3
  233. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  234. package/src/meeting/in-meeting-actions.ts +8 -0
  235. package/src/meeting/index.ts +1237 -254
  236. package/src/meeting/locusMediaRequest.ts +106 -6
  237. package/src/meeting/muteState.ts +10 -1
  238. package/src/meeting/request.ts +11 -0
  239. package/src/meeting/util.ts +53 -8
  240. package/src/meeting/voicea-meeting.ts +1 -1
  241. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  242. package/src/meeting-info/meeting-info-v2.ts +11 -4
  243. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  244. package/src/meetings/index.ts +224 -80
  245. package/src/meetings/meetings.types.ts +19 -0
  246. package/src/meetings/request.ts +43 -0
  247. package/src/meetings/util.ts +117 -4
  248. package/src/member/ai-docs/member-spec.md +196 -0
  249. package/src/member/index.ts +10 -0
  250. package/src/member/types.ts +1 -0
  251. package/src/member/util.ts +29 -0
  252. package/src/members/ai-docs/members-spec.md +256 -0
  253. package/src/members/index.ts +70 -7
  254. package/src/members/util.ts +12 -4
  255. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  256. package/src/metrics/constants.ts +11 -0
  257. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  258. package/src/multistream/codec/constants.ts +58 -0
  259. package/src/multistream/mediaRequestManager.ts +119 -28
  260. package/src/multistream/receiveSlot.ts +18 -0
  261. package/src/multistream/remoteMediaManager.ts +23 -1
  262. package/src/multistream/sendSlotManager.ts +112 -4
  263. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  264. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  265. package/src/reachability/clusterReachability.ts +3 -2
  266. package/src/reachability/index.ts +47 -16
  267. package/src/reachability/reachability.types.ts +11 -0
  268. package/src/reachability/util.ts +36 -0
  269. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  270. package/src/reactions/reactions.type.ts +3 -0
  271. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  272. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  273. package/src/recording-controller/index.ts +1 -2
  274. package/src/roap/ai-docs/roap-spec.md +241 -0
  275. package/src/roap/turnDiscovery.ts +9 -1
  276. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  277. package/src/webinar/index.ts +333 -73
  278. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  279. package/test/unit/spec/annotation/index.ts +214 -182
  280. package/test/unit/spec/breakouts/breakout.ts +9 -3
  281. package/test/unit/spec/breakouts/events.ts +120 -2
  282. package/test/unit/spec/breakouts/index.ts +336 -15
  283. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  284. package/test/unit/spec/controls-options-manager/index.js +244 -29
  285. package/test/unit/spec/controls-options-manager/util.js +165 -0
  286. package/test/unit/spec/hashTree/hashTreeParser.ts +3126 -238
  287. package/test/unit/spec/hashTree/utils.ts +125 -1
  288. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  289. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  290. package/test/unit/spec/interpretation/index.ts +119 -4
  291. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  292. package/test/unit/spec/locus-info/index.js +1880 -136
  293. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  294. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  295. package/test/unit/spec/media/index.ts +92 -0
  296. package/test/unit/spec/media/properties.ts +26 -26
  297. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  298. package/test/unit/spec/meeting/index.js +3697 -501
  299. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  300. package/test/unit/spec/meeting/muteState.js +81 -0
  301. package/test/unit/spec/meeting/request.js +12 -0
  302. package/test/unit/spec/meeting/utils.js +206 -16
  303. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  304. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  305. package/test/unit/spec/meetings/index.js +586 -53
  306. package/test/unit/spec/meetings/request.js +141 -0
  307. package/test/unit/spec/meetings/utils.js +402 -51
  308. package/test/unit/spec/member/index.js +7 -0
  309. package/test/unit/spec/member/util.js +89 -0
  310. package/test/unit/spec/members/index.js +216 -0
  311. package/test/unit/spec/members/request.js +37 -1
  312. package/test/unit/spec/members/utils.js +63 -0
  313. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  314. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  315. package/test/unit/spec/multistream/sendSlotManager.ts +165 -38
  316. package/test/unit/spec/reachability/index.ts +128 -46
  317. package/test/unit/spec/reachability/util.ts +31 -0
  318. package/test/unit/spec/recording-controller/index.js +9 -8
  319. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  320. package/test/unit/spec/webinar/index.ts +982 -328
@@ -0,0 +1,261 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: module-spec
3
+ generated_from: module-spec@0.2.2
4
+ generator_plugin: repo-annotation@1.0.5+codex.20260818094939
5
+ generated_by: codex
6
+ approved_by: repository user
7
+ updated_at: 2026-08-22T15:21:29Z
8
+ validation_status: pass-with-warnings
9
+ -->
10
+ # REACHABILITY — SPEC
11
+
12
+ > Start here → root [`AGENTS.md`](../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md). This is the canonical source-local spec for `src/reachability/`.
13
+
14
+ ## Metadata
15
+
16
+ | Field | Value |
17
+ |---|---|
18
+ | Module id | `reachability` |
19
+ | Source path(s) | `src/reachability/` |
20
+ | Parent spec | — |
21
+ | Doc kind | Module spec |
22
+ | Coverage score | 93% assessed 2026-08-22; 13/14 mandatory fields present; all critical and Important fields present; one noncritical polish gap remains; pending independent validation of the participant-role repair |
23
+ | Generated from | `module-spec` @ SDLC template library `0.2.2` |
24
+ | generated_by / approved_by / updated_at | codex / repository user / 2026-08-22T15:21:29Z |
25
+ | Validation status | pass-with-warnings |
26
+
27
+ ## Evidence Rules
28
+
29
+ Requirements cite current implementation and mirrored unit-test paths. Current code wins over retained prose when they conflict; commit and PR history are excluded by repository-owner decision. Missing test evidence is stated as a gap rather than inferred.
30
+
31
+ ## Source Material Register
32
+
33
+ | Source material | Scope | Decision | Detail location or disposition |
34
+ |---|---|---|---|
35
+ | No routed legacy module spec | overview / API / behavior / tests | none; generated from current cluster/probe/request code and tests |
36
+ | Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
37
+
38
+ ## Overview
39
+
40
+ `src/reachability/` contains 6 direct source/reference file(s) and has 4 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
41
+
42
+ ## Purpose / Responsibility
43
+
44
+ Discovers media clusters, probes protocol reachability with peer connections, determines NAT characteristics, and reports results.
45
+
46
+ ## Stack
47
+
48
+ TypeScript/JavaScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and Mocha/Sinon/`@webex/test-helper-chai` tests. Build target: `yarn workspace @webex/plugin-meetings build:src`.
49
+
50
+ ## Folder / Package Structure
51
+
52
+ ```text
53
+ src/reachability/
54
+ ├── clusterReachability.ts — clusterReachability implementation responsibility
55
+ ├── index.ts — module facade/controller or primary exports
56
+ ├── reachability.types.ts — module type declarations
57
+ ├── reachabilityPeerConnection.ts — reachabilityPeerConnection implementation responsibility
58
+ ├── request.ts — HTTP request boundary
59
+ ├── util.ts — normalization/helper functions
60
+ └── ai-docs/reachability-spec.md — canonical module specification
61
+ ```
62
+
63
+ ## Key Files (source of truth)
64
+
65
+ | File | Holds |
66
+ |---|---|
67
+ | `src/reachability/clusterReachability.ts` | clusterReachability implementation responsibility |
68
+ | `src/reachability/index.ts` | module facade/controller or primary exports |
69
+ | `src/reachability/reachability.types.ts` | module type declarations |
70
+ | `src/reachability/reachabilityPeerConnection.ts` | reachabilityPeerConnection implementation responsibility |
71
+ | `src/reachability/request.ts` | HTTP request boundary |
72
+ | `src/reachability/util.ts` | normalization/helper functions |
73
+ | `test/unit/spec/reachability/clusterReachability.ts` and 3 sibling test file(s) | mirrored characterization/unit coverage |
74
+
75
+ ## Public Surface
76
+
77
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
78
+ |---|---|---|---|---|---|---|
79
+ | `reachability.1` | SDK / remote | `Reachability.getClusters()` and `gatherReachability()` | Fetch cluster discovery data, cache the join cookie, and start a configured reachability run. | Disabled reachability rejects before the catch boundary; missing WebRTC capability or caught discovery/probe failure returns `{}`; a started successful run resolves its defer promise with `undefined` after storing results. | `src/reachability/index.ts`, `src/reachability/request.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
80
+ | `reachability.2` | SDK / async | `ClusterReachability.getResult()`, `start()`, `abort()` and `ReachabilityPeerConnection.getResult()`, `start()`, `abort()` | Run and settle per-cluster/per-protocol WebRTC probes with owned timers and peer connections. | Preserve the `udp`, `tcp`, and `xtls` protocol names and one-settlement cleanup. | `src/reachability/clusterReachability.ts`, `src/reachability/reachabilityPeerConnection.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
81
+ | `reachability.3` | SDK / lifecycle | `gatherReachabilityFallback()` and `stopReachability()` | Restart with fallback discovery when the minimum cluster target is missed, or abort an active run. | Both paths absorb their documented internal failures; stop emits `reachability:stopped` only for an active timer. | `src/reachability/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
82
+ | `reachability.4` | SDK / query | `isSubnetReachable()`, `isAnyPublicClusterReachable()`, `isWebexMediaBackendUnreachable()`, and `isAnyClusterReachableViaProtocol()` | Answer media-selection questions from the latest in-memory cluster results. | Preserve boolean/null semantics and current public/video-mesh distinctions. | `src/reachability/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
83
+ | `reachability.5` | SDK / report | `getJoinCookie()`, `getReachabilityReport()`, `getReachabilityMetrics()`, `getReachabilityResults()`, `getClientMediaPreferences()`, and `getReachabilityReportToAttachToRoap()` | Read cached/in-memory results and format local metrics, media preferences, or ROAP attachment data. | These methods construct/return data; they do not submit a reachability report to the service. | `src/reachability/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
84
+ | `reachability.6` | exported utilities | `resolveReachabilityProtocols()`, `isReachabilityEnabled()`, `convertStunUrlToTurn()`, and `convertStunUrlToTurnTls()` | Resolve configured protocol sets and transform validated STUN URLs for probe setup. | Invalid STUN input throws; preserve `xtls` and URL conversion behavior. | `src/reachability/util.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
85
+ | `reachability.7` | exported events/types | `Events`, `ResultEventData`, `ClientMediaIpsUpdatedEventData`, `NatTypeUpdatedEventData`, `Protocol`, `ResolvedReachabilityProtocols`, `ReachabilityProtocolConfig`, `EnableReachabilityChecksConfig`, `ReachabilityPeerConnectionEvents`, `TransportResult`, `NatType`, `ClusterReachabilityResult`, `ReachabilityMetrics`, `TransportResultForBackend`, `ReachabilityResultForBackend`, `ReachabilityResultsForBackend`, `ReachabilityResults`, `ReachabilityReportV0`, `ReachabilityReportV1`, `ClientMediaPreferences`, `GetClustersTrigger`, `ClusterNode`, and `ClusterList` | Share the exact probe/result vocabulary with Meetings, metrics, and ROAP code. | Add fields compatibly and preserve raw result/protocol/NAT values. | `src/reachability/clusterReachability.ts`, `src/reachability/reachability.types.ts`, `src/reachability/request.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
86
+ | `reachability.8` | dormant request helper | `ReachabilityRequest.remoteSDPForClusters()` | POST local SDP offers to the reachability resource and return remote SDP bodies when called directly. | No current package code invokes this exported helper; do not present it as part of `gatherReachability()`. | `src/reachability/request.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
87
+
88
+ ### Emitted events
89
+
90
+ Current source emits these observable literals from the `Reachability` controller. Preserve literal values and the current terminal/progress timing.
91
+
92
+ | Event literal | Constant / expression | Emission evidence |
93
+ |---|---|---|
94
+ | `reachability:done` | inline literal | `src/reachability/index.ts` |
95
+ | `reachability:firstResultAvailable` | inline literal | `src/reachability/index.ts` |
96
+ | `reachability:stopped` | inline literal | `src/reachability/index.ts` |
97
+
98
+ Compatibility notes:
99
+ - Prefer additive options and payload fields. Preserve method/event names, rejection semantics, and cleanup timing; route public changes through `src/index.ts` or the documented owning object.
100
+
101
+ ## Requires (dependencies)
102
+
103
+ Webex reachability services, browser RTCPeerConnection, STUN/TURN candidates, timers, and metrics/request access.
104
+
105
+ ## Requirements
106
+
107
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
108
+ |---|---|---|---|---|---|---|
109
+ | `REACHABILITY-R-001` | fetch and normalize candidate clusters. | Discovers media clusters, probes protocol reachability with peer connections, determines NAT characteristics, and reports results. | `src/reachability/index.ts` | `test/unit/spec/reachability/index.ts` | none | PRESENT |
110
+ | `REACHABILITY-R-002` | Run the `udp`, `tcp`, and `xtls` reachability probes used by code and metric keys. | Callers and telemetry consumers need the exact wire/field name rather than an ambiguous prose-only TLS label. | `src/reachability/index.ts`, `src/reachability/clusterReachability.ts`, `src/reachability/reachability.types.ts` | `test/unit/spec/reachability/index.ts` | none | PRESENT |
111
+ | `REACHABILITY-R-003` | `gatherReachability()` throws from its `async` body when reachability is disabled before entering its `try`, so the returned promise rejects; it returns `{}` when WebRTC is unavailable or when discovery/probe setup fails inside the `try`. A started successful run returns the defer promise, which resolves with `undefined` after results are stored. `getClusters()` retries once and can reject its direct caller on the second failure; fallback catches and logs its own failures. | Callers must distinguish the disabled-config rejection, empty-object skip/failure sentinel, and successful void settlement instead of treating every gather outcome as `{}` or a rejection. | `src/reachability/index.ts`, `src/reachability/clusterReachability.ts`, `src/reachability/reachabilityPeerConnection.ts` | `test/unit/spec/reachability/index.ts`, `test/unit/spec/reachability/clusterReachability.ts` | none | PRESENT |
112
+ | `REACHABILITY-R-004` | Each cluster/protocol probe settles once, closes its peer connection/timer, and contributes an explicit reachable/unreachable result. | ICE events and timeouts race; deterministic cleanup and aggregation prevent false success and leaks. | `src/reachability/clusterReachability.ts`, `src/reachability/reachabilityPeerConnection.ts` | `test/unit/spec/reachability/clusterReachability.ts` | none | PRESENT |
113
+ | `REACHABILITY-R-005` | The aggregate report preserves IP version, NAT/protocol/cluster outcomes, previous-report context, and trigger. | The backend and media selection need comparable current results rather than a single boolean. | `src/reachability/index.ts`, `src/reachability/reachability.types.ts`, `src/reachability/request.ts` | `test/unit/spec/reachability/index.ts`, `test/unit/spec/reachability/request.js` | none | PRESENT |
114
+
115
+ ## Design Overview
116
+
117
+ `Reachability` fetches media clusters with `request.ts`, builds a `ClusterReachability` aggregate per cluster, and runs UDP/TCP/`xtls` probes through `ReachabilityPeerConnection`; each probe owns and closes its peer connection and timeout.
118
+
119
+ ## Data Flow
120
+
121
+ ```mermaid
122
+ flowchart LR
123
+ Caller[Meetings registration / diagnostics] --> Reach[index.ts]
124
+ Reach --> Request[request.ts cluster discovery]
125
+ Request --> Service[reachability service]
126
+ Reach --> Cluster[clusterReachability.ts]
127
+ Cluster --> Probe[reachabilityPeerConnection.ts]
128
+ Probe --> ICE[WebRTC ICE candidate gathering]
129
+ Probe --> Cluster
130
+ Cluster --> Reach
131
+ Reach --> Local[local report / metrics / ROAP attachment]
132
+ ```
133
+
134
+ ## Sequence Diagram(s)
135
+
136
+ Sequence coverage:
137
+
138
+ | Operation group | Diagram | Failure coverage |
139
+ |---|---|---|
140
+ | UC-1…UC-5 — reachability discovery and probe operation groups | Reachability discovery and probe primary sequence | second discovery failure, absorbed gather failure, probe timeout/abort, and peer cleanup |
141
+ | UC-1…UC-5 — reachability discovery and probe alternate/failure paths | Reachability discovery and probe alternate/failure sequence | cluster discovery failure, ICE timeout, peer-connection failure, unsupported protocol, or explicit stop |
142
+
143
+ ### Reachability discovery and probe primary sequence
144
+
145
+ ```mermaid
146
+ sequenceDiagram
147
+ participant C as Caller
148
+ participant R as Reachability index.ts
149
+ participant Q as request.ts
150
+ participant P as ReachabilityPeerConnection
151
+ C->>R: gatherReachability()
152
+ R->>Q: fetch clusters
153
+ Q-->>R: candidate cluster list
154
+ loop UDP, TCP, xtls per cluster
155
+ R->>P: start probe
156
+ P-->>R: reachable/unreachable after ICE or timeout
157
+ end
158
+ R->>R: build in-memory results/report data
159
+ R-->>C: defer settles undefined; disabled rejects; skipped/caught failure returns empty object
160
+ ```
161
+
162
+ ### Reachability discovery and probe alternate/failure sequence
163
+
164
+ ```mermaid
165
+ sequenceDiagram
166
+ participant R as Reachability
167
+ participant P as Protocol probe
168
+ participant W as RTCPeerConnection
169
+ R->>P: probe cluster with udp, tcp, or xtls
170
+ P->>W: gather ICE candidates
171
+ alt candidate proves reachable
172
+ W-->>P: matching candidate
173
+ P-->>R: reachable result; close connection/timer
174
+ else timeout or terminal probe error
175
+ W--xP: timeout/error
176
+ P-->>R: unreachable result or rejection; close connection/timer
177
+ end
178
+ ```
179
+
180
+ ## Class / Component Relationships
181
+
182
+ ```mermaid
183
+ classDiagram
184
+ class Caller
185
+ class Reach
186
+ class Request
187
+ class Service
188
+ class Cluster
189
+ class Probe
190
+ class ICE
191
+ Caller --> Reach
192
+ Reach --> Request
193
+ Request --> Service
194
+ Reach --> Cluster
195
+ Cluster --> Probe
196
+ Probe --> ICE
197
+ Probe --> Cluster
198
+ Cluster --> Reach
199
+ Reach --> Request
200
+ ```
201
+
202
+ The arrows identify ownership and delegation inside `src/reachability/`; files that only declare types or constants are not presented as transports.
203
+
204
+ ## Use Cases
205
+
206
+ - **UC-1:** Fetch clusters with one retry, store the returned join cookie, and start enabled `udp`, `tcp`, and `xtls` probes. Evidence: `src/reachability/index.ts`, `src/reachability/request.ts`.
207
+ - **UC-2:** Settle each cluster/protocol probe once and close its timer and peer connection on success, failure, timeout, or abort. Evidence: `src/reachability/clusterReachability.ts`, `src/reachability/reachabilityPeerConnection.ts`.
208
+ - **UC-3:** Reject before probing when reachability is disabled, return `{}` when WebRTC is unavailable or a discovery/probe setup failure is caught, and otherwise resolve the run's defer with `undefined` after storing results. Evidence: `src/reachability/index.ts`.
209
+ - **UC-4:** Trigger fallback discovery when the minimum reachable-cluster threshold is missed, aborting the previous run before probing the replacement list. Evidence: `src/reachability/index.ts`.
210
+ - **UC-5:** Read results as metrics, client media preferences, or a ROAP attachment without calling the dormant `ReachabilityRequest.remoteSDPForClusters()` helper. Evidence: `src/reachability/index.ts`, `src/reachability/request.ts`.
211
+
212
+ ## State Model
213
+
214
+ Cluster/protocol probe state, peer connections, timers, partial results, and cached report data exist for one reachability run.
215
+
216
+ ## Business Rules & Invariants
217
+
218
+ - Each probe settles once and closes its peer connection/timer; unsupported or failed protocols are reported rather than inferred reachable. Enforced by `src/reachability/index.ts` and supporting code under `src/reachability/`.
219
+
220
+ ## Concurrency & Reactive Flow
221
+
222
+ - Each cluster/protocol probe owns one peer connection and timeout, settles once from its ICE/error/timeout path, and closes both resources before contributing to the aggregate. Cluster discovery is requested remotely; report/metric/ROAP shapes are constructed locally. Only failures inside `gatherReachability()`'s `try` are absorbed as `{}`; disabled configuration rejects before that boundary.
223
+
224
+ ## Protocol / Wire Format
225
+
226
+ - External payloads are parsed/serialized by files under `src/reachability/` and existing Webex/media dependencies. Preserve current field names, enum/raw values, sequence identifiers, and compatibility behavior; do not treat the normalized client model as the wire schema.
227
+
228
+ ## Error Handling & Failure Modes
229
+
230
+ | Condition | Signal | Caller recovery |
231
+ |---|---|---|
232
+ | Reachability is disabled in configuration | `gatherReachability()` throws `enableReachabilityChecks is disabled in config` from its `async` body before entering the catch block, which rejects the returned promise. | Enable the configured checks or handle the rejection; do not expect `{}` for this path. |
233
+ | Cluster discovery still fails after `getClusters()` retries once | A direct `getClusters()` caller receives the rejection; `gatherReachability()` and fallback callers catch it and resolve with their documented empty/void outcome. | Distinguish direct discovery from the failure-absorbing gather APIs. |
234
+ | ICE timeout or supported probe cannot establish reachability | The probe settles on its current unreachable/rejection path and closes its peer connection and timeout. | Record the explicit unreachable result; do not retain the probe connection. |
235
+ | All `udp`, `tcp`, and `xtls` probes settle | The module stores aggregate protocol/cluster/NAT/IP-version results, emits completion, and resolves the gather defer with `undefined`; no report-submission call is made. | Read the stored/local report through the query/report helpers rather than expecting the gather promise to carry the result object. |
236
+
237
+ ## Pitfalls
238
+
239
+ - Browser ICE callbacks and timeout can race. Cleanup must be idempotent and partial results must not be presented as a complete success.
240
+ - Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
241
+
242
+ ## Key Design Trade-off
243
+
244
+ - Parallel probes reduce startup time but require per-probe isolation and deterministic aggregation.
245
+
246
+ ## Test-Case Strategy (module)
247
+
248
+ Use the current mirrored suites: `test/unit/spec/reachability/clusterReachability.ts`, `test/unit/spec/reachability/index.ts`, `test/unit/spec/reachability/request.js`, `test/unit/spec/reachability/util.ts`. Characterize the reachability-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
249
+
250
+ | Behavior / Requirement | Existing test evidence | Gap |
251
+ |---|---|---|
252
+ | `REACHABILITY-R-001` | `test/unit/spec/reachability/index.ts` | cover discovery, probe, fallback, stop, query, and report-format groups |
253
+ | `REACHABILITY-R-002` | `test/unit/spec/reachability/index.ts` | second discovery failure versus absorbed gather failure needs paired assertions |
254
+ | `REACHABILITY-R-003` | `test/unit/spec/reachability/index.ts` | keep paired assertions for disabled-config rejection, WebRTC/caught-failure `{}`, successful `undefined` defer settlement, and no `remoteSDPForClusters()` invocation |
255
+ | `REACHABILITY-R-004` | `test/unit/spec/reachability/clusterReachability.ts` | verify callback/timeout races |
256
+ | `REACHABILITY-R-005` | `test/unit/spec/reachability/index.ts`, `test/unit/spec/reachability/request.js` | verify partial/mixed protocol reports |
257
+
258
+ ## Traceability
259
+
260
+ - Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
261
+ - Coverage state and contracts baseline: `../../../.sdd/manifest.json`
@@ -6,13 +6,14 @@ import {Enum} from '../constants';
6
6
  import {
7
7
  ClusterReachabilityResult,
8
8
  NatType,
9
+ Protocol,
9
10
  ReachabilityPeerConnectionEvents,
10
11
  } from './reachability.types';
11
12
  import {ReachabilityPeerConnection} from './reachabilityPeerConnection';
12
13
 
13
14
  // data for the Events.resultReady event
14
15
  export type ResultEventData = {
15
- protocol: 'udp' | 'tcp' | 'xtls';
16
+ protocol: Protocol;
16
17
  result: 'reachable' | 'unreachable' | 'untested';
17
18
  latencyInMilliseconds: number; // amount of time it took to get the ICE candidate
18
19
  clientMediaIPs?: string[];
@@ -20,7 +21,7 @@ export type ResultEventData = {
20
21
 
21
22
  // data for the Events.clientMediaIpsUpdated event
22
23
  export type ClientMediaIpsUpdatedEventData = {
23
- protocol: 'udp' | 'tcp' | 'xtls';
24
+ protocol: Protocol;
24
25
  clientMediaIPs: string[];
25
26
  };
26
27
 
@@ -25,6 +25,7 @@ import {
25
25
  TransportResultForBackend,
26
26
  GetClustersTrigger,
27
27
  NatType,
28
+ Protocol,
28
29
  } from './reachability.types';
29
30
  import {
30
31
  ClientMediaIpsUpdatedEventData,
@@ -33,6 +34,7 @@ import {
33
34
  NatTypeUpdatedEventData,
34
35
  ResultEventData,
35
36
  } from './clusterReachability';
37
+ import {isReachabilityEnabled, resolveReachabilityProtocols} from './util';
36
38
  import EventsScope from '../common/events/events-scope';
37
39
  import BEHAVIORAL_METRICS from '../metrics/constants';
38
40
  import Metrics from '../metrics';
@@ -194,7 +196,7 @@ export default class Reachability extends EventsScope {
194
196
  */
195
197
  public async gatherReachability(trigger: string): Promise<ReachabilityResults> {
196
198
  // @ts-ignore
197
- if (!this.webex.config.meetings.enableReachabilityChecks) {
199
+ if (!isReachabilityEnabled(this.webex.config.meetings.enableReachabilityChecks)) {
198
200
  throw new Error('enableReachabilityChecks is disabled in config');
199
201
  }
200
202
 
@@ -515,7 +517,7 @@ export default class Reachability extends EventsScope {
515
517
  * Returns true only if ALL protocols (UDP, TCP and TLS) have been tested and none
516
518
  * of the media clusters where reachable with any of the protocols. This is done
517
519
  * irrespective of the config, so for example:
518
- * if config.meetings.experimental.enableTlsReachability === false,
520
+ * if config.meetings.enableReachabilityChecks disables TLS,
519
521
  * it will return false, because TLS reachability won't be tested,
520
522
  * so we can't say for sure that media backend is unreachable over TLS.
521
523
  *
@@ -568,6 +570,32 @@ export default class Reachability extends EventsScope {
568
570
  return unreachable;
569
571
  }
570
572
 
573
+ /**
574
+ * Checks if any cluster is reachable via the given protocol based on stored reachability results.
575
+ *
576
+ * @param {string} protocol - the protocol to check ('udp', 'tcp', or 'xtls')
577
+ * @returns {Promise<boolean>} true if at least one cluster has a 'reachable' result for the given protocol
578
+ */
579
+ async isAnyClusterReachableViaProtocol(protocol: Protocol): Promise<boolean> {
580
+ try {
581
+ // @ts-ignore
582
+ const resultsJson = await this.webex.boundedStorage.get(
583
+ this.namespace,
584
+ REACHABILITY.localStorageResult
585
+ );
586
+
587
+ const results: ReachabilityResults = JSON.parse(resultsJson);
588
+
589
+ return Object.values(results).some((result) => result[protocol]?.result === 'reachable');
590
+ } catch (e) {
591
+ LoggerProxy.logger.warn(
592
+ `Reachability:index#isAnyClusterReachableViaProtocol --> Error reading reachability data: ${e}`
593
+ );
594
+
595
+ return false;
596
+ }
597
+ }
598
+
571
599
  /**
572
600
  * Get list of all unreachable clusters
573
601
  * @returns {array} Unreachable clusters
@@ -700,7 +728,7 @@ export default class Reachability extends EventsScope {
700
728
  */
701
729
  protected getStatistics(
702
730
  results: Array<ClusterReachabilityResult & {isVideoMesh: boolean}>,
703
- protocol: 'udp' | 'tcp' | 'xtls',
731
+ protocol: Protocol,
704
732
  isVideoMesh: boolean
705
733
  ) {
706
734
  const values = results
@@ -888,14 +916,21 @@ export default class Reachability extends EventsScope {
888
916
 
889
917
  this.startTime = performance.now();
890
918
 
919
+ const protocols = resolveReachabilityProtocols(
920
+ // @ts-ignore
921
+ this.webex.config.meetings.enableReachabilityChecks
922
+ );
923
+
924
+ const enabledProtocols = [
925
+ protocols.udp && 'UDP',
926
+ protocols.tcp && 'TCP',
927
+ protocols.tls && 'TLS',
928
+ ].filter(Boolean);
929
+
891
930
  LoggerProxy.logger.log(
892
- `Reachability:index#performReachabilityChecks --> doing UDP${
893
- // @ts-ignore
894
- this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : ''
895
- }${
896
- // @ts-ignore
897
- this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : ''
898
- } reachability checks`
931
+ `Reachability:index#performReachabilityChecks --> doing ${enabledProtocols.join(
932
+ ','
933
+ )} reachability checks`
899
934
  );
900
935
 
901
936
  this.resetResultCounters();
@@ -905,18 +940,14 @@ export default class Reachability extends EventsScope {
905
940
  const cluster = clusterList[key];
906
941
 
907
942
  // Linus doesn't support TCP reachability checks on video mesh nodes
908
- const includeTcpReachability =
909
- // @ts-ignore
910
- this.webex.config.meetings.experimental.enableTcpReachability && !cluster.isVideoMesh;
943
+ const includeTcpReachability = protocols.tcp && !cluster.isVideoMesh;
911
944
 
912
945
  if (!includeTcpReachability) {
913
946
  cluster.tcp = [];
914
947
  }
915
948
 
916
949
  // Linus doesn't support xTLS reachability checks on video mesh nodes
917
- const includeTlsReachability =
918
- // @ts-ignore
919
- this.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;
950
+ const includeTlsReachability = protocols.tls && !cluster.isVideoMesh;
920
951
 
921
952
  if (!includeTlsReachability) {
922
953
  cluster.xtls = [];
@@ -2,6 +2,17 @@ import {IP_VERSION, Enum} from '../constants';
2
2
 
3
3
  export type Protocol = 'udp' | 'tcp' | 'xtls';
4
4
 
5
+ // Per-protocol reachability flags, fully resolved.
6
+ export type ResolvedReachabilityProtocols = {
7
+ udp: boolean;
8
+ tcp: boolean;
9
+ tls: boolean;
10
+ };
11
+
12
+ export type ReachabilityProtocolConfig = Partial<Omit<ResolvedReachabilityProtocols, 'udp'>>;
13
+
14
+ export type EnableReachabilityChecksConfig = boolean | ReachabilityProtocolConfig;
15
+
5
16
  /**
6
17
  * Events emitted by ReachabilityPeerConnection
7
18
  */
@@ -1,4 +1,40 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
+ import {EnableReachabilityChecksConfig, ResolvedReachabilityProtocols} from './reachability.types';
3
+
4
+ /**
5
+ * Resolves `enableReachabilityChecks` into explicit per-protocol flags.
6
+ * Defaults to all protocols enabled when not configured.
7
+ * UDP is always tested unless reachability is disabled entirely (`false`).
8
+ *
9
+ * @param {EnableReachabilityChecksConfig} enabled value of config.meetings.enableReachabilityChecks
10
+ * @returns {ResolvedReachabilityProtocols} resolved per-protocol flags
11
+ */
12
+ export function resolveReachabilityProtocols(
13
+ enabled: EnableReachabilityChecksConfig = true
14
+ ): ResolvedReachabilityProtocols {
15
+ if (typeof enabled === 'object') {
16
+ return {
17
+ udp: true,
18
+ tcp: enabled.tcp ?? true,
19
+ tls: enabled.tls ?? true,
20
+ };
21
+ }
22
+
23
+ return {udp: enabled, tcp: enabled, tls: enabled};
24
+ }
25
+
26
+ /**
27
+ * Whether any reachability protocol is enabled.
28
+ *
29
+ * @param {EnableReachabilityChecksConfig} config value of config.meetings.enableReachabilityChecks
30
+ * @returns {boolean} true if any protocol is enabled
31
+ */
32
+ export function isReachabilityEnabled(config: EnableReachabilityChecksConfig = true): boolean {
33
+ const {udp, tcp, tls} = resolveReachabilityProtocols(config);
34
+
35
+ return udp || tcp || tls;
36
+ }
37
+
2
38
  /**
3
39
  * Converts a stun url to a turn url
4
40
  *