Get Stop in accounting do some action
Hello everyone I need to update some check and replay attribute in database when get stop in accounting and the session is finish i need to know in which section of virtual server file ( sites-enabled/default) i need to put unlang script (and/or perl script) ? and how i can check in script if accounting get stop packet , read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay . Best regards.
On 3 Mar 2013, at 11:32, Mehdi Ravanbakhsh <babakco@gmail.com> wrote:
Hello everyone
I need to update some check and replay attribute in database when get stop in accounting and the session is finish
i need to know in which section of virtual server file ( sites-enabled/default) i need to put unlang script (and/or perl script) ?
and
how i can check in script if accounting get stop packet , .
preacct { if (Acct-Status-Type == 'Stop') { <read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay> } }
Dear Arran many thanks for your help *i have another question : who can i access to Acctuniqueid of the record in this unlang script and in Perl script ?* * * * * * * * * On Sun, Mar 3, 2013 at 8:30 PM, Arran Cudbard-Bell < a.cudbardb@freeradius.org> wrote:
On 3 Mar 2013, at 11:32, Mehdi Ravanbakhsh <babakco@gmail.com> wrote:
Hello everyone
I need to update some check and replay attribute in database when get stop in accounting and the session is finish
i need to know in which section of virtual server file ( sites-enabled/default) i need to put unlang script (and/or perl script) ?
and
how i can check in script if accounting get stop packet , .
preacct { if (Acct-Status-Type == 'Stop') { <read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay> } }
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Dear Arran i see in log file that first executing preacct section and then UPDATE radacct by AcctStopTime .. if i need to change that record i need to Executing my perl script or uunlang script after database updated with AcctStopTime so do i need chnage the location of this : preacct { if (Acct-Status-Type == 'Stop') { <read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay> } } LOG file : [<thread>] # Executing section preacct from file /usr/local/etc/raddb/sites-enabled/default # Executing section accounting from file /usr/local/etc/raddb/sites-enabled/default rlm_sql (sql): Reserving sql socket id: 0 rlm_sql_postgresql: query: START TRANSACTION rlm_sql_postgresql: Status: PGRES_COMMAND_OK rlm_sql_postgresql: query affected rows = 0 rlm_sql_postgresql: query: UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', expiry_time = 'now'::timestamp(0) - '1 second'::interval WHERE nasipaddress = '78.39.54.132' AND pool_key = '32' AND username = 'test1' AND callingstationid = '188.245.240.75' AND framedipaddress = '192.168.90.100' rlm_sql_postgresql: Status: PGRES_COMMAND_OK rlm_sql_postgresql: query affected rows = 1 rlm_sql_postgresql: query: COMMIT rlm_sql_postgresql: Status: PGRES_COMMAND_OK rlm_sql_postgresql: query affected rows = 0 Released IP 192.168.90.100 (did 78.39.54.132 cli 188.245.240.75 user test1) rlm_sql (sql): Released sql socket id: 0 rlm_sql (sql): Reserving sql socket id: 4 rlm_sql_postgresql: query: UPDATE radacct SET AcctStopTime = ('2013-03-07 07:31:04'::timestamp - '0'::interval), AcctSessionTime = CASE WHEN '176' = '' THEN (EXTRACT(EPOCH FROM ('2013-03-07 07:31:04'::TIMESTAMP WITH TIME ZONE - AcctStartTime::TIMESTAMP WITH TIME ZONE - '0'::INTERVAL)))::BIGINT ELSE NULLIF('176','')::BIGINT END, AcctInputOctets = (('0'::bigint << 32) + '28689'::bigint), AcctOutputOctets = (('0'::bigint << 32) + '80'::bigint), AcctTerminateCause = 'NAS-Request', AcctStopDelay = 0, FramedIPAddress = NULLIF('192.168.90.100', '')::inet, ConnectInfo_stop = '' WHERE AcctSessionId = '81000016' AND UserName = 'test1' AND NASIPAddress = '78.39.54.132' AND AcctStopTime IS NULL rlm_sql_postgresql: Status: PGRES_COMMAND_OK rlm_sql_postgresql: query affected rows = 1 rlm_sql (sql): Released sql socket id: 4 Ready to process requests. On Sun, Mar 3, 2013 at 8:30 PM, Arran Cudbard-Bell < a.cudbardb@freeradius.org> wrote:
On 3 Mar 2013, at 11:32, Mehdi Ravanbakhsh <babakco@gmail.com> wrote:
Hello everyone
I need to update some check and replay attribute in database when get stop in accounting and the session is finish
i need to know in which section of virtual server file ( sites-enabled/default) i need to put unlang script (and/or perl script) ?
and
how i can check in script if accounting get stop packet , .
preacct { if (Acct-Status-Type == 'Stop') { <read some radacct fild of that session to do some calculate and do some query in database in radcheck and radreplay> } }
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (2)
-
Arran Cudbard-Bell -
Mehdi Ravanbakhsh