Skip to main content
Twilio’s Media Streams API sends raw audio from a call over a WebSocket to your server. Your server opens a Humain Kiosk session, proxies the audio stream, and returns AI-generated audio back to the caller — all in real time.
Store your credential as an environment variable. Never hard-code hk_live_… tokens in source files, dialplans, or configuration files committed to version control. Use an environment variable (HUMAIN_CREDENTIAL) or a secrets manager and inject the value at runtime.

How it works


TwiML response

When Twilio calls your webhook, respond with this TwiML to start the audio stream:
Replace {session_id} with the ID returned by POST /v1/sessions.

Webhook handler


Twilio console configuration

  1. In the Twilio Console, open Phone Numbers → Manage → Active numbers.
  2. Click your number and scroll to Voice Configuration.
  3. Set A call comes in → Webhook → https://your-server.example.com/incoming-call (HTTP POST).
  4. Set Call status changes → https://your-server.example.com/call-status (HTTP POST).
  5. Save.
Your webhook server must be publicly reachable by Twilio. During local development, use ngrok or the Twilio CLI to expose your local port.

Testing

Use the Twilio CLI to place a test call:
Or dial your Twilio number from any phone.