# IP based

### 1. IP-based chan\_sip configuration

**Step 1**: Log in to your FreePBX admin interface. Go to connectivity>Trunks> click on the +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 the image below:

![FreePBX SIP Trunk Configuration](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDRG_w4C8d45-0DEK7%2F-LWDSr-T3P3cbWRDkOOg%2Fdfs1.png?alt=media\&token=496fbd55-0c16-4f07-953c-f63ba2bf9461)

In the same window, click on Sip Settings. Under the Outgoing tab, enter the Trunk Name as “didforsale\_1”.&#x20;

```
type=peer 
context=from-trunk
 disallow=all
 host=66.209.76.70
 allow=ulaw
 nat=yes
 canreinvite=no
 insecure=very
 dtmfmode=rfc2833
 qualify=yes
```

Once all the details are copied, click on Submit. &#x20;

<figure><img src="https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUHjv4EwOoqWXb2by8A%2Fuploads%2F0bgATZAWJaKH40P5ouSy%2Fimage.png?alt=media&#x26;token=3440086a-da6f-4acc-bea8-3e81d0915946" alt=""><figcaption></figcaption></figure>

**Step 2:** Create a second trunk for inbound with Trunk Name as “didforsale\_2” and add the trunk Parameters as shown in the image below:

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWD_67De83AncKxUzdz%2F-LWD_eH1L_d9NM7W9i7c%2Fdid_2.png?alt=media\&token=fbb2e247-d0f9-4f46-b77b-a1a5239157fa)

In PEER details, copy the following details:

```
type=peer
nat=yes
insecure=very
host=66.209.76.72
dtmfmode=rfc2833 
disallow=all 
context=from-trunk 
canreinvite=no 
allow=ulaw
```

<figure><img src="https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUHjv4EwOoqWXb2by8A%2Fuploads%2FAP8TcMZ0TEsoUR3QfwTQ%2Fimage.png?alt=media&#x26;token=e8311ee5-665f-4f94-8cfd-57703e20e8a2" alt=""><figcaption></figcaption></figure>

#### 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 image below:

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDcFgo2zvjmZISWq1U%2F-LWDcK13zvmROycv1RuF%2Fout1.png?alt=media\&token=15bae3a5-9f27-4247-9177-387eed655cd9)

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=term1.didforsale.com
nat=yes
insecure=very 
dtmfmode=rfc2833 
disallow=all 
context=from-trunk 
canreinvite=no 
allow=ulaw 
type=peer
```

<figure><img src="https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUHjv4EwOoqWXb2by8A%2Fuploads%2Fzh6PCGcsJULCRckexa1X%2Fimage.png?alt=media&#x26;token=ee6925fa-49d8-41d9-8863-115bdacef703" alt=""><figcaption></figcaption></figure>

Click on the Submit button.<br>

**Step 4**: Create a second trunk in the same way with Trunk Name as "DFS\_out\_2” with the below PEER Details:

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDdmafMBPaqCCS2aNO%2F-LWDdybnTK9mdpwEP-Kr%2Fout2.png?alt=media\&token=e9a8f430-cbb8-4134-82a7-67853f1c60f1)

```
type=peer
nat=yes 
insecure=very 
host=term2.didforsale.com
dtmfmode=rfc2833 
disallow=all 
context=from-trunk 
canreinvite=no 
allow=ulaw

```

Refer image below for better understanding:

<figure><img src="https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUHjv4EwOoqWXb2by8A%2Fuploads%2FQwT7vdSq26QiUgs8PMCt%2Fimage.png?alt=media&#x26;token=d8d97005-c9a9-44e2-9b67-27f0198c1073" alt=""><figcaption></figcaption></figure>

Click on the Submit button.

#### &#x20;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:

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDdmafMBPaqCCS2aNO%2F-LWDeY4geI-_XH5pHpvk%2FAddInboundRoute.png?alt=media\&token=75d691bd-5e1c-424b-ad4e-796cd1cf2b4a)

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDdmafMBPaqCCS2aNO%2F-LWDeRraKkWd--gsyOlb%2FInboundROute.png?alt=media\&token=9876e3c6-b0ec-4a78-854f-6794792d18b1)

Click on Submit button.<br>

#### Routing Outbound Routes

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

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDedh19CPRf1Z_9DDu%2F-LWDexJo7dZ4HoqYJmk1%2FAddoutboundROute.png?alt=media\&token=ec164832-c9ae-49fa-a19d-a53d44ba4b0d)

###

**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.

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDedh19CPRf1Z_9DDu%2F-LWDfAq6WhI2ONhrQQrI%2FoutboundRoute.png?alt=media\&token=ead04946-9a81-4a55-b09c-2ded7cc2ed1c)

**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:

![](https://4161683604-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LUHjv4EwOoqWXb2by8A%2F-LWDg1Ppgxz4LrhW3ZNV%2F-LWDgA9ihwNJygVHbe-K%2Fdialpattern.png?alt=media\&token=06888ab6-86d4-4775-b2a4-96b835556556)

Click on the Submit button. Also, press APPLY CONFIG (on the top right corner).
