QUESTION A2Billing - An Adventure in PBX Billing - Part 1

jbh

Guru
Joined
Dec 16, 2008
Messages
180
Reaction score
0
Many thanks Joe. The solution to a problem I had not yet realised I had !
 

sri2talk

New Member
Joined
Apr 29, 2008
Messages
11
Reaction score
0
Only Certain extensions are sent through a2b

Have you ever thought of having it so only certain extensions are sent through a2billing? For example I have about a dozen or so extensions at my house that I don't want to pass through the system. Or are you going to just use a certain account code for all of your internal extensions and put a certain credit amount on that? I haven't worked with a2billing and the last time I tried I was a little overwhelmed on how to set it up, so I'm really enjoying this so far!

I think you can set up 2 trunks. 1 set of trunks require 9 as a prefix. These are sent to a2b. The extension ATAs that need to be billed will have a dialing prefix of 9 set in their config so that any number they dial will be prefixed with 9.
 

sri2talk

New Member
Joined
Apr 29, 2008
Messages
11
Reaction score
0
Thanks for the above suggestion for using the Jeff Howe method. In fact it is much better and cleaner than using the ATAs to prepend 9. The issue with ATAs prepending 9 was that a *97 would come in as 9*97 - unacceptable.
 

sri2talk

New Member
Joined
Apr 29, 2008
Messages
11
Reaction score
0
I am not getting the user prompts for prepaid-welcome etc. Are they synthesized on the fly? i.e. Do I need to have festival/cepstral on the same machine as asterisk/a2billing?
 

Bart

Active Member
Joined
Nov 14, 2007
Messages
447
Reaction score
25
Call Report - CDR Report show wrong time

The server reports correct time and timezone in php.ini is correct so I've ran out of places to check - I appears +7 ahead.

What am I missing?

Bart
 

dbenwit

New Member
Joined
Apr 26, 2009
Messages
13
Reaction score
0
Handling Multiple Incoming DIDs + Company Directory Issue

I have used this article to set up serveral installations of A2Billing to bill for incoming and outgoing calls on asterisk-based PBXs and it has been invaluable. Thus, I would like to relate my experiences in dealing with the setup of multiple incoming DIDs which require different rating. (ie. local DID + several Toll Free DIDs) What I will describe may be obvious to many, but was certainly not to me. I would also like to warn of a problem which I have encountered with the Company Directory using this approach.

I set up an incoming route for each of the DIDs and send it to the A2B-DID custom destination. As I want each of these incoming DID calls to hit the auto-attendant, I have set up a custom feature code using Misc. Applications with its destination being the IVR for the auto-attendant, just as outlined in this article, for each of the DIDs (ie. 900, 901, 902). I then create an entry under Incoming DID - Destination in A2Billing for each of the DIDs, using a different custom feature code as the destination for each of the DIDs. This then allows me to set up separate rate for each of the DIDs and A2Billing will rate incoming calls on each DID accordingly.

The configuration has worked well, except for one issue which has been both annoying and dangerous. It has to do with an incoming call in which the caller selects to use the Company Directory option (pressing the # key) and then hangs up before connecting through to an extension. The result of this is a looping created in the Asterisk CLI and ultimately an uncontrollable growth in the asterisk log file leading to the crashing of asterisk or a full disk drive after several days, if the problem is not detected. The only way to stop this, as far as I have been able to determine, is to reboot the server.
The loop in the /var/log/asterisk/full log is as follows:

From Asterisk CLI [2009-06-23 23:20:38] WARNING[3517] file.c: Failed to write frame
[2009-06-23 23:20:38] VERBOSE[3517] logger.c: -- <Local/900@from-internal-e886,2> Playing 'dir-intro-fnln-oper' (language 'en')
[2009-06-23 23:20:38] VERBOSE[3517] logger.c: -- Playing 'dir-nomatch' (escape_digits=) (sample_offset 0)
[2009-06-23 23:20:38] WARNING[3517] file.c: Failed to write frame
[2009-06-23 23:20:38] WARNING[3517] file.c: Failed to write frame
[2009-06-23 23:20:38] VERBOSE[3517] logger.c: -- <Local/900@from-internal-e886,2> Playing 'dir-intro-fnln-oper' (language 'en')
[2009-06-23 23:20:38] VERBOSE[3517] logger.c: -- Playing 'dir-nomatch' (escape_digits=) (sample_offset 0)
[2009-06-23 23:20:38] WARNING[3517] file.c: Failed to write frame
[2009-06-23 23:20:38] WARNING[3517] file.c: Failed to write frame
[2009-06-23 23:20:38] VERBOSE[3517] logger.c: -- <Local/900@from-internal-e886,2> Playing 'dir-intro-fnln-oper' (language 'en')

If you open the Asterisk CLI, you will observe the following lines scrolling by continuously:

From Asterisk CLI -- Playing 'dir-nomatch' (escape_digits=) (sample_offset 0)
-- <Local/900@from-internal-e886,2> Playing 'dir-intro-fnln-oper' (language 'en')
-- Playing 'dir-nomatch' (escape_digits=) (sample_offset 0)
-- <Local/900@from-internal-e886,2> Playing 'dir-intro-fnln-oper' (language 'en')
-- Playing 'dir-nomatch' (escape_digits=) (sample_offset 0)
…<Local/900@from-internal-e886,2> Playing 'dir-intro-fnln-oper' (language 'en')

This is the tell tale sign of the problem beyond the large log files.

I have been able to isolate this problem to the routing of the incoming call through A2Billing as I cannot reproduce it if I bypass A2Billing in the incoming route (ie. do not use A2B-DID as the destination, but rather the IVR). I have read that this problem is related to the use of the custom feature code for setting a destination for incoming DID calls, but there was no solution offered.

Has anyone else experienced this problem, and, if so, have any solution?

Dave
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

If you have a number of customers where you wish to rate the incoming DID, and for that matter outbound calls, then it may be an idea to bring the DID to your own central A2Billing server, and do the rating there.

Other than that, I do not see any immediate way around the problem. The rating of the DID is a convoluted solution, and would be better served by doing it code.

We are looking at a solution for 1.4 where the A leg is rated, and added to the B leg, however there is other stuff further up the priority list at the moment.

In as much as rebooting is concerned, issuing the command amportal kill, followed by amportal start should avoid the need to reboot.

Joe
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
That's a a pretty dangerous bug if anyone on your server can dial in, press #, hang up, and know that the server is destined to crash. What could be more important than fixing that? :confused5:
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

The methodology used to rate an inbound call is somewhat convoluted.

As you know, the call comes into FreePBX as an inbound route, and we send it off to A2Billing tagged as a DID.

When it arrives at A2Billing, the destination has to go through a trunk in order to be rated.

So a trunk of technology "Local" is created to the appropriate context - usually the "from-internal" context.

Now this is a bodge to achieve this particular functionality, of rating DID by the minute. Normally DID are delivered for a fixed monthly cost, and no per minute charges, and so there is usually no need to follow this methodology.

However, more and more DID providers are charging by the minute, and as such we are doing development work to be able to charge the A Leg, or indeed credit the A Leg for Revenue share numbers, and add (or subtract) the cost to the B Leg.

However, A2Billing has never been designed to add the A Leg to the BLeg, so some major re-writes are required.


If you use any product in the way that it was not designed to work, then problems can be expected.

Such is the beauty of open source, we can all, if we wish, apply some ingenuity, thought and consideration to the problem.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
The methodology used to rate an inbound call is somewhat convoluted.

If you use any product in the way that it was not designed to work, then problems can be expected.

That makes perfect sense if we were talking about providers using a product in an unanticipated way. But this involves end users being able to destroy an Asterisk server by pressing # and then hanging up.

It's really <strike>disingenuous</strike> inappropriate to attribute the bug to "the beauty of open source" or leave it for others to fix. :crazy:
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Sending the call into FreePBX, sending it into A2Billing, looping it back into the company directory, rather than an extension or ring group was not something that was tested, and we did not anticipate this particular scenario, when writing the instructions. I would re-iterate that it may be best to avoid using this methodology for this particular scenario, until the time is found to look at this issue in more detail, to work out whether the issue lies in FreePBX dial plan or the asterisk dial command.

The last act that A2Billing does, is send a dial command back to asterisk, so this may be the area to concentrate on.

In respect of your comment, disingenuous defined as not candid or sincere, especially in feigning ignorance

(source - http://www.askoxford.com/concise_oed/disingenuous?view=uk)

I'm not sure whether that is a fair comment.

Joe
 

therock112

Member
Joined
Dec 13, 2007
Messages
143
Reaction score
0
Can A2billing be installed and configured simply by running a script?

or does each admin have to go thru the painfull setup process to get this working.....
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
heh. Now you're learning the true meaning of open $ource, at least to some. :wink5:
 

sri2talk

New Member
Joined
Apr 29, 2008
Messages
11
Reaction score
0
A2Billing: calling Card Access number does not proceed

For this adventure in A2Billing, we will activate another cool part of our Family Telephone System platform.

In an earlier article I mentioned that A2Billing is a great platform for calling card services. Calling Card services allow a user to call into the PBX, authenticate themselves, and then place outbound calls from the PBX which are billed to their A2B account.

In our case, we can think of it as being rather like DISA with billing.

Overview
For a variety of reasons, it can be very desirable to be able to call into your PBX, get a dial-tone, and make an outbound call. So desirable in fact that FreePBX has DISA to facilitate that very thing. However – DISA isn’t billed – and that’s not going to work.

What we need is a DISA like solution that keeps A2Billing happily in the loop and rating (billing) these calls.

Here are the general steps we need to take to accomplish this.
  • Have an available DID to use for the inbound calls.
  • Create a new agi-conf context to be used to configure the behavior of A2B when it is handling calling-card calls.
  • Create a Custom Destination for the new agi-conf context.
  • Create a new context to route the inbound Calling Card DID to the new agi-conf context.
  • Configure A2B with users CID to allow for pass-through authentication in A2B. This way, the inbound callers’ caller id is used to authenticate them – and they are not prompted to authenticate by entering their card number.
Creating the agi-conf
The agi-conf contexts determine specific behaviors related to how A2B processes the calls run through it. We will create one designed for the Calling Cards behaviors. In FreePBX, Tools, Config Edit, open a2billing.conf.

Near the bottom of the file, you will find the context called agi-conf1. This context was setup and configured during a previous article – to reflect the behavior we wanted for outbound calls. Review those settings briefly to recall your previous decisions.

Now, in the editor, copy the context agi-conf1, and paste it immediately below. Change the context name of the newly pasted version to [agi-conf2].

Within the newly created agi-conf2 context, locate the line:
use_dnid = YES - and change it to use_dnid = NO

When you have made the change, click UPDATE to save your changes.

Since the rest of the settings in the agi-conf2 file are based on your previous decisions for outbound call behaviors (from agi-conf1) – there’s little benefit the changing any of the other settings. By leaving them, your users will experience very similar outbound call behaviors from both inside the system, and when using calling card services.

Creating the Calling-Card Dial Plan
Eventually we have to provide a FreePBX destination that gets the inbound calling-card user into the a2b agi-conf2 context that we created above. To do that, we will edit another config file in the FreePBX Config Editor: extensions_a2billing.conf.

You will recall in a previous article we created 2 contexts at the bottom called [custom-a2billing] and [custom-a2billing-did], which we had based on the contexts at the top of the file called [a2billing] and [a2billing-did]. Those previously created contexts are used by A2B to process our inbound and outbound calls right now.

At the bottom of the extensions_a2billing.conf file, paste the following new context:

[custom-a2billing-2]
;For call through service
exten => _X.,1,Answer()
exten => _X.,n,Wait(1)
exten => _X.,n,deadAGI(a2billing.php|2)
exten => _X.,n,Hangup

This context is based on our [custom-a2billing] context, with some changes and additions.

Because this context will be used by a process that plays a sound file, we have added the ANSWER line as the first line of the context. (Its not desirable in the [custom-a2billing] context because that context only transfers calls.)

Because we want the line to finish connecting and stabilize before beginning the outbound sound file playback, we added the WAIT line as the second line.

Lastly, we changed the final digit in the deadAGI line from 1, to 2. This is the change that actually directs the call to use the agi-conf2 context we created in the previous step.

When you have made the change, click UPDATE to save your changes.

Creating the Calling Card Custom Destination
We must expose the new agi-conf2 context in FreePBX so that the Calling-Card DID can be routed to it. From Inside FreePBX, Tools, Custom Destinations, select Add Custom Destination.
Create a New Custom Destination with the following characteristics:
Custom Destination: custom-a2billing-2,${EXTEN},1
Description: A2Billing Calling-Card
And Submit changes to save your work.

You will notice that the Destination context we specified is the exact name of the context we created in extension_a2billing.conf in Creating the Calling-Card Dial Plan, above.

Direct the Calling-Card Access DID to the AGI-CONF2 Context
The last piece of this puzzle is to direct the Calling Card DID to the new Custom Destination.
From Inside FreePBX, Setup, Inbound Routes, decide if you are going to add a new DID route, or modify an existing one. Either way, Set Destination of the inbound route to:
Custom Destinations: A2Billing Calling Card

When you have made the change, click Submit to save your changes. Then Apply and confirm your configuration changes.

Pick up any phone, and dial into the Calling Card DID. You should be prompted by recording to enter your Card Number. Punch in any A2B account card number that has credit enough to make a call. You should be asked for the destination phone number – which signals that you have been successful. Test it by entering a valid card number and making a call.

When you have proven that our work so far has been successful, we will add another cool feature – what I call A2Billing pass-through authentication.

OK. so far everything worked fine. But now, I am not able to dial a DID number from my cell phone to get the calling card prompts.

Here are the excerpts from the logs:
-- Executing [s@macro-privacy-mgr:9] GotoIf("SIP/vitel-inbound-b7a0b5a8", "0?fail") in new stack
-- Executing [s@macro-privacy-mgr:10] SetCallerPres("SIP/vitel-inbound-b7a0b5a8", "allowed_passed_screen") in new stack
-- Executing [9095555555@from-trunk:6] Goto("SIP/vitel-inbound-b7a0b5a8", " custom-a2billing-2|9095555555|1") in new stack
-- Goto ( custom-a2billing-2, 9095555555,1)


/var/log/asterisk/full:
[Aug 18 15:27:56] DEBUG[6022] app_macro.c: Executed application: GotoIf
[Aug 18 15:27:56] VERBOSE[6022] logger.c: -- Executing [s@macro-privacy-mgr:10] SetCallerPres("SIP/vitel-inboun
d-b7a0b5a8", "allowed_passed_screen") in new stack
[Aug 18 15:27:56] DEBUG[6022] app_macro.c: Executed application: SetCallerPres
[Aug 18 15:27:56] VERBOSE[6022] logger.c: -- Executing [9095555555@from-trunk:6] Goto("SIP/vitel-inbound-b7a0b5
a8", " custom-a2billing-2|9095555555|1") in new stack
[Aug 18 15:27:56] VERBOSE[6022] logger.c: -- Goto ( custom-a2billing-2, 9095555555,1)
[Aug 18 15:27:56] WARNING[6022] pbx.c: Channel 'SIP/vitel-inbound-b7a0b5a8' sent into invalid extension '9095555555
' in context ' custom-a2billing-2', but no invalid handler
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

Can A2billing be installed and configured simply by running a script?
Short answer, yes it can.

There is an open source install script included with PiaF for version 1.3.4, and there is are detailed instructions on the A2Billing forum for installing 1.4, as well as an install script modified from my original install script to install 1.4 freely available on the A2Billing forum.

There is some manual customisation to be done to configure A2Billing itself, but that is to be expected as each person's requirements are different.

I've not got round to building an install script to install 1.4 for PiaF because of some dependency issues, which require an upgrade to PHP 5.2, more information as to why Centos have not included PHP 5.2 here:-

https://www.centos.org/modules/newbb/viewtopic.php?topic_id=19917&forum=41

(hp 5.2 is still in the testing repository purely because insufficient people have installed it and reported back their usage to the CentOS-devel mailing list.)

NB: I would not advise using the centos testing repository, as it does not yet seem to include php-mcrypt and php-mhash that is required for A2Billing.

There has also been an issue of time, with a new release, documentation, testing etc, that comes with a new release with so many changes as version 1.4 has over 1.3.4

Should you get stuck, or need a helping hand, then A2Billing offers commercial support and training through it's website, still being developed at www.star2billing.com. Alternatively, the A2Billing forums provide free support, and I have been known to answer the occasional question on these forums.

In respect of the question above:-

Code:
sent into invalid extension 9095555555 ' in context ' custom-a2billing-2', but no invalid handler
This means that you have sent a call into a context, but no match can be found for the extension number (9095555555)you sent in.

You should have a context that looks like this :-
Code:
[custom-a2billing-2]
  ;For call through service
  exten => _X.,1,Answer()
  exten => _X.,n,Wait(1)
  exten => _X.,n,deadAGI(a2billing.php|2)
  exten => _X.,n,Hangup
The 9095555555 should match with the _X.

If your context does not look like this, then obviously alter it, or relax the extension to do a broader match, e.g

Code:
[custom-a2billing-2]
   ;For call through service
   exten => _.,1,Answer()
   exten => _.,n,Wait(1)
   exten => _.,n,deadAGI(a2billing.php|2)
   exten => _.,n,Hangup

I hope this clarifies.

Joe

 

sri2talk

New Member
Joined
Apr 29, 2008
Messages
11
Reaction score
0
The context looks exactly like that.

I am still getting the same issue. If I change my DID target to A2B-Inbound (custom-a2billing context), the call is answered and "Please enter your PIN" prompt is heard. If I enter the card number it says press 9 to call SIP IAX friend. Upon pressing 9 it dials out as 0119095555555 instead of waiting for me to input the number to call.
My contexts:
Code:
[custom-a2billing]
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,deadAGI(a2billing.php|1)
exten => _X.,n,Hangup

[custom-a2billing-2]
exten => _.,1,Answer
exten => _.,n,Wait(1)
exten => _.,1,deadAGI(a2billing.php|2)
exten => _.,n,Hangup
Note: I changed the above based on Joe's suggestion. Same problem.

Do I need to do anything on the a2billing admin screens? I even entered the DID 9095555555 in the available DIDs section.

What is missing?


I am looking for a calling card experience:
1. Call DID for Calling Card access (e.g. 9095555555)
2. Answer: "Welcome to My Calling Card" (I need to put this recording and update a2billing.conf).
3. Caller enters the Card number
4. Prompt for number to call
5. Say balance
6. Call the outgoing number entered
7. Hangup.
 

dbenwit

New Member
Joined
Apr 26, 2009
Messages
13
Reaction score
0
Company Directory Problem

Joe and Ward,

Thanks for commenting on my company directory problem.

I should probably clarify that, in the long term, we would like to have our own separate A2Billing server. However, that is not financially possible for us at the moment. That is why we are running A2Billing directly on the customer IP-PBX.

The workaround at the moment is to disable the company directory in the IVR, however, the customer would like this feature back as soon as possible.

As I indicated previously, I have isolated the problem to be caused by routing the incoming calls through A2Billing, and that, if I bypass A2Billing, there is no problem. As I have read that this problem may be related to the use of custom feature codes created in Misc. Applications in FreePBX/trixboxCE, I would like to come up with a solution to provide the same functionality, but without having to use the custom feature codes. I am currently trying to think of and test out some alternative solutions. If anyone has any ideas, I would welcome them.

Thanks,
Dave
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
Hi

The # key has a special meaning to Asterisk, can you change the # in FreePBX feature codes to something else, such as a 9, just for testing purposes, so we can see if it is the # key that causes the problem.

Joe
 

Members online

No members online now.

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top