bridge_basic.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  * Richard Mudgett <rmudgett@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 /*!
00020  * \file
00021  * \brief Basic bridge subclass API.
00022  *
00023  * \author Richard Mudgett <rmudgett@digium.com>
00024  *
00025  * See Also:
00026  * \arg \ref AstCREDITS
00027  */
00028 
00029 #ifndef _ASTERISK_BRIDGING_BASIC_H
00030 #define _ASTERISK_BRIDGING_BASIC_H
00031 
00032 #if defined(__cplusplus) || defined(c_plusplus)
00033 extern "C" {
00034 #endif
00035 
00036 #define AST_TRANSFERER_ROLE_NAME "transferer"
00037 /* ------------------------------------------------------------------- */
00038 
00039 /*!
00040  * \brief Sets the features a channel will use upon being bridged.
00041  * \since 12.0.0
00042  *
00043  * \param chan Which channel to set features for
00044  * \param features Which feature codes to set for the channel
00045  *
00046  * \retval 0 on success
00047  * \retval -1 on failure
00048  */
00049 int ast_bridge_features_ds_set_string(struct ast_channel *chan, const char *features);
00050 
00051 /*!
00052  * \brief writes a channel's DTMF features to a buffer string
00053  * \since 12.0.0
00054  *
00055  * \param chan channel whose feature flags should be checked
00056  * \param buffer pointer string buffer where the output should be stored
00057  * \param buf_size size of the provided buffer (ideally enough for all features, 6+)
00058  *
00059  * \retval 0 on successful write
00060  * \retval -1 on failure
00061  */
00062 int ast_bridge_features_ds_get_string(struct ast_channel *chan, char *buffer, size_t buf_size);
00063 
00064 /*!
00065  * \brief Get DTMF feature flags from the channel.
00066  * \since 12.0.0
00067  *
00068  * \param chan Channel to get DTMF features datastore.
00069  *
00070  * \note The channel should be locked before calling this function.
00071  * \note The channel must remain locked until the flags returned have been consumed.
00072  *
00073  * \retval flags on success.
00074  * \retval NULL if the datastore does not exist.
00075  */
00076 struct ast_flags *ast_bridge_features_ds_get(struct ast_channel *chan);
00077 
00078 /*!
00079  * \brief Set basic bridge DTMF feature flags datastore on the channel.
00080  * \since 12.0.0
00081  *
00082  * \param chan Channel to set DTMF features datastore.
00083  * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
00084  *
00085  * \note The channel must be locked before calling this function.
00086  *
00087  * \retval 0 on success.
00088  * \retval -1 on error.
00089  */
00090 int ast_bridge_features_ds_set(struct ast_channel *chan, struct ast_flags *flags);
00091 
00092 /*!
00093  * \brief Append basic bridge DTMF feature flags on the channel.
00094  * \since 12.0.0
00095  *
00096  * \param chan Channel to append DTMF features datastore.
00097  * \param flags Builtin DTMF feature flags. (ast_bridge_config flags)
00098  *
00099  * \note The channel must be locked before calling this function.
00100  * \note This function differs from ast_bridge_features_ds_set only in that it won't
00101  *       remove features already set on the channel.
00102  *
00103  * \retval 0 on success.
00104  * \retval -1 on error.
00105  */
00106 int ast_bridge_features_ds_append(struct ast_channel *chan, struct ast_flags *flags);
00107 
00108 /*! \brief Bridge basic class virtual method table. */
00109 extern struct ast_bridge_methods ast_bridge_basic_v_table;
00110 
00111 /*!
00112  * \brief Create a new basic class bridge
00113  *
00114  * \retval a pointer to a new bridge on success
00115  * \retval NULL on failure
00116  *
00117  * Example usage:
00118  *
00119  * \code
00120  * struct ast_bridge *bridge;
00121  * bridge = ast_bridge_basic_new();
00122  * \endcode
00123  *
00124  * This creates a basic two party bridge with any configured
00125  * DTMF features enabled that will be destroyed once one of the
00126  * channels hangs up.
00127  */
00128 struct ast_bridge *ast_bridge_basic_new(void);
00129 
00130 /*!
00131  * \brief Set feature flags on a basic bridge
00132  *
00133  * Using this function instead of setting flags directly will
00134  * ensure that after operations such as an attended transfer,
00135  * the bridge will maintain the flags that were set on it.
00136  *
00137  * \params Flags to set on the bridge. These are added to the flags already set.
00138  */
00139 void ast_bridge_basic_set_flags(struct ast_bridge *bridge, unsigned int flags);
00140 
00141 /*! Initialize the basic bridge class for use by the system. */
00142 void ast_bridging_init_basic(void);
00143 
00144 /* ------------------------------------------------------------------- */
00145 
00146 #if defined(__cplusplus) || defined(c_plusplus)
00147 }
00148 #endif
00149 
00150 #endif   /* _ASTERISK_BRIDGING_BASIC_H */

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