import from branch_1_1:
[freeradius.git] / src / billing / README
1 $Id$
2
3         VOIP ACCOUNTING WITH CISCO VSA
4
5 INTRODUCTION
6
7 Cisco VoIP gateways can use radius accounting to log call records,
8 however FreeRadius in it's default configuration is not very well
9 suited to the job as the default database config is designed with
10 standard dial-up ISP Authentication and Post billing in mind.
11 The typical configuration on FreeRadius with a MySQL backend will
12 not handle the load of accounting for multiple Cisco gateways
13 under full utilisation.
14 The default database config also thows away all non-standard
15 RADIUS attributes which infact contains alot of highly useful
16 information pertinent to VoIP.
17
18 The good news is that with a few modifications to the configuration
19 files and the use of Postgresql (or another heavy duty SQL server)
20 insead of MySQL FreeRadius can be made into a reliable, flexible
21 and scalable (and free!) billing solution for VoIP providors.
22
23 MySQL cannot be used as the configuration relies on the connect and
24 disconnect time as reported by the Cisco gatways (Cisco VSA
25 attributes "h323-connect-time" and "h323-disconnect-time") and
26 MySQL limited date handling does not recognise full Cisco date
27 stamps time as a valid "datetime". (While Oracle and possibly some
28 other high end DBs should support Cisco time format they have not
29 been tested at this time). MySQL could possibly be supported in
30 future but it would require extra pre-processing by a FreeRADIUS
31 module to do so and there is no plan currently to impliment this,
32 although working code that impliments this would be happily accepted.
33
34 This reliance on VSA records REQUIRES that all cisco devices be
35 configured to send VSA attributes. This system is not known to work
36 with any non-cisco equipment, although it is theoretically possible
37 for non-cisco equipment to impliment Cisco VSA attributes...
38
39 This is required as the default FreeRadius SQL configuration (where
40 RADIUS "Start" records are INSERTed into the database, and then
41 UPDATEd with information from the associated "Stop" record) does not
42 scale as well as this solution which strictly uses INSERTs. As call
43 start and stop times are not contained in "standard" radius
44 attributes (They are added/updated by FreeRadius when the record is
45 logged in the default configuration.)
46
47 This REQUIRES all equipment be kept is timesync with the use on NTP
48 otherwise similtaneous records from different gateways may have
49 differing timestamps.
50
51 CONFIGURATION
52
53 * Install and configure FreeRadius as appropriate for your system.
54 * Test that FreeRadius is recieving accounting records from your
55   gateway. Do not proceed until you are certain this is working.
56
57 * Configure all the NASes to send VSA attributes. On older Ciscos
58   use one of the following commands (depending if you are using 
59   SIP or H323):
60         "gw-accounting h323 vsa"
61         "gw-accounting sip vsa"
62   On Ciscos with newer versions of IOS need both of the following commands:
63         "gw-accounting aaa"
64         "radius-server vsa send"
65
66 * Create a Database to hold your billing records. ie:
67         "createdb radius"
68
69 * Import the SQL schema to your database. ie:
70         "psql radius < cisco_h323_db_schema-postgres.sql"
71
72 * In /etc/raddb/radiusd.conf set "with_cisco_vsa_hack = yes"
73
74 * In /etc/raddb/radiusd.conf add "$INCLUDE  ${confdir}/pgsql-voip.conf"
75   (You can find the correct section by searching for "sql.conf")
76
77 * In /etc/raddb/radiusd.conf add "pgsql-voip" to the "accounting { }" section.
78
79 * (re)Start radiusd
80
81
82 If you wish to do RADIUS SQL Authentication using the same database, you
83 must use src/modules/rlm_sql/drivers/rlm_sql_postgresql/db_postgresql.sql
84 as well as this schema. This is left as an excercise for the reader.
85
86    -- Peter Nixon [ codemonkey@peternixon.net ]
87