aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-13 17:33:29 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-03-13 17:33:29 +0000
commitff96fc8670d794fa89397ff38163e0dca9182eb9 (patch)
tree9111eb950330766b10f6855b68b3e030c57abb00
parent86812735d314f9e9ad4685b99a72ed20d77d5e29 (diff)
Merged revisions 182029 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r182029 | mmichelson | 2009-03-13 12:26:43 -0500 (Fri, 13 Mar 2009) | 41 lines Merged revisions 181990 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r181990 | mmichelson | 2009-03-13 12:12:32 -0500 (Fri, 13 Mar 2009) | 35 lines Check the DYNAMIC_FEATURES of both the chan and peer when interpreting DTMF. Dynamic features defined in the applicationmap section of features.conf allow one to specify whether the caller, callee, or both have the ability to use the feature. The documentation in the features.conf.sample file could be interpreted to mean that one only needs to set the DYNAMIC_FEATURES channel variable on the calling channel in order to allow for the callee to be able to use the features which he should have permission to use. However, the DYNAMIC_FEATURES variable would only be read from the channel of the participant that pressed the DTMF sequence to activate the feature. The result of this was that the callee was unable to use dynamic features unless the dialplan writer had taken measures to be sure that the DYNAMIC_FEATURES variable was set on the callee's channel. This commit changes the behavior of ast_feature_interpret to concatenate the values of DYNAMIC_FEATURES from both parties involved in the bridge. The features themselves determine who has permission to use them, so there is no reason to believe that one side of the bridge could gain the ability to perform an action that they should not have the ability to perform. Kevin Fleming pointed out on the asterisk-users list that the typical way that this was worked around in the past was by setting _DYNAMIC_FEATURES on the calling channel so that the value would be inherited by the called channel. While this works, the documentation alone is not enough to figure out why this is necessary for the callee to be able to use dynamic features. In this particular case, changing the code to match the documentation is safe, easy, and will generally make things easier for people for future installations. This bug was originally reported on the asterisk-users list by David Ruggles. (closes issue #14657) Reported by: mmichelson Patches: 14657.patch uploaded by mmichelson (license 60) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@182064 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/features.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/main/features.c b/main/features.c
index c3731af33..7e7edc78b 100644
--- a/main/features.c
+++ b/main/features.c
@@ -1715,20 +1715,30 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
struct ast_call_feature *feature;
struct feature_group *fg = NULL;
struct feature_group_exten *fge;
- const char *dynamic_features;
+ const char *peer_dynamic_features, *chan_dynamic_features;
+ char dynamic_features_buf[128];
char *tmp, *tok;
int res = FEATURE_RETURN_PASSDIGITS;
int feature_detected = 0;
if (sense == FEATURE_SENSE_CHAN) {
ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL);
- dynamic_features = pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES");
}
else {
ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL);
- dynamic_features = pbx_builtin_getvar_helper(peer, "DYNAMIC_FEATURES");
}
- ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%d, dynamic=%s\n", chan->name, peer->name, code, sense, features.flags, dynamic_features);
+
+ ast_channel_lock(peer);
+ peer_dynamic_features = ast_strdupa(S_OR(pbx_builtin_getvar_helper(peer, "DYNAMIC_FEATURES"),""));
+ ast_channel_unlock(peer);
+
+ ast_channel_lock(chan);
+ chan_dynamic_features = ast_strdupa(S_OR(pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES"),""));
+ ast_channel_unlock(chan);
+
+ snprintf(dynamic_features_buf, sizeof(dynamic_features_buf), "%s%s%s", S_OR(chan_dynamic_features, ""), chan_dynamic_features && peer_dynamic_features ? "#" : "", S_OR(peer_dynamic_features,""));
+
+ ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%d, dynamic=%s\n", chan->name, peer->name, code, sense, features.flags, dynamic_features_buf);
ast_rwlock_rdlock(&features_lock);
for (x = 0; x < FEATURES_COUNT; x++) {
@@ -1750,10 +1760,10 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
}
ast_rwlock_unlock(&features_lock);
- if (ast_strlen_zero(dynamic_features) || feature_detected)
+ if (ast_strlen_zero(dynamic_features_buf) || feature_detected)
return res;
- tmp = ast_strdupa(dynamic_features);
+ tmp = dynamic_features_buf;
while ((tok = strsep(&tmp, "#"))) {
AST_RWLIST_RDLOCK(&feature_groups);