AGI execution after hangup

I’ve got a very nice AGI script that is doing a lot of work with files when people are interacting with the script. This leaves around many temporary files that I’d really like to clean up after the call. My problem is that Asterisk stops executing the script once the call has ended. Is there any way to have Asterisk execute a script upon termination of a call? Or do anything upon termination besides die?

I know I can do this via the Manager interface, and that’s what I’m planning to use. Just thought I’d check for an easier method.

DeadAGI(script) executes after a call has hung up