Asterisk Installation on OpenWRT

This guide refers to the package of Asterisk version 1.0.10,
tested on the WRT54GL hardware on the OpenWrt 0.9 GNU/Linux distribution, which you may find, for example, here

Index

OpenWrt installation

It’s possible to build your own OpenWrt distribution, customizing the kernel and the packages, by using this buildsystem.
Alternatively, follow this procedure to install a pre-built firmware:

  • Download the most appropriate firmware for your router; with our hardware, for example, the file openwrt-wrt54g-squashfs.bin
  • Be sure to be able to transmit to the router, for example with the command:
    ping 192.168.1.1
  • Turn off the WRT54GL and run, from a Unix like box, the following command (all in one row):
    atftp --trace --option "timeout 1" --option "mode octet" --put --local-file openwrt-wrt54g-squashfs.bin 192.168.1.1
  • Turn on the WRT54GL, which should automatically receive the new firmware and wait some minutes

If you have troubles or if you are installing from a different operating system or architecture, you can refer to this great guide

Preparing OpenWrt

  • Now it should be possible to login in the new OpenWrt installation, with, in our case, the command:
    telnet 192.168.1.1
  • It’s possible to set the root password by running passwd which wll also disable the telnet service in favor of the openbear server, which offers the ssh service
  • To set the 4 LAN ports of the router to get the IP address automatically, by using the DHCP protocol, write the command:
    nvram set lan_proto=dhcpclient
    and then the command:
    nvram commit
    which will save the changes on the flash memory and apply them on the next reboot

Here you will find the documentation of the nvram options

Installing Asterisk

  • Having the OpenWrt router connected to the Internet, update it’s packages database, by running:
    ipkg update
  • Upgrade all the packages to the last version, by running:
    ipkg upgrade
  • Install Asterisk by running:
    ipkg install asterisk

Get Asterisk to start at boot

If you want the Asterisk daemon to start at boot, modify with your favourite text editor the file /etc/default/asterisk changing the row:
ENABLE_ASTERISK=”no”
in
ENABLE_ASTERISK=”yes”

First execution of Asterisk

As the superuser root, from whatever folder you are in, run:
asterisk -vvvc
Asterisk will load it’s modules and it’s configuration, you should then read:
Asterisk Ready.
*CLI>

this is the command line interface of Asterisk, to logout run the command:
stop now

Reboot and verify

Reboot the system with the command:
reboot
after the reboot process, you can verify that Asterisk is running with the command:
asterisk -r
and logout from the command line interface with the command:
exit

Configuring the Asterisk modules

The default Asterisk configuration on OpenWrt disables some modules, in particular some codecs.
Modify in accordance with your needs the directives of the /etc/asterisk/modules.conf file, like, for example:
noload => codec_alaw.so
with
load => codec_alaw.so
obtaining a result similar to this

System optimization

  • The WRT54GL has 4 MB of flash memory, which acts as an hard drive, and 16 MB of RAM.
    By installing Asterisk it will remain less than 1 MB of free space on the flash.
    It’s advisable to disable the logging of Asterisk, by changing with your favourite text editor the file /etc/asterisk/logger.conf, obtaining a result like this

    Also, those are some commands you may find useful:

    • It’s possible to view the partitions usage with the command: df -h
    • Obtain the list of the installed packages with the command: ipkg status|grep Package
    • Uninstall a package with the command, for example: ipkg remove asterisk
  • Even more important is the RAM usage, because going out of RAM and SWAP will result in some service failure, or even a system crash (until the next reboot)

    Here are some commands you may find useful for monitoring memory usage:

    • It’s possible to view the memory usage with the command: free
    • How much memory is using a process with the command: ps
    • With the command top you will have a view, in real time, of the running processes, the CPU percentage usage, the memory usage and the total load on the system

Italian Flag

This guide is also available in Italian


AddThis social bookmarking image button
Creative Commons License

One Response to “Asterisk Installation on OpenWRT”

  1. [...] public links >> openwrt p0f 2.0.8 on openWRT Saved by mileyhannahlover on Sat 20-12-2008 Asterisk Installation on OpenWRT Saved by TemariNara8 on Wed 10-12-2008 [Router] Flashing from OpenWRT to DD-WRT Saved by [...]

Leave a Reply