A (better) introduction to Rivr

[This post is a contribution of Jean-Philippe Gariépy, lead software developer at Nu Echo.]

In August 2013, Nu Echo announced Rivr, a new open-source Java dialogue engine for VoiceXML. At that moment, the API wasn’t yet frozen and we were expecting feedback before releasing our first stable version. Since that moment, we’ve been working on cleaning up the API, making it more intuitive. We’ve also added more documentation and a set of self-contained examples, the Rivr Cookbook. Being satisfied with the current state of Rivr, we released the 1.0.0 version. This version is ready for production-grade applications. We plan to leave the API compatible for all 1.0.x upcoming versions.

What is Rivr?

In a nutshell, Rivr is a Java library for making IVR applications for VoiceXML platforms. Rivr uses Java servlets to exchange VoiceXML documents between the VoiceXML platform and the application, each document being generated on-the-fly by Rivr. Instead of using the traditional, less powerful state machine abstractions, the developer implements the callflow by the means of a regular Java program. The developer never manipulates VoiceXML directly.

How does it work?

When you write a dialogue with Rivr, you write a Java method that will be invoked by the controller. The controller is usually the DialogueServlet but it can also be a unit test. In this method, whenever you need to perform a VoiceXML action (e.g. play a message, perform speech or DTMF recognition, transfer a call or record a message), you create an OutputTurn object and send it down to the DialogueChannel via the doTurn() method. The latter method will block the dialogue thread until the dialogue channel receives an InputTurn from the controller. Then, the thread will unblock and the method will return the InputTurn to the dialogue. There is no need to be concerned about the complete HTTP round-trip occurring between the servlet and the VoiceXML platform. You just need to call a method and deal with the result, this feels mouch more like a regular library API than a heavy framework.

A dialogue starts with a FirstTurn, then it’s just a series a exchanges of OutputTurns (actions to be run on VoiceXML platform) and InputTurns (the results of those actions) until the dialogue terminates with a LastTurn:

public LastTurn run(FirstTurn firstTurn, DialogueContext context) {
    OutputTurn question1 = ...;
    InputTurn response1 = doTurn(question1, context);

    //do something with the response

    OutputTurn question2 = ...;
    InputTurn response2 = doTurn(question2, context);
    //do something with the response

    //repeat as needed, then provide a dialogue result

    LastTurn dialogueResult = ...;
    return dialogueResult;




Share this:

About the author

Dominique Boucher
I am the CTO of Nu Echo, where I am in charge of leading the technology directions and help turn customer requirements into truly effective products and solutions.

Leave a Reply