When we have a tunneled MS-CHAP2-Success attribute, it goes
[freeradius.git] / raddb / sql / postgresql-voip-postpaid.conf
1 #  Id: postgresql.conf,v 1.8.2.11 2003/07/15 11:15:43 pnixon Exp $
2 #
3 #  Configuration for the SQL module, when doing H323 VoIP billing.
4 #
5 #  The database schema is available at:
6 #
7 #   src/radiusd/src/billing/h323_db_postgresql.sql
8 #
9 sql pgsql-voip {
10
11         # Database type currently must be rlm_sql_postgresql to work with this setup.
12         driver = "rlm_sql_postgresql"
13
14         # Connect info
15         server = "localhost"
16         login = "postgres"
17         password = ""
18         
19         # Database configuration
20         radius_db = "radius"
21                 
22         # Database table configuration
23         acct_table1 = "Start"
24         acct_table2 = "Stop"
25                 
26         authcheck_table = "radcheck"
27         authreply_table = "radreply"
28         
29         groupcheck_table = "radgroupcheck"
30         groupreply_table = "radgroupreply"
31         
32         usergroup_table = "radusergroup"
33         
34         # Remove stale session if checkrad does not see a double login
35         deletestalesessions = yes
36
37         # Print all SQL statements when in debug mode (-x)
38         sqltrace = no
39         sqltracefile = ${logdir}/sqltrace.sql
40
41         # number of sql connections to make to server
42         num_sql_socks = 25
43         
44         # Radius server name so you can tell which radius server handled a request
45         # when you have multiple radius servers and one database.
46         radius_server_name = FreeRADIUS
47
48         #######################################################################
49         #  Query config:  Username
50         #######################################################################
51         # This is the username that will get substituted, escaped, and added 
52         # as attribute 'SQL-User-Name'.  '%{SQL-User-Name}' should be used below 
53         # everywhere a username substitution is needed so you you can be sure 
54         # the username passed from the client is escaped properly.  
55         #
56         #  Uncomment the next line, if you want the sql_user_name to mean:
57         #
58         #    Use Stripped-User-Name, if it's there.
59         #    Else use User-Name, if it's there,
60         #    Else use hard-coded string "none" as the user name.
61         #
62         #sql_user_name = "%{Stripped-User-Name:-%{User-Name:-none}}"
63         #
64         sql_user_name = "%{User-Name}"
65
66
67         #######################################################################
68         #  Accounting Queries
69         #######################################################################
70         # accounting_onoff_query        - query for Accounting On/Off packets 
71         # accounting_update_query       - query for Accounting update packets 
72         # accounting_update_query_alt   - query for Accounting update packets 
73         #                               (alternate in case first query fails)
74         # accounting_start_query        - query for Accounting start packets 
75         # accounting_start_query_alt    - query for Accounting start packets 
76         #                               (alternate in case first query fails)
77         # accounting_stop_query         - query for Accounting stop packets 
78         # accounting_stop_query_alt     - query for Accounting start packets 
79         #                               (alternate in case first query doesn't
80         #                                affect any existing rows in the table)
81         #######################################################################
82
83         # Note: The VoIP accouting does not need Alternate queries in the shipped
84         # configuration as all queries are INSERTS, hence should always work.
85         # If they do not work then you probably have duplicate records in your table.
86         
87
88         accounting_start_query = "INSERT into ${acct_table1}%{h323-call-type} \
89                 (RadiusServerName, UserName, NASIPAddress, AcctTime, CalledStationId, \
90                 CallingStationId, AcctDelayTime, h323gwid, h323callorigin, h323setuptime, H323ConnectTime, callid) \
91                 values('${radius_server_name}', '%{SQL-User-Name}', \
92                 '%{NAS-IP-Address}', now(), '%{Called-Station-Id}', \
93                 '%{Calling-Station-Id}', '%{Acct-Delay-Time:-0}', '%{h323-gw-id}', \
94                 '%{h323-call-origin}', strip_dot('%{h323-setup-time}'), strip_dot('%{h323-connect-time}'), pick_id('%{h323-conf-id}', '%{call-id}'))"
95
96
97         accounting_stop_query = "INSERT into ${acct_table2}%{h323-call-type} \
98                 (RadiusServerName, UserName, NASIPAddress, AcctTime, \
99                 AcctSessionTime, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, \
100                 AcctDelayTime, H323RemoteAddress, H323VoiceQuality, CiscoNASPort, h323callorigin, callid, \
101                 h323connecttime, h323disconnectcause, h323disconnecttime, h323gwid, h323setuptime) \
102                 values('${radius_server_name}', '%{SQL-User-Name}', '%{NAS-IP-Address}', now(), '%{Acct-Session-Time:-0}', \
103                 '%{Acct-Input-Octets:-0}', '%{Acct-Output-Octets:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', \
104                 '%{Acct-Delay-Time:-0}', NULLIF('%{h323-remote-address}', '')::inet, NULLIF('%{h323-voice-quality}','')::integer, NULLIF('%{Cisco-NAS-Port}', ''), \
105                 '%{h323-call-origin}', pick_id('%{h323-conf-id}', '%{call-id}'), strip_dot('%{h323-connect-time}'), '%{h323-disconnect-cause}', \
106                 strip_dot('%{h323-disconnect-time}'), '%{h323-gw-id}', strip_dot('%{h323-setup-time}'))"
107  
108
109 }