Asterisk configuration is frequently confusing in addition to frustrating. The FreePBX GUI simplifies the many tiresome configuration tasks inwards Asterisk. The next guide volition walk through the steps to laid upwards a SIP body using FreePBX.
Prerequisites
- A surgery Asterisk server alongside FreePBX.
- SIP body information from a SIP provider. We'll hold out using Broadvoice.
Setup the SIP Trunk
Open upwards a spider web browser in addition to acquire to your Asterisk server spider web interface:
http://[Server Name or IP]/admin/Login every bit "admin" or "maint" (depending on your system).
Now, on the left, nether Basic click Trunks, you lot should come across a alternative of body types, similar this:
Add a TrunkAdd SIP Trunk
Add DAHDi Trunk
Add Zap Trunk (DAHDi compatibility mode)
Add IAX2 Trunk
Click Add SIP Trunk. We are at nowadays presented alongside a page that nosotros must fill upwards inwards alongside our body info.
General Settings
In the Outbound Caller ID field, you lot tin give the sack acquire into a caller ID, but it may non create anything. So, we'll skip this field. We'll too acquire out the Never Override CallerID unchecked.
For the Maximum Channels field, we'll pose inwards 1. This is because the excogitation nosotros are using inwards this guide solely allows 1 incoming telephone telephone at a time.
Leave the Disable Trunk in addition to Monitor Trunk Failures at their defaults.
Dialed Number Manipulation Rules (Outgoing Dial Rules)
Dial rules are powerful, yet quite uncomplicated to learn. These rules tin give the sack manipulate the dialed break earlier sending it out this trunk. If no dominion applies, the break is non changed. The master copy dialed break is passed downward from the route where to a greater extent than or less manipulation may convey already occurred. This body has the alternative to farther manipulate the number.
Dial rules follow the next basic format:
("prepend") + "prefix" | "match pattern"
If the break matches the combined values inwards the prefix addition the match pattern boxes, the dominion volition hold out applied in addition to all subsequent rules ignored. Upon a match, the prefix, if defined, volition hold out stripped. Next the prepend volition hold out inserted inwards front end of the match pattern in addition to the resulting break volition hold out sent to the trunk. All fields are optional.
Rules:
- X matches whatsoever digit from 0-9
- Z matches whatsoever digit from 1-9
- N matches whatsoever digit from 2-9
- [1237-9] matches whatsoever digit inwards the brackets (example: 1,2,3,7,8,9)
- . wildcard, matches i or to a greater extent than dialed digits
- + Adds a break onto the dialed digits.
- | Subtracts a break from the dialed digits.
- prepend: Digits to prepend upon a successful match. If the dialed break matches the patterns inwards the prefix in addition to match pattern boxes, this volition hold out prepended earlier sending to the trunk.
- prefix: Prefix to withdraw upon a successful match. If the dialed break matches this addition the match pattern box, this prefix is removed earlier adding the optional prepend box in addition to sending the results to the trunk.
- match pattern: The dialed break volition hold out compared against the prefix addition this pattern. Upon a match, this part of the break volition hold out sent to the trunks afterwards removing the prefix in addition to appending the prepend digits. You tin give the sack completely supervene upon a break yesteryear matching on the prefix only, replacing it alongside a prepend in addition to leaving the match pattern blank.
In the next examples, we'll usage dialing rules to modify numbers for U.S.A. 10-digit dialing.
1+NXXNXXXXXX 1416+NXXXXXX 9|.
Let's attempt what these mean:
We'll laid about alongside the kickoff one. (1+NXXNXXXXXX)
1+ agency prepends "1" to the number.
N agency jibe whatsoever break betwixt two in addition to 9.
X agency jibe whatsoever break betwixt 0 in addition to 9.
This would jibe a break like, tell 416-515-1234 in addition to plow it into 1-416-555-1234 earlier sending it to the SIP servers.
So, the side yesteryear side i (1416+NXXXXXX) goes similar this:
1416+ prepends "1416" to the number.
N matches whatsoever break betwixt two in addition to 9.
X matches whatsoever break betwixt 0 in addition to 9.
So in addition to thence this i would jibe a break like, 555-1234 in addition to plow it into 1-416-555-1234 earlier sending it to the SIP servers.
In the 3rd representative (9|.)
9| prefix or withdraw "9" from the number. This is commonly added to route calls to a trunk. So the user would dial "9" to dial-out from this trunk.
. The catamenia or point "." is a wildcard that matches i or to a greater extent than digits thence this volition allow whatsoever type of telephone telephone to usage this trunk.
So in addition to thence this i would jibe whatsoever break alongside a prefix 9, strip the nine from the break in addition to mail the residue of the break to the SIP servers.
The Outbound Dial Prefix plain prefixes a break to all numbers dialed through this trunk. For nigh cases including this example, nosotros volition acquire out it blank. However, if this is a body to to a greater extent than or less other Asterisk server or a Centrex line, you lot many demand to pose "9" inwards this box to access an exterior line.
Outgoing Settings
Under Outgoing Settings, nosotros come across the plain Trunk Name. We'll pose "Broadvoice" inwards this box.Now, hither comes i of the nigh complicated parts of setting upwards a SIP trunk, the PEER Details. These settings rate Asterisk how to connect to the SIP provider.
Here is a listing of the nigh mutual settings alongside descriptions of each one:
disallow=all
- This should always come upwards earlier whatsoever allow directives
allow=ulaw
- This allows usage of the G.711 u-law codec. Most SIP providers back upwards this codec.
context=from-trunk
- This is the context that Asterisk volition dump calls coming from the body into this dialplan context. Without this laid to a proper context, incoming calls will non work.
dtmfmode=auto
- This tells Asterisk how to interpert DTMF tones. It tin give the sack hold out auto (auto-negotiates what way to usage - recommended), inband (sends DTMF every bit sounds inwards the well stream), rfc2833 (recommended if your SIP provider supports it), or information (DTMF information is sent within the SIP header)
fromdomain=sip.broadvoice.com
- This tells the SIP provider what domain the telephone telephone comes from. Some SIP providers require this for authentication.
fromuser=<Username>
- This is the username to authenticate to the SIP provider with.
host=sip.broadvoice.com
- This is the host to connect alongside to mail calls
insecure=very
- This determines if Asterisk should authenticate calls coming in. Your SIP provider should rate what to laid this to. Common settings are "invite", "invite,port", or "very".
qualify=yes
- This tells Asterisk whether or non to mail SIP NOTIFY messages to the peer to banking concern check if it's even thence avalible the latency betwixt it in addition to Asterisk.
secret=<Password>
- This is the password to authenticate to the SIP provider
type=peer
- This sets the type to peer. This is required.
username=<Username>
- This is the username to connect to the SIP provider with.
authname<Username>
- This is the authentication username to connect to the SIP provider with. This isn't commonly required, but to a greater extent than or less providers similar Broadvoice require it to register.
canreinvite=no
- This tells Asterisk if it should endeavor to laid upwards a telephone telephone betwixt the SIP provider in addition to the finish telephone directly. This is typicly laid to no. If you're behind a NAT, this should hold out laid to "no".
Incoming Settings
We create non demand anything nether Incoming Settings, thence only acquire out it blank.
Registration
One of the nigh of import settings inwards a SIP trunk, is the register string. You volition respect the plain nether Registration.
Some SIP providers usage a slightly dissimilar register string format than others. The formats acquire every bit below:
<Username>@<SIP proxy>:<Password>:<AuthID>@<SIP proxy>/<DID>
Which translates into:
<Phone number>@<SIP proxy>:<Password>:<Phone number>@<SIP proxy>/<DID>
While others usage this format:
<Username>:<Password>@<SIP proxy>/<DID>
Which translates into:
<Phone number>:<Password>@<SIP proxy>/<DID>
The /<DID> is of import because it tells Asterisk how to route incoming calls from this trunk. It is a expert sentiment to laid it to your telephone number/username.
So, for this guide, we'll usage a register string similar this:
4165555555@sip.broadvoice.com:ATenCharPw:4165555555@sip.broadvoice.com/4165555555
Finally nosotros tin give the sack click the Submit Changes button.
Now nosotros tin give the sack motion on to setting upwards the inbound route.