Remove dead code from features.c; refactor pickup code into pickup.c

This patch does the following:
 * It moves the pickup code out of features.c and into pickup.c
 * It removes the vast majority of dead code out of features.c. In particular,
   this includes the parking code.

(issue ASTERISK-22134)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2013-08-02 02:32:44 +00:00
parent 63a229e369
commit 38236e54a8
24 changed files with 566 additions and 1403 deletions

View File

@@ -8,7 +8,7 @@
*
* \brief
* Prototypes for public functions only of internal interest,
*
*
*/
@@ -25,7 +25,7 @@ int astdb_init(void); /*!< Provided by db.c */
void ast_channels_init(void); /*!< Provided by channel.c */
void ast_builtins_init(void); /*!< Provided by cli.c */
int ast_cli_perms_init(int reload); /*!< Provided by cli.c */
int dnsmgr_init(void); /*!< Provided by dnsmgr.c */
int dnsmgr_init(void); /*!< Provided by dnsmgr.c */
void dnsmgr_start_refresh(void); /*!< Provided by dnsmgr.c */
int dnsmgr_reload(void); /*!< Provided by dnsmgr.c */
void threadstorage_init(void); /*!< Provided by threadstorage.c */
@@ -109,9 +109,9 @@ enum ast_module_reload_result ast_module_reload(const char *name);
*/
void ast_process_pending_reloads(void);
/*! \brief Load XML documentation. Provided by xmldoc.c
/*! \brief Load XML documentation. Provided by xmldoc.c
* \retval 1 on error.
* \retval 0 on success.
* \retval 0 on success.
*/
int ast_xmldoc_load_documentation(void);

View File

@@ -28,30 +28,6 @@
#include "asterisk/linkedlists.h"
#include "asterisk/bridge.h"
#define FEATURE_MAX_LEN 11
#define FEATURE_APP_LEN 64
#define FEATURE_APP_ARGS_LEN 256
#define FEATURE_SNAME_LEN 32
#define FEATURE_EXTEN_LEN 32
#define FEATURE_MOH_LEN 80 /* same as MAX_MUSICCLASS from channel.h */
#define DEFAULT_PARKINGLOT "default" /*!< Default parking lot */
#define AST_FEATURE_RETURN_HANGUP -1
#define AST_FEATURE_RETURN_SUCCESSBREAK 0
#define AST_FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE
#define AST_FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER
#define AST_FEATURE_RETURN_PASSDIGITS 21
#define AST_FEATURE_RETURN_STOREDIGITS 22
#define AST_FEATURE_RETURN_SUCCESS 23
#define AST_FEATURE_RETURN_KEEPTRYING 24
#define AST_FEATURE_RETURN_PARKFAILED 25
#define FEATURE_SENSE_CHAN (1 << 0)
#define FEATURE_SENSE_PEER (1 << 1)
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);
/*! \brief main call feature structure */
enum {
@@ -93,54 +69,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer,struct as
int ast_bridge_add_channel(struct ast_bridge *bridge, struct ast_channel *chan,
struct ast_bridge_features *features, int play_tone, const char *xfersound);
/*!
* \brief Test if a channel can be picked up.
*
* \param chan Channel to test if can be picked up.
*
* \note This function assumes that chan is locked.
*
* \return TRUE if channel can be picked up.
*/
int ast_can_pickup(struct ast_channel *chan);
/*!
* \brief Find a pickup channel target by group.
*
* \param chan channel that initiated pickup.
*
* \retval target on success. The returned channel is locked and reffed.
* \retval NULL on error.
*/
struct ast_channel *ast_pickup_find_by_group(struct ast_channel *chan);
/*! \brief Pickup a call */
int ast_pickup_call(struct ast_channel *chan);
/*!
* \brief Pickup a call target.
*
* \param chan channel that initiated pickup.
* \param target channel to be picked up.
*
* \note This function assumes that target is locked.
*
* \retval 0 on success.
* \retval -1 on failure.
*/
int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target);
/*!
* \brief accessor for call pickup message type
* \since 12.0.0
*
* \retval pointer to the stasis message type
* \retval NULL if not initialized
*/
struct stasis_message_type *ast_call_pickup_type(void);
/*! \brief Reload call features from features.conf */
int ast_features_reload(void);
/*!
* \brief parse L option and read associated channel variables to set warning, warning frequency, and timelimit

View File

@@ -30,6 +30,11 @@
*/
#define PARK_APPLICATION "Park"
/*!
* \brief The default parking lot
*/
#define DEFAULT_PARKINGLOT "default"
/*!
* \brief Defines the type of parked call message being published
* \since 12

91
include/asterisk/pickup.h Normal file
View File

@@ -0,0 +1,91 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2013, Digium, Inc.
*
* Matt Jordan <mjordan@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*!
* \file
* \brief Call Pickup API
*
* Includes code and algorithms from the Zapata library.
*
*/
#ifndef _AST_FEATURES_H
#define _AST_FEATURES_H
/*!
* \brief Test if a channel can be picked up.
*
* \param chan Channel to test if can be picked up.
*
* \note This function assumes that chan is locked.
*
* \return TRUE if channel can be picked up.
*/
int ast_can_pickup(struct ast_channel *chan);
/*!
* \brief Find a pickup channel target by group.
*
* \param chan channel that initiated pickup.
*
* \retval target on success. The returned channel is locked and reffed.
* \retval NULL on error.
*/
struct ast_channel *ast_pickup_find_by_group(struct ast_channel *chan);
/*!
* \brief Pickup a call
*
* \param chan The channel that initiated the pickup
*
* \retval 0 on success
* \retval -1 on failure
*/
int ast_pickup_call(struct ast_channel *chan);
/*!
* \brief Pickup a call target.
*
* \param chan channel that initiated pickup.
* \param target channel to be picked up.
*
* \note This function assumes that target is locked.
*
* \retval 0 on success.
* \retval -1 on failure.
*/
int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target);
/*!
* \brief accessor for call pickup message type
* \since 12.0.0
*
* \retval pointer to the stasis message type
* \retval NULL if not initialized
*/
struct stasis_message_type *ast_call_pickup_type(void);
/*!
* \brief Initialize pickup
*
* \retval 0 on success
* \retval non-zero on failure
*/
int ast_pickup_init(void);
#endif /* _AST_FEATURES_H */