Call centre HUD for Asterisk

At work every fortnight or so we hold what we call Evenings Of Code. The company buys the development team pizza and beer and in exchange we work on projects and ideas that are of special or particular interest to us, that the company would benefit from, but that the company doesn’t really need at the moment and so normal weekday work time cannot be allocated to it.

My recent project has been to create a HUD (Heads-Up Display) for the call centre. I’m particularly suited to do this out of those in my team because I have quite a lot of experience with Asterisk, the popular open-source PBX, on which the company’s telephone system is based. The system, designed for a 1080p display (it’s not yet decided whether we’re going to go for a plasma or a projector yet), uses caller details records (CDRs) and the Asterisk Manager system to gather statistics on the day’s calls. It’s not quite realtime, but the key queue statistics from the Manager are updated every five seconds and the cumulative statistics based on the CDRs since midnight every 20 seconds.

A script runs constantly in the background during the working day (8.00am to 8.00pm) to perform the updates, which saves the results in a database table. The HUD itself is then loaded in a browser and uses AJAX calls every five seconds to read the contents of this table. This will allow multiple instances of the HUD to run without each hammering the CDRs and the Manager. At the moment, as it’s in testing, it’s being loaded into web browsers by certain staff members, and so when it initially loads it loads quarter-size. When we finally put it up on the wall we would then hover over the top right corner and an option will appear to enlarge it to full 1080p, basically by doubling the values in key CSS properties.

It looks slick too. Because it uses AJAX there are no page loads, you would expect nothing less in this day and age. If a digit changes after retrieving an update then the old digit is faded out before the new digit is faded in. If a digit doesn’t change between updates it obviously remains static.

We’re now trying to ascertain whether my algorithms for calculating the statistics are accurate at the moment by using a bit of manual record keeping on the part of the cell centre staff, who have been asked to record the number of calls they are taking per day for a week or so, independently of the records on the PBX. I’m confident that I’ve got it right, however, and actually quite pleased the information that I have been able to calculate given that Asterisk CDRs aren’t all that great to work with.

Assuming the project gets full approval following testing my intention is to get it running on a Raspberry Pi, which can be strapped to the back of the screen or on top of the projector, or indeed easily hidden in the ceiling in either case. Given that modern screens and projectors come with USB ports they will even be able to supply power to the Raspberry Pi. This means that the screen or the projector, whichever is chosen, represents the largest cost of the project as the Raspberry Pi eliminates the need to dedicate a whole PC for the purpose. My research indicates that the Raspberry Pi is capable of running Google Chrome, so that’s all good.

Screenshot of the system during a quiet period (no calls in the queues)


Asterisk CDR Statistics

I’ve been a beneficiary of the open source software community for quite some time now. Ever since downloading Slackware Linux onto upteen floppy disks in 1995, I have used and profited from the use of open source software, whether it it be an operating system, programming language, server technology or desktop application. However, up until this point I’ve never given anything back to the open source community (I really don’t count my Twitter CLI script), chiefly because every software system I have created or worked on has been proprietary and subject to non-disclosure agreements. I’m not grumbling about that, not all software is meant to be or should be open source and working on such systems has paid the bills (just about).

So, what have I written? Unhappy about the lack of a decent (and free of charge) system for analysing caller detail records (CDRs) generated by Asterisk PBX telephone systems, I decided that I would combine a number of techniques that I have learnt and developed over the past year or so to put my own package together, and it’s now at the stage where I think it could be considered a beta. This means that it’s not perfect but it’s more or less there. I’ve started hosting it over at Github.

Principal features

  • Clean, modern interface.
  • Supports multiple Asterisk servers which record their CDRs to a MySQL database.
  • Uses Google Chart API to generate dynamic charts.
  • Quick and advanced search facilities.
  • Rolling monthly and annual reports.
  • MVC framework*.


Further development

Where does it go from here? I’m open to suggestion, which is why I’ve published it and I would welcome comments from anyone who’s interested and/or finds it useful, whether you are a developer or just an end user. Is it useful? Does it work out of the box on your system? Is it easy to install for someone who isn’t a developer? What other features would be useful, bearing in mind that the data produced by the Asterisk CDR MySQL add-on is relatively limited?

I know that the documentation is a little rough around the edges and so I shall be paying attention to that, certainly. I also want to do some really thorough and structured testing in order to ensure it’s as robust as possible. I’ve tested it, obviously, but I’ve not seriously tried to break it yet.

So please feel free to download it, either as a tarball for installation or from the Subversion repository if you would like a good look under the hood. Please submit any comments, suggestions or indeed any code you would like to contribute via the Google Code page in order that all information pertaining to it is kept in the same place. I won’t publish any comments made directly on this blog post for this reason.


Zurückgegangen VON Boston

Yeah, so I spent exactly four days and four hours traveling to Boston, being in Boston and travelling back from Boston this week. It’s kind of a surreal feeling; I feel as if I should be totally overwhelmed by such an intense trip but I’m not, I’m really chilled out about it and it feels like Boston is no further away than London rather than being five timezones away over the Atlantic. Each journey and each day went off without a hitch; never before have I had such a relaxed and straightforward trip abroad. Would that all our holidays were the same!

The conference itself, Fall VON, was very interesting and I truly immersed myself in the IP communications world for two whole days, meeting some very clever people and some notable industry names. I’ve gathered a wealth of information that will prove to be very useful for my current project at work and so the trip was well worth it from a commercial point of view. A couple of the talks were by people who had used the technology with which I specialise in specific applications and while these applications were reasonable clever they weren’t on the sort of scale that my current project is going to be, so I’m going to see if it’s reasonable and feasible for me to do a talk myself at next year’s event once my project is finished.

Boston is a marvellous place. My favourite city in the United States is of course New York, but Boston comes a very close second. Its relative age combined with its New England environs, cleanliness, friendly inhabitants and functional transportation systems make it a pleasure to be in. Manchester, Boston and New York are the three places in the world where I really feel at home, more-so even than my birthplace. The only thing it’s really lacking is the sort of gay scene that I’m used to in Manchester, but then I’m willing to admit that my standards have been set pretty high in that regard. Not even New York comes close to Manchester, mostly thanks to the Republican Party, but that’s a different story.

The local baseball team, the Red Sox, apparently won the “world” series last week, although unclear how much of the rest of the world beyond the United States were invited to participate in this tournament. There was a giant parade through Boston on Tuesday which lasted practically all day. I didn’t see it because I was at the convention centre, but it was apparently enourmous.