Sunday, April 17, 2011

Building an IVR Survey App with Grails 1

I have been exercising my Grails skills lately while working on an IVR based survey application. Grails is a pretty incredible platform for an IVR application because of Groovy's builder infrastructure. We can exploit Groovy's MarkupBuilder to create XML, specifically VXML, on the fly with minimal effort. I will post more about my progress of the Grails IVR survey application as things progress. I am considering open sourcing the code on github, but I think I need to prove it out a bit first. In Groovy/Grails we can do things like this:

render (contentType:"text/xml") {
    vxml(version:"2.1") {
        form ("", id:"survey") {
            block {
                audio (src: "/ivr-survey/prompt/fetch/${}")
                prompt (promptInstance.text)
                "goto" (next: "/nextPrompt")

Above we can utilize the render method in a Grails controller to respond with XML/VXML and the promptInstance (an instance of a Prompt class) in order to drive the application dynamically based on the current prompt in the call flow. There is quite a bit of stuff going on around the above snippet, so I will dig deeper into the application in the next post.