Wed Apr 6 11:29:44 2011

Asterisk developer's documentation


features.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2005, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@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 /*! \file
00020  * \brief Call Parking and Pickup API 
00021  * Includes code and algorithms from the Zapata library.
00022  */
00023 
00024 #ifndef _AST_FEATURES_H
00025 #define _AST_FEATURES_H
00026 
00027 #include "asterisk/pbx.h"
00028 #include "asterisk/linkedlists.h"
00029 
00030 #define FEATURE_MAX_LEN    11
00031 #define FEATURE_APP_LEN    64
00032 #define FEATURE_APP_ARGS_LEN  256
00033 #define FEATURE_SNAME_LEN  32
00034 #define FEATURE_EXTEN_LEN  32
00035 #define FEATURE_MOH_LEN    80  /* same as MAX_MUSICCLASS from channel.h */
00036 
00037 #define PARK_APP_NAME "Park"
00038 #define DEFAULT_PARKINGLOT "default"   /*!< Default parking lot */
00039 
00040 #define AST_FEATURE_RETURN_HANGUP           -1
00041 #define AST_FEATURE_RETURN_SUCCESSBREAK     0
00042 #define AST_FEATURE_RETURN_PBX_KEEPALIVE    AST_PBX_KEEPALIVE
00043 #define AST_FEATURE_RETURN_NO_HANGUP_PEER   AST_PBX_NO_HANGUP_PEER
00044 #define AST_FEATURE_RETURN_PASSDIGITS       21
00045 #define AST_FEATURE_RETURN_STOREDIGITS      22
00046 #define AST_FEATURE_RETURN_SUCCESS          23
00047 #define AST_FEATURE_RETURN_KEEPTRYING       24
00048 #define AST_FEATURE_RETURN_PARKFAILED       25
00049 
00050 #define FEATURE_SENSE_CHAN (1 << 0)
00051 #define FEATURE_SENSE_PEER (1 << 1)
00052 
00053 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);
00054 
00055 /*! \brief main call feature structure */
00056 
00057 enum {
00058    AST_FEATURE_FLAG_NEEDSDTMF = (1 << 0),
00059    AST_FEATURE_FLAG_ONPEER =    (1 << 1),
00060    AST_FEATURE_FLAG_ONSELF =    (1 << 2),
00061    AST_FEATURE_FLAG_BYCALLEE =  (1 << 3),
00062    AST_FEATURE_FLAG_BYCALLER =  (1 << 4),
00063    AST_FEATURE_FLAG_BYBOTH  =   (3 << 3),
00064 };
00065 
00066 struct ast_call_feature {
00067    int feature_mask;
00068    char *fname;
00069    char sname[FEATURE_SNAME_LEN];
00070    char exten[FEATURE_MAX_LEN];
00071    char default_exten[FEATURE_MAX_LEN];
00072    ast_feature_operation operation;
00073    unsigned int flags;
00074    char app[FEATURE_APP_LEN];    
00075    char app_args[FEATURE_APP_ARGS_LEN];
00076    char moh_class[FEATURE_MOH_LEN];
00077    AST_LIST_ENTRY(ast_call_feature) feature_entry;
00078 };
00079 
00080 /*!
00081  * \brief Park a call and read back parked location 
00082  * \param chan the channel to actually be parked
00083  * \param host the channel which will have the parked location read to.
00084  * \param timeout is a timeout in milliseconds
00085  * \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
00086  * 
00087  * Park the channel chan, and read back the parked location to the host. 
00088  * If the call is not picked up within a specified period of time, 
00089  * then the call will return to the last step that it was in 
00090  * (in terms of exten, priority and context)
00091  * \retval 0 on success.
00092  * \retval -1 on failure.
00093 */
00094 int ast_park_call(struct ast_channel *chan, struct ast_channel *host, int timeout, const char *parkexten, int *extout);
00095 
00096 /*! 
00097  * \brief Park a call via a masqueraded channel
00098  * \param rchan the real channel to be parked
00099  * \param host the channel to have the parking read to.
00100  * \param timeout is a timeout in milliseconds
00101  * \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
00102  * 
00103  * Masquerade the channel rchan into a new, empty channel which is then parked with ast_park_call
00104  * \retval 0 on success.
00105  * \retval -1 on failure.
00106 */
00107 int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *host, int timeout, int *extout);
00108 
00109 /*! 
00110  * \brief Determine if parking extension exists in a given context
00111  * \retval 0 if extension does not exist
00112  * \retval 1 if extension does exist
00113 */
00114 int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan, const char *context);
00115 
00116 /*! \brief Determine system call pickup extension */
00117 const char *ast_pickup_ext(void);
00118 
00119 /*! \brief Bridge a call, optionally allowing redirection */
00120 int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer,struct ast_bridge_config *config);
00121 
00122 /*! \brief Pickup a call */
00123 int ast_pickup_call(struct ast_channel *chan);
00124 
00125 /*! 
00126  * \brief register new feature into feature_set 
00127  * \param feature an ast_call_feature object which contains a keysequence
00128  * and a callback function which is called when this keysequence is pressed
00129  * during a call. 
00130 */
00131 void ast_register_feature(struct ast_call_feature *feature);
00132 
00133 /*! 
00134  * \brief unregister feature from feature_set
00135  * \param feature the ast_call_feature object which was registered before
00136 */
00137 void ast_unregister_feature(struct ast_call_feature *feature);
00138 
00139 /*! 
00140  * \brief detect a feature before bridging 
00141  * \param chan
00142  * \param features an ast_flags ptr
00143  * \param code ptr of input code
00144  * \param feature
00145  * \retval ast_call_feature ptr to be set if found 
00146 */
00147 int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature);
00148 
00149 /*! 
00150  * \brief look for a call feature entry by its sname
00151  * \param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. 
00152 */
00153 struct ast_call_feature *ast_find_call_feature(const char *name);
00154 
00155 void ast_rdlock_call_features(void);
00156 void ast_unlock_call_features(void);
00157 
00158 /*! \brief Reload call features from features.conf */
00159 int ast_features_reload(void);
00160 
00161 /*!
00162  * \brief parse L option and read associated channel variables to set warning, warning frequency, and timelimit
00163  * \note caller must be aware of freeing memory for warning_sound, end_sound, and start_sound
00164 */
00165 int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit);
00166 
00167 #endif /* _AST_FEATURES_H */

Generated on Wed Apr 6 11:29:44 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7