Search This Blog

Wednesday, May 28, 2014

FreePBX: Inbound number not working help

Setting up an Inbound (DID/DDI) number in FreePBX can be tricky. We have to do 2 things to get it to work. First we need to tell FreePBX/Asterisk that the incoming call is allowed, the second is to say what to do with that incoming call.
Lets look at allowing the call first. One of the easiest ways to do this is allow Anonymous SIP Calls in FreePBX. I recommend you do not do this though as you don’t really want Asterisk/FreePBX trying to process any call fired at it.
So if we’re not going to allow anonymous SIP calls we need to tell Asterisk what IPs to allow calls from, and we do this by setting up a trunk. When a call comes to our server we will receive a SIP INVITE from the remote server, asking us to accept the call, so let’s have a look at the SIP INVITE messages coming in …


First we’ll install ‘tcpdump’ if it’s not already on the system. In CentOS we do -
yum -y install tcpdump
Next we run the following command to list all the INVITE messages coming in. You will need to change the network adapter name if you’re not on a VPS, probably from venet0 to eth0 -
tcpdump -i venet0 -n -s 0 port 5060 -vvv | grep -B1 "INVITE sip"
Now if we ring the number we should see the SIP INVITE message coming in. If you don’t then you should double check that the call provider is definitely passing the call to your server.
Here’s mine -
08:05:37.332640 IP (tos 0x0, ttl  57, id 56110, offset 0, flags [none], proto: UDP (17), length: 947) 84.218.247.34.sip > 92.152.251.121.sip: [udp sum ok] SIP, length: 919
INVITE sip:441604283321@call.sysadminman.net SIP/2.0
The above tells us that the call came from 84.218.247.34 (the call provider) to 92.152.251.121 (my Asterisk server) and the destination telephone number is 441604283321
That should be all the information we need. Now lets set up the trunk. We’re going to add a SIP trunk with the following details -

Those are the minimum details we need. Basically it just tells Asterisk to allow calls from that host IP address.
Now we create the Inbound Route to tell FreePBX where to send the call. The important part here is to make sure you enter the “DID Number” in the format it appears in the SIP INVITE message above -

One other thing I do when testing an inbound call for the first time is set the destination to “Terminate Call/Put caller on hold forever”. That way you should get music when calling the number (if you set the destination to an extension and it doesn’t work it may be that the extension is not working!)

Last updated by .

No comments:

Post a Comment