Tonight we were debugging a customers PBX system for them because of what seemed like a really simple issue with their company directory. As they are located in a bi-lingual area they wanted to have english and french menus available to them. They use a combination of Asterisk 1.4 and FreePBX 2.5.

With this software they already had the Languages module available to them, so they were able to create one main IVR, and then several branching IVR’s dependant on the language that was selected.

In this case, English and French. So, that’s all well and good, then we noticed that when you dial the company directory from the French menu, the prompt for the instructions (and only that prompt) is always played in english, instead of our desired language of french. This is really weird. So, we debugged it a little bit and found this in the logs:

— Executing [3@app-languages:2] Set("DAHDI/1-1", "CHANNEL(language)=fr") in new stack
— <DAHDI/1-1> Playing 'dir-intro-oper' (language 'fr') directory|default|from-did-direct|lo: — Playing 'dir-instr' (language 'en')

Hmm, that’s weird – it says it’s playing it in french, but it’s playing it in english that first time. Then it goes on to correctly say that it’s playing the english soundfile, not the french one. Hm, even weirder. So, maybe it’s permissions.

We checked the permissions in /var/lib/asterisk/sounds and /var/lib/asterisk/sounds/fr and everything was correct. They were owned by the asterisk user and asterisk group, we don’t run as root and neither should you. The permissions were rw-r-r so that was fine too. Hmmmf. So, now we began to search google. We found one post on the subject from the freepbx bug tracker where the user was basically told it was his problem, so, we thought it was our problem too and continued searching for another hour or two trying everything possible:

  1. Replaced the sound files a couple times, deleting in between
  2. Re-did the permissions
  3. Symlinked them to various directories
  4. Added a hard coding of “fr/” to all soundfiles in the FreePBX AGI – Directory
  5. Ensured we have support for en and fr enabled
  6. Manually created the Directory with another Language and Misc Destination in FreePBX (complex!)
  7. Asked on IRC

Well, if you’re reading this, none of that probably worked for you either. So, this is what we did – not sure how “right” it is, but it avoids this issue if you’re trying to run your IVR with a company directory in english and french. It’s pretty simple too.

First, login to your FreePBX interface.

Then click over to the Tools tab on the left.

Go to Custom Destinations, and Create a new one

Custom Destination: **from-internal-custom,s,1  
** Name: **French-Directory**

Now press the submit button.

Now Flip over to the Setup Tab of FreePBX and go to your French IVR menu with the Directory in it.

Change the destination to go from the default (#) or whatever you have it set to, to instead go to your new Custom Destination (French-Directory)

Now you’re done the setup in FreePBX.

SSH to your PBX system, and then edit the custom extensions file

# sudo nano /etc/asterisk/extensions_custom.conf

Now Paste the following in there

exten => s,1,Answer  
exten => s,n,Wait(1)  
exten => s,n,Set(LANGUAGE()=fr)  
;exten => s,n,AGI(directory,${DIR-CONTEXT},from-did-direct,${DIRECTORY:0:1}${DIRECTORY_OPTS}o)  
exten => s,n,Directory(default|from-did-direct|lo)  
exten => s,n,Playback(vm-goodbye)  
exten => s,n,Hangup()  
exten => o,1,Goto(from-internal,${OPERATOR_XTN},1)

Exit and save the file then reload asterisk.

# sudo asterisk -rx "reload"

Now, you should test the calling into your menu to make sure the proper directory is working. Does for us. Comments are open if anyone has better suggestions, or a way to fix the directory agi that comes with FreePBX to properly support the instructions/intro being played in french (or any other language) instead of only english.


Comment by Jody on 2009-06-25 11:52:58 -0500

Thank you for this is was very helpful and enabled me to get my IVR up and running with both English and french options.

The only change I had to make was that since I already had from-internal-custom as an entry in my extensions_custom.conf file I just added everything after that into the section.

thanks again.

Comment by Max on 2009-08-10 17:10:50 -0500

I have this problem too. But this trick seems to be only for the “phonebook directory” (Feature code:411) and not for “the extension directory” (Feature code:#).

Is there a way to call the extension directory instead?

Comment by Max on 2009-08-12 10:10:58 -0500

Finally… It was just because the sound file was absent in the fr/ directory..