Geeks With Blogs
Joaquin Jares Just another geek's blog

Everything started a few months ago. I live in a country where you cannot choose the
phone company you'll get, and you're stuck with the single company that covers your area.

This of course smells of corruption, but that's not the point here.
The problem was I spent about an year calling the phone company so they'll repair my
line, which was absolutely dead. And they'll send someone, and it'll work for a few days,
and then the problems started again. I spent half last year without even having a phone.

So I told myself: why not go to IP?

For those unfamiliar with VoIP I'll clear some of the vocabulary out right away. A VoIP
(Voice over IP) phone is a phone (known as an ATA) that connects to a provider (VoIP
provider) using one of several protocols (h.323 and SIP being the two most popular). You
can have an incoming phone number (called a DID) that looks exactly like any regular
phone number in your area. The people calling you can never know you're on VoIP (except
for a little delay in the voice). You also don't want that huge downloads interfere with
your voice experience, and you have QoS (Quality of Service) for that. It is a system
where you either limit the bandwith of a certain port/computer/etc or that dynamically
limits and increases the bandwith of a service.

So I cancel the line with the telco company (which they ended up not doing pecause they
lost my form and they where forcing me to pay an extra month I didn't use), and I start
searching for VoIP providers carrying DID's in my area. When you have VoIP, you can have
a provider anywhere in the world. The cost of the calls is generally the same. But if you
want an incoming line, it has to be in your area, or people'll have to call international
rates to get to you.

I found several VoIP providers (which was amazing, I thought that there where none), and
I sent mails to all of them asking them what their costs where, etc, etc. I finally chose
Altocontacto.com, and I must say I'm very satisfied with them. I wasn't satisfied with
the whole VoIP thing at first, but they have excellent customer support, and they helped
me through every issue they could.

Second step was to find a good ATA. I live with my non-computer savy girlfriend (and I
love her) and I wanted this phone to resemble a phone as much as it could. The solution
for that is a VoIP router, which routes internet calls to a regular phone line. I saw
several, and finally I had to choose between PAP2 or RT31P2 from linksys. I love linksys,
all my routing hardware is linksys, but I must tell you: never buy VoIP products from
them. Linksys has over the last few years associated with the major VoIP providers in the
US (Vonage being the number one). They usually sell hardware locked to those companies.
You can find unlocked hardware outside the US (which is completely legal) or unlock your
linksys hardware (which, I think, is not so legal). The problem is that if you buy
unlocked hardware from linksys, they will absolutely not give you any support.
Furthermore, they'll try to find out how you got the hardware in the first place, and
they'll demand that you be a VoIP provider authorized by them before giving you the most
simple and mundane piece of data.

Anyway, I had these choice to make. RT31P2 seemed like stronger hardware, with QoS
capabilities so I chose that. It was, of course, the wrong choice. RT31P2 may have better
hardware than the PAP2, but the PAP2 has a way better firmware. There's configuration you
simply can't do with the RT31P2. And the QoS system it has is lame. But at first,
everything went ok. I was making the calls, I had to choose amongst several voice
protocols and I found one where the calls will actually sound ok. I was jolly,
altoncontacto was helping me with all of this. They didn't have the RT31P2 in their
knowledge base, so I had to configure it myself, but everything was ok. My configuration
at this point was:

Internet provider <-> WRT54G <-> RT31P2 <-> Regular phone

With some wireless computers connected to the WRT54G router and some wired computers
connected to the RT31P2. Then, my friends started complaining that they could never call
me, and I started doing some tests. Apparently, the VoIP provider was ditching my
connection after some time of inactivity. I could connect perfectly, but I'll get
silently disconnected after some time. Nobody uses DID's in Argentina, so this company
has a lot of outgoing calls and almost no incoming calls. To increase the concurrency of
the system, they kill connections after a fair timeout (which is about 2 minutes). I
couldn't really blame them, the configuration they had was optimum for their needs. They
tell me "just set the register expires parameter in yout ATA to 120 seconds, and
everything'll be fine". But my ATA (the RT31P2) doesn't carry that setting... so I
couldn't do that. Another problem I had, which was more like a slight nuisance than a
problem, was that using VoIP you're technically nowhere. So when you want to call your
next door neighbor you have to dial the 00 + international code + local code + number.
This wasn't a big problem, but it sure was annoying.

So at first I try configuring this RT31P2 thing in every conceivable way, and then I
contact linksys for support, and they wouldn't even tell me if the parameter was there or
not. Finally, this really cool guy from linksys (they're forbidden to do it, which
doesn't mean they're bad people) tells me "if you can't find the configuration parameter,
it probably isn't there". So I thank him and start going through alternative paths. First
path was trying to replace the RT31P2 with a PAP2, which does have the parameter. But
that was a no-no, my equipment was used and really difficult to sell. Then, other things:
connecting a modem to the additional phone line and opening the port and closing it every
120 seconds (I don't even think that would work anyway), sending the SIP request with a
spoofed IP address from a wired PC (but I generally don't have any on 24x7). And finally,
changing the firmware of one of the routers to acommodate my needs.

Linksys may create good hardware, but the firmware's are generally pretty bad. Also, they
used to opensource some of their firmwares. Those two items combined made people (several
people, in fact) create firmwares for their hardware. RT31P2 firmwares are obviously
nowhere to be found, those are locked... but WRT54G firmwares come in all sort of
packages and colors. You simply have to choose which one's best for you and go with it.
WRT54G seems also to be a popular choice where I work, so I went around asking people
which firmware they use. One of them suggested OpenWRT. You can schedule tasks in
OpenWRT, so I could spoof the SIP request from there. Others suggested Sveasoft's
firmwares, but I really don't think I want to get into that war. So I went with OpenWRT,
and I started investigating. Checking things out, I found out that there was an Asterisk
port for OpenWRT, so I started finding stuff out about that too. Now, don't get me wrong.
Before this, I didn't even know what an Asterisk was. I'm a developer, not an
administrator. This kind of things are simply out of my scope. So let me explain:

In the telephony world, there's a piece of hardware called a PBX. What a PBX does is it
receives incoming phone lines, and it routes them to the extensions in your
house/company. A software PBX does almost the same thing: It gets VoIP phone lines and it
routes them to VoIP extensions, or other software/hardware PBX's that'll route the calls
to regular phone extensions. It provides routing mechanisms and protocol conversions (if
you want, for instance, to communicate a SIP-enabled phone with an h323-enabled VoIP
provider). The OpenWRT-Asterisk combination allowed me to make local calls without
international prefixes (given that I configured an appropiate rule) and best of all, it
carried the Register Expires configuration item!

My first step was then to flash the firmware in the linksys router. (Disclaimer: this is
what I did, and it voided my warranty... kids, don't do this at home!). They tell you
that your WAN (Internet) connection must be set to static before flashing the firmware,
so I went into linksys' web admin and changed that. That left me with no internet, so I
made sure to havve everything I needed (Including linksys' V2.02.7 firmware just in case)
before starting. The best procedure for flashing the router from a Windows box (I had a
Linux box, but I wanted to use the windows), is to start pinging the router with

ping 192.168.1.1 -t

where the router will always be 192.168.1.1, no matter what you configure it to be. You
then have to have this line:

tftp -i 192.168.1.1 PUT firmware.bin

ready in a separate command prompt. You disconnect power from the linksys router count to
60 and reconnect it. As soon as the ping starts responding again, hit return in the tftp
line. That'll upload the firmware (in about 10 seconds), and you're ready to go!
So at this point, I had a WRT54G with an OpenWRT firmware, a RT31P2 connecting with my
VoIP provider, and a wired computer connected to the RT31P2. Next step was to make the
internet work...

To get into the WRT54G, I couldn't use the web interface anymore, since it was no longer
there. I had to telnet into it instead. Now, telneting into a box is the most unsecure
thing you can do. Issuing a passwd command, I set a password for root (a strong one,
also, with letters and numbers and strange symbols). OpenWRT also comes with SSH, so I
tried connecting to it with putty. It asked me for a user login (root) and a password
(the one I just set). So I went ahead and deleted telnet from the WRT. After that, I had
to make the internet work. My girlfriend was about to wake up, and if Internet didn't
work... I wouldn't be able to work on this anymore. All your settings remain when you
flash the firmware, so the only thing I had to do is to set the WAN to dhcp again (I had
set it to static before flashing the firmware). The parameter's name is wan_proto, and
the setting should be dhcp. I issued these commands:

nvram set wan_proto=dhcp
nvram commit

And everything was working again! This is just how easy it is to flash a WRT54G and get
whichever firmware you want. Even the wireless interface was working again. (BTW, at this
point I used nvram show a lot to find what the names of the parameters where). So next step was to get the Asterisk up and running. I'll continue with that in a few days... if you want a preview, go to http://lestblood.imagodirt.net/archives/106-Asterisk-on-OpenWRT-part-2.html. I'll try to post all the relevant links tomorrow, I'm so thankful to so many people...

Posted on Sunday, November 13, 2005 10:05 AM | Back to top


Comments on this post: Got VOIP!! On how to integrate a WRT54G with Asterisk - Part 1

# re: Got VOIP!! On how to integrate a WRT54G with Asterisk - Part 1
Requesting Gravatar...
Hi Joaquin,
Its nice to hear that you got your VOIP solution working. In case anyone should find this thread via google... there may be a simpler solution... the advanced admin feature of the RTP31P2

http://192.168.15.1/Voice_adminPage.htm

pasting in Voice_adminPage.htm after the normal address used to login into the router should give access to the complete PAP2 interface, where you can set the timeout, and other features such as the dialing plan.

best wishes,
D
Left by David Durkee on Sep 08, 2009 4:09 AM

Your comment:
 (will show your gravatar)


Copyright © Joaquin Jares | Powered by: GeeksWithBlogs.net