AGI Script to automatically timeout after X seconds

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

We have a AGI to capture agent/callerID information to our MySQL Server, few query got delayed for some reason and it ended up causing too much load on our MySQL.

You could use normal Unix style timers within the script.

If you want to ‘hide’ a lengthy step in your AGI, you can create a thread to play a prompt like ‘Please wait while we process your credit card’ and then join (pthreads) the threads when the prompt finishes.

In my situation, the card auth (and database activities) usually took less than the length of the prompt so it ‘appeared’ to be instantaneous to the caller.