My dialplan with time regulated incoming call forwarding

Catalog of dial plans
mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

My example of time control on incoming call.

Post by mnipp » Sat Nov 07, 2009 11:59 pm

Time for some fine tuning of closed time range.
A third(3)dot will exclude the starttime from the number range

example:

starttime = 1100
stoptime = 0800

(stoptime...starttime)

openhours will now turn true on 1100 not 1101 in previous examples.

A third(3)dot in the open time range (starttime...stoptime) will also see a stoptime(2330) turn openhours false on 2330 not 2331

Code: Select all

 Tz = +11 # Time Zone GMT+11
  t = Time.now.utc + (Tz*60*60)  
  hhmm = t.strftime("%H%M")

starttime = '0800' #  8:00am(0800) to 
stoptime  = '2330' # 11:30pm(2330) 24 hour time 

openhours = stoptime < starttime ? !((stoptime...starttime) === hhmm) : (starttime...stoptime) === hhmm

if openhours then sys.Dial("#{sys.Username}@local")
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

jvwelzen
Posts: 716
Joined: Thu Sep 11, 2008 1:56 pm

Re: My dialplan with time regulated incoming call forwarding

Post by jvwelzen » Sun Apr 04, 2010 10:55 am

I tryed to use mnipp's example to write a DND Mode but the opendays are set to true when the opentimes are set to example 2300 is still not reached

So I merged the opendays with the opentimes and it's seems to be working better

Code: Select all

 Tz = +2 # Time Zone GMT+1 
  t = Time.now.utc + (Tz*60*60)  
  hhmm = t.strftime("%H%M") 

startday = "0"
endday = "5"

starttime = "2300" 
stoptime  = "0630" 

opendays = startday > endday ? !(((endday+1)..(startday-1)) === t.wday) && stoptime < starttime ? !((stoptime...starttime) === hhmm) : (starttime...stoptime) === hhmm : (startday..endday) === t.wday && (starttime...stoptime) === hhmm

   if opendays then sys.Respond(480, "User has DND (Do Not Desturb Mode) enabled")

   else

   callswitch(num, 45) # Piece From The Dialplan From Mike Telis Or replace with sys.Dial

   end

Post Reply