Asterisk Voicemail Detection: How to Set Up AMD on Your Asterisk PBX
Complete guide to implementing voicemail detection on Asterisk PBX systems. Learn configuration, best practices, and integration strategies.
Marketing Team
VM Hunter
Asterisk remains one of the most popular open-source PBX systems for call centers and VoIP operations worldwide. Yet many Asterisk deployments are still using basic or outdated voicemail detection methods that don't take advantage of modern AI-powered accuracy.
If you're running an Asterisk system, understanding how to properly configure voicemail detection is critical to maximizing efficiency and compliance. This guide walks you through everything you need to know.
Why Voicemail Detection Matters for Asterisk Systems
Asterisk powers outbound calling for thousands of contact centers, telemarketers, and customer service operations globally. For these operations, voicemail detection isn't optional — it's the difference between efficient operations and wasted resources.
When your Asterisk dialer connects to a number without proper voicemail detection:
- Agents spend time listening to voicemail greetings, destroying agent utilization
- False positives hang up on real customers, creating compliance issues
- Call quality and customer experience suffer from dropped calls
- Compliance reports show high abandoned call rates
Proper Asterisk voicemail detection implementation prevents all of this.
Understanding Asterisk and AMD Architecture
How Asterisk Handles Call Detection
Asterisk processes incoming audio through its dialplan — the set of instructions that control what happens when a call connects. The dialplan can be configured to:
- Monitor audio characteristics (energy levels, silence, duration)
- Listen for specific tones (DTMF, answering machine beeps)
- Analyze speech patterns
- Route calls based on detection results
Historically, Asterisk relied on applications like:
- ZAPM — Tone-based detection looking for answering machine beeps
- Asterisk Built-in AMD — Basic timing heuristics in the core dialplan
- Custom AGI scripts — Asterisk Gateway Interface scripts written in various languages
Each of these approaches has limitations, which we'll address.
The Dialplan Layer
In Asterisk, voicemail detection logic typically lives in the dialplan. Here's a simplified example of traditional Asterisk AMD:
exten => _X.,1,Answer
exten => _X.,n,AMD(initialSilence=2500,greeting=1500,afterGreetingSilence=800,totalAnalysisTime=5000,silenceThreshold=256)
exten => _X.,n,GotoIf($["${AMDSTATUS}"="MACHINE"]?hangup:agent)
exten => _X.,n(hangup),Hangup()
exten => _X.,n(agent),Dial(SIP/agent)
This uses Asterisk's built-in AMD, which analyzes timing. The parameters control:
- initialSilence: Time to wait before detection starts
- greeting: Expected voicemail greeting duration
- afterGreetingSilence: Expected silence after greeting
- totalAnalysisTime: Maximum time to analyze before making a decision
The problem: These timing parameters are not universal. They work for some greetings and fail on others.
Traditional Asterisk AMD Limitations
Problem 1: Timing-Based False Negatives
Modern voicemail greetings are brief. "Hi, this is Mike — leave a message" might be 1.5 seconds. Asterisk's built-in AMD, configured for 2-3 second greetings, routes it to an agent.
An agent hears the beep, realizes it's a machine, and hangs up. 8 seconds of productive time wasted.
Problem 2: False Positives on Business Greetings
A business professional: "Good afternoon, this is Sarah Martinez with accounting. How can I help you?" That's 5+ seconds. The timing heuristics classify it as voicemail and disconnect.
Problem 3: Parameter Tuning Nightmare
Different carriers, regions, and calling patterns require different parameter sets. What works for a domestic consumer campaign might fail for international B2B calls.
Most operations spend weeks tweaking these parameters and never get them quite right. They end up with a compromised setting that's suboptimal for all scenarios.
Problem 4: No Confidence Scoring
Traditional Asterisk AMD returns binary results: MACHINE or HUMAN. There's no confidence level. You can't distinguish between "definitely voicemail" and "probably voicemail."
Modern Asterisk Voicemail Detection: Integration Approaches
Approach 1: AGI-Based Integration
Asterisk's Gateway Interface (AGI) allows external programs to control call routing. You can write an AGI script that:
- Captures audio from the Asterisk channel
- Sends it to a modern voicemail detection API
- Receives classification results
- Routes the call accordingly
Implementation:
exten => _X.,1,Answer
exten => _X.,n,AGI(detection.php)
exten => _X.,n,GotoIf($["${DETECTION_RESULT}"="HUMAN"]?agent:hangup)
exten => _X.,n(agent),Dial(SIP/agent)
exten => _X.,n(hangup),Hangup()
Your AGI script (e.g., detection.php) would:
<?php
$socket = fopen('unix:///var/run/asterisk/agi', 'r+');
// Read AGI environment
while (!feof($socket)) {
$line = trim(fgets($socket));
if (empty($line)) break;
$agi[$line[0]] = $line;
}
// Capture audio and send to detection service
$audio = capture_channel_audio();
$response = call_detection_api($audio);
// Set detection result
fwrite($socket, "SET VARIABLE DETECTION_RESULT {$response['classification']}
");
fclose($socket);
?>
Pros:
- Works with existing Asterisk infrastructure
- Flexible — can use any external detection service
- Can implement complex logic
Cons:
- Requires custom script development
- Adds processing latency (audio capture, API call, network round-trip)
- Requires maintaining custom code
Approach 2: REST API Integration with Dialplan
Modern Asterisk versions support CURL in the dialplan, allowing direct API calls:
exten => _X.,1,Answer
exten => _X.,n,MixMonitor(${UNIQUEID}.wav)
exten => _X.,n,Wait(0.5)
exten => _X.,n,Set(DETECTION_URL=https://api.vmhunter.com/detect)
exten => _X.,n,CURL(${DETECTION_URL}?token=${API_KEY},OUTPUT_VAR)
exten => _X.,n,GotoIf($["${OUTPUT_VAR}"="human"]?agent:hangup)
exten => _X.,n(agent),Dial(SIP/agent)
exten => _X.,n(hangup),Hangup()
Pros:
- No custom scripting required
- Modern, standardized approach
- Easier to integrate updates
Cons:
- Network dependency — detection latency depends on API response time
- Requires Asterisk version with CURL support (Asterisk 13+)
Approach 3: Embedded Detection Service
For operations requiring sub-50ms latency, running a detection service locally on your Asterisk server (or nearby) eliminates network round-trips.
This could be:
- A containerized AI model running locally
- A dedicated hardware appliance connected via SIP
- A separate server handling detection via local API
Pros:
- Sub-50ms latency
- No external network dependency
- Maximum control
Cons:
- Requires infrastructure investment
- Need to maintain detection model updates
- More complex deployment
Best Practices for Asterisk Voicemail Detection
1. Use Real Call Data to Tune Parameters
Before deploying, capture 1,000+ real calls from your specific calling patterns. Test detection against this dataset and measure false positive and false negative rates.
Don't rely on vendor claims or lab benchmarks. Your results will be different.
2. Implement Confidence Scoring
If your detection service provides confidence scores, use them:
exten => _X.,n,GotoIf($["${CONFIDENCE}" > "0.98"]?route:manual_review)
exten => _X.,n(route),GotoIf($["${CLASSIFICATION}"="human"]?agent:hangup)
exten => _X.,n(manual_review),Dial(SIP/supervisor)
Route low-confidence classifications to supervisors for manual review.
3. Monitor and Log Detection Results
Capture:
- Classification results (human/voicemail)
- Confidence scores
- Actual call outcomes (did the agent connect? Was there a human?)
- False positive and false negative counts
This data is critical for optimization and troubleshooting.
4. Implement Gradual Rollout
Don't switch your entire operation overnight. Start with a subset of campaigns:
- Week 1: Test with 5% of traffic, compare against current detection
- Week 2: Expand to 20% if metrics look good
- Week 3: Expand to 50%
- Week 4: Full deployment
This approach catches issues before they impact your entire operation.
5. Set Up Alert Thresholds
Monitor key metrics continuously:
- False positive rate > 1% → alert
- False negative rate > 2% → alert
- API latency > 200ms → alert
- Detection service availability < 99.9% → alert
6. Maintain Fallback Logic
If your detection service becomes unavailable, have a fallback strategy:
exten => _X.,n,GotoIf($["${DETECTION_AVAILABLE}"="yes"]?modern_detection:legacy_amd)
exten => _X.,n(modern_detection),CURL(...)
exten => _X.,n(legacy_amd),AMD(...)
Common Implementation Pitfalls and Solutions
Pitfall 1: Insufficient Initial Silence
Voicemail greetings often start immediately after answer. If your detection service waits too long for initial silence before starting analysis, it might miss the beginning of the greeting.
Solution: Capture audio from the moment the call is answered, not after an artificial delay.
Pitfall 2: Network Latency Causing Dropped Calls
If detection takes 2-3 seconds and your call is routed after that delay, callers may hang up before connecting to an agent.
Solution: Use latency < 100ms. If your current approach is slower, consider local deployment or pre-connection detection.
Pitfall 3: Misconfigured Silence Parameters
If detection times out waiting for silence that never comes (or comes too quickly), it falls back to default behavior, which might be wrong.
Solution: Test with your actual call characteristics and adjust parameters based on real data, not guesses.
Pitfall 4: Ignoring Call Quality
Compressed or poor-quality audio (common on mobile networks) can reduce detection accuracy.
Solution: Understand how quality variations affect your specific detection service and adjust confidence thresholds accordingly.
Measuring Success
After implementing Asterisk voicemail detection, track these metrics:
| Metric | Baseline | Target |
|---|---|---|
| False positive rate | 5% | < 0.5% |
| False negative rate | 15% | < 1% |
| Agent time per false negative (seconds) | 8-10 | 2-3 |
| Abandoned call rate | 8-12% | < 2% |
| Agent utilization | 70% | 80%+ |
| Call connection time (seconds) | 2-3 | < 0.5 |
The financial impact: A 50-person call center running 50,000 calls/day could save $200,000-$400,000 annually by moving from legacy to modern detection.
Conclusion
Asterisk voicemail detection has evolved from simple timing heuristics to sophisticated AI-powered classification. If you're still using Asterisk's built-in AMD, the upgrade path is straightforward and doesn't require replacing your entire PBX.
Modern integration approaches (AGI, REST API, or embedded services) allow you to add 99.7% accurate detection to your existing Asterisk infrastructure with minimal disruption.
The question isn't whether to upgrade — it's how quickly you want to realize the efficiency gains.
Start your free trial — deploy modern voicemail detection on your Asterisk system with no installation required. No credit card needed.