How to get control on hangup?


I am using g option on dia lcommand, so when the callee hangs up, execution can continue in the dialplan, e.g. connect to a different channel or exten
Now Iam looking for a way to get control when caller hangs up -callee should not be disconnected but reconnected elsewhere