How can I implement voicemail detection (AMD) in a dialplan?
2026-04-02You can implement voicemail detection using a custom dialplan in Asterisk with the AMD() application.
Important:
There is no universal configuration. AMD parameters depend heavily on:
- Country
- Landline and Mobile Carriers
- Audio quality
- Language and voicemail behavior
Best practice:
- Start with standard parameters
- Record and analyze real calls
- Tune based on your own environment
Example Dialplan (basic AMD implementation):
;; START AMD_CHECKER
;same => n,AMD(${INITIALSILENCE}, ${GREETING}, ${AFTERGREETINGSILENCE}, ${TOTALANALYSIS}, ${MINIUMWORDLENGTH}, ${BETWEENWORDSILENCE}, ${MAXIMUMNUMBEROFWORDS}, ${SILENCETHRESHOLD}, ${MAXIMUMWORDLENGTH})
same => n,AMD(2500, 1500, 800, 5000, 100, 50, 4, 256, 1500)
same => n,NoOp(AMD STATUS ${AMDSTATUS})
same => n,ExecIf($["${AMDSTATUS}"="MACHINE"]?WaitForSilence(2200,1,25))
same => n,NoOp(WAITSTATUS ${WAITSTATUS})
same => n,ExecIf($["${AMDSTATUS}"="MACHINE"]?Background(custom/fAudioVoicemailMessage))
same => n,ExecIf($["${AMDSTATUS}"="MACHINE"]?UserEvent(ATTRIBUTE,Uniqueid:${UNIQUEID},APPT:VOICEMAIL))
same => n,ExecIf($["${AMDSTATUS}"="MACHINE"]?UserEvent(CALLSTATUS,Uniqueid:${UNIQUEID},V:VOICEMAIL)
same => n,ExecIf($["${AMDSTATUS}"="MACHINE"]?Hangup())
;;; END AMD CHECKER