nuecho / rivr

Rivr is a lightweight open-source dialogue engine enabling Java developers to easily create enterprise-grade VoiceXML applications.
http://rivr.nuecho.com
Other
61 stars 23 forks source link

How to add audio file in the prompt as part of Interaction #19

Open nmvprasad opened 3 years ago

nmvprasad commented 3 years ago

How to add audio file in the prompt as part of Interaction

Interaction interaction = interaction("get-dtmf") .addPrompt(new SpeechSynthesis("say a number between 5 and 10 digits long."))

Also how to use the grammar file while taking user input and collecting user input by listening to his voice

gawi commented 3 years ago

Instead of a SpeechSynthesis, use an AudioFileReference.

To specify a grammar, create a GrammarReference and put it into a SpeechRecognition object. Next, pass this object to the addPrompt and build methods of the Interaction.Builder.

Note: if you don't want the user to be able to barge-in, don't pass it to the addPrompt method.

See cookbook example.