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

Using conditionals, loops, web calls, and regular expressions

This recipe helps us demonstrate the loops and other conditionals prevailing in Lua scripts. You will get also familiar with regular expressions and web calls.

Getting ready

Create a dialplan extension 12347 that will call our third Lua script. Edit the /usr/local/freeswitch/conf/dialplan/default/03_advanced.xml file:

<include> <extension name="Advanced Lua Script"> <condition field="destination_number" expression="^(12347)$"> <action application="answer"/> <action application="sleep" data="1000"/> <action application="playback" data="ivr/ivr-welcome_to_freeswitch.wav"/> <action application="sleep" data="500"/> <action application="lua" data="advanced.lua"/> <action application="playback" ...

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