[Asterisk-Users] billing realtime
Senad Jordanovic
senad at bicom.us
Wed May 3 01:07:20 MST 2006
asterisk-users-bounces at lists.digium.com wrote:
> Hi Senad
>
> i looking for same thing, that is consider absolutetimeout as a
> timer, everytime is near t zero, 3 secs for example, renew it,
> reacalculate real credit, and start again until some of the parties
> hangup.
>
> The problem is how to iterate in asterisk config, or in deadagi,
> you will need some time values from asterisk anyway, CDR{billsec} and
> CDR{duration}, because i think we have to give this control to
> asterisk, he really knows the timing of calls. Now the problem number
> two. Asterisk set those values above, when the call is completely
> finished, i have tried with deadagi in php whit sleep function,
> nothing, the values of the varialbles are set after hangup extension,
> after deadagi final execution.
If I understood well, when each call is made u give him duration time
based on the billing.
Its wrong direction at start. The only possible solution is in the
asterisk. You need global variable with total time for all channels,
then you need the timer.
Timer can be one by each channel, and each channel timer decrements same
global time variable when it becomes a zero or less terminate all active
channels for that account.
The other way would be to have one timer who decrements global time
variable based on number of active channels. Timer is inactive when
there is no active channels for account.
To explain this, if timer decrement cycle is n second then he should
decrement global remained time variable ACCOUNT_TIME = ACCOUNT_TIME- (n
active channels at the moment) x (timer cycle in seconds).
Then check condition ACCOUNT_TIME <= 0 if true hangup all active
channels for that account.
Then check condition (n active channels for account == 0) if true stop
the timer.
The "n active channels" should be checked on asterisk.
If you create account time variable when first channel of account
becomes active like AV_{some id} and timer who will process this
remaining time.
Then on each new channel for that account you just increment other
variable NAC_{some id} or decrement.
The best is that this variables be asterisk variables (global).
We have not tried above, so be my guest if you have free time :)
Senad
More information about the asterisk-users
mailing list