Route incoming call to my time condition

Hi,

I m trying to configure time conditions through cli root, im unable to do from GUI.

My Currently Inbound Route set in Extension.conf
exten=>_X.,1,Dial(sip/200)
exten=>n,hangup

above is my current setting if anyone dial to my landline goes to 200 ext

how do i route incoming call to my time condition, as follows

During Office Hours 8 AM to 5 PM, ->>should goes to 200 Ext.

and After Hours Call after 5 PM to 8 AM - >> Should goes to System Recording"We are currently not available, please leave your message, we will revert back to you"

How do I configure the above from CLI in Extension.conf.

Thanks in Advance.
Sam

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

GotoIfTime(times,days_of_week,days_of_month,months?label)

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:

times

Time ranges, in 24-hour format

days_of_week

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

days_of_month

Days of the month (1-31)

months

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 late on Tuesday and Thursday
exten => s,n,GotoIfTime(09:00-19:59,tue&thru,*,*?open,s,1)
;
; We're also open from 9am to noon on Saturday
exten => s,n,GotoIfTime(09:00-11:59,sat,*,*?open,s,1)
;
; Otherwise, we're closed
exten => s,n,Goto(closed,s,1)

asteriskdocs.org/en/2nd_Edit … -B-91.html

1 Like

You don’t need to call Hangup, but if you do, the exten=> line needs to have valid syntax. Yours is missing the extension pattern field.

Examples of how to route by time using conditional contexts are included in the sample configuration files.