Cisco/Linksys/Sipura Analog Telephone Adapters

From LinuxMCE
Revision as of 13:59, 27 August 2011 by Twodogs (Talk | contribs)

Jump to: navigation, search


by Twodogs, 25 Aug 2011

Want to get rid of that expensive telephone service? Want to connect your phone to your LinuxMCE home automation system? Want to spend hours of frustrating software configuration? Of course!

This tutorial shows how to get your existing analog phone to work with VOIP using the Broadvoice service provider and an SAP3102. 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). Also, if you chose another VOIP provider, it should not cause too many problems as long as it is recognized by linuxMCE.

http://wiki.linuxmce.org/index.php/VOIP_Service_Providers


Glossary

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.

Preliminary Steps

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. I wanted a provider that offered 911 service (some don't) and that had an existing template in LinuxMCE. That's why I chose Broadvoice. It costs me $11 per month instead of the $70 I paid to the phone company.

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...

1. Plug a USB headset into your orbiter and use the softphone. (cheap, but inconvenient)

2. Connect a VOIP phone directly to your LAN. (pretty neat, but expensive)

3. Connect an ATA and use your existing analog phones. (convenient and inexpensive)

I chose the Linksys SPA3102 because it has and FXS and an FXO port that allows you to set up VOIP and PSTN and then choose between then (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 Qwest telephone serive 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.

3. Configure LMCE phone line device.

4. Configure Asterisk using FreePBX.

5. Configure The ATA.

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. Network

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 the 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 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.

Step 2. Phone Device

Log in to the LinuxMCE web admin. Go to Wizard -> Devices -> Phones -> Add Device (bottom of the page). For device template select “Generic SIP softphone” which is template 1734. When the device is added, 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). 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 the update button.

Success is basically generating an extension number, password, and port number

Step 3. Phone Line Device

Sarah can create a phone line during the installation wizard, but I thought it was easier to do through the LinuxMCE admin page. Besides, you'll probably screw up the configuration and have to delete and reinstall everything anyway. Your VOIP provider's website has the information to set up the phone line (Broadvoice has an Account->Show Settings tab). To get everything ready, log into LinuxMCE admin, then open another browser tab and log into your VOIP provider. 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 most people the local number length is 7, but here in Denver we have several area codes and I had to enter 10. The stuff below is copied directly from your web provider. Broadvoice is one of the VOIP 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. 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 device and start over – it only takes a minute. Go no further until you get a “registered” indication.

Finally 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 when we're all done anyone who tries to call will get a “party not available” message.

Success is getting the line to register - that means LinuxMCE is talking to your VOIP provider.

Step 4. Configure Asterisk Using FreePBX

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. Only 4 tabs are of interest.

Extensions Tab. Click the 3-digit extension number that matches the phone device you set up in step 2. Write down the important information to help you configure the ATA later. For me this was:

Name – SPA3102

Extension – 200

Secret – 200 (this is the password you supplied)

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 “OK” in the popup. Or something like that – it takes three button pushes.

Outbound Routes Tab. Look on the right and you'll see a route for each trunk. We only set up one trunk, so click on it (mine was “broadvoice”). You'll have to change some things in the “Dial Patterns” box. Make it look like this:

112

411

911

NXXXXXX

NXXNXXXXXX

What are patterns and rules about? When you dial a number on your phone, Asterisk checks the dial pattern. So if it sees 112, 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:

9NXXXXXX

9NXXNXXXXXX

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 the leading “9” whenever we dial an 8 or 11 digit number.

Inbound Routes Tab. Nothing to change here. At the bottom you'll see “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.

Success is basically seeing that the wizard configured Asterisk (along with your changes). This means that LinuxMCE has talked with Asterisk and passed info on the phone and phone line..

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 “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.

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.

Success is getting the ATA to register. That means it has talked to LinuxMCE and recognized the VOIP line.

Test It

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. I wanted to use my analog answering machine, but LinuxMCE voice mail picked up first. I changed the time delay from 15 to 30 seconds. Then I found that Broadvoice voice mail 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. If your get error messages dialing out, check your dial patterns and dial rules.