Cisco/Linksys/Sipura Analog Telephone Adapters

From LinuxMCE
Revision as of 02:18, 1 September 2011 by Twodogs (Talk | contribs) (Step 4. Configure Asterisk Using FreePBX)

Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 applies 25 Aug 2011 twodogs
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information


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 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). 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. I chose Broadvoice for $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 an FXO port that allows you to set up PSTN as well as VOIP, 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 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 line

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”. 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 "add device".

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 (so I lied to Sarah and told her I had no phone). 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. 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. Hit "update".

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. "Host" is sip.broadvoice.com. Hit "submit".

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.

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

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. So we 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:

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

Success has two steps:

- First is basically seeing that the wizard configured Asterisk. This means that LinuxMCE has talked with Asterisk and passed info on the phone and phone line.

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


There are two steps to success:

- First is getting the ATA to register. That means it has talked to LinuxMCE and recognized the VOIP line. Your ATA will now have 3 green lights.

- Second is getting the port number correct. The phone will register with an incorrect port, but it won't work ring or work right.

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. 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 green lights, start snooping around, recycle power, etc.

2. Configure LMCE phone device. Not much to get wrong here. If the device shows up on the next steps, it's probably good.

3. Configure LMCE phone line device. If it registers, you are probably good. If your phone seems like its trying to work but doesn't ring, check Phone Line -> Settings as described above.

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. Again if the ATA registers, it is probably good. Just a reminder, but your ATA will never register until your phone line has registered. Ensure the extension, port, and proxy match between the ATA and LMCE.


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.