6. Outcall daemon

After the configuration is done, incoming calls should work without doing anything else, since it's asterisk responsability to launch the EAGI script when a call is received. However, for outgoing calls we need the phonepatch to listen the server radio in order to hear DTMF tones and destination numbers.

That means that we need the daemon that listens the radio link to be configured at startup. Edit /etc/asterisk-phonepatch.conf and uncomment the configuration file you need to set in daemon mode. If you need to install more than one, create a new configuration file (/etc/asterisk-phonepatch/phonepatch2.conf for example) and add it to /etc/asterisk-phonepatch.conf. Notice that phonepatches cannot share the same soundcard nor the same pidfile. Here is an example for two simulataneous phonepatches:

# Global configuration file for asterisk-phonepatch
# Enter configuration files to be loaded as daemon mode

/etc/asterisk/phonepatch.conf
/etc/asterisk/phonepatch2.conf

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

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

# 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 and errors won't appear on asterisk logs, they are written to /var/log/daemon.log, check this file to see what is its state:

# sudo tail -f /var/log/daemon.log
Jun  9 14:41:41 localhost asterisk-phonepatch[6561]: no phonepatch pidfile found
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:

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

# asterisk-phonepatch
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-phonepatch.pid