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
This commit is contained in:
Mark Michelson
2013-06-06 21:40:35 +00:00
parent 5f740572d0
commit 2dc8a06006
16 changed files with 2182 additions and 2706 deletions

View File

@@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/dial.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/bridging.h"
#include "asterisk/features_config.h"
/*** DOCUMENTATION
<application name="Dial" language="en_US">
@@ -1074,7 +1075,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
int caller_entertained = outgoing
&& ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
struct ast_party_connected_line connected_caller;
struct ast_str *featurecode = ast_str_alloca(FEATURE_MAX_LEN + 1);
struct ast_str *featurecode = ast_str_alloca(AST_FEATURE_MAX_LEN + 1);
int cc_recall_core_id;
int is_cc_recall;
int cc_frame_received = 0;
@@ -1701,22 +1702,31 @@ skip_frame:;
static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str **featurecode)
{
struct ast_flags features = { AST_FEATURE_DISCONNECT }; /* only concerned with disconnect feature */
struct ast_call_feature feature = { 0, };
char disconnect_code[AST_FEATURE_MAX_LEN];
int res;
ast_str_append(featurecode, 1, "%c", code);
res = ast_feature_detect(chan, &features, ast_str_buffer(*featurecode), &feature);
if (res != AST_FEATURE_RETURN_STOREDIGITS) {
res = ast_get_builtin_feature(chan, "disconnect", disconnect_code, sizeof(disconnect_code));
if (res) {
ast_str_reset(*featurecode);
}
if (feature.feature_mask & AST_FEATURE_DISCONNECT) {
return 1;
return 0;
}
return 0;
if (strlen(disconnect_code) > ast_str_strlen(*featurecode)) {
/* Could be a partial match, anyway */
if (strncmp(disconnect_code, ast_str_buffer(*featurecode), ast_str_strlen(*featurecode))) {
ast_str_reset(*featurecode);
}
return 0;
}
if (strcmp(disconnect_code, ast_str_buffer(*featurecode))) {
ast_str_reset(*featurecode);
return 0;
}
return 1;
}
/* returns true if there is a valid privacy reply */