LineVaults
Integration · Asterisk

Asterisk answering machine detection in one EAGI call

LineVaults delivers Asterisk answering machine detection as a single EAGI application in your dialplan. It takes the place of AMD(), sets the same AMDSTATUS variable plus an AMDCAUSE, and hands the call back to AMD() whenever it can't judge it.

1. Requirements

ItemRequirement
AsteriskVersion 13 or newer; EAGI is built in
Python3.6 or newer, standard library only
NetworkOutbound TLS on port 443 to amd.linevaults.com
Clientlinevaults.agi.py in /var/lib/asterisk/agi-bin/, mode 755
CredentialsAn API key from the dashboard; the Sandbox plan is free

2. The dialplan change

Find the line that runs AMD() after Answer() and swap it for four lines. The first is the detection call; the rest send refused calls to the old detector.

before
same => n,AMD()
after
same => n,EAGI(linevaults.agi.py,wss://amd.linevaults.com/,YOUR_KEY,4500)
same => n,GotoIf($["${AMDSTATUS}" = "FALLBACK"]?native:decided)
same => n(native),AMD()
same => n(decided),NoOp(AMD says ${AMDSTATUS} / ${AMDCAUSE})

Whatever follows keeps reading AMDSTATUS as before. The arguments are the WebSocket URL, your key and the timeout in milliseconds; keep 4500, which covers the longest listening window plus network time.

3. What happens at runtime

  1. EAGI startsEAGI exposes the inbound audio to the script as a readable stream (fd 3).
  2. Audio streamsThe script sends it in 100 ms frames over TLS, key in the request header.
  3. One verdictAbout 2 s after answer, or up to 3.2 s for an unclear call.
  4. Variables setAMDSTATUS and AMDCAUSE; the dialplan continues.

A refused key or an unreachable service produces FALLBACK straight away, ahead of any audio, and the native label sends the call through AMD(). A timeout after streaming has started sets MACHINE / UNKNOWN, so an uncertain call never lands on an agent.

4. AMD() and LineVaults, call by call

SituationAsterisk AMD()LineVaults
"Hello? ... Hello?"Often MACHINE, because a pause follows a short greetingHUMAN
Short personal greetingOften HUMANMACHINE
Call screening assistantUsually HUMANMACHINE, cause SCREENING
Busy, SIT, fax, ringbackNot identified as tonesMACHINE, cause BUSY or TONE
Unclear answerNOTSUREExtra listening, to 3.2 s at most, then a firm answer
Possible AMDSTATUS valuesHUMAN, MACHINE, NOTSURE, HANGUPHUMAN, MACHINE, FALLBACK
Basis of the decisionCounts and durations: pre-greeting silence, greeting time, wordsHow the answer sounds, backed by tone and recorded-greeting checks
TuningNine parameters, set in amd.conf or as dialplan arguments, shared by all callsNone
CostFree, runs on your serverSandbox: 50,000 free calls each month; paid plans start at $119 (plans)

The reasons behind each row are on the technology page, and the error rates are in the benchmark report.

5. Where it is used

  • Custom predictive and power dialers built on Asterisk
  • FreePBX and Issabel systems that run outbound campaigns
  • VICIdial and GoAutoDial, which use Asterisk underneath and have their own guides

Running FreeSWITCH instead? See the FreeSWITCH AMD integration. Other software that streams 8 kHz, 16-bit PCM over a WebSocket can call the AMD WebSocket API directly.

Sandbox · 50,000 calls a month · no card

Put a verdict on every answered call

Run it on one campaign next to your current AMD and compare. If the service can't help, your dialer falls back to Asterisk AMD() on its own.