login | register
Tue 07 of Oct, 2008 [18:13 UTC]

voip-info.org

Discuss [0] History

Asterisk multi-language

Created by: oej,Last modification on Thu 05 of Jun, 2008 [12:47 UTC] by fborcel

Setting up a Multi-Language Asterisk Installation


Many Asterisk Dialplan commands cause Asterisk to play sound files from the /var/lib/asterisk/sounds directory structure. Many of these sounds are recordings of phrases and sentences such as, "Please hold while I try that extension." Asterisk supports the automatic selection of different language editions of these sound files.

When Asterisk looks for a particular sound file, such as transfer.gsm, it will first look in a subdirectory corresponding with the currently selected language. For example, if the currently selected language "de", the Asterisk will first look for the file /var/lib/asterisk/sounds/de/transfer.gsm. If this file or the "de" directory does not exist, then Asterisk will look for the file /var/lib/asterisk/sounds/transfer.gsm, which is usually an English-language default recording.

If an Asterisk command specifies a sound file in a subdirectory, Asterisk looks in that subdirectory for the language subdirectory. For example, the SayDigits command may play the sound file "digits/6". Asterisk will, if the language code is "de", first look for /var/lib/asterisk/sounds/digits/de/6.gsm before falling back to /var/lib/asterisk/sounds/digits/6.gsm.

Setting the Language

The default language for a particular channel is set in that channel's configuration file. Look for a setting like:

   language=en

in the [general] section.

You may specify any text (up to 20 characters long) as the language code. When playing sounds from the /var/lib/asterisk/sounds directory, Asterisk will look for a subdirectory with the same name as the currently selected language.

You can override the channel's default language using the SetLanguage command in your Dialplan. You may use the ${LANGUAGE} channel variable to discover what the currently selected language code is.

(:exclaim:) The language code specified in the channel configuration files and using the SetLanguage command is quite separate from the country code specified in the indications.conf file used to select country-specific tones (dialtone, ring tone, busy tone etc) by the Playtones command.

Dialplan Commands

The Dialplan Commands that use the multi-language feature of Asterisk include:


Tip

This "language selection" feature does not have to be restricted just to making different language files. You could, for example, choose to have your voice prompts recorded by a male speaker and a female speaker. A channel configuration file might set:

   language=female

and you could override that with a call to SetLanguage(male). If you requested Asterisk to play the 'transfer' sound file, then Asterisk will look in /var/lib/asterisk/sounds/male/transfer.gsm directory, and if not found, revert to the default /var/lib/asterisk/sounds/transfer.gsm.

See also



Asterisk | Configuration

Comments