There is a problem: You can write code that will disable users who ended the balance, even if they speak at this time? To balance did not go negative. Maybe we can somehow change the timeout value when there is a conversation?
Help solve the problem.
min_credit_2call = 0.25 (0.99, 0.00)
min_duration_2bill = 0
dialcommand_param = |60|HRrL(%timeout%:61000:00000)
dial_balance_reservation = 0.0
When the per-minute billing (per 1 minute), min_duration_2bill = 60, dial_balance_reservation = 0.0
With per-second billing, min_duration_2bill = 1, dial_balance_reservation = 0.99
If you disable per-second counter (without dropping a call) and without "pre-booking" the cost of the call
From -0,139 to -5.352 USD
I think that, in order to properly calculate the balance of the subscriber (without a care in the negative), then you need to call is managed by the AGI script to specify the settings to connect to the database and the fields to be read and updated.
That is, I can see this logic:
The call came in the context, then went to the AGI, following script to check the current balance if it is positive, then send the call to the trunk through it, while if the other side responded, the script updates every second balance basis, taking into account the cost of direction, then reads the new value of the balance sheet and check if the balance is greater than 0, then continue to perform call / update the balance. In this second call from the same account will receive the current balance and at the same time to update the timeout counter for all active calls / channels on actual data. Upon reaching the 0 on the balance sheet, the script that got 0 when checking automatically stops all other calculations and breaks all active connections account. In this follow-up calls are already locked, as the balance of 0 (even if for 1 sec. Will be two calls at the same time, in the same second, which is almost impossible), as the script will handle each call separately.