Asterisk configuration is often confusing and frustrating. The FreePBX GUI simplifies the many tedious configuration tasks in Asterisk. The following guide will walk through the steps to set up a SIP trunk using FreePBX.
In Twilio’s documentation for setting up SIP connections, they mention sending SIP Options messages from my PBX to the Twilio SIP Trunk. Here is what is says: Optionally set-up your Communications Infrastructure to issue SIP OPTIONS messages as a ping mechanism to your Elastic SIP Trunk (Send the Message Request To: Termination URI you created ( example.pstn.twilio.com)); the Twilio platform.
Prerequisites
Setup the SIP Trunk
Open up a web browser and go to your Asterisk server web interface:Login as 'admin' or 'maint' (depending on your system).
Now, on the left, under Basic click Trunks, you should see a selection of trunk types, like this:
Add a Trunk
Add SIP Trunk
Add DAHDi Trunk
Add Zap Trunk (DAHDi compatibility mode)
Add IAX2 Trunk
Click Add SIP Trunk. We are now presented with a page that we must fill in with our trunk info.
General Settings
In the Outbound Caller ID field, you can enter a caller ID, but it may not do anything. So, we'll skip this field. We'll also leave the Never Override CallerID unchecked.
For the Maximum Channels field, we'll put in 1. This is because the plan we are using in this guide only allows 1 incoming call at a time.
Leave the Disable Trunk and Monitor Trunk Failures at their defaults.
Dialed Number Manipulation Rules (Outgoing Dial Rules)
Dial rules are powerful, yet quite simple to learn. These rules can manipulate the dialed number before sending it out this trunk. If no rule applies, the number is not changed. The original dialed number is passed down from the route where some manipulation may have already occurred. This trunk has the option to further manipulate the number.
Dial rules follow the following basic format:
If the number matches the combined values in the prefix plus the match pattern boxes, the rule will be applied and all subsequent rules ignored. Upon a match, the prefix, if defined, will be stripped. Next the prepend will be inserted in front of the match pattern and the resulting number will be sent to the trunk. All fields are optional.
Rules:
In the following examples, we'll use dialing rules to modify numbers for US 10-digit dialing.
Let's examine what these mean:
We'll start with the first one. (1+NXXNXXXXXX) 1+ means prepends '1' to the number. N means match any number between 2 and 9. X means match any number between 0 and 9. This would match a number like, say 416-515-1234 and turn it into 1-416-555-1234 before sending it to the SIP servers. So, the next one (1416+NXXXXXX) goes like this: 1416+ prepends '1416' to the number. N matches any number between 2 and 9. X matches any number between 0 and 9. So then this one would match a number like, 555-1234 and turn it into 1-416-555-1234 before sending it to the SIP servers. In the third example (9|.) 9| prefix or remove '9' from the number. This is normally added to route calls to a trunk. So the user would dial '9' to dial-out from this trunk. . The period or dot '.' is a wildcard that matches one or more digits so this will allow any type of call to use this trunk. So then this one would match any number with a prefix 9, strip the 9 from the number and send the rest of the number to the SIP servers.
The Outbound Dial Prefix field prefixes a number to all numbers dialed through this trunk. For most cases including this example, we will leave it blank. However, if this is a trunk to another Asterisk server or a Centrex line, you many need to put '9' in this box to access an outside line.
Outgoing SettingsUnder Outgoing Settings, we see the field Trunk Name. We'll put 'Broadvoice' in this box.
Now, here comes one of the most complicated parts of setting up a SIP trunk, the PEER Details. These settings tell Asterisk how to connect to the SIP provider.
Here is a list of the most common settings with descriptions of each one:
Incoming Settings
We do not need anything under Incoming Settings, so just leave it blank.
Registration
One of the most important settings in a SIP trunk, is the register string. You will find the field under Registration. Some, like Broadvoice, use this format:Some SIP providers use a slightly different register string format than others. The formats go as below: Which translates into: While others use this format: Which translates into: The /<DID> is important because it tells Asterisk how to route incoming calls from this trunk. It is a good idea to set it to your phone number/username. So, for this guide, we'll use a register string like this: Finally we can click the Submit Changes button. Now we can move on to setting up the inbound route. Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |