assistant-api with each supported telephony provider. Choose your provider below.
For Twilio, Vonage, and Exotel you need a public HTTPS hostname — see the ngrok guide for local development.
For Asterisk and SIP, your server connects out to Rapida, so no public URL is required on your end.
Required Environment Variable
All telephony providers (except SIP) require one shared env var:Twilio
Store vault credentials
In the Rapida dashboard go to Credentials → Create Credential, select provider type Twilio, and enter:
Credentials are encrypted at rest in the vault.
| Key | Description |
|---|---|
account_sid | Your Twilio Account SID (ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) |
account_token | Your Twilio Auth Token |
Configure the phone number webhook
In the Twilio Console → Phone Numbers → Manage → Active numbers, select your number and set:
Replace
| Field | Value |
|---|---|
| Voice webhook (HTTP POST) | https://{PUBLIC_ASSISTANT_HOST}/v1/talk/twilio/call/{assistantId} |
| Status callback URL | https://{PUBLIC_ASSISTANT_HOST}/v1/talk/twilio/ctx/{contextId}/event |
{assistantId} with the numeric assistant ID from the Rapida dashboard.What Rapida returns
When Twilio hits the webhook, Rapida responds with TwiML that opens a bidirectional Media Stream:Audio is μ-law 8kHz, base64-encoded per the Twilio Media Streams spec.
PUBLIC_ASSISTANT_HOST must be HTTPS — Twilio rejects plain HTTP webhooks.Vonage
Store vault credentials
In Credentials → Create Credential, select provider type Vonage:
| Key | Description |
|---|---|
api_key | Vonage API key |
api_secret | Vonage API secret |
application_id | Vonage Application ID (JWT auth) |
private_key | Vonage Application private key (PEM, JWT auth) |
Configure the Vonage application answer URL
In the Vonage Dashboard → Applications, open your voice application and set:
| Field | Value |
|---|---|
| Answer URL (POST) | https://{PUBLIC_ASSISTANT_HOST}/v1/talk/vonage/call/{assistantId} |
| Event URL (POST) | https://{PUBLIC_ASSISTANT_HOST}/v1/talk/vonage/ctx/{contextId}/event |
Exotel
Store vault credentials
In Credentials → Create Credential, select provider type Exotel:
| Key | Description |
|---|---|
api_key | Exotel API key |
api_secret | Exotel API secret |
account_sid | Exotel Account SID |
Configure the ExoPhone app
In the Exotel Dashboard → ExoPhones, assign your ExoPhone an App and set the passthru URL to:Rapida responds with Exotel passthru XML that opens a WebSocket stream.
Exotel operates in India and South-East Asia. Make sure
PUBLIC_ASSISTANT_HOST is reachable from Exotel’s servers (public HTTPS, not localhost).Asterisk — AudioSocket
AudioSocket uses a native raw TCP protocol. Asterisk connects to Rapida over TCP port4573 using the contextId as the session identifier.
When to use: Asterisk 16+, private/LAN network, lowest latency.
Confirm required env vars
assistant-api binds a TCP AudioSocket server on AUDIOSOCKET__PORT at startup.Configure the dialplan
CHANNEL(audioreadformat)=slin and CHANNEL(audiowriteformat)=slin are required — AudioSocket expects signed 16-bit linear PCM.Outbound calls via ARI (AudioSocket)
For outbound calls, Rapida uses Asterisk’s ARI to originate the call. The dialplan receives theRAPIDA_CONTEXT_ID channel variable set by ARI:
| Key | Required | Description |
|---|---|---|
ari_url | Yes | ARI base URL, e.g. http://asterisk.local:8088 |
ari_user | Yes | ARI username |
ari_password | Yes | ARI password |
endpoint_technology | No | Channel technology — default PJSIP |
trunk | No | SIP trunk name, builds PJSIP/trunk/number |
Asterisk — WebSocket
WebSocket useschan_websocket over standard HTTPS/WSS. No custom TCP port required.
When to use: Asterisk 20+, cloud-hosted Asterisk, NAT traversal scenarios.
Outbound calls via ARI (WebSocket)
AudioSocket vs WebSocket — Quick Comparison
| AudioSocket | WebSocket | |
|---|---|---|
| Asterisk version | 16+ | 20+ |
| Module | res_audiosocket | chan_websocket |
| Protocol | Raw TCP port 4573 | WSS (HTTPS port) |
| Firewall | TCP 4573 must be open | Standard HTTPS only |
| Audio codec | SLIN 16-bit 8kHz | μ-law 8kHz |
| Latency | Lowest | Slightly higher |
| TLS built-in | No | Yes (native WSS) |
SIP
Theassistant-api runs a built-in SIP server. Any SIP client can call it directly — no external provider account needed.
Dial from any SIP client
Use this connection string from any SIP phone, softphone, or PBX:
| Field | Value |
|---|---|
assistantID | Numeric assistant ID from the Rapida dashboard |
apiKey | Rapida API key scoped to the project (rpd-xxx) |
SIP__EXTERNAL_IP | Public IP set in env var |
SIP__PORT | 5090 (default) |
Related
ngrok — Local Testing
Use ngrok to test Twilio, Vonage, and Exotel webhooks from your local machine.
Adding a New Provider
Implement the Telephony interface to support a new provider.
Configuration
Full env var reference for PUBLIC_ASSISTANT_HOST, SIP, and AudioSocket.
Telephony Overview
Provider comparison table and URL routing reference.