AMDY.IO

Playback audio (insert.wav) — play a prompt during detection

updated 2026-08-29

Playback audio — insert.wav

There's a second AMDY variant that plays a short audio prompt to the caller while detection runs. The prompt streams at the 2-second mark; detection keeps running in parallel, so the prompt doesn't slow classification down. Typical use: a brief greeting that fills the otherwise-silent AMD window so the prospect doesn't hang up before AMDY decides.

Full reference: AMD Playback Installation Guide (PDF) — 7 pages, the canonical document for this variant.

When you'd use this

If you don't need a prompt, stick with the standard installer — the plain variant has fewer moving parts.

Install in one command

bash <(curl -sL https://download.amdy.io/installamd-audio.sh) --audio <FILE_OR_URL> --strip-silence

What that does: 1. Installs the playback variant of the AGI (amd_playback.py v2.3) over /var/lib/asterisk/agi-bin/amd.py. 2. Downloads your audio file: - Bare name (e.g. --audio ambiguous.wav) → fetched from https://download.amdy.io/<name> - Full URL (e.g. --audio https://example.com/greeting.wav) → fetched as-is 3. Re-encodes it to 8 kHz mono 16-bit PCM and trims leading/trailing silence. 4. Saves it as /var/lib/asterisk/sounds/amdy/insert.wav (the basename is hardcoded — whatever you pass, it always lands as insert.wav).

Useful flags

Flag What it does
--audio FILE_OR_URL Required. Source audio.
--normalize Re-encode to 8 kHz mono 16-bit PCM. Use if your source isn't already in that format.
--strip-silence Trim silence ≥ 0.1 s below −45 dBFS. Implies --normalize. Recommended.
--no-reload Don't run asterisk -rx 'dialplan reload' automatically.

Replacing the audio later

The filename is hardcoded — just overwrite the file in place:

# If you have a clean 8 kHz mono 16-bit WAV already:
cp newprompt.wav /var/lib/asterisk/sounds/amdy/insert.wav

# If you don't, convert with sox/ffmpeg:
ffmpeg -y -i source.mp3 -f wav - \
  | sox -t wav - -r 8000 -c 1 -b 16 -e signed-integer \
        /var/lib/asterisk/sounds/amdy/insert.wav \
        silence 1 0.1 -45d -1 0.1 -45d

No restart needed — the next call picks it up.

Verify it worked

# Confirm playback build is installed
grep -E 'PLAYBACK_ENABLED|PLAYBACK_TIME|PLAYBACK_FILE' /var/lib/asterisk/agi-bin/amd.py

# Audio file present
ls -l /var/lib/asterisk/sounds/amdy/insert.wav

# Correct format (must report 8000 Hz, 1 channel)
soxi /var/lib/asterisk/sounds/amdy/insert.wav

# Watch a live call — look for the PLAYBACK line
asterisk -rvvv

During a real call you should see something like:

PLAYBACK: streaming /var/lib/asterisk/sounds/amdy/insert to caller

Common problems

Symptom Cause Fix
Prompt never plays PLAYBACK_ENABLED = False in amd.py, or insert.wav missing / wrong owner Open /var/lib/asterisk/agi-bin/amd.py, set PLAYBACK_ENABLED = True; chown root:root /var/lib/asterisk/sounds/amdy/insert.wav (Vicidial runs Asterisk as root)
Prompt sounds garbled / chipmunk Audio isn't 8 kHz mono 16-bit PCM (e.g. it was a 44.1 kHz or stereo file) Re-install with --strip-silence (or --normalize), or convert manually with the sox command above
Prompt plays before detection starts A stray Playback(custom/...) line is in your extension 8370 dialplan block Remove that line — the AGI handles playback. Don't add Playback(...) for the insert audio in the dialplan.
WARN: installed amd.py has no PLAYBACK_ENABLED The wrong tarball got pulled (the plain one instead of the playback one) Re-run the playback installer with the command at the top of this page
ERROR: Unsupported distro Installer's distro list doesn't include yours Re-download the installer (AlmaLinux / Rocky / Oracle Linux are supported as of rev 2026-05-19), or pass -o <distro>
All calls classified HUMAN amd.py defaults to HUMAN on any error Check WebSocket reachability — run the one-shot check; look at section 4 (AMDY connectivity)

Adjusting when the prompt plays

The defaults at the top of /var/lib/asterisk/agi-bin/amd.py:

Constant Default What it controls
PLAYBACK_ENABLED True Master on/off. Flip to False to disable playback without reinstalling.
PLAYBACK_TIME 2.0 Seconds after answer before insert.wav starts streaming.
PLAYBACK_FILE "insert" Basename — leave as "insert" unless you know what you're changing.

Edit, save, no restart needed (each new call reads the AGI fresh).

Roll back to the standard variant

If you'd rather not run the playback variant:

# The installer leaves the previous AGI at amd.py.bak.<timestamp>
ls /var/lib/asterisk/agi-bin/amd.py.bak.*

# Restore the most recent backup (replace the timestamp with the one shown)
cp /var/lib/asterisk/agi-bin/amd.py.bak.<timestamp> /var/lib/asterisk/agi-bin/amd.py

Or simply re-run the standard installer for your OS from the Cheat sheet.

See also