Call forward after hours

I want my phone to ring elsewhere after hours and on the weekends. Is it possible in Asterisk and if so is it complex?

I am thinking that this could be done in either of two ways

  1. After 5pm the system would start processing calls in new manner.
  2. Each time a call comes in the system would query the clock to find out which way to process the call.

Thanks

Look at GotoIfTime. Below is a rough example.

exten => 111,1,GotoIfTime(17:00-08:00|Mon-Fri||?elsewhere,s,1)
exten => 111,n,GotoIfTime(|Sat-Sun||*?elsewhere,s,1)
exten => 111,n,Dial(SIP/111)
exten => 111,n,Voicemail(111@default,u)

[elsewhere]
exten => s,1,Dial(SIP/222)

The other way is to qualify the nclusion of a context with time constraints, which should be documented in the sample dialplan (GotoIfTime gets a whole section in Asterisk: The Future of Telephony). Which is best will depend on the exact requiement you have. The context method is possibly best for class of service restirctions.