This may seem to be a somewhat silly question but is there any way of telling in the dial plan when an answered call finishes. I am assuming that the dial application terminates the dial plan on a successful call. The ‘g’ option says specifically that the dialplan continues ‘if the destination channel hangs up’ so presumably doesn’t continue the dialplan if the calling channel is the one that hangs up.
If the h extension exists in the current context, it is run at that point.