The default behavior of FreePBX, starting at version 12, is to use chan_pjsip for endpoints and trunks.  Sections of this article will cover installations of FreePBX configured with either chan_pjsip or chan_sip. Selection of either chan_pjsip or can_sip from within your distribution can be found in the Admin Web tool under Settings -> Advanced Settings -> Dialplan and Operational -> SIP Channel Driver.  The Admin Web tool may be viewed by visiting: http://[ip of your freepbx]/admin

To configure FreePBX to work with Digium's SIP Trunking service, you should make configuration changes in 3 areas:

Each of these is configured using the Admin Web tool provided by FreePBX.
For more information about the configuration of FreePBX, please see the FreePBX wiki.

Trunks, chan_pjsip

First, you need to create a FreePBX Trunk for your Digium SIP Trunking account.
On the Connectivity -> Trunks page, select Add SIP (chan_pjsip) Trunk
To configure a Digium SIP Trunking account, make modifications to the following options:

  1. General Settings

  2. Dialed Number Manipulation Rules (This entire section can be left at defaults)

  3. PJSIP Settings

Note 1: G729 should typically only be allowed if you've installed Digium's G.729 Add-on for Asterisk. G.729 is a licensed algorithm that cannot be distributed or used freely without this add-on.G.729 should be used on
Note 2: Session timers is not supported by our servers, you will need to disable this feature by setting timer=no  your PJSIP channel driver configuration. 
 

Once the Trunk has been configured with these settings, click the Submit Changes button at the bottom of the screen and then, when it displays at the top of the screen, the red Apply Changes button.

Trunks, chan_sip

If you are not using chan_pjsip, you may instead create a FreePBX Trunk using chan_sip.
On the Connectivity -> Trunks page, select Add SIP (chan_sip) Trunk

To configure a Digium SIP Trunking account, make modifications to the following options:

  1. General Settings

  2. Outgoing Settings

type=peer
directmedia=no
host=sip.digiumcloud.net
defaultuser=your_digium_username
fromuser=your_digium_username
secret=your_digium_password
insecure=invite
trustrpid=yes
sendrpid=pai
disallow=all
allow=g722
allow=ulaw
allow=g729
session-timers=refuse

G729 should typically only be allowed if you've installed Digium's G.729 Add-on for Asterisk. G.729 is a licensed algorithm that cannot be distributed or used freely without this add-on.G.729 should be used on

  1. Incoming Settings (USER Details: blank out this section)

  2. Registration

Register String: your_digum_username:your_digium_password@sip.digiumcloud.net:5060/your_digium_username
 

Once the Trunk has been configured with these settings, click the Submit Changes button at the bottom of the screen and then, when it displays at the top of the screen, the red Apply Changes button.

Inbound Routes

Once a Trunk has been created, you should next create an Inbound Route in order to handle calls coming from Digium's SIP Trunking service to your FreePBX system.  
To make these configuration changes, visit the Connectivity -> Inbound Routes page.
To configure a Digium SIP Trunking account, make modifications to the following options:

Add Incoming Route

Once the Inbound Route has been configured with these settings, click the Submit Changes button at the bottom of the screen and then, when it displays at the top of the screen, the red Apply Changes button.

Outbound Routes

Once an Inbound Route has been created, you should next create an Outbound Route in order to send calls from internal extensions out to Digium's SIP Trunking service.  
To make these configuration changes, visit the Connectivity -> Outbound Routes page.
To configure a Digium SIP Trunking account, make modifications to the following options:

Once the Inbound Route has been configured with these settings, click the Submit Changes button at the bottom of the screen and then, when it displays at the top of the screen, the red Apply Changes button.