@webex/plugin-meetings 3.13.0-next.12 → 3.13.0-next.14
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.
- package/.repo-context.json +577 -0
- package/.sdd/manifest.json +1320 -428
- package/AGENTS.md +528 -72
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/config.js +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/webinar/index.js +1 -1
- package/docs/adr/0001-migrate-existing-docs-into-sdd.md +141 -0
- package/docs/adr/index.md +26 -0
- package/docs/architecture.md +816 -0
- package/docs/getting-started.md +177 -0
- package/docs/index.md +53 -0
- package/docs/specs/README.md +126 -0
- package/package.json +21 -21
- package/schemas/repo-context.schema.json +796 -0
- package/src/aiEnableRequest/docs/README.md +376 -0
- package/src/annotation/docs/README.md +402 -0
- package/src/breakouts/docs/README.md +643 -0
- package/src/controls-options-manager/docs/README.md +365 -0
- package/src/hashTree/docs/README.md +566 -0
- package/src/interceptors/docs/README.md +434 -0
- package/src/interpretation/docs/README.md +420 -0
- package/src/locus-info/docs/README.md +609 -0
- package/src/media/docs/README.md +488 -0
- package/src/meeting/docs/README.md +834 -0
- package/src/meeting-info/docs/README.md +352 -0
- package/src/meetings/docs/README.md +549 -0
- package/src/member/docs/README.md +347 -0
- package/src/members/docs/README.md +514 -0
- package/src/metrics/docs/README.md +287 -0
- package/src/multistream/docs/README.md +523 -0
- package/src/personal-meeting-room/docs/README.md +322 -0
- package/src/reachability/docs/README.md +548 -0
- package/src/reactions/docs/README.md +296 -0
- package/src/reconnection-manager/docs/README.md +485 -0
- package/src/recording-controller/docs/README.md +335 -0
- package/src/roap/docs/README.md +444 -0
- package/src/webinar/docs/README.md +425 -0
- package/.sdd/templates/.source.json +0 -30
- package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +0 -111
- package/.sdd/templates/component-repo/module-docs/module-spec.template.md +0 -321
- package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +0 -59
- package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +0 -49
- package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +0 -42
- package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +0 -120
- package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +0 -206
- package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +0 -90
- package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +0 -68
- package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +0 -111
- package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +0 -57
- package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +0 -69
- package/.sdd/templates/component-repo/standing-docs/RULES.template.md +0 -96
- package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +0 -84
- package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +0 -82
- package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +0 -94
- package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +0 -64
- package/.sdd/templates/component-repo/template-map.json +0 -112
- package/ai-docs/ARCHITECTURE.md +0 -208
- package/ai-docs/CONTRACTS.md +0 -267
- package/ai-docs/DATA_MODEL.md +0 -64
- package/ai-docs/GETTING_STARTED.md +0 -73
- package/ai-docs/GLOSSARY.md +0 -56
- package/ai-docs/REVIEW_CHECKLIST.md +0 -45
- package/ai-docs/RULES.md +0 -79
- package/ai-docs/SECURITY.md +0 -74
- package/ai-docs/SERVICE_STATE.md +0 -59
- package/ai-docs/SPEC_INDEX.md +0 -85
- package/ai-docs/TEST_INDEX.md +0 -45
- package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +0 -61
- package/ai-docs/patterns/defensive-error-propagation.md +0 -55
- package/ai-docs/patterns/event-scope-emission.md +0 -46
- package/ai-docs/patterns/source-to-test-path-mirroring.md +0 -45
- package/ai-docs/patterns/stateless-plugin-request-classes.md +0 -53
- package/ai-docs/patterns/typed-constants-and-enum-values.md +0 -47
- package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +0 -223
- package/src/annotation/ai-docs/annotation-spec.md +0 -236
- package/src/breakouts/ai-docs/breakouts-spec.md +0 -324
- package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +0 -243
- package/src/hashTree/ai-docs/hash-tree-spec.md +0 -267
- package/src/interceptors/ai-docs/interceptors-spec.md +0 -247
- package/src/interpretation/ai-docs/interpretation-spec.md +0 -256
- package/src/locus-info/ai-docs/locus-info-spec.md +0 -293
- package/src/media/ai-docs/media-spec.md +0 -267
- package/src/meeting/ai-docs/meeting-spec.md +0 -404
- package/src/meeting-info/ai-docs/meeting-info-spec.md +0 -261
- package/src/meetings/ai-docs/meetings-spec.md +0 -298
- package/src/member/ai-docs/member-spec.md +0 -196
- package/src/members/ai-docs/members-spec.md +0 -256
- package/src/metrics/ai-docs/metrics-spec.md +0 -185
- package/src/multistream/ai-docs/multistream-spec.md +0 -295
- package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +0 -234
- package/src/reachability/ai-docs/reachability-spec.md +0 -261
- package/src/reactions/ai-docs/reactions-spec.md +0 -198
- package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +0 -272
- package/src/recording-controller/ai-docs/recording-controller-spec.md +0 -223
- package/src/roap/ai-docs/roap-spec.md +0 -241
- package/src/webinar/ai-docs/webinar-spec.md +0 -243
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Module Spec
|
|
3
|
+
title: 'ROAP module specification'
|
|
4
|
+
description: Responsibilities, boundaries, design, invariants, and verification for the plugin-meetings ROAP sender and TURN discovery module.
|
|
5
|
+
tags: [module, specification]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: module-spec
|
|
9
|
+
generated_from: module-spec@0.3.0
|
|
10
|
+
generated_by: claude-code
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-11-17T03:14:21Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# ROAP
|
|
17
|
+
|
|
18
|
+
This source-local document at `src/roap/docs/README.md` is the canonical source-local spec for
|
|
19
|
+
`src/roap/` and owns the stable specification for **the ROAP module** of `@webex/plugin-meetings`:
|
|
20
|
+
the `Roap` sender that a `Meeting` uses to send outgoing ROAP messages to Locus, the `RoapRequest`
|
|
21
|
+
adapter that sends them through the Meeting's `LocusMediaRequest`, and `TurnDiscovery`, which runs
|
|
22
|
+
the TURN discovery exchange before media setup. Ground every claim in package evidence and link to
|
|
23
|
+
the [package architecture](../../../docs/architecture.md) instead of repeating broader facts. No
|
|
24
|
+
service specification exists because this package is a library.
|
|
25
|
+
|
|
26
|
+
Related context: [documentation index](../../../docs/index.md) ·
|
|
27
|
+
[package agent instructions](../../../AGENTS.md) · repo architecture:
|
|
28
|
+
[package architecture](../../../docs/architecture.md) · registry:
|
|
29
|
+
[specification registry](../../../docs/specs/README.md) · related module:
|
|
30
|
+
[media](../../media/docs/README.md)
|
|
31
|
+
|
|
32
|
+
## Metadata
|
|
33
|
+
|
|
34
|
+
| Field | Value |
|
|
35
|
+
| ----- | ----- |
|
|
36
|
+
| Owner | @webex/web-client, @webex/web-sdk |
|
|
37
|
+
| Source path | `src/roap` |
|
|
38
|
+
| Resource kind | module |
|
|
39
|
+
| Status | Draft |
|
|
40
|
+
| Last verified | 2026-11-16 at `0b8c34db7f` |
|
|
41
|
+
| Module id | `plugin-meetings/roap` |
|
|
42
|
+
| Parent spec | — |
|
|
43
|
+
| Doc kind | Module spec |
|
|
44
|
+
| Coverage score | Pending coverage assessment |
|
|
45
|
+
| Validation status | not-run |
|
|
46
|
+
|
|
47
|
+
Coverage state and the contracts baseline are recorded in `.sdd/manifest.json`.
|
|
48
|
+
|
|
49
|
+
## Applicability
|
|
50
|
+
|
|
51
|
+
| Condition ID | Status | Evidence or reason | Owned section |
|
|
52
|
+
| ------------ | ------ | ------------------ | ------------- |
|
|
53
|
+
| `module.has_tiers` | N/A | No tier policy exists in `package.json` | Tier |
|
|
54
|
+
| `module.has_ui` | N/A | `src/roap/index.ts` sends messages and returns promises | UI use-case flow |
|
|
55
|
+
| `module.crosses_service_boundaries` | Applicable | `src/roap/request.ts` sends ROAP messages to Locus through `src/meeting/locusMediaRequest.ts`; `src/roap/turnDiscovery.ts` reads reachability and waits for Mercury-delivered responses | Cross-boundary use-case flow |
|
|
56
|
+
| `module.holds_client_state` | Applicable | `src/roap/turnDiscovery.ts` holds the in-progress defer, the TURN info, and the response timer | Client state model |
|
|
57
|
+
| `module.enforces_domain_rules` | Applicable | Skip, rethrow, sequence, and header rules in `src/roap/turnDiscovery.ts` and `src/roap/index.ts` | Business rules and invariants |
|
|
58
|
+
| `module.is_concurrent_async` | Applicable | Every operation in `src/roap/index.ts` and `src/roap/turnDiscovery.ts` returns a promise; TURN discovery waits on a timer or a Mercury message | Concurrency and reactive flow |
|
|
59
|
+
| `module.owns_persistence` | N/A | Nothing in `src/roap/turnDiscovery.ts` or `src/roap/request.ts` is stored | Data, schema, and migration discipline |
|
|
60
|
+
| `module.stateful_transitions` | N/A | The manifest section profile resolves this to false; the ROAP offer/answer state machine belongs to the media connection, reached from `src/meeting/index.ts` | State machine |
|
|
61
|
+
| `module.exposes_wire_protocol` | Applicable | ROAP message bodies built in `src/roap/index.ts` and `src/roap/turnDiscovery.ts`; the Locus request body in `src/roap/request.ts` | Protocol and wire format |
|
|
62
|
+
| `module.ui_multi_screen` | N/A | No UI in `src/roap/index.ts` | UI flow |
|
|
63
|
+
| `module.large_data_model` | N/A | `src/roap/types.ts` declares three small types | Data model |
|
|
64
|
+
| `module.returns_caller_errors` | Applicable | Rejections in `src/roap/request.ts` and `src/roap/index.ts`; 409/403 rethrow and skip results in `src/roap/turnDiscovery.ts` | Caller-visible failure modes |
|
|
65
|
+
| `module.module_specific_conventions` | N/A | The manifest section profile resolves this to false; repository rules in `AGENTS.md` apply | Module-specific rules |
|
|
66
|
+
| `module.published_package` | N/A | `src/index.ts` re-exports nothing from src/roap | Export stability |
|
|
67
|
+
| `module.embedded_in_host` | N/A | No host mount API in `src/roap/index.ts` | Host integration and theming |
|
|
68
|
+
| `module.has_design_tradeoff` | Applicable | `src/roap/turnDiscovery.ts` resolves most failures as a skip so join continues without TURN | Key design trade-off |
|
|
69
|
+
| `module.has_submodules` | N/A | src/roap has no child module in `.sdd/manifest.json` | Sub-modules |
|
|
70
|
+
|
|
71
|
+
## Evidence register
|
|
72
|
+
|
|
73
|
+
Requirements cite current implementation and mirrored unit-test paths. Current code wins over
|
|
74
|
+
retained prose when they conflict; commit and PR history are excluded by repository-owner decision.
|
|
75
|
+
Missing test evidence is stated as a gap rather than inferred.
|
|
76
|
+
|
|
77
|
+
| Evidence | What it establishes |
|
|
78
|
+
| -------- | ------------------- |
|
|
79
|
+
| `src/roap/index.ts` | `Roap extends StatelessWebexPlugin`; `sendRoapOK`, `sendRoapAnswer`, `sendRoapError`, `sendRoapMediaRequest`; TURN discovery delegation; type re-exports |
|
|
80
|
+
| `src/roap/request.ts` | `RoapRequest.sendRoap`: the Locus request body, reachability and client media preferences, the missing-`locusMediaRequest` rejection, `locus.roapSeq` |
|
|
81
|
+
| `src/roap/turnDiscovery.ts` | `TurnDiscovery`: skip check, request generation, HTTP and Mercury response handling, OK, abort, 10-second wait, 409/403 rethrow, seq 0 |
|
|
82
|
+
| `src/roap/types.ts` | `TurnDiscoverySkipReason` values, `TurnServerInfo`, `TurnDiscoveryResult` |
|
|
83
|
+
| `src/constants.ts` | `ROAP.ROAP_TYPES` (`OFFER`, `ANSWER`, `OK`, `ERROR`, `TURN_DISCOVERY_REQUEST`, `TURN_DISCOVERY_RESPONSE`) and `ROAP.ROAP_VERSION` `'2'` |
|
|
84
|
+
| `src/meeting/index.ts` | Creates `new Roap({}, {parent: this.webex})`; sends OK, OFFER, and ANSWER from the media connection's `ROAP_MESSAGE_TO_SEND` events; applies returned answers through `roapMessageReceived`; calls the TURN discovery methods during join |
|
|
85
|
+
| `src/meetings/util.ts` | `handleRoapMercury` routes `TURN_DISCOVERY_RESPONSE` to `roap.turnDiscovery.handleTurnDiscoveryResponse` and other ROAP messages to `Meeting.roapMessageReceived` |
|
|
86
|
+
| `src/meeting/locusMediaRequest.ts` | Queues and sends `RoapMessage` requests to Locus one at a time |
|
|
87
|
+
| `src/reconnection-manager/index.ts` | Forces TURN discovery with `doTurnDiscovery(meeting, true, true)` when reconnecting |
|
|
88
|
+
| `test/unit/spec/roap/index.ts`, `test/unit/spec/roap/request.ts`, `test/unit/spec/roap/turnDiscovery.ts` | Mirrored unit coverage |
|
|
89
|
+
| `test/unit/spec/meetings/utils.js` | `handleRoapMercury` routing cases, including `TURN_DISCOVERY_RESPONSE` |
|
|
90
|
+
| Observation, no stated WHY | After a failure other than 409/403 inside `doTurnDiscovery` (the request rejects or the 10-second wait times out), `TurnDiscovery` keeps its `defer`, so later `doTurnDiscovery` and `generateTurnDiscoveryRequestMessage` calls report `already in progress` until `abort()` runs (`src/roap/turnDiscovery.ts`). Not a requirement until a reason is recorded |
|
|
91
|
+
|
|
92
|
+
## Purpose and boundary
|
|
93
|
+
|
|
94
|
+
- Responsibility: sends outgoing ROAP messages (OK, ANSWER, ERROR, and the OFFER media request),
|
|
95
|
+
returns the ROAP answer found in their HTTP responses, and performs TURN discovery for meeting
|
|
96
|
+
media. Incoming Mercury ROAP routing is owned by `MeetingsUtil`; `Meeting` hands incoming
|
|
97
|
+
messages to the media connection, whose ROAP state machine handles sequence and
|
|
98
|
+
glare.
|
|
99
|
+
- In scope: the ROAP message bodies; the Locus request through `LocusMediaRequest` with reachability
|
|
100
|
+
data; parsing the answer or TURN response out of `mediaConnections[0].remoteSdp`; TURN discovery
|
|
101
|
+
skip, request, response, OK, abort, and failure handling.
|
|
102
|
+
- Out of scope: ROAP sequence numbers and glare for SDP negotiation (the media connection, through
|
|
103
|
+
`Meeting`); queuing Locus requests (`src/meeting/locusMediaRequest.ts`); applying answers and media
|
|
104
|
+
connection setup (`Meeting`, `src/media`); reachability probing (`src/reachability`).
|
|
105
|
+
- Consumers: `Meeting` (`src/meeting/index.ts`), `MeetingsUtil` (`src/meetings/util.ts`), and
|
|
106
|
+
`ReconnectionManager` (`src/reconnection-manager/index.ts`).
|
|
107
|
+
|
|
108
|
+
## Structure and key files
|
|
109
|
+
|
|
110
|
+
`src/roap/` contains 4 direct source/reference file(s) and has 3 mirrored unit-test file(s) under
|
|
111
|
+
`test/unit/spec/roap/`. The module facade and primary exports are `index.ts`; the HTTP request
|
|
112
|
+
boundary is `request.ts`, `turnDiscovery.ts` holds TURN discovery, `types.ts` holds the module type
|
|
113
|
+
declarations, and this canonical module specification is `src/roap/docs/README.md`. The code is
|
|
114
|
+
TypeScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and
|
|
115
|
+
Mocha/Sinon/`@webex/test-helper-chai` tests. Build target:
|
|
116
|
+
`yarn workspace @webex/plugin-meetings build:src`.
|
|
117
|
+
|
|
118
|
+
| File | Holds |
|
|
119
|
+
| ---- | ----- |
|
|
120
|
+
| `src/roap/index.ts` | module facade `Roap`: outgoing ROAP messages, TURN discovery delegation, and the primary type exports |
|
|
121
|
+
| `src/roap/request.ts` | HTTP request boundary `RoapRequest`: sends one ROAP message through `LocusMediaRequest` |
|
|
122
|
+
| `src/roap/turnDiscovery.ts` | `TurnDiscovery`: the TURN discovery exchange, its skip rules, and its failure handling |
|
|
123
|
+
| `src/roap/types.ts` | module type declarations: `TurnDiscoverySkipReason`, `TurnServerInfo`, `TurnDiscoveryResult` |
|
|
124
|
+
| `test/unit/spec/roap/index.ts` and 2 sibling test file(s) | mirrored characterization/unit coverage (`request.ts`, `turnDiscovery.ts`) |
|
|
125
|
+
|
|
126
|
+
## Public surface
|
|
127
|
+
|
|
128
|
+
None of these are re-exported by `src/index.ts`; they are reached through `meeting.roap`. Contract
|
|
129
|
+
ID `roap-signaling` is registered in `.sdd/manifest.json` and indexed in the
|
|
130
|
+
[package architecture](../../../docs/architecture.md#public-and-consumer-surfaces).
|
|
131
|
+
|
|
132
|
+
Manifest contracts: provides `roap-signaling`; requires `locus-http` and
|
|
133
|
+
`webex-core-plugin-host`.
|
|
134
|
+
|
|
135
|
+
| Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
|
|
136
|
+
| ----------- | ---- | ------- | ------- | --------------------------- | -------------------- | ---------- |
|
|
137
|
+
| `roap-signaling` | SDK / remote | `Roap.sendRoapOK()`, `sendRoapAnswer()`, `sendRoapError()`, and `sendRoapMediaRequest()` | Build and send outgoing ROAP control/media messages through the current Locus media route (`meeting.locusMediaRequest`). | Preserve message/action fields and returned promise behavior: `sendRoapMediaRequest()` resolves `{locus, roapAnswer}`, the others resolve after the request; inbound Mercury ordering is owned elsewhere. | `src/roap/index.ts` | package architecture |
|
|
138
|
+
| `roap-signaling` | request adapter | `RoapRequest.sendRoap()` | Issue the outgoing Locus media request and return its response/rejection to `Roap`. | Preserve the request body `{type: 'RoapMessage', selfUrl, mediaId, roapMessage, reachability, clientMediaPreferences}` and direct promise propagation; it resolves `{locus}`, with `locus.roapSeq` set to the sent `seq`, and adds `mediaConnections` (the whole response array) only when the response's first media connection is truthy, so callers must treat it as optional. | `src/roap/request.ts` | package architecture |
|
|
139
|
+
| `roap-signaling` | TURN discovery | `Roap.doTurnDiscovery()`, `generateTurnDiscoveryRequestMessage()`, `handleTurnDiscoveryHttpResponse()`, and `abortTurnDiscovery()` | Delegate TURN discovery lifecycle through the active `TurnDiscovery` instance. | Preserve skip-vs-rethrow distinctions and abort ownership. | `src/roap/index.ts`, `src/roap/turnDiscovery.ts` | package architecture |
|
|
140
|
+
| `roap-signaling` | TURN discovery component | `TurnDiscovery.handleTurnDiscoveryResponse()`, `generateTurnDiscoveryRequestMessage()`, `handleTurnDiscoveryHttpResponse()`, `abort()`, `sendRoapOK()`, `isSkipped()`, and `doTurnDiscovery()` | Generate the discovery offer, interpret HTTP or Mercury results, and expose normalized TURN server information or skip reason. | HTTP 409/403 are rethrown; other handled discovery failures resolve a skipped result (`failure: <message>`). `handleTurnDiscoveryHttpResponse()` throws when no discovery is in progress. | `src/roap/turnDiscovery.ts` | package architecture |
|
|
141
|
+
| `roap-signaling` | exported contracts | `TurnDiscoveryResult`, `TurnServerInfo`, and `TurnDiscoverySkipReason` | Share the exact success/skip shape returned to Meeting negotiation. | Add fields and skip reasons compatibly; existing values (`missing http response`, `reachability`, `already in progress`, and `failure: <message>`) are consumer-visible. `src/roap/index.ts` re-exports the three types. | `src/roap/types.ts`, `src/roap/index.ts` | package architecture |
|
|
142
|
+
|
|
143
|
+
Compatibility notes:
|
|
144
|
+
|
|
145
|
+
- 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.
|
|
146
|
+
|
|
147
|
+
## Dependencies
|
|
148
|
+
|
|
149
|
+
Meeting/Locus media request transport (`meeting.locusMediaRequest`), the Meeting's media
|
|
150
|
+
connection and sequence state, reachability for TURN skip decisions and request preferences, and
|
|
151
|
+
Webex TURN discovery through Locus.
|
|
152
|
+
|
|
153
|
+
| Dependency | Why it is required | Failure behavior |
|
|
154
|
+
| ---------- | ------------------ | ---------------- |
|
|
155
|
+
| `LocusMediaRequest` (`src/meeting/locusMediaRequest.ts`, `locus-http`) | Sends `RoapMessage` requests to the Locus media endpoint | Rejections are logged and rethrown by `RoapRequest.sendRoap` |
|
|
156
|
+
| `@webex/webex-core` `StatelessWebexPlugin` (`webex-core-plugin-host`) | Base class of `Roap` and `RoapRequest`; `this.webex.meetings` access | — |
|
|
157
|
+
| `webex.meetings.reachability` | `getClientMediaPreferences`, `getReachabilityReportToAttachToRoap`, `isAnyPublicClusterReachable` | Preference or report errors are logged and a fallback is sent; a reachable public cluster skips TURN discovery |
|
|
158
|
+
| `webex.meetings.meetingCollection` | Finds the Meeting by `correlationId` for OK, ANSWER, and ERROR | — |
|
|
159
|
+
| `MeetingUtil.getIpVersion` (`src/meeting/util.ts`) | IP version for client media preferences | — |
|
|
160
|
+
| `@webex/common` `Defer` | The TURN discovery wait | — |
|
|
161
|
+
| `src/metrics/index.ts` | `ROAP_HTTP_RESPONSE_MISSING`, `TURN_DISCOVERY_FAILURE`, `TURN_DISCOVERY_REQUIRES_OK` | — |
|
|
162
|
+
| `src/constants.ts` | `ROAP` message types and version | — |
|
|
163
|
+
|
|
164
|
+
## Requirements
|
|
165
|
+
|
|
166
|
+
| ID | WHAT | WHY | Source evidence | Test / example evidence | Assumptions / gaps | Confidence |
|
|
167
|
+
| --- | ---- | --- | --------------- | ----------------------- | ------------------ | ---------- |
|
|
168
|
+
| `ROAP-R-001` | Send outgoing ROAP media messages and process the returned response; inbound Mercury routing is outside `src/roap/`, except that `TurnDiscovery.handleTurnDiscoveryResponse()` receives the TURN responses `MeetingsUtil` routes to it. | Ownership must match current call paths so changes to incoming sequence/glare logic are made in `MeetingsUtil` and `Meeting`, not in this sender. | `src/roap/index.ts`, `src/meetings/util.ts`, `src/meeting/index.ts` | `test/unit/spec/roap/index.ts`, `test/unit/spec/meetings/utils.js` | none | PRESENT |
|
|
169
|
+
| `ROAP-R-002` | send Locus media requests and return the SDP answer: `sendRoapMediaRequest()` updates the Meeting's media connections, parses `mediaConnections[0].remoteSdp`, and resolves `{locus, roapAnswer}`, where `roapAnswer` is set only for an `ANSWER` message; otherwise it sends `ROAP_HTTP_RESPONSE_MISSING`. `Meeting` applies the answer. | Locus media requests and TURN discovery have different response and failure semantics during negotiation. | `src/roap/index.ts`, `src/roap/request.ts` | `test/unit/spec/roap/index.ts` | none | PRESENT |
|
|
170
|
+
| `ROAP-R-003` | Outgoing media-request failures reject their caller. TURN discovery rethrows HTTP 409/403, while other handled discovery failures resolve a result with `turnDiscoverySkippedReason` `failure: <message>`; this sender owns no inbound Mercury listener. | Negotiation code must distinguish direct request rejection from TURN skip results and the specific 409/403 rethrow path; the code comment says 409/403 mean the client was dropped from the meeting, so continuing media setup is pointless. | `src/roap/index.ts`, `src/roap/request.ts`, `src/roap/turnDiscovery.ts` | `test/unit/spec/roap/index.ts`, `test/unit/spec/roap/turnDiscovery.ts` | none | PRESENT |
|
|
171
|
+
| `ROAP-R-004` | Incoming ROAP sequence and glare handling are delegated by `MeetingsUtil.handleRoapMercury()` to `Meeting.roapMessageReceived()`, which passes the message to the media connection's `roapMessageReceived()`; `TURN_DISCOVERY_RESPONSE` goes to `TurnDiscovery` instead. `src/roap/types.ts` only declares TURN-discovery shapes. | Explicit cross-module ownership prevents passive TURN types from being mistaken for inbound negotiation guards. | `src/meetings/util.ts`, `src/meeting/index.ts`, `src/roap/types.ts` | `test/unit/spec/meetings/utils.js`, `test/unit/spec/meeting/index.js` | none | PRESENT |
|
|
172
|
+
| `ROAP-R-005` | TURN discovery normalizes service results for the active media negotiation: it collects every `x-cisco-turn-url` header and the last `x-cisco-turn-username` and `x-cisco-turn-password`, drops empty URLs, fails when any of the three is missing, sends OK unless the response has `noOkInTransaction`, rethrows 409/403, and reports other handled failures through the documented skip reason. | Media setup needs the correct relay configuration and an explicit skipped outcome rather than fabricated credentials or a blanket rejection claim; the code comment says empty URLs arrive from video mesh nodes. | `src/roap/turnDiscovery.ts`, `src/roap/request.ts` | `test/unit/spec/roap/turnDiscovery.ts`, `test/unit/spec/roap/request.ts` | none | PRESENT |
|
|
173
|
+
| `ROAP-R-006` | Unless forced, TURN discovery is skipped with reason `reachability` when any public cluster is reachable; a forced discovery (`isForced`) always runs. | The skip-reason comment: TURN is not needed when UDP reachability to public clusters is fine; reconnection forces it (`src/reconnection-manager/index.ts`). | `src/roap/turnDiscovery.ts`, `src/roap/types.ts` | `test/unit/spec/roap/turnDiscovery.ts` | none | PRESENT |
|
|
174
|
+
| `ROAP-R-007` | TURN discovery messages (`TURN_DISCOVERY_REQUEST` and its OK) always use `seq` 0, and the request carries headers `includeAnswerInHttpResponse` and `noOkInTransaction`. | The code comment: TURN discovery always precedes the first SDP exchange, which starts at seq 1, so seq 0 works whether or not discovery is done. | `src/roap/turnDiscovery.ts` | `test/unit/spec/roap/turnDiscovery.ts` | none | PRESENT |
|
|
175
|
+
| `ROAP-R-008` | `sendRoapMediaRequest()` sends an `OFFER` with the caller's `seq`, `tieBreaker`, and headers `includeAnswerInHttpResponse` and `noOkInTransaction`, always with the Meeting's `mediaId`, and `preferTranscoding` set for non-multistream meetings. | The code comment: an empty media id is only for reconnecting, and reconnection always sends `TURN_DISCOVERY_REQUEST` first, so the offer never needs one. | `src/roap/index.ts` | `test/unit/spec/roap/index.ts` | none | PRESENT |
|
|
176
|
+
| `ROAP-R-009` | When the reachability calls fail, `RoapRequest.sendRoap()` logs the error and still sends the message with fallback client media preferences `{joinCookie: undefined, ipver: unknown, preferTranscoding: !isMultistream}` and no reachability report. | The code comment: the bare minimum fallback value that should still allow the join. | `src/roap/request.ts` | `test/unit/spec/roap/request.ts` | none | PRESENT |
|
|
177
|
+
|
|
178
|
+
## Design overview
|
|
179
|
+
|
|
180
|
+
`src/roap/index.ts` is the outgoing ROAP sender: it builds/sends Locus media requests through
|
|
181
|
+
`request.ts` and returns the SDP answer found in the response for `Meeting` to apply.
|
|
182
|
+
`turnDiscovery.ts` separately resolves TURN data. Incoming Mercury routing belongs to
|
|
183
|
+
`MeetingsUtil`, and sequence and glare handling belong to the media connection that `Meeting`
|
|
184
|
+
feeds, outside this module.
|
|
185
|
+
|
|
186
|
+
`Meeting` creates one `Roap` per meeting; `Roap` creates one `RoapRequest` and one `TurnDiscovery`
|
|
187
|
+
that share it. `Meeting` calls `sendRoapOK`, `sendRoapMediaRequest`, and `sendRoapAnswer` when the
|
|
188
|
+
media connection emits `ROAP_MESSAGE_TO_SEND`, and `sendRoapError` for errors. TURN discovery has
|
|
189
|
+
two entry styles: `doTurnDiscovery()` runs the whole exchange itself, while join with media calls
|
|
190
|
+
`generateTurnDiscoveryRequestMessage()`, sends the message inside the join request, and then calls
|
|
191
|
+
`handleTurnDiscoveryHttpResponse()` or `abortTurnDiscovery()`.
|
|
192
|
+
|
|
193
|
+
## Data flow and sequence coverage
|
|
194
|
+
|
|
195
|
+
Call style: in-process promises from `Meeting`; HTTPS to Locus through `LocusMediaRequest`; inbound
|
|
196
|
+
TURN responses either in the HTTP response or over Mercury through `MeetingsUtil`.
|
|
197
|
+
|
|
198
|
+
Sequence coverage:
|
|
199
|
+
|
|
200
|
+
| Operation group | Diagram | Failure coverage |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| UC-1…UC-4 — outgoing ROAP and TURN operation groups | Outgoing ROAP and TURN primary sequence | missing `locusMediaRequest`, outgoing Locus media request rejection, invalid returned SDP JSON, TURN 409/403 rethrow, handled skip result, and abort |
|
|
203
|
+
| UC-2, UC-4 — TURN discovery exchange | TURN discovery sequence | reachability skip, already in progress, missing HTTP response with Mercury fallback, 10-second timeout, missing headers, 409/403 rethrow |
|
|
204
|
+
| UC-3 — TURN discovery inside join | Join-time TURN discovery sequence | missing HTTP response, abort when join fails |
|
|
205
|
+
|
|
206
|
+
```mermaid
|
|
207
|
+
flowchart LR
|
|
208
|
+
Meeting[Meeting outgoing negotiation] --> Roap[index.ts]
|
|
209
|
+
Roap --> Request[request.ts]
|
|
210
|
+
Request --> LMR[LocusMediaRequest queue]
|
|
211
|
+
LMR --> Locus[Locus media endpoint]
|
|
212
|
+
Locus --> Request
|
|
213
|
+
Request --> Roap
|
|
214
|
+
Roap --> Meeting
|
|
215
|
+
Meeting --> Media[apply returned SDP answer in the media connection]
|
|
216
|
+
Roap --> Turn[turnDiscovery.ts]
|
|
217
|
+
Turn --> Request
|
|
218
|
+
Turn --> Reach[reachability: isAnyPublicClusterReachable]
|
|
219
|
+
Mercury[MeetingsUtil Mercury routing] --> Turn
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Outgoing ROAP and TURN primary sequence:
|
|
223
|
+
|
|
224
|
+
```mermaid
|
|
225
|
+
sequenceDiagram
|
|
226
|
+
participant M as Meeting
|
|
227
|
+
participant R as Roap index.ts
|
|
228
|
+
participant Q as roap/request.ts
|
|
229
|
+
participant L as Locus media endpoint
|
|
230
|
+
M->>R: sendRoapMediaRequest(options)
|
|
231
|
+
R->>Q: send outgoing ROAP payload
|
|
232
|
+
alt required media request context is missing (no meeting.locusMediaRequest)
|
|
233
|
+
Q--xR: rejected promise from request.ts
|
|
234
|
+
R--xM: propagated rejection
|
|
235
|
+
else
|
|
236
|
+
Q->>L: HTTP media request
|
|
237
|
+
L-->>Q: response with SDP/ROAP or rejection
|
|
238
|
+
alt rejection
|
|
239
|
+
Q--xR: logged and rethrown
|
|
240
|
+
R--xM: propagated rejection
|
|
241
|
+
else response
|
|
242
|
+
Q-->>R: {locus} plus mediaConnections only when present
|
|
243
|
+
opt response includes mediaConnections
|
|
244
|
+
R->>M: updateMediaConnections(mediaConnections)
|
|
245
|
+
end
|
|
246
|
+
R-->>M: {locus, roapAnswer}
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
Note over M: Incoming Mercury ROAP goes through MeetingsUtil to Meeting and the media connection, not src/roap
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
TURN discovery sequence:
|
|
253
|
+
|
|
254
|
+
```mermaid
|
|
255
|
+
sequenceDiagram
|
|
256
|
+
participant C as Meeting or ReconnectionManager
|
|
257
|
+
participant T as TurnDiscovery
|
|
258
|
+
participant Re as reachability
|
|
259
|
+
participant Q as RoapRequest
|
|
260
|
+
participant U as MeetingsUtil (Mercury)
|
|
261
|
+
C->>T: doTurnDiscovery(meeting, isReconnecting, isForced)
|
|
262
|
+
opt not forced
|
|
263
|
+
T->>Re: isAnyPublicClusterReachable()
|
|
264
|
+
Re-->>T: true: resolve {turnDiscoverySkippedReason: reachability}
|
|
265
|
+
end
|
|
266
|
+
alt discovery already in progress
|
|
267
|
+
T-->>C: {turnDiscoverySkippedReason: already in progress}
|
|
268
|
+
else
|
|
269
|
+
T->>Q: sendRoap(TURN_DISCOVERY_REQUEST, seq 0, empty mediaId when reconnecting)
|
|
270
|
+
alt TURN response in the HTTP response
|
|
271
|
+
Q-->>T: mediaConnections[0].remoteSdp
|
|
272
|
+
else missing from the HTTP response
|
|
273
|
+
U->>T: handleTurnDiscoveryResponse(message, from mercury)
|
|
274
|
+
Note over T: rejects after 10 seconds without a response
|
|
275
|
+
end
|
|
276
|
+
opt response lacks noOkInTransaction
|
|
277
|
+
T->>Q: sendRoap(OK, seq 0)
|
|
278
|
+
end
|
|
279
|
+
alt success
|
|
280
|
+
T-->>C: {turnServerInfo}
|
|
281
|
+
else 409 or 403
|
|
282
|
+
T--xC: rethrow, defer cleared
|
|
283
|
+
else other failure
|
|
284
|
+
T-->>C: {turnDiscoverySkippedReason: failure: message}
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Join-time TURN discovery sequence:
|
|
290
|
+
|
|
291
|
+
```mermaid
|
|
292
|
+
sequenceDiagram
|
|
293
|
+
participant M as Meeting
|
|
294
|
+
participant R as Roap
|
|
295
|
+
participant T as TurnDiscovery
|
|
296
|
+
M->>R: generateTurnDiscoveryRequestMessage(meeting, isForced)
|
|
297
|
+
R->>T: generateTurnDiscoveryRequestMessage
|
|
298
|
+
T-->>M: {roapMessage} or {turnDiscoverySkippedReason}
|
|
299
|
+
M->>M: join request carrying the TURN_DISCOVERY_REQUEST
|
|
300
|
+
alt join succeeded
|
|
301
|
+
M->>R: handleTurnDiscoveryHttpResponse(meeting, joinResponse)
|
|
302
|
+
R->>T: parse remoteSdp, handle response, send OK when required
|
|
303
|
+
T-->>M: {turnServerInfo} or a skip reason
|
|
304
|
+
opt no turnServerInfo
|
|
305
|
+
M->>R: abortTurnDiscovery()
|
|
306
|
+
end
|
|
307
|
+
else join failed
|
|
308
|
+
M->>R: abortTurnDiscovery()
|
|
309
|
+
R->>T: abort(): reject and clear the defer
|
|
310
|
+
end
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Class and component relationships
|
|
314
|
+
|
|
315
|
+
```mermaid
|
|
316
|
+
classDiagram
|
|
317
|
+
class Meeting
|
|
318
|
+
class Roap
|
|
319
|
+
class Request
|
|
320
|
+
class Locus
|
|
321
|
+
class Media
|
|
322
|
+
class Turn
|
|
323
|
+
class Discovery
|
|
324
|
+
StatelessWebexPlugin <|-- Roap
|
|
325
|
+
StatelessWebexPlugin <|-- Request
|
|
326
|
+
Meeting --> Roap : meeting.roap
|
|
327
|
+
Roap --> Request : RoapRequest
|
|
328
|
+
Roap --> Turn : TurnDiscovery
|
|
329
|
+
Turn --> Request : shared RoapRequest
|
|
330
|
+
Request --> Locus : LocusMediaRequest send
|
|
331
|
+
Turn --> Discovery : reachability skip check
|
|
332
|
+
Meeting --> Media : applies the returned answer
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
The arrows identify ownership and delegation inside `src/roap/`; files that only declare types or constants are not presented as transports.
|
|
336
|
+
|
|
337
|
+
## Use cases and flows
|
|
338
|
+
|
|
339
|
+
| Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
|
|
340
|
+
| -------- | --------------- | ------------------------- | ---------------------------- | -------- |
|
|
341
|
+
| `UC-1` | Meeting | Send outgoing ROAP OK, answer, error, or media-request payloads through `RoapRequest.sendRoap()` and return the response/rejection | Missing `locusMediaRequest` rejects | `src/roap/index.ts`, `src/roap/request.ts` |
|
|
342
|
+
| `UC-2` | Meeting, ReconnectionManager | Generate a TURN discovery request, interpret its response, and expose normalized TURN server information | Skip, rethrow, or `failure:` result | `src/roap/turnDiscovery.ts` |
|
|
343
|
+
| `UC-3` | Meeting (join with media) | Abort an active discovery through the owning `Roap`/`TurnDiscovery` lifecycle | `abort()` outside a discovery does nothing | `src/roap/index.ts`, `src/roap/turnDiscovery.ts` |
|
|
344
|
+
| `UC-4` | Meeting | Distinguish 409/403 rethrows from other handled discovery outcomes that produce a skip reason, without assigning inbound Mercury/glare processing to this module | Inbound ROAP goes through `MeetingsUtil` to `Meeting` and the media connection | `src/roap/turnDiscovery.ts`, `src/meeting/index.ts`, `src/meetings/util.ts` |
|
|
345
|
+
|
|
346
|
+
### Cross-boundary use-case flow
|
|
347
|
+
|
|
348
|
+
| Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
|
|
349
|
+
| -------- | ---------------------- | ------------- | ---------------------------- |
|
|
350
|
+
| Locus media endpoint (`UC-1`, `UC-2`) | HTTPS through `LocusMediaRequest`, which queues requests and sends them one at a time | Request body and ROAP messages under Protocol and wire format | No retry here; rejections propagate (TURN discovery turns them into skip results except 409/403) |
|
|
351
|
+
| Mercury (`UC-2`) | `event:locus.message.roap` routed by `MeetingsUtil.handleRoapMercury` | Only `TURN_DISCOVERY_RESPONSE` reaches `TurnDiscovery` | 10-second wait, then a `failure:` skip result |
|
|
352
|
+
| Reachability (`UC-1`, `UC-2`) | In-process promises on `webex.meetings.reachability` | Client media preferences and reachability report attached to every ROAP request | Errors fall back to minimal preferences |
|
|
353
|
+
|
|
354
|
+
## Client state model
|
|
355
|
+
|
|
356
|
+
ROAP sequence, pending offer/answer, and negotiation state are held per media negotiation by the
|
|
357
|
+
media connection that `Meeting` owns; `src/roap/` keeps only the TURN discovery results and the
|
|
358
|
+
in-progress wait.
|
|
359
|
+
|
|
360
|
+
| State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
|
|
361
|
+
| -------------- | ----- | ------------- | ------------------- | ----------------------------- |
|
|
362
|
+
| `defer` (discovery in progress) | `TurnDiscovery` | undefined | Set by `generateTurnDiscoveryRequestMessage` and `sendRoapTurnDiscoveryRequest` | Cleared on success, 409/403, `abort()`, and failures inside `handleTurnDiscoveryHttpResponse`; kept after other `doTurnDiscovery` failures |
|
|
363
|
+
| `turnInfo` `{urls, username, password}` | `TurnDiscovery` | Empty urls and strings | Reset and refilled by every `handleTurnDiscoveryResponse` | Instance memory, one `TurnDiscovery` per `Roap` |
|
|
364
|
+
| `responseTimer` | `TurnDiscovery` | undefined | Armed by the Mercury wait | Cleared when a response is handled |
|
|
365
|
+
|
|
366
|
+
## Business rules and invariants
|
|
367
|
+
|
|
368
|
+
| ID | Invariant | WHY | Enforcement source | Test evidence |
|
|
369
|
+
| --- | --------- | --- | ------------------ | ------------- |
|
|
370
|
+
| `INV-001` | `src/roap/` owns outgoing request/response and TURN discovery only. Incoming Mercury sequencing/glare remains in `src/meetings/util.ts` and `src/meeting/index.ts`, and the media connection they feed. | Ownership must match the call paths (`ROAP-R-001`, `ROAP-R-004`). | `src/roap/index.ts`, `src/meetings/util.ts` | `test/unit/spec/meetings/utils.js` |
|
|
371
|
+
| `INV-002` | Direct outgoing ROAP request failures reject; TURN discovery rethrows 409/403, while its other handled failures resolve a result containing `turnDiscoverySkippedReason`. | 409/403 mean the client was dropped from the meeting; other failures let the join continue without TURN (code comments in `handleTurnDiscoveryFailure`). | `src/roap/request.ts`, `src/roap/turnDiscovery.ts` | `test/unit/spec/roap/turnDiscovery.ts` |
|
|
372
|
+
| `INV-003` | Only one TURN discovery runs at a time per `TurnDiscovery`; a second start reports `already in progress`. | The skip-reason comment in `src/roap/types.ts` names this case. | `src/roap/turnDiscovery.ts` | `test/unit/spec/roap/turnDiscovery.ts` |
|
|
373
|
+
|
|
374
|
+
## Concurrency and reactive flow
|
|
375
|
+
|
|
376
|
+
- Execution model: one JavaScript event loop; every operation returns a promise.
|
|
377
|
+
- Each outgoing ROAP/TURN operation is represented by its returned promise and owns no inbound Mercury listener or persistent negotiation state. Incoming ROAP sequence/glare ordering remains in `MeetingsUtil.handleRoapMercury()` and `Meeting.roapMessageReceived()`, which hands the message to the media connection.
|
|
378
|
+
- Ordering guarantees: Locus requests are serialized by the Meeting's `LocusMediaRequest` queue,
|
|
379
|
+
not by `src/roap/`; TURN discovery sends its request, waits for the response, and only then
|
|
380
|
+
sends OK.
|
|
381
|
+
- Reactive input: a Mercury-delivered `TURN_DISCOVERY_RESPONSE` settles the pending `defer`;
|
|
382
|
+
one arriving when no discovery is in progress is logged and ignored.
|
|
383
|
+
- Idempotency and retry: nothing is retried; `abort()` outside a discovery does nothing.
|
|
384
|
+
|
|
385
|
+
## Protocol and wire format
|
|
386
|
+
|
|
387
|
+
ROAP messages are JSON objects carried in the Locus media request; preserve current field names,
|
|
388
|
+
enum/raw values, sequence identifiers, and compatibility behavior, and do not treat the normalized
|
|
389
|
+
client model as the wire schema.
|
|
390
|
+
|
|
391
|
+
| Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
|
|
392
|
+
| ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
|
|
393
|
+
| `OFFER` `{messageType, sdps: [sdp], version, seq, tieBreaker, headers: ['includeAnswerInHttpResponse', 'noOkInTransaction']}` | ROAP `'2'` | `Roap.sendRoapMediaRequest` | Locus | `seq` and `tieBreaker` come from the media connection |
|
|
394
|
+
| `ANSWER` `{messageType, sdps: [sdp], version, seq}`; `OK` `{messageType, version, seq}`; `ERROR` `{messageType, version, errorType, seq}` | ROAP `'2'` | `Roap.sendRoapAnswer`, `sendRoapOK`, `sendRoapError` | Locus | `seq` from the caller |
|
|
395
|
+
| `TURN_DISCOVERY_REQUEST` `{messageType, version, seq: 0, headers: ['includeAnswerInHttpResponse', 'noOkInTransaction']}` and its `OK` with `seq` 0 | ROAP `'2'` | `TurnDiscovery` | Locus | Always seq 0 (`ROAP-R-007`) |
|
|
396
|
+
| Locus request `{type: 'RoapMessage', selfUrl, mediaId, roapMessage, reachability, clientMediaPreferences}` | — | `RoapRequest.sendRoap` | `LocusMediaRequest` | `locus.roapSeq` of the response is set to the sent `seq` |
|
|
397
|
+
| Response `mediaConnections[0].remoteSdp`: JSON string whose `roapMessage` carries `seq`, `messageType`, `sdps`, `errorType`, `errorCause`, `headers` | — | Locus | `sendRoapMediaRequest`, `parseHttpTurnDiscoveryResponse` | For TURN discovery the `remoteSdp` field holds the TURN response, as the backend sends it |
|
|
398
|
+
| `TURN_DISCOVERY_RESPONSE` headers `x-cisco-turn-url=…` (one or more), `x-cisco-turn-username=…`, `x-cisco-turn-password=…`, optional `noOkInTransaction` | — | Locus, in the HTTP response or over Mercury | `TurnDiscovery.handleTurnDiscoveryResponse` | Unknown headers are ignored; empty URLs are dropped |
|
|
399
|
+
|
|
400
|
+
## Caller-visible failure modes
|
|
401
|
+
|
|
402
|
+
| Condition | Signal | Caller recovery |
|
|
403
|
+
|---|---|---|
|
|
404
|
+
| Required Locus media request context/payload is absent | The request helper rejects rather than issuing an invalid outgoing ROAP request: without `locusMediaRequest`, `sendRoap` rejects with `sendRoap called when locusMediaRequest is undefined`; an empty `mediaId` is only logged and sent. | Supply the current `locusMediaRequest` and ROAP payload. |
|
|
405
|
+
| Locus media request rejects, or TURN discovery encounters a handled failure | The media-request promise rejects; TURN 409/403 rethrows, while other handled discovery failures resolve with `turnDiscoverySkippedReason` `failure: <message>`. `src/roap/` has no inbound Mercury listener to clean up. | Branch on request rejection versus TURN rethrow/skip result in the Meeting negotiation flow. |
|
|
406
|
+
| Locus returns an accepted ROAP/SDP response | `Roap` returns `{locus, roapAnswer}` to Meeting; `roapAnswer` is undefined, and `ROAP_HTTP_RESPONSE_MISSING` is sent, when the response holds no `ANSWER`. | Apply it only within the current Meeting negotiation. |
|
|
407
|
+
| `remoteSdp` in the OFFER response is not valid JSON | `sendRoapMediaRequest()` rejects with the parse error. | Treated by Meeting as a missing answer. |
|
|
408
|
+
| `handleTurnDiscoveryHttpResponse()` without a started discovery | Throws `handleTurnDiscoveryHttpResponse() called before generateTurnDiscoveryRequestMessage()`. | Call `generateTurnDiscoveryRequestMessage()` first. |
|
|
409
|
+
| TURN discovery already in progress | Resolves `turnDiscoverySkippedReason: 'already in progress'` with no TURN info. | Wait, or `abortTurnDiscovery()`. |
|
|
410
|
+
|
|
411
|
+
## Pitfalls and constraints
|
|
412
|
+
|
|
413
|
+
- Offer/answer messages are ordered protocol state. Retrying or applying a stale sequence can corrupt the peer connection.
|
|
414
|
+
- Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
|
|
415
|
+
- After a `doTurnDiscovery` failure other than 409/403, the `defer` stays set and later discoveries report `already in progress` until `abort()` (Evidence register observation).
|
|
416
|
+
- `handleTurnDiscoveryResponse` rejects the `defer` for an unexpected `messageType` but then still parses the headers and may call `resolve` on the already-rejected `defer`; the first settlement wins.
|
|
417
|
+
|
|
418
|
+
## Key design trade-off
|
|
419
|
+
|
|
420
|
+
- Explicit ROAP state preserves interoperability and recoverable errors but makes media setup sequential and stateful; that state lives in the media connection, and `src/roap/` stays a stateless sender apart from the single TURN discovery in progress.
|
|
421
|
+
|
|
422
|
+
| Chosen trade-off | Preserved invariant or benefit | Cost or limitation | Decision evidence |
|
|
423
|
+
| ---------------- | ------------------------------ | ------------------ | ----------------- |
|
|
424
|
+
| TURN discovery failures, except 409/403, resolve as a skip instead of rejecting | The join continues without TURN (code comment in `handleTurnDiscoveryFailure`) | Callers must read `turnDiscoverySkippedReason` to notice the failure | `src/roap/turnDiscovery.ts` |
|
|
425
|
+
| Answers and TURN responses are requested inline in the HTTP response, with Mercury as the fallback for TURN | One round trip in the normal case | Two delivery paths for the TURN response | `src/roap/index.ts`, `src/roap/turnDiscovery.ts` |
|
|
426
|
+
|
|
427
|
+
## Verification
|
|
428
|
+
|
|
429
|
+
Use the current mirrored suites: `test/unit/spec/roap/index.ts`, `test/unit/spec/roap/request.ts`, `test/unit/spec/roap/turnDiscovery.ts`. Characterize the roap-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
|
|
430
|
+
|
|
431
|
+
| Behavior / Requirement | Existing test evidence | Gap |
|
|
432
|
+
|---|---|---|
|
|
433
|
+
| `ROAP-R-001` | `test/unit/spec/roap/index.ts` | no case for `sendRoapOK`, `sendRoapAnswer`, or `sendRoapError`; TURN delegation and `sendRoapMediaRequest` are covered |
|
|
434
|
+
| `ROAP-R-002` | `test/unit/spec/roap/index.ts` | no case for invalid JSON in `remoteSdp` |
|
|
435
|
+
| `ROAP-R-003` | `test/unit/spec/roap/index.ts`, `test/unit/spec/roap/turnDiscovery.ts` | none: 409/403 rethrow, handled skip results, and abort are distinct cases |
|
|
436
|
+
| `ROAP-R-004` | `test/unit/spec/meetings/utils.js`, `test/unit/spec/meeting/index.js` | keep inbound sequence/glare coverage with the owning Meeting module |
|
|
437
|
+
| `ROAP-R-005` | `test/unit/spec/roap/turnDiscovery.ts`, `test/unit/spec/roap/request.ts` | none |
|
|
438
|
+
| `ROAP-R-006` to `ROAP-R-008` | `test/unit/spec/roap/turnDiscovery.ts`, `test/unit/spec/roap/index.ts` | none |
|
|
439
|
+
| `ROAP-R-009` | `test/unit/spec/roap/request.ts` | none |
|
|
440
|
+
| `INV-003` | `test/unit/spec/roap/turnDiscovery.ts` | no case for the `defer` kept after a non-409/403 failure |
|
|
441
|
+
|
|
442
|
+
A module specification is complete only when its public surface, invariants, failure modes, and
|
|
443
|
+
test evidence agree with the implementation. Coverage measurement is pending; semantic validation
|
|
444
|
+
has not run.
|