Linksys SPA3102 Setup on TrixBox
It looks like a pretty long guide but it is fairly simple. I've tried to break everything down as much as possible.
Please note that everything that looks like this has to be replaced with your own parameters. Do not just cut and paste.
All words in Bold specify link or section to go to.
Configuration consists of 3 main parts:
- Configure SPA3102 unit
- Change asterisk configuration files via web Config Edit
- Configure settings in FreePBX
SPA3102 Configuration
Follow Linksys installation diagram to connect the unit to local network.
Find out SPA3102 IP address either by checking your router's DHCP lease table or connecting analog phone to SPA3102 Phone port and dialing #110. Then open SPA3102 web configuration page by typing IP address of the unit.
1. Click on Admin login and then on Advanced
2. Select Router tab on a top
3. Click on WAN Setup
- Choose Connection Type you wish to use (DHCP, Static or PPPoE)
- As a good habit, under Optional Settings configure Host Name (for example: SPA3102, so that you can find it easier in DHCP lease table later)
- Also, enter values for Primary and Secondary NTP Server - you can use time-a.nist.gov and time-b.nist.gov
- You don't need to change anything under LAN Setup and Application tabs unless you're going to use SPA3102 as a router
4. Click on Voice tab on a top
- First, look at Info screen and write down Software version. Then go to Linksys website and download latest firmware. Follow instructions to install it. Log back in when upgrade is complete.
- All settings under System, SIP and Provisioning tabs can be left by default. Do not change them unless you really know what you're doing.
- Settings under Regional tab allow you to control various telephony parameters and are beyond the scope of this guide
- Click on Line 1 tab.
That is where you configure parameters for analog phone attached to SPA3102 Phone port. - Make sure Line Enable set to yes
- SAS, NAT and SIP settings are all default. Make sure SIP port is set to 5060
- Under Proxy and Registration you will configure analog phone connection to your TrixBox server:
- Proxy: IP address of TrixBox
- Outbound Proxy: none
- Use outbound proxy: no
- Register: yes
- Register expires: 3600
- Proxy Fallback Intvl: 3600
- Under Subscriber Information you will enter parameters for analog phone extension. All you need to enter here is User ID and Password. To get those you will need to create SIP extension using TrixBox > FreePBX
- Set Preferred Codec to G711u
- Make sure VOIP fallback to PSTN set to yes. That will send all calls from analog phone to PSTN line in case of network failure.
- Dial plan - You can use following example, but I will try to write a separate guide on dial plan configuration:
([2-79]11<:@gw0>|xx.|*xx.|**xx.|<#,:>xx.<:@gw0>|<#,:>*xx<:@gw0>)
- Click on PSTN line tab.
Here you'll configure PSTN line connection to TrixBox and few other important things - Again, set Line Enable to yes
- NAT, Network and SIP settings are all default. Just make sure SIP port is set to 5061
- Under Proxy and Registration you will configure PSTN line registration with your TrixBox server. It may be a little confusing to beginners but SPA3102 will actually register incoming PSTN line as a separate extension on TrixBox. All parameters will be pretty much the same as we configured under Line 1 tab.
Leave the Subscriber Information User ID and Password fields empty for now. We'll configure them later after we set up TrixBox. - Under Dial Plans you will have something like (xx.) in DP 1 through 7. Leave Dial Plan 8 blank for now. We'll get back to it later.
- VOIP-to-PSTN Gateway Setup:
- ... Enable: yes
- VOIP Caller Auth Method: HTTP Digest
- One Stage Dialing: yes
- VOIP Users and Passwords:
- User 1 Auth ID: asterisk
- ... Password: asterisk (or you can put something you like, just need to enter the same password in TrixBox later)
- PSTN-to-VOIP Gateway Setup:
- ... Gateway enable: yes
- Auth method: none
- PSTN CID for VOIP CID: yes
- PSTN Caller Default DP: 8
Now you can leave SPA3102 and we'll configure TrixBox. We'll have to enter few parameters in SPA3102 after that.TrixBox Configuration
1. Open FreePBX and go to Extensions
Create extension for analog phone attached to Phone port of SPA3102. Extension number and Secret will go to Line 1 tab of SPA3102 as User ID and Password (look in Subscriber Information section)
2. Open Asterisk Config Editor and select sip_custom.conf for editing.
If you do not have it on a list you can enter all required settings in sip.conf instead. I prefer using sip_custom.conf just to keep everything organized.
First, we setup incoming line registration. You can just cut and paste following context:
;PSTN Line via SPA3102 context for incoming calls
[1010]
username=1010
type=friend
secret=secret1010
dtmfmode=rfc2833
context=from-internal
disallow=all
allow=ulaw
insecure=very
You'll need to substitute values depending on configuration of your system. Just choose extension that is not being used and enter it instead of 1010. Username and secret from this context will go to SPA3102 PSTN line tab under Subscriber Information.
Second, we'll enter context for outgoing calls via SPA3102:
;SPA3102 Trunk Line - outgoing
[spa3102]
type=peer
auth=md5
host=[IP address of SPA3102]
port=5061
secret=[your_secret]
username=asterisk
fromuser=asterisk
dtmfmode=rfc2833
context=from-internal
insecure=very
Then, click on Update button below editor window to save configuration.
Finally, we need to configure inbound and outbound routes using SPA3102.
Let's start with creating trunk line:
1. Open FreePBX and go to Trunks
2. Create a new Custom Trunk with following parameters:
Outbound caller ID: Your phone number
Maximum channels: 1
Outgoing Dial Rules: you don't need to put anything at this point, unless you want to set up some custom rules
Outgoing Settings: SIP/spa3102/$OUTNUM$
Last string means that calls on this trunk will be made using context [spa3102] we've created earlier.
Now, go to Outbound Routes in FreePBX and create a new route (or you can add this trunk to an existing route if you prefer)
1. Let's name this route Local_Calls
2. Dial pattern will be 9|NXXXXXX
3. Trunk sequence: select SIP/spa3102/$OUTNUM$ from the drop-down list
We have few ways to handle calls coming via SPA3102: ring one extension, send call to a specific IVR menu or ring group.
Option 1 - Ring one extension- Open SPA3102 web configuration and open PSTN Line tab
- Scroll down to Dial Plans and change value for Dial Plan 8 to: (<S0:extension number>)
- Scroll all the way down and click on Submit All Changes. Wait for SPA3102 to reboot
- Test configuration by making a call to SPA3102
Option 2 - Send call to a specific IVR menu
- Go to TrixBox Config Edit and open extensions_additional.conf
- Scroll down and find contexts named like [ivr-1] or [ivr-2,3,4,5 ... and so on]. If you have multiple IVR menus built you'll have to find the one you need. [ivr-1] usually is main menu but that may be different in your system. You will not need to change anything in this file so just click on /etc/asterisk on a top to get to the list of files again.
- Open extensions_custom.conf and in [from-internal-custom] enter the following line:
exten => XXXX,1,Goto(ivr-2,s,1)
Instead of XXXX you will need to enter some extension number that is not being used
- Open SPA3102 web configuration and open PSTN Line tab
- Change value for Dial Plan 8 to: (<S0:XXXX>)
- Submit All Changes and test configuration by calling SPA3102
Option 3 - Send call to a ring group
Setup will be similar to Option 2
- Make sure you have ring group defined in FreePBX Ring Groups
- Open extensions_custom.conf and in [from-internal-custom] enter the following line:
exten => XXXX,1,Goto(ext-group,#,1)
Where # is the number of ring group.
- Open SPA3102 web configuration and open PSTN Line tab
- Change value for Dial Plan 8 to: (<S0:XXXX>)
- Submit All Changes and test configuration by calling SPA3102
That's it. You should be able to make and receive calls using SPA3102