Skip to main content

$dialer.setAsrConfig

This method overrides the ASR provider settings of the phone channel used for the current call.

tip
The new settings apply only to the current session and don’t affect the global channel settings. They are used until overridden once again or until the call has finished.

Syntax

The method accepts an object with the new ASR settings. It is not necessary to pass all provider settings every time: you only need to specify the ones that should be overridden.

The method returns an object with the new provider settings.

tip
The settings that can be overridden are different for each provider. Refer to the article about $dialer.getAsrConfig to learn which settings there are, and use this method to obtain them in the script.
// Google provider settings
$dialer.setAsrConfig({
lang: "tr-TR",
model: "command_and_search"
});
caution
If you specify object properties not supported by the provider, they will be ignored. If you pass something other than an object (like a string), an error will be raised in the script.

How to use

Most providers support changing the speech recognition language and model. If you are developing a script for the phone bot that should communicate with users in multiple languages, use $dialer.setAsrConfig to change the recognized language dynamically.

state: SpeakFrench
q!: * speak french *
script:
var provider = $dialer.getAsrProvider(); # Get the current provider name

if (provider === "google") {
$dialer.setAsrConfig({ lang: "fr-FR" });
} else {
# For other providers, the properties and values to be overridden may be different
}
a: Comment puis-je vous aider ?

Please note that the code snippet above only illustrates an example and not an actual implementation of language switching. In a real bot script with support for multiple languages, you will also need to:

  • Change the language for speech synthesis as well as for speech recognition. Use the $dialer.setTtsConfig method to do so.
  • Change the NLU language, the classifier content, and the bot reply texts. You can learn more about these aspects of bot development in the multilingual bot tutorial.