How to make an outbound voice bot detect voicemail and leave a message (Pipecat and Twilio)
Confirmed by source: Official open-source framework docs with code. Checked live on 2026-10-25: voicemail and Twilio WebSocket guides return 200; VoicemailDetector exists in pipecat-ai/pipecat (src/pipecat/extensions/voicemail, repo pushed 2026-10-25, pipecat-ai 1.14.0 on PyPI) along with the LLM classifier; the twilio-chatbot/outbound example exists in pipecat-ai/pipecat-examples (pushed 2026-10-20). Not run by BranoLabs (no real calls placed). (checked 2026-10-25)
The problem
Many outbound calls, such as appointment reminders or callbacks, end up on voicemail. A bot that starts its conversation script at the greeting talks over it and leaves a garbled or empty message. You want the bot to tell a person from a voicemail greeting within moments, talk normally to people, and leave one clean message after the beep otherwise.
Tools needed
- Pipecat (open-source Python voice-agent framework) with VoicemailDetector
- Twilio Media Streams over WebSocket for dial-out
- A classifier: TypeSafe's JevClassifier or an LLMClassifier on a small fast model
- Speech-to-text, LLM and text-to-speech services (the example uses Deepgram, OpenAI and Cartesia)
- ngrok for local testing, or Pipecat Cloud
Step-by-step recipe
- Start from Pipecat's Twilio dial-out example (pipecat-examples/twilio-chatbot/outbound): a Twilio number, Twilio credentials plus STT, LLM and TTS API keys in .env, ngrok to expose the server, and uv sync to install.
- Create a VoicemailDetector with a classifier: JevClassifier (needs the pipecat-ai[typesafe] extra and a TypeSafe key, answers in about a tenth of a second) or an LLMClassifier wrapping a small, fast model.
- Insert the detector into the pipeline: detector() between speech-to-text and the user context aggregator, and gate() directly after text-to-speech. The bot's first reply is generated as usual but held until the verdict.
- Handle on_voicemail_detected: push a TTSSpeakFrame with your message (who is calling, why, how to call back) and then an EndWorkerFrame, so the call ends after the message has played.
- Optionally handle on_conversation_detected to log that a person answered; the held reply is released automatically.
- Tune decision_timeout (default 1 s of caller silence before deciding) and voicemail_response_delay (default 2 s of quiet after a voicemail verdict before speaking) against the greetings your calls actually reach.
- Place test calls to your own phone, once answering and once letting it go to voicemail, and listen to the recorded message.
Copyable prompt
Voicemail message (spoken once after the beep, under 20 seconds): Hello, this is [AGENT NAME], an automated assistant calling for [BUSINESS NAME] about [REASON, e.g. your appointment on DATE]. Please call us back at [CALL-BACK NUMBER, spoken slowly] or [ALTERNATIVE, e.g. reply to our SMS]. Thank you, goodbye. Classifier instructions (if you use an LLMClassifier): Calls go to [WHO, e.g. private customers in Germany, often after hours]. Greetings may be in [LANGUAGES]. A carrier mailbox message such as [EXAMPLE PHRASE] counts as voicemail.
Original template written by our AI agent for AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.
What the builder reported
Official Pipecat documentation for voicemail detection with complete code for the detector, pipeline placement, the voicemail and conversation events and timing options, plus a maintained Twilio dial-out example in the pipecat-ai/pipecat-examples repository. Pipecat reports the Jev classifier answers in about a tenth of a second; no call-volume results are published.
These are the source author's own claims. AgentRecipes has not run this recipe itself.
Watch out for
- Classification time is silence a real person hears after saying hello; an LLM classifier is slower than Jev, so use a small, fast model.
- Raise decision_timeout if greetings with long pauses get treated as people; lower it to answer people faster.
- Since Pipecat 1.12.0 the detector takes a classifier; the old llm and custom_system_prompt parameters are deprecated and will be removed in 2.0.0.
- Pick a current model for the classifier: the docs' LLM example uses gpt-4o-mini, which OpenAI has scheduled for removal on 14 January 2027.
- Automated outbound calls and voicemail drops are regulated in many countries (consent, calling hours, caller ID); check before calling customers.
- You pay Twilio per minute plus each STT, LLM and TTS provider, or Pipecat Cloud if you deploy there.
Source
Original write-up: Pipecat docs ↗
Found via Pipecat docs: “Twilio WebSocket Integration”. This recipe summarises the source in words written by our AI agent; read the original for the full details. Link last checked 2026-10-25.
More voice & phone agents recipes
New agent recipes in your inbox
A short email with the newest automation recipes, each linked to its real-world source. No spam. Every email has a one-click unsubscribe link.