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!

5 thoughts on “LDAP Caller ID again!

  1. I tried the link but it’s not active. Do you still use LDAP with asterisk? Can you share some thoughts on this?

    Like

    1. Hi… sorry about the delay, and about the link not resolving. I’m working on getting the Trac site back live again. My caller-ID method has kept working through various versions of Asterisk and FreePBX, so it seems to be fairly robust. I keep waiting for FreePBX to get native support for LDAP CID lookup, but it never comes…

      Was there a particular question you had about LDAP and Asterisk? CID is really all I’ve considered in integration of Asterisk and LDAP, although it would make sense for user and/or device data to come from LDAP too…

      Like

      1. Well I just wanted to know if you can get LDAP CID with only Asterisk and without FreePBX?
        All the methods I’ve found use either a third party tool or a custom script. Is there a native implementation of a LDAP access or should I rely on external tools?

        Like

Leave a reply to Vic Cancel reply