Skip to main content

Voice Mail Detection

Voice Mail Detection allows you to automatically handle voicemail scenarios when making outbound calls with a VideoSDK AI agent. When an outbound call is forwaded to a voicemail system, the detector triggers a callback so your agent can take the action such as leaving a voicemail message or ending the call.

What Problem This Solves

In outbound calling workflows, unanswered calls are often routed to voicemail systems. Without detection, agents may continue speaking or wait unnecessarily.

Voice Mail Detection lets you:

  • Detect voicemail systems automatically
  • Control how your agent responds
  • End calls cleanly after voicemail handling
info

To set up an outbound calling, and routing rules check out the Quick Start Example.

Enabling Voice Mail Detection

To use voicemail detection, import and add VoiceMailDetector to your agent configuration and register a callback that defines how voicemail should be handled.

from videosdk.agents import VoiceMailDetector
from videosdk.plugins.openai import OpenAILLM

async def voice_mail_callback(message):
print("Voice Mail message received:", message)

voicemail = VoiceMailDetector(
llm=OpenAILLM(),
duration=5,
callback=custom_callback_voicemail,
)

session = AgentSession(
voice_mail_detector=voicemail
)

Parameters

ParameterDescription
llmLLM to process the detected voicemail.
durationThe minimum period of silence (in seconds) that triggers voicemail detection.
callbackA function that is called whenever a voicemail is detected, allowing for custom actions like hanging up or leaving a message.

Example - Try It Yourself

Got a Question? Ask us on discord