Difference between revisions of "Category:Tutorials"
|Line 1:||Line 1:|
Revision as of 20:52, 26 August 2011
Cisco/Linksys/Sipura Analog Telephone Adapter
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!
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 telephone plugged into it. An FXO port wants to connect to the telephone office. 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. 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 there seemed to be a lot of information on how to configure it for LinuxMCE. There is a line of very similar ATA devices originally designed by Sipura, then bought by Linksys (owned by Cisco). So just about any ATA called a Sipura/Linksys/Cisco SPA-XXXX will probably work with this tutorial. The difference between these devices is mainly the number of different ports. For instance, the SPA2102 has two FXS ports for two home phone lines. The SPA3102 trades one FXS port for an FXO port (in case I ever wanted to get back with my phone company). I could configure the ATA so that I could access either my VOIP line or my PSTN line (by dialing “9” just like a corporate office). I am not using this feature, so this tutorial will not cover setting up a PSTN line.
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. It also helps to remember that LinuxMCE is basically a router. We're not really trying to get all these devices to talk with each other so much as we are trying to get them each to talk with LinuxMCE. This is helpful because it eliminates variables during troubleshooting. For instance, when you get your phone line device to register, that means LMCE is properly connected to your VOIP provider. If your ATA fails to register, the problem is your ATA configuration, not your phone line.
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. I use only two: the internet port connects it to the core through the switch, and the FXS port connect to my analog phone. During setup, I connected a laptop to the ethernet port to access the SPA3102 admin screens. I do not have a PSTN line so the FXO port goes unused. Your ATA quick 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.
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 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.
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:
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:
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.
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 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.
Grab your cell phone and dial your new VOIP number.
This category has the following 8 subcategories, out of 8 total.
Articles in category "Tutorials"
The following 143 pages are in this category, out of 143 total.