Posts Tagged ‘elastix’

Fixing 411/pbdirectory on FreePBX/Asterisk

Monday, January 12th, 2009

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.