Asterisk - The Open Source Telephony Project GIT-master-545c459
Loading...
Searching...
No Matches
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
 
void conf_bridge_profile_destroy (struct bridge_profile *b_profile)
 Destroy a bridge profile found by 'conf_find_bridge_profile'.
 
void conf_destroy_config (void)
 destroy the information loaded from the confbridge.conf file
 
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.
 
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.
 
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.
 
int conf_load_config (void)
 load confbridge.conf file
 
void conf_menu_entry_destroy (struct conf_menu_entry *menu_entry)
 Destroys and frees all the actions stored in a menu_entry structure.
 
static int conf_menu_profile_copy (struct conf_menu *dst, struct conf_menu *src)
 
int conf_reload_config (void)
 reload confbridge.conf file
 
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.
 
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 1484 of file conf_config_parser.c.

1485{
1486 struct conf_menu_action *menu_action = ast_calloc(1, sizeof(*menu_action));
1487
1488 if (!menu_action) {
1489 return -1;
1490 }
1491 menu_action->id = id;
1492
1493 switch (id) {
1494 case MENU_ACTION_NOOP:
1507 case MENU_ACTION_LEAVE:
1510 break;
1513 if (!(ast_strlen_zero(databuf))) {
1514 ast_copy_string(menu_action->data.playback_file, databuf, sizeof(menu_action->data.playback_file));
1515 } else {
1516 ast_free(menu_action);
1517 return -1;
1518 }
1519 break;
1521 if (!(ast_strlen_zero(databuf))) {
1526 );
1527 AST_STANDARD_APP_ARGS(args, databuf);
1528 if (!ast_strlen_zero(args.context)) {
1530 args.context,
1531 sizeof(menu_action->data.dialplan_args.context));
1532 }
1533 if (!ast_strlen_zero(args.exten)) {
1535 args.exten,
1536 sizeof(menu_action->data.dialplan_args.exten));
1537 }
1538 menu_action->data.dialplan_args.priority = 1; /* 1 by default */
1539 if (!ast_strlen_zero(args.priority) &&
1540 (sscanf(args.priority, "%30d", &menu_action->data.dialplan_args.priority) != 1)) {
1541 /* invalid priority */
1542 ast_free(menu_action);
1543 return -1;
1544 }
1545 } else {
1546 ast_free(menu_action);
1547 return -1;
1548 }
1549 };
1550
1551 AST_LIST_INSERT_TAIL(&menu_entry->actions, menu_action, action);
1552
1553 return 0;
1554}
enum queue_result id
Definition app_queue.c:1790
#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:113
@ MENU_ACTION_SET_SINGLE_VIDEO_SRC
Definition confbridge.h:112
@ MENU_ACTION_ADMIN_KICK_LAST
Definition confbridge.h:109
@ MENU_ACTION_TOGGLE_BINAURAL
Definition confbridge.h:116
@ MENU_ACTION_PLAYBACK
Definition confbridge.h:99
@ MENU_ACTION_LEAVE
Definition confbridge.h:110
@ MENU_ACTION_RESET_LISTENING
Definition confbridge.h:103
@ MENU_ACTION_INCREASE_TALKING
Definition confbridge.h:105
@ MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS
Definition confbridge.h:115
@ MENU_ACTION_INCREASE_LISTENING
Definition confbridge.h:101
@ MENU_ACTION_DIALPLAN_EXEC
Definition confbridge.h:107
@ MENU_ACTION_DECREASE_LISTENING
Definition confbridge.h:102
@ MENU_ACTION_PLAYBACK_AND_CONTINUE
Definition confbridge.h:100
@ MENU_ACTION_ADMIN_TOGGLE_LOCK
Definition confbridge.h:108
@ MENU_ACTION_DECREASE_TALKING
Definition confbridge.h:106
@ MENU_ACTION_PARTICIPANT_COUNT
Definition confbridge.h:114
@ MENU_ACTION_TOGGLE_MUTE
Definition confbridge.h:98
@ MENU_ACTION_NOOP
Definition confbridge.h:111
@ MENU_ACTION_RESET_TALKING
Definition confbridge.h:104
#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.
static struct @523 args
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:124
char exten[AST_MAX_EXTENSION]
Definition confbridge.h:129
struct conf_menu_action::@89 action
struct conf_menu_action::@88::@90 dialplan_args
char playback_file[PATH_MAX]
Definition confbridge.h:126
char context[AST_MAX_CONTEXT]
Definition confbridge.h:128
union conf_menu_action::@88 data
struct conf_menu_entry::@91 actions

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, 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 1556 of file conf_config_parser.c.

1557{
1558 struct conf_menu_entry *menu_entry = NULL, *cur = NULL;
1559 int res = 0;
1560 char *tmp_action_names = ast_strdupa(action_names);
1561 char *action = NULL;
1562 char *action_args;
1563 char *tmp;
1564 char buf[PATH_MAX];
1565 char *delimiter = ",";
1566
1567 if (!(menu_entry = ast_calloc(1, sizeof(*menu_entry)))) {
1568 return -1;
1569 }
1570
1571 for (;;) {
1572 char *comma;
1573 char *startbrace;
1574 char *endbrace;
1575 unsigned int action_len;
1576
1577 if (ast_strlen_zero(tmp_action_names)) {
1578 break;
1579 }
1580 startbrace = strchr(tmp_action_names, '(');
1581 endbrace = strchr(tmp_action_names, ')');
1582 comma = strchr(tmp_action_names, ',');
1583
1584 /* If the next action has brackets with comma delimited arguments in it,
1585 * make the delimeter ')' instead of a comma to preserve the arguments */
1586 if (startbrace && endbrace && comma && (comma > startbrace && comma < endbrace)) {
1587 delimiter = ")";
1588 } else {
1589 delimiter = ",";
1590 }
1591
1592 if (!(action = strsep(&tmp_action_names, delimiter))) {
1593 break;
1594 }
1595
1596 action = ast_strip(action);
1597 if (ast_strlen_zero(action)) {
1598 continue;
1599 }
1600
1601 action_len = strlen(action);
1602 ast_copy_string(menu_entry->dtmf, dtmf, sizeof(menu_entry->dtmf));
1603 if (!strcasecmp(action, "toggle_mute")) {
1605 } else if (!strcasecmp(action, "toggle_binaural")) {
1607 } else if (!strcasecmp(action, "no_op")) {
1608 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_NOOP, NULL);
1609 } else if (!strcasecmp(action, "increase_listening_volume")) {
1611 } else if (!strcasecmp(action, "decrease_listening_volume")) {
1613 } else if (!strcasecmp(action, "increase_talking_volume")) {
1615 } else if (!strcasecmp(action, "reset_listening_volume")) {
1617 } else if (!strcasecmp(action, "reset_talking_volume")) {
1619 } else if (!strcasecmp(action, "decrease_talking_volume")) {
1621 } else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
1623 } else if (!strcasecmp(action, "admin_toggle_mute_participants")) {
1625 } else if (!strcasecmp(action, "participant_count")) {
1627 } else if (!strcasecmp(action, "admin_kick_last")) {
1629 } else if (!strcasecmp(action, "leave_conference")) {
1630 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_LEAVE, NULL);
1631 } else if (!strcasecmp(action, "set_as_single_video_src")) {
1633 } else if (!strcasecmp(action, "release_as_single_video_src")) {
1635 } else if (!strncasecmp(action, "dialplan_exec(", 14)) {
1636 ast_copy_string(buf, action, sizeof(buf));
1637 action_args = buf;
1638 if ((action_args = strchr(action, '('))) {
1639 action_args++;
1640 }
1641 /* it is possible that this argument may or may not
1642 * have a closing brace at this point, it all depends on if
1643 * comma delimited arguments were provided */
1644 if ((tmp = strchr(action, ')'))) {
1645 *tmp = '\0';
1646 }
1647 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DIALPLAN_EXEC, action_args);
1648 } else if (action_len >= 21 && !strncasecmp(action, "playback_and_continue(", 22)) {
1649 ast_copy_string(buf, action, sizeof(buf));
1650 action_args = buf;
1651 if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1652 *tmp = '\0';
1653 action_args++;
1654 }
1655 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK_AND_CONTINUE, action_args);
1656 } else if (action_len >= 8 && !strncasecmp(action, "playback(", 9)) {
1657 ast_copy_string(buf, action, sizeof(buf));
1658 action_args = buf;
1659 if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1660 *tmp = '\0';
1661 action_args++;
1662 }
1663 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, action_args);
1664 }
1665 }
1666
1667 /* if adding any of the actions failed, bail */
1668 if (res) {
1669 conf_menu_entry_destroy(menu_entry);
1670 ast_free(menu_entry);
1671 return -1;
1672 }
1673
1674 /* remove any list entry with an identical DTMF sequence for overrides */
1676 if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) {
1679 ast_free(cur);
1680 break;
1681 }
1682 }
1684
1685 AST_LIST_INSERT_TAIL(&menu->entries, menu_entry, entry);
1686
1687 return 0;
1688}
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.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#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:139
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition confbridge.h:141
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 2319 of file conf_config_parser.c.

2320{
2321 struct user_profile *u_profile = obj;
2322
2323 if (strcasecmp(var->name, "announce_user_count_all")) {
2324 return -1;
2325 }
2326 if (ast_true(var->value)) {
2327 u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2328 } else if (ast_false(var->value)) {
2329 u_profile->flags = u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNTALL;
2330 } else if (sscanf(var->value, "%30u", &u_profile->announce_user_count_all_after) == 1) {
2331 u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2332 } else {
2333 return -1;
2334 }
2335 return 0;
2336}
#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:2233
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:2250
unsigned int flags
Definition confbridge.h:160
unsigned int announce_user_count_all_after
Definition confbridge.h:161

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 2890 of file conf_config_parser.c.

2891{
2892 struct conf_menu_entry *menu_entry;
2893
2894 SCOPED_AO2LOCK(menu_lock, menu);
2895 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2896 struct dtmf_menu_hook_pvt *pvt;
2897
2898 if (!(pvt = ast_calloc(1, sizeof(*pvt)))) {
2899 return -1;
2900 }
2901 pvt->user = user;
2902 pvt->menu = ao2_bump(menu);
2903
2905 menu_hook_destroy(pvt);
2906 return -1;
2907 }
2908
2909 if (ast_bridge_dtmf_hook(&user->features, pvt->menu_entry.dtmf,
2911 menu_hook_destroy(pvt);
2912 }
2913 }
2914 strcpy(user->menu_name, menu->name); /* Safe */
2915
2916 return 0;
2917}
#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:3391
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.
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
Definition lock.h:611
char name[MAX_PROFILE_NAME]
Definition confbridge.h:151
struct conf_menu * menu
struct conf_menu_entry menu_entry
struct confbridge_user * user
structure to hold users read from phoneprov_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, and dtmf_menu_hook_pvt::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 1076 of file conf_config_parser.c.

1077{
1078 const struct bridge_profile *left = obj;
1079 const struct bridge_profile *right = arg;
1080 const char *right_name = arg;
1081 int cmp;
1082
1083 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1084 default:
1085 case OBJ_POINTER:
1086 right_name = right->name;
1087 /* Fall through */
1088 case OBJ_KEY:
1089 cmp = strcasecmp(left->name, right_name);
1090 break;
1091 case OBJ_PARTIAL_KEY:
1092 cmp = strncasecmp(left->name, right_name, strlen(right_name));
1093 break;
1094 }
1095 return cmp ? 0 : CMP_MATCH;
1096}
@ 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:234
char name[MAX_PROFILE_NAME]
Definition confbridge.h:229

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 1098 of file conf_config_parser.c.

1099{
1100 const struct bridge_profile *b_profile = obj;
1101 const char *name = obj;
1102 int hash;
1103
1104 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1105 default:
1106 case OBJ_POINTER:
1107 name = b_profile->name;
1108 /* Fall through */
1109 case OBJ_KEY:
1110 hash = ast_str_case_hash(name);
1111 break;
1112 case OBJ_PARTIAL_KEY:
1113 /* Should never happen in hash callback. */
1114 ast_assert(0);
1115 hash = 0;
1116 break;
1117 }
1118 return hash;
1119}
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:779

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 945 of file conf_config_parser.c.

946{
947 struct bridge_profile *b_profile;
948
949 if (!(b_profile = ao2_alloc(sizeof(*b_profile), bridge_profile_destructor))) {
950 return NULL;
951 }
952
953 if (!(b_profile->sounds = bridge_profile_sounds_alloc())) {
954 ao2_ref(b_profile, -1);
955 return NULL;
956 }
957
958 ast_copy_string(b_profile->name, category, sizeof(b_profile->name));
959
960 return b_profile;
961}
#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:239

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 939 of file conf_config_parser.c.

940{
941 struct bridge_profile *b_profile = obj;
942 ao2_cleanup(b_profile->sounds);
943}
#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 963 of file conf_config_parser.c.

964{
965 return ao2_find(container, category, OBJ_KEY);
966}
#define ao2_find(container, arg, flags)
Definition astobj2.h:1736
struct ao2_container * container
Definition res_fax.c:603

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 1231 of file conf_config_parser.c.

1232{
1234
1235 if (!sounds) {
1236 return NULL;
1237 }
1238 if (ast_string_field_init(sounds, 512)) {
1239 ao2_ref(sounds, -1);
1240 return NULL;
1241 }
1242
1243 return sounds;
1244}
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.

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 1225 of file conf_config_parser.c.

1226{
1227 struct bridge_profile_sounds *sounds = obj;
1229}
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object

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 2474 of file conf_config_parser.c.

2475{
2476 struct bridge_profile *b_profile = obj;
2478 struct bridge_profile_sounds *oldsounds = b_profile->sounds;
2479
2480 if (!sounds) {
2481 return -1;
2482 }
2483 if (!(conf_find_bridge_profile(NULL, var->value, b_profile))) {
2484 ao2_ref(sounds, -1);
2485 return -1;
2486 }
2487 /* Using a bridge profile as a template is a little complicated due to the sounds. Since the sounds
2488 * structure of a dynamic profile will need to be altered, a completely new sounds structure must be
2489 * created instead of simply holding a reference to the one built by the config file. */
2513
2514 ao2_ref(b_profile->sounds, -1); /* sounds struct copied over to it from the template by reference only. */
2515 ao2_ref(oldsounds, -1); /* original sounds struct we don't need anymore */
2516 b_profile->sounds = sounds; /* the new sounds struct that is a deep copy of the one from the template. */
2517
2518 return 0;
2519}
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.
const ast_string_field waitforleader
Definition confbridge.h:225
const ast_string_field invalidpin
Definition confbridge.h:225
const ast_string_field placeintoconf
Definition confbridge.h:225
const ast_string_field onlyone
Definition confbridge.h:225
const ast_string_field otherinparty
Definition confbridge.h:225
const ast_string_field unlockednow
Definition confbridge.h:225
const ast_string_field getpin
Definition confbridge.h:225
const ast_string_field errormenu
Definition confbridge.h:225
const ast_string_field participantsunmuted
Definition confbridge.h:225
const ast_string_field participantsmuted
Definition confbridge.h:225
const ast_string_field leave
Definition confbridge.h:225
const ast_string_field locked
Definition confbridge.h:225
const ast_string_field join
Definition confbridge.h:225
const ast_string_field kicked
Definition confbridge.h:225
const ast_string_field hasleft
Definition confbridge.h:225
const ast_string_field unmuted
Definition confbridge.h:225
const ast_string_field leaderhasleft
Definition confbridge.h:225
const ast_string_field lockednow
Definition confbridge.h:225
const ast_string_field hasjoin
Definition confbridge.h:225
const ast_string_field onlyperson
Definition confbridge.h:225
const ast_string_field thereare
Definition confbridge.h:225
const ast_string_field muted
Definition confbridge.h:225
const ast_string_field begin
Definition confbridge.h:225

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 1859 of file conf_config_parser.c.

1860{
1861 int which = 0;
1862 char *res = NULL;
1863 int wordlen = strlen(word);
1864 struct ao2_iterator i;
1865 struct bridge_profile *b_profile = NULL;
1867
1868 if (!cfg) {
1869 return NULL;
1870 }
1871
1872 i = ao2_iterator_init(cfg->bridge_profiles, 0);
1873 while ((b_profile = ao2_iterator_next(&i))) {
1874 if (!strncasecmp(b_profile->name, word, wordlen) && ++which > state) {
1875 res = ast_strdup(b_profile->name);
1876 ao2_ref(b_profile, -1);
1877 break;
1878 }
1879 ao2_ref(b_profile, -1);
1880 }
1882
1883 return res;
1884}
#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
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:981

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 2095 of file conf_config_parser.c.

2096{
2097 int which = 0;
2098 char *res = NULL;
2099 int wordlen = strlen(word);
2100 struct ao2_iterator i;
2101 struct conf_menu *menu = NULL;
2103
2104 if (!cfg) {
2105 return NULL;
2106 }
2107
2108 i = ao2_iterator_init(cfg->menus, 0);
2109 while ((menu = ao2_iterator_next(&i))) {
2110 if (!strncasecmp(menu->name, word, wordlen) && ++which > state) {
2111 res = ast_strdup(menu->name);
2112 ao2_ref(menu, -1);
2113 break;
2114 }
2115 ao2_ref(menu, -1);
2116 }
2118
2119 return res;
2120}

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 1690 of file conf_config_parser.c.

1691{
1692 int which = 0;
1693 char *res = NULL;
1694 int wordlen = strlen(word);
1695 struct ao2_iterator i;
1696 struct user_profile *u_profile = NULL;
1698
1699 if (!cfg) {
1700 return NULL;
1701 }
1702
1703 i = ao2_iterator_init(cfg->user_profiles, 0);
1704 while ((u_profile = ao2_iterator_next(&i))) {
1705 if (!strncasecmp(u_profile->name, word, wordlen) && ++which > state) {
1706 res = ast_strdup(u_profile->name);
1707 ao2_ref(u_profile, -1);
1708 break;
1709 }
1710 ao2_ref(u_profile, -1);
1711 }
1713
1714 return res;
1715}
char name[MAX_PROFILE_NAME]
Definition confbridge.h:156

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 2786 of file conf_config_parser.c.

2787{
2788 *dst = *src;
2789 if (src->sounds) {
2790 ao2_ref(src->sounds, +1);
2791 }
2792}

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 2794 of file conf_config_parser.c.

2795{
2796 if (b_profile->sounds) {
2797 ao2_ref(b_profile->sounds, -1);
2798 b_profile->sounds = NULL;
2799 }
2800}

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 2957 of file conf_config_parser.c.

2958{
2960 aco_info_destroy(&cfg_info);
2962}
void ast_cli_unregister_multiple(void)
Definition ael_main.c:408
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
Definition astobj2.h:859
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:706

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 2802 of file conf_config_parser.c.

2803{
2804 struct bridge_profile *tmp2;
2805 struct ast_datastore *datastore = NULL;
2806 struct func_confbridge_data *b_data = NULL;
2808
2809 if (chan && ast_strlen_zero(bridge_profile_name)) {
2810 ast_channel_lock(chan);
2812 ast_channel_unlock(chan);
2813 if (datastore) {
2814 b_data = datastore->data;
2815 if (b_data->b_usable) {
2817 return result;
2818 }
2819 }
2820 }
2821
2822 if (!cfg) {
2823 return NULL;
2824 }
2825 if (ast_strlen_zero(bridge_profile_name)) {
2826 bridge_profile_name = DEFAULT_BRIDGE_PROFILE;
2827 }
2828 if (!(tmp2 = ao2_find(cfg->bridge_profiles, bridge_profile_name, OBJ_KEY))) {
2829 return NULL;
2830 }
2831 ao2_lock(tmp2);
2833 ao2_unlock(tmp2);
2834 ao2_ref(tmp2, -1);
2835
2836 return result;
2837}
#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:2983
#define ast_channel_unlock(chan)
Definition channel.h:2984
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition channel.c:2390
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 2873 of file conf_config_parser.c.

2874{
2875 struct conf_menu_entry *menu_entry = NULL;
2876
2877 ao2_lock(menu);
2878 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2879 if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {
2880 copy_menu_entry(result, menu_entry);
2881 ao2_unlock(menu);
2882 return 1;
2883 }
2884 }
2885 ao2_unlock(menu);
2886
2887 return 0;
2888}

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 2749 of file conf_config_parser.c.

2750{
2751 struct user_profile *tmp2;
2752 struct ast_datastore *datastore = NULL;
2753 struct func_confbridge_data *b_data = NULL;
2755
2756 if (chan && ast_strlen_zero(user_profile_name)) {
2757 ast_channel_lock(chan);
2759 ast_channel_unlock(chan);
2760 if (datastore) {
2761 b_data = datastore->data;
2762 if (b_data->u_usable) {
2764 return result;
2765 }
2766 }
2767 }
2768
2769 if (!cfg) {
2770 return NULL;
2771 }
2772 if (ast_strlen_zero(user_profile_name)) {
2773 user_profile_name = DEFAULT_USER_PROFILE;
2774 }
2775 if (!(tmp2 = ao2_find(cfg->user_profiles, user_profile_name, OBJ_KEY))) {
2776 return NULL;
2777 }
2778 ao2_lock(tmp2);
2780 ao2_unlock(tmp2);
2781 ao2_ref(tmp2, -1);
2782
2783 return result;
2784}
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 2645 of file conf_config_parser.c.

2646{
2647 if (aco_info_init(&cfg_info)) {
2648 return -1;
2649 }
2650
2651 /* User options */
2652 aco_option_register(&cfg_info, "type", ACO_EXACT, user_types, NULL, OPT_NOOP_T, 0, 0);
2653 aco_option_register(&cfg_info, "admin", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ADMIN);
2654 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);
2655 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);
2656 aco_option_register(&cfg_info, "marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MARKEDUSER);
2657 aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
2658 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);
2659 aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
2660 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);
2661 aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
2662 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);
2663 /* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
2664 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);
2665 aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
2666 aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
2667 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);
2668 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);
2669 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);
2670 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);
2671 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);
2673 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));
2674 aco_option_register(&cfg_info, "announcement", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, announcement));
2675 aco_option_register(&cfg_info, "denoise", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DENOISE);
2676 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);
2677 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));
2678 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));
2679 aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
2680 aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));
2681 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);
2682 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);
2683
2684 /* This option should only be used with the CONFBRIDGE dialplan function */
2686
2687/* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
2688 /* Bridge options */
2689 aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
2690 aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
2691 aco_option_register_custom(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "auto", sample_rate_handler, 0);
2692 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);
2693 aco_option_register_custom(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "none", sample_rate_handler, 0);
2694 aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
2695 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);
2697 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);
2698 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);
2699 aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
2700 aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
2701 aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
2702 aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
2706 aco_option_register(&cfg_info, "video_update_discard", ACO_EXACT, bridge_types, "2000", OPT_UINT_T, 0, FLDSET(struct bridge_profile, video_update_discard));
2707 aco_option_register(&cfg_info, "remb_send_interval", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_send_interval));
2708 aco_option_register_custom(&cfg_info, "remb_behavior", ACO_EXACT, bridge_types, "average", remb_behavior_handler, 0);
2709 aco_option_register(&cfg_info, "remb_estimated_bitrate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_estimated_bitrate));
2710 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);
2711 aco_option_register(&cfg_info, "announcements", ACO_EXACT, bridge_types, "yes", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), BRIDGE_OPT_ANNOUNCEMENTS);
2712 /* This option should only be used with the CONFBRIDGE dialplan function */
2714
2715 /* Menu options */
2716 aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
2717 /* This option should only be used with the CONFBRIDGE dialplan function */
2719 aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
2720
2721 if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
2722 goto error;
2723 }
2724
2726 goto error;
2727 }
2728
2729 return 0;
2730error:
2732 return -1;
2733}
#define __stringify(x)
Definition asterisk.h:216
static char regcontext[AST_MAX_CONTEXT]
Definition chan_iax2.c:362
static char language[MAX_LANGUAGE]
Definition chan_iax2.c:361
#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_ANNOUNCEMENTS
Definition confbridge.h:94
@ 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,...)

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_ANNOUNCEMENTS, 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 2865 of file conf_config_parser.c.

2866{
2867 struct conf_menu_action *menu_action = NULL;
2868 while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
2869 ast_free(menu_action);
2870 }
2871}
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.

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 2541 of file conf_config_parser.c.

2542{
2543 /* Copy each menu item to the dst struct */
2544 struct conf_menu_entry *cur;
2545
2546 AST_LIST_TRAVERSE(&src->entries, cur, entry) {
2547 struct conf_menu_entry *cpy;
2548
2549 if (!(cpy = ast_calloc(1, sizeof(*cpy)))) {
2550 return -1;
2551 }
2552
2553 if (copy_menu_entry(cpy, cur)) {
2555 ast_free(cpy);
2556 return -1;
2557 }
2558 AST_LIST_INSERT_TAIL(&dst->entries, cpy, entry);
2559 }
2560
2561 return 0;
2562}

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 2735 of file conf_config_parser.c.

2736{
2737 if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
2738 /* On a reload, just keep the config we already have in place. */
2739 return -1;
2740 }
2741 return 0;
2742}

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 2919 of file conf_config_parser.c.

2920{
2922 RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2923
2924 if (chan && ast_strlen_zero(menu_profile_name)) {
2925 struct ast_datastore *datastore;
2926 struct func_confbridge_data *b_data;
2927
2928 ast_channel_lock(chan);
2930 ast_channel_unlock(chan);
2931 if (datastore) {
2932 /* If a menu exists in the CONFBRIDGE function datastore, use it. */
2933 b_data = datastore->data;
2934 if (b_data->m_usable) {
2935 menu = ao2_bump(b_data->menu);
2936 return apply_menu_to_user(user, menu);
2937 }
2938 }
2939 }
2940
2941 /* Otherwise, we need to get whatever menu profile is specified to use (or default). */
2942 if (!cfg) {
2943 return -1;
2944 }
2945
2946 if (ast_strlen_zero(menu_profile_name)) {
2947 menu_profile_name = DEFAULT_MENU_PROFILE;
2948 }
2949
2950 if (!(menu = ao2_find(cfg->menus, menu_profile_name, OBJ_KEY))) {
2951 return -1;
2952 }
2953
2954 return apply_menu_to_user(user, menu);
2955}
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 2744 of file conf_config_parser.c.

2745{
2746 *dst = *src;
2747}

Referenced by conf_find_user_profile().

◆ confbridge_cfg_alloc()

void * confbridge_cfg_alloc ( void  )
static

Definition at line 2287 of file conf_config_parser.c.

2288{
2289 struct confbridge_cfg *cfg;
2290
2291 if (!(cfg = ao2_alloc(sizeof(*cfg), confbridge_cfg_destructor))) {
2292 return NULL;
2293 }
2294
2297 if (!cfg->user_profiles) {
2298 goto error;
2299 }
2300
2303 if (!cfg->bridge_profiles) {
2304 goto error;
2305 }
2306
2309 if (!cfg->menus) {
2310 goto error;
2311 }
2312
2313 return cfg;
2314error:
2315 ao2_ref(cfg, -1);
2316 return NULL;
2317}
@ 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 2279 of file conf_config_parser.c.

2280{
2281 struct confbridge_cfg *cfg = obj;
2284 ao2_cleanup(cfg->menus);
2285}

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 2521 of file conf_config_parser.c.

2522{
2523 struct conf_menu_action *menu_action;
2524 struct conf_menu_action *new_menu_action;
2525
2526 ast_copy_string(dst->dtmf, src->dtmf, sizeof(dst->dtmf));
2528
2529 AST_LIST_TRAVERSE(&src->actions, menu_action, action) {
2530 if (!(new_menu_action = ast_calloc(1, sizeof(*new_menu_action)))) {
2531 return -1;
2532 }
2533 memcpy(new_menu_action, menu_action, sizeof(*new_menu_action));
2534 AST_LIST_NEXT(new_menu_action, action) = NULL;
2535 AST_LIST_INSERT_TAIL(&dst->actions, new_menu_action, action);
2536 }
2537
2538 return 0;
2539}
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.

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

1327{
1329 ao2_cleanup(b_data->menu);
1330 ast_free(b_data);
1331}
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 1333 of file conf_config_parser.c.

1334{
1335 struct func_confbridge_data *b_data = data;
1337};
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 1344 of file conf_config_parser.c.

1345{
1346 struct ast_datastore *datastore;
1347 struct func_confbridge_data *b_data;
1348 char *parse;
1349 struct ast_variable tmpvar = { 0, };
1350 struct ast_variable template = {
1351 .name = "template",
1352 .file = "CONFBRIDGE"
1353 };
1356 AST_APP_ARG(option);
1357 );
1358
1359 if (!chan) {
1360 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1361 return -1;
1362 }
1363
1364 /* parse all the required arguments and make sure they exist. */
1365 if (ast_strlen_zero(data)) {
1366 return -1;
1367 }
1368 parse = ast_strdupa(data);
1370 if (ast_strlen_zero(args.type) || ast_strlen_zero(args.option)) {
1371 return -1;
1372 }
1373
1374 ast_channel_lock(chan);
1376 if (!datastore) {
1378 if (!datastore) {
1379 ast_channel_unlock(chan);
1380 return 0;
1381 }
1382 b_data = ast_calloc(1, sizeof(*b_data));
1383 if (!b_data) {
1384 ast_channel_unlock(chan);
1385 ast_datastore_free(datastore);
1386 return 0;
1387 }
1388 datastore->data = b_data;
1390 if (!b_data->b_profile.sounds) {
1391 ast_channel_unlock(chan);
1392 ast_datastore_free(datastore);
1393 return 0;
1394 }
1395 if (!(b_data->menu = menu_alloc("dialplan"))) {
1396 ast_channel_unlock(chan);
1397 ast_datastore_free(datastore);
1398 return 0;
1399 }
1400 ast_channel_datastore_add(chan, datastore);
1401 } else {
1402 b_data = datastore->data;
1403 }
1404 ast_channel_unlock(chan);
1405
1406 /* SET(CONFBRIDGE(type,option)=value) */
1407 if (!value) {
1408 value = "";
1409 }
1410 tmpvar.name = args.option;
1411 tmpvar.value = value;
1412 tmpvar.file = "CONFBRIDGE";
1413 if (!strcasecmp(args.type, "bridge")) {
1414 if (!strcasecmp(args.option, "clear")) {
1415 b_data->b_usable = 0;
1417 memset(&b_data->b_profile, 0, sizeof(b_data->b_profile)) ;
1418 if (!(b_data->b_profile.sounds = bridge_profile_sounds_alloc())) {
1419 /* If this reallocation fails, the datastore has become unusable and must be destroyed. */
1420 ast_channel_lock(chan);
1421 ast_channel_datastore_remove(chan, datastore);
1422 ast_channel_unlock(chan);
1423 ast_datastore_free(datastore);
1424 }
1425 return 0;
1426 }
1427
1428 if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) {
1429 template.value = DEFAULT_BRIDGE_PROFILE;
1430 aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile);
1431 }
1432
1433 if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
1434 b_data->b_usable = 1;
1435 return 0;
1436 }
1437 } else if (!strcasecmp(args.type, "user")) {
1438 if (!strcasecmp(args.option, "clear")) {
1439 b_data->u_usable = 0;
1441 memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
1442 return 0;
1443 }
1444
1445 if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) {
1446 template.value = DEFAULT_USER_PROFILE;
1447 aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile);
1448 }
1449
1450 if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
1451 b_data->u_usable = 1;
1452 return 0;
1453 }
1454 } else if (!strcasecmp(args.type, "menu")) {
1455 if (!strcasecmp(args.option, "clear")) {
1456 b_data->m_usable = 0;
1457 ao2_cleanup(b_data->menu);
1458 if (!(b_data->menu = menu_alloc("dialplan"))) {
1459 /* If this reallocation fails, the datastore has become unusable and must be destroyed */
1460 ast_channel_lock(chan);
1461 ast_channel_datastore_remove(chan, datastore);
1462 ast_channel_unlock(chan);
1463 ast_datastore_free(datastore);
1464 }
1465 return 0;
1466 }
1467
1468 if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) {
1469 template.value = DEFAULT_MENU_PROFILE;
1470 aco_process_var(&menu_type, "dialplan", &template, &b_data->menu);
1471 }
1472
1473 if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
1474 b_data->m_usable = 1;
1475 return 0;
1476 }
1477 }
1478
1479 ast_log(LOG_WARNING, "%s(%s,%s) cannot be set to '%s'. Invalid type, option, or value.\n",
1480 cmd, args.type, args.option, value);
1481 return -1;
1482}
#define ast_log
Definition astobj2.c:42
static const char type[]
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition channel.c:2376
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition channel.c:2385
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 1919 of file conf_config_parser.c.

1920{
1921 struct bridge_profile b_profile;
1922 char tmp[64];
1923
1924 switch (cmd) {
1925 case CLI_INIT:
1926 e->command = "confbridge show profile bridge";
1927 e->usage =
1928 "Usage: confbridge show profile bridge <profile name>\n";
1929 return NULL;
1930 case CLI_GENERATE:
1931 if (a->pos == 4) {
1932 return complete_bridge_profile_name(a->line, a->word, a->pos, a->n);
1933 }
1934 return NULL;
1935 }
1936
1937 if (a->argc != 5) {
1938 return CLI_SHOWUSAGE;
1939 }
1940
1941 if (!(conf_find_bridge_profile(NULL, a->argv[4], &b_profile))) {
1942 ast_cli(a->fd, "No conference bridge profile named '%s' found!\n", a->argv[4]);
1943 return CLI_SUCCESS;
1944 }
1945
1946 ast_cli(a->fd,"--------------------------------------------\n");
1947 ast_cli(a->fd,"Name: %s\n", b_profile.name);
1948 ast_cli(a->fd,"Language: %s\n", b_profile.language);
1949
1950 if (b_profile.internal_sample_rate) {
1951 snprintf(tmp, sizeof(tmp), "%u", b_profile.internal_sample_rate);
1952 } else {
1953 ast_copy_string(tmp, "auto", sizeof(tmp));
1954 }
1955 ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
1956
1957 if (b_profile.maximum_sample_rate) {
1958 snprintf(tmp, sizeof(tmp), "%u", b_profile.maximum_sample_rate);
1959 } else {
1960 ast_copy_string(tmp, "none", sizeof(tmp));
1961 }
1962 ast_cli(a->fd,"Maximum Sample Rate: %s\n", tmp);
1963
1964 if (b_profile.mix_interval) {
1965 ast_cli(a->fd,"Mixing Interval: %u\n", b_profile.mix_interval);
1966 } else {
1967 ast_cli(a->fd,"Mixing Interval: Default 20ms\n");
1968 }
1969
1970 ast_cli(a->fd,"Record Conference: %s\n",
1971 b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
1972 "yes" : "no");
1973
1974 ast_cli(a->fd,"Record File Append: %s\n",
1975 b_profile.flags & BRIDGE_OPT_RECORD_FILE_APPEND ?
1976 "yes" : "no");
1977
1978 ast_cli(a->fd,"Record File Timestamp: %s\n",
1979 b_profile.flags & BRIDGE_OPT_RECORD_FILE_TIMESTAMP ?
1980 "yes" : "no");
1981
1982 ast_cli(a->fd,"Record File: %s\n",
1983 ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
1984 b_profile.rec_file);
1985
1986 ast_cli(a->fd,"Record Options: %s\n",
1987 b_profile.rec_options);
1988
1989 ast_cli(a->fd,"Record Command: %s\n",
1990 b_profile.rec_command);
1991
1992 if (b_profile.max_members) {
1993 ast_cli(a->fd,"Max Members: %u\n", b_profile.max_members);
1994 } else {
1995 ast_cli(a->fd,"Max Members: No Limit\n");
1996 }
1997
1998 ast_cli(a->fd,"Registration context: %s\n", b_profile.regcontext);
1999
2000 switch (b_profile.flags
2006 ast_cli(a->fd, "Video Mode: last_marked\n");
2007 break;
2009 ast_cli(a->fd, "Video Mode: first_marked\n");
2010 break;
2012 ast_cli(a->fd, "Video Mode: follow_talker\n");
2013 break;
2015 ast_cli(a->fd, "Video Mode: sfu\n");
2016 break;
2017 case 0:
2018 ast_cli(a->fd, "Video Mode: no video\n");
2019 break;
2020 default:
2021 /* Opps. We have more than one video mode flag set. */
2022 ast_assert(0);
2023 break;
2024 }
2025
2026 ast_cli(a->fd,"Video Update Discard: %u\n", b_profile.video_update_discard);
2027 ast_cli(a->fd,"REMB Send Interval: %u\n", b_profile.remb_send_interval);
2028
2029 switch (b_profile.flags
2034 ast_cli(a->fd, "REMB Behavior: average\n");
2035 break;
2037 ast_cli(a->fd, "REMB Behavior: lowest\n");
2038 break;
2040 ast_cli(a->fd, "REMB Behavior: highest\n");
2041 break;
2043 ast_cli(a->fd, "REMB Behavior: average_all\n");
2044 break;
2046 ast_cli(a->fd, "REMB Behavior: lowest_all\n");
2047 break;
2049 ast_cli(a->fd, "REMB Behavior: highest_all\n");
2050 break;
2051 default:
2052 ast_assert(0);
2053 break;
2054 }
2055
2056 ast_cli(a->fd,"Enable Events: %s\n",
2057 b_profile.flags & BRIDGE_OPT_ENABLE_EVENTS ?
2058 "yes" : "no");
2059
2060 ast_cli(a->fd,"Announcements: %s\n",
2061 b_profile.flags & BRIDGE_OPT_ANNOUNCEMENTS ?
2062 "yes" : "no");
2063
2064 ast_cli(a->fd,"sound_only_person: %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
2065 ast_cli(a->fd,"sound_only_one: %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
2066 ast_cli(a->fd,"sound_has_joined: %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
2067 ast_cli(a->fd,"sound_has_left: %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));
2068 ast_cli(a->fd,"sound_kicked: %s\n", conf_get_sound(CONF_SOUND_KICKED, b_profile.sounds));
2069 ast_cli(a->fd,"sound_muted: %s\n", conf_get_sound(CONF_SOUND_MUTED, b_profile.sounds));
2070 ast_cli(a->fd,"sound_unmuted: %s\n", conf_get_sound(CONF_SOUND_UNMUTED, b_profile.sounds));
2071 ast_cli(a->fd,"sound_binaural_on: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_ON, b_profile.sounds));
2072 ast_cli(a->fd,"sound_binaural_off: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_OFF, b_profile.sounds));
2073 ast_cli(a->fd,"sound_there_are: %s\n", conf_get_sound(CONF_SOUND_THERE_ARE, b_profile.sounds));
2074 ast_cli(a->fd,"sound_other_in_party: %s\n", conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, b_profile.sounds));
2075 ast_cli(a->fd,"sound_place_into_conference: %s\n", conf_get_sound(CONF_SOUND_PLACE_IN_CONF, b_profile.sounds));
2076 ast_cli(a->fd,"sound_wait_for_leader: %s\n", conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, b_profile.sounds));
2077 ast_cli(a->fd,"sound_leader_has_left: %s\n", conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, b_profile.sounds));
2078 ast_cli(a->fd,"sound_get_pin: %s\n", conf_get_sound(CONF_SOUND_GET_PIN, b_profile.sounds));
2079 ast_cli(a->fd,"sound_invalid_pin: %s\n", conf_get_sound(CONF_SOUND_INVALID_PIN, b_profile.sounds));
2080 ast_cli(a->fd,"sound_locked: %s\n", conf_get_sound(CONF_SOUND_LOCKED, b_profile.sounds));
2081 ast_cli(a->fd,"sound_unlocked_now: %s\n", conf_get_sound(CONF_SOUND_UNLOCKED_NOW, b_profile.sounds));
2082 ast_cli(a->fd,"sound_lockednow: %s\n", conf_get_sound(CONF_SOUND_LOCKED_NOW, b_profile.sounds));
2083 ast_cli(a->fd,"sound_error_menu: %s\n", conf_get_sound(CONF_SOUND_ERROR_MENU, b_profile.sounds));
2084 ast_cli(a->fd,"sound_join: %s\n", conf_get_sound(CONF_SOUND_JOIN, b_profile.sounds));
2085 ast_cli(a->fd,"sound_leave: %s\n", conf_get_sound(CONF_SOUND_LEAVE, b_profile.sounds));
2086 ast_cli(a->fd,"sound_participants_muted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, b_profile.sounds));
2087 ast_cli(a->fd,"sound_participants_unmuted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, b_profile.sounds));
2088 ast_cli(a->fd,"sound_begin: %s\n", conf_get_sound(CONF_SOUND_BEGIN, b_profile.sounds));
2089 ast_cli(a->fd,"\n");
2090
2091 conf_bridge_profile_destroy(&b_profile);
2092 return CLI_SUCCESS;
2093}
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:189
@ CONF_SOUND_OTHER_IN_PARTY
Definition confbridge.h:178
@ CONF_SOUND_INVALID_PIN
Definition confbridge.h:183
@ CONF_SOUND_LOCKED_NOW
Definition confbridge.h:186
@ CONF_SOUND_THERE_ARE
Definition confbridge.h:177
@ CONF_SOUND_ONLY_ONE
Definition confbridge.h:176
@ CONF_SOUND_GET_PIN
Definition confbridge.h:182
@ CONF_SOUND_ERROR_MENU
Definition confbridge.h:188
@ CONF_SOUND_PARTICIPANTS_UNMUTED
Definition confbridge.h:192
@ CONF_SOUND_BINAURAL_ON
Definition confbridge.h:194
@ CONF_SOUND_ONLY_PERSON
Definition confbridge.h:184
@ CONF_SOUND_BEGIN
Definition confbridge.h:193
@ CONF_SOUND_PARTICIPANTS_MUTED
Definition confbridge.h:191
@ CONF_SOUND_WAIT_FOR_LEADER
Definition confbridge.h:180
@ CONF_SOUND_HAS_LEFT
Definition confbridge.h:172
@ CONF_SOUND_BINAURAL_OFF
Definition confbridge.h:195
@ CONF_SOUND_LEAVE
Definition confbridge.h:190
@ CONF_SOUND_LEADER_HAS_LEFT
Definition confbridge.h:181
@ CONF_SOUND_PLACE_IN_CONF
Definition confbridge.h:179
@ CONF_SOUND_HAS_JOINED
Definition confbridge.h:171
@ CONF_SOUND_UNLOCKED_NOW
Definition confbridge.h:187
@ CONF_SOUND_UNMUTED
Definition confbridge.h:175
@ CONF_SOUND_MUTED
Definition confbridge.h:174
@ CONF_SOUND_LOCKED
Definition confbridge.h:185
@ CONF_SOUND_KICKED
Definition confbridge.h:173
@ 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
char rec_file[PATH_MAX]
Definition confbridge.h:231
const char * name
static struct test_val a

References a, ast_assert, ast_cli(), ast_copy_string(), ast_strlen_zero(), BRIDGE_OPT_ANNOUNCEMENTS, 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 1886 of file conf_config_parser.c.

1887{
1888 struct ao2_iterator it;
1889 struct bridge_profile *b_profile;
1890 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1891
1892 switch (cmd) {
1893 case CLI_INIT:
1894 e->command = "confbridge show profile bridges";
1895 e->usage =
1896 "Usage: confbridge show profile bridges\n";
1897 return NULL;
1898 case CLI_GENERATE:
1899 return NULL;
1900 }
1901
1902 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1903 return NULL;
1904 }
1905
1906 ast_cli(a->fd,"--------- Bridge Profiles -----------\n");
1907 ao2_lock(cfg->bridge_profiles);
1908 it = ao2_iterator_init(cfg->bridge_profiles, 0);
1909 while ((b_profile = ao2_iterator_next(&it))) {
1910 ast_cli(a->fd,"%s\n", b_profile->name);
1911 ao2_ref(b_profile, -1);
1912 }
1914 ao2_unlock(cfg->bridge_profiles);
1915
1916 return CLI_SUCCESS;
1917}

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 2155 of file conf_config_parser.c.

2156{
2157 RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2158 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
2159 struct conf_menu_entry *menu_entry = NULL;
2160 struct conf_menu_action *menu_action = NULL;
2161
2162 switch (cmd) {
2163 case CLI_INIT:
2164 e->command = "confbridge show menu";
2165 e->usage =
2166 "Usage: confbridge show menu [<menu name>]\n";
2167 return NULL;
2168 case CLI_GENERATE:
2169 if (a->pos == 3) {
2170 return complete_menu_name(a->line, a->word, a->pos, a->n);
2171 }
2172 return NULL;
2173 }
2174
2175 if (a->argc != 4) {
2176 return CLI_SHOWUSAGE;
2177 }
2178
2179 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
2180 return NULL;
2181 }
2182
2183 if (!(menu = menu_find(cfg->menus, a->argv[3]))) {
2184 ast_cli(a->fd, "No conference menu named '%s' found!\n", a->argv[3]);
2185 return CLI_SUCCESS;
2186 }
2187 ao2_lock(menu);
2188
2189 ast_cli(a->fd,"Name: %s\n", menu->name);
2190 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2191 int action_num = 0;
2192 ast_cli(a->fd, "%s=", menu_entry->dtmf);
2193 AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
2194 if (action_num) {
2195 ast_cli(a->fd, ", ");
2196 }
2197 switch (menu_action->id) {
2199 ast_cli(a->fd, "toggle_mute");
2200 break;
2202 ast_cli(a->fd, "toggle_binaural");
2203 break;
2204 case MENU_ACTION_NOOP:
2205 ast_cli(a->fd, "no_op");
2206 break;
2208 ast_cli(a->fd, "increase_listening_volume");
2209 break;
2211 ast_cli(a->fd, "decrease_listening_volume");
2212 break;
2214 ast_cli(a->fd, "reset_listening_volume");
2215 break;
2217 ast_cli(a->fd, "reset_talking_volume");
2218 break;
2220 ast_cli(a->fd, "increase_talking_volume");
2221 break;
2223 ast_cli(a->fd, "decrease_talking_volume");
2224 break;
2226 ast_cli(a->fd, "playback(%s)", menu_action->data.playback_file);
2227 break;
2229 ast_cli(a->fd, "playback_and_continue(%s)", menu_action->data.playback_file);
2230 break;
2232 ast_cli(a->fd, "dialplan_exec(%s,%s,%d)",
2233 menu_action->data.dialplan_args.context,
2234 menu_action->data.dialplan_args.exten,
2235 menu_action->data.dialplan_args.priority);
2236 break;
2238 ast_cli(a->fd, "admin_toggle_conference_lock");
2239 break;
2241 ast_cli(a->fd, "admin_toggle_mute_participants");
2242 break;
2244 ast_cli(a->fd, "participant_count");
2245 break;
2247 ast_cli(a->fd, "admin_kick_last");
2248 break;
2249 case MENU_ACTION_LEAVE:
2250 ast_cli(a->fd, "leave_conference");
2251 break;
2253 ast_cli(a->fd, "set_as_single_video_src");
2254 break;
2256 ast_cli(a->fd, "release_as_single_video_src");
2257 break;
2258 }
2259 action_num++;
2260 }
2261 ast_cli(a->fd,"\n");
2262 }
2263
2264
2265 ao2_unlock(menu);
2266 return CLI_SUCCESS;
2267}
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 2122 of file conf_config_parser.c.

2123{
2124 struct ao2_iterator it;
2125 struct conf_menu *menu;
2126 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
2127
2128 switch (cmd) {
2129 case CLI_INIT:
2130 e->command = "confbridge show menus";
2131 e->usage =
2132 "Usage: confbridge show profile menus\n";
2133 return NULL;
2134 case CLI_GENERATE:
2135 return NULL;
2136 }
2137
2138 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
2139 return NULL;
2140 }
2141
2142 ast_cli(a->fd,"--------- Menus -----------\n");
2143 ao2_lock(cfg->menus);
2144 it = ao2_iterator_init(cfg->menus, 0);
2145 while ((menu = ao2_iterator_next(&it))) {
2146 ast_cli(a->fd,"%s\n", menu->name);
2147 ao2_ref(menu, -1);
2148 }
2150 ao2_unlock(cfg->menus);
2151
2152 return CLI_SUCCESS;
2153}

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 1749 of file conf_config_parser.c.

1750{
1751 struct user_profile u_profile;
1752
1753 switch (cmd) {
1754 case CLI_INIT:
1755 e->command = "confbridge show profile user";
1756 e->usage =
1757 "Usage: confbridge show profile user [<profile name>]\n";
1758 return NULL;
1759 case CLI_GENERATE:
1760 if (a->pos == 4) {
1761 return complete_user_profile_name(a->line, a->word, a->pos, a->n);
1762 }
1763 return NULL;
1764 }
1765
1766 if (a->argc != 5) {
1767 return CLI_SHOWUSAGE;
1768 }
1769
1770 if (!(conf_find_user_profile(NULL, a->argv[4], &u_profile))) {
1771 ast_cli(a->fd, "No conference user profile named '%s' found!\n", a->argv[4]);
1772 return CLI_SUCCESS;
1773 }
1774
1775 ast_cli(a->fd,"--------------------------------------------\n");
1776 ast_cli(a->fd,"Name: %s\n",
1777 u_profile.name);
1778 ast_cli(a->fd,"Admin: %s\n",
1779 u_profile.flags & USER_OPT_ADMIN ?
1780 "true" : "false");
1781 ast_cli(a->fd,"Send Events: %s\n",
1782 u_profile.flags & USER_OPT_SEND_EVENTS ?
1783 "true" : "false");
1784 ast_cli(a->fd,"Echo Events: %s\n",
1785 u_profile.flags & USER_OPT_ECHO_EVENTS ?
1786 "true" : "false");
1787 ast_cli(a->fd,"Marked User: %s\n",
1788 u_profile.flags & USER_OPT_MARKEDUSER ?
1789 "true" : "false");
1790 ast_cli(a->fd,"Start Muted: %s\n",
1791 u_profile.flags & USER_OPT_STARTMUTED?
1792 "true" : "false");
1793 ast_cli(a->fd,"MOH When Empty: %s\n",
1794 u_profile.flags & USER_OPT_MUSICONHOLD ?
1795 "enabled" : "disabled");
1796 ast_cli(a->fd,"MOH Class: %s\n",
1797 ast_strlen_zero(u_profile.moh_class) ?
1798 "default" : u_profile.moh_class);
1799 ast_cli(a->fd,"Announcement: %s\n",
1800 u_profile.announcement);
1801 ast_cli(a->fd,"Quiet: %s\n",
1802 u_profile.flags & USER_OPT_QUIET ?
1803 "enabled" : "disabled");
1804 ast_cli(a->fd,"Hear Join: %s\n",
1805 u_profile.flags & USER_OPT_HEAR_OWN_JOIN_SOUND ?
1806 "enabled" : "disabled");
1807 ast_cli(a->fd,"Wait Marked: %s\n",
1808 u_profile.flags & USER_OPT_WAITMARKED ?
1809 "enabled" : "disabled");
1810 ast_cli(a->fd,"END Marked (All): %s\n",
1811 u_profile.flags & USER_OPT_ENDMARKED ?
1812 "enabled" : "disabled");
1813 ast_cli(a->fd,"END Marked (Any): %s\n",
1814 u_profile.flags & USER_OPT_ENDMARKEDANY ?
1815 "enabled" : "disabled");
1816 ast_cli(a->fd,"Drop_silence: %s\n",
1817 u_profile.flags & USER_OPT_DROP_SILENCE ?
1818 "enabled" : "disabled");
1819 ast_cli(a->fd,"Silence Threshold: %ums\n",
1820 u_profile.silence_threshold);
1821 ast_cli(a->fd,"Talking Threshold: %u\n",
1822 u_profile.talking_threshold);
1823 ast_cli(a->fd,"Denoise: %s\n",
1824 u_profile.flags & USER_OPT_DENOISE ?
1825 "enabled" : "disabled");
1826 ast_cli(a->fd,"Jitterbuffer: %s\n",
1827 u_profile.flags & USER_OPT_JITTERBUFFER ?
1828 "enabled" : "disabled");
1829 ast_cli(a->fd,"Talk Detect Events: %s\n",
1830 u_profile.flags & USER_OPT_TALKER_DETECT ?
1831 "enabled" : "disabled");
1832 ast_cli(a->fd,"DTMF Pass Through: %s\n",
1833 u_profile.flags & USER_OPT_DTMF_PASS ?
1834 "enabled" : "disabled");
1835 ast_cli(a->fd,"PIN: %s\n",
1836 ast_strlen_zero(u_profile.pin) ?
1837 "None" : u_profile.pin);
1838 ast_cli(a->fd,"Announce User Count: %s\n",
1839 u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNT ?
1840 "enabled" : "disabled");
1841 ast_cli(a->fd,"Announce join/leave: %s\n",
1843 u_profile.flags & USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW ?
1844 "enabled (with review)" : "enabled" : "disabled");
1845 ast_cli(a->fd,"Announce User Count all: %s\n",
1846 u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?
1847 "enabled" : "disabled");
1848 ast_cli(a->fd,"Text Messaging: %s\n",
1849 u_profile.flags & USER_OPT_TEXT_MESSAGING ?
1850 "enabled" : "disabled");
1851 ast_cli(a->fd,"Answer Channel: %s\n",
1852 u_profile.flags & USER_OPT_ANSWER_CHANNEL ?
1853 "true" : "false");
1854 ast_cli(a->fd, "\n");
1855
1856 return CLI_SUCCESS;
1857}
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.
char moh_class[128]
Definition confbridge.h:158
char pin[MAX_PIN]
Definition confbridge.h:157

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 1717 of file conf_config_parser.c.

1718{
1719 struct ao2_iterator it;
1720 struct user_profile *u_profile;
1721 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1722
1723 switch (cmd) {
1724 case CLI_INIT:
1725 e->command = "confbridge show profile users";
1726 e->usage =
1727 "Usage: confbridge show profile users\n";
1728 return NULL;
1729 case CLI_GENERATE:
1730 return NULL;
1731 }
1732
1733 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1734 return NULL;
1735 }
1736
1737 ast_cli(a->fd,"--------- User Profiles -----------\n");
1738 ao2_lock(cfg->user_profiles);
1739 it = ao2_iterator_init(cfg->user_profiles, 0);
1740 while ((u_profile = ao2_iterator_next(&it))) {
1741 ast_cli(a->fd,"%s\n", u_profile->name);
1742 ao2_ref(u_profile, -1);
1743 }
1745 ao2_unlock(cfg->user_profiles);
1746
1747 return CLI_SUCCESS;
1748}

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 1021 of file conf_config_parser.c.

1022{
1023 struct conf_menu *menu;
1024 if (!(menu = ao2_alloc(sizeof(*menu), menu_destructor))) {
1025 return NULL;
1026 }
1027 ast_copy_string(menu->name, category, sizeof(menu->name));
1028 return menu;
1029}
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 1122 of file conf_config_parser.c.

1123{
1124 const struct conf_menu *left = obj;
1125 const struct conf_menu *right = arg;
1126 const char *right_name = arg;
1127 int cmp;
1128
1129 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1130 default:
1131 case OBJ_POINTER:
1132 right_name = right->name;
1133 /* Fall through */
1134 case OBJ_KEY:
1135 cmp = strcasecmp(left->name, right_name);
1136 break;
1137 case OBJ_PARTIAL_KEY:
1138 cmp = strncasecmp(left->name, right_name, strlen(right_name));
1139 break;
1140 }
1141 return cmp ? 0 : CMP_MATCH;
1142}

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 1167 of file conf_config_parser.c.

1168{
1169 struct conf_menu *menu = obj;
1170 struct conf_menu_entry *entry = NULL;
1171
1172 while ((entry = AST_LIST_REMOVE_HEAD(&menu->entries, entry))) {
1174 ast_free(entry);
1175 }
1176}

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 1031 of file conf_config_parser.c.

1032{
1033 return ao2_find(container, category, OBJ_KEY);
1034}

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 1144 of file conf_config_parser.c.

1145{
1146 const struct conf_menu *menu = obj;
1147 const char *name = obj;
1148 int hash;
1149
1150 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1151 default:
1152 case OBJ_POINTER:
1153 name = menu->name;
1154 /* Fall through */
1155 case OBJ_KEY:
1156 hash = ast_str_case_hash(name);
1157 break;
1158 case OBJ_PARTIAL_KEY:
1159 /* Should never happen in hash callback. */
1160 ast_assert(0);
1161 hash = 0;
1162 break;
1163 }
1164 return hash;
1165}

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 2858 of file conf_config_parser.c.

2859{
2860 struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2861
2862 return conf_handle_dtmf(bridge_channel, pvt->user, &pvt->menu_entry, pvt->menu);
2863}
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 2845 of file conf_config_parser.c.

2846{
2847 struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2848 struct conf_menu_action *action = NULL;
2849
2850 ao2_cleanup(pvt->menu);
2851
2854 }
2855 ast_free(pvt);
2856}

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 2591 of file conf_config_parser.c.

2592{
2593 add_menu_entry(obj, var->name, var->value);
2594 return 0;
2595}
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 2564 of file conf_config_parser.c.

2565{
2566 struct conf_menu *dst_menu = obj;
2568 RAII_VAR(struct conf_menu *, src_menu, NULL, ao2_cleanup);
2569
2570 if (!cfg) {
2571 return 0;
2572 }
2573
2574 if (!(src_menu = ao2_find(cfg->menus, var->value, OBJ_KEY))) {
2575 return -1;
2576 }
2577
2578 if (conf_menu_profile_copy(dst_menu, src_menu)) {
2579 return -1;
2580 }
2581
2582 return 0;
2583}
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 2338 of file conf_config_parser.c.

2339{
2340 struct bridge_profile *b_profile = obj;
2341
2342 if (strcasecmp(var->name, "mixing_interval")) {
2343 return -1;
2344 }
2345 if (sscanf(var->value, "%30u", &b_profile->mix_interval) != 1) {
2346 return -1;
2347 }
2348 switch (b_profile->mix_interval) {
2349 case 10:
2350 case 20:
2351 case 40:
2352 case 80:
2353 return 0;
2354 default:
2355 return -1;
2356 }
2357}
unsigned int mix_interval
Definition confbridge.h:238

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 2406 of file conf_config_parser.c.

2407{
2408 struct bridge_profile *b_profile = obj;
2409
2410 if (strcasecmp(var->name, "remb_behavior")) {
2411 return -1;
2412 }
2413
2421 );
2422
2423 if (!strcasecmp(var->value, "average")) {
2425 } else if (!strcasecmp(var->value, "lowest")) {
2427 } else if (!strcasecmp(var->value, "highest")) {
2429 } else if (!strcasecmp(var->value, "average_all")) {
2431 } else if (!strcasecmp(var->value, "lowest_all")) {
2433 } else if (!strcasecmp(var->value, "highest_all")) {
2435 } else if (!strcasecmp(var->value, "force")) {
2437 } else {
2438 return -1;
2439 }
2440 return 0;
2441}
@ BRIDGE_OPT_REMB_BEHAVIOR_FORCE
Definition confbridge.h:93
#define ast_clear_flag(p, flag)
Definition utils.h:78
#define ast_set_flag(p, flag)
Definition utils.h:71

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 2450 of file conf_config_parser.c.

2451{
2452 struct bridge_profile *b_profile = obj;
2453 unsigned int *slot;
2454
2455 if (!strcasecmp(var->name, "internal_sample_rate")) {
2456 slot = &b_profile->internal_sample_rate;
2457 if (!strcasecmp(var->value, "auto")) {
2458 *slot = 0;
2459 return 0;
2460 }
2461 } else if (!strcasecmp(var->name, "maximum_sample_rate")) {
2462 slot = &b_profile->maximum_sample_rate;
2463 if (!strcasecmp(var->value, "none")) {
2464 *slot = 0;
2465 return 0;
2466 }
2467 } else {
2468 return -1;
2469 }
2470
2471 return ast_parse_arg(var->value, PARSE_UINT32 | PARSE_IN_RANGE, slot, 8000, 192000);
2472}
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
unsigned int maximum_sample_rate
Definition confbridge.h:237
unsigned int internal_sample_rate
Definition confbridge.h:236

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 1246 of file conf_config_parser.c.

1247{
1248 struct bridge_profile_sounds *sounds = b_profile->sounds;
1249 if (ast_strlen_zero(sound_file)) {
1250 return -1;
1251 }
1252
1253 if (!strcasecmp(sound_name, "sound_only_person")) {
1255 } else if (!strcasecmp(sound_name, "sound_only_one")) {
1256 ast_string_field_set(sounds, onlyone, sound_file);
1257 } else if (!strcasecmp(sound_name, "sound_has_joined")) {
1258 ast_string_field_set(sounds, hasjoin, sound_file);
1259 } else if (!strcasecmp(sound_name, "sound_has_left")) {
1260 ast_string_field_set(sounds, hasleft, sound_file);
1261 } else if (!strcasecmp(sound_name, "sound_kicked")) {
1262 ast_string_field_set(sounds, kicked, sound_file);
1263 } else if (!strcasecmp(sound_name, "sound_muted")) {
1264 ast_string_field_set(sounds, muted, sound_file);
1265 } else if (!strcasecmp(sound_name, "sound_unmuted")) {
1266 ast_string_field_set(sounds, unmuted, sound_file);
1267 } else if (!strcasecmp(sound_name, "sound_binaural_on")) {
1269 } else if (!strcasecmp(sound_name, "sound_binaural_off")) {
1271 } else if (!strcasecmp(sound_name, "sound_there_are")) {
1272 ast_string_field_set(sounds, thereare, sound_file);
1273 } else if (!strcasecmp(sound_name, "sound_other_in_party")) {
1275 } else if (!strcasecmp(sound_name, "sound_place_into_conference")) {
1276 static int deprecation_warning = 1;
1277 if (deprecation_warning) {
1278 ast_log(LOG_WARNING, "sound_place_into_conference is deprecated"
1279 " and unused. Use sound_begin for similar functionality.");
1280 deprecation_warning = 0;
1281 }
1283 } else if (!strcasecmp(sound_name, "sound_wait_for_leader")) {
1285 } else if (!strcasecmp(sound_name, "sound_leader_has_left")) {
1287 } else if (!strcasecmp(sound_name, "sound_get_pin")) {
1288 ast_string_field_set(sounds, getpin, sound_file);
1289 } else if (!strcasecmp(sound_name, "sound_invalid_pin")) {
1291 } else if (!strcasecmp(sound_name, "sound_locked")) {
1292 ast_string_field_set(sounds, locked, sound_file);
1293 } else if (!strcasecmp(sound_name, "sound_unlocked_now")) {
1295 } else if (!strcasecmp(sound_name, "sound_locked_now")) {
1297 } else if (!strcasecmp(sound_name, "sound_error_menu")) {
1299 } else if (!strcasecmp(sound_name, "sound_join")) {
1300 ast_string_field_set(sounds, join, sound_file);
1301 } else if (!strcasecmp(sound_name, "sound_leave")) {
1302 ast_string_field_set(sounds, leave, sound_file);
1303 } else if (!strcasecmp(sound_name, "sound_participants_muted")) {
1305 } else if (!strcasecmp(sound_name, "sound_participants_unmuted")) {
1307 } else if (!strcasecmp(sound_name, "sound_begin")) {
1308 ast_string_field_set(sounds, begin, sound_file);
1309 } else {
1310 return -1;
1311 }
1312
1313 return 0;
1314}
const ast_string_field binauralon
Definition confbridge.h:225
const ast_string_field binauraloff
Definition confbridge.h:225

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 2585 of file conf_config_parser.c.

2586{
2587 set_sound(var->name, var->value, obj);
2588 return 0;
2589}
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 1179 of file conf_config_parser.c.

1180{
1181 const struct user_profile *left = obj;
1182 const struct user_profile *right = arg;
1183 const char *right_name = arg;
1184 int cmp;
1185
1186 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1187 default:
1188 case OBJ_POINTER:
1189 right_name = right->name;
1190 /* Fall through */
1191 case OBJ_KEY:
1192 cmp = strcasecmp(left->name, right_name);
1193 break;
1194 case OBJ_PARTIAL_KEY:
1195 cmp = strncasecmp(left->name, right_name, strlen(right_name));
1196 break;
1197 }
1198 return cmp ? 0 : CMP_MATCH;
1199}

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 1201 of file conf_config_parser.c.

1202{
1203 const struct user_profile *u_profile = obj;
1204 const char *name = obj;
1205 int hash;
1206
1207 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
1208 default:
1209 case OBJ_POINTER:
1210 name = u_profile->name;
1211 /* Fall through */
1212 case OBJ_KEY:
1213 hash = ast_str_case_hash(name);
1214 break;
1215 case OBJ_PARTIAL_KEY:
1216 /* Should never happen in hash callback. */
1217 ast_assert(0);
1218 hash = 0;
1219 break;
1220 }
1221 return hash;
1222}

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 987 of file conf_config_parser.c.

988{
989 struct user_profile *u_profile;
990
991 if (!(u_profile = ao2_alloc(sizeof(*u_profile), user_profile_destructor))) {
992 return NULL;
993 }
994
995 ast_copy_string(u_profile->name, category, sizeof(u_profile->name));
996
997 return u_profile;
998}

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 982 of file conf_config_parser.c.

983{
984 return;
985}

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 1000 of file conf_config_parser.c.

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

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 2443 of file conf_config_parser.c.

2444{
2445 struct user_profile *u_profile = obj;
2446
2447 return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
2448}

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 2597 of file conf_config_parser.c.

2598{
2601 RAII_VAR(struct conf_menu *, menu_profile, NULL, ao2_cleanup);
2602 /* We can only be called as a result of an aco_process_config so this is safe */
2603 struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
2604
2605 if (!cfg) {
2606 return 0;
2607 }
2608
2610 if (!bridge_profile) {
2612 if (!bridge_profile) {
2613 return -1;
2614 }
2615 ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_BRIDGE_PROFILE);
2618 }
2619
2621 if (!user_profile) {
2623 if (!user_profile) {
2624 return -1;
2625 }
2626 ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_USER_PROFILE);
2629 }
2630
2631 menu_profile = ao2_find(cfg->menus, DEFAULT_MENU_PROFILE, OBJ_KEY);
2632 if (!menu_profile) {
2633 menu_profile = menu_alloc(DEFAULT_MENU_PROFILE);
2634 if (!menu_profile) {
2635 return -1;
2636 }
2637 ast_log(AST_LOG_NOTICE, "Adding %s menu to app_confbridge\n", DEFAULT_MENU_PROFILE);
2639 ao2_link(cfg->menus, menu_profile);
2640 }
2641
2642 return 0;
2643}
#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 2359 of file conf_config_parser.c.

2360{
2361 struct bridge_profile *b_profile = obj;
2362
2363 if (strcasecmp(var->name, "video_mode")) {
2364 return -1;
2365 }
2366 if (!strcasecmp(var->value, "first_marked")) {
2367 ast_set_flags_to(b_profile,
2373 } else if (!strcasecmp(var->value, "last_marked")) {
2374 ast_set_flags_to(b_profile,
2380 } else if (!strcasecmp(var->value, "follow_talker")) {
2381 ast_set_flags_to(b_profile,
2387 } else if (!strcasecmp(var->value, "sfu")) {
2388 ast_set_flags_to(b_profile,
2394 } else if (!strcasecmp(var->value, "none")) {
2395 ast_clear_flag(b_profile,
2400 } else {
2401 return -1;
2402 }
2403 return 0;
2404}
#define ast_set_flags_to(p, flag, value)
Definition utils.h:105

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 968 of file conf_config_parser.c.

968 {
969 .type = ACO_ITEM,
970 .name = "bridge_profile",
971 .category_match = ACO_BLACKLIST_EXACT,
972 .category = "general",
973 .matchfield = "type",
974 .matchvalue = "bridge",
975 .item_alloc = bridge_profile_alloc,
976 .item_find = bridge_profile_find,
977 .item_offset = offsetof(struct confbridge_cfg, bridge_profiles),
978};
static void * bridge_profile_find(struct ao2_container *container, const char *category)
@ ACO_ITEM
@ ACO_BLACKLIST_EXACT

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ bridge_types

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

Definition at line 1049 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 2269 of file conf_config_parser.c.

2269 {
2270 AST_CLI_DEFINE(handle_cli_confbridge_show_user_profile, "Show a conference user profile."),
2271 AST_CLI_DEFINE(handle_cli_confbridge_show_bridge_profile, "Show a conference bridge profile."),
2272 AST_CLI_DEFINE(handle_cli_confbridge_show_menu, "Show a conference menu"),
2273 AST_CLI_DEFINE(handle_cli_confbridge_show_user_profiles, "Show a list of conference user profiles."),
2274 AST_CLI_DEFINE(handle_cli_confbridge_show_bridge_profiles, "Show a list of conference bridge profiles."),
2275 AST_CLI_DEFINE(handle_cli_confbridge_show_menus, "Show a list of conference menus"),
2276
2277};
#define AST_CLI_DEFINE(fn, txt,...)
Definition cli.h:197
static char * handle_cli_confbridge_show_user_profiles(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_menus(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_bridge_profile(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)

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 1061 of file conf_config_parser.c.

1061 {
1062 .filename = "confbridge.conf",
1064};

◆ 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 1339 of file conf_config_parser.c.

1339 {
1340 .type = "confbridge",
1342};

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 1054 of file conf_config_parser.c.

1054 {
1055 .type = ACO_GLOBAL,
1056 .name = "global",
1057 .category_match = ACO_WHITELIST_EXACT,
1058 .category = "general",
1059};
@ ACO_GLOBAL
@ ACO_WHITELIST_EXACT

◆ menu_type

struct aco_type menu_type
static

Definition at line 1036 of file conf_config_parser.c.

1036 {
1037 .type = ACO_ITEM,
1038 .name = "menu",
1039 .category_match = ACO_BLACKLIST_EXACT,
1040 .category = "general",
1041 .matchfield = "type",
1042 .matchvalue = "menu",
1043 .item_alloc = menu_alloc,
1044 .item_find = menu_find,
1045 .item_offset = offsetof(struct confbridge_cfg, menus),
1046};

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ menu_types

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

Definition at line 1050 of file conf_config_parser.c.

Referenced by conf_load_config().

◆ user_type

struct aco_type user_type
static

Definition at line 1005 of file conf_config_parser.c.

1005 {
1006 .type = ACO_ITEM,
1007 .name = "user_profile",
1008 .category_match = ACO_BLACKLIST_EXACT,
1009 .category = "general",
1010 .matchfield = "type",
1011 .matchvalue = "user",
1012 .item_alloc = user_profile_alloc,
1013 .item_find = user_profile_find,
1014 .item_offset = offsetof(struct confbridge_cfg, user_profiles),
1015};
static void * user_profile_find(struct ao2_container *container, const char *category)

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ user_types

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

Definition at line 1051 of file conf_config_parser.c.

Referenced by conf_load_config().