intercom
Two-way audio / talk-back cap.
Two-way audio / talk-back cap. Clients open a WebRTC audio-only session (server-initiated offer pattern, identical to the main video WebRTC flow) and the browser captures the mic; the server receives Opus RTP via werift, decodes through ffmpeg, re-encodes to the firmware's expected codec (Reolink: IMA ADPCM), and pipes it onto the camera's dedicated talk channel.
All audio transcoding happens server-side — clients don't need to know the camera's wire format. The ability cached in status exposes the firmware's codec/sampleRate only for display/debug; the client never has to act on those values.
At a glance
| Capability | intercom |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | camera |
| Source | packages/types/src/capabilities/intercom.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
startSession | mutation | yes | protected |
handleAnswer | mutation | yes | protected |
stopSession | mutation | yes | protected |
startTalkSession | mutation | yes | protected |
pushTalkAudio | mutation | yes | protected |
endTalkSession | mutation | yes | protected |
startSession
mutation
Open a server-side WebRTC audio-only session. Returns an SDP offer with a single sendonly audio m-line the client answers (client → server direction). The server wakes battery cams transparently before opening the upstream talk channel.
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | yes | |
sdpOffer | string | yes |
handleAnswer
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | yes | |
sdpAnswer | string | yes |
Output
Nothing.
stopSession
mutation
Close explicitly. Server also auto-closes on 30s idle.
Input
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | yes |
Output
Nothing.
startTalkSession
mutation
Open a raw-PCM talk session (no WebRTC SDP plumbing). Used by non-WebRTC consumers (HomeKit export, Alexa raw audio, test harnesses) that already have decoded PCM frames and just need a direct path onto the camera's talk channel. Mutually exclusive with startSession (an active WebRTC session must be stopped before a raw-PCM session can be opened on the same device, and vice versa).
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
sessionId | string | yes |
pushTalkAudio
mutation
Push one chunk of talk-back audio onto the active talk session. The cap is codec-agnostic: the caller declares (or omits) the wire format via codec; the provider decides between passthrough (when the wire codec matches the camera's native talk channel), transcoding via the audio-codec cap, or rejecting the call.
Callers do NOT need to know the camera's wire format or sample rate — that information lives entirely inside the provider.
Sequence numbers MUST be monotonic per talk session; older frames arriving after newer ones are dropped to avoid smearing the downstream encoder state (G.711 is stateless but IMA ADPCM's predictor would corrupt with re-ordering).
Input
| Field | Type | Required | Description |
|---|---|---|---|
audioBase64 | string | yes | Audio bytes for ONE frame, base64-encoded so the payload survives tRPC JSON serialization. |
codec | "opus" | "s16le" | "g711ulaw" | "g711alaw" | no | Wire codec of the payload. Omit to let the provider default to its native expected format (s16le @ provider-native rate, mono). See { |
sampleRate | number | no | Sample rate (Hz). REQUIRED for s16le; advisory for opus (encoder clock); ignored for g711* (implied 8000). |
channels | number | no | Channel count. Default 1. |
sequenceNumber | number | yes | Sequence number for ordering / dropping out-of-order frames. |
Output
| Field | Type | Required | Description |
|---|---|---|---|
accepted | boolean | yes |
endTalkSession
mutation
Close the raw-PCM talk session. Idempotent.
Input
No fields besides deviceId.
Output
Nothing.
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Runtime-state slice — mirrored by the kernel.
The cap declared status and nothing else, so the only two sources an exporter has for a value — the device.state-changed slice event and the deviceState.getAllSnapshots snapshot, both built from runtime state — carried nothing for intercom. A talk-back entity in Home Assistant would have been published and never received a value, which is the defect the export's two classification tables exist to prevent (177 of them, once), so intercom was excluded rather than exported.
The shape is the status shape: there is exactly one truth about talk-back and duplicating it into a second schema is how two halves of one capability come to disagree. Providers write it through this.runtimeState.setCapState('intercom', …) at the four points that open and close a session, and seed it at registration so the slice exists before the first session rather than after it.
Bound, named rather than hidden: talking mirrors the provider's own session handle, so a session torn down by a transport death that never reaches stopSession / endTalkSession leaves it latched until the next session or the next restart. That is why the slice is session and not restored — a restart must never restore "talking".
| Field | Type | Required | Description |
|---|---|---|---|
talking | boolean | yes | True while a talk session is open. |
lastSessionAt | number | null | yes | Ms epoch of the most recent session start. Null if never opened. |
ability | { codecs: string[]; sampleRate: number; duplex: "half" | "full"; maxBacklogMs: number } | null | yes | Firmware ability cached at first session creation. Null until probed. |
Events
onStatusChanged
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
status | { talking: boolean; lastSessionAt: number | null; ability: { codecs: string[]; sampleRate: number; duplex: "half" | "full"; maxBacklogMs: number } | null } | yes |