Thanks for the patch. Unfortunately the bug persists. The debug output has changed though. It looks like the closed time is now being recognised by the script, however an open call restriction is still restricted even when the system is closed and a closed call restriction is still not restricted at all.
Here is the debug output:
Closed period with closed call restriction
-- Executing [0403029xxx@internal:1] AGI("SIP/3001-08dd4078", "selintra|OutCos|0403029xxx") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/selintra
AGI Tx >> agi_request: selintra
AGI Tx >> agi_channel: SIP/3001-08dd4078
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1221011030.5
AGI Tx >> agi_callerid: 3001
AGI Tx >> agi_calleridname: 3001
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 0403029xxx
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: internal
AGI Tx >> agi_extension: 0403029xxx
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << DATABASE GET "STAT" "OCSTAT"
AGI Tx >> 200 result=1 (AUTO)
AGI Rx << GET VARIABLE IFTIME(11:00-12:00|*|*|*?CLOSED:OPEN)
AGI Tx >> 200 result=1 (CLOSED)
AGI Rx << SET PRIORITY 1
AGI Tx >> 200 result=0
AGI Rx << SET EXTENSION 0403029xxx
AGI Tx >> 200 result=0
AGI Rx << SET CONTEXT 3001closedcos
AGI Tx >> 200 result=0
-- AGI Script selintra completed, returning 0
-- Executing [0403029xxx@3001closedcos:1] AGI("SIP/3001-08dd4078", "selintra|OutCluster|0403029xxx") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/selintra
Closed period with open call restriction
-- Executing [0403029xxx@internal:1] AGI("SIP/3001-08dbd420", "selintra|OutCos|0403029xxx") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/selintra
AGI Tx >> agi_request: selintra
AGI Tx >> agi_channel: SIP/3001-08dbd420
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1221011263.7
AGI Tx >> agi_callerid: 3001
AGI Tx >> agi_calleridname: 3001
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 0403029xxx
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: internal
AGI Tx >> agi_extension: 0403029xxx
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << DATABASE GET "STAT" "OCSTAT"
AGI Tx >> 200 result=1 (AUTO)
AGI Rx << GET VARIABLE IFTIME(11:00-12:00|*|*|*?CLOSED:OPEN)
AGI Tx >> 200 result=1 (CLOSED)
AGI Rx << SET PRIORITY 1
AGI Tx >> 200 result=0
AGI Rx << SET EXTENSION 0403029xxx
AGI Tx >> 200 result=0
AGI Rx << SET CONTEXT 3001closedcos
AGI Tx >> 200 result=0
-- AGI Script selintra completed, returning 0
-- Executing [0403029xxx@3001closedcos:1] PlayTones("SIP/3001-08dbd420", "congestion") in new stack
-- Executing [0403029xxx@3001closedcos:2] Hangup("SIP/3001-08dbd420", "") in new stack
== Spawn extension (3001closedcos, 0403029xxx, 2) exited non-zero on 'SIP/3001-08dbd420'