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
tcpdump -i venet0 -n -s 0 port 5060 -vvv | grep -B1 "INVITE sip"
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
INVITE sip:441604283321@call.sysadminman.net SIP/2.0
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