Expand description
Run a SIP user agent as its own process, driven over a framed stdio protocol (length-prefixed JSON control frames interleaved with raw PCM audio frames).
A consumer drives an agent via ProcessClient (spawned with
ProcessClient::spawn), which forks a child that re-execs the host
binary’s agent subcommand — the host wires that subcommand to
worker::run. Each agent is its own process, with its own SIP socket and
media stack, so several can run side by side without sharing the SIP stack’s
process-global state — which a single shared process can’t do once incoming
calls must each be routed to the right agent.
Public surface: ProcessClient + AgentConfig to drive an agent,
worker::run (the worker entry the host re-execs), and audio (tone
analysis / WAV helpers). The framed wire protocol is an internal detail.
Modules§
- audio
- Tone detection on received call audio (for
verify-audio) and WAV output (for--save-audio). - worker
- The agent worker: one process, one registered UA (with
catchall), driven over stdio with theprotoframed protocol. Because each worker is its own process it binds its own SIP socket, so the provider routes incoming calls to this registration by contact address — which in-process multi-UA cannot do (one shared socket, and the request-URI user need not identify the UA, so there’s no way to demux).
Structs§
- Agent
Config - The full agent configuration the parent sends as the worker’s first stdin
line (before any command/query). Carrying it on stdin rather than argv keeps
credentials out of the process table. The
Account/BackendOptionsare embedded verbatim (they areSerialize/Deserializein ringo-core), so the worker rebuilds the exact account the in-process path would — adding a field to either struct can’t silently drift out of sync. - Audio
Frame - Re-exported so a consumer of
ProcessClient::start_rx_audiocan name the streamed frame type without also depending onringo-core. A mono PCM audio frame plus its sample rate — the unit streamed into a call viapush_audio/ out of one viasubscribe_received_audio. A mono PCM (s16) audio frame plus its sample rate — the unit fed into a call viapush_audioand handed out of one viasubscribe_received_audio. - Process
Client - Handle to one agent worker process. Spawn it with
ProcessClient::spawn, then drive it: fire-and-forget call-control commands, blocking queries (media stats, received DTMF, tone analysis, …), and anAppEventstream (returned byspawn). Dropping it deregisters and reaps the worker. - Saved
Audio - One WAV written by
ProcessClient::save_audio_detailed: which side of the call it holds, how much audio it contains, and whether the recording hit the retention cap (only the newestringo_core::RECORDING_MAX_SECSseconds are kept).