Specification · document 15
15 Calls: control, leases, routing and continuity
| Status | Draft. Protocol version 1 (sv1) of Sloppy Voice v2 |
| Date | 2026-12-04 |
| Depends on | 00 (overview and conventions), 03 (transport, envelope, errors), 09 (channels, membership, upgrades), 10 (permissions, moderation), 13 (MLS profile). Uses objects from 02, 06, 07, 12, 16, 17, 18, 19, 20 and 21 by reference. |
| Decisions used | D-004, D-009, D-012, D-013, D-015, D-018, D-021, D-023, D-026, D-027, D-028, D-031, D-034, D-036, D-037, D-041, D-042, D-043, D-045, D-046, D-047, D-048, D-049, D-050, D-055, D-056, D-057, D-060, D-062, D-064, D-066, D-067, D-089, D-090, D-094 |
| Owns | The Call and Participant objects and every endpoint under /v1/contexts/{ctx}/call…; VoiceLease, LeaseSnapshot and lease ticks (call.tick); RelayTicket (sv-relay+jwt); {relayUrl}/connect and the data-channel layout; the control-channel message envelope; the routing rules; SFU signalling messages; call.epoch_ready and call.epoch_switch; the auto-rejoin state machine and its timers; Move voice here; Mute for everyone (its endpoints and Mute object; 10 owns ServerMute and the permission, hierarchy and audit rules); /v1/diagnostics and the diagnostic report-kind registry; every call.*, relay.* and sfu.* event, message and error code; the limit maxCallParticipants |
1. Scope
1.1 In scope
This document specifies the call control plane:
- which contexts can hold a call, and the Call and Participant objects (§2);
- the call API under
/v1/contexts/{ctx}/call…: join, leave, participant state, Mute for everyone, epoch readiness and ringing (§3); - voice leases, lease snapshots and lease ticks, and how the relay, the SFU and receivers enforce them (§4);
- the RelayTicket (§5) and the relay connection at
{relayUrl}/connect, including the data-channel layout and the control-channel messages (§6); - routing between the relay and the SFU (§7), and SFU signalling (§8);
- the media epoch switch messages for secure calls (§9);
- auto-rejoin, the reconnecting seat and transmit state after a drop (§10), Move voice here (§11), and calls during security transitions and removals (§12);
- ringing for DM calls (§13) and call diagnostics at
/v1/diagnostics(§14); - the event catalogue (§15) and error codes (§16) of the
call,relayandsfuareas.
1.2 Out of scope
| Topic | Owner |
|---|---|
voice-dc/1 frame and route-header format, Opus, jitter buffer, push-to-talk and voice-activation detection, the audio engine's gating and its receiver-side lease enforcement |
16 |
video-dc/1 fragments, sfu-rtp/1 RTP profile, video adaptation, keyframe policy, slow-viewer isolation, video path recommendations |
17 |
SFrame keys, KID layout, joinNonce, MediaAttestation format and verification, old-key retention and the hold buffer |
18 |
| Relay and SFU internals, the transport of the relay-control interface, SFU adapter mappings for specific products | 21 |
Permissions (speak_and_share, mute_members, view_channel), timeouts, kicks and bans |
10 |
| Channel kinds, membership states, channel and server upgrade procedures | 09 |
| DM hosting, DM membership, message requests and DM security computation | 12 |
MLS groups, external commits, removals and mls.epoch_ack |
13 |
The notify.event payload, push delivery and VoIP push |
19 |
| Exact copy of talk, mute and reconnect indicators and of the diagnostics consent screen | 20 |
1.3 Terminology
The terms of 00 §2 apply, in particular Call, Participant, VoiceLease, Lease tick, Bounded authority, Media profile, Auto-rejoin, Move voice here and Talk indicator. This document adds:
| Term | Definition |
|---|---|
| Call-capable context | A voice channel, a 1:1 DM or a group DM (D-064). |
| Participation | One device's presence in one call, from admission until it leaves or is removed. It has one pid. |
| Seat | The server's record of a participation. A seat can be connecting, connected or reconnecting (§2.6). |
| LeaseSnapshot | A room-wide statement of current leases for one call: who may listen, who may send audio and who may send video (§4.2). |
| Coverage | A sender is covered for a media kind when the newest lease tick a party holds lists it for that kind and that tick is less than 3 s old (§4.6). |
| Route | The way a media source travels from a sender to a receiver: relay or sfu, both through the hosting server (§7). |
| Control channel | The reliable data channel labelled sv-control on a relay connection (§6.4). |
| Outage | A period in which a participant's client can neither send nor receive media on any route (§10.1). |
| Unexpected drop | An outage that the client repairs by rejoining automatically (§10.1, §10.5). |
| Planned migration | A change of relay, route, call or security mode that the server or client starts on purpose, during which mic and push-to-talk state are kept (§10.8). |
| Call screen | Any client user interface that shows the user as being in the call, including a minimised call bar and the operating system's call interface (CallKit, Android ConnectionService). It closes when the user presses Leave or the call ends. |
| Rejoin token | A per-participation secret that lets the same device restore its seat after a drop (§10.2). |
| Transmit gate | The client's decision, made continuously, whether captured audio may be sent (§10.6). |
1.4 Conformance
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals, as shown here.
This document places requirements on four roles:
| Role | Conformance class (00 §1.5) | Sections that apply |
|---|---|---|
| Call control: the hosting server's call logic | Server | 2–5, 7–16 |
| Relay | Server (every server runs one, D-066) | 4.5, 5, 6, 9.4, 11 |
| SFU adapter (control-plane side of the optional SFU) | SFU-capable server | 4.7, 8 |
| Client | Full client, Web client; Bot client when it joins calls | 2–4, 6, 7, 9–15 |
A Bot client that joins calls MUST meet every client requirement in this document except those about the user interface. Rationale notes start with "Rationale:" and are informative. "UX:" notes describe what the user sees; document 20 owns the exact copy and they defer to it. Examples are informative unless the text says otherwise. All JSON follows 00 §7: I-JSON, lowerCamelCase members, snake_case enum values, base64url without padding, RFC 3339 timestamps with milliseconds, durations in integer milliseconds ending in Ms.
2. Call model
2.1 Where calls exist
- A call exists only in a call-capable context: a channel whose
kindisvoice, a 1:1 DM or a group DM (D-064). A request about a call in any other context, including a text channel, fails withcall.unsupported_context. - A context has at most one call at a time. Its hosting server is the call's single controller: it assigns
pids, computes leases, picks the relay and, if used, drives the SFU. - A call has the security mode of its context (SM-11). Its
securitymember is fixed for the call's lifetime. A change of the context's security mode ends the call (§12). - Clients check, not trust (SM-12, D-056). A client MUST determine a call's security mode from the context's mode as it has established it itself: for a channel or server, the secure state it has pinned (D-056, 09); for a DM, the mode it computes from the participants' IdentityStates (D-050, 12) and, for a group DM, its secure-state pin (12 §11.1). It never takes the mode from the Call object, a
call.endednextmember or a RelayTicket'ssec. If a call is presented asinsecure(in the Call object, the ticket or a lease tick withoutepoch) while the client holds the context as secure, the client MUST NOT join, MUST NOT send any media, and MUST NOT play or forward any unencrypted frame. In a channel or server it shows W9 (09 trigger T2). In a group DM for which it holds a secure-state pin, it shows W9 (12 §11.1). In a 1:1 DM it refetches the participants' IdentityStates and joins only if its own computation then says the DM is insecure; otherwise it treats the call as unavailable and records a diagnostic (18 §8.5 item 2). The same check runs before every automatic rejoin (§10.5, §12.1). - There is no limit on call length (D-013). Neither call control, nor the relay, nor the SFU may end a call or a participation because of its duration. Remote sessions are renewed silently during a long call (06). A RelayTicket is needed only to open a relay connection, and a rejoin token's 60 s window counts from a drop rather than from issue (§10.2), so neither limits a call's length.
- A call starts when the first participant is admitted (§3.3) and ends by the rules of §2.4.
Rationale: tying calls to voice channels and DMs gives each call a natural permission scope (the channel's permissions, or the DM's participants) and a natural MLS group for secure media (D-041).
2.2 Who may join
The hosting server admits a device into a call only if every row of this table holds. It checks them in this order and returns the first failure.
| # | Check | Failure |
|---|---|---|
| 1 | The session is authenticated (home session, remote session or bot token). | core.unauthenticated (03) |
| 2 | The context exists and the caller may know about it: for a channel, 09 §9.3 H2 to H4 (account state, existence, view_channel); for a DM or group DM, the caller is a participant (12 §6.5). Then the context is call-capable. |
security.upgrade_required (H2); 404 core.not_found (03) for a channel that doesn't exist or that the caller can't view (09 §9.3 H3, H4) and for a DM the caller isn't in (12 §6.5), so a hidden channel answers exactly like an unknown context; 410 channel.deleted (09) for a deleted channel the caller could view before its deletion (09 §9.3 H3); call.unsupported_context |
| 3 | Membership. Channel: 09 §9.3 H5 (community membership, including bans; needs_encryption members pass). DM or group DM: the participation is active, or pending (or, in a 1:1 DM, declined) and made active by implicit acceptance (12 §8.7). A banned account fails here. |
member.not_member, member.pending (09); moderation.banned (10); dm.not_participant (12) |
| 4 | Secure context: the account is secure, then the device is enrolled and valid (SM-4, 07; 09 §9.3 H6 and H7 for channels). This includes a member whose membership is needs_encryption (09). |
security.account_required; security.device_not_enrolled |
| 5 | Channel: the account is a channel member (09 §9.3 H8). A timed-out member passes (it may listen, 10 §8.5; §4.1). | channel.join_required (09): the client joins the channel silently and retries (09 §9.5) |
| 6 | Secure context: the device has a current leaf in the context's MLS group (13). | call.mls_join_required |
| 7 | The one-call rule of §2.3 is satisfied, or the request resolves it. | call.already_in_call |
| 8 | The call has fewer than maxCallParticipants participations (§2.7). |
call.full |
| 9 | A relay can take the call. | call.relay_unavailable |
Joining does not require speak_and_share. A member without it is admitted as a listener: the lease lets them hear but not send (§4.1).
Visibility and community membership (checks 2 and 3, 09 §9.3 H2 to H5) come before the security checks (4), so a person who can't see a channel learns nothing about it, not even that it is secure (03 §18.6, 10 §6.3). An insecure account at a secure door still receives security.account_required and its client can show G1, whose join then resumes by itself (00 Matrix A3, §4.12.2). Example: an insecure account whose membership in a secure channel is needs_encryption passes check 3 and receives 403 security.account_required (userAction: enable_encryption) at check 4.
Rationale for check 6: in a secure call, everyone who can hear is a member of the MLS group, so "who can hear this call" is exactly the member list that 00 §5.5 tells users about. A device that isn't yet in the group couldn't decrypt anything anyway. A device waiting to be re-added after its user's own reset (13 §16 awaiting_readd, 12 §11.5) can't complete that join; its client shows 12 §11.7's status line in place of the call button and treats this answer as terminal (§10.5).
2.3 One call per user per hosting server (D-067)
- A user (canonical address) has at most one participation across all calls hosted by one server. This covers both a second device of the same user and the same device joining a second call on the same server.
- If a join would break this rule and the request has
takeOver: false, the server refuses it with 409call.already_in_call. The error'sdatasays where the existing participation is (§16). - If the request has
takeOver: true, the server ends the existing participation and admits the new one, in the order of §11. When the existing participation is on another device this is Move voice here (whether it is in the same call or in another call on the same server); when it is on the same device in another call it is a switch. - Across servers the rule is enforced by the client (D-067): before a device joins a call on one server, it MUST leave any call it is in on another server. A client MUST NOT be in two calls at once.
UX: switching to another voice channel on the same server is an ordinary click, so a client SHOULD send takeOver: true without asking when the existing participation is on the same device. When it is on another device, the client offers one choice and sends takeOver: true if the user agrees. The call.already_in_call data (sameCall, §16) tells it which wording applies: for the same call, for example "You're in this call on your phone. Move voice here?"; for another call, for example "You're in a call on your phone. Leave it and join here?" (20 owns the copy). The old device's message distinguishes the two cases in the same way (§11).
Rationale: a server can't see calls on other servers, so it enforces only what it can see. The client knows about all of its own calls.
2.4 Call lifecycle and end rules
A call is created by the first successful join in a context with no active call, if the request allows creation (create: true, the default). The call ends, and the server emits call.ended to every subscriber of the context (and, in a DM, sequences 12's dm.call_logged with phase: "ended", 12 §14.1), in these cases:
reason |
When |
|---|---|
empty |
The call has no seat left (none connecting, connected or reconnecting). |
completed |
A DM call (1:1 or group) that has had participations from at least two accounts falls to seats from only one account, and no ring is pending. |
unanswered |
A DM call never had a second account join, at least one ring was started, and every ring ended by timeout or cancellation (§13). Also: a DM call that started no ring (a join with ring: false, such as an automatic join of §10.5 or §12.1) and still has seats of only one account, which has been the only account in it, 60 s after it started. |
declined |
A DM call never had a second account join, at least one ring was started, and every ring target declined (§13). |
security_upgraded |
The context became secure (§12.1). |
security_downgraded |
A 1:1 DM became insecure (§12.3). |
group_restarted |
A secure context's MLS group generation changed during the call (13 §4.2 cases G-b and G-c; §12.5). |
channel_deleted |
The channel was deleted (09). |
context_closed |
The DM was closed (for example under K5), or the context otherwise stopped accepting calls. |
server_restart |
Call control lost the call's state and can't continue it (§10.8). |
A reconnecting seat counts as present for every rule above. So a 1:1 call doesn't end while one party is briefly offline.
Rationale for the 60 s rule: a DM call created without a ring is normally the first participant coming back after a planned migration or a server restart; the others get 60 s, the life of the rejoin token, to come back too, and the call doesn't stay open forever with one person in it.
A receiver MUST treat an unknown reason like context_closed: the call is over and the client doesn't rejoin automatically.
2.5 Objects
2.5.1 Call
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
callId |
string | Yes | UUIDv7, assigned by the hosting server when the call starts. Never reused. |
ctx |
string | Yes | The context reference (ch:…, dm:… or gdm:…). |
security |
string | Yes | insecure or secure; the context's mode when the call started. A receiver MUST treat an unknown value as secure and refuse to send media until it understands the call. |
startedAt |
string | Yes | RFC 3339 timestamp. |
participants |
array of Participant | Yes | Every seat, in ascending pid order. |
videoRoute |
string | Yes | dc (video uses video-dc/1 over the relay) or sfu (video uses sfu-rtp/1 through the SFU). See §7.2. Unknown values: treat as dc. |
mediaEpoch |
integer or null | Yes | Secure calls: the MLS epoch the call has most recently switched to (§9). Null in insecure calls. |
profiles |
array of string | Yes | Media profiles this call offers: always voice-dc/1 and video-dc/1; also sfu-rtp/1 when the server is SFU-capable. |
maxParticipants |
integer | Yes | The effective maxCallParticipants for this call. |
ringing |
Ring or null | Yes | The pending ring in a DM call (§13), or null when no target is being rung. Always null in channels. |
2.5.2 Participant
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
pid |
integer | Yes | Participant index, 0–65535, unique within the call (00 §7.6). |
addr |
string | Yes | Canonical address of the account. |
name |
string | Yes | Display name (01). Clients MUST check it against addr as 01 specifies (D-031) before showing it anywhere, including the incoming-call screen and the operating system's call interface, fall back to the address's own display form when it doesn't match, and show the domain under 20's rules when it differs from the context's. |
did |
string | Yes | Device ID of the participating device. |
kind |
string | Yes | user or bot. Unknown values: treat as user. |
state |
string | Yes | connecting, connected or reconnecting (§2.6). Unknown values: treat as connecting. |
joinedAt |
string | Yes | When this participation was admitted. A seat restored after a drop keeps its joinedAt. |
selfMuted |
boolean | Yes | The participant muted their own microphone. |
selfDeafened |
boolean | Yes | The participant turned off their own playback. |
mutedForEveryone |
boolean | Yes | A moderator applied Mute for everyone (§4.9). |
sources |
object | Yes | What the participant says it is sending: {"screen": bool, "screenAudio": bool, "webcam": bool}. Informative; leases and ticks are authoritative. |
leafIndex |
integer or null | Yes | Secure calls: the MLS leaf index of the participating device, which appears in its SFrame KIDs (18). Null in insecure calls. |
pid assignment: the server assigns the lowest index that is free and hasn't been released within the last 60 s. A pid is never reassigned within one call while a frame or tick that names it could still be in flight.
Rationale: small integers keep route headers and ticks compact. The 60 s quarantine means a late frame or stale tick can't be attributed to the wrong person.
2.5.3 Ring
| Member | Type | Required | Meaning |
|---|---|---|---|
by |
string | Yes | Canonical address of the account that started the call's first ring. |
targets |
array of RingTarget | Yes | The accounts still being rung, one entry each. Each target is rung, declines and times out independently (§13.2, §13.3). |
video |
boolean | Yes | The caller started with webcam on (a hint for the incoming-call screen). |
expiresAt |
string | Yes | The latest expiresAt among targets. |
A RingTarget is {"addr": string, "by": string, "expiresAt": string}: the canonical address being rung, the canonical address of the participant who started this target's current ring (the caller, or whoever rang again, §13.3), and when this target's ring times out (45 s after it started, §13). A target whose ring ends is removed from targets; when none is left, ringing becomes null.
2.5.4 Example
{
"callId": "01938f40-5a6b-7c8d-9e0f-102132435465",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
"security": "secure",
"startedAt": "2026-12-04T18:20:02.114Z",
"participants": [
{ "pid": 3, "addr": "bob@b.com", "name": "Bob", "did": "Yx3kP0aL9qR2sT5uV8wZ1B",
"kind": "user", "state": "connected", "joinedAt": "2026-12-04T18:20:02.114Z",
"selfMuted": false, "selfDeafened": false, "mutedForEveryone": false,
"sources": { "screen": true, "screenAudio": true, "webcam": false }, "leafIndex": 2 },
{ "pid": 7, "addr": "alice@a.com", "name": "Alice", "did": "q2bS9xVg3m0yJpQe1vT0Aw",
"kind": "user", "state": "reconnecting", "joinedAt": "2026-12-04T18:21:40.003Z",
"selfMuted": false, "selfDeafened": false, "mutedForEveryone": false,
"sources": { "screen": false, "screenAudio": false, "webcam": false }, "leafIndex": 5 }
],
"videoRoute": "dc",
"mediaEpoch": 42,
"profiles": ["voice-dc/1", "video-dc/1", "sfu-rtp/1"],
"maxParticipants": 200,
"ringing": null
}2.6 Seat state machine (call control)
| State | Event | Action | Next state |
|---|---|---|---|
| — | Join admitted (§3.3) | Assign pid, issue RelayTicket and rejoin token, add pid to the lease lists, emit call.participant_joined |
connecting |
connecting |
Relay reports the session up (21) | Emit call.participant_updated |
connected |
connecting |
20 s pass without a relay session | Remove the seat with reason timeout |
— |
connected |
Relay reports the session down (except an old relay's report after a planned migration, §6.9) | Record lostAt; start the 30 s seat timer; emit call.participant_updated |
reconnecting |
reconnecting |
Valid rejoin (§3.3) | Issue a new RelayTicket and rejoin token, keep pid, emit call.participant_updated |
connecting |
reconnecting |
30 s pass since lostAt |
Remove the seat with reason timeout |
— |
connecting or connected |
Valid rejoin with planned: false (the client noticed the drop before the relay did) |
As for reconnecting; the relay closes the old session with reason replaced when the new one arrives |
connecting |
connected |
Valid rejoin with planned: true (§10.8) |
Issue a new RelayTicket and rejoin token, keep pid; the seat stays connected while the client moves (make before break) |
connected |
connecting |
Valid rejoin with planned: true (§10.8), for example a relay migration that starts before the seat's first relay session is up |
Issue a new RelayTicket and rejoin token, keep pid |
connecting |
| any | Leave (§3.4) | Remove the seat with reason left |
— |
| any | Move voice here or switch (§11) | Remove the seat with reason moved or switched |
— |
| any | Removal: kick, ban, loss of membership or view_channel, device revocation, identity change, loss of the device's leaf (§12.4) |
Remove the seat with reason removed or revoked |
— |
| any | The device's session at the hosting server expired or ended without a revocation (§12.4) | Remove the seat with reason session_expired |
— |
| any | Call ends (§2.4) | Remove every seat with reason call_ended. The relay is told to close each session with call_restarted when the end reason is security_upgraded or group_restarted, and with call_ended otherwise (§4.5; 21 §6.4.5, §6.4.7) |
— |
"Remove the seat" always means, in this order: take the pid out of every lease list and push a new LeaseSnapshot at once (§4.3); tell the SFU adapter to stop the participant's tracks (§4.7); invalidate the rejoin token, except for reasons timeout and session_expired, where the token stays valid until its own expiry (§10.2); emit call.participant_left; then end the call if §2.4 says so.
A seat keeps its lease rights while connecting or reconnecting: its pid stays in the lists it was in. Leases state rights, not connectivity, so a device that rejoins within the seat's 30 s finds its rights unchanged (§10.3).
A client normally detects a relay failure (5 s, §6.7) before the relay does (10 s), so its rejoin usually moves the seat from connected straight to connecting. Clients SHOULD show the reconnecting badge only once a seat has been reconnecting for 2 s, so a seat that a rejoin repairs at once shows nothing to anyone; a seat that goes from connected or reconnecting to connecting shows no badge (20 §11.6).
2.7 Limits and timers
Limits are advertised in ServerMetadata limits (02) following 00 §7.12:
| Limit | Default | Floor | Meaning |
|---|---|---|---|
maxCallParticipants |
200 | 25 | Seats per call. In a secure call the MLS group size (maxSecureLeaves, 13) also bounds it. |
Every timer in this document:
| Timer | Value | Section |
|---|---|---|
| Lease snapshot interval | 1,000 ms (±100 ms) | 4.3 |
Lease validity (validMs) |
3,000 ms | 4.2 |
| Revocation push after the decision | ≤ 100 ms (SHOULD), ≤ 500 ms (MUST) | 4.3 |
| Relay re-emits a tick after receiving the snapshot | ≤ 50 ms (SHOULD); skipped if it can't be sent within 250 ms | 4.4 |
Hosting server discards a queued WebSocket call.tick |
after 250 ms in the queue | 4.4 |
| Relay stops all forwarding without a fresh snapshot | 3,000 ms | 4.5 |
| Revoked participant cut off on every honest path | ≤ 4,000 ms | 4.8 |
| SFU tracks disabled after a revocation | ≤ 1,000 ms | 4.7 |
| RelayTicket lifetime | ≤ 60 s | 5 |
| Relay waits for the first snapshot of an unknown call | 2,000 ms | 6.2 |
Client relay.ping interval |
5 s | 6.7 |
| Client declares the relay connection failed | ≥ 5,000 ms without any control-channel message, whatever the ICE state; or ≥ 5,000 ms in ICE disconnected (monotonic clock) |
6.7 |
| Relay declares a client gone | 10 s without any packet | 6.7 |
connecting seat timeout |
20 s | 2.6 |
| Reconnecting seat held | 30 s | 10.3 |
| Rejoin token accepted | 60 s after the participation stopped being connected | 10.2 |
| Auto-rejoin attempts | 0, 1, 2, 4, 8, 15 s, then every 30 s while the call screen is open | 10.5 |
| Screen share held after an unexpected drop | 30 s after t0 (client monotonic clock); it resumes only if a join response with seatRestored: true arrived by then (D-090) |
10.6 (owned by 17 §4.5) |
| Sender epoch-switch cap | 2 s after processing the commit | 9 |
| Old epoch key retention (receivers) | 10 s after learning a newer mediaEpoch |
9 (owned by 18) |
| Lagging sender's transmit gate closes | 8 s after learning a newer mediaEpoch it can't send in |
9 (owned by 18) |
| Hold for frames of an unknown newer epoch | 200 ms | 9 (owned by 18) |
| Video route switch overlap | ≤ 5 s | 7.2 |
| Move voice here admission wait | ≤ 3 s | 11 |
| Ring timeout | 45 s per target | 13 |
| DM call without a ring, one account only | ends 60 s after it started | 2.4 |
| Diagnostics counter sample | 10 s, and at call close | 14 |
3. Call control API
3.1 Common rules
All call endpoints are on the context's hosting server, relative to its base URL, and follow 00 §7.3 and 03: HTTPS, JSON bodies that aren't wrapped in the envelope, Authorization: Bearer (home or remote session) or Authorization: Bot, RFC 9457 problem details with userAction, and open CORS. {ctx} is one path segment; the colon MAY be percent-encoded.
| Method and path | Purpose | Section |
|---|---|---|
GET /v1/contexts/{ctx}/call |
Current call, or none | 3.2 |
POST /v1/contexts/{ctx}/call/join |
Join, rejoin, switch or Move voice here | 3.3 |
POST /v1/contexts/{ctx}/call/leave |
Leave | 3.4 |
PATCH /v1/contexts/{ctx}/call/participants/{pid} |
Own mute, deafen and source state | 3.5 |
GET, PUT, DELETE /v1/contexts/{ctx}/call/mutes[/{addr}] |
Mute for everyone | 3.6 |
POST /v1/contexts/{ctx}/call/epoch-ready |
call.epoch_ready |
3.7 |
POST /v1/contexts/{ctx}/call/ring, …/call/decline |
Ringing in DM calls | 13 |
/v1/contexts/{ctx}/call/sfu/… |
SFU signalling | 8 |
POST /v1/diagnostics |
Diagnostic reports | 14 |
POST {relayUrl}/connect |
Relay connection | 6.2 |
Every endpoint that acts on a participation identifies it from the session's device (did): a device can act only for its own participation, except Mute for everyone (§3.6). The server MUST NOT take an address, did or pid from the body as proof of who is asking.
Rate limits (per session, answered with 429 core.rate_limited, 03): join 30 per minute (enough for the auto-rejoin schedule of §10.5, its immediate resends and fast channel switching); participant updates 10 per second; epoch-ready 10 per second; ring per §13. Servers MAY set higher limits.
Whenever a socket gains a full subscription to a call-capable context's stream, through a resume or subscribe entry in session.hello (including the resume of every reconnect, 03 §5.4) or in session.subscribe (including a resume that restarts an existing subscription and an upgrade from heads), and again after any session.resync_required for that stream, the server sends call.state with the current call or null, targeted at that socket's session. It sends it after the SubscriptionResult for the stream (in session.ready or session.subscribed) and before any later call event of that context. Call events are ephemeral (00 §7.4) and no resume replays them, so this is how a client that missed events, including every participant and route update lost while its WebSocket was down, catches up.
Subscriptions while in a call. 03 delivers untargeted ephemeral events only to sockets with a full subscription to their stream (03 §7.2 E2), and the call-state events of §15 that aren't targeted are context events. Therefore, from the join request until its participation ends, a client MUST keep a full subscription to the call's context stream on the hosting server, whatever the user is looking at, and MUST renew it after every WebSocket reconnect. The server targets the participant events of §15 (call.tick, call.lease_changed, call.epoch_switch, call.route_changed, call.moved, call.migrate and the sfu.* events) at the sessions of the participating device. call.ringing and call.ring_ended travel on the target's me stream, which every socket subscribes at full (03 §5.4), and as targeted events they reach every connected session of the account (03 §7.2 E5).
3.2 Get the current call
GET /v1/contexts/{ctx}/call returns 200 with {"call": Call} or {"call": null}. Any member of the context may read it (rows 2, 3 and 5 of §2.2); in a secure channel, members whose state is needs_encryption may read it too (09 check H6 item ii), which lets their client show who is in the call next to the G1 card without being able to join.
Rationale: the roster of a voice channel is shown in the channel list, as users expect from familiar apps. It is metadata the server has in every mode (00 §5.4).
3.3 Join
POST /v1/contexts/{ctx}/call/join
3.3.1 Request
| Member | Type | Required | Default | Meaning |
|---|---|---|---|---|
features |
array of string | Yes | — | Media profiles this device supports in this call, a subset of its session features: voice-dc/1 (MUST be present), video-dc/1, sfu-rtp/1. Unknown values are ignored. |
create |
boolean | No | true |
Start a call if none is active. When false and no call is active, the server answers 404 call.not_active. |
takeOver |
boolean | No | false |
Resolve a one-call conflict (§2.3) by ending the user's existing participation on this server (§11). |
rejoinToken |
string | No | — | The token of a participation of this device, to restore its seat (§10.2). |
planned |
boolean | No | false |
Only with rejoinToken: this rejoin is a planned migration (§10.8). |
selfMuted |
boolean | No | false |
Initial self-mute state. |
selfDeafened |
boolean | No | false |
Initial self-deafen state. |
ring |
boolean | No | true |
DM contexts only: whether starting a call rings the other participants (§13). Ignored when the call already exists and in channels. |
video |
boolean | No | false |
The caller starts with webcam on; copied into the ring. |
Clients SHOULD send an Idempotency-Key header (03) with every join, so a retry after a lost response returns the same result. A client MUST use a fresh key for every new join, including every scheduled auto-rejoin attempt (§10.5) and every immediate resend with a changed body; it reuses a key only to resend the same request after losing its response. When a server replays a stored join response, it MUST put a newly issued RelayTicket in it, because the stored one may have expired or been used; every other member is replayed as stored.
Every automatic join (§10.5, §12.1, §12.5) MUST send ring: false.
3.3.2 Processing
The server processes a join as one atomic step per context and per account: call control holds a lock on the context and a lock on the account (canonical address) across steps 1 to 6, always taking the account lock first. Concurrent joins and leaves of one account, from any of its devices and in any contexts on this server, are therefore processed one after another, and the later one sees the participation the earlier one created or removed. So two concurrent takeOver: true joins of one user end with exactly one participation: the one processed second, after it has moved the first one away (§11).
- Run the checks of §2.2. If
rejoinTokenis present, validate it first (§10.2). A valid token satisfies check 7 for its own participation and makes the request a rejoin. A token that has expired gives 410call.rejoin_expired; a token for a participation that was moved gives 409call.moved; a token for a call that has ended gives 410call.ended; any other invalid token gives 403call.rejoin_invalid. The client then follows §10.5. - A rejoin re-runs checks 1–6 and 9, so a user who lost the right to be in the call isn't let back in (HP-13 item 8). It keeps the
pidif the seat still exists. If the seat was already removed with reasontimeout(between 30 s and 60 s after the drop) orsession_expired, the server admits the device as a new participation with a newpid, subject to checks 7 and 8;call.participant_joinedthen carriesrejoined: trueso other clients play no join sound. - If the device already holds a seat in this same call and no token was sent: with
takeOver: truethe server treats the request as an unplanned rejoin of that seat; otherwise it answers 409call.already_in_callwithsameDevice: true, sameCall: true. - If the user holds a seat elsewhere on this server: with
takeOver: truerun §11; otherwise 409call.already_in_call. - If no call is active: with
create: falseanswer 404call.not_active; otherwise create the call, choose a relay (§6.1), start sending it snapshots (§4.3) and emitcall.startedwith the new Call, before thecall.participant_joinedof step 6. In a DM, the hosting server also sequences 12'sdm.call_loggedwithphase: "started"(12 §14.1). - Admit: assign the
pid(§2.5.2), compute the VoiceLease (§4.1), push a snapshot that includes the newpid(§4.3), issue a RelayTicket (§5) and a fresh rejoin token (which replaces any earlier token of this participation), and emitcall.participant_joined(orcall.participant_updatedfor a restored seat). - DM call started by this request with
ring: true: start the ring (§13). - Answer
200with the response below.
3.3.3 Response
| Member | Type | Required | Meaning |
|---|---|---|---|
call |
Call | Yes | The call after admission. |
pid |
integer | Yes | This participation's index. |
rejoinToken |
string | Yes | Fresh rejoin token (§10.2). |
seatRestored |
boolean | Yes | true when a rejoin kept the earlier seat and pid. |
lease |
VoiceLease | Yes | This participant's rights (§4.1). |
tick |
LeaseSnapshot | Yes | The snapshot that admitted this pid. The client treats it as its first lease tick. For coverage (§4.6), its receipt time is when the client first sent a join request with this request's Idempotency-Key, not when the response arrived (16 §12.1 item 1), so a slow or replayed response can't make it look fresh. |
relay |
object | Yes | {"url": relayUrl, "ticket": RelayTicket, "ticketExpiresAt": timestamp} (§5, §6). |
The per-call value takes precedence over ServerMetadata (02): a client uses relay.url from the join response, never ServerMetadata endpoints.relayUrl.
POST https://b.com/v1/contexts/ch:01938a11-2b3c-7d4e-8f90-112233445566/call/join
Authorization: Bearer rs_4kJ…
Idempotency-Key: 9f0c1e2a-join-1
{ "features": ["voice-dc/1", "video-dc/1", "sfu-rtp/1"], "selfMuted": false }{
"call": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
"security": "secure", "startedAt": "2026-12-04T18:20:02.114Z", "participants": [ "…" ],
"videoRoute": "dc", "mediaEpoch": 42,
"profiles": ["voice-dc/1", "video-dc/1", "sfu-rtp/1"], "maxParticipants": 200, "ringing": null },
"pid": 7,
"rejoinToken": "rj_Vb7mQ2xT9kLp4sWz0aYc1dRf8gHn3uJe6iKo5tBv2Nw",
"seatRestored": false,
"lease": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 7, "listen": true,
"audio": true, "video": true, "audioBlockedBy": null, "videoBlockedBy": null },
"tick": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1185, "validMs": 3000,
"audio": [3, 7], "video": [3, 7], "listeners": [3, 7], "epoch": 42 },
"relay": { "url": "https://relay1.b.com/r",
"ticket": "eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXJlbGF5K2p3dCIsImtpZCI6ImIuY29tIzIwMjYtMTJhIn0.eyJpc3Mi…",
"ticketExpiresAt": "2026-12-04T18:21:00.000Z" }
}3.3.4 After the response
The client connects to the relay at once (§6.2). From the moment the join response arrives it is in state restoring of the client state machine (§10.4), and a failed relay connection is handled by §6.2 item 3. In a secure call it also makes sure it has installed send keys for its sending epoch as 18 §6.3 selects it (the highest epoch it holds at or below call.mediaEpoch, which is normally call.mediaEpoch itself; a device that holds no epoch that high keeps sending in its own newest epoch for up to 8 s, 18 §6.3 item 4, and a device that has just joined the group by external commit sends at once in its join epoch, 18 §6.3 row 3) before it sends media. 18 is normative for this condition. Until both are done, its transmit gate is closed (§10.6), and a held push-to-talk shows the "not being heard" state.
3.4 Leave
POST /v1/contexts/{ctx}/call/leave with body {"callId": "<uuid>"}.
The server removes the device's seat in that call with reason left (§2.6) and answers 204. Leave is idempotent: if the device holds no seat in that call, the server still answers 204. An unknown callId also gives 204.
The client closes its relay connection and SFU session after sending leave, and stops auto-rejoin. Closing the relay connection without calling leave is an outage, not a leave: the seat is held for 30 s.
UX: pressing Leave is the only way a user ends their own participation. A client SHOULD call leave when the user closes the app's call screen deliberately, and MUST NOT call it on its own because of network trouble.
3.5 Own participant state
PATCH /v1/contexts/{ctx}/call/participants/{pid} with any subset of:
| Member | Type | Meaning |
|---|---|---|
selfMuted |
boolean | Own microphone muted. |
selfDeafened |
boolean | Own playback off. A client that deafens also mutes, as users expect; the server doesn't enforce this. |
sources |
object | Any of screen, screenAudio, webcam (booleans): what the device is starting or stopping to send. |
The pid MUST be the device's own (call.not_participant otherwise). Setting screen or webcam to true needs video in the device's lease, and screenAudio needs audio; otherwise the server answers 403 call.not_permitted with data.blockedBy from the VoiceLease. The server answers 200 with the updated Participant and emits call.participant_updated.
selfMuted, selfDeafened and sources are for display only. Whether frames are forwarded depends only on the lease lists (§4).
3.6 Mute for everyone
Mute for everyone is the moderator action of D-015 and 10 that silences every audio source of one person (microphone, and screen or application sound) in one voice channel while leaving their video running. It works only in voice channels. This document owns its endpoints, its Mute object and its call effects; 10 supplies its permission, hierarchy rules and audit entries (10 §8.2, §8.6) and owns the separate community-wide ServerMute (/v1/moderation/server-mutes, 10 §8.6).
| Request | Effect | Response |
|---|---|---|
PUT /v1/contexts/{ctx}/call/mutes/{addr} with body {"reason"?, "showReason"?, "reportId"?} (10 §8.2 rules 2 and 3: reason 0–512 Unicode scalar values, showReason default false) |
Mutes the account addr in this channel's calls until removed. Idempotent; a PUT for an existing mute replaces its reason, showReason and reportId. |
200 with a Mute object |
DELETE /v1/contexts/{ctx}/call/mutes/{addr} |
Removes the mute. Idempotent. | 204 |
GET /v1/contexts/{ctx}/call/mutes?cursor=…&limit=… |
Lists current mutes, paged by cursor (00 §7.10). Any member who may read the call (§3.2) may list them, because call participants see who is muted. | 200 {"items": [Mute], "nextCursor": …} |
GET /v1/contexts/{ctx}/call/mutes/{addr} |
Reads one mute. | 200 with a Mute object, or 404 core.not_found |
{addr} is a canonical address (an alias of this server's own domains is rewritten; any other non-canonical address fails with 400 address.non_canonical, 01 §7.7) in one path segment, with every character outside RFC 3986 pchar percent-encoded as UTF-8 (03 §2.6 item 2). @ needs no encoding.
Mute object.
| Member | Type | Required | Meaning |
|---|---|---|---|
ctx |
string | Yes | The voice channel. |
addr |
string | Yes | Canonical address of the muted account. |
reason |
string or null | No | Present only for holders of mute_members in the channel, and for the muted account itself when showReason is true (10 §8.2 rule 2). |
showReason |
boolean | Yes | Whether the muted account is shown reason. |
reportId |
string or null | No | As 10 §8.2 rule 3; present only for holders of mute_members. |
createdAt |
string | Yes | When the mute was applied or last replaced. |
The Mute object never names the moderator (10 §8.2 rule 5); the audit log does (10 §11).
Rules:
PUTandDELETEneedmute_membersin the channel (10). The rules of 10 §8.2 rule 1 apply, and a refusal uses 10's codesmoderation.self_targetormoderation.target_protected; a caller without the permission gets 403core.forbidden. Clients send anIdempotency-Keyas 10 §8.2 rule 6 requires.- In a DM context the server answers 403
call.not_permitted. DMs have no moderators. - A mute is stored per (channel, account), not per call or per device. It survives rejoins, Move voice here, the end of the call and later calls in the channel, until a moderator removes it.
- While the mute exists, the account's participations are left out of the
audiolist and stay invideoandlisteners(§4.1). Within 500 ms the server pushes a new snapshot (§4.3), emitscall.participant_updatedwithmutedForEveryone: true, sendscall.lease_changedwithaudioBlockedBy: "muted_for_everyone"to the muted device, and writes 10's audit entry (member_muted, ormute_liftedonDELETE, withctxset, 10 §11.3) in the same transaction as the change. 10'smoderation.appliedandmoderation.liftedaren't sent for this mute (10 §8.6, §13.2). The target learns of it fromcall.lease_changed(audioBlockedBy: "muted_for_everyone"), and in later calls from the join response's VoiceLease and its own Participant'smutedForEveryone. - A ServerMute (10 §8.6) is a separate input to the lease computation (§4.1), reported as
audioBlockedBy: "server_muted". It doesn't create a Mute object here, andmutedForEveryoneistruewhile either applies.
UX: the muted person's client shows that a moderator muted them; other clients show a distinct "muted by a moderator" icon. A muted person who holds push-to-talk sees the "not being heard" state (§10.6), never a transmitting indicator.
3.7 Epoch readiness (call.epoch_ready)
POST /v1/contexts/{ctx}/call/epoch-ready with body:
| Member | Type | Required | Meaning |
|---|---|---|---|
callId |
string | Yes | The call. |
epoch |
integer | Yes | The MLS epoch whose SFrame receive and send keys this device has installed (18). |
The device MUST be a participant (call.not_participant) in a secure call (call.not_permitted in an insecure one). An epoch higher than the group's current epoch at the Delivery Service gives 409 call.epoch_unknown (the device is on a fork or ahead of a commit the server hasn't accepted; it resynchronizes per 13). An epoch at or below call.mediaEpoch is accepted and ignored. Success is 204. §9 defines when a device sends it and what the server does.
4. Voice leases
Bounded authority (00 HP-15, D-046) rests on one mechanism: the hosting server states, every second, who may listen and who may send, and every component that forwards or plays media obeys only statements that are less than 3 s old.
4.1 The VoiceLease
A participant's VoiceLease is its membership in the three lists of the newest LeaseSnapshot. Call control computes the lists from these inputs, which it MUST re-evaluate whenever one of them changes:
| Input | Owner | listeners |
audio |
video |
|---|---|---|---|---|
The device holds a seat (connecting, connected or reconnecting) |
15 | Required | Required | Required |
The account has speak_and_share in the context (channels: effective permission, 10; DMs: every participant has it) |
10, 12 | — | Required | Required |
| A Mute for everyone exists for the account in this channel (§3.6) | 15 | — | Excluded | — |
| A ServerMute applies to the account (channels only; 10 §8.6) | 10 | — | Excluded | — |
| The account is timed out (10) | 10 | — | Excluded | Excluded |
So: audio ⊆ listeners, video ⊆ listeners, and every seat is in listeners. A member whose rights to be in the call end (kick, ban, loss of view_channel, device revocation, and the rest of §12.4) loses the seat itself and so leaves all three lists.
Mapping from media sources (18 assigns sourceId) to lists:
sourceId |
Source | List that covers it |
|---|---|---|
| 0 | Microphone | audio |
| 1 | Screen video | video |
| 2 | Screen or application sound | audio |
| 3 | Webcam | video |
| 4–15 | Reserved | None: nobody forwards or plays them until a future document maps them |
The VoiceLease object is a participant's own view of its rights, returned by join and sent in call.lease_changed:
| Member | Type | Required | Meaning |
|---|---|---|---|
callId |
string | Yes | The call. |
pid |
integer | Yes | The participant. |
listen |
boolean | Yes | In listeners. Always true while the seat exists. |
audio |
boolean | Yes | In audio. |
video |
boolean | Yes | In video. |
audioBlockedBy |
string or null | Yes | Why audio is false: no_permission, muted_for_everyone, server_muted, timed_out or other. Null when audio is true. Unknown values: treat as other. |
videoBlockedBy |
string or null | Yes | Why video is false: no_permission, timed_out or other. Null when video is true. |
When more than one input blocks a list, …BlockedBy names the first that applies in this order: timed_out, no_permission, muted_for_everyone, server_muted.
4.2 The LeaseSnapshot
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
callId |
string | Yes | The call. |
seq |
integer | Yes | Strictly increasing per call (§4.3). |
validMs |
integer | Yes | Always 3000 in v1. Receivers MUST use 3,000 ms whatever the value says, and MAY report a different value as a diagnostic. |
audio |
array of integer | Yes | pids allowed to send sources 0 and 2. |
video |
array of integer | Yes | pids allowed to send sources 1 and 3. |
listeners |
array of integer | Yes | pids allowed to receive anything in the call. |
epoch |
integer | Secure calls only | The call's current mediaEpoch (§9). Absent in insecure calls. |
Each array is in ascending order without duplicates, and audio and video are subsets of listeners. A receiver that gets a snapshot breaking these rules MUST ignore it and record a diagnostic. Unknown members are ignored.
{ "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1186, "validMs": 3000,
"audio": [3], "video": [3, 7], "listeners": [3, 7, 12], "epoch": 42 }Rationale: snapshots are complete rather than deltas. A receiver that missed any number of them is correct again after the next one, and a stale or reordered snapshot is recognised by its seq alone. No timestamp is included, so no party needs synchronised clocks: every age is measured from receipt on the receiver's own monotonic clock.
4.3 Generating snapshots
- From the moment a call is created until it ends, call control MUST produce a snapshot for it at least every 1,000 ms (±100 ms).
- When a list changes, call control MUST produce a new snapshot without waiting for the next interval: it SHOULD do so within 100 ms of the decision and MUST do so within 500 ms. This applies to removals (revocations) and to grants alike.
seqstarts at 1 for a new call, increases by at least 1 for every snapshot, and MAY skip values. An implementation that restarts while keeping a call's state MUST continue above everyseqit might have used, for example withmax(last + 1, current Unix time in ms). One that loses a call's state ends it with reasonserver_restart(§10.8).- Call control MUST NOT produce a snapshot that lists a
pidwhose seat has been removed. - Each snapshot goes to the call's relay through the relay-control interface (21), which acknowledges it; to the SFU adapter when the call uses the SFU (§4.7); and to every participant's device session as the WebSocket event
call.tick(§4.4).
4.4 Lease ticks
A lease tick is a LeaseSnapshot delivered to a participant. It arrives two ways, with an identical payload:
- Over the relay. The relay re-emits every snapshot it accepts to every session of that call as the control-channel message
call.tick(§6.5), SHOULD do so within 50 ms of receipt, and MUST NOT modify it. A relay that can't send a tick at once because a session's control channel is congested MUST skip that tick for that session rather than send it more than 250 ms after receiving the snapshot. - Over the event WebSocket, as the ephemeral event
call.tick(§15), sent by the hosting server to each participating device's sessions. The hosting server MUST discard a queuedcall.tickthat has waited more than 250 ms since the snapshot was produced, instead of sending it.
The WebSocket copy comes from the hosting server itself, so it reaches a participant even when its relay connection is down or the relay misbehaves (item 3). A client processes ticks from both sources as one stream per callId:
- It keeps the newest tick of its current call: the one with the highest
seq, and ignores any tick whoseseqis not higher than that. seqstate belongs to onecallId. A tick for anothercallIdis ignored, except that when the client joins a new call (a switch, a rejoin into a new call, or the new call after §12.1 or §12.5) it discards all tick state of the old call and starts afresh with the join response'stick.- Recovery from a wedged
seq. When the newest held tick is 3,000 ms old or older, the client accepts the next tick of the same call that arrives over the WebSocket, whatever itsseq, and continues from it. A relay can therefore stop a client from accepting genuine ticks over the relay path (for example by sending a tick with a hugeseq), but not over the WebSocket, which is the hosting server's own channel.
Rationale: the "skip, don't send late" rules matter because a receiver measures a tick's age from when it arrives. A tick that sat in a queue for several seconds would otherwise look fresh.
4.5 Relay enforcement
The relay keeps, per call, the accepted snapshot with the highest seq (S) and the time r(S) it was received, on the relay's monotonic clock. It ignores a snapshot whose seq is not higher than S.seq, and applies a new one immediately on receipt. Snapshots reach the relay only from call control through the relay-control interface (21); when now − r(S) ≥ 3,000 ms, the relay accepts the next snapshot for the call whatever its seq, so a control-plane fault that produced a too-high seq can't silence a call for longer than 3 s.
For every media message from a session with participant index p (the pid in its RelayTicket):
- If
now − r(S) ≥ 3,000 ms, drop it. (A call whose snapshots stop for 3 s is silenced entirely.) - If the route header's
pid(16, 17) isn'tp, drop it and count a diagnostic. A sender can't speak as someone else. - If
pisn't in the list that covers the message'ssourceId(§4.1), drop it. - Otherwise forward it to each session
qof the call withq ≠ p,qinS.listeners, and, for sources 1, 2 and 3,qsubscribed to that source (§6.6).
Control-channel messages that a participant sends to others follow the same rules, with the condition of step 3 replaced by "p is in S.listeners". A media.attestation is forwarded to every listener, whether or not that listener subscribed to the source, because attestations are small and a receiver may be getting the source through the SFU. In an insecure call the relay SHOULD drop media.attestation messages instead of forwarding them (18 §8.6 item 3). A call.media_feedback goes only to its to.
When call control removes a seat, it also tells the relay through the relay-control interface (21) to close that session with a reason: the seat's removal reason, except as §2.6 says for a call end. The relay sends relay.closing with that reason (§6.6) and closes the connection. Whether or not that instruction arrives, a session whose p is missing from the newest snapshot gets nothing forwarded to or from it, and the relay SHOULD close it after 3 s.
Delivery is per recipient (00 §3.1): the relay checks and queues each recipient separately, so one slow listener never holds up the others. Queue and pacing rules are in 16, 17 and 21.
4.6 Receiver enforcement and coverage
Every client keeps the newest tick T (§4.4) and the time it received it, on its audio engine's monotonic clock (00 §7.7). A sender p is covered for a list L when p is in T.L and less than 3,000 ms have passed since T arrived.
- A client MUST drop, before decoding or playback, every frame whose sender isn't covered for the source's list at the moment of playout scheduling. This applies to both routes: relay and SFU. 16 specifies how the audio engine does this for audio, and 17 for video.
- A client MUST NOT send a source unless it is itself covered for that source's list. When it stops being covered, it stops sending that source within one frame interval and its transmit gate closes (§10.6).
- When the newest tick omits a sender, that sender stops being covered at once: the 3 s window only bounds how long the newest tick counts, it never extends a right the newest tick doesn't give.
Rationale: enforcing on the audio engine's own clock means a stalled user interface, a frozen WebSocket or a misbehaving relay can't keep stale audio playing (00 §3.1, brief §5).
4.7 SFU enforcement
When a call uses the SFU (§7.2), the SFU adapter applies every snapshot to the SFU:
- A published track of participant
pand sourcekis forwarded only whilepis covered fork's list in the newest snapshot. - A subscriber session of participant
qreceives tracks only whileqis inlisteners. - Each change MUST take effect at the SFU within 1,000 ms of the snapshot that caused it. If the adapter can't confirm a change within that time, call control MUST close the affected participant's SFU session.
- If the adapter receives no snapshot for a call for 3,000 ms, it MUST pause all forwarding for that call until snapshots resume.
SFUs don't understand leases; the adapter translates them into the SFU's own operations (§8.5, 21). Receivers enforce coverage on SFU media too (§4.6), so an SFU that ignores an instruction still can't make an honest client play a revoked sender for more than 4 s.
4.8 Timing: cut within 4 s
Let a revocation be decided at time 0. Let d be the one-way delay of the network path from the hosting server, or its relay, to a client, including the hop from call control to the relay. The analysis assumes d ≤ 0.5 s, which every network a call can usefully run on meets; a client whose ticks are older than that hears little anyway.
A tick produced just before time 0 can reach a client late by at most its queueing allowance (250 ms on the WebSocket, §4.4; on the relay path, 250 ms on the relay-control link, 21 §6.6 rule 3, plus 250 ms at the relay, §4.4) plus d, and counts for 3 s from arrival (§4.6). So the newest tick a client can hold that still lists a revoked sender expires no later than 3 s + 0.5 s + d after time 0.
| Path | Worst case for an honest implementation | Bound |
|---|---|---|
| Relay | The immediate snapshot reaches the relay within 0.5 s. If that push is lost, the next periodic snapshot (≤ 1.1 s) also omits the sender. If control itself fails, the relay's last snapshot expires 3 s after it arrived, and it arrived no later than 250 ms (21 §6.6 rule 3) plus the control-to-relay delay after time 0. | ≤ 3.25 s + control-to-relay delay |
| SFU | Adapter change within 1 s of the snapshot; session closed otherwise; dead-man pause after 3 s. | ≤ 1.5 s typical, ≤ 3 s if control fails |
So a revoked participant is cut off within 4 s on every path (D-046), under the delay assumption above. Every path goes through the relay or the SFU (D-094, §7.1), so the server enforces this whatever the participants' clients do: no modified client can keep sending to, or receiving from, a revoked participant.
4.9 Mute for everyone versus revoking speak_and_share (D-015)
| Action | Who | listeners |
audio |
video |
What others experience |
|---|---|---|---|---|---|
| Mute for everyone (§3.6), or a ServerMute (10 §8.6) | Member with mute_members (in the channel, or at community level) |
stays | removed | stays | Microphone and screen/application sound stop within 4 s; screen video and webcam continue. |
Revoke speak_and_share (role change or channel overwrite, 10) |
Member with manage_roles, or with mute_members for a member overwrite that changes only speak_and_share (10 §5.2, §8.7) |
stays | removed | removed | Every source stops within 4 s; the person can still listen and watch. |
| Timeout (10) | Member with timeout_members |
stays | removed | removed | As above, for the timeout's duration. |
Kick, ban, removal from the DM, loss of view_channel |
Per 10 and 12 | removed | removed | removed | The person leaves the call (call.participant_left, reason removed). |
| Self-mute | The participant | stays | stays | stays | The participant's own client stops sending; nothing is enforced. |
4.10 call.lease_changed
Whenever a participant's own audio or video membership changes, the hosting server sends call.lease_changed with the new VoiceLease to that participant's device session, in addition to the snapshot. Ticks are authoritative for enforcement; call.lease_changed exists so the client can say why.
UX: a client that loses audio while the user holds push-to-talk shows the "not being heard" state with the reason (muted by a moderator, no permission to speak, timed out). It never shows the user as transmitting (D-012). When audio comes back, a voice-activation or open-mic user is still self-muted from the start of the block (§10.6 rule 6) and unmutes deliberately; a push-to-talk user follows the physical control.
4.11 Test vectors: coverage
These vectors are normative for §4.4, §4.5 and §4.6. Times are in milliseconds on the receiving party's monotonic clock. The validity window is 3,000 ms.
Receiver vector R1.
| Time | Input | Newest tick after input | Decision |
|---|---|---|---|
| 0 | Tick seq 100, audio [3, 7] |
100 (received at 0) | — |
| 1000 | Tick seq 101, audio [3, 7] |
101 (at 1000) | — |
| 1500 | Audio frame from 7 | 101 | Play (7 listed, age 500) |
| 1600 | Tick seq 103, audio [3] (immediate revocation) |
103 (at 1600) | — |
| 1650 | Audio frame from 7 | 103 | Drop (7 not in newest tick) |
| 1700 | Tick seq 102, audio [3, 7] (late, via the WebSocket) |
103 | Ignored (seq not higher) |
| 1800 | Audio frame from 3 | 103 | Play |
| 4599 | Audio frame from 3 (no ticks since 1600) | 103 | Play (age 2999) |
| 4600 | Audio frame from 3 | 103 | Drop (age 3000 is not less than 3000) |
| 4700 | Tick seq 104, audio [3] |
104 (at 4700) | — |
| 4720 | Audio frame from 3 | 104 | Play |
Receiver vector R2 (recovery from a wedged seq). Same call throughout.
| Time | Input | Newest tick after input | Decision |
|---|---|---|---|
| 0 | Tick seq 200 via the relay, audio [3] |
200 (at 0) | — |
| 100 | Tick seq 9000000000000 via the relay (forged or faulty) |
9000000000000 (at 100) | — |
| 1000 | Tick seq 201 via the WebSocket |
9000000000000 | Ignored (seq not higher; newest tick is 900 old) |
| 3100 | Audio frame from 3 | 9000000000000 | Drop (age 3000) |
| 3150 | Tick seq 204 via the relay |
9000000000000 | Ignored (recovery accepts only WebSocket ticks) |
| 3200 | Tick seq 204 via the WebSocket, audio [3] |
204 (at 3200) | Accepted (newest tick age 3100 ≥ 3000) |
| 3250 | Audio frame from 3 | 204 | Play |
| 4150 | Tick seq 205 via the relay |
205 (at 4150) | — |
Relay vector V1. Snapshot seq 50 {audio: [1, 2], video: [1], listeners: [1, 2, 4]} arrives at time 0. No other snapshot arrives.
| Time | Message | Decision |
|---|---|---|
| 100 | From session 2, route-header pid 2, sourceId 0 |
Forward to 1 and 4 |
| 200 | From session 2, route-header pid 2, sourceId 3 (webcam) |
Drop (2 not in video) |
| 300 | From session 4, route-header pid 1, sourceId 0 |
Drop (header pid isn't the session's) |
| 400 | From session 4, route-header pid 4, sourceId 0 |
Drop (4 not in audio) |
| 2999 | From session 1, sourceId 1 |
Forward to the sessions of 2 and 4 that subscribed to (1, 1) |
| 3000 | From session 1, sourceId 0 |
Drop (snapshot stale: nothing is forwarded) |
5. RelayTicket
A RelayTicket authorises exactly one relay connection for one participation. It is a JWS (00 §7.13, profiled by 04 §6) with typ sv-relay+jwt, signed by a hosting-server key whose purpose is sign (02).
5.1 Claims
| Claim | Type | Required | Meaning |
|---|---|---|---|
iss |
string | Yes | The hosting server's canonical domain. |
aud |
string | Yes | The relay URL the ticket is for, exactly as given in the join response's relay.url. |
sub |
string | Yes | Canonical address of the participant. |
did |
string | Yes | Device ID of the participating device. |
ctx |
string | Yes | The context reference. |
cid |
string | Yes | The callId. |
pid |
integer | Yes | The participant index. |
sec |
string | Yes | The call's security: insecure or secure. |
prof |
array of string | Yes | Media profiles this session may use on the relay: a subset of voice-dc/1 and video-dc/1. |
iat |
integer | Yes | Issue time (NumericDate). |
exp |
integer | Yes | Expiry; at most iat + 60. |
jti |
string | Yes | At least 128 random bits, base64url. Single use at the relay. |
5.2 Validation by the relay
A relay MUST accept a ticket only if all of these hold, and MUST otherwise answer as stated:
- It passes 04 §6.8 steps 1 to 8 for
typsv-relay+jwt: at most 8,192 bytes (04 §6.3), a protected header with exactly the membersalg(EdDSA),typandkid, and a payload meeting 04 §6.5. Otherwiserelay.ticket_invalid. issis a hosting server this relay serves, andkidnames asignkey of that server that is usable for this ticket under 02 §11.6 step 5. That means its status isactive,nextwithnow ≥ nbf, orretiredwith the ticket'siat≤retiredAt; its thumbprint isn't revoked;now ≤ exp; and the ticket'siat ≥ nbf. Each comparison allows ±60 s skew (00 §7.7). The relay obtains the keys from ServerMetadata or through the relay-control interface (21 §6.7), and the same rules apply to keys from either source. Otherwiserelay.ticket_invalid.- The signature verifies under 04 §4.3 (04 §6.8 step 10), with the key checked as 04 §4.5 requires. Otherwise
relay.ticket_invalid. audequals one of the relay's own URLs. Otherwise 421relay.wrong_relay.iat− 60 s ≤ now <exp+ 60 s (00 §7.7 skew allowance) andexp−iat≤ 60. Otherwiserelay.ticket_expired.jtihasn't been used before. The relay remembers each acceptedjtiuntilexp+ 60 s. Otherwiserelay.ticket_replayed.- The relay has a snapshot for
cid. If not, it waits up to 2,000 ms for one, then answers 404relay.call_unknown.
A relay MUST hold at most one session per (cid, pid). A new session for the same pair replaces the old one, which receives relay.closing with reason replaced.
Rationale: a 60 s, single-use, audience-bound ticket limits a stolen ticket to one connection to one relay within a minute, and that connection still forwards only what the lease lists allow for that pid.
5.3 Example and test vector
Header and payload, decoded:
{ "alg": "EdDSA", "typ": "sv-relay+jwt", "kid": "b.com#2026-12a" }
{ "iss": "b.com", "aud": "https://relay1.b.com/r", "sub": "alice@a.com", "did": "q2bS9xVg3m0yJpQe1vT0Aw",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "cid": "01938f40-5a6b-7c8d-9e0f-102132435465",
"pid": 7, "sec": "secure", "prof": ["voice-dc/1", "video-dc/1"],
"iat": 1764872400, "exp": 1764872460, "jti": "t1QmR8fZ0aXc3vB6nK9wEg" }Test vector T1. Signing key: the Ed25519 secret key of RFC 8032 §7.1 test 1, 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60 (hex). Public key as a JWK: {"kty": "OKP", "crv": "Ed25519", "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"}, published as b.com#2026-12a. The header and payload are serialised exactly as below (no white space, members in the order shown):
{"alg":"EdDSA","typ":"sv-relay+jwt","kid":"b.com#2026-12a"}
{"iss":"b.com","aud":"https://relay1.b.com/r","sub":"alice@a.com","did":"q2bS9xVg3m0yJpQe1vT0Aw","ctx":"ch:01938a11-2b3c-7d4e-8f90-112233445566","cid":"01938f40-5a6b-7c8d-9e0f-102132435465","pid":7,"sec":"secure","prof":["voice-dc/1","video-dc/1"],"iat":1764872400,"exp":1764872460,"jti":"t1QmR8fZ0aXc3vB6nK9wEg"}The resulting compact JWS (one line, split here for width) is:
eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXJlbGF5K2p3dCIsImtpZCI6ImIuY29tIzIwMjYtMTJhIn0
.eyJpc3MiOiJiLmNvbSIsImF1ZCI6Imh0dHBzOi8vcmVsYXkxLmIuY29tL3IiLCJzdWIiOiJhbGljZUBhLmNvbSIsImRpZCI6InEyYlM5eFZnM20weUpwUWUxdlQwQXciLCJjdHgiOiJjaDowMTkzOGExMS0yYjNjLTdkNGUtOGY5MC0xMTIyMzM0NDU1NjYiLCJjaWQiOiIwMTkzOGY0MC01YTZiLTdjOGQtOWUwZi0xMDIxMzI0MzU0NjUiLCJwaWQiOjcsInNlYyI6InNlY3VyZSIsInByb2YiOlsidm9pY2UtZGMvMSIsInZpZGVvLWRjLzEiXSwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6InQxUW1SOGZaMGFYYzN2QjZuSzl3RWcifQ
.5qeJ1UYdfpXnMFu8JXvzGnXUhfrwGk3JkJ3OyVpBlDVCWdXtWpi8g4WqIYhUVlGgC8QIBhK20RIexdUrbisqDgA relay whose clock reads between 1764872340 and 1764872519 (NumericDate) accepts it once; a second presentation fails with relay.ticket_replayed; a relay at any URL other than https://relay1.b.com/r fails with relay.wrong_relay. The test key is public and MUST NOT be used outside tests.
6. The relay connection
Every server runs a relay (D-066). It is a WebRTC data-channel forwarder: it never decodes media, never holds media keys, and obeys lease snapshots (§4.5). Its internals and the relay-control interface are in 21.
6.1 Relay assignment
- When a call is created, call control picks one relay for it and gives every participant the same
relay.url. A deployment MAY spread one call over several relay processes behind that URL (cascading, 21), invisibly to clients. - The relay URL changes only through a planned relay migration (§6.9).
- The relay URL is an absolute HTTPS URL with no query, no fragment and no trailing slash:
relay-url = base-url ; 02 §3.3: DNS host, no userinfo, no IP literal, no "?" or "#"
; MUST NOT end in "/"
connect-url = relay-url "/connect"- The relay host MAY differ from the hosting server's base URL host. The relay MUST answer CORS like a
/v1/endpoint (00 §7.3):Access-Control-Allow-Origin: *, allowing theAuthorizationandContent-Typerequest headers.
6.2 POST {relayUrl}/connect
The client opens one RTCPeerConnection to the relay per participation.
- The client creates the three data channels of §6.4 with
negotiated: true, creates an SDP offer, and sends it without waiting for ICE gathering:
POST https://relay1.b.com/r/connect
Authorization: Bearer eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXJlbGF5K2p3dCIsImtpZCI6ImIuY29tIzIwMjYtMTJhIn0.eyJpc3Mi…
Content-Type: application/json
{ "offer": "v=0\r\no=- 4611731400430051336 2 IN IP4 127.0.0.1\r\n…m=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\n…" }- The relay validates the ticket (§5.2), creates the session and answers
201:
| Member | Type | Required | Meaning |
|---|---|---|---|
answer |
string | Yes | The SDP answer, containing all of the relay's ICE candidates. |
relaySessionId |
string | Yes | An opaque ID for diagnostics, at most 64 characters. |
- Errors are RFC 9457 problem details with the
relay.*codes of §16. A client that can't connect is in staterestoringof §10.4 (after a first join as after a rejoin) and acts as follows. Every "rejoin" here is a join with its rejoin token (§10.5,planned: false), which returns a fresh ticket; a ticket is never reused.
/connect answer |
Client action |
|---|---|
relay.ticket_invalid, relay.ticket_expired, relay.ticket_replayed (401); relay.call_unknown (404) |
Rejoin at once. If that rejoin's connection fails the same way, continue with the schedule of §10.5. |
relay.overloaded (503); network error; no answer within 10 s |
Wait retryAfterMs or until the next scheduled time of §10.5, whichever is later, then rejoin. |
relay.wrong_relay (421), relay.bad_offer (400) |
Rejoin once at once. If the new connection gets either code again, treat it as a terminal failure (§10.5): close the call screen with the reason and send a call_failure report (§14) with phase: "relay_connect". |
Any other 4xx |
As relay.bad_offer. |
Any other 5xx |
As relay.overloaded. |
A failure before the participation's first relay session has come up is not an unexpected drop: the client follows the schedule of §10.5 from the join response, but doesn't apply the mute of §10.6 rule 4, because nothing was being sent yet. The seat stays connecting meanwhile and is removed after 20 s without a relay session (§2.6); a later attempt then rejoins with the token while it is valid, and joins afresh after that.
4. The client applies the answer. The session is up when the sv-control channel opens and the relay's relay.welcome arrives (§6.6).
6.3 WebRTC requirements
- The relay SHOULD be an ICE-lite agent (RFC 8445 §2.5) with public host candidates on UDP. It SHOULD also offer passive ICE-TCP candidates (RFC 6544), preferably on TCP port 443, for networks that block UDP.
- TURN is never used, by relays or by clients, and clients configure no STUN servers for the relay connection (D-094): the relay's public candidates are enough. A relay is directly reachable by design.
- The SDP has one
m=applicationsection using SCTP over DTLS (RFC 8841, RFC 8261). The relay answersa=setup:passive, so the client is the DTLS client. DTLS 1.2 or later (00 §7.15). - Both sides MUST advertise
a=max-message-sizeof at least 65,536 bytes. Senders keep every data-channel message at or below 16 KiB. - ICE consent freshness (RFC 7675) applies.
- DTLS keys are ephemeral transport keys, which insecure accounts also use (D-060).
6.4 Data-channel layout
Every relay connection uses this layout. Every channel is created with negotiated: true and the fixed id below, so no in-band channel-opening protocol is needed.
id |
Label | Protocol | Ordered | Reliability | Message type | Carries |
|---|---|---|---|---|---|---|
| 0 | sv-control |
sv-control/1 |
Yes | Reliable | Text (UTF-8 JSON) | Control messages (§6.5) |
| 1 | sv-audio |
voice-dc/1 |
No | maxRetransmits: 0 |
Binary | Audio frames of sources 0 and 2 (16) |
| 2 | sv-video |
video-dc/1 |
No | maxPacketLifeTime: 120 ms |
Binary | Video fragments of sources 1 and 3 (17) |
A receiver drops a message of the wrong type for its channel, or on any other channel. A relay drops sv-video messages from a session whose ticket prof lacks video-dc/1.
Rationale: audio is never retransmitted, because a late voice frame is worse than a concealed one (16). Video gets up to 120 ms of per-hop retransmission, which repairs most single-fragment losses inside the 500 ms capture-to-display target and so needs fewer keyframes than the old native path, which had no retransmission (brief §5). Unordered delivery prevents head-of-line blocking between sources.
6.5 Control-channel messages
Each sv-control message is one JSON object:
| Member | Type | Required | Meaning |
|---|---|---|---|
t |
string | Yes | Message type, <area>.<name>. |
from |
integer | See below | The sending participant's pid. |
to |
integer | No | The target pid of a unicast message. |
d |
object | Yes | The payload, defined by the owner of t. |
msg-type = area "." name
area = 1*( %x61-7A ) ; a-z
name = ( %x61-7A ) *( %x61-7A / DIGIT / "_" )from rules: a client's from is ignored and the relay sets from to the session's pid on every message it forwards; a message the relay itself originates has no from.
A receiver ignores a message with an unknown t. A relay forwards only the types this table marks as forwarded.
| Type | Direction | Forwarded by the relay | Payload | Section |
|---|---|---|---|---|
relay.welcome |
relay → client | — | {callId, pid, relaySessionId, maxInboundKbps} |
6.6 |
relay.ping |
client → relay | — | {n} |
6.7 |
relay.pong |
relay → client | — | {n} |
6.7 |
relay.subscribe |
client → relay | — | {sources: [{pid, sourceId}…]} |
6.6 |
relay.closing |
relay → client | — | {reason, retryAfterMs} |
6.6 |
relay.error |
relay → client | — | A problem object (00 §7.9) | 6.6 |
call.tick |
relay → client | — (originated from snapshots) | LeaseSnapshot | 4.4 |
call.media_feedback |
client → client (through the relay), relay → client | Yes, to to |
{kind, …}, kinds owned by 16 and 17 |
6.6 |
media.attestation |
client → clients (through the relay) | Yes, to every listener (§4.5); in an insecure call the relay SHOULD drop it | Owned by 18 | 18 |
A relay MAY drop control messages beyond 50 per second per session (pings excluded) and relay.subscribe messages beyond 10 per second, answering with relay.error core.rate_limited at most once per second.
6.6 Relay messages in detail
relay.welcome is the relay's first message on a new session, followed at once by the newest call.tick. maxInboundKbps is the cap on everything this session may send to the relay; the default is 10,000 kbit/s. The relay drops traffic above it. Per-source budgets are in 16 and 17.
{ "t": "relay.welcome",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 7,
"relaySessionId": "r1-8f2c91", "maxInboundKbps": 10000 } }relay.subscribe lists which sources with sourceId 1, 2 or 3 this receiver wants: {"sources": [{"pid": 3, "sourceId": 1}, {"pid": 3, "sourceId": 2}]}. Each message replaces the previous list. The list starts empty. Microphone audio (source 0) is always forwarded to every listener and isn't subscribed. A relay MUST accept at least 32 entries.
UX: clients subscribe to a screen share and its sound when the user opens it, and to webcams that are visible on screen, so users never pay bandwidth for video they aren't watching. A client SHOULD subscribe to a 1:1 or small call's webcams and screen shares automatically, so nobody has to "open" anything in a small call.
relay.closing announces that the relay is ending the session. reason is one of:
reason |
Meaning | Client action |
|---|---|---|
left, removed, revoked, moved, switched, call_ended |
The seat was removed (§2.6). For call_ended, the call ended for a reason other than security_upgraded and group_restarted. |
Terminal: no auto-rejoin. moved shows that the call moved to the user's other device, or that the user joined another call there (§11). |
replaced |
A newer session for the same pid exists. |
None, if the client opened it; otherwise treat as an unexpected drop. |
drain |
The relay is being taken out of service. | Planned migration (§6.9). |
call_restarted |
The call ended with reason security_upgraded or group_restarted, and a new call replaces it (§12.1, §12.5). |
Planned migration (§10.8). The client keeps the call screen, mic mode, self-mute and push-to-talk state. It runs §12.1 steps 1 to 6 (which §12.5 shares) at once, without waiting for call.ended. |
timeout, overloaded |
The relay lost the client or is overloaded. | Unexpected drop (§10). |
session_expired |
The device's session at the hosting server expired or ended without a revocation (§12.4). | Unexpected drop: renew or re-create the session (06, 05), then rejoin with the rejoin token (§10.5). |
A client treats an unknown reason as an unexpected drop; the server decides on rejoin whether the user may come back.
relay.error reports a problem with a control message the client sent, carrying a problem object whose code is relay.bad_message or core.rate_limited. It never ends the session by itself.
call.media_feedback carries receiver feedback that the media profiles need, such as keyframe requests and congestion signals. d.kind and the other payload members are defined by 16 and 17; a receiver ignores unknown kinds. The relay forwards a client's feedback only to to, only when both from and to are in listeners; the relay MAY originate feedback (no from) about a recipient's congestion.
6.7 Keepalives and failure detection
- The client sends
relay.ping(with an incrementingn) every 5 s; the relay answersrelay.pongwith the samenat once. - The client declares the relay connection failed at the first instant, on its monotonic clock, at which any of these holds: 5,000 ms or more have passed since the last control-channel message of any type arrived (ticks normally arrive every second), so a message processed at or after that instant comes too late; the ICE connection state is
failed; the ICE connection state has beendisconnectedfor 5,000 ms or more; or the DTLS or SCTP transport closes. Each condition applies on its own. In particular the control-silence condition applies whatever the ICE state: an ICE recovery fromdisconnectedtoconnectedcancels only the third condition, never the first. Once it has declared the connection failed, the client closes it (§10.4) and ignores anything that arrives on it later. 16 §7.11 gives the timeline of a 5 s network loss with push-to-talk held. - The relay declares a client gone after 10 s without any packet from it, ends the session and reports it down through the relay-control interface (21). Call control then marks the seat
reconnecting(§2.6). - On failure, the client rejoins (§10).
6.8 Example: a session start
{ "t": "relay.welcome", "d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 7, "relaySessionId": "r1-8f2c91", "maxInboundKbps": 10000 } }
{ "t": "call.tick", "d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1185, "validMs": 3000, "audio": [3, 7], "video": [3, 7], "listeners": [3, 7], "epoch": 42 } }
{ "t": "relay.subscribe", "d": { "sources": [ { "pid": 3, "sourceId": 1 }, { "pid": 3, "sourceId": 2 } ] } }
{ "t": "media.attestation", "from": 3, "d": { "…": "defined by 18" } }6.9 Planned relay migration
Call control MAY move a call to another relay, for example to drain a relay for maintenance or to rebalance load. This is a planned migration: mic and push-to-talk state are kept and no one hears a gap.
- Call control starts sending the call's snapshots to the new relay as well as the old one, then sends
call.migrate(§15) to every participant, and asks the old relay to sendrelay.closingwith reasondrainandretryAfterMs: 0. Either signal starts the client's migration. - Each client rejoins with its rejoin token and
planned: true. The response carries the newrelay.urland a ticket for it; the seat staysconnectedand keeps itspid. - The client connects to the new relay without closing the old one. Once the new relay's first tick arrives, the client sends every frame to both relays and accepts frames from both, discarding duplicates per stream as 16 §8.2 (audio, by sequence number) and 17 §6.11 (video, by fragment) define. It moves its subscriptions to the new relay.
- The old relay closes all sessions of the call 10 s after the migration started. Call control ignores the old relay's session-down reports for participants already connected to the new relay. A client that hasn't migrated by then is in an unexpected drop and rejoins (§10), which also lands it on the new relay.
- After the window, call control stops sending snapshots to the old relay.
Rationale: dual sending for at most 10 s keeps everyone hearing everyone, whether they have moved yet or not, without requiring relays to bridge each other.
7. Routing
7.1 Routes
| Source | Default route | Other routes |
|---|---|---|
| Microphone (0) | Relay, voice-dc/1 |
None. Never the SFU. |
| Screen video (1), webcam (3) | Relay, video-dc/1 |
SFU (sfu-rtp/1) when videoRoute is sfu (§7.2). |
| Screen or application sound (2) | Relay, voice-dc/1 frames on sv-audio |
With the same participant's screen video (source 1): follows that video's route, so they stay in sync (17 §4.7). Without screen video ('share sound only', bots): always voice-dc/1 on the relay, never the SFU (16 §8.3 item 3). |
- The relay is mandatory and the default (D-045). Every participant keeps a relay connection for the whole participation, even while its video travels through the SFU: the relay carries its microphone audio, lease ticks, MediaAttestations and feedback.
- Clients MUST NOT send media to each other directly (D-094). Every source travels through the hosting server's relay or its SFU, in every context (channels, 1:1 DMs and group DMs) and every security mode. So the server enforces leases on every path (§4.5, §4.7), and no participant learns another's IP address from a call.
- Call control chooses
videoRoutefor the whole call (§7.2); the table fixes everything else about a source's route. - Route changes are silent (§7.3).
7.2 The SFU route
videoRouteis a property of the call, chosen by call control. It can besfuonly when the server is SFU-capable and the context is a channel or a group DM. A 1:1 DM call never uses the SFU.- Call control chooses by its own policy. RECOMMENDED: switch to
sfuwhen a call has more than 8 seats and at least one video source is active, and back todcwhen it has had at most 4 seats for 60 s. 17 MAY refine this recommendation. - A participant that didn't list
sfu-rtp/1in its joinfeaturescan't send or receive video whilevideoRouteissfu; its voice is unaffected. Every Full client supportssfu-rtp/1(00 §1.5), so in practice this affects only some bots. - To switch, call control emits
call.route_changedwith the newvideoRoute. Each client then, for each video source it sends (and the source 2 that accompanies its screen video): sets up its SFU session if it has none (§8), publishes the source on the new route, and stops sending it on the old route once it is flowing on the new one, no later than 5 s after the event. Receivers accept a source from both routes during this overlap and prefer the new route as soon as frames arrive on it. Switching back works the same way in reverse. - While
videoRouteissfu, a client sends no video, and no source 2 that accompanies its screen video, to the relay. Source 2 sent without screen video stays onvoice-dc/1on the relay (16 §8.3 item 3).
7.3 Route changes are silent
Moving any source between the relay and the SFU, and switching videoRoute, MUST NOT prompt, warn, change the mute state, release a held push-to-talk, or show the user as disconnected (00 §4.12.5). The transmit gate (§10.6) stays open throughout if it was open. A client MAY show the current route in a connection-details view that the user opens on purpose.
8. SFU signalling
8.1 Model
- The SFU is optional (D-045) and is any WebRTC SFU, reached through the hosting server's control plane (D-009). A client never calls an SFU's own API; it exchanges SDP with call control, and call control drives the SFU through an adapter (§8.5, 21). Media flows directly between the client and the SFU's media addresses, which appear in the SDP.
- Each participating device has at most one SFU session per call: one RTCPeerConnection carrying all the video sources it publishes (1, 3) and the sound (2) that accompanies a screen share, and all the tracks it subscribes to. Microphone audio never goes through the SFU (§7.1).
- In an insecure call the SFU can see and hear what it forwards (00 Matrix E). In a secure call every published frame is SFrame-encrypted through WebRTC encoded transforms, and the SFU forwards ciphertext with a readable, authenticated clear prefix; the Dependency Descriptor and RTP payload descriptors stay readable as unauthenticated forwarding hints (17 §12.6, 18 §8.4.3).
- The SFU path has no
sv-controlchannel. MediaAttestations (18) andcall.media_feedbackfor SFU-routed sources travel on the participant's relay control channel, which every participant keeps (§7.1). - SFU sessions exist only while
videoRouteissfu. When it returns todc, call control closes them (sfu.closed, reasonroute_changed) after the overlap of §7.2.
8.2 Endpoints
All paths are under /v1/contexts/{ctx}/call/sfu/. The device must be a participant (call.not_participant), videoRoute must be sfu (409 sfu.not_active), and the device's join features must include sfu-rtp/1 (core.unsupported_feature, 03).
| Request | Body | Response |
|---|---|---|
POST …/sfu/session |
{callId, offer, publish} |
201 {sfuSessionId, answer, tracks} |
POST …/sfu/session/{sfuSessionId}/offer |
{offer, publish}: a client-initiated renegotiation, for example to start or stop the webcam |
200 {answer, tracks} |
POST …/sfu/session/{sfuSessionId}/answer |
{negotiationId, answer}: the answer to a server offer (sfu.offer) |
204 |
PUT …/sfu/session/{sfuSessionId}/subscriptions |
{want: [{pid, sourceId, maxSpatialLayer, maxTemporalLayer}…]}; the layer members are optional integers; each request replaces the previous set |
202; the server follows with sfu.offer if transceivers must change |
DELETE …/sfu/session/{sfuSessionId} |
— | 204 |
sfuSessionId is a UUIDv7 assigned by call control. Every offer and answer is an SDP string of at most 16 KiB; a longer one, an SDP that call control or the SFU can't use, or a publish list that doesn't match the offer's transceivers, or, in a secure call, one that leaves a published video source no codec that 18 §8.4.2 allows (§8.3 item 7), gets 400 sfu.bad_sdp. When the SFU can't be reached or refuses a session for capacity, call control answers 503 sfu.unavailable with retryAfterMs; the client retries per §8.3 item 4, and its voice is unaffected.
publish is an array of {mid, sourceId, rids}: the transceiver mid of each published source in the offer, its sourceId (1, 2 or 3), and, for simulcast, its RID list (17). A device may publish a source only while it is covered for that source's list (§4.1); otherwise 403 call.not_permitted.
A Track describes one transceiver of the session:
| Member | Type | Meaning |
|---|---|---|
mid |
string | Transceiver mid in the session's SDP. |
direction |
string | send (published by this device) or recv (subscribed). |
pid |
integer | The publishing participant. |
sourceId |
integer | 1, 2 or 3. |
state |
string | active or paused (paused by lease enforcement or by the subscriber's layer choice). Unknown values: treat as paused. |
UX: subscriptions follow what the user is looking at, exactly as on the relay (§6.6).
8.3 Negotiation rules
- At most one negotiation is outstanding per session. The client is the "polite" peer: if it has a server offer outstanding, its own
…/offerrequest fails with 409sfu.negotiation_conflict(retryable), and it answers the server's offer first. - Call control MUST NOT send
sfu.offerwhile it is processing a client offer for the same session. - Every server offer carries a fresh
negotiationId(UUIDv7). If the client doesn't answer within 10 s, call control closes the session (sfu.closed, reasonnegotiation_timeout) and the client creates a new one. - If the SFU connection fails (ICE
failed, ordisconnectedfor 5 s), the client deletes the session if it can and creates a new one, retrying after 1, 2, 4 and 8 s and then every 30 s whilevideoRouteissfu. Video is interrupted meanwhile; voice isn't, and this is not an outage (§10.1). - A
sfu.session_unknownanswer (404, retryable) means call control lost the session; the client creates a new one. - A
sfu.bad_sdpanswer means the client built an unusable offer orpublishlist. It retries once with a freshly built offer; if that also fails, it stops publishing on the SFU path for this call (video is unavailable, voice continues) and sends acall_failurereport (§14) withphase: "in_call". - In a secure call, call control negotiates only the codecs that 18 §8.4.2 allows on the SFU path (Opus for source 2; VP8 and VP9 for video). An offer that also lists other codecs is answered with the allowed ones only, and no error results. An offer or
publishlist that leaves a published video source no allowed codec gets 400sfu.bad_sdp, which the client handles as item 6 says.
8.4 Enforcement
Lease enforcement on the SFU path is specified in §4.7: the adapter disables a revoked participant's tracks within 1 s of the snapshot, stops all tracks to a participant who is no longer a listener, and pauses the whole call if snapshots stop for 3 s. A paused track appears as state: "paused" in sfu.tracks_changed. Receivers enforce coverage on SFU media themselves as well (§4.6).
8.5 The adapter interface (informative)
Call control needs these operations from an SFU adapter. 21 maps them onto common open-source SFUs and states the adapter's normative requirements (21 §7.1, §7.2); it defines no wire protocol for the adapter.
| Operation | Purpose |
|---|---|
createSession(callId, pid, offer, publish) → answer, tracks |
Open a participant's PeerConnection at the SFU. |
renegotiate(session, offer, publish) → answer, tracks |
Client-initiated change. |
serverOffer(session) → offer, tracks; applyAnswer(session, answer) |
SFU-initiated change, for example new remote tracks to subscribe. |
setSubscriptions(session, want) |
Which tracks and layers this subscriber receives. |
setForwarding(callId, pid, sourceId, enabled) |
Lease enforcement for published tracks; MUST be confirmed within 1 s. |
setReceiving(callId, pid, enabled) |
Lease enforcement for subscribers. |
closeSession(session, reason) |
End a participant's SFU session. |
pauseCall(callId), resumeCall(callId) |
The 3 s dead-man rule of §4.7. |
| Events: session up and down, track published and unpublished | Feed sfu.tracks_changed and sfu.closed. |
9. Media epoch switching in secure calls (D-042)
This section applies only to secure calls. It defines the control messages that coordinate SFrame key rotation; the SFrame keys, KIDs and receive-side timers belong to 18.
9.1 The media epoch
A secure call's mediaEpoch is the MLS epoch of the context's group whose SFrame keys senders are expected to use. When the call starts, it is the group's current epoch. It only ever increases. It appears in the Call object and in every LeaseSnapshot (epoch). It always refers to the group generation (13 §4.2) that was current when the call started; a call never outlives that generation, because a generation change ends it (§12.5).
9.2 Device procedure
- While in a secure call, a device that processes a commit creating epoch
e(13) derives and installs SFrame receive and send keys fore(18). It keeps sending with its previous keys for now. - It then posts
call.epoch_readyfore(§3.7). - A device that joins a call, or rejoins it, installs keys for the epochs it holds and posts
call.epoch_readyfor its current epoch as soon as its relay session is up. It sends in the epoch 18 §6.3 selects; a device that has just joined the group by external commit holds only its join epoch, which may be later thanmediaEpoch, and sends in it at once (18 §6.3 row 3).
9.3 Server switch rule
For each secure call, call control evaluates this rule whenever it receives call.epoch_ready, whenever a seat changes state, and when a deadline passes:
- Let
Ebe the set of epochs higher thanmediaEpochthat the Delivery Service has sequenced for the group. - For an epoch
einE, the required set is every seat in stateconnectedwhose device has a leaf in epoche. Seats that areconnectingorreconnecting, and devices removed by the commits up toe, aren't required. - Epoch
eis ready when every required seat has postedcall.epoch_readyforeor a later epoch. - Epoch
eis due when 2,000 ms have passed since the Delivery Service sequenced the commit that createde. - If any epoch in
Eis ready or due, call control setsmediaEpochto the highest such epoch, emitscall.epoch_switchwith it, and includes it asepochin every following snapshot.
9.4 Delivering the switch
call.epoch_switch ({callId, epoch}) goes to every participant's device session over the WebSocket. The relay path carries the same information in the epoch member of every lease tick. A client MUST treat a tick whose epoch is higher than the epoch it sends with exactly as a call.epoch_switch for that epoch. A client ignores a switch to an epoch it has already passed.
9.5 Sender and receiver behaviour
These rules are restated from 18, which is normative for them:
- A sender switches to epoch
ekeys at the first of: receivingcall.epoch_switch(or a tick) namingeor later; or 2,000 ms after it processed the commit that createde, by its own clock. - Receivers keep the previous epoch's keys for 10 s after they learn that call control has switched past it (a newer
mediaEpochincall.epoch_switch, a lease tick or a join response, 18 §6.6), and hold frames of a not-yet-known newer epoch for up to 200 ms. A frame that still can't be decrypted counts as lost, and concealment covers it. - A device that learns of a switch to an epoch it hasn't processed yet fetches and processes the missing commits (13) at once. It keeps sending with its newest keys for up to 8 s after it first learned of the newer epoch (18 §6.3 item 4); after that, its transmit gate closes with the reason
waiting_for_keys(§10.6) until it has installed keys for an epoch at or above the currentmediaEpoch(18 §6.3 item 4).
Removed participants are cut by lease revocation, independently of the commit that removes them (D-037). The epoch switch only makes sure they can't decrypt what follows.
9.6 Test vectors: switch decision
Vector E1. mediaEpoch is 42. Seats: pid 1, 2 and 3 connected; pid 4 reconnecting. At t = 0 ms the Delivery Service sequences the external commit that creates epoch 43 and adds the joining device of pid 5.
| Time (ms) | Event | Required set for 43 | Ready posted | Decision |
|---|---|---|---|---|
| 150 | epoch_ready 43 from 1 |
{1, 2, 3} | {1} | Wait |
| 200 | epoch_ready 43 from 2 |
{1, 2, 3} | {1, 2} | Wait |
| 300 | pid 5 admitted (connecting) |
{1, 2, 3} | {1, 2} | Wait |
| 500 | pid 5 connected |
{1, 2, 3, 5} | {1, 2} | Wait |
| 600 | epoch_ready 43 from 5 |
{1, 2, 3, 5} | {1, 2, 5} | Wait |
| 700 | epoch_ready 43 from 3 |
{1, 2, 3, 5} | {1, 2, 3, 5} | Switch to 43 at 700 |
Vector E2. As E1, but pid 3 never posts. At 2,000 ms epoch 43 is due, and call control switches to 43 at 2,000.
Vector E3. mediaEpoch 42. Commits creating 43 and 44 are sequenced at 0 and 300 ms. Every required seat posts epoch_ready 44 by 450 ms; none posted 43. At 450 ms both 43 and 44 are ready (a post for 44 counts for 43); call control switches straight to 44.
10. Continuity: auto-rejoin (D-012, D-047)
10.1 What counts as a drop
| Event | Class | Mic and push-to-talk |
|---|---|---|
| The relay connection fails (§6.7) | Unexpected drop: auto-rejoin (§10.4) | D-012 rules (§10.6): voice activation and open mic come back muted; the webcam comes back off, and a screen share resumes only if the seat was restored within 30 s (D-090, §10.6 rule 7) |
| The event WebSocket disconnects while the relay connection is fine | Not a call event: the client reconnects the WebSocket (03) | Kept |
relay.closing with timeout, overloaded, session_expired or an unknown reason; replaced not caused by the client; call.participant_left for the device's own seat with reason timeout or session_expired |
Unexpected drop (for session_expired, the client first renews or re-creates its session, 06, 05) |
D-012 rules |
call.ended with reason server_restart |
Unexpected drop, rejoined by a fresh join with create: true and ring: false in every kind of context (§10.5) |
D-012 rules |
call.migrate, or relay.closing with drain |
Planned migration (§6.9) | Kept |
call.ended with reason security_upgraded or group_restarted; relay.closing with call_restarted |
Planned migration into the new call (§12.1, §12.5) | Kept |
call.route_changed; an SFU session going up or down; an epoch switch |
Not a drop (§7.3, §9) | Kept |
relay.closing with left, removed, revoked, moved, switched or call_ended; call.moved; call.ended with any other reason |
Terminal: the client leaves the call and doesn't rejoin | — |
An outage is the time from detecting an unexpected drop until the rejoin completes (§10.4). The ICE layer recovering by itself (disconnected back to connected less than 5,000 ms after it went disconnected, without a new session) is neither a drop nor an outage, but only while control-channel messages keep arriving: the control-silence condition of §6.7 rule 2 applies whatever the ICE state, and a later ICE recovery doesn't undo a drop it has declared. While no route is up, the talk indicator already shows that a push-to-talk user isn't being heard (16 routeUp, §10.6 condition b), before any drop is declared.
10.2 The rejoin token
- The server issues a fresh rejoin token with every successful join or rejoin; the new token replaces the old one at once. It is an opaque bearer secret with at least 128 bits of entropy:
rejoin-token = 1*128( ALPHA / DIGIT / "-" / "_" )- A token is bound to one participation: (
callId, canonical address,did). The server accepts it only from a session of the same account and device, in the same context. - A token is accepted while its participation's seat exists (in any state), and after the seat was removed with reason
timeoutorsession_expireduntil 60 s after the moment the participation stopped being connected (lostAt, §2.6; for a seat that never reachedconnected, its admission time; for a seat removed withsession_expiredwhileconnected, its removal time). That is the 60 s of D-047: it counts from the drop, not from issue, so a long call needs no token refresh. - Removing the seat for any reason other than
timeoutorsession_expiredinvalidates the token at once. A later presentation then fails withcall.moved(after Move voice here or a switch),call.ended(after the call ended) orcall.rejoin_invalid(otherwise). - Clients keep the token in memory. A client MAY keep it in protected storage for §10.9, and MUST delete it when the participation ends.
10.3 The reconnecting seat (server)
- When the relay reports a session down (§6.7), the seat becomes
reconnectingand the server emitscall.participant_updated. The seat keeps itspidand its lease rights for 30 s. - Other clients show a small "reconnecting" badge on that person once the seat has been
reconnectingfor 2 s (§2.6, 20 §11.6), and play no leave sound. Nothing else changes for them. - If the device rejoins within 30 s, the seat is restored: same
pid, samejoinedAt,seatRestored: true, and others see onlyreconnectingturning back intoconnected. - After 30 s the seat is removed with reason
timeout, and others see the person leave. If the device rejoins between 30 s and 60 s afterlostAt, it gets a newpid, andcall.participant_joinedcarriesrejoined: true, so other clients play no join sound.
10.4 Client auto-rejoin state machine
The client runs this state machine for its participation while the call screen is open. Retry times are offsets from the moment the drop was detected (t0), on the client's monotonic clock.
| State | Event | Action | Next state |
|---|---|---|---|
in_call |
Unexpected drop detected | Record t0. Close the relay session and SFU session. If the user uses voice activation or open mic, set self-mute (§10.6). Turn the webcam off and hold any screen share (§10.6 rule 7). Start attempt 1 at once. |
rejoining |
in_call |
Planned migration (§10.8) | Run §6.9, §7.2, §12.1, §12.4 (own resync) or §12.5 as applicable; nothing changes for the user | in_call |
in_call |
Terminal event (§10.1) | Stop media; close the call screen with the reason (20) | ended |
rejoining |
Join or rejoin answered 200 |
Connect to the relay with the new ticket. If a screen share is held and the response has seatRestored: false, stop the share (§10.6 rule 7, 17 §4.5). |
restoring |
rejoining |
Transient failure (§10.5) | — | waiting |
rejoining |
Terminal failure (§10.5) | Close the call screen with the reason | ended |
restoring |
The relay's first tick arrives (and, in a secure call, send keys for the sending epoch that 18 §6.3 selects are installed) | The rejoin is complete: the transmit gate is re-evaluated at once (§10.6) | in_call |
restoring |
The relay connection fails with a /connect error |
Act as §6.2 item 3 says | rejoining or waiting |
restoring |
The relay connection fails, or 10 s pass | Count as a failed attempt | waiting |
waiting |
The next scheduled time arrives, or the operating system reports that the network came back | Start the next attempt | rejoining |
rejoining, waiting or restoring |
A screen share is held (§10.6 rule 7) and t0 + 30 s passes before a join response with seatRestored: true has arrived |
Stop the screen share (17 §4.5) | Unchanged |
| any | The user presses Leave, or the call screen closes | Send leave if a seat might exist (§3.4); stop | ended |
At most one attempt is in flight at a time. A network-up signal starts an attempt early but doesn't change the schedule of later attempts.
10.5 Attempts, schedule and outcomes
Schedule. Attempts start at t0 + 0, 1, 2, 4, 8 and 15 s, then every 30 s (45, 75, 105 s, …) for as long as the call screen is open. There is no attempt limit (D-013, D-047).
What each attempt sends.
- Every attempt carries a fresh
Idempotency-Key(§3.3.1),ring: false,features, and the self-mute state chosen in §10.6. Before each attempt the client runs the security check of §2.1 item 4 against its own view of the context. - While less than 60 s have passed since
t0, and the client holds a rejoin token: a join withrejoinTokenandplanned: false. - Otherwise, or after
call.rejoin_expired: a fresh join without a token, withcreate: truein a voice channel andcreate: falsein a DM, except after acall.endedwith reasonserver_restart, where it iscreate: truein a DM too. Because every automatic join sendsring: false, an automatic rejoin never rings anyone; a DM call it creates ends by the 60 s rule of §2.4 if nobody else comes back.
Outcomes.
| Answer | Class | Client action |
|---|---|---|
200 |
Success | Continue in restoring. |
Network error, timeout, 5xx, core.unavailable, core.rate_limited, call.relay_unavailable, call.full |
Transient | Wait for the next scheduled attempt (honouring retryAfterMs when it is later). |
call.rejoin_expired |
Transient | Immediately send a fresh join in the same attempt. |
call.ended with data.reason empty or server_restart, in a voice channel |
Transient | Immediately send a fresh join with create: true in the same attempt. (The user was the last one in the call, or the server lost it; the channel's call simply starts again.) |
call.mls_join_required, when the MLS join the client then runs ends in 13's awaiting_readd state (a DM or group DM that doesn't yet list the user's new identity key after the user's own reset, 12 §11.5) |
Terminal | Close the call screen and show ST.dm_waiting_readd (20, 12 §11.7). The user can call again once the device has joined. |
call.mls_join_required (otherwise) |
Transient | Complete the MLS join (13) at once, then continue with the schedule. |
dm.upgrade_in_progress (12) |
Transient | Retry when dm.security_changed arrives (12), or at the next scheduled time, whichever is first. Meanwhile the client takes part in creating the group as 12 §11.4 requires. |
core.unauthenticated, core.token_expired, or federation.session_ended whose data.retry allows a new session (06) |
Transient | Renew or re-create the remote session (06 §6.1), or refresh the home session (05), then resend in the same attempt. If that fails transiently, wait for the next scheduled attempt; if it fails terminally (for example the device was revoked), the attempt is terminal. |
call.already_in_call with sameDevice and sameCall both true |
Transient | Immediately resend with takeOver: true. |
call.already_in_call (otherwise), call.moved |
Terminal | The user is in a call on another device; show that and stop. |
call.ended (other reasons, or in a DM), call.not_active |
Terminal | Show "Call ended" and stop. |
security.account_required, security.upgrade_required, security.device_not_enrolled |
Terminal | Show G1 or G2; if the user completes it while the call screen is still open, join again. |
dm.closed, dm.encryption_pending (12) |
Terminal | Show why (20) and stop. |
Any other problem with retryable: true |
Transient | Wait retryAfterMs, or until the next scheduled attempt, whichever is later. |
core.forbidden, core.not_found, call.rejoin_invalid, any other problem with retryable: false |
Terminal | Stop and show why (20). |
The rows are matched in order; the first that fits decides.
Test vector A1. Drop detected at t0 = 0, network down until 50 s, voice channel.
| Attempt | Time (s) | Request | Result |
|---|---|---|---|
| 1 | 0 | Rejoin with token | Network error |
| 2 | 1 | Rejoin with token | Network error |
| 3 | 2 | Rejoin with token | Network error |
| 4 | 4 | Rejoin with token | Network error |
| 5 | 8 | Rejoin with token | Network error |
| 6 | 15 | Rejoin with token | Network error |
| 7 | 45 | Rejoin with token | Network error |
| 8 | 50 (network-up signal) | Rejoin with token | 200, seatRestored: false (the seat timed out 30 s after the relay noticed the loss), new pid |
Test vector A2. As A1, but the network returns at 70 s without a network-up signal: attempt 8 at 75 s is a fresh join with create: true (more than 60 s since t0).
Test vector A3. A user alone in a voice channel's call drops at t0 = 0; the relay reports the session down at 10 s (lostAt), so the seat times out at 40 s and the call ends with reason empty. The network returns at 45 s with a network-up signal. Attempt 7 at 45 s: rejoin with the token → 410 call.ended with data.reason empty → in the same attempt, a fresh join with create: true → 200, a new call with the user in it. A user whose outage lasts 70 s gets the same result through A2's path, so the outcome doesn't depend on timing.
10.6 Transmit state (D-012)
The transmit gate is open, and captured microphone audio is sent, only while all of these hold. 16 §7.2 and §7.3 are the normative definition of this gate; this table summarises them.
| # | Condition | When it fails, the "not being heard" reason is |
|---|---|---|
| a | The user wants to transmit: in push-to-talk mode the physical control is held now and the user isn't self-muted (a deliberate self-mute wins over a held control, 16 §7.3); in voice-activation mode the user isn't self-muted and voice is detected; in open-mic mode the user isn't self-muted. | — (the user isn't trying to talk) |
| b | A route is up: 16's routeUp (16 §7.2). That is a usable relay connection: audio channel open, ICE neither disconnected nor failed, some message from the relay within the last 1,500 ms, and no uplink backlog held for 200 ms. |
reconnecting (or connecting before the first relay session is up, 16) |
| c | The device is covered for audio (§4.6). |
16's TalkState reason not_allowed, whose blockedBy is the audioBlockedBy of the newest VoiceLease (§4.1): no_permission, muted_for_everyone, server_muted, timed_out or other. 16 §7.10 holds the one enumeration. |
| d | Secure calls: the device has installed send keys for the sending epoch that 18 §6.3 selects, and 18 §6.3 item 4 hasn't closed the gate (16's keysOk). 18 is normative for this condition. |
waiting_for_keys |
Rules:
- When (a) holds and any of (b)–(d) fails, the client is not being heard. It MUST expose this state and its reason to the talk indicator, which MUST say plainly that the user isn't being heard, for example "Reconnecting — you're not being heard" (20 owns the copy). It MUST never look like it is transmitting. A push-to-talk user who holds the control while self-muted is also not being heard, with the reason
muted(16 §7.10). - Audio captured while the gate is closed MUST be discarded and never sent later. When the gate opens, transmission starts with live audio only, captured after the gate opened. 16 specifies how the audio engine enforces this.
- Push-to-talk follows the physical control. The client keeps reading the control's state throughout an outage. When conditions (b)–(d) become true, it reads the control at that moment: if it is held, whether since before the drop or pressed during the outage, transmission starts at once. Releasing the control at any time, including during the outage, closes the gate; pressing it again opens it once (b)–(d) hold.
- Voice activation and open mic come back muted. On detecting an unexpected drop, a client in voice-activation or open-mic mode sets the user's self-mute and sends
selfMuted: truewith every rejoin attempt. The mute indicator shows muted, and the user unmutes deliberately. A user who was already muted stays muted. Push-to-talk users keep their self-mute state unchanged. - Planned migrations keep everything. Mic mode, self-mute and push-to-talk state are unchanged by planned migrations and route changes. If the gate closes briefly during one (for example while keys arrive after a security upgrade), rule 1 applies.
- Blocks on
audio. A VoiceLease (in a join or rejoin response, or incall.lease_changed) may reportaudioblocked:audioBlockedByis non-null because of a Mute for everyone or ServerMute, a timeout, loss ofspeak_and_share, orother. When that starts, or when the first VoiceLease of a join or rejoin already reports it, a client in voice-activation or open-mic mode that isn't self-muted MUST set self-mute at that moment and report it (§3.5). A change to voice-activation or open-mic mode while the block lasts does the same. The gate is therefore already closed by the mute when coverage returns, in whatever order lease ticks andcall.lease_changedarrive, and the user unmutes deliberately. So the microphone never goes live after minutes of silence without a deliberate unmute. A push-to-talk client changes nothing and follows the physical control (rule 3). A PTT held when coverage returns transmits at once with live audio only, because the talk indicator has been saying "not being heard" all along. Coverage lost and regained only through tick age (no VoiceLease reported a block) triggers nothing. 16 §7.8 is normative for this mute, and 20 §11.3 rule 4 for how it is shown. - Video after an unexpected drop (D-090). On detecting an unexpected drop the client stops sending every video source. The webcam is turned off at once and stays off after the rejoin; the user turns it on again deliberately. A screen share keeps its capture, with its indicator saying that the user isn't being seen, and resumes by itself only if the rejoin's join response has
seatRestored: trueand arrived no later thant0+ 30 s on the client's monotonic clock. Otherwise the client stops the share att0+ 30 s, or earlier when a join response withseatRestored: falsearrives, and the user shares again deliberately. The 30 s run from the client's own detection of the drop, not from the server'slostAt, so the bound holds even when the relay notices the loss late. Planned migrations (§10.8) keep both. 17 §4.5 is normative for video, and 20 §11.10 for how it is shown.
UX: the person's own client shows the reason it can't be heard; everyone else sees the person's normal state plus, during a drop, the reconnecting badge. 20 owns all copy.
Rationale: the user must never feel the button pressed while the app disagrees about whether they are transmitting. Voice-activation and open-mic users have no physical control to express intent after an outage, so muting them is the only way to avoid broadcasting a room they may have walked into.
10.7 Rights are re-checked on rejoin
Every rejoin re-runs the admission checks (§3.3.2 step 2). The client honours the lease in the response: if the user lost speak_and_share or was muted for everyone during the outage, the client rejoins as a listener and shows the reason when the user tries to talk. If the user lost the right to be in the call at all, the rejoin fails terminally.
10.8 Planned migrations
| Migration | Started by | Procedure |
|---|---|---|
| Relay migration | call.migrate or relay.closing drain |
§6.9 |
| Security upgrade of the context | call.ended security_upgraded, or relay.closing call_restarted |
§12.1 |
| Group generation change | call.ended group_restarted, or relay.closing call_restarted |
§12.5 |
| The device's own MLS resync during a call | The client (13 §10.5) | §12.4 |
| Video route change | call.route_changed |
§7.2 |
In each case the client keeps mic mode, self-mute and push-to-talk state, and its screen share and webcam (17 §4.5), and doesn't set the VAD/open-mic mute of §10.6 rule 4 or apply §10.6 rule 7. It shows no reconnecting state unless an outage actually happens, apart from the neutral status line of §12.1 while the call is re-established after security_upgraded or group_restarted (20 owns its copy; it is never a warning).
server_restart is not a planned migration: call control lost the call, so participants probably had an outage. Clients treat it as an unexpected drop and rejoin with a fresh join (§10.5).
10.9 After a client restart
A client MAY rejoin automatically after its own process restarted (a crash, or the operating system ending it) only if all of these hold: the restart happens within 60 s; the user hadn't pressed Leave; and the call screen is still present (for example, the operating system's call interface still shows the call). It then follows the unexpected-drop rules, including the voice-activation mute. No video source resumes after a process restart, whatever seatRestored says: the new process holds no capture, so the webcam stays off and any screen share active before the restart has ended. If the client's Participant in the join response still shows screen, screenAudio or webcam as true in its sources, the client sends them as false (§3.5, 17 §4.5), and the user shares again deliberately (D-090). The new process uses a fresh joinNonce (18). Otherwise it doesn't rejoin, and the user can join again with one tap.
11. Move voice here (D-067)
Move voice here moves a user's participation from one of their devices (D1) to another (D2) on the same hosting server. A switch is the same procedure when one device moves from one call to another call on the same server. In both cases the old participation is fully revoked before the new one is admitted, so a user is never in a call twice (brief §5).
When a join with takeOver: true finds an existing participation P1 (pid p1 in call C1) of the same user on this server, call control:
- Validates the new join completely (§2.2 checks 1–6, 8 and 9; when D2 joins
C1itself, check 8 countsC1withoutP1). If it fails,P1is untouched and the error is returned. So moving to an unenrolled device of a secure account gives G2 and leaves the call running on the old device. - Removes
P1with reasonmoved(different device) orswitched(same device), per §2.6: pushes a snapshot withoutp1toC1's relay and SFU adapter at once, tells the relay to closep1's session with that reason, invalidatesP1's rejoin token, sendscall.movedto D1's sessions (formovedonly; itssameCallsays whether D2 joinedC1or another call), and emitscall.participant_left. - Waits until
C1's relay has acknowledged a snapshot withoutp1(21) and, ifC1uses the SFU, the adapter has confirmed thatp1's tracks are stopped; or until 3,000 ms have passed since the last snapshot that listedp1was sent, whichever comes first. After that, no honest relay or SFU forwards anything to or fromp1. - Admits D2 per §3.3.2 step 6, with a new
pid. If D2 joins the same callC1,call.participant_joinedcarriesmovedFrom: p1, and the end rules of §2.4 are not evaluated forC1between steps 2 and 4, so moving a 1:1 call to another device never ends it. - Answers the join.
The old device, on call.moved or relay.closing with reason moved, stops capture and playback at once, closes its call screen and doesn't rejoin. If it was offline at the time, it learns of the move from the call.moved error on its next rejoin attempt (whose data.sameCall carries the same information) and stops then.
Self-mute and self-deafen don't move: D2 starts with the state in its own join request. A Mute for everyone applies to the account and so continues on D2 (§3.6).
UX: the new device's join is one tap. Others see the same person continue, with no leave or join sound when movedFrom is present. The old device says the call moved to the user's other device or, when sameCall is false, that the user joined another call on their other device (20 owns the copy).
Rationale: revoke-then-admit with a bounded wait (at most 3 s, usually a few tens of milliseconds) guarantees that two of the user's devices never both send or receive in the call, which would cause echo and duplicated audio for everyone.
12. Security transitions and removals during a call
12.1 Channel upgrade: security_upgraded
When a channel's upgrade to secure takes effect (09, D-057), the hosting server ends its active call with call.ended, reason security_upgraded, and next: {"security": "secure"}. This is a planned migration (00 HP-12 step 6). Every client that had the call screen open:
- keeps the call screen open with a neutral status line while the call is re-established (20 owns the copy; never a warning, 00 §4.12.5), and keeps mic mode, self-mute and push-to-talk state;
- checks the context's mode itself (§2.1 item 4);
nextis only a hint; - if the account is insecure, now in membership state
needs_encryption(09): closes the call screen and shows G1 in the channel; if the user turns on encryption, the join resumes by itself (00 §4.12.2); - if the device is unenrolled: does the same with G2;
- otherwise, gets a current leaf in the context's MLS group at once, not waiting for its next sync: in a channel by external commit (09, 13); in a DM by processing its Welcome, or by external commit as a listed person's further device, as 12 §11.4 and 13 specify;
- then joins the new call with
create: true,ring: false, no rejoin token, a freshIdempotency-Keyand its current self-mute state, following the schedule of §10.5 (fromt0= thecall.endedevent) while the call screen is open. The first device to join starts the new secure call, whosemediaEpochis the group's current epoch.
While steps 5 and 6 run, a held push-to-talk shows "not being heard" with the reason reconnecting (§10.6). A small call typically completes within about 2 s (one external commit plus one join per device). Larger calls take longer, because the hosting server sequences external commits one at a time and answers 425 when more than 3 are in flight (13); each device's transmit gate opens as soon as it has rejoined, whatever the others are doing.
No churn sounds. The old call's end and the new call's joins are one migration to the user. A client MUST NOT play leave sounds for the call.ended with reason security_upgraded or group_restarted, and MUST NOT play join sounds for participants of the new call whose account was in the previous call of the same context and who join within 60 s of that call.ended (20 PD-20-10).
Rationale: a secure call can't continue the insecure call's media in place, because SFrame keys come from the MLS group that the upgrade creates. Ending it with a distinct reason lets every client rejoin without asking anything, which is what 00 HP-12 requires.
12.2 Server upgrade
A server upgrade upgrades every channel (09), so §12.1 applies to each call in a channel. Insecure DMs hosted on the server are closed (K5) or put in encryption_pending (00 HP-9, 12 §13.1). Either way their calls end with reason context_closed, and clients don't rejoin.
12.3 DM security changes
| Change (12) | Call effect | Client behaviour |
|---|---|---|
| 1:1 DM becomes secure (both accounts are now secure) | call.ended, security_upgraded, at 12's dm.security_changed (the switch); a call running while the DM is upgrading continues until then (12 §14) |
As §12.1, using the DM's new MLS group (12, 13). A join refused meanwhile with dm.upgrade_in_progress is transient (§10.5). |
| Insecure group DM becomes secure | call.ended, security_upgraded, at 12's dm.security_changed |
As §12.1. |
| 1:1 DM becomes insecure (one account downgraded) | call.ended, security_downgraded |
Terminal: clients MUST NOT rejoin automatically. The DM shows W2 and W7 (12, 20). Either person may start a new call deliberately. |
| A participant of a secure group DM downgrades and is removed (12) | That participant's seat is removed with reason removed |
The call continues for everyone else. |
Rationale: a secure call never silently turns into an insecure one. The person sees why in the DM and decides.
12.4 Removals
| Cause | Seat removal reason | Timing |
|---|---|---|
Kick, ban, removal from a DM, loss of view_channel, membership becoming needs_encryption (10, 12, 09) |
removed |
Immediately when the hosting server applies the action |
Device revocation (device.revoked), identity change (identity.changed) affecting the device, the remote session ended by the server because of a revocation or account deletion (06 federation.session_ended with data.reason device_revoked or account_deleted), or loss of the device's leaf in a secure context's group (below) |
revoked |
Immediately when the hosting server processes the event, which 06 requires within 60 s of the home server's fan-out |
| The device's session at the hosting server expired, or ended for any other reason, without a revocation (06 §6.4, 05) | session_expired |
Immediately |
| The account was deleted (05) | removed |
Immediately |
The hosting server starts 13 §13.2's removal of the device's leaf for a reason not covered above (for example evicted, or stale_leaf after a failed re-check), except a stale_leaf removal of a duplicate leaf while the device keeps another leaf for the same did |
revoked |
Immediately, at 13 §13.2 step 2 (00 HP-3) |
Leaf loss. In a secure call, the seat is removed with revoked when, after the Delivery Service sequences a commit, the device has no leaf in the group, unless that commit is the device's own resync external commit (13 §10.5), which removes its old leaf and adds a new one for the same (address, did). A resync during a call is a planned migration (§10.8): call control updates the seat's leafIndex to the new leaf and emits call.participant_updated; the client restarts its media process with a fresh joinNonce as 18 requires, installs its keys and posts call.epoch_ready (§9.2). There is no outage, and the voice-activation mute of §10.6 rule 4 doesn't apply. The removal of a duplicate leaf (13 stale_leaf) while the device still holds another leaf for the same did isn't a leaf loss either; the seat's leafIndex then names the remaining leaf. This commit-time rule is a backstop for any removal that the rows above didn't already cut.
Removal revokes the lease at once (§2.6), so the person is cut off within 4 s (§4.8) whether or not an MLS commit has removed their leaf yet (D-037). The removed client treats the removal as terminal (§10.1) and shows why (20), except session_expired, which is an unexpected drop: the client renews or re-creates its session (06 §6.1, 05) and rejoins with its rejoin token, which stays valid as §10.2 says. A timed-out member (10) keeps the seat but loses audio and video (§4.9).
Own reset or downgrade. A device whose user starts fresh or turns off encryption leaves its call before it sends the request (08 §11.2 S5, §11.3), so its seat is removed with left and it never holds a seat after deleting its MLS state (08 §11.2 S6). It closes the call screen with a neutral line (20 §11.8) and doesn't rejoin. The user's other devices that are in calls are removed with revoked when the hosting server processes identity.changed, as the table says.
Rationale for session_expired: remote sessions last 1 h and are renewed silently (D-062). A renewal that fails because the network or the home server was briefly unreachable must not end a call permanently (D-012, D-013); a revocation still does.
12.5 Group generation change: group_restarted
When a secure context's MLS group gets a new generation during a call (13 §4.2 cases G-b and G-c), epoch numbers restart, so mediaEpoch and every call.epoch_ready would be ambiguous. Call control therefore ends the call with call.ended, reason group_restarted, when it retires the generation the call was using. This is a planned migration, handled exactly like §12.1 steps 1 to 6: clients join the new generation's group (13 §4.4: on mls.group_retired or mls.generation_retired they discard the old group's MLS state and join or bootstrap the new generation) and then join the new call with create: true and ring: false, keeping mic and push-to-talk state. 18 erases the old generation's media keys (18 §6.6 item 3). Case G-a (a 1:1 DM that becomes secure again) is a security change and ends the call with security_upgraded (§12.3).
13. Ringing in DM calls
Ringing exists only in 1:1 DMs and group DMs. Channels never ring.
13.1 Starting and ending a ring
- When a join with
ring: truestarts a DM call, call control creates a Ring (§2.5.3) whosetargetsare the DM's other participants in stateactive(12 §6.3), excluding bots and excluding, in a 1:1 DM, a participant who has blocked the caller (12 §8.5). Each target's ring lasts 45 s. Apendingparticipant (a DM that is still a message request for them) is never rung: the hosting server sequences 12'sdm.call_loggedwithphase: "started"(§3.3.2 step 5), which reaches that person in thedm.requestas a missed call (12 §14.1, D-049). - Call control emits
call.ring_updatedwith the new Ring on the context stream. For each target account, it:- sends
call.ringingon that account'smestream to every session the account has on the hosting server (§3.1, §15); - sends
notify.eventwith kindcall_ringto the account's home server (19). Unlike other notifications, a ring is sent whether or not the account has a foreground session on the hosting server, and is never coalesced, so the user's phone rings even while their desktop app is open. It carries the context reference, the hosting server's canonical domain, thecallId, the caller's address and display name, the call'ssecurity, thevideoflag and the target'sexpiresAt; 19 owns the payload format and delivery (including VoIP push).
- sends
- The ring ends for a target when that account joins the call from any device (reason
answered), declines from any device (declined), its ring times out (timeout), or the caller leaves or the call ends before the target answers (cancelled). Call control then removes the target fromringing, sendscall.ring_endedto the target's sessions (on itsmestream) andcall.ring_updatedto the context stream, and sendsnotify.eventwith kindcall_ring_endedto the target's home server so that every device stops ringing (19). - When no target is left in
ringingand no other account has ever joined, the call ends: reasondeclinedwhen every target declined, otherwiseunanswered(§2.4).
As defence in depth, the recipient's home server also MUST NOT ring for a DM that is still a message request (D-049); the request shows the missed call from the dm.call_logged start it carries (12 §14.1). So both sides hold the rule.
call_ring and call_ring_ended are sent at once whatever the recipient's sessions are, and never coalesced, as 00 HP-9 states. Rationale: a person whose desktop app is open in another room still expects their phone to ring, as with every familiar calling app.
13.2 Answering and declining
- Answer is a join with
create: false. If the call has ended meanwhile, the answer is 404call.not_activeand the client shows "Call ended". - Decline:
POST /v1/contexts/{ctx}/call/declinewith{"callId": "<uuid>"}from any device of a target account. The ring ends for that account on all its devices.204. A device that isn't a target gets 409call.ring_not_allowed; a decline after the ring already ended is accepted and ignored. - In a group DM each target is rung and declines independently; one person declining doesn't end the call.
13.3 Ringing again
POST /v1/contexts/{ctx}/call/ring with {"callId": "<uuid>", "targets": ["dan@d.com"]} (targets optional; the default is every account that §13.1 item 1 allows to be rung and that isn't in the call) starts a new 45 s ring for those accounts: each gets a RingTarget with a new expiresAt, and a target already being rung has its ring restarted. Targets that §13.1 item 1 excludes are silently skipped. Each new ring is delivered as in §13.1 item 2, including call.ring_updated. The caller must be a participant. Limits: at most once every 10 s per call, and at most 5 times per call (core.rate_limited). In a channel, or for an address that isn't a participant of the DM, the answer is 409 call.ring_not_allowed. 202.
UX: the incoming-call screen, its sounds and the missed-call entry are specified by 20 and 19. Ringing is never a security prompt. The caller's name on the incoming-call screen is checked against the address as §2.5.2 requires. A client SHOULD offer "Ring again" after unanswered. DM timeline call entries are 12's dm.call_logged (12 §14.1), which the hosting server sequences when call control starts and ends a DM call.
14. Diagnostics
Clients record call counters so that operators can fix connection problems. This section defines what is recorded, what may be uploaded, and the endpoint. 20 owns the consent screen.
14.1 What clients record
During a call, a client records a Sample every 10 s and one more when the call closes, and keeps the last 30 samples (5 minutes) in memory.
| Member | Type | Meaning |
|---|---|---|
at |
string | Sample time. |
rttMs |
integer | Round-trip time on the relay connection. |
jitterMs |
integer | Interarrival jitter of received audio. |
lossPermille |
integer | Received audio frames lost, per thousand. |
audioFramesSent, audioFramesReceived |
integer | Counts in the interval. |
concealedMs |
integer | Audio filled by FEC or concealment (16). |
jitterBufferMs |
integer | Current jitter-buffer depth. |
maxTickAgeMs |
integer | Oldest the newest lease tick got during the interval. |
videoKbpsSent, videoKbpsReceived |
integer | Video bitrates. |
framesHeld |
integer | Transitions of received video sources into the held state: the sum of heldEntries in 17's VideoStats (17 §14). |
keyframeRequests |
integer | Keyframe requests sent. |
undecryptableFrames |
integer | Secure calls: frames that couldn't be decrypted (18). |
attestationFailures |
integer | Secure calls: MediaAttestation failures (18). |
candidateTypes |
array of string | ICE candidate types of the relay connection's selected candidate pair (host or prflx); never addresses. |
audio |
object | Optional: AudioStats (16 §13). audioFramesSent, audioFramesReceived, concealedMs, lossPermille and jitterBufferMs are derived from it as 16 §13 states. |
video |
object | Optional: VideoStats (17 §14). videoKbpsSent, videoKbpsReceived, framesHeld and keyframeRequests are derived from it as 17 §14 states. |
14.2 What may be uploaded, and consent
A client has one diagnostics setting with three values:
| Value | What is uploaded |
|---|---|
off |
Nothing. |
failures (default, D-089) |
A call_failure report when: a join failed and the user gave up; an unexpected drop wasn't repaired within 60 s; more than 3 unexpected drops happened within 10 minutes; or the relay connection couldn't be established. |
full |
Also a call_summary report when each call closes. |
The default is failures (D-089): only failure reports, containing counters and no content, are uploaded, and only to the server involved. Clients mention the setting during onboarding and in privacy settings, and users can turn it off (20 §9.2, §17). Rationale: non-IT-literate users can't diagnose their own call failures, and the operator who can fix them is the one who runs the relay.
UX: 20 §17 specifies the setting ("Problem reports"), its one-sentence explanation and the onboarding statement. The client never asks the user to choose a value, during a call or anywhere else.
Never collected or uploaded: audio, video or any media payload; message content; SFrame or MLS key material, KIDs or nonces; SDP; ICE candidate addresses; any IP address; the names or addresses of other participants (only pids, which mean nothing outside the call); device names; contact lists; location.
14.3 POST /v1/diagnostics
The client sends call reports to the call's hosting server, using its session there. Reports of the kinds owned by other documents go where those documents say.
| Member | Type | Required | Meaning |
|---|---|---|---|
reportId |
string | Yes | UUIDv7 chosen by the client; the request is idempotent on it. |
kind |
string | Yes | Report kind (§14.4). |
client |
string | Yes | Product and version, as in session.hello (03). |
platform |
string | Yes | desktop, web, ios, android or bot. |
createdAt |
string | Yes | When the report was made. |
ctx |
string | No | The context, for call kinds. |
callId |
string | No | The call, for call kinds. |
data |
object | Yes | Kind-specific data. |
The server answers 202 with {"reportId": "…"}. A body over 64 KiB gets 413 core.too_large; more than 30 reports per hour per session get 429 core.rate_limited. A client keeps every report within 64 KiB. It first applies the upload bounds of 16 §13 (audio) and 17 §14 (video), and then, if the report is still too large, omits the oldest Samples. The endpoint accepts home sessions, remote sessions and bot tokens.
call_failure data: {phase, code, security, outageMs, rejoinAttempts, iceState, dtlsState, samples}, where phase is join, relay_connect, in_call or rejoin; code is the last error code seen, or null; security is the call's mode; and samples is up to 30 Samples. call_summary data: {durationMs, security, routesUsed, unexpectedDrops, samples}, where routesUsed lists the routes the device's media used (relay, and sfu when its video went through the SFU).
POST https://b.com/v1/diagnostics
{ "reportId": "01938f55-0d1e-7f20-8a31-425364758697", "kind": "call_failure",
"client": "sloppyvoice-desktop/1.0.3", "platform": "desktop",
"createdAt": "2026-12-04T18:30:12.441Z",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "callId": "01938f40-5a6b-7c8d-9e0f-102132435465",
"data": { "phase": "rejoin", "code": "relay.overloaded", "security": "secure",
"outageMs": 61250, "rejoinAttempts": 7, "iceState": "failed", "dtlsState": "closed",
"samples": [ { "at": "2026-12-04T18:29:02.000Z", "rttMs": 48, "jitterMs": 6,
"lossPermille": 12, "audioFramesSent": 500, "audioFramesReceived": 1490,
"concealedMs": 140, "jitterBufferMs": 60, "maxTickAgeMs": 1020,
"videoKbpsSent": 0, "videoKbpsReceived": 1800, "framesHeld": 0,
"keyframeRequests": 1, "undecryptableFrames": 0, "attestationFailures": 0,
"candidateTypes": ["host"] } ] } }14.4 Report kinds
kind |
Data owner | Sent to |
|---|---|---|
call_failure |
15 | The call's hosting server |
call_summary |
15 | The call's hosting server |
identity_check |
07 | As 07 specifies (silent credential-check failures, D-035) |
media_attestation |
18 | As 18 specifies (D-043) |
sealed_verify |
14 | As 14 specifies |
pin_conflict |
02 | As 02 §10.6 specifies |
transport |
03 | As 03 specifies |
vault_integrity, key_storage |
08 | The account's home server, as 08 §16.4 specifies |
security_downgrade_seen |
09 | As 09 specifies (W9 reports, D-056) |
13 reports MLS failures as MlsReports to …/mls/reports (13 §7.10), not here.
A server MUST accept unknown kinds (MAY discard them) and MUST NOT fail a request because of one. A kind is 1–64 characters of lowercase letters, digits, _ and ..
The consent setting of §14.2 governs every upload to /v1/diagnostics, whatever the kind (20 §17): with off nothing is uploaded; with failures or full, reports of the other kinds, which all describe failures, are uploaded as their owners specify.
14.5 Server handling
A server keeps diagnostic reports for at most 30 days, makes them available only to its own administrators, never sends them to another server, and deletes an account's reports when the account is deleted (05). Diagnostics never change a call's behaviour.
15. Events
Registration under 03 §11.2. Every event in this section is a client WebSocket event sent server to client by the call's hosting server, and is ephemeral (00 §7.4, 03 §7.2): it carries no seq, is never replayed, and isn't a timeline item. A client that missed some recovers from call.state (§3.1) or GET …/call (§3.2), as 03 §7.2 E4 requires. Receivers ignore unknown members and unknown event types. Call timeline entries in DMs are 12's durable dm.call_logged, not events of this document.
Streams and targeting. "Context" means the call's context stream: the envelope's ctx is the call's context, and the event reaches sockets with a full subscription to it. "Context, targeted" means the same stream, targeted (03 §7.2 E5) at the sessions of the named devices, which keep a full subscription to the context while they hold a seat (§3.1). "me, targeted" means the account stream (ctx me) of the named account on the hosting server, targeted at that account's sessions; the payload then carries the context reference in ctx.
| Type | Transport | Class | Stream and targeting | Payload d |
|---|---|---|---|---|
call.state |
Client WebSocket | Ephemeral | Context, targeted at a session whose socket has just gained a full subscription to the context (by resume or subscribe in session.hello or session.subscribe), or received session.resync_required for it (§3.1) |
{call}: a Call or null |
call.started |
Client WebSocket | Ephemeral | Context | {call} |
call.participant_joined |
Client WebSocket | Ephemeral | Context | {callId, participant, rejoined, movedFrom}; rejoined (boolean, default false) and movedFrom (integer) are optional |
call.participant_updated |
Client WebSocket | Ephemeral | Context | {callId, participant} |
call.participant_left |
Client WebSocket | Ephemeral | Context | {callId, pid, addr, reason}; reason is left, timeout, removed, revoked, session_expired, moved, switched or call_ended (unknown values: treat as left) |
call.ended |
Client WebSocket | Ephemeral | Context | {callId, reason, endedAt, next}; reason per §2.4; next is {"security": …} for security_upgraded, otherwise absent (a hint only, §2.1 item 4) |
call.ring_updated |
Client WebSocket | Ephemeral | Context | {callId, ringing, ended}: the call's current Ring or null, and, when a target's ring just ended, ended = {addr, reason} with reason as for call.ring_ended |
call.tick |
Client WebSocket (also the relay's control channel, §6.5) | Ephemeral | Context, targeted at each participating device | A LeaseSnapshot (§4.2) |
call.lease_changed |
Client WebSocket | Ephemeral | Context, targeted at the affected participating device | A VoiceLease (§4.1) |
call.epoch_switch |
Client WebSocket | Ephemeral | Context, targeted at each participating device (secure calls) | {callId, epoch} |
call.route_changed |
Client WebSocket | Ephemeral | Context, targeted at each participating device | {callId, videoRoute} (§7.2) |
call.moved |
Client WebSocket | Ephemeral | Context, targeted at the device whose participation was moved | {callId, pid, sameCall}; sameCall is true when the user's other device joined this same call, false when it joined another call on this server |
call.migrate |
Client WebSocket | Ephemeral | Context, targeted at each participating device | {callId, reason, deadlineMs}; reason is drain or rebalance (unknown: treat as drain); deadlineMs is 10000 |
call.ringing |
Client WebSocket | Ephemeral | me, targeted at every session of each ring target account |
{ctx, callId, by: {addr, name}, security, video, expiresAt}; expiresAt is this target's |
call.ring_ended |
Client WebSocket | Ephemeral | me, targeted at every session of the target account |
{ctx, callId, addr, reason}; reason is answered, declined, timeout or cancelled (unknown: treat as cancelled) |
sfu.offer |
Client WebSocket | Ephemeral | Context, targeted at the device owning the SFU session | {callId, sfuSessionId, negotiationId, offer, tracks} |
sfu.tracks_changed |
Client WebSocket | Ephemeral | Context, targeted at the device owning the SFU session | {callId, sfuSessionId, tracks} |
sfu.closed |
Client WebSocket | Ephemeral | Context, targeted at the device owning the SFU session | {callId, sfuSessionId, reason}; reason is route_changed, negotiation_timeout, removed or sfu_failed (unknown: treat as sfu_failed) |
A participating device's sessions are the WebSocket sessions of its did on the hosting server.
Examples:
{ "v": 1, "t": "call.tick", "id": "01938f41-0a1b-7c2d-8e3f-405162738495",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "ts": "2026-12-04T18:22:31.000Z",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1186, "validMs": 3000,
"audio": [3], "video": [3, 7], "listeners": [3, 7, 12], "epoch": 42 } }{ "v": 1, "t": "call.participant_left", "id": "01938f41-2c3d-7e4f-9a0b-1c2d3e4f5a6b",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "ts": "2026-12-04T18:23:05.212Z",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 12, "addr": "carol@c.com", "reason": "removed" } }{ "v": 1, "t": "call.ended", "id": "01938f42-0000-7000-8000-00000000a001",
"ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566", "ts": "2026-12-04T18:40:00.031Z",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "reason": "security_upgraded",
"endedAt": "2026-12-04T18:40:00.030Z", "next": { "security": "secure" } } }{ "v": 1, "t": "call.ringing", "id": "01938f43-1111-7222-8333-444455556666",
"ctx": "me", "ts": "2026-12-04T19:02:10.500Z",
"d": { "ctx": "dm:Xq3v9LzKp0aT7mW2bN5cRg", "callId": "01938f43-0f00-7a00-8b00-0c0d0e0f1011", "by": { "addr": "alice@a.com", "name": "Alice" },
"security": "secure", "video": false, "expiresAt": "2026-12-04T19:02:55.500Z" } }16. Error codes and registry additions
16.1 Error codes
The call, relay and sfu areas are owned by this document (00 §7.5). Every code uses the problem object of 00 §7.9. On the relay's own endpoint, relay.* codes are returned by the relay.
| Code | HTTP | retryable |
userAction |
Meaning | data |
|---|---|---|---|---|---|
call.unsupported_context |
409 | false | none |
The context can't hold calls (for example a text channel). | — |
call.not_active |
404 | false | none |
No call is active and the request didn't allow creating one. | — |
call.ended |
410 | false | none |
The call the request names has ended. | {reason}: the call's end reason (§2.4) |
call.already_in_call |
409 | false | none |
The user already has a participation on this server (§2.3). | {ctx, callId, sameDevice, sameCall} |
call.full |
409 | true | wait |
The call has maxCallParticipants seats. |
{maxParticipants} |
call.rejoin_expired |
410 | false | none |
The rejoin token is past its 60 s window; join afresh. | — |
call.rejoin_invalid |
403 | false | none |
The rejoin token isn't valid for this device and context. | — |
call.moved |
409 | false | none |
The participation was moved to another device or call. | {sameCall} as in the call.moved event (§15) |
call.not_participant |
403 | false | none |
The device holds no seat in this call, or the pid isn't its own. |
— |
call.not_permitted |
403 | false | none |
The action needs a right the participant lacks, or isn't available in this kind of context or call. | {blockedBy} when a lease blocks it |
call.mls_join_required |
409 | true | none |
Secure context: the device has no current leaf in the group; complete the MLS join (13) and retry. A device waiting to be re-added after its user's reset (13 §16 awaiting_readd) can't, so its client treats this as terminal (§10.5). |
{groupEpoch} |
call.epoch_unknown |
409 | true | none |
call.epoch_ready named an epoch the Delivery Service hasn't sequenced. |
{groupEpoch} |
call.ring_not_allowed |
409 | false | none |
Ringing or declining isn't possible here (channel, non-target, non-participant). | — |
call.relay_unavailable |
503 | true | wait |
No relay can take the call now. | — |
relay.ticket_invalid |
401 | false | none |
The RelayTicket is malformed, from an unknown issuer or key, or its signature fails. | — |
relay.ticket_expired |
401 | false | none |
The ticket is outside its validity window. | — |
relay.ticket_replayed |
401 | false | none |
The ticket's jti was already used. |
— |
relay.wrong_relay |
421 | false | none |
The ticket's aud isn't this relay. |
— |
relay.call_unknown |
404 | true | none |
The relay has no snapshot for the call. | — |
relay.bad_offer |
400 | false | none |
The SDP offer is unusable (wrong channels, no m=application, oversize). |
— |
relay.overloaded |
503 | true | wait |
The relay can't accept sessions now. | — |
relay.bad_message |
— (in relay.error) |
false | none |
A control message was malformed or not allowed. | {t} |
sfu.not_active |
409 | false | none |
The call's videoRoute isn't sfu. |
— |
sfu.unavailable |
503 | true | wait |
The SFU can't be reached or is overloaded. | — |
sfu.bad_sdp |
400 | false | none |
The SDP or publish list is unusable. |
— |
sfu.negotiation_conflict |
409 | true | none |
A server offer is outstanding; answer it first. | {negotiationId} |
sfu.session_unknown |
404 | true | none |
Call control has no such SFU session; create a new one. | — |
userAction is none for most codes because clients handle them automatically (§10.5); the user sees only the outcome. This document also returns core.* codes (03), the security.* codes of 00 §4.11, and the access codes of 09, 10 and 12 (channel.deleted, channel.join_required, member.*, moderation.banned, dm.not_participant) as stated in §2.2 (a channel or DM the caller can't see answers core.not_found, one of the core.* codes), and 01's address.non_canonical as stated in §3.6.
16.2 Registry additions
| Registry (owner) | Additions |
|---|---|
| Event types (03) | Every type in §15, all ephemeral client WebSocket events, with the streams and targeting stated there. |
| Error codes (03) | Every code in §16.1. |
| Limits (00 §7.12, 03) | maxCallParticipants (default 200, floor 25). |
JWS typ (04) |
sv-relay+jwt (already listed in 00 §7.13). |
| Data channels (this document) | sv-control (sv-control/1, id 0), sv-audio (voice-dc/1, id 1), sv-video (video-dc/1, id 2). |
| Control-channel message types (this document) | The call.* and relay.* types of §6.5; media.attestation is reserved for 18. |
call.media_feedback kinds |
audio_loss (16 §4.7); keyframe_request, video_pref and video_report (client-sent), and video_viewer_state, video_audience and video_upload_pressure (relay-originated, sent without from) (17 §7.1). |
| Diagnostic report kinds (this document) | call_failure, call_summary; reserved for others: identity_check (07), media_attestation (18), sealed_verify (14), pin_conflict (02), transport (03), vault_integrity and key_storage (08), security_downgrade_seen (09). |
notify.event kinds (19) |
call_ring and call_ring_ended (§13). |
| Crypto labels (04) | None. |
17. Security considerations
- Relay and SFU trust. In insecure calls the relay and the SFU can hear and see everything they forward, as the owner intends (R-09). In secure calls they forward SFrame ciphertext and can't decrypt or forge media (18), but they see metadata: who is in the call, who sends when, frame sizes and bitrates (00 §5.4). They are part of the hosting server's trust domain: they are trusted to enforce leases and to be available, never for confidentiality in secure calls.
- Lease ticks aren't signed. Ticks come from the hosting server, directly or through its relay, and the hosting server already decides membership. A malicious relay could forge ticks that delay or extend coverage for the clients connected to it, or send a tick with a huge
seqso that clients ignore every genuine tick that arrives over the relay. Without §4.4 item 3 that would wedge the client for the rest of the call; with it, the client accepts the next WebSocket tick once its newest tick is 3 s old, so the wedge costs at most about 3 s of coverage, plus however long the client's WebSocket stays down. Either attack is within the hosting server's existing power; neither lets anyone decrypt a secure call after the next epoch switch, because removed devices also lose their MLS leaves (D-037). Signing ticks was rejected because it would add a signature verification per second per participant for no gain against the only party able to produce them. - Sender spoofing. The relay checks that every frame's route-header
pidis the session's own (§4.5) and setsfromon every control message it forwards (§6.5). In secure calls the KID's leaf must belong to the sending participant's device in the receiver's own MLS state for the frame's epoch (18 §4.5; the Participant'sleafIndexis only a hint), and MediaAttestation authenticates the sending device. A member colluding with a relay can still inject media under another member's keys: normally for under 1 s, and at most about 3 s per episode (00 §10 item 9, 18 §14 item 2). - RelayTicket theft. A ticket is valid for one connection to one relay for at most 60 s, and only for one
pidwhose rights are bounded by the lease lists. Tickets travel only over TLS in the join response and the connect request. - Rejoin token theft. The token is accepted only from a session of the same account and device, so a thief needs that session already. It grants nothing beyond what the session grants, and it dies with the participation.
- Participants' addresses. Clients never connect to each other (D-094, §7.1), so other call participants never learn a user's IP address from a call. The relay, the SFU and every other server the client connects to learn its address, as with any server.
- Leases bind every path. All media goes through the relay or the SFU, both of which enforce the lease lists (§4.5, §4.7), so a revoked participant is cut off within 4 s even when both the revoked client and the clients it talks to are modified (§4.8).
- Denial of service on relays. A relay allocates WebRTC resources only after validating a ticket (§5.2), runs ICE-lite with consent freshness, forwards only to authenticated sessions in
listeners, caps inbound traffic per session (§6.6), and rate-limits control messages. Because it never forwards to an address that hasn't completed ICE and DTLS with it, it can't be used to amplify traffic towards a third party. - Ringing abuse. Only
activeDM participants can be rung, never by someone they blocked; message requests never ring; automatic joins never ring (§3.3.1); re-rings are limited to once every 10 s and 5 per call (§13.3); servers rate-limit joins. - Auto-rejoin privacy. Audio captured during an outage is discarded, never sent late, and voice-activation and open-mic users come back muted, after a drop, and from the start of a moderator's block on their audio, so they are still muted when it ends (§10.6 rules 4 and 6). This prevents broadcasting speech the user didn't expect to be heard. Likewise the webcam comes back off after a drop, and a screen share resumes only if the seat was restored within 30 s, so the camera never goes live again without a deliberate action and the screen isn't re-published after an outage long enough for the user to have moved on (D-090, §10.6 rule 7). A call that became insecure never rejoins by itself (§12.3).
- Downgrade by a malicious hosting server. A server could present a call in a secure context as
insecure. Clients take the call's mode from their own view of the context (§2.1 item 4), so they refuse to join or send, and a pinned channel or server shows W9 (D-056). A secure call never carries plaintext media to or from an honest client. - Move voice here revokes the old device before admitting the new one (§11), so a device a user has walked away from can't keep listening after the user moves the call.
- Diagnostics carry no content, keys or addresses (§14.2), go only to the call's hosting server, are retained at most 30 days, are sent by default only for failures (
failures, D-089), and can be turned off. - Hidden listeners. In a secure call, only devices with a leaf in the context's MLS group can decrypt media (§2.2 check 6). A hosting server could forward ciphertext to a group member it doesn't show in the roster, but that member can already read the context; this is within the "server decides membership" trust of 00 §5.3.
- Self state is advisory.
selfMuted,selfDeafenedandsourcesare reported by the participant's own client and can be false. Only lease lists are enforced.
18. Open questions
| ID | Question | Recommendation |
|---|---|---|
| OQ-15-2 | D-012 says voice-activation and open-mic users come back muted after an automatic rejoin. Should very short outages (for example a Wi-Fi to mobile-data handover that heals within 2 s) be exempt? | Keep D-012 exactly as written for v1: every automatic rejoin after an unexpected drop returns muted. Transient ICE blips that heal without a rejoin are already not drops (§10.1). Revisit after user testing. |
OQ-15-1 and OQ-15-3 were answered by the owner and removed: diagnostics default to failures (D-089, §14.2), and all call media travels through the hosting server's relay or SFU (D-094, §7.1).
19. References
19.1 Normative
- RFC 2119, RFC 8174 — requirement key words
- RFC 5234 — ABNF
- RFC 8259 — JSON; RFC 7493 — I-JSON
- RFC 3339 — timestamps; RFC 9562 — UUIDv7; RFC 4648 — base64url
- RFC 3986 — URIs
- RFC 9457 — problem details for HTTP APIs
- RFC 6455 — WebSocket
- RFC 7515 — JWS; RFC 7519 — JWT; RFC 8037 — EdDSA in JOSE; RFC 8032 — Ed25519
- RFC 8445 — ICE; RFC 6544 — ICE over TCP; RFC 7675 — ICE consent freshness
- RFC 8825 — WebRTC overview; RFC 8826, RFC 8827 — WebRTC security; RFC 9429 — JSEP
- RFC 8831 — WebRTC data channels; RFC 8841 — SDP for SCTP over DTLS; RFC 8261 — SCTP over DTLS; RFC 3758 — SCTP partial reliability
- RFC 9147 — DTLS 1.3; RFC 6347 — DTLS 1.2
- RFC 9420 — MLS; RFC 9605 — SFrame
- W3C WebRTC 1.0; W3C WebRTC Encoded Transform
- Sloppy Voice documents 00, 03, 09, 10 and 13 (this document's dependencies), and 02, 05, 06, 07, 12, 16, 17, 18, 19, 20, 21 where cited
19.2 Informative
- RFC 9725 — WebRTC-HTTP Ingestion Protocol (WHIP), whose one-request offer/answer pattern
{relayUrl}/connectresembles - RFC 8835 — WebRTC transports
- RFC 9750 — MLS architecture
spec/DECISIONS.md— decision log- The project brief, §5 — the old voice and video design (relay, bounded authority, Move voice here, diagnostics)