Linksys SPA 3102 – Making it Work with Asterisk

I wanted to look into asterisk a little, but that only makes sense if I have some kind of telephone line for it. I don’t have a VOIP line that I could simply move to an asterisk install, but I do however have an analog telephone line which don’t use so far. Naturally I wanted to use that and since this was mostly for messing around a little I wanted to keep the costs low.After looking through some Hardware that could do the job I ended up buying a Linksys SPA 3102. Now that thing is way more than just an ATA (Analog Telephone Adapter) but it seems to be the cheapest piece of equipment to do the job. So this article is in no way going to cover all the functionality or possibility’s of this little box. But as I was setting it up there were a few problems along the way and no guide seemed complete.

The Hardware

But first lets cover the Hardware itself. The Box contains The SPA 3102, a power cord with inbuilt external power supply, a telephone cable with 2 RJ-11 connectors, a Network cable and a CD with various Handbooks. With a footprint of 10 by 10 cm and a height of a little over 3 cm the SPA 3102 is pretty compact and can be hidden somewhere out of the way easily. Tho you might want to make sure that the space is not too tight or that there is a little airflow, since it got warm to the touch after a few minutes of running. For its Telephone Functionality it has one RJ-11 connector for a PSTN Line (FXO Port) and one RJ-11 connector to connect a phone or fax machine (FXS Port). On the Network side of things it has two RJ-45 Connectors one for the LAN and one for the Internet. All the connectors are Color Coded and clearly labeled so there should be no confusion when connecting it.

When trying to hook it all up I ran into my 1st problem since I did not use my analog line  so for I did not have any cable at hand that I could use to connect it to the wall jack. Lucky for me I had one in my random cables box, but if you are like me and don’t use your analog line then make sure you have a cable that lets you connect your wall jack to the RJ-11 connector on the SPA 3102.

Basic Setup

First make sure you analogue phone is working you will need it. Mine  was not working and it took me a while until I got the idea to actually check it.

If you are like me and you already have an Internet-gateway that does its job just fine you will not need the Router/Gateway functionality of the SPA3102. In that case be warned if you connect only the LAN Port there will be some weird issues but there is a simple solution: connect the WAN Port instead of the LAN Port. After that connect your phone and your Land line.

Next you will need to find out the IP of the Linksys and enable the web interface on the WAN Port. To do this pick up the phone you connected and dial **** you should be greeted by a computer generated voice telling you that you are connected to the SPA’s configuration interface. Type 110# and it will tell you the current IP. Write it down and type 7932# followed by 1# and 1 to enable the web interface. If the Voice menu does not work, disconnect the PSTN and try again.

Firmware upgrade

Before you set up the SPA you should probably check the Firmware version. Mine came with version 3.3.6(GW) the settings below seemed to work but after a day or two I was not able place outgoing calls anymore. I tried to change most of the regional and PSTN Setting and it did not help. In the end I tried updating the Firmware. It turned out to be a lot more complicated then it should be. The firmware package contains a .bin file, that is the actual firmware and it contains an update program. For the Firmware update to work, you need to enable firmware updates in the provisioning tab of the web-interface, you need to be connected to the WAN port(you should be if you followed my advise) and you need to be in the same subnet as the SPA3102. I have met all those conditions and it did not work. The updater told me immediately, that it can’t connect to my SPA. I messed around with the network settings and nothing helped. Fortunately there is another way to update the firmware. You need a web server or TFTP server connected to the same subnet as the WAN port of the SPA. Put the firmware update on that server and open the following URL with your browser:
http://SPA3102_IP/admin/upgrade?http://yourwebserver/firmware.bin
Replace the placeholder names with the appropriate values and it should start updating your firmware. Check the status LED on your SPA, if it’s blinking it means, that the firmware update is currently going on.

SPA3102 – Preparing it for asterisk

Now connect to the Webinterface and start setting up the SPA and enter the advanced admin mode. You can also get there by appending “/admin/advanced” to the IP. Now go to LAN Setup and change Networking Service from NAT to Bridge ( this might not be required but SIP is not the most NAT friendly protocol so I would recommend it). After that do the normal Network Setup on the WAN Tab.

Now Change to the Voice Setup and go to the SIP tab and change the RTP Packet Size to “0.020″. After that go to the Provisioning Tab and make sure that Provisioning is disabled. Now off to the Regional tab there is a lot of settings to change and if you are not in Germany these settings might be wrong for you:

Dial Tone: 425@-19;30(*/0/1)
Busy Tone: 425@-19;10(.48/.48/1)
Reorder Tone: 425@-19;10(.24/.24/1)
Ring Back Tone: 425@-19;*(1/4/1)
MWI Dial Tone: 425@-19;2(.1/.1/1);10(*/0/1)
Cfwd Dial Tone: 425@-19;2(.2/.2/1);10(*/0/1)
Holding Tone: 600@-19;15(.1/.1/1,.1/.1/1,.1/9.5/1)
Ring1 Cadence: 60(1/4)
CWT1 Cadence: 30(.2/.2,.2/5)
Ring Wave Form: Sinusoid
Ring Voltage: 60
CWT Frequency: 425@-19
Hook Flash Timer Min: .06
Time Zone: GMT+1
Daylight Saving Time Rule: start=3/-1/7/2;end=10/-1/7/3;save=1
FXS Port Impedance: 220+820||115nF
Caller ID FSK Standard: v.23

It is also recommended that you remove or change the vertical service activation codes that are used by asterisk:
CW Act Code
CW Per Call Act Code
Block CID Act Code
CWCID Act Code
Dist Ring Act Code
Att-Xfer Act Code
CW Deact Code
CID Deact Code
CWCID Deact Code
Dist Ring Deact Code
Conference Act Code

Next you will want to change some settings in the Line 1 Tab, so that your phone will be known to Asterisk:
SIP Port: use an unused Port and make sure to use the same Port in Asterisk for this extension (I used 5062)
Proxy: enter your asterisk Server here
Register: yes
Register Expires:300
Display Name: phone1 (Enter a name for the Line)
User ID: 1000 (enter the Extension Number you will use for this extension in Asterisk)
Password: secretpassword
Dial Plan:([*x]x.)

And as a last step make some changes in the PSTN Line Tab:
SIP Port: use any free port and set the same port on the corresponding trunk in Asterisk (I used 5061)
Proxy: enter your asterisk Server here
Register: yes
Register Expires:300
Make Call Without Reg: yes
Answer Call Without Reg: yes
Display Name: Enter a name that will be shown if theres no Caller ID
User ID: pick a name that u will use a trunk name in Asterisk like 1-pstn
Password: secretpassword
Dial Plan 2: (S0) I used the number of my land line but you can put pretty much anything here
PSTN Ring Thru Line 1: no
VoIP Answer Delay: 0
PSTN Answer Delay: 3
Detect Disconnect Tone: yes
Disconnect Tone: 425@-30,425@-30;1.4(.5/.5/1+2)
FXO Port Impedance: 270+750||150nF
Line-In-Use Voltage: 30
Ring Validation Time: 150
Ring Timeout: 768 (when it was shorter I had problems with mobile networks on the old firmware, did not try to change it with the new one)

This takes care of the configuration the side of the SPA3102.

Asterisk Configuration

Now only the Asterisk setup is left. I used the Asterisk appliance with FreePBX and made all the changes in the web interface.
First I went to Connectivity->Trunks and added a new SIP-Trunk:

General Settings:
Name: 1-pstn
Outbound CID: my land line number
CID Options: allow any CID
Maximum Channels: 1
Outgoing Settings:
Trunk Name: 1-pstn
Peer Details:

allow=ulaw
canreinvite=no
context=from-trunk
dtmfmode=rfc2833
host=dynamic
incominglimit=1
nat=never
port=5061
qualify=yes
secret=securepassword
type=friend
username=1-pstn

That’s the entire Trunk configuration. Next I went to Connectivity->Outbound Routes and created a route with the following settings:

Name: SPA3102
Dial Pattern (Match Pattern field): 0.
this should match any number starting with a 0, I should probably change this to match any Number since this is my only outgoing trunk.
Trunk Sequence for Matched Routes:
I selected the Trunk I just created, as my first and only Trunk.

This took care of outgoing phone calls. In order to receive incoming calls or actually place outgoing calls, I still needed an extension. So I went to Applications->Extensions and added a generic SIP extension (I will only list the field I changed):
user extension: 1000
sip alias: phone1
Display name: phone1
secret: secretpassword

I created the extension with these settings and edited the extension again after creating it. I changed the SIP port to 5062.

Now only one thing was left to do, I needed an inbound route for my incoming calls. I went to Connectivity->Inbound Routes and created a route with the following settings:
Description: SPA3102
DID: my land line number
Destination: Extensions -> the extensions -> 1000 phone1

That is all you need to get the SPA3102 to work with Asterisk. If you followed my instructions you will be able to place calls from your asterisk over your land line and you will receive the calls from the land line on the analogue phone connected to the SPA 3102.

flattr this!

5 thoughts on “Linksys SPA 3102 – Making it Work with Asterisk

  1. I have an Asterisk Server based on a Synology Asterisk package… I have the No FXO port detected !! error message in Analog Trunks… I have Asterisk Build:
    Asterisk/1.8.13.1
    Asterisk GUI-version : 2.1.0-rc1
    So the indications given there cannot be found in my interface, so I edited the files, but nothing works… I still have the problem…

    Registered SIPCall sip 41325133791 free2.voipgateway.org
    Rejected PSTN sip 1-pstn 10.0.0.6 (my PSA-3102 IP address)

    Thank you for your help, if you have any idea, I requested help from Cisco/Linksys/Sipura, from Digium/Asterisk, and from Synology, but no one could help me for now… I need to my the Asterisk work for my phone lines… Thank you very much, this is for EJFJ Corporation…

    • I changed my DSL connection a little while back, so unfortunately i don’t have the SPA3102 in use anymore.

      I can get it our again and have a look. But do you get an error number maybe?
      Do the SIP settings on the SPA and your asterisk match?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What is 7 + 5 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)