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:

  1. Configure SPA3102 unit
  2. Change asterisk configuration files via web Config Edit
  3. 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
4. Click on Voice tab on a top

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



Option 2 - Send call to a specific IVR menu

Option 3 - Send call to a ring group
Setup will be similar to Option 2

That's it. You should be able to make and receive calls using SPA3102