Fixing 411/pbdirectory on FreePBX/Asterisk

If you’re trying to get 411 or the phonebook/directory working on an Asterisk/FreePBX such as Elastix, Trixbox or PIAF, you may find that it doesn’t work.

“No directory entries match your search, enter the first three letters of the entry you’re looking for.”

To fix it you’re going to have to ssh or otherwise remote into the PBX and edit pbdirectory (which was located in /var/lib/asterisk/agi-bin/pbdirectory on Elastix).

Find the function phonebook_list(), and on line 95 change

if (substr($k, 1, 7) == 'cidname') {
  $numbers[substr($k, 9)] = $v ;
}

to

if (strstr($k, 'cidname')) {
  $split = explode("/",$k);
  $ext = $split[2];
  $numbers[$ext] = $v;
}

Tonight or tomorrow I’ll try to get a bugfix submitted.  I’d actually like to make some improvements to pbdirectory.  The big peeve I’ve found trying to use it is that it only matches the first three digits of the user’s name.  So if the directory is in the format “Firstname Lastname” and someone punches in the first three digits of the user’s last name, a match will not be found.  Perhaps will submit an improved version shortly.

Tags: , , , , ,

One Response to “Fixing 411/pbdirectory on FreePBX/Asterisk”

  1. A. Motaal Says:

    Thank you for your tip! Highly appreciated :D

    This works temporarily until the Asterisk and/or FreePBX folks officially address this problem. I am sure countless other people find this very inconvenient whilst essential to any professional PBX system

    I can confirm that this solution works for Elastix 1.3 running Asterisk 1.4 and FreePBX 2.4.1 as of February 20, 2009.

    Thanks!

Leave a Reply