Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 3:00 pm
Voice Broadcast System


All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: negative balance when canreinvite is enabled
PostPosted: Fri Dec 18, 2009 6:22 am 
Offline

Joined: Wed Apr 01, 2009 6:09 am
Posts: 5
Hi, Sir:
I found that when canreinvite=yes is enabled, even restrict to single channel phone call will result in negative balance in calling card case. My understanding is that when caller initially calls the system, the asterisk uses Dial() command to make the call to termination. But after sip reinvite, the a2billing essentially handles the call to the caller and the callee directly. And it appears that it doesn't actively monitor the call any more. So when the call lasts longer than the credit allows, the call still continues between caller and callee. When the caller or callee finally hang up, the server updates the cc_card record, resulting in negative balance.
I wonder if there is any way to resolve this. sip reinvite is very useful in reducing the server bandwidth usage and improve call quality. But this negative balance is preventing me from using it. If somebody can point me to the method and where to make the code change, I will try to get this done.
I am using 1.3.2 A2B and 1.4 asterisk.


Top
 Profile  
 
 Post subject: Re: Logic behind simultaneous calls and maintain the balance
PostPosted: Fri Dec 18, 2009 9:13 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

Can you show us what you have put in your dialcommand_param in the agi-conf.

With the default settings (L), I don't think a re-invite happens, as there is a possibility that Asterisk will have to play some more IVR, so you have to change this to an S.

Joe


Top
 Profile  
 
 Post subject: Re: Logic behind simultaneous calls and maintain the balance
PostPosted: Sun Jan 10, 2010 6:27 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Hello

Happy new year 2010. I wish more donation and success for A2Billing.

I am using reinvite and I have never noticed that it could be the cause for negative balance. That is something to investigate.

During one of our experiments with asterisk, we have noticed that asterisk is able to dynamically put itself in the rtp path when necessary. So basically, the rtp debug was not showing a single rtp packet while the sip debug was showing lots of them. But as soon as we entered the code for spying on a channel or monitoring the call, the rtp packets started going through asterisk. Then after finish our spying or monitoring, the rtp disapeared from asterisk and started going directly from the caller to the callee.

When using reinvite, the signaling is still routed through asterisk, and that's all that is needed in order to disconnect the call when that time comes. I don't thing that asterisk monitors the rtp waiting for the disconnection time to arrive. It merely sets a timer that determines when a call must be disconnected regardless of the reinvite status.

Cheers


Top
 Profile  
 
 Post subject: Re: Logic behind simultaneous calls and maintain the balance
PostPosted: Fri Feb 27, 2015 7:23 am 
Offline

Joined: Fri Feb 27, 2015 7:18 am
Posts: 2
Location: UA, Zhitomir
Hello!
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.

A2Billing v2.0.16

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

Quote:
When the per-minute billing (per 1 minute), min_duration_2bill = 60, dial_balance_reservation = 0.0
-2.886 USD
-5.352 USD
-9.952 USD

With per-second billing, min_duration_2bill = 1, dial_balance_reservation = 0.99
-0.792 USD
-0.992 USD

If you disable per-second counter (without dropping a call) and without "pre-booking" the cost of the call
-0.139 USD

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.


Top
 Profile  
 
 Post subject: Re: Logic behind simultaneous calls and maintain the balance
PostPosted: Fri Feb 27, 2015 8:52 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

If i understand correctly, you want to check the current balance almost continuously. The hits on the database for several hundred concurrent calls may be huge, and the revenue you keep by not allowing any negative balance may exceed the revenue you lose by not being able to have as higher call capacity on your hardware.

Now that Asterisk allows execution of dialplan after the AGI-Conf has hung-up, there may be a halfway house solution with less load on the platform by extending the dialplan we have at http://www.asterisk2billing.org/add-ons ... ls-module/ which limits the number of concurrent VoIP calls in dialplan.

It could be extended that each time a call is hung-up, the balance is checked for that customer, and if the balance is less than the minimum credit to call, then hang-up all calls belonging to that customer.

There would still be the possibility of negative balance, but the figures would be very much lower.

Joe


Top
 Profile  
 
 Post subject: Re: Logic behind simultaneous calls and maintain the balance
PostPosted: Fri Feb 27, 2015 9:35 am 
Offline

Joined: Fri Feb 27, 2015 7:18 am
Posts: 2
Location: UA, Zhitomir
Where can I find these settings?


Top
 Profile  
 
 Post subject: Re: Logic behind simultaneous calls and maintain the balance
PostPosted: Fri Feb 27, 2015 9:45 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

There are settings in the database to set the number of concurrent calls, but no code in A2Billing to respect these settings.

We have written some dialplan to refer to these database settings, which you are welcome to purchase. We can also provide a quote to extend this functionality as described in my last post.

Alternatively, you can write your own dialplan to do the same thing.

Joe


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group