Sample dialplan I made pointing to different greeting message and a diversion to mobile call after hours on weekdays and a different day of the week, this is with SailPBX installed.
Add a comment
exten => s,1,GotoIfTime(17:00-07:58,mon-fri,*,*?whattodoafterhours) same => n,GotoIfTime(6:00-23:58,sun,*,*?leavevoicemail:closed) ; Below will work for M-F 7pm-7:58am (Asterisk allows 2 minutes gap, so no point typing 7:59) same => n(whattodoafterhours),Playback(pls-wait-connect-call)
; To dial internal extension number 5000 same => n,Dial(SIP/5000)
; Or you can also enable to divert to mobile number, then comment the next line below ;same => n,Dial(SIP/0412345678@peer4041) same => n,Hangup ; Below is applicable for Sunday only same => n(leavevoicemail),Background(usergreeting3001)
; Caller will leave a voicemail to extension number 5000 mailbox same => n,Voicemail(5000,su) same => n,Hangup same => n(closed),agi(sarkhpe,Inbound,Main,,)