Endpoint swapped in bridged channel

I’m not too clear what you are trying to do, and there was a big change in the handling of masquerades after the version whose internal I know best. However, on the versions I’m familiar with channels can be accessed by their unique ID, as well as the channel name, and the channel name should be readable using the CHANNEL function.

An explanation of what your dialplan is trying to do might help, as I suspect most people find they don’t have to treat this case specially.