2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Mark Spencer <markster@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.
20 * \brief Call Parking and Pickup API
21 * Includes code and algorithms from the Zapata library.
24 #ifndef _AST_FEATURES_H
25 #define _AST_FEATURES_H
27 #include "asterisk/pbx.h"
29 #define FEATURE_MAX_LEN 11
30 #define FEATURE_APP_LEN 64
31 #define FEATURE_APP_ARGS_LEN 256
32 #define FEATURE_SNAME_LEN 32
33 #define FEATURE_EXTEN_LEN 32
34 #define FEATURE_MOH_LEN 80 /* same as MAX_MUSICCLASS from channel.h */
36 #define PARK_APP_NAME "Park"
38 /*! \brief main call feature structure */
41 AST_FEATURE_FLAG_NEEDSDTMF = (1 << 0),
42 AST_FEATURE_FLAG_ONPEER = (1 << 1),
43 AST_FEATURE_FLAG_ONSELF = (1 << 2),
44 AST_FEATURE_FLAG_BYCALLEE = (1 << 3),
45 AST_FEATURE_FLAG_BYCALLER = (1 << 4),
46 AST_FEATURE_FLAG_BYBOTH = (3 << 3),
49 struct ast_call_feature {
52 char sname[FEATURE_SNAME_LEN];
53 char exten[FEATURE_MAX_LEN];
54 char default_exten[FEATURE_MAX_LEN];
55 int (*operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data);
57 char app[FEATURE_APP_LEN];
58 char app_args[FEATURE_APP_ARGS_LEN];
59 char moh_class[FEATURE_MOH_LEN];
60 AST_LIST_ENTRY(ast_call_feature) feature_entry;
64 #define AST_FEATURE_RETURN_HANGUP -1
65 #define AST_FEATURE_RETURN_SUCCESSBREAK 0
66 #define AST_FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE
67 #define AST_FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER
68 #define AST_FEATURE_RETURN_NO_HANGUP_PEER_PARKED AST_PBX_NO_HANGUP_PEER_PARKED
69 #define AST_FEATURE_RETURN_PASSDIGITS 21
70 #define AST_FEATURE_RETURN_STOREDIGITS 22
71 #define AST_FEATURE_RETURN_SUCCESS 23
72 #define AST_FEATURE_RETURN_KEEPTRYING 24
76 * \brief Park a call and read back parked location
77 * \param chan the channel to actually be parked
78 * \param host the channel which will have the parked location read to.
79 * \param timeout is a timeout in milliseconds
80 * \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
82 * Park the channel chan, and read back the parked location to the host.
83 * If the call is not picked up within a specified period of time,
84 * then the call will return to the last step that it was in
85 * (in terms of exten, priority and context)
86 * \retval 0 on success.
87 * \retval -1 on failure.
89 int ast_park_call(struct ast_channel *chan, struct ast_channel *host, int timeout, int *extout);
92 * \brief Park a call via a masqueraded channel
93 * \param rchan the real channel to be parked
94 * \param host the channel to have the parking read to.
95 * \param timeout is a timeout in milliseconds
96 * \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
98 * Masquerade the channel rchan into a new, empty channel which is then parked with ast_park_call
99 * \retval 0 on success.
100 * \retval -1 on failure.
102 int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *host, int timeout, int *extout);
105 * \brief Determine system parking extension
106 * \returns the call parking extension for drivers that provide special call parking help
108 const char *ast_parking_ext(void);
110 /*! \brief Determine system call pickup extension */
111 const char *ast_pickup_ext(void);
113 /*! \brief Bridge a call, optionally allowing redirection */
114 int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer,struct ast_bridge_config *config);
116 /*! \brief Pickup a call */
117 int ast_pickup_call(struct ast_channel *chan);
119 /*! \brief register new feature into feature_set
120 \param feature an ast_call_feature object which contains a keysequence
121 and a callback function which is called when this keysequence is pressed
123 void ast_register_feature(struct ast_call_feature *feature);
125 /*! \brief unregister feature from feature_set
126 \param feature the ast_call_feature object which was registered before*/
127 void ast_unregister_feature(struct ast_call_feature *feature);
129 /*! \brief look for a call feature entry by its sname
130 \param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. */
131 struct ast_call_feature *ast_find_call_feature(const char *name);
133 void ast_rdlock_call_features(void);
134 void ast_unlock_call_features(void);
136 /*! \brief Reload call features from features.conf */
137 int ast_features_reload(void);
139 #endif /* _AST_FEATURES_H */