How use function GotoIfTime()

Hi, In our company we work for 8:00AM to 6:00PM, how can i redirect all incoming calls to SIP/205 when we are closed (6:00PM)
?? If we are open (8:00AM to 5.59) redirect calls to SIP/201

exten => _X.,1,Noop(DDI CALL FROM ${EXTEN})
exten => _X.,n,GotoIfTime(08:00-17:59|mon-fri|*|*?open)
exten => _X.,n(closed),Dial(SIP/205)
exten => _X.,n(closed),Hangup()
exten => _X.,n(open),Dial(SIP/201)
exten => _X.,n(open),Hangup()

Or similar, but you get the idea


No, it doesn’t work
i have this

exten=>s,1,Noop(DDI CALL FROM ${EXTEN})

And at everytime the SIP/205 ring, the SIP/201 do not ring when we are close, i test it using this

exten=>s,1,Noop(DDI CALL FROM ${EXTEN})

And my PBX still ringing 205. Im using asterisk 1-4-21.1


Take it from me that’s a working example taken directly from a working system

check your system time and post the cli output of a call.


Sorry to pull this post up from ages ago!

Could anyone let me know how to change the actual message? I have the below set up were mainmenu-hol is the ‘Christmas message’ so can change the dates/ times, etc but I’m not sure where the message is saved or how to change the message. The mainmenu-day is just the out of hours message.

Hopefully this is just a simple change - as I’ve mentioned in other posts I’ve taken this on from an existing set up and just working things out as I go!

exten => s,1,GotoIfTime(||1-4|Jan?mainmenu-hol,s,1)
exten => s,2,GotoIfTime(||25-31|Dec?mainmenu-hol,s,1)
exten => s,3,GotoIfTime(17:00-23:59||24|Dec?mainmenu-hol,s,1)
exten => s,4,GotoIfTime(8:00-17:00|mon-fri|
exten => s,5,Goto(mainmenu-ooh,s,1)

Look in your dialplan for the context called [mainmenu-hol].

It should have a playback/background command that is playing some sound file. It will indicate were that file is, either by directory on the playback else its in the standard area (/var/lib/asterisk/sounds/en).

You will need to record a new sound file if you wish to change what it says.

I set up in my dialplan,

So I can dial *3000 to record a sound file. It then plays it back.
If I just wish to listen to one. Say if I’ve had someone else record some for me (since they have prettier voices). I can dial *3100 to listen to it.

Later, I just move and rename the files from the /tmp directory to my /var/lib/asterisk/sounds/en/ivr directory.