Template for deploying an AI voice assistant with Twilio, OpenAI Realtime API, and Cloudflare Workers
View the Project on GitHub jmoore2333/twilio-openai-voice-assistant-cloudflare-template
The template includes a small optional outbound route so you can trigger a Twilio call from your own app without building a bigger campaign system first.
POST /voice/outbound creates an outbound call through the Twilio REST APIPOST /voice/outbound/twiml<Connect><Stream> TwiMLPOST /voice/status receives Twilio lifecycle callbacksTWILIO_ACCOUNT_SIDTWILIO_PHONE_NUMBEROUTBOUND_API_TOKENIf any of those are missing, the outbound starter route returns a configuration error and stays inactive.
curl -X POST https://<your-worker-subdomain>.workers.dev/voice/outbound \
-H "Authorization: Bearer <OUTBOUND_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"to": "+15551234567",
"machineDetection": true,
"timeoutSeconds": 30
}'
to: required destination phone number in E.164 formatmachineDetection: optional booleantimeoutSeconds: optional ring timeout from 5 to 60 seconds