AGI Timeouts

Is there a way to force an AGI Script to automatically timeout after x seconds even if it is not completed running?

I had a situation come up last night where my M$ SQL Server had a locking issue due poor program logic. This ended up causing some of the AGI Scripts to take longer to complete, and that cascaded into a failure of both my db Server and my Phone System, and the end result was that I sat oblivious to the entire thing watching Tivo until one of 3 customers with my direct cell phone called me to tell me about it.


I use M$ SQL Server (don’t even suggest mySQL) to maintain a CDR, and a few other IVR functions for my Asterisk 1.6 box, the primary purpose is to allow live interaction from a number of my other systems w/ the Phone system.

But for incoming calls, the only purpose of the SQL interface is to get a GUID for MixMon to use as a filename, and to get the status of the extensions (employee working or not, where to dial etc). I actually wrote the extensions.conf so that the calls have failovers if the AGI failed to return what it is supposed to. But apparently I missed this timeout function, and it still took the system down.