This Perl script serves as a bridge between an Asterisk server and the Zammad CTI interface. It connects via AMI to Asterisk and monitors it for queue events; the relevant ones will be pushed to Zammad's CTI interface.
- No AMI SSL support yet, so use it only on the Asterisk host.
- Can only monitor queue events and nothing else.
-
Enable AMI in Asterisk in
/etc/asterisk/manager.conf
. -
Create the file
/etc/asterisk/manager.d/zammad.conf
with the following contents:[zammad] secret = xxx read = agent
Use a strong randomly generated password, e.g.
$(pwgen 32)
. -
Run
manager reload
inasterisk -r
. -
Install the Perl dependencies listed in the script.
E.g. on Debian stretch:
apt install libanyevent-http-perl libconfig-simple-perl libdata-printer-perl liblog-any-perl liblog-any-adapter-dispatch-perl libwww-form-urlencoded-perl cpan Asterisk::AMI
-
Enable Zammad's CTI (Generic) interface.
-
Copy
config.cfg.sample
toconfig.cfg
:cp config.cfg.sample config.cfg chmod 600 config.cfg
-
Edit
config.cfg
and fill in your Zammad CTI URL and your AMI secret. -
Start the script:
./asterisk-zammad-cti-bridge
An example systemd service file asterisk-zammad-cti-bridge.service.example
is provided. To install it:
-
Copy the file to
/etc/systemd/system
and remove the.example
:cp -a asterisk-zammad-cti-bridge.service.example /etc/systemd/system/asterisk-zammad-cti-bridge.service
-
Create the required user:
useradd asterisk-zammad-cti-bridge
-
Set the
config.cfg
permissions:chown asterisk-zammad-cti-bridge config.cfg chmod 0600 config.cfg
asterisk-zammad-cti-bridge
will readconfig.cfg
from the current working directory or from the application directory, so you can place it either in/home/asterisk-zammad-cti-bridge
or in/opt/asterisk-zammad-cti-bridge
. -
Adapt the service file to your requirements:
-
Change
ExecStart
to the correct path where you've placedasterisk-zammad-cti-bridge.service
. The service defaults to/opt/asterisk-zammad-cti-bridge
. -
If you want to use different Asterisk/Zammad instances from the config (see "Multiple instances" below), edit the service file as necessary. Create one systemd service file for each
asterisk-zammad-cti-bridge.service
instance.
-
-
Enable the service:
systemctl enable asterisk-zammad-cti-bridge.service
-
Start the service:
systemctl start asterisk-zammad-cti-bridge.service
If you want to bridge multiple Asterisk/Zammad instances, e.g. one Asterisk to two Zammad instances (prod and test), you need to run multiple asterisk-zammad-cti-bridge
instances. Add a new section to config.cfg
for each additional instance, e.g.:
[zammad-test]
url=https://zammad-test.example.com/api/v1/cti/mytoken
Then start a new asterisk-zammad-cti-bridge
instance and tell it to read the [zammad-test]
section instead of the [zammad]
section:
./asterisk-zammad-cti-bridge --zammad zammad-test