AgentRecipes
Recipes › Voice & phone agents

How to make an outbound voice bot detect voicemail and leave a message (Pipecat and Twilio)

Voice & phone agentsPipecat✓ Confirmed by source

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

Step-by-step recipe

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. Optionally handle on_conversation_detected to log that a person answered; the held reply is released automatically.
  6. 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.
  7. Place test calls to your own phone, once answering and once letting it go to voicemail, and listen to the recorded message.

Copyable prompt

Prompt template
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

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

Set up an AI phone receptionist that books, reschedules and cancels appointments (Vapi)A small business such as a barbershop or clinic misses calls while staff are busy, and most of those calls are simple: book a slot, move…Vapi✓ Confirmed by sourceAnswer calls after hours with an ElevenLabs voice agent and get a summary of every call (Twilio)Calls that come in at night or at weekends go to a voicemail box nobody checks until the next morning, and the caller often never calls…ElevenLabs Agents✓ Confirmed by sourcePlace outbound reminder and callback calls with Twilio and OpenAI GPT-LiveAppointment reminders, delivery updates and promised callbacks are phone calls staff keep forgetting to make. You want a script that…Twilio✓ Confirmed by source

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.