ElevenLabs's ElevenAgents -AgentStream Integration
12 min
connect an exotel phone call to an elevenlabs conversational ai https //elevenlabs io agent over agentstream audio stays speech to speech exotel pcm ↔ your bridge ↔ elevenlabs convai sample code integrations/elevenlabs https //github com/exotel/agent stream/tree/main/integrations/elevenlabs in the agent stream https //github com/exotel/agent stream repo if you have not set up connect yet, start with connect voice ai with agentstream docid xb3tdmzuz6jbcqdsboqd what you get outbound (or inbound via applet) calls that talk to your elevenlabs agent bidirectional pcm on agentstream a production oriented python bridge under integrations/elevenlabs/exotel/bridge py before you start item notes elevenlabs agent id + api key exotel account sid, api key, api token, exophone python 3 10+ virtualenv recommended public wss cloudflared or ngrok for the first test audio tip in the elevenlabs agent, set output to pcm 8000 when available that avoids a 16→8 khz resample and reduces “slow” or muddy voice on the phone install git clone https //github com/exotel/agent stream git cd agent stream cp shared/env exotel example shared/ env exotel \# fill exotel account sid, exotel api key, exotel api token, exotel caller id cd integrations/elevenlabs python3 m venv venv && source venv/bin/activate pip install r exotel/requirements txt export elevenlabs agent id="your agent id" export elevenlabs api key="your api key" export elevenlabs region="default" # default | us | eu | india export bg sound volume="0" # 0 = no background ambience while testing run the bridge and open a tunnel terminal a cd integrations/elevenlabs source venv/bin/activate python exotel/bridge py port 10002 \\ \ agent id "$elevenlabs agent id" \\ \ api key "$elevenlabs api key" the bridge listens on 0 0 0 0 10002 path /v1/convai/conversation/exotel terminal b cloudflared tunnel url http //127 0 0 1 10002 \# note the https //… trycloudflare com host — use wss\ // with the same host place a connect call from the repo root set a && source shared/ env exotel && set +a python shared/place connect call py \\ \ to +91xxxxxxxxxx \\ \ stream url "wss\ //your cloudflare host/v1/convai/conversation/exotel" streamurl wss\ //host/v1/convai/conversation/exotel port 10002 answer the handset the agent should greet at normal pitch and respond when you speak verify voice is not slow or unusually deep (if it is, set agent output to pcm 8000 or confirm resample logs) bridge logs show media flowing and a first audio ms=… style line when audio starts call lasts well beyond a few seconds (very short hangups usually mean a bad streamurl or the receive loop blocked) go live checklist bridge runs on a stable host with a real tls certificate for wss\ // api keys only in env / secret store agent audio format set for telephony ( pcm 8000 preferred) background sound volume set intentionally (or 0 ) monitoring on process health and websocket disconnects load tested concurrent calls for your expected traffic this sample is a solid bridge for pilots high concurrency still needs horizontal scale (multiple bridge instances behind a wss load balancer), timeouts, and ops metrics troubleshoot symptom what to check call drops in 4 seconds streamurl path wrong; tunnel down; bot not accepting wss slow / deep voice agent still on 16 khz pcm played as 8 khz — prefer pcm 8000 or confirm bridge resample agent parrots the caller prompt / conversation override and half duplex behaviour in the bridge readme no agent audio api key, agent id, region, and elevenlabs console errors related repo readme integrations/elevenlabs/readme md connect voice ai api https //docs exotel com/exotel agentstream/connect voice ai api openai realtime agentstream integration docid\ t3ukaryxrfdiutrpue79n sarvam ai agentstream integration docid\ os9lcvtosfqtjzly qmvu
