2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 2013, Digium, Inc.
6 * Mark Michelson <mmichelson@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 #ifndef _FEATURES_CONFIG_H
20 #define _FEATURES_CONFIG_H
22 #include "asterisk/stringfields.h"
27 * \brief General features configuration items
29 struct ast_features_general_config {
30 AST_DECLARE_STRING_FIELDS(
31 /*! Sound played when automon or automixmon features are used */
32 AST_STRING_FIELD(courtesytone);
34 /*! Milliseconds allowed between digit presses when entering feature code */
35 unsigned int featuredigittimeout;
39 * \brief Get the general configuration options for a channel
41 * \note The channel should be locked before calling this function.
42 * \note The returned value has its reference count incremented.
44 * If no channel is provided, then the global features configuration is returned.
46 * \param chan The channel to get configuration options for
47 * \retval NULL Failed to get configuration
48 * \retval non-NULL The general features configuration
50 struct ast_features_general_config *ast_get_chan_features_general_config(struct ast_channel *chan);
53 * \brief Feature configuration relating to transfers
55 struct ast_features_xfer_config {
56 AST_DECLARE_STRING_FIELDS (
57 /*! Sound to play when transfer succeeds */
58 AST_STRING_FIELD(xfersound);
59 /*! Sound to play when transfer fails */
60 AST_STRING_FIELD(xferfailsound);
61 /*! DTMF sequence used to abort an attempted atxfer */
62 AST_STRING_FIELD(atxferabort);
63 /*! DTMF sequence used to complete an attempted atxfer */
64 AST_STRING_FIELD(atxfercomplete);
65 /*! DTMF sequence used to turn an attempted atxfer into a three-way call */
66 AST_STRING_FIELD(atxferthreeway);
68 /*! Milliseconds allowed between digit presses when dialing transfer destination */
69 unsigned int transferdigittimeout;
70 /*! Milliseconds to wait for the transfer target to answer a transferred call */
71 unsigned int atxfernoanswertimeout;
72 /*! Milliseconds to wait before attempting to re-dial the transfer target */
73 unsigned int atxferloopdelay;
74 /*! Number of times to re-attempt dialing the transfer target */
75 unsigned int atxfercallbackretries;
76 /*! Determines if the call is dropped on attended transfer failure */
77 unsigned int atxferdropcall;
81 * \brief Get the transfer configuration options for a channel
83 * \note The channel should be locked before calling this function.
84 * \note The returned value has its reference count incremented.
86 * If no channel is provided, then the global transfer configuration is returned.
88 * \param chan The channel to get configuration options for
89 * \retval NULL Failed to get configuration
90 * \retval non-NULL The transfer features configuration
92 struct ast_features_xfer_config *ast_get_chan_features_xfer_config(struct ast_channel *chan);
95 * \brief Configuration relating to call pickup
97 struct ast_features_pickup_config {
98 AST_DECLARE_STRING_FIELDS (
99 /*! Digit sequence to press to pick up a ringing call */
100 AST_STRING_FIELD(pickupexten);
101 /*! Sound to play to picker when pickup succeeds */
102 AST_STRING_FIELD(pickupsound);
103 /*! Sound to play to picker when pickup fails */
104 AST_STRING_FIELD(pickupfailsound);
109 * \brief Get the pickup configuration options for a channel
111 * \note The channel should be locked before calling this function.
112 * \note The returned value has its reference count incremented.
114 * If no channel is provided, then the global pickup configuration is returned.
116 * \param chan The channel to get configuration options for
117 * \retval NULL Failed to get configuration
118 * \retval non-NULL The pickup features configuration
120 struct ast_features_pickup_config *ast_get_chan_features_pickup_config(struct ast_channel *chan);
123 * \brief Configuration for the builtin features
125 struct ast_featuremap_config {
126 AST_DECLARE_STRING_FIELDS (
127 /*! Blind transfer DTMF code */
128 AST_STRING_FIELD(blindxfer);
129 /*! Disconnect DTMF code */
130 AST_STRING_FIELD(disconnect);
131 /*! Automon DTMF code */
132 AST_STRING_FIELD(automon);
133 /*! Attended Transfer DTMF code */
134 AST_STRING_FIELD(atxfer);
135 /*! One-touch parking DTMF code */
136 AST_STRING_FIELD(parkcall);
137 /*! Automixmon DTMF code */
138 AST_STRING_FIELD(automixmon);
143 * \brief Get the featuremap configuration options for a channel
145 * \note The channel should be locked before calling this function.
146 * \note The returned value has its reference count incremented.
148 * If no channel is provided, then the global featuremap configuration is returned.
150 * \param chan The channel to get configuration options for
151 * \retval NULL Failed to get configuration
152 * \retval non-NULL The pickup features configuration
154 struct ast_featuremap_config *ast_get_chan_featuremap_config(struct ast_channel *chan);
157 * \brief Get the DTMF code for a builtin feature
159 * \note The channel should be locked before calling this function
161 * If no channel is provided, then the global setting for the option is returned.
163 * \param chan The channel to get the option from
164 * \param feature The short name of the feature (as it appears in features.conf)
165 * \param[out] buf The buffer to write the DTMF value into
166 * \param size The size of the buffer in bytes
168 * \retval non-zero Unrecognized builtin feature name
170 int ast_get_builtin_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len);
173 * \brief Get the DTMF code for a call feature
175 * \note The channel should be locked before calling this function
177 * If no channel is provided, then the global setting for the option is returned.
179 * This function is like \ref ast_get_builtin_feature except that it will
180 * also check the applicationmap in addition to the builtin features.
182 * \param chan The channel to get the option from
183 * \param feature The short name of the feature
184 * \param[out] buf The buffer to write the DTMF value into
185 * \param size The size of the buffer in bytes
187 * \retval non-zero Unrecognized feature name
189 int ast_get_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len);
191 #define AST_FEATURE_MAX_LEN 11
194 * \brief An applicationmap configuration item
196 struct ast_applicationmap_item {
197 AST_DECLARE_STRING_FIELDS (
198 /* Name of the item */
199 AST_STRING_FIELD(name);
200 /* Name Dialplan application that is invoked by the feature */
201 AST_STRING_FIELD(app);
202 /* Data to pass to the application */
203 AST_STRING_FIELD(app_data);
204 /* Music-on-hold class to play to party on which feature is not activated */
205 AST_STRING_FIELD(moh_class);
207 /* DTMF key sequence used to activate the feature */
208 char dtmf[AST_FEATURE_MAX_LEN];
209 /* If true, activate on party that input the sequence, otherwise activate on the other party */
210 unsigned int activate_on_self;
214 * \brief Get the applicationmap for a given channel.
216 * \note The channel should be locked before calling this function.
218 * This uses the value of the DYNAMIC_FEATURES channel variable to build a
219 * custom applicationmap for this channel. The returned container has
220 * applicationmap_items inside.
222 * \param chan The channel for which applicationmap is being retrieved.
223 * \retval NULL An error occurred or the channel has no dynamic features.
224 * \retval non-NULL A container of applicationmap_items pertaining to the channel.
226 struct ao2_container *ast_get_chan_applicationmap(struct ast_channel *chan);
228 void ast_features_config_shutdown(void);
230 int ast_features_config_reload(void);
232 int ast_features_config_init(void);
234 #endif /* _FEATURES_CONFIG_H */