
12-18-08, 12:56 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing - Part 1
Starting to tackle A2Billing – and not for the first time – brought out a few emotions. I mean – I like a good hard technical problem to sink my teeth into. Note that I said hard not impossible. But my first few dips into the cool waters of A2Billing just about froze my nu.., um, nasal cavities. I don’t know why I have found it so hard to get my brain around how A2Billing gets installed, and configured.
Well this time, I’m motivated. I mean, I actually finally wrote a couple dial plans all by myself, and understood what I was doing – sorta. I must be ready to tackle billing, right?
Well – I thought it might be helpful to document what works for anyone else with no experience and a definite mental block who might try to do this.
So – here's the basic plan. The family is spread out, far and wide. Even more so this year. Since I have deployed a few traditional SMB type PBX’s to great effect – it might be a good way for us all to stay in touch. Besides that I found out my uncle’s monthly phone bill was $65.00 / month. Looking at his bill – his calling would result in maybe $8.00, including fees for a DID, in the VoIP world. How many more relatives are in the same boat?
Nothing says commitment to a project like a $900 expense – so I acquired 4 GrandStream GXV 3000 telephones. Having used them in one other small company deployment, I felt the devil you know is better than the devil you don’t. They should arrive around the 20th.
I have until Christmas to figure out how to be a phone company for our far flung family.
So – here were the project goals for TFPS (The Family Phone System)
1.Hosted Provider / PBXIAF
To assure performance. No NAT issues, and a fat pipe to the net. (The last thing we need is network contention at the PBX to sink the boat before she sails.) We chose Lylix – for being just excellent providers all around with our other PBX’s.
2.Video Support (Obviously)
Otherwise the screens on the phones are expensive places to stick postit notes.
3.Bells and Whistles – Features and Functions
The Nerdvittles Add-ons have spoiled me forever – Ill never again be content sitting in front of a telephone that can not read me the weather in Orem, Utah or Walla Walla Washington at the touch of a few buttons. All the creature comforts, like free 411, CID lookup, and proper handling of 911 calls. Allison chirping away for my custom prompts via Cepstral, and the surf-reports all need to be available to the users of TFPS (The Family Phone System.)
4.Conference Room(s)
For those long winded family discussions, and special occasions like birthdays, nothing beats an all hand-on-deck conference call. I don’t think Asterisk conference rooms support video yet, but the audio will still be great to have.
5.Voice Mail
Obvious, but important. It would be nice if Follow me could work also -
6.Web Access
To Voice Mail (ARI), and the Follow Me controls inside, and the ability to change voice mail to email settings.
7.Extension to extension calls free.
Each family unit gets a Video Phone, and can call all other family units 24 / 7 without Fees.
8.Web Based Account Management – Calls to and from the OutSide NOT Free
They need to be able to log into their A2Billing user interface – and use all the cool tools inside. They need to be able to see their call records, and most importantly to Pay their bills in an automated way. (Have you ever tried to rate calls and make bills by hand? It’s TERRIBLE. ) This becomes more important as they add DID’s to the system, and begin using it as regular telephone as well.
9.Apportioned Maintenance Fees
The system should include in its automatic billing a way to charge a percentage (in this case 20%) of the hosting fees (5 families) – so everyone contributes equally to the monthly hosting fees. (At lylix, this will be about $7.00 per family per month)
I secretly believe they will all begin asking about ways to use the system more, and I don’t want to be involved each time they pay their part of the phone bill. So the plan is to enable PayPal (I know, I know. I’m taking the easy way out here. At least I Hope I am.)
The Setup
I have hardware that is known good, and has run PBXIAF very nicely before. I don’t want to introduce any unknowns that I don’t have to. I’m sure there’s gonna be plenty of them to deal with anyways.
The first steps was be to get a “pristine platform” prepared. So did an absolutely new and standard install of PBXIAF 1.3. Then installed and updated all modules. Lylix is still loading FreePBX 2.4, (everything else is pure PBXIAF 1.3), So I went through the Upgrade to 2.5.x as well. When this is done, all modules are up to date, and update-scripts, update-fixes has been run.
The next step is to add the g729 codec if you have the license for it.
I install my Cepstral licenses and voices at the same time. And Swift.
Now is a good time to make that first full backup. By this time, you will have and hour or so – depending upon how fast your internet and CDROM drives are – into the project.
The next time I work on this project – I will be installing all the goodies that make life pleasurable – Weather Reports and all. In Fact, every feature that I want TFPS (Remember the acronyms, kids, The Family Phone System) users to have access to should be installed, and tested as working normally before any A2Billing installation steps should be undertaken. (Makes it way easier to trouble shoot things.)
Then it’s time for Trunks
Till Next time -
Last edited by tshif : 10-14-09 at 09:58 PM.
|
|

12-18-08, 09:39 AM
|
|
Guru
|
|
Join Date: Nov 2007
Location: South FL, USA
Posts: 436
|
|
Subscribed
+1 for freezing my nasal cavities on A2Billing a couple times over the years. Was secretly hoping for Joe to train Ward, and in turn the rest of us in an NV article. You've got my attention 
__________________
- J
|
|

12-20-08, 01:40 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing - Part 2 – Ship Shape and Bristol Fashion
A2Billing - An Adventure in PBX Billing - Part 2 – Ship Shape and Bristol Fashion
(Why do all the cool people in VoIPland live on or party on Boats? Phillippe of FreePBX fame smiles out from his boat-based avatar at the FreePBX site. I hear Tom King Scubas, Joe Roper has a semi aquatic dog living with the family on a boat, Ward has all these cool island locations preloaded in his example for the Nerd Vittle XTide scripts – so you know where there’s an island, there’s Boats, right? I confess – Im a hopeless landlubber . I Need Dramamine when I *watch people* in boats from the shore. I hope that doesn’t effect this project…. J I have all those phones coming.)
So when last we met, the fresh build of PBXIAF 1.3 had been made on our Hosted provider, Lylix. All modules and FreePBX itself updated to the latest and greatest. We also installed our Ceptral and g729 licenses at the same time.
If your sensing a pattern, Im glad. The goal is to build this puppy from the ground up, good functional foundations, then the “workings”. In other words, get her ship shape and bristol fashion. Before we get on to the workings, take this time and make yourself a complete Back up of your system. I cant say that enough. In fact – lets take a couple minutes to make a few simple changes and get a lot more out of the FreePBX backup program.
Backups – Quick – Dirty – and Offsite
I didn’t know until fairly recently that the backup program we all have immediate access to in FreePBX has some hidden talents. For example, its easily modified to include additional folders in the backups beyond what we get by default. This proves to be important if you expect to get your music on hold files and a few other resources that don’t get picked up by the default backup configuration.
Another trick that its capable of is sending your backup file to an offsite ftp server when its done. Its sorta weak – if it fails for any reason, it does so silently. But still – Ill take extra precautions for free when I can get them.
So let’s look at how to make those two things happen when we make backups..
Make Offsite FTP Backups
My reference for this part of the project is material on the freepbx forums:
(http://freepbx.org/forum/freepbx/use...#comment-16521)
First let’s Review the /etc/amportal.conf file and you will find a section identical to below:
|
Code:
|
#The following are used to optionally have the freepbx backup program optionally
# send the generated backup to an ftp server
#
# FTPBACKUP=YES to enable
# FTPUSER, FTPPASSWORD, FTPSERVER must be set
# FTPSUBDIR is an optional subdirectory at the ftp server, it will cause ftp to do a cd
#
# There is no error checking so you should check to make sure these are set correctly. The
# ftp is saved after the backup, so it will not cause the local backup file to be effected
#
FTPBACKUP=yes
FTPUSER=asterisk
FTPPASSWORD=yourftpsitepassword
FTPSUBDIR=mybackupfolder – optional if not root
FTPSERVER=ipadress only. No funny business with urls |
You will notice we removed the hash marks `#` from the front of the lines to un-remark them, and added the information needed to locate, login to, navigate and drop your backup files there at the end of the regular back up process. I can’t say this loudly enough: there’s no error checking, if it fails, it fails without so much as a whimper. There is no substitute for verification. When your files make it to the FTP server, you have been successful.
Add Your Special Folders to Backup
A lot of PBXIAF operators like to run the tftp server – which they use to provide configuration files to each device as they restart. If you don’t do something like this, you will eventually be stuck having to walk someone through reprogramming their SIP phone when they somehow lose their hardware settings. We are not going to use the tfpt server or store anything it its folders yet for this project, but we might in the future. I’m going to add the folder to backups now so I don’t have to remember to do it later.
Look for a section that has information in it like this:
|
Code:
|
# AMPPROVROOT=/var/ftp /tftpboot
# One or more directories where there are provisioning files that should be included in the backup. Currently
# these get backed up only, the FreePBX utility does not automatically restore them.
AMPPROVROOT=/var/ftp /tftpboot /var/lib/asterisk/bin /var/lib/asterisk/agi-bin /var/lib/asterisk/mohmp3/ |
Space deliminated, this is a list of the top folders in each hierarchy that will be added to the backups when run. The FTP folders are for reasons mentioned above, the bin and agi-bin folder frequently get customized, and I *hate* remembering after the fact that I have to re upload all the music on hold files, and custom sound files. Basically, any area you know you have tweaked, and don’t want loose.
Once that’s been changed, reread configs in config edit, and lets try a backup. Don’t forget to make sure the FTP server is ready for the attempted login. Do an amportal restart just for general health and safety.
Navigate to the FreePBX backup module, and commence the backup. Don’t be surprised when the size of the backup is larger – especially if you have a lot of music on hold.
After the backup is finished, the FreePBX module will attempt to ftp your file to the server. Check and see if it was successful. In my testing, it seems to fail for active style FTP transfers, but more testing would be a good thing. Keep at the settings, until you get it – it does work really well.
Now we’ve got some work done, and even improved our backups a little, and then put them to use. Now we can get on with more details of the infrastructure.
-- See Part 2A
Last edited by tshif : 12-25-08 at 07:10 PM.
|
|

12-20-08, 01:44 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing – Ship Shape and Bristol Fashion- Part 2A
Now we can get on with more details of the infrastructure.
Kennonsoft Updates
Oh I like the new menus.! I can’t wait to take them apart and try adding things to them. The documentations exists – so well try it if we ever think of something to add that’s not already there after a pass through Tom’s script garden and Wards “AddOn Shoppe” at Nerd Vittles.
For now, I want to present different information in the side bar area. We know we can change to url of the rss feed. Since I wont be changing this text very often, I’ve decided to put the rssfeed.xml right on the pbx. The easiest way to do that it turns out is to just a copy and paste away.
Normally, the rss feed is pointed by default at the http://pbxinaflash.com/rssfeed.xml location.. Get into the Admin Menu and select menu configuration. Where is says RSS URL, put this instead: http://localhost/feed.xml.
Now we need a copy of the xml file itself.. The easiest way to get that is to open it ina browser and copy the source code into your clipboard. Paste the http://pbxinaflash.com/rssfeed.xml url directly into a browser, and open it. Then right click on the resulting page and click show source. Use the Select All function and copy the entire contents into the paste buffer.
Next I use winscp and navigate to /var/www/html/and create a new file called feed.xml. Paste the contents of your clipboard buffer (the contents of the XLM code screen) into the new file, and then save it.
I changed file ownership to asterisk:asterisk, and marked it executable – but it may not be necessary.
Now, any time you want to change the message on the sidebar text area, simply open that file, and using the xml format and existing data as a guide, modify it to say what you want it to say. When you have saved all your changes, refresh your browser view of the PBXIAF menu, and see the results.
If your looking to nail it all down “pretty” there’s one more thing you can do easily in the Kennonsoft menu – it’s the PBXIAF version of branding. Back in /var/www/html/, find and make a backup of _branding.htm so if it gets mucked up to badly by an edit, you can recover. Then, open it in the winscp editor.
This file deals with the message and graphic that appears under the Kennonsoft menus in the user and admin mode. To customize it, create a graphic of the correct size, and upload it to the location specified in the existing script .xml file. Make the necessary edits to the graphic referenced in the _branding.htm file, and you’ll have your own graphic showing “down below”. Spend a little time working with the rest of the edits to get the text, url links, and any popup messages you may want, edited to reflect your verbiage. There's a lot of example material to work with in the existing file. It’s a tiny little area, but a lot can be done with it.
When your masterpiece is ready, save you changes, and refresh your menu screen – you should see your results right away. If it goes blank instead – hunt down and eliminate any special character in your file. One Illegal anything, and the file won’t display.
Notice we leave the reference to the style sheet at pbxiaf. This way, your feed will look like its supposed to and match the rest of the menu.
And while were working on menu things – its probably a good time to start adding things to it. Creature comforts – the underpinnings of functionality that we want to offer the users of TFPS. Time to pull out the Nerd Vilttles add ons!
In spite of the fact that I just don’t think the phone system needs to be delivering email – the system users have spoken and spoken loudly. They DO think it should do things like that. It seems one man's creature comforts are another man's necessities of life. Alas, I’m addicted to the weather reports by phone – so I don’t have a lot of room to talk .
Here’s some of add ons we are going to install. Some come from our (small) bag of tricks – others from Nerd Vittles, or heck, anywhere we could find them. From the Nerd Vittle collection, we have selected. weather report by zip code, voice reminders, awstats, and the callerid Superfecta (revisited) and a couple more. We’ll add a few dial plan fragments of our own.
I’m not going to repeat stuff that’s already in the forums – Ill provide links when I can for you. You should decide now if you haven’t already done so what features you want to offer, and install and configure them during this phase of the project. If you pick other NerdVittle add-ons, now’s the time to do them while we do our selections. Also, gather your own favorites together and perform the installation of any complex dial plan phone apps – ala nerd vittles – during this phase of the project
Some advice - First – takes a deep breath and don’t rush stuff. Most of the Nerd Vittles, and other specialized stuff needs little configuration things done to it. Pay attention and follow the instructions. So – Less coffee, or more??? Haha.
AWSTATS
Let’s do awstats first. Its fast, and (me) the brain-dead can do it thanks to wards scripts and tutorial on Nerd Vittles. Ill say right now that the icon for this program only shows up on the KenonSoft menu when its in the mood to do so. You can always get there with the long url, but it still weirds me out. I think it disappears when viewed on port 9080 or 443, but is there for port 80 viewers. But then I believe in the Easter bunny too, and could be wrong about both. Heres the link to the nerd vittles tutorial. Follow it exactly, and you will have success. (As I write this, I have a guy looking at his menu on his local network, and he sees the thing – im outside on 443 and 9080 – its just not there for me. Go figure.)
Superfecta – revisted
Next, we move on to the Superfecta revisited. Tongue in cheek, I say innocently, Have you noticed, there’s no caller ID with VoIP? If you look through the forums, between Titanous’s dearly departed version, and Wards surviving Superfecta, they have been the most read threads of all. Well – relax, as usual, Ward has made it easy. And, recently a forum user has helped update the script to include new lookup sources – so if you have had this little nugget installed for long, you should consider a redo. Forum user Klingon888 has the magic going with this post from the forums. First, do a normal Superfecta Install, and then update using this script of Kligon888. Pay attention when he talks about configuring the new services.
Web Based Alternative – If Superfecta just wont Super for you
If for some reason your setup can’t run the Superfecta, a reasonable alternative might be to look into http://www.voipcnam.com. We use them for one low volume client who is still stuck to Trix. Its super easy to integrate with FreePBX – and if you use FreePBX Phonebook caching, you only get charged for new lookups. (I have nothing to do with these folks, just find their service useful.)
Weather by Zip and Voice Reminders
Next weather report by zip code, and voice reminders 4.0.3 get the installation and configuration once-over. . Weather report by zip code is a walk in the park – Wards work again – easy as pie for you and me. Note: When I looked, the instructions on Nerdvilttles were older and contained more manual steps with databases. Make sure you follow the thread in the forum for installation, and use the Nerd Vittles article as a reference for configuration tweaking that is needed.
It’s the same for voice reminders – although the thread is pretty darn hard to follow. You must install, then upgrade, and patch a dial plan. But its worth it when the system just works like its supposed to. Don’t forget the step about securing the Voice Reminders web page – or you could end up with some really unfortunate results. (This project could really use some script magic to get the installation better contained – but it works if you are careful and find and follow all the steps.)
Munin
Because we want to be able to assess how much usage the KennonSoft Menu and A2Billing web portal get, we added munin, although I’m not sure that its returning any valid readings. maybe due to the way A2Billing interacts with the rest of the system. Time and experience should answer that for us. (Or maybe one of the Trio creators will chime in with some info? Jump in guys. )
Now we delve into non-vittles projects, and we'll start with Hotel Style Wake Up Calls.
See A2Billing - An Adventure in PBX Billing - Ship Shape and Bristol Fashion - Part 2B
Last edited by tshif : 12-25-08 at 07:18 PM.
|
|

12-20-08, 01:47 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing – Ship Shape and Bristol Fashion- Part 2B
Hotel Style WakeUp Calls
We all know what that means. Your in an uncomfortable bed, in a strange room, in a distant city, and we depend on the simple wakeup call to get up and moving in the morning. Well – simple “wake up call” type calls have proven to be a very popular point with our home users – and since this is a Family Phone System – were putting it in. That thread contains two styles of wakeup calls – one for internal use only, and a second add on dial plan that can be made to work with virtually any outside number. And this is no simple Simon wake up call – it’s Allison, and shell even let your snooze for 5, 10 or 15 minutes. Ahhhh, snooonze with Allison…..
Streaming Telephone Music
Another bizarrely popular ability is for people at their desks to listen to the radio through their really bad speakerphones at a really low bit rate. (I can’t help it, I’m sitting here listening to Christmas music on my crappy speakerphone.) This entry sports menus that you pre make into wav files with either flite or swift, so that your menus are key-stroke interruptible. Right – you get to jump right in and interrupt the menu and get into your favorite channel right away.
VoiceMail Notification (This script has bugs - Do Not Deploy untill further notice 1/23/09 tshif)
Under some circumstances, I really want to know when I have received a voicemail – even if its not appropriate for me to take the call live with Follow-Me. Attached to this article is a dial plan that adds a function that calls the number of your choice, and tells you when a voice mail has been received. It allows you the option of connecting to voice mail right then and there, or to leave it for later. There’s even a dial code to turn the function of and on. Ordinarily, I try hard to give credit for dial plans that I pick up along the road, but this one has been through a lot of different hands, and I’m not sure who to thank. I have left all the authors original notes and credits as I found them. My thanks to the smart folks who put this together. (If it’s you, and I just failed to give you proper credit – please send me a message soI can fix that! )
Get the text file from the attachment, and add the contents of it to your dial plan, anywhere in the from-internal-custom context. The version is set to use the feature code 26. Change it in the first few lines of the dial plan to any unused extension and your good to go.
This should be added to the FreePBX extension registry – but I haven’t had time to test it that way yet.
Get your SIP Together
A final assessment of the things that need to be done in sip_nat.conf, and sip_custom.conf. Remember we said VIDEO phones were being used, we need to add videosupport=yes as well as the codecs that our phones use. The GXVs only speak h263 and h264, and I’ve only been able to make them work with Asterisk using h263. I leave the others in case one day the sky should fall, and they become supported. Remember to remove g729 if you don't have the license.
Sip_custom.conf
videosupport=yes
disallow=all
allow=g729
allow=gsm
allow=ulaw
allow=alaw
allow=g722
allow=h263
allow=h264
allow=h263p
Because we are on a public address in a hosted location, the sip_nat entries are simpler than when you are behind a firewall. In sip_nat.conf, we use:
nat=no
canreinvite=no
Make sure it works
In the next part of this write up, were actually begin working with A2Billing (Oh RIGHT, that’s what this thread is supposed to be about right?) Before we go there, its time to go back, and check our work. Make sure everything you have added to the system is working JUST the way you want it to. Theres no point moving forward – ‘cuase if it doesn’t work now, A2Billing will NOT improve the situation. J
Next time we meet on this thread, well be adding trunks, and a one or two more important dial plan destinations – and begin the trek into the deep frigid waters of A2Billing. I have my nose plug ready, and with luck Tom can loan me a snorkel. But not to worry – I know when I don’t know enough about something. And that something in this case is A2billing. So – with Christmas rushing forward at tremendous speed – and $900 of Video Phones sitting on the desk next to me looking ominous - I made the tuff call and pried open my wallet a bit – and called in the big guns for advice and help.
That’s right guys, Joe Roper is gonna sit in on our next installment and make us all geniuses at installing A2Billing. Well, ok, I might never make genius, but I’m sure its going to be a lot of fun and fascinating to finally understand – and accomplish – a working A2Biling platform. I can’t wait!
So till next time – Happy Holidays
Last edited by tshif : 01-23-09 at 08:07 PM.
|
|

12-20-08, 03:53 AM
|
|
Guru
|
|
Join Date: Oct 2007
Posts: 3,333
|
|
Hi
So I've been co-opted to help out to install A2Billing for Tony. When he said he was going to blog what he was doing, I did not expect it to be so detailed, so I've a hard act to follow.
The specification for A2Billing was to install it to work nicely with FreePBX, so that all the functionality of FreePBX remains as far as is possible, and calls to the PSTN were billed at the appropriate rate. So in effect, the way that we are going to build A2Billing is to just bill FreePBX extensions.
So we have got to the point so far that we have installed FreePBX, and all the other bits and pieces, we have set up a trunk, (consider the PBX in a Flash / Fonicatec service) and we've set up some extensions.
1. We have to run the A2Billing install script,however, because I've been lazy, I've not sent a new one to Tom to install the latest A2Billing, so a bit of hand editing is in order.
So open /usr/local/sbin/install-a2billing
and change the following:
|
Code:
|
wget http://a2billing.net/downloads/A2Billing_1.3.3.tar.gz
tar zxfv A2Billing_1.3.3.tar.gz |
to
|
Code:
|
wget http://a2billing.net/downloads/A2Billing_1.3.4.tar.gz
tar zxfv A2Billing_1.3.4.tar.gz |
and
|
Code:
|
mysql mya2billing -u a2billinguser -pa2billing < a2billing-mysql-schema-MYSQL.5.X-v1.3.0.sql
mysql mya2billing -u a2billinguser -pa2billing < UPDATE-a2billing-v1.3.0-to-v1.3.1-mysql.sql
mysql mya2billing -u a2billinguser -pa2billing < UPDATE-a2billing-v1.3.2-to-v1.3.3-mysql.sql |
to
|
Code:
|
mysql mya2billing -u a2billinguser -pa2billing < a2billing-mysql-schema-MYSQL.5.X-v1.3.0.sql
mysql mya2billing -u a2billinguser -pa2billing < UPDATE-a2billing-v1.3.0-to-v1.3.1-mysql.sql
mysql mya2billing -u a2billinguser -pa2billing < UPDATE-a2billing-v1.3.2-to-v1.3.3-mysql.sql
mysql mya2billing -u a2billinguser -pa2billing < UPDATE-a2billing-v1.3.3-to-v1.3.4-mysql.sql |
Save it, and we should be good to go.
2. type install-a2billing
You will be prompted for the root password of MySQL, in standard build, the password is passw0rd. if you have changed the MySQL root password you will know, and so you will have to type that in instead.
Some stuff will happen on the screen.
Then the script pauses for 10 seconds to read some instructions on the screen.
This is the installation of cpan for the A2Billing callback Daemon, not really required in this impementation, but we will do it anyway.
3. When prompted for manual configuration change the default "Yes" to a "no"
4. When you get a prompt, type install Config::IniFiles it's case sensitive. press enter, and wait a while.
5. Reload
6. Quit
and then A2Billing is installed and ready to go.
One small cockup in the script as to be fixed, go to /etc/asterisk/iax_custom.conf, and put a carriage return in to move the #include... onto the next line, save and you are done.
The next area is to start the configuration of A2Billing and freePBX so that it can interact with FreePBX nicely. To do this, we have to add a bit of custom code so that we can create an A2Billing from FreePBX to A2Billing.
Open extensions_custom.conf and add the following code to the bottom of the file: -
|
Code:
|
[macro-dialout-trunk-predial-hook]
exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
exten => s,2,MacroExit
[custom-freepbx-a2billing]
exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8})
exten => _X.,n,Hangup() |
Now create a trunk in FreePBX over which we are going to pass billable calls.
Add custom trunk, and in the dial string at the bottom type:-
Submit and apply.
This is the trunk you use to send calls out via A2Billing, just select it in outbound routes, and calls will go out via A2Billing. The /1 refers to which agi-conf is going to be used in /etc/asterisk/a2billing.conf, and Tony will explain what an agi-conf is and how you use it.
There we have it. A2Billing 1.3.4 is now installed and ready for configuration.
Tony will go into the configuration, because he will be much better at explaining stuff than me.
In brief, Tony will explain how:- - To add a trunk to A2Billing that we have previously configured and tested in FreePBX
- To add a call plan
- To Add a Rate Card
- To attach a Rate Card to a Call plan
- To Add rates for the destinations.
- Create first customer
- Add credit to the customer
- Show a payment from that customer for the credit you have added.
- Explain how to make extension in FreePBX authenticate to A2Billing seamlessly
- Edit agi-conf to react in the right way for this configuration.
Over to Tony
Yours
Joe
Last edited by jroper : 12-23-08 at 07:31 AM.
|
|

12-20-08, 04:27 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing - Extra – Integrating the Video Phones
A2Billing - An Adventure in PBX Billing - Extra – Integrating the Video Phones
“Captain, you have a signal on the com unit. “
“Is it Starfleet Command?”
“No sir, Its your Mother, and she looks annoyed”
Ah – Starships. Now that’s MY kinda Boat J
First Review and Assessment – The Grandstream GXV 3000
It cant be avoided forever, and the stack of phones isn’t getting any smaller or less ominous. Best I get on with the task of getting them configured.
I have to say these are just cool looking. We got the black version.
They can be wall mounted, and have ugly little snap on feet to make them sit more upright on your desk. When wall-mounted, the screen folds back flat so it accommodates wall mounting very well. The buttons are round, to small, and mushy when you press them. Most of the buttons either have no discernible labeling of any kind, or one of the little tiny blob looking symbols that always looks like a little blob of melted ice cream. Ummmm. Ice Cream.... I hope its intuitive to use, or Ill be keeping a magnifying glass nearby to be able to see these things. The handset cord is about 6 inches long – note to self – go to Radio Shack for real curly cords.
The camera is mounted on the top of the screen, and can tilt, the screen pans and tilts, so overall you get a lot of flexibility in the angle of the screen and camera. It has load of input and output jacks in the back for video and audio. This little puppy can be attached to any TV with RCA video and audio inputs. Same for the video camera. It has 2 USB ports. I wondered why, until I realized you can plug certain USB network devices into this and make it a wireless LAN client. I t does NOT support power over Ethernet. It has pass-through Ethernet ports, so you can chain another device through it. But its only 10/100.
Ease of Setup? In a word, Yes.
The unit got its address from the network dhcp server, and booted. In a quick moment I was in the web Configuration interface, and configuring away. I should point out that if we were doing this right, we would be deploying configuration files from a server so that all the configuration options are applied automatically, from a central location, each time the phone boots. Because we are only deploying 5 phones, and time is so short – I have opted to configure them manually.
Ill cover some of the settings that I have found to be important to working with PBXIAF, but not anything that’s outside that scope. You will want to experiment and discover most of that on your own any way.
Custom Screen Saver
First though – were going to take the time to make a screen saver to replace the really ugly one that you get from Grandstream. To do that, your gonna need some digital photos, or other art, that you want to use, an art program capable of saving simple jpeg picture, at a very specific size. The good news is that even lowly MS Paint can do it, although it the most convoluted process you ever saw. If you have Macromedia Fireworks, or almost any other reasonable art type program, you’ll be able to do it.
The phone requires its picture be provided in a binary (*.bin) file, and they give you the tool to make it with. Go here and download the screensaver generator tool. Open the zip file, and tread the 4 lines of instructions, and follow them. In brief, you need to make your picture fit inside 320 x 240 pixels, period. And they have to be save in simple jpeg. Once you have created as many pictures as you want in the series (the actual limits are noted in the readme file of the creator tool), load of the creator tool, and add them to the list. Click on the GO button, and you end up with a file called image.bin. It HAS to be called that, and only that.
I made I series of images at various places on the screen to simulate a traditional screen saver, and added them to the list of the creator program in the order I thought I would like to see them displayed.
I found an old image of a favorite symbol of mine. It’s being used privately in my families’ home.
When displayed, the images are displayed in this order. (This is the coolest visual I have ever seen. It looks really cool on these phones).
Since all the phones are displaying the same image.bin file, I’m once again going to rely on the pbxiaf web server to deliver these files to the phones. Each time they boot up, the version will be checked, and if it has changed, the new one will be downloaded.
Use winscp to copy the image.bin file to /var/www/html/.
Controlling the Phone Firmware Version
Point your web browser at the ip address displayed on the telephones screen. The default admin password is admin.
There is no point in configuring the phone completely until the newest firmware has been uploaded, since some of the configuration option change from version to version. To do that, click on the Basic Information tab and find the firmware revision information. Then go here and see if there’s something newer. If there is Get it.
Again, we will rely upon the pbx webserver. We are fortunate with Grandstream phones they will provision with http, not just tftp, so we don’t have to do anything magical and start up tftp. Instead, we head back to the /var/www/html/. Folder and make a new directory called gxv3000.
Using winscp, copy the ENTIRE CONTENTS of the firmware zip file you got from Grandstream into /var/www/html/gxv3000.
Getting our Firmware Update – and Getting our Slide Show on the Road.
We have several changes to make to the config in these units, but not until they have the newest firmware, so well make just two changes before our first reboot.

Here, the top area, place the path we made to the firmware files; yourpbxaddress.com/gxv3000
In the bottom area, place the path we made to the screensaver imiage.bin files; yourpbxaddress.com
You may choose to put the screensaver file in the same folder at the firmware, and make both paths the same. I don’t, because I don’t want to forget its there and crush it when I put the next firmware revision into that folder in the future.
Before the next step, I need to say this. Don’t lose power, or find any other creative way of interrupting the next few reboots. The phone can be turned into a very expensive paperweight in one accidental kick of the power plug. I say, plug it all into a good UPS before you go on.
Ok. Click UPDATE to save your changes, and then click Reboot.
If all goes well, in bout 2 minutes, and possibly a few reboots, your phone will stop most of its activity, and show you a main screen. If you wait for the default 60 seconds, you’ll get to see the results of your screen saver upgrades. (Ah, Space, the final frontier…..)
See A2Billing - An Adventure in PBX Billing - Extra – Integrating the Video Phones Part B
Last edited by tshif : 12-23-08 at 10:49 PM.
|
|

12-20-08, 04:43 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
An Adventure in PBX Billing - Extra – Integrating the Video Phones Part B
Important Phone Configuration Points
Time to get busy with the actual phone configurations. Lets start with the Status page. Verify that is says you are running the version of the firmware you think you just installed. If not, try try try again. If all is well, lets get busy.
The Basic Setting Tab
The Basic settings tab deals with the local network connection – which I will leave totally to you – and some other setting we want to talk about.
Select the correct time zone for your location, and the type of calendar and clock options you prefer. I always get a 12 hour clock also. Don’t forget to enable daylight savings if you celebrate that where you live. J Click update and change to the Advanced Settings Tab
The Advanced Settings Tab
Silence suppression is a weird concept to me. Its already silent, what’s to suppress? Well it turns out the human ear is accustomed to a certain amount of background noise. When things get to quiet – well they think the call has been cut off. It makes them feel like nobody is listening to them – when your there all along. So, by adding back comfort noise, or suppressing silence, we make the calling experience better. Sounds more like an analog line to me, but it is strangely comforting. Bottom line, turn it on.
In order to come anywhere near close to simulating full motion, don’t set your video frame rate for less than 15 frame/second. I like to give it a lot of bandwidth if its there, and specify 192kbps. I find it makes the video much sharper. If your users don’t have the bandwidth, and the calling experience is choppy, back this down a bit. The image gets more granular, but the overall experience may be viewed as smoother.
Video frame skipping allows the video to skip a few frames if it gets behind the audio – so that image and video can stay more closely synchronized. I usually turn this on.
Down near the bottom, there are two controls that deal with browser settings Start Browser on boot, and enable browser toolbar. Turn them both off. They act oddly, and invite questions I don’t want to answer from users.
Click Update and go to the Account 1 tab
Here’s where most of the issues usually crop up. Mark the account active. Add a friendly account name. For this Phone, it’s called Smith Household. For SIP Server, and Outbound Proxy, place your pbx address. For SIP User, and Authenticate ID, place the exact extension number you will be assigning to this phone. For Name, place an individuals Friend name (I.E; John Smith).
If you tell the phone to use DNS server, it might not work even to call other local extension if you loose your DNS server. On the other hand, if you don’t, sometimes the phone may have trouble registering with the PBX. Your mileage mar vary. ID is phone number NO, SIP registration YES, Unregistration YES.
The Nat traversal STUN settings should be set based on your own experience. Check out the thread in the forums about STUN servers for the latest group hug on the topic of their use.
Voice Mail User id should be set to 97, not *97. Due to a quirk in the GXV 3000, it can not send a leading asterisk as a dial string character. Because of this, we will be changing all the *codes to non * codes in FreePBX later.
For DTMF, I strongly suggest trying ONLY DTMF. It really generally works the best.
You MUST turn OFF early dial, and you MUST select NO for Enable Call Features.
I’ve decided to leave the paging function active in the PBX with auto answer. I’m thinking it could lead to some interesting surprise video exchanges. Shhhh! Don’t tell the family yet. Hahahahha. For the AutoAnswer selection, Enable Paging/ intercom.
One last setting to make sure the end users don’t struggle to get the video to work. Find the setting near the bottom for ENABLE Video, and set it for YES. Now, the phones default condition will be to place and receive calls with the video active (when present at both ends).
During the configuration process you'll have a chance to set the video codes. It important the h233 is available as one of the three choices you get to specific. If its not, the current version of PBXIAF will not see or process Video - since it only recognizes h233. I suggest an ordering of .h233, .h233+, and .h234.
Enable the use of RFC5168 support for upwards compatibility.
Select Update. Then reboot. That’s it kids! Its ready to go, with full video support – even in voice mails! )If you didn’t put videosupport=yes into your sip config files when we said to earlier, NOW would be a good time, or NO video for you.
Make your extension in FreePBX
Even though we are jumping ahead a bit, its wont hurt anything with our A2Billing Adventure for us to get into FreePBX and create the extension for the phone we just configured as we normally would.
Once that’s done, you can call yourself, and leave a Video Voicemail as a test.
The next time we meet, well be right back into the Adventure in A2Billing Tthe Maestro himself, Joe Roper.has already posted the entire installation process to this thread. Awesome!
See ya there
Last edited by tshif : 12-22-08 at 04:47 AM.
Reason: Added video codec selection
|
|

12-22-08, 09:42 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing - Part 3 – Batten Down the Hatches - Part A
(More Boat talk. Can I get a glass Of Water please? I Am very fond of lobster…)
Welcome back – to our discussion and deployment of our multiple Family Video Telephone System. That’s whole multi family thing is pretty important – because this entire topic really is about A2Billing. The only way this could work is with every household contributing their fair share and usage to the project each month – with bare-minimal human intervention. A2Billing is perfect for that role – and the only way we could proceed.
Setup your phones
So – on with the project. First, if you haven’t yet configured your telephones to work with the pbx, do it now, Using whatever means and methods you normally use.
Anyone who is following along and using the GXP video phones (in the last post to this thread in the GPX3000 review), can and should now get any/all of your phones configured and ready for use.
I found I had missed one important configuration item in the thread about the GXP 3000 – concerning the need to specify a Video Codec. Yikes, that’s not so minor. If you were follow along that thread, go find the new video codec setting and be sure to add that to your list of things to configure on the phone.
While you are configuring your telephones, go ahead and create the extension in FreePBX for each of them as well. It doesn’t really matter when we create them – as long as they are in place before we try to use them with A2billing later.
When creating extensions in FreePBX, remember, (1) Don’t enable or use FollowMe for any of the extension you create. FollowMe is not fully compatible with A2Billing at this time. (2) Don’t use VMX Locator for the same reasons. Ok, that being said, work-a rounds for the FollowMe situation ARE possible and we may look at adding some of them later. But for now we will stick with an unmodified FreePBX installation. Use Voice Mail the same as always.
A few loose edges
The last thing well do is put into place a few utility dial plans that we will make available to our users, and the system itself. Some are in the category of creature comfort, others in the category of common sense and CYA.
You can cut and paste these all together, into the same place: extensions_override_freepbx.conf.
I consider these “quick and dirty” in that they can be used even when not registered with the FreePBX extension registry, and therefore could create conflicts if you inadvertently reuse any of these extensions elsewhere in FreePBX.
You should register each of them in Custom Extensions. In the custom Extension Box, enter the extension number you have assigned in the dial plan. The description is for your own benefit – use it as you see fit.
In some of these, you will see technology/trunkname. One we have trunks installed on the PBX, all the technology/trunkname entries will be replaced with entries that reflect the technology, and the trunk name, that you want them to use to dial out on. (Such as “SIP/trunk123”)
|
Code:
|
[from-internal-custom]
;This routes 411 calls to Google free 411 services. If we decide to use the pbx 411 function, well assign it a different number later. This is a Standard phone call to an 800 number – it would be cool to find a way for it to exit the system ENUM, since most VoIP providers charge for 800 calls.
exten => 411,1,Answer
exten => 411,n,Playback(pls-wait-connect-call&digits/2&directory-assistance)
exten => 411,n,Wait(1)
exten => 411,n,Dial(technology/trunkname/18004664411,,r)
exten => 411,n,Hangup()
; The routes a VoIP call to the TellMe menu service. More entertaining that informative, it’s an example of voice menus gone to extreme, to little important effect. But, its something users like to play with. Note, the service is off line much of the time. The 180 is the amount of time to let the call ring and the m means play the “default” music on hold Chanel instead of ringing.
exten => 436,1,Dial(SIP/radio@didx.net,180,m)
exten => 436,t,Hangup
; Dials via standard800 number an ad based free 411 service. When I tested this it wasn’t working, but it may just be offline temporarily. Maybe for good – if you have any alternatives – let me know.
exten => 511,1,Answer
exten => 511,n,Wait(1)
exten => 511,n,Playback(wait-moment)
exten => 511,n,Swift("1 800 Free 4 1 1 services")
exten => 511,n,Wait(1)
exten => 511,n,Dial(technology/trunkname/18003733411)
exten => 511,n,Hangup()
exten => 511,t,Congestion()
; Connects to free service Traffic Information. Our Users go nuts for this one. Note, if you don’t send valid Caller ID, this system wont let you in.
exten => 872,1,Answer
exten => 872,n,Wait(1)
exten => 872,n,Playback(pls-wait-connect-call&digits/2&traffic&information)
exten => 872,n,Playback(pbx-transfer)
exten => 872,n,Dial(technology/trunkname/18666987232)
exten => 872,n,Hangup()
exten => 872,t,Congestion()
; This is wht I call the NO 911 Response. It states in clear terms that NO 911 Service is available on this line, and can relate the address for the caller in case they need to call emergency services but don’t know the address. Those lines should be commented out for multi location deployments.
exten => 911,1,Answer
exten => 911,n,Wait(1)
exten => 911,n,Zapateller()
exten => 911,n,Wait(1)
exten => 911,n,Playback(no-911-1)
exten => 911,n,Wait(1)
; This line should be commented out for multi location deployments.
exten => 911,n,Swift("The address at this location is - twenty to fifty-one Main Street Hoffenburg california -- 92555")
exten => 911,n,Wait(2)
exten => 911,n,Zapateller()
exten => 911,n,Wait(1)
exten => 911,n,Playback(no-911-2)
exten => 911,n,Wait(1)
; This line should be commented out for multi location deployments.
exten => 911,n,Swift("The address at this location is - twenty to fifty-one Main Street Hoffenburg california -- 92555")
exten => 911,n,Wait(1)
exten => 911,n,Zapateller()
exten => 911,n,Congestion()
exten => 911,t,Hangup()
; extension designed to be used as a custom trunk to trap and prevent international calls technically, this isn’t used by A2Billing – it has other ways of doing the same thing, but I add it hear because is usable in many other deployments.
exten => 912,1,Answer
exten => 912,n,Wait(1)
exten => 912,n,Zapateller()
exten => 912,n,Playback(im-sorry)
exten => 912,n,Playback(international-call&has-been&disabled)
exten => 912,n,Wait(.5)
;exten => 912,n,Playback(no-911-1)
exten => 912,n,Wait(0.5)
xten => 912,t,Hangup() |
Trunks – Dialing for (Less) Dollars
Although this is being “sold” to the family as a Video Intercom system, we all now its much more than that. My uncle has already said he wants to use it for him home phone service, se we need an outbound trunk provider for sure.
I have intended to try out Fonicatec – and this seems like as good a time as any. I know I don’t want service interruptions and poor line quality to end this excitement that seems to be building up in the family.
One you create your account with Fonicatec at http://usasignup.pbxinaflash.net/A2Billing_UI/signup/ , its time to login and add some $ to your account so outbound calls can be made. The cool part is, the Fonicatec interface is the A2Billing customer interface. You'll get to see a little bit of how your user's web experience will be.
Paypal is accepted – and the payment experience is really very nice. If you have ever paid with Paypay before, you will recognize this experience.
Side Note
In order for this to work for your PBX, you are login to need a PayPal business account. I have been told that only the business accounts can receive online payments in this fashion – although since we already had one – I didn’t test out if it is actually truly required. Creating one is Free – and once you have it, you’re ready to begin receiving payments from your users. I just copied this link from our website – it makes it easy for you to get started.
See A2Billing - An Adventure in PBX Billing - Part 3B
Last edited by tshif : 12-22-08 at 11:54 AM.
|
|

12-22-08, 09:48 AM
|
|
Guru
|
|
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
|
|
|
A2Billing - An Adventure in PBX Billing - Part 3B
Continued -
Finish the Payment at Fonicatec
Continue to click through the paypal screens and when you are done – you will be returned to the Account info screen at Fonicatec. Fonicatec is now ready to allow us to dial out. But first, we must make the trunk in FreePBX. There is a link to the Trunk configuration settings in your welcome email which arrives right after you sign up with sign up Fonicatec . The trunk info is clear and concise; You wont have to hunt far and wide to figure out how to make this service work.
Install Fonicatec Trunk
Make sure the only acceptable dialing patterns is: 1+NXXNXXXXXX
This assures that we only deliver properly formatted calls (with the leading 1, so your users don’t have to dial it)
Create Outbound Route to Fonicatec trunk
Now that we have our trunks installed, we should test the outbound call ability so that we know the trunk is working before moving to use it under A2Billing.
Get into FreePBX, OutBound routes, and create one for the Fonicatec trunk. Remember, Fonicatec is IAX2 ONLY. (IN the USA, the pronunciation seems to be EEKS where as in the UK, it is more reasonably pronounced as EYE-AXE.) Believe me, you're better off. IAX2 simply has no NAT problems to worry about – so the connection between your PBX and your outbound trunk provider will always be able to find each other. Unfortunately, the examples are not cut-and-past able, so be careful when entering them. All though the screen say that your username is your account name, which it really seems to mean is termed as your "Card Number" inside the Fonicatec A2Billing user interface, with secret is your PW or PIN.
We must send all calls out including the area code. Because the family is geographically spread out, we can’t readily code the system to know each callers home area code; They will have to include it when they dial. The following dial patterns should work for these requirements for any call to USA, Mexico, or Canada..
|
Code:
|
1NXXNXXXXXX
NXXNXXXXXX
If you plan on supporting international dialing, add this also:
011. |
In the trunk sequence select only the Fonicatec trunk. Many of us might want to include an ENUM trunk as the first option, but adding that here would create a situation where a Call might come into the PBX (once DID’s are assigned), and get forwarded to an OUTSIDE number by ENUM – and A2Billing would not have a record of the call being made.
I’ll say that a little differently – A2Billing will only have records of calls placed through the A2B/x trunk(s) , of which ENUM is not one. If not having a record of a call that was placed, but was free doesn’t upset your apple cart – then go ahead and add ENUM – but Id wait until the system works before complicating it in this way.
Another thing to note is that A2Billing rates (or Bills) inbound calls and outbound calls in separate procedures. Well talk more about that later on.
It doesn’t matter at this moment if you have installed A2Billing as per Joes earlier post or not. Remember, we are just about to test to make sure that a call can be placed to outside the system from a regular normal FreePBX perspective.
Save your changes to active the outbound Route and Fonicatec trunk.
Be sure and follow the instructions when you sign up with Fonicatec to validate your account with them. This validation will remove the one-call-at-a-time restriction from your account, and allow you to deliver caller ID’s to the destinations. Without this, only one family member gets to make a call, from any location in the system, at a time.
I don’t know about you, but I have dealt with too many VOip providers who don’t seem to have a clue in the world how to configure Asterisk or FreePBX for their services. It is a genuine pleasure to run into a provider like Fonicatec who’s setup instructions actually work right the first time, without any VooDoo dances required.
Fixing the Dial Plans
In the section above called a few loose edges, we installed some dial plans that included the temporary text "technology/trunkname". Now that we have an outbound trunk, we need to edit those occurrences to reflect the real information from our Fonicatec trunk. For Technology, use IAX2, for trunkname, use the Trunk name you used when you created the trunk. Once you save those changes, and reread configs, those special dial plans should work.
DTMF
Do Test My Friend!
Now, pick up a phone registered on this pbx, and try an outbound call. Make sure to dial in the format NXXXNXXXXXX. You should be able to dial out just as you normally would through your pbx at this phase. If you can’t – Fix this first. A2Billing will be using this trunk for outbound calling – if it doesn’t work, A2Billing cant work. You can also use the special extentions to test. Try dialing 872, or 411. Both of these also use an outbound trunk.
Notice that your caller ID will be wrong until you validate your account with Fonicatec, and begin sending your own proper caller ID.
If there’s anything not working so far – go back and fix it. We are going to want to know that the foundation pbx works as we begin configuring A2Billing – as the very next thing we do.
Until next time -
Last edited by tshif : 12-27-08 at 04:20 PM.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:02 PM.
|
|