Rotary Dial Test Program
For Asterisk/Zaptel FXS Users
Download dialtest.tar.gz
Download dialtest-0.2.tar.gz (includes update for DAHDI)

This program prompts the user to dial the digit zero (from a rotary phone).
The dial speed (in pulses/sec.) and the percent break is then read back to
the user as spoken text using asterisk's built-in voice library.

The program runs as an asterisk AGI application.  The rotary phone can
connect to asterisk via any hardware supported by the zaptel driver
(including my x100pfxs hack)

It requires a small patch to be applied to the zaptel.c driver, to log the 
individual pulse state transitions.  The AGI application reads these messages
from the syslog, computes the dial characteristics, and reads the results
back to the caller.

INSTALLATION

0. Unpack the tar archive file to any convenient working directory.  The
command (as root)
	tar -zxf dialtest.tar.gz -C /
will unpack the file and put the asterisk files into the proper location
automatically.  Or, you may want to unpack the file somewhere within your
home directory and review the files first before installing them.

1. Apply the patch to zaptel.c (patch -p1 < /tmp/zaptel.patch)

2. "make" and "make install" zaptel drivers

3. Remove all zaptel drivers (rmmod), then reload zaptel drivers, ztcfg etc.

4. Now verify that you see the hookstate messages in syslog (usually, this
is /var/log/messages) for example
Feb 10 17:00:33 localhost kernel: zaptel: zt_hooksig 1: 1139868033:433028
Feb 10 17:00:44 localhost kernel: zaptel: zt_hooksig 0: 1139868044:317363

If this isn't working, the dial test app won't function.

5. You need to have asterisk-perl installed (I used version 0.08).  There
is a copy (attached) which you can install by doing
   a. unpack asterisk-perl-0.08.tar.gz to a temp working directory
   b. 'cd' to that directory
   c.  perl Makefile.PL
   d.  make
   e.  make test ["optional" ;-)]
   f.  make install
Needless to say, you must have perl installed.

6. Ensure that file /var/lib/asterisk/agi-bin/dialtest.agi exists and is 
executable (rwxr-xr-x)

7. Ensure that file /var/lib/asterisk/sounds/dialtest/dt.wav exists and
is readable

8. Add an extension to your extensions.conf file such as (31 in this sample)
          exten => 31,1,Answer
          exten => 31,2,AGI(dialtest.agi)
          exten => 31,3,Hangup

9. Test the installation of dialtest.agi by entering the command
          perl -cw /var/lib/asterisk/agi-bin/dialtest.agi
You should receive a message 
          /var/lib/asterisk/agi-bin/dialtest.agi syntax OK
If not, correct before proceeding.

10. Now dial the extension you created.  Dial zero when prompted.

11. You should receive an error "1" if the digit received was other than
zero, followed by the actual digit received.

12. Otherwise, you should get the dial speed (such as "9.3") followed by 
the percent break, followed by percent make.