Online billing - Smartswitch billing subsystem that updates and controls the balance in real time.
Unlike the standard scheme for updating balances, described in the Balances section, Online billing updates balances during a conversation between peers, and not when the call ends.
A separate daemon process is constantly running on the system.
This process cycles through all active channels periodically and calculates the current cost of the call.
After calculating the cost, the process updates the corresponding balances.
The Code Report is also updated.
After the balances have been updated, the process checks if the balance cutoff should be triggered for the current balance.
If the process determines that the cutoff should be triggered, it instructs Telephony to release the call.
After the call has been released, the billing system determines that the call was released through the online billing procedure and does not carry out a full update of the balances, because they have already been updated during the daemon's operation.
Only that part of the call that is between the previous update of the call and its completion is updated in the balance.
All other billing, including saving the CDR, proceeds as usual.
This mode of operation is essential for billing customers who are allowed to originate more than 1 concurrent call and who require a strict prepaid mode when the balance never becomes negative.
Using the standard balance cutoff mode is not suitable for this case.
Suppose the first call came from a client with a positive balance.
Standard mode calculates the cost per minute for the dialed number.
Then, based on the current balance, a session limit in seconds is calculated and set.
Suppose that after this moment, but before the completion of the first call, a second call will come from the same client.
The billing system will again calculate the session limit in seconds for the second call.
But the first call, which is still active now, doesn't count! After all, it has not yet ended and has not updated the balances!
And after the completion of both calls, the client's balance will become negative.
This situation would not be possible if the client had a limit on the number of simultaneous calls equal to 1.
A possible solution to this problem is to divide the balance by the number of allowed simultaneous calls.
But in this case, the client will be allocated the wrong number of seconds if it generates only 1 call.
Online billing copes with this problem, however, it comes with a cost.
The check period for online billing is configurable.
If the period is set too long, the balance checker will find that the calls have gone beyond the positive balance too late.
And the balances will go into a small minus.
If the period is set too short, the controller will consume a lot of CPU resources when checking and updating balances, decreasing the throughput of the system.
Therefore, for each case of installation, the period should be selected individually, based on the number of simultaneous calls serviced by the system and on the hardware capabilities of the system.
The optimal strategy is to set the period to 60 seconds and decrease it until performance problems become noticeable.
Online Billing works closely with Consumption Profiles and can be used together.