bridge_channel_internal.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2013 Digium, Inc.
00005  *
00006  * Matt Jordan <mjordan@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 #ifndef _ASTERISK_PRIVATE_BRIDGING_CHANNEL_H
00020 #define _ASTERISK_PRIVATE_BRIDGING_CHANNEL_H
00021 
00022 /*!
00023  * \file
00024  * \brief Private Bridging Channel API
00025  *
00026  * \author Matt Jordan <mjordan@digium.com>
00027  *
00028  * A private API to manipulate channels in a bridge. These can be called on a channel in
00029  * a bridge by \ref bridge.c. These functions should not be called elsewhere, including
00030  * by other members of the Bridging API.
00031  *
00032  * See Also:
00033  * \arg \ref AstCREDITS
00034  * \arg \ref Ast
00035  */
00036 
00037 /*!
00038  * \internal
00039  * \brief Actions that can be taken on a channel in a bridge
00040  */
00041 enum bridge_channel_action_type {
00042    /*! Bridged channel is to send a DTMF stream out */
00043    BRIDGE_CHANNEL_ACTION_DTMF_STREAM,
00044    /*! Bridged channel is to indicate talking start */
00045    BRIDGE_CHANNEL_ACTION_TALKING_START,
00046    /*! Bridged channel is to indicate talking stop */
00047    BRIDGE_CHANNEL_ACTION_TALKING_STOP,
00048    /*! Bridge channel is to play the indicated sound file. */
00049    BRIDGE_CHANNEL_ACTION_PLAY_FILE,
00050    /*! Bridge channel is to run the indicated application. */
00051    BRIDGE_CHANNEL_ACTION_RUN_APP,
00052    /*! Bridge channel is to run the custom callback routine. */
00053    BRIDGE_CHANNEL_ACTION_CALLBACK,
00054    /*! Bridge channel is to get parked. */
00055    BRIDGE_CHANNEL_ACTION_PARK,
00056    /*! Bridge channel is to execute a blind transfer. */
00057    BRIDGE_CHANNEL_ACTION_BLIND_TRANSFER,
00058    /*! Bridge channel is to execute an attended transfer */
00059    BRIDGE_CHANNEL_ACTION_ATTENDED_TRANSFER,
00060 
00061    /*
00062     * Bridge actions put after this comment must never be put onto
00063     * the bridge_channel wr_queue because they have other resources
00064     * that must be freed.
00065     */
00066 
00067    /*! Bridge reconfiguration deferred technology destruction. */
00068    BRIDGE_CHANNEL_ACTION_DEFERRED_TECH_DESTROY = 1000,
00069    /*! Bridge deferred dissolving. */
00070    BRIDGE_CHANNEL_ACTION_DEFERRED_DISSOLVING,
00071 };
00072 
00073 /*!
00074  * \internal
00075  * \brief Allocate a new ao2 ref counted bridge_channel
00076  * \since 12.0.0
00077  *
00078  * \param bridge The bridge to make the bridge_channel for
00079  *
00080  * \retval NULL on error
00081  * \retval ao2 ref counted object on success
00082  */
00083 struct ast_bridge_channel *bridge_channel_internal_alloc(struct ast_bridge *bridge);
00084 
00085 /*!
00086  * \internal
00087  * \brief Clear owed events by the channel to the original bridge.
00088  * \since 12.0.0
00089  *
00090  * \param orig_bridge Original bridge the channel was in before leaving.
00091  * \param bridge_channel Channel that owes events to the original bridge.
00092  *
00093  * \note On entry, the orig_bridge is already locked.
00094  *
00095  * \return Nothing
00096  */
00097 void bridge_channel_settle_owed_events(struct ast_bridge *orig_bridge, struct ast_bridge_channel *bridge_channel);
00098 
00099 /*!
00100  * \internal
00101  * \brief Push the bridge channel into its specified bridge.
00102  * \since 12.0.0
00103  *
00104  * \param bridge_channel Channel to push.
00105  *
00106  * \note A ref is not held by bridge_channel->swap when calling because the
00107  * push with swap happens immediately.
00108  *
00109  * \note On entry, bridge_channel->bridge is already locked.
00110  *
00111  * \retval 0 on success.
00112  * \retval -1 on failure.  The channel did not get pushed.
00113  *
00114  * \note On failure the caller must call
00115  * ast_bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
00116  */
00117 int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel);
00118 
00119 /*!
00120  * \internal
00121  * \brief Pull the bridge channel out of its current bridge.
00122  * \since 12.0.0
00123  *
00124  * \param bridge_channel Channel to pull.
00125  *
00126  * \note On entry, bridge_channel->bridge is already locked.
00127  *
00128  * \return Nothing
00129  */
00130 void bridge_channel_internal_pull(struct ast_bridge_channel *bridge_channel);
00131 
00132 /*!
00133  * \internal
00134  * \brief Join the bridge_channel to the bridge (blocking)
00135  *
00136  * \param bridge_channel The Channel in the bridge
00137  *
00138  * \note The bridge_channel->swap holds a channel reference for the swap
00139  * channel going into the bridging system.  The ref ensures that the swap
00140  * pointer is valid for the bridge subclass push callbacks.  The pointer
00141  * will be NULL on return if the ref was consumed.
00142  *
00143  * \details
00144  * This API call puts the bridge_channel into the bridge and handles the
00145  * bridge_channel's processing of events while it is in the bridge.  It
00146  * will return when the channel has been instructed to leave the bridge.
00147  *
00148  * \retval 0 bridge channel successfully joined the bridge
00149  * \retval -1 bridge channel failed to join the bridge
00150  */
00151 int bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel);
00152 
00153 /*!
00154  * \internal
00155  * \brief Temporarily suspend a channel from a bridge, handing control over to some
00156  * other system
00157  *
00158  * \param bridge_channel The channel in the bridge
00159  * \note This function assumes that \ref bridge_channel is already locked
00160  */
00161 void bridge_channel_internal_suspend_nolock(struct ast_bridge_channel *bridge_channel);
00162 
00163 /*!
00164  * \internal
00165  * \brief Unsuspend a channel that was previously suspended
00166  *
00167  * \param bridge_channel The channel in the bridge
00168  * \note This function assumes that \ref bridge_channel is already locked
00169  */
00170 void bridge_channel_internal_unsuspend_nolock(struct ast_bridge_channel *bridge_channel);
00171 
00172 /*!
00173  * \internal
00174  * \brief Queue a blind transfer action on a transferee bridge channel
00175  *
00176  * This is only relevant for when a blind transfer is performed on a two-party
00177  * bridge. The transferee's bridge channel will have a blind transfer bridge
00178  * action queued onto it, resulting in the party being redirected to a new
00179  * destination
00180  *
00181  * \param transferee The channel to have the action queued on
00182  * \param exten The destination extension for the transferee
00183  * \param context The destination context for the transferee
00184  * \param hook Frame hook to attach to transferee
00185  *
00186  * \retval 0 on success.
00187  * \retval -1 on error.
00188  */
00189 int bridge_channel_internal_queue_blind_transfer(struct ast_channel *transferee,
00190       const char *exten, const char *context,
00191       transfer_channel_cb new_channel_cb, void *user_data);
00192 
00193 /*!
00194  * \internal
00195  * \brief Queue an attended transfer action on a transferee bridge channel
00196  *
00197  * This is only relevant for when an attended transfer is performed on a two-party
00198  * bridge. The transferee's bridge channel will have an attended transfer bridge
00199  * action queued onto it.
00200  *
00201  * \param transferee The channel to have the action queued on
00202  * \param unbridged_chan The unbridged channel who is the target of the attended
00203  * transfer
00204  *
00205  * \retval 0 on success.
00206  * \retval -1 on error.
00207  */
00208 int bridge_channel_internal_queue_attended_transfer(struct ast_channel *transferee,
00209       struct ast_channel *unbridged_chan);
00210 
00211 /*!
00212  * \internal
00213  * \brief Return whether or not the bridge_channel would allow optimization
00214  *
00215  * \retval 0 if optimization is not allowed
00216  * \retval non-zero if optimization is allowed
00217  */
00218 int bridge_channel_internal_allows_optimization(struct ast_bridge_channel *bridge_channel);
00219 
00220 #endif /* _ASTERISK_PRIVATE_BRIDGING_H */

Generated on Thu Apr 16 06:27:16 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6