Task is next. Your .sh bash script will be scheduled in crone tab for every 15 minutes.
Script is running command: asterisk -rx 'sip show channels' to get Asterisk output for current channels.
Based on the outputm if one of IP is repeated more than "n" times - this IP is blocked in IP tables,
Please see file attached [login to view URL] for whole description.
I'm writing on bash(shell script) for Linux systems. my one of last finished script/project - https://www.freelancer.com/projects/php/script-detect-undelivered-emails/ ready to discuss of your task.