Asterisk on a Linksys NSLU2

From JoatWiki
Jump to: navigation, search

Asterisk on a Linksys NSLU2

(23 May 2009) - Following are my notes on building small Asterisk servers on NSLU2s (AKA slugs), using readily available packages. This was part of a technical and economical challenge posed by Sparks. The challenge came out of a late-night discussion concerning his desktop system. I'd watched him build it and still drool over its capabilities. While he enjoys using it, he doesn't enjoy what it does to his electric bill.

As he was only looking for an Asterisk server, I suggested a "re-purposed" NSLU2 as it only draws 10 watts or so (5V x 2A, as marked on the wall wart). During the build-out of this project, zENGx expressed interest in the project. This meant adding a third NSLU2 and complicating the configure a bit.

Originally, I attempted to build Asterisk from scratch, in a development environment onboard the NSLU2. It became apparent pretty quickly that building kernel modules directly on the NSLU2 was not something that is supported and I didn't want to devote more than a Saturday in the attempt (which is what occurred). As the primary interest is in having a working rig, the following is our notes for building out the architecture using OpenVPN 2.1 and Asterisk 1.4. Building Asterisk 1.6 will come later (using a different article).

Contents

Feature Wish List

(from discussions between Sparks, zENGx, and joat)

  • Low power - This is the primary goal, so that it can be left on 24/7 and not run up the power bill.
  • SIP - A must have.
  • IAX - Optional. A very-nice-to-have, to support inter-server SMS message handling.
  • POTS access - Not needed at this time but a nice-to-have.
  • Voice mail - A very-nice-to-have feature. We may be forced to employ external voice mail services.
  • SSH and screen - Command line access is a must. The screen feature falls into the "really nice to have" category.
  • CenterIM - A quite powerful IM.
  • Encryption of some sort for the voice streams.
  • Asterisk interface to the wake-on-LAN function.

Limitations and Trade-offs

  • The stated limitation of four concurrent calls really isn't an issue. Expected use is, at most, two concurrent calls. Will need to edit rtp.conf to correspond to this limit.
  • The stated limitation to ulaw and alaw codecs isn't an issue for now. need link to source
  • Compiling anything on the NSLU2 takes a long time! Compiling anything that involves building new kernel modules needs to be done on a cross-compiler. Thus, compiling Asterisk from scratch isn't going to happen any time soon (need to build a cross-compile environment first).
  • Voicemail probably won't occur on the NSLU2 as USB storage is slow, usually scarce, and not tolerant of a large number of rewrites (remember: we're using vendor swag for storage!).
  • OpenVPN on the NSLU2 doesn't seem to be able to use AES-256-CBC, though it does work with AES-128-CBC.

The Hardware

Not much more needed here than the NSLU2 and a VoIP phone at each site. Need a description of the box here.

Installing the Operating System

Figuring out which version of the firmware to install is probably the hardest part of the process. I originally chose the OpenSlug/BE distro because of the ability to natively compile and because more than two drives can be attached to the Slug (this may be important later). Also, MySQL, Perl, and Zlib are already available as packages. You'll probably want to read this page and the pages that it links to while trying to decide. I highly recommend reading everything before attempting an install.

1) Once you've figured out what firmware you want, visit the SlugOS download page (I grabbed the "SlugOS/BE 5.3 Beta (NSLU2)").

2) Next, using your favorite package manager (for your desktop or laptop system), install the upslug2 utility on your desktop or laptop. Both Fedora and Ubuntu have this as an available package.

3) Using your favorite file manager (Windows or Unix) copy anything off of the thumb drive that you're going to use as storage for the Slug. For this project, I'm using one of the 1 GB thumb drives that I obtained as conference swag.

4) Hook the NSLU2 into the hub or switch that your desktop (or laptop) system uses.

5) Boot the NSLU2 in upgrade mode by turning off the device and removing all USB devices. While holding the reset button in (it's on the back, just above the power jack), push the power button on the front. After about 10 seconds, the top LED should turn red. Release the reset button immediately. The LED should start flashing red and green. This page provides more discussion on using the reset button and the LED colors.

6) On your desktop, open a terminal and run "upslug2" without any arguments. You should see something similar to the following. If you don't, check your cables and connections. (Note: upslug2 must be run as root.) Make note of the MAC address.

root@desk:~# upslug2
NSLU2     00:14:bf:71:19:dd Product ID: 1 Protocol ID: 0 Firmware Version: R23V63 [0x2363]

7) (As root) Create a working directory and move the zip file (that you downloaded in step #1) into it.

root@desk:~# mv /home/joat/Desktop/SlugOSBE-5.3-beta-firmware.zip .
root@desk:~# ls
SlugOSBE-5.3-beta-firmware.zip
root@desk:~# mkdir work
root@desk:~# mv SlugOSBE-5.3-beta-firmware.zip work/

8) cd into the working folder and unzip the file.

root@desk:~# cd work/
root@desk:~/work# unzip SlugOSBE-5.3-beta-firmware.zip 
Archive:  SlugOSBE-5.3-beta-firmware.zip
  inflating: LICENSE                 
  inflating: README                  
  inflating: slugosbe-5.3-beta-nslu2.bin  

9) From your working directory, push the new firmware to the device using the upslug2 utility and the MAC address you noted earlier. (See this page for more discussion on use of the upslug2 utility.)

upslug2 --target="00:14:bf:71:19:dd" --image="slugosbe-5.3-beta-nslu2.bin" 

You should see the following followed by a line with a bunch of exclamation points (it was impossible to capture):

Upgrading LKG7119DD 00:14:bf:71:19:dd
   . original flash contents  * packet timed out
   ! being erased             - erased
   u being upgraded           U upgraded
   v being verified           V verified 

 Display:
   <status> <address completed>+<bytes transmitted but not completed>
 Status:
   * timeout occured          + sequence error detected

Let it run. It'll switch to a line with upper and lower case U's, then V's, then the device will reboot and the command line will look like:

root@desk:~/work# upslug2 --target="00:14:bf:71:19:dd" --image="slugosbe-5.3-beta-nslu2.bin"
Upgrading LKG7119DD 00:14:bf:71:19:dd
   . original flash contents  * packet timed out
   ! being erased             - erased
   u being upgraded           U upgraded
   v being verified           V verified 

 Display:
   <status> <address completed>+<bytes transmitted but not completed>
 Status:
   * timeout occured          + sequence error detected

 7fffff+000000 ...VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Rebooting... done

The top LED will flash yellow-green for awhile. Let it alone until the you hear a beep or two and the top LED switches to a solid green. At this point, your installation of the basic system is complete.

10) If you've never used the device before, the IP address for it will be 192.168.1.77. If you've used it before and have forgotten what IP address you assigned, the device can be located by running nmap (remember, this is stuff coming out of my junk box):

root@desk:~/work# nmap -sP 192.168.1.2-254

Starting Nmap 4.76 ( http://nmap.org ) at 2009-05-22 23:19 EDT
Host 192.168.1.9 appears to be up.
MAC Address: 00:1D:0D:AE:F5:2E (Sony Computer Entertainment)
Host 192.168.1.22 appears to be up.
MAC Address: 00:06:25:F9:BA:C8 (The Linksys Group)
Host 192.168.1.78 appears to be up.
MAC Address: 00:14:BF:71:19:DD (Cisco-Linksys)
Host 192.168.1.144 appears to be up.
MAC Address: 00:0B:82:09:C7:A4 (Grandstream Networks)
Host 192.168.1.150 appears to be up.
MAC Address: 00:13:10:D4:31:5F (Cisco-Linksys)
Host 192.168.1.155 appears to be up.
MAC Address: 08:00:27:74:24:89 (Cadmus Computer Systems)
Host 192.168.1.175 appears to be up.
Nmap done: 253 IP addresses (7 hosts up) scanned in 5.44 seconds

So for me, the IP address is 192.168.1.78.

Configuring the Operating System

Right after install, you have about 6 MB of storage space (not much!) and (probably) a non-permanent IP address to worry about (i.e., it's a good idea to configure the box with more permanent settings and add primary storage). The utility that performs the needed actions is called "turnup" and is discussed here.

To set up the network configuration, log into the slug via ssh (user=root, pass=opeNSLUg):

ssh root@192.168.1.178

It should respond with something like:

joat@desk:~$ ssh root@192.168.1.78
The authenticity of host '192.168.1.78 (192.168.1.78)' can't be established.
RSA key fingerprint is 17:cc:52:48:73:2f:ab:e1:e3:95:61:92:03:fb:11:d1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.78' (RSA) to the list of known hosts.
root@192.168.1.78's password: 
root@LKG7119DD:~#

Next, run "turnup init". This script will prompt you to change the password and set the usual values for network configuration. If an item is displayed in square brackets, it the current value. You can accept this value by just hitting return. Example from my system:

root@LKG7119DD:~# turnup init
Please enter a new password for 'root'.
The password must be non-empty for ssh login to succeed!
Changing password for root
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password: 
Re-enter new password: 
Password changed.
Host name [LKG7119DD]: 
Domain name [workgroup]: 
Boot protocol (dhcp|static) [static]: 
IP address [192.168.1.78]: 
IP netmask [255.255.255.0]: 
IP gateway [192.168.1.1]: 
First DNS server [68.10.16.25]: 
Second DNS server [68.10.16.30]: 
Third DNS server []: 
turnup init: you must reboot for the changes to take effect
 You may want to run 'turnup preserve' to save these settings,
 after making any additional configuration changes which you
 require.
root@LKG7119DD:~#

Next, run "turnup preserve" to save these settings.

root@LKG7119DD:~# turnup preserve 
/sbin/sysconf: umounting any existing mount of /dev/mtdblock4
25 blocks
++*; done
root@LKG7119DD:~# 

At this point, type "reboot" to restart the system with the new values. Once the system comes up, plug in the thumb drive. Note: If you screw up the install on the thumb drive, this is the point that you can come back to and re-install the system on the thumb drive.

The NSLU2 wiki jumps write to creating a file system. As my flash drive was vendor swag, I had to first delete the content on the drive, and then delete the partitions (would you believe there were four?!). I did this via "fisk /dev/sda". While in fdisk, the current partitions can be shown via the "p" command. Also, please note that my slug did not automount the thumb drive so I didn't need to unmount it. If the slug auto-mounted the thumb drive, unmount it.

root@LKG7119DD:~# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000 MB, 1000341504 bytes
31 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1   ?      998934     1282200   272218546+ 20 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(356, 97, 46) logical=(998933, 27, 59)
Partition 1 has different physical/logical endings:
     phys=(357, 116, 40) logical=(1282199, 25, 23)
Partition 1 does not end on cylinder boundary
/dev/sda2   ?      692084      972509   269488144  6b Unknown
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(288, 110, 57) logical=(692083, 10, 57)
Partition 2 has different physical/logical endings:
     phys=(269, 101, 57) logical=(972508, 1, 52)
Partition 2 does not end on cylinder boundary
/dev/sda3   ?      280432     1007988   699181456  53 Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(345, 32, 19) logical=(280431, 16, 18)
Partition 3 has different physical/logical endings:
     phys=(324, 77, 19) logical=(1007987, 20, 49)
Partition 3 does not end on cylinder boundary
/dev/sda4   *      725613      725624       10668+ 49 Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(87, 1, 0) logical=(725612, 22, 36)
Partition 4 has different physical/logical endings:
     phys=(335, 78, 2) logical=(725623, 25, 44)
Partition 4 does not end on cylinder boundary

Partition table entries are not in disk order

The current partitions can be deleted by using the "d" command.

Command (m for help): d
Partition number (1-4): 4

Command (m for help): d
Partition number (1-4): 3

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Selected partition 1

To check that all partitions have been deleted from the table, use the "p" command.

Command (m for help): p

Disk /dev/sda: 1000 MB, 1000341504 bytes
31 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes

   Device Boot      Start         End      Blocks  Id System

A new partition can be created with the "n" command. Note that I chose to set up only one partition by just accepting the defaults (just hitting return).

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1016, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1016, default 1016): Using default value 1016

Check the current table again via the "p" command.

Command (m for help): p

Disk /dev/sda: 1000 MB, 1000341504 bytes
31 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1        1016      976375+ 83 Linux

Save the changes and exit fdisk with the "w" command.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table
root@LKG7119DD:~#

(This is where we catch up with notes on the NSLU2 wiki.) Create an EXT3 file system on the thumb drive by running "mkfs.ext3 /dev/sda1":

root@LKG7119DD:~# mkfs.ext3 /dev/sda1
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
122112 inodes, 244093 blocks
12204 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
15264 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LKG7119DD:~# 

While the thumb drive is still not mounted, copy the operating system to the thumb drive with the turnup command. This process only takes a few seconds.

root@LKG7119DD:~# turnup memstick -i /dev/sda1
/sbin/turnup: umounting any existing mount of /dev/mtdblock4
turnup: copying root file system
17156 blocks
done
rootdir=/tmp/rootfs.928
table='/tmp/flashdisk.928/etc/device_table'
root@LKG7119DD:~# 

Reboot the system at this point.

To check if the above was successful, log back into the machine and run the "df" command.

joat@desk:~$ ssh root@192.168.1.78
root@192.168.1.78's password: 
root@LKG7119DD:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 6400      5472       928  86% /initrd
/dev/sda1               961004     27940    884248   3% /
/dev/sda1               961004     27940    884248   3% /dev/.static/dev
udev                      2048        36      2012   2% /dev
tmpfs                    15120        20     15100   0% /var/volatile
tmpfs                    15120         0     15120   0% /dev/shm
root@LKG7119DD:~# 

Note that the root directory ("/") is now on the thumb drive (/dev/sda1) and that we have roughly 900M to play with. You now have a working operating system.

Adding a Swap File

Some of what we're going to be doing is going to require more memory than what the NSLU2 has, so we're going to need a swap file. I'm only guessing at the size needed but I'm betting that I'll need more than the 32M added in the NSLU2 wiki. I'll set it for 200 MB.

Create the swap file via "dd if=/dev/zero of=/swapfile bs=1M count=200":

root@LKG7119DD:~# dd if=/dev/zero of=/swapfile bs=1M count=200
200+0 records in
200+0 records out
root@LKG7119DD:~# 

Tell the operating system to use it via: "mkswap /swapfile":

root@LKG7119DD:~# mkswap /swapfile
Setting up swapspace version 1, size = 209711104 bytes
root@LKG7119DD:~# 

You next want to configure your file system so that the swap file is available automatically during boot up. First, make a back up copy of /etc/fstab by running "cp /etc/fstab /etc/fstab.backup".

root@LKG7119DD:~# cp /etc/fstab /etc/fstab.backup
root@LKG7119DD:~#

The add a line for the swap file to /etc/fstab by running the following:

echo '/swapfile swap swap defaults 0 0' >>/etc/fstab

Note that there's two greater than symbols before "/etc/fstab". Two of those will append a line to the existing file. One overwrites the file with just the swap file line. If you mess up and only use one, you can recover the fstab file via: "cp /etc/fstab.backup /etc/fstab".

At this point, to use the swap file, you can either reboot or use the "swapon -a" command. Once you've done either, you can check for free memory via the "free" command.

root@LKG7119DD:~# swapon -a
root@LKG7119DD:~# free
              total         used         free       shared      buffers
  Mem:        30240        28564         1676            0          384
 Swap:       204792            0       204792
Total:       235032        28564       206468
root@LKG7119DD:~# 

Updating the Package Feeds

Update your slug's package feeds by running "opkg update". This will grab the most recent lists of available packages:

root@LKG7119DD:~# opkg update
Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/cross
Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/native/5.3-beta/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/native/5.3-beta/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/native
root@LKG7119DD:~#

Setting the Time Zone for Your Slug

Install the time zone package and link the appropriate time zone file to your local file. The package in installed via "opkg install tzdata":

root@LKG7119DD:~# opkg install tzdata
Installing tzdata (2007k-r4) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/tzdata_2007k-r4_armv5teb.ipk
Configuring tzdata
root@LKG7119DD:~#

The linking is done via the "ln" command. You can see the available zones by typing in the leading part of the line and then hitting the tab key a couple times:

root@LKG7119DD:~# ln -s /usr/share/zoneinfo/America/
/usr/share/zoneinfo/America/Anchorage
/usr/share/zoneinfo/America/Caracas
/usr/share/zoneinfo/America/Chicago
/usr/share/zoneinfo/America/Denver
/usr/share/zoneinfo/America/Los_Angeles
/usr/share/zoneinfo/America/New_York
/usr/share/zoneinfo/America/Sao_Paulo
root@LKG7119DD:~# ln -s /usr/share/zoneinfo/America/

Link the proper zone file by selecting the proper zone and soft-linking it to /etc/localtime. If the slug complains about /etc/localtime already existing, remove it and try again.

root@LKG7119DD:~# ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
ln: /etc/localtime: File exists
root@LKG7119DD:~# rm /etc/localtime
root@LKG7119DD:~# ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Note: this time zone info is loaded at log in time. If you check the date, log out, log in, and recheck the date (at this point), you should notice a difference:

root@LKG7119DD:~# date
Sun May 24 00:49:47 UTC 2009
root@LKG7119DD:~# exit
Connection to 192.168.1.78 closed.
joat@desk:~$ ssh root@192.168.1.78
root@192.168.1.78's password: 
Last login: Sat May 23 20:21:43 2009 from 192.168.1.175
root@LKG7119DD:~# date
Sat May 23 20:50:05 EDT 2009
root@LKG7119DD:~# 

Adding the Standard Package Set (SPS)

At this point, the NSLU2 wiki advises the installation of a standard set of packages. If this slug were only going to be a quick install of Asterisk, I wouldn't install the extra packages. Because Sparks wants to do a few other things with this box, I'm adding them to this box (hopefully we won't need the space later). Note that I've left out the joe and nano editors that were recommended by the NSLU2 wiki. Also note that this downloads and installs (sometimes reinstalls) a lot of code, so it takes a bit of time to complete.

root@LKG7119DD:~# opkg -force-overwrite install bash file gawk util-linux procps coreutils    
Installing bash (3.2-r7) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/5.3-beta/bash_3.2-r7_armv5teb.ipk
package ncurses suggests installing ncurses-terminfo
Installing ncurses (5.4-r16) to root...
.
.
a number of lines removed for brevity
.
.
Configuring util-linux-umount
update-alternatives: Linking //bin/umount to umount.util-linux
root@LKG7119DD:~#

Installing the Optware Repository

Asterisk 1.6 is currently available via the Optware respository, so that needs to be added. This is done via the "setup-optware script".

root@LKG7119DD:~# setup-optware.sh 
Connecting to ipkg.nslu2-linux.org (140.211.169.169:80)
slugos5be-bootstrap_ 100% |*******************************|   214k 00:00:00 ETA
Optware Bootstrap for slugos5be.
Extracting archive... please wait
bootstrap/
bootstrap/bootstrap.sh
bootstrap/ipkg-opt.ipk
bootstrap/ipkg.sh
bootstrap/optware-bootstrap.ipk
bootstrap/wget.ipk
1072+1 records in
1072+1 records out
219822 bytes (220 kB) copied, 0.248045 seconds, 886 kB/s
Creating temporary ipkg repository...
Installing optware-bootstrap package...
Unpacking optware-bootstrap.ipk...Done.
Configuring optware-bootstrap.ipk...Setting up ipkg arch-file
Done.
Installing ipkg...
Unpacking ipkg-opt.ipk...Done.
Configuring ipkg-opt.ipk...Done.
Removing temporary ipkg repository...
Installing wget...
Installing wget (1.11.4-1) to root...
Configuring wget
Successfully terminated.
Creating /opt/etc/ipkg/cross-feed.conf...
Setup complete.

Note: this installs the older ipkg tool for the Optware tools, so you'll be using opkg for anything in the SlugOS repository and ipkg for anything in the Optware repository.

To update the list of available packages (currently nothing resides in the list), you need to run "ipkg update".

root@LKG7119DD:/var/volatile/tmp# ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/cross
Successfully terminated.
root@LKG7119DD:/var/volatile/tmp#

Installing Asterisk

You can view what packages are available by typing "opkg list|more" and/or "ipkg list|more". Currently, Asterisk 1.4 is available via either distro but Asterisk 1.6 is only available via the Optware repository.

To install Asterisk 1.6, run "ipkg install asterisk16" and "ipkg install asterisk16-addons".

Note: Until further notice, use asterisk14 vice asterisk16. For some reason, 1.6 refuses to pass audio. 1.4 works nicely though.

root@LKG7119DD:/var/volatile/tmp# ipkg install asterisk16
Installing asterisk16 (1.6.0.9-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/asterisk16_1.6.0.9-1_armeb.ipk
package asterisk16 suggests installing asterisk14-core-sounds-en-alaw
package asterisk16 suggests installing asterisk14-core-sounds-en-g729
package asterisk16 suggests installing asterisk14-core-sounds-en-gsm
package asterisk16 suggests installing asterisk14-core-sounds-en-ulaw
package asterisk16 suggests installing asterisk14-extra-sounds-en-alaw
package asterisk16 suggests installing asterisk14-extra-sounds-en-g729
package asterisk16 suggests installing asterisk14-extra-sounds-en-gsm
package asterisk16 suggests installing asterisk14-extra-sounds-en-ulaw
package asterisk16 suggests installing asterisk14-moh-freeplay-alaw
package asterisk16 suggests installing asterisk14-moh-freeplay-g729
package asterisk16 suggests installing asterisk14-moh-freeplay-gsm
package asterisk16 suggests installing asterisk14-moh-freeplay-ulaw
asterisk16: unsatisfied recommendation for asterisk14-gui
package asterisk16 suggests installing libogg
package asterisk16 suggests installing net-snmp
package asterisk16 suggests installing radiusclient-ng
package asterisk16 suggests installing sqlite2
package asterisk16 suggests installing unixodbc
package asterisk16 suggests installing jabberd
package asterisk16 suggests installing iksemel
package asterisk16 suggests installing x11
Installing openssl (0.9.8k-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/openssl_0.9.8k-1_armeb.ipk
Installing ncurses (5.7-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/ncurses_5.7-1_armeb.ipk
Installing libcurl (7.19.5-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/libcurl_7.19.5-1_armeb.ipk
Installing zlib (1.2.3-3) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/zlib_1.2.3-3_armeb.ipk
Installing termcap (1.3.1-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/termcap_1.3.1-2_armeb.ipk
Installing libstdc++ (6.0.9-6) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/libstdc++_6.0.9-6_armeb.ipk
Installing popt (1.15-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/popt_1.15-1_armeb.ipk
Configuring asterisk16
Configuring libcurl
Configuring libstdc++
Configuring ncurses
update-alternatives: Linking //opt/bin/clear to /opt/bin/ncurses-clear
Configuring openssl
Configuring popt
Configuring termcap
Configuring zlib
Successfully terminated.
root@LKG7119DD:/var/volatile/tmp# ipkg install asterisk16-addons
Installing asterisk16-addons (1.6.0.1-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/asterisk16-addons_1.6.0.1-1_armeb.ipk
Installing mysql (4.1.22-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/mysql_4.1.22-2_armeb.ipk
Installing readline (5.2-2) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/slugos5be/cross/unstable/readline_5.2-2_armeb.ipk
Configuring asterisk16-addons
Configuring mysql
Installing all prepared tables
Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
 
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/bin/mysqladmin -u root password 'new-password'
/opt/bin/mysqladmin -u root -h LKG7119DD password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt ; /opt/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /opt/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Starting MySQL. SUCCESS! 
Configuring readline
Successfully terminated.
root@LKG7119DD:/var/volatile/tmp#

As Asterisk relies on MySQL, you'll want the database service to start at boot. To cause this, copy the mysql.server script to /etc/init.d via:

cp /opt/share/mysql/mysql.server /etc/init.d/
ln -s /etc/init.d/mysql.server /etc/rc3.d/S99mysql
ls -s /etc/init.d/mysql.server /etc/rc0.d/K01mysql

The second line above causes MySQL to start at boot. The third line causes it to stop at shutdown.

If you want to set a password for root access to MySQL (this is highly recommended!), run the following:

/opt/bin/mysqladmin -u root password 'new-password'
/opt/bin/mysqladmin -u root -h LKG7119DD password 'new-password'

where "new-password" is whatever password you want to use for root and "LKG7119DD" is the hostname of your slug (Be sure to change it to whatever yours is! LKG7119DD is the name of my slug!) This second line is not needed (and probably won't work) unless you configure MySQL to listen on the network (vice a local socket). If you need MySQL to listen on a network port, comment out the "skip-networking" line in /opt/etc/my.cnf and restart the service.

To be sure that the above works, reboot the system, login and run "ps ax|grep mysql". The output should look something like:

root@LKG7119DD:/opt/etc# ps ax|grep mysql
 4349 pts/0    S      0:00 /bin/sh /opt/bin/mysqld_safe --datadir=/opt/var/lib/mysql --pid-file=/opt /var/lib/mysql/LKG7119DD.pid
 4382 pts/0    Sl     0:00 /opt/libexec/mysqld --basedir=/opt --datadir=/opt/var/lib/mysql  --user=root --pid-file=/opt/var/lib/mysql/LKG7119DD.pid --skip-external-locking --port=3306  --socket=/tmp/mysql.sock
 4390 pts/0    S+     0:00 grep mysql
root@LKG7119DD:/opt/etc#

Installing IPTables

Installing OpenVPN

Update to this section coming soon. - joat (2 June 2009)

OpenVPN can be configured in a number of ways. The target configuration for us was "limited peer" in that we wanted to see into each other's networks but with a locally controlled filter (i.e., peered network with a firewall limiting the access).

opkg install openvpn
opkg install openvpn-doc
  1. http://www.nslu2-linux.org/wiki/HowTo/SetUpOpenVPNServer

Tweaks

  1. You must declare "bindaddr" in Asterisk's sip.conf and iax.conf files! Otherwise, Asterisk may use the IP addresses for your VPN end points. In our tests, calls still went through, they were just "outside" of the encryption.

Troubleshooting

Crossed out lines in "Issues" are described in "Fixes".

Issues

  • (Sparks) There is an external hard drive that the slug absolutely refuses to recognize. It's formatted EXT3, the slug says VFAT and no FAT table.
  • (All) With iptables, attempts to run "-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT" were met with "No chain/target/match by that name"

Fixes

Inability to find FAT table

Let's just say that the cause was nothing that anyone wants to admit to, okay? (heh)

No state in IPTables

(29 May 2009) One of the things that gave us fits for awhile was the following error:

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables: No chain/target/match by that name

A lot of people have had this error, very few actually posted the fix, once they'd discovered it. It's simple, we were missing a pkg and the simple fix turned out to be:

opkg install kernel-module-xt-state

Thanks go to Toby, Sven, Jost, and cooper for providing the pointer to the solution by writing the IP Masquerading HOWTO.

Sources and Additional Reading

To Do

  • fix bash
  • third leg
  • startup scripts
  • NTP
  • document this puppy!





Comments:

Leave a Comment

Personal tools