assistant-api supports five telephony providers. Each is identified by a string constant defined in api/assistant-api/internal/channel/telephony/telephony.go.
Provider Comparison
| Provider | Transport | Audio Format | Region |
|---|---|---|---|
| Twilio | WebSocket (Media Streams) | μ-law 8kHz | Global |
| Vonage | WebSocket | Linear PCM 16kHz | Global |
| Exotel | WebSocket | μ-law 8kHz | India / SEA |
| Asterisk AudioSocket | Raw TCP 0.0.0.0:4573 | Linear PCM 8kHz | Self-hosted PBX |
| Asterisk WebSocket | WebSocket (chan_websocket) | μ-law 8kHz | Self-hosted PBX |
| SIP | UDP 0.0.0.0:5090 + RTP | PCM | Direct SIP / SIP trunks |
Twilio, Vonage, and Exotel are cloud providers — they call your server. You need
PUBLIC_ASSISTANT_HOST set to a public HTTPS hostname (use ngrok locally).Asterisk AudioSocket and WebSocket run on your own PBX — Asterisk connects out to Rapida.SIP is a built-in server in assistant-api — any SIP client can call it directly.URL Routing Pattern
All telephony paths follow this structure (source:api/assistant-api/internal/type/telephony.go):
| Path | Method | Purpose |
|---|---|---|
/v1/talk/{provider}/call/{assistantId} | POST / GET | Inbound call webhook (provider → Rapida) |
/v1/talk/{provider}/ctx/{contextId} | WebSocket | Bidirectional audio stream |
/v1/talk/{provider}/ctx/{contextId}/event | POST | Status / lifecycle events |
contextId is created on the first webhook hit and binds the conversation to a provider session. It is stored in PostgreSQL with the assistant ID, conversation ID, and auth token.
Inbound Call Flow
What’s Next
Running with a Provider
Step-by-step setup for Twilio, Vonage, Exotel, Asterisk AudioSocket, Asterisk WebSocket, and SIP.
Adding a New Provider
Implement the Telephony interface and register a new provider in the factory.
ngrok — Local Testing
Expose your local Rapida instance to Twilio, Vonage, and Exotel for development.
Configuration
All env vars: PUBLIC_ASSISTANT_HOST, SIP, AudioSocket, and more.