Now this time i required a help related to asterisk billing. I want user to get billed in two way or two plan pay per sec and pay per minute. Whenever the call is initiated the balance must be reduced that time itself.when the second minute or seconds is initiated it must deduct the amount that time itself . in other word it must deduct the amount in real time, like our cellular phone does.
Any kind of help or idea will be helpfull
If you want your own solution you can use an agi to determinate:
1: the initial balance
2: the cost per min or seconds of the dialed destination
3: Get the maximum duration of the call with above values, using simple math expressions.
4: Set the timeout(absolut)
5: if the call ends before the timeout update the balance.
i am trying to get if there is any current call in context before making 2nd call. if yes than what is the duration of current call. i have setup above mentioned setup, i check the balance in db before make a call and after call hangup minus the balance and update the table. which works fine.
but if there is a company and it has multiple phone lines 1001, 1002, 1003 etc… but one account how can i check current call duration if there is any before making 2nd call.
company has $1.00 balance.
$0.05 per call/min rate so total mins 20
before make a call i check in db how much balance a company has.
now if a phone line 1001 make call then 1001 has 20 min to talk (now counter started)
1001 has talk 10 mins and call is still in process
now another phone line 1002 make a call and again i check balance in db for balance, result is $1.00
1002 has another 20mins to talk, but it is wrong because 1001 has already been used half of balance and keep using it. plus 1002 has 20min to talk and if next line 1003 dial it will also get 20 min and so on. until 1001 finish all balance and balance get update in table and a new line try to call. please suggest how can i resolve this issue. like phone companies do shared mins. is there any possibility in asterisk that we can setup shared mins among more the 1 phone line. Thanks.