09-09-2024 01:51 PM - edited 09-09-2024 01:52 PM
Hi,
I'm trying to make a multiple locale menu with the voice API using TTS and SVAML. This is something pretty typical, the call start with a message in french that prompt the user to press 1 to continue in french and then a message in english that prompt the user to press 2 to continue in english. In order for the voice to be understandable i have to use two locale, so i tried something like this:
ace = %{
instructions: [
%{name: "say", text: "Bonjour ceci est un appel de #{caller}.", locale: locale_fr},
%{name: "say", text: "This a call from #{caller}.", locale: locale_en},
%{name: "say", text: "Pour le service en français faite le 1.", locale: locale_fr},
%{name: "say", text: "For service in English press 2.", locale: locale_en}
],
action: %{
name: "runMenu",
locale: locale_fr,
menus: [
%{
id: "main",
options: [
%{dtmf: 1, action: "menu(fr)"},
%{dtmf: 2, action: "menu(en)"}
]
},
# The rest of the menus definition.
]
}
}
This is elixir code but should be easy to understand. `%{}` are map ( object )
This is working fine except for one major issue, if we press a number before the "say" instructions are finish, the call end.
So if we press 1 as soon as we here to press 1 for service in french the call hang up.
I'm guessing this is because we are not yet in the `runMenu` action. Is there a way to prevent this?
I can't really put all of my text in the `mainPrompt` field of the "main" menu because i can only choose one locale and it will be either incomprehensible in french or in english.
Thank you!
09-09-2024 02:39 PM
Hi Etienne,
The runMenu mainPrompt field supports using SSML, so you could mix two different languages in the same prompt.
ace = %{
action: %{
name: "runMenu",
mainPrompt: "#ssml[<speak><lang xml:lang='fr-FR'>Bonjour ceci est un appel de #{caller}. Pour le service en français faite le 1.</lang><lang xml:lang='en-UK'>This a call from #{caller}. For service in English press 2.</lang></speak>]"
menus: [
%{
id: "main",
options: [
%{dtmf: 1, action: "menu(fr)"},
%{dtmf: 2, action: "menu(en)"}
]
},
# The rest of the menus definition.
]
}
}
This should work for you. You can read more about how to use SSML here.
Let me know if you have any other questions!
Thanks,