O'Reilly logo

FreeSWITCH 1.6 Cookbook by Giovanni Maruzzelli, Michael S Collins, Anthony Minessale II

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a basic Lua script

In this recipe, we will be creating a script that uses the basic Lua functionalities.

Getting ready

You don't need to install or configure anything to be ready to execute Lua scripts to handle your calls. Lua is the standard and preferred FreeSWITCH scripting language, which is compiled and embedded by default.

The script will be called by a dialplan extension, and when the script is finished, the call will be automatically hung up (see the Using conditionals, loops, web calls, and regular expressions recipe later to learn how to change this behavior and have the dialplan continue handling after the Lua script ends).

Create a dialplan extension "12345," which will call our first Lua script. Edit the /usr/local/freeswitch/conf/dialplan/default/01_basic_lua.xml ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required