I have done something similar to your thing with prepaid - I actually have
to handle prepaid and pay-by-the-month callers.  I use postgres as the
database,  and added a few tables, for instance one that records how much
prepaid time the customer has left.  Then I created triggers that work on
the radacct table, so that when the stop entry is made, it then processes
that information, deducts how much time they have available, does the
charging for the customers on pay-by-the-month, etc.
For authorisation, for the prepaid customers, I return the session-timeout
value to be how much time they have left, + 1 second.  So, if they have run
out of time, it authenticates them, but with a timeout of 1 second, so they
are pretty much instantly disconnected.
It did take quite a bit of programming within postgresql to get all the
triggers happening and get everything running smoothly, but it is now in
production and running very sweetly.  It handles customers who are prepaid,
as well as pay-by-the-month.  Some pay-by-the-month customers are charged
according to amount of time, while others are charged by data, and some are
even charged on a combination of both.

----- Original Message -----
From: "Galileo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 11, 2001 12:52 PM
Subject: A relly big question


> Well here is a really big and maybe stupid question but please if you have
time
> write a few lines.
> Here it goes.
> I'm truing to use a freeradius to  do the following :
> I  need freeradius to work with 3coms superstack 3 1500 NAS and to grant
access
> to  users  for  a  certain  amount of prepaid time and when that time
expire to
> disconnect users and if they try to connect again to deny access until
they pay
> for some more :)).
> If you are wondering why the hell do a need such a thing, well that is how
ISPs
> work here in Yugoslavia.
> Here is my setup: No nas at all using ntradping to emulate one.
> Freeradius 0.3. Mysql database. Dialup-admin as a frontend.
> Slightly modified authorize_check_query and authenticate_query
> to check if session-timeout in radreply table is smaller then 0 and to
deny access.
> If  anyone  is  interested  in details find a mail with subject "Database
design
> question" in the list archive.
>
> So wright now I need a accounting_stop_query which would update
session-timeout in
> radreply table when accounting stop occurs to something like this
> sesion-timeout = sesion-timeout (old value) - '%{Acct-Session-Time}'
> this  way  user will be able to have internet access for some prepaid
amount of
> time.
> I tried to test it like this :
>
>
> accounting_stop_query = "UPDATE ${acct_table1} SET AcctStopTime = '%S',
AcctSessionTime =
> '%{Acct-Session-Time}', AcctInputO
> ctets = '%{Acct-Input-Octets}', AcctOutputOctets =
'%{Acct-Output-Octets}',
> AcctTerminateCause = '%{Acct-Terminate-Cause}', AcctStop
> Delay = '%{Acct-Delay-Time}', ConnectInfo_stop = '%{Connect-Info}' WHERE
AcctSessionId =
> '%{Acct-Session-Id}' AND UserName = '%{SQL-
> User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'; UPDATE radreply SET
Value
> ='%{Acct-Session-Time}' WHERE UserName= '%{SQL-User-Na
> me}' AND Attribute = 'Session-Timeout';"
>
>
> but freeradius complaints it cannot update accounting start ??
>
> This query works in mysql console tool so its not a mistake in a sql
query.
> What's the right way to do this ?
>
> Second thing that's bothering me is what will happen if an isdn user logs
in.
> I have  to bill isdn calls differently. If an isd user only uses one isdn
channel
> then he would be billed as a normal call or maybe x1.5 but when he uses
both of
> his channels he should be billed x2 or maybe even x3.
>
> And   third  and  last  question is not freeradius oriented but someone on
this
> list  probably  knows. If a 3com superstack 3 1500 NAS receives
session-timeout
> attribute of 10 seconds, would it disconnect a users after 10 seconds of
online
> time or not.
>
> This is the last thing that is keeping me from building an linux only isp
> so if anyone can spare a couple of wise words I would appreciate it
greatly.
>
> If you have read this mail so far then thank you for your time
> an  if  not then best wishes to you all and greetings from cold (-10 C )
Yugoslavia
> :))
>
>
> -
> List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html
>
>



- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to