Using OTE’s 11888 to provide fast CLID data for FreePBX/Asterisk

For those using FreePBX (a configuration/administrative interface that manages Asterisk) there is a CallerID Lookup module, published by the FreePBX team. The module allows you to interface with data sources using several methods, one of them being http.

Like many companies, we maintain several systems that can be easily integrated with our VoIP PBX system, but we also receive a number of calls from the public, viz. companies interested in advertising on GEO|ADS, adding their business to AthensBook or ThessBook, or asking for a quote for a project. OTE recently revamped its aging whitepages.gr site and incorporated its content into their ‘umbrella’ 11888 business directory operation. The new site is faster, more beautiful and written in a more professional manner, as far as the markup is concerned, which makes it a perfect source of caller id information for a large number of telephone subscribers in Greece. Around one hour of Ruby scripting using Mechanize, Sinatra and some custom transliteration tables to convert the scraped names to their latinised counterparts (Cisco phones don’t seem to like Greek characters all that much) resulted in the following script (github)

In our version, we interface with some additional internal systems (viz. we have several lookups performed serially in searchAll), so we only ‘hit’ OTE’s servers when we don’t get a result back from those ‘higher-frequency’ stores. Additional support can be provided, of course, via LDAP for internal corporate directories, ENUM, etc. Clearly this is not the most rubyesque script ever, nor the most elegant one, its transliteration is crude (and arguably incomplete), but it seems to work fine at least for our purposes. Coupled with the caching support that the FreePBX clid module supports, the lookup performance is more than acceptable for ‘frequent’ callers. In our tests, OTE alone returns a result in less than 0.8s on average, which is good enough in almost every scenario; even if it were longer, in corporate PBX environments, IVRs, Queues allow for pretty ‘slow’ lookups anyway.

The code above is provided under the MIT License. This means you can do whatever you want with it, as long as you retain the license block (see below) in every piece of software that derives from or contains it. Obviously, by using this piece of code you accept the license, understand that is not warranted for any purpose, assume all responsibility pertaining its use, are liable for any claim etc. Here’s the requisite legalese:

Copyright (C) 2012 Cosmix.org

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5 Responses to “Using OTE’s 11888 to provide fast CLID data for FreePBX/Asterisk”

  1. floom says:

    Very nice! Github repo or Gist?

  2. cosmix says:

    Thanks floom! It’s now on github

  3. Kostas says:

    Hello!
    I am using FreePBX and your script seems to be just what I was looking for!
    I checked it out from github, but I can’t for the life of me make it work :'(
    I followed tutorials, installed ruby/sinatra/passenger and got them running.
    Everything *seems* to be working fine, but still no joy! Αγιούτο Χριστιανοί!

  4. cosmix says:

    Kostas, the script works fine on our end and has done so for the better part of three years. I am sorry, but I do not (and cannot) provide any assistance with installing and configuring it – you’ve got the code, you’re on your own. Good luck!

  5. Kostas says:

    I’m sure it works, that’s why I am trying to use it! I just want to be sure that I am not wasting my time over something trivial, like e.g. version incompatibilities.
    I use Ruby v2.2.2 , Sinatra v1.4.6 and Passenger v5.0.11 with no success.
    I suppose you are using it with earlier versions? Μην είσαι άσπλαχνος!

Have your say.

Write in the language of the post. Comments are meant to encourage on-topic discussion. For general comments, observations, complaints (e.g. about the site), you can use the form found in the Contact page. Make sure you've read the Terms of Use before commenting.

Comments Feed for this post Comments Feed for this entry.