Your PSTN and you: Linksys SPA-3102 and Asterisk

So another piece of my Asterisk/TrixBox puzzle was completed today -- or rather, almost completed. I received the Linksys SPA-3102 FXO/FXS SIP ATA, which will be the bridge between Asterisk and one of the incoming POTS lines to the lab. I probably should have ordered the SPA-3000, since I really don't need the routing/NAT capabilities present in the SPA-3102, but then again, it's a lab. I have it working inbound

So another piece of my Asterisk/TrixBox puzzle was completed today -- or rather, almost completed. I received the Linksys SPA-3102 FXO/FXS SIP ATA, which will be the bridge between Asterisk and one of the incoming POTS lines to the lab. I probably should have ordered the SPA-3000, since I really don't need the routing/NAT capabilities present in the SPA-3102, but then again, it's a lab. I have it working inbound and outbound with Asterisk, and it's also driving a few analog phones that are referenced as a single addressable Asterisk extension. It was a bit of a struggle, but not much. Some notes on this follow:

  • If you don't need the routing/NAT features of the SPA-3102, you need to initially configure it with a link on the Ethernet port, change the LAN Network Service to bridge, move the Ethernet link to the WAN port, dial #### from a phone connected to the FXS port, then dial 7932#, then 1 to enable the Web server on the WAN port.
  • On the voice side, you can get the SPA-3102 to trunk inbound and outbound to Asterisk without bothering to create individual extensions for the FXO and SIP ports. My trunk config is simple:


    auth=md5
    context=from-pstn
    dtmfmode=rfc2833
    fromuser=spa3102
    host=172.16.32.123
    insecure=very
    port=5061
    secret=spa3102
    type=peer
    username=spa3102

    The Asterisk server is set under Proxy, and the username/password is referenced in the SPA-3102 PSTN Line Subscriber Info section. You will show a failed registration on the PSTN line, but as long as you've flagged Make Call without Reg and Ans Call without Reg as Yes, it will work. I'd rather have this setup than cluttered extensions on Asterisk that aren't used.
  • Generating DIDs from the PSTN for inbound routes on Asterisk is non-obvious. This is handled as a dialplan within the SPA-3102. For instance, (S0<:4155551212) as Dial Plan 2 under PSTN Line with a corresponding flag to use DP2 under PSTN-to-VoIP Setup will generate a 4155551212 DID to Asterisk for an incoming call. Obviously, you can put whatever you want in that field.
  • Speaking of dialplans, the best FXS dialplan for the SPA-3102 and Asterisk (at least my configuration) is
    (*x|*xx|xxx|[3469]11|0|00|[2-9]xxxxxx|1xxx[2-9]xxxxxxS0|xxxxxxxxxxxx.)
    This speeds up recognition of internal extension and feature code dialing, as well as just about everything else. With this dialplan, calls from the FXS port are routed to Asterisk, which has outbound routing configured to prefer the SIP trunks over the PSTN lines for long-distance, and the PSTN lines for all local calling, including emergency dialing.
  • Call Waiting is a problem, and one I haven't solved yet. With the SPA-3102 not ringing through to the FXS port on an inbound call, Asterisk takes over and handles the ring distribution perfectly. However, I can't correctly generate a single flash to the PSTN when another call comes in. I get the CW notification beeps fine on both SIP and analog extensions, but hitting the switch hook simply brings me to the Asterisk dialtone for call forwarding, parking, etc. There's no clear method of generating that flash to the PSTN line to kick over to the other call. I just discovered this problem an hour ago, and am probably going to code something into Asterisk to respond to a *3 or other unused feature code to provide a flash to the PSTN. That's rather non-optimal, however. It would be nice to be able to trim the switch hook response timings within Asterisk (which may be possible, but I've not found it yet) and then do the same on the SPA-3102, which would let me configure the SPA-3102 to interpret the flash before Asterisk... but that would mean that other feature codes would be inoperable. Catch-22. The other option is to let the SPA-3102 ring through to the FXS port, which should let CW work on the analog phones -- but that still leaves the SIP extensions in the dark as far as call-waiting. Otherwise, CWCID works with the analog phones, and the call quality is great throughout.

    Aside from a few little pieces, the SPA-3102 is a great unit for the $90 price. The firmware is very complete in terms of tweaking just about every setting, and each port (FXO, FXS, SIP) can be treated as a unique entity, which makes it perfect for this purpose. I did upgrade to the latest firmware (5.1.5GWa as of this writing) without issue, though it requires a Windows system for the upgrade. The Web interface is a little wonky at times, but is otherwise fast and responsive. I especially like the fail-open configuration -- if power is out, the FXS port is bridged to the FXO port so normal calling is still possible.

    I'm expecting another one of these for another PSTN line, and possibly a Digium Iaxy to play with. Suffice it to say, I'm getting into Asterisk in a big way.

  • Recommended
    Join the discussion
    Be the first to comment on this article. Our Commenting Policies