[Kamailio-Users] CDRTool and Prepaid

DanB danb at sms4sip.com
Fri Sep 5 11:35:20 CEST 2008


Adrian,

here is what came into my mind at a glance.

There should be a billing daemon monitoring the calls. Not sure how it
should be done with the help of dialog of openser (hope that nobody here
get's offended but maybe could use some ideas to implement the same
mechanism in *SER dialog module).
The module should be responsible of each single call passing through B2BUA.
The max-duration should be shared between the calls belonging to the same
account.
There should be two different actions done:
1. On disconnect of each call, update the rating engine with the disconnect
info, plus recalculate the maximum duration permitted on the account.
2. At regular intervals, update the max-duration of the calls belonging to
the same account based on balance left. When balance 0, disconnect all the
calls belonging to the same account.

Now, the entire scenario would be easier with the help of rating-engine.

Billing example:

1. Call starts: in auth phase rating_engine is queried. If balance is not 0,
the call will be authorized. No need anymore of maximum duration or account
locking, just balance left.
2. Billing Daemon of B2BUA will regularly update rating engine with the
information about active calls, therefore rating-engine will need to
recalculate the balance left and return it.
3. As soon as the rating engine will return balance 0, all the calls will be
disconnected.

The whole scenario involves a minimum risk of negative balance but it will
all depend on how often billing daemon updates call states into rating
engine.

Cheers,
DanB




On Fri, Sep 5, 2008 at 11:05 AM, Alex Balashov <abalashov at evaristesys.com>wrote:

> In my experience dealing with it, it is precisely at the point where
> multiple calls are involved that using a proxy for rating and mediation
> purely becomes an impossible headache.
>
> The conclusion I always came to in my implementations, which too always
> started out with the noble goal of dealing with it all in proxy, is that
> to properly handle this, I would need to extend the functionality to
> include a B2BUA through which the calls are run that can sit there and
> monitor them at a relatively low interval and record updates to their
> duration into the database.
>
> The B2BUA would need some sort of call control API, like Asterisk's
> Manager API, or whatever Yate has, so that an outside process can sit
> there and do statekeeping on the calls.  You could do this without
> handling media by using the B2BUA in a purely signaling capacity, which
> I think is how Yate functions by default, and how Asterisk can function
> with the "directrtpsetup" option in sip.conf.
>
> It is then possible to know in reasonably real time the call duration
> without waiting for an accounting stop event and thus make the
> determination of whether another call should be allowed given the
> balance depletion.
>
> -- Alex
>
> Adrian Georgescu wrote:
>
> > The problem with concurrent prepaid calls and single balance is that
> > you have to correlate between the call control and rating angine
> > somehow so that all calls terminate when balnce becomes zero. The
> > problem is a bit complex:
> >
> > Example:
> >
> > Balance = 10.
> > A call starts to destination XXX, for the sake of example max session
> > time = 2 minutes
> > After one minute, you start second call to destination YYY which has a
> > different price and your balance is not anymore 10 but depends on the
> > duration of the first call which is in progress.
> >
> > What is the maximum session time for it given that the first call is
> > already in progress?
> > What should happen with the first call?
> >
> > I am looking for suggestions on implementing a proper algorithm to
> > deal with this situation in the rating engine. If you have any I would
> > be glad to hear it.
> >
> > Adrian
> >
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.kamailio.org
> > http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>
>
> --
> Alex Balashov
> Evariste Systems
> Web    : http://www.evaristesys.com/
> Tel    : (+1) (678) 954-0670
> Direct : (+1) (678) 954-0671
> Mobile : (+1) (706) 338-8599
>
> _______________________________________________
> Users mailing list
> Users at lists.kamailio.org
> http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20080905/155062f8/attachment.htm 


More information about the Users mailing list