mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
I mixed up the use of the find_feature() function, so I renamed it
find_dynamic_feature, and changed the code to use the correct lock when using it. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@63448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -932,7 +932,7 @@ static void ast_unregister_features(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief find a feature by name */
|
/*! \brief find a feature by name */
|
||||||
static struct ast_call_feature *find_feature(const char *name)
|
static struct ast_call_feature *find_dynamic_feature(const char *name)
|
||||||
{
|
{
|
||||||
struct ast_call_feature *tmp;
|
struct ast_call_feature *tmp;
|
||||||
|
|
||||||
@@ -1025,13 +1025,16 @@ static void unmap_features(void)
|
|||||||
|
|
||||||
static int remap_feature(const char *name, const char *value)
|
static int remap_feature(const char *name, const char *value)
|
||||||
{
|
{
|
||||||
int res = -1;
|
int x, res = -1;
|
||||||
struct ast_call_feature *feature;
|
|
||||||
|
|
||||||
ast_rwlock_wrlock(&features_lock);
|
ast_rwlock_wrlock(&features_lock);
|
||||||
if ((feature = find_feature(name))) {
|
for (x = 0; x < FEATURES_COUNT; x++) {
|
||||||
ast_copy_string(feature->exten, value, sizeof(feature->exten));
|
if (strcasecmp(builtin_features[x].sname, name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ast_copy_string(builtin_features[x].exten, value, sizeof(builtin_features[x].exten));
|
||||||
res = 0;
|
res = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ast_rwlock_unlock(&features_lock);
|
ast_rwlock_unlock(&features_lock);
|
||||||
|
|
||||||
@@ -1076,23 +1079,21 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
|
|||||||
tmp = ast_strdupa(dynamic_features);
|
tmp = ast_strdupa(dynamic_features);
|
||||||
|
|
||||||
while ((tok = strsep(&tmp, "#"))) {
|
while ((tok = strsep(&tmp, "#"))) {
|
||||||
ast_rwlock_rdlock(&features_lock);
|
AST_LIST_LOCK(&feature_list);
|
||||||
if (!(feature = find_feature(tok))) {
|
if (!(feature = find_dynamic_feature(tok)))
|
||||||
ast_rwlock_unlock(&features_lock);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* Feature is up for consideration */
|
/* Feature is up for consideration */
|
||||||
if (!strcmp(feature->exten, code)) {
|
if (!strcmp(feature->exten, code)) {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 " Feature Found: %s exten: %s\n",feature->sname, tok);
|
ast_verbose(VERBOSE_PREFIX_3 " Feature Found: %s exten: %s\n",feature->sname, tok);
|
||||||
res = feature->operation(chan, peer, config, code, sense);
|
res = feature->operation(chan, peer, config, code, sense);
|
||||||
ast_rwlock_unlock(&features_lock);
|
AST_LIST_UNLOCK(&feature_list);
|
||||||
break;
|
break;
|
||||||
} else if (!strncmp(feature->exten, code, strlen(code)))
|
} else if (!strncmp(feature->exten, code, strlen(code)))
|
||||||
res = FEATURE_RETURN_STOREDIGITS;
|
res = FEATURE_RETURN_STOREDIGITS;
|
||||||
|
|
||||||
ast_rwlock_unlock(&features_lock);
|
AST_LIST_UNLOCK(&feature_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -1127,14 +1128,14 @@ static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer,
|
|||||||
|
|
||||||
/* while we have a feature */
|
/* while we have a feature */
|
||||||
while ((tok = strsep(&tmp, "#"))) {
|
while ((tok = strsep(&tmp, "#"))) {
|
||||||
ast_rwlock_rdlock(&features_lock);
|
AST_LIST_LOCK(&feature_list);
|
||||||
if ((feature = find_feature(tok)) && ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
|
if ((feature = find_dynamic_feature(tok)) && ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) {
|
||||||
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLER))
|
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLER))
|
||||||
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
|
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
|
||||||
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLEE))
|
if (ast_test_flag(feature, AST_FEATURE_FLAG_BYCALLEE))
|
||||||
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
|
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
|
||||||
}
|
}
|
||||||
ast_rwlock_unlock(&features_lock);
|
AST_LIST_UNLOCK(&feature_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2299,10 +2300,13 @@ static int load_config(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((feature = find_feature(var->name))) {
|
AST_LIST_LOCK(&feature_list);
|
||||||
|
if ((feature = find_dynamic_feature(var->name))) {
|
||||||
|
AST_LIST_UNLOCK(&feature_list);
|
||||||
ast_log(LOG_WARNING, "Dynamic Feature '%s' specified more than once!\n", var->name);
|
ast_log(LOG_WARNING, "Dynamic Feature '%s' specified more than once!\n", var->name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
AST_LIST_UNLOCK(&feature_list);
|
||||||
|
|
||||||
if (!(feature = ast_calloc(1, sizeof(*feature))))
|
if (!(feature = ast_calloc(1, sizeof(*feature))))
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user