367 #define DEFAULT_FEATURE_DIGIT_TIMEOUT 1000 368 #define DEFAULT_COURTESY_TONE "" 369 #define DEFAULT_RECORDING_FAIL_SOUND "" 372 #define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3 373 #define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER 15 374 #define DEFAULT_ATXFER_DROP_CALL 0 375 #define DEFAULT_ATXFER_LOOP_DELAY 10 376 #define DEFAULT_ATXFER_CALLBACK_RETRIES 2 377 #define DEFAULT_XFERSOUND "beep" 378 #define DEFAULT_XFERFAILSOUND "beeperr" 379 #define DEFAULT_ATXFER_ABORT "*1" 380 #define DEFAULT_ATXFER_COMPLETE "*2" 381 #define DEFAULT_ATXFER_THREEWAY "*3" 382 #define DEFAULT_ATXFER_SWAP "*4" 383 #define DEFAULT_TRANSFER_DIAL_ATTEMPTS 3 384 #define DEFAULT_TRANSFER_RETRY_SOUND "pbx-invalid" 385 #define DEFAULT_TRANSFER_INVALID_SOUND "privacy-incorrect" 388 #define DEFAULT_PICKUPEXTEN "*8" 389 #define DEFAULT_PICKUPSOUND "" 390 #define DEFAULT_PICKUPFAILSOUND "" 393 #define DEFAULT_FEATUREMAP_BLINDXFER "#" 394 #define DEFAULT_FEATUREMAP_DISCONNECT "*" 395 #define DEFAULT_FEATUREMAP_AUTOMON "" 396 #define DEFAULT_FEATUREMAP_ATXFER "" 397 #define DEFAULT_FEATUREMAP_PARKCALL "" 398 #define DEFAULT_FEATUREMAP_AUTOMIXMON "" 425 return strcasecmp(item1->
name, key2);
428 return strncasecmp(item1->
name, key2, strlen(key2));
432 return strcasecmp(item1->
name, item2->
name);
520 return strncasecmp(group1->
name, key2, strlen(key2)) ? 0 :
CMP_MATCH;
584 .category =
"general",
590 .name =
"featuremap",
592 .category =
"featuremap",
598 .name =
"applicationmap",
600 .category =
"applicationmap",
606 .name =
"featuregroup",
608 .category =
"^(general|featuremap|applicationmap|parkinglot_.*)$",
616 .name =
"parkinglot",
618 .category =
"^parkinglot_.*$",
631 .types =
ACO_TYPES(&global_option, &featuremap_option, &applicationmap_option, &featuregroup_option, &parkinglot_option),
751 cfg->parkinglots =
ao2_alloc(
sizeof(*cfg->parkinglots),
NULL);
752 if (!cfg->parkinglots) {
756 if (allocate_applicationmap) {
758 if (!cfg->applicationmap) {
764 if (!cfg->featuregroups) {
843 if (!strcasecmp(name,
"featuredigittimeout")) {
845 }
else if (!strcasecmp(name,
"courtesytone")) {
847 }
else if (!strcasecmp(name,
"recordingfailsound")) {
862 if (!strcasecmp(field,
"featuredigittimeout")) {
864 }
else if (!strcasecmp(field,
"courtesytone")) {
866 }
else if (!strcasecmp(field,
"recordingfailsound")) {
881 if (!strcasecmp(name,
"transferdigittimeout")) {
883 }
else if (!strcasecmp(name,
"atxfernoanswertimeout")) {
885 }
else if (!strcasecmp(name,
"atxferloopdelay")) {
887 }
else if (!strcasecmp(name,
"atxfercallbackretries")) {
889 }
else if (!strcasecmp(name,
"atxferdropcall")) {
891 }
else if (!strcasecmp(name,
"xfersound")) {
893 }
else if (!strcasecmp(name,
"xferfailsound")) {
895 }
else if (!strcasecmp(name,
"atxferabort")) {
897 }
else if (!strcasecmp(name,
"atxfercomplete")) {
899 }
else if (!strcasecmp(name,
"atxferthreeway")) {
901 }
else if (!strcasecmp(name,
"atxferswap")) {
903 }
else if (!strcasecmp(name,
"transferdialattempts")) {
905 }
else if (!strcasecmp(name,
"transferretrysound")) {
907 }
else if (!strcasecmp(name,
"transferinvalidsound")) {
922 if (!strcasecmp(field,
"transferdigittimeout")) {
924 }
else if (!strcasecmp(field,
"atxfernoanswertimeout")) {
926 }
else if (!strcasecmp(field,
"atxferloopdelay")) {
928 }
else if (!strcasecmp(field,
"atxfercallbackretries")) {
930 }
else if (!strcasecmp(field,
"atxferdropcall")) {
932 }
else if (!strcasecmp(field,
"xfersound")) {
934 }
else if (!strcasecmp(field,
"xferfailsound")) {
936 }
else if (!strcasecmp(field,
"atxferabort")) {
938 }
else if (!strcasecmp(field,
"atxfercomplete")) {
940 }
else if (!strcasecmp(field,
"atxferthreeway")) {
942 }
else if (!strcasecmp(field,
"atxferswap")) {
944 }
else if (!strcasecmp(field,
"transferdialattempts")) {
946 }
else if (!strcasecmp(field,
"transferretrysound")) {
948 }
else if (!strcasecmp(field,
"transferinvalidsound")) {
963 if (!strcasecmp(name,
"pickupsound")) {
965 }
else if (!strcasecmp(name,
"pickupfailsound")) {
967 }
else if (!strcasecmp(name,
"pickupexten")) {
982 if (!strcasecmp(field,
"pickupsound")) {
984 }
else if (!strcasecmp(field,
"pickupfailsound")) {
986 }
else if (!strcasecmp(field,
"pickupexten")) {
1001 if (!strcasecmp(name,
"blindxfer")) {
1003 }
else if (!strcasecmp(name,
"disconnect")) {
1005 }
else if (!strcasecmp(name,
"automon")) {
1007 }
else if (!strcasecmp(name,
"atxfer")) {
1009 }
else if (!strcasecmp(name,
"automixmon")) {
1011 }
else if (!strcasecmp(name,
"parkcall")) {
1026 if (!strcasecmp(field,
"blindxfer")) {
1028 }
else if (!strcasecmp(field,
"disconnect")) {
1030 }
else if (!strcasecmp(field,
"automon")) {
1032 }
else if (!strcasecmp(field,
"atxfer")) {
1034 }
else if (!strcasecmp(field,
"automixmon")) {
1036 }
else if (!strcasecmp(field,
"parkcall")) {
1137 ast_assert(cfg->global && cfg->global->general);
1139 ao2_ref(cfg->global->general, +1);
1140 return cfg->global->general;
1157 ast_assert(cfg->global && cfg->global->xfer);
1159 ao2_ref(cfg->global->xfer, +1);
1160 return cfg->global->xfer;
1207 ast_assert(cfg->global && cfg->global->pickup);
1209 ao2_ref(cfg->global->pickup, +1);
1210 return cfg->global->pickup;
1230 return cfg->featuremap;
1261 if (!applicationmap) {
1321 ao2_link(applicationmap, appmap_item);
1340 ao2_ref(cfg->applicationmap, +1);
1341 return cfg->applicationmap;
1350 if (!applicationmap) {
1357 while ((name =
strsep(&group_names,
"#"))) {
1379 return applicationmap;
1397 unsigned int activate_on_self;
1412 slash = strchr(
args.activate_on,
'/');
1418 if (!
args.app_data) {
1428 paren = strchr(
args.app,
'(');
1435 close_paren = strrchr(paren,
')');
1437 *close_paren =
'\0';
1446 }
else if (strchr(
args.app_data,
'"')) {
1451 if (!strcasecmp(
args.activate_on,
"self") || !strcasecmp(
args.activate_on,
"caller")) {
1452 activate_on_self = 1;
1453 }
else if (!strcasecmp(
args.activate_on,
"peer") || !strcasecmp(
args.activate_on,
"callee")) {
1454 activate_on_self = 0;
1461 ast_debug(1,
"Allocating applicationmap item: dtmf = %s, app = %s, app_data = %s, moh_class = %s\n",
1465 args.moh_class,
args.dtmf, activate_on_self);
1534 "parking is now handled by res_parking.conf\n");
1613 if (!strcasecmp(data,
"inherit")) {
1617 snprintf(buf, len,
"%s", inherit ?
"yes" :
"no");
1626 res =
general_get(cfg->global->general, data, buf, len) &&
1627 xfer_get(cfg->global->xfer, data, buf, len) &&
1628 pickup_get(cfg->global->pickup, data, buf, len);
1644 if (!strcasecmp(data,
"inherit")) {
1656 res =
general_set(cfg->global->general, data, value) &&
1657 xfer_set(cfg->global->xfer, data, value) &&
1658 pickup_set(cfg->global->pickup, data, value);
1753 .
name =
"FEATUREMAP",
1761 ast_log(
LOG_ERROR,
"Unable to initialize configuration info for features\n");
1869 aco_set_defaults(&featuremap_option,
"featuremap", features_cfg->featuremap)) {
1870 ast_log(
LOG_ERROR,
"Failed to load features.conf and failed to initialize defaults.\n");
1903 #define HFS_FORMAT "%-25s %-7s %-7s\n" 1932 "Usage: features show\n" 1933 " Lists configured features\n";
struct features_global_config * global
static int internal_featuremap_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static struct aco_type featuregroup_option
const ast_string_field app
static struct features_config * __features_config_alloc(int allocate_applicationmap)
Main Channel structure associated with a channel.
#define DEFAULT_XFERFAILSOUND
#define AST_CLI_DEFINE(fn, txt,...)
#define DEFAULT_FEATUREMAP_BLINDXFER
static void general_copy(struct ast_features_general_config *dest, const struct ast_features_general_config *src)
#define DEFAULT_ATXFER_CALLBACK_RETRIES
static void * feature_ds_duplicate(void *data)
static struct aco_type global_option
Feature configuration relating to transfers.
static int pickup_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Asterisk main include file. File version handling, generic pbx functions.
static struct aco_type * applicationmap_options[]
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
int load_features_config(void)
static struct aco_type featuremap_option
static struct aco_type global
#define DEFAULT_ATXFER_LOOP_DELAY
static void features_config_destructor(void *obj)
Featuregroup representation.
static struct aco_type applicationmap_option
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
struct ao2_container * featuregroups
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
const ast_string_field atxferabort
static int internal_feature_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int print_applicationmap(void *obj, void *arg, int flags)
static const struct ast_datastore_info feature_ds_info
static int featuregroup_hash(const void *obj, int flags)
const ast_string_field atxferthreeway
#define DEFAULT_FEATUREMAP_ATXFER
Configuration for the builtin features.
static struct ast_datastore * get_feature_chan_ds(struct ast_channel *chan)
An applicationmap configuration item.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
descriptor for a cli entry.
const ast_string_field atxfercomplete
static void featuregroup_item_destructor(void *obj)
static struct aco_file features_conf
#define ao2_callback(c, flags, cb_fn, arg)
Allow objects with duplicate keys in container.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
struct ao2_container * ast_get_chan_applicationmap(struct ast_channel *chan)
Get the applicationmap for a given channel.
Structure for variables, used for configurations and for channel variables.
static struct ao2_container * applicationmap_alloc(int replace_duplicates)
#define DEFAULT_ATXFER_COMPLETE
unsigned int atxferdropcall
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
static int featuregroup_cmp(void *obj, void *arg, int flags)
const ast_string_field appmap_item_name
const ast_string_field pickupsound
Structure for a data store type.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
static struct aco_type item
#define ao2_global_obj_ref(holder)
General features configuration items.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
static void global_config_destructor(void *obj)
static int group_item_sort(const void *obj, const void *arg, int flags)
unsigned int featuredigittimeout
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
unsigned int transferdigittimeout
static int feature_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static void ast_applicationmap_item_destructor(void *obj)
The representation of a single configuration file to be processed.
void ast_cli(int fd, const char *fmt,...)
#define DEFAULT_FEATUREMAP_DISCONNECT
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
struct ast_applicationmap_item * appmap_item
struct ao2_container * items
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
unsigned int transferdialattempts
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
static void * featuregroup_find(struct ao2_container *group_container, const char *category)
struct ast_featuremap_config * featuremap
static int check_featuregroup_item(void *obj, void *arg, void *data, int flags)
#define ast_strlen_zero(foo)
#define DEFAULT_RECORDING_FAIL_SOUND
#define DEFAULT_PICKUPEXTEN
static struct ao2_container * group_container
struct ast_features_xfer_config * xfer
const ast_string_field courtesytone
static int general_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
const ast_string_field atxfer
struct ast_features_general_config * general
Asterisk datastore objects.
struct ast_features_general_config * ast_get_chan_features_general_config(struct ast_channel *chan)
Get the general configuration options for a channel.
static int unsupported_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Configuration from the "general" section of features.conf.
int reload_features_config(void)
static void * featuregroup_alloc(const char *cat)
const ast_string_field xferfailsound
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
const ast_string_field transferretrysound
struct ast_features_pickup_config * pickup
#define ast_debug(level,...)
Log a DEBUG message.
static int general_get(struct ast_features_general_config *general, const char *field, char *buf, size_t len)
#define DEFAULT_ATXFER_DROP_CALL
static int xfer_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct features_global_config * global_config_alloc(void)
#define DEFAULT_TRANSFER_INVALID_SOUND
AO2_GLOBAL_OBJ_STATIC(globals)
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
static struct aco_type parkinglot_option
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
General Asterisk PBX channel definitions.
static struct aco_type * featuremap_options[]
void * aco_pending_config(struct aco_info *info)
Get pending config changes.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static struct ast_applicationmap_item * applicationmap_item_alloc(const char *name, const char *app, const char *app_data, const char *moh_class, const char *dtmf, unsigned int activate_on_self)
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
static int applicationmap_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Data structure associated with a custom dialplan function.
unsigned int atxferloopdelay
#define AST_STRING_FIELD(name)
Declare a string field.
#define ao2_ref(o, delta)
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define DEFAULT_FEATUREMAP_AUTOMIXMON
static int add_item(void *obj, void *arg, int flags)
static struct console_pvt globals
static void feature_ds_destroy(void *data)
static int featuremap_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
struct ast_featuremap_config * ast_get_chan_featuremap_config(struct ast_channel *chan)
Get the featuremap configuration options for a channel.
int ast_get_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len)
Get the DTMF code for a call feature.
static void general_destructor(void *obj)
static struct ast_cli_entry cli_features_config[]
struct dummy_config * parkinglots
Core PBX routines and definitions.
const ast_string_field name
static void xfer_copy(struct ast_features_xfer_config *dest, const struct ast_features_xfer_config *src)
Their was an error and no changes were applied.
struct ao2_container * applicationmap
static int pickup_set(struct ast_features_pickup_config *pickup, const char *name, const char *value)
static int load_config(void)
static void xfer_destructor(void *obj)
static struct features_config * features_config_dup(const struct features_config *orig)
static int xfer_get(struct ast_features_xfer_config *xfer, const char *field, char *buf, size_t len)
#define DEFAULT_FEATUREMAP_PARKCALL
Configuration option-handling.
static int feature_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
#define ast_string_fields_copy(copy, orig)
Copy all string fields from one instance to another of the same structure.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
const ast_string_field pickupfailsound
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
unsigned int activate_on_self
static void featuremap_copy(struct ast_featuremap_config *dest, const struct ast_featuremap_config *src)
#define ao2_global_obj_release(holder)
static struct ast_custom_function feature_function
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
unsigned int atxfernoanswertimeout
#define ao2_callback_data(container, flags, cb_fn, arg, data)
static void pickup_copy(struct ast_features_pickup_config *dest, const struct ast_features_pickup_config *src)
static int pickup_get(struct ast_features_pickup_config *pickup, const char *field, char *buf, size_t len)
#define ao2_alloc(data_size, destructor_fn)
static struct aco_type * featuregroup_options[]
#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER
const ast_string_field atxferswap
static int featuremap_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int applicationmap_sort(const void *obj, const void *arg, int flags)
static void parse(struct mgcp_request *req)
static struct ast_custom_function featuremap_function
static int featuregroup_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
static int parking_warning
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *result,...)
The argument parsing routine.
static int print_featuregroup(void *obj, void *arg, int flags)
const ast_string_field dtmf_override
#define DEFAULT_TRANSFER_DIAL_ATTEMPTS
static struct aco_type * parkinglot_options[]
static int general_set(struct ast_features_general_config *general, const char *name, const char *value)
void unload_features_config(void)
#define DATASTORE_INHERIT_FOREVER
#define DEFAULT_ATXFER_ABORT
#define ao2_find(container, arg, flags)
static int check_featuregroup(void *obj, void *arg, void *data, int flags)
static char * handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command to list configured features.
const ast_string_field moh_class
#define DEFAULT_XFERSOUND
char * ast_get_chan_features_xferfailsound(struct ast_channel *chan)
Get the transfer configuration option xferfailsound.
Entry in the container of featuregroups.
CONFIG_INFO_CORE("features", cfg_info, globals, features_config_alloc,.files=ACO_FILES(&features_conf),.pre_apply_config=features_pre_apply_config,)
const ast_string_field automon
static int print_featuregroups(void *obj, void *arg, int flags)
static int featuremap_get(struct ast_featuremap_config *featuremap, const char *field, char *buf, size_t len)
const ast_string_field recordingfailsound
#define ao2_global_obj_replace_unref(holder, obj)
#define DEFAULT_FEATURE_DIGIT_TIMEOUT
Replace objects with duplicate keys in container.
char * strsep(char **str, const char *delims)
static int internal_featuremap_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
const ast_string_field blindxfer
#define DEFAULT_COURTESY_TONE
Standard Command Line Interface.
Type information about a category-level configurable object.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define DEFAULT_TRANSFER_DIGIT_TIMEOUT
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
#define DEFAULT_PICKUPFAILSOUND
const char * ast_channel_name(const struct ast_channel *chan)
static void featuregroup_destructor(void *obj)
struct ast_features_xfer_config * ast_get_chan_features_xfer_config(struct ast_channel *chan)
Get the transfer configuration options for a channel.
static void pickup_destructor(void *obj)
int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod)
Register a custom function.
static int internal_feature_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static void featuremap_config_destructor(void *obj)
static struct aco_type * global_options[]
char * ast_get_chan_features_atxferabort(struct ast_channel *chan)
Get the transfer configuration option atxferabort.
#define ast_datastore_alloc(info, uid)
static void * features_config_alloc(void)
int ast_get_builtin_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len)
Get the DTMF code for a builtin feature.
static int features_pre_apply_config(void)
const ast_string_field xfersound
#define DEFAULT_FEATUREMAP_AUTOMON
static struct features_config * get_feature_ds(struct ast_channel *chan)
const ast_string_field parkcall
static int xfer_set(struct ast_features_xfer_config *xfer, const char *name, const char *value)
const ast_string_field automixmon
static int featuremap_set(struct ast_featuremap_config *featuremap, const char *name, const char *value)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
char dtmf[AST_FEATURE_MAX_LEN]
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
unsigned int atxfercallbackretries
static void features_copy(struct features_config *dest, const struct features_config *src)
#define DEFAULT_PICKUPSOUND
#define DEFAULT_ATXFER_THREEWAY
static void global_copy(struct features_global_config *dest, const struct features_global_config *src)
const ast_string_field disconnect
const ast_string_field transferinvalidsound
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
#define DEFAULT_ATXFER_SWAP
const ast_string_field app_data
const ast_string_field pickupexten
Configuration relating to call pickup.
#define AST_APP_ARG(name)
Define an application argument.
#define DEFAULT_TRANSFER_RETRY_SOUND
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define aco_option_register_custom_nodoc(info, name, matchtype, types, default_val, handler, flags)
Register a config option with no expected documentation.
#define ao2_link(container, obj)
static int featuremap_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)