Untangle, Asterisk PBX and File Server; All-in-One. Part 6

If you’ve been following the story so far you’ll now where I am. If you haven’t, please go back to Part 1 and read from there. Alternatively if you do a search for Untangle in the little search box top-left then you should get all of the posts so far.

I have stalled on Untangle due to kernel issues already well documented on here before. The good news is the guys from Untangle are in contact with me and are working on a new kernel for the upcoming 5.1 release. I am hoping to get something to play with in the next few weeks. And it will most likely be based on a 2.6.22 release which is excellent news as that has direct support for my hardware.

So in the meantime I have been installing Samba – which is fairly straightforward – and Asterisk which is a bit more involved.

As you will know, I am using the Linux From Scratch (LFS) project for this server’s operating system. From the same stable, comes the Beyond Linux From Scratch (BLFS) book that contains many (i.e. hundreds) excellent resources and instructions for installing various applications; including Samba. So I will not go into detail about how to build Samba here. The configuration of Samba for my home network is another subject and I will discuss this further once I’m happy with the set up.

Asterisk, the Open Source PBX, is another ballgame entirely. To build asterisk itself from source is not too hard. From an LFS core, there were no dependencies to satisfy first. If you are on a major distro however, you will certainly need to add quite a few -dev packages to your system first. With Ubuntu they have a meta package called build-essentials which will certainly help. Here is a good starting point for information: http://www.voip-info.org/wiki/index.php?page=Asterisk+installation+tips.

To build asterisk for testing purposes, build and install as root*. As I have an x100p analogue FXO card I need to install the zaptel driver first like this (after extracting the source tarball and cd‘ing into it):

./configure --prefix=/usr &&
make menuselect &&
make &&
make install &&
make config

Both this and the Asterisk build expect your kernel source tree (the headers) to be in /usr/src/linux-`uname -r` by default. The make menuselect command will enable you to select which hardware drivers you need and to disable the building of those you do not. make config will install a rc.d script for init so the card is properly initialised during boot-up. Although I had to hack this a bit to work with the LFS/BLFS boot scripts. Even if you do not have any analogue cards, you are recommended to install the zaptel drivers as they can provide timing a source for Inter-Asterisk Trunks (IAX) and conferencing via the ztdummy module.

Once the zaptel modules are installed, repeat a similar process for the Asterisk source:

./configure --prefix=/usr &&
make menuselect &&
make &&
make install

This should build and install the Asterisk server into the /usr hierarchy with the configuration files in /etc/asterisk and the runtime information and sound files under /var. When you run make menuselect pay attention, you can choose whether to install various language files, codecs, add-on sounds (I installed the extra sound files) and other goodies. Here’s a page that should help you get going once again: http://www.voip-info.org/wiki/index.php?page=Asterisk+Compile.

You can elect to install sample configuration files, by typing make samples. This will basically give you a working PBX out of the box for testing purposes. This is sort-of-useful but the files are very complicated and hard to follow, although they are well commented so they make a good reference. I quickly removed the whole /etc/asterisk directory to somewhere else (to keep for reference) and started from scratch with a clean directory.

Learning how to setup asterisk is time consuming. Then comes that moment when, after reading for hours and looking into lots of text files and learning about channels, priorities, applications and contexts, suddenly the penny drops! It will become clear. But don’t rush it and I would strongly recommend NOT going for one of the packaged appliance builds that come with a GUI front end to start with. Why? Because you will never learn what’s under the hood and you will be limited by the GUI designer’s ideas of what you need to configure. Once you ‘get it’, by all means use a GUI, but not before…

For testing you will need a phone 🙂 I know. Obvious but it had to be said. There are plenty of SIP phones on the market that are inexpensive, and there are several “soft phones” that you can run on your PC and use a headset, or mic & speakers. I chose to go the soft phone route for now and tried the following three soft phones for Linux.

  • Ekiga: Formerly Gnome Meeting. Initially I thought this was great but I have had several weird issues with DTMF and sound quality, so this is on the back-burner for now.
  • Wengo Phone: Looks nice, seems to work O.K. but I preferred the User Interface and overall experience of the final one in my list.
  • Twinkle: This just works. Has a simple and easy to use interface and is a cinch to setup. My personal favourite of the three (apart from the name, that is.)

These soft phones I used purely for SIP connectivity on my local LAN to the Asterisk server. There are others that can connect to Asterisk using IAX or H.323 but I didn’t try those, nor see a need to.

Here are a couple of resources I found very helpful along the way:

  • The voip-info.org wiki for Asterisk
  • This excellent short slide presentation (They say a picture paints a thousand words don’t they…)
  • This e-book: The “TFOT” Book (If this site is down, google for it. It’s available from lots of other sources)
  • And google. There is loads of information out there if you are prepared to look for it.

Along with my business partner who has installed Asterisk on his similarly small and low-powered server, we now have fully networked digital PBX functionality (IAX trunking between our servers), Voicemail (with email notification and forwarding), and Dial-in & Dial-out via the PSTN (through the x100p card on my box). Next is to try conferencing and call parking.

Asterisk, Samba Server HardwareWith this little server (shown here with the x100p card installed), I now have Samba, providing a home network file server for all the family, Asterisk running happily and providing advanced digital telephony throughout the house. And all using free and Open Source software. Once I’d bought the hardware, the software costs were zero, and will be zero. How much is Windows Home Server? And more to the point, why do you need it? Oh yes, does it also have a fully fledged enterprise grade digital PBX? And is it secure? (Just like the rest of Windows… lol)

Once I’ve nailed the configuration down and got asterisk running securely*, I’ll post some more on this including configuration details.

* The usual way to install Asterisk from source is by, and as, root. For a test-bed that’s no problem but for a production environment with direct internet connectivity (as this device will have) this is not a good idea. I will spend a little time developing an installation procedure that will install it as a non-root user and with limited privilages. The suggested mechanisms I have found on-line are not quite as I would like them. I try and keep to the FHS where possible and maintain a “tight” ship. This process I will also document once it’s nailed…

Untangle, Asterisk PBX and File Server; All-in-One. Part 5

If you’ve been following the story so far you’ll now where I am. If you haven’t, please go back to Part 1 and read from there.

I’ve been a bit busy recently so haven’t had as much time as I’d like to crack on with this. However, I’ve actually come to a bit of a halt regarding Untangle due to the kernel…

I managed to get the initial Rake (Ruby’s Make) build scripts to run to completion on my LFS-6.3 system :-). For those who are interested, after editing some of the Rake files for hard-coded environment variables, I had to drop down to the last version 5 release of the JDK. Version 6 is not supported due to the issues mentioned in part 4 of this series.

After the build completed, trying to run Untangle caused it to barf badly. But I wasn’t surprised by this. I hadn’t installed Postgresql, and I discovered I was missing a setting in my kernel config (IP Userspace queueing via NETLINK (OBSOLETE)) which caused this file ip_queue_maxlen to be created in /proc. There was another file in /proc missing too: icmp_frag_accept. It was searching for this, that led me to get to the bottom of the kernel issues.

After some dialogue on their mailing lists, it became clear that the build process was not going to be as simple as I’d first thought. The current version of Untangle (5.0.2) uses a very heavily patched Debian kernel (2.6.16-ck11). The method they use for patching relies on some debian tools which, seeing as I am building on LFS, I don’t have – nor do I really want.

A little side note: In the Untangle kernel, they are using the now infamous CK scheduler from Con Kolivas, that is no longer being developed for, or ported to, the main kernel tree (Google for Con Kolivas to read about the saga). I’m not sure how this will affect the UT project in the long run but it is quite an interesting area of kernel development and fuelled some big arguments.

When I have some more time to concentrate, I’ll try and work out what is really needed and see if I can patch my recent 2.6.22.5 kernel. They are developing a new release of Untangle (5.1) which may well give me what I need anyway; the ability to run other apps on the same platform and a more modern kernel version. Watch this space…

In the meantime, I have managed to get Asterisk installed. It’s a fairly straightforward CMMI (configure, make, make install) install for the needed packages (in build order): zaptel-1.4.5.1 drivers for the x100p card, asterisk-1.4.11 and asterisk-addons-1.4.2.

Configuring asterisk however is another ball game entirely. It is fairly complicated and involves a steep learning curve. Although thankfully, there are plenty of resources available on-line. I strongly recommend to get the Creative Commons Licensed O’Reilly book from 2005: Asterisk – The Future of Telephony which is widely available on-line and is an excellent resource. Also, there are lots of good blogs 😉 and other online resources to help you get started.

In addition, you will almost certainly need a SIP phone of some description. I’m currently using the Ekiga softphone as it is open source and happily runs on Ubuntu (it’s gnome based). It was originally called GnomeMeeting.

I can now make and receive calls locally between the Asterisk server and my PSTN line. Next is to try and get it work over a NAT’ed firewall to Alan Bell’s (my business partner) Asterisk server. Using IAX2 (Inter-Asterisk Exchange protocol) seems the way to ge here as it was specifically designed to use a single IP port, as opposed to SIP that uses independent ports (and potentially many of them) for connection management (UDP) and actual call data (RDP). Using SIP requires you to open up hundreds, if not thousands, of ports on your firewall. More reading and learning to follow.

Laterz…

Untangle, Asterisk PBX and File Server; All-in-One. Part 4

If you’ve been following the story so far you’ll now where I am. If you haven’t go back to Part 1 and start from there.

The server itself is running smoothly and seemingly reliably. Building Untangle (ut for short) is proving somwhat more problematic, although to be honest, it is what I expected.

After fixing a few hardcoded environment variables (JAVA_HOME) in the [m]rakefiles and changing a class declaration from com.sun.java.swing to javax.swing, the build is failing due to some Java declarations which are requesting an unsupported feature. If anyone is interested, here’s a tarball of the build-log so far: Untangle Build Log

A bit of Googling has thrown up some information that using the SwingUtilities2 package is a big no-no. Even in the JDK 5 version. It has been moved out of the way in JDK 6 and is, apparently, unnecessary due to changes in the way swing now deals with anti-aliasing and sub-pixel font rendering.

Anyway, the guys at Untangle are being very helpful, I’ve got subscribed to their developer mailing list and, hopefully, we’ll have a fix soon.

If there are any Java gurus out there who could suggest an alternative way of dealing with this using the JDK 6 release, the error is caused in this try/catch block:

try{ ((JComponent)nameJLabel).putClientProperty(javax.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY, new Boolean(true)); }
catch(Throwable t){}

or here in the util class:

public static void setAAClientProperty(Component parentComponent, boolean isAAEnabled){
if( parentComponent instanceof JComponent ){
try{ ((JComponent)parentComponent).putClientProperty(javax.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY, new Boolean(isAAEnabled)); }
catch(Throwable t){}

Meanwhile, I’ve been playing with file systems and sorting out the partitioning to my liking. Reading several articles on-line I have decided to use XFS for the file system on most partitions. According to what I can find, it offers generally better performance and scalability than the more commonly used ext2/3. It certainly takes up less disk space, I gained 4GB on the biggest partition /home: ext3 = 260GB v XFS = 264GB. On the smaller partitions (4.7GB) I gained 100MB when going from ext3 to XFS and lost that silly and irrelevant lost+found directory.

Keep Tuned, and don’t hesitate to comment 🙂

Untangle, Asterisk PBX and File Server; All-in-One. Part 3

In this third instalment, the hardware is all running and I have a nice and shiny new LFS-6.3 running happily with xorg-7.2 and the very cool and lightweight fluxbox Window Manager. I have also installed the latest JDK, and Ruby & Rake to support the untangle build process.

A first try at building the untangle source failed (as I expected really). Initially this was due to the JAVA_HOME environment variable being hard-coded into various “.rb” rake build files. Needless to say, where they expected the JDK to be (/usr/lib/jvm/java-1.5.0-sun/jre), mine is somewhere else entirely (/opt/jdk).

I edited the top level rakefile, so that JAVA_HOME pointed to my JDK, to see how this affected the build. It ran for a bit longer but then aborted with some unintelligible errors.

Realising that I know nothing of Ruby, and consequently Rake, I thought I’d try a different tack. My main desktop machine runs Ubuntu Feisty. As an experiment, I installed VirtualBox (A virtualisation application) and installed the Untangle ISO into that as a virtual machine.

Really neat – it worked without any hiccups or issues whatsoever. Now I can play around with Untangle, see what goes where and what it’s dependencies are, before I go back to try and build it from source on my new server platform.

Here’s a screen shot of Untangle running as a VM (Virtual Machine) on my Ubuntu Desktop 🙂 You can see I have opened a

Untangle in VirtualBox

terminal in Untangle so I can start investigating the environment.

In terms of the dependencies I know I am missing: Postgresql is definate, and I may need ANT too. It might also be that I will need to downgrade the JDK to version 5 rather than 6; but I’ll confirm that later.

I have also just ordered the FXO card for Asterisk. The card I ended up going for was for sale on eBay in the USA. It sounds like it should do the trick nicely and has a low profile bracket so it will install into my little case. Including shipping it worked out at just over £17.00. Not too bad.

This may end up being a slightly longer series that I first thought. But hopefully it will still be interesting…

Untangle, Asterisk PBX and File Server; All-in-One. Part 2

The rest of the hardware finally arrived this afternoon (the courier seemed to be asleep yesterday).

The physical installation was simple and quick. Everything worked first time. I connected it all up, checked it POSTed O.K. and verified in the BIOS that the new RAM, HDD and CD were visible and identified correctly. No problems.Hardware installed and cabled up

I tidied up the cabling and put the lid on 🙂

Unfortunately I’ve just noticed that when I come to install the FXO line card for the PBX I’ll have to move some of the cables, but it shouldn’t be too much trouble.Hardware installed and cabled up

As things were going so well, I though I’d just see how the Untangle install from their ISO went. It installed fine really but there were a couple of issues for me with it:

  1. It didn’t give me any opportunity to partition the hard disk,
  2. It didn’t do any sort of locale checks so I ended up with a default US keyboard layout,
  3. It couldn’t identify the network chipset hardware. Their kernel is quite old and doesn’t have the drivers built in.

To be honest, this isn’t really a problem though. As this will be a heavily customised server anyway, I had always really planned to build a new LFS system on the box, partition it how I want and then build the untangle source and on top of my own host Linux. That way I will have much more control over what goes on, and I should be able to add asterisk and anything else as and when I see fit… That’s the theory anyway 😉

In terms of partitioning, I reviewed my original plan and have come up with a new and much simpler scheme:

Machine Part Type Drive Grub Mount Point File System OS Size (GB)
vimes   sda hd0    
320.000

Linux sda1 hd0,0 /boot ext2 Linux 0.2
  Linux Swap sda2 hd0,1 /swap swap   1.000
  Linux sda3 hd0,2 / ext3   5.000
  Extended sda4   ext part      
  Linux sda5 hd0,4 /opt ext3   5.000
  Linux sda6 hd0,5 /usr ext3   5.000
  Linux sda7 hd0,6 /srv ext3   5.000
  Linux sda8 hd0,7 /var ext3   5.000
  Linux sda9 hd0,8 /home ext3   280.000
  Linux sda10 hd0,9 /mnt/lfs ext3   10.000
               
              316.2

The figures won’t be exact as formatting will remove some of the usable space, but the idea is about right.

As you may also have noticed, I have chosen “vimes” for the name of this box. He is, after all, the Discworld’s first and only true “policeman”. I thought that Vetinari (the patrician of Ankh Morpork) would also be appropriate but vimes is quite a friendly chap, not how I would describe Vetinari.

More later…

Untangle, Asterisk PBX and File Server; All-in-One.

Here’s the first instalment of what hopefully will be a short series. I am building a low-power PC for use as a home server, firewall, net-filter, and IP-PBX.

Our house is flood-wired with CAT5e cabling to almost every room, and with me, my wife and eldest son we can have up to 4 or 5 PCs active on our network at any one time.

My eldest son (James) is about to turn 7 and has already started to use Google. So it is time to put some content filtering on the network, and maybe some caching too. Plus I want a decent, low power device that could be left on pretty much 24/7 with sufficient hard disk capacity to act as a backup host for our desktop machines’ data. Also my business partner and I both work from our respective homes currently and it would be useful if the single analogue line coming into my office could be switched (via Asterisk) so calls can be routed to whoever happens to be available using VOIP.

After reading up on the Untangle product, I decided that would be a great foundation for my project as it is a bundle of all the main network security applications built into one software appliance. The interesting task will be to get it, happily living along side Asterisk, Samba/FTP and hopefully Apache for a public web server.

After ensuring that Untangle would be happy with a low-power VIA type PC for our use, the next step was to identify suitable hardware. Much research led me to choosing this board – a Jetway J7F4K which has dual GigE Lan ports, a couple of sata ports, IDE, USB and the usual other interfaces. This board is available in two models:

  • a 1.5Ghz VIA CN700 fan cooled (available as either a 25W or 12W mobo)
  • or a 1.2Ghz VIA CN700 fanless and rated at an amazingly meagre 7W.

The 1.2Ghz model was the one I chose as power drain is more important to me than 300Mhz of processing power. To fill it out, I ordered, a 1Gb stick of DDR2 533Mhz ram, a 320Gb Hitachi Sata Hard Disk and a DVD+/-RW/RAM anything drive.

For those interested, the motherboard I ordered from LinITX.com and the rest of bits I got from SCAN Computers. After reading a couple of forums, there were good comments about LinITX and they had the latest rev of the Jetway board in stock which has a new heatsink and latest BIOS to cure some reported reliability problems with earlier models. SCAN I have used before and always offer good prices and service.

I bought a really neat case on eBay for £15.oo which was a real bargain. Brand new, including PSU, quite small and nicely engineered, and designed for uATX boards, but Mini-ITX are fine too. It is made by a company I’d not heard of before; In-WIN.

Case with Motherboard installed

The motherboard arrived before all the rest of hardware so I have just loosely fitted the mobo, and am thinking about how to route the cables neatly. For that I’ll need some cable ties and some of the sticky pads for fixing cable ties to as there aren’t many useful holes in the case to tie onto.

Detail of Motherboard

The motherboard itself is really quite amazing. being the Mini-ITX format – it is really tiny, just 17cm (6.6in) square! Here’s a close up of it and you can clearly see the large heatsink that covers the processor, VRMs and northbridge I believe.

On Monday I should be getting the rest of the hardware so I’ll post some more as I complete the physical assembly.

Then we’ll get into the good stuff – installing lots of Open Source software…

Update: Whilst waiting for the hardware to arrive, I started thinking about a partitioning scheme. I am not a fan of LVM for performance reasons so I will be using physical partitions. Here’s my first draft.

Machine Part Type Drive Grub Mount Point File System OS Size (GB)
TBC   sda hd0    
320.000

Linux sda1 hd0,0 /boot ext2 Linux 0.243
  Linux Swap sda2 hd0,1 /swap swap   1.870
  Linux sda3 hd0,2 / ext3   4.000
  Extended sda4   ext part      
  Linux sda5 hd0,4 /usr ext3   10.000
  Linux sda6 hd0,5 /var ext3   10.000
  Linux sda7 hd0,6 /opt ext3   10.000
  Linux sda8 hd0,7 /srv ext3   10.000
  Linux sda9 hd0,8 /home ext3   100.000
  Linux sda10 hd0,9 /home/alord ext3   40.000
  Linux sda11 hd0,10 /home/hjlord ext3   40.000
  Linux sda12 hd0,11 /home/jlord ext3   40.000
  Linux sda13 hd0,12 /home/mlord ext3   40.000
  Linux sda14 hd0,13 /mnt/lfs ext3   10.000
               
              316.11

Also, I’m thinking about a name for the new server… All the computers in our network are named after characters from Terry Pratchett’s Discworld novels. So Far I have used: Twoflower, Rincewind, Moist, Binky, Gaspode and Mort. I am thinking about using: Eroll (the dragon), Ludmilla (a werewolf), Angua (another werewolf), Vimes (the commander of the watch), or Magrat (the young witch).

Anyone got any more good suggestions?

« Previous PageNext Page »