Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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 452 of file features_config.c.

◆ DEFAULT_ATXFER_CALLBACK_RETRIES

#define DEFAULT_ATXFER_CALLBACK_RETRIES   2

Definition at line 449 of file features_config.c.

◆ DEFAULT_ATXFER_COMPLETE

#define DEFAULT_ATXFER_COMPLETE   "*2"

Definition at line 453 of file features_config.c.

◆ DEFAULT_ATXFER_DROP_CALL

#define DEFAULT_ATXFER_DROP_CALL   0

Definition at line 447 of file features_config.c.

◆ DEFAULT_ATXFER_LOOP_DELAY

#define DEFAULT_ATXFER_LOOP_DELAY   10

Definition at line 448 of file features_config.c.

◆ DEFAULT_ATXFER_SWAP

#define DEFAULT_ATXFER_SWAP   "*4"

Definition at line 455 of file features_config.c.

◆ DEFAULT_ATXFER_THREEWAY

#define DEFAULT_ATXFER_THREEWAY   "*3"

Definition at line 454 of file features_config.c.

◆ DEFAULT_COURTESY_TONE

#define DEFAULT_COURTESY_TONE   ""

Definition at line 441 of file features_config.c.

◆ DEFAULT_FEATURE_DIGIT_TIMEOUT

#define DEFAULT_FEATURE_DIGIT_TIMEOUT   1000

Default general options

Definition at line 440 of file features_config.c.

◆ DEFAULT_FEATUREMAP_ATXFER

#define DEFAULT_FEATUREMAP_ATXFER   ""

Definition at line 470 of file features_config.c.

◆ DEFAULT_FEATUREMAP_AUTOMIXMON

#define DEFAULT_FEATUREMAP_AUTOMIXMON   ""

Definition at line 472 of file features_config.c.

◆ DEFAULT_FEATUREMAP_AUTOMON

#define DEFAULT_FEATUREMAP_AUTOMON   ""

Definition at line 469 of file features_config.c.

◆ DEFAULT_FEATUREMAP_BLINDXFER

#define DEFAULT_FEATUREMAP_BLINDXFER   "#"

Default featuremap options

Definition at line 467 of file features_config.c.

◆ DEFAULT_FEATUREMAP_DISCONNECT

#define DEFAULT_FEATUREMAP_DISCONNECT   "*"

Definition at line 468 of file features_config.c.

◆ DEFAULT_FEATUREMAP_PARKCALL

#define DEFAULT_FEATUREMAP_PARKCALL   ""

Definition at line 471 of file features_config.c.

◆ DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER

#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER   15

Definition at line 446 of file features_config.c.

◆ DEFAULT_PICKUPEXTEN

#define DEFAULT_PICKUPEXTEN   "*8"

Default pickup options

Definition at line 462 of file features_config.c.

◆ DEFAULT_PICKUPFAILSOUND

#define DEFAULT_PICKUPFAILSOUND   ""

Definition at line 464 of file features_config.c.

◆ DEFAULT_PICKUPSOUND

#define DEFAULT_PICKUPSOUND   ""

Definition at line 463 of file features_config.c.

◆ DEFAULT_RECORDING_FAIL_SOUND

#define DEFAULT_RECORDING_FAIL_SOUND   ""

Definition at line 442 of file features_config.c.

◆ DEFAULT_TRANSFER_ANNOUNCE_SOUND

#define DEFAULT_TRANSFER_ANNOUNCE_SOUND   "pbx-transfer"

Definition at line 459 of file features_config.c.

◆ DEFAULT_TRANSFER_DIAL_ATTEMPTS

#define DEFAULT_TRANSFER_DIAL_ATTEMPTS   3

Definition at line 456 of file features_config.c.

◆ DEFAULT_TRANSFER_DIGIT_TIMEOUT

#define DEFAULT_TRANSFER_DIGIT_TIMEOUT   3

Default xfer options

Definition at line 445 of file features_config.c.

◆ DEFAULT_TRANSFER_INVALID_SOUND

#define DEFAULT_TRANSFER_INVALID_SOUND   "privacy-incorrect"

Definition at line 458 of file features_config.c.

◆ DEFAULT_TRANSFER_RETRY_SOUND

#define DEFAULT_TRANSFER_RETRY_SOUND   "pbx-invalid"

Definition at line 457 of file features_config.c.

◆ DEFAULT_XFERFAILSOUND

#define DEFAULT_XFERFAILSOUND   "beeperr"

Definition at line 451 of file features_config.c.

◆ DEFAULT_XFERSOUND

#define DEFAULT_XFERSOUND   "beep"

Definition at line 450 of file features_config.c.

◆ HFS_FORMAT

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

Definition at line 1975 of file features_config.c.

Function Documentation

◆ __features_config_alloc()

static struct features_config * __features_config_alloc ( int  allocate_applicationmap)
static

Definition at line 806 of file features_config.c.

807{
808 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
809
810 cfg = ao2_alloc(sizeof(*cfg), features_config_destructor);
811 if (!cfg) {
812 return NULL;
813 }
814
815 cfg->global = global_config_alloc();
816 if (!cfg->global) {
817 return NULL;
818 }
819
820 cfg->featuremap = ao2_alloc(sizeof(*cfg->featuremap), featuremap_config_destructor);
821 if (!cfg->featuremap || ast_string_field_init(cfg->featuremap, 32)) {
822 return NULL;
823 }
824
825 cfg->parkinglots = ao2_alloc(sizeof(*cfg->parkinglots), NULL);
826 if (!cfg->parkinglots) {
827 return NULL;
828 }
829
830 if (allocate_applicationmap) {
831 cfg->applicationmap = applicationmap_alloc(1);
832 if (!cfg->applicationmap) {
833 return NULL;
834 }
835
836 cfg->featuregroups = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, 11,
838 if (!cfg->featuregroups) {
839 return NULL;
840 }
841 }
842
843 ao2_ref(cfg, +1);
844 return cfg;
845
846}
@ 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 1368 of file features_config.c.

1369{
1370 struct featuregroup_item *fg_item = obj;
1371 struct ao2_container *applicationmap = arg;
1372 RAII_VAR(struct ast_applicationmap_item *, appmap_item, NULL, ao2_cleanup);
1373
1374 /* If there's no DTMF override, then we can just link
1375 * the applicationmap item directly. Otherwise, we need
1376 * to create a copy with the DTMF override in place and
1377 * link that instead
1378 */
1379 if (ast_strlen_zero(fg_item->dtmf_override)) {
1380 ao2_ref(fg_item->appmap_item, +1);
1381 appmap_item = fg_item->appmap_item;
1382 } else {
1383 appmap_item = applicationmap_item_alloc(fg_item->appmap_item_name,
1384 fg_item->appmap_item->app, fg_item->appmap_item->app_data,
1385 fg_item->appmap_item->moh_class, fg_item->dtmf_override,
1386 fg_item->appmap_item->activate_on_self);
1387 }
1388
1389 if (!appmap_item) {
1390 return 0;
1391 }
1392
1393 ao2_link(applicationmap, appmap_item);
1394 return 0;
1395}
#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 786 of file features_config.c.

787{
791}
#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 1454 of file features_config.c.

1456{
1458 struct ao2_container *applicationmap = obj;
1460 AST_APP_ARG(dtmf);
1461 AST_APP_ARG(activate_on);
1464 AST_APP_ARG(moh_class);
1465 );
1466 char *parse = ast_strdupa(var->value);
1467 char *slash;
1468 char *paren;
1469 unsigned int activate_on_self;
1470
1472
1473 if (ast_strlen_zero(args.dtmf) ||
1474 ast_strlen_zero(args.activate_on) ||
1475 ast_strlen_zero(args.app)) {
1476 ast_log(LOG_WARNING, "Invalid applicationmap syntax for '%s'. Missing required argument\n", var->name);
1477 return -1;
1478 }
1479
1480 /* features.conf used to have an "activated_by" portion
1481 * in addition to activate_on. Get rid of whatever may be
1482 * there
1483 */
1484 slash = strchr(args.activate_on, '/');
1485 if (slash) {
1486 *slash = '\0';
1487 }
1488
1489 /* Some applications do not require arguments. */
1490 if (!args.app_data) {
1491 args.app_data = "";
1492 }
1493
1494 /* Two syntaxes allowed for applicationmap:
1495 * Old: foo = *1,self,NoOp,Boo!,default
1496 * New: foo = *1,self,NoOp(Boo!),default
1497 *
1498 * We need to handle both
1499 */
1500 paren = strchr(args.app, '(');
1501 if (paren) {
1502 /* New syntax */
1503 char *close_paren;
1504
1505 args.moh_class = args.app_data;
1506 *paren++ = '\0';
1507 close_paren = strrchr(paren, ')');
1508 if (close_paren) {
1509 *close_paren = '\0';
1510 }
1511 args.app_data = paren;
1512
1513 /* Re-check that the application is not empty */
1514 if (ast_strlen_zero(args.app)) {
1515 ast_log(LOG_WARNING, "Applicationmap item '%s' does not contain an application name.\n", var->name);
1516 return -1;
1517 }
1518 } else if (strchr(args.app_data, '"')) {
1519 args.app_data = ast_strip_quoted(args.app_data, "\"", "\"");
1520 }
1521
1522 /* Allow caller and callee to be specified for backwards compatibility */
1523 if (!strcasecmp(args.activate_on, "self") || !strcasecmp(args.activate_on, "caller")) {
1524 activate_on_self = 1;
1525 } else if (!strcasecmp(args.activate_on, "peer") || !strcasecmp(args.activate_on, "callee")) {
1526 activate_on_self = 0;
1527 } else {
1528 ast_log(LOG_WARNING, "Invalid 'activate_on' value %s for applicationmap item %s\n",
1529 args.activate_on, var->name);
1530 return -1;
1531 }
1532
1533 ast_debug(1, "Allocating applicationmap item: dtmf = %s, app = %s, app_data = %s, moh_class = %s\n",
1534 args.dtmf, args.app, args.app_data, args.moh_class);
1535
1536 item = applicationmap_item_alloc(var->name, args.app, args.app_data,
1537 args.moh_class, args.dtmf, activate_on_self);
1538
1539 if (!item) {
1540 return -1;
1541 }
1542
1543 if (!ao2_link(applicationmap, item)) {
1544 return -1;
1545 }
1546
1547 return 0;
1548}
#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 1346 of file features_config.c.

1349{
1351
1353
1354 if (!item || ast_string_field_init(item, 64)) {
1355 return NULL;
1356 }
1357
1362 ast_copy_string(item->dtmf, dtmf, sizeof(item->dtmf));
1363 item->activate_on_self = activate_on_self;
1364
1365 return item;
1366}
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 490 of file features_config.c.

491{
492 const struct ast_applicationmap_item *item1 = obj;
493 const struct ast_applicationmap_item *item2;
494 const char *key2;
495
496 switch(flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
497 case OBJ_KEY:
498 key2 = arg;
499 return strcasecmp(item1->name, key2);
500 case OBJ_PARTIAL_KEY:
501 key2 = arg;
502 return strncasecmp(item1->name, key2, strlen(key2));
503 default:
504 case OBJ_POINTER:
505 item2 = arg;
506 return strcasecmp(item1->name, item2->name);
507 }
508}
#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 483 of file features_config.c.

484{
485 struct ast_applicationmap_item *item = obj;
486
488}
#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 1305 of file features_config.c.

1306{
1307 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1308
1309 if (chan) {
1310 cfg = get_feature_ds(chan);
1311 } else {
1313 }
1314
1315 if (!cfg) {
1316 return -1;
1317 }
1318
1319 return featuremap_get(cfg->featuremap, feature, buf, len);
1320}
#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 1397 of file features_config.c.

1398{
1400 struct ao2_container *applicationmap;
1401 char *group_names;
1402 char *name;
1403
1404 if (!cfg) {
1405 return NULL;
1406 }
1407
1408 if (!chan) {
1409 if (!cfg->applicationmap || ao2_container_count(cfg->applicationmap) == 0) {
1410 return NULL;
1411 }
1412 ao2_ref(cfg->applicationmap, +1);
1413 return cfg->applicationmap;
1414 }
1415
1416 group_names = ast_strdupa(S_OR(pbx_builtin_getvar_helper(chan, "DYNAMIC_FEATURES"), ""));
1417 if (ast_strlen_zero(group_names)) {
1418 return NULL;
1419 }
1420
1421 applicationmap = applicationmap_alloc(0);
1422 if (!applicationmap) {
1423 return NULL;
1424 }
1425
1426 /* global config must be initialized */
1427 ast_assert(cfg->featuregroups != NULL);
1428 ast_assert(cfg->applicationmap != NULL);
1429 while ((name = strsep(&group_names, "#"))) {
1430 RAII_VAR(struct featuregroup *, group, ao2_find(cfg->featuregroups, name, OBJ_KEY), ao2_cleanup);
1431
1432 if (!group) {
1433 RAII_VAR(struct ast_applicationmap_item *, item, ao2_find(cfg->applicationmap, name, OBJ_KEY), ao2_cleanup);
1434
1435 if (item) {
1436 ao2_link(applicationmap, item);
1437 } else {
1438 ast_log(LOG_WARNING, "Unknown DYNAMIC_FEATURES item '%s' on channel %s.\n",
1439 name, ast_channel_name(chan));
1440 }
1441 } else {
1442 ao2_callback(group->items, 0, add_item, applicationmap);
1443 }
1444 }
1445
1446 if (ao2_container_count(applicationmap) == 0) {
1447 ao2_cleanup(applicationmap);
1448 return NULL;
1449 }
1450
1451 return applicationmap;
1452}
char * strsep(char **str, const char *delims)
#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)
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 1285 of file features_config.c.

1286{
1287 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1288
1289 if (chan) {
1290 cfg = get_feature_ds(chan);
1291 } else {
1293 }
1294
1295 if (!cfg) {
1296 return NULL;
1297 }
1298
1299 ast_assert(cfg->featuremap != NULL);
1300
1301 ao2_ref(cfg->featuremap, +1);
1302 return cfg->featuremap;
1303}

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 1250 of file features_config.c.

1251{
1252 char *res;
1254
1255 if (!cfg) {
1256 return NULL;
1257 }
1258
1259 res = ast_strdup(cfg->atxferabort);
1260 ao2_ref(cfg, -1);
1261
1262 return res;
1263}
#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 1195 of file features_config.c.

1196{
1197 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1198
1199 if (chan) {
1200 cfg = get_feature_ds(chan);
1201 } else {
1203 }
1204
1205 if (!cfg) {
1206 return NULL;
1207 }
1208
1209 ast_assert(cfg->global && cfg->global->general);
1210
1211 ao2_ref(cfg->global->general, +1);
1212 return cfg->global->general;
1213}

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 1265 of file features_config.c.

1266{
1267 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1268
1269 if (chan) {
1270 cfg = get_feature_ds(chan);
1271 } else {
1273 }
1274
1275 if (!cfg) {
1276 return NULL;
1277 }
1278
1279 ast_assert(cfg->global && cfg->global->pickup);
1280
1281 ao2_ref(cfg->global->pickup, +1);
1282 return cfg->global->pickup;
1283}

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 1215 of file features_config.c.

1216{
1217 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1218
1219 if (chan) {
1220 cfg = get_feature_ds(chan);
1221 } else {
1223 }
1224
1225 if (!cfg) {
1226 return NULL;
1227 }
1228
1229 ast_assert(cfg->global && cfg->global->xfer);
1230
1231 ao2_ref(cfg->global->xfer, +1);
1232 return cfg->global->xfer;
1233}

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 1235 of file features_config.c.

1236{
1237 char *res;
1239
1240 if (!cfg) {
1241 return NULL;
1242 }
1243
1244 res = ast_strdup(cfg->xferfailsound);
1245 ao2_ref(cfg, -1);
1246
1247 return res;
1248}

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 1322 of file features_config.c.

1323{
1324 RAII_VAR(struct ao2_container *, applicationmap, NULL, ao2_cleanup);
1326
1327 if (!ast_get_builtin_feature(chan, feature, buf, len)) {
1328 return 0;
1329 }
1330
1331 /* Dang, must be in the application map */
1332 applicationmap = ast_get_chan_applicationmap(chan);
1333 if (!applicationmap) {
1334 return -1;
1335 }
1336
1337 item = ao2_find(applicationmap, feature, OBJ_KEY);
1338 if (!item) {
1339 return -1;
1340 }
1341
1342 ast_copy_string(buf, item->dtmf, len);
1343 return 0;
1344}
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 1639 of file features_config.c.

1640{
1641 struct featuregroup *group = obj;
1642 int *err = arg;
1643
1644 ao2_callback_data(group->items, 0, check_featuregroup_item, arg, data);
1645
1646 if (*err) {
1647 ast_log(LOG_WARNING, "Featuregroup %s refers to non-existent applicationmap item\n",
1648 group->name);
1649 }
1650
1651 return *err ? CMP_STOP : 0;
1652}
@ 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 1621 of file features_config.c.

1622{
1623 struct ast_applicationmap_item *appmap_item;
1624 struct featuregroup_item *fg_item = obj;
1625 int *err = arg;
1626 struct ao2_container *applicationmap = data;
1627
1628 appmap_item = ao2_find(applicationmap, fg_item->appmap_item_name, OBJ_KEY);
1629 if (!appmap_item) {
1630 *err = 1;
1631 return CMP_STOP;
1632 }
1633
1634 fg_item->appmap_item = appmap_item;
1635
1636 return 0;
1637}

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 1118 of file features_config.c.

1119{
1120 struct features_config *cfg = data;
1121 ao2_cleanup(cfg);
1122}

References ao2_cleanup.

◆ feature_ds_duplicate()

static void * feature_ds_duplicate ( void *  data)
static

Definition at line 1124 of file features_config.c.

1125{
1126 struct features_config *old_cfg = data;
1127
1128 return features_config_dup(old_cfg);
1129}
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 1774 of file features_config.c.

1776{
1777 if (!chan) {
1778 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1779 return -1;
1780 }
1781
1782 return internal_feature_read(chan, cmd, data, buf, len);
1783}
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 1785 of file features_config.c.

1787{
1788 if (!chan) {
1789 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1790 return -1;
1791 }
1792
1793 return internal_feature_write(chan, cmd, data, value);
1794}
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 616 of file features_config.c.

617{
618 struct featuregroup *group;
619
621 if (!group) {
622 return NULL;
623 }
624
625 group->name = ast_strdup(cat);
626 if (!group->name) {
628 return NULL;
629 }
630
633 if (!group->items) {
635 return NULL;
636 }
637
638 return group;
639}
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 582 of file features_config.c.

583{
584 struct featuregroup *group1 = obj;
585 struct featuregroup *group2;
586 const char *key2;
587
588 switch(flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
589 case OBJ_KEY:
590 key2 = arg;
591 return strcasecmp(group1->name, key2) ? 0 : CMP_MATCH;
592 case OBJ_PARTIAL_KEY:
593 key2 = arg;
594 return strncasecmp(group1->name, key2, strlen(key2)) ? 0 : CMP_MATCH;
595 case OBJ_POINTER:
596 group2 = arg;
597 return strcasecmp(group1->name, group2->name) ? 0 : CMP_MATCH;
598 default:
599 return CMP_STOP;
600 }
601}
@ 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 608 of file features_config.c.

609{
610 struct featuregroup *group = obj;
611
612 ast_free((char *) group->name);
613 ao2_cleanup(group->items);
614}
#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 603 of file features_config.c.

604{
605 return ao2_find(group_container, category, OBJ_KEY);
606}
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 1550 of file features_config.c.

1552{
1554 struct featuregroup *group = obj;
1555
1557 if (!item || ast_string_field_init(item, 32)) {
1558 return -1;
1559 }
1560
1561 ast_string_field_set(item, appmap_item_name, var->name);
1562 ast_string_field_set(item, dtmf_override, var->value);
1563
1564 if (!ao2_link(group->items, item)) {
1565 return -1;
1566 }
1567
1568 /* We wait to look up the application map item in the preapply callback */
1569
1570 return 0;
1571}
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 563 of file features_config.c.

564{
565 const struct featuregroup *group;
566 const char *key;
567
568 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
569 case OBJ_KEY:
570 key = obj;
571 return ast_str_case_hash(key);
572 case OBJ_PARTIAL_KEY:
573 ast_assert(0);
574 return 0;
575 case OBJ_POINTER:
576 default:
577 group = obj;
579 }
580}
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 524 of file features_config.c.

525{
526 struct featuregroup_item *item = obj;
527
529 ao2_cleanup(item->appmap_item);
530}

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 721 of file features_config.c.

722{
723 struct ast_featuremap_config *cfg = obj;
724
726}
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 882 of file features_config.c.

883{
884 ast_string_fields_copy(dest, src);
885}
#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 1095 of file features_config.c.

1097{
1098 int res = 0;
1099
1100 if (!strcasecmp(field, "blindxfer")) {
1101 ast_copy_string(buf, featuremap->blindxfer, len);
1102 } else if (!strcasecmp(field, "disconnect")) {
1103 ast_copy_string(buf, featuremap->disconnect, len);
1104 } else if (!strcasecmp(field, "atxfer")) {
1105 ast_copy_string(buf, featuremap->atxfer, len);
1106 } else if (!strcasecmp(field, "automixmon")) {
1107 ast_copy_string(buf, featuremap->automixmon, len);
1108 } else if (!strcasecmp(field, "parkcall")) {
1109 ast_copy_string(buf, featuremap->parkcall, len);
1110 } else {
1111 /* Unrecognized option */
1112 res = -1;
1113 }
1114
1115 return res;
1116}

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 1613 of file features_config.c.

1615{
1616 struct ast_featuremap_config *featuremap = obj;
1617
1618 return featuremap_set(featuremap, var->name, var->value);
1619}
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 1796 of file features_config.c.

1798{
1799 if (!chan) {
1800 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1801 return -1;
1802 }
1803
1804 return internal_featuremap_read(chan, cmd, data, buf, len);
1805}
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 1072 of file features_config.c.

1074{
1075 int res = 0;
1076
1077 if (!strcasecmp(name, "blindxfer")) {
1078 ast_string_field_set(featuremap, blindxfer, value);
1079 } else if (!strcasecmp(name, "disconnect")) {
1080 ast_string_field_set(featuremap, disconnect, value);
1081 } else if (!strcasecmp(name, "atxfer")) {
1082 ast_string_field_set(featuremap, atxfer, value);
1083 } else if (!strcasecmp(name, "automixmon")) {
1084 ast_string_field_set(featuremap, automixmon, value);
1085 } else if (!strcasecmp(name, "parkcall")) {
1086 ast_string_field_set(featuremap, parkcall, value);
1087 } else {
1088 /* Unrecognized option */
1089 res = -1;
1090 }
1091
1092 return res;
1093}

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 1807 of file features_config.c.

1809{
1810 if (!chan) {
1811 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1812 return -1;
1813 }
1814
1815 return internal_featuremap_write(chan, cmd, data, value);
1816}
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 848 of file features_config.c.

849{
850 return __features_config_alloc(1);
851}
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 710 of file features_config.c.

711{
712 struct features_config *cfg = obj;
713
714 ao2_cleanup(cfg->global);
719}
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 898 of file features_config.c.

899{
900 struct features_config *dup;
901
903 if (!dup) {
904 return NULL;
905 }
906
907 features_copy(dup, orig);
908
909 return dup;
910}
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 887 of file features_config.c.

888{
889 global_copy(dest->global, src->global);
891
892 /* applicationmap and featuregroups are purposely not copied. A channel's applicationmap
893 * is produced on the fly when ast_get_chan_applicationmap() is called
894 * NOTE: This does not apply to the global cfg->applicationmap and cfg->featuregroups
895 */
896}
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 1661 of file features_config.c.

1662{
1663 struct features_config *cfg = aco_pending_config(&cfg_info);
1664 int err = 0;
1665
1666 /* Now that the entire config has been processed, we can check that the featuregroup
1667 * items refer to actual applicationmap items.
1668 */
1669
1670 /* global config must be initialized */
1671 ast_assert(cfg->featuregroups != NULL);
1674
1675 return err;
1676}
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 737 of file features_config.c.

738{
739 struct ast_features_general_config *cfg = obj;
740
742}
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 931 of file features_config.c.

933{
934 int res = 0;
935
936 if (!strcasecmp(field, "featuredigittimeout")) {
937 snprintf(buf, len, "%u", general->featuredigittimeout);
938 } else if (!strcasecmp(field, "courtesytone")) {
940 } else if (!strcasecmp(field, "recordingfailsound")) {
942 } else {
943 /* Unrecognized option */
944 res = -1;
945 }
946
947 return res;
948}

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 1573 of file features_config.c.

1575{
1576 struct features_global_config *global = obj;
1577 struct ast_features_general_config *general = global->general;
1578
1579 return general_set(general, var->name, var->value);
1580}
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 912 of file features_config.c.

914{
915 int res = 0;
916
917 if (!strcasecmp(name, "featuredigittimeout")) {
919 } else if (!strcasecmp(name, "courtesytone")) {
920 ast_string_field_set(general, courtesytone, value);
921 } else if (!strcasecmp(name, "recordingfailsound")) {
922 ast_string_field_set(general, recordingfailsound, value);
923 } else {
924 /* Unrecognized option */
925 res = -1;
926 }
927
928 return res;
929}
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
Definition: main/config.c:4047

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 1181 of file features_config.c.

1182{
1183 struct ast_datastore *ds;
1184
1185 if (!(ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
1186 /* Hasn't been created yet. Trigger creation. */
1188
1190 }
1191
1192 return ds;
1193}
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:2368
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 1145 of file features_config.c.

1146{
1147 RAII_VAR(struct features_config *, orig, NULL, ao2_cleanup);
1148 struct features_config *cfg;
1149 struct ast_datastore *ds;
1150
1151 if ((ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
1152 cfg = ds->data;
1153 ao2_ref(cfg, +1);
1154 return cfg;
1155 }
1156
1158 if (!orig) {
1159 return NULL;
1160 }
1161
1162 cfg = features_config_dup(orig);
1163 if (!cfg) {
1164 return NULL;
1165 }
1166
1167 if (!(ds = ast_datastore_alloc(&feature_ds_info, NULL))) {
1168 ao2_cleanup(cfg);
1169 return NULL;
1170 }
1171
1172 /* Give the datastore a reference to the config */
1173 ao2_ref(cfg, +1);
1174 ds->data = cfg;
1175
1176 ast_channel_datastore_add(chan, ds);
1177
1178 return cfg;
1179}
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2354
#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 758 of file features_config.c.

759{
761
762 cfg = ao2_alloc(sizeof(*cfg), global_config_destructor);
763 if (!cfg) {
764 return NULL;
765 }
766
767 cfg->general = ao2_alloc(sizeof(*cfg->general), general_destructor);
768 if (!cfg->general || ast_string_field_init(cfg->general, 32)) {
769 return NULL;
770 }
771
772 cfg->xfer = ao2_alloc(sizeof(*cfg->xfer), xfer_destructor);
773 if (!cfg->xfer || ast_string_field_init(cfg->xfer, 32)) {
774 return NULL;
775 }
776
777 cfg->pickup = ao2_alloc(sizeof(*cfg->pickup), pickup_destructor);
778 if (!cfg->pickup || ast_string_field_init(cfg->pickup, 32)) {
779 return NULL;
780 }
781
782 ao2_ref(cfg, +1);
783 return cfg;
784}
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 728 of file features_config.c.

729{
730 struct features_global_config *cfg = obj;
731
732 ao2_cleanup(cfg->general);
733 ao2_cleanup(cfg->xfer);
734 ao2_cleanup(cfg->pickup);
735}
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 875 of file features_config.c.

876{
877 general_copy(dest->general, src->general);
878 xfer_copy(dest->xfer, src->xfer);
879 pickup_copy(dest->pickup, src->pickup);
880}
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 532 of file features_config.c.

533{
534 const struct featuregroup_item *item1 = obj;
535 const struct featuregroup_item *item2;
536 const char *key2;
537
538 switch(flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
539 case OBJ_KEY:
540 key2 = arg;
541 return strcasecmp(item1->appmap_item_name, key2);
542 case OBJ_PARTIAL_KEY:
543 key2 = arg;
544 return strncasecmp(item1->appmap_item_name, key2, strlen(key2));
545 case OBJ_POINTER:
546 item2 = arg;
547 return strcasecmp(item1->appmap_item_name, item2->appmap_item_name);
548 default:
549 return CMP_STOP;
550 }
551}

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 1995 of file features_config.c.

1996{
1997 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1998
1999 switch (cmd) {
2000
2001 case CLI_INIT:
2002 e->command = "features show";
2003 e->usage =
2004 "Usage: features show\n"
2005 " Lists configured features\n";
2006 return NULL;
2007 case CLI_GENERATE:
2008 return NULL;
2009 }
2010
2012
2013 ast_cli(a->fd, HFS_FORMAT, "Builtin Feature", "Default", "Current");
2014 ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
2015
2016 ast_cli(a->fd, HFS_FORMAT, "Pickup", DEFAULT_PICKUPEXTEN, cfg->global->pickup->pickupexten);
2017 ast_cli(a->fd, HFS_FORMAT, "Blind Transfer", DEFAULT_FEATUREMAP_BLINDXFER, cfg->featuremap->blindxfer);
2018 ast_cli(a->fd, HFS_FORMAT, "Attended Transfer", DEFAULT_FEATUREMAP_ATXFER, cfg->featuremap->atxfer);
2019 ast_cli(a->fd, HFS_FORMAT, "Disconnect Call", DEFAULT_FEATUREMAP_DISCONNECT, cfg->featuremap->disconnect);
2020 ast_cli(a->fd, HFS_FORMAT, "Park Call", DEFAULT_FEATUREMAP_PARKCALL, cfg->featuremap->parkcall);
2021 ast_cli(a->fd, HFS_FORMAT, "One Touch MixMonitor", DEFAULT_FEATUREMAP_AUTOMIXMON, cfg->featuremap->automixmon);
2022
2023 ast_cli(a->fd, "\n");
2024 ast_cli(a->fd, HFS_FORMAT, "Dynamic Feature", "Default", "Current");
2025 ast_cli(a->fd, HFS_FORMAT, "---------------", "-------", "-------");
2026 if (!cfg->applicationmap || ao2_container_count(cfg->applicationmap) == 0) {
2027 ast_cli(a->fd, "(none)\n");
2028 } else {
2029 ao2_callback(cfg->applicationmap, 0, print_applicationmap, a);
2030 }
2031
2032 ast_cli(a->fd, "\nFeature Groups:\n");
2033 ast_cli(a->fd, "---------------\n");
2034 if (!cfg->featuregroups || ao2_container_count(cfg->featuregroups) == 0) {
2035 ast_cli(a->fd, "(none)\n");
2036 } else {
2037 ao2_callback(cfg->featuregroups, 0, print_featuregroups, a);
2038 }
2039
2040 return CLI_SUCCESS;
2041}
#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 1678 of file features_config.c.

1680{
1681 int res;
1682 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1683 SCOPED_CHANNELLOCK(lock, chan);
1684
1685 if (!strcasecmp(data, "inherit")) {
1686 struct ast_datastore *ds = get_feature_chan_ds(chan);
1687 unsigned int inherit = ds ? ds->inheritance : 0;
1688
1689 snprintf(buf, len, "%s", inherit ? "yes" : "no");
1690 return 0;
1691 }
1692
1693 cfg = get_feature_ds(chan);
1694 if (!cfg) {
1695 return -1;
1696 }
1697
1698 res = general_get(cfg->global->general, data, buf, len) &&
1699 xfer_get(cfg->global->xfer, data, buf, len) &&
1700 pickup_get(cfg->global->pickup, data, buf, len);
1701
1702 if (res) {
1703 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATURE()\n", data);
1704 }
1705
1706 return res;
1707}
ast_mutex_t lock
Definition: app_sla.c:337
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:626
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 1709 of file features_config.c.

1711{
1712 int res;
1713 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1714 SCOPED_CHANNELLOCK(lock, chan);
1715
1716 if (!strcasecmp(data, "inherit")) {
1717 struct ast_datastore *ds = get_feature_chan_ds(chan);
1718 if (ds) {
1720 }
1721 return 0;
1722 }
1723
1724 if (!(cfg = get_feature_ds(chan))) {
1725 return -1;
1726 }
1727
1728 res = general_set(cfg->global->general, data, value) &&
1729 xfer_set(cfg->global->xfer, data, value) &&
1730 pickup_set(cfg->global->pickup, data, value);
1731
1732 if (res) {
1733 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATURE()\n", data);
1734 }
1735
1736 return res;
1737}
#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 1739 of file features_config.c.

1741{
1742 int res;
1743 SCOPED_CHANNELLOCK(lock, chan);
1744
1745 res = ast_get_builtin_feature(chan, data, buf, len);
1746
1747 if (res) {
1748 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATUREMAP()\n", data);
1749 }
1750
1751 return res;
1752}

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 1754 of file features_config.c.

1756{
1757 int res;
1758 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1759 SCOPED_CHANNELLOCK(lock, chan);
1760
1761 if (!(cfg = get_feature_ds(chan))) {
1762 return -1;
1763 }
1764
1765 res = featuremap_set(cfg->featuremap, data, value);
1766 if (res) {
1767 ast_log(LOG_WARNING, "Invalid argument '%s' to FEATUREMAP()\n", data);
1768 return -1;
1769 }
1770
1771 return 0;
1772}

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 1830 of file features_config.c.

1831{
1832 if (aco_info_init(&cfg_info)) {
1833 ast_log(LOG_ERROR, "Unable to initialize configuration info for features\n");
1834 return -1;
1835 }
1836
1837 aco_option_register_custom(&cfg_info, "featuredigittimeout", ACO_EXACT, global_options,
1839 aco_option_register_custom(&cfg_info, "recordingfailsound", ACO_EXACT, global_options,
1841 aco_option_register_custom(&cfg_info, "courtesytone", ACO_EXACT, global_options,
1843
1844 aco_option_register_custom(&cfg_info, "transferdigittimeout", ACO_EXACT, global_options,
1846 aco_option_register_custom(&cfg_info, "atxfernoanswertimeout", ACO_EXACT, global_options,
1848 aco_option_register_custom(&cfg_info, "atxferdropcall", ACO_EXACT, global_options,
1850 aco_option_register_custom(&cfg_info, "atxferloopdelay", ACO_EXACT, global_options,
1852 aco_option_register_custom(&cfg_info, "atxfercallbackretries", ACO_EXACT, global_options,
1854 aco_option_register_custom(&cfg_info, "xfersound", ACO_EXACT, global_options,
1856 aco_option_register_custom(&cfg_info, "xferfailsound", ACO_EXACT, global_options,
1858 aco_option_register_custom(&cfg_info, "atxferabort", ACO_EXACT, global_options,
1860 aco_option_register_custom(&cfg_info, "atxfercomplete", ACO_EXACT, global_options,
1862 aco_option_register_custom(&cfg_info, "atxferthreeway", ACO_EXACT, global_options,
1864 aco_option_register_custom(&cfg_info, "atxferswap", ACO_EXACT, global_options,
1866 aco_option_register_custom(&cfg_info, "transferdialattempts", ACO_EXACT, global_options,
1868 aco_option_register_custom(&cfg_info, "transferretrysound", ACO_EXACT, global_options,
1870 aco_option_register_custom(&cfg_info, "transferinvalidsound", ACO_EXACT, global_options,
1872 aco_option_register_custom(&cfg_info, "transferannouncesound", ACO_EXACT, global_options,
1874
1875 aco_option_register_custom(&cfg_info, "pickupexten", ACO_EXACT, global_options,
1877 aco_option_register_custom(&cfg_info, "pickupsound", ACO_EXACT, global_options,
1879 aco_option_register_custom(&cfg_info, "pickupfailsound", ACO_EXACT, global_options,
1881
1883 "", unsupported_handler, 0);
1885 "", unsupported_handler, 0);
1886 aco_option_register_custom_nodoc(&cfg_info, "parkext_exclusive", ACO_EXACT, global_options,
1887 "", unsupported_handler, 0);
1888 aco_option_register_custom_nodoc(&cfg_info, "parkinghints", ACO_EXACT, global_options,
1889 "", unsupported_handler, 0);
1890 aco_option_register_custom_nodoc(&cfg_info, "parkedmusicclass", ACO_EXACT, global_options,
1891 "", unsupported_handler, 0);
1893 "", unsupported_handler, 0);
1895 "", unsupported_handler, 0);
1897 "", unsupported_handler, 0);
1898 aco_option_register_custom_nodoc(&cfg_info, "parkedcalltransfers", ACO_EXACT, global_options,
1899 "", unsupported_handler, 0);
1900 aco_option_register_custom_nodoc(&cfg_info, "parkedcallreparking", ACO_EXACT, global_options,
1901 "", unsupported_handler, 0);
1902 aco_option_register_custom_nodoc(&cfg_info, "parkedcallhangup", ACO_EXACT, global_options,
1903 "", unsupported_handler, 0);
1904 aco_option_register_custom_nodoc(&cfg_info, "parkedcallrecording", ACO_EXACT, global_options,
1905 "", unsupported_handler, 0);
1906 aco_option_register_custom_nodoc(&cfg_info, "comebackcontext", ACO_EXACT, global_options,
1907 "", unsupported_handler, 0);
1908 aco_option_register_custom_nodoc(&cfg_info, "comebacktoorigin", ACO_EXACT, global_options,
1909 "", unsupported_handler, 0);
1910 aco_option_register_custom_nodoc(&cfg_info, "comebackdialtime", ACO_EXACT, global_options,
1911 "", unsupported_handler, 0);
1912 aco_option_register_custom_nodoc(&cfg_info, "parkeddynamic", ACO_EXACT, global_options,
1913 "", unsupported_handler, 0);
1915 "", unsupported_handler, 0);
1916
1927
1929 "", applicationmap_handler, 0);
1930
1932 "", featuregroup_handler, 0);
1933
1935 "", unsupported_handler, 0);
1936
1937 if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
1938 RAII_VAR(struct features_config *, features_cfg, features_config_alloc(), ao2_cleanup);
1939
1940 if (aco_set_defaults(&global_option, "general", features_cfg->global) ||
1941 aco_set_defaults(&featuremap_option, "featuremap", features_cfg->featuremap)) {
1942 ast_log(LOG_ERROR, "Failed to load features.conf and failed to initialize defaults.\n");
1943 return -1;
1944 }
1945
1946 ast_log(LOG_NOTICE, "Could not load features config; using defaults\n");
1948 }
1949
1950 return 0;
1951}
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 2067 of file features_config.c.

2068{
2069 int res;
2070
2071 res = load_config();
2075
2076 return res;
2077}
#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 870 of file features_config.c.

871{
872 ast_string_fields_copy(dest, src);
873}

References ast_string_fields_copy.

Referenced by global_copy().

◆ pickup_destructor()

static void pickup_destructor ( void *  obj)
static

Definition at line 751 of file features_config.c.

752{
753 struct ast_features_pickup_config *cfg = obj;
754
756}
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 1053 of file features_config.c.

1055{
1056 int res = 0;
1057
1058 if (!strcasecmp(field, "pickupsound")) {
1060 } else if (!strcasecmp(field, "pickupfailsound")) {
1062 } else if (!strcasecmp(field, "pickupexten")) {
1064 } else {
1065 /* Unrecognized option */
1066 res = -1;
1067 }
1068
1069 return res;
1070}

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 1591 of file features_config.c.

1593{
1594 struct features_global_config *global = obj;
1595 struct ast_features_pickup_config *pickup = global->pickup;
1596
1597 return pickup_set(pickup, var->name, var->value);
1598}

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 1034 of file features_config.c.

1036{
1037 int res = 0;
1038
1039 if (!strcasecmp(name, "pickupsound")) {
1040 ast_string_field_set(pickup, pickupsound, value);
1041 } else if (!strcasecmp(name, "pickupfailsound")) {
1042 ast_string_field_set(pickup, pickupfailsound, value);
1043 } else if (!strcasecmp(name, "pickupexten")) {
1044 ast_string_field_set(pickup, pickupexten, value);
1045 } else {
1046 /* Unrecognized option */
1047 res = -1;
1048 }
1049
1050 return res;
1051}

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 1977 of file features_config.c.

1978{
1979 struct ast_applicationmap_item *item = obj;
1980 struct ast_cli_args *a = arg;
1981
1982 ast_cli(a->fd, HFS_FORMAT, item->name, "no def", item->dtmf);
1983 return 0;
1984}
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 1953 of file features_config.c.

1954{
1955 struct featuregroup_item *item = obj;
1956 struct ast_cli_args *a = arg;
1957
1958 ast_cli(a->fd, "===> --> %s (%s)\n", item->appmap_item_name,
1959 S_OR(item->dtmf_override, item->appmap_item->dtmf));
1960
1961 return 0;
1962}

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 1964 of file features_config.c.

1965{
1966 struct featuregroup *group = obj;
1967 struct ast_cli_args *a = arg;
1968
1969 ast_cli(a->fd, "===> Group: %s\n", group->name);
1970
1972 return 0;
1973}
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 2056 of file features_config.c.

2057{
2058 /* Rearm the parking config options have moved warning. */
2059 parking_warning = 0;
2060
2061 if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
2062 return -1;
2063 }
2064 return 0;
2065}
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 2047 of file features_config.c.

2048{
2052 aco_info_destroy(&cfg_info);
2054}
#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 1601 of file features_config.c.

1603{
1604 if (!parking_warning) {
1605 ast_log(LOG_WARNING, "Parkinglots are no longer configurable in features.conf; "
1606 "parking is now handled by res_parking.conf\n");
1607 parking_warning = 1;
1608 }
1609 ast_log(LOG_WARNING, "The option '%s' is no longer configurable in features.conf.\n", var->name);
1610 return 0;
1611}

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 859 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 744 of file features_config.c.

745{
746 struct ast_features_xfer_config *cfg = obj;
747
749}

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 993 of file features_config.c.

995{
996 int res = 0;
997
998 if (!strcasecmp(field, "transferdigittimeout")) {
999 snprintf(buf, len, "%u", xfer->transferdigittimeout);
1000 } else if (!strcasecmp(field, "atxfernoanswertimeout")) {
1001 snprintf(buf, len, "%u", xfer->atxfernoanswertimeout);
1002 } else if (!strcasecmp(field, "atxferloopdelay")) {
1003 snprintf(buf, len, "%u", xfer->atxferloopdelay);
1004 } else if (!strcasecmp(field, "atxfercallbackretries")) {
1005 snprintf(buf, len, "%u", xfer->atxfercallbackretries);
1006 } else if (!strcasecmp(field, "atxferdropcall")) {
1007 snprintf(buf, len, "%u", xfer->atxferdropcall);
1008 } else if (!strcasecmp(field, "xfersound")) {
1010 } else if (!strcasecmp(field, "xferfailsound")) {
1012 } else if (!strcasecmp(field, "atxferabort")) {
1014 } else if (!strcasecmp(field, "atxfercomplete")) {
1016 } else if (!strcasecmp(field, "atxferthreeway")) {
1018 } else if (!strcasecmp(field, "atxferswap")) {
1020 } else if (!strcasecmp(field, "transferdialattempts")) {
1021 snprintf(buf, len, "%u", xfer->transferdialattempts);
1022 } else if (!strcasecmp(field, "transferretrysound")) {
1024 } else if (!strcasecmp(field, "transferinvalidsound")) {
1026 } else {
1027 /* Unrecognized option */
1028 res = -1;
1029 }
1030
1031 return res;
1032}

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 1582 of file features_config.c.

1584{
1585 struct features_global_config *global = obj;
1586 struct ast_features_xfer_config *xfer = global->xfer;
1587
1588 return xfer_set(xfer, var->name, var->value);
1589}

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 950 of file features_config.c.

952{
953 int res = 0;
954
955 if (!strcasecmp(name, "transferdigittimeout")) {
957 } else if (!strcasecmp(name, "atxfernoanswertimeout")) {
959 } else if (!strcasecmp(name, "atxferloopdelay")) {
961 } else if (!strcasecmp(name, "atxfercallbackretries")) {
963 } else if (!strcasecmp(name, "atxferdropcall")) {
965 } else if (!strcasecmp(name, "xfersound")) {
966 ast_string_field_set(xfer, xfersound, value);
967 } else if (!strcasecmp(name, "xferfailsound")) {
968 ast_string_field_set(xfer, xferfailsound, value);
969 } else if (!strcasecmp(name, "atxferabort")) {
970 ast_string_field_set(xfer, atxferabort, value);
971 } else if (!strcasecmp(name, "atxfercomplete")) {
972 ast_string_field_set(xfer, atxfercomplete, value);
973 } else if (!strcasecmp(name, "atxferthreeway")) {
974 ast_string_field_set(xfer, atxferthreeway, value);
975 } else if (!strcasecmp(name, "atxferswap")) {
976 ast_string_field_set(xfer, atxferswap, value);
977 } else if (!strcasecmp(name, "transferdialattempts")) {
979 } else if (!strcasecmp(name, "transferretrysound")) {
980 ast_string_field_set(xfer, transferretrysound, value);
981 } else if (!strcasecmp(name, "transferinvalidsound")) {
982 ast_string_field_set(xfer, transferinvalidsound, value);
983 } else if (!strcasecmp(name, "transferannouncesound")) {
984 ast_string_field_set(xfer, transferannouncesound, value);
985 } else {
986 /* Unrecognized option */
987 res = -1;
988 }
989
990 return res;
991}

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 670 of file features_config.c.

◆ applicationmap_options

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

Definition at line 699 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 2043 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 1131 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 1818 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 678 of file features_config.c.

◆ featuregroup_options

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

Definition at line 700 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 1824 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 662 of file features_config.c.

Referenced by load_config().

◆ featuremap_options

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

Definition at line 698 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 703 of file features_config.c.

◆ global_option

struct aco_type global_option
static

Definition at line 654 of file features_config.c.

Referenced by load_config().

◆ global_options

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

Definition at line 697 of file features_config.c.

Referenced by load_config().

◆ parking_warning

int parking_warning = 0
static

Definition at line 1600 of file features_config.c.

Referenced by reload_features_config(), and unsupported_handler().

◆ parkinglot_option

struct aco_type parkinglot_option
static

Definition at line 688 of file features_config.c.

◆ parkinglot_options

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

Definition at line 701 of file features_config.c.

Referenced by load_config().