mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
features_config: Ignore parkinglots in features.conf instead of failing to load
Parkinglots are defined in res_features.conf now, but this patch fixes features_config so that features don't fail to load when parkinglots are present in features.conf Review: https://reviewboard.asterisk.org/r/2801/ ........ Merged revisions 398068 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398099 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -473,7 +473,7 @@ static int process_category(struct ast_config *cfg, struct aco_info *info, struc
|
|||||||
|
|
||||||
field = info->internal->pending + type->item_offset;
|
field = info->internal->pending + type->item_offset;
|
||||||
if (!*field) {
|
if (!*field) {
|
||||||
ast_log(LOG_ERROR, "No object to update!\n");
|
ast_log(LOG_ERROR, "In %s: %s - No object to update!\n", file->filename, cat);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -180,7 +180,7 @@
|
|||||||
format for the recording is determined by the <replaceable>TOUCH_MONITOR_FORMAT</replaceable>
|
format for the recording is determined by the <replaceable>TOUCH_MONITOR_FORMAT</replaceable>
|
||||||
channel variable. If this variable is not specified, then <literal>wav</literal> is the
|
channel variable. If this variable is not specified, then <literal>wav</literal> is the
|
||||||
default. The filename is constructed in the following manner:</para>
|
default. The filename is constructed in the following manner:</para>
|
||||||
|
|
||||||
<para> prefix-timestamp-filename</para>
|
<para> prefix-timestamp-filename</para>
|
||||||
|
|
||||||
<para>where prefix is either the value of the <replaceable>TOUCH_MONITOR_PREFIX</replaceable>
|
<para>where prefix is either the value of the <replaceable>TOUCH_MONITOR_PREFIX</replaceable>
|
||||||
@@ -547,9 +547,15 @@ static void *featuregroup_alloc(const char *cat)
|
|||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Used for deprecated parking configuration */
|
||||||
|
struct dummy_config {
|
||||||
|
char dummy;
|
||||||
|
};
|
||||||
|
|
||||||
struct features_config {
|
struct features_config {
|
||||||
struct features_global_config *global;
|
struct features_global_config *global;
|
||||||
struct ast_featuremap_config *featuremap;
|
struct ast_featuremap_config *featuremap;
|
||||||
|
struct dummy_config *parkinglots;
|
||||||
struct ao2_container *applicationmap;
|
struct ao2_container *applicationmap;
|
||||||
struct ao2_container *featuregroups;
|
struct ao2_container *featuregroups;
|
||||||
};
|
};
|
||||||
@@ -588,14 +594,24 @@ static struct aco_type featuregroup_option = {
|
|||||||
.item_find = featuregroup_find,
|
.item_find = featuregroup_find,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct aco_type parkinglot_option = {
|
||||||
|
.type = ACO_GLOBAL,
|
||||||
|
.name = "parkinglot",
|
||||||
|
.category_match = ACO_WHITELIST,
|
||||||
|
.category = "^parkinglot_.*$",
|
||||||
|
.item_offset = offsetof(struct features_config, parkinglots),
|
||||||
|
.hidden = 1,
|
||||||
|
};
|
||||||
|
|
||||||
static struct aco_type *global_options[] = ACO_TYPES(&global_option);
|
static struct aco_type *global_options[] = ACO_TYPES(&global_option);
|
||||||
static struct aco_type *featuremap_options[] = ACO_TYPES(&featuremap_option);
|
static struct aco_type *featuremap_options[] = ACO_TYPES(&featuremap_option);
|
||||||
static struct aco_type *applicationmap_options[] = ACO_TYPES(&applicationmap_option);
|
static struct aco_type *applicationmap_options[] = ACO_TYPES(&applicationmap_option);
|
||||||
static struct aco_type *featuregroup_options[] = ACO_TYPES(&featuregroup_option);
|
static struct aco_type *featuregroup_options[] = ACO_TYPES(&featuregroup_option);
|
||||||
|
static struct aco_type *parkinglot_options[] = ACO_TYPES(&parkinglot_option);
|
||||||
|
|
||||||
static struct aco_file features_conf = {
|
static struct aco_file features_conf = {
|
||||||
.filename = "features.conf",
|
.filename = "features.conf",
|
||||||
.types = ACO_TYPES(&global_option, &featuremap_option, &applicationmap_option, &featuregroup_option),
|
.types = ACO_TYPES(&global_option, &featuremap_option, &applicationmap_option, &featuregroup_option, &parkinglot_option),
|
||||||
};
|
};
|
||||||
|
|
||||||
AO2_GLOBAL_OBJ_STATIC(globals);
|
AO2_GLOBAL_OBJ_STATIC(globals);
|
||||||
@@ -714,6 +730,11 @@ static struct features_config *__features_config_alloc(int allocate_applicationm
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg->parkinglots = ao2_alloc(sizeof(*cfg->parkinglots), NULL);
|
||||||
|
if (!cfg->parkinglots) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (allocate_applicationmap) {
|
if (allocate_applicationmap) {
|
||||||
cfg->applicationmap = applicationmap_alloc(1);
|
cfg->applicationmap = applicationmap_alloc(1);
|
||||||
if (!cfg->applicationmap) {
|
if (!cfg->applicationmap) {
|
||||||
@@ -1433,9 +1454,15 @@ static int pickup_handler(const struct aco_option *opt,
|
|||||||
return pickup_set(pickup, var->name, var->value);
|
return pickup_set(pickup, var->name, var->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int parking_warning = 0;
|
||||||
static int unsupported_handler(const struct aco_option *opt,
|
static int unsupported_handler(const struct aco_option *opt,
|
||||||
struct ast_variable *var, void *obj)
|
struct ast_variable *var, void *obj)
|
||||||
{
|
{
|
||||||
|
if (!parking_warning) {
|
||||||
|
ast_log(LOG_WARNING, "Parkinglots are no longer configurable in features.conf; "
|
||||||
|
"parking is now handled by res_parking.conf\n");
|
||||||
|
parking_warning = 1;
|
||||||
|
}
|
||||||
ast_log(LOG_WARNING, "The option '%s' is no longer configurable in features.conf.\n", var->name);
|
ast_log(LOG_WARNING, "The option '%s' is no longer configurable in features.conf.\n", var->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1708,6 +1735,9 @@ static int load_config(void)
|
|||||||
aco_option_register_custom(&cfg_info, "^.*$", ACO_REGEX, featuregroup_options,
|
aco_option_register_custom(&cfg_info, "^.*$", ACO_REGEX, featuregroup_options,
|
||||||
"", featuregroup_handler, 0);
|
"", featuregroup_handler, 0);
|
||||||
|
|
||||||
|
aco_option_register_custom_nodoc(&cfg_info, "^.*$", ACO_REGEX, parkinglot_options,
|
||||||
|
"", unsupported_handler, 0);
|
||||||
|
|
||||||
if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
|
if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
|
||||||
RAII_VAR(struct features_config *, features_cfg, __features_config_alloc(0), ao2_cleanup);
|
RAII_VAR(struct features_config *, features_cfg, __features_config_alloc(0), ao2_cleanup);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user