Setting up Standard SIPStation Manually in FreePBX
While the SIPSTATION module in FreePBX offers the quickest, easiest setup of SIPStation, it is also possible to set up SIPStation manually by following the instructions below.
Â
Â
Â
Locating your SIP Username and Password
You will need to know the SIP Username and SIP Password for your SIPStation account in order to set up SIPStation manually in FreePBX. This login is different from the one you use to access the SIPStation Store. It is specific to your SIPStation service.
If you don't know your SIP username and password, log into the SIPStation Store at http://www.sipstation.com.Â
Click on My Account in the navigation menu.
Scroll down to the "Account Configuration" section. Your SIP username and password are shown. Take note of this information.
Â
Setting up Trunks in the FreePBX GUI
The following instructions will help you set up a SIP trunk for trunk1.freepbx.com. When finished, you will need to create a second SIP trunk for trunk2.freepbx.com for redundancy.
In your FreePBX GUI, go to Connectivity → Trunks.
Click the Add Trunk button.
Click Add SIP (chan_sip) Trunk in the drop-down menu.
General
There is not much you need to do in the General Settings tab. Enter a name for the trunk, then edit other options as needed. You can view the pop-up tooltips for additional information.
You do not need to set the Maximum Channels field in your trunks with FreePBX SIP Trunks. If you use more channels than you have purchased, the network will signal congestion properly, allowing other failover trunks to be engaged if you have configured them in your route.Â
In this example we are assuming that one of our DIDs (account phone numbers in SIPStation) is 212-555-1234. You will notice that we put the 2125551234 into the Outbound Caller ID field. Whatever you set in the Outbound Caller ID field will be the default Caller ID used when extensions do not have their own Outbound Caller ID configured.
Dialplan Manipulation Rules
Dialplan manipulation 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. If the number matches the combined values in the prefix plus the match pattern boxes, and the Caller ID matches the CallerID field, 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.
You can enter information manually or use the Dial patterns wizards button.
Use the plus sign to add another dial pattern or the trash icon to delete a dial pattern.
For example, you can enable 7-digit dialing on the trunk by entering the area code into the prepend field, then entering "NXXXXXX" into the match pattern field. Now, if 7-digit dialing is also enabled on your routes, calls will be sent out from this trunk with the area code added automatically. In our example, our area code is 212.
SIP Settings
Outgoing
Next you must configure the Outgoing Settings to talk to the SIPStation service. There are two SIP Trunk Servers available on this service: trunk1.freepbx.com and trunk2.freepbx.com. You can use either of them, or both, for outbound calling. Right now we are going to walk through setting up trunk1.freepbx.com.
Trunk Name: Give this trunk a unique name. Note: this is used as the trunk context within Asterisk.
PEER Details:Â Enter the following, replacing your_SIP_username_here and your_SIP_password_here with your actual SIP username and password located earlier.
context=from-pstn
type=peer
insecure=port,invite
qualify=yes
sendrpid=yes
trustrpid=yes
dtmfmode=rfc2833
username=your_SIP_username_here
secret=your_SIP_password_here
host=trunk1.freepbx.com
outofcall_message_context=sms-incoming
disallow=all
allow=ulaw
Â
The setting of qualify=yes is technically not needed, but it allows you to monitor the health of the internet connection in Asterisk. If you are not doing any port forwarding, this keeps the NAT pinhole open. For those of you on the extremely techie side, the setting of insecure=very is correct inside FreePBX. FreePBX will automatically convert this to: insecure=port,invite on Asterisk 1.4 and higher versions. (But if you happen to be setting this up in a raw Asterisk install, then you will want the latter).
Incoming
You do not need to change anything in the User Context and User Details fields. The last thing you need to configure is the registration string so that the FreePBX.com servers know where to send your inbound calls. This is simply derived from your SIP Username and SIP Password. You should be registering to trunk1.freepbx.com.
Register String: Enter username:password@trunk1.freepbx.com (replacing username and password with your actual SIP username and password).
Saving Changes
Click the Submit button
Click the Apply Config button. Your changes will become live.
Important: After you have set up a trunk for trunk1.freepbx.com, create a second trunk using trunk2.freepbx.com. This needs to be set up for redundancy.
 Setting Up Outbound Routes in the FreePBX GUI
Before you can start placing calls, you need to create outbound routes in order to route calls to your SIPStation trunks.
Creating a Non-Emergency Route
In your FreePBX GUI, go to Connectivity → Outbound Routes
Click the Add Outbound Route button.
Non-Emergency Route Settings
You should be viewing the Route Settings tab.
Give the route a name. In our example, we will call this route "Outbound."
Trunk Sequence: Select the two trunks you created earlier. The system will try the top trunk first, followed by the next one down, and so forth.
Non-Emergency Dial Patterns
Click on the Dial Patterns tab.
Set up dial pattern rules to match 7-, 10- and 11-digit numbers.  Remember, your SIPStation trunks require you to send either 10- or 11-digit numbers when you call someone. If you want to enable users to use 7-digit dialing, you will need to create a dial pattern that prepends an area code to 7-digit numbers. You can do this at either the trunk level or the route level. In our example, we enabled 7-digit dialing earlier when we were setting up the trunk.
Â
Saving the Non-Emergency Route
Click the Submit button
Click the Apply Config button.
You will see your new route in the routes list.
Â
Creating an Emergency Route
We highly encourage you to create a separate route called "EMERGENCY." For more information on E911, please visit our E911 Service wiki.
Go to Connectivity → Outbound Routes if not there already.
Click the Add Outbound Route button.
Emergency Route Settings
You should be viewing the Route Settings tab.
Give the route a name. In our example we will call this route "EMERGENCY."
Important: Select the Emergency button to mark this route as an emergency route. This will enforce the use of a device's Emergency CID setting (if set).
Trunk Sequence: Select the two trunks you created earlier. The system will try the top trunk first, followed by the next one down, and so forth.
Emergency Dial Patterns
Click on the Dial Patterns tab.
Set up dial patterns for 911 and 933. (933 reaches the E911 address verification service.) It is also a good idea to add an extra dial pattern that uses "9" as a prefix in case users think they need to dial 9 to reach an outside line.
Saving and Moving the Emergency Route
Click the Submit button
Click the Apply Config button.
You will see your new route in the routes list.
The order of your outbound routes is very important. Your EMERGENCY outbound route needs to be placed first in the list, at the top. If it was not the first route you created, you will manually need to move it to the top of the list. The system looks down the list when looking for a matched dial pattern. If a match is found, the system does not continue to look for a "better" match. This is why the emergency route needs to be first, to ensure it is used correctly.
If your emergency route is not at the top of the list, click on its arrow symbol and drag it to the top of the list.
Click the Apply Config button after changing the order of the routes.
Setting Up Inbound Routes in the FreePBX GUI
You will need to configure an Inbound Route so your PBX knows where to send incoming calls. The most common causes of support calls that start with "I'm not receiving inbound calls" are missing or improperly formatted registration strings or inbound routes. Assuming you have purchased DIDs, your calls will be transmitted as a 10-Digit DID and should be entered as such in your Inbound Route section. Â
In your FreePBX GUI, go to Connectivity → Inbound Routes.
Click the Add Inbound Route button.
General
You should be viewing the General tab.
Enter a Description for this route and enter your DID Number (use 10 digits).
Use the drop-down menus at the bottom to choose the destination to which to route incoming calls on this route.
We're choosing an extension in our example, but you can choose any valid destination.ÂClick the Submit button.
Click the Apply Config button.
Â
Any/Any Route
You can also create an "Any/Any" route which will terminate any DIDs you have not specifically assigned. Just leave the DID Number field blank. This will create a catch-all route that will match if a call comes in and a specific DID route for that call cannot be found. Choose a destination, submit the changes, and click Apply Config as above.