Archive for February, 2007

Making the phones work right

I’ve had a good productive few days with system things recently.  Probably the biggest improvements have been on the phone system.

The cutover to Trixbox changed a lot of how we worked with the phone system — and not all for the better.  Losing LDAP caller-id lookup and other features was a bit of a PITA, and honestly was a bit too much to sacrifice just to get the easy configurability of FreePBX.  I blogged about how I restored the LDAP caller-id lookup, and that the LDAP phone directory was on the way back, but I remembered one other thing that was really useful in the previous setup — voicemail.

In an office phone system, you would generally associate voicemail with an extension.  FreePBX follows that model, and makes it really easy to set up.  For a home system, however, it’s not ideal, because (at least in my setup anyway) there are a number of extensions that are all in the same ring group and are actually all for the same person (or people).

Right at the start, I configured this in FreePBX by setting up “Other (custom) device” extensions with Voicemail enabled, and disabling voicemail on all “real” extensions.  In the setup of the real extensions, I set the “mailbox” field in Device Options to be the correct voicemail number that extension would belong to, so that the Message Waiting Indicator (MWI) worked correctly.  The trouble was that getting into the voicemail system was not a one-touch deal any more, as the default FreePBX voicemail access feature codes were all set up according to the mailbox-per-extension model.  So we had to dial the Voicemail number (a non-intuitive number starting with *98 according to FreePBX) and log in with a password.

I thought about setting up a custom application (FreePBX-speak for a hand-written context in extensions.conf), but thought that there must be a way to get the existing code to work…  but after looking at it for a while, I decided that a custom app would be much easier to get working my way, and be less likely to break in a future FreePBX release.

The end result was incredibly simple.  Since I had already told FreePBX the desired mailbox for each real extension (the MWI config I mentioned earlier), I simply wrote a few lines of dialplan to extract that from MySQL and send the caller to that voicemail box!  I was expecting a lot of work, but I think it took longer for me to get the MySQL userid and password right than it did to get the code correct. :)

Other things I did were a rearrangement of the queue and IVR for the work phone line, and I made a bunch of system recordings for queues and voicemail.  There’s very little left for the phone system now!

Hackergotchis again

I fixed my Planet mod that creates the hackergotchi <img> tags in the RSS feed.  So Dudes, if you’ve got a hackergotchi and want it in your Planet entries, let me know!

I’m really quite confused now

I gave up my former desktop machine to use as the new combined Asterisk/MythTV system.  This means I’ve been using various machines scattered about the house to do home system stuff, and it’s a bit frustrating.  At the time I commandeered the other machine, a system based on Core 2 Duo was the most likely contenderto replace it — even though I’m a big AMD fan, Intel seemed to have the bang-buck ratio covered.  But what a difference a few short weeks can make!

In the last few weeks, AMD have released Athlon 64 X2s with higher clock speeds, and correspondingly dropped the price of the existing processors.  The prices of some of the motherboards I was eyeing have dropped slightly as well.  AMD was back on the agenda again!

Then, I saw a listing for the Athlon 64 4×4 chip, which uses Socket F rather than the Socket AM2 of the X2 Athlons — Socket F being the same socket used for the newer Opteron parts.  So now, putting a Socket F board into the desktop machine gets a look-in… but then, I could upgrade the Opteron server machine and cascade the current dual-Opteron rig to be the desktop…

Choices, choices!  Maybe I should just stick with the old laptop — dud hard disk (I need to turn the machine on its side when I power it up) but it works okay…  kinda…  Ooh, ASUS M2N32-SLI Deluxe…  shiny…

LDAP Caller ID again!

After a hiatus that has lasted since I first cut the phone system over to Trixbox (probably a year or more), LDAP caller-ID name lookup is working again on my Asterisk system!  A lot easier to maintain than the original version I implemented ages ago, too.  A bit of PHP code does the trick!

I’m using FreePBX for keeping my Asterisk box configured, and it’s working great — but there are a couple of tricks that I just haven’t quite been able to work around.  You see, FreePBX applies a few assumptions that work fine in a small office environment (like voicemail-per-extension) but don’t map to home use (one voicemail for the household).  The biggest aspect of FreePBX is that it maintains the dialplan in a set of files all of its own making — you can extend it using “custom applications” (basically a reference to a dialplan file of your own creation), but I’d be concerned about an upgrade trenching custom dialplan files…

My original LDAP caller-id lookup module implemented a new dialplan app (something like  LDAPCallerName).  I inserted it into the dialplan at the relevant place, et voila, name lookup.  But even if I could port my old code to the later revisions of Asterisk, or use the community LDAP lookup module (which was written just a little while after I wrote mine), how do I add the lookup into the dialplan?

FreePBX has a module called “Caller Name Lookup Sources”.  Out of the box, it has the types “Internal”, “ENUM”, “HTTP”, and “MySQL” (“SugarCRM” is listed as well, which I figured would be tied into the SugarCRM system that’s provided with Trixbox, but when you select it you get “not yet implemented”).  MySQL doesn’t help me, as I don’t want to transfer data out of LDAP into some other store.  ENUM is a name lookup system based on DNS, and having seen a lot of work on LDAP-backed DNS servers I thought this might be interesting… until I realised that I’d likely have to spend a heap of effort adding the DNS attributes and object types to my existing LDAP data (assuming that I could use the data in its existing structure at all).

I had disregarded the HTTP method as overly clumsy — on a single host, contacting the HTTP server to run a script to get data from the LDAP server just seemed too much overhead to me.  After I had a think about the available options though, it made a lot of sense — and half-an-hour after I decided to do it, I had a working prototype (and I consider myself very much a PHP newbie).  My script has a few nice features that tie in with the way the Caller Name Lookup module works in FreePBX, including the thing that I found was missing in the Asterisk LDAP module — the ability to drop leading zeroes from the number to be looked up, allowing you to have numbers stored in your database in international format.

Next to come will be the directory lookup CMXML app, that will allow the “External Directory” function on the Cisco phones to work again!

Joyeux Asterisk

The new consolidated Asterisk machine has been running well, but a recent outage shows the potential folly of (still) using Gentoo as a server base.

The new machine was not in any of the Cacti graphing, so I decided to set it up on Friday night.  net-snmp had been installed, but I must have removed it in an overly-agressive cleanup (when I transferred the desktop built onto it).  So I rebuilt net-snmp, configured and started it, added the box to Cacti, and was happy.

The following night, Susan told me that her mum had tried to phone in the morning and it rang out.  At first we figured we were actually out, but the time was wrong.  Looking in the Asterisk CDR log, I saw a call of 0:00 duration, marked as “NO ANSWER”.  Picked up the mobile and dialled home, and sure enough no ringing.  What was worse was that I could not even dial between extensions.  Hmmm.

Googling turned up little response, and neither did turning up the log level.  I could find that a curious AGI script called “dialparties.agi” was telling the dialplan that all available extensions were busy (which they certainly were not).  By the output, it looked like the script was not running correctly…  I found that there was an update to FreePBX available, and thinking that I might have tickled some bug all of a sudden I tried to install it.  The installation script produced a cryptic error, something like the following:

/usr/bin/php: libnetsnmp.so.5: cannot open shared object file: No such file or directory

Suddenly the soup got clearer!  Rebuilding net-snmp probably brought in a version upgrade; PHP was linked against net-snmp, and the library was gone.  But the whole FreePBX interface is PHP code, and it was working fine… it would seem that Apache mod_php was either rebuilt after the net-snmp build or does not link against net-snmp, because any PHP code in web pages was fine.  And sure enough, the dialparties.agi script is command-line PHP.

So rebuilding PHP fixed the problem!  Now I know some more about FreePBX — it is totally broken without a functioning command-line PHP.  PHP in turn is dependent on net-snmp… and who knows where the chain goes after that…

I probably need to put this kind of stuff on my Wiki, as it will likely catch me out again.  Maybe I need to get in the habit of running revdep-rebuild a bit more often (or compile a list of those packages that revdep-rebuild should *always* be run after).

EDIT: Zoinks!  revdep-rebuild has a list of about 50 packages that are broken…  Sigh :)

Brisbane Motor Show

My father-in-law and I took Nicholas to the Brisbane Motor Show today.  What a great day out!  He absolutely loved it.  We rode the bus to get there, and he loves bus rides, but when we got inside and onto the show floor he was speechless!

He loved the Lamborghinis, was in awe of the Audis, thought the Ferraris were fine, and took a liking to the Lotus.  He also thought the Nissans were neat, and took a shine to the Subarus!  While at Holden, he couldn’t take his eyes off the HSV Grange.  He climbed in a few cars, ran his hand along a few more, and even sat on a couple of scooters — I think he liked the Yamaha Majesty best! :)

Pop and Nicholas sat in a Peugeot 407 Coupe and were both impressed (even though Nicholas said the radio was “a bit noisy” when Pop turned it on!).  His eyes almost popped out of his head when he saw the Hummer H3, but it was on a tiny little stand that was way too crowded and he couldn’t get away from it fast enough.

There were a couple of Corvette Z06s there as well, and while Nicholas didn’t think too much of the car, he was glued to the screen showing video of the car being put through its paces by the presenters of such TV shows as Top Gear.

By lunchtime, we were all totally worn out.  Nicholas fell asleep on my shoulder as we were getting ready to leave the floor.  As worn out as I got though, I can’t wait to take him back next year!