Skip to main content

Module backend

Module backend 

Source

Structs§

AudioFrame
A mono PCM audio frame plus its sample rate — the unit streamed into a call via push_audio / out of one via subscribe_received_audio. A mono PCM (s16) audio frame plus its sample rate — the unit fed into a call via push_audio and handed out of one via subscribe_received_audio.
BaresipBackend
Backend that uses libbaresip directly via FFI (no process spawning, no ctrl_tcp wire protocol). libre and libbaresip are built from the vendored submodules and statically linked into the binary.
Session
A live backend session. Dropping this tears down the backend (stops the process / closes the library) and cleans up resources.

Traits§

Backend
A backend provides SIP user-agent functionality — library init, event translation and the phone command interface. The FFI backend links libbaresip directly (statically with vendored, or dynamically via pkg-config).

Functions§

available_audio_codecs
The audio codecs this baresip build has registered (name + real srate/ch). Empty until a session has started the RE thread.
call_count
Returns the total number of active calls across all UAs. Used by ringo-flow to wait for BYE flush before dropping sessions.
is_registered
Returns true if any UA is still registered. Checks uag_list() on the RE thread without holding the lock. Used by ringo-flow to wait for ua_unregister to complete between scenarios.
push_audio
Append mono s16 samples to the agent’s stream-in queue (see start_audio_stream). No-op until a stream has been started for key.
received_audio
Recently received (decoded) mono audio for the UA with audio key key (the account username), plus its sample rate. Captured in-process by ringo’s own audio player, so ringo-flow can verify a received tone without reading baresip’s sndfile recordings. None if no audio has been received yet.
sent_audio
Recently sent (rendered) mono audio for the UA with audio key key, plus its sample rate. Only populated when full capture is enabled (--save-audio); otherwise empty. Used by ringo-flow to save the sent recording.
shutdown
Shut down the backend’s global runtime: hang up calls, tear down the user agents, stop the event loop and join its thread. Call once at process exit; a no-op if the backend was never started. Agnostic façade over the concrete backend’s teardown (the FFI backend stops its libre event thread here).
sip_trace_file
Trace every SIP request/response to path (its own file, separate from the log). Call before the first session is spawned — the handler is installed during baresip init.
sip_trace_stderr
Trace every SIP request/response to stderr (separate from the log).
start_audio_stream
Switch the agent’s audio source to live-streamed mono s16 PCM at rate Hz (key = the audio key / account username). Samples fed via push_audio are played in real time; before any arrive (or on underrun) the source is silent. This is the inbound half for live audio (e.g. TTS into the call).
subscribe_received_audio
Subscribe to the agent’s received (decoded) audio as live mono AudioFrames — the outbound half for live audio (e.g. feeding STT). Replaces any previous subscription for key.