Connect a voice agent: LiveKit, Vapi and any SIP platform
Answer your bubblr line with your own voice AI over SIP: set up LiveKit or Vapi for inbound and outbound calls, check signatures, and transfer to people.
bubblr doesn't include a voice AI: you bring your own, built on LiveKit, Vapi or any platform that speaks SIP. bubblr answers the call on your line's number and connects it to your agent; your agent can also place calls from that number. Routing, caller ID, the call log and billing stay with bubblr.
Never use a platform's "import your phone number" option. It asks for credentials bubblr doesn't hand out, and taking the number away from bubblr would stop routing, the call log and your team's app from working. Connect over SIP as below.
How it works
- Incoming calls → your agent. You add the agent's SIP address as a voice endpoint, and choose a
call routing strategy that uses it (
ai_first,team_firstorai_after_hours). When a call comes in, bubblr calls that SIP address, with the username and password you gave (SIP digest), and adds five headers:X-Bubblr-Call-Id,X-Bubblr-Profile,X-Bubblr-From(the caller, E.164),X-Bubblr-DirectionandX-Bubblr-Signature. The SIPFromis the caller's number too. If the agent doesn't answer withinai_timeout_seconds(10 by default), the call goes to your team, then voicemail. - Your agent → anyone. Your platform sends calls to your team's dial-out address: the
sip_domainfromGET /v1/calling, with the SIP username and password your team got when calling was set up (a team admin can make a new password in the app). SendINVITE sip:<number to call>@<sip_domain>. The number you call from (the SIPFrom) must be the line's own number, or send the headerX-Bubblr-Profile: prf_…. bubblr checks the plan and the destination, then dials with the line's number as caller ID. The call shows in the call log withorigin: "sip". - Handing a caller back. Your agent calls
POST /v1/calls/{call_id}/transferwith an API key (calls:write) and the id fromX-Bubblr-Call-Id, toteam, a teammate, a number or another agent. For a call your agent placed itself, find the id withGET /v1/profiles/{profile_id}/calls?with=<number>&limit=1.
Adding the voice endpoint
curl -X POST https://api.bubblr.io/v1/profiles/prf_2Wq8nT4kLm/voice-endpoints \
-H "Authorization: Bearer $BUBBLR_API_KEY" -H "Content-Type: application/json" \
-d '{"kind": "sip", "name": "Receptionist agent", "sip_uri": "sip:+14155550123@agents.example.com;transport=tcp", "sip_username": "bubblr", "sip_password": "a-long-random-password"}'The answer includes signing_secret (vss_…), shown once. Then route calls to it and try it:
curl -X PUT https://api.bubblr.io/v1/profiles/prf_2Wq8nT4kLm/call-routing \
-H "Authorization: Bearer $BUBBLR_API_KEY" -H "Content-Type: application/json" \
-d '{"strategy": "ai_first", "endpoint_id": "vep_5Qs2hJ9nVb"}'
curl -X POST https://api.bubblr.io/v1/profiles/prf_2Wq8nT4kLm/voice-endpoints/vep_5Qs2hJ9nVb/test \
-H "Authorization: Bearer $BUBBLR_API_KEY"The test calls your agent with a short message; the outcome arrives as call.* events.
Checking the signature
Before your agent trusts the X-Bubblr-* headers, check X-Bubblr-Signature: t=<unix seconds>,v1=<hex>:
v1 = HMAC-SHA256(signing_secret, "<t>.<call_id>.<profile_id>.<from>.<direction>"), and refuse a t older than 5
minutes. With the SDK:
import { verifyVoiceSignature } from "@bubblr/sdk";
const trusted = await verifyVoiceSignature({
signature: headers["X-Bubblr-Signature"],
secret: process.env.BUBBLR_VOICE_SECRET!,
callId: headers["X-Bubblr-Call-Id"],
profileId: headers["X-Bubblr-Profile"],
from: headers["X-Bubblr-From"],
direction: headers["X-Bubblr-Direction"],
});LiveKit
LiveKit telephony, Cloud or self-hosted.
Inbound trunk. Save as
inbound-trunk.json, thenlk sip inbound create inbound-trunk.json:{"trunk": {"name": "bubblr", "numbers": ["+14155550123"], "auth_username": "bubblr", "auth_password": "<pick one>", "include_headers": "SIP_X_HEADERS", "headers_to_attributes": {"X-Bubblr-Call-Id": "bubblr.call_id", "X-Bubblr-Profile": "bubblr.profile", "X-Bubblr-From": "bubblr.from", "X-Bubblr-Direction": "bubblr.direction", "X-Bubblr-Signature": "bubblr.signature"}}}numbersis the line's number; it must match the part before@in step 3. Use a username and password, not an IP allowlist: calls don't come from fixed addresses.Dispatch rule (
lk sip dispatch create dispatch-rule.json), one room per caller with your agent in it:{"dispatch_rule": {"name": "bubblr", "rule": {"dispatch_rule_individual": {"room_prefix": "call-"}}, "room_config": {"agents": [{"agent_name": "my-agent"}]}}}Voice endpoint in bubblr (the app's Voice AI page, or the API above):
{"kind": "sip", "name": "LiveKit", "sip_uri": "sip:+14155550123@<your-project>.sip.livekit.cloud;transport=tcp", "sip_username": "bubblr", "sip_password": "<same>"}. The host is your project's SIP URI (project settings), withoutsip:. Then set routing toai_firstwith itsendpoint_id, and test.In the agent, the SIP participant's attributes carry
bubblr.call_idand the rest (sip.phoneNumberis the caller). Checkbubblr.signaturewith the endpoint's signing secret before trusting them.Outbound trunk (
lk sip outbound create outbound-trunk.json):{"trunk": {"name": "bubblr out", "address": "<sip_domain>", "numbers": ["+14155550123"], "auth_username": "<sip_username>", "auth_password": "<sip_password>", "transport": "SIP_TRANSPORT_TCP"}}One trunk per line (
numbers= that line's number), or one trunk with"numbers": ["*"]andsip_numberset per call. Place calls withCreateSIPParticipant {sip_trunk_id, sip_call_to: "+1…", room_name, …}.Transfers: call
POST /v1/calls/{call_id}/transferfrom an agent tool. LiveKit'sTransferSIPParticipant(transfer_to: "tel:+1…"or"sip:team@bubblr") sends a SIP REFER, which bubblr maps to the same transfer; prefer the API, which works in every case.
Vapi
Vapi SIP. Inbound and outbound are two Vapi phone numbers.
- Inbound: a Vapi SIP number.
POST https://api.vapi.ai/phone-number{"provider": "vapi", "sipUri": "sip:<your-name>@sip.vapi.ai", "assistantId": "…", "authentication": {"username": "bubblr", "password": "<pick one>"}}. Setauthentication: without it, Vapi accepts calls to that address from anyone. - Voice endpoint in bubblr:
{"kind": "sip", "name": "Vapi", "sip_uri": "sip:<your-name>@sip.vapi.ai", "sip_username": "bubblr", "sip_password": "<same>"}, routing as for LiveKit, then test. - In the assistant, Vapi turns SIP headers starting with
x-into template variables; the caller is{{customer.number}}. Look at the test call's log in Vapi to see the names it gives theX-Bubblr-*headers. - Outbound: a BYO SIP trunk pointing at your dial-out address.
POST https://api.vapi.ai/credential{"provider": "byo-sip-trunk", "name": "bubblr", "gateways": [{"ip": "<sip_domain>", "inboundEnabled": false, "outboundProtocol": "tcp"}], "outboundLeadingPlusEnabled": true, "outboundAuthenticationPlan": {"authUsername": "<sip_username>", "authPassword": "<sip_password>"}}, thenPOST https://api.vapi.ai/phone-number{"provider": "byo-phone-number", "name": "Line 1", "number": "+14155550123", "numberE164CheckEnabled": false, "credentialId": "<the credential's id>"}(one per line). Place calls withPOST https://api.vapi.ai/call {"assistantId": "…", "phoneNumberId": "<that number>", "customer": {"number": "+1…"}}. - Transfers: an API-request tool in the assistant that calls
POST /v1/calls/{call_id}/transfer. Vapi's owntransferCallplaces a new call instead, so it can't hand the caller back to your team.
Other platforms
Any platform that takes calls at a SIP address and places calls through a SIP trunk follows the same two halves
(ElevenLabs, a PBX). Agents without SIP can use a stream endpoint instead: the call's audio streams to your wss://
URL (8 kHz μ-law, JSON over WebSocket), with call_id, profile_id, from, direction and signature in the
stream's start message.