Remove some dead parking call
[asterisk/asterisk.git] / include / asterisk / features.h
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
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.
13  *
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.
17  */
18
19 /*! \file
20  * \brief Call Parking and Pickup API
21  * Includes code and algorithms from the Zapata library.
22  */
23
24 #ifndef _AST_FEATURES_H
25 #define _AST_FEATURES_H
26
27 #include "asterisk/pbx.h"
28 #include "asterisk/linkedlists.h"
29 #include "asterisk/bridge.h"
30
31 #define FEATURE_MAX_LEN         11
32 #define FEATURE_APP_LEN         64
33 #define FEATURE_APP_ARGS_LEN    256
34 #define FEATURE_SNAME_LEN       32
35 #define FEATURE_EXTEN_LEN       32
36 #define FEATURE_MOH_LEN         80  /* same as MAX_MUSICCLASS from channel.h */
37
38 #define DEFAULT_PARKINGLOT "default"    /*!< Default parking lot */
39
40 #define AST_FEATURE_RETURN_HANGUP           -1
41 #define AST_FEATURE_RETURN_SUCCESSBREAK     0
42 #define AST_FEATURE_RETURN_PBX_KEEPALIVE    AST_PBX_KEEPALIVE
43 #define AST_FEATURE_RETURN_NO_HANGUP_PEER   AST_PBX_NO_HANGUP_PEER
44 #define AST_FEATURE_RETURN_PASSDIGITS       21
45 #define AST_FEATURE_RETURN_STOREDIGITS      22
46 #define AST_FEATURE_RETURN_SUCCESS          23
47 #define AST_FEATURE_RETURN_KEEPTRYING       24
48 #define AST_FEATURE_RETURN_PARKFAILED       25
49
50 #define FEATURE_SENSE_CHAN      (1 << 0)
51 #define FEATURE_SENSE_PEER      (1 << 1)
52
53 typedef int (*ast_feature_operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data);
54
55 /*! \brief main call feature structure */
56
57 enum {
58         AST_FEATURE_FLAG_NEEDSDTMF = (1 << 0),
59         AST_FEATURE_FLAG_ONPEER =    (1 << 1),
60         AST_FEATURE_FLAG_ONSELF =    (1 << 2),
61         AST_FEATURE_FLAG_BYCALLEE =  (1 << 3),
62         AST_FEATURE_FLAG_BYCALLER =  (1 << 4),
63         AST_FEATURE_FLAG_BYBOTH  =   (3 << 3),
64 };
65
66 /*!
67  * \brief Park a call via a masqueraded channel
68  *
69  * \param park_me Channel to be parked.
70  * \param parker Channel parking the call.
71  * \param timeout is a timeout in milliseconds
72  * \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
73  *
74  * \details
75  * Masquerade the park_me channel into a new, empty channel which is then parked.
76  *
77  * \note Use ast_masq_park_call_exten() instead.
78  *
79  * \retval 0 on success.
80  * \retval -1 on failure.
81  */
82 int ast_masq_park_call(struct ast_channel *park_me, struct ast_channel *parker, int timeout, int *extout);
83
84 /*!
85  * \brief Park a call via a masqueraded channel
86  * \since 1.8.9
87  *
88  * \param park_me Channel to be parked.
89  * \param parker Channel parking the call.
90  * \param park_exten Parking lot access extension
91  * \param park_context Parking lot context
92  * \param timeout is a timeout in milliseconds
93  * \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
94  *
95  * \details
96  * Masquerade the park_me channel into a new, empty channel which is then parked.
97  *
98  * \retval 0 on success.
99  * \retval -1 on failure.
100  */
101 int ast_masq_park_call_exten(struct ast_channel *park_me, struct ast_channel *parker, const char *park_exten, const char *park_context, int timeout, int *extout);
102
103 /*!
104  * \brief Determine if parking extension exists in a given context
105  * \retval 0 if extension does not exist
106  * \retval 1 if extension does exist
107 */
108 int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan, const char *context);
109
110 /*! \brief Bridge a call, optionally allowing redirection */
111 int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer,struct ast_bridge_config *config);
112
113 /*!
114  * \brief Add an arbitrary channel to a bridge
115  * \since 12.0.0
116  *
117  * The channel that is being added to the bridge can be in any state: unbridged,
118  * bridged, answered, unanswered, etc. The channel will be added asynchronously,
119  * meaning that when this function returns once the channel has been added to
120  * the bridge, not once the channel has been removed from the bridge.
121  *
122  * In addition, a tone can optionally be played to the channel once the
123  * channel is placed into the bridge.
124  *
125  * \note When this function returns, there is no guarantee that the channel that
126  * was passed in is valid any longer. Do not attempt to operate on the channel
127  * after this function returns.
128  *
129  * \param bridge Bridge to which the channel should be added
130  * \param chan The channel to add to the bridge
131  * \param features Features for this channel in the bridge
132  * \param play_tone Indicates if a tone should be played to the channel
133  * \param xfersound Sound that should be used to indicate transfer with play_tone
134  * \retval 0 Success
135  * \retval -1 Failure
136  */
137 int ast_bridge_add_channel(struct ast_bridge *bridge, struct ast_channel *chan,
138                 struct ast_bridge_features *features, int play_tone, const char *xfersound);
139
140 /*!
141  * \brief Test if a channel can be picked up.
142  *
143  * \param chan Channel to test if can be picked up.
144  *
145  * \note This function assumes that chan is locked.
146  *
147  * \return TRUE if channel can be picked up.
148  */
149 int ast_can_pickup(struct ast_channel *chan);
150
151 /*!
152  * \brief Find a pickup channel target by group.
153  *
154  * \param chan channel that initiated pickup.
155  *
156  * \retval target on success.  The returned channel is locked and reffed.
157  * \retval NULL on error.
158  */
159 struct ast_channel *ast_pickup_find_by_group(struct ast_channel *chan);
160
161 /*! \brief Pickup a call */
162 int ast_pickup_call(struct ast_channel *chan);
163
164 /*!
165  * \brief Pickup a call target.
166  *
167  * \param chan channel that initiated pickup.
168  * \param target channel to be picked up.
169  *
170  * \note This function assumes that target is locked.
171  *
172  * \retval 0 on success.
173  * \retval -1 on failure.
174  */
175 int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target);
176
177 /*!
178  * \brief accessor for call pickup message type
179  * \since 12.0.0
180  *
181  * \retval pointer to the stasis message type
182  * \retval NULL if not initialized
183  */
184 struct stasis_message_type *ast_call_pickup_type(void);
185
186 /*! \brief Reload call features from features.conf */
187 int ast_features_reload(void);
188
189 /*!
190  * \brief parse L option and read associated channel variables to set warning, warning frequency, and timelimit
191  * \note caller must be aware of freeing memory for warning_sound, end_sound, and start_sound
192 */
193 int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit);
194
195 #endif /* _AST_FEATURES_H */