In my experience, I think actually the redirection not forwarding or transferring a channel to one extension. Its actually redirecting the sequence of dialplan execution. So by redirecting you have to specify destination context,extension,priority. So that the redirected call take the appropriate call and execute. Unless you specify the context the it may take the default one. If no matching found I think it may disconnected. I think this may be happen to you. It may be identified from the asterisk CLI. I have one another problem when redirecting form one to another context first forwarding extensions hangup only arrive after complete conversation including forwarded extension.
my dialplan as follows:
[forwarding]
;callforwarding
exten => _XXXX,1,Answer()
same => n,Dial(SIP/${EXTEN})
same => n,Hangup()
[external]
exten => _XXXX,1,Answer()
same => n,Dial(SIP/${EXTEN})
same => n,Hangup()
AMI redirect action(php):
$msg="Action: Redirect\r\n";
$msg.="Exten: $ToExten\r\n";
$msg.="Context: forwarding\r\n";
$msg.="Priority: 1\r\n";
$msg.="Channel: $channel\r\n\r\n";
fputs($this->amisocket, $msg);
My issue: Hangup not receiving in time asterisk ami