Help setting up afterhours

I’ve just been put in charge of our asterisk system. I understand some of the concepts but need a little help.

Currently, I have a phoneline setup where it plays a standard greeting that plays anytime. I want to setup an afterhours greeting. I need the current standard greeting to play from the 7:30-6:00, Monday-Friday. Otherwise, I need the afterhours greeting to play any other time. I have the recordings that I need, just don’t know how or where to set them up. Here is what I have currently in place. Any help would be great.

The name of the files I need are:

501xxxxxxx_standard_greeting
501xxxxxxx_afterhours_greeting

Thanks,
Nathan

[501xxxxxxx]
exten => s,1,Answer
exten => s,2,Ringing
exten => s,3,Wait(2)
exten => s,4,Background(501xxxxxxx/501xxxxxxx_standard_greeting)
exten => s,5,Wait(1)
exten => s,6,Ringing
exten => s,7,Wait(1)
exten => s,8,Goto(internal|10002|1)

    ;exten => 1,1,NoOp(${EXTEN})
    exten => 1,1,Goto(501xxxxxxx_extensions,s,1)

    ; send unsorted voicemails here
    exten => 2,1,Voicemail(u12005@default)

    ;invalid extension
    exten => i,1,Goto(|s|4)

Hi Nathan.

You can get away from numbering all of your lines, by using n after the first one. This helps when trying to add or insert new lines. Also you can use labels to help with jumping around.

You can make use of the GotoIfTime to handle the night/day difference.

Below is a way in which you could modify your dialplan…

[501xxxxxxx]
exten => s,1,Answer
exten => s,n,Ringing
exten => s,n,Wait(2)
exten => s,n(replay),GotoIfTime(7:30-18:00|Mon-Fri|*|*?s|day)
exten => s,n(night),Background(501xxxxxxx/501xxxxxxx_afterhours_greeting)
exten => s,n,Goto(s,resume)
exten => s,n(day),Background(501xxxxxxx/501xxxxxxx_standard_greeting)
exten => s,n(resume),Wait(1)
exten => s,n,Ringing
exten => s,n,Wait(1)
exten => s,n,Goto(internal|10002|1)

;exten => 1,1,NoOp(${EXTEN})
exten => 1,1,Goto(501xxxxxxx_extensions,s,1)

; send unsorted voicemails here
exten => 2,1,Voicemail(u12005@default)

;invalid extension
exten => i,1,Goto(|s|replay)

Be sure to check out the book Asterisk: the Future of Telephony if you havent. Find it here: http://downloads.oreilly.com/books/9780596510480.pdf