<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2176/25/9/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Bridging+API">Asterisk 12 Bridging API</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~mjordan">Matt Jordan</a>
    </h4>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. ast_bridge_join <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Have the currently executing channel join a bridge. This is a blocking operation, and should only be called from the context of an {{ast_channel}}&#39;s {{pbx_thread}}. <span class="diff-added-words"style="background-color: #dfd;">The function will return on one of three locations:</span> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;"># The channel hangs up <br># The channel is booted out <br># The bridge disolves <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">It is up to the caller of the function to decide what happens next. In general, that should be one of three things: <br>* Run the {{h}} extension (if the channel was hung up) <br>* Run the next dialplan location <br>* Perform an {{ast_async_goto}} on the channel <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" ># Relinquish control of the channel after calling this method. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">When the channel leaves the bridge the channel will: <br>* Wait for another thread to claim it with ast_bridge_depart() if not specified as an independent channel <br>* Run a PBX at the set location if exited by AST_SOFTHANGUP_ASYNCGOTO (any exit location datastore is removed) <br>* Run a PBX if a location is specified by datastore <br>* Run the h exten if specifed by datastore then hangup <br>* hangup <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>READ THIS</b><br />The API described below is a work in progress. Certain aspects, such as the semantics of what happens to a channel when it is ejected from a bridge and needs to execute a new location in the dialplan, are still being worked out. Treat the documentation here as a working reference, rather than a contractual guarantee.</td></tr></table></div>

<div>
<ul>
    <li><a href='#Asterisk12BridgingAPI-BridgingFramework'> Bridging Framework</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-Enumerations'>Enumerations</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-astbridgecapability'>ast_bridge_capability</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgechannelstateenum'>ast_bridge_channel_state enum</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgewriteresult'>ast_bridge_write_result</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeactiontype'>ast_bridge_action_type</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgevideomodetype'>ast_bridge_video_mode_type</a></li>
</ul>
    <li><a href='#Asterisk12BridgingAPI-Structures'>Structures</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-astbridgetechoptimizations'>ast_bridge_tech_optimizations</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgechannel'>ast_bridge_channel</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgevideosinglesrcdata'>ast_bridge_video_single_src_data</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgevideotalkersrcdata'>ast_bridge_video_talker_src_data</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgevideomode'>ast_bridge_video_mode</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridge'>ast_bridge</a></li>
</ul>
    <li><a href='#Asterisk12BridgingAPI-Functionsonastbridge'>Functions on ast_bridge</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-astbridgenew'>ast_bridge_new</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgelock'>ast_bridge_lock</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeunlock'>ast_bridge_unlock</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgecheck'>ast_bridge_check</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgedestroy'>ast_bridge_destroy</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgejoin'>ast_bridge_join</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeimpart'>ast_bridge_impart</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgedepart'>ast_bridge_depart</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeremove'>ast_bridge_remove</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgemerge'>ast_bridge_merge</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgesuspend'>ast_bridge_suspend</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeunsuspend'>ast_bridge_unsuspend</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgechangestate'>ast_bridge_change_state</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgesetinternalsamplerate'>ast_bridge_set_internal_sample_rate</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgesetmixinginterval'>ast_bridge_set_mixing_interval</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgesetsinglesrcvideomode'>ast_bridge_set_single_src_video_mode</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgesettalkersrcvideomode'>ast_bridge_set_talker_src_video_mode</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeupdatetalkersrcvideomode'>ast_bridge_update_talker_src_video_mode</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgenumbervideosrc'>ast_bridge_number_video_src</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeisvideosrc'>ast_bridge_is_video_src</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgeremovevideosrc'>ast_bridge_remove_video_src</a></li>
</ul>
</ul>
    <li><a href='#Asterisk12BridgingAPI-BridgingTechnologies'> Bridging Technologies</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-Enumerations'>Enumerations</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-astbridgepreference'>ast_bridge_preference</a></li>
</ul>
    <li><a href='#Asterisk12BridgingAPI-Structs'>Structs</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-astbridgetechnology'>ast_bridge_technology</a></li>
</ul>
    <li><a href='#Asterisk12BridgingAPI-Functions'>Functions</a></li>
<ul>
    <li><a href='#Asterisk12BridgingAPI-astbridgetechnologyregister'>ast_bridge_technology_register</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgetechnologyunregister'>ast_bridge_technology_unregister</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgehandletrip'>ast_bridge_handle_trip</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgenotifytalking'>ast_bridge_notify_talking</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgetechnologysuspend'>ast_bridge_technology_suspend</a></li>
    <li><a href='#Asterisk12BridgingAPI-astbridgetechnologyunsuspend'>ast_bridge_technology_unsuspend</a></li>
</ul>
</ul>
</ul></div>

<h1><a name="Asterisk12BridgingAPI-BridgingFramework"></a><a href="http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction/include/asterisk/bridging.h" class="external-link" rel="nofollow">Bridging Framework</a></h1>

<h2><a name="Asterisk12BridgingAPI-Enumerations"></a>Enumerations</h2>

<h3><a name="Asterisk12BridgingAPI-astbridgecapability"></a>ast_bridge_capability</h3>

<p>A bridge technology uses this when it registers to inform the framework which capabilities it can provide. When a bridge is created, the creator of the bridge can specify capabilities that it knows it will need for that bridge and the framework will choose the best technology that matches those capabilities. Additionally, when conditions in a bridge change such that the technology can no longer meet all of the conditions, the framework will use the capabilities to pick a new technology for the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*! \brief Capabilities for a bridge technology */
enum ast_bridge_capability {
        /*! Bridge is only capable of mixing 2 channels */
        AST_BRIDGE_CAPABILITY_1TO1MIX = (1 &lt;&lt; 1),
        /*! Bridge is capable of mixing 2 or more channels */
        AST_BRIDGE_CAPABILITY_MULTIMIX = (1 &lt;&lt; 2),
        /*! Bridge should natively bridge two channels if possible */
        AST_BRIDGE_CAPABILITY_NATIVE = (1 &lt;&lt; 3),
        /*! Bridge should run using the multithreaded model */
        AST_BRIDGE_CAPABILITY_MULTITHREADED = (1 &lt;&lt; 4),
        /*! Bridge should run a central bridge thread */
        AST_BRIDGE_CAPABILITY_THREAD = (1 &lt;&lt; 5),
        /*! Bridge technology can do video mixing (or something along those lines) */
        AST_BRIDGE_CAPABILITY_VIDEO = (1 &lt;&lt; 6),
        /*! Bridge technology can optimize things based on who is talking */
        AST_BRIDGE_CAPABILITY_OPTIMIZE = (1 &lt;&lt; 7),
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgechannelstateenum"></a>ast_bridge_channel_state enum</h3>

<p>The current state of an <tt>ast_bridge_channel</tt> object.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*! \brief State information about a bridged channel */
enum ast_bridge_channel_state {
        /*! Waiting for a signal (Channel in the bridge) */
        AST_BRIDGE_CHANNEL_STATE_WAIT = 0,
        /*! Bridged channel has ended itself (it has hung up) */
        AST_BRIDGE_CHANNEL_STATE_END,
        /*! Bridged channel was forced out and should be hung up */
        AST_BRIDGE_CHANNEL_STATE_HANGUP,
        /*! Bridged channel was ast_bridge_depart() from the bridge without being hung up */
        AST_BRIDGE_CHANNEL_STATE_DEPART,
        /*! Bridged channel was ast_bridge_depart() from the bridge during AST_BRIDGE_CHANNEL_STATE_END */
        AST_BRIDGE_CHANNEL_STATE_DEPART_END,
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgewriteresult"></a>ast_bridge_write_result</h3>

<p>The possible conditions that a <tt>ast_bridge_technology</tt> write operation can return.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*! \brief Return values for bridge technology write function */
enum ast_bridge_write_result {
        /*! Bridge technology wrote out frame fine */
        AST_BRIDGE_WRITE_SUCCESS = 0,
        /*! Bridge technology attempted to write out the frame but failed */
        AST_BRIDGE_WRITE_FAILED,
        /*! Bridge technology does not support writing out a frame of this type */
        AST_BRIDGE_WRITE_UNSUPPORTED,
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeactiontype"></a>ast_bridge_action_type</h3>

<p>The framework uses this enum to determine the action it is supposed to execute on a channel in a bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">enum ast_bridge_action_type {
        /*! Bridged channel is to detect a feature hook */
        AST_BRIDGE_ACTION_FEATURE,
        /*! Bridged channel is to act on an interval hook */
        AST_BRIDGE_ACTION_INTERVAL,
        /*! Bridged channel is to send a DTMF stream out */
        AST_BRIDGE_ACTION_DTMF_STREAM,
        /*! Bridged channel is to indicate talking start */
        AST_BRIDGE_ACTION_TALKING_START,
        /*! Bridged channel is to indicate talking stop */
        AST_BRIDGE_ACTION_TALKING_STOP,
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgevideomodetype"></a>ast_bridge_video_mode_type</h3>

<p>For bridges that support video, the supported ways in which a bridge can choose the video source.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">enum ast_bridge_video_mode_type {
        /*! Video is not allowed in the bridge */
        AST_BRIDGE_VIDEO_MODE_NONE = 0,
        /*! A single user is picked as the only distributed of video across the bridge */
        AST_BRIDGE_VIDEO_MODE_SINGLE_SRC,
        /*! A single user's video feed is distributed to all bridge channels, but
         *  that feed is automatically picked based on who is talking the most. */
        AST_BRIDGE_VIDEO_MODE_TALKER_SRC,
};</pre>
</div></div>

<h2><a name="Asterisk12BridgingAPI-Structures"></a>Structures</h2>

<h3><a name="Asterisk12BridgingAPI-astbridgetechoptimizations"></a>ast_bridge_tech_optimizations</h3>

<p>Some bridging technologies support advanced talk optimizations/detection operations. This structure provides configuration information for those technologies.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Structure specific to bridge technologies capable of
 * performing talking optimizations.
 */
struct ast_bridge_tech_optimizations {
        /*! The amount of time in ms that talking must be detected before
         *  the dsp determines that talking has occurred */
        unsigned int talking_threshold;
        /*! The amount of time in ms that silence must be detected before
         *  the dsp determines that talking has stopped */
        unsigned int silence_threshold;
        /*! Whether or not the bridging technology should drop audio
         *  detected as silence from the mix. */
        unsigned int drop_silence:1;
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgechannel"></a>ast_bridge_channel</h3>

<p>The <tt>ast_bridge_channel</tt> object maintain the state of an <tt>ast_channel</tt> in a bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Structure that contains information regarding a channel in a bridge
 */
struct ast_bridge_channel {
        /*! Condition, used if we want to wake up a thread waiting on the bridged channel */
        ast_cond_t cond;
        /*! Current bridged channel state */
        enum ast_bridge_channel_state state;
        /*! Asterisk channel participating in the bridge */
        struct ast_channel *chan;
        /*! Asterisk channel we are swapping with (if swapping) */
        struct ast_channel *swap;
        /*! Bridge this channel is participating in */
        struct ast_bridge *bridge;
        /*! Private information unique to the bridge technology */
        void *bridge_pvt;
        /*! Thread handling the bridged channel */
        pthread_t thread;
        /*! Additional file descriptors to look at */
        int fds[4];
        /*! Bit to indicate whether the channel is suspended from the bridge or not */
        unsigned int suspended:1;
        /*! TRUE if the imparted channel must wait for an explicit depart from the bridge to reclaim the channel. */
        unsigned int depart_wait:1;
        /*! Features structure for features that are specific to this channel */
        struct ast_bridge_features *features;
        /*! Technology optimization parameters used by bridging technologies capable of
         *  optimizing based upon talk detection. */
        struct ast_bridge_tech_optimizations tech_args;
        /*! Call ID associated with bridge channel */
        struct ast_callid *callid;
        /*! Linked list information */
        AST_LIST_ENTRY(ast_bridge_channel) entry;
        /*! Queue of actions to perform on the channel. */
        AST_LIST_HEAD_NOLOCK(, ast_frame) action_queue;
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgevideosinglesrcdata"></a>ast_bridge_video_single_src_data</h3>

<p>For bridges that support video that are in AST_BRIDGE_VIDEO_MODE_SINGLE_SRC mode, this structure is used to pass information about the video source.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*! This is used for both SINGLE_SRC mode to set what channel
 *  should be the current single video feed */
struct ast_bridge_video_single_src_data {
        /*! Only accept video coming from this channel */
        struct ast_channel *chan_vsrc;
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgevideotalkersrcdata"></a>ast_bridge_video_talker_src_data</h3>

<p>For bridges that support video that are in AST_BRIDGE_VIDEO_MODE_TALKER_SRC mode, this structure is used to pass information about the source of audio and the possible video sources.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*! This is used for both SINGLE_SRC_TALKER mode to set what channel
 *  should be the current single video feed */
struct ast_bridge_video_talker_src_data {
        /*! Only accept video coming from this channel */
        struct ast_channel *chan_vsrc;
        int average_talking_energy;

        /*! Current talker see's this person */
        struct ast_channel *chan_old_vsrc;
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgevideomode"></a>ast_bridge_video_mode</h3>

<p>This structure acts as a wrapper around the various possible video mode channel information objects.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">struct ast_bridge_video_mode {
        enum ast_bridge_video_mode_type mode;
        /* Add data for all the video modes here. */
        union {
                struct ast_bridge_video_single_src_data single_src_data;
                struct ast_bridge_video_talker_src_data talker_src_data;
        } mode_data;
};</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridge"></a>ast_bridge</h3>

<p>The main bridging type, the <tt>ast_bridge</tt> type defines how a bridge behaves, what technology it uses to perform the operations on the channels in the bridge, what channels are in the bridge, the state of the bridge, and more. Operations on a bridge are performed on an instance of <tt>ast_bridge</tt>.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Structure that contains information about a bridge
 */
struct ast_bridge {
        /*! Condition, used if we want to wake up the bridge thread. */
        ast_cond_t cond;
        /*! Number of channels participating in the bridge */
        int num;
        /*! The video mode this bridge is using */
        struct ast_bridge_video_mode video_mode;
        /*! The internal sample rate this bridge is mixed at when multiple channels are being mixed.
         *  If this value is 0, the bridge technology may auto adjust the internal mixing rate. */
        unsigned int internal_sample_rate;
        /*! The mixing interval indicates how quickly the bridges internal mixing should occur
         * for bridge technologies that mix audio. When set to 0, the bridge tech must choose a
         * default interval for itself. */
        unsigned int internal_mixing_interval;
        /*! Bit to indicate that the bridge thread is waiting on channels in the bridge array */
        unsigned int waiting:1;
        /*! Bit to indicate the bridge thread should stop */
        unsigned int stop:1;
        /*! Bit to indicate the bridge thread should refresh itself */
        unsigned int refresh:1;
        /*! Bridge flags to tweak behavior */
        struct ast_flags feature_flags;
        /*! Bridge technology that is handling the bridge */
        struct ast_bridge_technology *technology;
        /*! Private information unique to the bridge technology */
        void *bridge_pvt;
        /*! Thread running the bridge */
        pthread_t thread;
        /*! Enabled features information */
        struct ast_bridge_features features;
        /*! Array of channels that the bridge thread is currently handling */
        struct ast_channel **array;
        /*! Number of channels in the above array */
        size_t array_num;
        /*! Number of channels the array can handle */
        size_t array_size;
        /*! Call ID associated with the bridge */
        struct ast_callid *callid;
        /*! Linked list of channels participating in the bridge */
        AST_LIST_HEAD_NOLOCK(, ast_bridge_channel) channels;
        /*! Linked list of channels removed from the bridge and waiting to be departed. */
        AST_LIST_HEAD_NOLOCK(, ast_bridge_channel) depart_wait;
};</pre>
</div></div>

<h2><a name="Asterisk12BridgingAPI-Functionsonastbridge"></a>Functions on ast_bridge</h2>

<h3><a name="Asterisk12BridgingAPI-astbridgenew"></a>ast_bridge_new</h3>

<p>Create a new instance of <tt>ast_bridge</tt> with the requested capabilities.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Create a new bridge
 *
 * \param capabilities The capabilities that we require to be used on the bridge
 * \param flags Flags that will alter the behavior of the bridge
 *
 * \retval a pointer to a new bridge on success
 * \retval NULL on failure
 *
 * Example usage:
 *
 * \code
 * struct ast_bridge *bridge;
 * bridge = ast_bridge_new(AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
 * \endcode
 *
 * This creates a simple two party bridge that will be destroyed once one of
 * the channels hangs up.
 */
struct ast_bridge *ast_bridge_new(uint32_t capabilities, int flags);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgelock"></a>ast_bridge_lock</h3>

<p>Lock the bridge. While locked, the state of the bridge cannot be changed by external entities. Internal entities may become blocked as well when they need to change the state of the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Lock the bridge.
 *
 * \param bridge Bridge to lock
 *
 * \return Nothing
 */
#define ast_bridge_lock(bridge)        _ast_bridge_lock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
static inline void _ast_bridge_lock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
{
        __ao2_lock(bridge, AO2_LOCK_REQ_MUTEX, file, function, line, var);
}</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeunlock"></a>ast_bridge_unlock</h3>

<p>Unlock the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Unlock the bridge.
 *
 * \param bridge Bridge to unlock
 *
 * \return Nothing
 */
#define ast_bridge_unlock(bridge)        _ast_bridge_unlock(bridge, __FILE__, __PRETTY_FUNCTION__, __LINE__, #bridge)
static inline void _ast_bridge_unlock(struct ast_bridge *bridge, const char *file, const char *function, int line, const char *var)
{
        __ao2_unlock(bridge, file, function, line, var);
}</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgecheck"></a>ast_bridge_check</h3>

<p>Determine if the Bridging Framework can create a bridge with the requested capabilities.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief See if it is possible to create a bridge
 *
 * \param capabilities The capabilities that the bridge will use
 *
 * \retval 1 if possible
 * \retval 0 if not possible
 *
 * Example usage:
 *
 * \code
 * int possible = ast_bridge_check(AST_BRIDGE_CAPABILITY_1TO1MIX);
 * \endcode
 *
 * This sees if it is possible to create a bridge capable of bridging two channels
 * together.
 */
int ast_bridge_check(uint32_t capabilities);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgedestroy"></a>ast_bridge_destroy</h3>

<p>Explicitly destroy a bridge. Note that a self managing bridge will automatically destroy itself when no more channels are in the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Destroy a bridge
 *
 * \param bridge Bridge to destroy
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_destroy(bridge);
 * \endcode
 *
 * This destroys a bridge that was previously created using ast_bridge_new.
 */
int ast_bridge_destroy(struct ast_bridge *bridge);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgejoin"></a>ast_bridge_join</h3>

<p>Have the currently executing channel join a bridge. This is a blocking operation, and should only be called from the context of an <tt>ast_channel</tt>'s <tt>pbx_thread</tt>. The function will return on one of three locations:</p>
<ol>
        <li>The channel hangs up</li>
        <li>The channel is booted out</li>
        <li>The bridge disolves</li>
</ol>


<p>It is up to the caller of the function to decide what happens next. In general, that should be one of three things:</p>
<ul>
        <li>Run the <tt>h</tt> extension (if the channel was hung up)</li>
        <li>Run the next dialplan location</li>
        <li>Perform an <tt>ast_async_goto</tt> on the channel</li>
</ul>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Join (blocking) a channel to a bridge
 *
 * \param bridge Bridge to join
 * \param chan Channel to join
 * \param swap Channel to swap out if swapping
 * \param features Bridge features structure
 * \param tech_args Optional Bridging tech optimization parameters for this channel.
 *
 * \retval state that channel exited the bridge with
 *
 * Example usage:
 *
 * \code
 * ast_bridge_join(bridge, chan, NULL, NULL);
 * \endcode
 *
 * This adds a channel pointed to by the chan pointer to the bridge pointed to by
 * the bridge pointer. This function will not return until the channel has been
 * removed from the bridge, swapped out for another channel, or has hung up.
 *
 * If this channel will be replacing another channel the other channel can be specified
 * in the swap parameter. The other channel will be thrown out of the bridge in an
 * atomic fashion.
 *
 * If channel specific features are enabled a pointer to the features structure
 * can be specified in the features parameter.
 */
enum ast_bridge_channel_state ast_bridge_join(struct ast_bridge *bridge,
        struct ast_channel *chan,
        struct ast_channel *swap,
        struct ast_bridge_features *features,
        struct ast_bridge_tech_optimizations *tech_args);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeimpart"></a>ast_bridge_impart</h3>

<p>Place an <tt>ast_channel</tt> in a bridge. This is a non-blocking operation. Callers of the function should:</p>
<ol>
        <li>Have control of the channel before placing it in the bridge, i.e., no <tt>pbx_thread</tt> should be executing on the channel</li>
        <li>Relinquish control of the channel after calling this method.</li>
</ol>


<p>When the channel leaves the bridge the channel will:</p>
<ul>
        <li>Wait for another thread to claim it with ast_bridge_depart() if not specified as an independent channel</li>
        <li>Run a PBX at the set location if exited by AST_SOFTHANGUP_ASYNCGOTO (any exit location datastore is removed)</li>
        <li>Run a PBX if a location is specified by datastore</li>
        <li>Run the h exten if specifed by datastore then hangup</li>
        <li>hangup</li>
</ul>



<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Impart (non-blocking) a channel onto a bridge
 *
 * \param bridge Bridge to impart on
 * \param chan Channel to impart
 * \param swap Channel to swap out if swapping.  NULL if not swapping.
 * \param features Bridge features structure. Must be NULL or obtained by ast_bridge_features_new().
 * \param independent TRUE if caller does not want to reclaim the channel using ast_bridge_depart().
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_impart(bridge, chan, NULL, NULL, 0);
 * \endcode
 *
 * \details
 * This adds a channel pointed to by the chan pointer to the
 * bridge pointed to by the bridge pointer.  This function will
 * return immediately and will not wait until the channel is no
 * longer part of the bridge.
 *
 * If this channel will be replacing another channel the other
 * channel can be specified in the swap parameter.  The other
 * channel will be thrown out of the bridge in an atomic
 * fashion.
 *
 * If channel specific features are enabled, a pointer to the
 * features structure can be specified in the features
 * parameter.
 *
 * \note If you impart a channel as not independent you MUST
 * ast_bridge_depart() the channel.  The bridge channel thread
 * is created join-able.  The implication is that the channel is
 * special and is not intended to be moved to another bridge.
 *
 * \note If you impart a channel as independent you must not
 * ast_bridge_depart() the channel.  The bridge channel thread
 * is created non-join-able.  The channel must be treated as if
 * it were placed into the bridge by ast_bridge_join().
 * Channels placed into a bridge by ast_bridge_join() are
 * removed by a third party using ast_bridge_remove().
 */
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, int independent);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgedepart"></a>ast_bridge_depart</h3>

<p>Remove a previously imparted <tt>ast_channel</tt> from the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Depart a channel from a bridge
 *
 * \param bridge Bridge to depart from
 * \param chan Channel to depart
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_depart(bridge, chan);
 * \endcode
 *
 * This removes the channel pointed to by the chan pointer from the bridge
 * pointed to by the bridge pointer and gives control to the calling thread.
 * This does not hang up the channel.
 *
 * \note This API call can only be used on channels that were added to the bridge
 *       using the ast_bridge_impart API call with the independent flag FALSE.
 */
int ast_bridge_depart(struct ast_bridge *bridge, struct ast_channel *chan);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeremove"></a>ast_bridge_remove</h3>

<p>Remove any channel from the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Remove a channel from a bridge
 *
 * \param bridge Bridge that the channel is to be removed from
 * \param chan Channel to remove
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_remove(bridge, chan);
 * \endcode
 *
 * This removes the channel pointed to by the chan pointer from the bridge
 * pointed to by the bridge pointer and requests that it be hung up. Control
 * over the channel will NOT be given to the calling thread.
 *
 * \note This API call can be used on channels that were added to the bridge
 *       using both ast_bridge_join and ast_bridge_impart.
 */
int ast_bridge_remove(struct ast_bridge *bridge, struct ast_channel *chan);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgemerge"></a>ast_bridge_merge</h3>

<p>Merge two bridges together.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Merge two bridges together
 *
 * \param bridge0 First bridge
 * \param bridge1 Second bridge
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_merge(bridge0, bridge1);
 * \endcode
 *
 * This merges the bridge pointed to by bridge1 with the bridge pointed to by bridge0.
 * In reality all of the channels in bridge1 are simply moved to bridge0.
 *
 * \note The second bridge specified is not destroyed when this operation is
 *       completed.
 */
int ast_bridge_merge(struct ast_bridge *bridge0, struct ast_bridge *bridge1);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgesuspend"></a>ast_bridge_suspend</h3>

<p>Suspend a channel from the bridge. Channels that are suspended from the bridge are no longer manipulated by threads in the bridge and can be safely accessed by non-bridge threads. Channels in a bridge <b>must</b> be suspended prior to manipulation by external threads.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Suspend a channel temporarily from a bridge
 *
 * \param bridge Bridge to suspend the channel from
 * \param chan Channel to suspend
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_suspend(bridge, chan);
 * \endcode
 *
 * This suspends the channel pointed to by chan from the bridge pointed to by bridge temporarily.
 * Control of the channel is given to the calling thread. This differs from ast_bridge_depart as
 * the channel will not be removed from the bridge.
 *
 * \note This API call can be used on channels that were added to the bridge
 *       using both ast_bridge_join and ast_bridge_impart.
 */
int ast_bridge_suspend(struct ast_bridge *bridge, struct ast_channel *chan);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeunsuspend"></a>ast_bridge_unsuspend</h3>

<p>Unsuspend a previously suspended channel, returning control of it back to the bridge's threads.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Unsuspend a channel from a bridge
 *
 * \param bridge Bridge to unsuspend the channel from
 * \param chan Channel to unsuspend
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_unsuspend(bridge, chan);
 * \endcode
 *
 * This unsuspends the channel pointed to by chan from the bridge pointed to by bridge.
 * The bridge will go back to handling the channel once this function returns.
 *
 * \note You must not mess with the channel once this function returns.
 *       Doing so may result in bad things happening.
 */
int ast_bridge_unsuspend(struct ast_bridge *bridge, struct ast_channel *chan);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgechangestate"></a>ast_bridge_change_state</h3>

<p>Change the state of a bridged channel.</p>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>WARNING</b><br />You shouldn't use this unless you are implementing a bridging feature hook.</td></tr></table></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Change the state of a bridged channel
 *
 * \param bridge_channel Channel to change the state on
 * \param new_state The new state to place the channel into
 *
 * Example usage:
 *
 * \code
 * ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
 * \endcode
 *
 * This places the channel pointed to by bridge_channel into the state
 * AST_BRIDGE_CHANNEL_STATE_HANGUP.
 *
 * \note This API call is only meant to be used in feature hook callbacks to
 *       request the channel exit the bridge.
 */
void ast_bridge_change_state(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);</pre>
</div></div>


<h3><a name="Asterisk12BridgingAPI-astbridgesetinternalsamplerate"></a>ast_bridge_set_internal_sample_rate</h3>

<p>If a bridging technology supports the multimix capability, set the mixing sampling rate.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Adjust the internal mixing sample rate of a bridge
 * used during multimix mode.
 *
 * \param bridge Channel to change the sample rate on.
 * \param sample_rate the sample rate to change to. If a
 *        value of 0 is passed here, the bridge will be free to pick
 *        what ever sample rate it chooses.
 *
 */
void ast_bridge_set_internal_sample_rate(struct ast_bridge *bridge, unsigned int sample_rate);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgesetmixinginterval"></a>ast_bridge_set_mixing_interval</h3>

<p>If a bridging technology supports the multimix capability, set the mixing interval.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Adjust the internal mixing interval of a bridge used
 * during multimix mode.
 *
 * \param bridge Channel to change the sample rate on.
 * \param mixing_interval the sample rate to change to.  If 0 is set
 * the bridge tech is free to choose any mixing interval it uses by default.
 */
void ast_bridge_set_mixing_interval(struct ast_bridge *bridge, unsigned int mixing_interval);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgesetsinglesrcvideomode"></a>ast_bridge_set_single_src_video_mode</h3>

<p>If a bridging technology supports video, set the single video source to feed to all participants.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Set a bridge to feed a single video source to all participants.
 */
void ast_bridge_set_single_src_video_mode(struct ast_bridge *bridge, struct ast_channel *video_src_chan);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgesettalkersrcvideomode"></a>ast_bridge_set_talker_src_video_mode</h3>

<p>If a bridging technology supports video, set the video mode to use the current talker.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Set the bridge to pick the strongest talker supporting
 * video as the single source video feed
 */
void ast_bridge_set_talker_src_video_mode(struct ast_bridge *bridge);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeupdatetalkersrcvideomode"></a>ast_bridge_update_talker_src_video_mode</h3>

<p>Inform a video capable bridging technology about the talk energy and frame information for a specific channel.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Update information about talker energy for talker src video mode.
 */
void ast_bridge_update_talker_src_video_mode(struct ast_bridge *bridge, struct ast_channel *chan, int talker_energy, int is_keyfame);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgenumbervideosrc"></a>ast_bridge_number_video_src</h3>

<p>Get the number of video sources in the bridge.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Returns the number of video sources currently active in the bridge
 */
int ast_bridge_number_video_src(struct ast_bridge *bridge);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeisvideosrc"></a>ast_bridge_is_video_src</h3>

<p>Return whether or not a channel is a video source.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Determine if a channel is a video src for the bridge
 *
 * \retval 0 Not a current video source of the bridge.
 * \retval None 0, is a video source of the bridge, The number
 *         returned represents the priority this video stream has
 *         on the bridge where 1 is the highest priority.
 */
int ast_bridge_is_video_src(struct ast_bridge *bridge, struct ast_channel *chan);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgeremovevideosrc"></a>ast_bridge_remove_video_src</h3>

<p>Remove a channel from being the video source.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief remove a channel as a source of video for the bridge.
 */
void ast_bridge_remove_video_src(struct ast_bridge *bridge, struct ast_channel *chan);</pre>
</div></div>

<h1><a name="Asterisk12BridgingAPI-BridgingTechnologies"></a><a href="http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction/include/asterisk/bridging_technology.h" class="external-link" rel="nofollow">Bridging Technologies</a></h1>

<h2><a name="Asterisk12BridgingAPI-Enumerations"></a>Enumerations</h2>

<h3><a name="Asterisk12BridgingAPI-astbridgepreference"></a>ast_bridge_preference</h3>

<p>An enumeration that specifies for a registered bridging technology the preference the Bridging Framework should assign when picking between technologies with equivalent capabilities.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*! \brief Preference for choosing the bridge technology */
enum ast_bridge_preference {
        /*! Bridge technology should have high precedence over other bridge technologies */
        AST_BRIDGE_PREFERENCE_HIGH = 0,
        /*! Bridge technology is decent, not the best but should still be considered over low */
        AST_BRIDGE_PREFERENCE_MEDIUM,
        /*! Bridge technology is low, it should not be considered unless it is absolutely needed */
        AST_BRIDGE_PREFERENCE_LOW,
};</pre>
</div></div>

<h2><a name="Asterisk12BridgingAPI-Structs"></a>Structs</h2>

<h3><a name="Asterisk12BridgingAPI-astbridgetechnology"></a>ast_bridge_technology</h3>

<p>The interface that defines a bridging technology.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Structure that is the essence of a bridge technology
 */
struct ast_bridge_technology {
        /*! Unique name to this bridge technology */
        const char *name;
        /*! The capabilities that this bridge technology is capable of.  This has nothing to do with
         * format capabilities. */
        uint32_t capabilities;
        /*! Preference level that should be used when determining whether to use this bridge technology or not */
        enum ast_bridge_preference preference;
        /*! Callback for when a bridge is being created */
        int (*create)(struct ast_bridge *bridge);
        /*! Callback for when a bridge is being destroyed */
        int (*destroy)(struct ast_bridge *bridge);
        /*! Callback for when a channel is being added to a bridge */
        int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
        /*! Callback for when a channel is leaving a bridge */
        int (*leave)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
        /*! Callback for when a channel is suspended from the bridge */
        void (*suspend)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
        /*! Callback for when a channel is unsuspended from the bridge */
        void (*unsuspend)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
        /*! Callback to see if a channel is compatible with the bridging technology */
        int (*compatible)(struct ast_bridge_channel *bridge_channel);
        /*! Callback for writing a frame into the bridging technology */
        enum ast_bridge_write_result (*write)(struct ast_bridge *bridge, struct ast_bridge_channel *bridged_channel, struct ast_frame *frame);
        /*! Callback for when a file descriptor trips */
        int (*fd)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, int fd);
        /*! Callback for replacement thread function */
        int (*thread)(struct ast_bridge *bridge);
        /*! Callback for poking a bridge thread */
        int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
        /*! Formats that the bridge technology supports */
        struct ast_format_cap *format_capabilities;
        /*! Bit to indicate whether the bridge technology is currently suspended or not */
        unsigned int suspended:1;
        /*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
        struct ast_module *mod;
        /*! Linked list information */
        AST_RWLIST_ENTRY(ast_bridge_technology) entry;
};</pre>
</div></div>

<h2><a name="Asterisk12BridgingAPI-Functions"></a>Functions</h2>

<h3><a name="Asterisk12BridgingAPI-astbridgetechnologyregister"></a>ast_bridge_technology_register</h3>

<p>Register a technology with the Bridging Framework.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Register a bridge technology for use
 *
 * \param technology The bridge technology to register
 * \param mod The module that is registering the bridge technology
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_technology_register(&amp;simple_bridge_tech);
 * \endcode
 *
 * This registers a bridge technology declared as the structure
 * simple_bridge_tech with the bridging core and makes it available for
 * use when creating bridges.
 */
int __ast_bridge_technology_register(struct ast_bridge_technology *technology, struct ast_module *mod);

/*! \brief See \ref __ast_bridge_technology_register() */
#define ast_bridge_technology_register(technology) __ast_bridge_technology_register(technology, ast_module_info-&gt;self)</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgetechnologyunregister"></a>ast_bridge_technology_unregister</h3>

<p>Unregister a technology with the Bridging Framework.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Unregister a bridge technology from use
 *
 * \param technology The bridge technology to unregister
 *
 * \retval 0 on success
 * \retval -1 on failure
 *
 * Example usage:
 *
 * \code
 * ast_bridge_technology_unregister(&amp;simple_bridge_tech);
 * \endcode
 *
 * This unregisters a bridge technlogy declared as the structure
 * simple_bridge_tech with the bridging core. It will no longer be
 * considered when creating a new bridge.
 */
int ast_bridge_technology_unregister(struct ast_bridge_technology *technology);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgehandletrip"></a>ast_bridge_handle_trip</h3>

<p>Notify the Bridging Framework that a channel has a frame waiting.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Feed notification that a frame is waiting on a channel into the bridging core
 *
 * \param bridge The bridge that the notification should influence
 * \param bridge_channel Bridge channel the notification was received on (if known)
 * \param chan Channel the notification was received on (if known)
 * \param outfd File descriptor that the notification was received on (if known)
 *
 * Example usage:
 *
 * \code
 * ast_bridge_handle_trip(bridge, NULL, chan, -1);
 * \endcode
 *
 * This tells the bridging core that a frame has been received on
 * the channel pointed to by chan and that it should be read and handled.
 *
 * \note This should only be used by bridging technologies.
 */
void ast_bridge_handle_trip(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_channel *chan, int outfd);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgenotifytalking"></a>ast_bridge_notify_talking</h3>

<p>Notify the Bridging Framework that a channel has started talking.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Lets the bridging indicate when a bridge channel has stopped or started talking.
 *
 * \note All DSP functionality on the bridge has been pushed down to the lowest possible
 * layer, which in this case is the specific bridging technology being used. Since it
 * is necessary for the knowledge of which channels are talking to make its way up to the
 * application, this function has been created to allow the bridging technology to communicate
 * that information with the bridging core.
 *
 * \param bridge_channel The bridge channel that has either started or stopped talking.
 * \param started_talking set to 1 when this indicates the channel has started talking set to 0
 * when this indicates the channel has stopped talking.
 */
void ast_bridge_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgetechnologysuspend"></a>ast_bridge_technology_suspend</h3>

<p>Suspend a bridging technology from consideration by the Bridging Framework.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Suspend a bridge technology from consideration
 *
 * \param technology The bridge technology to suspend
 *
 * Example usage:
 *
 * \code
 * ast_bridge_technology_suspend(&amp;simple_bridge_tech);
 * \endcode
 *
 * This suspends the bridge technology simple_bridge_tech from being considered
 * when creating a new bridge. Existing bridges using the bridge technology
 * are not affected.
 */
void ast_bridge_technology_suspend(struct ast_bridge_technology *technology);</pre>
</div></div>

<h3><a name="Asterisk12BridgingAPI-astbridgetechnologyunsuspend"></a>ast_bridge_technology_unsuspend</h3>

<p>Unsuspend a bridging technology from consideration by the Bridging Framework.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">/*!
 * \brief Unsuspend a bridge technology
 *
 * \param technology The bridge technology to unsuspend
 *
 * Example usage:
 *
 * \code
 * ast_bridge_technology_unsuspend(&amp;simple_bridge_tech);
 * \endcode
 *
 * This makes the bridge technology simple_bridge_tech considered when
 * creating a new bridge again.
 */
void ast_bridge_technology_unsuspend(struct ast_bridge_technology *technology);</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Bridging+API">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=22088074&revisedVersion=4&originalVersion=3">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Bridging+API?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>