Thursday 2 July 2009

Updating Asterisk

Wow, I've not blogged for a long time! (In fact I wrote the bulk of this post in March.) I'd like to say my publishing hiatus has been due to something very exciting and worthy of your envy but alas any such stories would be not much more than fantasy. In any event, my Twitterings no doubt have revealed just what has been keeping me busy. A family update may soon follow this posting but for the time being, technical matters have my attention.

In a moment of springtime madness, far too late at night and when I was far too tired, I decided it would be a great idea to bring my 1.4.21.2 Asterisk installation up to the (then) current 1.4.23.2 release. This was in no small part prompted by Clint's commissioning of his FreePBX VM while we were skiing in France at the beginning of March, although there was no particular problem that I expected to remedy with this update. Predictably, the whole process turned to custard and another six hours of my waking consciousness was squandered putting things right. Here are my top three learnings.

The renaming of Zaptel to DAHDI seems to be spectacularly poorly documented. I didn't manage to find any easy way of removing the Zaptel 1.4.11 drivers so I had to hack these out manually. Installing the DADHI 2.1.0.4 equivalent (with the 2.1.0.2 tools) was quite straightforward but, for a while, that was as far as I got. The DAHDI module would not load in Asterisk and there was no sign of my TDM400P card or its associated channels. I had to resort to reading the source code to find out what was wrong. The promised 'etc/asterisk/chan_dahdi.conf' generated file was missing but, in this event, the code looks for the old 'etc/asterisk/zapata.conf' which unfortunately no longer works. Again I was left to manual editing.

Testing my PSTN lines once DAHDI was again working reminded me that UK caller ID is received intermittently and I summised ths same fix I discussed here was required. However, following the massive search and replace that has been enacted on the Asterisk source code, the old patch failed completely. (I'd forgotten this was just one more reason why my sane half had planned to stick with the existing versions until some imperative made me move.) I manually modified the 1.4.23.2 chan_dahdi.c file to apply the same fix and generated the revised patch file (here). One more recompile and I was back in business.

Everything has been very stable since. From the logs I can see that without the patch I would have missed CID on one in every four calls or so.

Update: I've since updated to Asterisk 1.4.25.1 and Dahdi 2.2.0 without problems. The patch file I created for 1.4.23.2 applies to fine for this and all intervening versions.