On Fri, Dec 4, 2009 at 7:58 AM, Neil Patel
<neilp@cs.stanford.edu> wrote:
Hi All,
I haven't found a substantial example of IVR applications implemented in lua. Can anyone suggest where to look? My issue has to do with appropriate coding style.
I am implementing a voice message board application in lua. I want to allow the user to dial buttons to navigate forward and back in the list of messages. One way to implement playmessage() is to check for a forward/back command while playing the current message, and if a command is given to invoke playmessage() with the prev/next message in the list. However, this leaves a chain of unreturned playmessage calls on the execution stack (a recursive function).
Alternatively, the playmessage() function can return control to its caller (perhaps a while loop that spins forever) and pass back a code to indicate the command. The caller acts accordingly. This is non-recursive, but for anything but simple applications this style becomes tedious as you start needing to pass back more info and up longer chains of functions.
Any guidance on this would be appreciated.
Thanks,
Neil
Sorry for the late response. Tony and I have just gotten to the point in the book we're writing that deals with IVRs so I've started looking at this much more closely. Lua (and Perl, PHP, and the other swig'd langs) support a light OOP way of defining IVR menus (via the IVRMenu class, btw) in a dynamic way. I've got the demo IVR all converted to a Lua script with the exception that I've got a bug to track down when using "menu-sub" as an action. (Says that the menu is invalid when I try it; I am gonna work with bkw when we get a few minutes...)
Anyway, here's what I've got so far and I intend to drop it into the scripts/lua directory in the source tree once we confirm that it all works.