| # -*- text -*- |
| # |
| # cui/postgresql/queries.conf -- Queries to update a PostgreSQL CUI table. |
| # |
| # $Id: 6c2215f0abbe5cb30658ea541d525fd7a274c547 $ |
| |
| post-auth { |
| query = "\ |
| INSERT INTO ${..cui_table} \ |
| (clientipaddress, callingstationid, username, cui) \ |
| VALUES \ |
| ('%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}', '%{Calling-Station-Id}', \ |
| '%{User-Name}', '%{reply:Chargeable-User-Identity}')" |
| |
| } |
| |
| accounting { |
| reference = "%{tolower:type.%{Acct-Status-Type}.query}" |
| type { |
| start { |
| query = "\ |
| UPDATE ${....cui_table} SET \ |
| lastaccounting = now() \ |
| WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \ |
| AND callingstationid = '%{Calling-Station-Id}' \ |
| AND username = '%{User-Name}' \ |
| AND cui = '%{Chargeable-User-Identity}'" |
| } |
| interim-update { |
| query ="\ |
| UPDATE ${....cui_table} SET \ |
| lastaccounting = now() \ |
| WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \ |
| AND callingstationid = '%{Calling-Station-Id}' \ |
| AND username = '%{User-Name}' \ |
| AND cui = '%{Chargeable-User-Identity}'" |
| } |
| stop { |
| query ="\ |
| DELETE FROM ${....cui_table} \ |
| WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \ |
| AND callingstationid = '%{Calling-Station-Id}' \ |
| AND username = '%{User-Name}' \ |
| AND cui = '%{Chargeable-User-Identity}'" |
| } |
| } |
| } |