Remove from Company Directory not working in 2.3.0.3 (Trixbox 2.3.0.1)

I saw that I can prevent a name from showing up in the IVR directory by putting ()s around the name, in the Display Name field of the extension. I am using 2.3.0.3 and have not gotten this to work. I put ()s around the name (Mike Shappell) saved and restarted and when I access the company directory I am still getting a match for the name. Is this working or am I missing something? Thanks.

Mike

There has never been such a trick by design although I’ve heard of people doing some thing like this. The real solution is we need a proper directory module and a change to the way the directory works. So you can exclude users, alias them, create new names and point them somewhere else, etc. The module would not be too hard to write and could leverage much of what is there today - but is is needed and the real way to do it. Sorry that does not really help you with you current problem though.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

First off I agree with Philippe that the directory needs work. There are several features I’d like to have also. To that end I just submitted a patch that allows for the integration of multiple boxes so that the voicemail directory on any one system becomes a unified single directory across multiple systems. This patch assumes a lot, each box can already talk to each other box, the dial plans handle the routing, there are no overlapping extensions, etc.

But since I was just through the code I knew where to make the change to have it do what you want…

If you edit the /var/lib/asterisk/agi-bin/directory file and go to the bottom then go up 36 lines (or just down 483 lines) you will find the following line.
if (!empty($box[“name”])) {

replace it with this line
if (!empty($box[“name”]) && (substr($box[“name”],1)!="(") && (substr($box[“name”],-1) != “)”)) {

then you will have that functionality.

Be aware that every time you upgrade freepbx (or the voice module) you take a chance that the file will be replaced loosing that functionality again.

You guys are awesome thank you so much for all the useful post. This one worked like a charm.

This really should be part of the FreePBX distro, as the test is for the characters “(” and “)”. If one chooses not to use it, no harm done! The downside is that it costs two additional tests. But it would be a great help for others with same name and multiple extensions (ie. home phone, office phone, iPhone, netbook soft phone, etc.) of which one wants to hide some or all of the extension(s).

One possible solution is to create a daily/weekly/monthly cron job. This would be necessary if someone else in the company updates/upgrades FreePBX and not knowing the custom modification. Example:

File=/etc/cron.weekly/chkdirectory
#!/bin/bash
cd /var/lib/asterisk/agi-bin
if ! grep -q ‘(substr($box[“name”],1)!="(")’ ./directory ; then
mv ./directory ./.directory && cp ./.directory ./directory && chown asterisk:asterisk ./directory && chmod 754 ./directory
sed -i ‘s/^.\tif (!empty($box./\tif (!empty($box[“name”]) && (substr($box[“name”],1)!="(") && (substr($box[“name”],-1)!=")")) {/’ ./directory
fi