<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I think, it depends on the complexity of the rate DB data-structure.<br>
And on the skills of the programmer. Some people prefer using pr.
languages<br>
and others DB specific languages. In one of my previous projects the
business<br>
logic was too complicated for a DB specific language (at least for my
skills) so<br>
I went for the rlm_perl way. I think for a programmer with limited
experience<br>
on any commonly used language writing an rlm_perl handle for radius
will not take long.<br>
After all perl is fairly simple. Anyone who has little experience using
c or php or java<br>
would need only a working day to get started. Even the connections to
the DB are simple<br>
since DBI provides a very simple to understand interface (all the
internet how-tos I searched<br>
when I started with perl and DBI had the extact 5 lines of code, even
the same variable names :)).<br>
<br>
Sorry if I sound like a rlm_perl preacher... but I use it on a
production system and it works like<br>
a charm.<br>
<br>
Sebo PL wrote:
<blockquote
 cite="mid:52f9f85c0812031237i1802a559rc58fffe111c57a19@mail.gmail.com"
 type="cite">I think it could be done by some special DB function. <br>
  <div class="gmail_quote">You can write one in plpgsql, then you can
exec it using the sql radius module.<br>
  <br>
  <div class="gmail_quote">2008/12/3 <a moz-do-not-send="true"
 href="mailto:regs@kinetix.gr" target="_blank">regs@kinetix.gr</a> <span
 dir="ltr"><<a moz-do-not-send="true" href="mailto:regs@kinetix.gr"
 target="_blank">regs@kinetix.gr</a>></span>
  <div>
  <div class="Wj3C7c"><br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">
These situations are often in the VoIP billing world. If the rate
changes during a call there is little<br>
you can do in a prepaid billing system (in a postpaid situation this is
not a problem). You have to choose<br>
either to bill your customer with the rate that is valid at the
beginning of the call or at the end of it. Most of the <br>
implemantations choose to bill the customer with the rate that is valid
at the end of the call. I know<br>
this is somewhat inconsistent because if you calculate the remaining
time with a low rate and the rate changes <br>
during the call then you might end up with a negative credit on your
prepaid customer's balance. There is little <br>
you can do to about that. You just have to choose one of the options
above and notify your customers <br>
about your decision. The thing is that all this - although scary at
first sight - is somewhat balanced in the end<br>
(fair-wise) because the probabilities that your customer can make a
call during a low-to-high rate change are<br>
equal with the probabilities that the call follows a high-to-low rate
change. So in the end nobody really loses or wins.<br>
    <br>
You don't have to be a perl expert to use the rlm_perl module. But I
can tell you from my experience that it<br>
gives you control of all different scenarios that may arise. Your
back-end could (usually a DB in these situations)<br>
be as complex as you like (pricelists per customer, per time-slice, per
type, per u-name-it), and your code could<br>
be as complex as you like (and as dynamic as you like) using a 3rd
generation language that gives the flexibility to<br>
do whatever you want.
    <div>
    <div><br>
    <br>
    <br>
Alan DeKok wrote:
    <blockquote type="cite">
      <pre>Saeed Akhtar wrote:
  </pre>
      <blockquote type="cite">
        <pre>Yes I know that freeradius doesn't know whether we are charging $ 1 or
2. But the purpose of asking question was that If a user has 3 hrs left
@ $1/hr and after an hour the rate changes to 0.5/hr then technically
freeradius should reply Session-Timeout = 5hrs as (1hr @ $1/hr + 4hrs @
$0.5/hr). So may be we can create some condition to do so. 
    </pre>
      </blockquote>
      <pre>  See the "expr" module.  It has limited support for some math expressions.

  Alan DeKok.
-
List info/subscribe/unsubscribe? See <a moz-do-not-send="true"
 href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a>
  </pre>
    </blockquote>
    <br>
    </div>
    </div>
    </div>
    <br>
-<br>
List info/subscribe/unsubscribe? See <a moz-do-not-send="true"
 href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br>
  </blockquote>
  </div>
  </div>
  </div>
  <br>
  </div>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
-
List info/subscribe/unsubscribe? See <a class="moz-txt-link-freetext" href="http://www.freeradius.org/list/users.html">http://www.freeradius.org/list/users.html</a></pre>
</blockquote>
<br>
</body>
</html>