4. Outcall daemon

Once configured, incoming calls should work without doing anything else, since Asterisk will launch automatically the EAGI script when a call for a phonepatch extension is received. However, to enable outgoing calls we need that the phonepatch listens to the channel, detect DTMF tones from the user and make calls when necessary. To enable the daemon mode, edit the main configuration file /etc/asterisk/phonepatch.conf and set outcall_daemon=on inside all the phonepatches sections you want to enable.

After a /etc/init.d/asterisk-phonepatch restart, you sould see the process on a ps and the pidfile for them:

# init.d/asterisk-phonepatch start
Starting Asterisk Phonepatch daemons: asterisk-phonepatch

# ps awx |grep phonepatch
19119 ?        S      0:00 /usr/bin/python /usr/sbin/asterisk-pho ....
19412 ?        S      0:00 /usr/bin/python /usr/sbin/asterisk-pho ....

# cat /var/run/asterisk/phonepatch.pid
19119

# cat /var/run/asterisk/phonepatch2.pid
19412

Daemon info is written to /var/log/daemon.log, check this file to see what is its state:

# tail -f /var/log/daemon.log
Jun  9 14:41:41 localhost asterisk-phonepatch[6561]: soundcard opened: /dev/dsp1 (8000 sps)
Jun  9 14:41:41 localhost asterisk-phonepatch[6561]: radio control opened: command:eboard -p
Jun  9 14:41:41 localhost asterisk-phonepatch[6564]: creating pidfile: /var/run/asterisk-phonepatch.pid
Jun  9 14:41:41 localhost asterisk-phonepatch[6564]: waiting for askfortone_button

When debugging, you can start phonepatch daemon directly from the console (in this mode only one can be active, select it with the -p option).

# init.d/asterisk-phonepatch stop
Stopping Asterisk Phonepatch daemons:
 phonepatch: done

# asterisk-phonepatch -p phonepatch1
phonepatch -- daemon -  -- start of state: daemon
phonepatch -- daemon -  -- soundcard opened: /dev/dsp (8000 sps)
phonepatch -- daemon -  -- radio control opened: command:eboard -ep
phonepatch -- daemon -  -- creating pidfile: /var/run/asterisk/phonepatch1.pid