Asterisk on OpenWRT January 7. 2005
I have been using for my long-distance at home a VoIP connection provided by Vonage. The school had been paying for the service which gave me free long-distance. Fortunately the school finally wised up and cancelled their Vonage service (vonage is a horrible horrible VoIP company) but this left me with no long-distance (other than my .10 a min lan long-distance). The school (Brian Capouch) has been big in the VoIP scene and had switched to a company called NuFone. This company works great with the Asterisk open source PBX software and so I decided to setup my own PBX in my house! Asterisk requires a linux machine to work which since I didn't want to have a full machine up and running 24hrs a day just for a few phone calls, OpenWRT+Asterisk seemed like the best solution. OpenWRT is a linux distro that runs on the Linksys WRT-G/GS wireless G routers. These OpenWRT routers are fully functional linux installs without all the hassle or electrical cost of a full machine running.
I've since setup some pretty cool things with more on the way with Asterisk. I can now call (using a sip phone on campus) x7106 and it will ring my house internet. I can also call (from the house) any long-distance number and have it use the SJC NuFone account to place the call.
Here is how (how-to) I got it to work
Update 2005-03-10: A new and more verbose version of this entry can be found at Asterisk on OpenWRT part 2.
The first thing I needed to do was install the OpenWRT firmware. I didn't take the time (or bandwidth) to compile it myself. I just used the snapshot for the gs version of OpenWRT (I have the GS hardware). There is a wonderful howto
I actually first tried to turn the OpenWRT router into a simple bridge but ran into some problems being able to use the package tools as well as the WAN port on the machine. I ended up converting my entire network address space to handle the new router instead of using OpenWRT as a bridge (my internal IP addresses were the same as the routers external IP address... you can very well "route" with the same network on both sides of a router).
Once I got the machine setup and talking on the internet (and routing my traffic) I started the process of installing Asterisk.
The first thing I did was add the following line to my /etc/ipkg.conf file:
src local http://126.96.36.199/ipkg
src nico http://nthill.free.fr/openwrt/ipkg/stable
src nico-t http://nthill.free.fr/openwrt/ipkg/testing
src ab0oo http://www.wildcatwireless.net/wrt54g
The first "local" package line comes from Brian Capouch. He is really big into Asterisk and has created a OpenWRT package of the Asterisk-cvs branch. I used the cvs version for my install instead of the default "asterisk" package that comes from nthill.free.fr.
The second thing was to install 'asterisk-cvs' and 'asterisk-sounds' The package manager installs a few other packages that are needed for asterisk. There is the ability to install other modules for asterisk but I didn't/don't need them.
This is where the documentation for what I was doing was absent. I had never worked with asterisk let alone asterisk on openwrt. There were a few things I needed to change to the asterisk install to get it up and running. The first thing was to not load some of the modules that were not installed on the machine. I had to change/put the following in my /etc/asterisk/modules.conf file:
; Asterisk configuration file
; Module Loader configuration file
; If you want, load the GTK console right away.
; Don't load the KDE console since
; it's not as sophisticated right now.
noload => pbx_gtkconsole.so
;load => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
noload => pbx_dundi.so
; Intercom application is obsoleted by
; chan_oss. Don't load it.
noload => app_intercom.so
; Explicitly load the chan_modem.so early on to be sure
; it loads before any of the chan_modem* 's afte rit
; load => chan_modem.so
noload => res_musiconhold.so
noload => chan_modem.so
noload => cdr_pgsql.so
noload => cdr_mysql.so
; Load either OSS or ALSA, not both
; By default, load OSS only (automatically) and do not load ALSA
noload => chan_alsa.so
;noload => chan_oss.so
; Module names listed in "global" section will have symbols globally
; exported to modules loaded after them.
After I got the modules all squared away, I needed to setup my IAX configuration to talk to SJC (so they could talk to me too). I edited the /etc/asterisk/iax.conf file to accomplish that. The next thing I did was to get my ATA 186 SIP phone talking to my new Asterisk server. That was really simple. I just needed to edit my /etc/asterisk/sip.conf file to talk to the ATA. Changing those two files doesn't do much for actually making calls. The next thing I had to do (and what took me all day) was to edit my /etc/asterisk/extenstions.conf file. With the help of the BC over my shoulder, I was able to get the asterisk server to use NuFone as well as have the on campus asterisk server to be able to dial my asterisk server which in turn rings my ATA.
There is so much more I want to get setup with that box but what does one do when they run a phone company?... I have that many possibilities!
Sorry, this is the sort of basic doubts I have. Can you help me out in designing the full system. thanks
(Just as a linux router, not necessarily for VoIP at this point..)
I believe it has a 4MB ROM and a 8 or 16MB RAM.
As far as the voicemail is concerned. I think the problem has to do with the wrt not being able to handle the compression that takes place when saving a sound file. Another problem with the vociemail on these boxes is the fact that if the box loses power you lose all of your voicemail. There are a few ways around this problem but I found the simplest solution is to foward the call to a place that can handle voicemail. Another way would be to mount an nfs share (I haven't tried this yet so it's only a guess) and save the voicemails there.
Thanks for the great comment Callis!!
When I moved to Mexico, I only had 2 machines to utilized for work. So I am unable to do a full * deployment. All I am looking to do is simple calls via FWD and Broadvoice. Easier to have the devices do the trancoding, and fortunately, I have a [B]Cisco 6970[/B], and several [B]SIPURA 2000[/B].
Although, I have an old [B]Netwinder 2100[/B], which is MIPS based, so I am going to see if I can load the asterisk image on there and see if that will work. The beauty of that is that it has 128M RAM and a 10G hard drive.
The NLSU2 it's a Network Attached Storage device equipped with:
- an Intel IXP420 network processor at 133 Mhz (and can be set for 266MHz operation using a simple modification),
- 8MB of flash memory,
- 32MB of SDRAM
- 1 FastEthernet port
- 2 USB 2.0 ports
You can use it with an USB Flash disk or an external USB hard drive
and have much more space to install packages and even have a swap partition on the HD.
Regarding Asterisk, I'm using the unslung version as a home PBX for more than 6 months and it works fine with G711 and GSM codecs.
Voicemail also works perfect, including sending the messages in email.
I use a Sipura SPA 3000 as phone adapter and gateway to PSTN.
This seems really cool that you can run asterisk off a WRT54gs box. Has anybody tried the G711u codec and does it work off this box? The reason I ask, I use VOIPSTUNT to make free calls worldwide but I think they only support G711u not GSM.
Does the IVR / Auto attendant / Hold music features still work?
I'm correctly new to Linux / Asterisk. Current playing around with Asterisk@home 2.5 image installed in VMWARE.. pretty cool for practice and no major timing issues. Call quality is pretty good to.. Running off my XP PC Pentium 4 - 1400 with 256mb / SDRAM. (128mb xp / 128mb Asterisk server)
I currently have WRT54G version 2.0 - would it work on this? I guess not because of 4mb flash?
Just want to wish you a very happy birthday--one day late. Hope you had a great weekend and that your work goes well this coming week. Take time to enjoy all the pleasures of NYC--you seem like a big city kind of guy.