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




Related posts:

  1. Using DISA with FreePBX and A2Billing
  2. Integrating FreePBX with A2Billing
  3. Using a callwithus DID with FreePBX/Asterisk


25 Comments

  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:

    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:

    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:

    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:

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

    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.

  14. matt:

    Hi Zenny. Many thanks for sharing!! Matt.

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

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

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

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

  19. 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…

  20. matt:

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

  22. matt:

    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

  23. Av:

    Thanks alot, it help me. you ar ethe best :)

  24. 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,

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

Leave a comment