Building voice applications
Now that we have covered the basic Lua syntax, let's create a simple Lua script and the corresponding entry in the Dialplan. First, create a new Dialplan extension that will execute the Lua script when a user dials 9910:
- Open the
01_Custom.xml
file that we created in Chapter 5, Understanding the XML Dialplan, and add the following new extension:<extension name="Simple Lua Test"> <condition field="destination_number" expression="^(9910)$"> <action application="lua" data="test1.lua"/> </condition> </extension>
- Save the file. Launch
fs_cli
and issuereload_xml
,or press F6.
Our Dialplan is now ready to call the Lua script named test1.lua
. Create this new script as follows:
- Using your text editor, create
test1.lua
in thefreeswitch/scripts/ ...
Get FreeSWITCH 1.0.6 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.