A programmable voice platform: SIP and WebRTC call control, multi-party mixing, recording, TTS/STT, and pluggable AI agents (ElevenLabs, VAPI, Pipecat, Deepgram
A programmable voice platform: SIP and WebRTC call control, multi-party mixing, recording, TTS/STT, and pluggable AI agents (ElevenLabs, VAPI, Pipecat, Deepgram
A Go service that bridges SIP and WebRTC voice calls with multi-party audio mixing, a REST API, and real-time webhooks.
json_base64 framing, configurable sample rate (8/16/24/48 kHz), bidirectional text, and caller-supplied X-/P- headers — designed to also back a future generic Agent APImengelbart/moqtransport (IETF draft-11); browser interop with draft-16 clients (moqtail, moq.dev) is not expected to work out of the box. Disabled by default; enable with MOQ_ENABLED=true + MOQ_TLS_CERT_FILE / MOQ_TLS_KEY_FILErole and declare a matrix of who-hears-whom by role. Applied atomically at leg-join time so a supervisor cannot momentarily bleed into the customer's audio. See API.md.m=audio sections in one dialog (RFC 3264), each with its own RTP port, direction, language and mixer room; built for live translation, where the original audio and a translated feed are mixed separately. Follows the SIPREC (RFC 7866) wire profile for interoperability. See API.md.SDP + rs-metadata INVITEs are answered receive-only on every m=audio section, and each section is bound to the participant the metadata names. The received audio is an ordinary set of leg streams, so it can be recorded to file and attached to rooms for live STT/agents. Disabled by default; enable with SIPREC_ENABLED=true (needs SIP_TCP_ENABLED=true). The metadata is checked against the SDP it arrived with, so a client that binds a participant to the wrong a=label -- a document that is otherwise valid and would silently attribute audio to the wrong party -- is reported in warnings on GET /v1/legs/{id}/siprec instead of being recorded as if it were correct. VoiceBlender can also act as the recording client, forking a room's participants to an external recording server one stream each (POST /v1/rooms/{id}/siprec, SIPREC_SRC_ENABLED=true). See API.md.stt.turn), including eager end-of-turn signals for speculative generation; Speechmatics reports end-of-turn from server-side silence detection and supports mid-stream finalizeevent_id (also sent as X-Event-Id) for receiver-side deduplication; typed event data with CDR-style leg.disconnected (disposition, timing, quality)GET /v1/vsi streams all events and accepts commands (mute, hold, DTMF, room management) over a single persistent WebSocket; filter by app_id regex for multi-tenant isolationGET /metrics (active legs/rooms, call durations, disconnect reasons, event-egress drop/delivery counters, Go runtime). See API.md for the full metric reference. Profiling via go tool pprof is available at /debug/pprof/ when built with -tags pprof.# Build and run
go build -o voiceblender ./cmd/voiceblender
./voiceblender
# Or run directly
go run ./cmd/voiceblenderThe REST API listens on :8080 and SIP on 127.0.0.1:5060 by default.
docker/docker-compose.cluster.yml brings up two VoiceBlender containers (dialer on host port 8080, peer on 8081) sharing the same voiceblender.env. Useful for end-to-end testing of inter-instance calls, REFER transfers, and webhook delivery between peers. Bring it up with:
docker compose -f docker/docker-compose.cluster.yml up --buildAll configuration is via environment variables. The full reference — every variable, its default and behaviour, plus the S3 bucket preflight rules — lives in CONFIGURATION.md.
A ready-to-edit file with every variable is committed as voiceblender.env.example.
Online documentation:
Full reference: API.md
API authentication. The HTTP surface — REST, the
/v1/vsievent WebSocket,/v1/legs/websocket, the/v1/legs/moqWebTransport endpoint,/metrics, and pprof — has no built-in credential authentication (no API key, bearer token, or session). Access is gated solely by theALLOWED_IPSallowlist and your network placement. Do not expose it to untrusted networks; front it with a reverse proxy or gateway that enforces auth if you need per-caller credentials. This is distinct from SIP-layer auth (digest challenge of inbound INVITE/REGISTER) and outbound webhook signing (WEBHOOK_SECRET), which are covered separately below.
……GET /v1/vsi # VoiceBlender Streaming Interface (VSI)POST /v1/webrtc/offer # SDP offer/answer exchange
POST /v1/legs/{id}/ice-candidates # Add trickle ICE candidate
GET /v1/legs/{id}/ice-candidates # Get gathered ICE candidates…Inbound INVITE and REGISTER are handled symmetrically: every inbound request is
surfaced to the client (an INVITE via leg.ringing, a REGISTER via
sip.registration_attempt), which may challenge it (e.g. based on its source
address). VoiceBlender replies 401 with a digest WWW-Authenticate and
verifies the credentialed retry itself against the supplied password/ha1.
INVITE challenges target the ringing leg by id; REGISTER attempts are
challenged/accepted/rejected by attempt_id.
If the client does not decide, the two differ: an unchallenged INVITE simply
keeps ringing and remains answerable (nothing is auto-answered), while an
undecided REGISTER falls back to SIP_INBOUND_REGISTER_DEFAULT after the consult
window — reject (403) by default (fail-closed), or accept to bind it.
VoiceBlender can REGISTER itself to an upstream SIP registrar/PBX as a UAC,
refresh the binding before expiry, place outbound calls under the registered
identity, and accept inbound INVITEs the registrar delivers. Only the
sip_register trunk type is implemented today; ip_ip is reserved.
POST /v1/sip/trunks # Create a trunk; 202 Accepted, REGISTER runs async
GET /v1/sip/trunks # List configured trunks
GET /v1/sip/trunks/{id} # Trunk status snapshot (never returns password)
DELETE /v1/sip/trunks/{id} # Unregister + remove (202 Accepted, async)Outbound calls placed with POST /v1/legs whose from matches a registered
trunk's AOR (or AOR user-part) automatically attach the trunk's digest
credentials and traverse the trunk's upstream via a Route header — the trunk's
outbound_proxy when one is configured, otherwise its registrar_uri.
Such calls also send From and P-Asserted-Identity in the trunk's AOR realm
rather than SIP_DOMAIN, so the call claims the identity the registrar
actually authenticated. An AOR port, if configured, is not carried into the
From — sip:[email protected]:5070 yields a From host of
pbx.example.com.
Changed outcome. This can flip how an upstream responds to calls that previously went out under
SIP_DOMAIN. A registrar that accepted them un-challenged may now challenge them — which resolves on its own for a correctly provisioned trunk, since the digest credentials are already attached, but surfaces as a401/407failure for one with stale credentials. It can flip the other way too: a registrar that rejected an unknown From domain may now accept the call. There is no toggle. The only way to keepSIP_DOMAINon the From is to use afromthat matches no trunk AOR and no trunk AOR user-part, which also drops the trunk's credentials and Route.
By default a trunk talks straight to its registrar_uri. Set
sip_register.outbound_proxy to put an SBC or edge proxy in front:
{
"type": "sip_register",
"sip_register": {
"registrar_uri": "sip:pbx.example.com:5060",
"outbound_proxy": "sip:edge.acme.net:5060;transport=tcp",
"aor": "sip:[email protected]",
"password": "s3cret"
}
}Every INVITE placed from that AOR then carries
Route: . The REGISTER is sent to the
same hop but without a pre-loaded Route — a proxy that does not recognise
the Route URI as one of its own forwards the REGISTER back at itself instead of
popping the header, and the registration fails with no response at all. Either
way the Request-URI still names the registrar, and digest authentication still
computes against it — only the next hop changes. The field defaults to SIP_OUTBOUND_PROXY and is resolved
when the trunk is created, so GET /v1/sip/trunks/{id} reports the hop actually
in effect.
A single call can override this with outbound_proxy on POST /v1/legs, which
also wo
No open issues yet, or sync has not completed.