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”

screenshot-3_1_2009-1_52_50-pm

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

screenshot-3_1_2009-1_56_54-pm

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.

screenshot-3_1_2009-2_00_16-pm

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

screenshot-3_1_2009-2_31_42-pm

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

screenshot-3_1_2009-2_18_15-pm

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

screenshot-3_1_2009-2_21_25-pm

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.

screenshot-3_1_2009-2_23_37-pm

41 thoughts on “Getting started with FreePBX – Part 6 Cheap phone calls using DISA and Callback

  1. 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. matt Post author

    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.

  3. B. 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

  4. matt Post author

    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?

  5. mepj

    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?
    thank you. keep up the good work.

  6. 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.

  7. B. 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.

  8. matt Post author

    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

  9. mepj

    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?
    thank you. keep up the good work.

  10. matt Post author

    Hi mepj, thanks for the comments.
    Did 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”

  11. 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.

  12. zenny

    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

  13. Elmohem

    Hi

    I configure DISA but when i call DID I got the message “Please enter your password followed by the # key”.
    After 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

  14. matt Post author

    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.

  15. Elmohem

    Thank you Matt
    I will copy my trunk configure and removed the user name and password and ip server

    allow=g729&ilbc&ulaw&alaw
    canreinvite=no
    context=from-pstn
    disallow=yes
    fromuser=>>>>>>>>>>>
    host=194.>>>.>>>.>>>
    insecure=very
    nat=yes
    qualify=no
    secret=>>>>>>>>>>>
    type=peer
    user=>>>>>>
    username=>>>>>>>>>
    dtmfmode=rfc2833

  16. 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

  17. harif

    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…

  18. matt Post author

    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.

  19. harif

    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

  20. matt Post author

    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. zenny

    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,

  22. zenny

    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!!!

  23. John

    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?

  24. matt Post author

    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.

  25. Lee

    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
    Lee

  26. matt Post author

    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

  27. Lee

    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

  28. Allthe

    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.

  29. matt Post author

    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.

  30. Barbaros

    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/[email protected];2
    — Local/[email protected];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,
    Barbaros

  31. matt Post author

    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.

  32. Barbaros

    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.

  33. matt Post author

    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.

  34. Tanbir

    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?

  35. Nuwan

    Hi Matt

    I’m Nuwan Now I’m work at Dubai Compnay My parents and Family they stay at Sri Lanka, I called them using Skype few month before I installed Asterisk server at My Home in Sri Lanka. With 4 PSTN Line. I purchased 4 tablet pc and installed Xlite and register all tab Pc with Extention with I created in Sri Lanka Astisk server

    Tab One X lite Setting

    I can Make call to Sri Lanka Using My Tab Pc for the Sri Lankan Rates.Now I hope to give this Facility to my minor staff They Don’t have tab pc or Wifi facilty then I heard about Call Back service and Direct Inward System Access system. My requirement is Just Suppose One Of my minor worker has Nokia 1010 phone he want call sri Lanka for low rate then he can use call back service he dial Direct Inward System Access number and he enter his pin and can make call Please advice me how can setup this this with my own server or This virtual Hosting free PABX serivice. Please let me know How Can Accomplish this.

  36. matt Post author

    Hi Nuwan,

    I’ve sent a couple of replies via e-mail. Please check your spam folder to see if they’re going in there.

    Regards, Matt

Comments are closed.