I'm a big fan of Asterisk on router -- imho, it's the perfect platform for anyone want to try Asterisk at home -- 24x7, fanless and even the cheapest router can handle at least 2-3 concurrent conversation. Before this WZR-HP-G300NH, I had Asterisk running on a WRT54G-TM for over a year with lots of fun.
Installing Asterisk on the router is easier now as current OpenWrt trunk build(the one we use) includes prebuilt Asterisk binaries. As always, since OpenWrt is designed to work with / not /opt, some adjustment is required to get Asterisk working properly.
- Install Asterisk 1.6
Believe it or not, DD-WRT MEGA also has Asterisk included -- it's an old ver1.4 and some important files are missing -- I have no idea why DD-WRT decided to do so, too much flash ROM? Anyway, to install Asterisk 1.6 on our opkg enabled router, run
opkg install asterisk16
You may also want to install some additional modules like:
opkg install asterisk16-res-agi
opkg install asterisk16-res-musiconhold
To view a full list of Asterisk packages(lots of them!), run
opkg list | grep asterisk16 - The configuration file: asterisk.conf
With our installation, the asterisk.conf is in /opt/etc/asterisk/asterisk.conf. Change it to the contents below:
[directories] ; remove the (!) to enable this
astetcdir => /opt/etc/asterisk
astmoddir => /opt/usr/lib/asterisk/modules
astvarlibdir => /opt/usr/lib/asterisk
astdbdir => /opt/usr/lib/asterisk
astkeydir => /opt/usr/lib/asterisk
astdatadir => /opt/usr/lib/asterisk
astagidir => /opt/usr/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk - Asterisk configuration
By default, asterisk loads lots of modules, you can change the settings to fit your needs and reduce memory usage.
Below is a sample of /opt/etc/asterisk/modules.conf with reduced modules:
[modules]
autoload=no ; only load explicitly declared modules
load => app_dial.so
load => app_echo.so
load => app_macro.so
load => app_playback.so
load => chan_sip.so
load => codec_ulaw.so
load => pbx_config.so
load => format_pcm.so
load => format_wav.so
load => func_callerid.so
load => func_strings.so
load => res_musiconhold.so
load => res_agi.so
For SIP users, other important files including /opt/etc/asterisk/extensions.conf and /opt/etc/asterisk/sip.conf. These are not covered here, please refer to website about Asterisk like asteriskguru and voip-info.org. Also, here is a must-read ebook: Asterisk: The Future of Telephony Second Edition(download the PDF book) - Run it as service
Create file /opt/etc/init.d/asterisk with below(delete previous contents if its not empty)
source /mnt/root/.profile
mkdir -p /var/run/asterisk
mkdir -p /var/spool/asterisk
mkdir -p /var/log/asterisk/cdr-csv
/opt/usr/sbin/asterisk -C /opt/etc/asterisk/asterisk.conf
And run
chmod a+x /opt/etc/init.d/asterisk
ln -s /opt/etc/init.d/asterisk /opt/etc/init.d/S95asterisk
[compat]
pbx_realtime=1.6
res_agi=1.6
app_set=1.6
As you can see, by modifying this file, we tell Asterisk to look for files at /opt/etc/asterisk and /opt/usr/lib/asterisk instead of default locations, which fits our installation.
Now try to launch asterisk by running:
asterisk -vvvvvc
Exit by pressing ctrl+c
That's all. Enjoy Asterisk and happy VoIP!
10 comments:
Great blog!
Any chance you can write a tutorial on using ushare? I tried following the DD-WRT tutorial and so far I'm stuck at trying to run it.
My error:
Interface ath0 is down.
Recheck uShare's configuration and try again !
ioctl: Cannot assign requested address
Ath0 is the wireless interface.
Please write how to configure opendchub with scripts
Thanks for this great blog!
I am considering running Asterisk and/or Wireless Hostspot manager(Chillispot, FreeRadius) on a suitable router. This blog sure shed a light on my choice of router. Do you plan to write a tutorial on configuring the WZR-HP-G300NH as a Wireless Hotspot soon.
Evans, Netherlands
Do you have any idea how I could get my Nokia CS-15 3g modem to start on the wzr using dd-wrt?!
On ubuntu I had the same problem until I found a post saying I just have to type " eject /dev/sr1 " in the terminal! And it works great there!
Could it be that simple on the wzr too? What should the commandline look like ?
I´m not an expert on linux but I´m not a retard either :P
Magnus, Finland
sounds great - does having the VOIP system affect the quality of the VPN system at all? im concerned that it will become a bit too much to handle for a small office (4 pcs 2 sip phones)
Can anyone help please... i'm new and i get this error..
root@DD-WRT:/opt# opkg install asterisk16
Collected errors:
* make_directory: Cannot create directory `//usr/lib/opkg': Read-only file system.
* make_directory: Cannot create directory `/usr/lib/opkg': Read-only file system.
* make_directory: Cannot create directory `//usr/lib/opkg': Read-only file system.
* opkg_install_cmd: Cannot install package asterisk16.
root@DD-WRT:/opt#
Thanks in advance.
When I'm trying to run this command: "opkg install asterisk16", dd-wrt says that "-sh: opkg: not found". I have dd-wrt v24 sp2 installed on my router. Can you help me plz?
It would be great if this would work...
In my case when I start asterisk I get huge number of messages like:
loader.c:726 inspect_module: Module 'func_timeout.so' was not compiled with the same compile-time options as this version of Asterisk.
loader.c:727 inspect_module: Module 'res_adsi.so' will not be initialized as it may cause instability.
As result of this... or may be something else I can not load dial plan.
So "dialplan reload" is not valid command with OpenWRT asterisk. If I use "dialplan show" -- my dial plan is not there.
So I can not get working what works fine in Asterisk 1.6 on my desktop.
Anybody was able to get this working???
Great list, just give me a couple of new ideas on what to do next!
hp p1505 driver
Can anyone put here some working sip.conf and extension.conf for several interior phones and for multiple SIP-VSP (voice service provider) accounts ?
Post a Comment