Summary
Lua is a great choice for building simple and elegant voice applications for interacting with callers. It is very lightweight and is therefore scalable. It has a simple syntax that is easy to learn and there is ample online documentation.
In this chapter, we accomplished a number of objectives:
Became acquainted with basic Lua syntax and control structures
Wrote several scripts that demonstrate how to interact with a caller, including answering, hanging up, playing sound files, playing Phrase Macros, and accepting input from the caller
Learned how to use the
freeswitch
object to send log messages to the console and to execute API commandsInstalled LuaSQL and demonstrated how to connect to a PostgreSQL database from within a Lua script
Built
mod_curl
and enabled it to be loaded by defaultDemonstrated the use of curl requests to perform web calls from within a Lua script
Became familiar with Lua's pattern-matching syntax
Now that we have a basis for writing scripts to interact with a caller...