GotoIfTime( ) Conditionally branches, depending on the time and day




Branches to the specified extension, if the current time matches the specified time. Each of the elements may be specified either as * (for always) or as a range.

The arguments to this application are:


Time ranges, in 24-hour format


Days of the week (mon, tue, wed, thu, fri, sat, sun)


Days of the month (1-31)


Months (jan, feb, mar, apr, etc.)

    ; If we're open, then go to the open context
    ; We're open from 9am to 6pm Monday through Friday
    exten => s,1,GotoIfTime(09:00-17:59,mon-fri,*,*?open,s,1)
    ; We're also open from 9am to noon on Saturday
    exten => s,2,GotoIfTime(09:00-11:59,sat,*,*?open,s,1)
    ; Otherwise, we're closed
    exten => s,3,Goto(closed,s,1)


See Also

GotoIf( )