bridge_after.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 After Bridge Execution API
00022  *
00023  * \author Richard Mudgett <rmudgett@digium.com>
00024  *
00025  * See Also:
00026  * \arg \ref AstCREDITS
00027  */
00028 
00029 #ifndef _ASTERISK_BRIDGING_AFTER_H
00030 #define _ASTERISK_BRIDGING_AFTER_H
00031 
00032 #if defined(__cplusplus) || defined(c_plusplus)
00033 extern "C" {
00034 #endif
00035 
00036 /*! Reason the the after bridge callback will not be called. */
00037 enum ast_bridge_after_cb_reason {
00038    /*! The datastore is being destroyed.  Likely due to hangup. (Enum value must be zero.) */
00039    AST_BRIDGE_AFTER_CB_REASON_DESTROY,
00040    /*! Something else replaced the callback with another. */
00041    AST_BRIDGE_AFTER_CB_REASON_REPLACED,
00042    /*! The callback was removed because of a masquerade. (fixup) */
00043    AST_BRIDGE_AFTER_CB_REASON_MASQUERADE,
00044    /*! The channel was departed from the bridge. */
00045    AST_BRIDGE_AFTER_CB_REASON_DEPART,
00046    /*! Was explicitly removed by external code. */
00047    AST_BRIDGE_AFTER_CB_REASON_REMOVED,
00048 };
00049 
00050 /*!
00051  * \brief Set channel to goto specific location after the bridge.
00052  * \since 12.0.0
00053  *
00054  * \param chan Channel to setup after bridge goto location.
00055  * \param context Context to goto after bridge.
00056  * \param exten Exten to goto after bridge.
00057  * \param priority Priority to goto after bridge.
00058  *
00059  * \note chan is locked by this function.
00060  *
00061  * \details Add a channel datastore to setup the goto location
00062  * when the channel leaves the bridge and run a PBX from there.
00063  *
00064  * \return Nothing
00065  */
00066 void ast_bridge_set_after_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
00067 
00068 /*!
00069  * \brief Set channel to run the h exten after the bridge.
00070  * \since 12.0.0
00071  *
00072  * \param chan Channel to setup after bridge goto location.
00073  * \param context Context to goto after bridge.
00074  *
00075  * \note chan is locked by this function.
00076  *
00077  * \details Add a channel datastore to setup the goto location
00078  * when the channel leaves the bridge and run a PBX from there.
00079  *
00080  * \return Nothing
00081  */
00082 void ast_bridge_set_after_h(struct ast_channel *chan, const char *context);
00083 
00084 /*!
00085  * \brief Set channel to go on in the dialplan after the bridge.
00086  * \since 12.0.0
00087  *
00088  * \param chan Channel to setup after bridge goto location.
00089  * \param context Current context of the caller channel.
00090  * \param exten Current exten of the caller channel.
00091  * \param priority Current priority of the caller channel
00092  * \param parseable_goto User specified goto string from dialplan.
00093  *
00094  * \note chan is locked by this function.
00095  *
00096  * \details Add a channel datastore to setup the goto location
00097  * when the channel leaves the bridge and run a PBX from there.
00098  *
00099  * If parseable_goto then use the given context/exten/priority
00100  *   as the relative position for the parseable_goto.
00101  * Else goto the given context/exten/priority+1.
00102  *
00103  * \return Nothing
00104  */
00105 void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto);
00106 
00107 /*!
00108  * \brief Setup any after bridge goto location to begin execution.
00109  * \since 12.0.0
00110  *
00111  * \param chan Channel to setup after bridge goto location.
00112  *
00113  * \note chan is locked by this function.
00114  *
00115  * \details Pull off any after bridge goto location datastore and
00116  * setup for dialplan execution there.
00117  *
00118  * \retval 0 on success.  The goto location is set for a PBX to run it.
00119  * \retval non-zero on error or no goto location.
00120  *
00121  * \note If the after bridge goto is set to run an h exten it is
00122  * run here immediately.
00123  */
00124 int ast_bridge_setup_after_goto(struct ast_channel *chan);
00125 
00126 /*!
00127  * \brief Run any after bridge callback.
00128  * \since 12.0.0
00129  *
00130  * \param chan Channel to run after bridge callback.
00131  *
00132  * \return Nothing
00133  */
00134 void ast_bridge_run_after_callback(struct ast_channel *chan);
00135 
00136 /*!
00137  * \brief Run discarding any after bridge callbacks.
00138  * \since 12.0.0
00139  *
00140  * \param chan Channel to run after bridge callback.
00141  *
00142  * \return Nothing
00143  */
00144 void ast_bridge_discard_after_callback(struct ast_channel *chan, enum ast_bridge_after_cb_reason reason);
00145 
00146 /*!
00147  * \brief Run a PBX on any after bridge goto location.
00148  * \since 12.0.0
00149  *
00150  * \param chan Channel to execute after bridge goto location.
00151  *
00152  * \note chan is locked by this function.
00153  *
00154  * \details Pull off any after bridge goto location datastore
00155  * and run a PBX at that location.
00156  *
00157  * \note On return, the chan pointer is no longer valid because
00158  * the channel has hung up.
00159  *
00160  * \return Nothing
00161  */
00162 void ast_bridge_run_after_goto(struct ast_channel *chan);
00163 
00164 /*!
00165  * \brief Discard channel after bridge goto location.
00166  * \since 12.0.0
00167  *
00168  * \param chan Channel to discard after bridge goto location.
00169  *
00170  * \note chan is locked by this function.
00171  *
00172  * \return Nothing
00173  */
00174 void ast_bridge_discard_after_goto(struct ast_channel *chan);
00175 
00176 /*!
00177  * \brief Read after bridge goto if it exists
00178  * \since 12.0.0
00179  *
00180  * \param chan Channel to read the after bridge goto parseable goto string from
00181  * \param buffer Buffer to write the after bridge goto data to
00182  * \param buf_size size of the buffer being written to
00183  */
00184 void ast_bridge_read_after_goto(struct ast_channel *chan, char *buffer, size_t buf_size);
00185 
00186 /*!
00187  * \brief After bridge callback failed.
00188  * \since 12.0.0
00189  *
00190  * \param reason Reason callback is failing.
00191  * \param data Extra data what setup the callback wanted to pass.
00192  *
00193  * \note Called when the channel leaves the bridging system or
00194  * is destroyed.
00195  *
00196  * \return Nothing
00197  */
00198 typedef void (*ast_bridge_after_cb_failed)(enum ast_bridge_after_cb_reason reason, void *data);
00199 
00200 /*!
00201  * \brief After bridge callback function.
00202  * \since 12.0.0
00203  *
00204  * \param chan Channel just leaving bridging system.
00205  * \param data Extra data what setup the callback wanted to pass.
00206  *
00207  * \return Nothing
00208  */
00209 typedef void (*ast_bridge_after_cb)(struct ast_channel *chan, void *data);
00210 
00211 /*!
00212  * \brief Setup an after bridge callback for when the channel leaves the bridging system.
00213  * \since 12.0.0
00214  *
00215  * \param chan Channel to setup an after bridge callback on.
00216  * \param callback Function to call when the channel leaves the bridging system.
00217  * \param failed Function to call when it will not be calling the callback.
00218  * \param data Extra data to pass with the callback.
00219  *
00220  * \note chan is locked by this function.
00221  *
00222  * \note failed is called when the channel leaves the bridging
00223  * system or is destroyed.
00224  *
00225  * \retval 0 on success.
00226  * \retval -1 on error.
00227  */
00228 int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb callback, ast_bridge_after_cb_failed failed, void *data);
00229 
00230 /*!
00231  * \brief Get a string representation of an after bridge callback reason
00232  * \since 12.0.0
00233  *
00234  * \param reason The reason to interpret to a string
00235  * \retval NULL Unrecognized reason
00236  * \retval non-NULL String representation of reason
00237  */
00238 const char *ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason);
00239 
00240 #if defined(__cplusplus) || defined(c_plusplus)
00241 }
00242 #endif
00243 
00244 #endif   /* _ASTERISK_BRIDGING_H */

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