The daynight module (ver 1.0.2.2) creates a typo in the configuration file which may lead to unexpected results. An example of a daynight configuration in sip_additional.conf:
[app-daynight]
include => app-daynight-custom
exten => 0,1,GotoIf($["${DB(DAYNIGHT/C${EXTEN}}" = "NIGHT"]?timeconditions,1,1:ext-queues,2000,1)
; end of [app-daynight]
[app-daynight-toggle]
include => app-daynight-toggle-custom
exten => *280,1,Answer
exten => *280,n,Wait(1)
exten => *280,n,Set(INDEX=0)
exten => *280,n,Goto(app-daynight-toggle,s,1)
exten => s,1,Set(DAYNIGHTMODE=${DB(DAYNIGHT/C${INDEX}})
exten => s,n,GotoIf($["${DAYNIGHTMODE}" = "NIGHT"]?day:night)
exten => s,n(day),Set(DB(DAYNIGHT/C${INDEX})=DAY)
exten => s,n,Playback(beep&silence/1&day&reception&digits/${INDEX}&enabled)
exten => s,n,Hangup
exten => s,n(night),Set(DB(DAYNIGHT/C${INDEX})=NIGHT)
exten => s,n,Playback(beep&silence/1&beep&silence/1&day&reception&digits/${INDEX}&disabled)
exten => s,n,Hangup
; end of [app-daynight-toggle]
Note the missing right parenthesis when accessing DAYNIGHT/C${INDEX} as well as setting the DAYNIGHTMODE variable.