Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1288 → Rev 1289

/conf/radius/counter.conf
34,7 → 34,7
# The 'query' parameter specifies the SQL query used to get
# the current Counter value from the database. There are 3
# parameters that can be used in the query:
# %k 'key' parameter
# ${key} 'key' parameter
# %b unix time value of beginning of reset period
# %e unix time value of end of reset period
#
59,7 → 59,7
# below
query = "SELECT SUM(acctsessiontime - \
GREATEST((%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \
FROM radacct WHERE username = '%{%k}' AND \
FROM radacct WHERE username = '%{${key}}' AND \
UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%b'"
 
# This query ignores calls that started in a previous
66,13 → 66,13
# reset period and continue into into this one. But it
# is a little easier on the SQL server
# query = "SELECT SUM(acctsessiontime) FROM radacct WHERE \
# username = '%{%k}' AND acctstarttime > FROM_UNIXTIME('%b')"
# username = '%{${key}}' AND acctstarttime > FROM_UNIXTIME('%b')"
 
# This query is the same as above, but demonstrates an
# additional counter parameter '%e' which is the
# timestamp for the end of the period
# query = "SELECT SUM(acctsessiontime) FROM radacct \
# WHERE username = '%{%k}' AND acctstarttime BETWEEN \
# WHERE username = '%{${key}}' AND acctstarttime BETWEEN \
# FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"
}
 
90,7 → 90,7
# below
query = "SELECT SUM(acctsessiontime - \
GREATEST((%b - UNIX_TIMESTAMP(acctstarttime)), 0)) \
FROM radacct WHERE username='%{%k}' AND \
FROM radacct WHERE username='%{${key}}' AND \
UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '%b'"
 
# This query ignores calls that started in a previous
97,13 → 97,13
# reset period and continue into into this one. But it
# is a little easier on the SQL server
# query = "SELECT SUM(acctsessiontime) FROM radacct WHERE \
# username='%{%k}' AND acctstarttime > FROM_UNIXTIME('%b')"
# username='%{${key}}' AND acctstarttime > FROM_UNIXTIME('%b')"
 
# This query is the same as above, but demonstrates an
# additional counter parameter '%e' which is the
# timestamp for the end of the period
# query = "SELECT SUM(acctsessiontime) FROM radacct \
# WHERE username='%{%k}' AND acctstarttime BETWEEN \
# WHERE username='%{${key}}' AND acctstarttime BETWEEN \
# FROM_UNIXTIME('%b') AND FROM_UNIXTIME('%e')"
}
 
114,11 → 114,11
key = User-Name
reset = never
# This is the original query
# query = "SELECT IFNULL(SUM(AcctSessionTime),0) FROM radacct WHERE UserName='%{%k}'"
# query = "SELECT IFNULL(SUM(AcctSessionTime),0) FROM radacct WHERE UserName='%{${key}}'"
# This is the query modified for ALCASAR needs (thanks to Daniel Laliberte --> authorized period after the first connection)
query = "SELECT IFNULL((SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) \
FROM radacct \
WHERE UserName='%{%k}' \
WHERE UserName='%{${key}}' \
ORDER BY acctstarttime \
LIMIT 1),0)"
}