找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1495|回复: 2

Using DISA with FreePBX and A2Billing

[复制链接]
发表于 2011-11-13 04:49:13 | 显示全部楼层 |阅读模式
Using DISA with FreePBX and A2BillingDISA is great!
It allows you to call in to your Asterisk server, get a dial tone, and then dial back out as if you were using a normal extension on your system. I use this lots to make cheap international calls from my mobile phone.
You may also wish to route your DISA calls via A2Billing. If you’ve integrated FreePBX and A2Billing as described here it’s a simple case of changing one setting on your DISA setup in FreePBX.

All you need to do is change the ‘Context’ to ‘a2billing’ and you outgoing call will be passed to A2Billing to be routed. So you should end up with something like this is FreePBX -

One thing with DISA – make sure it’s secure! It’s a great feature but you don’t want other people making calls at your expense.

 楼主| 发表于 2011-11-13 04:51:16 | 显示全部楼层

Integrating FreePBX with A2Billing

Please note that if using Asterisk 1.6 or later the pipe (|) symbols below need changing to commas (,)
There are several reasons you may want to integrate FreePBX and A2Billing. Whether you’re just using FreePBX to setup trunks for your a2billing calling card system or you use FreePBX and want to route the outbound calls via a2billing to do least cost routing.
There are 2 things you need to do to integrate the two. The first is to add the following to extensions_custom.conf

/etc/asterisk/extensions_custom.conf
[a2billing]
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,DeadAGI(a2billing.php|1)
exten => _X.,n,Hangup

[a2billing-callback]
exten => _X.,1,DeadAGI(a2billing.php|1|callback)
exten => _X.,n,Hangup

[a2billing-cid-callback]
exten => _X.,1,Wait(1)
exten => _X.,n,DeadAGI(a2billing.php|1|cid-callback)
exten => _X.,n,Hangup

[a2billing-all-callback]
exten => _X.,1,DeadAGI(a2billing.php|1|all-callback|1) ;last parameter is the callback area code
exten => _X.,n,Hangup

[a2billing-predictivedialer]
exten => _X.,1,DeadAGI(a2billing.php|1|predictivedialer)
exten => _X.,n,Hangup

[a2billing-did]
exten => _X.,1,DeadAGI(a2billing.php|1|did)
exten => _X.,2,Hangup

[a2billing-voucher]
exten => _X.,1,DeadAGI(a2billing.php|1|voucher)
;exten => _X.,1,AGI(a2billing.php|1|voucher|1) ; will add 44 in front of the callerID for the CID authentication
exten => _X.,n,Hangup

[a2billing-sip]
exten => _X.,1,DeadAGI(a2billing.php|2)
exten => _X.,n,Hangup

The number after the a2billing.php| is the agi-conf in the a2billing.conf file that the call is passed to. This allows you to have different settings for certain types of calls such as whether the caller can chose the a2billing language or whether their balance is read to them. You will need to restart Asterisk or ‘reload sip’ to get the changes above to take effect.
You might not need all of the contexts above but it won’t hurt to put them in there.
The second thing to do is create the following Custom Destinations in FreePBX -
Custom Destination: a2billing,${EXTEN},1  Description: a2billing
Custom Destination: a2billing-callback,${EXTEN},1  Description: a2billing-callback
Custom Destination: a2billing-cid-callback,${EXTEN},1  Description: a2billing-cid-callback
Custom Destination: a2billing-did,${EXTEN},1  Description: a2billing-did
Custom Destination: a2billing-sip,${EXTEN},1  Description: a2billing-sip
Again, you might not need all of those or you might need extra ones but you get the idea.
So you should end up with something like this -

These destinations can then be used in Inbound Routes, IVRs, etc in FreePBX to pass the call to A2Billing

 楼主| 发表于 2011-11-13 04:57:09 | 显示全部楼层

Using a2billing for caller ID callback

Setting up callback in A2Billing can be a tricky thing!
Here I’ll do a walk through that will hopefully get you at least some of the way.
This guide was written using a SysAdminMan VPS running A2Billing version 1.9.4. I will be using voip.ms for outbound calls and a didx.net inbound number for the callback access number.
PREREQUISITS
This VPS template already has the following set up (if you are using your own installation you will need to ensure this) -
  • A2Billing callback daemon installed and running
  • Your callback server is correctly configured in A2Billing Admin – CALLBACK / Server
  • If you want to route the inbound call using FreePBX then you need a Custom Destination described here
  • Also described in that post is setting up a context to pass the call to A2Billing. For a2billing-cid-callback I now use a slightly modified version as below. This was to prevent double callback entries being created -
[a2billing-cid-callback]
exten => h,1,Hangup
exten => _X.,1,Ringing
exten => _X.,n,Wait(2)
exten => _X.,n,DeadAgi(a2billing.php,1,cid-callback,) ;last parameter is the callback area code
exten => _X.,n,Hangup(38)

As I said the setting above are already included on the SysAdminMan VPS. One change we need to make is tell A2Billing which country the callback will be happening in. This is because the Caller ID will normally be presented without the country code, and we need to add that on to give A2Billing the correct number to dial.
My callback access number is going to be in the UK so I’m going to edit the context above and set the callback area code to ’44′. Don’t forget to reload Asterisk after making the change -
[a2billing-cid-callback]
exten => h,1,Hangup
exten => _X.,1,Ringing
exten => _X.,n,Wait(2)
exten => _X.,n,DeadAgi(a2billing.php,1,cid-callback,44) ;last parameter is the callback area code
exten => _X.,n,Hangup(38)

I’m also going to assume you have the following set up already -
SETTING UP THE ACCESS NUMBER
First we need to pass the inbound call to A2Billing. To do this I am going to create an Inbound Route in FreePBX and initially set the destination to ‘Terminate Call / Put caller on hold forever’ -

This is a great first step as it means we can call the number and should get music-on-hold. If we have any problems at this stage we know it’s absolutely nothing to do with A2Billing.
So, give the access number a call, make sure you get music, and then check in the FreePBX CDR reports and check that your CLID number is being presented (so that A2Billing will know where to call you back) and what format it’s in -

If your access number works OK then change the Inbound Route destination to a2billing-cid-callback -

ADDING THE CALLER ID TO THE A2BILLING CUSTOMER
Now that our inbound call is working we need to tell A2Billing that if a call comes in with a certain caller ID it belongs to a specific customer. To do this edit the A2Billing customer and add the caller ID. We must add the caller ID in the format it it being presented by our DDI provider -

GIVING IT A GO
If you call your access number now you should get a couple of rings and then the call gets disconnected. You should see an entry getting added in A2Billing  to CALLBACK/Add -

So, I got my entry in the callback queue but there are 2 problems with it! The first is that the number it’s trying to call is 44447… As my DDI provider presents the number in an international format there is no need for me to add it on again. So I can edit the extensions_custom.conf file above and remove the ’44′ that I added on to the a2billing-cid-callback context. You must reload Asterisk following this change -
exten => _X.,n,DeadAgi(a2billing.php,1,cid-callback,) ;last parameter is the callback area code

The second problem is that the call stays as ‘PENDING’. The callback daemon should be running every minute and picking up that entry and making the call. As it’s not changing from ‘PENDING’ we know it’s not doing this. Sometimes the callback daemon will start before MySQL, or loses its connection to MySQL. You can resolve this by restarting it -
service a2b-callback-daemon restart

IT WORKS!
And that’s it. I can now call the access number and a callback entry gets created -

The system then calls me back and tells me my balance and asks me to type the number I want to call. You must enter the number to call in a format that A2Billing understands (in other words it must work in the simulator – http://sysadminman.net/blog/2011/a2billing-troubleshooting-ratecard-simulator-2407)
TROUBLESHOOTING
Hopefully that will get you started, but it’s by no means easy. I hope to write a further post with some troubleshooting tips.
Be aware that if you plan on doing this in Elastix then that has an old version of A2Billing (and doesn’t have the callback daemon installed by default) so it’s likely to be much more complicated.

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )

GMT-8, 2026-5-28 12:09 , Processed in 0.016438 second(s), 16 queries .

Supported by Weloment Group X3.5

© 2008-2026 Best Deal Online

快速回复 返回顶部 返回列表