Open Source - How to configure a Digium SIP Trunking account with AsteriskNOW and FreePBX
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:
Connectivity -> Trunks
Connectivity -> Inbound Routes
Connectivity -> Outbound Routes
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:
General Settings
Trunk Name: digium-siptrunk
Outbound CallerID: your_digium_number, e.g. 2565551234
CID Options: Force Trunk CID
Dialed Number Manipulation Rules (This entire section can be left at defaults)
PJSIP Settings
Configuration Mode: Advanced
Username: your_digium_username
Secret: your_digium_password
SIP Server: sip.digiumcloud.net
SIP Server Port: 5060
Client URI: sip:your_digium_username@sip.digiumcloud.net
Server URI: sip:sip.digiumcloud.net
AOR Contact: sip:sip.digiumcloud.net:5060
Contact User: your_digium_username
Codecs: Select g722, ulaw, g729
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:
General Settings
Trunk Name: digium-siptrunk
Outbound CallerID: your_digium_number, e.g. 2565551234
CID Options: Force Trunk CID
Dialed Number Manipulation Rules (This entire section can be left at defaults)
Outgoing Settings
Trunk Name: digium-siptrunk
PEER Details:
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
Incoming Settings (USER Details: blank out this section)
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
Description: calls-from-your_digium_number
DID Number: your_digium_number, e.g. 2565551234
Options (This entire section can be left at defaults)
Privacy (This entire section can be left at defaults)
Call Recording (This entire section can be left at defaults)
CID Lookup Source (This entire section can be left at defaults)
Fax Detect (This entire section can be left at defaults)
Language (This entire section can be left at defaults)
Superfecta CID Lookup (This entire section can be left at defaults)
Set Destination: Choose an IVR or Extension or any other destination to which you want to send Inbound Calls on this Digium SIP Trunk
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:
Outbound Route (Route Name: digium-outbound)
Additional Settings (This entire section can be left blank)
Dial Patterns that will use this Route
Leave Prepend and Prefix blank and add match patterns for:
International Dialing: 011. (Don't forget the trailing period in this pattern)
10-digit dialing: NXXNXXXXXX
1+ 10-digit dialing: 1NXXNXXXXXX
Trunk Sequence for Matched Routes
0: digium-siptrunk
Optional Destination on Congestion (This entire section can be left blank)
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.