trunking as a SIP client on asterisk via freepbx

Some of you may purchase a SIP service thus having a SIP extension given to you by your SIP provider. This is not the same as a SIP trunk where an “agreement” is made between two SIP servers. This is a typical SIP client which you configure on a softphone or a hardphone. If you wish to make Asterisk become the “client” in receiving and making calls from this account you can easily do that with FreePBX and this guide would help you do so. Firstly, you need the SIP provider account with a minimum user, pass and IP/name of the SIP provider, like what we in Astiostech provide called Astervox. This account will be used to make and receive calls via an Asterisk and will be then forwarded to an Internal SIP extension. From this extension, you can shoot it out to a queue or whatever you wish to do with it. Diagram. image Let’s say the Astervox (SIP provider) gives us an account like this: Ext/User: 4000
Pass: 4000abc

Here’s how to get it working with FreePBX/Asterisk 1) Go to FreePBX, General settings and enable Inbound SIP calls
image 2) Create a new SIP trunk, call it anything you wish, go to the Outgoing Settings (thus becoming the outbound trunk)
host=<yoursipproviderIPorName> [When using name, ensure you can resolve]
username=4000 [the sip account username]
secret=4000abc [the sip account password]
fromuser=4000 [this is your Asterisk IP or name or Dyndns]
nat=yes 3) For the Inbound (incoming call) part, go to Register String, enter the authentication info again like below and the extension where you wish to shoot the call to. image [See below for full text] 4000:4000abc:[email protected]/1001 /1001 is the internal extension that will be dialed when this SIP client 4000 is called (SIP bridging) on the SIP provider. Note, 1001 could also be an Inbound route because 1001 is treated as a DID therefore with an inbound route, you can do more routing and stuff, with it. 4) Save and apply configuration in FreePBX 5) Define Outbound Routes so that you can dial via this Trunk 6) Define Inbound Routes if you like to shoot different CID to different places. To check if the links/registrations are up, at the command prompt, run: # asterisk –rx “sip show registry”  [for our inbound – you should see state=registered to your SIP provider] # asterisk –rx “sip show peers” [for our outbound – you should see status=OK] Remember! If you are behind a NAT, you must NAT to your Internal Asterisk box UDP/5060 and UDP/10000 to 20000. Otherwise you may get one way audio issues. If required outbound rules also may need to be set and as a minimal the UDP/5060 and the RTP part you should get from your provider, normally with Asterisk its UDP 10000 to 20000. Done.