Cisco/Linksys/Sipura Analog Telephone Adapters
|Version||Status||Date Updated||Updated By|
|810||applies||25 Aug 2011||twodogs|
This tutorial shows how to get your existing analog phone to work with VOIP using the SPA3102. However, any Sipura/Linksys/Cisco SPA-XXXX is configured almost identically. This family of devices was originally designed by Sipura, then bought by Linksys (owned by Cisco).
- VOIP – Voice Over Internet Protocol.
- ATA – Analog Telephone Adapter.
- POTS – Plain Old Telephone Service.
- PSTN – Public Switched Telephone Network.
- FXS – Foreign Exchange Station.
- FXO – Foreign Exchange Office.
- RJ45 – Ethernet jack.
- RJ11 – phone jack.
Its easy to confuse FXS and FXO. If you can remember that telecom engineers call telephones “stations”, then you can remember that an FXS port wants to have a station (telephone) plugged into it. An FXO port wants to connect to the office downtown. These are both RJ11 jacks.
Get a VOIP provider
You will need a VOIP provider to give you a phone number and provide access to the PSTN. This allows you to call your mom and vice versa. Without a VOIP provider you could only make computer to computer calls to your geek friends. When choosing a VOIP provider, you may want to consider whether they offer 911 service (some don't) and whether there is an existing template in LinuxMCE.
Get An ATA
The ATA is a device the size of a router. It has one or more RJ45 jacks that connect it to your LinuxMCE network, and it has one or more RJ11 jacks that provide an FXS port for your existing analog telephone. An ATA is only one of three ways to use VOIP with LinuxMCE. You could...
- Plug a USB headset into your orbiter and use the softphone. (cheap, but inconvenient)
- Connect a VOIP phone directly to your LAN. (pretty neat, but expensive)
- Connect an ATA and use your existing analog phones. (convenient and inexpensive)
I chose the Linksys SPA3102 because it has an FXO port that allows you to set up PSTN as well as VOIP, then choose between them (by dialing 9, for instance). I thought it would be useful to keep my PSTN line until I got VOIP to work properly. As it turned out, PSTN is just as difficult to configure as VOIP. I actually got VOIP to work first, so I fired my land telephone service and never looked back. We won't talk about setting up PSTN, though there are other tutorials that cover this. So I could have saved a few bucks by choosing an ATA without an FXO port like an SPA2100 (eBay for $15-20).
Make It Work
We'll cover this in five steps. I suggest following the order below in order to prevent having to revisit screens.
1. Install hardware.
2. Configure LMCE phone device. This tells LMCE how to communicate with a the new ATA
3. Configure LMCE phone line device. This tells LMCE how to communicate with the new VOIP provider
4. Configure Asterisk using FreePBX. This is LMCE's telecom brain
5. Configure The ATA. This tells the ATA how to communicate with LMCE
There are a zillion different screens, tabs, options, etc. to fiddle with. The configuration process is like opening a safe: if you know the combination it only takes a few seconds. If you don't know, it could take forever. To make the process easier, we'll talk about what not to touch. Configuration and troubleshooting become easier if we remember that we are trying to get each component to talk properly to LinuxMCE. If each is done correctly, they will all function together as a system. I'll try to give criteria for success following each step.
Step 1. Hardware
I thought I might have to fix some IP addresses or fool around with the modem or router, but no, I just plugged everything in as follows:
DSL Modem > Wireless Router > Core > Switch > SPA3102 > Analog Handset
The SPA3102 has 4 ports: internet, ethernet, FXS, and FXO. The reason for all the ports is that this ATA can be used as a standalone device (without Asterisk or LinuxMCE). So a typical user (not us) will normally set up with internet in from the provider, ethernet out to the LAN. LinuxMCE is set up as more of a wagon wheel configuration with the core at the center. So we won't use the ATA ethernet port (except for configuration, as we'll see). The FXS port connects the analog phone. The FXO port is only if your want to keep normal phone service. I don't cover that in this tutorial. For all setup, your ATA setup manual is your friend.
Success: Getting two solid green lights on your ATA indicating that you have power and internet.
Step 2. Phone Device
Log in to the LinuxMCE web admin. Go to Wizard -> Devices -> Phones -> Add Device (bottom of the page). Select template 1734, “Generic SIP softphone”.
Now you will see a screen that probably shows two phone devices. One of these phones gets set up automatically as part of your onscreen orbiter; the other phone is the one we just installed. Don't get confused and start reconfiguring the wrong phone!
Don't touch the orbiter phone. At the upper left, it says "controlled by:Onscreen Orbiter" and it is phone type "SIP6051".
The phone we want says "controlled by: Asterisk" and is phone type "SIP". It will show an extension number – don't change it. It also shows a password – change this to match the extension number (just to make life easier, but you must change it to something more secure later). On the left of the screen, rename the phone to whatever you like – I chose SPA3102. Under that field, use the drop down to assign the phone to a room. Write down the extension and password because we'll use it later. The new extension also has been assigned to a port (probably 5060 but we'll check that later). Now hit "update".
Success: Generating an extension number, password, and port number
Step 3. Phone Line Device
Sarah can create a phone line during the installation wizard, but its easier to use the LinuxMCE admin page. Besides, the odds of getting everything exactly right on the first try are pretty slim, so you're going to end up in web admin anyway - might as well just start there. Just lie to Sarah and tell you have no phone. Your VOIP provider's website has the information to set up the phone line. To get everything ready, log into LinuxMCE admin, then open another browser tab, log into your VOIP provider, and bring up the screen with your account settings (so you can easily copy/paste). Now tab back to LinuxMCE admin and click Phone Line-> Add. A screen will pop up allowing you to enter your VOIP provider information. Start up at the top. Leave the “prepend” boxes blank for now to make things simpler. For most people the local number length is 7, but here in Denver we have several area codes and I had to enter 10. Hit "update".
The remainder of the entries on this screen are copied directly from your VOIP provider. Broadvoice is one of the providers appearing in the drop down window, so I just selected it. If you chose an unrecognized provider, you'll have to look for a tutorial telling you what to do. A gotcha here is that the username and password are the ones for your phone line, not the ones to log into the website. For Broadvoice, the username is your 10 digit phone number, and the password is a bunch of random letters. "Host" is sip.broadvoice.com.
Hit submit when done. The phone line should almost immediately show “registered”. If not, you entered something wrong. Trying to correct it doesn't work too well. Best to delete the phone line and recreate it. Go no further until you get a “registered” indication.
After the phone line registers, click “settings” to ensure that all drop downs say “ring extensions” and put a checkmark next to the phone you setup in step 2. Otherwise your new phone won't ring, and the caller will get a “party not available” message.
Success: Getting the line to register - that means LinuxMCE is talking to your VOIP provider.
Step 4. Configure Asterisk Using FreePBX
Note - In LMCE 1004 Freepbx is not used. Use Wizard -> devices -> phone lines to set up trunks.
In LinuxMCE admin, select Advanced -> Configuration -> Phones Setup. This brings up the FreePBX window that is basically a front end used to configure Asterisk. If you chose a VOIP provider that LinuxMCE recognizes, (from the drop down list in Step 3.) you will be happy to see that Asterisk has been magically configured, but there are a few things to check and change. The big picture here is that Asterisk is powerful software that can manage telecom for a business. There might be many extensions in different offices, and several different phone lines (trunks) coming in. So Asterisk needs to know about the extensions and trunks it has to manage. It needs rules to route incoming calls to the correct extension. Finally, it needs rules to route outbound calls to the correct trunk. We are only setting up one simple VOIP line, but we still need to visit the 4 tabs below.
Extensions Tab. Click the 3-digit extension number that matches the phone device you set up in step 2. You should see everything you entered in step 2, plus some more info including the port number. Change nothing, but write down the information to help you configure the ATA later. For me this was:
- Name – SPA3102
- Extension – 200
- Secret – 200 (just another name for password)
- Port – 5060
Trunk Tab. Look on the right and click the sip trunk corresponding to the phone line you set up in step 3. (mine is SIP/broadvoice). Put a “1” in the maximum channels box, then delete everything from the “Dial Rules” box. I'll explain what this is all about shortly. If you hover your mouse over “Dial Rules” you'll get helpful information. When the changes are made, hit “submit” at the bottom, “apply” at the top, and “continue” in the popup.
Outbound Routes Tab. Look on the right and you'll see a route for each trunk. Click on our new trunk (mine was “broadvoice”). You'll have to change some things in the “Dial Patterns” box. For the US, make it look like the following, then hit submit/apply/continue:
What are patterns and rules about? When you dial a number on your phone, Asterisk checks the dial pattern. So if it sees 411, 911, any 7-digit number, or any 10-digit number, then it will route those calls to my Broadvoice sip trunk. If I had kept my PSTN line and setup another trunk, then I could make a dial pattern for that trunk like:
So whenever I dialed 9+the number, Asterisk would know to route that call to the PSTN trunk. Of course we would have to remove the “9” prefix before actually dialing the number. To do that, we would open up the trunk tab and put in a “Dial Rule” to subtract a leading “9”. For our configuration, we chose simple dial patterns that direct all calls to the VOIP trunk. We got rid of all dial rules because we don't want asterisk to change the number we dial or we'll end up in troubleshooting hell.
Inbound Routes Tab. Nothing to change here. At the bottom you'll see that “Set Destination” will have a check next to “Custom App – custom-linuxmce,102,1”. This allows LinuxMCE to determine what is to be done with incoming calls. For instance, when you set your home's alarm, it can automatically redirect incoming calls to your cell phone. Default settings are fine.
- Seeing that the wizard configured Asterisk. This means that LinuxMCE has talked with Asterisk and passed info on the phone and phone line.
- Getting the pattens and rules correct. You won't know for sure until you test the phone.
Step 5. Configure The ATA
If the ATA is not new, you should reset the factory default. Connect an analog phone to the FXS port, and dial ****73738# from the telephone keypad (check your manual). It asks you to enter 1 to confirm.
The ATA has it's own admin screen – it is not configured through LinumMCE admin. The ATA manual tells how to get access the admin setup. I plugged a laptop directly into the unused “ethernet” port of the ATA, then opened a web browser and pointed it to IP address 192.168.0.1 (because the ATA manual told me).
Look on the upper right side of the page and make sure you are logged in as “admin” and “advanced”. We won't mess with any of the “Router” tabs. It defaults to DHCP and that's how we'll leave it. We only have to modify two “Voice” tabs. By the way, "Line" tabs are for configuring VOIP, and PSTN tabs are for configuring PSTN. If your model ATA has a "Line 2" or "PSTN" tab, just ignore them.
SIP Tab. Change “RTP Packet Size” to 0.020
Line 1 Tab. Get the info you wrote in step 4, and change the following:
- Line Enable: Yes
- SIP Port: 5060 (or whatever you phone device uses)
- Proxy: 192.168.80.1 (fixed IP address of your LinuxMCE core – should be same for everyone)
- Register: Yes
- Register Expires: 3600
- Make Call Without Reg: yes
- Ans Call Without Reg: yes
- Display Name: 200 (or your phone device's extension)
- UserID: 200 (or your phone device's extension)
- Password: 200 (or your phone device's pasword)
- Use AuthID: no
- Preferred Codec: G711u
- Use Pref Codec Only: no
- Dial Plan: (xxx|xxxx|xxxxxxx|xxxxxxxxxx|1xxxxxxxxxx)
Submit the changes and cross your fingers while it thinks for a few seconds. When the admin screen returns, click on the “Router Status” tab and you should see that your ATA has registered and picked up a unique IP address from the core. If it doesn't seem to work, you might have to remove power from the ATA and wait 10 seconds before powering back up. The interesting thing about this step is that we enter no information about the VOIP provider. We provide info about LMCE, and allow LMCE to tell the ATA about the VOIP provider. Pretty cool.
It's probably a good idea to check your work. Go back into FreePBX and look at the bottom of the main screen. You should see 3 green lines all the way across the screen:
- IP Phones Online (2)
- IP Trunks Online (1)
- IP Trunk Registrations (1)
If the first line goes halfway across the screen and only shows one phone online, it means your orbiter softphone is OK but your new ATA is not. The phone is not talking correctly to Asterisk. Most likely you made a mistake with step 2 or 5.
- Getting the ATA to register. That means it has talked to LinuxMCE and recognized the VOIP line. Your ATA will now have 3 solid green lights.
- Getting the port number correct. The phone will register and show 3 green lights with an incorrect port, but it won't ring or work right.
Grab your cell phone and dial your new VOIP number. The LinuxMCE telecom screen should pop up and the phone connected to the ATA should ring. If not, here is some step-by-step troubleshooting advice:
1. Install hardware. Problems here should be obvious and easy to correct. If the ATA does not have 2 solid green lights, start snooping around, recycle power, etc.
2. Configure LMCE phone device. Biggest gotcha is confusing the two phones and modifying the wrong one. If you messed up, delete the device and recreate it.
3. Configure LMCE phone line device. If it registers, you are probably good.
4. Configure Asterisk using FreePBX. An error here can easily produce problems that send you looking elsewhere. For instance, a "Line is unavailable" message will make you think you screwed up step 3. In reality, it is probably something wrong with your dial patterns and dial rules.
5. Configure The ATA. Your ATA will never register until your phone line has registered. Ensure the extension, port, and proxy match between the ATA and LMCE.
I've had incoming calls cause the telecom screen to appear on the orbiter, but the phone does not ring (however, it shows "registered" and calls out fine). Two things can cause this.
- Mixing up your phone devices as described in step 2.
- Forgetting to look at Phone Line -> Settings during step 3.
Even after you get your phone working, you might still have some problems to overcome. I wanted to use my analog answering machine, but LinuxMCE voicemail picked up first. I changed the time delay from 15 to 30 seconds, but then Broadvoice voicemail would pick up. I changed that from the 3rd to the 6th ring. Now my answering machine finally has time to pick up on the 4th ring.
Once the phone is working, go back and change your phone's password under LMCE admin "phone device". The password should automatically be wizard'd to asterisk (check this in the FreePBX extensions tab). Then manually enter the same password in your ATA admin configuration. If you use phone extension 200 and password 200, your asterisk line can be easily hacked! Google "secure password generator" to get a strong password.