TwilioPaul KampTutorial
Make Outbound Calls with Twilio Voice and Media Streams, GPT-Live-1 in the OpenAI API, and Node.js
Summary
This tutorial shows how to build an outbound AI voice agent that uses Twilio Programmable Voice and Media Streams to call a permitted phone number, rather than waiting for inbound calls. It connects the call to GPT-Live-1 in the OpenAI API through a Node.js server, with Fastify, ws, dotenv, and the Twilio helper library handling the application and relay. The implementation reads the destination from a --call flag, validates E.164 formatting, exposes the server through a public tunnel, and uses environment variables for credentials and the calling number. Owlie identifies itself as an AI assistant, retrieves a callback note with get_callback_reason, delegates factual questions to hosted web_search, and can be interrupted during speech. The completed demo rings the chosen number, explains why it is calling, and can return random callback notes or web-searched answers, while the tutorial stresses verified numbers, model access, and outbound-calling compliance.
Context
The tutorial addresses outbound callbacks such as appointment reminders and delivery updates, where an AI agent needs to initiate a phone call. It also notes that outbound calling requires permitted numbers, model access, and compliance with applicable regulations, including the TCPA in the United States.
Approach / What changed
A Node.js application uses Twilio Programmable Voice to place the call and Media Streams to relay audio to GPT-Live-1. Fastify, ws, dotenv, and the Twilio helper library support the server, while a public tunnel exposes it. The agent uses get_callback_reason for callback notes and hosted web_search for factual questions.
Takeaways
The destination is supplied with the --call flag and rejected before dialing if it does not match the expected E.164 format.
The assistant uses get_callback_reason for the callback note and OpenAI's hosted web_search for factual questions.
The demo requires a Twilio Voice number, an allowed destination, GPT-Live-1 access, Node.js 22 or later, and a publicly reachable server.
Source and freshness
- Source
- twilio.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.