Checkmk 2.0 is here! See what's new.

Your requirement

You are telephoning via a HorstBox with firmware version 5.0. You want to initiate a call on the HorstBox from Linux via command-line command. You also want to specify which telephone you want to use.

Conditions

The HorstBox is ready for telephoning. You have activated the administration via SSH. The SSH key that you have configured belongs to the user who is to initiate dialling on the command-line. It is not protected by a passphrase (or you have used some other method so that you do not need a password). This means that you can log in via ssh 192.168.0.1 without entering a password.

The procedure

The procedure presented here does not use the TAPI, but triggers dialling by creating a call file. We take advantage of the fact that the HorstBox uses a quite ʻnormal’ Asterisk implementation.

The following command creates a two-line call file with a simple echo, which makes phone 300 ring. The destination number is 089/11223344, and the output of the echo is transferred via SSH to the HorstBox (here under the IP address 192.168.0.1). There the script changes to /mnt/var/spool/asterisk and converts the output of the echo into a file tmp/anruf. This file is made readable for Asterisk and then moved to the outgoing directory:

echo -e 'Channel: zap/g2/300\nExtension: 08911223344' | \
 ssh 192.168.0.1 "cd /mnt/var/spool/asterisk/ ; cat > tmp/anruf ; chmod 666 tmp/anruf ; mv tmp/anruf outgoing"

About one second later the phone rings. As soon as you pick up the phone (and not before!) the HorstBox starts to dial the target number.

Linux knowledge

These articles were written by the founder of Checkmk many years ago.
They are still valid though and thus we keep them on our website.
Mathias has since then developed a monitoring software called Checkmk

Find out more