Docs menu

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_first or ai_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-Direction and X-Bubblr-Signature. The SIP From is the caller's number too. If the agent doesn't answer within ai_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_domain from GET /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). Send INVITE sip:<number to call>@<sip_domain>. The number you call from (the SIP From) must be the line's own number, or send the header X-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 with origin: "sip".
  • Handing a caller back. Your agent calls POST /v1/calls/{call_id}/transfer with an API key (calls:write) and the id from X-Bubblr-Call-Id, to team, a teammate, a number or another agent. For a call your agent placed itself, find the id with GET /v1/profiles/{profile_id}/calls?with=<number>&limit=1.

Adding the voice endpoint

Shell
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:

Shell
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:

TypeScript
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.

  1. Inbound trunk. Save as inbound-trunk.json, then lk sip inbound create inbound-trunk.json:

    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"}}}

    numbers is 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.

  2. Dispatch rule (lk sip dispatch create dispatch-rule.json), one room per caller with your agent in it:

    JSON
    {"dispatch_rule": {"name": "bubblr", "rule": {"dispatch_rule_individual": {"room_prefix": "call-"}},
      "room_config": {"agents": [{"agent_name": "my-agent"}]}}}
  3. 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), without sip:. Then set routing to ai_first with its endpoint_id, and test.

  4. In the agent, the SIP participant's attributes carry bubblr.call_id and the rest (sip.phoneNumber is the caller). Check bubblr.signature with the endpoint's signing secret before trusting them.

  5. Outbound trunk (lk sip outbound create outbound-trunk.json):

    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": ["*"] and sip_number set per call. Place calls with CreateSIPParticipant {sip_trunk_id, sip_call_to: "+1…", room_name, …}.

  6. Transfers: call POST /v1/calls/{call_id}/transfer from an agent tool. LiveKit's TransferSIPParticipant (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.

  1. 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>"}}. Set authentication: without it, Vapi accepts calls to that address from anyone.
  2. 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.
  3. 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 the X-Bubblr-* headers.
  4. 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>"}}, then POST 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 with POST https://api.vapi.ai/call {"assistantId": "…", "phoneNumberId": "<that number>", "customer": {"number": "+1…"}}.
  5. Transfers: an API-request tool in the assistant that calls POST /v1/calls/{call_id}/transfer. Vapi's own transferCall places 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.

Keys come with your first line.

Request an invite and we'll set up a line for your team. API access is part of every plan.

Request an invite