AI Phone Assistant — Twilio + OpenAI Realtime + Cloudflare Workers

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

Outbound Call Patterns

This template is inbound-first, but the same architecture also works well for outbound calling once you add a Twilio REST call trigger and a status callback endpoint.

Minimal Outbound Flow

  1. Your app creates a call through the Twilio REST API.
  2. Twilio requests a TwiML endpoint in your Worker.
  3. The TwiML response connects the call to your WebSocket stream.
  4. Your Durable Object runs the same OpenAI Realtime bridge used for inbound calls.
  5. Twilio posts lifecycle updates to a status callback endpoint.

Patterns Worth Keeping

Voicemail And Machine Detection

Production Scheduling

Good Use Cases

The important part is the pattern: Twilio starts the phone call, the Worker owns the live bridge, and your application owns the workflow state. Your application can be as simple as the same worker you’re using to handle the websockets, just writing out to emails and your database, or anything else you want to bind it to.