Configuring Linksys SPA 3102 for Asterisk

As I mentioned in my previous post, I've been working on installing Asterisk.  I purchased a Linksys SPA 3102 ATA device.  It has FXO and FXS ports as well as two ethernet ports to go between your Internet connection and router.  The FXO port accepts a dial tone from the phone company and the FXS port generates one for your phones.  Since I have DSL and the phone line that comes along with it, I wanted to make use of that for local and emergency calls.

Because this device has so many configuration options, I wanted to document what I did in case I need to refer back to it in the future.  At some point, I'd like to look into creating an XML file to provision the device.  But I'm not ready for that yet.  Most of what I did was based on this forum post, but I didn't follow it exactly.

I've installed Asterisk on my Linode, which is on a static ip out on the Internet, and I've installed the SPA-3102 behind my home router, which is a WRT54G running the Tomato firmware behind a dynamic ip.  Since I have DSL, I have a combination DSL modem and router in one.  It's pretty limited in what it can do and I was afraid of it interfering with the VOIP traffic.  What other people recommended (online somewhere) was to put the DSL modem into bridge mode and configure my WRT54G to establish the PPPoE connection.  A useful tip from one of the forums was to clone the MAC address of the DSL modem to the WRT54G WAN port, otherwise you might end up in a situation where you need to call tech support.

With the home network reconfigured, it was time to get started with the SPA-3102.  My first order of business was to flash the device with updated firmware and reset it to factory defaults.  When I downloaded the flash, I was let down to see that you needed to run some flash program under Windows.  I later found out you can put the firmware image on a web server and use an "Upgrade URL" to flash the device (get the Admin Guide and search for "upgrade url" for more information).  For me, the flash and reset procedure went something like this..

  1. Turn off wireless on your laptop.
  2. Connect your laptop to LAN port of SPA-3102.
  3. Connect the WAN port of the SPA-3102 to your local network.
  4. Browse to from your laptop (make sure you click admin and advanced to see all of the configuration options).
  5. Note the WAN IP address the SPA-3102 was given.
  6. Enable the WAN web server (under Router->Wan Setup).
  7. Went to my desktop computer and fired up the Windows virtual machine.
  8. Under Windows, I opened the remote web management to verify I could connect to the WAN IP of the SPA-3102.
  9. Ran the firmware updater and followed the prompts.
  10. After the firmware update is complete, verify the version by browsing to the web management interface.
  11. Connect a phone to the phone port of the SPA-3102 (you should hear a dial tone).
  12. Dial **** to access the IVR.
  13. Dial 73738# to perform full factory reset.
  14. Dial 1 to confirm the action.

Now that the upgrade and reset procedure is complete, I returned to the laptop to enable the WAN web server again.  I then put my laptop away and finished configuring the device from my desktop computer.

As you should have noticed by now, the web management of the device is broken down by router options and voice options.  I configured the router options first.  This is a little misleading as I'm not using the device as a router, but that is where some of the basic networking options are kept.  Before configuring the basic stuff, I went to my WRT54G and gave the device a static DHCP IP address.  This way the device would be on a static IP address, but I wouldn't need to configure that in the device itself.  After that was done, I proceeded with the following basic networking configuration options..

  1. Browsed to Router -> WAN Setup tab.
  2. Set the HostName to "spa-3102" and Domain to "local".
  3. Set Primary NTP Server to "" and Secondary NTP Server to "".
  4. Enable WAN Web Server was set to "yes" earlier.
  5. Browsed to Router -> LAN Setup tab.
  6. Set Networking Service to "Bridge".
  7. Set Enable DHCP Server to "no".
  8. Click "Submit All Changes" button.

After the device resets, you can verify the settings on the Router -> Status page.  With the basic stuff out of the way, you can move onto the voice options.  These are a little more complicated and you will probably end up tweaking things as you configure Asterisk.

  1. Browse to Voice -> System.
  2. Set the admin password and user password.
  3. Click the "Submit All Changes" button and the device will reset.  Once it does, log in to the device.
  4. Browse to Voice -> Regional.
  5. Vertical Service Activation Codes.  Note: I read a forum post that said to clear all of these out so Asterisk would handle them if entered.  I have not done that yet.
  6. Under Miscellaneous, set the Time Zone.  Note: I still need to figure out the Daylight Savings Time Rule syntax, but I have a couple months for that.  The time zone parameter affects the time that is displayed on your phones if you have phones that do that.
  7. Browse to Voice -> Line 1.
  8. NAT Settings.  Note: I did not need to enable the NAT settings.  If you do, you will need to enable all of the NAT and STUN server settings under the SIP tab as well.  See the Admin Guide for more information.
  9. Set Proxy to your Asterisk server hostname.
  10. Set Register to "yes".  This is the default.  Note: The registration settings initiate contact to the Asterisk server and will keep the connection alive along with some Asterisk settings in the sip.conf file.
  11. Set Make Call Without Reg to "no".  This is the default.
  12. Set Ans Call Without Reg to "no".  This is the default.
  13. Set Display Name to "Line1".
  14. Set User Id to "line1".
  15. Set Password to something secret.
  16. Dial Plan.  Note: I did not modify this, but I may tweak it at some point.
  17. Browse to Voice -> PSTN Line.
  18. Set Proxy to your Asterisk server hostname.
  19. Make sure registration is enabled and required for making and answering calls.
  20. Set Display Name to "PSTN".
  21. Set User Id to "pstn".
  22. Set Password to something secret.
  23. Set Dial Plan 1 to "(xx.)".
  24. Set Dial Plan 8 to "S0<>" where is your Asterisk server.  Note: I believe this hostname needs to match your proxy hostname for authentication purposes.
  25. Set VoIP-To-PSTN Gateway Enable to "yes".
  26. Set Line 1 VoIP Caller DP to "1".
  27. Set VoIP Caller Default DP to "1".
  28. Set PSTN-To-VoIP Gateway Enable to "yes".
  29. Set PSTN Ring Thru Line 1 to "no".
  30. Set PSTN CID For VoIP CID to "yes".
  31. Set PSTN Caller Default DP to "8".
  32. Set PSTN Answer Delay to "5".  Note: This is to allow enough time for caller id.
  33. Click "Submit All Changes" button.

Now your Linksys SPA 3102 should be configured.  The next part involves configuring Asterisk. The installation and global configuration of Asterisk is outside the scope of this blog post. Below are sections of configuration files you need to modify for the SPA-3102.

First, the sip.conf file will handle the connections from the device to the Asterisk server. You should have a global section and most likely have other devices.

; Line1 on SPA3102

; PSTN on SPA3102

Then the extensions.conf file will tell how to route the calls. The "context=internal" for the line1 device above will route those calls to "[internal]". For me that also handles all of my devices. The "context=pstn" for the pstn device will route those calls to the section shown below. Since I put in for dial plan 8 above, we have to describe how to handle those incoming calls below.

exten => 123,1,NoOP(${CALLERID}) ; show the caller ID info in the console
exten => 123,n,Ringing()
exten => 123,n,Answer()
exten => 123,n,Playback(silence/1)
exten => 123,n,Playback(pls-wait-connect-call)
exten => 123,n,Wait(3)
exten => 123,n,Dial(SIP/line1,60)
exten => 123,n,Congestion

Right now all of this is pretty basic just to get things running. I'll probably end up doing more with the extensions.conf file and I plan on signing up with a sip provider to make outgoing long distance calls. The short-term plans are to keep using the local line for incoming calls, but I could port that number somewhere if needed. Also, I need to say thanks to Ryan Tucker for answering all my Asterisk questions along the way!

Tags: ,

16 Responses to “Configuring Linksys SPA 3102 for Asterisk”

  1. Tissa Says:

    I've got a telephone adapter and it's model number is SPA 3102.I am facing difficulty in configuring my telephone adapter.Iam using ADSL line for my internet connection and my telephone adapter is connected to the internet through a wired router.After several attempts i was unable to connect to my LinkSys to internet.Can you please guide me on providing LAN/WAN settings.

  2. path Says:

    Tissa, I read that it is best to configure your DSL modem to be in a gateway mode. That is what I did with mine. It probably depends on your ISP though. I have a Linksys WRT54G firewall behind the DSL modem that connects to Verizon DSL and handles the PPPoE connection. I then connected my SPA-3102 to the firewall and it all works well.

  3. yassine Says:

    I installed Asterisk1.6.0.5 with Fedora OS.I configured two users sip with softphones and it work well.but the Linksys adapter SPA3102 configuration dosen't work,I use only Local network,and i try to call from a softphone to an analogic phone,but no answer.i configured the file sip.conf and extensions.conf.i got no answer.i think i need help from someone who had turned it on!thanks

  4. path Says:

    Well, my SPA3102 is on my local home network and my Asterisk server is hosted at There may be some changes necessary, at least I've heard that much about putting Asterisk behind a NAT'd firewall.

  5. Andy Cox Says:

    Hey - thanks for this clearly-written tutorial. Works for me.

  6. Vince Says:

    After reading a lot of things, I finally got the incoming PSTN calls working with asterisk!
    Thank you for this great tutorial!

    But i don't figure how to make an outgoing call from asterisk thru the PSTN line of the 3102.
    Is it possible?


  7. Vince Says:

    Sorry it works perfectly!

    I was dialing SIP/pstn/${EXTEN} instead of SIP/line1/${EXTEN}

    Thanks again!

  8. lcl Says:

    hi, i hope that you can help me to configure my spa 3102 since i had already try for 2 days ,but i still unable to do it . My ip pbx is 3cx phone system and is in the same network with spa 3102, which port shall i use in spa3102( lan or wan port) , i tried to use lan port but the power light is unstabil, then after i change the network type to bridge, then the light is stable but i unable to access to the spa3102, what setting shall i need to to change? thanks

  9. Graham Pope Says:

    This is great and all works for me for incoming calls. How do I make out going call from the phone on Line 1 to the PSTN?


  10. twinclouds Says:

    I have a very basic question. Let's say I have a soft phone connected to the extension 201 on asterisk and I can make voip calls using gtalk with no problem. Now, I configured asterisk and spa3102 as described and the pstn registered fine also. If I want o make a call from extension 201 though pstn line connected to the 3102, what I should do?

  11. Jerry Says:


    many tries to get the SPA122 working and the SPA3102 had the same issue. this helped fix it and the SPA122 as well.


  12. Andreas Says:


    Thank you very much. I got my PSTN line with the help of a SPA 3102 connected and configured in about two hours. Looks, that everything works fine.

    With the help of this page I need not to consult the nearly 300 pages of manual.

  13. Emmanuel J-F Jotterand Says:

    Hello, I still have a problem (at least one!) : No Analog Trunks can be added in the Asterisk synology package interface, it is writen :

    No FXO ports detected !!

    What should I do, what is the problem... I follow the whole tutorial, I just refered to stay the Linksys SPA3102 as a router (not as a bridge)... Is it a problem? According to Cisco technicians this is the best solution, but they do not do support for Asterisk and do not know how it works...

  14. jozatan Says:

    Crazy! Worked right away. A few super small modification were necessary because of the news asterisk but everything else worked right on without any glitches.

    Two questions:

    1) How to make outgoing calls from any asterisk extension internal to the outside world via the pstn line?
    2) How to make calls coming from the pstn line to be able to dial extension of my choice in my internal asterisk space?

    Simple questions I know =)

    My Cisco SPA 3102 is labeled a bit confusing. Inside the web interface says: "Line 1", which is the FXS and "PSTN Line" which is the FXO. This is pretty clear. However, on the device itself outside is written "PHONE", which is labeled "Line 1" on the web interface or aka FXS and "LINE", which actually is labeled "PSTN" on the web interface or aka FXO. So summarized:

    FXO = LINE = PSTN Line
    FXS = PHONE = Line 1

  15. path Says:

    Crazy that someone is posting to this five year old blog post! I don't believe you can route calls in and out of asterisk using the pstn line of the spa 3102. I think you'll need a card in an asterisk server for that. I haven't run asterisk in years though, so I can't say for sure.

  16. Eduard Says:

    Hi Path!

    I've met the same situation as in your post. I dit everything similarly but got an issue:
    Incoming calls pass through Cisco to Asterisk normally.

    But when I try to make outbound call from Asterisk - I hear "All circuits are busy...".
    Tcpdump show me that reply from spa232d was SIP 404 Not Found, despite all config are as described in your post and default DP for VoIP-to-PSNT gateway are "(xx.)"

    Can you comment something?

Leave a Reply