Telrate CGI
------------

Telrate.cgi is a web interface to isdnrate for displaying tables & graphics of
provider costs.

Installation
------------

- Automatic

 $ ./configure
 # make install

 run ./configure to get a list  of default options, you may override them, as
 ./configure --cc ch --gifpng png ...
 or look at the sample config's alex & leo.


- Manually

extract index.html,info.html,pics to /usr/local/httpd/htdocs/somedir
(default is telrate, that's easiest)

# cd /usr/local/httpd/htdocs
# tar -xzf telrate.tgz

make it readable for your webserver


edit telrate.cgi:
--------------
 country $CC='de' ...
 location of code file ( /usr/lib/isdn/code-$CC.dat )
     ( this file is actually ./tools/zone/CC/code )
 location of isdnrate (only if pipe's are used not sockets)
 location of mktemp (should be ok)

 location of index.html, info.html, pic, (default /telrate/ under htdocs)

 if your /tmp ist not writable by all users, turn off $use_sockets
 or change the location of the unix socket in both isdnrate.c and telrate.cgi.

 make a tmp dir below htdocs
 # mkdir /usr/local/httpd/htdocs/tmp
 # chmod 700 /usr/local/httpd/htdocs/tmp
 # chown wwwrun.nogrup tmp
  (or whatever uid.gid your webserver runs with)

in /etc/httpd/srm.conf  or httpd.conf you may enable mod_perl for
perl script invocation:

Apache config:
------------------

ScriptAlias /cgi-bin/ "/usr/local/httpd/cgi-bin/"
ScriptAlias /perl/ "/usr/local/httpd/cgi-bin/"
# enable mod_perl for /perl/
#

<Location /perl>
AddHandler  perl-script .pl
AddHandler  perl-script .cgi
PerlHandler Apache::Registry
PerlModule = CGI GD IO::Handle
Options +ExecCGI
</Location>

# enable mod_perl for /cgi-perl/ via PerlRun
#

<Location /cgi-bin>
AddHandler  perl-script .pl
PerlHandler Apache::PerlRun
PerlSendHeader On
Options +ExecCGI
</Location>

-----------------
End Apache config


 # cp telrate.cgi /usr/local/httpd/cgi-bin
 # chmod 755 /usr/local/httpd/cgi-bin/telrate.cgi
 # chmod 644 /etc/isdn/isdn.conf


NB: telrate.cgi uses the following perl modules:
 CGI, GD, IO::Handle und Socket
 if you don't have these, point your browser to www.perl.com,
 and look for CPAN mirrors near your location.


 index.html, info.html
 ---------------------

If your script-url ist not /perl/ change it to /cgi-bin in both files or
configure apache to use /perl for your /cgi-bin.
If you expanded to a different dir then /telrate/ you have to adjust
IMG tags too.


Running the Program
-------------------

If $use_sockets is on, telrate.cgi tries to start a server instance of
isdnlog/bin/isdnrate with the configured options for pid_file and socketname.
If this doesn't work, you can start an isdnrate-daemon manually by:
  isdnrate -D2 -v

If $use_sockets is off, telrate.cgi has to start isdnrate for every detail,
which can take quite a long time.

Enjoy
