Great. Thanks. I got that sorted out. But this last GotoIF is acting weired. Whether it returns 1 (false) or 0 (true) it still goes to ?continueTwo context. I have included the full script here. It should flow as follows:
1- Read current time.
2- Pull up the callerID and it’s value (last call EPOCH).
3- If it is null go ahead and save the current time/welcome and hangup.
4- If it is not Null then do the MATH and do a GotoIF.
- Based on the values returned, if the last call was more than a week ago then just hangup. If the call was less than a week (epoch < 604800) then go ahead with the welcome msg and hangup.
[custom-test]
exten => s,1,Noop(${EPOCH})
exten => s,n,Set(DB(test/currentTime)=${EPOCH})
exten => s,n,Set(currentTime=${DB(test/currentTime)})
exten => s,n,Noop(${currentTime})
exten => s,n,SayDigits(${currentTime})
exten => s,n,Answer()
exten => s,n,Noop()
exten => s,n,Set(readVarify=${DB(test/${CALLERID(num)})
exten => s,n,SayDigits(${readVarify})
exten => s,n,GotoIf($[${ISNULL(${readVarify})}]?continueTwo:continueOne)
exten => s,n(continueOne),Set(timeDiff=${MATH(${currentTime}-${readVarify},int)})
exten => s,n,GotoIf,($[${timeDiff} < 604800]?continueTwo:bye)
exten => s,n(bye),Playback(welcome)
exten => s,n,Hangup()
exten => s,n(continueTwo),Answer()
exten => s,n,Playback(welcome)
exten => s,n,Noop(${EPOCH})
exten => s,n,Set(DB(test/${CALLERID(num)})=${EPOCH})
exten => s,n,Set(COUNT=${DB(test/${CALLERID(num)})
exten => s,n,Noop(${COUNT})
exten => s,n,SayDigits(${COUNT})
exten => s,n,Hangup()