Monitor ZAP

I would like to keep the number of ZAP channels engaged for each server Asterisk without exceeding a given threshold, say 75 channels. If exceeded, I would like to run some custom commands (such as AGI). Can I enforce this through the Asterisk dialplan or other programmatic approach?