[Kamailio-Users] CDRTool and Prepaid

Alex Balashov abalashov at evaristesys.com
Fri Sep 5 11:40:32 CEST 2008


Adrian Georgescu wrote:

> It does not require a b2bua. It can be done in the proxy call control 
> module that send out the BYEs and the rating engine. Just the algorithm 
> need to be defined.

I profess ignorance as to how the rating engine works, but I presume 
that it involves an outside process that updates the call duration 
frequently?

If so, I would say that the algorithm should check if there is enough 
credit available for at least a minute of call time at the new rate 
based on the last known temporal position of all existing calls.  This 
threshold should, perhaps, be a configurable parameter.

It won't get it right every time;  that depends on where the polling / 
update interval for call duration falls.  If the update interval is 
known, perhaps the wisest thing to do is to build padding into the 
threshold that rounds up the time consumed by the existing tracked calls 
to what it would be when the next duration tracking interval comes, as a 
fraction of the per-minute rate.

For instance, if there are 3 existing calls open at 2.9c/min and the 
polling interval is 10 seconds, and the new call is 5c/min, then the 
available credit threshold required to complete the new call should be:

   0.05 + (3 * (0.029 / 6))

-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599




More information about the Users mailing list