Connect ViciDial
The install command, what it changes, campaign settings, test calls and rollback.
This guide is for whoever has root on the ViciDial server. The install takes about five minutes, says what it will change before it changes it, and comes out again with one command.
Before you start
- ViciDial on Asterisk 13 or newer. ViciBox 7 to 12 are fine.
- Root on each server that places calls. In a cluster, install on every dialer server.
- Python 3.6 or newer. ViciBox already has it, and nothing is installed with pip.
- Outbound access to AMD Cop from the dialer: see Network and security.
- The install command from the portal: Dialers, then Get my install command. It carries the account's key.
Install
Run the command from the portal as root, on the dialer:
curl -fsSL https://api.amdcop.ai/connector.sh | sudo bash -s amdcop_live_...To read the script before running it:
curl -fsSLO https://api.amdcop.ai/connector.sh
less connector.sh
sudo bash connector.sh amdcop_live_...To see what it would do without changing anything, add AMDCOP_DRY_RUN=1:
curl -fsSL https://api.amdcop.ai/connector.sh | sudo AMDCOP_DRY_RUN=1 bash -s amdcop_live_...When it finishes, the dialer registers itself with the portal. Nobody needs to type its address.
While it runs, Dialers ticks off each step under the command, from Install key used to First verdict returned. A step that fails says why, and what to do.

What it changes
The installer asks your Asterisk what it can do, then takes one of two ways in.
| Your dialer | What the installer does | What you change in ViciDial |
|---|---|---|
Asterisk has AudioSocket() and extension 8370 is free |
Takes over. Adds an 8370 context that is your 8369 with AMD() replaced by AMD Cop, keeps your original 8369 for rollback, and points 8369 at 8370. Your AMD() line stays in 8370 and runs only when AMD Cop cannot answer. |
Nothing. Campaigns that dial 8369 now use AMD Cop. |
| Anything else: ViciBox's Asterisk 13, or another AMD already on 8370 | Installs beside. The same steps on a spare extension, and nothing else in the file changes. | Point one campaign's Routing Extension at the new extension when you are ready. |
On a dialer that could be taken over, install with AMDCOP_MODE=beside to move one campaign at a time.
Which extension a beside install uses
8371, unless something on the dialer already uses it. AMDY's Press-1 installer does, for example; then AMD Cop takes the next free one, up to 8379, so 8372 on most of those dialers. Running the install again keeps the extension it already has.
You do not have to remember the number. The installer prints it, and the portal shows it for each dialer under Dialers, beside Routing Extension in that dialer's row, and uses it in every instruction, such as the test calls after an install.

To choose the extension yourself, install with AMDCOP_SIDE_EXTEN=8375 (any free extension). If that one is taken, the installer stops and changes nothing.
It also adds:
- the AMD Cop scripts in
/var/lib/asterisk/agi-bin/, all namedamdcop_*; /etc/amdcop/config.json, holding your key, readable only by root and the user Asterisk runs as;amdcop-sender, which sends call records to the portal, as a systemd service (or a cron entry where there is no systemd);- a spool of call records in
/var/spool/amdcop, capped at 200 MB; - the doctor and the uninstaller, in
/usr/local/lib/amdcop/, which only root can change.
It never writes to the ViciDial database and never edits a campaign.
Campaign settings
AMD Cop answers in ViciDial's own terms. It sets AMDSTATUS and AMDCAUSE, and ViciDial's VD_amd.agi routes the call exactly as it does after Asterisk's own AMD, so your voicemail drop and your statuses keep working. A campaign needs the settings stock AMD needs:
| Campaign setting | Value |
|---|---|
| Routing Extension | 8369 after a take-over. After a beside install, the extension the portal shows for the dialer under Dialers (8371, or 8372 if 8371 was taken) |
| AMD Type | AMD |
| CPD AMD Action | DISABLED |
| AMD Agent Route Options | DISABLED |
Leave AMD Agent Route Options at DISABLED if you can. With it ENABLED, a settings container named AMD_AGENT_OPT_ and the campaign decides which status and cause pairs reach an agent, and every other call is hung up as a machine. ViciDial reads each cause up to its first dash, and AMD Cop's causes start with the status (HUMAN-AMDCOP), so a container holding HUMAN,HUMAN, as AMDY asks for, passes AMD Cop's people and sampled calls. Add the line NOTSURE,NOTSURE too, whatever Detection says. Without it, calls AMD Cop is not sure of are hung up, and during an outage on our side so is every call, people included. Statuses and causes has the details, and the doctor checks each campaign's container when the campaign lookup is on.
Test it
From a campaign that uses AMD Cop (after a beside install, one whose Routing Extension is the one the portal shows):
- Call your own mobile and answer with a normal "Hello?". It should reach an agent, and the portal shows Human.
- Call a number you know goes to voicemail. No agent should hear it, and the portal shows Machine.
To watch the dialplan pick up the change:
asterisk -rx "dialplan show 8370@"The @ asks for the extension in every context: without it, Asterisk looks for a context called 8370 and finds none. After a beside install, use the extension the portal shows for the dialer, for example dialplan show 8372@.
If AMD Cop cannot be reached
When the dialer gets no verdict in time (AMD Cop is down or slow, the dialer cannot reach it, or it refuses the dialer's key), the call still goes ahead. By default, if the problem shows within 1 second of the answer, the call runs your own AMD() line, with the settings in your 8369, and ViciDial routes it on that answer. A refused connection shows at once, which is what the dialer sees while our service is down or restarting, so your voicemail drop keeps working then.
A problem that shows later sends the call to an agent instead: AMD() started that late can take a person who has already said hello for a machine. That includes our server not answering at all, which the dialer waits 2 seconds to give up on, and a key refused only after the call was heard.
To send those calls to an agent instead, as if there were no AMD, choose Send every call to an agent under Detection, If AMD Cop cannot answer. A change reaches the dialer within a minute. At install, AMDCOP_FALLBACK=agent does the same until the dialer first hears from the portal; the installer prints the setting before it changes anything, dry run included.
Either way the call carries AMDCOP_CAUSE, which says why there was no verdict: see Statuses and causes.
Roll back
sudo /usr/local/lib/amdcop/uninstall.shIt restores your original 8369, removes every file the installer added, stops amdcop-sender and deletes the spool, saying how many call records it discarded. Your key stays valid until you revoke it in the portal. After a beside install you can also simply point the campaign back at its old extension.
Installed before connector 1.5.0?
Every new install is connector 1.6.0. A dialer installed earlier needs the install command run again before anything else on this page: it upgrades in place, keeps the extension and your settings, and Dialers then shows 1.6.0. Until it is upgraded:
- on connector 1.4.0 or older, the doctor and the uninstaller are in
/etc/amdcop/, where the user Asterisk runs as can change them, so do not run them withsudo: upgrade first, and they move to/usr/local/lib/amdcop/; - on connector 1.3.0 or older, causes start with
AMDCOP_, which noHUMAN,HUMANline matches; - before connector 1.2.0, calls AMD Cop cannot answer go to an agent whatever Detection says;
- on connector 1.2.0 or older, Dialers shows "Not reported" for the extension: use the one the installer printed.
Next: Connect FreeSWITCH