Getting started with FreePBX – Part 6 Cheap phone calls using DISA and Callback
One of the great things about voip is that you can make international calls at local rates. Combine that with Asterisk/FreePBX and you’ve got the ability to make cheap international phone calls using your mobile phone.
To do this we’re going to setup DISA (Direct Inward System Access). This will enable us to ring our Asterisk server, get a dial tone and then dial back out again.
Then I will show you how you can combine this with callbacks if that works out cheaper for you.
Installing the modules
First we need to install the DISA (if it’s not installed already) and Callback modules. See part 5 for more information about installing FreePBX modules.
Setting up DISA
Now we are going to configure a DISA…
Click on DISA on the left hand main menu
Give your DISA a name- I called mine “testdisa”
Give it a PIN – really important as you don’t want anyone able to make calls while you pay!
and click “Submit Changes”

Now I’m going to use the IPKall DID number I setup in part 4 to call my DISA so I need to change the Inbound Route
So click Inbound Route in the main menu, scroll down to the bottom and change the destination to the new DISA
and click Submit

Now click “Apply Configuration Changes” and give it a go.
Now if you dial your DID number you should get a message saying “Please enter your password followed by the # key”. If you do that you should get another dial tone and be able to make calls as though you were ringing from an internal extension.

Using callback
Sometimes it might be cheaper to get the system to call you back as well as giving you a dial tone to dial out on. That’s simple to setup by modifying what we did above.
First we need to click on the click on the Callback menu on the left hand side
Then give your callback a name – I called mine “testcallback”
Then give it a callback number to call you back on (it might be possible to leave this blank and have it call you back on the number you called in from – if appropriate)
Then set a delay if required
Then set the destination as the DISA we configured earlier, and click Submit Changes

Now we’re going to modify the DID Inbound Route again so click on Inbound Route on the left hand menu and select the “ipkall” inbound route
Here I’m going to do 2 things -
First I’m going to add a “Caller ID Number”. This is because I only want the system to call me back when I dial the DID number. I don’t want it calling me any time anyone calls the number. So I enter my mobile phone number in the “Caller ID Number” box

Secondly I change the destination to the “testcallback” we just created, and click Submit

Finally click on “Apply Configuration Changes” and give it a go!
You should be able to – dial you DID number and get a fast busy tone, hang up, get a call back, enter your DISA password and get another dial tone that you can call back out on.
![]()
Last updated by .
Related posts:
- Using DISA with FreePBX and A2Billing
- Getting started with FreePBX – Part 4 Setting up a DID number
- Getting started with FreePBX – Part 3 Making external calls
Avaialble systems include FreePBX, PBX-in-a-Flash, Elastix, A2Billing and FusionPBX.
More details and prices can be found at sysadminman.net

B. Mettichi:
Hello Sir,
I have a calling card system composed of Asterisk, FreePbx and A2Billing. Can I setup the CallBack feature in FreePbx and bill it in A2Billing. In other words: How to setup the billing of callback calls, that have been set up in FreePbx, in A2Billing.
Thanks.
2 June 2009, 3:08 ammatt:
Hi, A2Billing has it’s own callback system so you probably want to use that to place the callback (not the FreePBX module). In FreePBX you would just create an Inbound Route for your DID that passed the call to A2Billing (this is usually a custom destination called a2billing-callback. This is all you would do in FreePBX.
2 June 2009, 9:15 amB. Mettichi:
Hello,
Thanks a lot for your reply.
The problem is that I havn’t succeded to install A2Billing callback (the callback daemon). The documentation of A2Billing is really missing a lot of information.
Please help me installing the callback scripts and configuring it.
Thanks
2 June 2009, 5:57 pmmatt:
The callback daemon can be tricky to install and, to be honest, it can also be a bit flaky in A2Billing v1.3. They have completely rewritten the callback daemon using python in the soon-to-be-released A2billing version 1.4. My advice would be to wait for the if that’s possible. If not then what errors are you getting trying to setup the callback daemon?
2 June 2009, 8:39 pmmepj:
I found your site so helpful in getting started with asterisk and Freepbx, I have closely followed all the guides but the softfone does not register with asterisk. I have done port forwarding in both the router and the pc’s firewall but still nothing worked. what could be the reason?
4 June 2009, 12:59 amthank you. keep up the good work.
B. Mettichi:
Hello Matt and thak you for your help.
I have install a2billing 1.4 on Debian. I have succeeded to install the Callaback daemon with the install instructions given by a2billing.org.
When starting the callback daemon, I get the following error message:
srva13:/usr/src/a2b-1.4/CallBack/callback-daemon-py/callback_daemon# service a2b-callback-daemon start
Starting a2b-callback-daemon : a2b-callback-daemon:Traceback (most recent call last):
File “/usr/bin/a2b_callback_daemon”, line 7, in ?
sys.exit(
File “/usr/lib/python2.4/site-packages/pkg_resources.py”, line 236, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python2.4/site-packages/pkg_resources.py”, line 2097, in load_entry_point
return ep.load()
File “/usr/lib/python2.4/site-packages/pkg_resources.py”, line 1830, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File “build/bdist.linux-x86_64/egg/callback_daemon/a2b_callback_daemon.py”, line 23, in ?
File “build/bdist.linux-x86_64/egg/callback_daemon/database.py”, line 28, in ?
ImportError: cannot import name sessionmaker
failed!
Can you help me fix this problem.
Thanks.
4 June 2009, 8:06 amB. Mettichi:
Hello Matt,
I have just succeeded fixing the problem above. The callback daemon works well now.
Can you give me a sample configuration of the callback in a2billing (a screenshot will be very helpful).
Thanks.
Regards.
4 June 2009, 4:57 pmmatt:
Hi, I’m glad you got it working! Any chance you could explain what was wrong in case it could help someone else?
I’m afraid I don’t have any examples for version 1.4 at all yet but will do when it’s released from beta.
Matt
4 June 2009, 10:37 pmmepj:
I found your site so helpful in getting started with asterisk and Freepbx, I have closely followed all the guides but the softfone does not register with asterisk. I have done port forwarding in both the router and the pc’s firewall but still nothing worked. what could be the reason?
5 June 2009, 1:04 amthank you. keep up the good work.
matt:
Hi mepj, thanks for the comments.
5 June 2009, 6:34 amDid you install Asterisk/FreePBX on the server? It may be the firewall (iptables) on there blocking connections to port 5060. You should be able to see if this is the case by doing “iptables –list”
B. Mettichi:
Hello Matt,
The problem was the version of sqlalchemy needed by the callback daemon.
The solution is by installing the 0.4 version.
About the callback feature, I havn’t yet succeeded getting it working. I need, if possible, a sample configuration from you (a screenshot would be the best) even if the sample is from the 1.3 version.
Thanks in advance.
6 June 2009, 5:18 pmzenny:
It was a great tutorial. But what I could not do is the recording the calls (both incoming and outgoing) even when I opted for ‘Always’ in ‘Record Options’ in the related extension to IPKall number. How can I record calls that gets routed via IPKall? Any hints will be appreciated!! zenny
29 June 2009, 9:22 amzenny:
I came across this site for DISA calls recording, but could not exactly follow and worry it may bread security or FreePBX code
http://seal-7.blogspot.com/2008/06/recording-transport-with-freepbx.html
Just for the community’s info.
30 June 2009, 6:34 ammatt:
Hi Zenny. Many thanks for sharing!! Matt.
30 June 2009, 8:55 amElmohem:
Hi
I configure DISA but when i call DID I got the message “Please enter your password followed by the # key”.
27 October 2009, 8:32 amAfter I heard this message I enter my PIN 1234 but i hear password incorrect but i am sure is right.
When I configure DID to used inbound call for a2billing I hear message say “enter your pin card number” I enter my card number but after that enter message again said the not pin number entered.
Can i got a solve for this problem??
Thanks
matt:
Hi. It is probably an incorrect setting of dtmfmode on the trunk. It is likely that Asterisk is not ‘hearing’ your keypresses. Have a search for dtmfmode, there are a few different options to try. Matt.
27 October 2009, 8:17 pmElmohem:
Thank you Matt
I will copy my trunk configure and removed the user name and password and ip server
allow=g729&ilbc&ulaw&alaw
27 October 2009, 10:49 pmcanreinvite=no
context=from-pstn
disallow=yes
fromuser=>>>>>>>>>>>
host=194.>>>.>>>.>>>
insecure=very
nat=yes
qualify=no
secret=>>>>>>>>>>>
type=peer
user=>>>>>>
username=>>>>>>>>>
dtmfmode=rfc2833
Rhofran:
ImportError: cannot import name sessionmaker
hi Metichi,you said that you fixed that problem, but how??
can you please share this information with us?
Thanks
2 December 2009, 1:17 amharif:
hi…
ur site is extremely helpfull…i succesfully configured a2billing…thanx to u…
now i got problem with a2billing callback
i am using elastix 1.5.2.2 with a2billing 1.3
i want to know if callbac-daemon is installed in my elastix or not..how can i know it..i tried (service a2b-callback-daemon status)
but dint got anything..
is callback-daemon required for callback..if yes..how can i install callback-daemon in a2billing 1.3
i dont want to upgrade a2billing
thanx in advance…
21 December 2009, 6:24 ammatt:
Thanks for the comments – I’m glad you found it useful
I’m pretty sure that Elastix doesn’t have the callback daemon installed (you should be able to see with – ‘ps -ef | grep call’)
I thinkn that the callback daemon is definitely the most fiddly parts of A2Billing to get working. You can install it by downloading the matching a2billing version from the website. I’d make sure you install the correct version as it was completely rewritten for A2Billing v1.4 and I don’t suppose that would work wih 1.3.
21 December 2009, 9:08 amharif:
thanx
for the quick reply…when i typed the above commant u told i got the reply below
root 8555 4985 0 05:27 pts/2 00:00:00 grep call
and wen i tried to locate callback-daemon i dint find any file..can u plzz tell me the working version of callback-daemon with a2billing 1.3
and i have 1 more doubt..if i am trying to install callback-daemon in elastix will it change any .conf files in elastix..
can u plzz tell me a good guide for installation of callback-daemon..
actually i have been trying for the past 12 hours…i wud be sooooo greatfull if u help me
thanx in advance
21 December 2009, 10:40 ammatt:
I can’t actually find a link to the 1.3 tar either, although I’m guessing there’s one somewhere.
You should be able to get it from svn though by doing -
yum install subversion
cd /some_temp_folder
svn co –username guest –password guest http://svn.a2billing.net/svn/asterisk2billing/branches/1.3/
As for installing it, if you follow the instructions in the post here they should work -
http://forum.asterisk2billing.org/viewtopic.php?p=9757
Installing the daemon itself won’t change any of the Elastix config files
Matt
21 December 2009, 10:58 amAv:
Thanks alot, it help me. you ar ethe best
5 February 2010, 9:45 pmzenny:
Since one of my ipkall number expired, I requested for a new one and I configured exactly as stated here, but when I call the DID number, I get the response to enter my PIN and #, and immediately after I get an announcement to asterisk user directory instead of the dial tone to call outside. Where did I go wrong? Any pointer? (it was working well earlier with the similar setup). thanks,
15 February 2010, 9:01 amzenny:
To my post above, let me copy part of the output of the ‘asteriks -rvvv’ command on console.
– Executing DISA(“SIP/66.54.140.46-09c9a028″, “/etc/asterisk/disa-2.conf”) in new stack
— Executing Answer(“SIP/66.54.140.46-09c9a028″, “”) in new stack
— Executing Wait(“SIP/66.54.140.46-09c9a028″, “1″) in new stack
— Executing AGI(“SIP/66.54.140.46-09c9a028″, “directory||from-did-direct|l”) in new stack
— Launched AGI Script /var/lib/asterisk/agi-bin/directory
directory||from-did-direct|l: Notice: vm-context not specified. Using ‘default’
— Playing ‘dir-intro’ (language ‘en’)
— Playing ‘dir-intro’ (language ‘en’)
== Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on ‘SIP/204-09bf3a30′ in macro ‘dialout-trunk’
== Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on ‘SIP/204-09bf3a30′
— Executing Macro(“SIP/204-09bf3a30″, “hangupcall|”) in new stack
It shows that instead of pointing me to the new dialtone to dial outside, it seems launching ‘Launched AGI Script /var/lib/asterisk/agi-bin/directory’. Help appreciated!!!
15 February 2010, 9:21 amJohn:
I just switched to freepbx from text asterisk, very nice guide. Before my change I had setup disa with caller-id authentication, and this was only for family members and consisted of three numbers. Is there a way to duplicate this in freepx?
6 July 2010, 4:24 pmmatt:
Sure you can do that. You just need to create inbound routes with the caller id set and then forward those calls to your DISA.
7 July 2010, 12:35 amLee:
Hey Matt,
Great tutorial as ever.
Have been trying to set this up for a client and all steps work up until the final part.
When I receive the call back the system terminates the call when I answer.
Any ideas?
Cheers
13 July 2010, 12:47 pmLee
matt:
Hi Lee,
Callback has always been a pain to get working. What version of a2billing are you using?
As the call is being established it sounds like it’s not getting passed to DISA correctly (is that where the call should be going or straight through to a2billing?)
You’d probably need to turn up the logging level to see what’s going on.
Matt
13 July 2010, 12:59 pmLee:
Hi Matt,
At the moment I just want it to got to DISA as my client has there own server but eventually I want to set it up for all my clients through A2billing.
My A2billing version is 1.3.0
Lee
14 July 2010, 7:18 amLee:
Callback now working,
I found the answer here:
http://pbxinaflash.com/forum/showthread.php?t=7238&highlight=callback
In short the callback timeouts are incorrect on the older versions of Freepbx which means the system will hangup after 15 seconds and terminate the callback. You need to edit this file:
/var/lib/asterisk/bin/callback
And change from:
$timeout = “15000″;
To
$timeout = “30000″;
And it will work.
Cheers
6 August 2010, 1:19 pmLee
matt:
Nice one Lee.
Thanks for the update. Matt.
6 August 2010, 3:12 pmAllthe:
Hi,
I need create a IVR with PIN CODE, in other words, when I dial the number, the IVR number to require the password before sending the message. I need to create this in Elastix.
Can anyone help?
Thanks.
16 November 2010, 10:34 ammatt:
There’s no built in way to request a PIN for an IVR. The only way I can think to do it is with 2 IVRs.
The first IVR would ask for the password, then would just have one option with a long option number (the PIN) that puts the call through to the second IVR.
16 November 2010, 10:58 amBarbaros:
I have fresh installed from iso Elastix 2.2 include a2billing 1.8.1 and i have followed your docs step by step but i have now interested problem. I have a DID from ipkall and it is going to DISA, when i am calling to my DID after pin code i am calling to my mobile phone and checking from logs. My mobile phone is not ringing, it means freepbx is not calling but in the logs shows calling like
” — Called SIP/diamond/xxmyphonenumberxx
— SIP/diamond-00000015 is making progress passing it to Local/xxmyphonenumberxx@from-internal-6e48;2
— Local/xxmyphonenumberxx@from-internal-6e48;1 is making progress passing it to SIP/66.54.140.46-00000014 ”
for me interested ” SIP/66.54.140.46-00000014 ” because this IP of ipkall server. Why my call passing to there i can’t found. More interested when i am calling from a extension i don’t have any problem everything working good. For this situation my callback also is not working same like shows calling but nothing. If somebody have idea can share with me ?
King Regards,
12 November 2011, 2:40 amBarbaros
matt:
Hi, what provider are you using for your outbound calls? I think IPKall is just inbound.
You need to make sure that your caller ID is being presented in a way that works with how you have your outbound routes set up. In other words – can you call your mobile number (in the format it is shown in the CDRs) from an extensions.
12 November 2011, 10:54 amBarbaros:
I am using for outbound calls voipraider and now i can call via DISA without problem but callback still has same problem. For the callback servis freepbx has not any dependency to DID provider because i am using my DID only for inbound calls and it is pointing to callback directly like in your steps. i don’t know how will i pass that problem. Thanks for your attention Matt.
12 November 2011, 8:38 pmmatt:
The only way to see what’s happening will be to use the Asterisk console and turn up the debugging and watch what Asterisk is trying to do unfortunately.
13 November 2011, 2:59 pmTanbir:
I got FreePBX 2.8 in us server. My trunk also based in us. If i call through from uk what will be my dial pattern for internationnal call. My trunk also want me to add 0011103 prefix in e164 format. I am totally new in this field. Can someone help me with this?
16 February 2012, 3:45 pm