Skip to main content

mod_directory — Dial-by-Name Directory

mod_directory provides a dial-by-name IVR that reads your FreeSWITCH XML directory, prompts callers to enter keypad digits corresponding to a name, presents matching entries, and transfers the call to the selected extension. It lives in src/mod/applications/mod_directory and is categorised as an application module.

Reach for this module when you need an automated corporate directory — callers who do not know an extension can spell part of a name and be connected without operator assistance.

Loading the Module

The module name is mod_directory. In the vanilla autoload_configs/modules.conf.xml the entry is commented out:

<!--<load module="mod_directory"/>-->

To activate it, uncomment that line (or add it) and restart FreeSWITCH, or load it at runtime from fs_cli:

load mod_directory

No special build flag is required; the module is compiled as part of the standard FreeSWITCH build when present.

Configuration: directory.conf.xml

The module reads autoload_configs/directory.conf.xml. The file has two sections: a global <settings> block and a <profiles> block containing one or more named profiles. The dialplan application call references a profile by name.

Global settings

ParameterPurposeAccepted ValuesDefault
odbc-dsnODBC data source for the search databaseDSN string (dsn:user:pass)(none — SQLite used)
dbnameSQLite database filenamestringdirectory
debugLog verbosity levelinteger0

Profile parameters

ParameterPurposeAccepted ValuesDefault
next-keyDTMF digit to advance to the next resultsingle digit or # or *6
prev-keyDTMF digit to go back to the previous resultsingle digit or # or *4
terminator-keyDTMF digit to end input / abortsingle digit or # or *#
switch-order-keyDTMF digit to toggle first-name / last-name searchsingle digit or # or **
select-name-keyDTMF digit to select the announced entry and transfersingle digit or # or *1
new-search-keyDTMF digit to start a new searchsingle digit or # or *3
search-orderDefault search fieldlast_name, first_name, first_and_last_namelast_name
digit-timeoutInter-digit timeout in millisecondsinteger 0–300003000
min-search-digitsMinimum digits required before searchinginteger ≥ 03
max-menu-attemptsMaximum search attempts before exitinginteger ≥ 03
max-resultMaximum matches to announce (0 = unlimited)integer ≥ 05
use-number-aliasUse number-alias attribute as the transfer target instead of the user idtrue, falsefalse

Example configuration

<configuration name="directory.conf" description="Directory">
<settings>
<!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
<!--<param name="dbname" value="directory"/>-->
</settings>
<profiles>
<profile name="default">
<param name="max-menu-attempts" value="3"/>
<param name="min-search-digits" value="3"/>
<param name="terminator-key" value="#"/>
<param name="digit-timeout" value="3000"/>
<param name="max-result" value="5"/>
<param name="next-key" value="6"/>
<param name="prev-key" value="4"/>
<param name="switch-order-key" value="*"/>
<param name="select-name-key" value="1"/>
<param name="new-search-key" value="3"/>
<param name="search-order" value="last_name"/>
</profile>
</profiles>
</configuration>

Per-user directory visibility

Two user-level <param> elements in the XML directory control whether a user appears in search results:

ParameterPurposeAccepted ValuesDefault
directory-visibleInclude user in name search resultstrue, falsetrue
directory-exten-visibleAnnounce the extension when reading the entrytrue, falsetrue

The display name is taken from the user variable effective_caller_id_name. If a user variable directory_full_name is also set, it overrides effective_caller_id_name for directory purposes.

Dialplan Applications

ApplicationPurposeArguments
directoryRun the dial-by-name IVR and transfer on selection<profile_name> <domain_name> [<context_name>] or <profile_name> <domain_name> <dialplan_name> <context_name>

The application populates an internal search table from the named domain's XML directory, guides the caller through keypad entry, and transfers the call when the caller selects an entry. If the caller does not select an entry within max-menu-attempts tries the application returns without transferring.

When only three arguments are supplied the third argument is treated as context_name and dialplan_name defaults to XML. When four arguments are supplied the third is dialplan_name and the fourth is context_name.

<action application="directory" data="default $${domain} XML default"/>
<!-- Search within a specific context using an alternate dialplan -->
<action application="directory" data="default example.com XML sales"/>

Channel Variables

The following channel variables are read by mod_directory during execution.

VariableSet / ReadPurpose
directory_group_selectionReadWhen set, restricts the user population to the named directory group only
directory_voicemail_profileReadVoicemail profile used when looking up pre-recorded names via mod_voicemail; defaults to the directory profile name
directory_search_orderReadOverrides the profile search-order parameter for this call; accepts last_name, first_name, or first_and_last_name

See also

Source: src/mod/applications/mod_directory