# Id: postgresql.conf,v 1.8.2.11 2003/07/15 11:15:43 pnixon Exp $ # # Configuration for the SQL module, when doing H323 VoIP billing. # # The database schema is available at: # # src/radiusd/src/billing/h323_db_postgresql.sql # sql pgsql-voip { # Database type currently must be rlm_sql_postgresql to work with this setup. driver = "rlm_sql_postgresql" # Connect info server = "localhost" login = "postgres" password = "" # Database configuration radius_db = "radius" # Database table configuration acct_table1 = "Start" acct_table2 = "Stop" authcheck_table = "radcheck" authreply_table = "radreply" groupcheck_table = "radgroupcheck" groupreply_table = "radgroupreply" usergroup_table = "usergroup" # Remove stale session if checkrad does not see a double login deletestalesessions = yes # Print all SQL statements when in debug mode (-x) sqltrace = no sqltracefile = ${logdir}/sqltrace.sql # number of sql connections to make to server num_sql_socks = 25 # Radius server name so you can tell which radius server handled a request # when you have multiple radius servers and one database. radius_server_name = myservername ####################################################################### # Query config: Username ####################################################################### # This is the username that will get substituted, escaped, and added # as attribute 'SQL-User-Name'. '%{SQL-User-Name}' should be used below # everywhere a username substitution is needed so you you can be sure # the username passed from the client is escaped properly. # # Uncomment the next line, if you want the sql_user_name to mean: # # Use Stripped-User-Name, if it's there. # Else use User-Name, if it's there, # Else use hard-coded string "none" as the user name. # #sql_user_name = "%{Stripped-User-Name:-%{User-Name:-none}}" # sql_user_name = "%{User-Name}" ####################################################################### # Accounting Queries ####################################################################### # accounting_onoff_query - query for Accounting On/Off packets # accounting_update_query - query for Accounting update packets # accounting_update_query_alt - query for Accounting update packets # (alternate in case first query fails) # accounting_start_query - query for Accounting start packets # accounting_start_query_alt - query for Accounting start packets # (alternate in case first query fails) # accounting_stop_query - query for Accounting stop packets # accounting_stop_query_alt - query for Accounting start packets # (alternate in case first query doesn't # affect any existing rows in the table) ####################################################################### # Note: The VoIP accouting does not need Alternate queries in the shipped # configuration as all queries are INSERTS, hence should always work. # If they do not work then you probably have duplicate records in your table. accounting_start_query = "INSERT into ${acct_table1}%{h323-call-type} \ (RadiusServerName, UserName, NASIPAddress, AcctTime, CalledStationId, \ CallingStationId, AcctDelayTime, h323gwid, h323callorigin, h323setuptime, H323ConnectTime, callid) \ values('${radius_server_name}', '%{SQL-User-Name}', \ '%{NAS-IP-Address}', now(), '%{Called-Station-Id}', \ '%{Calling-Station-Id}', '%{Acct-Delay-Time:-0}', '%{h323-gw-id}', \ '%{h323-call-origin}', strip_dot('%{h323-setup-time}'), strip_dot('%{h323-connect-time}'), pick_id('%{h323-conf-id}', '%{call-id}'))" accounting_stop_query = "INSERT into ${acct_table2}%{h323-call-type} \ (RadiusServerName, UserName, NASIPAddress, AcctTime, \ AcctSessionTime, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, \ AcctDelayTime, H323RemoteAddress, H323VoiceQuality, CiscoNASPort, h323callorigin, callid, \ h323connecttime, h323disconnectcause, h323disconnecttime, h323gwid, h323setuptime) \ values('${radius_server_name}', '%{SQL-User-Name}', '%{NAS-IP-Address}', now(), '%{Acct-Session-Time:-0}', \ '%{Acct-Input-Octets:-0}', '%{Acct-Output-Octets:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', \ '%{Acct-Delay-Time:-0}', NULLIF('%{h323-remote-address}', '')::inet, NULLIF('%{h323-voice-quality}','')::integer, NULLIF('%{Cisco-NAS-Port}', ''), \ '%{h323-call-origin}', pick_id('%{h323-conf-id}', '%{call-id}'), strip_dot('%{h323-connect-time}'), '%{h323-disconnect-cause}', \ strip_dot('%{h323-disconnect-time}'), '%{h323-gw-id}', strip_dot('%{h323-setup-time}'))" }