QUESTION A2Billing - An Adventure in PBX Billing - Part 1

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Nothing Special in sip_nat.conf

Hey Jeff;

Nothing special due to our setup, just the normal kinds of entries -

externip = 70.167.200.200 ;(substitute your public ip address)
localnet = 192.168.25.0/255.255.255.0 ;(substitute your lan subnet address)
nat=yes
canreinvite=no

If you are using xlite video soft phone - be patient with it. I have used it before - I don't know about the current version, but in the past it has had some definite quirks when used with asterisk - but I do know it can work. Good luck - and let us all know how it comes out for you.

Glad to have you aboard as a reader!

Tony
 

jrglass

Guru
Joined
Oct 18, 2007
Messages
302
Reaction score
20
Thanks,

I have externip and localnet in my Sip_custom.conf. Should that matter?

Jeff
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Jeff
Bottom line - I'm just not sure. I know it works correctly in the sip_nat.conf file. If your not getting good results, maybe relocating it to a known good location would be a good troubleshooting step.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 6 – Dry Dock for DID’s

The next installment of A2Billing - An adventure in PBX Billing - should be posted within the next 40 hours or so.

Well be working with all things DID - acquiring, configuring, and integrating with A2Billing. We also work with billing for inbound calls, accounting for DIDs with free minutes, and using subscriptions to account for apportioned hosting fees for all the families on the system.

Were taking some extra time to make sure we cover this stuff accurately - and completely. We'll be back soon -
Tony

12/30/08 Hang in there guys - I managed to catch the flu, and its slowing me down. The next installments are almost ready.
 

blakekrone

Guru
Joined
Aug 27, 2008
Messages
59
Reaction score
0
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!
 

jroper

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

You can of course send out calls via different trunks, but all your carrier reconciliation would be inaccurate, so a safer way of doing it is to create 2 call-plans, and either give free minutes (Tony's covering that next) or zero rate the calls for the extensions you want to be free.

Joe
 

nsukho

New Member
Joined
Dec 25, 2008
Messages
14
Reaction score
0
Excellent tutorial... Thanks a lot... Keep it up...
Neil
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 5AA – Yo Ho Ho Too Much Rum

A2Billing - An Adventure in PBX Billing - Part 5AA – Yo Ho Ho Too Much Rum

Ok - After being gone for way too many days - we are back in the saddle again and ready to continue our Adventure.

This article should have been the first part of Part 5, but I somehow missed getting it into the forum the first time around.

So - these steps go in between The end of Part 4, and the beginning of Part 5. My most humble apologies for having missed this in the first place.

=================
Since we are about to begin routing calls through A2Billing, we have to add the final links in FreePBX. We have a couple of special contexts and a couple Custom Destinations to create.

Special Contexts and Custom Destinations
In FreePBX, Config Edit tool, open extensions_a2billing.conf. Inside you will see several contexts. These are used by A2B to perform a variety of tasks.

We will be adding 2 new contexts to the file that we will use to further integrate A2B with FreePBX

Locate the first context in the file that looks like this:
[a2billing]
exten => _X.,1,deadAGI(a2billing.php|1)
exten => _X.,n,Hangup

Make a copy of it, and change the name so it looks like this and paste it to the bottom of the file:
[custom-a2billing]
;for call through service
exten => _X.,1,deadAGI(a2billing.php|1)
exten => _X.,n,Hangup

Locate the first context in the file that looks like this:
[a2billing-did]
exten => _X.,1,deadAGI(a2billing.php|1|did)
exten => _X.,2,Hangup

Make a copy of it, and change the name so it looks like this and paste it to the bottom of the file:
[custom-a2billing-did]
;To deliver DID and bill for them
exten => _X.,1,deadAGI(a2billing.php|1|did)
exten => _X.,2,Hangup

Click Update to save your changes.

Adding Custom Destinations
We will now register the two custom contexts we just added with FreePBX as custom destinations. The first one we are working on is the context that is used for call-through services.

Call-through can be though of in this way. You dial in to your PBX and place your outbound calls through the PBX in order to take advantage of your great VoIP rates. In other words, you are calling-through your PBX.
Adding the Call-Through Custom Destination
In FreePBX, navigate to Tools, Custom Destinations, Add Custom Destination.

Custom Destination: custom-a2billing,${EXTEN},1
Description: A2B-Inbound
Notes: For a call through service

Then Submit Changes

Now we’ll build the other Custom Destination.

Adding the Inbound DID Billing Custom Destination
This destination is used in the rating and billing of inbound DID’s. Without this, we cannot bill for inbound minutes.

In FreePBX, navigate to Tools, Custom Destinations, Add Custom Destination.

Custom Destination: custom-a2billing-did,${EXTEN},1
Description: A2B-DID
Notes: To direct DID into A2Billing for onwards delivery and billing.

Adding The Inbound DID Billing Trunk in FreePBX
Now we add the trunk in FreePBX that will be used to direct inbound calls to A2B for processing. (Part of this step may have been done during a2billing installation, just verify that its complete.) In FreePBX, Select Setup, Trunks, Add trunk, Add Custom Trunk.
Dial Rules: 1+NXXNXXXXXX
Custom Dial String: A2B/1

Submit Changes, then Apply Changes.

Once you have completed these steps, continue the adventure here
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 6A – Dry Dock for DID’s

Greetings and Happy New Year to everyone!
Here is the 6th and final part of the series - which completes our total functional system! Hurray!

A2Billing - An Adventure in PBX Billing - Part 6Dry Dock for DID’s

Last time, we had completed then entire principle configuration for outbound call processing through A2Billing.

I have to admit being completely excited when I got to see my first set of outbound caller records in the user webui. When I said at the beginning of this series that I have tried – without success – to get A2Billing functional before, I really wasn’t kidding. And this was always just about the place where my efforts gave up the ghost before. If anyone else has been in the same boat – then congratulations for making it this far with me! Thanks Joe!
Of course, we aren’t done yet – we now need to get A2B on-board for billing our inbound calls. That’s what we will focus on now.

Inbound calls – received via DID services from a VoIP vendor, have a wide variety of billing arrangements, depending upon the vendor you select. Fonicatec doesn’t have DID’s for the USA at this time, so we are going to be trying out another vendor that I haven’t worked with before called VoIP.ms for DID service.

To prepare for that, we’ll again perform the steps necessary to activate a new trunk on our platform – first in FreePBX, and Second in A2Billing.

Let’s recap those steps briefly:
  • Acquire Service from the DID Vendor (in this case, VoIP.ms)
  • Configure the trunk in FreePBX according to Vendors directions.(Hopefully they will work as well as Fonicatec’s did.)
  • Configure the Trunk In A2Billing
Since the purpose of this trunk is to bring in DID’s we’ll be performing configurations for the DID’s for the first time.

Steps to make DID’s available in A2Billing
  • Acquire DID(s) from Vendor (VoIP.ms)
  • Make Inbound Route(s) in FreePBX
  • Configure DID in A2Billing
  • Assign DID(s) to a user account in A2B
Step 4 can be done by the admin, or by the user “purchasing” a DID from you inventory.

I suppose that in a Family environment, most of the DID’s will be assigned by the ADMIN, but we will cover the process for a user buying one because it’s absolutely cool that we have that ability.

But, first things first.
Acquire Service from the DID Vendor (in this case, VoIP.ms)
Provider VoIP.ms has some really attractive terms for their DID’s as well as pretty impressive USA coverage. Another really good feature is you special order DID’s (Called carrier order) in almost any area should they not actually stock it.

Go through the signup process, and validate your account after receiving the confirmation email. Put some credit into your account right away – ‘cause soon it will be DID buying time!

First though we got those pesky 7 things to do on the list above. First on the lists, create the trunk in FreePBX.

Initial General Config for VoIP.ms
We first need to establish some basic configs within the VoIP.ms service.

Log into your account with VoIP.ms, and select Main Menu, Account Settings.
Most of the top of the page contains settings related to outbound traffic, so we will ignore them for the time being.
Near the bottom of the top block, find Main SIP/IAX Password. By default, this is set to the same as the password to your account with VoIP.ms. You may change it here so that the trunk password is unique if you wish.

In the area below labeled Inbound Settings for Main Account user, Locate Protocol for inbound DID’s and select IAX2, for device type select IP PBX Server, Asterisk or Softswitch.

Under Advanced Settings, and the NAT setting. If you PBX is NAT’ed, Select yes, other wise select no, then click APPLY.

For DTMF mode, select RFC2833(AVT), then click Apply.

Under Allowed Codecs, enable only those that you have enabled on your PBX, then Click Apply.

Gather Trunk Settings for VoIP.ms
Still in the VoIP.ms interface, Select Support, Configuration Samples.
Because VoIP.ms offers IAX2 trunks, Look under the section called Asterisk Samples , and select FreePBX/Trixbox/Asterisk@home (IAX2).

This will open a simulator that will provide you with exact settings, right down to and including your ID’s and password. A simple cut and past or two away from a perfect configuration.

But first – we have to select the server to which you want to connect your trunk. They have several, so pick the one that’s closest to you (a decent rule of thumb) from the drop down box.

Capture the PEER Details into notepad, as well as the Register string. Note the trunk name is easy enough to remember, and it must be called this: voipms

Acquire DID
Before we leave the VoIP.ms interface, we may as well acquire the DID(s) that we want. In their web interface, navigate to DID Numbers, Order DID(s). Were here to acquire a standard DID in the United States, well go to that link.

Per Minute vs. Monthly Flat rate vs. Combo Plans
All these billing styles have their place. Let’s talk about them each a little because its important to understand the differences.

Whats a channel? Basically, it’s a call in progress. Example: If your plan supports two channels, you basically have call waiting/and 3 way conference capabilities and that’s that.

Your DID’s may have different specifics listed than the one I choose –
The per minute plan Carries a monthly fee of $1.49, and a one-time setup fee of $0.50, with a fairly typical billing increment of 6 seconds. There are No included minutes, but there ARE unlimited channels.

So – who is this kind of plan a good idea for?
First, the unlimited channel feature is a rare and beautiful thing to anyone who needs their DID’s to be of the “never busy” variety. Call centers can handle an unlimited number of inbound calls to accommodate the ebb and flow of business needs. This also makes the presence of queues in asterisk far more useful. I mean, if you have only two channels, wouldn’t call waiting really do everything you want? J

One potential down side of this plan is that you don’t know in advance what your inbound phone bill will be – it’s up to how many inbound minutes are used. You pay for what you use.

The Monthly Flat Rate plan
Typically carries a monthly fee (in this case, $7.95), and a one-time setup fee of (again in this case) $1.00. Its not a metered plan (sometimes called an all you can eat plan), so there is no billing increment. There are 2 channels available.

So – who is this kind of plan a good idea for?
As an all you can eat plan, it inherently provides for a known regular phone bill for your inbound calling. “Unlimited service” in this case means that the most call traffic that could ever happen on this line would be two channels ( or calls) , in use at all times. The kind of service most closely emulates traditional phone service with call waiting and 3 way conference abilities.

Potential down sides are that this service will ring busy for inbound callers if there are already two calls in progress. You’ll never be able to have more that two callers in an Asterisk conference room this way.

Combo Plans
The combo plan is rather like a combination of both. There is a setup fee, and a monthly fee that covers a certain number of included minutes, after which you are billed for additional minutes. This type of plan may have a variety of available channel options depending upon the vendor.

So – who is this kind of plan a good idea for?
The combo plan has some of the benefits of each of the other two types. If your average months inbound calling is within the included minutes, then its generally cheaper than the All you can eat plan. Also, most of the combo plans have more than just 2 channels available, making them better choice for working with a pbx than a 2 channel plan.

Potential down sides are that the minutes over those included are sometimes more expensive than a straight by-the-minute metered plan. Sorta of like cell phone plans that gouge you for going over your plan minutes, but not as severe a gouging.

Choose and Continue
Select the plan type that you think is best for the user who will be assigned the DID. Remember which one you chose.

Once we have selected a DID, we need to select per minute or flat rate plan.

See A2Billing - An Adventure in PBX Billing - Part 6B – Dry Dock for DID’s
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 6B – Dry Dock for DID’s

A2Billing - An Adventure in PBX Billing - Part 6B – Dry Dock for DID’s (Continued)

I see no valid reason to pay $0.0125 per CNAM lookup when we have Wards Superfecta, so well be shutting this OFF. (If we wanted to use it, there is a way to account for it in A2B. We could use the extended rate tables, and set it up as a connect charge on the inbound route.)

Last but not least in the Route number to dropdown box, select Main Account.

Once you have recorded you plan details, Click On Order DID.

Configure the DID(s) in VoIP.ms webui
Once ordered, your DID(s) will now be manageable under DID Numbers, Manage DID(s). Go there and let’s get things setup.

This screen can be confusing – what exactly does it effect? What is its scope? Ok, the good people at VoIP.ms have a dealer/customer or dealer/reseller capability built into their website. To make a long story short, we are configuring settings for the Main Account only at this time. Any such “sub-accounts” would be configured separately.

In the middle there will be a little gear icon and the link for Main Account Inbound Settings. Navigate there, and for Protocol for inbound DIDs select IAX2 from the dropdown box. This reflects our intention to use an IAX2 trunk with this provider.

In the Device Type dropdown, select IP PBX, Asterisk, Gateway or Softswitch
Apply Changes.

The last thing to do for DID configuration here is to click on the little edit icon for your DID, and bring up its individual DID settings.

Once there, verify the following entries are in place.
Routing….. [Main Account] IAX2 . . .
Failover . . . none
Voice mail ….. None
DID Point of service….Select the same server you did when you were creating the trunk. (I use USA3 Los Angeles).

Dial time out in seconds.. Set for 60 seconds, I like our PBX to decide when to rescind the call.

And, again, for caller ID lookup, we don’t need any, thanks to Ward.

When ready, select Click Here to apply changes. Notice the message that says it can take up to 1 minute for these changes to take effect.

FreePBX Trunk configuration for VoIP.ms Trunk
We are now ready to Return to FreePBX and Create an IAX2 Trunk with the properties we captured into notepad (see Gather Trunk Settings for VoIP.ms, above) from the example at VoIP.ms. Remember to alter the allow= parameter to reflect the Codecs your PBX actually supports.

I also like to add qualify=yes so that asterisk displays lag time stats for the trunks. Another important setting to try is trunk=yes. This is the setting that permits IAX2 trunks to bundle calls for better efficiency. Note: You must have a timing source on your system to use this trunk parameter. (It’s the same for using conference rooms, you must have a timing source, either hardware, or ztdummy.).
Don’t forget the trunk name must be voipms.

Go and create this trunk in FreePBX Now,

FreePBX DID configuration
One of the most common problems when setting up inbound routes in FreePBX is messing up the DID number. You must enter the DID exactly as Asterisk will be receiving it from the DID provider.

It’s also a good idea to test a new DID and make sure it works in the FreePBX environment before getting A2B into the picture.

A sound practice is to capture caller DID being received by asterisk (from the asterisk cli), and paste that into the inbound route on FreePBX.

Using FreePBX Inbound routes, temporarily route the DID directly to any valid extension, and try calling into the DID from the outside (Cell phone, etc.). If the call doesn’t ring the extension like this, it won’t work in A2B either. Again, verify exactly what DID is being received by Asterisk, and use that to define the inbound route in FreePBX. Once you can call into the extension, make sure that the call is working as it should (It has 2 way audio, and etc.).

When you have verified the inbound DID works, move to the next step.

Now we shall see a bit of the plumbing that supports the handoff of inbound calls from FreePBX to A2B. For each DID you are setting up in VoIP.ms, create an inbound route in FreePBX. Specify Only the DID Number, Set Destination for Custom Destinations: A2B-DID. This is how calls are passed into A2B from FreePBX. Set the caller lookup source to be the Superfecta which we installed earlier in this project.
Select SUBMIT to save your new inbound route.

Info: The Custom Destination is used to direct DID into A2Billing for onwards delivery and billing.

A2Billing Trunk Configuration for VoIP.ms
Not all providers use or require the same configurations for their trunks. Inbound calls can be forwarded by your provider in a number of ways. Some providers require both inbound and outbound trunk directions to be authenticated, others do not. VoIP.ms does not require inbound calls to have an inbound authenticated trunk for them to be received on, so if you are not using them for outbound calls (this project uses Fonicatec), you may skip this step.

This is virtually the same procedure we used when we configured the Fonicatec trunk in A2Billing. Here’s a brief recap of the steps: (from the A2B admin webui)

TRUNK, Create Provider, VoIPms

TRUNK, Add Trunk:
Provider: VoIPms
Label: VoIPms-trunk
Provider Tec IAX2
ProviderIP VoipMS

A2Billing Inbound DID Trunk Configuration for VoIP.ms
Because we are being charged for inbound minutes, circumstances are a little different than what A2B expects (A2B assumes that inbound call are all unlimited).

To prepare A2B to bill for inbound minutes, we must create a special trunk in A2B to handle these “Local Inbound calls”. Because we may want to run reports in A2B on the use of the Local Trunk, we also want to create a Trunk provider for the Local-Trunk.

Create Provider
Navigate to the A2B Admin screen, under TRUNK, select Create provider.
In provider name enter Local Destination, and confirm Data.


Create Trunk
We have created trunks in A2B before, so here’s a brief reminder of the steps to used, and the information you need to create this special trunk: (from the A2B admin webui).

TRUNK, Add Trunk:
Provider: Local Destination
Label: Local-trunk
Provider Tec Local
ProviderIP %dialingnumber%@from-internal

And CONFIRM DATA when you are satisfied with your entries.

A2Billing Rate Cards Calling Plans, and Rates for Inbound Call Rating
Adding a Rate Card
This is virtually the same procedure we used when we configured the Fonicatec RateCard in A2Billing. Here’s a brief recap of the steps, and the information you need to create the Local Destinations rate card : (from the A2B admin webui)

RATECARD, Create New RateCard, Tariff Name: Local Destination
Select Trunk: Local-trunk
Confirm Data

Adding Rates
Because we use the Local-trunk & the Local Destination rate card to rate (bill) the inbound calls, we must add rates for any DID’s we have in the system. In fact, that’s the only purpose for the Local Destination rate card. We wont need to import a whole slew of rates again since this trunk is ONLY used for inbound calls; Only our DID’s need to have rates created for them.

From the A2B admin webui, under RATECARD, Select Add Rate.
In the Ratecard drop down list box, select Local Destination.
In the prefix field, enter the users FreePBX extension number.
In the Destination field, enter the 10 digit form of the DID.
In the Purchase Cost section, enter the cost, minimum duration, and buyrate billing block data. For our Voipms DIDs, that is
Buy Rate: 0.0149
Min Duration: 6
Buyrate Billing block: 6

In the Selling Cost area, enter the same information using the sell values you have determined appropriate for your PBX. Then click Confirm Data.

Using these same steps, add a rate for each DID you have added to your system.

See A2Billing - An Adventure in PBX Billing - Part 6C – Dry Dock for DID’s
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 6C – Dry Dock for DID’s

A2Billing - An Adventure in PBX Billing - Part 6C – Dry Dock for DID’s (Continued)

Add the Local Destination Rate card to the Calling Plan
We also need to associate this new Local Destination RateCard with our existing Calling Plan. Under RATECARD, Select List Calling Plans. Select our Standard Family Calling Plan and click EDIT.

Under Add New RateCard, highlight, and ADD the new RateCard called Local Destinations. Then CONFIRM DATA to save your changes.

A2Billing DID Configuration for VoIP.ms Trunk
The next steps are akin to placing the DID(s) you have secured from VoIP.ms into inventory with the A2B system. Once in inventory in this manner, we can assign it to an account, and manage it.

From the A2B webui, Under DID, select Add DID group. Name it Group 1 DIDs Save your Data. Note that regardless of how many different DID providers you may ultimately use, we will only ever create this one DID Group called Group 1 DIDs. All DID’s that are meant to be usable by the end users will be assigned to this group.

Under DID, select Add DID. In the DID field, enter the DID number you captured from the Asterisk CLI earlier (when we tested the new DID in FreePBX before routing the call to custom destination: A2B-DID). For billing, Select Fixed per month + Dial Out.

Select Group 1 DIDs for DID Group.

Select a country where the DID terminates. This is for reporting purposes only.

Select ACTIVATED = YES

For the monthly rate, enter the desired monthly selling price for this DID. If you want to charge exactly what you paid, enter exactly that amount. If you want to charge a different amount, enter that amount here.

When you are satisfied with your entries click CONFIRM DATA.

Repeat this process for all the DID’s that you acquired from VoIP.ms.

Connect the DID to the User Extension
Now we need to assign a DID to an A2Billing user account. There are two ways this can happen.

The administrator can do it through a process called Add Destination, or, the end user can go through a “purchase process” which accomplishes the same thing.

User Account Changes
In order to make these DIDs available for end user purchase, the User account in A2B must be assigned to Group 1 DIDs. From inside the A2B Admin webui, select CUSTOMERS, List Customers, and edit each customer account to reflect DIDGROUP: Group 1 DIDs.

Lets start by looking at the “end user DID selection and purchase method”. Log in to the A2B user interface as a user to whom you wish to assign a DID. Another way of saying this is pretend for a minute you are one of your users, and you received an email directing you to log in here, and select your telephone number from those available. (People LIKE choices). So, you log in, and from the user webui, and select DID.

From here your users can select from the telephone numbers you have “in stock”, and acquire them for use.

Click on the Select country drop down box, and select United States. You should see the list of all the DID’s you have configured in A2B. To buy a DID for this account, click on the DID that you want – this will select it. Then, in the Ring to Destination field, the user simply enters their FreePBX extension number.

Make sure that the VoIP CALL control is set to NO, or this DID’s inbound minutes wont be billed.

When you are satisfied with your entries, click NEXT.

You will be asked to confirm your new DID purchase. Say YES/OK.

That’s it – this DID will now ring at the extension specified, and be rated by A2B.

Now, let’s look at the “admin assigns DID’s to end users method”. Log into the A2B admin webui, and under DID, select List Destinations. You will see a very short list consisting of the destination you created, when testing out the end user selection and purchase method.

While in the A2B admin webui, under DID, select Add Destination. In the destination filed, enter the FreePBX extension number to which you want the call delivered. For ID card use or select the A2B Account Number for the account that is to be billed for these DID calls, and select the DID from the drop down box. Set it to be activated, and VoIP call must be set to NO, or the call will not be delivered or billed.

The exact same results would have been achieved if the admin had come here and selected Add Destination, and entered the FreePBX extension in the field labeled DESTINATION, entered the account number of the correct A2B user in the IDCARD field, and selected the DID from the drop down list box.

Another way to say this is that whether or not the end user is allowed to select and purchase their own DIDs from a list in the user interface, or if the administrator creates the destination from inside the admin webui – the exact same results occur, and can be viewed in the List destinations area.

If you wish to manually assign your DIDs to users (the “Admin Assigns” method), please do so now.

If you intend to let your users select their own numbers (the “User Selects” method), you are finished with DID Configuration!

So – lets test it. Grab your cell phone and dial a DID which has been assigned to an A2B Account / FreePBX user. Obviously, make sure that the extension is plugged in and registered with the PBX. When I just tried it, the extension rang! J

If yours rings also, pick it up and have a short conversation with yourself – after you hang up – log into the A2B user webui and check out the info under invoice details. You will see one DID call detailed at the bottom of the screen.

Congrats – your inbound “by the minute” billing is working!

See A2Billing - An Adventure in PBX Billing - Part 6D – Dry Dock for DID’s
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 6D – Dry Dock for DID’s

A2Billing - An Adventure in PBX Billing - Part 6 – Dry Dock for DID’s - Continued

Call Flow Overview
We have now deployed a complete set of call flow procedures. We have a trunk, we can place outbound calls, and we can receive incoming calls – and A2B rates and bills for them all. The diagrams depict what we have accomplished so far.

icf.jpg


ocf.jpg



Accounting for Special DID Bundled Minutes Pricing

Got Free Minutes? It’s a Package Offer
DIDs that come with bundled talk minutes require special handling. We shall use an A2B Package Offer. You can create an unlimited number of Package Offers in A2B – but a customer can only participate in one Package Offer at a time.

Some free Minutes – Then By the Minute
As it turns out, neither of the DID plans at VoIP.ms include a certain amount of free minutes, and then bill by the minute – but it is a fairly common thing to find with DID vendors, so we should understand how to accommodate that type of billing in A2B.

All Free Inbound Minutes
If you acquired an all you can eat DID plan, you still want to create a package offer to account for the cost free nature of your inbound calls.

3000 Free Inbound - Package Offer
From the A2B admin webui, select PACKAGE OFFER, Add Package Offer.
If your DID(s) came with 3000 free minutes, name the Package something descriptive, like 3000 Free Inbound Minutes. The package type should be Free Minute. Since the free minutes reset monthly, the Billing type should be set to monthly. The Free time to call field is the number of seconds that are included for free each billing period. 3000 minutes *60 seconds = 180,000 seconds, so we would enter180000.


The START DAY is of particular importance, as it allows you to synchronize when A2B and the vendor “roll over” the service for the month and reset the free minutes. Asking the vendor when they do their Free Minute reset should get you the answer you need.

Confirm Data

All you can Eat Inbound – Package Offer
If your DID(s) came with unlimited inbound, you would Label it something like “All Free Inbound”, with a package type of Unlimited, and a billing type of Monthly.
The STARTDAY should be set to 1. Free Time to call should be set to 2,678,400, (That’s 86,400 seconds a day times 31 days.)

This is certainly not the only way to accomplish configuring for All Free inbound minutes. We chose this way because we like a consistent approach to handling any amount of bundled inbound minutes; hoping that consistency might make it easier to maintain later on. However, this approach does have its down sides.

If you want to offer free outbound minutes as well, there’s a bit of a snag because you can only participate in one package at a time. (You could create a package with a certain amount of free minutes irrespective of their being used for inbound or outbound – much like your cell phone probably works.) The key is to remember always that a user can participate in one Package at a time.

Another approach would be to adjust the rate in the Local Destination rate card for this inbound DID to zero for both buy and sell rates. This is perhaps the most elegant method to use.

Likewise, you could simply route the inbound DID directly to the destination extension – and not route it into the A2B/1 custom trunk we use to bring inbound DIDs into A2B. The calls would go through, and never touch A2B. The down side is that these calls would not show up at all in A2B – the end users would not have records of the calls (since they didn’t go through A2B),

If you acquired the all you can eat plan DID at VoIP.ms, this is the way to go for you. Your DID calls will still be recorded in A2B – but no fees will ever accrue for DID minute use. Build this package in A2B now if this is the type of DID(s) you are using.

Apply Package Offer to Customers (A2B Accounts) via Call Plans
Packages are applied to an A2B customer account via the Call Plan – so if we are going to be using DID’s that include all-you-can-eat inbound, or some free minutes before billing for calls, we need to create a special Call Plan that Includes the correct Package Offering.

When we don’t need a Package
If your DID(s) came with zero free minutes, such as the metered plan from VoIP.ms, you do not need a Package Offer. Just assign the customer accounts to the Standard Family Plan. It has no Package Offer associated with it – so all inbound calls will be billed.

Create the 3000 Free Inbound Call Plan
If have acquired this type of DID(s), you’ll want to create a call plan for their use. From the A2B admin webui, under RATECARD, select Create Call Plan.

Our regular Call Plan is Called Standard Family Plan; Since this plan includes 3000 free Inbound Minutes, Well Call it 3000 Free Inbound., For LC type select LCR: According to buyer price. For PACKAGE, select 3000 Free Inbound Minutes. For REMOVE INTER PREFIX, select YES.
Confirm Data to Save.

Create the All Free Inbound Call Plan
If you acquired the flat-rate all you can eat plan from VoIP.ms, you’ll want to create a call plan for users of those DID(s). From the A2B admin webui, under RATECARD, select Create Call Plan.
Call it All Free Inbound., For LC type select LCR: According to buyer price. For PACKAGE, select All Free Inbound. For REMOVE INTER PREFIX, select YES.
Confirm Data to Save.

Assign RateCard(s) to the New Plan(s)
From within the admin webui of A2B, select List Call Plan, and EDIT each new Call Plan to add the RateCards called Local Destination and Standard – Fonicatec to the plan. Do this by highlighting them, and clicking ADD RATECARD. Don’t forget to CONFIRM DATA to save your changes.
(If you forget this step, A2B won’t be able to process any calls for anyone on the 3000 Free Inbound Call Plan, or the All Free Inbound Plan because there wont be any valid destinations (Rates) available.)

Assign A2B User Accounts to the correct Calling Plan
Users who have DID’s that offer 3000 free minutes, or unlimited free minutes, need to be assigned to the appropriate plan.

Still in the A2B admin webui, Under CUSTOMERS, List Customers, Select the EDIT button for the customer you need to edit. Change the CALL PLAN from Standard Family Plan to the one that is appropriate for the DID(s) they use. Then CONFIRM DATA to save your changes.

That finishes the configuration for DIDs that are either partially or totally metered.

Now we will deal with regular recurring fees that do not have any connection to talk minutes or DID fees. We have decided to split the hosting fees equally among the families using the PBX which in this case means about $7/month. The method we will use is subscriptions.

See A2Billing - An Adventure in PBX Billing - Part 6E – Dry Dock for DID’s
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing - An Adventure in PBX Billing - Part 6E – Dry Dock for DID’s

A2Billing - An Adventure in PBX Billing - Part 6E – Dry Dock for DID’s (Continued)

Subscriptions
Subscriptions are periodic charges which can be applied to an A2B user account. (Each A2B user account may be associated with a SINLGE subscription.)

From the A2B admin webui, under RECURRING SERVICE, select Add Subscription.
Label the Subscription Hosting Fee
Fee: 7.00
Status: Active

Now that the subscription is ready to be used, edit each customer record in A2B and set the SUBSCRIPTION FEE Drop Down box to HOSTING.

Subscriptions are billed via CRON job. By default, subscriptions are billed the first day of every month – which works just fine for our project. If you wish to change that schedule, you can use WebMin to make changes. You’ll find it under System, Scheduled Cron Jobs. In fact, this is an easy way to examine any/all of the Cron tasks that A2B sets up.

It’s been a long and exciting voyage. Sometimes the seas have been rough – but with Joe Ropers help – we never took on to much water to keep going The basic (whew) configurations have been completed now, and the system is working .

In review of our goals – here’s how the project shapes up:

Hosted Provider / PBXIAF
Video Support (Obviously)
Bells and Whistles – Features and Functions
Conference Room(s)
Voice Mail
Web Access
Extension to extension calls free.
Web Based Account Management

Calls to and from the OutSide NOT Free
Apportioned Maintenance Fees

During the project – we directly addressed 8 of 9 goals! That’s great news. And the other one, number 4: Conference rooms, doesn’t need to be covered here. Simply set up the Conference Room using FreePBX as always. The extensions you assign the conference room will be directly dialable by all extensions.

Part 6 is the final part of this article - and we are done! If you made it this far, you should have a fully working system, capable of meeting the specific needs we hoped for. I hope you enjoyed the travel as I did from start to finish.

But we aren’t quite done with this topic just yet. When we meet next, we will take a look at getting the FreePBX FollowMe capability to work correctly with A2Billing. I'll keep you posted on how that works out as soon as we have results to talk about!

Tony

PS: Now would be a really good time to make a FreePBX backup, and a A2Billing backup - to safeguard against the loss of all your hard work.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Extension to extension Calls Are Free

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!

Thanks for the very kind words!
If you mean extension to extension calls, if they are dialed using the FreePBX assigned extension number, they are free, and occur "Under the hood" and out of site of A2Billing.

If you mean you want some extension to go out the trunks, but not be billed - there are probably a couple different ways you can approach that. Let me know if that's what you wanted
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Excellent tutorial... Thanks a lot... Keep it up...
Neil

Thanks Neil - I'm very happy to hear you are finding it useful. :smile5:

I noticed this is your first post here - very nice to have you aboard. This is a great community - and it works best when everyone feels free to contribute and ask questions. Good luck with your project!
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
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 :)

Ok - so - how did we do? Did you do a build up and test out the system? How did it work out for you? :yesnod:
 

TheShniz

Guru
Joined
Nov 15, 2007
Messages
560
Reaction score
2
Ok - so - how did we do? Did you do a build up and test out the system? How did it work out for you? :yesnod:

Well I've been most impressed with the sheer level of detail you've provided, as you seem to have left absolutely nothing to question... I truly appreciate this!

Question: How did it test out for me?
Short Answer: I've not built a test box as yet.

Long Answer:

I like to read everything from start to finish, and then I begin by documenting everything in the writeup... which basically entails transcribing, condensing, filtering, and formatting. Then I build a test box off my own transcription. The reason being, I intend to follow these instructions over & over, and just works out easier for me. Anywho, I'm currently backlogged at work with systems that need to get out, but I've already begun my own documentation... I anticipate building a test box in a week or two.

Special Note for Everybody:

Asterisk is community driven, and as such... good documentation is always a rarity. HowTo's are literally scattered every which way in varying levels of quality. I always suggest to those new to the game, to create their own system of documentation. It truly helps you wade through the crap, keep the gems, and most importantly be able to find what you're looking for. There is just soooo much to remember, and I don't like the statement "he's forgotten more than I even know". Document First, Build Second, and Revise Document Again.

I've been following A2Billing for YEARS, have dabbled with it several times at various stages, but have not seen anything even remotely as good as this writeup here... thanx a bunch Tony!!!!!
:party:
 

nsukho

New Member
Joined
Dec 25, 2008
Messages
14
Reaction score
0
Tony,
Again, thank you for this topic. It has helped me a lot in setting up my billing module.
I am trying to find a solution to the following situation:
Let's say one of your subscribers make a phone call from the freePBX extension to another subscriber in your pbx system by dialing the subscriber's DID number (not the extension number). I prefer to convert that call from extension to extension without using the outgoing trunk and DID. I still want that phone call to be logged into the a2billing's CDR. That way the call is FREE of termination & DID incoming charges. Is there any possibility of doing this? If yes, please tell us how.
Thanks in advance.
Neil
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
You would need via A2Billing trunk, A2Billing to recognise the dialled digits, so you would have to put the DID in a rate card, with a local trunk to pass it bcak to the extension.

So in Tony's writeup, all you should have to do is create a ratecard with your DID in it, using the same "local" trunk, and then set the destination you want. e.g. extension number.

Make sure you attach the ratecard to the callplan.

Joe
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A2Billing – Integrating IVR’s into the Family Phone System

Today – I want to change my mom’s inbound telephone line to include an IVR.

Since Mom has an accountant to handle her bills and finances, we want calls related to those things to go to the accountant, and not reach mom and get her agitated. (This type of agitation tends to spread to everyone around. Not good. :cryin: )

At the same time, we don’t want to break our nice new A2Billing setup either.

Here are the design goals:
  • Route Moms inbound calls to an IVR
  • The IVR has two choices, talk to the accountant, or talk to Mom
  • Billing must not be broken.
Here’re the basic steps we will take to get there from here.
  • Create the IVR
  • Create a Dial Plan, and Custom Destination to provide a call path to the accountant
  • Create a misc application to provide a path to the IVR
  • Create a Rate Card to the new IVR destination
  • Edit the A2B Destination for Mom's DID
Overview
We presume you already have built up your system, and that the DID we are working with is already routed to an end user successfully and working fine with A2Billing. If not, don’t bother proceeding now, as it won’t magically start working just because we are adding the IVR.

To accomplish our goals, virtually none of the call flow between FreePBX and A2Billing need be changed.

Essentially, the inbound call flow for the DID stays the same.
icf.jpg

In the case of an inbound DID call, the Rate Selection Rule in A2B finds the destination extension to be a complete (or longest) match in the Ratecard created for that extension. That Rate Card is associated with the Local Destination Trunk. The Local destination trunk sends the call back to FreePBX to delivery to the destination configured in A2B for the DID. The presence of the IVR changes nothing in this call flow.

The ONLY change to call flow, is the A2B destination for the DID is changed to the extension of the IVR, instead of Mom’s actual extension.

The accountant is available by URI - so we’ll set up a simple dial plan that goes directly there.

Step 1: Create the Accountant Call Path
Add the Dial Plan Fragment
In FreePBx config edit, in extension_override_freepbx.conf, add the following context. (I usually add to the bottom of the file to avoid other contexts.)

[accounting]
exten => s,1,Dial(sip/[email protected])

(Where xxx and yyy are replaced to from your valid URI)
Note that you could use any valid dial syntax here – including PSTN calls if that’s all your accountant has.

Add the Custom Destination
In FreePBx Custom Destinations, Add a custom destination with the following characteristics:
Custom Destination: accounting,s,1
Description: Accounting

When you have all the settings as described, save your changes, apply configuration changes, and continue with reload.

Step 2: Create the IVR Sound File
The IVR will play a recording telling folks to press one if they are calling about busniees, and 2 if they want to talk to Mom. Because we have Cepstral, we want to create the IVR announcement using Allison’s Voice.

Prepare the sound files.
To create the IVR announcement you can record them in your own voice, or create them with swift (Cepstral) or flite. To use flite/swift, create a text file containing the things you want spoken.

The following example includes the use of Cepstral’s mark up language which allows you to alter the way the text is spoken. To use this example with flite, simply remove the htm-like code, leaving it to be plain text.

moms-ivr.txt should contain text something like this:

<break strength='strong' />Hello - you have reached the Smith residence.<break strength='medium' />
If you are calling to discuss financial concerns, bill payments, or money matters of any kind, please press 1 now.<break strength='medium' />If you are calling to speak to the Smiths, please press <emphasis level='strong'> 2 </emphasis> now.
Upload the moms-ivr.txt file to your pbx. I use winscp, and place them in /root.
Log into your pbx (I use putty), and cd /root

Flite and swift have the same syntax. From putty:

Code:
  [FONT=&quot]swift -f moms-ivr.txt –o moms-ivr.wav[/FONT]
  [FONT=&quot]or [/FONT]
  [FONT=&quot]flite -f moms-ivr.txt –o moms-ivr.wav[/FONT]


Step 3:
Upload the sound file to System Recordings.
The next step is to move the wav file we created in step 2 back to your local PC. No reason to let them build up in the /root folder. I use winscp to move them back to a storage folder on my pc.

NOTE: In Step 4, we use a neat effect in the IVR, for which it will be easiest if we have TWO COPIES of the moms-ivr.wav file. Once you have moved the file back to your PC, make a second copy of it named moms-ivrr.wav

Once you have both copies of the wave file ready, use the FreePBX System Recordings function to upload them. Leave the files named as they are.

Step 4: Create Composite IVR Timeout Message
We would like the IVR message to repeat once if the caller does not respond, in case they weren’t paying attention the first time around. But I also want to add some additional words to the effect – “Hey – you need to press a button” before repeating the IVR sound file.

To do that, well use a neat feature of FreePBX that I call composite system recordings. In step 3, above, we created and uploaded 2 identical copies of the IVR wave file (moms-ivr, and mom-ivrr). We will use moms-ivr.wav for the first time the IVR plays.

Now lets make a composite system recording response to play during the replay(s) of the IVR sound file.

Using FreePBX System Recordings locate and select the moms-ivrr file on the list.

Under the files section, click the blue down-arrow 3 times to open up 3 blank lines above it.

Using the drop down box, locate the following sound files, and select them, one for each blank box we created in the Files section:

Top Box: talking-to-myself
Second Box: sorry-your-having-problems
Third Box: please-try-again

The fourth box should already have moms-ivrr listed. When you have all the files arranged as described, save your changes, apply configuration changes, and continue with reload.

Step 5: Create the IVR
In FreePBX, Setup, IVR, select Add IVR. Create an IVR with the following characteristics:
Change Name: Smith-IVR
Announcement: moms-ivr
Timeout: 7
Enable Directory: NO / Unchecked
VM Return to IVR: NO / Unchecked
Enable Direct Dial: NO / Unchecked
Loop before t-dest: YES / Checked
Timeout message: moms-ivrr
Repeat Loops: 2

In the Options area, use the following Destinations:
Keypress: 1
Custom Destination: Accounting

Keypress: 2
Extensions: Mom’s Extension

Keypress: t
Terminate Call: Congestion

When you have all the settings arranged as described, save your changes, apply configuration changes, and continue with reload.

Step 6: Add Misc Application
Because A2B will need to be able to route calls to the IVR, the IVR needs to be assigned a dialable number. In FreePBX, Setup, Misc Applications, Select Add Misc Application.
Create the Misc application with the following characteristics:
Description: Smith IVR
Feature Code: any valid extension (keep the 10xx pattern to maximize a2b integration ease.)
Feature Status: Enabled
Desitnation: IVR: Smith-IVR

When you have all the settings arranged as described, save your changes, apply configuration changes, and continue with reload.

Step 7: Configure A2Billing
In FreePBX, we leave the inbound route for Mom’s DID going directly into A2B. Inside A2Billing, we need to make a couple of alterations. This assumes you have your system set up as per the rest of this 6 Part thread.

Add Rate Card
Before A2B can route calls to mom’s IVR, it has to have a valid rate for that destination.
From inside the A2B admin webui, under RATE CARD select add rate. Create a rate with the following characteristics:
RATECARD: Local Destination
DIAL PREFIX: Your IVR Extension (Feature Code used in step 6)
DESTINATION: Mom’s10 digit DID
BUY RATE, BUYRATE DURATION, BUYRATE BILLING BLOCK, and the corresponding SELL RATES need to be set to the values you have determined are appropriate for this inbound DID. (As you did when you created the inbound DID billing function in previous parts of this article.)

When you have all the settings arranged as described, save your changes with CONFIRM DATA.

Modify Destination
Now, we must tell A2B to route Moms inbound calls to her new IVR, instead of directly to her extension.

While still in the A2B admin webui, under DID, select List Destination. Locate the destination for Mom’s DID, and select EDIT.
On the DESTINATION line, change the value from Mom’s extension, to the IVR Extension (Feature Code used in step 6), and CONFIRM DATA.

If everything has gone well for you – when you call the DID, you are greeted by your IVR, and A2B is rating the call normally. Since this works, my mind has been going overboard coming up with cool reasons to use IVR's within our hybrid FreePBX/A2Billing Family Phone System.
I'd be very interested to know how you use the IVR integration with A2Billing. :chefb:

Until Next time -
 

Members online

No members online now.

Forum statistics

Threads
25,778
Messages
167,504
Members
19,199
Latest member
leocipriano
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