[asterisk-users] Pre-paid Billing
Alex Balashov
abalashov at evaristesys.com
Thu Sep 18 09:53:46 CDT 2008
Igor Zamocky wrote:
> Isn't 'don't allow multiple calls' acceptable solution?
> At least, it's the simplest one :)
>
> I can imagine solution with multiple calls allowed, but it needs some external
> synchronous processing. With every call you should start process, that will
> decrement user's balance based on dialled destination, you have to update
> balance every second. After balance=0 you just kill active call(s).
>
> The fact, that there are multiple calls means nothing, just more processes
> will decrement balance for the same user.
>
> Btw, this will give You oportunity upgrade balance during call, so active call
> can be longer than we originally thought - of course, you should not use S(x).
>
> There will be probably a lot of other / more effective, easier, ... / ideas :)
You don't have to update the balance every second - increments of
something like 10 seconds will do. And you can have one synchronous
process - not many - that listens to Manager events and updates the call
times and balances accordingly. An outside process can also trigger a
Hangup event causing the call to be hung up if credit is exhausted, or
too low.
Then, you can define a minimum formula for the balance required to admit
a new call. Something like a minute of credit being required after
subtracting the usage of all existing simultaneous calls in progress at
the next projected utilisation polling interval.
But you are essentially correct. Things are, of course, far easier if
you just don't allow multiple simultaneous calls. :-)
-- Alex
--
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 asterisk-users
mailing list