Asterisk - The Open Source Telephony Project GIT-master-97770a9
Data Structures | Macros | Functions | Variables
features_config.c File Reference
#include "asterisk.h"
#include "asterisk/features_config.h"
#include "asterisk/config_options.h"
#include "asterisk/datastore.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/cli.h"
#include "features_config.h"
Include dependency graph for features_config.c:

Go to the source code of this file.

Data Structures

struct  dummy_config
 
struct  featuregroup
 Featuregroup representation. More...
 
struct  featuregroup_item
 Entry in the container of featuregroups. More...
 
struct  features_config
 
struct  features_global_config
 Configuration from the "general" section of features.conf. More...
 

Macros

#define DEFAULT_ATXFER_ABORT   "*1"
 
#define DEFAULT_ATXFER_CALLBACK_RETRIES   2
 
#define DEFAULT_ATXFER_COMPLETE   "*2"
 
#define DEFAULT_ATXFER_DROP_CALL   0
 
#define DEFAULT_ATXFER_LOOP_DELAY   10
 
#define DEFAULT_ATXFER_SWAP   "*4"
 
#define DEFAULT_ATXFER_THREEWAY   "*3"
 
#define DEFAULT_COURTESY_TONE   ""
 
#define DEFAULT_FEATURE_DIGIT_TIMEOUT   1000
 
#define DEFAULT_FEATUREMAP_ATXFER   ""
 
#define DEFAULT_FEATUREMAP_AUTOMIXMON   ""
 
#define DEFAULT_FEATUREMAP_AUTOMON   ""
 
#define DEFAULT_FEATUREMAP_BLINDXFER   "#"
 
#define DEFAULT_FEATUREMAP_DISCONNECT   "*"
 
#define DEFAULT_FEATUREMAP_PARKCALL   ""
 
#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER   15
 
#define DEFAULT_PICKUPEXTEN   "*8"
 
#define DEFAULT_PICKUPFAILSOUND   ""
 
#define DEFAULT_PICKUPSOUND   ""
 
#define DEFAULT_RECORDING_FAIL_SOUND   ""
 
#define DEFAULT_TRANSFER_ANNOUNCE_SOUND   "pbx-transfer"
 
#define DEFAULT_TRANSFER_DIAL_ATTEMPTS   3
 
#define DEFAULT_TRANSFER_DIGIT_TIMEOUT   3
 
#define DEFAULT_TRANSFER_INVALID_SOUND   "privacy-incorrect"
 
#define DEFAULT_TRANSFER_RETRY_SOUND   "pbx-invalid"
 
#define DEFAULT_XFERFAILSOUND   "beeperr"
 
#define DEFAULT_XFERSOUND   "beep"
 
#define HFS_FORMAT   "%-25s %-7s %-7s\n"
 

Functions

static struct features_config__features_config_alloc (int allocate_applicationmap)
 
static int add_item (void *obj, void *arg, int flags)
 
 AO2_GLOBAL_OBJ_STATIC (globals)
 
static struct ao2_containerapplicationmap_alloc (int replace_duplicates)
 
static int applicationmap_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static struct ast_applicationmap_itemapplicationmap_item_alloc (const char *name, const char *app, const char *app_data, const char *moh_class, const char *dtmf, unsigned int activate_on_self)
 
static int applicationmap_sort (const void *obj, const void *arg, int flags)
 
static void ast_applicationmap_item_destructor (void *obj)
 
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. More...
 
struct ao2_containerast_get_chan_applicationmap (struct ast_channel *chan)
 Get the applicationmap for a given channel. More...
 
struct ast_featuremap_configast_get_chan_featuremap_config (struct ast_channel *chan)
 Get the featuremap configuration options for a channel. More...
 
char * ast_get_chan_features_atxferabort (struct ast_channel *chan)
 Get the transfer configuration option atxferabort. More...
 
struct ast_features_general_configast_get_chan_features_general_config (struct ast_channel *chan)
 Get the general configuration options for a channel. More...
 
struct ast_features_pickup_configast_get_chan_features_pickup_config (struct ast_channel *chan)
 Get the pickup configuration options for a channel. More...
 
struct ast_features_xfer_configast_get_chan_features_xfer_config (struct ast_channel *chan)
 Get the transfer configuration options for a channel. More...
 
char * ast_get_chan_features_xferfailsound (struct ast_channel *chan)
 Get the transfer configuration option xferfailsound. More...
 
int ast_get_feature (struct ast_channel *chan, const char *feature, char *buf, size_t len)
 Get the DTMF code for a call feature. More...
 
static int check_featuregroup (void *obj, void *arg, void *data, int flags)
 
static int check_featuregroup_item (void *obj, void *arg, void *data, int flags)
 
 CONFIG_INFO_CORE ("features", cfg_info, globals, features_config_alloc,.files=ACO_FILES(&features_conf),.pre_apply_config=features_pre_apply_config,)
 
static void feature_ds_destroy (void *data)
 
static void * feature_ds_duplicate (void *data)
 
static int feature_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int feature_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static void * featuregroup_alloc (const char *cat)
 
static int featuregroup_cmp (void *obj, void *arg, int flags)
 
static void featuregroup_destructor (void *obj)
 
static void * featuregroup_find (struct ao2_container *group_container, const char *category)
 
static int featuregroup_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int featuregroup_hash (const void *obj, int flags)
 
static void featuregroup_item_destructor (void *obj)
 
static void featuremap_config_destructor (void *obj)
 
static void featuremap_copy (struct ast_featuremap_config *dest, const struct ast_featuremap_config *src)
 
static int featuremap_get (struct ast_featuremap_config *featuremap, const char *field, char *buf, size_t len)
 
static int featuremap_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int featuremap_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int featuremap_set (struct ast_featuremap_config *featuremap, const char *name, const char *value)
 
static int featuremap_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static void * features_config_alloc (void)
 
static void features_config_destructor (void *obj)
 
static struct features_configfeatures_config_dup (const struct features_config *orig)
 
static void features_copy (struct features_config *dest, const struct features_config *src)
 
static int features_pre_apply_config (void)
 
static void general_copy (struct ast_features_general_config *dest, const struct ast_features_general_config *src)
 
static void general_destructor (void *obj)
 
static int general_get (struct ast_features_general_config *general, const char *field, char *buf, size_t len)
 
static int general_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int general_set (struct ast_features_general_config *general, const char *name, const char *value)
 
static struct ast_datastoreget_feature_chan_ds (struct ast_channel *chan)
 
static struct features_configget_feature_ds (struct ast_channel *chan)
 
static struct features_global_configglobal_config_alloc (void)
 
static void global_config_destructor (void *obj)
 
static void global_copy (struct features_global_config *dest, const struct features_global_config *src)
 
static int group_item_sort (const void *obj, const void *arg, 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. More...
 
static int internal_feature_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int internal_feature_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static int internal_featuremap_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
static int internal_featuremap_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static int load_config (void)
 
int load_features_config (void)
 
static void pickup_copy (struct ast_features_pickup_config *dest, const struct ast_features_pickup_config *src)
 
static void pickup_destructor (void *obj)
 
static int pickup_get (struct ast_features_pickup_config *pickup, const char *field, char *buf, size_t len)
 
static int pickup_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int pickup_set (struct ast_features_pickup_config *pickup, const char *name, const char *value)
 
static int print_applicationmap (void *obj, void *arg, int flags)
 
static int print_featuregroup (void *obj, void *arg, int flags)
 
static int print_featuregroups (void *obj, void *arg, int flags)
 
int reload_features_config (void)
 
void unload_features_config (void)
 
static int unsupported_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static void xfer_copy (struct ast_features_xfer_config *dest, const struct ast_features_xfer_config *src)
 
static void xfer_destructor (void *obj)
 
static int xfer_get (struct ast_features_xfer_config *xfer, const char *field, char *buf, size_t len)
 
static int xfer_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int xfer_set (struct ast_features_xfer_config *xfer, const char *name, const char *value)
 

Variables

static struct aco_type applicationmap_option
 
static struct aco_typeapplicationmap_options [] = ACO_TYPES(&applicationmap_option)
 
static struct ast_cli_entry cli_features_config []
 
static const struct ast_datastore_info feature_ds_info
 
static struct ast_custom_function feature_function
 
static struct aco_type featuregroup_option
 
static struct aco_typefeaturegroup_options [] = ACO_TYPES(&featuregroup_option)
 
static struct ast_custom_function featuremap_function
 
static struct aco_type featuremap_option
 
static struct aco_typefeaturemap_options [] = ACO_TYPES(&featuremap_option)
 
static struct aco_file features_conf
 
static struct aco_type global_option
 
static struct aco_typeglobal_options [] = ACO_TYPES(&global_option)
 
static int parking_warning = 0
 
static struct aco_type parkinglot_option
 
static struct aco_typeparkinglot_options [] = ACO_TYPES(&parkinglot_option)
 

Macro Definition Documentation

◆ DEFAULT_ATXFER_ABORT

#define DEFAULT_ATXFER_ABORT   "*1"

Definition at line 372 of file features_config.c.

◆ DEFAULT_ATXFER_CALLBACK_RETRIES

#define DEFAULT_ATXFER_CALLBACK_RETRIES   2

Definition at line 369 of file features_config.c.

◆ DEFAULT_ATXFER_COMPLETE

#define DEFAULT_ATXFER_COMPLETE   "*2"

Definition at line 373 of file features_config.c.

◆ DEFAULT_ATXFER_DROP_CALL

#define DEFAULT_ATXFER_DROP_CALL   0

Definition at line 367 of file features_config.c.

◆ DEFAULT_ATXFER_LOOP_DELAY

#define DEFAULT_ATXFER_LOOP_DELAY   10

Definition at line 368 of file features_config.c.

◆ DEFAULT_ATXFER_SWAP

#define DEFAULT_ATXFER_SWAP   "*4"

Definition at line 375 of file features_config.c.

◆ DEFAULT_ATXFER_THREEWAY

#define DEFAULT_ATXFER_THREEWAY   "*3"

Definition at line 374 of file features_config.c.

◆ DEFAULT_COURTESY_TONE

#define DEFAULT_COURTESY_TONE   ""

Definition at line 361 of file features_config.c.

◆ DEFAULT_FEATURE_DIGIT_TIMEOUT

#define DEFAULT_FEATURE_DIGIT_TIMEOUT   1000

Default general options

Definition at line 360 of file features_config.c.

◆ DEFAULT_FEATUREMAP_ATXFER

#define DEFAULT_FEATUREMAP_ATXFER   ""

Definition at line 390 of file features_config.c.

◆ DEFAULT_FEATUREMAP_AUTOMIXMON

#define DEFAULT_FEATUREMAP_AUTOMIXMON   ""

Definition at line 392 of file features_config.c.

◆ DEFAULT_FEATUREMAP_AUTOMON

#define DEFAULT_FEATUREMAP_AUTOMON   ""

Definition at line 389 of file features_config.c.

◆ DEFAULT_FEATUREMAP_BLINDXFER

#define DEFAULT_FEATUREMAP_BLINDXFER   "#"

Default featuremap options

Definition at line 387 of file features_config.c.

◆ DEFAULT_FEATUREMAP_DISCONNECT

#define DEFAULT_FEATUREMAP_DISCONNECT   "*"

Definition at line 388 of file features_config.c.

◆ DEFAULT_FEATUREMAP_PARKCALL

#define DEFAULT_FEATUREMAP_PARKCALL   ""

Definition at line 391 of file features_config.c.

◆ DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER

#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER   15

Definition at line 366 of file features_config.c.

◆ DEFAULT_PICKUPEXTEN

#define DEFAULT_PICKUPEXTEN   "*8"

Default pickup options

Definition at line 382 of file features_config.c.

◆ DEFAULT_PICKUPFAILSOUND

#define DEFAULT_PICKUPFAILSOUND   ""

Definition at line 384 of file features_config.c.

◆ DEFAULT_PICKUPSOUND

#define DEFAULT_PICKUPSOUND   ""

Definition at line 383 of file features_config.c.

◆ DEFAULT_RECORDING_FAIL_SOUND

#define DEFAULT_RECORDING_FAIL_SOUND   ""

Definition at line 362 of file features_config.c.

◆ DEFAULT_TRANSFER_ANNOUNCE_SOUND

#define DEFAULT_TRANSFER_ANNOUNCE_SOUND   "pbx-transfer"

Definition at line 379 of file features_config.c.

◆ DEFAULT_TRANSFER_DIAL_ATTEMPTS

#define DEFAULT_TRANSFER_DIAL_ATTEMPTS   3

Definition at line 376 of file features_config.c.

◆ DEFAULT_TRANSFER_DIGIT_TIMEOUT

#define DEFAULT_TRANSFER_DIGIT_TIMEOUT   3

Default xfer options

Definition at line 365 of file features_config.c.

◆ DEFAULT_TRANSFER_INVALID_SOUND

#define DEFAULT_TRANSFER_INVALID_SOUND   "privacy-incorrect"

Definition at line 378 of file features_config.c.

◆ DEFAULT_TRANSFER_RETRY_SOUND

#define DEFAULT_TRANSFER_RETRY_SOUND   "pbx-invalid"

Definition at line 377 of file features_config.c.

◆ DEFAULT_XFERFAILSOUND

#define DEFAULT_XFERFAILSOUND   "beeperr"

Definition at line 371 of file features_config.c.

◆ DEFAULT_XFERSOUND

#define DEFAULT_XFERSOUND   "beep"

Definition at line 370 of file features_config.c.

◆ HFS_FORMAT

#define HFS_FORMAT   "%-25s %-7s %-7s\n"

Definition at line 1895 of file features_config.c.

Function Documentation

◆ __features_config_alloc()

static struct features_config * __features_config_alloc ( int  allocate_applicationmap)
static

Definition at line 726 of file features_config.c.

727{
728 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
729
730 cfg = ao2_alloc(sizeof(*cfg), features_config_destructor);
731 if (!cfg) {
732 return NULL;
733 }
734
735 cfg->global = global_config_alloc();
736 if (!cfg->global) {
737 return NULL;
738 }
739
740 cfg->featuremap = ao2_alloc(sizeof(*cfg->featuremap), featuremap_config_destructor);
741 if (!cfg->featuremap || ast_string_field_init(cfg->featuremap, 32)) {
742 return NULL;
743 }
744
745 cfg->parkinglots = ao2_alloc(sizeof(*cfg->parkinglots), NULL);
746 if (!cfg->parkinglots) {
747 return NULL;
748 }
749
750 if (allocate_applicationmap) {
751 cfg->applicationmap = applicationmap_alloc(1);
752 if (!cfg->applicationmap) {
753 return NULL;
754 }
755
756 cfg->featuregroups = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, 11,
758 if (!cfg->featuregroups) {
759 return NULL;
760 }
761 }
762
763 ao2_ref(cfg, +1);
764 return cfg;
765
766}
@ AO2_ALLOC_OPT_LOCK_NOLOCK
Definition: astobj2.h:367
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:409
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
Definition: astobj2.h:1303
static struct ao2_container * applicationmap_alloc(int replace_duplicates)
static int featuregroup_hash(const void *obj, int flags)
static void features_config_destructor(void *obj)
static int featuregroup_cmp(void *obj, void *arg, int flags)
static void featuremap_config_destructor(void *obj)
static struct features_global_config * global_config_alloc(void)
#define NULL
Definition: resample.c:96
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:359
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References ao2_alloc, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_hash, ao2_ref, applicationmap_alloc(), ast_string_field_init, featuregroup_cmp(), featuregroup_hash(), featuremap_config_destructor(), features_config_destructor(), global_config_alloc(), NULL, and RAII_VAR.

Referenced by features_config_alloc(), and features_config_dup().

◆ add_item()

static int add_item ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1288 of file features_config.c.

1289{
1290 struct featuregroup_item *fg_item = obj;
1291 struct ao2_container *applicationmap = arg;
1292 RAII_VAR(struct ast_applicationmap_item *, appmap_item, NULL, ao2_cleanup);
1293
1294 /* If there's no DTMF override, then we can just link
1295 * the applicationmap item directly. Otherwise, we need
1296 * to create a copy with the DTMF override in place and
1297 * link that instead
1298 */
1299 if (ast_strlen_zero(fg_item->dtmf_override)) {
1300 ao2_ref(fg_item->appmap_item, +1);
1301 appmap_item = fg_item->appmap_item;
1302 } else {
1303 appmap_item = applicationmap_item_alloc(fg_item->appmap_item_name,
1304 fg_item->appmap_item->app, fg_item->appmap_item->app_data,
1305 fg_item->appmap_item->moh_class, fg_item->dtmf_override,
1306 fg_item->appmap_item->activate_on_self);
1307 }
1308
1309 if (!appmap_item) {
1310 return 0;
1311 }
1312
1313 ao2_link(applicationmap, appmap_item);
1314 return 0;
1315}
#define ao2_link(container, obj)
Add an object to a container.
Definition: astobj2.h:1532
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)
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
Generic container type.
An applicationmap configuration item.
Entry in the container of featuregroups.
struct ast_applicationmap_item * appmap_item
const ast_string_field dtmf_override
const ast_string_field appmap_item_name

References ast_applicationmap_item::activate_on_self, ao2_cleanup, ao2_link, ao2_ref, ast_applicationmap_item::app, ast_applicationmap_item::app_data, applicationmap_item_alloc(), featuregroup_item::appmap_item, featuregroup_item::appmap_item_name, ast_strlen_zero(), featuregroup_item::dtmf_override, ast_applicationmap_item::moh_class, NULL, and RAII_VAR.

Referenced by ast_get_chan_applicationmap().

◆ AO2_GLOBAL_OBJ_STATIC()

AO2_GLOBAL_OBJ_STATIC ( globals  )

◆ applicationmap_alloc()

static struct ao2_container * applicationmap_alloc ( int  replace_duplicates)
static

Definition at line 706 of file features_config.c.

707{
711}
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
Definition: astobj2.h:1327
@ AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW
Allow objects with duplicate keys in container.
Definition: astobj2.h:1181
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE
Replace objects with duplicate keys in container.
Definition: astobj2.h:1211
static int applicationmap_sort(const void *obj, const void *arg, int flags)

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW, AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, applicationmap_sort(), and NULL.

Referenced by __features_config_alloc(), and ast_get_chan_applicationmap().

◆ applicationmap_handler()

static int applicationmap_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1374 of file features_config.c.

1376{
1378 struct ao2_container *applicationmap = obj;
1380 AST_APP_ARG(dtmf);
1381 AST_APP_ARG(activate_on);
1384 AST_APP_ARG(moh_class);
1385 );
1386 char *parse = ast_strdupa(var->value);
1387 char *slash;
1388 char *paren;
1389 unsigned int activate_on_self;
1390
1392
1393 if (ast_strlen_zero(args.dtmf) ||
1394 ast_strlen_zero(args.activate_on) ||
1395 ast_strlen_zero(args.app)) {
1396 ast_log(LOG_WARNING, "Invalid applicationmap syntax for '%s'. Missing required argument\n", var->name);
1397 return -1;
1398 }
1399
1400 /* features.conf used to have an "activated_by" portion
1401 * in addition to activate_on. Get rid of whatever may be
1402 * there
1403 */
1404 slash = strchr(args.activate_on, '/');
1405 if (slash) {
1406 *slash = '\0';
1407 }
1408
1409 /* Some applications do not require arguments. */
1410 if (!args.app_data) {
1411 args.app_data = "";
1412 }
1413
1414 /* Two syntaxes allowed for applicationmap:
1415 * Old: foo = *1,self,NoOp,Boo!,default
1416 * New: foo = *1,self,NoOp(Boo!),default
1417 *
1418 * We need to handle both
1419 */
1420 paren = strchr(args.app, '(');
1421 if (paren) {
1422 /* New syntax */
1423 char *close_paren;
1424
1425 args.moh_class = args.app_data;
1426 *paren++ = '\0';
1427 close_paren = strrchr(paren, ')');
1428 if (close_paren) {
1429 *close_paren = '\0';
1430 }
1431 args.app_data = paren;
1432
1433 /* Re-check that the application is not empty */
1434 if (ast_strlen_zero(args.app)) {
1435 ast_log(LOG_WARNING, "Applicationmap item '%s' does not contain an application name.\n", var->name);
1436 return -1;
1437 }
1438 } else if (strchr(args.app_data, '"')) {
1439 args.app_data = ast_strip_quoted(args.app_data, "\"", "\"");
1440 }
1441
1442 /* Allow caller and callee to be specified for backwards compatibility */
1443 if (!strcasecmp(args.activate_on, "self") || !strcasecmp(args.activate_on, "caller")) {
1444 activate_on_self = 1;
1445 } else if (!strcasecmp(args.activate_on, "peer") || !strcasecmp(args.activate_on, "callee")) {
1446 activate_on_self = 0;
1447 } else {
1448 ast_log(LOG_WARNING, "Invalid 'activate_on' value %s for applicationmap item %s\n",
1449 args.activate_on, var->name);
1450 return -1;
1451 }
1452
1453 ast_debug(1, "Allocating applicationmap item: dtmf = %s, app = %s, app_data = %s, moh_class = %s\n",
1454 args.dtmf, args.app, args.app_data, args.moh_class);
1455
1456 item = applicationmap_item_alloc(var->name, args.app, args.app_data,
1457 args.moh_class, args.dtmf, activate_on_self);
1458
1459 if (!item) {
1460 return -1;
1461 }
1462
1463 if (!ao2_link(applicationmap, item)) {
1464 return -1;
1465 }
1466
1467 return 0;
1468}
#define paren
Definition: ael_lex.c:962
static const char app[]
Definition: app_adsiprog.c:56
#define var
Definition: ast_expr2f.c:605
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_log
Definition: astobj2.c:42
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_WARNING
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
Definition: utils.c:1818
static struct aco_type item
Definition: test_config.c:1463
const char * args

References ao2_cleanup, ao2_link, app, applicationmap_item_alloc(), args, AST_APP_ARG, ast_debug, AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strip_quoted(), ast_strlen_zero(), item, LOG_WARNING, NULL, paren, RAII_VAR, and var.

Referenced by load_config().

◆ applicationmap_item_alloc()

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 
)
static

Definition at line 1266 of file features_config.c.

1269{
1271
1273
1274 if (!item || ast_string_field_init(item, 64)) {
1275 return NULL;
1276 }
1277
1282 ast_copy_string(item->dtmf, dtmf, sizeof(item->dtmf));
1283 item->activate_on_self = activate_on_self;
1284
1285 return item;
1286}
static void ast_applicationmap_item_destructor(void *obj)
static const char name[]
Definition: format_mp3.c:68
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425

References ast_applicationmap_item::activate_on_self, ao2_alloc, app, ast_applicationmap_item_destructor(), ast_copy_string(), ast_string_field_init, ast_string_field_set, ast_applicationmap_item::dtmf, item, ast_applicationmap_item::moh_class, name, and NULL.

Referenced by add_item(), and applicationmap_handler().

◆ applicationmap_sort()

static int applicationmap_sort ( const void *  obj,
const void *  arg,
int  flags 
)
static

Definition at line 410 of file features_config.c.

411{
412 const struct ast_applicationmap_item *item1 = obj;
413 const struct ast_applicationmap_item *item2;
414 const char *key2;
415
416 switch(flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
417 case OBJ_KEY:
418 key2 = arg;
419 return strcasecmp(item1->name, key2);
420 case OBJ_PARTIAL_KEY:
421 key2 = arg;
422 return strncasecmp(item1->name, key2, strlen(key2));
423 default:
424 case OBJ_POINTER:
425 item2 = arg;
426 return strcasecmp(item1->name, item2->name);
427 }
428}
#define OBJ_KEY
Definition: astobj2.h:1151
#define OBJ_POINTER
Definition: astobj2.h:1150
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1152

References ast_applicationmap_item::name, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by applicationmap_alloc().

◆ ast_applicationmap_item_destructor()

static void ast_applicationmap_item_destructor ( void *  obj)
static

Definition at line 403 of file features_config.c.

404{
405 struct ast_applicationmap_item *item = obj;
406
408}
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:374

References ast_string_field_free_memory, and item.

Referenced by applicationmap_item_alloc().

◆ ast_get_builtin_feature()

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.

Note
The channel should be locked before calling this function

If no channel is provided, then the global setting for the option is returned.

Parameters
chanThe channel to get the option from
featureThe short name of the feature (as it appears in features.conf)
[out]bufThe buffer to write the DTMF value into
lenThe size of the buffer in bytes
Return values
0Success
non-zeroUnrecognized builtin feature name

Definition at line 1225 of file features_config.c.

1226{
1227 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1228
1229 if (chan) {
1230 cfg = get_feature_ds(chan);
1231 } else {
1233 }
1234
1235 if (!cfg) {
1236 return -1;
1237 }
1238
1239 return featuremap_get(cfg->featuremap, feature, buf, len);
1240}
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
Definition: astobj2.h:918
static struct console_pvt globals
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static struct features_config * get_feature_ds(struct ast_channel *chan)
static int featuremap_get(struct ast_featuremap_config *featuremap, const char *field, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)

References ao2_cleanup, ao2_global_obj_ref, buf, featuremap_get(), get_feature_ds(), globals, len(), NULL, and RAII_VAR.

Referenced by action_atxfer(), ast_get_feature(), attended_transfer_exec(), builtin_feature_get_exten(), detect_disconnect(), and internal_featuremap_read().

◆ ast_get_chan_applicationmap()

struct ao2_container * ast_get_chan_applicationmap ( struct ast_channel chan)

Get the applicationmap for a given channel.

Note
The channel should be locked before calling this function.

This uses the value of the DYNAMIC_FEATURES channel variable to build a custom applicationmap for this channel. The returned container has applicationmap_items inside.

Parameters
chanThe channel for which applicationmap is being retrieved.
Return values
NULLAn error occurred or the channel has no dynamic features.
non-NULLA container of applicationmap_items pertaining to the channel.

Definition at line 1317 of file features_config.c.

1318{
1320 struct ao2_container *applicationmap;
1321 char *group_names;
1322 char *name;
1323
1324 if (!cfg) {
1325 return NULL;
1326 }
1327
1328 if (!chan) {
1329 if (!cfg->applicationmap || ao2_container_count(cfg->applicationmap) == 0) {
1330 return NULL;
1331 }
1332 ao2_ref(cfg->applicationmap, +1);
1333 return cfg->applicationmap;
1334 }
1335
1336 group_names = ast_strdupa(S_OR(pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES"), ""));
1337 if (ast_strlen_zero(group_names)) {
1338 return NULL;
1339 }
1340
1341 applicationmap = applicationmap_alloc(0);
1342 if (!applicationmap) {
1343 return NULL;
1344 }
1345
1346 /* global config must be initialized */
1347 ast_assert(cfg->featuregroups != NULL);
1348 ast_assert(cfg->applicationmap != NULL);
1349 while ((name = strsep(&group_names, "#"))) {
1350 RAII_VAR(struct featuregroup *, group, ao2_find(cfg->featuregroups, name, OBJ_KEY), ao2_cleanup);
1351
1352 if (!group) {
1353 RAII_VAR(struct ast_applicationmap_item *, item, ao2_find(cfg->applicationmap, name, OBJ_KEY), ao2_cleanup);
1354
1355 if (item) {
1356 ao2_link(applicationmap, item);
1357 } else {
1358 ast_log(LOG_WARNING, "Unknown DYNAMIC_FEATURES item '%s' on channel %s.\n",
1359 name, ast_channel_name(chan));
1360 }
1361 } else {
1362 ao2_callback(group->items, 0, add_item, applicationmap);
1363 }
1364 }
1365
1366 if (ao2_container_count(applicationmap) == 0) {
1367 ao2_cleanup(applicationmap);
1368 return NULL;
1369 }
1370
1371 return applicationmap;
1372}
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
Definition: astobj2.h:1693
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1736
const char * ast_channel_name(const struct ast_channel *chan)
static int add_item(void *obj, void *arg, int flags)
char * strsep(char **str, const char *delims)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition: strings.h:80
Featuregroup representation.
#define ast_assert(a)
Definition: utils.h:739

References add_item(), ao2_callback, ao2_cleanup, ao2_container_count(), ao2_find, ao2_global_obj_ref, ao2_link, ao2_ref, applicationmap_alloc(), ast_assert, ast_channel_name(), ast_log, ast_strdupa, ast_strlen_zero(), globals, item, LOG_WARNING, name, NULL, OBJ_KEY, pbx_builtin_getvar_helper(), RAII_VAR, S_OR, and strsep().

Referenced by ast_get_feature(), set_config_flags(), and setup_bridge_features_dynamic().

◆ ast_get_chan_featuremap_config()

struct ast_featuremap_config * ast_get_chan_featuremap_config ( struct ast_channel chan)

Get the featuremap configuration options for a channel.

Note
The channel should be locked before calling this function.
The returned value has its reference count incremented.

If no channel is provided, then the global featuremap configuration is returned.

Parameters
chanThe channel to get configuration options for
Return values
NULLFailed to get configuration
non-NULLThe pickup features configuration

Definition at line 1205 of file features_config.c.

1206{
1207 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1208
1209 if (chan) {
1210 cfg = get_feature_ds(chan);
1211 } else {
1213 }
1214
1215 if (!cfg) {
1216 return NULL;
1217 }
1218
1219 ast_assert(cfg->featuremap != NULL);
1220
1221 ao2_ref(cfg->featuremap, +1);
1222 return cfg->featuremap;
1223}

References ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_assert, get_feature_ds(), globals, NULL, and RAII_VAR.

Referenced by testsuite_notify_feature_success().

◆ ast_get_chan_features_atxferabort()

char * ast_get_chan_features_atxferabort ( struct ast_channel chan)

Get the transfer configuration option atxferabort.

Note
The channel should be locked before calling this function.
The returned value has to be freed.

If no channel is provided, then option is pulled from the global transfer configuration.

Parameters
chanThe channel to get configuration options for
Return values
NULLFailed to get configuration
non-NULLThe atxferabort

Definition at line 1170 of file features_config.c.

1171{
1172 char *res;
1174
1175 if (!cfg) {
1176 return NULL;
1177 }
1178
1179 res = ast_strdup(cfg->atxferabort);
1180 ao2_ref(cfg, -1);
1181
1182 return res;
1183}
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
struct ast_features_xfer_config * ast_get_chan_features_xfer_config(struct ast_channel *chan)
Get the transfer configuration options for a channel.
Feature configuration relating to transfers.

References ao2_ref, ast_get_chan_features_xfer_config(), ast_strdup, ast_features_xfer_config::atxferabort, and NULL.

Referenced by action_cancel_atxfer().

◆ ast_get_chan_features_general_config()

struct ast_features_general_config * ast_get_chan_features_general_config ( struct ast_channel chan)

Get the general configuration options for a channel.

Note
The channel should be locked before calling this function.
The returned value has its reference count incremented.

If no channel is provided, then the global features configuration is returned.

Parameters
chanThe channel to get configuration options for
Return values
NULLFailed to get configuration
non-NULLThe general features configuration

Definition at line 1115 of file features_config.c.

1116{
1117 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1118
1119 if (chan) {
1120 cfg = get_feature_ds(chan);
1121 } else {
1123 }
1124
1125 if (!cfg) {
1126 return NULL;
1127 }
1128
1129 ast_assert(cfg->global && cfg->global->general);
1130
1131 ao2_ref(cfg->global->general, +1);
1132 return cfg->global->general;
1133}

References ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_assert, get_feature_ds(), globals, NULL, and RAII_VAR.

Referenced by bridge_channel_feature_digit_timeout(), and feature_automixmonitor().

◆ ast_get_chan_features_pickup_config()

struct ast_features_pickup_config * ast_get_chan_features_pickup_config ( struct ast_channel chan)

Get the pickup configuration options for a channel.

Note
The channel should be locked before calling this function.
The returned value has its reference count incremented.

If no channel is provided, then the global pickup configuration is returned.

Parameters
chanThe channel to get configuration options for
Return values
NULLFailed to get configuration
non-NULLThe pickup features configuration

Definition at line 1185 of file features_config.c.

1186{
1187 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1188
1189 if (chan) {
1190 cfg = get_feature_ds(chan);
1191 } else {
1193 }
1194
1195 if (!cfg) {
1196 return NULL;
1197 }
1198
1199 ast_assert(cfg->global && cfg->global->pickup);
1200
1201 ao2_ref(cfg->global->pickup, +1);
1202 return cfg->global->pickup;
1203}

References ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_assert, get_feature_ds(), globals, NULL, and RAII_VAR.

Referenced by __analog_ss_thread(), analog_ss_thread(), ast_pickup_call(), call_pickup_incoming_request(), get_destination(), handle_call_outgoing(), and key_main_page().

◆ ast_get_chan_features_xfer_config()

struct ast_features_xfer_config * ast_get_chan_features_xfer_config ( struct ast_channel chan)

Get the transfer configuration options for a channel.

Note
The channel should be locked before calling this function.
The returned value has its reference count incremented.

If no channel is provided, then the global transfer configuration is returned.

Parameters
chanThe channel to get configuration options for
Return values
NULLFailed to get configuration
non-NULLThe transfer features configuration

Definition at line 1135 of file features_config.c.

1136{
1137 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1138
1139 if (chan) {
1140 cfg = get_feature_ds(chan);
1141 } else {
1143 }
1144
1145 if (!cfg) {
1146 return NULL;
1147 }
1148
1149 ast_assert(cfg->global && cfg->global->xfer);
1150
1151 ao2_ref(cfg->global->xfer, +1);
1152 return cfg->global->xfer;
1153}

References ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_assert, get_feature_ds(), globals, NULL, and RAII_VAR.

Referenced by action_bridge(), add_transferer_role(), ast_get_chan_features_atxferabort(), ast_get_chan_features_xferfailsound(), attended_transfer_properties_alloc(), bridge_exec(), grab_transfer(), and testsuite_notify_feature_success().

◆ ast_get_chan_features_xferfailsound()

char * ast_get_chan_features_xferfailsound ( struct ast_channel chan)

Get the transfer configuration option xferfailsound.

Note
The channel should be locked before calling this function.
The returned value has to be freed.

If no channel is provided, then option is pulled from the global transfer configuration.

Parameters
chanThe channel to get configuration options for
Return values
NULLFailed to get configuration
non-NULLThe xferfailsound

Definition at line 1155 of file features_config.c.

1156{
1157 char *res;
1159
1160 if (!cfg) {
1161 return NULL;
1162 }
1163
1164 res = ast_strdup(cfg->xferfailsound);
1165 ao2_ref(cfg, -1);
1166
1167 return res;
1168}

References ao2_ref, ast_get_chan_features_xfer_config(), ast_strdup, NULL, and ast_features_xfer_config::xferfailsound.

Referenced by play_failsound(), and stream_failsound().

◆ ast_get_feature()

int ast_get_feature ( struct ast_channel chan,
const char *  feature,
char *  buf,
size_t  len 
)

Get the DTMF code for a call feature.

Note
The channel should be locked before calling this function

If no channel is provided, then the global setting for the option is returned.

This function is like ast_get_builtin_feature except that it will also check the applicationmap in addition to the builtin features.

Parameters
chanThe channel to get the option from
featureThe short name of the feature
[out]bufThe buffer to write the DTMF value into
lenThe size of the buffer in bytes
Return values
0Success
non-zeroUnrecognized feature name

Definition at line 1242 of file features_config.c.

1243{
1244 RAII_VAR(struct ao2_container *, applicationmap, NULL, ao2_cleanup);
1246
1247 if (!ast_get_builtin_feature(chan, feature, buf, len)) {
1248 return 0;
1249 }
1250
1251 /* Dang, must be in the application map */
1252 applicationmap = ast_get_chan_applicationmap(chan);
1253 if (!applicationmap) {
1254 return -1;
1255 }
1256
1257 item = ao2_find(applicationmap, feature, OBJ_KEY);
1258 if (!item) {
1259 return -1;
1260 }
1261
1262 ast_copy_string(buf, item->dtmf, len);
1263 return 0;
1264}
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.
struct ao2_container * ast_get_chan_applicationmap(struct ast_channel *chan)
Get the applicationmap for a given channel.

References ao2_cleanup, ao2_find, ast_copy_string(), ast_get_builtin_feature(), ast_get_chan_applicationmap(), buf, item, len(), NULL, OBJ_KEY, and RAII_VAR.

Referenced by handle_incoming_request().

◆ check_featuregroup()

static int check_featuregroup ( void *  obj,
void *  arg,
void *  data,
int  flags 
)
static

Definition at line 1559 of file features_config.c.

1560{
1561 struct featuregroup *group = obj;
1562 int *err = arg;
1563
1564 ao2_callback_data(group->items, 0, check_featuregroup_item, arg, data);
1565
1566 if (*err) {
1567 ast_log(LOG_WARNING, "Featuregroup %s refers to non-existent applicationmap item\n",
1568 group->name);
1569 }
1570
1571 return *err ? CMP_STOP : 0;
1572}
@ CMP_STOP
Definition: astobj2.h:1028
#define ao2_callback_data(container, flags, cb_fn, arg, data)
Definition: astobj2.h:1723
static int check_featuregroup_item(void *obj, void *arg, void *data, int flags)
char name[AST_MAX_EXTENSION]

References ao2_callback_data, ast_log, check_featuregroup_item(), CMP_STOP, LOG_WARNING, and group::name.

Referenced by features_pre_apply_config().

◆ check_featuregroup_item()

static int check_featuregroup_item ( void *  obj,
void *  arg,
void *  data,
int  flags 
)
static

Definition at line 1541 of file features_config.c.

1542{
1543 struct ast_applicationmap_item *appmap_item;
1544 struct featuregroup_item *fg_item = obj;
1545 int *err = arg;
1546 struct ao2_container *applicationmap = data;
1547
1548 appmap_item = ao2_find(applicationmap, fg_item->appmap_item_name, OBJ_KEY);
1549 if (!appmap_item) {
1550 *err = 1;
1551 return CMP_STOP;
1552 }
1553
1554 fg_item->appmap_item = appmap_item;
1555
1556 return 0;
1557}

References ao2_find, featuregroup_item::appmap_item, featuregroup_item::appmap_item_name, CMP_STOP, and OBJ_KEY.

Referenced by check_featuregroup().

◆ CONFIG_INFO_CORE()

CONFIG_INFO_CORE ( "features"  ,
cfg_info  ,
globals  ,
features_config_alloc  ,
files = ACO_FILES(&features_conf),
pre_apply_config = features_pre_apply_config 
)

◆ feature_ds_destroy()

static void feature_ds_destroy ( void *  data)
static

Definition at line 1038 of file features_config.c.

1039{
1040 struct features_config *cfg = data;
1041 ao2_cleanup(cfg);
1042}

References ao2_cleanup.

◆ feature_ds_duplicate()

static void * feature_ds_duplicate ( void *  data)
static

Definition at line 1044 of file features_config.c.

1045{
1046 struct features_config *old_cfg = data;
1047
1048 return features_config_dup(old_cfg);
1049}
static struct features_config * features_config_dup(const struct features_config *orig)

References features_config_dup().

◆ feature_read()

static int feature_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 1694 of file features_config.c.

1696{
1697 if (!chan) {
1698 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1699 return -1;
1700 }
1701
1702 return internal_feature_read(chan, cmd, data, buf, len);
1703}
static int internal_feature_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

References ast_log, buf, ast_datastore::data, internal_feature_read(), len(), and LOG_WARNING.

◆ feature_write()

static int feature_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 1705 of file features_config.c.

1707{
1708 if (!chan) {
1709 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1710 return -1;
1711 }
1712
1713 return internal_feature_write(chan, cmd, data, value);
1714}
static int internal_feature_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
int value
Definition: syslog.c:37

References ast_log, ast_datastore::data, internal_feature_write(), LOG_WARNING, and value.

◆ featuregroup_alloc()

static void * featuregroup_alloc ( const char *  cat)
static

Definition at line 536 of file features_config.c.

537{
538 struct featuregroup *group;
539
541 if (!group) {
542 return NULL;
543 }
544
545 group->name = ast_strdup(cat);
546 if (!group->name) {
548 return NULL;
549 }
550
553 if (!group->items) {
555 return NULL;
556 }
557
558 return group;
559}
static int group_item_sort(const void *obj, const void *arg, int flags)
static void featuregroup_destructor(void *obj)

References ao2_alloc, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE, ast_strdup, featuregroup_destructor(), group_item_sort(), group::name, and NULL.

◆ featuregroup_cmp()

static int featuregroup_cmp ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 502 of file features_config.c.

503{
504 struct featuregroup *group1 = obj;
505 struct featuregroup *group2;
506 const char *key2;
507
508 switch(flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
509 case OBJ_KEY:
510 key2 = arg;
511 return strcasecmp(group1->name, key2) ? 0 : CMP_MATCH;
512 case OBJ_PARTIAL_KEY:
513 key2 = arg;
514 return strncasecmp(group1->name, key2, strlen(key2)) ? 0 : CMP_MATCH;
515 case OBJ_POINTER:
516 group2 = arg;
517 return strcasecmp(group1->name, group2->name) ? 0 : CMP_MATCH;
518 default:
519 return CMP_STOP;
520 }
521}
@ CMP_MATCH
Definition: astobj2.h:1027
const char * name

References CMP_MATCH, CMP_STOP, featuregroup::name, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by __features_config_alloc().

◆ featuregroup_destructor()

static void featuregroup_destructor ( void *  obj)
static

Definition at line 528 of file features_config.c.

529{
530 struct featuregroup *group = obj;
531
532 ast_free((char *) group->name);
533 ao2_cleanup(group->items);
534}
#define ast_free(a)
Definition: astmm.h:180

References ao2_cleanup, ast_free, and group::name.

Referenced by featuregroup_alloc().

◆ featuregroup_find()

static void * featuregroup_find ( struct ao2_container group_container,
const char *  category 
)
static

Definition at line 523 of file features_config.c.

524{
525 return ao2_find(group_container, category, OBJ_KEY);
526}
static struct ao2_container * group_container

References ao2_find, group_container, and OBJ_KEY.

◆ featuregroup_handler()

static int featuregroup_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1470 of file features_config.c.

1472{
1474 struct featuregroup *group = obj;
1475
1477 if (!item || ast_string_field_init(item, 32)) {
1478 return -1;
1479 }
1480
1481 ast_string_field_set(item, appmap_item_name, var->name);
1482 ast_string_field_set(item, dtmf_override, var->value);
1483
1484 if (!ao2_link(group->items, item)) {
1485 return -1;
1486 }
1487
1488 /* We wait to look up the application map item in the preapply callback */
1489
1490 return 0;
1491}
static void featuregroup_item_destructor(void *obj)

References ao2_alloc, ao2_cleanup, ao2_link, ast_string_field_init, ast_string_field_set, featuregroup_item_destructor(), item, NULL, RAII_VAR, and var.

Referenced by load_config().

◆ featuregroup_hash()

static int featuregroup_hash ( const void *  obj,
int  flags 
)
static

Definition at line 483 of file features_config.c.

484{
485 const struct featuregroup *group;
486 const char *key;
487
488 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
489 case OBJ_KEY:
490 key = obj;
491 return ast_str_case_hash(key);
492 case OBJ_PARTIAL_KEY:
493 ast_assert(0);
494 return 0;
495 case OBJ_POINTER:
496 default:
497 group = obj;
499 }
500}
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
Definition: strings.h:1303

References ast_assert, ast_str_case_hash(), group::name, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by __features_config_alloc().

◆ featuregroup_item_destructor()

static void featuregroup_item_destructor ( void *  obj)
static

Definition at line 444 of file features_config.c.

445{
446 struct featuregroup_item *item = obj;
447
449 ao2_cleanup(item->appmap_item);
450}

References ao2_cleanup, ast_string_field_free_memory, and item.

Referenced by featuregroup_handler().

◆ featuremap_config_destructor()

static void featuremap_config_destructor ( void *  obj)
static

Definition at line 641 of file features_config.c.

642{
643 struct ast_featuremap_config *cfg = obj;
644
646}
Configuration for the builtin features.

References ast_string_field_free_memory.

Referenced by __features_config_alloc().

◆ featuremap_copy()

static void featuremap_copy ( struct ast_featuremap_config dest,
const struct ast_featuremap_config src 
)
static

Definition at line 802 of file features_config.c.

803{
804 ast_string_fields_copy(dest, src);
805}
#define ast_string_fields_copy(copy, orig)
Copy all string fields from one instance to another of the same structure.
Definition: stringfields.h:630

References ast_string_fields_copy.

Referenced by features_copy().

◆ featuremap_get()

static int featuremap_get ( struct ast_featuremap_config featuremap,
const char *  field,
char *  buf,
size_t  len 
)
static

Definition at line 1015 of file features_config.c.

1017{
1018 int res = 0;
1019
1020 if (!strcasecmp(field, "blindxfer")) {
1021 ast_copy_string(buf, featuremap->blindxfer, len);
1022 } else if (!strcasecmp(field, "disconnect")) {
1023 ast_copy_string(buf, featuremap->disconnect, len);
1024 } else if (!strcasecmp(field, "atxfer")) {
1025 ast_copy_string(buf, featuremap->atxfer, len);
1026 } else if (!strcasecmp(field, "automixmon")) {
1027 ast_copy_string(buf, featuremap->automixmon, len);
1028 } else if (!strcasecmp(field, "parkcall")) {
1029 ast_copy_string(buf, featuremap->parkcall, len);
1030 } else {
1031 /* Unrecognized option */
1032 res = -1;
1033 }
1034
1035 return res;
1036}

References ast_copy_string(), ast_featuremap_config::atxfer, ast_featuremap_config::automixmon, ast_featuremap_config::blindxfer, buf, ast_featuremap_config::disconnect, features_config::featuremap, len(), and ast_featuremap_config::parkcall.

Referenced by ast_get_builtin_feature().

◆ featuremap_handler()

static int featuremap_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1533 of file features_config.c.

1535{
1536 struct ast_featuremap_config *featuremap = obj;
1537
1538 return featuremap_set(featuremap, var->name, var->value);
1539}
static int featuremap_set(struct ast_featuremap_config *featuremap, const char *name, const char *value)

References featuremap_set(), and var.

Referenced by load_config().

◆ featuremap_read()

static int featuremap_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 1716 of file features_config.c.

1718{
1719 if (!chan) {
1720 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1721 return -1;
1722 }
1723
1724 return internal_featuremap_read(chan, cmd, data, buf, len);
1725}
static int internal_featuremap_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

References ast_log, buf, ast_datastore::data, internal_featuremap_read(), len(), and LOG_WARNING.

◆ featuremap_set()

static int featuremap_set ( struct ast_featuremap_config featuremap,
const char *  name,
const char *  value 
)
static

Definition at line 992 of file features_config.c.

994{
995 int res = 0;
996
997 if (!strcasecmp(name, "blindxfer")) {
998 ast_string_field_set(featuremap, blindxfer, value);
999 } else if (!strcasecmp(name, "disconnect")) {
1000 ast_string_field_set(featuremap, disconnect, value);
1001 } else if (!strcasecmp(name, "atxfer")) {
1002 ast_string_field_set(featuremap, atxfer, value);
1003 } else if (!strcasecmp(name, "automixmon")) {
1004 ast_string_field_set(featuremap, automixmon, value);
1005 } else if (!strcasecmp(name, "parkcall")) {
1006 ast_string_field_set(featuremap, parkcall, value);
1007 } else {
1008 /* Unrecognized option */
1009 res = -1;
1010 }
1011
1012 return res;
1013}

References ast_string_field_set, features_config::featuremap, name, and value.

Referenced by featuremap_handler(), and internal_featuremap_write().

◆ featuremap_write()

static int featuremap_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 1727 of file features_config.c.

1729{
1730 if (!chan) {
1731 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1732 return -1;
1733 }
1734
1735 return internal_featuremap_write(chan, cmd, data, value);
1736}
static int internal_featuremap_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)

References ast_log, ast_datastore::data, internal_featuremap_write(), LOG_WARNING, and value.

◆ features_config_alloc()

static void * features_config_alloc ( void  )
static

Definition at line 768 of file features_config.c.

769{
770 return __features_config_alloc(1);
771}
static struct features_config * __features_config_alloc(int allocate_applicationmap)

References __features_config_alloc().

Referenced by load_config().

◆ features_config_destructor()

static void features_config_destructor ( void *  obj)
static

Definition at line 630 of file features_config.c.

631{
632 struct features_config *cfg = obj;
633
634 ao2_cleanup(cfg->global);
639}
struct ast_featuremap_config * featuremap
struct ao2_container * applicationmap
struct ao2_container * featuregroups
struct features_global_config * global
struct dummy_config * parkinglots

References ao2_cleanup, features_config::applicationmap, features_config::featuregroups, features_config::featuremap, features_config::global, and features_config::parkinglots.

Referenced by __features_config_alloc().

◆ features_config_dup()

static struct features_config * features_config_dup ( const struct features_config orig)
static

Definition at line 818 of file features_config.c.

819{
820 struct features_config *dup;
821
823 if (!dup) {
824 return NULL;
825 }
826
827 features_copy(dup, orig);
828
829 return dup;
830}
static void features_copy(struct features_config *dest, const struct features_config *src)

References __features_config_alloc(), features_copy(), and NULL.

Referenced by feature_ds_duplicate(), and get_feature_ds().

◆ features_copy()

static void features_copy ( struct features_config dest,
const struct features_config src 
)
static

Definition at line 807 of file features_config.c.

808{
809 global_copy(dest->global, src->global);
811
812 /* applicationmap and featuregroups are purposely not copied. A channel's applicationmap
813 * is produced on the fly when ast_get_chan_applicationmap() is called
814 * NOTE: This does not apply to the global cfg->applicationmap and cfg->featuregroups
815 */
816}
static void global_copy(struct features_global_config *dest, const struct features_global_config *src)
static void featuremap_copy(struct ast_featuremap_config *dest, const struct ast_featuremap_config *src)

References features_config::featuremap, featuremap_copy(), features_config::global, and global_copy().

Referenced by features_config_dup().

◆ features_pre_apply_config()

static int features_pre_apply_config ( void  )
static

Definition at line 1581 of file features_config.c.

1582{
1583 struct features_config *cfg = aco_pending_config(&cfg_info);
1584 int err = 0;
1585
1586 /* Now that the entire config has been processed, we can check that the featuregroup
1587 * items refer to actual applicationmap items.
1588 */
1589
1590 /* global config must be initialized */
1591 ast_assert(cfg->featuregroups != NULL);
1594
1595 return err;
1596}
void * aco_pending_config(struct aco_info *info)
Get pending config changes.
static int check_featuregroup(void *obj, void *arg, void *data, int flags)

References aco_pending_config(), ao2_callback_data, features_config::applicationmap, ast_assert, check_featuregroup(), features_config::featuregroups, and NULL.

◆ general_copy()

static void general_copy ( struct ast_features_general_config dest,
const struct ast_features_general_config src 
)
static

◆ general_destructor()

static void general_destructor ( void *  obj)
static

Definition at line 657 of file features_config.c.

658{
659 struct ast_features_general_config *cfg = obj;
660
662}
General features configuration items.

References ast_string_field_free_memory.

Referenced by global_config_alloc().

◆ general_get()

static int general_get ( struct ast_features_general_config general,
const char *  field,
char *  buf,
size_t  len 
)
static

Definition at line 851 of file features_config.c.

853{
854 int res = 0;
855
856 if (!strcasecmp(field, "featuredigittimeout")) {
857 snprintf(buf, len, "%u", general->featuredigittimeout);
858 } else if (!strcasecmp(field, "courtesytone")) {
860 } else if (!strcasecmp(field, "recordingfailsound")) {
862 } else {
863 /* Unrecognized option */
864 res = -1;
865 }
866
867 return res;
868}

References ast_copy_string(), buf, ast_features_general_config::courtesytone, ast_features_general_config::featuredigittimeout, len(), and ast_features_general_config::recordingfailsound.

Referenced by internal_feature_read().

◆ general_handler()

static int general_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1493 of file features_config.c.

1495{
1496 struct features_global_config *global = obj;
1497 struct ast_features_general_config *general = global->general;
1498
1499 return general_set(general, var->name, var->value);
1500}
static int general_set(struct ast_features_general_config *general, const char *name, const char *value)
Configuration from the "general" section of features.conf.
static struct aco_type global
Definition: test_config.c:1445

References general_set(), global, and var.

Referenced by load_config().

◆ general_set()

static int general_set ( struct ast_features_general_config general,
const char *  name,
const char *  value 
)
static

Definition at line 832 of file features_config.c.

834{
835 int res = 0;
836
837 if (!strcasecmp(name, "featuredigittimeout")) {
839 } else if (!strcasecmp(name, "courtesytone")) {
840 ast_string_field_set(general, courtesytone, value);
841 } else if (!strcasecmp(name, "recordingfailsound")) {
842 ast_string_field_set(general, recordingfailsound, value);
843 } else {
844 /* Unrecognized option */
845 res = -1;
846 }
847
848 return res;
849}
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
Definition: main/config.c:3828

References ast_parse_arg(), ast_string_field_set, ast_features_general_config::featuredigittimeout, name, PARSE_INT32, and value.

Referenced by general_handler(), and internal_feature_write().

◆ get_feature_chan_ds()

static struct ast_datastore * get_feature_chan_ds ( struct ast_channel chan)
static

Definition at line 1101 of file features_config.c.

1102{
1103 struct ast_datastore *ds;
1104
1105 if (!(ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
1106 /* Hasn't been created yet. Trigger creation. */
1108
1110 }
1111
1112 return ds;
1113}
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.
Definition: channel.c:2418
static const struct ast_datastore_info feature_ds_info
Structure for a data store object.
Definition: datastore.h:64

References ao2_cleanup, ast_channel_datastore_find(), feature_ds_info, get_feature_ds(), and NULL.

Referenced by internal_feature_read(), and internal_feature_write().

◆ get_feature_ds()

static struct features_config * get_feature_ds ( struct ast_channel chan)
static

Definition at line 1065 of file features_config.c.

1066{
1067 RAII_VAR(struct features_config *, orig, NULL, ao2_cleanup);
1068 struct features_config *cfg;
1069 struct ast_datastore *ds;
1070
1071 if ((ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
1072 cfg = ds->data;
1073 ao2_ref(cfg, +1);
1074 return cfg;
1075 }
1076
1078 if (!orig) {
1079 return NULL;
1080 }
1081
1082 cfg = features_config_dup(orig);
1083 if (!cfg) {
1084 return NULL;
1085 }
1086
1087 if (!(ds = ast_datastore_alloc(&feature_ds_info, NULL))) {
1088 ao2_cleanup(cfg);
1089 return NULL;
1090 }
1091
1092 /* Give the datastore a reference to the config */
1093 ao2_ref(cfg, +1);
1094 ds->data = cfg;
1095
1096 ast_channel_datastore_add(chan, ds);
1097
1098 return cfg;
1099}
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2404
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:85
void * data
Definition: datastore.h:66

References ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_datastore_alloc, ast_datastore::data, feature_ds_info, features_config_dup(), globals, NULL, and RAII_VAR.

Referenced by ast_get_builtin_feature(), ast_get_chan_featuremap_config(), ast_get_chan_features_general_config(), ast_get_chan_features_pickup_config(), ast_get_chan_features_xfer_config(), get_feature_chan_ds(), internal_feature_read(), internal_feature_write(), and internal_featuremap_write().

◆ global_config_alloc()

static struct features_global_config * global_config_alloc ( void  )
static

Definition at line 678 of file features_config.c.

679{
681
682 cfg = ao2_alloc(sizeof(*cfg), global_config_destructor);
683 if (!cfg) {
684 return NULL;
685 }
686
687 cfg->general = ao2_alloc(sizeof(*cfg->general), general_destructor);
688 if (!cfg->general || ast_string_field_init(cfg->general, 32)) {
689 return NULL;
690 }
691
692 cfg->xfer = ao2_alloc(sizeof(*cfg->xfer), xfer_destructor);
693 if (!cfg->xfer || ast_string_field_init(cfg->xfer, 32)) {
694 return NULL;
695 }
696
697 cfg->pickup = ao2_alloc(sizeof(*cfg->pickup), pickup_destructor);
698 if (!cfg->pickup || ast_string_field_init(cfg->pickup, 32)) {
699 return NULL;
700 }
701
702 ao2_ref(cfg, +1);
703 return cfg;
704}
static void xfer_destructor(void *obj)
static void pickup_destructor(void *obj)
static void general_destructor(void *obj)
static void global_config_destructor(void *obj)

References ao2_alloc, ao2_cleanup, ao2_ref, ast_string_field_init, general_destructor(), global_config_destructor(), NULL, pickup_destructor(), RAII_VAR, and xfer_destructor().

Referenced by __features_config_alloc().

◆ global_config_destructor()

static void global_config_destructor ( void *  obj)
static

Definition at line 648 of file features_config.c.

649{
650 struct features_global_config *cfg = obj;
651
652 ao2_cleanup(cfg->general);
653 ao2_cleanup(cfg->xfer);
654 ao2_cleanup(cfg->pickup);
655}
struct ast_features_pickup_config * pickup
struct ast_features_general_config * general
struct ast_features_xfer_config * xfer

References ao2_cleanup, features_global_config::general, features_global_config::pickup, and features_global_config::xfer.

Referenced by global_config_alloc().

◆ global_copy()

static void global_copy ( struct features_global_config dest,
const struct features_global_config src 
)
static

Definition at line 795 of file features_config.c.

796{
797 general_copy(dest->general, src->general);
798 xfer_copy(dest->xfer, src->xfer);
799 pickup_copy(dest->pickup, src->pickup);
800}
static void xfer_copy(struct ast_features_xfer_config *dest, const struct ast_features_xfer_config *src)
static void pickup_copy(struct ast_features_pickup_config *dest, const struct ast_features_pickup_config *src)
static void general_copy(struct ast_features_general_config *dest, const struct ast_features_general_config *src)

References features_global_config::general, general_copy(), features_global_config::pickup, pickup_copy(), features_global_config::xfer, and xfer_copy().

Referenced by features_copy().

◆ group_item_sort()

static int group_item_sort ( const void *  obj,
const void *  arg,
int  flags 
)
static

Definition at line 452 of file features_config.c.

453{
454 const struct featuregroup_item *item1 = obj;
455 const struct featuregroup_item *item2;
456 const char *key2;
457
458 switch(flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
459 case OBJ_KEY:
460 key2 = arg;
461 return strcasecmp(item1->appmap_item_name, key2);
462 case OBJ_PARTIAL_KEY:
463 key2 = arg;
464 return strncasecmp(item1->appmap_item_name, key2, strlen(key2));
465 case OBJ_POINTER:
466 item2 = arg;
467 return strcasecmp(item1->appmap_item_name, item2->appmap_item_name);
468 default:
469 return CMP_STOP;
470 }
471}

References featuregroup_item::appmap_item_name, CMP_STOP, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by featuregroup_alloc().

◆ handle_feature_show()

static char * handle_feature_show ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
)
static

CLI command to list configured features.

Parameters
e
cmd
a
Return values
CLI_SUCCESSon success.
NULLwhen tab completion is used.

Definition at line 1915 of file features_config.c.

1916{
1917 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1918
1919 switch (cmd) {
1920
1921 case CLI_INIT:
1922 e->command = "features show";
1923 e->usage =
1924 "Usage: features show\n"
1925 " Lists configured features\n";
1926 return NULL;
1927 case CLI_GENERATE:
1928 return NULL;
1929 }
1930
1932
1933 ast_cli(a->fd, HFS_FORMAT, "Builtin Feature", "Default", "Current");
1934 ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
1935
1936 ast_cli(a->fd, HFS_FORMAT, "Pickup", DEFAULT_PICKUPEXTEN, cfg->global->pickup->pickupexten);
1937 ast_cli(a->fd, HFS_FORMAT, "Blind Transfer", DEFAULT_FEATUREMAP_BLINDXFER, cfg->featuremap->blindxfer);
1938 ast_cli(a->fd, HFS_FORMAT, "Attended Transfer", DEFAULT_FEATUREMAP_ATXFER, cfg->featuremap->atxfer);
1939 ast_cli(a->fd, HFS_FORMAT, "Disconnect Call", DEFAULT_FEATUREMAP_DISCONNECT, cfg->featuremap->disconnect);
1940 ast_cli(a->fd, HFS_FORMAT, "Park Call", DEFAULT_FEATUREMAP_PARKCALL, cfg->featuremap->parkcall);
1941 ast_cli(a->fd, HFS_FORMAT, "One Touch MixMonitor", DEFAULT_FEATUREMAP_AUTOMIXMON, cfg->featuremap->automixmon);
1942
1943 ast_cli(a->fd, "\n");
1944 ast_cli(a->fd, HFS_FORMAT, "Dynamic Feature", "Default", "Current");
1945 ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
1946 if (!cfg->applicationmap || ao2_container_count(cfg->applicationmap) == 0) {
1947 ast_cli(a->fd, "(none)\n");
1948 } else {
1949 ao2_callback(cfg->applicationmap, 0, print_applicationmap, a);
1950 }
1951
1952 ast_cli(a->fd, "\nFeature Groups:\n");
1953 ast_cli(a->fd, "---------------\n");
1954 if (!cfg->featuregroups || ao2_container_count(cfg->featuregroups) == 0) {
1955 ast_cli(a->fd, "(none)\n");
1956 } else {
1957 ao2_callback(cfg->featuregroups, 0, print_featuregroups, a);
1958 }
1959
1960 return CLI_SUCCESS;
1961}
#define CLI_SUCCESS
Definition: cli.h:44
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
@ CLI_INIT
Definition: cli.h:152
@ CLI_GENERATE
Definition: cli.h:153
#define HFS_FORMAT
#define DEFAULT_FEATUREMAP_BLINDXFER
#define DEFAULT_FEATUREMAP_DISCONNECT
static int print_featuregroups(void *obj, void *arg, int flags)
#define DEFAULT_FEATUREMAP_ATXFER
#define DEFAULT_FEATUREMAP_PARKCALL
static int print_applicationmap(void *obj, void *arg, int flags)
#define DEFAULT_PICKUPEXTEN
#define DEFAULT_FEATUREMAP_AUTOMIXMON
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
static struct test_val a

References a, ao2_callback, ao2_cleanup, ao2_container_count(), ao2_global_obj_ref, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, DEFAULT_FEATUREMAP_ATXFER, DEFAULT_FEATUREMAP_AUTOMIXMON, DEFAULT_FEATUREMAP_BLINDXFER, DEFAULT_FEATUREMAP_DISCONNECT, DEFAULT_FEATUREMAP_PARKCALL, DEFAULT_PICKUPEXTEN, globals, HFS_FORMAT, NULL, print_applicationmap(), print_featuregroups(), RAII_VAR, and ast_cli_entry::usage.

◆ internal_feature_read()

static int internal_feature_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 1598 of file features_config.c.

1600{
1601 int res;
1602 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1603 SCOPED_CHANNELLOCK(lock, chan);
1604
1605 if (!strcasecmp(data, "inherit")) {
1606 struct ast_datastore *ds = get_feature_chan_ds(chan);
1607 unsigned int inherit = ds ? ds->inheritance : 0;
1608
1609 snprintf(buf, len, "%s", inherit ? "yes" : "no");
1610 return 0;
1611 }
1612
1613 cfg = get_feature_ds(chan);
1614 if (!cfg) {
1615 return -1;
1616 }
1617
1618 res = general_get(cfg->global->general, data, buf, len) &&
1619 xfer_get(cfg->global->xfer, data, buf, len) &&
1620 pickup_get(cfg->global->pickup, data, buf, len);
1621
1622 if (res) {
1623 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATURE()\n", data);
1624 }
1625
1626 return res;
1627}
ast_mutex_t lock
Definition: app_sla.c:331
static struct ast_datastore * get_feature_chan_ds(struct ast_channel *chan)
static int xfer_get(struct ast_features_xfer_config *xfer, const char *field, char *buf, size_t len)
static int pickup_get(struct ast_features_pickup_config *pickup, const char *field, char *buf, size_t len)
static int general_get(struct ast_features_general_config *general, const char *field, char *buf, size_t len)
#define SCOPED_CHANNELLOCK(varname, chan)
scoped lock specialization for channels.
Definition: lock.h:619
unsigned int inheritance
Definition: datastore.h:69

References ao2_cleanup, ast_log, buf, ast_datastore::data, general_get(), get_feature_chan_ds(), get_feature_ds(), ast_datastore::inheritance, len(), lock, LOG_WARNING, NULL, pickup_get(), RAII_VAR, SCOPED_CHANNELLOCK, and xfer_get().

Referenced by feature_read().

◆ internal_feature_write()

static int internal_feature_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 1629 of file features_config.c.

1631{
1632 int res;
1633 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1634 SCOPED_CHANNELLOCK(lock, chan);
1635
1636 if (!strcasecmp(data, "inherit")) {
1637 struct ast_datastore *ds = get_feature_chan_ds(chan);
1638 if (ds) {
1640 }
1641 return 0;
1642 }
1643
1644 if (!(cfg = get_feature_ds(chan))) {
1645 return -1;
1646 }
1647
1648 res = general_set(cfg->global->general, data, value) &&
1649 xfer_set(cfg->global->xfer, data, value) &&
1650 pickup_set(cfg->global->pickup, data, value);
1651
1652 if (res) {
1653 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATURE()\n", data);
1654 }
1655
1656 return res;
1657}
#define DATASTORE_INHERIT_FOREVER
Definition: channel.h:194
static int pickup_set(struct ast_features_pickup_config *pickup, const char *name, const char *value)
static int xfer_set(struct ast_features_xfer_config *xfer, const char *name, const char *value)
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition: utils.c:2199

References ao2_cleanup, ast_log, ast_true(), ast_datastore::data, DATASTORE_INHERIT_FOREVER, general_set(), get_feature_chan_ds(), get_feature_ds(), ast_datastore::inheritance, lock, LOG_WARNING, NULL, pickup_set(), RAII_VAR, SCOPED_CHANNELLOCK, value, and xfer_set().

Referenced by feature_write().

◆ internal_featuremap_read()

static int internal_featuremap_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 1659 of file features_config.c.

1661{
1662 int res;
1663 SCOPED_CHANNELLOCK(lock, chan);
1664
1665 res = ast_get_builtin_feature(chan, data, buf, len);
1666
1667 if (res) {
1668 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATUREMAP()\n", data);
1669 }
1670
1671 return res;
1672}

References ast_get_builtin_feature(), ast_log, buf, ast_datastore::data, len(), lock, LOG_WARNING, and SCOPED_CHANNELLOCK.

Referenced by featuremap_read().

◆ internal_featuremap_write()

static int internal_featuremap_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 1674 of file features_config.c.

1676{
1677 int res;
1678 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1679 SCOPED_CHANNELLOCK(lock, chan);
1680
1681 if (!(cfg = get_feature_ds(chan))) {
1682 return -1;
1683 }
1684
1685 res = featuremap_set(cfg->featuremap, data, value);
1686 if (res) {
1687 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATUREMAP()\n", data);
1688 return -1;
1689 }
1690
1691 return 0;
1692}

References ao2_cleanup, ast_log, ast_datastore::data, featuremap_set(), get_feature_ds(), lock, LOG_WARNING, NULL, RAII_VAR, SCOPED_CHANNELLOCK, and value.

Referenced by featuremap_write().

◆ load_config()

static int load_config ( void  )
static

Definition at line 1750 of file features_config.c.

1751{
1752 if (aco_info_init(&cfg_info)) {
1753 ast_log(LOG_ERROR, "Unable to initialize configuration info for features\n");
1754 return -1;
1755 }
1756
1757 aco_option_register_custom(&cfg_info, "featuredigittimeout", ACO_EXACT, global_options,
1759 aco_option_register_custom(&cfg_info, "recordingfailsound", ACO_EXACT, global_options,
1761 aco_option_register_custom(&cfg_info, "courtesytone", ACO_EXACT, global_options,
1763
1764 aco_option_register_custom(&cfg_info, "transferdigittimeout", ACO_EXACT, global_options,
1766 aco_option_register_custom(&cfg_info, "atxfernoanswertimeout", ACO_EXACT, global_options,
1768 aco_option_register_custom(&cfg_info, "atxferdropcall", ACO_EXACT, global_options,
1770 aco_option_register_custom(&cfg_info, "atxferloopdelay", ACO_EXACT, global_options,
1772 aco_option_register_custom(&cfg_info, "atxfercallbackretries", ACO_EXACT, global_options,
1774 aco_option_register_custom(&cfg_info, "xfersound", ACO_EXACT, global_options,
1776 aco_option_register_custom(&cfg_info, "xferfailsound", ACO_EXACT, global_options,
1778 aco_option_register_custom(&cfg_info, "atxferabort", ACO_EXACT, global_options,
1780 aco_option_register_custom(&cfg_info, "atxfercomplete", ACO_EXACT, global_options,
1782 aco_option_register_custom(&cfg_info, "atxferthreeway", ACO_EXACT, global_options,
1784 aco_option_register_custom(&cfg_info, "atxferswap", ACO_EXACT, global_options,
1786 aco_option_register_custom(&cfg_info, "transferdialattempts", ACO_EXACT, global_options,
1788 aco_option_register_custom(&cfg_info, "transferretrysound", ACO_EXACT, global_options,
1790 aco_option_register_custom(&cfg_info, "transferinvalidsound", ACO_EXACT, global_options,
1792 aco_option_register_custom(&cfg_info, "transferannouncesound", ACO_EXACT, global_options,
1794
1795 aco_option_register_custom(&cfg_info, "pickupexten", ACO_EXACT, global_options,
1797 aco_option_register_custom(&cfg_info, "pickupsound", ACO_EXACT, global_options,
1799 aco_option_register_custom(&cfg_info, "pickupfailsound", ACO_EXACT, global_options,
1801
1803 "", unsupported_handler, 0);
1805 "", unsupported_handler, 0);
1806 aco_option_register_custom_nodoc(&cfg_info, "parkext_exclusive", ACO_EXACT, global_options,
1807 "", unsupported_handler, 0);
1808 aco_option_register_custom_nodoc(&cfg_info, "parkinghints", ACO_EXACT, global_options,
1809 "", unsupported_handler, 0);
1810 aco_option_register_custom_nodoc(&cfg_info, "parkedmusicclass", ACO_EXACT, global_options,
1811 "", unsupported_handler, 0);
1813 "", unsupported_handler, 0);
1815 "", unsupported_handler, 0);
1817 "", unsupported_handler, 0);
1818 aco_option_register_custom_nodoc(&cfg_info, "parkedcalltransfers", ACO_EXACT, global_options,
1819 "", unsupported_handler, 0);
1820 aco_option_register_custom_nodoc(&cfg_info, "parkedcallreparking", ACO_EXACT, global_options,
1821 "", unsupported_handler, 0);
1822 aco_option_register_custom_nodoc(&cfg_info, "parkedcallhangup", ACO_EXACT, global_options,
1823 "", unsupported_handler, 0);
1824 aco_option_register_custom_nodoc(&cfg_info, "parkedcallrecording", ACO_EXACT, global_options,
1825 "", unsupported_handler, 0);
1826 aco_option_register_custom_nodoc(&cfg_info, "comebackcontext", ACO_EXACT, global_options,
1827 "", unsupported_handler, 0);
1828 aco_option_register_custom_nodoc(&cfg_info, "comebacktoorigin", ACO_EXACT, global_options,
1829 "", unsupported_handler, 0);
1830 aco_option_register_custom_nodoc(&cfg_info, "comebackdialtime", ACO_EXACT, global_options,
1831 "", unsupported_handler, 0);
1832 aco_option_register_custom_nodoc(&cfg_info, "parkeddynamic", ACO_EXACT, global_options,
1833 "", unsupported_handler, 0);
1835 "", unsupported_handler, 0);
1836
1847
1849 "", applicationmap_handler, 0);
1850
1852 "", featuregroup_handler, 0);
1853
1855 "", unsupported_handler, 0);
1856
1857 if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
1858 RAII_VAR(struct features_config *, features_cfg, features_config_alloc(), ao2_cleanup);
1859
1860 if (aco_set_defaults(&global_option, "general", features_cfg->global) ||
1861 aco_set_defaults(&featuremap_option, "featuremap", features_cfg->featuremap)) {
1862 ast_log(LOG_ERROR, "Failed to load features.conf and failed to initialize defaults.\n");
1863 return -1;
1864 }
1865
1866 ast_log(LOG_NOTICE, "Could not load features config; using defaults\n");
1868 }
1869
1870 return 0;
1871}
if(!yyg->yy_init)
Definition: ast_expr2f.c:854
#define __stringify(x)
Definition: asterisk.h:216
#define ao2_global_obj_replace_unref(holder, obj)
Replace an ao2 object in the global holder, throwing away any old object.
Definition: astobj2.h:901
@ ACO_PREFIX
@ ACO_EXACT
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
@ ACO_PROCESS_ERROR
Their was an error and no changes were applied.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
#define aco_option_register_custom_nodoc(info, name, matchtype, types, default_val, handler, flags)
Register a config option with no expected documentation.
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 * global_options[]
#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER
#define DEFAULT_TRANSFER_INVALID_SOUND
#define DEFAULT_ATXFER_LOOP_DELAY
static int pickup_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_ATXFER_ABORT
#define DEFAULT_TRANSFER_ANNOUNCE_SOUND
#define DEFAULT_ATXFER_SWAP
#define DEFAULT_PICKUPFAILSOUND
static int general_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_COURTESY_TONE
static int featuremap_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_ATXFER_THREEWAY
static int unsupported_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_ATXFER_CALLBACK_RETRIES
static void * features_config_alloc(void)
static struct aco_type * parkinglot_options[]
#define DEFAULT_FEATURE_DIGIT_TIMEOUT
#define DEFAULT_TRANSFER_DIGIT_TIMEOUT
#define DEFAULT_TRANSFER_RETRY_SOUND
static int applicationmap_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int xfer_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_ATXFER_DROP_CALL
#define DEFAULT_PICKUPSOUND
static struct aco_type * applicationmap_options[]
#define DEFAULT_ATXFER_COMPLETE
static int featuregroup_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct aco_type * featuregroup_options[]
#define DEFAULT_TRANSFER_DIAL_ATTEMPTS
#define DEFAULT_XFERFAILSOUND
static struct aco_type featuremap_option
static struct aco_type global_option
#define DEFAULT_RECORDING_FAIL_SOUND
#define DEFAULT_XFERSOUND
static struct aco_type * featuremap_options[]
#define LOG_ERROR
#define LOG_NOTICE

References __stringify, ACO_EXACT, aco_info_init(), aco_option_register_custom, aco_option_register_custom_nodoc, ACO_PREFIX, aco_process_config(), ACO_PROCESS_ERROR, aco_set_defaults(), ao2_cleanup, ao2_global_obj_replace_unref, applicationmap_handler(), applicationmap_options, ast_log, DEFAULT_ATXFER_ABORT, DEFAULT_ATXFER_CALLBACK_RETRIES, DEFAULT_ATXFER_COMPLETE, DEFAULT_ATXFER_DROP_CALL, DEFAULT_ATXFER_LOOP_DELAY, DEFAULT_ATXFER_SWAP, DEFAULT_ATXFER_THREEWAY, DEFAULT_COURTESY_TONE, DEFAULT_FEATURE_DIGIT_TIMEOUT, DEFAULT_FEATUREMAP_ATXFER, DEFAULT_FEATUREMAP_AUTOMIXMON, DEFAULT_FEATUREMAP_BLINDXFER, DEFAULT_FEATUREMAP_DISCONNECT, DEFAULT_FEATUREMAP_PARKCALL, DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER, DEFAULT_PICKUPEXTEN, DEFAULT_PICKUPFAILSOUND, DEFAULT_PICKUPSOUND, DEFAULT_RECORDING_FAIL_SOUND, DEFAULT_TRANSFER_ANNOUNCE_SOUND, DEFAULT_TRANSFER_DIAL_ATTEMPTS, DEFAULT_TRANSFER_DIGIT_TIMEOUT, DEFAULT_TRANSFER_INVALID_SOUND, DEFAULT_TRANSFER_RETRY_SOUND, DEFAULT_XFERFAILSOUND, DEFAULT_XFERSOUND, featuregroup_handler(), featuregroup_options, featuremap_handler(), featuremap_option, featuremap_options, features_config_alloc(), general_handler(), global_option, global_options, globals, LOG_ERROR, LOG_NOTICE, parkinglot_options, pickup_handler(), RAII_VAR, unsupported_handler(), and xfer_handler().

Referenced by load_features_config().

◆ load_features_config()

int load_features_config ( void  )

Definition at line 1987 of file features_config.c.

1988{
1989 int res;
1990
1991 res = load_config();
1995
1996 return res;
1997}
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
static struct ast_custom_function feature_function
static struct ast_cli_entry cli_features_config[]
static struct ast_custom_function featuremap_function
static int load_config(void)
int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod)
Register a custom function.
#define ARRAY_LEN(a)
Definition: utils.h:666

References __ast_custom_function_register(), ARRAY_LEN, ast_cli_register_multiple, cli_features_config, feature_function, featuremap_function, load_config(), and NULL.

Referenced by load_module().

◆ pickup_copy()

static void pickup_copy ( struct ast_features_pickup_config dest,
const struct ast_features_pickup_config src 
)
static

Definition at line 790 of file features_config.c.

791{
792 ast_string_fields_copy(dest, src);
793}

References ast_string_fields_copy.

Referenced by global_copy().

◆ pickup_destructor()

static void pickup_destructor ( void *  obj)
static

Definition at line 671 of file features_config.c.

672{
673 struct ast_features_pickup_config *cfg = obj;
674
676}
Configuration relating to call pickup.

References ast_string_field_free_memory.

Referenced by global_config_alloc().

◆ pickup_get()

static int pickup_get ( struct ast_features_pickup_config pickup,
const char *  field,
char *  buf,
size_t  len 
)
static

Definition at line 973 of file features_config.c.

975{
976 int res = 0;
977
978 if (!strcasecmp(field, "pickupsound")) {
980 } else if (!strcasecmp(field, "pickupfailsound")) {
982 } else if (!strcasecmp(field, "pickupexten")) {
984 } else {
985 /* Unrecognized option */
986 res = -1;
987 }
988
989 return res;
990}

References ast_copy_string(), buf, len(), ast_features_pickup_config::pickupexten, ast_features_pickup_config::pickupfailsound, and ast_features_pickup_config::pickupsound.

Referenced by internal_feature_read().

◆ pickup_handler()

static int pickup_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1511 of file features_config.c.

1513{
1514 struct features_global_config *global = obj;
1515 struct ast_features_pickup_config *pickup = global->pickup;
1516
1517 return pickup_set(pickup, var->name, var->value);
1518}

References global, pickup_set(), and var.

Referenced by load_config().

◆ pickup_set()

static int pickup_set ( struct ast_features_pickup_config pickup,
const char *  name,
const char *  value 
)
static

Definition at line 954 of file features_config.c.

956{
957 int res = 0;
958
959 if (!strcasecmp(name, "pickupsound")) {
960 ast_string_field_set(pickup, pickupsound, value);
961 } else if (!strcasecmp(name, "pickupfailsound")) {
962 ast_string_field_set(pickup, pickupfailsound, value);
963 } else if (!strcasecmp(name, "pickupexten")) {
964 ast_string_field_set(pickup, pickupexten, value);
965 } else {
966 /* Unrecognized option */
967 res = -1;
968 }
969
970 return res;
971}

References ast_string_field_set, name, and value.

Referenced by internal_feature_write(), and pickup_handler().

◆ print_applicationmap()

static int print_applicationmap ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1897 of file features_config.c.

1898{
1899 struct ast_applicationmap_item *item = obj;
1900 struct ast_cli_args *a = arg;
1901
1902 ast_cli(a->fd, HFS_FORMAT, item->name, "no def", item->dtmf);
1903 return 0;
1904}
const char * name

References a, ast_cli(), HFS_FORMAT, item, and aco_type::name.

Referenced by handle_feature_show().

◆ print_featuregroup()

static int print_featuregroup ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1873 of file features_config.c.

1874{
1875 struct featuregroup_item *item = obj;
1876 struct ast_cli_args *a = arg;
1877
1878 ast_cli(a->fd, "===> --> %s (%s)\n", item->appmap_item_name,
1879 S_OR(item->dtmf_override, item->appmap_item->dtmf));
1880
1881 return 0;
1882}

References a, ast_cli(), item, and S_OR.

Referenced by print_featuregroups().

◆ print_featuregroups()

static int print_featuregroups ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1884 of file features_config.c.

1885{
1886 struct featuregroup *group = obj;
1887 struct ast_cli_args *a = arg;
1888
1889 ast_cli(a->fd, "===> Group: %s\n", group->name);
1890
1892 return 0;
1893}
static int print_featuregroup(void *obj, void *arg, int flags)

References a, ao2_callback, ast_cli(), group::name, and print_featuregroup().

Referenced by handle_feature_show().

◆ reload_features_config()

int reload_features_config ( void  )

Definition at line 1976 of file features_config.c.

1977{
1978 /* Rearm the parking config options have moved warning. */
1979 parking_warning = 0;
1980
1981 if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
1982 return -1;
1983 }
1984 return 0;
1985}
static int parking_warning

References aco_process_config(), ACO_PROCESS_ERROR, and parking_warning.

◆ unload_features_config()

void unload_features_config ( void  )

Definition at line 1967 of file features_config.c.

1968{
1972 aco_info_destroy(&cfg_info);
1974}
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
Definition: astobj2.h:859
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References aco_info_destroy(), ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_custom_function_unregister(), cli_features_config, feature_function, featuremap_function, and globals.

Referenced by unload_module().

◆ unsupported_handler()

static int unsupported_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1521 of file features_config.c.

1523{
1524 if (!parking_warning) {
1525 ast_log(LOG_WARNING, "Parkinglots are no longer configurable in features.conf; "
1526 "parking is now handled by res_parking.conf\n");
1527 parking_warning = 1;
1528 }
1529 ast_log(LOG_WARNING, "The option '%s' is no longer configurable in features.conf.\n", var->name);
1530 return 0;
1531}

References ast_log, LOG_WARNING, parking_warning, and var.

Referenced by load_config().

◆ xfer_copy()

static void xfer_copy ( struct ast_features_xfer_config dest,
const struct ast_features_xfer_config src 
)
static

Definition at line 779 of file features_config.c.

References ast_string_fields_copy, ast_features_xfer_config::atxfercallbackretries, ast_features_xfer_config::atxferdropcall, ast_features_xfer_config::atxferloopdelay, ast_features_xfer_config::atxfernoanswertimeout, ast_features_xfer_config::transferdialattempts, and ast_features_xfer_config::transferdigittimeout.

Referenced by global_copy().

◆ xfer_destructor()

static void xfer_destructor ( void *  obj)
static

Definition at line 664 of file features_config.c.

665{
666 struct ast_features_xfer_config *cfg = obj;
667
669}

References ast_string_field_free_memory.

Referenced by global_config_alloc().

◆ xfer_get()

static int xfer_get ( struct ast_features_xfer_config xfer,
const char *  field,
char *  buf,
size_t  len 
)
static

Definition at line 913 of file features_config.c.

915{
916 int res = 0;
917
918 if (!strcasecmp(field, "transferdigittimeout")) {
919 snprintf(buf, len, "%u", xfer->transferdigittimeout);
920 } else if (!strcasecmp(field, "atxfernoanswertimeout")) {
921 snprintf(buf, len, "%u", xfer->atxfernoanswertimeout);
922 } else if (!strcasecmp(field, "atxferloopdelay")) {
923 snprintf(buf, len, "%u", xfer->atxferloopdelay);
924 } else if (!strcasecmp(field, "atxfercallbackretries")) {
925 snprintf(buf, len, "%u", xfer->atxfercallbackretries);
926 } else if (!strcasecmp(field, "atxferdropcall")) {
927 snprintf(buf, len, "%u", xfer->atxferdropcall);
928 } else if (!strcasecmp(field, "xfersound")) {
930 } else if (!strcasecmp(field, "xferfailsound")) {
932 } else if (!strcasecmp(field, "atxferabort")) {
934 } else if (!strcasecmp(field, "atxfercomplete")) {
936 } else if (!strcasecmp(field, "atxferthreeway")) {
938 } else if (!strcasecmp(field, "atxferswap")) {
940 } else if (!strcasecmp(field, "transferdialattempts")) {
941 snprintf(buf, len, "%u", xfer->transferdialattempts);
942 } else if (!strcasecmp(field, "transferretrysound")) {
944 } else if (!strcasecmp(field, "transferinvalidsound")) {
946 } else {
947 /* Unrecognized option */
948 res = -1;
949 }
950
951 return res;
952}

References ast_copy_string(), ast_features_xfer_config::atxferabort, ast_features_xfer_config::atxfercallbackretries, ast_features_xfer_config::atxfercomplete, ast_features_xfer_config::atxferdropcall, ast_features_xfer_config::atxferloopdelay, ast_features_xfer_config::atxfernoanswertimeout, ast_features_xfer_config::atxferswap, ast_features_xfer_config::atxferthreeway, buf, len(), ast_features_xfer_config::transferdialattempts, ast_features_xfer_config::transferdigittimeout, ast_features_xfer_config::transferinvalidsound, ast_features_xfer_config::transferretrysound, ast_features_xfer_config::xferfailsound, and ast_features_xfer_config::xfersound.

Referenced by internal_feature_read().

◆ xfer_handler()

static int xfer_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1502 of file features_config.c.

1504{
1505 struct features_global_config *global = obj;
1506 struct ast_features_xfer_config *xfer = global->xfer;
1507
1508 return xfer_set(xfer, var->name, var->value);
1509}

References global, var, and xfer_set().

Referenced by load_config().

◆ xfer_set()

static int xfer_set ( struct ast_features_xfer_config xfer,
const char *  name,
const char *  value 
)
static

Definition at line 870 of file features_config.c.

872{
873 int res = 0;
874
875 if (!strcasecmp(name, "transferdigittimeout")) {
877 } else if (!strcasecmp(name, "atxfernoanswertimeout")) {
879 } else if (!strcasecmp(name, "atxferloopdelay")) {
881 } else if (!strcasecmp(name, "atxfercallbackretries")) {
883 } else if (!strcasecmp(name, "atxferdropcall")) {
885 } else if (!strcasecmp(name, "xfersound")) {
886 ast_string_field_set(xfer, xfersound, value);
887 } else if (!strcasecmp(name, "xferfailsound")) {
888 ast_string_field_set(xfer, xferfailsound, value);
889 } else if (!strcasecmp(name, "atxferabort")) {
890 ast_string_field_set(xfer, atxferabort, value);
891 } else if (!strcasecmp(name, "atxfercomplete")) {
892 ast_string_field_set(xfer, atxfercomplete, value);
893 } else if (!strcasecmp(name, "atxferthreeway")) {
894 ast_string_field_set(xfer, atxferthreeway, value);
895 } else if (!strcasecmp(name, "atxferswap")) {
896 ast_string_field_set(xfer, atxferswap, value);
897 } else if (!strcasecmp(name, "transferdialattempts")) {
899 } else if (!strcasecmp(name, "transferretrysound")) {
900 ast_string_field_set(xfer, transferretrysound, value);
901 } else if (!strcasecmp(name, "transferinvalidsound")) {
902 ast_string_field_set(xfer, transferinvalidsound, value);
903 } else if (!strcasecmp(name, "transferannouncesound")) {
904 ast_string_field_set(xfer, transferannouncesound, value);
905 } else {
906 /* Unrecognized option */
907 res = -1;
908 }
909
910 return res;
911}

References ast_parse_arg(), ast_string_field_set, ast_true(), ast_features_xfer_config::atxfercallbackretries, ast_features_xfer_config::atxferdropcall, ast_features_xfer_config::atxferloopdelay, ast_features_xfer_config::atxfernoanswertimeout, name, PARSE_INT32, ast_features_xfer_config::transferdialattempts, ast_features_xfer_config::transferdigittimeout, and value.

Referenced by internal_feature_write(), and xfer_handler().

Variable Documentation

◆ applicationmap_option

struct aco_type applicationmap_option
static

Definition at line 590 of file features_config.c.

◆ applicationmap_options

struct aco_type* applicationmap_options[] = ACO_TYPES(&applicationmap_option)
static

Definition at line 619 of file features_config.c.

Referenced by load_config().

◆ cli_features_config

struct ast_cli_entry cli_features_config[]
static
Initial value:
= {
{ .handler = handle_feature_show , .summary = "Lists configured features" ,},
}
static char * handle_feature_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command to list configured features.

Definition at line 1963 of file features_config.c.

Referenced by load_features_config(), and unload_features_config().

◆ feature_ds_info

const struct ast_datastore_info feature_ds_info
static
Initial value:
= {
.type = "FEATURE",
.destroy = feature_ds_destroy,
.duplicate = feature_ds_duplicate,
}
static void * feature_ds_duplicate(void *data)
static void feature_ds_destroy(void *data)

Definition at line 1051 of file features_config.c.

Referenced by get_feature_chan_ds(), and get_feature_ds().

◆ feature_function

struct ast_custom_function feature_function
static
Initial value:
= {
.name = "FEATURE",
.read = feature_read,
.write = feature_write
}
static int feature_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int feature_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)

Definition at line 1738 of file features_config.c.

Referenced by load_features_config(), and unload_features_config().

◆ featuregroup_option

struct aco_type featuregroup_option
static

Definition at line 598 of file features_config.c.

◆ featuregroup_options

struct aco_type* featuregroup_options[] = ACO_TYPES(&featuregroup_option)
static

Definition at line 620 of file features_config.c.

Referenced by load_config().

◆ featuremap_function

struct ast_custom_function featuremap_function
static
Initial value:
= {
.name = "FEATUREMAP",
.read = featuremap_read,
}
static int featuremap_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static int featuremap_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)

Definition at line 1744 of file features_config.c.

Referenced by load_features_config(), and unload_features_config().

◆ featuremap_option

struct aco_type featuremap_option
static

Definition at line 582 of file features_config.c.

Referenced by load_config().

◆ featuremap_options

struct aco_type* featuremap_options[] = ACO_TYPES(&featuremap_option)
static

Definition at line 618 of file features_config.c.

Referenced by load_config().

◆ features_conf

struct aco_file features_conf
static
Initial value:
= {
.filename = "features.conf",
}
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
static struct aco_type featuregroup_option
static struct aco_type parkinglot_option
static struct aco_type applicationmap_option

Definition at line 623 of file features_config.c.

◆ global_option

struct aco_type global_option
static

Definition at line 574 of file features_config.c.

Referenced by load_config().

◆ global_options

struct aco_type* global_options[] = ACO_TYPES(&global_option)
static

Definition at line 617 of file features_config.c.

Referenced by load_config().

◆ parking_warning

int parking_warning = 0
static

Definition at line 1520 of file features_config.c.

Referenced by reload_features_config(), and unsupported_handler().

◆ parkinglot_option

struct aco_type parkinglot_option
static

Definition at line 608 of file features_config.c.

◆ parkinglot_options

struct aco_type* parkinglot_options[] = ACO_TYPES(&parkinglot_option)
static

Definition at line 621 of file features_config.c.

Referenced by load_config().