3 ## voip-postpaid.conf -- PostgreSQL configuration for H323 VoIP billingx
4 ## (cisco_h323_db_schema.sql)
10 # Database type currently must be rlm_sql_postgresql to work with this setup.
11 driver = "rlm_sql_postgresql"
18 # Database configuration
21 # Database table configuration
25 authcheck_table = "radcheck"
26 authreply_table = "radreply"
28 groupcheck_table = "radgroupcheck"
29 groupreply_table = "radgroupreply"
31 usergroup_table = "radusergroup"
33 # Remove stale session if checkrad does not see a double login
34 deletestalesessions = yes
36 # Print all SQL statements when in debug mode (-x)
38 sqltracefile = ${logdir}/sqltrace.sql
40 # number of sql connections to make to server
43 # Radius server name so you can tell which radius server handled a request
44 # when you have multiple radius servers and one database.
45 radius_server_name = FreeRADIUS
47 #######################################################################
48 # Query config: Username
49 #######################################################################
50 # This is the username that will get substituted, escaped, and added
51 # as attribute 'SQL-User-Name'. '%{SQL-User-Name}' should be used below
52 # everywhere a username substitution is needed so you you can be sure
53 # the username passed from the client is escaped properly.
55 # Uncomment the next line, if you want the sql_user_name to mean:
57 # Use Stripped-User-Name, if it's there.
58 # Else use User-Name, if it's there,
59 # Else use hard-coded string "none" as the user name.
61 #sql_user_name = "%{Stripped-User-Name:-%{User-Name:-none}}"
63 sql_user_name = "%{User-Name}"
66 #######################################################################
68 #######################################################################
69 # accounting_onoff_query - query for Accounting On/Off packets
70 # accounting_update_query - query for Accounting update packets
71 # accounting_update_query_alt - query for Accounting update packets
72 # (alternate in case first query fails)
73 # accounting_start_query - query for Accounting start packets
74 # accounting_start_query_alt - query for Accounting start packets
75 # (alternate in case first query fails)
76 # accounting_stop_query - query for Accounting stop packets
77 # accounting_stop_query_alt - query for Accounting start packets
78 # (alternate in case first query doesn't
79 # affect any existing rows in the table)
80 #######################################################################
82 # Note: The VoIP accouting does not need Alternate queries in the shipped
83 # configuration as all queries are INSERTS, hence should always work.
84 # If they do not work then you probably have duplicate records in your table.
87 accounting_start_query = "INSERT into ${acct_table1}%{h323-call-type} \
88 (RadiusServerName, UserName, NASIPAddress, AcctTime, CalledStationId, \
89 CallingStationId, AcctDelayTime, h323gwid, h323callorigin, h323setuptime, H323ConnectTime, callid) \
90 values('${radius_server_name}', '%{SQL-User-Name}', \
91 '%{NAS-IP-Address}', now(), '%{Called-Station-Id}', \
92 '%{Calling-Station-Id}', '%{Acct-Delay-Time:-0}', '%{h323-gw-id}', \
93 '%{h323-call-origin}', strip_dot('%{h323-setup-time}'), strip_dot('%{h323-connect-time}'), pick_id('%{h323-conf-id}', '%{call-id}'))"
96 accounting_stop_query = "INSERT into ${acct_table2}%{h323-call-type} \
97 (RadiusServerName, UserName, NASIPAddress, AcctTime, \
98 AcctSessionTime, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, \
99 AcctDelayTime, H323RemoteAddress, H323VoiceQuality, CiscoNASPort, h323callorigin, callid, \
100 h323connecttime, h323disconnectcause, h323disconnecttime, h323gwid, h323setuptime) \
101 values('${radius_server_name}', '%{SQL-User-Name}', '%{NAS-IP-Address}', now(), '%{Acct-Session-Time:-0}', \
102 '%{Acct-Input-Octets:-0}', '%{Acct-Output-Octets:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', \
103 '%{Acct-Delay-Time:-0}', NULLIF('%{h323-remote-address}', '')::inet, NULLIF('%{h323-voice-quality}','')::integer, NULLIF('%{Cisco-NAS-Port}', ''), \
104 '%{h323-call-origin}', pick_id('%{h323-conf-id}', '%{call-id}'), strip_dot('%{h323-connect-time}'), '%{h323-disconnect-cause}', \
105 strip_dot('%{h323-disconnect-time}'), '%{h323-gw-id}', strip_dot('%{h323-setup-time}'))"