[asterisk-dev] Asterisk bridging framework

Joshua C. Colp jcolp at sangoma.com
Wed Dec 27 17:51:38 CST 2023


On Wed, Dec 27, 2023 at 5:23 PM <asterisk at phreaknet.org> wrote:

> A few questions about the native bridging framework:
>
> In contrast to DAHDI conferencing, which still requires manually
> servicing each channel in the conference, in whatever arbitrary threads
> desired, the bridging API is more "event oriented". I have a couple
> questions about the latter:
>
>   * Is there any way to retain control of a channel in a bridge and
>     service it manually, e.g. call ast_waitfor/ast_read on it? It seems
>     when a channel is imparted to a bridge, a thread is always created,
>     with the only difference being you don't need to join it later with
>     AST_BRIDGE_IMPART_CHAN_INDEPENDENT. I'm pretty sure the answer is
>     'no', since that's the entire point of native bridging, but just
>     want to confirm that... (and that the bridging framework requires 1
>     thread per channel)
>

No. Servicing is yielded to the bridge on being put into a bridge. Control
can be temporarily yielded to a different thread using ast_bridge_suspend
and returned to the bridge using ast_bridge_unsuspend while in a bridge.


>   * There are a couple functions for hooking into the bridge, e.g.
>     ast_bridge_dtmf_hook for DTMF events and ast_bridge_interval_hook
>     periodically. I don't see anything more generic than this, though.
>     Say that for certain channels in the bridge I wanted to intercept
>     the voice frames from the bridge and modify them. I suppose you just
>     use framehooks as usual on the channel? I'm guessing there's no
>     difference in behavior, and that ast_bridge_dtmf_hook is purely a
>     convenience function.
>

Framehooks would be used for that purpose. DTMF hooks aren't strictly a
convenience, because they are aware of the threading model of bridging and
can do things within the confines of the bridge without leaving it.


>   * Is there any current way to detect if a channel is muted in a
>     bridge? There's an ast_channel_suppress API, but no API to read the
>     datastore, and I don't see anything else that seems relevant to
>     determining this. Not sure if I've missed something... would code
>     need to be added to do this?
>

There is no explicit API for the bridge level muting to check, but provided
the channel lock was held you could probably grab the ast_bridge_channel
using ast_channel_get_bridge_channel, and then look at the features, and
check mute. If the suppress API method is used instead to mute it and an
API doesn't exist for that, then it would have to be extended.

-- 
Joshua C. Colp
Director of Engineering | Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20231227/8272ce38/attachment.html>


More information about the asterisk-dev mailing list