Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > b013de3914b800f77c99940fa1c0338c > files > 6

freeradius-postgresql-0.9.2-3mdk.i586.rpm

Id: postgresql.conf,v 1.8.2.11 2003/07/15 11:15:43 pnixon Exp $

	VOIP ACCOUNTING

INTRODUCTION

Cisco VoIP gateways can use radius accounting to log call records,
however FreeRadius in it's default configuration is not very well
suited to the job as the default database config is designed with
standard dial-up ISP Authentication and Post billing in mind.
The typical configuration on FreeRadius with a MySQL backend will
not handle the load of accounting for multiple Cisco gateways
under full utilisation.
The default database config also thows away all non-standard
RADIUS attributes which infact contains alot of highly useful
information pertinent to VoIP.

The good news is that with a few modifications to the configuration
files and the use of Postgresql (or another heavy duty SQL server)
insead of MySQL FreeRadius can be made into a reliable, flexable
and scalable (and free!) billing solution for VoIP providors.

MySQL cannot be used as the configuration relies on the connect and
disconnect time as reported by the Cisco gatways (Cisco VSA
attributes "h323-connect-time" and "h323-disconnect-time") and
MySQL limited date handling does not recognise full Cisco date
stamps time as a valid "datetime". (While Oracle and possibly some
other high end DBs should support Cisco time format they have not
been tested at this time)

This is required as the default FreeRadius SQL configuration (where
RADIUS "Start" records are INSERTed into the database, and then
UPDATEd with information from the associated "Stop" record) does not
scale as well as this solution which strictly uses INSERTs. As call
start and stop times are not contained in "standard" radius
attributes (They are added/updated by FreeRadius when the record is
logged in the default configuration.)

This requires all equipment be kept is timesync with the use on NTP
otherwise similtaneous records from different gateways may have
differing timestamps.

CONFIGURATION

* Install and configure FreeRadius as appropriate for your system.
* Test that FreeRadius is recieving accounting records from your
  gateway. Do not proceed until you are certain this is working.


* Create a Database to hold your billing records. ie:
	"createdb radius"
* Add the plperl language to the database. ie:
	"createlang plperl radius"
  Note: On some versions of SuSE Postgresql cannot find the correct
	perl libraries so you have to symlink them. ie:
	"ln -s \
	 /usr/lib/perl5/5.8.0/i586-linux-thread-multi/CORE/libperl.so \
	 /usr/lib/libperl.so"

* Import the SQL schema to your database. ie:
	"psql radius < h323_db_postgresql.sql"

* Copy the custom SQL queries to raddb/ ie:
  	"cp pgsql-voip.conf /etc/raddb/"

* In /etc/raddb/radiusd.conf add "$INCLUDE  ${confdir}/pgsql-voip.conf"
  You can find the correct section by searching for "sql.conf"

* In /etc/raddb/radiusd.conf set "with_cisco_vsa_hack = yes"

* In /etc/raddb/radiusd.conf add "sql" to the "accounting {" section
  just after the line "detail"

* (re)Start radiusd


If you wish to do RADIUS SQL Authentication using the same database, you
must use src/modules/rlm_sql/drivers/rlm_sql_postgresql/db_postgresql.sql
as well as this schema and also modify your SQL queries to suit. This is
not recomended, but is possible. It is left as an excercise for the reader.

   -- Peter Nixon [ codemonkey@peternixon.net ]