35 thoughts on “Getting started with FreePBX – Part 4 Setting up a DID number

  1. elmohem

    I did what in this tutorial but my extension ringing and when answer the call is disconnect directly.
    How to solve this problem?
    Elmohem

  2. matt Post author

    It could be that the voice stream is being blocked by a firewall (UDP port 5060) or that NAT is messing things up. Do you know if your Asterisk server or Extension is behind a NAT router?

  3. Av

    I did what in this tutorial but my extension is not ringing, I couldn`t hear no sound. Please help me out here.
    Thanks

  4. matt Post author

    I’m afraid it’s difficult to say without any more info. Are you using a ditro or did you install Asterisk/FreePBX yourself? Could it be iptables/firewall blocking the traffic? Can you make extension to extension calls?

  5. Av

    Hi Matt,
    Thanks for the quick reply, Now I made it work. not with ipkall, but the same number which I used in Trunk. So now I am using same number for Inbound and Outbound Call for callback. when I dial the DID number, it says “the person is busy, leave message“, when I hung up then I am getting my call back but I wanted to hear busy tone instead so I wont get charge. Is there any way to hear busy tone instead message. Sorry for my bad english 🙂

    Thanks again

  6. matt Post author

    do you have voicemail turned on for the extension the calls are going to?, and how are you doing the callback? with the FreePBX callback module?

  7. dinesh

    I am using ipkall number in inbound and i want use it in call back system but when i call from my cell number to this it does not call back me and when i use this number to forward on extension i see the incoming number different. It does not show my cell number in incoming number. How it will show the exact incoming number? Thanks for your support in advance

  8. matt Post author

    The format that the caller ID is presented varies between different providers. Sometimes you need to check in the logs to see the format it is coming as. You could accept all calls initially and then check the CDR to see the format.

    You may need to manipulate the number on the outound route to get the outbound call back to work.

  9. michaël

    hi matt
    i followed your tutorial it ‘is very great but im facing some issues here.
    here is what i get when the call comes to the asterisk:

    [Mar 13 08:22:16] NOTICE[1954]: chan_sip.c:22622 handle_request_invite: Call from ‘sagbohan’ (217.9.36.145:5060) to extension ‘s’ rejected because extension not found in context ‘from-trunk’.

    here is my trunk config:
    username=username
    type=friend
    secret=secret
    insecure=very
    host=iptel.org
    dtmfmode=rfc2833
    context=from-trunk

    thanks for the help

  10. michaël

    Dear matt thank you Very much for replying.

    how can i get the provider to send the call to a specific URI. i do have an URI from the provider.

    – still with the same configuration i tried to place outbound calls and got a message saying that the call was rejected because the called extension has not been found in context from-internal

  11. Michaël

    Hi matt i also forgot to tell you that i followed the steps for the configuration of a2billing so the DID is sent to a custom context a2billing.

  12. Moiz

    Hello,..

    I just new in this field……….
    I want to assign DID number to my SIP account so, I can receive call from any PSTN phone….. Now let me Clarify something to you all guys so you can understand my problem.

    1. My basic OS is Window 7….. I have installed VMware Player on it…… and I have Installed Elastix Distro 2.0.3 on VMware Player built in with FreePBX…..

    2. On VMware setting my Network Adapter is “Bridge: Connected directly to physical network.”
    3. While Installing Elastix Distro, in Network Configuration part I choose “A. Activate on Boot, B. Enable Ipv4 Support.
    4. In IPv4 Configuration part i choose “Manual Address Configuration”. So my Ip Address is 192.168.1.11 and NetMask is 255.255.255.0, my Gateway is 192.168.1.1, Primary DNS is 8.8.8.8 and Secondary DNS 8.8.4.4
    5. I Host Name Configuration i choose Manually Option: Host Name = Elastix
    (My windows Network Configuration is also same as above, only IP address is different….
    Now after complete installation I can access my WEB GUI from windows Browsers.

    In PBX I created two Extensions (1000, 1002) as Directed by you in Part Two….
    When i try to Put Secret, My eyebeam or Xlite are unable to register… but when I keep secret blank I can register my both softphone……

    I have also Setup DID number for my SIP Extension….. I just follow your Given above steps….. And at the end I tried to call that number its completly blank for some time…
    Here is my IPKall setting

    SIP URI: 2532421069 (DID Number of IPKall) @ 192.168.1.11:5060
    Email Add: My Mail Address
    Password: My Password
    Time to ring before hanging up: 120 seconds

    Problems: I cannot register my softphone when i input Secret in SIP Extension
    I cannot call my SIP number with given DID No. from IPKall.

    Please Help Me…..

    Thanks in advance…

    Regards
    Moiz Bharmal

  13. matt Post author

    Unfortunately this is not going to work – 2532421069 @ 192.168.1.11:5060 – because 192.168.1.11 is a PRIVATE IP address. Nothing on the internet can talk directly to it. You need your PUBLIC IP address in there. Even then though you’re going to have problems because of your firewall and NAT that is happening.

    See here for some more information about Asterisk and NAT – http://www.voip-info.org/wiki/view/Asterisk+SIP+NAT+solutions

  14. Moiz

    I am really sorry to border again
    In this case right now I have change my Private IP to Public IP in IPKall Settings…….. and also turned of my windows firewall…
    But still problems continue
    Can you just explain me in Simple Language what settings I need to do to avoid all this things……

    Sorry to border you once again…

    Thanks

    Regards
    Moiz Bharmal

  15. matt Post author

    Unfortunately it’s not a simple problem to solve when you are running Asterisk at home. You are going to have to do port forwarding on you broadband firewall there, to get the incoming traffic from IPKall to your Asterisk server.

  16. Moiz

    Matt:

    I am realy very thank full to you to providing me this guide and giving me a hint for port forwarding on broadband firewall…………
    By forwarding the port in firewall i can receive the call from my PSTN line by dialing IPKall number… Thanks Once again….

    But there is one issue about secret… which i said earlier i cannot register my xlite soft-phone when i input secret in my extension setting…. but when i don’t put secret or keep it blank, my Soft-phone can register easily….. which is not safe anyway…..

    can you give me an idea for this matter

    Regards
    Moiz Bharmal.

  17. Moiz

    And how can I show Incoming No. in my sofphone like If I am calling from my cell phone or land line.. what setting I need to do…
    Thanks in advance
    And Yes once again Thank you for giving me a hint for port forwarding in my firewall NAT setting….

    Regards
    Moiz Bharmal

  18. matt Post author

    Glad you got the call working.

    Not really sure about the extension registration. It definitely sounds like you do not have a secrect configured on the extension in FreePBX?

  19. matt Post author

    This will depend on what caller ID IPKall are passing to you. Some providers do not pass the caller ID.

  20. Daniel Mann

    Hi Matt,

    Thanks for the article – still relevant after more than 3 years!

    I’ve followed your instructions above, but ran into one odd issue. When I create an inbound route to match the IPKall DID (253XXXXXXX – partially masked for anonymity), the call does not ring through to the destination (extension, queue, etc.).

    However, when I remove the DID match (i.e., match any inbound call), the call rings through to the specified destination and everything seems to work fine.

    When configured like this, asterisk warns me about using a catch-all match:

    — Executing [[email protected]:1] NoOp(“SIP/66.54.140.46-00000041”, “Catch-All DID Match – Found 253XXXXXXX – You probably want a DID for this.”) in new stack

    …but does connect the call.

    Here’s what happens when I specify the DID in the inbound route:

    — Executing [[email protected]:1] NoOp(“SIP/66.54.140.46-00000040”, “Received incoming SIP connection from unknown peer to 253XXXXXXX”) in new stack
    — Executing [[email protected]:2] Set(“SIP/66.54.140.46-00000040”, “DID=253XXXXXXX”) in new stack
    — Executing [[email protected]:3] Goto(“SIP/66.54.140.46-00000040”, “s,1”) in new stack
    — Goto (from-sip-external,s,1)
    — Executing [[email protected]:1] GotoIf(“SIP/66.54.140.46-00000040”, “1?checklang:noanonymous”) in new stack
    — Goto (from-sip-external,s,2)
    — Executing [[email protected]:2] GotoIf(“SIP/66.54.140.46-00000040”, “0?setlanguage:from-trunk,253XXXXXXX,1”) in new stack
    — Goto (from-trunk,253XXXXXXX,1)
    — Executing [[email protected]:1] Set(“SIP/66.54.140.46-00000040”, “__FROM_DID=253XXXXXXX”) in new stack
    — Executing [[email protected]:2] NoOp(“SIP/66.54.140.46-00000040”, “Received an unknown call with DID set to 253XXXXXXX”) in new stack
    — Executing [[email protected]:3] Goto(“SIP/66.54.140.46-00000040”, “s,a2”) in new stack
    — Goto (from-trunk,s,2)
    — Executing [[email protected]:2] Answer(“SIP/66.54.140.46-00000040”, “”) in new stack
    — Executing [[email protected]:3] Wait(“SIP/66.54.140.46-00000040”, “2”) in new stack
    — Executing [[email protected]:4] Playback(“SIP/66.54.140.46-00000040”, “ss-noservice”) in new stack
    — Playing ‘ss-noservice.gsm’ (language ‘en’)

    My distro is PBX in a Flash 2.0.6.2 with FreePBX 2.10. Other inbound routes with a DID specified work just fine. Let me know if you need any information I have not provided here.

    Any ideas or suggestions?

    Thank you,

    Daniel Mann

  21. Daniel Mann

    Hi Matt,

    Thanks for the response. I followed your instructions and got the following from tcpdump:

    66.54.140.46.sip > 1.2.3.4.sip: [udp sum ok] SIP, length: 900
    INVITE sip:[email protected] SIP/2.0

    (Again, my IP address, IPKall number, and hostname are obfuscated for anonymity.)

    The number in the SIP invite – 253XXXXXXX – exactly matches the number I’m using on the inbound route. I even copied the DID from the tcpdump output and pasted into the DID field on the inbound route.

    No luck yet. As before, with the DID in that field, asterisk plays the no service message on inbound calls. When I remove the DID from that field, thus matching all inbound calls, the call rings through to the destination (my extension, for testing).

    Other ideas? Would a complete log dump be helpful to you?

    Thanks,

    Daniel Mann

  22. Daniel Mann

    Update: I tried a variation, and it works!

    Not sure what made my try this, but I decided to add some Alpha characters to the SIP URI used by IPKall. So, I just prepended ‘IPKall’ to the number, making the new target ‘IPKall253XXXXXXX’. (Again, number partly masked.)

    Then I set the DID field on my inbound route to match (‘IPKall253XXXXXXX’) and tried another test call. Success! The call rang through to the destination (my extension).

    I don’t know if this behavior is the result of a bug, or some other configuration on my system (though it is fairly stock), but I’m happy that it is working. Maybe this info will help someone else who finds their way here.

    Thanks again for posting such great material. You have some very useful resources here.

    Daniel Mann

  23. matt Post author

    Hi Daniel,

    Thanks for the feedback, good to know it’s working! It’s not something I’ve seen before though. There shoudln’t be any need to have alpha characters in there. The only other thing that should be needed is either “Allow Anonymous SIP” set to “Yes” on the general settings page of FreePBX (not a good idea as far as security!) or a SIP trunk creating for each IP that the call could come from.

    However, if the call was working with no DID entered in the Inbound Route it would seem that the call was allowed to the server.

    Still, good news it’s OK 🙂

  24. Daniel Mann

    No idea why the alpha characters made a difference here. The call was reaching my server just fine, but for some reason the DID match on the inbound route failed to recognize the call with all numbers in the DID. For some still unknown reason adding the alpha characters caused the match to work, and got the route working as desired.

    I did allow anonymous SIP for a few minutes while testing the new IPKall service; however, the firewall was configured to permit only IPKall’s SIP server to connect. As soon as I got calls working I disabled anonymous SIP and created a trunk as per your instructions on the above-linked page. Now it’s working great.

    Daniel Mann

  25. Ahmed

    Hi Matt,

    Was following your tutorial and got most of it to work. I am using Elastix and trying to configure on that. I have made the setting via both the Unembedded version and the on screen GUI for elastix.

    Now, this is what needs to be done, i have added my Free SIP id using GetOnSIP.com and forwarded my number to that SIP account. (works like a charm on a normal SoftPhone).

    I need to make those calls land on the freePBX and THEN fwd to the softphone.

    The SIP settings that i got form GET ON SIP are as follows:
    Your SIP account credentials are:
    Username: aXXXXXXi
    Authentication Username: getonsip_aXXXXXXXi
    SIP address: [email protected]
    SIP Password: secret/password
    Domain: getonsip.com
    Outbound Proxy: sip.onsip.com

    now where do i put this info?

    Thanks

  26. matt Post author

    You would create a SIP trunk with the information they having given you to tell Asterisk the getonsip system.

  27. Ahmed

    Hey Matt,

    Got it to work and for people out there, who need help with GetOnSip:

    disallow=all
    allow=g722&g729&ulaw
    context=from-trunk
    dtmfmode=auto
    fromdomain=getonsip.com
    fromuser=aXXXXXXXi
    host=getonsip.com
    insecure=very
    qualify=yes
    secret=XXXXXXXXXXXXXXXX
    type=peer
    username=aXXXXXXi
    authname=getonsip_aXXXXXXXXi
    canreinvite=no

    Register String:
    aXXXXXXi:secret:[email protected]/getonsip_aXXXXXXXXi

    WORKS ON THE FIRST GO
    Courtesy: http://www.vpnbest.com/voip/vsp/98-sip-address-for-your-businese

    NOW, i got all teh things set up, extensions, IVR etc and when i call my DID number, the call is picked up but i don’t hear the IVR and drops in 3 seconds.

    This is what is see in my reports for the calls:

    Calldate
    Channel
    Source
    Clid
    Dst
    Disposition
    Duration

    1. 2013-02-26 14:24:33 SIP/IPKall… 0000000000 “unknown” s ANSWERED 00:03
    2. 2013-02-26 14:17:00 SIP/IPKall… 4098226712 “unknown” s ANSWERED 00:03
    3. 2013-02-26 14:15:27 SIP/1000-0… 1000 “Ahmed Omar” *99 ANSWERED 00:08
    4. 2013-02-26 14:08:56 SIP/IPKall… 4098226712 “unknown” s ANSWERED 00:03
    5. 2013-02-26 14:08:11 SIP/IPKall… 1923312609494 “1923312609494” s ANSWERED 00:03

    So as you can see *99 is the call recording i am listenign to and rest are incoming calls frm my cellphione that get dropped… any help?

    Thanks

  28. Monir

    Hi Matt,

    I complete all steps. Now when I am trying to call the ipKall DID, I am getting a busy tone. Any idea ? I have checked my firewall and SIP traffic is allowed. How can I check asterisk log to see if the call even hit the asterisk server ?

    Thank You

Comments are closed.