AGI: Why the script is stop when hangup?


In a AGI script If nobody answer to the call I redirect the caller to a “voiceMail” . I use for that the request “RECORD FILE”.
When the caller finish what he have to say, he will of course hang up.

At this time I would like send a eMail whit the record file just create in attachement-file.

But I can’t do it because when the caller hang up, my AGI script stop.

Could you give me a solution to be able to send my mail ? (the mail adress is in DB mysql, so I can’t use the function voiceMail).



This is recent bahavior in the 1.2 tree of Asterisk. I don’t think it happened this way in 1.2.1 (and certainly not in 1.0.X) and I can’t track where in the code it happened. The way we worked around it is to add this to extensions.conf and write another script to do what we needed done.
exten => h,1,DeadAGI(dead.agi,${EXTEN})

Then you can still execute anything you want after hangup within the AGI you just need to write another script to do it.

Not sure why Asterisk changed like this, but this is the only fix I’ve been able to find for the new immediate-AGI-termination-upon-hangup behavior in Asterisk 1.2.X