GoToIfTime() Occasionally Skips Valid Rule

My extensions.conf contains the following rules to control our IVR and make sure after hours calls are sent to the appropriate extension.

same => n,Answer()
; this sets the inter-digit timer
same => n,Set(TIMEOUT(digit)=2)
same => n,GotoIfTime(08:00-16:59,mon-fri,*,*?open,1)
same => n,Goto(closed,1)

Some of my customers have complained that they are being sent to the “closed” extension during normal business hours. It seems to be an intermittent problem, and I can’t find any rhyme or reason to why some customers might experience it while most don’t.

As a sanity check, is there anything in the above sequence that might be causing it?

Since I’m not sure when it’s happening, I’m not sure how to debug it. The Master.csv log file just shows that callers are being sent to the closed extension, but doesn’t say why. Anywhere else I should look? Should I just hang out in the Asterisk CLI with debugging turned on waiting for it to happen to a caller?

First step, are you sure that your box’s time is correct? If you’re using NTP, is it synchronizing against a reliable source? Is your timezone set correctly?

You can also add some logging to your dialplan so that you can see this better in the logs. Something like:

Then just compare these logs with when your calls actually came in to see what time Asterisk thinks it is.