mod_directory is a dial by name directory application.
Caller can search for a member of a domain using their telephone keypad. They can search by first or last name. Single or multiple results can be returned and easily navigated. The directory application will play, if available, the recorded name associated with the extension, letter spell the name or can be setup to use cepstral tts. The letter spelling vs tts setup is accomplished by changing conf/lang/en/en.xml.
Directory uses phrase macros, delivered into "conf/lang/en/us/dir".
The directory application has a configuration file (directory.conf.xml) which is loaded on FreeSWITCH startup from conf/autoload_configs.
Demo directory.conf.xml file:
The directory application will react differently depending on some params set in the configuration file.
Some customers will say that people only know them by first name, and when you are dealing with a small entity, it doesn't really hurt. So you can set this param to "first_name" instead of the profile default value of "last_name", then it will search the directory using first names.
You can also set search-order to "first_and_last_name" which will allow search the directory for matches of either first or last name.
If you have the "search-order" param set to last_name and would like to use first_name on some calls, you can set the "directory_search_order" channel variable to "first_name" and it will search by first name for the current call.
Setting this parameter to true will have directory search by the "number-alias" instead of "id" in user directory.
To use directory from the dialplan:
Directory uses the Freeswitch User Directory as its source of information.
Multiple variables set on a user will change how the directory finds/returns information. Specify these in the <variables> section of the user.
This field needs to contain the full name of the person in this format "FirstName LastName". This is primarily used to override the effective_caller_id_name that is used by default. Useful if the display of the name on the caller id has been shortened or reversed, it can also be useful if your have characters that aren't present on a telephone keypad.
This field will be used if directory_full_name isn't set. Check directory_full_name for more information.
Specify these in the <params> section of the user.
True:False/ This allow to hide a user from the directory. Useful for dummy extension(Door phone, Intercom...) or private entry (CEO). (Defaults to True)
True/False: This define if we playback the extension of the person after it name or not. Can be useful so caller doesn't need to access the directory on every call. You might not want to give your extension for privacy and security (Defaults to True)
Example Directory Entry
Interaction with xml_curl
Whenever this application is called, it parses the user directory and creates a mapping between each user's name, and the digits that would be dialed to spell their name. If you are using xml_curl to generate your user directory on the fly, it is important that you include some logic in your script that will return enough information when this lookup is performed.
The request will look something like this:
Note: some elements have been removed, such as FreeSWITCH-Hostname, etc...
Your script must return each user that is a member of the specified domain, so the directory application can build it's lookup table.
In the above example, only the effective_caller_id_name and directory_full_name values are returned. While there is no harm in returning other fields like sip passwords, dial strings, etc. there is no reason to. The less data FreeSWITCH has to parse, the better.
The users returned MUST be a member of a group, otherwise mod_directory will not parse them. You can enclose all the returned users in the default group to satisfy this requirement.
The default en/us/callie sounds contain the sounds needed for the directory.
If you would like to use your TTS engine for everything instead of using prerecorded sounds, edit the [freeswitch_root]/conf/lang/[language]/[language].xml and replace the line that looks like:
Speaking the name
If the user has recorded their name, then that recording will be used when listing the matches. If they have not, the name will be read one letter at a time by default. If you would like the system to read their name as if it were being spoken, the following two files will have to be edited:
[freeswitch_root]/conf/lang/[language]/dir/sounds.xml - Replace the action tag under "directory_result_say_name" with:
[freeswitch_root]/conf/lang/[language]/[language].xml - Make sure that your tts engine and voice are correct in the line:
If you are using flite, you can find information about it here: mod_flite
language is the two character language abbreviation
freeswitch_root is the root of your Freeswitch installation