[Asterisk-Dev] Manager API Bridge channels help
C. Maj
cmaj-SPAM at freedomcorpse.com
Mon May 16 07:59:31 MST 2005
On Fri, 13 May 2005, mattf waxed:
> Hello,
>
> I've seen the concept of this batted around a few times in the last
> year(taking 2 existing conversations, removing one party from each and
> Bridging them together by way of a Manager API Action: Bridge), but noone
> seems to have gotten it to fully work. I took several pointers from several
> people, but now my lack of knowledge about the core channel handling in
> Asterisk has stopped me.
>
> In the code below you can see that I MASQ both channels I want to bridge
> together and drop the other two, and as far as the talking parties can tell
> they are then connected and the other two lines are dead, (and 'show
> channels' reflects this point as well.). The problem is that one or both of
> the dropped off channels will be stuck in ast_channel_walk_locked mode
> unless you do a hard hangup(in which case the do not disappear from 'show
After the masquerade, aren't they zombies ? I thought there
was an automatic zombie killer. Careful tho with calls to
ast_do_masquerade because that can fail so you should check
the return result. That function in general looks pretty
scary. (Speaking from experience with Resident Evil 4,
anything that creates a bunch of zombies Is A Bad Thing.)
> channels') and even though the 2 bridged lines can converse and show
> channels says they are together, the manager does not return a success or
> failure and it seems to be stuck at the ast_channel_bridge function.
I see that ast_channel_bridge, in channel.c, gets you into a
loop that doesn't break until the bridge ends. The bridge
can end for a variety of reasons: hangup, timeout, etc. Do
you receive the manager "Link" event ? That would be the
confirmation of success, and "Unlink" would be an indication
of failure/end of bridge.
But whenever you see something like:
for (;;) { blah }
you can plan on things going "blah" for a while.
If you really need this action_bridge call to return before
the bridge is completed, you'll need to spawn a new thread
and perform ast_channel_bridge inside there. That might get
pretty thread heavy, tho. But it's used with attended
transfers -- see ast_bridge_call_thread in res_features.c,
and that seems pretty similar to what you are trying to do.
--Chris
--
Chris Maj, Rochester
cmaj_at_freedomcorpse_dot_com
Pronunciation Guide: Maj == May
More information about the asterisk-dev
mailing list