[asterisk-dev] Question about ast_async_goto()

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Tue Aug 22 09:35:45 MST 2006


On Tuesday 22 August 2006 10:56, Joshua Colp wrote:
> It's used for things like attended transfers. Basically you have two
> channels in a bridge talking to eachother, but you want to replace one.
> Currently we don't have a way of interacting with the bridge itself to do
> this (it is something that myself and others would like to see). This is
> where masquerading comes into play. Without touching the bridge, you
> masquerade the new channel into the channel you want to replace. The old
> channel dies off, and the two other ones then talk to each other. It's more
> complicated internally naturally, but you get the drift. It's also used for
> things like optimizations of channels in chan_local (this is what happens
> when you don't have /n on the end). Once both Local channels are bridged to
> other channels (like SIP ones) then they can masquerade themselves out of
> existence and the other channels can talk directly.

Ok, so if I understand correctly (based on this and our IRC discussions):

Point 1: The bridging code currently has no provision to say "stop bridging 
A-B and bridge A-C instead"
Point 2: The ability to switch bridge endpoints is very necessary

So, ast_do_masquerade() shifts the channels around under the bridge's nose.  
It basically flips some pointers around, copies some values from the old 
bridged channel to the new to-be-bridged channel, stuffs some pins in some 
dolls and performs a virgin sacrifice... in the end, the to-be-bridged 
channel looks and acts like the was-bridged channel it replaces, at least to 
the bridge code, and the system works as you expected it to.

Is that about right?  The masqueraded channel must keep some old identity 
information around though, as the CDRs aren't screwed up and various status 
commands report the correct channel names.

When you say a channel just "dies off" -- what happens?  The equivalent of a 
hangup (from which perspective, asterisk hanging up the channel, or the 
channel hanging up on asterisk?)

-A.



More information about the asterisk-dev mailing list