diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-06-06 21:40:35 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-06-06 21:40:35 +0000 |
commit | 2dc8a060064f359a17f5ebcd515d85fe5203c019 (patch) | |
tree | fca012b9378a2a005fea30278f7d2a6129251b1f /main/manager.c | |
parent | 5f740572d081330fb43462eba5b0f495d8e56df1 (diff) |
Refactor the features configuration scheme.
Features configuration is handled in its own API in
features_config.h and features_config.c. This way, features
configuration is accessible to anything that needs it.
In addition, features configuration has been altered to
be more channel-oriented. Most callers of features API
code will be supplying a channel so that the individual
channel's settings will be acquired rather than the global
setting.
Missing from this commit is XML documentation for the
features configuration. That will be handled in a separate
commit.
Review: https://reviewboard.asterisk.org/r/2578/
(issue ASTERISK-21542)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/main/manager.c b/main/manager.c index 229b83b4e..da5a98490 100644 --- a/main/manager.c +++ b/main/manager.c @@ -96,6 +96,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/test.h" #include "asterisk/json.h" #include "asterisk/bridging.h" +#include "asterisk/features_config.h" /*** DOCUMENTATION <manager name="Ping" language="en_US"> @@ -4048,8 +4049,8 @@ static int action_atxfer(struct mansession *s, const struct message *m) const char *exten = astman_get_header(m, "Exten"); const char *context = astman_get_header(m, "Context"); struct ast_channel *chan = NULL; - struct ast_call_feature *atxfer_feature = NULL; - char *feature_code = NULL; + char feature_code[AST_FEATURE_MAX_LEN]; + const char *digit; if (ast_strlen_zero(name)) { astman_send_error(s, m, "No channel specified"); @@ -4060,31 +4061,33 @@ static int action_atxfer(struct mansession *s, const struct message *m) return 0; } - ast_rdlock_call_features(); - atxfer_feature = ast_find_call_feature("atxfer"); - ast_unlock_call_features(); - if (!atxfer_feature) { - astman_send_error(s, m, "No attended transfer feature found"); + if (!(chan = ast_channel_get_by_name(name))) { + astman_send_error(s, m, "Channel specified does not exist"); return 0; } - if (!(chan = ast_channel_get_by_name(name))) { - astman_send_error(s, m, "Channel specified does not exist"); + ast_channel_lock(chan); + if (ast_get_builtin_feature(chan, "atxfer", feature_code, sizeof(feature_code)) || + ast_strlen_zero(feature_code)) { + ast_channel_unlock(chan); + astman_send_error(s, m, "No attended transfer feature code found"); + ast_channel_unref(chan); return 0; } + ast_channel_unlock(chan); if (!ast_strlen_zero(context)) { pbx_builtin_setvar_helper(chan, "TRANSFER_CONTEXT", context); } /* BUGBUG action_atxfer() is broken because the bridge DTMF hooks need both begin and end events to match correctly. */ - for (feature_code = atxfer_feature->exten; feature_code && *feature_code; ++feature_code) { - struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code }; + for (digit = feature_code; *digit; ++digit) { + struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *digit }; ast_queue_frame(chan, &f); } - for (feature_code = (char *)exten; feature_code && *feature_code; ++feature_code) { - struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *feature_code }; + for (digit = exten; *digit; ++digit) { + struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = *digit }; ast_queue_frame(chan, &f); } |