Why ngrok is Required
Twilio, Vonage, and Exotel use a two-step call setup:- They send an HTTP POST webhook to your server when a call arrives
- They open a WebSocket to your server to stream bidirectional audio
You need a single ngrok tunnel pointing to port
8080 (the Nginx gateway). All webhook and WebSocket traffic flows through Nginx and is proxied to assistant-api.Prerequisites
Step-by-Step Setup
1
Install and authenticate ngrok
2
Start the tunnel
https:// URL — this is your PUBLIC_ASSISTANT_HOST.The free tier generates a random URL on each restart. To get a stable URL across restarts, use a paid ngrok plan with a reserved domain.
3
Update PUBLIC_ASSISTANT_HOST in assistant-api
Edit
docker/assistant-api/.assistant.env:4
Update media URL in the UI config
Edit The
ui/src/configs/config.development.json:media field is the public URL the browser and telephony providers use for WebSocket connections.5
Restart assistant-api and the UI
6
Verify the tunnel is proxying correctly
Configuring Twilio for Local Testing
With ngrok running, point your Twilio phone number’s webhook to:- Inbound call
- Outbound call
- Open Twilio Console → Phone Numbers → Active Numbers
- Select your number
- Under Voice Configuration, set:
- Call the number — Twilio posts the webhook to ngrok, which forwards to your local assistant-api
Configuring Vonage for Local Testing
Point your Vonage Application’s Answer URL to:- Open Vonage Dashboard → Applications → select your app
- Under Capabilities → Voice → Answer URL, set the URL above
- Set Event URL to:
https://abc123.ngrok-free.app/v1/talk/vonage/ctx/{contextId}/event
Configuring Exotel for Local Testing
In your Exotel App (applet), set the webhook URL to:Two Configurations Always Need Updating
When your ngrok URL changes (e.g., after a free-tier restart), update both of these:
Then restart:
Stable URLs (Recommended for Team Development)
Using a random URL is inconvenient for team development since the webhook URL in Twilio/Vonage must be updated every time ngrok restarts. Options for a stable URL:
With a static/reserved domain, you set the webhook URL in Twilio/Vonage once and never update it.
Troubleshooting
Webhook returns 502 Bad Gateway
Webhook returns 502 Bad Gateway
The Rapida stack is not running. Verify:
Audio connects but there is no voice / silence
Audio connects but there is no voice / silence
PUBLIC_ASSISTANT_HOST is still set to the old ngrok URL or to localhost. Update it to the new ngrok hostname and run make rebuild-assistant.ngrok shows 'ERR_NGROK_3200: tunnel not found'
ngrok shows 'ERR_NGROK_3200: tunnel not found'
The tunnel is not running. Start it again:And update both
PUBLIC_ASSISTANT_HOST and connection.media with the new URL.Twilio error: 'Not a valid https URL'
Twilio error: 'Not a valid https URL'
Twilio requires HTTPS. ngrok provides HTTPS automatically. Do not use the
http:// version of the URL — always use the https://abc123.ngrok-free.app URL in Twilio’s console.Next Steps
Telephony Setup
Full provider setup — Twilio, Vonage, Exotel, Asterisk, SIP.
Configuration
All PUBLIC_ASSISTANT_HOST and SIP variables.