VoiceXML with Speech Service Locales

The section explains how VoiceXML can pick speech services based on their locale

BVR determines which speech service it will use by matching a call feature with the required functionality (e.g. ASR or TTS) with the locale of the prompt or grammar. If no locale is specified on a prompt or grammar, the VoiceXML document's locale will be used. Note that VoiceXML document locales use a dash (-) and speech services use an underscore (_). Internally BVR will convert the dashes to underscores before matching the locale to a Call Feature.

For example, if the application has 2 TTS call features assigned, one with a locale of en_US and one with a locale of en_GB, and the VoiceXML prompt has a locale of en-US, the en_US call feature will be used. Therefore, it is possible to use custom locales to switch between different Call Features. For example, if you wish to use MRCPv2 for some en_US TTS and Amazon Polly for other en_US TTS, the MRCPv2 Call Feature could be defined with the locale en_US and the Polly call feature could be defined with the locale en_US_Polly.
Note: It is recommended that MRCPv2 Call Features are defined with standard Locales (such as en_US) as the locale is often sent to the speech platform in MRCPv2, which may not play well with a custom locale.
The locale can then be switched on the fly for a prompt using the xml:lang parameter, for example:
<prompt xml:lang="en-US-Polly">

This same parameter can be used when defining a grammar if using this method for ASR, although currently ASR is only supported with MRCPv2.

The primary purpose of using xml:lang to select a speech service is to switch between locales based on language. For example, you may wish to say something in US English followed by Spanish. An example of how you would achieve this is:

<prompt xml:lang="en-US">Hello, welcome to Blueworx</prompt>
<prompt xml:lang="es">Hola bienvenido a Blueworx</prompt>