summaryrefslogtreecommitdiff
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-06-06 21:40:35 +0000
committerMark Michelson <mmichelson@digium.com>2013-06-06 21:40:35 +0000
commit2dc8a060064f359a17f5ebcd515d85fe5203c019 (patch)
treefca012b9378a2a005fea30278f7d2a6129251b1f /apps/app_dial.c
parent5f740572d081330fb43462eba5b0f495d8e56df1 (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 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index b6f1ce872..b0caa5c6b 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -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);
+ return 0;
}
- if (feature.feature_mask & AST_FEATURE_DISCONNECT) {
- return 1;
+
+ 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;
}
- 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 */