2001-11-02 01:22:37 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2001-11-02 01:22:37 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2001-11-02 01:22:37 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Mark Spencer <markster@digium.com>
|
2001-11-02 01:22:37 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* 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.
|
2001-11-02 01:22:37 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
|
|
|
* \brief Call Parking and Pickup API
|
2001-11-02 01:22:37 +00:00
|
|
|
* Includes code and algorithms from the Zapata library.
|
|
|
|
*/
|
|
|
|
|
2004-07-17 23:56:12 +00:00
|
|
|
#ifndef _AST_FEATURES_H
|
|
|
|
#define _AST_FEATURES_H
|
2001-11-02 01:22:37 +00:00
|
|
|
|
2008-04-08 17:32:42 +00:00
|
|
|
#include "asterisk/pbx.h"
|
2008-11-02 20:06:03 +00:00
|
|
|
#include "asterisk/linkedlists.h"
|
2008-04-08 17:32:42 +00:00
|
|
|
|
2005-08-23 02:22:33 +00:00
|
|
|
#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
|
2006-08-29 21:20:43 +00:00
|
|
|
#define FEATURE_MOH_LEN 80 /* same as MAX_MUSICCLASS from channel.h */
|
2005-08-23 02:22:33 +00:00
|
|
|
|
2008-10-06 23:08:21 +00:00
|
|
|
#define PARK_APP_NAME "Park"
|
2010-09-15 19:23:56 +00:00
|
|
|
#define DEFAULT_PARKINGLOT "default" /*!< Default parking lot */
|
2008-10-06 23:08:21 +00:00
|
|
|
|
Merged revisions 183126 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r183126 | dvossel | 2009-03-19 11:15:16 -0500 (Thu, 19 Mar 2009) | 17 lines
Allow disconnect feature before a call is bridged
feature.conf has a disconnect option. By default this option is set to '*', but it could be anything. If a user wishes to disconnect a call before the other side answers, only '*' will work, regardless if the disconnect option is set to something else. This is because features are unavailable until bridging takes place. The default disconnect option, '*', was hardcoded in app_dial, which doesn't make any sense from a user perspective since they may expect it to be something different. This patch allows features to be detected from outside of the bridge, but not operated on. In this case, the disconnect feature can be detected before briding and handled outside of features.c.
(closes issue #11583)
Reported by: sobomax
Patches:
patch-apps__app_dial.c uploaded by sobomax (license 359)
11583.latest-patch uploaded by murf (license 17)
detect_disconnect.diff uploaded by dvossel (license 671)
Tested by: sobomax, dvossel
Review: http://reviewboard.digium.com/r/195/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:28:33 +00:00
|
|
|
#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)
|
|
|
|
|
2009-05-21 21:13:09 +00:00
|
|
|
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);
|
Merged revisions 183126 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r183126 | dvossel | 2009-03-19 11:15:16 -0500 (Thu, 19 Mar 2009) | 17 lines
Allow disconnect feature before a call is bridged
feature.conf has a disconnect option. By default this option is set to '*', but it could be anything. If a user wishes to disconnect a call before the other side answers, only '*' will work, regardless if the disconnect option is set to something else. This is because features are unavailable until bridging takes place. The default disconnect option, '*', was hardcoded in app_dial, which doesn't make any sense from a user perspective since they may expect it to be something different. This patch allows features to be detected from outside of the bridge, but not operated on. In this case, the disconnect feature can be detected before briding and handled outside of features.c.
(closes issue #11583)
Reported by: sobomax
Patches:
patch-apps__app_dial.c uploaded by sobomax (license 359)
11583.latest-patch uploaded by murf (license 17)
detect_disconnect.diff uploaded by dvossel (license 671)
Tested by: sobomax, dvossel
Review: http://reviewboard.digium.com/r/195/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:28:33 +00:00
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \brief main call feature structure */
|
2008-04-08 17:32:42 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
AST_FEATURE_FLAG_NEEDSDTMF = (1 << 0),
|
|
|
|
AST_FEATURE_FLAG_ONPEER = (1 << 1),
|
|
|
|
AST_FEATURE_FLAG_ONSELF = (1 << 2),
|
|
|
|
AST_FEATURE_FLAG_BYCALLEE = (1 << 3),
|
|
|
|
AST_FEATURE_FLAG_BYCALLER = (1 << 4),
|
|
|
|
AST_FEATURE_FLAG_BYBOTH = (3 << 3),
|
|
|
|
};
|
|
|
|
|
2005-08-23 02:22:33 +00:00
|
|
|
struct ast_call_feature {
|
|
|
|
int feature_mask;
|
|
|
|
char *fname;
|
|
|
|
char sname[FEATURE_SNAME_LEN];
|
|
|
|
char exten[FEATURE_MAX_LEN];
|
|
|
|
char default_exten[FEATURE_MAX_LEN];
|
Merged revisions 183126 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r183126 | dvossel | 2009-03-19 11:15:16 -0500 (Thu, 19 Mar 2009) | 17 lines
Allow disconnect feature before a call is bridged
feature.conf has a disconnect option. By default this option is set to '*', but it could be anything. If a user wishes to disconnect a call before the other side answers, only '*' will work, regardless if the disconnect option is set to something else. This is because features are unavailable until bridging takes place. The default disconnect option, '*', was hardcoded in app_dial, which doesn't make any sense from a user perspective since they may expect it to be something different. This patch allows features to be detected from outside of the bridge, but not operated on. In this case, the disconnect feature can be detected before briding and handled outside of features.c.
(closes issue #11583)
Reported by: sobomax
Patches:
patch-apps__app_dial.c uploaded by sobomax (license 359)
11583.latest-patch uploaded by murf (license 17)
detect_disconnect.diff uploaded by dvossel (license 671)
Tested by: sobomax, dvossel
Review: http://reviewboard.digium.com/r/195/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:28:33 +00:00
|
|
|
ast_feature_operation operation;
|
After some study, thought, comparing, etc. I've backed out the previous universal mod to make ast_flags a 64 bit thing. Instead, I added a 64-bit version of ast_flags (ast_flags64), and 64-bit versions of the test-flag, set-flag, etc. macros, and an app_parse_options64 routine, and I use these in app_dial alone, to eliminate the 30-option limit it had grown to meet. There is room now for 32 more options and flags. I was heavily tempted to implement some of the other ideas that were presented, but this solution does not intro any new versions of dial, doesn't have a different API, has a minimal/zero impact on code outside of dial, and doesn't seriously (I hope) affect the code structure of dial. It's the best I can think of right now. My goal was NOT to rewrite dial. I leave that to a future, coordinated effort.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-19 23:24:27 +00:00
|
|
|
unsigned int flags;
|
2005-08-23 02:22:33 +00:00
|
|
|
char app[FEATURE_APP_LEN];
|
|
|
|
char app_args[FEATURE_APP_ARGS_LEN];
|
2006-08-29 21:20:43 +00:00
|
|
|
char moh_class[FEATURE_MOH_LEN];
|
2005-08-23 02:22:33 +00:00
|
|
|
AST_LIST_ENTRY(ast_call_feature) feature_entry;
|
|
|
|
};
|
|
|
|
|
2007-08-07 23:04:01 +00:00
|
|
|
/*!
|
|
|
|
* \brief Park a call and read back parked location
|
|
|
|
* \param chan the channel to actually be parked
|
|
|
|
* \param host the channel which will have the parked location read to.
|
|
|
|
* \param timeout is a timeout in milliseconds
|
2007-09-05 16:31:39 +00:00
|
|
|
* \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
|
|
|
|
*
|
2007-08-07 23:04:01 +00:00
|
|
|
* Park the channel chan, and read back the parked location to the host.
|
|
|
|
* If the call is not picked up within a specified period of time,
|
|
|
|
* then the call will return to the last step that it was in
|
|
|
|
* (in terms of exten, priority and context)
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on failure.
|
2001-11-02 01:22:37 +00:00
|
|
|
*/
|
2010-09-15 19:23:56 +00:00
|
|
|
int ast_park_call(struct ast_channel *chan, struct ast_channel *host, int timeout, const char *parkexten, int *extout);
|
2005-10-24 20:12:06 +00:00
|
|
|
|
2007-08-07 23:04:01 +00:00
|
|
|
/*!
|
|
|
|
* \brief Park a call via a masqueraded channel
|
|
|
|
* \param rchan the real channel to be parked
|
|
|
|
* \param host the channel to have the parking read to.
|
|
|
|
* \param timeout is a timeout in milliseconds
|
2007-09-05 16:31:39 +00:00
|
|
|
* \param extout is a parameter to an int that will hold the parked location, or NULL if you want.
|
|
|
|
*
|
2007-08-07 23:04:01 +00:00
|
|
|
* Masquerade the channel rchan into a new, empty channel which is then parked with ast_park_call
|
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on failure.
|
2001-11-02 01:22:37 +00:00
|
|
|
*/
|
2006-03-31 00:11:45 +00:00
|
|
|
int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *host, int timeout, int *extout);
|
2001-11-02 01:22:37 +00:00
|
|
|
|
2007-08-07 23:04:01 +00:00
|
|
|
/*!
|
2010-09-15 19:23:56 +00:00
|
|
|
* \brief Determine if parking extension exists in a given context
|
|
|
|
* \retval 0 if extension does not exist
|
|
|
|
* \retval 1 if extension does exist
|
2007-08-07 23:04:01 +00:00
|
|
|
*/
|
2010-09-15 19:23:56 +00:00
|
|
|
int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan, const char *context);
|
2001-11-02 01:22:37 +00:00
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \brief Determine system call pickup extension */
|
2007-06-06 21:08:07 +00:00
|
|
|
const char *ast_pickup_ext(void);
|
2001-11-02 01:22:37 +00:00
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \brief Bridge a call, optionally allowing redirection */
|
2006-03-31 00:11:45 +00:00
|
|
|
int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer,struct ast_bridge_config *config);
|
2004-04-26 23:22:34 +00:00
|
|
|
|
2011-06-09 16:47:07 +00:00
|
|
|
/*!
|
|
|
|
* \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);
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \brief Pickup a call */
|
2006-03-31 00:11:45 +00:00
|
|
|
int ast_pickup_call(struct ast_channel *chan);
|
2003-04-09 04:00:43 +00:00
|
|
|
|
Merged revisions 318671 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r318671 | alecdavis | 2011-05-13 10:52:08 +1200 (Fri, 13 May 2011) | 30 lines
Fix directed group pickup feature code *8 with pickupsounds enabled
Since 1.6.2, the new pickupsound and pickupfailsound in features.conf cause many issues.
1). chan_sip:handle_request_invite() shouldn't be playing out the fail/success audio, as it has 'netlock' locked.
2). dialplan applications for directed_pickups shouldn't beep.
3). feature code for directed pickup should beep on success/failure if configured.
Created a sip_pickup() thread to handle the pickup and playout the audio, spawned from handle_request_invite.
Moved app_directed:pickup_do() to features:ast_do_pickup().
Functions below, all now use the new ast_do_pickup()
app_directed_pickup.c:
pickup_by_channel()
pickup_by_exten()
pickup_by_mark()
pickup_by_part()
features.c:
ast_pickup_call()
(closes issue #18654)
Reported by: Docent
Patches:
ast_do_pickup_1.8_trunk.diff.txt uploaded by alecdavis (license 585)
Tested by: lmadsen, francesco_r, amilcar, isis242, alecdavis, irroot, rymkus, loloski, rmudgett
Review: https://reviewboard.asterisk.org/r/1185/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-12 22:56:43 +00:00
|
|
|
/*!
|
2011-06-09 16:47:07 +00:00
|
|
|
* \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.
|
|
|
|
*
|
Merged revisions 318671 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r318671 | alecdavis | 2011-05-13 10:52:08 +1200 (Fri, 13 May 2011) | 30 lines
Fix directed group pickup feature code *8 with pickupsounds enabled
Since 1.6.2, the new pickupsound and pickupfailsound in features.conf cause many issues.
1). chan_sip:handle_request_invite() shouldn't be playing out the fail/success audio, as it has 'netlock' locked.
2). dialplan applications for directed_pickups shouldn't beep.
3). feature code for directed pickup should beep on success/failure if configured.
Created a sip_pickup() thread to handle the pickup and playout the audio, spawned from handle_request_invite.
Moved app_directed:pickup_do() to features:ast_do_pickup().
Functions below, all now use the new ast_do_pickup()
app_directed_pickup.c:
pickup_by_channel()
pickup_by_exten()
pickup_by_mark()
pickup_by_part()
features.c:
ast_pickup_call()
(closes issue #18654)
Reported by: Docent
Patches:
ast_do_pickup_1.8_trunk.diff.txt uploaded by alecdavis (license 585)
Tested by: lmadsen, francesco_r, amilcar, isis242, alecdavis, irroot, rymkus, loloski, rmudgett
Review: https://reviewboard.asterisk.org/r/1185/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-05-12 22:56:43 +00:00
|
|
|
* \retval 0 on success.
|
|
|
|
* \retval -1 on failure.
|
|
|
|
*/
|
|
|
|
int ast_do_pickup(struct ast_channel *chan, struct ast_channel *target);
|
|
|
|
|
2010-06-08 14:38:18 +00:00
|
|
|
/*!
|
|
|
|
* \brief register new feature into feature_set
|
|
|
|
* \param feature an ast_call_feature object which contains a keysequence
|
|
|
|
* and a callback function which is called when this keysequence is pressed
|
|
|
|
* during a call.
|
|
|
|
*/
|
2006-03-31 00:11:45 +00:00
|
|
|
void ast_register_feature(struct ast_call_feature *feature);
|
2005-08-23 02:22:33 +00:00
|
|
|
|
2010-06-08 14:38:18 +00:00
|
|
|
/*!
|
|
|
|
* \brief unregister feature from feature_set
|
|
|
|
* \param feature the ast_call_feature object which was registered before
|
|
|
|
*/
|
2006-03-31 00:11:45 +00:00
|
|
|
void ast_unregister_feature(struct ast_call_feature *feature);
|
2001-11-02 01:22:37 +00:00
|
|
|
|
2010-06-08 14:38:18 +00:00
|
|
|
/*!
|
|
|
|
* \brief detect a feature before bridging
|
|
|
|
* \param chan
|
|
|
|
* \param features an ast_flags ptr
|
|
|
|
* \param code ptr of input code
|
|
|
|
* \param feature
|
|
|
|
* \retval ast_call_feature ptr to be set if found
|
|
|
|
*/
|
2009-05-21 21:13:09 +00:00
|
|
|
int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature);
|
Merged revisions 183126 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r183126 | dvossel | 2009-03-19 11:15:16 -0500 (Thu, 19 Mar 2009) | 17 lines
Allow disconnect feature before a call is bridged
feature.conf has a disconnect option. By default this option is set to '*', but it could be anything. If a user wishes to disconnect a call before the other side answers, only '*' will work, regardless if the disconnect option is set to something else. This is because features are unavailable until bridging takes place. The default disconnect option, '*', was hardcoded in app_dial, which doesn't make any sense from a user perspective since they may expect it to be something different. This patch allows features to be detected from outside of the bridge, but not operated on. In this case, the disconnect feature can be detected before briding and handled outside of features.c.
(closes issue #11583)
Reported by: sobomax
Patches:
patch-apps__app_dial.c uploaded by sobomax (license 359)
11583.latest-patch uploaded by murf (license 17)
detect_disconnect.diff uploaded by dvossel (license 671)
Tested by: sobomax, dvossel
Review: http://reviewboard.digium.com/r/195/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-03-19 16:28:33 +00:00
|
|
|
|
2010-06-08 14:38:18 +00:00
|
|
|
/*!
|
|
|
|
* \brief look for a call feature entry by its sname
|
|
|
|
* \param name a string ptr, should match "automon", "blindxfer", "atxfer", etc.
|
|
|
|
*/
|
2007-05-08 16:41:35 +00:00
|
|
|
struct ast_call_feature *ast_find_call_feature(const char *name);
|
|
|
|
|
|
|
|
void ast_rdlock_call_features(void);
|
|
|
|
void ast_unlock_call_features(void);
|
2007-05-04 16:37:23 +00:00
|
|
|
|
2008-01-23 23:09:11 +00:00
|
|
|
/*! \brief Reload call features from features.conf */
|
|
|
|
int ast_features_reload(void);
|
|
|
|
|
2010-06-08 14:38:18 +00:00
|
|
|
/*!
|
|
|
|
* \brief parse L option and read associated channel variables to set warning, warning frequency, and timelimit
|
|
|
|
* \note caller must be aware of freeing memory for warning_sound, end_sound, and start_sound
|
2009-09-24 20:29:51 +00:00
|
|
|
*/
|
|
|
|
int ast_bridge_timelimit(struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit);
|
|
|
|
|
2004-07-17 23:56:12 +00:00
|
|
|
#endif /* _AST_FEATURES_H */
|