# # 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 { # 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 all records are in 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_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. accounting_start_query = "INSERT into ${acct_table1}%{h323-call-type} (RadiusServerName, AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortType, AcctStartTime, ConnectInfo_start, CalledStationId, CallingStationId, ServiceType, FramedIPAddress, AcctStartDelay, h323gwid, h323callorigin, h323calltype, h323setuptime, h323confid, AcctStatusType) values('${radius_server_name}', '%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Type}', '%S', '%{Connect-Info}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-IP-Address}', '%{Acct-Delay-Time:-0}', '%{h323-gw-id}', '%{h323-call-origin}', '%{h323-call-type}', strip_dot('%{h323-setup-time}'), '%{h323-conf-id}', 'Start')" accounting_stop_query = "INSERT into ${acct_table2}%{h323-call-type} (RadiusServerName, AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortType, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStopDelay, H323RemoteAddress, AcctStatusType, CiscoNASPort, h323calltype, h323callorigin, h323confid, h323connecttime, h323disconnectcause, h323disconnecttime, h323gwid, h323setuptime) values('ank-rad1', '%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Type}', '%S', '%{Acct-Session-Time:-0}', '%{Acct-Authentic}', '', '%{Connect-Info}', '%{Acct-Input-Octets:-0}', '%{Acct-Output-Octets:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Acct-Terminate-Cause}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time:-0}', '%{h323-remote-address}', 'Stop', '%{Cisco-NAS-Port}', '%{h323-call-type}', '%{h323-call-origin}', '%{h323-conf-id}', strip_dot('%{h323-connect-time}'), '%{h323-disconnect-cause}', strip_dot('%{h323-disconnect-time}'), '%{h323-gw-id}', strip_dot('%{h323-setup-time}'))" }