Skip to main content
ElevenLabs Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Voicemail detection

The Voicemail Detection tool allows your ElevenLabs agent to automatically identify when a call has been answered by a voicemail system rather than a human. This system tool enables agents to handle automated voicemail scenarios gracefully by either leaving a pre-configured message or ending the call immediately.

  • Automatic Detection: The LLM analyzes conversation patterns to identify voicemail systems based on automated greetings and prompts
  • Configurable Response: Choose to either leave a custom voicemail message or end the call immediately when voicemail is detected
  • Call Termination: After detection and optional message delivery, the call is automatically terminated
  • Status Tracking: Voicemail detection events are logged and can be viewed in conversation history and batch call results

Parameters:

  • reason (string, required): The reason for detecting voicemail (e.g., "automated greeting detected", "no human response")

Function call format:

JSON
{
  "type": "function",
  "function": {
    "name": "voicemail_detection",
    "arguments": "{\"reason\": \"Automated greeting detected with request to leave message\"}"
  }
}

The voicemail detection tool can be configured with the following options:

Voicemail detection configuration
interface

  • Voicemail Message: You can configure an optional custom message to be played when voicemail is detected. This message supports dynamic variables, allowing you to personalize voicemail messages with runtime values such as {{user_name}} or {{appointment_time}}

When creating an agent via API, you can add the Voicemail Detection tool to your agent configuration. It should be defined as a system tool:

Python
from elevenlabs import AgentConfig, ConversationalConfig, ElevenLabs

elevenlabs = ElevenLabs(api_key="YOUR_API_KEY")

response = elevenlabs.conversational_ai.agents.create(
    conversation_config=ConversationalConfig(
        agent=AgentConfig(
            prompt={
                "built_in_tools": {
                    "voicemail_detection": {
                        "type": "system",
                        "name": "voicemail_detection",
                        # Optional: customize when the tool should be triggered
                        "description": "",
                        "params": {
                            "system_tool_type": "voicemail_detection",
                            # Optional: message left when voicemail is detected
                            "voicemail_message": "Sorry I missed you. I'll call back later.",
                        },
                    }
                }
            },
        ),
    ),
)
JavaScript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";

const elevenlabs = new ElevenLabsClient({
  apiKey: "YOUR_API_KEY",
});

await elevenlabs.conversationalAi.agents.create({
  conversationConfig: {
    agent: {
      prompt: {
        builtInTools: {
          voicemailDetection: {
            type: "system",
            name: "voicemail_detection",
            description: "", // Optional: Customize when the tool should be triggered
            params: {
              systemToolType: "voicemail_detection",
              // Optional: message left when voicemail is detected
              voicemailMessage: "Sorry I missed you. I'll call back later.",
            },
          },
        },
      },
    },
  },
});
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu