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" data="ivr/ivr-thank_you.wav"/> <action application="hangup"/> </condition> </extension> </include>
Save...