How to continue in the dial plan even after channel hangup

Dear Friends,
I am implementing an IVR using Asterisk-Java Fast AGI Implementation.
I have a feature in the IVR, which transfers the call to a support executive.(press 0 to transfer your call… etc etc)
Everything is working fine, but getting the call details is not.
What I mean to say is, after the call with the executive is over, when I try to get the DIALSTATUS, DIALEDTIME etc variables, I get an error (which is trivial because the call is hangup and I cannot get the details after hangup)
What I really want is, to get these variables after the call is hangup. I have seen that DeadAGI addresses tyhis problem.
Sould I call an additional script (apart from the IVR which is AGI) after the IVR is done to get these details? If yes, how do I do this. Because after the first script exits (with hangup or exception), Asterisk stops at that extension and doesnot continue any further. It continues further in the dial plan only if the IVR exits without an error (and without hangup by customer or script). How do I ensure that the DeadAGI script (the second one is ALWAYS called). And my worry is if it is called, will it have access to the channel variables after hangup ?
One more IMP thing Id like to mention is :: I also tried using DEADAGI for the IVR script (the first one). Everything seemed to be fine but for the music on hold(). It seems that the music on hold doesnt work on the DeadAGI. If anyone has observe similar thing and has obtained a solution, please let me know for which I would be very greatful.


see: … sions.conf

Why not write the ivr in plain asterisk script. The structure for it is

extens => s,1,Background() ; press one for xx, 2 for xx 3 for xx etc. etc
exten => 1,1, NoOp(extension to execute when 1 is pressed)
exten => 2,1, NoOp(extension to execute when 3 is pressed)
exten => 3,1, NoOp(extension to execute when 3 is pressed)
exten => h,1, NoOp(extension to execute after hangup)
exten => t,1,Goto(s,1) ; when you wait to long it will play the menu again.

This is basiccaly it, you can make it as complicated and complex as you like, jump to other menus etc. So what is the point using agi scripts for a menu?

I believe the answer to your question is the “h” extension. If one is present in the current context, asterisk will automatically jump there once a channel is hung up.

You would need to use DeadAGI in the “h” extension.