Asterisk - The Open Source Telephony Project GIT-master-70eff7f
Loading...
Searching...
No Matches
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.
 
struct ao2_containerast_get_chan_applicationmap (struct ast_channel *chan)
 Get the applicationmap for a given channel.
 
struct ast_featuremap_configast_get_chan_featuremap_config (struct ast_channel *chan)
 Get the featuremap configuration options for a channel.
 
char * ast_get_chan_features_atxferabort (struct ast_channel *chan)
 Get the transfer configuration option atxferabort.
 
struct ast_features_general_configast_get_chan_features_general_config (struct ast_channel *chan)
 Get the general configuration options for a channel.
 
struct ast_features_pickup_configast_get_chan_features_pickup_config (struct ast_channel *chan)
 Get the pickup configuration options for a channel.
 
struct ast_features_xfer_configast_get_chan_features_xfer_config (struct ast_channel *chan)
 Get the transfer configuration options for a channel.
 
char * ast_get_chan_features_xferfailsound (struct ast_channel *chan)
 Get the transfer configuration option xferfailsound.
 
int ast_get_feature (struct ast_channel *chan, const char *feature, char *buf, size_t len)
 Get the DTMF code for a call feature.
 
static 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.
 
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 456 of file features_config.c.

◆ DEFAULT_ATXFER_CALLBACK_RETRIES

#define DEFAULT_ATXFER_CALLBACK_RETRIES   2

Definition at line 453 of file features_config.c.

◆ DEFAULT_ATXFER_COMPLETE

#define DEFAULT_ATXFER_COMPLETE   "*2"

Definition at line 457 of file features_config.c.

◆ DEFAULT_ATXFER_DROP_CALL

#define DEFAULT_ATXFER_DROP_CALL   0

Definition at line 451 of file features_config.c.

◆ DEFAULT_ATXFER_LOOP_DELAY

#define DEFAULT_ATXFER_LOOP_DELAY   10

Definition at line 452 of file features_config.c.

◆ DEFAULT_ATXFER_SWAP

#define DEFAULT_ATXFER_SWAP   "*4"

Definition at line 459 of file features_config.c.

◆ DEFAULT_ATXFER_THREEWAY

#define DEFAULT_ATXFER_THREEWAY   "*3"

Definition at line 458 of file features_config.c.

◆ DEFAULT_COURTESY_TONE

#define DEFAULT_COURTESY_TONE   ""

Definition at line 445 of file features_config.c.

◆ DEFAULT_FEATURE_DIGIT_TIMEOUT

#define DEFAULT_FEATURE_DIGIT_TIMEOUT   1000

Default general options

Definition at line 444 of file features_config.c.

◆ DEFAULT_FEATUREMAP_ATXFER

#define DEFAULT_FEATUREMAP_ATXFER   ""

Definition at line 474 of file features_config.c.

◆ DEFAULT_FEATUREMAP_AUTOMIXMON

#define DEFAULT_FEATUREMAP_AUTOMIXMON   ""

Definition at line 476 of file features_config.c.

◆ DEFAULT_FEATUREMAP_AUTOMON

#define DEFAULT_FEATUREMAP_AUTOMON   ""

Definition at line 473 of file features_config.c.

◆ DEFAULT_FEATUREMAP_BLINDXFER

#define DEFAULT_FEATUREMAP_BLINDXFER   "#"

Default featuremap options

Definition at line 471 of file features_config.c.

◆ DEFAULT_FEATUREMAP_DISCONNECT

#define DEFAULT_FEATUREMAP_DISCONNECT   "*"

Definition at line 472 of file features_config.c.

◆ DEFAULT_FEATUREMAP_PARKCALL

#define DEFAULT_FEATUREMAP_PARKCALL   ""

Definition at line 475 of file features_config.c.

◆ DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER

#define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER   15

Definition at line 450 of file features_config.c.

◆ DEFAULT_PICKUPEXTEN

#define DEFAULT_PICKUPEXTEN   "*8"

Default pickup options

Definition at line 466 of file features_config.c.

◆ DEFAULT_PICKUPFAILSOUND

#define DEFAULT_PICKUPFAILSOUND   ""

Definition at line 468 of file features_config.c.

◆ DEFAULT_PICKUPSOUND

#define DEFAULT_PICKUPSOUND   ""

Definition at line 467 of file features_config.c.

◆ DEFAULT_RECORDING_FAIL_SOUND

#define DEFAULT_RECORDING_FAIL_SOUND   ""

Definition at line 446 of file features_config.c.

◆ DEFAULT_TRANSFER_ANNOUNCE_SOUND

#define DEFAULT_TRANSFER_ANNOUNCE_SOUND   "pbx-transfer"

Definition at line 463 of file features_config.c.

◆ DEFAULT_TRANSFER_DIAL_ATTEMPTS

#define DEFAULT_TRANSFER_DIAL_ATTEMPTS   3

Definition at line 460 of file features_config.c.

◆ DEFAULT_TRANSFER_DIGIT_TIMEOUT

#define DEFAULT_TRANSFER_DIGIT_TIMEOUT   3

Default xfer options

Definition at line 449 of file features_config.c.

◆ DEFAULT_TRANSFER_INVALID_SOUND

#define DEFAULT_TRANSFER_INVALID_SOUND   "privacy-incorrect"

Definition at line 462 of file features_config.c.

◆ DEFAULT_TRANSFER_RETRY_SOUND

#define DEFAULT_TRANSFER_RETRY_SOUND   "pbx-invalid"

Definition at line 461 of file features_config.c.

◆ DEFAULT_XFERFAILSOUND

#define DEFAULT_XFERFAILSOUND   "beeperr"

Definition at line 455 of file features_config.c.

◆ DEFAULT_XFERSOUND

#define DEFAULT_XFERSOUND   "beep"

Definition at line 454 of file features_config.c.

◆ HFS_FORMAT

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

Definition at line 1979 of file features_config.c.

Function Documentation

◆ __features_config_alloc()

static struct features_config * __features_config_alloc ( int  allocate_applicationmap)
static

Definition at line 810 of file features_config.c.

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

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

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

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

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

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

1353{
1355
1357
1358 if (!item || ast_string_field_init(item, 64)) {
1359 return NULL;
1360 }
1361
1366 ast_copy_string(item->dtmf, dtmf, sizeof(item->dtmf));
1367 item->activate_on_self = activate_on_self;
1368
1369 return item;
1370}
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.
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 494 of file features_config.c.

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

488{
489 struct ast_applicationmap_item *item = obj;
490
492}
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object

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

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

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

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

1290{
1291 RAII_VAR(struct features_config *, cfg, NULL, ao2_cleanup);
1292
1293 if (chan) {
1294 cfg = get_feature_ds(chan);
1295 } else {
1297 }
1298
1299 if (!cfg) {
1300 return NULL;
1301 }
1302
1303 ast_assert(cfg->featuremap != NULL);
1304
1305 ao2_ref(cfg->featuremap, +1);
1306 return cfg->featuremap;
1307}

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

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

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

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

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

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

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

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

1240{
1241 char *res;
1243
1244 if (!cfg) {
1245 return NULL;
1246 }
1247
1248 res = ast_strdup(cfg->xferfailsound);
1249 ao2_ref(cfg, -1);
1250
1251 return res;
1252}

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

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

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

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

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

1123{
1124 struct features_config *cfg = data;
1125 ao2_cleanup(cfg);
1126}

References ao2_cleanup.

◆ feature_ds_duplicate()

static void * feature_ds_duplicate ( void *  data)
static

Definition at line 1128 of file features_config.c.

1129{
1130 struct features_config *old_cfg = data;
1131
1132 return features_config_dup(old_cfg);
1133}
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 1778 of file features_config.c.

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

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

621{
622 struct featuregroup *group;
623
625 if (!group) {
626 return NULL;
627 }
628
629 group->name = ast_strdup(cat);
630 if (!group->name) {
632 return NULL;
633 }
634
637 if (!group->items) {
639 return NULL;
640 }
641
642 return group;
643}
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 586 of file features_config.c.

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

613{
614 struct featuregroup *group = obj;
615
616 ast_free((char *) group->name);
617 ao2_cleanup(group->items);
618}
#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 607 of file features_config.c.

608{
609 return ao2_find(group_container, category, OBJ_KEY);
610}
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 1554 of file features_config.c.

1556{
1558 struct featuregroup *group = obj;
1559
1561 if (!item || ast_string_field_init(item, 32)) {
1562 return -1;
1563 }
1564
1565 ast_string_field_set(item, appmap_item_name, var->name);
1566 ast_string_field_set(item, dtmf_override, var->value);
1567
1568 if (!ao2_link(group->items, item)) {
1569 return -1;
1570 }
1571
1572 /* We wait to look up the application map item in the preapply callback */
1573
1574 return 0;
1575}
static void featuregroup_item_destructor(void *obj)
const char * name

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

Referenced by load_config().

◆ featuregroup_hash()

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

Definition at line 567 of file features_config.c.

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

529{
530 struct featuregroup_item *item = obj;
531
533 ao2_cleanup(item->appmap_item);
534}

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

726{
727 struct ast_featuremap_config *cfg = obj;
728
730}
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 886 of file features_config.c.

887{
888 ast_string_fields_copy(dest, src);
889}
#define ast_string_fields_copy(copy, orig)
Copy all string fields from one instance to another of the same structure.

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

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

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

1619{
1620 struct ast_featuremap_config *featuremap = obj;
1621
1622 return featuremap_set(featuremap, var->name, var->value);
1623}
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 1800 of file features_config.c.

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

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

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

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

853{
854 return __features_config_alloc(1);
855}
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 714 of file features_config.c.

715{
716 struct features_config *cfg = obj;
717
718 ao2_cleanup(cfg->global);
723}
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 902 of file features_config.c.

903{
904 struct features_config *dup;
905
907 if (!dup) {
908 return NULL;
909 }
910
911 features_copy(dup, orig);
912
913 return dup;
914}
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 891 of file features_config.c.

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

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

742{
743 struct ast_features_general_config *cfg = obj;
744
746}
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 935 of file features_config.c.

937{
938 int res = 0;
939
940 if (!strcasecmp(field, "featuredigittimeout")) {
941 snprintf(buf, len, "%u", general->featuredigittimeout);
942 } else if (!strcasecmp(field, "courtesytone")) {
944 } else if (!strcasecmp(field, "recordingfailsound")) {
946 } else {
947 /* Unrecognized option */
948 res = -1;
949 }
950
951 return res;
952}

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

1579{
1580 struct features_global_config *global = obj;
1581 struct ast_features_general_config *general = global->general;
1582
1583 return general_set(general, var->name, var->value);
1584}
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

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

918{
919 int res = 0;
920
921 if (!strcasecmp(name, "featuredigittimeout")) {
923 } else if (!strcasecmp(name, "courtesytone")) {
924 ast_string_field_set(general, courtesytone, value);
925 } else if (!strcasecmp(name, "recordingfailsound")) {
926 ast_string_field_set(general, recordingfailsound, value);
927 } else {
928 /* Unrecognized option */
929 res = -1;
930 }
931
932 return res;
933}
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.

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

1186{
1187 struct ast_datastore *ds;
1188
1189 if (!(ds = ast_channel_datastore_find(chan, &feature_ds_info, NULL))) {
1190 /* Hasn't been created yet. Trigger creation. */
1192
1194 }
1195
1196 return ds;
1197}
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:2390
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 1149 of file features_config.c.

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

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

733{
734 struct features_global_config *cfg = obj;
735
736 ao2_cleanup(cfg->general);
737 ao2_cleanup(cfg->xfer);
738 ao2_cleanup(cfg->pickup);
739}
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 879 of file features_config.c.

880{
881 general_copy(dest->general, src->general);
882 xfer_copy(dest->xfer, src->xfer);
883 pickup_copy(dest->pickup, src->pickup);
884}
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 536 of file features_config.c.

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

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

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

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

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

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

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

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

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

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

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

2072{
2073 int res;
2074
2075 res = load_config();
2079
2080 return res;
2081}
#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:706

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

875{
876 ast_string_fields_copy(dest, src);
877}

References ast_string_fields_copy.

Referenced by global_copy().

◆ pickup_destructor()

static void pickup_destructor ( void *  obj)
static

Definition at line 755 of file features_config.c.

756{
757 struct ast_features_pickup_config *cfg = obj;
758
760}
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 1057 of file features_config.c.

1059{
1060 int res = 0;
1061
1062 if (!strcasecmp(field, "pickupsound")) {
1064 } else if (!strcasecmp(field, "pickupfailsound")) {
1066 } else if (!strcasecmp(field, "pickupexten")) {
1068 } else {
1069 /* Unrecognized option */
1070 res = -1;
1071 }
1072
1073 return res;
1074}

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

1597{
1598 struct features_global_config *global = obj;
1599 struct ast_features_pickup_config *pickup = global->pickup;
1600
1601 return pickup_set(pickup, var->name, var->value);
1602}

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

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

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

1982{
1983 struct ast_applicationmap_item *item = obj;
1984 struct ast_cli_args *a = arg;
1985
1986 ast_cli(a->fd, HFS_FORMAT, item->name, "no def", item->dtmf);
1987 return 0;
1988}

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

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

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

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

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

2052{
2056 aco_info_destroy(&cfg_info);
2058}
void ast_cli_unregister_multiple(void)
Definition ael_main.c:408
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
Definition astobj2.h:859
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 1605 of file features_config.c.

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

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

749{
750 struct ast_features_xfer_config *cfg = obj;
751
753}

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

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

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

1588{
1589 struct features_global_config *global = obj;
1590 struct ast_features_xfer_config *xfer = global->xfer;
1591
1592 return xfer_set(xfer, var->name, var->value);
1593}

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

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

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

674 {
675 .type = ACO_GLOBAL,
676 .name = "applicationmap",
677 .category_match = ACO_WHITELIST_EXACT,
678 .category = "applicationmap",
679 .item_offset = offsetof(struct features_config, applicationmap),
680};
@ ACO_GLOBAL
@ ACO_WHITELIST_EXACT

◆ applicationmap_options

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

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

2047 {
2048 AST_CLI_DEFINE(handle_feature_show, "Lists configured features"),
2049};
#define AST_CLI_DEFINE(fn, txt,...)
Definition cli.h:197

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

1135 {
1136 .type = "FEATURE",
1137 .destroy = feature_ds_destroy,
1138 .duplicate = feature_ds_duplicate,
1139};

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

1822 {
1823 .name = "FEATURE",
1824 .read = feature_read,
1825 .write = feature_write
1826};

Referenced by load_features_config(), and unload_features_config().

◆ featuregroup_option

struct aco_type featuregroup_option
static

Definition at line 682 of file features_config.c.

682 {
683 .type = ACO_ITEM,
684 .name = "featuregroup",
685 .category_match = ACO_BLACKLIST,
686 .category = "^(general|featuremap|applicationmap|parkinglot_.*)$",
687 .item_offset = offsetof(struct features_config, featuregroups),
688 .item_alloc = featuregroup_alloc,
689 .item_find = featuregroup_find,
690};
@ ACO_ITEM
@ ACO_BLACKLIST
static void * featuregroup_alloc(const char *cat)
static void * featuregroup_find(struct ao2_container *group_container, const char *category)

◆ featuregroup_options

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

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

1828 {
1829 .name = "FEATUREMAP",
1830 .read = featuremap_read,
1831 .write = featuremap_write
1832};

Referenced by load_features_config(), and unload_features_config().

◆ featuremap_option

struct aco_type featuremap_option
static

Definition at line 666 of file features_config.c.

666 {
667 .type = ACO_GLOBAL,
668 .name = "featuremap",
669 .category_match = ACO_WHITELIST_EXACT,
670 .category = "featuremap",
671 .item_offset = offsetof(struct features_config, featuremap),
672};

Referenced by load_config().

◆ featuremap_options

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

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

707 {
708 .filename = "features.conf",
710};

◆ global_option

struct aco_type global_option
static

Definition at line 658 of file features_config.c.

658 {
659 .type = ACO_GLOBAL,
660 .name = "globals",
661 .category_match = ACO_WHITELIST_EXACT,
662 .category = "general",
663 .item_offset = offsetof(struct features_config, global),
664};

Referenced by load_config().

◆ global_options

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

Definition at line 701 of file features_config.c.

Referenced by load_config().

◆ parking_warning

int parking_warning = 0
static

Definition at line 1604 of file features_config.c.

Referenced by reload_features_config(), and unsupported_handler().

◆ parkinglot_option

struct aco_type parkinglot_option
static

Definition at line 692 of file features_config.c.

692 {
693 .type = ACO_GLOBAL,
694 .name = "parkinglot",
695 .category_match = ACO_WHITELIST,
696 .category = "^parkinglot_.*$",
697 .item_offset = offsetof(struct features_config, parkinglots),
698 .hidden = 1,
699};
@ ACO_WHITELIST

◆ parkinglot_options

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

Definition at line 705 of file features_config.c.

Referenced by load_config().