Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Data Structures | Functions | Variables
conf_config_parser.c File Reference

ConfBridge config parser. More...

#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/config.h"
#include "asterisk/config_options.h"
#include "include/confbridge.h"
#include "asterisk/astobj2.h"
#include "asterisk/cli.h"
#include "asterisk/bridge_features.h"
#include "asterisk/stringfields.h"
#include "asterisk/pbx.h"
Include dependency graph for conf_config_parser.c:

Go to the source code of this file.

Data Structures

struct  confbridge_cfg
 
struct  dtmf_menu_hook_pvt
 
struct  func_confbridge_data
 

Functions

static int add_action_to_menu_entry (struct conf_menu_entry *menu_entry, enum conf_menu_action_id id, char *databuf)
 
static int add_menu_entry (struct conf_menu *menu, const char *dtmf, const char *action_names)
 
static int announce_user_count_all_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static AO2_GLOBAL_OBJ_STATIC (cfg_handle)
 
static int apply_menu_to_user (struct confbridge_user *user, struct conf_menu *menu)
 
static int bridge_cmp_cb (void *obj, void *arg, int flags)
 
static int bridge_hash_cb (const void *obj, const int flags)
 
static void * bridge_profile_alloc (const char *category)
 
static void bridge_profile_destructor (void *obj)
 
static void * bridge_profile_find (struct ao2_container *container, const char *category)
 
static struct bridge_profile_soundsbridge_profile_sounds_alloc (void)
 
static void bridge_profile_sounds_destroy_cb (void *obj)
 
static int bridge_template_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static char * complete_bridge_profile_name (const char *line, const char *word, int pos, int state)
 
static char * complete_menu_name (const char *line, const char *word, int pos, int state)
 
static char * complete_user_profile_name (const char *line, const char *word, int pos, int state)
 
void conf_bridge_profile_copy (struct bridge_profile *dst, struct bridge_profile *src)
 copies a bridge profile More...
 
void conf_bridge_profile_destroy (struct bridge_profile *b_profile)
 Destroy a bridge profile found by 'conf_find_bridge_profile'. More...
 
void conf_destroy_config (void)
 destroy the information loaded from the confbridge.conf file More...
 
const struct bridge_profileconf_find_bridge_profile (struct ast_channel *chan, const char *bridge_profile_name, struct bridge_profile *result)
 Find a bridge profile given a bridge profile's name and store that profile in result structure. More...
 
int conf_find_menu_entry_by_sequence (const char *dtmf_sequence, struct conf_menu *menu, struct conf_menu_entry *result)
 Finds a menu_entry in a menu structure matched by DTMF sequence. More...
 
const struct user_profileconf_find_user_profile (struct ast_channel *chan, const char *user_profile_name, struct user_profile *result)
 find a user profile given a user profile's name and store that profile in result structure. More...
 
int conf_load_config (void)
 load confbridge.conf file More...
 
void conf_menu_entry_destroy (struct conf_menu_entry *menu_entry)
 Destroys and frees all the actions stored in a menu_entry structure. More...
 
static int conf_menu_profile_copy (struct conf_menu *dst, struct conf_menu *src)
 
int conf_reload_config (void)
 reload confbridge.conf file More...
 
int conf_set_menu_to_user (struct ast_channel *chan, struct confbridge_user *user, const char *menu_profile_name)
 find a menu profile given a menu profile's name and apply the menu in DTMF hooks. More...
 
static void conf_user_profile_copy (struct user_profile *dst, struct user_profile *src)
 
static void * confbridge_cfg_alloc (void)
 
static void confbridge_cfg_destructor (void *obj)
 
 CONFIG_INFO_STANDARD (cfg_info, cfg_handle, confbridge_cfg_alloc,.files=ACO_FILES(&confbridge_conf),.pre_apply_config=verify_default_profiles,)
 
static int copy_menu_entry (struct conf_menu_entry *dst, struct conf_menu_entry *src)
 
static void func_confbridge_data_destructor (struct func_confbridge_data *b_data)
 
static void func_confbridge_destroy_cb (void *data)
 
int func_confbridge_helper (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static char * handle_cli_confbridge_show_bridge_profile (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * handle_cli_confbridge_show_bridge_profiles (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * handle_cli_confbridge_show_menu (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * handle_cli_confbridge_show_menus (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * handle_cli_confbridge_show_user_profile (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * handle_cli_confbridge_show_user_profiles (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static void * menu_alloc (const char *category)
 
static int menu_cmp_cb (void *obj, void *arg, int flags)
 
static void menu_destructor (void *obj)
 
static void * menu_find (struct ao2_container *container, const char *category)
 
static int menu_hash_cb (const void *obj, const int flags)
 
static int menu_hook_callback (struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 
static void menu_hook_destroy (void *hook_pvt)
 
static int menu_option_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int menu_template_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int mix_interval_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int remb_behavior_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int sample_rate_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int set_sound (const char *sound_name, const char *sound_file, struct bridge_profile *b_profile)
 
static int sound_option_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int user_cmp_cb (void *obj, void *arg, int flags)
 
static int user_hash_cb (const void *obj, const int flags)
 
static void * user_profile_alloc (const char *category)
 
static void user_profile_destructor (void *obj)
 
static void * user_profile_find (struct ao2_container *container, const char *category)
 
static int user_template_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int verify_default_profiles (void)
 
static int video_mode_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 

Variables

static struct aco_type bridge_type
 
static struct aco_typebridge_types [] = ACO_TYPES(&bridge_type)
 
static struct ast_cli_entry cli_confbridge_parser []
 
static struct aco_file confbridge_conf
 
static const struct ast_datastore_info confbridge_datastore
 
static struct aco_type general_type
 
static struct aco_type menu_type
 
static struct aco_typemenu_types [] = ACO_TYPES(&menu_type)
 
static struct aco_type user_type
 
static struct aco_typeuser_types [] = ACO_TYPES(&user_type)
 

Detailed Description

ConfBridge config parser.

Author
David Vossel dvoss.nosp@m.el@d.nosp@m.igium.nosp@m..com

Definition in file conf_config_parser.c.

Function Documentation

◆ add_action_to_menu_entry()

static int add_action_to_menu_entry ( struct conf_menu_entry menu_entry,
enum conf_menu_action_id  id,
char *  databuf 
)
static

Definition at line 1452 of file conf_config_parser.c.

1453{
1454 struct conf_menu_action *menu_action = ast_calloc(1, sizeof(*menu_action));
1455
1456 if (!menu_action) {
1457 return -1;
1458 }
1459 menu_action->id = id;
1460
1461 switch (id) {
1462 case MENU_ACTION_NOOP:
1475 case MENU_ACTION_LEAVE:
1478 break;
1481 if (!(ast_strlen_zero(databuf))) {
1482 ast_copy_string(menu_action->data.playback_file, databuf, sizeof(menu_action->data.playback_file));
1483 } else {
1484 ast_free(menu_action);
1485 return -1;
1486 }
1487 break;
1489 if (!(ast_strlen_zero(databuf))) {
1494 );
1495 AST_STANDARD_APP_ARGS(args, databuf);
1496 if (!ast_strlen_zero(args.context)) {
1498 args.context,
1499 sizeof(menu_action->data.dialplan_args.context));
1500 }
1501 if (!ast_strlen_zero(args.exten)) {
1503 args.exten,
1504 sizeof(menu_action->data.dialplan_args.exten));
1505 }
1506 menu_action->data.dialplan_args.priority = 1; /* 1 by default */
1507 if (!ast_strlen_zero(args.priority) &&
1508 (sscanf(args.priority, "%30d", &menu_action->data.dialplan_args.priority) != 1)) {
1509 /* invalid priority */
1510 ast_free(menu_action);
1511 return -1;
1512 }
1513 } else {
1514 ast_free(menu_action);
1515 return -1;
1516 }
1517 };
1518
1519 AST_LIST_INSERT_TAIL(&menu_entry->actions, menu_action, action);
1520
1521 return 0;
1522}
enum queue_result id
Definition: app_queue.c:1808
#define ast_free(a)
Definition: astmm.h:180
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
static int priority
@ MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC
Definition: confbridge.h:112
@ MENU_ACTION_SET_SINGLE_VIDEO_SRC
Definition: confbridge.h:111
@ MENU_ACTION_ADMIN_KICK_LAST
Definition: confbridge.h:108
@ MENU_ACTION_TOGGLE_BINAURAL
Definition: confbridge.h:115
@ MENU_ACTION_PLAYBACK
Definition: confbridge.h:98
@ MENU_ACTION_LEAVE
Definition: confbridge.h:109
@ MENU_ACTION_RESET_LISTENING
Definition: confbridge.h:102
@ MENU_ACTION_INCREASE_TALKING
Definition: confbridge.h:104
@ MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS
Definition: confbridge.h:114
@ MENU_ACTION_INCREASE_LISTENING
Definition: confbridge.h:100
@ MENU_ACTION_DIALPLAN_EXEC
Definition: confbridge.h:106
@ MENU_ACTION_DECREASE_LISTENING
Definition: confbridge.h:101
@ MENU_ACTION_PLAYBACK_AND_CONTINUE
Definition: confbridge.h:99
@ MENU_ACTION_ADMIN_TOGGLE_LOCK
Definition: confbridge.h:107
@ MENU_ACTION_DECREASE_TALKING
Definition: confbridge.h:105
@ MENU_ACTION_PARTICIPANT_COUNT
Definition: confbridge.h:113
@ MENU_ACTION_TOGGLE_MUTE
Definition: confbridge.h:97
@ MENU_ACTION_NOOP
Definition: confbridge.h:110
@ MENU_ACTION_RESET_TALKING
Definition: confbridge.h:103
#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_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:731
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
enum conf_menu_action_id id
Definition: confbridge.h:123
char exten[AST_MAX_EXTENSION]
Definition: confbridge.h:128
struct conf_menu_action::@89 action
struct conf_menu_action::@88::@90 dialplan_args
char playback_file[PATH_MAX]
Definition: confbridge.h:125
char context[AST_MAX_CONTEXT]
Definition: confbridge.h:127
union conf_menu_action::@88 data
struct conf_menu_entry::@91 actions
const char * args

References conf_menu_entry::actions, args, AST_APP_ARG, ast_calloc, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_free, AST_LIST_INSERT_TAIL, AST_STANDARD_APP_ARGS, ast_strlen_zero(), conf_menu_action::context, voicemailpwcheck::context, conf_menu_action::data, conf_menu_action::dialplan_args, conf_menu_action::exten, id, conf_menu_action::id, MENU_ACTION_ADMIN_KICK_LAST, MENU_ACTION_ADMIN_TOGGLE_LOCK, MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, MENU_ACTION_DECREASE_LISTENING, MENU_ACTION_DECREASE_TALKING, MENU_ACTION_DIALPLAN_EXEC, MENU_ACTION_INCREASE_LISTENING, MENU_ACTION_INCREASE_TALKING, MENU_ACTION_LEAVE, MENU_ACTION_NOOP, MENU_ACTION_PARTICIPANT_COUNT, MENU_ACTION_PLAYBACK, MENU_ACTION_PLAYBACK_AND_CONTINUE, MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC, MENU_ACTION_RESET_LISTENING, MENU_ACTION_RESET_TALKING, MENU_ACTION_SET_SINGLE_VIDEO_SRC, MENU_ACTION_TOGGLE_BINAURAL, MENU_ACTION_TOGGLE_MUTE, conf_menu_action::playback_file, conf_menu_action::priority, and priority.

Referenced by add_menu_entry().

◆ add_menu_entry()

static int add_menu_entry ( struct conf_menu menu,
const char *  dtmf,
const char *  action_names 
)
static

Definition at line 1524 of file conf_config_parser.c.

1525{
1526 struct conf_menu_entry *menu_entry = NULL, *cur = NULL;
1527 int res = 0;
1528 char *tmp_action_names = ast_strdupa(action_names);
1529 char *action = NULL;
1530 char *action_args;
1531 char *tmp;
1532 char buf[PATH_MAX];
1533 char *delimiter = ",";
1534
1535 if (!(menu_entry = ast_calloc(1, sizeof(*menu_entry)))) {
1536 return -1;
1537 }
1538
1539 for (;;) {
1540 char *comma;
1541 char *startbrace;
1542 char *endbrace;
1543 unsigned int action_len;
1544
1545 if (ast_strlen_zero(tmp_action_names)) {
1546 break;
1547 }
1548 startbrace = strchr(tmp_action_names, '(');
1549 endbrace = strchr(tmp_action_names, ')');
1550 comma = strchr(tmp_action_names, ',');
1551
1552 /* If the next action has brackets with comma delimited arguments in it,
1553 * make the delimeter ')' instead of a comma to preserve the arguments */
1554 if (startbrace && endbrace && comma && (comma > startbrace && comma < endbrace)) {
1555 delimiter = ")";
1556 } else {
1557 delimiter = ",";
1558 }
1559
1560 if (!(action = strsep(&tmp_action_names, delimiter))) {
1561 break;
1562 }
1563
1564 action = ast_strip(action);
1565 if (ast_strlen_zero(action)) {
1566 continue;
1567 }
1568
1569 action_len = strlen(action);
1570 ast_copy_string(menu_entry->dtmf, dtmf, sizeof(menu_entry->dtmf));
1571 if (!strcasecmp(action, "toggle_mute")) {
1573 } else if (!strcasecmp(action, "toggle_binaural")) {
1575 } else if (!strcasecmp(action, "no_op")) {
1576 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_NOOP, NULL);
1577 } else if (!strcasecmp(action, "increase_listening_volume")) {
1579 } else if (!strcasecmp(action, "decrease_listening_volume")) {
1581 } else if (!strcasecmp(action, "increase_talking_volume")) {
1583 } else if (!strcasecmp(action, "reset_listening_volume")) {
1585 } else if (!strcasecmp(action, "reset_talking_volume")) {
1587 } else if (!strcasecmp(action, "decrease_talking_volume")) {
1589 } else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
1591 } else if (!strcasecmp(action, "admin_toggle_mute_participants")) {
1593 } else if (!strcasecmp(action, "participant_count")) {
1595 } else if (!strcasecmp(action, "admin_kick_last")) {
1597 } else if (!strcasecmp(action, "leave_conference")) {
1598 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_LEAVE, NULL);
1599 } else if (!strcasecmp(action, "set_as_single_video_src")) {
1601 } else if (!strcasecmp(action, "release_as_single_video_src")) {
1603 } else if (!strncasecmp(action, "dialplan_exec(", 14)) {
1604 ast_copy_string(buf, action, sizeof(buf));
1605 action_args = buf;
1606 if ((action_args = strchr(action, '('))) {
1607 action_args++;
1608 }
1609 /* it is possible that this argument may or may not
1610 * have a closing brace at this point, it all depends on if
1611 * comma delimited arguments were provided */
1612 if ((tmp = strchr(action, ')'))) {
1613 *tmp = '\0';
1614 }
1615 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DIALPLAN_EXEC, action_args);
1616 } else if (action_len >= 21 && !strncasecmp(action, "playback_and_continue(", 22)) {
1617 ast_copy_string(buf, action, sizeof(buf));
1618 action_args = buf;
1619 if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1620 *tmp = '\0';
1621 action_args++;
1622 }
1623 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK_AND_CONTINUE, action_args);
1624 } else if (action_len >= 8 && !strncasecmp(action, "playback(", 9)) {
1625 ast_copy_string(buf, action, sizeof(buf));
1626 action_args = buf;
1627 if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1628 *tmp = '\0';
1629 action_args++;
1630 }
1631 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, action_args);
1632 }
1633 }
1634
1635 /* if adding any of the actions failed, bail */
1636 if (res) {
1637 conf_menu_entry_destroy(menu_entry);
1638 ast_free(menu_entry);
1639 return -1;
1640 }
1641
1642 /* remove any list entry with an identical DTMF sequence for overrides */
1644 if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) {
1647 ast_free(cur);
1648 break;
1649 }
1650 }
1652
1653 AST_LIST_INSERT_TAIL(&menu->entries, menu_entry, entry);
1654
1655 return 0;
1656}
char * strsep(char **str, const char *delims)
#define PATH_MAX
Definition: asterisk.h:40
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
static int add_action_to_menu_entry(struct conf_menu_entry *menu_entry, enum conf_menu_action_id id, char *databuf)
void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry)
Destroys and frees all the actions stored in a menu_entry structure.
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
#define NULL
Definition: resample.c:96
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Definition: strings.h:223
Definition: confbridge.h:138
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:140
struct conf_menu_entry::@92 entry
struct conf_menu::@93 entries

References add_action_to_menu_entry(), ast_calloc, ast_copy_string(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_strdupa, ast_strip(), ast_strlen_zero(), buf, conf_menu_entry_destroy(), conf_menu_entry::dtmf, conf_menu::entries, MENU_ACTION_ADMIN_KICK_LAST, MENU_ACTION_ADMIN_TOGGLE_LOCK, MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, MENU_ACTION_DECREASE_LISTENING, MENU_ACTION_DECREASE_TALKING, MENU_ACTION_DIALPLAN_EXEC, MENU_ACTION_INCREASE_LISTENING, MENU_ACTION_INCREASE_TALKING, MENU_ACTION_LEAVE, MENU_ACTION_NOOP, MENU_ACTION_PARTICIPANT_COUNT, MENU_ACTION_PLAYBACK, MENU_ACTION_PLAYBACK_AND_CONTINUE, MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC, MENU_ACTION_RESET_LISTENING, MENU_ACTION_RESET_TALKING, MENU_ACTION_SET_SINGLE_VIDEO_SRC, MENU_ACTION_TOGGLE_BINAURAL, MENU_ACTION_TOGGLE_MUTE, NULL, PATH_MAX, and strsep().

Referenced by menu_option_handler().

◆ announce_user_count_all_handler()

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

Definition at line 2283 of file conf_config_parser.c.

2284{
2285 struct user_profile *u_profile = obj;
2286
2287 if (strcasecmp(var->name, "announce_user_count_all")) {
2288 return -1;
2289 }
2290 if (ast_true(var->value)) {
2291 u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2292 } else if (ast_false(var->value)) {
2293 u_profile->flags = u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNTALL;
2294 } else if (sscanf(var->value, "%30u", &u_profile->announce_user_count_all_after) == 1) {
2295 u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2296 } else {
2297 return -1;
2298 }
2299 return 0;
2300}
#define var
Definition: ast_expr2f.c:605
@ USER_OPT_ANNOUNCEUSERCOUNTALL
Definition: confbridge.h:66
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition: utils.c:2199
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
Definition: utils.c:2216
unsigned int flags
Definition: confbridge.h:159
unsigned int announce_user_count_all_after
Definition: confbridge.h:160

References user_profile::announce_user_count_all_after, ast_false(), ast_true(), user_profile::flags, USER_OPT_ANNOUNCEUSERCOUNTALL, and var.

Referenced by conf_load_config().

◆ AO2_GLOBAL_OBJ_STATIC()

static AO2_GLOBAL_OBJ_STATIC ( cfg_handle  )
static

◆ apply_menu_to_user()

static int apply_menu_to_user ( struct confbridge_user user,
struct conf_menu menu 
)
static

Definition at line 2853 of file conf_config_parser.c.

2854{
2855 struct conf_menu_entry *menu_entry;
2856
2857 SCOPED_AO2LOCK(menu_lock, menu);
2858 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2859 struct dtmf_menu_hook_pvt *pvt;
2860
2861 if (!(pvt = ast_calloc(1, sizeof(*pvt)))) {
2862 return -1;
2863 }
2864 pvt->user = user;
2865 pvt->menu = ao2_bump(menu);
2866
2868 menu_hook_destroy(pvt);
2869 return -1;
2870 }
2871
2872 if (ast_bridge_dtmf_hook(&user->features, pvt->menu_entry.dtmf,
2874 menu_hook_destroy(pvt);
2875 }
2876 }
2877 strcpy(user->menu_name, menu->name); /* Safe */
2878
2879 return 0;
2880}
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Definition: astobj2.h:480
int ast_bridge_dtmf_hook(struct ast_bridge_features *features, const char *dtmf, ast_bridge_hook_callback callback, void *hook_pvt, ast_bridge_hook_pvt_destructor destructor, enum ast_bridge_hook_remove_flags remove_flags)
Attach a DTMF hook to a bridge features structure.
Definition: bridge.c:3251
static int menu_hook_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
static void menu_hook_destroy(void *hook_pvt)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
Definition: lock.h:611
static char user[512]
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:150
struct conf_menu * menu
struct conf_menu_entry menu_entry
struct confbridge_user * user
structure to hold users read from users.conf

References ao2_bump, ast_bridge_dtmf_hook(), ast_calloc, AST_LIST_TRAVERSE, copy_menu_entry(), conf_menu_entry::dtmf, conf_menu::entries, dtmf_menu_hook_pvt::menu, dtmf_menu_hook_pvt::menu_entry, menu_hook_callback(), menu_hook_destroy(), conf_menu::name, SCOPED_AO2LOCK, dtmf_menu_hook_pvt::user, and user.

Referenced by conf_set_menu_to_user().

◆ bridge_cmp_cb()

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

bridge profile container functions

Definition at line 1044 of file conf_config_parser.c.

1045{
1046 const struct bridge_profile *left = obj;
1047 const struct bridge_profile *right = arg;
1048 const char *right_name = arg;
1049 int cmp;
1050
1051 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1052 default:
1053 case OBJ_POINTER:
1054 right_name = right->name;
1055 /* Fall through */
1056 case OBJ_KEY:
1057 cmp = strcasecmp(left->name, right_name);
1058 break;
1059 case OBJ_PARTIAL_KEY:
1060 cmp = strncasecmp(left->name, right_name, strlen(right_name));
1061 break;
1062 }
1063 return cmp ? 0 : CMP_MATCH;
1064}
@ CMP_MATCH
Definition: astobj2.h:1027
#define OBJ_KEY
Definition: astobj2.h:1151
#define OBJ_POINTER
Definition: astobj2.h:1150
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1152
unsigned int flags
Definition: confbridge.h:233
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:228

References CMP_MATCH, bridge_profile::flags, bridge_profile::name, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by confbridge_cfg_alloc().

◆ bridge_hash_cb()

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

Definition at line 1066 of file conf_config_parser.c.

1067{
1068 const struct bridge_profile *b_profile = obj;
1069 const char *name = obj;
1070 int hash;
1071
1072 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1073 default:
1074 case OBJ_POINTER:
1075 name = b_profile->name;
1076 /* Fall through */
1077 case OBJ_KEY:
1078 hash = ast_str_case_hash(name);
1079 break;
1080 case OBJ_PARTIAL_KEY:
1081 /* Should never happen in hash callback. */
1082 ast_assert(0);
1083 hash = 0;
1084 break;
1085 }
1086 return hash;
1087}
static const char name[]
Definition: format_mp3.c:68
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
#define ast_assert(a)
Definition: utils.h:739

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

Referenced by confbridge_cfg_alloc().

◆ bridge_profile_alloc()

static void * bridge_profile_alloc ( const char *  category)
static

Definition at line 913 of file conf_config_parser.c.

914{
915 struct bridge_profile *b_profile;
916
917 if (!(b_profile = ao2_alloc(sizeof(*b_profile), bridge_profile_destructor))) {
918 return NULL;
919 }
920
921 if (!(b_profile->sounds = bridge_profile_sounds_alloc())) {
922 ao2_ref(b_profile, -1);
923 return NULL;
924 }
925
926 ast_copy_string(b_profile->name, category, sizeof(b_profile->name));
927
928 return b_profile;
929}
#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
static void bridge_profile_destructor(void *obj)
static struct bridge_profile_sounds * bridge_profile_sounds_alloc(void)
struct bridge_profile_sounds * sounds
Definition: confbridge.h:238

References ao2_alloc, ao2_ref, ast_copy_string(), bridge_profile_destructor(), bridge_profile_sounds_alloc(), bridge_profile::name, NULL, and bridge_profile::sounds.

Referenced by verify_default_profiles().

◆ bridge_profile_destructor()

static void bridge_profile_destructor ( void *  obj)
static

Definition at line 907 of file conf_config_parser.c.

908{
909 struct bridge_profile *b_profile = obj;
910 ao2_cleanup(b_profile->sounds);
911}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934

References ao2_cleanup, and bridge_profile::sounds.

Referenced by bridge_profile_alloc().

◆ bridge_profile_find()

static void * bridge_profile_find ( struct ao2_container container,
const char *  category 
)
static

Definition at line 931 of file conf_config_parser.c.

932{
933 return ao2_find(container, category, OBJ_KEY);
934}
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1736
struct ao2_container * container
Definition: res_fax.c:531

References ao2_find, container, and OBJ_KEY.

◆ bridge_profile_sounds_alloc()

static struct bridge_profile_sounds * bridge_profile_sounds_alloc ( void  )
static

Definition at line 1199 of file conf_config_parser.c.

1200{
1202
1203 if (!sounds) {
1204 return NULL;
1205 }
1206 if (ast_string_field_init(sounds, 512)) {
1207 ao2_ref(sounds, -1);
1208 return NULL;
1209 }
1210
1211 return sounds;
1212}
static void bridge_profile_sounds_destroy_cb(void *obj)
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:359

References ao2_alloc, ao2_ref, ast_string_field_init, bridge_profile_sounds_destroy_cb(), NULL, and sounds.

Referenced by bridge_profile_alloc(), bridge_template_handler(), and func_confbridge_helper().

◆ bridge_profile_sounds_destroy_cb()

static void bridge_profile_sounds_destroy_cb ( void *  obj)
static

Bridge Profile Sounds functions

Definition at line 1193 of file conf_config_parser.c.

1194{
1195 struct bridge_profile_sounds *sounds = obj;
1197}
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:374

References ast_string_field_free_memory, and sounds.

Referenced by bridge_profile_sounds_alloc().

◆ bridge_template_handler()

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

Definition at line 2438 of file conf_config_parser.c.

2439{
2440 struct bridge_profile *b_profile = obj;
2442 struct bridge_profile_sounds *oldsounds = b_profile->sounds;
2443
2444 if (!sounds) {
2445 return -1;
2446 }
2447 if (!(conf_find_bridge_profile(NULL, var->value, b_profile))) {
2448 ao2_ref(sounds, -1);
2449 return -1;
2450 }
2451 /* Using a bridge profile as a template is a little complicated due to the sounds. Since the sounds
2452 * structure of a dynamic profile will need to be altered, a completely new sounds structure must be
2453 * created instead of simply holding a reference to the one built by the config file. */
2477
2478 ao2_ref(b_profile->sounds, -1); /* sounds struct copied over to it from the template by reference only. */
2479 ao2_ref(oldsounds, -1); /* original sounds struct we don't need anymore */
2480 b_profile->sounds = sounds; /* the new sounds struct that is a deep copy of the one from the template. */
2481
2482 return 0;
2483}
const struct bridge_profile * conf_find_bridge_profile(struct ast_channel *chan, const char *bridge_profile_name, struct bridge_profile *result)
Find a bridge profile given a bridge profile's name and store that profile in result structure.
static unsigned char leave[]
Definition: leave.h:12
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
const ast_string_field waitforleader
Definition: confbridge.h:224
const ast_string_field invalidpin
Definition: confbridge.h:224
const ast_string_field placeintoconf
Definition: confbridge.h:224
const ast_string_field onlyone
Definition: confbridge.h:224
const ast_string_field otherinparty
Definition: confbridge.h:224
const ast_string_field unlockednow
Definition: confbridge.h:224
const ast_string_field getpin
Definition: confbridge.h:224
const ast_string_field errormenu
Definition: confbridge.h:224
const ast_string_field participantsunmuted
Definition: confbridge.h:224
const ast_string_field participantsmuted
Definition: confbridge.h:224
const ast_string_field leave
Definition: confbridge.h:224
const ast_string_field locked
Definition: confbridge.h:224
const ast_string_field join
Definition: confbridge.h:224
const ast_string_field kicked
Definition: confbridge.h:224
const ast_string_field hasleft
Definition: confbridge.h:224
const ast_string_field unmuted
Definition: confbridge.h:224
const ast_string_field leaderhasleft
Definition: confbridge.h:224
const ast_string_field lockednow
Definition: confbridge.h:224
const ast_string_field hasjoin
Definition: confbridge.h:224
const ast_string_field onlyperson
Definition: confbridge.h:224
const ast_string_field thereare
Definition: confbridge.h:224
const ast_string_field muted
Definition: confbridge.h:224
const ast_string_field begin
Definition: confbridge.h:224

References ao2_ref, ast_string_field_set, bridge_profile_sounds::begin, bridge_profile_sounds_alloc(), conf_find_bridge_profile(), bridge_profile_sounds::errormenu, bridge_profile_sounds::getpin, bridge_profile_sounds::hasjoin, bridge_profile_sounds::hasleft, bridge_profile_sounds::invalidpin, bridge_profile_sounds::join, bridge_profile_sounds::kicked, bridge_profile_sounds::leaderhasleft, bridge_profile_sounds::leave, leave, bridge_profile_sounds::locked, bridge_profile_sounds::lockednow, bridge_profile_sounds::muted, NULL, bridge_profile_sounds::onlyone, bridge_profile_sounds::onlyperson, bridge_profile_sounds::otherinparty, bridge_profile_sounds::participantsmuted, bridge_profile_sounds::participantsunmuted, bridge_profile_sounds::placeintoconf, bridge_profile::sounds, sounds, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, var, and bridge_profile_sounds::waitforleader.

Referenced by conf_load_config().

◆ complete_bridge_profile_name()

static char * complete_bridge_profile_name ( const char *  line,
const char *  word,
int  pos,
int  state 
)
static

Definition at line 1827 of file conf_config_parser.c.

1828{
1829 int which = 0;
1830 char *res = NULL;
1831 int wordlen = strlen(word);
1832 struct ao2_iterator i;
1833 struct bridge_profile *b_profile = NULL;
1835
1836 if (!cfg) {
1837 return NULL;
1838 }
1839
1840 i = ao2_iterator_init(cfg->bridge_profiles, 0);
1841 while ((b_profile = ao2_iterator_next(&i))) {
1842 if (!strncasecmp(b_profile->name, word, wordlen) && ++which > state) {
1843 res = ast_strdup(b_profile->name);
1844 ao2_ref(b_profile, -1);
1845 break;
1846 }
1847 ao2_ref(b_profile, -1);
1848 }
1850
1851 return res;
1852}
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
Definition: astobj2.h:918
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
short word
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_strdup, cfg_handle, bridge_profile::name, NULL, and RAII_VAR.

Referenced by handle_cli_confbridge_show_bridge_profile().

◆ complete_menu_name()

static char * complete_menu_name ( const char *  line,
const char *  word,
int  pos,
int  state 
)
static

Definition at line 2059 of file conf_config_parser.c.

2060{
2061 int which = 0;
2062 char *res = NULL;
2063 int wordlen = strlen(word);
2064 struct ao2_iterator i;
2065 struct conf_menu *menu = NULL;
2067
2068 if (!cfg) {
2069 return NULL;
2070 }
2071
2072 i = ao2_iterator_init(cfg->menus, 0);
2073 while ((menu = ao2_iterator_next(&i))) {
2074 if (!strncasecmp(menu->name, word, wordlen) && ++which > state) {
2075 res = ast_strdup(menu->name);
2076 ao2_ref(menu, -1);
2077 break;
2078 }
2079 ao2_ref(menu, -1);
2080 }
2082
2083 return res;
2084}

References ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_strdup, cfg_handle, conf_menu::name, NULL, and RAII_VAR.

Referenced by handle_cli_confbridge_show_menu().

◆ complete_user_profile_name()

static char * complete_user_profile_name ( const char *  line,
const char *  word,
int  pos,
int  state 
)
static

Definition at line 1658 of file conf_config_parser.c.

1659{
1660 int which = 0;
1661 char *res = NULL;
1662 int wordlen = strlen(word);
1663 struct ao2_iterator i;
1664 struct user_profile *u_profile = NULL;
1666
1667 if (!cfg) {
1668 return NULL;
1669 }
1670
1671 i = ao2_iterator_init(cfg->user_profiles, 0);
1672 while ((u_profile = ao2_iterator_next(&i))) {
1673 if (!strncasecmp(u_profile->name, word, wordlen) && ++which > state) {
1674 res = ast_strdup(u_profile->name);
1675 ao2_ref(u_profile, -1);
1676 break;
1677 }
1678 ao2_ref(u_profile, -1);
1679 }
1681
1682 return res;
1683}
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:155

References ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_strdup, cfg_handle, user_profile::name, NULL, and RAII_VAR.

Referenced by handle_cli_confbridge_show_user_profile().

◆ conf_bridge_profile_copy()

void conf_bridge_profile_copy ( struct bridge_profile dst,
struct bridge_profile src 
)

copies a bridge profile

Note
conf_bridge_profile_destroy must be called on the dst structure

Definition at line 2749 of file conf_config_parser.c.

2750{
2751 *dst = *src;
2752 if (src->sounds) {
2753 ao2_ref(src->sounds, +1);
2754 }
2755}

References ao2_ref, and bridge_profile::sounds.

Referenced by conf_find_bridge_profile(), and join_conference_bridge().

◆ conf_bridge_profile_destroy()

void conf_bridge_profile_destroy ( struct bridge_profile b_profile)

Destroy a bridge profile found by 'conf_find_bridge_profile'.

Definition at line 2757 of file conf_config_parser.c.

2758{
2759 if (b_profile->sounds) {
2760 ao2_ref(b_profile->sounds, -1);
2761 b_profile->sounds = NULL;
2762 }
2763}

References ao2_ref, NULL, and bridge_profile::sounds.

Referenced by confbridge_exec(), destroy_conference_bridge(), func_confbridge_data_destructor(), func_confbridge_helper(), and handle_cli_confbridge_show_bridge_profile().

◆ conf_destroy_config()

void conf_destroy_config ( void  )

destroy the information loaded from the confbridge.conf file

Definition at line 2920 of file conf_config_parser.c.

2921{
2923 aco_info_destroy(&cfg_info);
2925}
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
Definition: astobj2.h:859
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
static struct ast_cli_entry cli_confbridge_parser[]
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
#define ARRAY_LEN(a)
Definition: utils.h:666

References aco_info_destroy(), ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), cfg_handle, and cli_confbridge_parser.

Referenced by conf_load_config(), and unload_module().

◆ conf_find_bridge_profile()

const struct bridge_profile * conf_find_bridge_profile ( struct ast_channel chan,
const char *  bridge_profile_name,
struct bridge_profile result 
)

Find a bridge profile given a bridge profile's name and store that profile in result structure.

Parameters
chanchannel the bridge profile is requested for
bridge_profile_namename of the profile requested (optional)
resultdata contained by the bridge profile will be copied to this struct pointer

If bridge_profile_name is not provided, this function will check for the presence of a bridge profile set by the CONFBRIDGE function on a channel datastore. If that doesn't exist, the default_bridge profile is used.

Return values
bridgeprofile on success
NULLon failure

Definition at line 2765 of file conf_config_parser.c.

2766{
2767 struct bridge_profile *tmp2;
2768 struct ast_datastore *datastore = NULL;
2769 struct func_confbridge_data *b_data = NULL;
2771
2772 if (chan && ast_strlen_zero(bridge_profile_name)) {
2773 ast_channel_lock(chan);
2775 ast_channel_unlock(chan);
2776 if (datastore) {
2777 b_data = datastore->data;
2778 if (b_data->b_usable) {
2780 return result;
2781 }
2782 }
2783 }
2784
2785 if (!cfg) {
2786 return NULL;
2787 }
2788 if (ast_strlen_zero(bridge_profile_name)) {
2789 bridge_profile_name = DEFAULT_BRIDGE_PROFILE;
2790 }
2791 if (!(tmp2 = ao2_find(cfg->bridge_profiles, bridge_profile_name, OBJ_KEY))) {
2792 return NULL;
2793 }
2794 ao2_lock(tmp2);
2796 ao2_unlock(tmp2);
2797 ao2_ref(tmp2, -1);
2798
2799 return result;
2800}
#define ao2_unlock(a)
Definition: astobj2.h:729
#define ao2_lock(a)
Definition: astobj2.h:717
static PGresult * result
Definition: cel_pgsql.c:84
#define ast_channel_lock(chan)
Definition: channel.h:2972
#define ast_channel_unlock(chan)
Definition: channel.h:2973
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2368
void conf_bridge_profile_copy(struct bridge_profile *dst, struct bridge_profile *src)
copies a bridge profile
static const struct ast_datastore_info confbridge_datastore
#define DEFAULT_BRIDGE_PROFILE
Definition: confbridge.h:42
Structure for a data store object.
Definition: datastore.h:64
void * data
Definition: datastore.h:66
struct bridge_profile b_profile

References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero(), func_confbridge_data::b_profile, func_confbridge_data::b_usable, cfg_handle, conf_bridge_profile_copy(), confbridge_datastore, ast_datastore::data, DEFAULT_BRIDGE_PROFILE, NULL, OBJ_KEY, RAII_VAR, and result.

Referenced by bridge_template_handler(), confbridge_exec(), and handle_cli_confbridge_show_bridge_profile().

◆ conf_find_menu_entry_by_sequence()

int conf_find_menu_entry_by_sequence ( const char *  dtmf_sequence,
struct conf_menu menu,
struct conf_menu_entry result 
)

Finds a menu_entry in a menu structure matched by DTMF sequence.

Note
the menu entry found must be destroyed using conf_menu_entry_destroy()
Return values
1success, entry is found and stored in result
0failure, no entry found for given DTMF sequence

Definition at line 2836 of file conf_config_parser.c.

2837{
2838 struct conf_menu_entry *menu_entry = NULL;
2839
2840 ao2_lock(menu);
2841 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2842 if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {
2843 copy_menu_entry(result, menu_entry);
2844 ao2_unlock(menu);
2845 return 1;
2846 }
2847 }
2848 ao2_unlock(menu);
2849
2850 return 0;
2851}

References ao2_lock, ao2_unlock, AST_LIST_TRAVERSE, copy_menu_entry(), conf_menu_entry::dtmf, conf_menu::entries, NULL, and result.

Referenced by action_playback_and_continue().

◆ conf_find_user_profile()

const struct user_profile * conf_find_user_profile ( struct ast_channel chan,
const char *  user_profile_name,
struct user_profile result 
)

find a user profile given a user profile's name and store that profile in result structure.

Parameters
chanchannel the user profile is requested for
user_profile_namename of the profile requested (optional)
resultdata contained by the user profile will be copied to this struct pointer

If user_profile_name is not provided, this function will check for the presence of a user profile set by the CONFBRIDGE function on a channel datastore. If that doesn't exist, the default_user profile is used.

Return values
userprofile on success
NULLon failure

Definition at line 2712 of file conf_config_parser.c.

2713{
2714 struct user_profile *tmp2;
2715 struct ast_datastore *datastore = NULL;
2716 struct func_confbridge_data *b_data = NULL;
2718
2719 if (chan && ast_strlen_zero(user_profile_name)) {
2720 ast_channel_lock(chan);
2722 ast_channel_unlock(chan);
2723 if (datastore) {
2724 b_data = datastore->data;
2725 if (b_data->u_usable) {
2727 return result;
2728 }
2729 }
2730 }
2731
2732 if (!cfg) {
2733 return NULL;
2734 }
2735 if (ast_strlen_zero(user_profile_name)) {
2736 user_profile_name = DEFAULT_USER_PROFILE;
2737 }
2738 if (!(tmp2 = ao2_find(cfg->user_profiles, user_profile_name, OBJ_KEY))) {
2739 return NULL;
2740 }
2741 ao2_lock(tmp2);
2743 ao2_unlock(tmp2);
2744 ao2_ref(tmp2, -1);
2745
2746 return result;
2747}
static void conf_user_profile_copy(struct user_profile *dst, struct user_profile *src)
#define DEFAULT_USER_PROFILE
Definition: confbridge.h:41
struct user_profile u_profile

References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero(), cfg_handle, conf_user_profile_copy(), confbridge_datastore, ast_datastore::data, DEFAULT_USER_PROFILE, NULL, OBJ_KEY, RAII_VAR, result, func_confbridge_data::u_profile, and func_confbridge_data::u_usable.

Referenced by conf_send_event_to_participants(), confbridge_exec(), handle_cli_confbridge_show_user_profile(), and user_template_handler().

◆ conf_load_config()

int conf_load_config ( void  )

load confbridge.conf file

Definition at line 2609 of file conf_config_parser.c.

2610{
2611 if (aco_info_init(&cfg_info)) {
2612 return -1;
2613 }
2614
2615 /* User options */
2616 aco_option_register(&cfg_info, "type", ACO_EXACT, user_types, NULL, OPT_NOOP_T, 0, 0);
2617 aco_option_register(&cfg_info, "admin", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ADMIN);
2618 aco_option_register(&cfg_info, "send_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_SEND_EVENTS);
2619 aco_option_register(&cfg_info, "echo_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ECHO_EVENTS);
2620 aco_option_register(&cfg_info, "marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MARKEDUSER);
2621 aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
2622 aco_option_register(&cfg_info, "music_on_hold_when_empty", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MUSICONHOLD);
2623 aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
2624 aco_option_register(&cfg_info, "hear_own_join_sound", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_HEAR_OWN_JOIN_SOUND);
2625 aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
2626 aco_option_register(&cfg_info, "announce_user_count", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCEUSERCOUNT);
2627 /* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
2628 aco_option_register(&cfg_info, "announce_only_user", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 0, FLDSET(struct user_profile, flags), USER_OPT_NOONLYPERSON);
2629 aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
2630 aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
2631 aco_option_register(&cfg_info, "end_marked_any", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKEDANY);
2632 aco_option_register(&cfg_info, "talk_detection_events", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_TALKER_DETECT);
2633 aco_option_register(&cfg_info, "dtmf_passthrough", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DTMF_PASS);
2634 aco_option_register(&cfg_info, "announce_join_leave", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCE_JOIN_LEAVE);
2635 aco_option_register(&cfg_info, "announce_join_leave_review", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW);
2637 aco_option_register(&cfg_info, "music_on_hold_class", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, moh_class));
2638 aco_option_register(&cfg_info, "announcement", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, announcement));
2639 aco_option_register(&cfg_info, "denoise", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DENOISE);
2640 aco_option_register(&cfg_info, "dsp_drop_silence", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DROP_SILENCE);
2641 aco_option_register(&cfg_info, "dsp_silence_threshold", ACO_EXACT, user_types, __stringify(DEFAULT_SILENCE_THRESHOLD), OPT_UINT_T, 0, FLDSET(struct user_profile, silence_threshold));
2642 aco_option_register(&cfg_info, "dsp_talking_threshold", ACO_EXACT, user_types, __stringify(DEFAULT_TALKING_THRESHOLD), OPT_UINT_T, 0, FLDSET(struct user_profile, talking_threshold));
2643 aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
2644 aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));
2645 aco_option_register(&cfg_info, "text_messaging", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_TEXT_MESSAGING);
2646 aco_option_register(&cfg_info, "answer_channel", ACO_EXACT, user_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ANSWER_CHANNEL);
2647
2648 /* This option should only be used with the CONFBRIDGE dialplan function */
2650
2651/* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
2652 /* Bridge options */
2653 aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
2654 aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
2655 aco_option_register_custom(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "auto", sample_rate_handler, 0);
2656 aco_option_register(&cfg_info, "binaural_active", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_BINAURAL_ACTIVE);
2657 aco_option_register_custom(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "none", sample_rate_handler, 0);
2658 aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
2659 aco_option_register(&cfg_info, "record_conference", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_CONFERENCE);
2661 aco_option_register(&cfg_info, "record_file_append", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_FILE_APPEND);
2662 aco_option_register(&cfg_info, "record_file_timestamp", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_RECORD_FILE_TIMESTAMP);
2663 aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
2664 aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
2665 aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
2666 aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
2670 aco_option_register(&cfg_info, "video_update_discard", ACO_EXACT, bridge_types, "2000", OPT_UINT_T, 0, FLDSET(struct bridge_profile, video_update_discard));
2671 aco_option_register(&cfg_info, "remb_send_interval", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_send_interval));
2672 aco_option_register_custom(&cfg_info, "remb_behavior", ACO_EXACT, bridge_types, "average", remb_behavior_handler, 0);
2673 aco_option_register(&cfg_info, "remb_estimated_bitrate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_estimated_bitrate));
2674 aco_option_register(&cfg_info, "enable_events", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_ENABLE_EVENTS);
2675 /* This option should only be used with the CONFBRIDGE dialplan function */
2677
2678 /* Menu options */
2679 aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
2680 /* This option should only be used with the CONFBRIDGE dialplan function */
2682 aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
2683
2684 if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
2685 goto error;
2686 }
2687
2689 goto error;
2690 }
2691
2692 return 0;
2693error:
2695 return -1;
2696}
#define __stringify(x)
Definition: asterisk.h:216
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:349
static char language[MAX_LANGUAGE]
Definition: chan_iax2.c:348
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
static int user_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int remb_behavior_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int announce_user_count_all_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int sample_rate_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct aco_type * user_types[]
static int video_mode_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int sound_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct aco_type * bridge_types[]
static struct aco_type * menu_types[]
void conf_destroy_config(void)
destroy the information loaded from the confbridge.conf file
static int menu_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int menu_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int bridge_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int mix_interval_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_SILENCE_THRESHOLD
Definition: confbridge.h:49
@ USER_OPT_ENDMARKED
Definition: confbridge.h:60
@ USER_OPT_WAITMARKED
Definition: confbridge.h:59
@ USER_OPT_HEAR_OWN_JOIN_SOUND
Definition: confbridge.h:73
@ USER_OPT_TEXT_MESSAGING
Definition: confbridge.h:71
@ USER_OPT_QUIET
Definition: confbridge.h:57
@ USER_OPT_DENOISE
Definition: confbridge.h:61
@ USER_OPT_MARKEDUSER
Definition: confbridge.h:54
@ USER_OPT_DTMF_PASS
Definition: confbridge.h:65
@ USER_OPT_NOONLYPERSON
Definition: confbridge.h:53
@ USER_OPT_TALKER_DETECT
Definition: confbridge.h:63
@ USER_OPT_MUSICONHOLD
Definition: confbridge.h:56
@ USER_OPT_ANNOUNCEUSERCOUNT
Definition: confbridge.h:58
@ USER_OPT_STARTMUTED
Definition: confbridge.h:55
@ USER_OPT_DROP_SILENCE
Definition: confbridge.h:64
@ USER_OPT_ANSWER_CHANNEL
Definition: confbridge.h:72
@ USER_OPT_SEND_EVENTS
Definition: confbridge.h:69
@ USER_OPT_ENDMARKEDANY
Definition: confbridge.h:74
@ USER_OPT_ADMIN
Definition: confbridge.h:52
@ USER_OPT_JITTERBUFFER
Definition: confbridge.h:67
@ USER_OPT_ECHO_EVENTS
Definition: confbridge.h:70
@ USER_OPT_ANNOUNCE_JOIN_LEAVE
Definition: confbridge.h:62
@ USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW
Definition: confbridge.h:68
#define DEFAULT_TALKING_THRESHOLD
Definition: confbridge.h:46
@ BRIDGE_OPT_BINAURAL_ACTIVE
Definition: confbridge.h:84
@ BRIDGE_OPT_RECORD_CONFERENCE
Definition: confbridge.h:78
@ BRIDGE_OPT_RECORD_FILE_TIMESTAMP
Definition: confbridge.h:83
@ BRIDGE_OPT_ENABLE_EVENTS
Definition: confbridge.h:89
@ BRIDGE_OPT_RECORD_FILE_APPEND
Definition: confbridge.h:82
@ ACO_PREFIX
@ ACO_EXACT
@ ACO_REGEX
@ 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 FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_BOOLFLAG_T
Type for default option handler for bools (ast_true/ast_false) that are stored in a flag.
@ OPT_CHAR_ARRAY_T
Type for default option handler for character array strings.
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
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.
int error(const char *format,...)
Definition: utils/frame.c:999

References __stringify, ACO_EXACT, aco_info_init(), aco_option_register, aco_option_register_custom, ACO_PREFIX, aco_process_config(), ACO_PROCESS_ERROR, ACO_REGEX, announce_user_count_all_handler(), ARRAY_LEN, ast_cli_register_multiple, BRIDGE_OPT_BINAURAL_ACTIVE, BRIDGE_OPT_ENABLE_EVENTS, BRIDGE_OPT_RECORD_CONFERENCE, BRIDGE_OPT_RECORD_FILE_APPEND, BRIDGE_OPT_RECORD_FILE_TIMESTAMP, bridge_template_handler(), bridge_types, CHARFLDSET, cli_confbridge_parser, conf_destroy_config(), DEFAULT_SILENCE_THRESHOLD, DEFAULT_TALKING_THRESHOLD, error(), FLDSET, language, menu_option_handler(), menu_template_handler(), menu_types, mix_interval_handler(), NULL, OPT_BOOLFLAG_T, OPT_CHAR_ARRAY_T, OPT_NOOP_T, OPT_UINT_T, regcontext, remb_behavior_handler(), sample_rate_handler(), sound_option_handler(), USER_OPT_ADMIN, USER_OPT_ANNOUNCE_JOIN_LEAVE, USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW, USER_OPT_ANNOUNCEUSERCOUNT, USER_OPT_ANSWER_CHANNEL, USER_OPT_DENOISE, USER_OPT_DROP_SILENCE, USER_OPT_DTMF_PASS, USER_OPT_ECHO_EVENTS, USER_OPT_ENDMARKED, USER_OPT_ENDMARKEDANY, USER_OPT_HEAR_OWN_JOIN_SOUND, USER_OPT_JITTERBUFFER, USER_OPT_MARKEDUSER, USER_OPT_MUSICONHOLD, USER_OPT_NOONLYPERSON, USER_OPT_QUIET, USER_OPT_SEND_EVENTS, USER_OPT_STARTMUTED, USER_OPT_TALKER_DETECT, USER_OPT_TEXT_MESSAGING, USER_OPT_WAITMARKED, user_template_handler(), user_types, and video_mode_handler().

Referenced by load_module().

◆ conf_menu_entry_destroy()

void conf_menu_entry_destroy ( struct conf_menu_entry menu_entry)

Destroys and frees all the actions stored in a menu_entry structure.

Definition at line 2828 of file conf_config_parser.c.

2829{
2830 struct conf_menu_action *menu_action = NULL;
2831 while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
2832 ast_free(menu_action);
2833 }
2834}
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:833

References conf_menu_entry::actions, ast_free, AST_LIST_REMOVE_HEAD, and NULL.

Referenced by action_playback_and_continue(), add_menu_entry(), conf_menu_profile_copy(), and menu_destructor().

◆ conf_menu_profile_copy()

static int conf_menu_profile_copy ( struct conf_menu dst,
struct conf_menu src 
)
static

Definition at line 2505 of file conf_config_parser.c.

2506{
2507 /* Copy each menu item to the dst struct */
2508 struct conf_menu_entry *cur;
2509
2510 AST_LIST_TRAVERSE(&src->entries, cur, entry) {
2511 struct conf_menu_entry *cpy;
2512
2513 if (!(cpy = ast_calloc(1, sizeof(*cpy)))) {
2514 return -1;
2515 }
2516
2517 if (copy_menu_entry(cpy, cur)) {
2519 ast_free(cpy);
2520 return -1;
2521 }
2522 AST_LIST_INSERT_TAIL(&dst->entries, cpy, entry);
2523 }
2524
2525 return 0;
2526}

References ast_calloc, ast_free, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, conf_menu_entry_destroy(), copy_menu_entry(), and conf_menu::entries.

Referenced by menu_template_handler().

◆ conf_reload_config()

int conf_reload_config ( void  )

reload confbridge.conf file

Definition at line 2698 of file conf_config_parser.c.

2699{
2700 if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
2701 /* On a reload, just keep the config we already have in place. */
2702 return -1;
2703 }
2704 return 0;
2705}

References aco_process_config(), and ACO_PROCESS_ERROR.

Referenced by reload().

◆ conf_set_menu_to_user()

int conf_set_menu_to_user ( struct ast_channel chan,
struct confbridge_user user,
const char *  menu_profile_name 
)

find a menu profile given a menu profile's name and apply the menu in DTMF hooks.

Parameters
chanchannel the menu profile is requested for
useruser profile the menu is being applied to
menu_profile_namename of the profile requested (optional)

If menu_profile_name is not provided, this function will check for the presence of a menu profile set by the CONFBRIDGE function on a channel datastore. If that doesn't exist, the default_menu profile is used.

Return values
0on success
-1on failure

Definition at line 2882 of file conf_config_parser.c.

2883{
2885 RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2886
2887 if (chan && ast_strlen_zero(menu_profile_name)) {
2888 struct ast_datastore *datastore;
2889 struct func_confbridge_data *b_data;
2890
2891 ast_channel_lock(chan);
2893 ast_channel_unlock(chan);
2894 if (datastore) {
2895 /* If a menu exists in the CONFBRIDGE function datastore, use it. */
2896 b_data = datastore->data;
2897 if (b_data->m_usable) {
2898 menu = ao2_bump(b_data->menu);
2899 return apply_menu_to_user(user, menu);
2900 }
2901 }
2902 }
2903
2904 /* Otherwise, we need to get whatever menu profile is specified to use (or default). */
2905 if (!cfg) {
2906 return -1;
2907 }
2908
2909 if (ast_strlen_zero(menu_profile_name)) {
2910 menu_profile_name = DEFAULT_MENU_PROFILE;
2911 }
2912
2913 if (!(menu = ao2_find(cfg->menus, menu_profile_name, OBJ_KEY))) {
2914 return -1;
2915 }
2916
2917 return apply_menu_to_user(user, menu);
2918}
static int apply_menu_to_user(struct confbridge_user *user, struct conf_menu *menu)
#define DEFAULT_MENU_PROFILE
Definition: confbridge.h:43
struct conf_menu * menu

References ao2_bump, ao2_cleanup, ao2_find, ao2_global_obj_ref, apply_menu_to_user(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero(), cfg_handle, confbridge_datastore, ast_datastore::data, DEFAULT_MENU_PROFILE, func_confbridge_data::m_usable, func_confbridge_data::menu, NULL, OBJ_KEY, and RAII_VAR.

Referenced by confbridge_exec().

◆ conf_user_profile_copy()

static void conf_user_profile_copy ( struct user_profile dst,
struct user_profile src 
)
static

Definition at line 2707 of file conf_config_parser.c.

2708{
2709 *dst = *src;
2710}

Referenced by conf_find_user_profile().

◆ confbridge_cfg_alloc()

void * confbridge_cfg_alloc ( void  )
static

Definition at line 2251 of file conf_config_parser.c.

2252{
2253 struct confbridge_cfg *cfg;
2254
2255 if (!(cfg = ao2_alloc(sizeof(*cfg), confbridge_cfg_destructor))) {
2256 return NULL;
2257 }
2258
2261 if (!cfg->user_profiles) {
2262 goto error;
2263 }
2264
2267 if (!cfg->bridge_profiles) {
2268 goto error;
2269 }
2270
2273 if (!cfg->menus) {
2274 goto error;
2275 }
2276
2277 return cfg;
2278error:
2279 ao2_ref(cfg, -1);
2280 return NULL;
2281}
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition: astobj2.h:363
#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 int menu_cmp_cb(void *obj, void *arg, int flags)
static int bridge_hash_cb(const void *obj, const int flags)
static int user_cmp_cb(void *obj, void *arg, int flags)
static void confbridge_cfg_destructor(void *obj)
static int bridge_cmp_cb(void *obj, void *arg, int flags)
static int menu_hash_cb(const void *obj, const int flags)
static int user_hash_cb(const void *obj, const int flags)
struct ao2_container * menus
struct ao2_container * bridge_profiles
struct ao2_container * user_profiles

References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, bridge_cmp_cb(), bridge_hash_cb(), confbridge_cfg::bridge_profiles, confbridge_cfg_destructor(), error(), menu_cmp_cb(), menu_hash_cb(), confbridge_cfg::menus, NULL, user_cmp_cb(), user_hash_cb(), and confbridge_cfg::user_profiles.

◆ confbridge_cfg_destructor()

static void confbridge_cfg_destructor ( void *  obj)
static

Definition at line 2243 of file conf_config_parser.c.

2244{
2245 struct confbridge_cfg *cfg = obj;
2248 ao2_cleanup(cfg->menus);
2249}

References ao2_cleanup, confbridge_cfg::bridge_profiles, confbridge_cfg::menus, and confbridge_cfg::user_profiles.

Referenced by confbridge_cfg_alloc().

◆ CONFIG_INFO_STANDARD()

CONFIG_INFO_STANDARD ( cfg_info  ,
cfg_handle  ,
confbridge_cfg_alloc  ,
files = ACO_FILES(&confbridge_conf),
pre_apply_config = verify_default_profiles 
)

◆ copy_menu_entry()

static int copy_menu_entry ( struct conf_menu_entry dst,
struct conf_menu_entry src 
)
static

Definition at line 2485 of file conf_config_parser.c.

2486{
2487 struct conf_menu_action *menu_action;
2488 struct conf_menu_action *new_menu_action;
2489
2490 ast_copy_string(dst->dtmf, src->dtmf, sizeof(dst->dtmf));
2492
2493 AST_LIST_TRAVERSE(&src->actions, menu_action, action) {
2494 if (!(new_menu_action = ast_calloc(1, sizeof(*new_menu_action)))) {
2495 return -1;
2496 }
2497 memcpy(new_menu_action, menu_action, sizeof(*new_menu_action));
2498 AST_LIST_NEXT(new_menu_action, action) = NULL;
2499 AST_LIST_INSERT_TAIL(&dst->actions, new_menu_action, action);
2500 }
2501
2502 return 0;
2503}
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
Definition: linkedlists.h:681
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:439

References conf_menu_entry::actions, ast_calloc, ast_copy_string(), AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_NEXT, AST_LIST_TRAVERSE, conf_menu_entry::dtmf, and NULL.

Referenced by apply_menu_to_user(), conf_find_menu_entry_by_sequence(), and conf_menu_profile_copy().

◆ func_confbridge_data_destructor()

static void func_confbridge_data_destructor ( struct func_confbridge_data b_data)
static

Definition at line 1294 of file conf_config_parser.c.

1295{
1297 ao2_cleanup(b_data->menu);
1298 ast_free(b_data);
1299}
void conf_bridge_profile_destroy(struct bridge_profile *b_profile)
Destroy a bridge profile found by 'conf_find_bridge_profile'.

References ao2_cleanup, ast_free, func_confbridge_data::b_profile, conf_bridge_profile_destroy(), and func_confbridge_data::menu.

Referenced by func_confbridge_destroy_cb().

◆ func_confbridge_destroy_cb()

static void func_confbridge_destroy_cb ( void *  data)
static

Definition at line 1301 of file conf_config_parser.c.

1302{
1303 struct func_confbridge_data *b_data = data;
1305};
static void func_confbridge_data_destructor(struct func_confbridge_data *b_data)

References func_confbridge_data_destructor().

◆ func_confbridge_helper()

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

Definition at line 1312 of file conf_config_parser.c.

1313{
1314 struct ast_datastore *datastore;
1315 struct func_confbridge_data *b_data;
1316 char *parse;
1317 struct ast_variable tmpvar = { 0, };
1318 struct ast_variable template = {
1319 .name = "template",
1320 .file = "CONFBRIDGE"
1321 };
1324 AST_APP_ARG(option);
1325 );
1326
1327 if (!chan) {
1328 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1329 return -1;
1330 }
1331
1332 /* parse all the required arguments and make sure they exist. */
1333 if (ast_strlen_zero(data)) {
1334 return -1;
1335 }
1336 parse = ast_strdupa(data);
1338 if (ast_strlen_zero(args.type) || ast_strlen_zero(args.option)) {
1339 return -1;
1340 }
1341
1342 ast_channel_lock(chan);
1344 if (!datastore) {
1346 if (!datastore) {
1347 ast_channel_unlock(chan);
1348 return 0;
1349 }
1350 b_data = ast_calloc(1, sizeof(*b_data));
1351 if (!b_data) {
1352 ast_channel_unlock(chan);
1353 ast_datastore_free(datastore);
1354 return 0;
1355 }
1356 datastore->data = b_data;
1358 if (!b_data->b_profile.sounds) {
1359 ast_channel_unlock(chan);
1360 ast_datastore_free(datastore);
1361 return 0;
1362 }
1363 if (!(b_data->menu = menu_alloc("dialplan"))) {
1364 ast_channel_unlock(chan);
1365 ast_datastore_free(datastore);
1366 return 0;
1367 }
1368 ast_channel_datastore_add(chan, datastore);
1369 } else {
1370 b_data = datastore->data;
1371 }
1372 ast_channel_unlock(chan);
1373
1374 /* SET(CONFBRIDGE(type,option)=value) */
1375 if (!value) {
1376 value = "";
1377 }
1378 tmpvar.name = args.option;
1379 tmpvar.value = value;
1380 tmpvar.file = "CONFBRIDGE";
1381 if (!strcasecmp(args.type, "bridge")) {
1382 if (!strcasecmp(args.option, "clear")) {
1383 b_data->b_usable = 0;
1385 memset(&b_data->b_profile, 0, sizeof(b_data->b_profile)) ;
1386 if (!(b_data->b_profile.sounds = bridge_profile_sounds_alloc())) {
1387 /* If this reallocation fails, the datastore has become unusable and must be destroyed. */
1388 ast_channel_lock(chan);
1389 ast_channel_datastore_remove(chan, datastore);
1390 ast_channel_unlock(chan);
1391 ast_datastore_free(datastore);
1392 }
1393 return 0;
1394 }
1395
1396 if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) {
1397 template.value = DEFAULT_BRIDGE_PROFILE;
1398 aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile);
1399 }
1400
1401 if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
1402 b_data->b_usable = 1;
1403 return 0;
1404 }
1405 } else if (!strcasecmp(args.type, "user")) {
1406 if (!strcasecmp(args.option, "clear")) {
1407 b_data->u_usable = 0;
1409 memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
1410 return 0;
1411 }
1412
1413 if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) {
1414 template.value = DEFAULT_USER_PROFILE;
1415 aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile);
1416 }
1417
1418 if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
1419 b_data->u_usable = 1;
1420 return 0;
1421 }
1422 } else if (!strcasecmp(args.type, "menu")) {
1423 if (!strcasecmp(args.option, "clear")) {
1424 b_data->m_usable = 0;
1425 ao2_cleanup(b_data->menu);
1426 if (!(b_data->menu = menu_alloc("dialplan"))) {
1427 /* If this reallocation fails, the datastore has become unusable and must be destroyed */
1428 ast_channel_lock(chan);
1429 ast_channel_datastore_remove(chan, datastore);
1430 ast_channel_unlock(chan);
1431 ast_datastore_free(datastore);
1432 }
1433 return 0;
1434 }
1435
1436 if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) {
1437 template.value = DEFAULT_MENU_PROFILE;
1438 aco_process_var(&menu_type, "dialplan", &template, &b_data->menu);
1439 }
1440
1441 if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
1442 b_data->m_usable = 1;
1443 return 0;
1444 }
1445 }
1446
1447 ast_log(LOG_WARNING, "%s(%s,%s) cannot be set to '%s'. Invalid type, option, or value.\n",
1448 cmd, args.type, args.option, value);
1449 return -1;
1450}
#define ast_log
Definition: astobj2.c:42
static const char type[]
Definition: chan_ooh323.c:109
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2354
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2363
static struct aco_type bridge_type
static void * menu_alloc(const char *category)
static void user_profile_destructor(void *obj)
static struct aco_type menu_type
static struct aco_type user_type
int aco_process_var(struct aco_type *type, const char *cat, struct ast_variable *var, void *obj)
Parse a single ast_variable and apply it to an object.
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:85
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:68
#define LOG_WARNING
Structure for variables, used for configurations and for channel variables.
int value
Definition: syslog.c:37

References aco_process_var(), ao2_cleanup, args, AST_APP_ARG, ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), func_confbridge_data::b_profile, func_confbridge_data::b_usable, bridge_profile_sounds_alloc(), bridge_type, conf_bridge_profile_destroy(), confbridge_datastore, ast_datastore::data, DEFAULT_BRIDGE_PROFILE, DEFAULT_MENU_PROFILE, DEFAULT_USER_PROFILE, ast_variable::file, LOG_WARNING, func_confbridge_data::m_usable, func_confbridge_data::menu, menu_alloc(), menu_type, ast_variable::name, NULL, bridge_profile::sounds, type, func_confbridge_data::u_profile, func_confbridge_data::u_usable, user_profile_destructor(), user_type, ast_variable::value, and value.

◆ handle_cli_confbridge_show_bridge_profile()

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

Definition at line 1887 of file conf_config_parser.c.

1888{
1889 struct bridge_profile b_profile;
1890 char tmp[64];
1891
1892 switch (cmd) {
1893 case CLI_INIT:
1894 e->command = "confbridge show profile bridge";
1895 e->usage =
1896 "Usage: confbridge show profile bridge <profile name>\n";
1897 return NULL;
1898 case CLI_GENERATE:
1899 if (a->pos == 4) {
1900 return complete_bridge_profile_name(a->line, a->word, a->pos, a->n);
1901 }
1902 return NULL;
1903 }
1904
1905 if (a->argc != 5) {
1906 return CLI_SHOWUSAGE;
1907 }
1908
1909 if (!(conf_find_bridge_profile(NULL, a->argv[4], &b_profile))) {
1910 ast_cli(a->fd, "No conference bridge profile named '%s' found!\n", a->argv[4]);
1911 return CLI_SUCCESS;
1912 }
1913
1914 ast_cli(a->fd,"--------------------------------------------\n");
1915 ast_cli(a->fd,"Name: %s\n", b_profile.name);
1916 ast_cli(a->fd,"Language: %s\n", b_profile.language);
1917
1918 if (b_profile.internal_sample_rate) {
1919 snprintf(tmp, sizeof(tmp), "%u", b_profile.internal_sample_rate);
1920 } else {
1921 ast_copy_string(tmp, "auto", sizeof(tmp));
1922 }
1923 ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
1924
1925 if (b_profile.maximum_sample_rate) {
1926 snprintf(tmp, sizeof(tmp), "%u", b_profile.maximum_sample_rate);
1927 } else {
1928 ast_copy_string(tmp, "none", sizeof(tmp));
1929 }
1930 ast_cli(a->fd,"Maximum Sample Rate: %s\n", tmp);
1931
1932 if (b_profile.mix_interval) {
1933 ast_cli(a->fd,"Mixing Interval: %u\n", b_profile.mix_interval);
1934 } else {
1935 ast_cli(a->fd,"Mixing Interval: Default 20ms\n");
1936 }
1937
1938 ast_cli(a->fd,"Record Conference: %s\n",
1939 b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
1940 "yes" : "no");
1941
1942 ast_cli(a->fd,"Record File Append: %s\n",
1943 b_profile.flags & BRIDGE_OPT_RECORD_FILE_APPEND ?
1944 "yes" : "no");
1945
1946 ast_cli(a->fd,"Record File Timestamp: %s\n",
1947 b_profile.flags & BRIDGE_OPT_RECORD_FILE_TIMESTAMP ?
1948 "yes" : "no");
1949
1950 ast_cli(a->fd,"Record File: %s\n",
1951 ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
1952 b_profile.rec_file);
1953
1954 ast_cli(a->fd,"Record Options: %s\n",
1955 b_profile.rec_options);
1956
1957 ast_cli(a->fd,"Record Command: %s\n",
1958 b_profile.rec_command);
1959
1960 if (b_profile.max_members) {
1961 ast_cli(a->fd,"Max Members: %u\n", b_profile.max_members);
1962 } else {
1963 ast_cli(a->fd,"Max Members: No Limit\n");
1964 }
1965
1966 ast_cli(a->fd,"Registration context: %s\n", b_profile.regcontext);
1967
1968 switch (b_profile.flags
1974 ast_cli(a->fd, "Video Mode: last_marked\n");
1975 break;
1977 ast_cli(a->fd, "Video Mode: first_marked\n");
1978 break;
1980 ast_cli(a->fd, "Video Mode: follow_talker\n");
1981 break;
1983 ast_cli(a->fd, "Video Mode: sfu\n");
1984 break;
1985 case 0:
1986 ast_cli(a->fd, "Video Mode: no video\n");
1987 break;
1988 default:
1989 /* Opps. We have more than one video mode flag set. */
1990 ast_assert(0);
1991 break;
1992 }
1993
1994 ast_cli(a->fd,"Video Update Discard: %u\n", b_profile.video_update_discard);
1995 ast_cli(a->fd,"REMB Send Interval: %u\n", b_profile.remb_send_interval);
1996
1997 switch (b_profile.flags
2002 ast_cli(a->fd, "REMB Behavior: average\n");
2003 break;
2005 ast_cli(a->fd, "REMB Behavior: lowest\n");
2006 break;
2008 ast_cli(a->fd, "REMB Behavior: highest\n");
2009 break;
2011 ast_cli(a->fd, "REMB Behavior: average_all\n");
2012 break;
2014 ast_cli(a->fd, "REMB Behavior: lowest_all\n");
2015 break;
2017 ast_cli(a->fd, "REMB Behavior: highest_all\n");
2018 break;
2019 default:
2020 ast_assert(0);
2021 break;
2022 }
2023
2024 ast_cli(a->fd,"Enable Events: %s\n",
2025 b_profile.flags & BRIDGE_OPT_ENABLE_EVENTS ?
2026 "yes" : "no");
2027
2028 ast_cli(a->fd,"sound_only_person: %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
2029 ast_cli(a->fd,"sound_only_one: %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
2030 ast_cli(a->fd,"sound_has_joined: %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
2031 ast_cli(a->fd,"sound_has_left: %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));
2032 ast_cli(a->fd,"sound_kicked: %s\n", conf_get_sound(CONF_SOUND_KICKED, b_profile.sounds));
2033 ast_cli(a->fd,"sound_muted: %s\n", conf_get_sound(CONF_SOUND_MUTED, b_profile.sounds));
2034 ast_cli(a->fd,"sound_unmuted: %s\n", conf_get_sound(CONF_SOUND_UNMUTED, b_profile.sounds));
2035 ast_cli(a->fd,"sound_binaural_on: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_ON, b_profile.sounds));
2036 ast_cli(a->fd,"sound_binaural_off: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_OFF, b_profile.sounds));
2037 ast_cli(a->fd,"sound_there_are: %s\n", conf_get_sound(CONF_SOUND_THERE_ARE, b_profile.sounds));
2038 ast_cli(a->fd,"sound_other_in_party: %s\n", conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, b_profile.sounds));
2039 ast_cli(a->fd,"sound_place_into_conference: %s\n", conf_get_sound(CONF_SOUND_PLACE_IN_CONF, b_profile.sounds));
2040 ast_cli(a->fd,"sound_wait_for_leader: %s\n", conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, b_profile.sounds));
2041 ast_cli(a->fd,"sound_leader_has_left: %s\n", conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, b_profile.sounds));
2042 ast_cli(a->fd,"sound_get_pin: %s\n", conf_get_sound(CONF_SOUND_GET_PIN, b_profile.sounds));
2043 ast_cli(a->fd,"sound_invalid_pin: %s\n", conf_get_sound(CONF_SOUND_INVALID_PIN, b_profile.sounds));
2044 ast_cli(a->fd,"sound_locked: %s\n", conf_get_sound(CONF_SOUND_LOCKED, b_profile.sounds));
2045 ast_cli(a->fd,"sound_unlocked_now: %s\n", conf_get_sound(CONF_SOUND_UNLOCKED_NOW, b_profile.sounds));
2046 ast_cli(a->fd,"sound_lockednow: %s\n", conf_get_sound(CONF_SOUND_LOCKED_NOW, b_profile.sounds));
2047 ast_cli(a->fd,"sound_error_menu: %s\n", conf_get_sound(CONF_SOUND_ERROR_MENU, b_profile.sounds));
2048 ast_cli(a->fd,"sound_join: %s\n", conf_get_sound(CONF_SOUND_JOIN, b_profile.sounds));
2049 ast_cli(a->fd,"sound_leave: %s\n", conf_get_sound(CONF_SOUND_LEAVE, b_profile.sounds));
2050 ast_cli(a->fd,"sound_participants_muted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, b_profile.sounds));
2051 ast_cli(a->fd,"sound_participants_unmuted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, b_profile.sounds));
2052 ast_cli(a->fd,"sound_begin: %s\n", conf_get_sound(CONF_SOUND_BEGIN, b_profile.sounds));
2053 ast_cli(a->fd,"\n");
2054
2055 conf_bridge_profile_destroy(&b_profile);
2056 return CLI_SUCCESS;
2057}
const char * conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
Looks to see if sound file is stored in bridge profile sounds, if not default sound is provided.
#define CLI_SHOWUSAGE
Definition: cli.h:45
#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
static char * complete_bridge_profile_name(const char *line, const char *word, int pos, int state)
@ CONF_SOUND_JOIN
Definition: confbridge.h:188
@ CONF_SOUND_OTHER_IN_PARTY
Definition: confbridge.h:177
@ CONF_SOUND_INVALID_PIN
Definition: confbridge.h:182
@ CONF_SOUND_LOCKED_NOW
Definition: confbridge.h:185
@ CONF_SOUND_THERE_ARE
Definition: confbridge.h:176
@ CONF_SOUND_ONLY_ONE
Definition: confbridge.h:175
@ CONF_SOUND_GET_PIN
Definition: confbridge.h:181
@ CONF_SOUND_ERROR_MENU
Definition: confbridge.h:187
@ CONF_SOUND_PARTICIPANTS_UNMUTED
Definition: confbridge.h:191
@ CONF_SOUND_BINAURAL_ON
Definition: confbridge.h:193
@ CONF_SOUND_ONLY_PERSON
Definition: confbridge.h:183
@ CONF_SOUND_BEGIN
Definition: confbridge.h:192
@ CONF_SOUND_PARTICIPANTS_MUTED
Definition: confbridge.h:190
@ CONF_SOUND_WAIT_FOR_LEADER
Definition: confbridge.h:179
@ CONF_SOUND_HAS_LEFT
Definition: confbridge.h:171
@ CONF_SOUND_BINAURAL_OFF
Definition: confbridge.h:194
@ CONF_SOUND_LEAVE
Definition: confbridge.h:189
@ CONF_SOUND_LEADER_HAS_LEFT
Definition: confbridge.h:180
@ CONF_SOUND_PLACE_IN_CONF
Definition: confbridge.h:178
@ CONF_SOUND_HAS_JOINED
Definition: confbridge.h:170
@ CONF_SOUND_UNLOCKED_NOW
Definition: confbridge.h:186
@ CONF_SOUND_UNMUTED
Definition: confbridge.h:174
@ CONF_SOUND_MUTED
Definition: confbridge.h:173
@ CONF_SOUND_LOCKED
Definition: confbridge.h:184
@ CONF_SOUND_KICKED
Definition: confbridge.h:172
@ BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE
Definition: confbridge.h:86
@ BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL
Definition: confbridge.h:92
@ BRIDGE_OPT_REMB_BEHAVIOR_LOWEST
Definition: confbridge.h:87
@ BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER
Definition: confbridge.h:81
@ BRIDGE_OPT_VIDEO_SRC_LAST_MARKED
Definition: confbridge.h:79
@ BRIDGE_OPT_VIDEO_SRC_SFU
Definition: confbridge.h:85
@ BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL
Definition: confbridge.h:91
@ BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL
Definition: confbridge.h:90
@ BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST
Definition: confbridge.h:88
@ BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
Definition: confbridge.h:80
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
const char * name
static struct test_val a

References a, ast_assert, ast_cli(), ast_copy_string(), ast_strlen_zero(), BRIDGE_OPT_ENABLE_EVENTS, BRIDGE_OPT_RECORD_CONFERENCE, BRIDGE_OPT_RECORD_FILE_APPEND, BRIDGE_OPT_RECORD_FILE_TIMESTAMP, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL, BRIDGE_OPT_REMB_BEHAVIOR_LOWEST, BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED, BRIDGE_OPT_VIDEO_SRC_SFU, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_bridge_profile_name(), conf_bridge_profile_destroy(), conf_find_bridge_profile(), conf_get_sound(), CONF_SOUND_BEGIN, CONF_SOUND_BINAURAL_OFF, CONF_SOUND_BINAURAL_ON, CONF_SOUND_ERROR_MENU, CONF_SOUND_GET_PIN, CONF_SOUND_HAS_JOINED, CONF_SOUND_HAS_LEFT, CONF_SOUND_INVALID_PIN, CONF_SOUND_JOIN, CONF_SOUND_KICKED, CONF_SOUND_LEADER_HAS_LEFT, CONF_SOUND_LEAVE, CONF_SOUND_LOCKED, CONF_SOUND_LOCKED_NOW, CONF_SOUND_MUTED, CONF_SOUND_ONLY_ONE, CONF_SOUND_ONLY_PERSON, CONF_SOUND_OTHER_IN_PARTY, CONF_SOUND_PARTICIPANTS_MUTED, CONF_SOUND_PARTICIPANTS_UNMUTED, CONF_SOUND_PLACE_IN_CONF, CONF_SOUND_THERE_ARE, CONF_SOUND_UNLOCKED_NOW, CONF_SOUND_UNMUTED, CONF_SOUND_WAIT_FOR_LEADER, bridge_profile::flags, bridge_profile::internal_sample_rate, bridge_profile::language, bridge_profile::max_members, bridge_profile::maximum_sample_rate, bridge_profile::mix_interval, bridge_profile::name, NULL, bridge_profile::rec_command, bridge_profile::rec_file, bridge_profile::rec_options, bridge_profile::regcontext, bridge_profile::remb_send_interval, bridge_profile::sounds, ast_cli_entry::usage, and bridge_profile::video_update_discard.

◆ handle_cli_confbridge_show_bridge_profiles()

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

Definition at line 1854 of file conf_config_parser.c.

1855{
1856 struct ao2_iterator it;
1857 struct bridge_profile *b_profile;
1858 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1859
1860 switch (cmd) {
1861 case CLI_INIT:
1862 e->command = "confbridge show profile bridges";
1863 e->usage =
1864 "Usage: confbridge show profile bridges\n";
1865 return NULL;
1866 case CLI_GENERATE:
1867 return NULL;
1868 }
1869
1870 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1871 return NULL;
1872 }
1873
1874 ast_cli(a->fd,"--------- Bridge Profiles -----------\n");
1875 ao2_lock(cfg->bridge_profiles);
1876 it = ao2_iterator_init(cfg->bridge_profiles, 0);
1877 while ((b_profile = ao2_iterator_next(&it))) {
1878 ast_cli(a->fd,"%s\n", b_profile->name);
1879 ao2_ref(b_profile, -1);
1880 }
1882 ao2_unlock(cfg->bridge_profiles);
1883
1884 return CLI_SUCCESS;
1885}

References a, ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), cfg_handle, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, bridge_profile::name, NULL, RAII_VAR, and ast_cli_entry::usage.

◆ handle_cli_confbridge_show_menu()

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

Definition at line 2119 of file conf_config_parser.c.

2120{
2121 RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2122 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
2123 struct conf_menu_entry *menu_entry = NULL;
2124 struct conf_menu_action *menu_action = NULL;
2125
2126 switch (cmd) {
2127 case CLI_INIT:
2128 e->command = "confbridge show menu";
2129 e->usage =
2130 "Usage: confbridge show menu [<menu name>]\n";
2131 return NULL;
2132 case CLI_GENERATE:
2133 if (a->pos == 3) {
2134 return complete_menu_name(a->line, a->word, a->pos, a->n);
2135 }
2136 return NULL;
2137 }
2138
2139 if (a->argc != 4) {
2140 return CLI_SHOWUSAGE;
2141 }
2142
2143 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
2144 return NULL;
2145 }
2146
2147 if (!(menu = menu_find(cfg->menus, a->argv[3]))) {
2148 ast_cli(a->fd, "No conference menu named '%s' found!\n", a->argv[3]);
2149 return CLI_SUCCESS;
2150 }
2151 ao2_lock(menu);
2152
2153 ast_cli(a->fd,"Name: %s\n", menu->name);
2154 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2155 int action_num = 0;
2156 ast_cli(a->fd, "%s=", menu_entry->dtmf);
2157 AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
2158 if (action_num) {
2159 ast_cli(a->fd, ", ");
2160 }
2161 switch (menu_action->id) {
2163 ast_cli(a->fd, "toggle_mute");
2164 break;
2166 ast_cli(a->fd, "toggle_binaural");
2167 break;
2168 case MENU_ACTION_NOOP:
2169 ast_cli(a->fd, "no_op");
2170 break;
2172 ast_cli(a->fd, "increase_listening_volume");
2173 break;
2175 ast_cli(a->fd, "decrease_listening_volume");
2176 break;
2178 ast_cli(a->fd, "reset_listening_volume");
2179 break;
2181 ast_cli(a->fd, "reset_talking_volume");
2182 break;
2184 ast_cli(a->fd, "increase_talking_volume");
2185 break;
2187 ast_cli(a->fd, "decrease_talking_volume");
2188 break;
2190 ast_cli(a->fd, "playback(%s)", menu_action->data.playback_file);
2191 break;
2193 ast_cli(a->fd, "playback_and_continue(%s)", menu_action->data.playback_file);
2194 break;
2196 ast_cli(a->fd, "dialplan_exec(%s,%s,%d)",
2197 menu_action->data.dialplan_args.context,
2198 menu_action->data.dialplan_args.exten,
2199 menu_action->data.dialplan_args.priority);
2200 break;
2202 ast_cli(a->fd, "admin_toggle_conference_lock");
2203 break;
2205 ast_cli(a->fd, "admin_toggle_mute_participants");
2206 break;
2208 ast_cli(a->fd, "participant_count");
2209 break;
2211 ast_cli(a->fd, "admin_kick_last");
2212 break;
2213 case MENU_ACTION_LEAVE:
2214 ast_cli(a->fd, "leave_conference");
2215 break;
2217 ast_cli(a->fd, "set_as_single_video_src");
2218 break;
2220 ast_cli(a->fd, "release_as_single_video_src");
2221 break;
2222 }
2223 action_num++;
2224 }
2225 ast_cli(a->fd,"\n");
2226 }
2227
2228
2229 ao2_unlock(menu);
2230 return CLI_SUCCESS;
2231}
static void * menu_find(struct ao2_container *container, const char *category)
static char * complete_menu_name(const char *line, const char *word, int pos, int state)

References a, conf_menu_entry::actions, ao2_cleanup, ao2_global_obj_ref, ao2_lock, ao2_unlock, ast_cli(), AST_LIST_TRAVERSE, cfg_handle, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_menu_name(), conf_menu_action::context, conf_menu_action::data, conf_menu_action::dialplan_args, conf_menu_entry::dtmf, conf_menu_action::exten, conf_menu_action::id, MENU_ACTION_ADMIN_KICK_LAST, MENU_ACTION_ADMIN_TOGGLE_LOCK, MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, MENU_ACTION_DECREASE_LISTENING, MENU_ACTION_DECREASE_TALKING, MENU_ACTION_DIALPLAN_EXEC, MENU_ACTION_INCREASE_LISTENING, MENU_ACTION_INCREASE_TALKING, MENU_ACTION_LEAVE, MENU_ACTION_NOOP, MENU_ACTION_PARTICIPANT_COUNT, MENU_ACTION_PLAYBACK, MENU_ACTION_PLAYBACK_AND_CONTINUE, MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC, MENU_ACTION_RESET_LISTENING, MENU_ACTION_RESET_TALKING, MENU_ACTION_SET_SINGLE_VIDEO_SRC, MENU_ACTION_TOGGLE_BINAURAL, MENU_ACTION_TOGGLE_MUTE, menu_find(), test_val::name, NULL, conf_menu_action::playback_file, conf_menu_action::priority, RAII_VAR, and ast_cli_entry::usage.

◆ handle_cli_confbridge_show_menus()

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

Definition at line 2086 of file conf_config_parser.c.

2087{
2088 struct ao2_iterator it;
2089 struct conf_menu *menu;
2090 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
2091
2092 switch (cmd) {
2093 case CLI_INIT:
2094 e->command = "confbridge show menus";
2095 e->usage =
2096 "Usage: confbridge show profile menus\n";
2097 return NULL;
2098 case CLI_GENERATE:
2099 return NULL;
2100 }
2101
2102 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
2103 return NULL;
2104 }
2105
2106 ast_cli(a->fd,"--------- Menus -----------\n");
2107 ao2_lock(cfg->menus);
2108 it = ao2_iterator_init(cfg->menus, 0);
2109 while ((menu = ao2_iterator_next(&it))) {
2110 ast_cli(a->fd,"%s\n", menu->name);
2111 ao2_ref(menu, -1);
2112 }
2114 ao2_unlock(cfg->menus);
2115
2116 return CLI_SUCCESS;
2117}

References a, ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), cfg_handle, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, conf_menu::name, NULL, RAII_VAR, and ast_cli_entry::usage.

◆ handle_cli_confbridge_show_user_profile()

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

Definition at line 1717 of file conf_config_parser.c.

1718{
1719 struct user_profile u_profile;
1720
1721 switch (cmd) {
1722 case CLI_INIT:
1723 e->command = "confbridge show profile user";
1724 e->usage =
1725 "Usage: confbridge show profile user [<profile name>]\n";
1726 return NULL;
1727 case CLI_GENERATE:
1728 if (a->pos == 4) {
1729 return complete_user_profile_name(a->line, a->word, a->pos, a->n);
1730 }
1731 return NULL;
1732 }
1733
1734 if (a->argc != 5) {
1735 return CLI_SHOWUSAGE;
1736 }
1737
1738 if (!(conf_find_user_profile(NULL, a->argv[4], &u_profile))) {
1739 ast_cli(a->fd, "No conference user profile named '%s' found!\n", a->argv[4]);
1740 return CLI_SUCCESS;
1741 }
1742
1743 ast_cli(a->fd,"--------------------------------------------\n");
1744 ast_cli(a->fd,"Name: %s\n",
1745 u_profile.name);
1746 ast_cli(a->fd,"Admin: %s\n",
1747 u_profile.flags & USER_OPT_ADMIN ?
1748 "true" : "false");
1749 ast_cli(a->fd,"Send Events: %s\n",
1750 u_profile.flags & USER_OPT_SEND_EVENTS ?
1751 "true" : "false");
1752 ast_cli(a->fd,"Echo Events: %s\n",
1753 u_profile.flags & USER_OPT_ECHO_EVENTS ?
1754 "true" : "false");
1755 ast_cli(a->fd,"Marked User: %s\n",
1756 u_profile.flags & USER_OPT_MARKEDUSER ?
1757 "true" : "false");
1758 ast_cli(a->fd,"Start Muted: %s\n",
1759 u_profile.flags & USER_OPT_STARTMUTED?
1760 "true" : "false");
1761 ast_cli(a->fd,"MOH When Empty: %s\n",
1762 u_profile.flags & USER_OPT_MUSICONHOLD ?
1763 "enabled" : "disabled");
1764 ast_cli(a->fd,"MOH Class: %s\n",
1765 ast_strlen_zero(u_profile.moh_class) ?
1766 "default" : u_profile.moh_class);
1767 ast_cli(a->fd,"Announcement: %s\n",
1768 u_profile.announcement);
1769 ast_cli(a->fd,"Quiet: %s\n",
1770 u_profile.flags & USER_OPT_QUIET ?
1771 "enabled" : "disabled");
1772 ast_cli(a->fd,"Hear Join: %s\n",
1773 u_profile.flags & USER_OPT_HEAR_OWN_JOIN_SOUND ?
1774 "enabled" : "disabled");
1775 ast_cli(a->fd,"Wait Marked: %s\n",
1776 u_profile.flags & USER_OPT_WAITMARKED ?
1777 "enabled" : "disabled");
1778 ast_cli(a->fd,"END Marked (All): %s\n",
1779 u_profile.flags & USER_OPT_ENDMARKED ?
1780 "enabled" : "disabled");
1781 ast_cli(a->fd,"END Marked (Any): %s\n",
1782 u_profile.flags & USER_OPT_ENDMARKEDANY ?
1783 "enabled" : "disabled");
1784 ast_cli(a->fd,"Drop_silence: %s\n",
1785 u_profile.flags & USER_OPT_DROP_SILENCE ?
1786 "enabled" : "disabled");
1787 ast_cli(a->fd,"Silence Threshold: %ums\n",
1788 u_profile.silence_threshold);
1789 ast_cli(a->fd,"Talking Threshold: %u\n",
1790 u_profile.talking_threshold);
1791 ast_cli(a->fd,"Denoise: %s\n",
1792 u_profile.flags & USER_OPT_DENOISE ?
1793 "enabled" : "disabled");
1794 ast_cli(a->fd,"Jitterbuffer: %s\n",
1795 u_profile.flags & USER_OPT_JITTERBUFFER ?
1796 "enabled" : "disabled");
1797 ast_cli(a->fd,"Talk Detect Events: %s\n",
1798 u_profile.flags & USER_OPT_TALKER_DETECT ?
1799 "enabled" : "disabled");
1800 ast_cli(a->fd,"DTMF Pass Through: %s\n",
1801 u_profile.flags & USER_OPT_DTMF_PASS ?
1802 "enabled" : "disabled");
1803 ast_cli(a->fd,"PIN: %s\n",
1804 ast_strlen_zero(u_profile.pin) ?
1805 "None" : u_profile.pin);
1806 ast_cli(a->fd,"Announce User Count: %s\n",
1807 u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNT ?
1808 "enabled" : "disabled");
1809 ast_cli(a->fd,"Announce join/leave: %s\n",
1811 u_profile.flags & USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW ?
1812 "enabled (with review)" : "enabled" : "disabled");
1813 ast_cli(a->fd,"Announce User Count all: %s\n",
1814 u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?
1815 "enabled" : "disabled");
1816 ast_cli(a->fd,"Text Messaging: %s\n",
1817 u_profile.flags & USER_OPT_TEXT_MESSAGING ?
1818 "enabled" : "disabled");
1819 ast_cli(a->fd,"Answer Channel: %s\n",
1820 u_profile.flags & USER_OPT_ANSWER_CHANNEL ?
1821 "true" : "false");
1822 ast_cli(a->fd, "\n");
1823
1824 return CLI_SUCCESS;
1825}
static char * complete_user_profile_name(const char *line, const char *word, int pos, int state)
const struct user_profile * conf_find_user_profile(struct ast_channel *chan, const char *user_profile_name, struct user_profile *result)
find a user profile given a user profile's name and store that profile in result structure.

References a, user_profile::announcement, ast_cli(), ast_strlen_zero(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_user_profile_name(), conf_find_user_profile(), user_profile::flags, user_profile::moh_class, user_profile::name, NULL, user_profile::pin, user_profile::silence_threshold, user_profile::talking_threshold, ast_cli_entry::usage, USER_OPT_ADMIN, USER_OPT_ANNOUNCE_JOIN_LEAVE, USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW, USER_OPT_ANNOUNCEUSERCOUNT, USER_OPT_ANNOUNCEUSERCOUNTALL, USER_OPT_ANSWER_CHANNEL, USER_OPT_DENOISE, USER_OPT_DROP_SILENCE, USER_OPT_DTMF_PASS, USER_OPT_ECHO_EVENTS, USER_OPT_ENDMARKED, USER_OPT_ENDMARKEDANY, USER_OPT_HEAR_OWN_JOIN_SOUND, USER_OPT_JITTERBUFFER, USER_OPT_MARKEDUSER, USER_OPT_MUSICONHOLD, USER_OPT_QUIET, USER_OPT_SEND_EVENTS, USER_OPT_STARTMUTED, USER_OPT_TALKER_DETECT, USER_OPT_TEXT_MESSAGING, and USER_OPT_WAITMARKED.

◆ handle_cli_confbridge_show_user_profiles()

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

Definition at line 1685 of file conf_config_parser.c.

1686{
1687 struct ao2_iterator it;
1688 struct user_profile *u_profile;
1689 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1690
1691 switch (cmd) {
1692 case CLI_INIT:
1693 e->command = "confbridge show profile users";
1694 e->usage =
1695 "Usage: confbridge show profile users\n";
1696 return NULL;
1697 case CLI_GENERATE:
1698 return NULL;
1699 }
1700
1701 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1702 return NULL;
1703 }
1704
1705 ast_cli(a->fd,"--------- User Profiles -----------\n");
1706 ao2_lock(cfg->user_profiles);
1707 it = ao2_iterator_init(cfg->user_profiles, 0);
1708 while ((u_profile = ao2_iterator_next(&it))) {
1709 ast_cli(a->fd,"%s\n", u_profile->name);
1710 ao2_ref(u_profile, -1);
1711 }
1713 ao2_unlock(cfg->user_profiles);
1714
1715 return CLI_SUCCESS;
1716}

References a, ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), cfg_handle, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, user_profile::name, NULL, RAII_VAR, and ast_cli_entry::usage.

◆ menu_alloc()

static void * menu_alloc ( const char *  category)
static

Definition at line 989 of file conf_config_parser.c.

990{
991 struct conf_menu *menu;
992 if (!(menu = ao2_alloc(sizeof(*menu), menu_destructor))) {
993 return NULL;
994 }
995 ast_copy_string(menu->name, category, sizeof(menu->name));
996 return menu;
997}
static void menu_destructor(void *obj)

References ao2_alloc, ast_copy_string(), menu_destructor(), conf_menu::name, and NULL.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ menu_cmp_cb()

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

menu container functions

Definition at line 1090 of file conf_config_parser.c.

1091{
1092 const struct conf_menu *left = obj;
1093 const struct conf_menu *right = arg;
1094 const char *right_name = arg;
1095 int cmp;
1096
1097 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1098 default:
1099 case OBJ_POINTER:
1100 right_name = right->name;
1101 /* Fall through */
1102 case OBJ_KEY:
1103 cmp = strcasecmp(left->name, right_name);
1104 break;
1105 case OBJ_PARTIAL_KEY:
1106 cmp = strncasecmp(left->name, right_name, strlen(right_name));
1107 break;
1108 }
1109 return cmp ? 0 : CMP_MATCH;
1110}

References CMP_MATCH, conf_menu::name, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by confbridge_cfg_alloc().

◆ menu_destructor()

static void menu_destructor ( void *  obj)
static

Definition at line 1135 of file conf_config_parser.c.

1136{
1137 struct conf_menu *menu = obj;
1138 struct conf_menu_entry *entry = NULL;
1139
1140 while ((entry = AST_LIST_REMOVE_HEAD(&menu->entries, entry))) {
1142 ast_free(entry);
1143 }
1144}

References ast_free, AST_LIST_REMOVE_HEAD, conf_menu_entry_destroy(), conf_menu::entries, conf_menu_entry::entry, and NULL.

Referenced by menu_alloc().

◆ menu_find()

static void * menu_find ( struct ao2_container container,
const char *  category 
)
static

Definition at line 999 of file conf_config_parser.c.

1000{
1001 return ao2_find(container, category, OBJ_KEY);
1002}

References ao2_find, container, and OBJ_KEY.

Referenced by handle_cli_confbridge_show_menu().

◆ menu_hash_cb()

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

Definition at line 1112 of file conf_config_parser.c.

1113{
1114 const struct conf_menu *menu = obj;
1115 const char *name = obj;
1116 int hash;
1117
1118 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1119 default:
1120 case OBJ_POINTER:
1121 name = menu->name;
1122 /* Fall through */
1123 case OBJ_KEY:
1124 hash = ast_str_case_hash(name);
1125 break;
1126 case OBJ_PARTIAL_KEY:
1127 /* Should never happen in hash callback. */
1128 ast_assert(0);
1129 hash = 0;
1130 break;
1131 }
1132 return hash;
1133}

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

Referenced by confbridge_cfg_alloc().

◆ menu_hook_callback()

static int menu_hook_callback ( struct ast_bridge_channel bridge_channel,
void *  hook_pvt 
)
static

Definition at line 2821 of file conf_config_parser.c.

2822{
2823 struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2824
2825 return conf_handle_dtmf(bridge_channel, pvt->user, &pvt->menu_entry, pvt->menu);
2826}
int conf_handle_dtmf(struct ast_bridge_channel *bridge_channel, struct confbridge_user *user, struct conf_menu_entry *menu_entry, struct conf_menu *menu)
Once a DTMF sequence matches a sequence in the user's DTMF menu, this function will get called to per...

References conf_handle_dtmf(), dtmf_menu_hook_pvt::menu, dtmf_menu_hook_pvt::menu_entry, and dtmf_menu_hook_pvt::user.

Referenced by apply_menu_to_user().

◆ menu_hook_destroy()

static void menu_hook_destroy ( void *  hook_pvt)
static

Definition at line 2808 of file conf_config_parser.c.

2809{
2810 struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2811 struct conf_menu_action *action = NULL;
2812
2813 ao2_cleanup(pvt->menu);
2814
2817 }
2818 ast_free(pvt);
2819}

References conf_menu_entry::actions, ao2_cleanup, ast_free, AST_LIST_REMOVE_HEAD, dtmf_menu_hook_pvt::menu, dtmf_menu_hook_pvt::menu_entry, and NULL.

Referenced by apply_menu_to_user().

◆ menu_option_handler()

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

Definition at line 2555 of file conf_config_parser.c.

2556{
2557 add_menu_entry(obj, var->name, var->value);
2558 return 0;
2559}
static int add_menu_entry(struct conf_menu *menu, const char *dtmf, const char *action_names)

References add_menu_entry(), and var.

Referenced by conf_load_config().

◆ menu_template_handler()

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

Definition at line 2528 of file conf_config_parser.c.

2529{
2530 struct conf_menu *dst_menu = obj;
2532 RAII_VAR(struct conf_menu *, src_menu, NULL, ao2_cleanup);
2533
2534 if (!cfg) {
2535 return 0;
2536 }
2537
2538 if (!(src_menu = ao2_find(cfg->menus, var->value, OBJ_KEY))) {
2539 return -1;
2540 }
2541
2542 if (conf_menu_profile_copy(dst_menu, src_menu)) {
2543 return -1;
2544 }
2545
2546 return 0;
2547}
static int conf_menu_profile_copy(struct conf_menu *dst, struct conf_menu *src)

References ao2_cleanup, ao2_find, ao2_global_obj_ref, cfg_handle, conf_menu_profile_copy(), NULL, OBJ_KEY, RAII_VAR, and var.

Referenced by conf_load_config().

◆ mix_interval_handler()

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

Definition at line 2302 of file conf_config_parser.c.

2303{
2304 struct bridge_profile *b_profile = obj;
2305
2306 if (strcasecmp(var->name, "mixing_interval")) {
2307 return -1;
2308 }
2309 if (sscanf(var->value, "%30u", &b_profile->mix_interval) != 1) {
2310 return -1;
2311 }
2312 switch (b_profile->mix_interval) {
2313 case 10:
2314 case 20:
2315 case 40:
2316 case 80:
2317 return 0;
2318 default:
2319 return -1;
2320 }
2321}
unsigned int mix_interval
Definition: confbridge.h:237

References bridge_profile::mix_interval, and var.

Referenced by conf_load_config().

◆ remb_behavior_handler()

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

Definition at line 2370 of file conf_config_parser.c.

2371{
2372 struct bridge_profile *b_profile = obj;
2373
2374 if (strcasecmp(var->name, "remb_behavior")) {
2375 return -1;
2376 }
2377
2385 );
2386
2387 if (!strcasecmp(var->value, "average")) {
2389 } else if (!strcasecmp(var->value, "lowest")) {
2391 } else if (!strcasecmp(var->value, "highest")) {
2393 } else if (!strcasecmp(var->value, "average_all")) {
2395 } else if (!strcasecmp(var->value, "lowest_all")) {
2397 } else if (!strcasecmp(var->value, "highest_all")) {
2399 } else if (!strcasecmp(var->value, "force")) {
2401 } else {
2402 return -1;
2403 }
2404 return 0;
2405}
@ BRIDGE_OPT_REMB_BEHAVIOR_FORCE
Definition: confbridge.h:93
#define ast_clear_flag(p, flag)
Definition: utils.h:77
#define ast_set_flag(p, flag)
Definition: utils.h:70

References ast_clear_flag, ast_set_flag, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE, BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL, BRIDGE_OPT_REMB_BEHAVIOR_FORCE, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST, BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL, BRIDGE_OPT_REMB_BEHAVIOR_LOWEST, BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL, and var.

Referenced by conf_load_config().

◆ sample_rate_handler()

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

Definition at line 2414 of file conf_config_parser.c.

2415{
2416 struct bridge_profile *b_profile = obj;
2417 unsigned int *slot;
2418
2419 if (!strcasecmp(var->name, "internal_sample_rate")) {
2420 slot = &b_profile->internal_sample_rate;
2421 if (!strcasecmp(var->value, "auto")) {
2422 *slot = 0;
2423 return 0;
2424 }
2425 } else if (!strcasecmp(var->name, "maximum_sample_rate")) {
2426 slot = &b_profile->maximum_sample_rate;
2427 if (!strcasecmp(var->value, "none")) {
2428 *slot = 0;
2429 return 0;
2430 }
2431 } else {
2432 return -1;
2433 }
2434
2435 return ast_parse_arg(var->value, PARSE_UINT32 | PARSE_IN_RANGE, slot, 8000, 192000);
2436}
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
Definition: main/config.c:4047
unsigned int maximum_sample_rate
Definition: confbridge.h:236
unsigned int internal_sample_rate
Definition: confbridge.h:235

References ast_parse_arg(), bridge_profile::internal_sample_rate, bridge_profile::maximum_sample_rate, PARSE_IN_RANGE, PARSE_UINT32, and var.

Referenced by conf_load_config().

◆ set_sound()

static int set_sound ( const char *  sound_name,
const char *  sound_file,
struct bridge_profile b_profile 
)
static

Definition at line 1214 of file conf_config_parser.c.

1215{
1216 struct bridge_profile_sounds *sounds = b_profile->sounds;
1217 if (ast_strlen_zero(sound_file)) {
1218 return -1;
1219 }
1220
1221 if (!strcasecmp(sound_name, "sound_only_person")) {
1223 } else if (!strcasecmp(sound_name, "sound_only_one")) {
1224 ast_string_field_set(sounds, onlyone, sound_file);
1225 } else if (!strcasecmp(sound_name, "sound_has_joined")) {
1226 ast_string_field_set(sounds, hasjoin, sound_file);
1227 } else if (!strcasecmp(sound_name, "sound_has_left")) {
1228 ast_string_field_set(sounds, hasleft, sound_file);
1229 } else if (!strcasecmp(sound_name, "sound_kicked")) {
1230 ast_string_field_set(sounds, kicked, sound_file);
1231 } else if (!strcasecmp(sound_name, "sound_muted")) {
1232 ast_string_field_set(sounds, muted, sound_file);
1233 } else if (!strcasecmp(sound_name, "sound_unmuted")) {
1234 ast_string_field_set(sounds, unmuted, sound_file);
1235 } else if (!strcasecmp(sound_name, "sound_binaural_on")) {
1237 } else if (!strcasecmp(sound_name, "sound_binaural_off")) {
1239 } else if (!strcasecmp(sound_name, "sound_there_are")) {
1240 ast_string_field_set(sounds, thereare, sound_file);
1241 } else if (!strcasecmp(sound_name, "sound_other_in_party")) {
1243 } else if (!strcasecmp(sound_name, "sound_place_into_conference")) {
1244 static int deprecation_warning = 1;
1245 if (deprecation_warning) {
1246 ast_log(LOG_WARNING, "sound_place_into_conference is deprecated"
1247 " and unused. Use sound_begin for similar functionality.");
1248 deprecation_warning = 0;
1249 }
1251 } else if (!strcasecmp(sound_name, "sound_wait_for_leader")) {
1253 } else if (!strcasecmp(sound_name, "sound_leader_has_left")) {
1255 } else if (!strcasecmp(sound_name, "sound_get_pin")) {
1256 ast_string_field_set(sounds, getpin, sound_file);
1257 } else if (!strcasecmp(sound_name, "sound_invalid_pin")) {
1259 } else if (!strcasecmp(sound_name, "sound_locked")) {
1260 ast_string_field_set(sounds, locked, sound_file);
1261 } else if (!strcasecmp(sound_name, "sound_unlocked_now")) {
1263 } else if (!strcasecmp(sound_name, "sound_locked_now")) {
1265 } else if (!strcasecmp(sound_name, "sound_error_menu")) {
1267 } else if (!strcasecmp(sound_name, "sound_join")) {
1268 ast_string_field_set(sounds, join, sound_file);
1269 } else if (!strcasecmp(sound_name, "sound_leave")) {
1270 ast_string_field_set(sounds, leave, sound_file);
1271 } else if (!strcasecmp(sound_name, "sound_participants_muted")) {
1273 } else if (!strcasecmp(sound_name, "sound_participants_unmuted")) {
1275 } else if (!strcasecmp(sound_name, "sound_begin")) {
1276 ast_string_field_set(sounds, begin, sound_file);
1277 } else {
1278 return -1;
1279 }
1280
1281 return 0;
1282}
const ast_string_field binauralon
Definition: confbridge.h:224
const ast_string_field binauraloff
Definition: confbridge.h:224

References ast_log, ast_string_field_set, ast_strlen_zero(), bridge_profile_sounds::begin, bridge_profile_sounds::binauraloff, bridge_profile_sounds::binauralon, bridge_profile_sounds::errormenu, bridge_profile_sounds::getpin, bridge_profile_sounds::hasjoin, bridge_profile_sounds::hasleft, bridge_profile_sounds::invalidpin, bridge_profile_sounds::join, bridge_profile_sounds::kicked, bridge_profile_sounds::leaderhasleft, leave, bridge_profile_sounds::locked, bridge_profile_sounds::lockednow, LOG_WARNING, bridge_profile_sounds::muted, bridge_profile_sounds::onlyone, bridge_profile_sounds::onlyperson, bridge_profile_sounds::otherinparty, bridge_profile_sounds::participantsmuted, bridge_profile_sounds::participantsunmuted, bridge_profile_sounds::placeintoconf, bridge_profile::sounds, sounds, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, and bridge_profile_sounds::waitforleader.

Referenced by sound_option_handler().

◆ sound_option_handler()

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

Definition at line 2549 of file conf_config_parser.c.

2550{
2551 set_sound(var->name, var->value, obj);
2552 return 0;
2553}
static int set_sound(const char *sound_name, const char *sound_file, struct bridge_profile *b_profile)

References set_sound(), and var.

Referenced by conf_load_config().

◆ user_cmp_cb()

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

User profile container functions

Definition at line 1147 of file conf_config_parser.c.

1148{
1149 const struct user_profile *left = obj;
1150 const struct user_profile *right = arg;
1151 const char *right_name = arg;
1152 int cmp;
1153
1154 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1155 default:
1156 case OBJ_POINTER:
1157 right_name = right->name;
1158 /* Fall through */
1159 case OBJ_KEY:
1160 cmp = strcasecmp(left->name, right_name);
1161 break;
1162 case OBJ_PARTIAL_KEY:
1163 cmp = strncasecmp(left->name, right_name, strlen(right_name));
1164 break;
1165 }
1166 return cmp ? 0 : CMP_MATCH;
1167}

References CMP_MATCH, user_profile::flags, user_profile::name, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.

Referenced by confbridge_cfg_alloc().

◆ user_hash_cb()

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

Definition at line 1169 of file conf_config_parser.c.

1170{
1171 const struct user_profile *u_profile = obj;
1172 const char *name = obj;
1173 int hash;
1174
1175 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1176 default:
1177 case OBJ_POINTER:
1178 name = u_profile->name;
1179 /* Fall through */
1180 case OBJ_KEY:
1181 hash = ast_str_case_hash(name);
1182 break;
1183 case OBJ_PARTIAL_KEY:
1184 /* Should never happen in hash callback. */
1185 ast_assert(0);
1186 hash = 0;
1187 break;
1188 }
1189 return hash;
1190}

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

Referenced by confbridge_cfg_alloc().

◆ user_profile_alloc()

static void * user_profile_alloc ( const char *  category)
static

Definition at line 955 of file conf_config_parser.c.

956{
957 struct user_profile *u_profile;
958
959 if (!(u_profile = ao2_alloc(sizeof(*u_profile), user_profile_destructor))) {
960 return NULL;
961 }
962
963 ast_copy_string(u_profile->name, category, sizeof(u_profile->name));
964
965 return u_profile;
966}

References ao2_alloc, ast_copy_string(), user_profile::name, NULL, and user_profile_destructor().

Referenced by verify_default_profiles().

◆ user_profile_destructor()

static void user_profile_destructor ( void *  obj)
static

Definition at line 950 of file conf_config_parser.c.

951{
952 return;
953}

Referenced by func_confbridge_helper(), and user_profile_alloc().

◆ user_profile_find()

static void * user_profile_find ( struct ao2_container container,
const char *  category 
)
static

Definition at line 968 of file conf_config_parser.c.

969{
970 return ao2_find(container, category, OBJ_KEY);
971}

References ao2_find, container, and OBJ_KEY.

◆ user_template_handler()

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

Definition at line 2407 of file conf_config_parser.c.

2408{
2409 struct user_profile *u_profile = obj;
2410
2411 return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
2412}

References conf_find_user_profile(), NULL, and var.

Referenced by conf_load_config().

◆ verify_default_profiles()

static int verify_default_profiles ( void  )
static

Definition at line 2561 of file conf_config_parser.c.

2562{
2565 RAII_VAR(struct conf_menu *, menu_profile, NULL, ao2_cleanup);
2566 /* We can only be called as a result of an aco_process_config so this is safe */
2567 struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
2568
2569 if (!cfg) {
2570 return 0;
2571 }
2572
2574 if (!bridge_profile) {
2576 if (!bridge_profile) {
2577 return -1;
2578 }
2579 ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_BRIDGE_PROFILE);
2582 }
2583
2585 if (!user_profile) {
2587 if (!user_profile) {
2588 return -1;
2589 }
2590 ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_USER_PROFILE);
2593 }
2594
2595 menu_profile = ao2_find(cfg->menus, DEFAULT_MENU_PROFILE, OBJ_KEY);
2596 if (!menu_profile) {
2597 menu_profile = menu_alloc(DEFAULT_MENU_PROFILE);
2598 if (!menu_profile) {
2599 return -1;
2600 }
2601 ast_log(AST_LOG_NOTICE, "Adding %s menu to app_confbridge\n", DEFAULT_MENU_PROFILE);
2603 ao2_link(cfg->menus, menu_profile);
2604 }
2605
2606 return 0;
2607}
#define ao2_link(container, obj)
Add an object to a container.
Definition: astobj2.h:1532
static void * bridge_profile_alloc(const char *category)
static void * user_profile_alloc(const char *category)
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
void * aco_pending_config(struct aco_info *info)
Get pending config changes.
#define AST_LOG_NOTICE

References aco_pending_config(), aco_set_defaults(), ao2_cleanup, ao2_find, ao2_link, ast_log, AST_LOG_NOTICE, bridge_profile_alloc(), confbridge_cfg::bridge_profiles, bridge_type, DEFAULT_BRIDGE_PROFILE, DEFAULT_MENU_PROFILE, DEFAULT_USER_PROFILE, menu_alloc(), menu_type, confbridge_cfg::menus, NULL, OBJ_KEY, RAII_VAR, user_profile_alloc(), confbridge_cfg::user_profiles, and user_type.

◆ video_mode_handler()

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

Definition at line 2323 of file conf_config_parser.c.

2324{
2325 struct bridge_profile *b_profile = obj;
2326
2327 if (strcasecmp(var->name, "video_mode")) {
2328 return -1;
2329 }
2330 if (!strcasecmp(var->value, "first_marked")) {
2331 ast_set_flags_to(b_profile,
2337 } else if (!strcasecmp(var->value, "last_marked")) {
2338 ast_set_flags_to(b_profile,
2344 } else if (!strcasecmp(var->value, "follow_talker")) {
2345 ast_set_flags_to(b_profile,
2351 } else if (!strcasecmp(var->value, "sfu")) {
2352 ast_set_flags_to(b_profile,
2358 } else if (!strcasecmp(var->value, "none")) {
2359 ast_clear_flag(b_profile,
2364 } else {
2365 return -1;
2366 }
2367 return 0;
2368}
#define ast_set_flags_to(p, flag, value)
Definition: utils.h:104

References ast_clear_flag, ast_set_flags_to, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED, BRIDGE_OPT_VIDEO_SRC_SFU, and var.

Referenced by conf_load_config().

Variable Documentation

◆ bridge_type

struct aco_type bridge_type
static

Definition at line 936 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ bridge_types

struct aco_type* bridge_types[] = ACO_TYPES(&bridge_type)
static

Definition at line 1017 of file conf_config_parser.c.

Referenced by conf_load_config().

◆ cli_confbridge_parser

struct ast_cli_entry cli_confbridge_parser[]
static

Definition at line 2233 of file conf_config_parser.c.

Referenced by conf_destroy_config(), and conf_load_config().

◆ confbridge_conf

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

Definition at line 1029 of file conf_config_parser.c.

◆ confbridge_datastore

const struct ast_datastore_info confbridge_datastore
static
Initial value:
= {
.type = "confbridge",
}
static void func_confbridge_destroy_cb(void *data)

Definition at line 1307 of file conf_config_parser.c.

Referenced by conf_find_bridge_profile(), conf_find_user_profile(), conf_set_menu_to_user(), and func_confbridge_helper().

◆ general_type

struct aco_type general_type
static

Definition at line 1022 of file conf_config_parser.c.

◆ menu_type

struct aco_type menu_type
static

Definition at line 1004 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ menu_types

struct aco_type* menu_types[] = ACO_TYPES(&menu_type)
static

Definition at line 1018 of file conf_config_parser.c.

Referenced by conf_load_config().

◆ user_type

struct aco_type user_type
static

Definition at line 973 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ user_types

struct aco_type* user_types[] = ACO_TYPES(&user_type)
static

Definition at line 1019 of file conf_config_parser.c.

Referenced by conf_load_config().