Understanding Automatic Speech Recognition Directory Lookups


Applies to: Exchange Server 2010 SP3, Exchange Server 2010 SP2

Microsoft Exchange Server 2010 Unified Messaging (UM) offers a voice user interface (VUI) that uses Automatic Speech Recognition (ASR). This is the telephone interface callers use to navigate the menu systems and access their mailbox using speech inputs. ASR enables callers to use speech inputs instead of dual-tone multi-frequency (DTMF, also known as touchtone) inputs to navigate the UM auto attendant menus. ASR also enables UM-enabled users to access their mailboxes. This topic discusses how ASR is used in Exchange 2010 Unified Messaging, and how grammar files are used with ASR.


Overview of Grammar Files

Default Grammar Files


Grammar Generation

Customizing Grammar Files

For More Information

Overview of Grammar Files

A speech grammar file contains words and phrases that the UCMA will try to recognize when the grammar file is being used. Grammar files define things such as the commands available to users while they're reviewing their mail or their calendar or the names of people recognized by the UCMA when a caller searches the directory. Speech grammar files are first generated as files that have a .grxml extension. They're then processed into a compiled form with a .cfg extension before they're loaded into the UCMA. Because the .cfg file is loaded into the memory of the Microsoft Exchange Unified Messaging service, there is no .cfg file created and saved to a disk. The following figure shows how the grammar files are used by callers.

Grammar file overview

Overview of Grammar Files


If you want to locate the .grxml file that corresponds to a .cfg file, look in the event log for event IDs 1040 or 1041. The event will indicate which .grxml file was used to produce a particular .cfg file.

Default Grammar Files

When the Unified Messaging server role is installed, many files are copied to the server. These files include the default grammar files that are used by ASR to enable the VUI. By default, these grammar files are installed in the <Program Files>\Microsoft\ Exchange Server\V14\UnifiedMessaging\grammars\<language> folder. However, when these grammar files are used by the Unified Messaging server, they're loaded and compiled into a .cfg file by the Microsoft Exchange Unified Messaging service.

The default grammar files include the following files:

  • Calendar.grxml

  • Common.grxml

  • Contacts.grxml

  • Email.grxml

  • Mainmenu.grxml

Custom Grammar Files

Several custom grammar files are created when the Unified Messaging server role is installed and then again when you create UM objects in the Active Directory directory service and the Microsoft Exchange Unified Messaging service runs grammar generation at its scheduled time, once each day. These grammar files contain the names of users and other objects, for example distribution lists, that are in Active Directory. For each name, there is additional data, for example an e-mail alias. This data lets the name be associated with a unique object.

The following grammar files are created when the Microsoft Exchange Unified Messaging service runs grammar generation at the scheduled time:

  • Gal.grxml

  • <DialPlanGUID>.grxml

  • <AddressListGUID>.grxml

  • DistributionList.grxml


    UM-enabled users may not be immediately available for callers. You must either wait until the next scheduled grammar generation to occur or manually run galgrammargenerator.exe to include the UM-enabled user's name in a grammar file.

When the Unified Messaging server creates a speech grammar file, it examines many directory objects to determine which names should be added to the speech grammar file. The types of objects it processes are based on the scope of the grammar being created. However, for all these objects, Unified Messaging won't add the object to the grammar if the object is hidden from the Exchange 2010 address lists or the msExchHideFromAddressLists attribute is set to true for the object.

  • For the global address list grammar file, Unified Messaging will consider the following:

    • Mail-enabled users

    • Mail-enabled contacts

  • For dial plan grammar files, Unified Messaging will consider the following:

    • UM-enabled users in the specified dial plan
  • For the distribution list grammar file, Unified Messaging will consider the following:

    • Distribution lists that are visible in address lists

A default global address list is created when the Mailbox server role is installed on a computer running Exchange 2010. When the Unified Messaging server role is installed, it creates a grammar file for the global address list based on the speech grammar filters that are configured. If you create custom address lists or distribution lists in your Exchange 2010 organization, additional grammar files will be created for each custom address list or distribution list you create.

If you create an address list that contains, for example, all recipients in a particular department, and then later add a new user in this department, the recipient won't be included as a member of the address list until you run the Update-AddressList cmdlet.

If you create an address list that contains, for example, all recipients in a particular department, and then the membership of the address list changes, you must run the Update-AddressList cmdlet before Unified Messaging name speech grammar generation occurs. This ensures that, when the grammar is generated or updated, it will contain all the recipients currently in the address list. When you run the Update-AddressList cmdlet, it will include each recipient in every address list that the recipient is a member of.

If a UM-enabled user isn't stamped as a member of an address list before grammar generation occurs, the user won't be added as a member. The next time grammar generation occurs, either on the defined schedule or manually when you run galgrammargenerator.exe, the UM-enabled user won't be added to the grammar for the address list. Therefore, their name won't be available when the directory is searched.


For a grammar file to be generated for a distribution list, the distribution list must not be hidden.

When you first create a UM dial plan, no grammar files are created. However, when a Unified Messaging server joins a dial plan for the first time, a single grammar file for the UM dial plan is created in the appropriate language folder. The UM dial plan speech grammar file is then filtered to include only UM-enabled users associated with the dial plan. The grammar files for these objects are named using the GUIDs of the objects they represent after they're compiled, for example, 2da514a1-06f4-44a1-9ce5-610854f7d2ee.grxml or the corresponding .cfg file.

When the grammar files for UM dial plans, the global address list, address lists, and distribution lists are created, they're created in a language-specific folder on the local Unified Messaging server. The language folder used is selected based on the default language that is configured on the UM dial plan. For example, if the default language on the dial plan is set to US-English (en-US), a grammar file will be created in the <Program Files>\Microsoft\ Exchange Server\V14\UnifiedMessaging\grammars\en folder. After the grammar file is created, it will be updated according to the schedule that is configured on the Unified Messaging server.

For more information, see the following topics:

Grammar Generation

Frequently, the default grammar generation schedule will meet your needs. However, there are times when you must manually generate grammar files or update existing grammar files before the scheduled grammar generation task runs. There may also be times when you want to change the default grammar generation schedule.

Grammar generation occurs in the following situations:

  • When the Unified Messaging server is added to a UM dial plan, and daily after that at a scheduled interval.

  • When you run the galgrammargenerator.exe command to manually update or create grammar files.

The grammar file that is created is then updated when the scheduled grammar generation task runs. To display the default grammar generation schedule for a UM server, use the following cmdlet in the Exchange Management Shell:

(Get-UMServer $env:COMPUTERNAME).GrammarGenerationSchedule

For more information about the Get-UMServer cmdlet, see Get-UMServer.

By default, grammar generation occurs daily at the time specified by the GrammarGenerationSchedule parameter of the UM server. By default, the schedule is defined so that grammar generation starts at 2:00 A.M. each day. However, the grammar generation schedule can be changed and is controlled using the Set-UMserver cmdlet in the Shell. There is no graphical user interface that you can use to control the grammar generator schedule. This schedule can be controlled only by using the Set-UMserver cmdlet in the Shell. For more information about how to change the phonetic display name using the Set-UMServer cmdlet, see Set-UMServer.

By default, the grammar generation schedule is set to start once a day at 2:00 A.M. local time on the UM server. After it starts, grammar generation will run until it is completed, whether this is before the scheduled end time for the active period or not. Grammar generation won't run if there is another grammar generation that is running. Although you can configure additional scheduled times, grammar generation won't run within one hour of a previously scheduled grammar generation period. Because grammar generation uses lots of system resources, we recommend that you configure all grammar generation schedules so that grammar generation will occur during off-peak hours. However, you can stagger the grammar generation schedules on multiple UM servers, for example, Umserver1 starts at 2:00 A.M., Umserver2 starts at 2:30 A.M., and Umserver3 starts at 3:00 A.M. This helps minimize the effect of grammar generation on the Active Directory domain controllers.


A log file named UMSpeechGrammar.log will be created in the %ExchangeRoot%\UnifiedMessaging\temp folder. This log file contains information about all grammar files created or updated on a UM server. This file will be overwritten every time that scheduled grammar generation runs.

In the following circumstances, you can wait for the next scheduled grammar generation for the changes to be reflected, or you can force an update using the galgrammargenerator.exe command:

  • When you complete a new installation of the UM server role and enable users for Unified Messaging

  • When a UM dial plan, UM auto attendant, custom address list, or custom distribution list is created

  • When you create UM-enabled users

  • If you change a UM dial plan or UM auto attendant


When an Outlook Voice Access user tries to locate a UM-enabled user using the directory search feature with ASR immediately after you complete a new installation of the Unified Messaging server role and enabled users for UM, the caller will hear a system prompt that says, "I'm sorry I couldn't help." Then they are disconnected. This occurs because a grammar file for the global address list hasn't been generated. Use the galgrammargenerator.exe command to create the required grammar file for the global address list.

Each grammar file is overwritten every time that the Microsoft Exchange Unified Messaging service automatically runs or when you manually run the galgrammargenerator.exe program to force an update of the grammar files. This ensures that users who have just been enabled for UM can be accessed from the directory search in a time-efficient manner when a caller uses ASR. You can use galgrammargenerator.exe to force an update, or to generate or overwrite the grammar files used by Unified Messaging if they become corrupted. For example, when you first enable users for Unified Messaging, those users won't be available to callers who use ASR to perform a directory search until the scheduled grammar generation task runs. To make sure that those new users who were recently UM-enabled are visible to callers, run the galgrammargenerator.exe program to force the .grxml files to be created or updated and to compile the appropriate .cfg files so that callers can use ASR to move through the menu systems or locate users using ASR. For detailed steps, see Update the Speech Grammar Files on a UM Server.

Galgrammargenerator.exe is also useful when a UM server has joined a dial plan and one or more speech-enabled auto attendants are associated with the dial plan. By default, callers who call into a speech-enabled auto attendant can only reach UM-enabled users who are associated with the dial plan. Before callers can be transferred to UM-enabled users using voice inputs, a grammar file must be generated. The grammar file isn't generated automatically when the server joins a dial plan. Instead, it is generated the next time grammar generation is scheduled. Grammar generation occurs according to the default schedule, at 2:00 AM local time each day, unless the schedule has been changed.

If you want UM-enabled users to be available from a directory search from the speech-enabled auto attendant immediately after you create the auto attendant, you must generate the required grammar file for the auto attendant using galgrammargenerator.exe with the –d option.

A grammar file isn't required with auto attendants that aren't speech-enabled. This is because a DTMF map is added to Active Directory for each user when they're enabled for Unified Messaging. DTMF maps enable callers to enter the digits that correspond to the letters of the user's name or e-mail alias on a telephone keypad.

However, a DTMF map won't automatically be created for users who aren't UM-enabled. By using galgrammargenerator.exe with the -u option, you can generate a DTMF map for all users who are mail-enabled but not UM-enabled. This lets users who are mail-enabled but not UM-enabled be reached from the auto attendant when their name or e-mail alias is entered by a caller using DTMF inputs. For more information about the DTMF interface, see Understanding the DTMF Interface.

The following table lists the switches and descriptions for the switches for galgrammargenerator.exe.

Galgrammargenerator.exe and the switches

Switch Description

-d <dialplan>

Creates a grammar file that contains the names of UM-enabled users only in the specified UM dial plan.


Generates the grammar file.


Generates a grammar file for a distribution list.


Generates a log file. The path can be an absolute path, for example, C:\Logfiles. By default, the UM server will also automatically create a log file in the \UnifiedMessaging\Temp folder.


Preloads all generated grammars into the Microsoft Speech Server platform.

-s <UMserver>

Creates a grammar file for each UM dial plan to which the specified UM server belongs.


Creates or updates DTMF maps for users who are enabled for UM and who aren't enabled for UM.


If mailbox-enabled users or mail-enabled contacts have an invalid character in their e-mail alias, and you run the galgrammargenerator.exe /u command to create a DTMF map for users, the command doesn't complete successfully, and Unified Messaging reports an error. To make sure that all mailbox users and mail-enabled contacts have no invalid characters in their e-mail addresses, use the Get-User cmdlet to view all users. The Get-User cmdlet performs a validation check for the user attributes. If any field has a character that isn't valid, an error is generated that identifies the recipient and the field that contains the invalid character.


Defines the speech filter list that is used in XML format.


The default speech grammar filter list (SpeechGrammarFilterList.xml) is installed in the <Program Files>\Microsoft\ Exchange Server\V14\Bin folder on each server that has the Unified Messaging server role installed. The contents of the speech filter list file must be the same on each UM server. The speech grammar filter list contains several rules that specify input patterns against which display names are matched and output patterns that define transformations of the matched name. If the name matches a pattern, it will be replaced in the speech grammar by the name or names generated from the associated output pattern or patterns. If the name doesn't match a pattern, it is passed through unchanged to the speech grammar. Names will be rejected from insertion in the speech grammar if they to have two or more distinct ways of being said. We recommend that you don't manually modify the SpeechGrammarFilterList.xml file.

Customizing Grammar Files

Currently, ASR is available only in English and includes the prerecorded prompts and Text-to-Speech (TTS) support for English. Although ASR support is included in the English language pack, there are times when it is difficult for speech recognition to locate the correct UM-enabled user because the user has a name that is difficult to pronounce, the caller's speech is matched against the wrong name, or the caller speaks a form of the user's name that differs from the name that exists in the speech grammar. However, adding an additional UM language pack won't resolve this problem.


Because ASR is enabled by default for U.S. English, a folder named \grammars\en is created on each Unified Messaging server. A folder is created for each language pack you install on the Unified Messaging server.

Unified Messaging uses two Active Directory attributes to generate names to use with ASR grammar files: Display name (displayName) and Phonetic display name (msDS-PhoneticName). By default, Unified Messaging uses the displayName attribute to recognize the name of a user when a caller speaks their name. This works well if the user's name is easy to pronounce. However, in some cases, users have names that are difficult to pronounce. To help Unified Messaging find users whose names are difficult to pronounce, we recommend that you configure the Unified Messaging system by supplying a phonetic display name for users who have names that ASR has trouble recognizing. However, to supply a phonetic display name, you must predict how the UCMA would perceive a certain spelling of a name to provide an accurate pronunciation for the phonetic name.


By default, the UM server will try to insert both the phonetic display name, if one exists, and the display name into the speech grammar file.

For example, the display name "Kweku Ako-Adjei" could be given a phonetic display name of "Quaykoo Akoo Oddjay", and UM would insert that into the speech grammar file. The drawback to creating phonetic names for users is that it is difficult to do on a large scale. It would be very time-consuming to create and test phonetic display names for every user whose name isn't correctly recognized by ASR, especially in large enterprise environments.

To add or change the phonetic display name for a UM-enabled user, you must use ADSI Edit (AdsiEdit.msc) or the Set-User cmdlet in the Shell. You can't use Active Directory Users and Computers or the Exchange Management Console to change a user's phonetic display name. For more information about how to change a phonetic display name using the Set-User cmdlet, see Set-User.

The PhoneticDisplayName parameter specifies a phonetic pronunciation for the display name. The display name is specified using the DisplayName parameter. If the display name isn't easy for the UM server to pronounce or recognize, you can use the PhoneticDisplayName parameter to specify a phonetic version. If you specify a value, it is used by ASR to recognize the user's name and by the TTS engine to pronounce the user's name. If you don't specify a value, the UM server uses the DisplayName parameter. The maximum length of this parameter value is 255 characters.

For more information about ADSI Edit, see Adsiedit Overview.

For More Information

Update the Speech Grammar Files on a UM Server

Understanding Unified Messaging Dial Plans

Understanding Unified Messaging Auto Attendants

 © 2010 Microsoft Corporation. All rights reserved.