The default dialplan shows you a lot of options to handle time dependent call processing, however if you do insist on using lua:

 

before = 900

after = 1800

now = os.date("%H%M")  

 

if (after > before) and (now > before) and (now > after) then

                …

End

 

Grmt

 

From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of chrisbware@interfree.it
Sent: Friday, November 04, 2011 14:14
To: freeswitch-users@lists.freeswitch.org
Subject: [Freeswitch-users] Lua time condition

 

Hi guys,
 
I'm a Lua newbie. I'd like to route an incoming call using a Lua script, according to time. Basically I need to
specify a Lua condition like the following:
 
If DATE_TIME1 < current_time < DATE_TIME2
then bridge(A)
else bridge(B)
 
 
I hope some Lua guru can help me! 

-------------------------------------------------------------------------------
Valore legale alle tue mail
InterfreePEC - la tua Posta Elettronica Certificata
http://pec.interfree.it
-------------------------------------------------------------------------------