https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do make the agent end the call when it reaches...
# ❓・ai-evy-support
m
@AI Evy how do make the agent end the call when it reaches the voicemail of these type The mailbox is full" or " The voicemail box is full" or "The voicemail box has not been set up yet" or "Press 1 or 0 for more options".
a
Thanks for tagging me @Md Adnan. I'll look through relevant sources and get back to you shortly.
### Answer To handle voicemail scenarios and have the agent end the call, you can use the
voicemail_option
configuration. [(1) ]() [(2) ]() To hang up when voicemail is detected, set the
voicemail_message
to an empty string:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
  response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
  voice_id: '11labs-Adrian',
  enable_voicemail_detection: true,
  voicemail_message: ""
}) ;
[(1) ]() Key settings: - `enable_voicemail_detection`: Set to
true
to detect whether the call enters a voicemail (only available for phone calls) . - `voicemail_message`: Set to an empty string (
""
) if you want to hangup after hitting voicemail. - `voicemail_detection_timeout_ms`: Configures when to stop running voicemail detection (default is 30,000 ms / 30 seconds) . However, the specific voicemail messages you mentioned ("The mailbox is full", "The voicemail box has not been set up yet", "Press 1 or 0 for more options") are not explicitly documented as configurable detection triggers. The voicemail detection feature will try to detect voicemail in the first 3 minutes of the call, but the exact phrases it recognizes are not specified in the available sources. For more granular control over specific voicemail message types, you may need to reach out to support: - [Contact Sales]() - [Retell AI GitHub]() Would you like a general answer on how you might handle this through prompt engineering or custom logic?
​ To learn more, see the sources I considered: [[1] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[2] Update Voice Agent](https://docs.retellai.com/api-references/update-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy i want to leave the voicemail but sometimes it reaches ivr or some company voicemails where it was unable to detect and the call go on till max duration reach
a
Thanks for the follow-up, @Md Adnan. I'll get back to you soon.
### Answer The voicemail detection feature has a configurable timeout via
voicemail_detection_timeout_ms
, which stops detection after a set period (default 30,000 ms / 30 seconds, with a maximum of 180,000 ms / 3 minutes) . [(1) ]() [(2) ]() For cases where detection fails (IVRs, company voicemails, etc.) , you have a few options: 1. Adjust the detection timeout:
Copy code
javascript
voicemail_detection_timeout_ms: 30000
[(1) ]() The minimum value is 5,000 ms and maximum is 180,000 ms (3 minutes) . 2. Set a maximum call duration as a fallback:
Copy code
javascript
max_call_duration_ms: 3600000
This will force end the call if reached. The minimum is 60,000 ms (1 min) and maximum is 7,200,000 ms (2 hours) . However, the sources do not document a way to configure detection for specific phrases like "mailbox is full" or "press 1 for more options." The voicemail detection works automatically but the exact detection logic/phrases are not exposed for customization. A community member also noted issues with voicemail detection "talking over the answering machine messages and ignoring the beep." [(3) ]() For more granular control over IVR/voicemail edge cases, you may need to contact support: - [Contact Sales]() - [Retell AI GitHub]() Would you like a general answer on potential workarounds?
​ To learn more, see the sources I considered: [[1] Create Voice Agent](https://docs.retellai.com/api-references/create-agent) [[2] Update Voice Agent](https://docs.retellai.com/api-references/update-agent) [[3] Discord message from @nick.voice.ai on 2025-01-13](https://discord.com/channels/1186424376300679209/1294891368505937952/1328457163093442570) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.