IP Based
Configure FreePBX ChanSIP SIP Trunking with IP based interconnection with DIDForSale. This configuration has been tested on FreePBX Version 14.0.5.2 'VoIP Server'

1. IP based chan_sip configuration

Step 1: Login to your freepbx admin interface. Go to connectivity>Trunks> click on +Add Trunk option. Under that select ADD SIP(chan_sip) Trunk. A new window will appear. Enter the Trunk Name as “didforsale_1” and add the trunk Parameter as shown in image below:
FreePBX SIP Trunk Configuration
In the same window, click on Sip Settings. Under the Outgoing tab, enter the Trunk Name as “didforsale_1”.
type=peer
context=from-trunk
disallow=all
host=209.216.2.211
allow=ulaw
nat=yes
canreinvite=no
insecure=very
dtmfmode=rfc2833
qualify=yes
Once all the details are copied, click on Submit.
Step 2: Create a second trunk for inbound with Trunk Name as “didforsale_2” and add the trunk Parameters as shown in below image:
In PEER Details copy the following details:
type=peer
nat=yes
insecure=very
host=209.216.15.70
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw

CREATING OUTBOUND TRUNK

Step 3: Go to Connectivity >Trunks and select the option Add SIP Trunk>Select ADD SIP(chan_sip) Trunk. A new window will appear. Enter the Trunk Name as “DFS_out_1” and add the trunk Parameter as shown in below image:
In the same window, click on Sip Settings. Under the Outgoing tab, enter the Trunk Name as “DFS_out_1”. In PEER Details copy the following details:
host=209.216.2.212
nat=yes
insecure=very
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw
type=peer
Click on Submit button.
Step 4: Create a second trunk in the same way with Trunk Name as "DFS_out_2” with the below PEER Details:
type=peer
nat=yes
insecure=very
host=209.216.15.71
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=ulaw
Refer image below for better understanding:
Click on Submit button.

ROUTING INBOUND DID

Step 5: For routing your inbound calls coming on your DID number, click on inbound routes and configure the DID with prefix 1. Toll free numbers needs to be configured without 1. Say your DID is 949 885 9944 then you will configure the DID with 19498859944 in the inbound routes. Delete existing routes for the DID and then reconfigure from scratch. Here is the image for inbound setups:
Click on Submit button.

Routing Outbound Routes

Step 6: For routing your outbound calls. Go to connectivity>Outbound Routes. Click on Add Outbound Route button (as shown below).

STEP 7: You should be viewing the Route Setting tab. Under that, give the Route Name. Select which trunks this outbound route will use, and in what order. Choose the trunk(s) which you have created ,DFS_out_1 and DFS_out_2 from the drop-down menus next to Trunk Sequence for Matched Routes.
STEP 8: Click the Dial Patterns tab. Click Dial patterns wizards. In preprend enter “1” and for match pattern enter “NXXNXXXXXX”. For better understanding refer the following image:
Click on Submit button. Also press APPLY CONFIG (on the top right corner).