Zentyal‎ > ‎asterisk‎ > ‎

Using the Cisco SPA232D with asterisk

Let's all have a moment of silence for the SPA3102, which has reached end-of-life. Cisco has replaced it with the SPA232D, which is a similar ATA, but being more advanced it also costs just a bit more, which is why we're disappointed with the loss of the SPA3102. And before we start, we'd like to say a word of thanks. Without this site, we would have had much more difficulty getting this to work. The SPA232D has a nice help feature, but we couldn't find an administrative manual anywhere and had difficulty finding documentation for parts we didn't understand, such as dialplans. Thanks to the post on pathennessy, we were able to quickly get this all working, though we did find a couple gotchas along the way.

The SPA232D has three main features:
  • one FXO port (incoming analog line, like from a carrier).  --- this is what we'll be focusing on.
  • one FXS port (analog station, like for a phone).  --- we don't care about this.
  • DECT base unit allows you to pair it with cisco cordless handsets.  --- and we really don't care about this.
We use the cisco ATA when we need small ATAs. Specifically, we're going to cover connecting the SPA232D to an asterisk PBX in order to enable asterisk to make and receive calls across the FXO port. So for example, we have one analog line provided by comcast. We can use an ATA with an FXO port to let asterisk access that line without having to buy a $500 PCI card or a similarly expensive media gateway. Why don't we just use a SIP provider to connect our asterisk PBX to the PSTN? Great question! We do! but for this project we needed a minimal cost solution to connect two FXO ports to our asterisk PBX, and that's where these ATAs come in.

Let's start with a picture to see the parts involved in this project

The SPA232D has four ports - two network ports (one "Internet" and one "Ethernet") and two phone ports (one "line" and one "phone"). In our example, we'll be using the Internet and Line ports, but we'll need to use the Ethernet briefly when the device is first turned on.

Step 1: enable remote access of the SPA232D.

Gotcha #1: Use the Internet port -- don't use the ethernet port.

When we first tried to configure this device, it made sense to us just to use the ethernet port because our asterisk PBX would be on the same LAN and we didn't need any routing capabilities of the SPA232D. But when we tried this, the SPA232D would send traffic to asterisk as if it were 127.0.0.1, so obviously when asterisk would try to reply to a registration from the device, those replies would go a whole lot of nowhere. This smells like a bug in the firmware (v1.3.0), but by simply using the ethernet port instead, we were able to work around the problem.

Because you'll still want to be able to configure your SPA232D from your LAN, you'll need to enable "remote" access in the SPA232D. To get started, connect your PC to the ethernet port of the SPA232D. To access the device, you need to browse to 192.168.15.1 and login using admin:admin. Once logged in, we need to change the following items:
  • browse to administration -> management -> user list.
    • change the default passwords. you cannot enable remote access until you do this.
  • browse to administration -> management -> web access management.
    • enable remote access.

Step 2: configure the PSTN (FXO) port using the voice -> PSTN page.

In the config portal of the SPA232D, browse to voice -> PSTN.

1) Enter your registration information. The proxy field is the IP/hostname of your asterisk server.



2) Enter a dialplan that will be used for sending the call to asterisk.

There's a link to understand dialplans at the top of this page; there's also a PDF attached. The pictured dialplan means "immediatly send the call to s@10.1.1.1" where s is the extension within the target context of your asterisk dial plan (more on that when we cover the asterisk side of the config) and 10.1.1.1 is the IP/hostname of the asterisk server.


3) Adjust two more settings.

First we tell the SPA232D to use our dialplan when receiving calls from the PSTN. This is how PSTN-to-VoIP calls get sent to asterisk.
Then we adjust the PSTN answer delay. This is a value in seconds. If you use 0, the call will immediately be answered, but you won't receive callerID. 5 is a value that's as close to immediate as possible while still giving the SPA232D a chance to receive callerID from the FXO port before sending the call to asterisk.




Step 3: configure sip.conf

[spa232d-pstn]
  type=friend
  host=dynamic
  secure=spa232d
  insecure=port,invite
  dtmfmode=inband
  qualify=3600
  nat=no
  canreinvite=yes
  ;This is where we define the context of the incoming call.
  ;The context must have a station that matches the dialplan from
  ;the SPA232D.
  context=from-fxo
  disallow=all
  allow=gsm
  allow=ulaw




Step 4: configure extensions.conf

[from-fxo]
  include => parkedcalls

  ; 's' extension is what we defined in the dialplan of the SPA232D.
  exten => s,1,NoOp()
  ; wait(1) gives a gap between asterisk handling the call
  ; and the ring being supplied to the calling party by the SPA232D.
  exten => s,n,Wait(1)
  exten => s,n,Answer()
  ; here you should continue the s extension to handle the call.

  exten => i,1,NoOp()
  exten => i,n,Hangup()


That's it! Now when you call your number, the SPA232D will receive the call and send it over to your asterisk PBX. You can also send calls out from asterisk across the FXO port of the SPA232D.... we didn't give examples of this configuration, but you'd send them out using something like: Dial(SIP/spa232d-pstn/${DESTINATION})
Ċ
Matthew R Chase,
Apr 5, 2014, 9:29 AM
Comments