Records Feature record

FDR-016

Voice Calls

Active Last reviewed 2026-11-05 Source file

Overview

Rooms support real-time voice conversations with optional camera video and screen/window/tab sharing. Supported browsers can include audio from a shared browser tab. A phone tab in the room sidebar lets members start or join the room call; the call panel shows screen-share tiles first, then video-enabled participant cards, then compact voice-only participant cards, and provides mute, camera, screen-share, device-selection, and hang-up controls. Audio and video are routed through LiveKit (an external WebRTC service); Chatto only handles authorization, participant state, and the UI.

Behavior

Incoming calls use the Direct calls or Room calls notification preference. A new direct call defaults to Push notification. A new channel-room call defaults to Off. An eligible member can open the room or dismiss the alert. The room shows the current call and provides the usual controls to join it. See FDR-012.

Operators can limit concurrent call participants with livekit.max_global_participants. The default is unlimited. Each user or bot takes one place per room, including listen-only and pending joins. A native companion publisher shares its owner's place. At capacity, Chatto returns RESOURCE_EXHAUSTED for a new join or primary token request. A participant can request another token for the same call. Lowering the limit preserves existing calls. Leave events and LiveKit reconciliation release places, including abandoned joins. LiveKit can still reconnect a participant with a valid token.

  • Supported browsers expose microphone, camera, and hang-up actions through system media controls during a call. These actions use the same permissions as the call panel. Microphone and camera actions are available only with the corresponding permission, including when permissions change during a call. System metadata shows only the Chatto name, to keep room and participant names off the lock screen. The most recently joined call owns these controls; leaving it clears them. This integration does not guarantee that a mobile browser keeps a background call running.

  • Calls request a browser audio mode for simultaneous playback and recording where supported, including while muted or listen-only. This is a best-effort request to support background call audio. It does not request microphone access for listen-only members. The last call to leave restores the previous audio mode unless another feature has selected a different mode. The browser can still interrupt audio or terminate the page. Closing the page retains explicit call departure behavior.

  • Members can see an ongoing call when they join or rejoin its room, including when the room becomes universal. They do not need to reconnect or wait for the call to restart. A new account can also see an existing call in a universal room when it has permission to join that room.

  • Connection quality comes from LiveKit, independently of microphone activity. Participant cards and the current-user card show an amber network icon for a poor connection and a red disconnected icon for a lost connection. Hover or click the icon to read its status. Healthy and unknown connections show no warning. Recovery removes the warning and closes its explanation.

  • Video quality selection uses the display's physical pixel density so that HiDPI call views can request enough detail. This can increase download use and activate a larger publisher layer. Native macOS screen sharing defaults to one tuned H.264 layer with resolution priority and an 8 Mbps video maximum. Actual rates depend on network and encoder limits. The Diagnostics menu retains stock H.264 and HEVC simulcast modes with 8/4/1 Mbps layer limits; their combined video ceiling is 13 Mbps when viewers need all three layers. See FDR-034 for rate control and fallback behavior.

  • Open a participant's user context menu with the three-dot button or a right-click anywhere on their card, including camera and screen-share video. This also works on secondary stage tiles. Left-clicking sidebar video opens the user menu. Left-clicking a secondary or unpinned featured stage tile pins it; clicking the pinned featured tile unpins it. Touch users can long-press the card, including its video. For remote participants in the active call, participant and camera card menus include Voice volume alongside profile actions. This control is also available from the members list. Screen-share card menus show Stream volume instead. Adjust each independently from 0% to 100%. 100% is the original level. A perceptual curve maps 50% to -10 dB; percentages approximate relative loudness, not signal amplitude. Both sources use the same curve, including saved slider positions. These settings change only what this listener hears. The browser saves levels per server and user for later calls. Native game-share audio uses the sharing user's stream level.

  • Mute locally silences both sources without changing saved levels. Sliders move in 5% steps and mark 100% as the original level. Playback is limited to 100%. Older saved values above 100% are retained, but playback uses 100%. Calls use LiveKit media-element playback. Some mobile browsers use system volume and ignore intermediate levels. Local mute and zero volume also disable audio delivery through LiveKit track settings. They do not rely on media-element volume.

  • Microphone activity appears as a glow on the participant card. Quiet input does not show a warning because normal pauses do not indicate a microphone fault. The call toolbar's gear opens Voice & video preferences for a microphone test.

  • Calls use the system output when the browser cannot select a media-element output device. If the browser blocks playback, Enable call audio resumes it.

  • Voice Boosting is off by default. It enables microphone enhancement independently of the noise gate. Both choices are saved per browser and server. Previous default-on Boost values do not enable the explicit opt-in. Device, volume, gate, and join-muted choices are retained. A saved gate threshold applies with Boost off too. With both controls off, calls use native LiveKit capture and playback. With Boost on, optional microphone processing adds low-cut filtering, EQ, compression, bass control, de-essing, and peak limiting. The gate has a softer closing transition to preserve quiet word endings. Capture retains browser echo cancellation, noise suppression, and automatic gain control. Disabling Boost keeps an active gate. Setting the gate to Off and disabling Boost removes optional processing without leaving the call. Users can disable both controls if processing fails. A failed optional processor does not own or stop the original capture track.

  • Noise gate threshold and its input meter remain visible with Boost off. The threshold defaults to Off. Higher thresholds suppress quieter sounds. The meter shows input before the gate. Muted calls show no input activity. The gate uses a short attack, a hold period, a lower closing threshold, and a slower release. It does not change participant mute state.

  • Voice activity follows browser-local audio measurements where available, independently of Boost and the gate. Received activity follows decoded audio. Local activity and the settings meter use microphone input before processing. Optional measurement failures fall back to SDK activity reports. Measurements stop when the page is hidden and resume in the foreground. They do not replace or stop capture or playback tracks and open no external connections.

  • LiveKit owns background capture recovery and playback recovery. The mute control follows SDK publication state, including a mute after failed recovery. Enable call audio calls the SDK from a user gesture and uses its playback status. Chatto requests play-and-record through the optional Audio Session API before connecting media. It does not repeatedly reopen capture in the background. Call cues use local audio files, without a separate AudioContext. iOS background behavior still needs tests on physical devices.

  • App Preferences → Voice & video stores microphone, speaker, camera, and join-muted choices in this browser for the selected server. Successful device changes during a call update those choices. Missing devices use a system default without erasing the saved choice. The next call can use a device that returns. Changes from this preferences page also switch the connected call. An explicit microphone is a preferred capture device when a call or local test starts. The browser can use an available input without first rejecting capture for a missing saved device. The device picker shows the system default fallback and keeps the saved choice. A local test also uses the default output when the saved speaker is absent or output selection is unsupported.

  • Camera selection does not start video. Joining muted does not request microphone access merely to list devices. Browser support controls whether a speaker can be selected.

  • Device choices use compact dropdowns so long device lists do not expand the settings page. The controls follow the app's depth preference where browser support permits. A local microphone test records a sample without playing live audio. Stop or the 10-second limit ends capture before replay starts through the selected speaker. The sample stays in browser memory until the next test, microphone change, or navigation. Users can replay it. The test does not connect to LiveKit or verify network connectivity. Testing is unavailable during the selected server's call. Output changes keep capture active. A failed explicit output selection stops the test instead of silently playing through another device. Input changes restart an active test. Camera choices do not interrupt it. Navigation discards the sample, and late capture results are stopped. The test and calls share microphone capture options: mono input, echo cancellation, noise suppression, automatic gain control, and voice isolation where the browser supports it. With both processing controls off, the test records the browser capture stream. With either control enabled, it records the processed track. The input meter works in both modes and shows input before the gate. Switching between this bypass and processing starts a new sample and keeps the selected speaker.

  • Opening the settings page requests microphone and camera access separately when their device names are unavailable and no call is active on the selected server. The browser may show permission dialogs. Each successful request refreshes the device choices and stops capture immediately. A missing or blocked camera does not prevent audio device discovery. Discovery does not play, record, or send media to an external service.

  • Room membership and call.join are required to enter a call. Starting a new call also requires call.start. Media permissions do not grant entry.

  • call.voice, call.camera, and call.screenshare independently control microphone, camera, and screen or application sharing. Captured share audio belongs to call.screenshare, including native game sharing.

  • Members with call.join and no media permissions can listen and watch. Their client does not request microphone or camera access to join.

  • Members can still view an active call and leave it after call permissions are denied. Call controls show which actions are unavailable.

  • The client stops revoked media when it receives updated room permissions. The server also checks connected participants on its 30-second LiveKit reconciliation cycle. It updates media grants or disconnects participants who can no longer join. Failures retry on later cycles. Revocation is not instantaneous, and an old unexpired token can briefly reconnect before a subsequent check removes that participant again.

  • Existing human call access is preserved on upgrade through initial server grants for everyone. An existing grant, deny, or clear is never overwritten. Bots need explicit grants and their owner's current authority.

  • Members of a room with the right permission see a phone tab alongside the room sidebar's members/files tabs when LiveKit is configured.

  • Opening the call tab shows the current room call. If no call is active, it offers a "Start call" action. If a call is active and the viewer has not joined, it shows projected participants as ungrouped participant cards and a "Join call" action.

  • When the current room has an active call, the phone tab is accent-highlighted and pulses while another sidebar tab is selected. Selecting the pulsing tab opens the call tab and joins the call.

  • Joining the call switches the call tab into participant mode. The sidebar keeps a featured source above a separate scrolling participant list. Other screen shares come first in the list, then cameras, then compact voice-only cards. The featured person has no second card in the list, with or without a camera. A screen share is a separate source: its owner's person card stays visible when the share is featured. Participant mode exposes a voice activity glow, mute state, camera toggle, screen-share toggle, device selector, and hang-up controls.

  • The pane header shows maximize and fullscreen controls only while the viewer is connected to that room's call. An active call alone does not show these controls.

  • On desktop, an active call sidebar can be maximized from the pane header. Maximized mode hides the Room View and turns the call panel into a stage layout. The call stays visible at all viewport widths. Below 1024 px, the Server Sidebar and Server Gutter are hidden to give the call the available width. At 1024 px and above, they stay visible.

  • The stage layout features one source in the largest 16:9 card that fits the stage, so very wide or tall screens do not crop camera feeds or stretch the card. Both layouts use the same selection: a pin comes first, then the remote active speaker, then a remote camera, then the viewer's own camera. The active speaker counts only while at least one camera is on, and is featured with or without a camera of their own. All other screen shares, cameras, and participants show as equal tiles. The tiles go in one row below the featured source, which scrolls horizontally when the tiles do not fit, or beside it when that gives the featured source a larger card, as on ultrawide screens. Beside the featured source, the tiles fill the remaining width in a near-square grid that starts at the top edge of the featured card.

  • The viewer can select a camera or screen share in the sidebar, or any secondary stage tile, to pin it to the featured area. A screen share that starts while no source is pinned acquires the pin automatically. If several shares first appear together, a remote share comes before the viewer's own share. A new share never replaces an existing pin. Unpinning returns to automatic selection; an existing share does not acquire the pin again unless it stops and starts again. Clicking the pinned tile again unpins it. On hover or keyboard focus, the featured tile shows a pin icon when unpinned and a crossed-out pin icon when pinned. The featured card also offers an unpin action. A pin is local to the viewer and lasts while the panel is mounted. Switching between sidebar, maximized, and fullscreen layouts keeps the pin. When the pinned source ends or the viewer leaves the call, the pin clears and the stage selects a source automatically again.

  • Without a pin or any camera, the stage shows all sources as equal tiles in a balanced grid. Voice-only calls keep compact participant rows in the sidebar.

  • The active speaker comes from LiveKit's server-side active speaker updates. The viewer never counts as the active speaker. The last speaker stays the active speaker during silence. A new speaker replaces the current one only after staying the loudest remote speaker for 3 seconds without interruption, so short interjections do not move the stage. The first speaker, and the next speaker after the current one leaves, apply at once.

  • An active call pane can be placed into browser fullscreen from the pane header, whether it is in the normal sidebar width or maximized across the chat route. This is separate from maximizing the pane inside the chat route. Fullscreen always uses the stage layout and keeps the pane header visible. The header close button exits fullscreen and returns to the previous pane layout without leaving the call. The maximize and fullscreen controls and the resize handle are hidden in fullscreen. Fullscreen ends when the call controls leave the pane, for example when the viewer leaves the call or opens a profile from the call user menu.

  • Fullscreen applies to the complete call pane. Individual camera and screen-share tiles use picture-in-picture for a separate video window. Joined participant cards offer mute. Cards narrower than 20rem put unpin and mute in their three-dot menu. Wider cards show these actions and picture-in-picture in their header. The card width selects the layout independently of the window width. Names, usernames, connection warnings, and mute status stay visible. Mute keeps the menu open; unpin closes it. Remote cards keep volume controls in their menu. Voice cards use the same height for local and remote participants. Calls with up to three participants use one sidebar column, including camera tiles. With more than three participants, a wide sidebar with a screen share or multiple video feeds uses two equal-width participant columns; screen shares span the full row. Narrow sidebars use one column. Remote participant mute is local to the viewer and does not change call membership or other participants' audio. The local participant card controls the viewer's own microphone.

  • Call controls form one joined pill with separators at the bottom of the call pane. Its height and rounded corners match the composer and other bottom-row controls. Participant content scrolls above it.

  • Camera and screen-share tile menus include Picture-in-picture when the browser supports requests from the page, including secondary stage tiles. Wide cards also show the toggle in the sidebar and featured stage headers. Both controls show the selected video's active state and become available once video is ready. They open or close that tile's video; selecting another tile switches the picture-in-picture video. Closing the browser's picture-in-picture window resets the toggle. Closing the sidebar or switching rooms or servers keeps the selected video in picture-in-picture while the call and stream remain active. Ending the call or removing the selected stream closes its picture-in-picture window. A successful menu toggle closes that menu. Resizing a card or closing its menu keeps picture-in-picture active. Failed requests show an error without interrupting the call. Browsers without page-controlled picture-in-picture still show the user menu, with this action omitted.

  • While the viewer is in a call, the app header shows a compact joined pill group: a room button, then mute, camera, screen-share, and leave. The group sits on a flat, dark track, and its buttons have no depth lighting. The room button shows a status dot, the room name with a muted room-type prefix such as #, and a glow while the viewer speaks. With more than one registered server, the server logo comes before the room name, and the accessible label names the server. A poor or lost connection replaces the dot with a warning glyph. The button opens the call room. Narrow windows show only the status; the name stays in the tooltip and accessible label. Microphone, camera, and screen share show a green glyph without a fill while they send media and show a neutral, slashed glyph while off. The microphone and camera controls keep a stable name and report their state as pressed. Leave shows a red hang-up glyph without a fill, in the header and in the call panel. Screen share is hidden where the browser or host cannot capture a screen, unless a share is running. The controls remain available when the viewer changes rooms or servers, or opens the call sidebar. Both toolbars share the media controls and place the microphone before the camera.

  • One app session can connect to only one call across its registered servers. Joining another call leaves the previous call first. Concurrent join requests run in order; a failed join does not block later requests. This limit does not coordinate separate browser tabs or devices.

  • While the viewer is connected to a call, supported browsers request a screen wake lock so the display does not automatically dim or lock. The lock is released when the call ends and requested again when the app returns to the foreground. Browsers that do not support or grant wake locks continue the call without this enhancement; a wake lock does not prevent mobile operating systems from suspending an app that the user backgrounds or manually locks.

  • Other rooms with an active call replace the normal room/DM icon with the same accent phone icon and animated pulse twin used by the call tab so members know there's a conversation happening; clicking that icon opens the room with the call tab selected and joins the call.

  • A deliberate selection of a call indicator joins the active call immediately. The indicators are the pulsing phone icon in the room list, the pulsing phone tab, the timeline "Join call" action, and the "Join" action of a call on the server Overview. The join applies the saved join-muted choice. If the viewer is in a different call, the client leaves that call first, without a confirmation. An indicator never starts a call. Without call.join, the indicator only opens the call tab. The incoming call alert opens the room and does not join.

  • Message author names show a compact call presence icon when the author is in the current room's active call: phone for voice-only participants, video camera when the viewer has joined the LiveKit call and can see an active camera track.

  • A call start appears in the room timeline as a system row naming the member who started it. While that exact call remains active, the row includes a "Join call" action that opens the room's call sidebar and joins the call. The final leave adds a separate "The active call has ended" row. Individual participant joins and leaves update call indicators and participant lists without adding timeline rows. Explicit user intent is recorded immediately, and LiveKit webhooks/reconciliation confirm or correct the active participant projection.

  • Losing room membership also removes the user from the room's active call. This includes voluntarily leaving the room, being removed by a moderator, being banned, and account-deletion cleanup. The affected client immediately hides that room's call roster and disconnects its local media when the membership change arrives. Chatto records the call leave from the membership transition and best-effort asks LiveKit to disconnect the participant; if that LiveKit removal fails, the room membership change still succeeds and reconciliation can catch up later.

  • Joined call participants hear fixed synthesized cues from durable participant join/leave events, including their own join/leave events and other participants in the same active call. These call cues are separate from configurable notification sounds and do not use notification sound filters; CallEndedEvent does not play a separate cue.

  • The first join starts a call session, creates fresh per-call E2EE key material, and records durable call lifecycle facts. The final leave ends the call, records the end fact, and shreds the call key.

  • Hanging up disconnects from LiveKit and clears the participant from everyone else's view.

  • New clients always enable LiveKit E2EE before connecting. Chatto distributes a KMS-backed per-call shared key with the LiveKit join token; the raw key is never written to EVT and is shredded when the call ends.

  • Screen sharing requests browser-tab audio when the browser supports it. In Chrome, the presenter must select a browser tab and enable Share tab audio in the browser picker. Chatto excludes whole-system audio so remote call playback is not captured and fed back into the room.

  • Screen-share state is LiveKit track state only. Users who have not joined the call still see who is in the active call, but they do not see whether a participant is sharing a screen.

  • Dismissing or denying the browser screen-share picker leaves the call connected without an error toast. The control returns to its ready state so the user can try again. Other capture failures still show an error.

  • Screen sharing is one call control on every host. In a web browser it opens the browser's own window/tab/screen picker. On macOS 15 and newer, Chatto Desktop instead opens a Chatto picker with static previews of ordinary visible application windows and complete displays. Selecting a window publishes its video and isolated owning-application audio; selecting a display is video-only so Chatto's remote call playback cannot be captured and echoed upstream. Native sharing offers multiple quality layers so LiveKit can match receiver size and network conditions while pausing unused layers. Browser and native sharing occupy one mutually exclusive share slot, while camera and microphone remain independent.

  • When LiveKit is not configured on the server, all voice UI is hidden — no button, no panel, no indicator.

Design Decisions

1. Call lifecycle and join/leave are durable room facts with internal source

Decision: CallStartedEvent, CallParticipantJoinedEvent, CallParticipantLeftEvent, and CallEndedEvent are persisted in the room EVT aggregate keyed by room ID, on evt.room.{roomId}.call_started, evt.room.{roomId}.call_joined, evt.room.{roomId}.call_left, and evt.room.{roomId}.call_ended. Explicit frontend join/leave writes use source USER; LiveKit webhook writes use source LIVEKIT; reconciliation writes use source RECONCILIATION. Public APIs expose active call state and call-start/end timeline rows without the internal source or E2EE key ref. Start and end facts drive room history as well as active call state, live indicators, and key lifecycle; participant transitions remain hidden from normal room history. Why: Calls are realtime/audit facts that should survive process restarts and be delivered through the same durable live EVT path as other room facts. Chatto's product model treats calls as always happening inside a room, with at most one active call per room. Rooms are intentionally cheap coordination spaces, so future private, temporary, or non-public calls can use short-lived rooms and inherit room membership, authorization, naming, visibility, and live-delivery behavior instead of introducing a separate call-membership model. Keeping source internal lets projections distinguish optimistic user intent from media-server observation without adding public API surface. Tradeoff: Duplicate user/LiveKit/reconciliation reports are collapsed at the call-state write boundary when they do not change participant state. A real join, leave, and later rejoin still records each transition as a distinct call session. The model uses the call projection's per-room applied sequence as the OCC token against evt.room.{roomId}.> so lifecycle and participant transitions are guarded by the room aggregate boundary across replicas. The design deliberately favors room-scoped calls over independent call aggregates; if calls later need their own durable lifecycle beyond the room boundary, new writes may need to move to a call aggregate while replaying legacy room-scoped facts.

2. Active call state is projection-backed and reconciled

Decision: Active participant snapshots and the active call session come from a call-state model/projection over durable call facts, not from MEMORY_CACHE. User joins can create pending/optimistic state; LiveKit and reconciliation facts confirm or correct it. Chatto includes the active Chatto callId in the LiveKit room name so LiveKit webhooks and reconciliation snapshots are applied only to the matching call session. On startup and periodically, Chatto compares active LiveKit rooms/participants to the projection and appends reconciliation facts for mismatches. If LiveKit cannot list rooms/participants for three consecutive elected reconciliation cycles, Chatto ends all projected active calls with reconciliation facts; before that threshold it defers cleanup. If LiveKit reports a room in ListRooms but returns not-found when participants are listed, Chatto treats that room as gone/empty and continues reconciling other rooms. Why: The UI needs current participant state, but it should not depend only on volatile KV state or only on historical replay. EVT gives durable audit/live delivery, while LiveKit reconciliation keeps "who is connected now" grounded in the media server. Tradeoff: The projection can briefly show optimistic state before LiveKit or reconciliation corrects it. If LiveKit reports the same already-active transition, the duplicate report is skipped instead of appending another public call event. A sustained LiveKit listing outage can end active calls after the shared failure threshold, favoring eventual UI recovery and unblocking new sessions while avoiding immediate cleanup for transient API failures. Multiple replicas may reconcile concurrently; call transition facts are OCC-gated on the room aggregate and rechecked after conflicts.

3. Graceful degradation when LiveKit isn't configured

Decision: When LiveKit credentials are absent, the call APIs return null/empty and the frontend hides the entire voice UI. Why: Self-hosters who don't want to run LiveKit (or haven't yet) shouldn't see dead UI affordances. Hiding the surface entirely is clearer than disabled buttons. See ADR-009. Tradeoff: Operators have to know LiveKit setup exists. Documented in setup guides.

4. Audio tracks must be explicitly attached

Decision: The frontend listens for RoomEvent.TrackSubscribed and calls track.attach() to wire LiveKit audio into a hidden <audio> element. On leave or TrackUnsubscribed, it calls track.detach(). Why: LiveKit delivers audio data over WebRTC, but the browser doesn't autoplay it without an attached element. Without explicit attach, the UI looks like everything works — participant rings even animate — but nobody hears anything. The pattern lives in apps/frontend/src/lib/state/voiceCall.svelte.ts; any refactor that touches LiveKit subscription handling needs to keep the track.attach() / track.detach() calls intact. Tradeoff: A subtle requirement that's easy to miss when refactoring; the skill warns explicitly.

The frontend writes remote audio diagnostics at Debug level with the [call-audio] prefix. It records participant and subscription events, playback status, and classified subscription and encryption failures. Every ten seconds, it records audio publication state, receiver and media-element state, and a limited set of receive counters. Compare successive counters to distinguish missing delivery from a decoding or playback problem. Missing statistics do not by themselves prove a failure.

The first entry records the LiveKit client version. Call, participant, session, publication, receiver, and RTP stream numbers are temporary aliases. These entries exclude names, account IDs, raw SDK IDs, error messages, device IDs, addresses, tokens, SDP, and audio content. Collection stops when the call is cleaned up, and late statistics are discarded. Repeated errors are limited to one entry per category and alias every ten seconds. The diagnostics do not change subscriptions or playback and do not send data to another service. For a call report, enable Debug or Verbose messages in the browser console, preserve the log before leaving, filter for [call-audio], and copy those entries. Other browser and SDK logs can contain private data and are outside this filter's privacy guarantees.

5. Voice activity fills the identity row

Decision: Soft, flowing accent-coloured fog illuminates each speaking participant's identity row. Calls measure microphone input before processing and decoded remote audio. SDK activity reports provide a fallback when measurement is unavailable or listener-local controls pause audio delivery. Microphone volume controls the fog's brightness, spread, and movement speed. Quiet speech produces a gentle drift; louder speech moves the fog faster. Three translucent layers of broad wisps move independently and overlap. Animated simplex noise gives them uneven density and shape. Speed changes smoothly. The glow responds quickly to speech and fades away in silence. Video and screen-share content stays clear. Muted microphones show no activity. Muting someone locally does not hide their speaking activity. Reduced motion keeps the glow stationary and updates its intensity without animation. Screen-share tiles do not show an audio meter. The SDK does not provide a separate screen-audio level. Activity feedback is limited to microphone tracks. Why: The card background makes active speakers easy to find without a pulsing outline or an extra status icon. The effect uses existing call audio levels and needs no additional audio capture or external connection. Tradeoff: Glow intensity conveys relative activity rather than a calibrated volume measurement. Only users who joined the call receive this feedback. Foreground measurements use one analysis-only audio context. Capture and playback do not pass through it. SDK fallback reports can respond more slowly.

6. Screen sharing is joined-client LiveKit track state

Decision: Screen/window/tab sharing uses LiveKit's browser screen-share publishing path and is represented by screen-share video plus optional browser-provided tab audio on joined clients. Chatto requests tab audio, publishes it with media-oriented stereo settings, and excludes whole-system audio. Chatto does not persist separate screen-share events, add public API fields, or expose screen-share state to call observers before they join. Why: Screen sharing is media-session state, and the existing durable room facts already answer the server-owned question of who is in the call. Keeping screen-share state inside LiveKit avoids adding durable state that can become stale when browser capture ends. Tradeoff: Non-joined observers know a call is active and who is in it, but not whether someone is sharing. Audio capture remains browser- and surface-dependent, and presenters must opt into tab audio in the browser picker.

7. Big-call mode is a desktop pane state, not a separate route

Decision: Maximized call mode expands the room call sidebar across the chat route content area while keeping the call visible at every viewport width. Below 1024 px, it hides the Server Sidebar and Server Gutter. At 1024 px and above, they stay visible. It is session-only UI state and uses one featured stage plus a secondary strip. A new screen share acquires an empty pin in all layouts. An existing pin protects the viewer's choice. Without a pin, the remote active speaker is featured; a new speaker must stay the loudest for a hold time, so short interjections do not move the stage. The viewer can pin any tile to the featured stage. A voice-only call uses an equal grid, also while someone speaks, because no participant has media that needs a large view and the speaking glow already shows who talks. Browser fullscreen of the call pane uses the same stage layout; a sidebar layout stretched across the screen wastes most of the space. Why: The sidebar keeps the featured source visible while the participant list scrolls, so a new share cannot appear outside the visible area when no other source is pinned. Calls remain room-scoped context, not a separate destination. Keeping the left navigation visible on larger screens lets users move between rooms. On smaller screens, the call takes priority over navigation. Tradeoff: The maximize control is available in the desktop call pane. A maximized pane stays visible when the viewport narrows. Other mobile call panes keep the existing overlay model.

8. Fullscreen and local mute are viewer-local controls

Decision: The fullscreen control uses the browser Fullscreen API on the complete call pane. Individual videos have a picture-in-picture control. Local mute changes only this viewer's local audio: remote participants are muted through LiveKit track delivery settings and remote participant volume, and local participant tiles reuse the viewer's microphone mute. Why: One fullscreen mode avoids conflicts between an individual tile and the complete call pane. Fullscreen and local mute are personal presentation choices. They should not create durable call facts, alter room state, or surprise other participants. Tradeoff: Local mute is intentionally not visible to other participants and does not change the remote participant's published mute state. Users need to distinguish it from the normal microphone mute indicator.

9. Test endpoints bypass webhook validation in build-tag mode

Decision: E2E tests use special /webhooks/test/call-join and /webhooks/test/call-leave endpoints that skip HMAC validation and call the core methods directly. Available only with -tags test_endpoints. Why: Real LiveKit isn't realistic to run in CI, but webhook flow is exactly the thing E2E tests need to exercise. Build-tag gating keeps the endpoints out of production. See ADR-020. Tradeoff: Two webhook entry points (real + test); test ones are well-isolated and trivially removable from prod builds.

10. E2EE keys are KMS-backed per-call secrets

Decision: voiceCallToken returns both token and e2eeKey. The first join for a room creates a new call ID and per-call E2EE key through Chatto's KMS boundary, stores the raw key in ENCRYPTION_KEYS under call.e2ee.{callId}, and records only the key ref in CallStartedEvent. The final leave records CallEndedEvent, then attempts idempotent key shredding. That event is also the durable trigger for the shared call-key cleanup consumer, which retries unfinished shredding across crashes and replicas. The frontend creates an ExternalE2EEKeyProvider, configures the LiveKit E2EE worker, sets the key, enables E2EE, then connects. Why: LiveKit E2EE key generation/distribution is application responsibility. Chatto already authorizes token access by room membership, so the token resolver is the narrow place to distribute the shared call key. Keeping the raw key out of EVT and normal backups avoids turning event-log copies into permanent decrypt material for captured media. Making the end fact the retry source closes the post-commit crash window without coupling recovery to LiveKit reconciliation. Tradeoff: Always-on E2EE breaks media compatibility with older clients that do not enable E2EE. Key deletion is at least once, so replicas may repeat the same idempotent shredding attempt; an unavailable KMS can briefly retain an ended call's key until retry succeeds. Restoring a backup without ENCRYPTION_KEYS cannot recover active call keys; active calls should be considered interrupted across such restores.

11. Screen sharing is one action with an optional native host capability

Decision: Voice controls expose one screen-share action. When the host advertises the narrow native screen-share capability, Chatto presents short-lived, single-use opaque window and display offers with in-memory previews in its own picker. Enumeration requires a user action, supersedes any earlier enumeration, and excludes Chatto Desktop's own windows. Without that capability, the action delegates to LiveKit and the browser's picker. Selecting a native source starts a publish-only LiveKit companion connection with its own opaque identity and the same per-call E2EE key. The frontend merges that connection's media into the owning member's logical participant, hides the companion as a separate tile, and never attaches the local owner's companion audio. Window capture publishes owning-application audio; full-display capture is video-only because system audio would contain remote call playback. Starting either implementation replaces the other; camera and microphone publications are unaffected. Why: One action matches the user's intent independently of where Chatto runs. The browser keeps its required security chooser, while native capture can add previews, deterministic source choice, and owning-application audio that Chromium's path cannot provide consistently. Direct native publication also avoids an H.264 decode, canvas copy, browser capture, and second WebRTC encode. The optional capability pattern from ADR-072 keeps platform knowledge out of the shared product state and leaves macOS, Windows, and feasible Linux providers independent. Tradeoff: Desktop source enumeration requires macOS Screen & System Audio Recording permission, and static previews can become stale before selection; the helper re-resolves the offered source, verifies a window still belongs to the enumerated application, and fails safely. Full-display viewers do not receive source audio until the native path can exclude Chatto's own playback before capture. The server must mint a separate short-lived publisher credential because reusing the member's LiveKit identity would disconnect their primary call connection. Webhooks and reconciliation exclude companion identities from durable call membership, while stale-room cleanup still removes them. The first macOS target publishes aspect-ratio-preserving H.264 quality classes with maximum edges of 1920, 1280, and 640 pixels at 60, 60, and 30 fps respectively. Encoding multiple layers can consume more publisher CPU and upload when receivers simultaneously request different qualities, while dynacast avoids that cost for unused layers. Actual cadence and quality remain dependent on the source, hardware encoder, network, SFU, and receiving device.

12. Active calls request a best-effort screen wake lock

Decision: While the viewer is connected to any call, the web client requests a screen wake lock from supporting browsers. Because browsers release locks when a document is hidden, the client requests a fresh lock after returning to the foreground. Ending the call releases the lock. Unsupported or rejected requests do not interrupt the call. Why: Preventing automatic display sleep reduces avoidable call interruption and friction on mobile devices while respecting the browser's power and permission policy. Tradeoff: The API can keep a visible screen awake, but it cannot guarantee background execution or override manual device locking, operating-system power policy, or browser suspension. Keeping the display on also uses more battery.

13. Owners check the LiveKit setup on the System page

Decision: The owner-only AdminDiagnosticsService.GetSystemInfo response includes LiveKit setup diagnostics. It reports whether LiveKit is enabled and configured, the LiveKit URL, the API key, whether webhooks use a separate signing key, and the webhook URL that LiveKit must call ({webserver.url}/webhooks/livekit). For each request, Chatto calls LiveKit ListRooms once with a RoomList grant and a five-second limit, and classifies the result as connected, unreachable, unauthorized, or error. It flags a ws:// or http:// LiveKit URL when the public server URL host is not a loopback address or a .localhost name. Each server process records the time of its last accepted and last rejected LiveKit webhook in memory. The System page shows a Calls health check only when LiveKit is configured, and a LiveKit tab with the details. The response never contains the API secret or the webhook signing secret. Why: Most self-hosted call failures are setup errors: an unreachable URL, wrong credentials, missing or badly signed webhooks, or an unencrypted URL. Operators can find these errors without a test call. A live API call proves reachability and credentials in one step. Tradeoff: Each page load or refresh makes one LiveKit API call and can take up to five seconds when LiveKit does not reply. Webhook times are per process and reset on restart, so a replica that did not receive webhooks shows none even when another replica did. Chatto cannot inspect TURN or LiveKit media network settings, so the page links to the TURN guide.

Permissions

All five permissions support Server, Room group, Room, and Direct messages scopes. DM checks use the shared Direct messages scope, not individual DM rules.

  • call.start — start a call; also requires call.join.
  • call.join — join an active call, including as a listener.
  • call.voice — publish microphone audio.
  • call.camera — publish camera video.
  • call.screenshare — share a screen, window, tab, or native application, including captured audio.

Call hosts, participant removal, and other management actions are deferred.

  • ADRs: ADR-009 (webhook-driven voice call state), ADR-012 (two-tier real-time events), ADR-020 (build-tag gated test endpoints), ADR-067 (Electron desktop packaging), ADR-069 (explicit durable consumer lifecycle), ADR-072 (optional host capabilities), ADR-091 (semantic realtime events), ADR-113 (one-time upgrade grants for new permissions)
  • FDRs: FDR-001 (Roles & Permissions), FDR-019 (Room Lifecycle), FDR-034 (Chatto Desktop), FDR-045 (Realtime Event Stream)

Open Questions

  • Should there be a dedicated voice.join permission so operators can disable voice in specific rooms/groups without touching room membership? Currently any room member can call.

Records that name this record

Esc