#
# Pbx Accounting / Billing
# Copyright 2000-2002 (c) Calin Damian
# http://pbx.sourceforge.net
#
# $Id: INSTALL,v 1.1.1.1 2002/02/27 19:25:04 calinovich Exp $
#

    I know this package should have a Makefile to ease your eforts made 
to setup this app.
    Since then use these simple steps to achieve the install.

------------------------------------------------------------------------------
    You may not want to wait until an automated installation is implemented.
In the roadmap (http://pbx.sourceforge.net/index.php?sect=docs) there are some
other tasks to complete before the automated install:

 - corect cost calculation for overlaping calls onto 2+ rules
 - top30 (or topX, where you name X)
 - admin module
 - aliases for dialed numbers (let's say 039475472 => "Sugar")
 - comparative reports (in-out)
 - graphics with rrdtool

If you want to contribute in some way please consult support section:
http://pbx.sourceforge.net/index.php?sect=support
------------------------------------------------------------------------------

Prerequisites:
-=-=-=-=-=-=-

 - MySQL database server
 - Web server which you can configure with php (Apache works and IIS should
work too)
 - cable to conect your computer to the phone central
(referer to http://pbx.sourceforge.net/index.php?sect=cables)
 - and of course the phone central :)



Install:
-=-=-=-

Accounting (capture) install
----------------------------
1. Create "worker" group and the "pbx" user with "/var/worker" as its
home
(This user is gonna be user for the capture script)

2. The files located in "workerhome" directory must be copied in home
directory of the pbx user (/var/worker) and chowned "pbx.worker".

3. "util/pbx" bash script must be copied in "/etc/rc.d/init.d" and must pe chowned
"pbx.worker". Please take a moment to modify this script to reflect corect
serial port used, by default set to ttyS0 (COM1 under DOS/Win)

4. Set appropiate permissions for the serial device used to connect to phone
central.
(crw-rw----    1 root     worker)

5. Import sql structure located in "sql/pbx.sql" into MySQL database

6. Create MySQL users as in "sql/user.sql"

7. Conect your computer with the phone central with the specific cable.

8. Configure your serial port/ phone central's serial port to match settings.
(I mean bps, stop bits, corections, etc.)
Note: This step is _mandatory_ for this app to function corectlly. You may
want to consult the Serial-HOWTO.

9. Activate SMDR option of your phone central if not already have.

10. Test your setup (with the serial port and phone central):
`cat /dev/ttyS0`
Now you should see some phone calls cached in the memory of your phone
central.

11. Put the "setserial" command in a startup script so that if your PC is rebooted
you don't need to setup the serial port again ("/etc/rc.d/rc.local" maybe)

12. Install the cron (located in "util/pbx.cron" file) which will capture, process
and import data into MySQL. The cron must be installed for/under the "pbx" user
created at step '1'.


Billing (reporting) install
---------------------------

---------------
First off all: |     This INSTALL file does not cover web server specific problems.
--------------/    You may want to consult the manual of your installed server.


  - you have to copy the content of the "html/" directory in whatever location
you want. Of course the location must be accesibile from a web browser.

  - verify the setting in "config.php" to match the MySQL users and passwords

  - modify default 'include path' of the php module or copy the "util/fasttemplate.php"
file in a directory which is already in the include path.

Note:
    Reporting module does not provide any kind of authentification or securization
of transmision.
    You may want to configure your web server with SSL and you may want to verify
built in authentification methods available in your web-server.

Hint for Apache users:
	take a look at the "html/.htaccess" file and issue a "man htpasswd" command
	
Other fixups, preferences setups
--------------------------------
  - for design modifications matters look in
* const.php
* css file
* templating files (*.tpl)


Billing rules
-------------

    Billing rules are described using a set of tables from pbx database. For now
the only way to describe your billing rules is to:
1. Understand the cost algorithm so you know what influence has any data you put
in cost configure tables (see docs dir)
2. billing tables must be completed manually, from a sql command prompt, or
using a gui tool like phpmyadmin (see http://phpmyadmin.sourceforge.net/)


Enjoy!
