Astlinux Instructions for SIP.edu Users 2005-11-27 jtodd@tello.com http://www.loligo.com/asterisk/astlinux Here are some basic instructions for getting a Soekris 4801 with Sangoma card to work with Astlinux as a basic SIP gateway, attached to a PBX or switch via a PRI. This set of instructions should be treated more as a "guideline" than a literal guide, even though it is written with explicit instructions. These instructions assume a reasonable amount of UNIX literacy. Only a few files need to be modified for the "standard" SIP.edu termination/origination. If you have a different configuration requirement set (i.e.: a channelized T1 instead of a PRI) then you may refer to Asterisk documentation as to how to change Asterisk's configurations to support the different line encodings. This configuration example is for SIP.edu users, but any Astlinux user may find the methods enclosed useful for their own implementation of Astlinux on Soekris platforms. The Astlinux system is a basic Linux kernel plus Asterisk, and drivers for the Sangoma T1/E1 A101/2 cards. You can find the device with Sangoma bundle here: http://www.soekris.com/bundles.htm (pricelist item 11480153 - ~$646) Make sure you also buy a 110v power adapter (pricelist item 31321215, ~$15) with your order. You'll also need a 32mb or larger Compact Flash card from a third party. Astlinux assumes that you are going to be running on a Compact Flash card AND a USB keydisk. However, since this system will see very little modification and no "active" filesystem components like voicemail, we can leave everything on the Compact Flash which means there a few "different" things that are implied in our configuration (notably changing a very few directory paths.) All of the config files and settings will be stored on the CF disk and there will be NO USB keydisk required. There are some shortcomings to this, notably that logfiles are not stored across reboots. However, the lack of additional (fragile) components may be seen to make up for the lack of logfiles. Capabilities: - 23 channels of SIP<->PRI mapping - PRI->SIP lookups/dialing of E.164 numbers in ENUM (various "root" trees) - PRI->SIP lookups/dialing of E.164 numbers in Tello database (optional) - PRI->SIP lookups/dialing of ISN (ITAD Subscriber Numbers) - SIP->PRI mapping of partial/complete E.164 numbers on PBX - SIP->PRI mapping of usernames to partial/complete E.164 numbers on PBX INSTALLATION There are three ways that you can get this running on a device of your own: 1) Download everything from the relevant locations, follow the extensive instructions below to get the Soekris system up and running in a suitable manner, and install/edit the sample Asterisk files. [asterisk files not complete yet] 2) [not complete yet] Download the Compact Flash image that is supplied on http://www.loligo.com/***** and copy it to your compact flash card, avoiding a lot of the operating system fiddling and file manipulation. Only modification of a few files is required to get running. 3) [not complete yet] Send in the form labelled "SIP.edu-Install-Questions" found on http://www.loligo.com/***** to jtodd@tello.com, send him $10 via PayPal, and a pre-formatted and configured Compact Flash card will appear in your mailbox in a few days, ready for installation and operation. ---- Start of Instructions ---- 1) Download the 0.2.9 image to your hard drive: zot# cd /tmp zot# wget "http://mirror.krisk.org/AstLinux-0.2.9-net4801.img.gz" You should end up with a file named "AstLinux-0.2.9-net4801.img.gz" in your directory. It's about 14.4 megabytes in size. 2) Insert the Compact Flash card in your laptop or desktop machine. Using the "mount" command, determine where the CF card is mounted. Note the "disk" number (i.e.: /dev/disk3s1 means that the disk number is 3) Ensure that all data has been removed from the card, since we're going to be formatting the card. The card in the example below is called "NO NAME". [example shown from an Apple MacOSX laptop] zot# mount /dev/disk0s5 on / (local, journaled) devfs on /dev (local) fdesc on /dev (union) on /.vol /dev/disk1s9 on /Volumes/ExternalFirewire1 (asynchronous, local, nodev, nosuid, mounted by jtodd) /dev/disk2s9 on /Volumes/Weasels (local, nodev, nosuid, mounted by jtodd) automount -nsl [451] on /Network (automounted) automount -fstab [454] on /automount/Servers (automounted) automount -static [454] on /automount/static (automounted) /dev/disk3s1 on /Volumes/NO NAME (local, nodev, nosuid) zot# If you're running Linux or Windows, I'm afraid I have no immediate help for you but I'm sure that a Google search will start to give you some clues on how to mount/write the image to the appropriately named flash device driver on your system. 3) Unmount the drive, but don't remove the card. This makes the card available for raw read/writes. Use the command line version of "umount" in MacOS; don't use the graphical editor. zot# umount /dev/disk3s1 4) Copy the image onto the CF card: zot# gzcat -c AstLinux-0.2.8-net4801.img.gz > /dev/disk3 You should see no errors or output as a result of this command, typically. If the operating system complains about "unknown disk" before you eject, hit the "ignore" or "cancel" button - you don't want to reformat. 5) Remove CF card from your laptop (ignore the unmounting errors) and put into the Soekris 4801. 6) Attach a serial cable to the Soekris, and fire up the terminal emulation program of your choice to communicate over the serial port. You'll need a null modem. Settings are 19200/8/N/1. 7) Connect a network connection (RJ45 Ethernet) to the eth0 interface on the Soekris. This LAN segment should have a DHCP server. This step is not mandatory, but is convenient. Further discussion below assumes that you have Internet access for updates and downloads. You will not need this to be on DHCP forever; just for the "bootstrap" process of configuration. 8) Power up the Soekris. You should see a boot screen for the Soekris, then the output of Linux booting. See the "dmesg-0.2.8.txt" file for details of what it should look like. 9) If you get a failure message with something like this: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) Then you will need to reboot the device and fix the boot commands. At the GRUB menu (where it asks which kernel to use) you should hit 'e' to edit the boot commands. Edit the boot line and change all references of "hda1" to "hdb1" The system should boot. Login and modify /boot/grub/grub.conf to make these changes permanently. (note: filesystem must be mounted RW with "mount -o rw,remount /" first) 10) The username is "root" and the default password is "astlinux" - log in. 11) First, change the root password with "passwd" (note: system automatically mounts itself read/write and then remounts as read-only after "passwd" is executed, so any further changes to the disk will be impossible without issuing a "mount -o rw,remount /" command after "passwd" has completed. While not important if you are following these instructions to the letter, it is worth noting to prevent future frustration.) 12) [***DON'T RUN THIS INSTRUCTION*** This doesn't work as of 2005-11-21 with 0.2.9 - check to see if astup has been fixed before running this step. No major problems if you don't run it. I've left this step included since eventually it will be "fixed".] Run "astup", which will upgrade any applications via rsync over the Internet from Kristian Kielhofner's site, which has the latest updates to various code bits. Answer "yes" to the questions (the default answers) 13) Next, let's get all the extra apps and goodies. a) Open your CF card in fdisk with "fdisk /dev/hda" (where hda is your CF card; it might be "hdb" depending on what happened in prior steps.) b) Press "n" to make a new partition. c) Press "p for a primary partition. d) Press "2" for partition 2. e) Hit return for the defaults on starting cylinder and last cylinder. f) Press "w" to save your changes and exit. Ignore the "device or resource busy" error if you get one. g) Reboot by typing "reboot", and log back in j) Create the filesystem on /dev/hda2 - type "mke2fs /dev/hda2" i) Reboot again. Log back in as root. j) You should see hda2 in the list of filesystems displayed by typing "mount" - the system should have mounted it as /mnt/opt l) When the filesystem has mounted, run the "mkopt" script to download the AstLinuxOpt package to your new partition. The script will automatically check to ensure that /mnt/opt (the new location of this extended filesystem) is mounted. 14) Change the CF drive to be temporarily read/write: pbx etc # mount -o rw,remount / 15) Fix sshd. NOTE: There is an emacs-like editor called "nano" on the system once you get the extra apps, if you're like me and hate vi. a) Copy all current keys to /stat/etc/ssh: cp /etc/ssh/* /stat/etc/ssh b) Edit /etc/init.d/sshd and modify this line so that the ssh keys are kept across boots: original(~7th line from top): if [ -f /mnt/kd/ssh/ssh_host_key ] modified: if [ -f /stat/etc/ssh/ssh_host_key ] 16) Edit the /stat/etc/rc.conf file. - Change these lines to suit: ## System Domainname ## DOMAIN=tello.com HOSTNAME=poptart - Change your timezone TIMEZONE=GMT (other options would be "America/Los_Angeles", "America/Chicago" or "America/New_York" as examples) - Edit the IP address, netmask, default gateway, and nameservers of the device for static use (per your site's config) EXTIP="192.168.25.2" EXTNM="255.255.255.0" EXTGW="192.168.25.1" DNS="192.168.1.1 192.168.1.2 192.168.1.3" - I would suggest rebooting to ensure all this is written and runs correctly. Remember you'll need to re-mount the system (mount -o rw,remount /) after the reboot to continue editing the files below. 17) Edit/create a new file called /stat/etc/zaptel.conf and insert these lines: span=1,0,0,esf,b8zs bchan=1-23 dchan=24 loadzone = us defaultzone=us 18) Edit /stat/etc/asterisk/zapata.conf and add these lines to the end of the file: switchtype = national signalling = pri_cpe group = 1 channel => 1-23 These last two steps assumes a "national" signalling method for the PRI, and that all 23 channels are used in a very "vanilla" setup for a PRI. If you're running some other type of signalling, you'll need to alter this to suit. If your switch/PBX expects the PRI from the Asterisk device to be "central office" signalling format, change "pri_cpe" to "pri_net". For more details on configuring the Zaptel portions of Asterisk, please consult the web-based documentation for Asterisk or http://www.voip-info.org/ as this is outside the scope of this document. 19) Configure the sangoma card to be a TDM PRI interface. a) Run "wancfg". Note: you may or may not be able to run this application from the console easily. My suggestion is to log into the system via ssh from another machine. b) "C"reate a netw configuration file c) Select "wanpipe1.conf" d) Select from detected cards list e) Choose "AFT-A101u SLOT=10..." [etc.] f) Use all defaults in "Hardware Configuration" menu; select "Back" card type=A101/2 Physical Medium=T1 g) In "Wanpipe Configuration" menu, select "Protocol" h) Select "TDM Voice". Then go "Back" to "Wanpipe Configuration" menu i) select "Interface Setup" j) Select "Interface 1->w1g1" (there are no other options on this page) k) In "Interface Configuration" screen, make your screen match this: Interface Name=w1g1 Operation Mode=TDM_VOICE TDM Voice Span=1 Override Asterisk Echo Enable=Yes TDM PRI HW-HDLC Timeslot=0 Not Used Hardware Echo Cancellation=Yes Hardare Echo Cancellation Map=ALL l) Go back/exit out of various menus. Answer "Yes" to the question of "Do you want to save wanpipe1.conf?" Continue exiting out of application. j) Now, back at a shell prompt, type this: "cp -r /tmp/etc/wanpipe/* /stat/etc/wanpipe/" - this stores the configs permanently. k) NOTE: If you have nothing plugged into the WAN port, your console may be unusable due to error messages! I would suggest plugging in an RJ-45 T1 loopback plug into the device while it is not connected to any T1 equipment to prevent this state. 20) Reboot yet again. 21) Time to go to the web interface. There is a minimal administrative web interface, which can be accessed with HTTPS at the IP address of the external interface, with url /admin. In other words: https://10.0.2.3./admin/ The username is "admin" and the initial password is "astlinux" 22) Change the web administrator password. This is done through the "Setup" menu. 23) Start modifying Asterisk to match what your site requires. This is a whole different set of example files (mostly written but not polished) but the basic configuration is complete and Asterisk should launch correctly at this point with all 23 PRI ports active. JT's custom notes for Asterisk: - add "usernames" file for seed definitions - modify asterisk.conf for exec options permissions: [options] execincludes=yes - Modify modules.conf and add this before the [global] section: ; Modifications by John Todd (jtodd@tello.com) ; let's lighten the load a bit: noload => res_adsi.so noload => chan_skinny.so noload => chan_agent.so noload => chan_mgcp.so noload => pbx_realtime.so noload => pbx_ael.so noload => app_festival.so noload => app_sms.so noload => app_alarmreceiver.so noload => app_getcpeid.so noload => app_adsiprog.so noload => app_zapras.so noload => app_realtime.so noload => app_voicemail.so noload => app_hasnewvoicemail.so noload => app_queue.so noload => format_g729.so noload => format_g726.so noload => format_g723.so noload => format_ilbc.so noload => codec_lpc10.so noload => codec_g726.so noload => codec_ilbc.so - copy extensions.conf to extensions.conf.orig - copy sip.conf to sip.conf.orig - copy sip.conf from my test configs with SIP.edu specifics for the SIP.edu load