Docs / Asterisk install
For custom Asterisk dialers (not ViciDial/Vicibox). This guide covers the Python EAGI script installation and dialplan integration.
ws://api.amdy.io:2700curl -sL https://download.amdy.io/installamd-asterisk.sh | bashThe installer will prompt for your API key, install Python dependencies, and place the EAGI script at /var/lib/asterisk/agi-bin/amdy-amd.py.
If you prefer to install step by step:
pip3 install pyst2 websocket-clientmkdir -p /var/lib/asterisk/agi-bin
curl -sL https://download.amdy.io/amd.py -o /var/lib/asterisk/agi-bin/amdy-amd.py
chmod 755 /var/lib/asterisk/agi-bin/amdy-amd.py
chown asterisk:asterisk /var/lib/asterisk/agi-bin/amdy-amd.pypython3 -c "from asterisk.agi import AGI; from websocket import create_connection; print('OK')"Add the EAGI call to your dialplan. The script sets three channel variables you can use for routing:
[amd-context]
exten => s,1,Answer()
; Run AMDY EAGI script
exten => s,n,EAGI(amdy-amd.py)
; Route based on result
exten => s,n,GotoIf($["${AMDSTATUS}" = "HUMAN"]?human:machine)
; Machine detected - hangup or voicemail
exten => s,n(machine),NoOp(Machine detected: ${AMDCAUSE})
exten => s,n,Hangup()
; Human detected - route to agent
exten => s,n(human),NoOp(Human detected)
exten => s,n,Queue(sales-queue)
; ... or Dial(SIP/agent-01,30) etc.| Variable | Values | Description |
|---|---|---|
| AMDSTATUS | HUMAN or AMD | Detection result |
| AMDCAUSE | HUMAN, MACHINE, CONNECTION_ERROR | Reason code |
| AMDSTATS | JSON string | Raw API response with timing data |
ws://api.amdy.io:2700 with your API key.AMDSTATUS, AMDCAUSE, and AMDSTATS channel variables.If Asterisk reports File not found, check:
/var/lib/asterisk/agi-bin/amdy-amd.pychmod 755chown asterisk:asteriskasterisk.conf for astagidir settingIf you see import errors, reinstall the dependencies:
pip3 install --force-reinstall pyst2 websocket-clientCheck that the server can reach api.amdy.io:2700. Test with:
python3 -c "from websocket import create_connection; ws = create_connection('ws://api.amdy.io:2700'); print('Connected'); ws.close()"The script defaults to HUMAN on connection errors for safety (better to route a machine to an agent than hang up on a human). Check Asterisk logs for the actual error.
Need help? Email [email protected] with:
asterisk -V)python3 --version)asterisk -rvvv | grep AMD)