This is my approach attempting to solve the problem of a call passing twice over an IAX link.
What happens
Linking two Asterisk via IAX allows to transfer calls between users on a different PBX, this is what happens:
ext_call ------> pbx_a -----IAX link-----> pbx_b ----> user@b
If user@b need to transfer the call back to an user on pbx_a, this is what happens:
ext_call ------> pbx_a -----IAX link-----> pbx_b
user@a <-------- pbx_a <----IAX link------ pbx_b
The call traverses twice the IAX link loosing quality, with lag and wasting bandwith for other calls.
Solution
My solution is based on ChannelRedirect and IAXVAR.
Dialplan sample
Example 1
PBX_A
ctx-