This is a very common requirement that route the calls to Voice-mail after office hours. Or you can transfer the calls to your cell phone after certain time say 6:00pm. In Asterisk you can also control the call location based on time and date.

[AutoAttendant]
exten => start,1,Verbose(2,Entering our auto-attedant)
same => n,Answer()
same => n,Playback(silence/1)
; We’re closed on New Years Eve, New Years Day, Christmas Eve, and Christmas Day
same => n,GotoIfTime(*,*,31,dec?holiday,1)
same => n,GotoIfTime(*,*,1,jan?holiday,1)
same => n,GotoIfTime(*,*,24,dec?holiday,1)
same => n,GotoIfTime(*,*,25,dec?holiday,1);
We can set auto-attendant dialplan to check for national holidays, if that is true,jump to “exten => holiday,1,Verbose(2,We’re closed for a holiday.)”
; Our operational hours are Monday-Friday, 9:00am to 5:00pm.
same => n,GotoIfTime(0900-1700,mon-fri,*,*?open,1:closed,1) ; It true jump to exten open, else jump to exten closed.
exten => open,1,Verbose(2,We’re open!)
same => n,Background(custom/open-greeting)
exten => closed,1,Verbose(2,We’re closed.)
same => n,Playback(custom/closed-greeting)
same => n,Voicemail(general-mailbox@default,u)
same => n,Hangup()
exten => holiday,1,Verbose(2,We’re closed for a holiday.)
same => n,Playback(custom/closed-holiday)
same => n,Voicemail(general-mailbox@default,u)
same => n,Hangup()
GotoIfTime() application is not only good for an auto-attendant but it can be used anywhere in the dialplan. For example sometimes we just want to forward calls to different people based on time, such as when support staff is not in the office on weekends, but are on call:
[support]
exten => 100,1,Verbose(2,Calling Support Staff.)
same => n,GotoIfTime(*,sat&sun,*,*?on_call,1)
same => n,Dial(SIP/support,30)
same => n,Voicemail(support@default,u)
same => n,Hangup()
exten => on_call,1,Verbose(2,Calling On-Call Support Staff.)
same => n,Dial(SIP/didforsale/8888888888&SIP/didforsale/8555555555,30)
same => n,Voicemail(support@default,u)
same => n,Hangup()

Check Out

How to limit the number of calls in asterisk

How to limit number of calls in Asterisk?Limit number of simultaneous calls on Asterisk based SIP Trunk. If you want to limit the number calls for your SIP peer or friend in Asterisk use call-limit in your trunk configuration. Create a trunk: trunkname type=peer...

read more

Asterisk Most frequently used commands

Find most frequently use asterisk commands. This is simple cheat sheet to view what’s happening inside your asterisk server. You can see how many calls, how many users who is communicating with your system.

read more

How to disable icesupport in asterisk

How to disable icesupport in Asterisk? This is for customer using Asterisk flavored PBX. icesupport is enabled by default that causes the call to hangup right after 200 OK. As of writing of this document, DIDForSale registered sip trunk with asterisk does not support...

read more

Learn more about our Products

SIP TRUNKING

PHONE NUMBERS

Visit SIP Trunking Pricing to see which plan suits your business!

With so many options to pick from it can often be hard to decide what’s best.
Our plans have been packaged together to give you optimum output.

Our SIP Trunks are Compatible with wide range of PBX & Platforms.

Share This