AI Voice · ElevenLabs ConvAI

Set up two-way voice for your ElevenLabs AI agent

This tutorial connects an ElevenLabs Conversational AI agent to PSTN through a DIDHub SIP trunk so your agent can both receive calls on a real phone number and place outbound calls. Bridge layer: Twilio-style BYOC compatible bridge (LiveKit, Pipecat, or custom).

Prerequisites: An ElevenLabs ConvAI agent already created and tested in the playground, a DIDHub account, and one DID provisioned (any country).

Step 1: Provision a SIP trunk in DIDHub

Dashboard → SIP Trunks → New trunk. Choose authentication mode:

# Trunk credentials shown after creation
SIP server   : sip.didhub.io
SIP port     : 5060 (UDP) or 5061 (TLS)
Username     : trunk_a4f9c2
Password     : "<copy from dashboard>"
Codecs       : PCMU, PCMA, OPUS

Step 2: Bridge layer — LiveKit Agents (recommended)

ElevenLabs ConvAI runs over a WebSocket; PSTN runs over SIP. LiveKit Agents handles the SIP ↔ WebSocket bridge for free.

# livekit-sip-trunk.yaml
trunk_id: didhub-elevenlabs
inbound_addresses: ["sip.didhub.io"]
outbound_address: sip.didhub.io
outbound_username: trunk_a4f9c2
outbound_password: "$DIDHUB_TRUNK_PASSWORD"
numbers: ["+15551234567"]
krisp_enabled: true
lk sip dispatch create --trunk-id didhub-elevenlabs --rule '{"dispatchRuleIndividual":{"roomPrefix":"call-"}}'

Step 3: Wire ElevenLabs ConvAI to LiveKit

# LiveKit agent (Python)
from livekit.agents import AgentSession
from livekit.plugins import elevenlabs

session = AgentSession(
    stt=elevenlabs.STT(api_key="$ELEVENLABS_API_KEY"),
    llm=elevenlabs.LLM(agent_id="$ELEVENLABS_AGENT_ID"),
    tts=elevenlabs.TTS(voice_id="21m00Tcm4TlvDq8ikWAM"),
)
await session.start(room=ctx.room)

Step 4: Bind the DID in DIDHub

Numbers → +1 555 123 4567 → Routing → SIP Trunk: didhub-elevenlabs. Save. Inbound calls now hit your LiveKit room which spawns the ElevenLabs agent.

Step 5: Place an outbound call

curl -X POST https://api.livekit.io/twirp/livekit.SIP/CreateSIPParticipant \
  -H "Authorization: Bearer $LK_TOKEN" \
  -d '{
    "sip_trunk_id": "didhub-elevenlabs",
    "sip_call_to": "+15557654321",
    "room_name": "call-outbound-001",
    "participant_identity": "elevenlabs-agent"
  }'

Audio quality checklist

What you just built

An ElevenLabs ConvAI agent that answers a real phone number with sub-300ms first-token latency, supports two-way calling, and runs entirely on standard SIP — portable to any provider that follows BYOC conventions.

Ready to get a number?

Pick a DID in 130+ countries from $1.99/month. Activates instantly on most numbers.