asterisk2billing.org
http://forum.asterisk2billing.org/

billing error using local channels
http://forum.asterisk2billing.org/viewtopic.php?f=16&t=3185
Page 1 of 1

Author:  paketecuento [ Tue Feb 05, 2008 10:50 pm ]
Post subject:  billing error using local channels

hi there,

I am using FreePBX with A2Billing. The idea is only bill international calls and use the power of FreePBX for the rest (voicemail, transfer, etc)

I've configured a custom trunk in FreePBX to send international calls to A2B:

local/$OUTNUM$@a2billing

the calls are routed to a2billing without any problemas and are authenticated using the FreePBX extension CID (for example, 100). Once in a2billing, I have defined a trunk to send back the call to freepbx

Provider tech: local
Provider IP: %dialingnumber%@from-internal/n

In this way I can control the outbound calls more efficiently.

So everything is ok, the call is processing ok, but when the call is answered, A2B the shows

-- Called voicetrading/00034699889560
-- SIP/voicetrading-09666768 is making progress passing it to Local/34699889560@from-internal-5581,2
-- Local/34699889560@from-internal-5581,1 is making progress passing it to Local/0034699889560@a2billing-3e8b,2
-- Local/0034699889560@a2billing-3e8b,1 is making progress passing it to SIP/100-0968a070
-- SIP/voicetrading-09666768 answered Local/34699889560@from-internal-5581,2
-- Local/34699889560@from-internal-5581,1 answered Local/0034699889560@a2billing-3e8b,2
-- Local/0034699889560@a2billing-3e8b,1 answered SIP/100-0968a070
a2billing.php|1: file:Class.RateEngine.php - line:1152 - -> dialstatus : ANSWER, answered time is 0
a2billing.php|1:
a2billing.php|1: file:Class.RateEngine.php - line:1156 - [USEDRATECARD=0]
a2billing.php|1: file:Class.RateEngine.php - line:913 - [CC_asterisk_stop QUERY = INSERT INTO cc_call (uniqueid,sessionid,username,nasipaddress,starttime,sessiontime, calledstation, terminatecause, stoptime, calledrate, sessionbill, calledcountry, calledsub, destination, id_tariffgroup, id_tariffplan, id_ratecard, id_trunk, src, sipiax, buyrate, buycost, id_card_package_offer) VALUES ('1202248947.64', 'Local/0034699889560@a2billing-3e8b,2', '74751', '', CURRENT_TIMESTAMP - INTERVAL 0 SECOND , '0', '0034699889560', 'ANSWER', now(), '0.2', '-0', '', '', 'todo', '1', '1', '1', '2', '100', '0', '0.1', '0', '0')]
a2billing.php|1: file:Class.RateEngine.php - line:916 - [CC_asterisk_stop 1.1: SQL: DONE : result=1]
a2billing.php|1: file:a2billing.php - line:310 - [a2billing account stop]
a2billing.php|1: file:Class.A2Billing.php - line:649 - [CARD STATUS UPDATE : UPDATE cc_card SET inuse=inuse-1 WHERE username='74751']
-- AGI Script a2billing.php completed, returning 0


So the call is answered, but a2billing is always considering a duration of 0 seconds!!!

I am using 1.3.1 and 1.3.2...

any idea??

Author:  stavros [ Tue Feb 05, 2008 11:06 pm ]
Post subject: 

Presumably A2B is billing correctly for standard calls? If not you're suffering one of several common issues, covered ad nauseam on this forum.
These folks are doing something similar with FreePBX and reporting success. Perhaps you can glean a little insight from them.

Author:  paketecuento [ Tue Feb 05, 2008 11:16 pm ]
Post subject: 

stavros wrote:
Presumably A2B is billing correctly for standard calls? If not you're suffering one of several common issues, covered ad nauseam on this forum.
These folks are doing something similar with FreePBX and reporting success. Perhaps you can glean a little insight from them.


hi stavros,

A2B is billing correctly as allways, in the standard mode :) If you define a customer and a sip friend, everything is perfect...

The link you provided was the first one I saw, but it is a bit different what I am experiencing. Anyway, they are modifying FreePBX itself, while I'm not doing that at all!!!

Author:  jroper [ Tue Feb 05, 2008 11:33 pm ]
Post subject: 

Quote:
The link you provided was the first one I saw, but it is a bit different what I am experiencing. Anyway, they are modifying FreePBX itself, while I'm not doing that at all!!!


And that is why you are getting 0 durations from FreePBX to A2Billing. It is actually recording the length of time from FreePBX to dial to A2Billing to dial.

It is the double dial that causes the problems.

Joe

Author:  paketecuento [ Wed Feb 06, 2008 7:53 am ]
Post subject: 

jroper wrote:
Quote:
The link you provided was the first one I saw, but it is a bit different what I am experiencing. Anyway, they are modifying FreePBX itself, while I'm not doing that at all!!!


And that is why you are getting 0 durations from FreePBX to A2Billing. It is actually recording the length of time from FreePBX to dial to A2Billing to dial.

It is the double dial that causes the problems.

Joe


So, what do I need to change..??? FreePBX?? A2Billing?? Is it more complicated than in appeareance?

any idea, please??

regards, paco

Author:  jroper [ Wed Feb 06, 2008 8:13 am ]
Post subject: 

Hi

You will have to follow the post mentioned above to achieve this, but don't upgrade anything, cos you will break it.

Alternatively, wait until I have been to the FreePBX (http://freepbx.org/open-telephony-training-seminar-0001) course and see if I can discover a more elegant way of doing it.


Joe

Author:  paketecuento [ Wed Feb 06, 2008 9:22 am ]
Post subject: 

jroper wrote:
Hi

You will have to follow the post mentioned above to achieve this, but don't upgrade anything, cos you will break it.


:)... The problem is that the other post shows a way that there is not avalaible any more: macro-dialout-trunk is now in extensions_additional.conf.
It seems that changes must be done in macro-dialout-trunk-custom this time!!!

Update: In FreePBX 2.4, macro-dialout-trunk is in extensions_additional.conf, but in 2.3.x is in extensions.conf


let's investigate...

paco

Author:  middletn [ Wed Feb 06, 2008 5:58 pm ]
Post subject: 

The local channel should not be used for billing!!! The reason is that the variables passed to A2B are volatile. This is why you are getting a zero duration value

regards

Author:  paketecuento [ Wed Feb 06, 2008 9:33 pm ]
Post subject: 

middletn wrote:
The local channel should not be used for billing!!! The reason is that the variables passed to A2B are volatile. This is why you are getting a zero duration value

regards


umhhh, you kill me!!! So local channel is not suitable to use with A2B!!!

ok, i will try to re-arrange the code proposed by cyberglobe.

thanks for the info...

paco

Author:  jroper [ Wed Feb 06, 2008 11:34 pm ]
Post subject: 

I spoke to Philippe Lindeheimer (FreePBX lead developer) a while ago, here are a few relavent snippets of his email regarding integration of A2Billing and FreePBX: -

"The routing/trunking code in FreePBX is about the most archaic. One of those ugly areas that we’ve been wanting to gut for a long time. (Still operates much like in AMP).

As far as a current solution though – you could simply use the macro-dialout-trunk-predial-hook which is a hook that is called in macro-dialout-trunk, just prior to doing the dial command. It allows you to do anything you want, including the setting of a return code to skip the current trunk – which would not be necessary since upon exit you are hung up. You can create your custom trunk as you do today, but instead of allowing the call to go through, you can detect that it is the desired and then make your agi call in that hook."


So those are Philippe's suggestions, your quick and easy alternative of course is to set up a second box for A2Billing.

Joe

Author:  stavros [ Thu Feb 07, 2008 12:15 am ]
Post subject: 

plindeheimer wrote:
you could simply use the macro-dialout-trunk-predial-hook which is a hook that is called in macro-dialout-trunk, just prior to doing the dial command.
Good on you, Joe. That sounds very promising.
jroper wrote:
quick and easy alternative of course is to set up a second box for A2Billing.
It would be even quicker and easier, and more economical of energy and space, to use virtualisation such as Linux-VServer. Whichever route (physical or virtual) you choose, enabling Asterisk's 'canreinvite' will eliminate any RTP overheads during the call.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/