features_config.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 * Mark Michelson <mmichelson@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 _FEATURES_CONFIG_H
00020 #define _FEATURES_CONFIG_H
00021 
00022 #include "asterisk/stringfields.h"
00023 
00024 struct ast_channel;
00025 
00026 /*!
00027  * \brief General features configuration items
00028  */
00029 struct ast_features_general_config {
00030    AST_DECLARE_STRING_FIELDS(
00031       /*! Sound played when automon or automixmon features are used */
00032       AST_STRING_FIELD(courtesytone);
00033       /*! Sound played when automon or automixmon features fail when used */
00034       AST_STRING_FIELD(recordingfailsound);
00035    );
00036    /*! Milliseconds allowed between digit presses when entering feature code */
00037    unsigned int featuredigittimeout;
00038 };
00039 
00040 /*!
00041  * \brief Get the general configuration options for a channel
00042  *
00043  * \note The channel should be locked before calling this function.
00044  * \note The returned value has its reference count incremented.
00045  *
00046  * If no channel is provided, then the global features configuration is returned.
00047  *
00048  * \param chan The channel to get configuration options for
00049  * \retval NULL Failed to get configuration
00050  * \retval non-NULL The general features configuration
00051  */
00052 struct ast_features_general_config *ast_get_chan_features_general_config(struct ast_channel *chan);
00053 
00054 /*!
00055  * \brief Feature configuration relating to transfers
00056  */
00057 struct ast_features_xfer_config {
00058    AST_DECLARE_STRING_FIELDS (
00059       /*! Sound to play when transfer succeeds */
00060       AST_STRING_FIELD(xfersound);
00061       /*! Sound to play when transfer fails */
00062       AST_STRING_FIELD(xferfailsound);
00063       /*! DTMF sequence used to abort an attempted atxfer */
00064       AST_STRING_FIELD(atxferabort);
00065       /*! DTMF sequence used to complete an attempted atxfer */
00066       AST_STRING_FIELD(atxfercomplete);
00067       /*! DTMF sequence used to turn an attempted atxfer into a three-way call */
00068       AST_STRING_FIELD(atxferthreeway);
00069       /*! DTMF sequence used to swap which party the transferer is talking to */
00070       AST_STRING_FIELD(atxferswap);
00071       /*! Sound played when an invalid extension is dialed, and the transferer should retry. */
00072       AST_STRING_FIELD(transferretrysound);
00073       /*! Sound played when an invalid extension is dialed, and the transferer is being returned to the call. */
00074       AST_STRING_FIELD(transferinvalidsound);
00075    );
00076    /*! Seconds allowed between digit presses when dialing transfer destination */
00077    unsigned int transferdigittimeout;
00078    /*! Seconds to wait for the transfer target to answer a transferred call */
00079    unsigned int atxfernoanswertimeout;
00080    /*! Seconds to wait before attempting to re-dial the transfer target */
00081    unsigned int atxferloopdelay;
00082    /*! Number of times to re-attempt dialing the transfer target */
00083    unsigned int atxfercallbackretries;
00084    /*! Determines if the call is dropped on attended transfer failure */
00085    unsigned int atxferdropcall;
00086    /*! Number of dial attempts allowed for blind/attended transfers */
00087    unsigned int transferdialattempts;
00088 };
00089 
00090 /*!
00091  * \brief Get the transfer configuration options for a channel
00092  *
00093  * \note The channel should be locked before calling this function.
00094  * \note The returned value has its reference count incremented.
00095  *
00096  * If no channel is provided, then the global transfer configuration is returned.
00097  *
00098  * \param chan The channel to get configuration options for
00099  * \retval NULL Failed to get configuration
00100  * \retval non-NULL The transfer features configuration
00101  */
00102 struct ast_features_xfer_config *ast_get_chan_features_xfer_config(struct ast_channel *chan);
00103 
00104 /*!
00105  * \brief Configuration relating to call pickup
00106  */
00107 struct ast_features_pickup_config {
00108    AST_DECLARE_STRING_FIELDS (
00109       /*! Digit sequence to press to pick up a ringing call */
00110       AST_STRING_FIELD(pickupexten);
00111       /*! Sound to play to picker when pickup succeeds */
00112       AST_STRING_FIELD(pickupsound);
00113       /*! Sound to play to picker when pickup fails */
00114       AST_STRING_FIELD(pickupfailsound);
00115    );
00116 };
00117 
00118 /*!
00119  * \brief Get the pickup configuration options for a channel
00120  *
00121  * \note The channel should be locked before calling this function.
00122  * \note The returned value has its reference count incremented.
00123  *
00124  * If no channel is provided, then the global pickup configuration is returned.
00125  *
00126  * \param chan The channel to get configuration options for
00127  * \retval NULL Failed to get configuration
00128  * \retval non-NULL The pickup features configuration
00129  */
00130 struct ast_features_pickup_config *ast_get_chan_features_pickup_config(struct ast_channel *chan);
00131 
00132 /*!
00133  * \brief Configuration for the builtin features
00134  */
00135 struct ast_featuremap_config {
00136    AST_DECLARE_STRING_FIELDS (
00137       /*! Blind transfer DTMF code */
00138       AST_STRING_FIELD(blindxfer);
00139       /*! Disconnect DTMF code */
00140       AST_STRING_FIELD(disconnect);
00141       /*! Automon DTMF code */
00142       AST_STRING_FIELD(automon);
00143       /*! Attended Transfer DTMF code */
00144       AST_STRING_FIELD(atxfer);
00145       /*! One-touch parking DTMF code */
00146       AST_STRING_FIELD(parkcall);
00147       /*! Automixmon DTMF code */
00148       AST_STRING_FIELD(automixmon);
00149    );
00150 };
00151 
00152 /*!
00153  * \brief Get the featuremap configuration options for a channel
00154  *
00155  * \note The channel should be locked before calling this function.
00156  * \note The returned value has its reference count incremented.
00157  *
00158  * If no channel is provided, then the global featuremap configuration is returned.
00159  *
00160  * \param chan The channel to get configuration options for
00161  * \retval NULL Failed to get configuration
00162  * \retval non-NULL The pickup features configuration
00163  */
00164 struct ast_featuremap_config *ast_get_chan_featuremap_config(struct ast_channel *chan);
00165 
00166 /*!
00167  * \brief Get the DTMF code for a builtin feature
00168  *
00169  * \note The channel should be locked before calling this function
00170  *
00171  * If no channel is provided, then the global setting for the option is returned.
00172  *
00173  * \param chan The channel to get the option from
00174  * \param feature The short name of the feature (as it appears in features.conf)
00175  * \param[out] buf The buffer to write the DTMF value into
00176  * \param size The size of the buffer in bytes
00177  * \retval 0 Success
00178  * \retval non-zero Unrecognized builtin feature name
00179  */
00180 int ast_get_builtin_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len);
00181 
00182 /*!
00183  * \brief Get the DTMF code for a call feature
00184  *
00185  * \note The channel should be locked before calling this function
00186  *
00187  * If no channel is provided, then the global setting for the option is returned.
00188  *
00189  * This function is like \ref ast_get_builtin_feature except that it will
00190  * also check the applicationmap in addition to the builtin features.
00191  *
00192  * \param chan The channel to get the option from
00193  * \param feature The short name of the feature
00194  * \param[out] buf The buffer to write the DTMF value into
00195  * \param size The size of the buffer in bytes
00196  * \retval 0 Success
00197  * \retval non-zero Unrecognized feature name
00198  */
00199 int ast_get_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len);
00200 
00201 #define AST_FEATURE_MAX_LEN 11
00202 
00203 /*!
00204  * \brief An applicationmap configuration item
00205  */
00206 struct ast_applicationmap_item {
00207    AST_DECLARE_STRING_FIELDS (
00208       /* Name of the item */
00209       AST_STRING_FIELD(name);
00210       /* Name Dialplan application that is invoked by the feature */
00211       AST_STRING_FIELD(app);
00212       /* Data to pass to the application */
00213       AST_STRING_FIELD(app_data);
00214       /* Music-on-hold class to play to party on which feature is not activated */
00215       AST_STRING_FIELD(moh_class);
00216    );
00217    /* DTMF key sequence used to activate the feature */
00218    char dtmf[AST_FEATURE_MAX_LEN];
00219    /* If true, activate on party that input the sequence, otherwise activate on the other party */
00220    unsigned int activate_on_self;
00221 };
00222 
00223 /*!
00224  * \brief Get the applicationmap for a given channel.
00225  *
00226  * \note The channel should be locked before calling this function.
00227  *
00228  * This uses the value of the DYNAMIC_FEATURES channel variable to build a
00229  * custom applicationmap for this channel. The returned container has
00230  * applicationmap_items inside.
00231  *
00232  * \param chan The channel for which applicationmap is being retrieved.
00233  * \retval NULL An error occurred or the channel has no dynamic features.
00234  * \retval non-NULL A container of applicationmap_items pertaining to the channel.
00235  */
00236 struct ao2_container *ast_get_chan_applicationmap(struct ast_channel *chan);
00237 
00238 void ast_features_config_shutdown(void);
00239 
00240 int ast_features_config_reload(void);
00241 
00242 int ast_features_config_init(void);
00243 
00244 #endif /* _FEATURES_CONFIG_H */

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