Если ночной режим включается и выключается автоматически, то используем функцию GotoIfTime:
exten => 3000,1,Answer
same => n,GotoIfTime(8:00-19:00,mon-fri,*,*?open)
same => n,Playback(announce/weekend)
same => n,Hangup()
same => n(open),Playback(announce/hello)
same => n,Queue(callcenter,t,,,300)
Если ночной режим включаем вручную, то делаем так:
; toggle night mode variable
=================================================
exten => 999,1,Answer()
same => n,Verbose(1,"NIGHT=${GLOBAL(NIGHT)}")
same => n,GotoIf(${GLOBAL(NIGHT)}?no)
same => n,Set(GLOBAL(NIGHT)=1)
same => n,Playback(announce/nighton)
same => n,Hangup()
same => n(no),Set(GLOBAL(NIGHT)=0)
same => n,Playback(announce/nightoff)
same => n,Hangup()
А потом проверяем значение переменной:
exten => _X.,1,Answer
same => n,GotoIf(${GLOBAL(NIGHT)}?night)
same => n,Background(announce/hello)
same => n,Queue(callcenter,t,,,300)
same => n,Hangup()
same => n(night),Background(announce/weekend)
same => n,Hangup()