Instalation Instructions
------------------------
REQUIRES:
	Those are needed to store data in a database.
		perl, perl-pg
		postgresql

	Those packages are needed by the web interface.
		apache
		php
		adodb: http://php.weblogs.com/adodb#downloads by John Lim <jlim@natsoft.com.my>


 1) Modify the file /etc/pblogan.conf to meet your needs.
	
 2) copy the usr/local/bin/readserial script to a directory in your 
    system. You should modify the port definition to meet your hardware
    configuration

 3) This script will create a plain text log file in /var/log/central/, 
    this directory MUST exist.

 4) I've put a line in my inittab to respawn this script, avoiding a big
    downtime

	rs:35:respawn:/path/to/the/file/readserial
 
    For testing purposes, just run readserial from the command line, and 
    make a     tail -f centralita.log     to watch what's going on.
    Make some calls to check it out.

 5) At this point, you should find a file called "centralita.log" in the 
    /var/log/central directory.

*** !!! IF SO ... you can go on. !!! ***

 6) Create a database called llamadas

	# su postgres -l
        $ createdb llamadas

    There is a llamadas.dump in usr/local/bin, use it to create the 
    database which will hold the data.

        $ psql -d llamadas -f llamadas.dump

*** THE INFORMATION CONTAINED IN THE DATABASE IS RELATIVE TO URUGUAY ***
*
*   The table costos, defines how much a minute costs depending on the prefix.
*   The table tarifas, defines wich discount aplies depending on the day
*       day of the week and the time.
*   The table internos, identifies the extensions connected to the PBX.
*
*** ALL OF THIS INFORMATION MUST BE CHECKED AND CORRECTED AS NEEDED ***

 7) Copy phonedb script wherever you want.
    NOTE: My case, is based on two hosts, one connected to the PBX, and 
    one that has the database running. The /var/log/central y exported via
    nfs to the database host.

 8) I've also put the phondb script in the inittab in the same way as 
    readserial.

        pb:35:respawn:/path/to/the/file/phonedb --daemon

    This will read from the log file defined in the pblogan.conf and feed
    the database.

 9) Verify if the database is updated the way it should, enter the psql 
    command and try to make select * from log; to verify all fields are
    updated..

10) Copy the home/httpd/html/phonedb/* to the directory where you want these
    scripts to be found by apache.

11) Edit the file config.inc to meet your needs.  
    The menu options related to users id will be displayed depending
    on the content of the brand value, if you are using a panasonic pbx that 
    requires the user to autenticate with a password, you must select 
    "panasonicwid".   

12) Open a browser and point it to the url of the pblogan web interface.


Wish you luck!!
