How to count the rings

Hi there. Because of other equipment on the line that can’t go through Asterisk hardware (building monitoring gear, etc.) I need to be able to count the rings before answering the phone.

exten => s,n,Wait(18)
exten => s,n,Answer

does not work because it will answer regardless after 4 rings, which causes issues with the communications from the building monitor system which has already answered.

Short of getting or building one of those old answering machine cutoff phone splitters that used to be in dollar stores, how can I do this in Asterisk software?

If there is someway to detect a ring has come in after the first ring? If so, I can count the rings via a variable before I tell it to answer.

Thanks
Jeff

Negative, there’s not a way to count rings.