$dialer.setAsrConfig
This method overrides the ASR provider settings of the phone channel used for the current call.
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.
$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"
});
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.