I am having an issue with Directory not pulling the greet file and playing it, so it defaults to saying the letters of the name.
I am new to FreePBX, but managed to get everything else I wanted in the PBX to work with the help of this forum, but I cannot find the answer to this one.
I built the box with freepbx-2.3.1 and upgraded this morning to freepbx-2.4.0rc1 this morning hoping it would fix the issue, even though nothing about Directory was in the Changes document.
Directory correctly finds the user from voicemail.conf and will connect to the proper extension, but it spells the name instead of using the greet file. The mailbox is in default context and in my vm extension folders are my greet and unavailable files in gsm wav and WAV formats.
This seems to be missing on mine. So is the path incomplete on the FreePBX generated AGI file? The rights appear to be correct on my voicemail.conf file:
-rw-rw-r-- 1 asterisk asterisk 12265 Feb 5 12:00 voicemail.conf
I spoke too soon, I did not have the verbosity of the debug set high enough. Still it is choosing the correct context, default. And if it didn’t use the correct context, it would’t find the correct user.
AGI Tx >> 200 result=1 (/var/log/asterisk)
AGI Rx << VERBOSE “Notice: vm-context not specified. Using ‘default’” 1
directory||from-did-direct|be: Notice: vm-context not specified. Using 'default’
AGI Tx >> 200 result=1
I have to watch what I post as I’ve customized mine to handle multiple asterisk servers so that we present a unified directory service from all branch servers. I could not remember if that line was supposed to be there or not (I removed it’s checking of the other servers from the output I provided).
If you edit edit the directory file (/var/lib/asterisk/agi-bin/directory) at line 32 there is a line:
define(“DEBUG”, 0);
change the 0 to a 1 and save the file. It will produce a debug file that might help you out. it will be located at /var/log/asterisk/directory.log (review this file carefully to be sure everything looks correct). Also since it is a AGI file it get’s reloaded each time the service is called so you can enable it, call a few times, edit it again to remove it and not effect any of the calls or other operations of the system.
You’ll want to take a look at the sound_file_exists function and see what it see’s. There is a example in side the function on how it is outputing information to the display that should help you get the info.
Can you provide some background info.
Asterisk version, Freepbx version, Hand built or distro install and if so who’s, etc…
I enabled debug in the AGI file and set AGI debugging in the CLI, but am unable to find the reason it is failing.
If you have time, I am including links to my directory file and directory.log for you to review, the CLI output hasn’t changed from above.
As for the box:
Asterisk 1.4.14
Asterisk-addons 1.4.4
FreePBX 2.4.0rc1.1 (started off with 2.3.1) all modules are up to date
RHEL5 x86_64
Find the sound_file_exists function. and place this line between the for loop and the if (…
$agi->verbose(file_exists($file.".".$ext))." Found “.$file.”.".$ext, 2);
So it will look like this when done:
foreach (array(“gsm”,“GSM”,“wav”,“WAV”) as $ext) {
$agi->verbose(file_exists($file.".".$ext))." Found “.$file.”.".$ext, 2);
if (file_exists($file.".".$ext)) {
This should print out each EXACT attempt to check for a sound file to be played. that way you will know what and where it is looking for something and what it thinks the result state is.
Thank you for the posting!
It greatly helped since I don’t know programming at all.
I now have it showing up in the CLI and it no longer spells out the name, but isn’t streaming the file either:
After fiddling with the code that you posted I got it to work as:
foreach (array("gsm","GSM","wav","WAV") as $ext) {
$agi->verbose(file_exists($file.".".$ext))." Found ".($file.".".$ext);
if (file_exists($file.".".$ext));{
return true; }
If I have the line as: $agi->verbose(file_exists($file.".".$ext))." Found “.($file.”.".$ext, 2);
It goes to “goodbye” and hangs up.
Ok, I started writing this an hour ago and now it just hit me.
I am on extension 0420.
Directory agi is looking for the sound file in /420
It’s dropping the zero. I created another extension with a non zero starting number and everything works.
I can create all my extensions to be non-zero starting, but I was making extensions based on last four digits of the phone number
Question is though, why is it dropping off the zero?
Thank you again fskrozki for helping me through this.
Glad you figured it out. I’m sorry about that I did a quick copy and paste and don’t remember how the ,2 got in there.
The issue with leading 0’s is that if at any point the extension is converted to a real number instead of a string of characters you will loose the leading 0. Also most people would not type in extension 0420 with the leading 0 as it means the same thing as 420.