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.
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.
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.
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:
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:
Ring Back Tone:
MWI Dial Tone:
Cfwd Dial Tone:
Ring Wave Form:
Hook Flash Timer Min:
Daylight Saving Time Rule:
FXS Port Impedance:
Caller ID FSK Standard:
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
Display Name: phone1 (Enter a name for the Line)
User ID: 1000 (enter the Extension Number you will use for this extension in Asterisk)
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
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
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.
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:
my land line number
allow any CID
That’s the entire Trunk configuration. Next I went to Connectivity->Outbound Routes and created a route with the following settings:
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
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:
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.