rendered paste body [macro-snap-catch]
exten => s, 1, GotoIf($[ "${CALLERID(num)}" = "" ] ? noforward)
exten => s, n, GotoIf($[ ${ISNULL(${DB(${CALLERID(num)}/ForwardLimit)})} = 1 ] ? noforward)
exten => s, n, GotoIf($[ ${DB(${CALLERID(num)}/ForwardLimit)} == 0 ] ? noforward)
exten => s, n, GotoIf($[ ${DB(${CALLERID(num)}/ForwardUntil)} > ${EPOCH}] ? noforward)
exten => s, n, NoOp(Call caught)
exten => s, n, GotoIf($[${DB(${CALLERID(num)}/ForwardLimit)} == -1] ? calluser)
exten => s, n, Set(DB(${CALLERID(num)}/ForwardLimit) = $[ ${DB(${CALLERID(num)}/ForwardLimit)} - 1 ])
exten => s, n, Set(channel=${DB(${DB(${CALLERID(num)}/ForwardTo)}/Channel)})
exten => s, n(calluser), Dial(${channel},14,tT) ; maybe a goto instead?
exten => s, n(noforward), NoOp(Caller not found in database, continuing dialplan)