Asterisk - The Open Source Telephony Project GIT-master-a358458
Data Structures | Functions | Variables
conf_config_parser.c File Reference

ConfBridge config parser. More...

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

Go to the source code of this file.

Data Structures

struct  confbridge_cfg
 
struct  dtmf_menu_hook_pvt
 
struct  func_confbridge_data
 

Functions

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

Variables

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

Detailed Description

ConfBridge config parser.

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

Definition in file conf_config_parser.c.

Function Documentation

◆ add_action_to_menu_entry()

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

Definition at line 1261 of file conf_config_parser.c.

1262{
1263 struct conf_menu_action *menu_action = ast_calloc(1, sizeof(*menu_action));
1264
1265 if (!menu_action) {
1266 return -1;
1267 }
1268 menu_action->id = id;
1269
1270 switch (id) {
1271 case MENU_ACTION_NOOP:
1284 case MENU_ACTION_LEAVE:
1287 break;
1290 if (!(ast_strlen_zero(databuf))) {
1291 ast_copy_string(menu_action->data.playback_file, databuf, sizeof(menu_action->data.playback_file));
1292 } else {
1293 ast_free(menu_action);
1294 return -1;
1295 }
1296 break;
1298 if (!(ast_strlen_zero(databuf))) {
1303 );
1304 AST_STANDARD_APP_ARGS(args, databuf);
1305 if (!ast_strlen_zero(args.context)) {
1307 args.context,
1308 sizeof(menu_action->data.dialplan_args.context));
1309 }
1310 if (!ast_strlen_zero(args.exten)) {
1312 args.exten,
1313 sizeof(menu_action->data.dialplan_args.exten));
1314 }
1315 menu_action->data.dialplan_args.priority = 1; /* 1 by default */
1316 if (!ast_strlen_zero(args.priority) &&
1317 (sscanf(args.priority, "%30d", &menu_action->data.dialplan_args.priority) != 1)) {
1318 /* invalid priority */
1319 ast_free(menu_action);
1320 return -1;
1321 }
1322 } else {
1323 ast_free(menu_action);
1324 return -1;
1325 }
1326 };
1327
1328 AST_LIST_INSERT_TAIL(&menu_entry->actions, menu_action, action);
1329
1330 return 0;
1331}
enum queue_result id
Definition: app_queue.c:1638
#define ast_free(a)
Definition: astmm.h:180
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
static int priority
@ MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC
Definition: confbridge.h:112
@ MENU_ACTION_SET_SINGLE_VIDEO_SRC
Definition: confbridge.h:111
@ MENU_ACTION_ADMIN_KICK_LAST
Definition: confbridge.h:108
@ MENU_ACTION_TOGGLE_BINAURAL
Definition: confbridge.h:115
@ MENU_ACTION_PLAYBACK
Definition: confbridge.h:98
@ MENU_ACTION_LEAVE
Definition: confbridge.h:109
@ MENU_ACTION_RESET_LISTENING
Definition: confbridge.h:102
@ MENU_ACTION_INCREASE_TALKING
Definition: confbridge.h:104
@ MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS
Definition: confbridge.h:114
@ MENU_ACTION_INCREASE_LISTENING
Definition: confbridge.h:100
@ MENU_ACTION_DIALPLAN_EXEC
Definition: confbridge.h:106
@ MENU_ACTION_DECREASE_LISTENING
Definition: confbridge.h:101
@ MENU_ACTION_PLAYBACK_AND_CONTINUE
Definition: confbridge.h:99
@ MENU_ACTION_ADMIN_TOGGLE_LOCK
Definition: confbridge.h:107
@ MENU_ACTION_DECREASE_TALKING
Definition: confbridge.h:105
@ MENU_ACTION_PARTICIPANT_COUNT
Definition: confbridge.h:113
@ MENU_ACTION_TOGGLE_MUTE
Definition: confbridge.h:97
@ MENU_ACTION_NOOP
Definition: confbridge.h:110
@ MENU_ACTION_RESET_TALKING
Definition: confbridge.h:103
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:731
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
enum conf_menu_action_id id
Definition: confbridge.h:123
char exten[AST_MAX_EXTENSION]
Definition: confbridge.h:128
struct conf_menu_action::@89 action
struct conf_menu_action::@88::@90 dialplan_args
char playback_file[PATH_MAX]
Definition: confbridge.h:125
char context[AST_MAX_CONTEXT]
Definition: confbridge.h:127
union conf_menu_action::@88 data
struct conf_menu_entry::@91 actions
const char * args

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

Referenced by add_menu_entry().

◆ add_menu_entry()

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

Definition at line 1333 of file conf_config_parser.c.

1334{
1335 struct conf_menu_entry *menu_entry = NULL, *cur = NULL;
1336 int res = 0;
1337 char *tmp_action_names = ast_strdupa(action_names);
1338 char *action = NULL;
1339 char *action_args;
1340 char *tmp;
1341 char buf[PATH_MAX];
1342 char *delimiter = ",";
1343
1344 if (!(menu_entry = ast_calloc(1, sizeof(*menu_entry)))) {
1345 return -1;
1346 }
1347
1348 for (;;) {
1349 char *comma;
1350 char *startbrace;
1351 char *endbrace;
1352 unsigned int action_len;
1353
1354 if (ast_strlen_zero(tmp_action_names)) {
1355 break;
1356 }
1357 startbrace = strchr(tmp_action_names, '(');
1358 endbrace = strchr(tmp_action_names, ')');
1359 comma = strchr(tmp_action_names, ',');
1360
1361 /* If the next action has brackets with comma delimited arguments in it,
1362 * make the delimeter ')' instead of a comma to preserve the arguments */
1363 if (startbrace && endbrace && comma && (comma > startbrace && comma < endbrace)) {
1364 delimiter = ")";
1365 } else {
1366 delimiter = ",";
1367 }
1368
1369 if (!(action = strsep(&tmp_action_names, delimiter))) {
1370 break;
1371 }
1372
1373 action = ast_strip(action);
1374 if (ast_strlen_zero(action)) {
1375 continue;
1376 }
1377
1378 action_len = strlen(action);
1379 ast_copy_string(menu_entry->dtmf, dtmf, sizeof(menu_entry->dtmf));
1380 if (!strcasecmp(action, "toggle_mute")) {
1382 } else if (!strcasecmp(action, "toggle_binaural")) {
1384 } else if (!strcasecmp(action, "no_op")) {
1385 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_NOOP, NULL);
1386 } else if (!strcasecmp(action, "increase_listening_volume")) {
1388 } else if (!strcasecmp(action, "decrease_listening_volume")) {
1390 } else if (!strcasecmp(action, "increase_talking_volume")) {
1392 } else if (!strcasecmp(action, "reset_listening_volume")) {
1394 } else if (!strcasecmp(action, "reset_talking_volume")) {
1396 } else if (!strcasecmp(action, "decrease_talking_volume")) {
1398 } else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
1400 } else if (!strcasecmp(action, "admin_toggle_mute_participants")) {
1402 } else if (!strcasecmp(action, "participant_count")) {
1404 } else if (!strcasecmp(action, "admin_kick_last")) {
1406 } else if (!strcasecmp(action, "leave_conference")) {
1407 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_LEAVE, NULL);
1408 } else if (!strcasecmp(action, "set_as_single_video_src")) {
1410 } else if (!strcasecmp(action, "release_as_single_video_src")) {
1412 } else if (!strncasecmp(action, "dialplan_exec(", 14)) {
1413 ast_copy_string(buf, action, sizeof(buf));
1414 action_args = buf;
1415 if ((action_args = strchr(action, '('))) {
1416 action_args++;
1417 }
1418 /* it is possible that this argument may or may not
1419 * have a closing brace at this point, it all depends on if
1420 * comma delimited arguments were provided */
1421 if ((tmp = strchr(action, ')'))) {
1422 *tmp = '\0';
1423 }
1424 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DIALPLAN_EXEC, action_args);
1425 } else if (action_len >= 21 && !strncasecmp(action, "playback_and_continue(", 22)) {
1426 ast_copy_string(buf, action, sizeof(buf));
1427 action_args = buf;
1428 if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1429 *tmp = '\0';
1430 action_args++;
1431 }
1432 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK_AND_CONTINUE, action_args);
1433 } else if (action_len >= 8 && !strncasecmp(action, "playback(", 9)) {
1434 ast_copy_string(buf, action, sizeof(buf));
1435 action_args = buf;
1436 if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1437 *tmp = '\0';
1438 action_args++;
1439 }
1440 res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, action_args);
1441 }
1442 }
1443
1444 /* if adding any of the actions failed, bail */
1445 if (res) {
1446 conf_menu_entry_destroy(menu_entry);
1447 ast_free(menu_entry);
1448 return -1;
1449 }
1450
1451 /* remove any list entry with an identical DTMF sequence for overrides */
1453 if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) {
1456 ast_free(cur);
1457 break;
1458 }
1459 }
1461
1462 AST_LIST_INSERT_TAIL(&menu->entries, menu_entry, entry);
1463
1464 return 0;
1465}
#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 tmp()
Definition: bt_open.c:389
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
char * strsep(char **str, const char *delims)
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
#define NULL
Definition: resample.c:96
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Definition: strings.h:223
Definition: confbridge.h:138
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:140
struct conf_menu::@93 entries
Definition: search.h:40

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, strsep(), and tmp().

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

2093{
2094 struct user_profile *u_profile = obj;
2095
2096 if (strcasecmp(var->name, "announce_user_count_all")) {
2097 return -1;
2098 }
2099 if (ast_true(var->value)) {
2100 u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2101 } else if (ast_false(var->value)) {
2102 u_profile->flags = u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNTALL;
2103 } else if (sscanf(var->value, "%30u", &u_profile->announce_user_count_all_after) == 1) {
2104 u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2105 } else {
2106 return -1;
2107 }
2108 return 0;
2109}
#define var
Definition: ast_expr2f.c:605
@ USER_OPT_ANNOUNCEUSERCOUNTALL
Definition: confbridge.h:66
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition: utils.c:2199
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
Definition: utils.c:2216
unsigned int flags
Definition: confbridge.h:159
unsigned int announce_user_count_all_after
Definition: confbridge.h:160

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

Referenced by conf_load_config().

◆ AO2_GLOBAL_OBJ_STATIC()

static AO2_GLOBAL_OBJ_STATIC ( cfg_handle  )
static

◆ apply_menu_to_user()

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

Definition at line 2662 of file conf_config_parser.c.

2663{
2664 struct conf_menu_entry *menu_entry;
2665
2666 SCOPED_AO2LOCK(menu_lock, menu);
2667 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2668 struct dtmf_menu_hook_pvt *pvt;
2669
2670 if (!(pvt = ast_calloc(1, sizeof(*pvt)))) {
2671 return -1;
2672 }
2673 pvt->user = user;
2674 pvt->menu = ao2_bump(menu);
2675
2677 menu_hook_destroy(pvt);
2678 return -1;
2679 }
2680
2681 if (ast_bridge_dtmf_hook(&user->features, pvt->menu_entry.dtmf,
2683 menu_hook_destroy(pvt);
2684 }
2685 }
2686 strcpy(user->menu_name, menu->name); /* Safe */
2687
2688 return 0;
2689}
#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:3182
static int menu_hook_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
static void menu_hook_destroy(void *hook_pvt)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
Definition: lock.h:604
static char user[512]
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:150
struct conf_menu * menu
struct conf_menu_entry menu_entry
struct confbridge_user * user
structure to hold users read from users.conf

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

Referenced by conf_set_menu_to_user().

◆ bridge_cmp_cb()

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

bridge profile container functions

Definition at line 853 of file conf_config_parser.c.

854{
855 const struct bridge_profile *left = obj;
856 const struct bridge_profile *right = arg;
857 const char *right_name = arg;
858 int cmp;
859
860 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
861 default:
862 case OBJ_POINTER:
863 right_name = right->name;
864 /* Fall through */
865 case OBJ_KEY:
866 cmp = strcasecmp(left->name, right_name);
867 break;
868 case OBJ_PARTIAL_KEY:
869 cmp = strncasecmp(left->name, right_name, strlen(right_name));
870 break;
871 }
872 return cmp ? 0 : CMP_MATCH;
873}
@ CMP_MATCH
Definition: astobj2.h:1027
#define OBJ_KEY
Definition: astobj2.h:1151
#define OBJ_POINTER
Definition: astobj2.h:1150
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1152
unsigned int flags
Definition: confbridge.h:233
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:228

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

Referenced by confbridge_cfg_alloc().

◆ bridge_hash_cb()

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

Definition at line 875 of file conf_config_parser.c.

876{
877 const struct bridge_profile *b_profile = obj;
878 const char *name = obj;
879 int hash;
880
881 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
882 default:
883 case OBJ_POINTER:
884 name = b_profile->name;
885 /* Fall through */
886 case OBJ_KEY:
887 hash = ast_str_case_hash(name);
888 break;
889 case OBJ_PARTIAL_KEY:
890 /* Should never happen in hash callback. */
891 ast_assert(0);
892 hash = 0;
893 break;
894 }
895 return hash;
896}
static const char name[]
Definition: format_mp3.c:68
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
Definition: strings.h:1303
#define ast_assert(a)
Definition: utils.h:739

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

Referenced by confbridge_cfg_alloc().

◆ bridge_profile_alloc()

static void * bridge_profile_alloc ( const char *  category)
static

Definition at line 722 of file conf_config_parser.c.

723{
724 struct bridge_profile *b_profile;
725
726 if (!(b_profile = ao2_alloc(sizeof(*b_profile), bridge_profile_destructor))) {
727 return NULL;
728 }
729
730 if (!(b_profile->sounds = bridge_profile_sounds_alloc())) {
731 ao2_ref(b_profile, -1);
732 return NULL;
733 }
734
735 ast_copy_string(b_profile->name, category, sizeof(b_profile->name));
736
737 return b_profile;
738}
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:409
static void bridge_profile_destructor(void *obj)
static struct bridge_profile_sounds * bridge_profile_sounds_alloc(void)
struct bridge_profile_sounds * sounds
Definition: confbridge.h:238

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

Referenced by verify_default_profiles().

◆ bridge_profile_destructor()

static void bridge_profile_destructor ( void *  obj)
static

Definition at line 716 of file conf_config_parser.c.

717{
718 struct bridge_profile *b_profile = obj;
719 ao2_cleanup(b_profile->sounds);
720}
#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 740 of file conf_config_parser.c.

741{
742 return ao2_find(container, category, OBJ_KEY);
743}
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1736
struct ao2_container * container
Definition: res_fax.c:501

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

1009{
1011
1012 if (!sounds) {
1013 return NULL;
1014 }
1015 if (ast_string_field_init(sounds, 512)) {
1016 ao2_ref(sounds, -1);
1017 return NULL;
1018 }
1019
1020 return sounds;
1021}
static void bridge_profile_sounds_destroy_cb(void *obj)
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:359

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

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

◆ bridge_profile_sounds_destroy_cb()

static void bridge_profile_sounds_destroy_cb ( void *  obj)
static

Bridge Profile Sounds functions

Definition at line 1002 of file conf_config_parser.c.

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

References ast_string_field_free_memory, and sounds.

Referenced by bridge_profile_sounds_alloc().

◆ bridge_template_handler()

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

Definition at line 2247 of file conf_config_parser.c.

2248{
2249 struct bridge_profile *b_profile = obj;
2251 struct bridge_profile_sounds *oldsounds = b_profile->sounds;
2252
2253 if (!sounds) {
2254 return -1;
2255 }
2256 if (!(conf_find_bridge_profile(NULL, var->value, b_profile))) {
2257 ao2_ref(sounds, -1);
2258 return -1;
2259 }
2260 /* Using a bridge profile as a template is a little complicated due to the sounds. Since the sounds
2261 * structure of a dynamic profile will need to be altered, a completely new sounds structure must be
2262 * created instead of simply holding a reference to the one built by the config file. */
2286
2287 ao2_ref(b_profile->sounds, -1); /* sounds struct copied over to it from the template by reference only. */
2288 ao2_ref(oldsounds, -1); /* original sounds struct we don't need anymore */
2289 b_profile->sounds = sounds; /* the new sounds struct that is a deep copy of the one from the template. */
2290
2291 return 0;
2292}
const struct bridge_profile * conf_find_bridge_profile(struct ast_channel *chan, const char *bridge_profile_name, struct bridge_profile *result)
Find a bridge profile given a bridge profile's name and store that profile in result structure.
static unsigned char leave[]
Definition: leave.h:12
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
const ast_string_field waitforleader
Definition: confbridge.h:224
const ast_string_field invalidpin
Definition: confbridge.h:224
const ast_string_field placeintoconf
Definition: confbridge.h:224
const ast_string_field onlyone
Definition: confbridge.h:224
const ast_string_field otherinparty
Definition: confbridge.h:224
const ast_string_field unlockednow
Definition: confbridge.h:224
const ast_string_field getpin
Definition: confbridge.h:224
const ast_string_field errormenu
Definition: confbridge.h:224
const ast_string_field participantsunmuted
Definition: confbridge.h:224
const ast_string_field participantsmuted
Definition: confbridge.h:224
const ast_string_field leave
Definition: confbridge.h:224
const ast_string_field locked
Definition: confbridge.h:224
const ast_string_field join
Definition: confbridge.h:224
const ast_string_field kicked
Definition: confbridge.h:224
const ast_string_field hasleft
Definition: confbridge.h:224
const ast_string_field unmuted
Definition: confbridge.h:224
const ast_string_field leaderhasleft
Definition: confbridge.h:224
const ast_string_field lockednow
Definition: confbridge.h:224
const ast_string_field hasjoin
Definition: confbridge.h:224
const ast_string_field onlyperson
Definition: confbridge.h:224
const ast_string_field thereare
Definition: confbridge.h:224
const ast_string_field muted
Definition: confbridge.h:224
const ast_string_field begin
Definition: confbridge.h:224

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

Referenced by conf_load_config().

◆ complete_bridge_profile_name()

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

Definition at line 1636 of file conf_config_parser.c.

1637{
1638 int which = 0;
1639 char *res = NULL;
1640 int wordlen = strlen(word);
1641 struct ao2_iterator i;
1642 struct bridge_profile *b_profile = NULL;
1644
1645 if (!cfg) {
1646 return NULL;
1647 }
1648
1649 i = ao2_iterator_init(cfg->bridge_profiles, 0);
1650 while ((b_profile = ao2_iterator_next(&i))) {
1651 if (!strncasecmp(b_profile->name, word, wordlen) && ++which > state) {
1652 res = ast_strdup(b_profile->name);
1653 ao2_ref(b_profile, -1);
1654 break;
1655 }
1656 ao2_ref(b_profile, -1);
1657 }
1659
1660 return res;
1661}
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
Definition: astobj2.h:918
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
short word
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

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

Referenced by handle_cli_confbridge_show_bridge_profile().

◆ complete_menu_name()

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

Definition at line 1868 of file conf_config_parser.c.

1869{
1870 int which = 0;
1871 char *res = NULL;
1872 int wordlen = strlen(word);
1873 struct ao2_iterator i;
1874 struct conf_menu *menu = NULL;
1876
1877 if (!cfg) {
1878 return NULL;
1879 }
1880
1881 i = ao2_iterator_init(cfg->menus, 0);
1882 while ((menu = ao2_iterator_next(&i))) {
1883 if (!strncasecmp(menu->name, word, wordlen) && ++which > state) {
1884 res = ast_strdup(menu->name);
1885 ao2_ref(menu, -1);
1886 break;
1887 }
1888 ao2_ref(menu, -1);
1889 }
1891
1892 return res;
1893}

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

1468{
1469 int which = 0;
1470 char *res = NULL;
1471 int wordlen = strlen(word);
1472 struct ao2_iterator i;
1473 struct user_profile *u_profile = NULL;
1475
1476 if (!cfg) {
1477 return NULL;
1478 }
1479
1480 i = ao2_iterator_init(cfg->user_profiles, 0);
1481 while ((u_profile = ao2_iterator_next(&i))) {
1482 if (!strncasecmp(u_profile->name, word, wordlen) && ++which > state) {
1483 res = ast_strdup(u_profile->name);
1484 ao2_ref(u_profile, -1);
1485 break;
1486 }
1487 ao2_ref(u_profile, -1);
1488 }
1490
1491 return res;
1492}
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:155

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

Referenced by handle_cli_confbridge_show_user_profile().

◆ conf_bridge_profile_copy()

void conf_bridge_profile_copy ( struct bridge_profile dst,
struct bridge_profile src 
)

copies a bridge profile

Note
conf_bridge_profile_destroy must be called on the dst structure

Definition at line 2558 of file conf_config_parser.c.

2559{
2560 *dst = *src;
2561 if (src->sounds) {
2562 ao2_ref(src->sounds, +1);
2563 }
2564}

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

2567{
2568 if (b_profile->sounds) {
2569 ao2_ref(b_profile->sounds, -1);
2570 b_profile->sounds = NULL;
2571 }
2572}

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

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

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

Referenced by conf_load_config(), and unload_module().

◆ conf_find_bridge_profile()

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

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

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

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

Return values
bridgeprofile on success
NULLon failure

Definition at line 2574 of file conf_config_parser.c.

2575{
2576 struct bridge_profile *tmp2;
2577 struct ast_datastore *datastore = NULL;
2578 struct func_confbridge_data *b_data = NULL;
2580
2581 if (chan && ast_strlen_zero(bridge_profile_name)) {
2582 ast_channel_lock(chan);
2584 ast_channel_unlock(chan);
2585 if (datastore) {
2586 b_data = datastore->data;
2587 if (b_data->b_usable) {
2589 return result;
2590 }
2591 }
2592 }
2593
2594 if (!cfg) {
2595 return NULL;
2596 }
2597 if (ast_strlen_zero(bridge_profile_name)) {
2598 bridge_profile_name = DEFAULT_BRIDGE_PROFILE;
2599 }
2600 if (!(tmp2 = ao2_find(cfg->bridge_profiles, bridge_profile_name, OBJ_KEY))) {
2601 return NULL;
2602 }
2603 ao2_lock(tmp2);
2605 ao2_unlock(tmp2);
2606 ao2_ref(tmp2, -1);
2607
2608 return result;
2609}
#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:2922
#define ast_channel_unlock(chan)
Definition: channel.h:2923
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:2399
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 2645 of file conf_config_parser.c.

2646{
2647 struct conf_menu_entry *menu_entry = NULL;
2648
2649 ao2_lock(menu);
2650 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2651 if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {
2652 copy_menu_entry(result, menu_entry);
2653 ao2_unlock(menu);
2654 return 1;
2655 }
2656 }
2657 ao2_unlock(menu);
2658
2659 return 0;
2660}

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

2522{
2523 struct user_profile *tmp2;
2524 struct ast_datastore *datastore = NULL;
2525 struct func_confbridge_data *b_data = NULL;
2527
2528 if (chan && ast_strlen_zero(user_profile_name)) {
2529 ast_channel_lock(chan);
2531 ast_channel_unlock(chan);
2532 if (datastore) {
2533 b_data = datastore->data;
2534 if (b_data->u_usable) {
2536 return result;
2537 }
2538 }
2539 }
2540
2541 if (!cfg) {
2542 return NULL;
2543 }
2544 if (ast_strlen_zero(user_profile_name)) {
2545 user_profile_name = DEFAULT_USER_PROFILE;
2546 }
2547 if (!(tmp2 = ao2_find(cfg->user_profiles, user_profile_name, OBJ_KEY))) {
2548 return NULL;
2549 }
2550 ao2_lock(tmp2);
2552 ao2_unlock(tmp2);
2553 ao2_ref(tmp2, -1);
2554
2555 return result;
2556}
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 2418 of file conf_config_parser.c.

2419{
2420 if (aco_info_init(&cfg_info)) {
2421 return -1;
2422 }
2423
2424 /* User options */
2425 aco_option_register(&cfg_info, "type", ACO_EXACT, user_types, NULL, OPT_NOOP_T, 0, 0);
2426 aco_option_register(&cfg_info, "admin", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ADMIN);
2427 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);
2428 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);
2429 aco_option_register(&cfg_info, "marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MARKEDUSER);
2430 aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
2431 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);
2432 aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
2433 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);
2434 aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
2435 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);
2436 /* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
2437 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);
2438 aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
2439 aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
2440 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);
2441 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);
2442 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);
2443 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);
2444 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);
2446 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));
2447 aco_option_register(&cfg_info, "announcement", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, announcement));
2448 aco_option_register(&cfg_info, "denoise", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DENOISE);
2449 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);
2450 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));
2451 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));
2452 aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
2453 aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));
2454 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);
2455 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);
2456
2457 /* This option should only be used with the CONFBRIDGE dialplan function */
2459
2460/* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
2461 /* Bridge options */
2462 aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
2463 aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
2464 aco_option_register_custom(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "auto", sample_rate_handler, 0);
2465 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);
2466 aco_option_register_custom(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "none", sample_rate_handler, 0);
2467 aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
2468 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);
2470 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);
2471 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);
2472 aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
2473 aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
2474 aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
2475 aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
2479 aco_option_register(&cfg_info, "video_update_discard", ACO_EXACT, bridge_types, "2000", OPT_UINT_T, 0, FLDSET(struct bridge_profile, video_update_discard));
2480 aco_option_register(&cfg_info, "remb_send_interval", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_send_interval));
2481 aco_option_register_custom(&cfg_info, "remb_behavior", ACO_EXACT, bridge_types, "average", remb_behavior_handler, 0);
2482 aco_option_register(&cfg_info, "remb_estimated_bitrate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_estimated_bitrate));
2483 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);
2484 /* This option should only be used with the CONFBRIDGE dialplan function */
2486
2487 /* Menu options */
2488 aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
2489 /* This option should only be used with the CONFBRIDGE dialplan function */
2491 aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
2492
2493 if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
2494 goto error;
2495 }
2496
2498 goto error;
2499 }
2500
2501 return 0;
2502error:
2504 return -1;
2505}
#define __stringify(x)
Definition: asterisk.h:216
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:325
static char language[MAX_LANGUAGE]
Definition: chan_iax2.c:324
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
static int user_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int remb_behavior_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int announce_user_count_all_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int sample_rate_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct aco_type * user_types[]
static int video_mode_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int sound_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct aco_type * bridge_types[]
static struct aco_type * menu_types[]
void conf_destroy_config(void)
destroy the information loaded from the confbridge.conf file
static int menu_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int menu_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int bridge_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int mix_interval_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_SILENCE_THRESHOLD
Definition: confbridge.h:49
@ USER_OPT_ENDMARKED
Definition: confbridge.h:60
@ USER_OPT_WAITMARKED
Definition: confbridge.h:59
@ USER_OPT_HEAR_OWN_JOIN_SOUND
Definition: confbridge.h:73
@ USER_OPT_TEXT_MESSAGING
Definition: confbridge.h:71
@ USER_OPT_QUIET
Definition: confbridge.h:57
@ USER_OPT_DENOISE
Definition: confbridge.h:61
@ USER_OPT_MARKEDUSER
Definition: confbridge.h:54
@ USER_OPT_DTMF_PASS
Definition: confbridge.h:65
@ USER_OPT_NOONLYPERSON
Definition: confbridge.h:53
@ USER_OPT_TALKER_DETECT
Definition: confbridge.h:63
@ USER_OPT_MUSICONHOLD
Definition: confbridge.h:56
@ USER_OPT_ANNOUNCEUSERCOUNT
Definition: confbridge.h:58
@ USER_OPT_STARTMUTED
Definition: confbridge.h:55
@ USER_OPT_DROP_SILENCE
Definition: confbridge.h:64
@ USER_OPT_ANSWER_CHANNEL
Definition: confbridge.h:72
@ USER_OPT_SEND_EVENTS
Definition: confbridge.h:69
@ USER_OPT_ENDMARKEDANY
Definition: confbridge.h:74
@ USER_OPT_ADMIN
Definition: confbridge.h:52
@ USER_OPT_JITTERBUFFER
Definition: confbridge.h:67
@ USER_OPT_ECHO_EVENTS
Definition: confbridge.h:70
@ USER_OPT_ANNOUNCE_JOIN_LEAVE
Definition: confbridge.h:62
@ USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW
Definition: confbridge.h:68
#define DEFAULT_TALKING_THRESHOLD
Definition: confbridge.h:46
@ BRIDGE_OPT_BINAURAL_ACTIVE
Definition: confbridge.h:84
@ BRIDGE_OPT_RECORD_CONFERENCE
Definition: confbridge.h:78
@ BRIDGE_OPT_RECORD_FILE_TIMESTAMP
Definition: confbridge.h:83
@ BRIDGE_OPT_ENABLE_EVENTS
Definition: confbridge.h:89
@ BRIDGE_OPT_RECORD_FILE_APPEND
Definition: confbridge.h:82
@ ACO_PREFIX
@ ACO_EXACT
@ ACO_REGEX
@ ACO_PROCESS_ERROR
Their was an error and no changes were applied.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_BOOLFLAG_T
Type for default option handler for bools (ast_true/ast_false) that are stored in a flag.
@ OPT_CHAR_ARRAY_T
Type for default option handler for character array strings.
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
int error(const char *format,...)
Definition: utils/frame.c:999

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

Referenced by load_module().

◆ conf_menu_entry_destroy()

void conf_menu_entry_destroy ( struct conf_menu_entry menu_entry)

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

Definition at line 2637 of file conf_config_parser.c.

2638{
2639 struct conf_menu_action *menu_action = NULL;
2640 while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
2641 ast_free(menu_action);
2642 }
2643}
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:833

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

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

◆ conf_menu_profile_copy()

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

Definition at line 2314 of file conf_config_parser.c.

2315{
2316 /* Copy each menu item to the dst struct */
2317 struct conf_menu_entry *cur;
2318
2319 AST_LIST_TRAVERSE(&src->entries, cur, entry) {
2320 struct conf_menu_entry *cpy;
2321
2322 if (!(cpy = ast_calloc(1, sizeof(*cpy)))) {
2323 return -1;
2324 }
2325
2326 if (copy_menu_entry(cpy, cur)) {
2328 ast_free(cpy);
2329 return -1;
2330 }
2331 AST_LIST_INSERT_TAIL(&dst->entries, cpy, entry);
2332 }
2333
2334 return 0;
2335}

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

2508{
2509 if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
2510 /* On a reload, just keep the config we already have in place. */
2511 return -1;
2512 }
2513 return 0;
2514}

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

2692{
2694 RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2695
2696 if (chan && ast_strlen_zero(menu_profile_name)) {
2697 struct ast_datastore *datastore;
2698 struct func_confbridge_data *b_data;
2699
2700 ast_channel_lock(chan);
2702 ast_channel_unlock(chan);
2703 if (datastore) {
2704 /* If a menu exists in the CONFBRIDGE function datastore, use it. */
2705 b_data = datastore->data;
2706 if (b_data->m_usable) {
2707 menu = ao2_bump(b_data->menu);
2708 return apply_menu_to_user(user, menu);
2709 }
2710 }
2711 }
2712
2713 /* Otherwise, we need to get whatever menu profile is specified to use (or default). */
2714 if (!cfg) {
2715 return -1;
2716 }
2717
2718 if (ast_strlen_zero(menu_profile_name)) {
2719 menu_profile_name = DEFAULT_MENU_PROFILE;
2720 }
2721
2722 if (!(menu = ao2_find(cfg->menus, menu_profile_name, OBJ_KEY))) {
2723 return -1;
2724 }
2725
2726 return apply_menu_to_user(user, menu);
2727}
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 2516 of file conf_config_parser.c.

2517{
2518 *dst = *src;
2519}

Referenced by conf_find_user_profile().

◆ confbridge_cfg_alloc()

void * confbridge_cfg_alloc ( void  )
static

Definition at line 2060 of file conf_config_parser.c.

2061{
2062 struct confbridge_cfg *cfg;
2063
2064 if (!(cfg = ao2_alloc(sizeof(*cfg), confbridge_cfg_destructor))) {
2065 return NULL;
2066 }
2067
2070 if (!cfg->user_profiles) {
2071 goto error;
2072 }
2073
2076 if (!cfg->bridge_profiles) {
2077 goto error;
2078 }
2079
2082 if (!cfg->menus) {
2083 goto error;
2084 }
2085
2086 return cfg;
2087error:
2088 ao2_ref(cfg, -1);
2089 return NULL;
2090}
@ 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 2052 of file conf_config_parser.c.

2053{
2054 struct confbridge_cfg *cfg = obj;
2057 ao2_cleanup(cfg->menus);
2058}

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

2295{
2296 struct conf_menu_action *menu_action;
2297 struct conf_menu_action *new_menu_action;
2298
2299 ast_copy_string(dst->dtmf, src->dtmf, sizeof(dst->dtmf));
2301
2302 AST_LIST_TRAVERSE(&src->actions, menu_action, action) {
2303 if (!(new_menu_action = ast_calloc(1, sizeof(*new_menu_action)))) {
2304 return -1;
2305 }
2306 memcpy(new_menu_action, menu_action, sizeof(*new_menu_action));
2307 AST_LIST_NEXT(new_menu_action, action) = NULL;
2308 AST_LIST_INSERT_TAIL(&dst->actions, new_menu_action, action);
2309 }
2310
2311 return 0;
2312}
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
Definition: linkedlists.h:681
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:439

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

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

◆ func_confbridge_data_destructor()

static void func_confbridge_data_destructor ( struct func_confbridge_data b_data)
static

Definition at line 1103 of file conf_config_parser.c.

1104{
1106 ao2_cleanup(b_data->menu);
1107 ast_free(b_data);
1108}
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 1110 of file conf_config_parser.c.

1111{
1112 struct func_confbridge_data *b_data = data;
1114};
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 1121 of file conf_config_parser.c.

1122{
1123 struct ast_datastore *datastore;
1124 struct func_confbridge_data *b_data;
1125 char *parse;
1126 struct ast_variable tmpvar = { 0, };
1127 struct ast_variable template = {
1128 .name = "template",
1129 .file = "CONFBRIDGE"
1130 };
1133 AST_APP_ARG(option);
1134 );
1135
1136 if (!chan) {
1137 ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1138 return -1;
1139 }
1140
1141 /* parse all the required arguments and make sure they exist. */
1142 if (ast_strlen_zero(data)) {
1143 return -1;
1144 }
1145 parse = ast_strdupa(data);
1147 if (ast_strlen_zero(args.type) || ast_strlen_zero(args.option)) {
1148 return -1;
1149 }
1150
1151 ast_channel_lock(chan);
1153 if (!datastore) {
1155 if (!datastore) {
1156 ast_channel_unlock(chan);
1157 return 0;
1158 }
1159 b_data = ast_calloc(1, sizeof(*b_data));
1160 if (!b_data) {
1161 ast_channel_unlock(chan);
1162 ast_datastore_free(datastore);
1163 return 0;
1164 }
1165 datastore->data = b_data;
1167 if (!b_data->b_profile.sounds) {
1168 ast_channel_unlock(chan);
1169 ast_datastore_free(datastore);
1170 return 0;
1171 }
1172 if (!(b_data->menu = menu_alloc("dialplan"))) {
1173 ast_channel_unlock(chan);
1174 ast_datastore_free(datastore);
1175 return 0;
1176 }
1177 ast_channel_datastore_add(chan, datastore);
1178 } else {
1179 b_data = datastore->data;
1180 }
1181 ast_channel_unlock(chan);
1182
1183 /* SET(CONFBRIDGE(type,option)=value) */
1184 if (!value) {
1185 value = "";
1186 }
1187 tmpvar.name = args.option;
1188 tmpvar.value = value;
1189 tmpvar.file = "CONFBRIDGE";
1190 if (!strcasecmp(args.type, "bridge")) {
1191 if (!strcasecmp(args.option, "clear")) {
1192 b_data->b_usable = 0;
1194 memset(&b_data->b_profile, 0, sizeof(b_data->b_profile)) ;
1195 if (!(b_data->b_profile.sounds = bridge_profile_sounds_alloc())) {
1196 /* If this reallocation fails, the datastore has become unusable and must be destroyed. */
1197 ast_channel_lock(chan);
1198 ast_channel_datastore_remove(chan, datastore);
1199 ast_channel_unlock(chan);
1200 ast_datastore_free(datastore);
1201 }
1202 return 0;
1203 }
1204
1205 if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) {
1206 template.value = DEFAULT_BRIDGE_PROFILE;
1207 aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile);
1208 }
1209
1210 if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
1211 b_data->b_usable = 1;
1212 return 0;
1213 }
1214 } else if (!strcasecmp(args.type, "user")) {
1215 if (!strcasecmp(args.option, "clear")) {
1216 b_data->u_usable = 0;
1218 memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
1219 return 0;
1220 }
1221
1222 if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) {
1223 template.value = DEFAULT_USER_PROFILE;
1224 aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile);
1225 }
1226
1227 if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
1228 b_data->u_usable = 1;
1229 return 0;
1230 }
1231 } else if (!strcasecmp(args.type, "menu")) {
1232 if (!strcasecmp(args.option, "clear")) {
1233 b_data->m_usable = 0;
1234 ao2_cleanup(b_data->menu);
1235 if (!(b_data->menu = menu_alloc("dialplan"))) {
1236 /* If this reallocation fails, the datastore has become unusable and must be destroyed */
1237 ast_channel_lock(chan);
1238 ast_channel_datastore_remove(chan, datastore);
1239 ast_channel_unlock(chan);
1240 ast_datastore_free(datastore);
1241 }
1242 return 0;
1243 }
1244
1245 if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) {
1246 template.value = DEFAULT_MENU_PROFILE;
1247 aco_process_var(&menu_type, "dialplan", &template, &b_data->menu);
1248 }
1249
1250 if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
1251 b_data->m_usable = 1;
1252 return 0;
1253 }
1254 }
1255
1256 ast_log(LOG_WARNING, "%s(%s,%s) cannot be set to '%s'. Invalid type, option, or value.\n",
1257 cmd, args.type, args.option, value);
1258 return -1;
1259}
#define ast_log
Definition: astobj2.c:42
static const char type[]
Definition: chan_ooh323.c:109
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2385
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2394
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 1696 of file conf_config_parser.c.

1697{
1698 struct bridge_profile b_profile;
1699 char tmp[64];
1700
1701 switch (cmd) {
1702 case CLI_INIT:
1703 e->command = "confbridge show profile bridge";
1704 e->usage =
1705 "Usage: confbridge show profile bridge <profile name>\n";
1706 return NULL;
1707 case CLI_GENERATE:
1708 if (a->pos == 4) {
1709 return complete_bridge_profile_name(a->line, a->word, a->pos, a->n);
1710 }
1711 return NULL;
1712 }
1713
1714 if (a->argc != 5) {
1715 return CLI_SHOWUSAGE;
1716 }
1717
1718 if (!(conf_find_bridge_profile(NULL, a->argv[4], &b_profile))) {
1719 ast_cli(a->fd, "No conference bridge profile named '%s' found!\n", a->argv[4]);
1720 return CLI_SUCCESS;
1721 }
1722
1723 ast_cli(a->fd,"--------------------------------------------\n");
1724 ast_cli(a->fd,"Name: %s\n", b_profile.name);
1725 ast_cli(a->fd,"Language: %s\n", b_profile.language);
1726
1727 if (b_profile.internal_sample_rate) {
1728 snprintf(tmp, sizeof(tmp), "%u", b_profile.internal_sample_rate);
1729 } else {
1730 ast_copy_string(tmp, "auto", sizeof(tmp));
1731 }
1732 ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
1733
1734 if (b_profile.maximum_sample_rate) {
1735 snprintf(tmp, sizeof(tmp), "%u", b_profile.maximum_sample_rate);
1736 } else {
1737 ast_copy_string(tmp, "none", sizeof(tmp));
1738 }
1739 ast_cli(a->fd,"Maximum Sample Rate: %s\n", tmp);
1740
1741 if (b_profile.mix_interval) {
1742 ast_cli(a->fd,"Mixing Interval: %u\n", b_profile.mix_interval);
1743 } else {
1744 ast_cli(a->fd,"Mixing Interval: Default 20ms\n");
1745 }
1746
1747 ast_cli(a->fd,"Record Conference: %s\n",
1748 b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
1749 "yes" : "no");
1750
1751 ast_cli(a->fd,"Record File Append: %s\n",
1752 b_profile.flags & BRIDGE_OPT_RECORD_FILE_APPEND ?
1753 "yes" : "no");
1754
1755 ast_cli(a->fd,"Record File Timestamp: %s\n",
1756 b_profile.flags & BRIDGE_OPT_RECORD_FILE_TIMESTAMP ?
1757 "yes" : "no");
1758
1759 ast_cli(a->fd,"Record File: %s\n",
1760 ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
1761 b_profile.rec_file);
1762
1763 ast_cli(a->fd,"Record Options: %s\n",
1764 b_profile.rec_options);
1765
1766 ast_cli(a->fd,"Record Command: %s\n",
1767 b_profile.rec_command);
1768
1769 if (b_profile.max_members) {
1770 ast_cli(a->fd,"Max Members: %u\n", b_profile.max_members);
1771 } else {
1772 ast_cli(a->fd,"Max Members: No Limit\n");
1773 }
1774
1775 ast_cli(a->fd,"Registration context: %s\n", b_profile.regcontext);
1776
1777 switch (b_profile.flags
1783 ast_cli(a->fd, "Video Mode: last_marked\n");
1784 break;
1786 ast_cli(a->fd, "Video Mode: first_marked\n");
1787 break;
1789 ast_cli(a->fd, "Video Mode: follow_talker\n");
1790 break;
1792 ast_cli(a->fd, "Video Mode: sfu\n");
1793 break;
1794 case 0:
1795 ast_cli(a->fd, "Video Mode: no video\n");
1796 break;
1797 default:
1798 /* Opps. We have more than one video mode flag set. */
1799 ast_assert(0);
1800 break;
1801 }
1802
1803 ast_cli(a->fd,"Video Update Discard: %u\n", b_profile.video_update_discard);
1804 ast_cli(a->fd,"REMB Send Interval: %u\n", b_profile.remb_send_interval);
1805
1806 switch (b_profile.flags
1811 ast_cli(a->fd, "REMB Behavior: average\n");
1812 break;
1814 ast_cli(a->fd, "REMB Behavior: lowest\n");
1815 break;
1817 ast_cli(a->fd, "REMB Behavior: highest\n");
1818 break;
1820 ast_cli(a->fd, "REMB Behavior: average_all\n");
1821 break;
1823 ast_cli(a->fd, "REMB Behavior: lowest_all\n");
1824 break;
1826 ast_cli(a->fd, "REMB Behavior: highest_all\n");
1827 break;
1828 default:
1829 ast_assert(0);
1830 break;
1831 }
1832
1833 ast_cli(a->fd,"Enable Events: %s\n",
1834 b_profile.flags & BRIDGE_OPT_ENABLE_EVENTS ?
1835 "yes" : "no");
1836
1837 ast_cli(a->fd,"sound_only_person: %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
1838 ast_cli(a->fd,"sound_only_one: %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
1839 ast_cli(a->fd,"sound_has_joined: %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
1840 ast_cli(a->fd,"sound_has_left: %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));
1841 ast_cli(a->fd,"sound_kicked: %s\n", conf_get_sound(CONF_SOUND_KICKED, b_profile.sounds));
1842 ast_cli(a->fd,"sound_muted: %s\n", conf_get_sound(CONF_SOUND_MUTED, b_profile.sounds));
1843 ast_cli(a->fd,"sound_unmuted: %s\n", conf_get_sound(CONF_SOUND_UNMUTED, b_profile.sounds));
1844 ast_cli(a->fd,"sound_binaural_on: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_ON, b_profile.sounds));
1845 ast_cli(a->fd,"sound_binaural_off: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_OFF, b_profile.sounds));
1846 ast_cli(a->fd,"sound_there_are: %s\n", conf_get_sound(CONF_SOUND_THERE_ARE, b_profile.sounds));
1847 ast_cli(a->fd,"sound_other_in_party: %s\n", conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, b_profile.sounds));
1848 ast_cli(a->fd,"sound_place_into_conference: %s\n", conf_get_sound(CONF_SOUND_PLACE_IN_CONF, b_profile.sounds));
1849 ast_cli(a->fd,"sound_wait_for_leader: %s\n", conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, b_profile.sounds));
1850 ast_cli(a->fd,"sound_leader_has_left: %s\n", conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, b_profile.sounds));
1851 ast_cli(a->fd,"sound_get_pin: %s\n", conf_get_sound(CONF_SOUND_GET_PIN, b_profile.sounds));
1852 ast_cli(a->fd,"sound_invalid_pin: %s\n", conf_get_sound(CONF_SOUND_INVALID_PIN, b_profile.sounds));
1853 ast_cli(a->fd,"sound_locked: %s\n", conf_get_sound(CONF_SOUND_LOCKED, b_profile.sounds));
1854 ast_cli(a->fd,"sound_unlocked_now: %s\n", conf_get_sound(CONF_SOUND_UNLOCKED_NOW, b_profile.sounds));
1855 ast_cli(a->fd,"sound_lockednow: %s\n", conf_get_sound(CONF_SOUND_LOCKED_NOW, b_profile.sounds));
1856 ast_cli(a->fd,"sound_error_menu: %s\n", conf_get_sound(CONF_SOUND_ERROR_MENU, b_profile.sounds));
1857 ast_cli(a->fd,"sound_join: %s\n", conf_get_sound(CONF_SOUND_JOIN, b_profile.sounds));
1858 ast_cli(a->fd,"sound_leave: %s\n", conf_get_sound(CONF_SOUND_LEAVE, b_profile.sounds));
1859 ast_cli(a->fd,"sound_participants_muted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, b_profile.sounds));
1860 ast_cli(a->fd,"sound_participants_unmuted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, b_profile.sounds));
1861 ast_cli(a->fd,"sound_begin: %s\n", conf_get_sound(CONF_SOUND_BEGIN, b_profile.sounds));
1862 ast_cli(a->fd,"\n");
1863
1864 conf_bridge_profile_destroy(&b_profile);
1865 return CLI_SUCCESS;
1866}
const char * conf_get_sound(enum conf_sounds sound, struct bridge_profile_sounds *custom_sounds)
Looks to see if sound file is stored in bridge profile sounds, if not default sound is provided.
#define CLI_SHOWUSAGE
Definition: cli.h:45
#define CLI_SUCCESS
Definition: cli.h:44
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
@ CLI_INIT
Definition: cli.h:152
@ CLI_GENERATE
Definition: cli.h:153
static char * complete_bridge_profile_name(const char *line, const char *word, int pos, int state)
@ CONF_SOUND_JOIN
Definition: confbridge.h:188
@ CONF_SOUND_OTHER_IN_PARTY
Definition: confbridge.h:177
@ CONF_SOUND_INVALID_PIN
Definition: confbridge.h:182
@ CONF_SOUND_LOCKED_NOW
Definition: confbridge.h:185
@ CONF_SOUND_THERE_ARE
Definition: confbridge.h:176
@ CONF_SOUND_ONLY_ONE
Definition: confbridge.h:175
@ CONF_SOUND_GET_PIN
Definition: confbridge.h:181
@ CONF_SOUND_ERROR_MENU
Definition: confbridge.h:187
@ CONF_SOUND_PARTICIPANTS_UNMUTED
Definition: confbridge.h:191
@ CONF_SOUND_BINAURAL_ON
Definition: confbridge.h:193
@ CONF_SOUND_ONLY_PERSON
Definition: confbridge.h:183
@ CONF_SOUND_BEGIN
Definition: confbridge.h:192
@ CONF_SOUND_PARTICIPANTS_MUTED
Definition: confbridge.h:190
@ CONF_SOUND_WAIT_FOR_LEADER
Definition: confbridge.h:179
@ CONF_SOUND_HAS_LEFT
Definition: confbridge.h:171
@ CONF_SOUND_BINAURAL_OFF
Definition: confbridge.h:194
@ CONF_SOUND_LEAVE
Definition: confbridge.h:189
@ CONF_SOUND_LEADER_HAS_LEFT
Definition: confbridge.h:180
@ CONF_SOUND_PLACE_IN_CONF
Definition: confbridge.h:178
@ CONF_SOUND_HAS_JOINED
Definition: confbridge.h:170
@ CONF_SOUND_UNLOCKED_NOW
Definition: confbridge.h:186
@ CONF_SOUND_UNMUTED
Definition: confbridge.h:174
@ CONF_SOUND_MUTED
Definition: confbridge.h:173
@ CONF_SOUND_LOCKED
Definition: confbridge.h:184
@ CONF_SOUND_KICKED
Definition: confbridge.h:172
@ BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE
Definition: confbridge.h:86
@ BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST_ALL
Definition: confbridge.h:92
@ BRIDGE_OPT_REMB_BEHAVIOR_LOWEST
Definition: confbridge.h:87
@ BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER
Definition: confbridge.h:81
@ BRIDGE_OPT_VIDEO_SRC_LAST_MARKED
Definition: confbridge.h:79
@ BRIDGE_OPT_VIDEO_SRC_SFU
Definition: confbridge.h:85
@ BRIDGE_OPT_REMB_BEHAVIOR_LOWEST_ALL
Definition: confbridge.h:91
@ BRIDGE_OPT_REMB_BEHAVIOR_AVERAGE_ALL
Definition: confbridge.h:90
@ BRIDGE_OPT_REMB_BEHAVIOR_HIGHEST
Definition: confbridge.h:88
@ BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
Definition: confbridge.h:80
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
const char * name
static struct test_val a

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

1664{
1665 struct ao2_iterator it;
1666 struct bridge_profile *b_profile;
1667 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1668
1669 switch (cmd) {
1670 case CLI_INIT:
1671 e->command = "confbridge show profile bridges";
1672 e->usage =
1673 "Usage: confbridge show profile bridges\n";
1674 return NULL;
1675 case CLI_GENERATE:
1676 return NULL;
1677 }
1678
1679 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1680 return NULL;
1681 }
1682
1683 ast_cli(a->fd,"--------- Bridge Profiles -----------\n");
1684 ao2_lock(cfg->bridge_profiles);
1685 it = ao2_iterator_init(cfg->bridge_profiles, 0);
1686 while ((b_profile = ao2_iterator_next(&it))) {
1687 ast_cli(a->fd,"%s\n", b_profile->name);
1688 ao2_ref(b_profile, -1);
1689 }
1691 ao2_unlock(cfg->bridge_profiles);
1692
1693 return CLI_SUCCESS;
1694}

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

1929{
1930 RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
1931 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1932 struct conf_menu_entry *menu_entry = NULL;
1933 struct conf_menu_action *menu_action = NULL;
1934
1935 switch (cmd) {
1936 case CLI_INIT:
1937 e->command = "confbridge show menu";
1938 e->usage =
1939 "Usage: confbridge show menu [<menu name>]\n";
1940 return NULL;
1941 case CLI_GENERATE:
1942 if (a->pos == 3) {
1943 return complete_menu_name(a->line, a->word, a->pos, a->n);
1944 }
1945 return NULL;
1946 }
1947
1948 if (a->argc != 4) {
1949 return CLI_SHOWUSAGE;
1950 }
1951
1952 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1953 return NULL;
1954 }
1955
1956 if (!(menu = menu_find(cfg->menus, a->argv[3]))) {
1957 ast_cli(a->fd, "No conference menu named '%s' found!\n", a->argv[3]);
1958 return CLI_SUCCESS;
1959 }
1960 ao2_lock(menu);
1961
1962 ast_cli(a->fd,"Name: %s\n", menu->name);
1963 AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
1964 int action_num = 0;
1965 ast_cli(a->fd, "%s=", menu_entry->dtmf);
1966 AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
1967 if (action_num) {
1968 ast_cli(a->fd, ", ");
1969 }
1970 switch (menu_action->id) {
1972 ast_cli(a->fd, "toggle_mute");
1973 break;
1975 ast_cli(a->fd, "toggle_binaural");
1976 break;
1977 case MENU_ACTION_NOOP:
1978 ast_cli(a->fd, "no_op");
1979 break;
1981 ast_cli(a->fd, "increase_listening_volume");
1982 break;
1984 ast_cli(a->fd, "decrease_listening_volume");
1985 break;
1987 ast_cli(a->fd, "reset_listening_volume");
1988 break;
1990 ast_cli(a->fd, "reset_talking_volume");
1991 break;
1993 ast_cli(a->fd, "increase_talking_volume");
1994 break;
1996 ast_cli(a->fd, "decrease_talking_volume");
1997 break;
1999 ast_cli(a->fd, "playback(%s)", menu_action->data.playback_file);
2000 break;
2002 ast_cli(a->fd, "playback_and_continue(%s)", menu_action->data.playback_file);
2003 break;
2005 ast_cli(a->fd, "dialplan_exec(%s,%s,%d)",
2006 menu_action->data.dialplan_args.context,
2007 menu_action->data.dialplan_args.exten,
2008 menu_action->data.dialplan_args.priority);
2009 break;
2011 ast_cli(a->fd, "admin_toggle_conference_lock");
2012 break;
2014 ast_cli(a->fd, "admin_toggle_mute_participants");
2015 break;
2017 ast_cli(a->fd, "participant_count");
2018 break;
2020 ast_cli(a->fd, "admin_kick_last");
2021 break;
2022 case MENU_ACTION_LEAVE:
2023 ast_cli(a->fd, "leave_conference");
2024 break;
2026 ast_cli(a->fd, "set_as_single_video_src");
2027 break;
2029 ast_cli(a->fd, "release_as_single_video_src");
2030 break;
2031 }
2032 action_num++;
2033 }
2034 ast_cli(a->fd,"\n");
2035 }
2036
2037
2038 ao2_unlock(menu);
2039 return CLI_SUCCESS;
2040}
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 1895 of file conf_config_parser.c.

1896{
1897 struct ao2_iterator it;
1898 struct conf_menu *menu;
1899 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1900
1901 switch (cmd) {
1902 case CLI_INIT:
1903 e->command = "confbridge show menus";
1904 e->usage =
1905 "Usage: confbridge show profile menus\n";
1906 return NULL;
1907 case CLI_GENERATE:
1908 return NULL;
1909 }
1910
1911 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1912 return NULL;
1913 }
1914
1915 ast_cli(a->fd,"--------- Menus -----------\n");
1916 ao2_lock(cfg->menus);
1917 it = ao2_iterator_init(cfg->menus, 0);
1918 while ((menu = ao2_iterator_next(&it))) {
1919 ast_cli(a->fd,"%s\n", menu->name);
1920 ao2_ref(menu, -1);
1921 }
1923 ao2_unlock(cfg->menus);
1924
1925 return CLI_SUCCESS;
1926}

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

1527{
1528 struct user_profile u_profile;
1529
1530 switch (cmd) {
1531 case CLI_INIT:
1532 e->command = "confbridge show profile user";
1533 e->usage =
1534 "Usage: confbridge show profile user [<profile name>]\n";
1535 return NULL;
1536 case CLI_GENERATE:
1537 if (a->pos == 4) {
1538 return complete_user_profile_name(a->line, a->word, a->pos, a->n);
1539 }
1540 return NULL;
1541 }
1542
1543 if (a->argc != 5) {
1544 return CLI_SHOWUSAGE;
1545 }
1546
1547 if (!(conf_find_user_profile(NULL, a->argv[4], &u_profile))) {
1548 ast_cli(a->fd, "No conference user profile named '%s' found!\n", a->argv[4]);
1549 return CLI_SUCCESS;
1550 }
1551
1552 ast_cli(a->fd,"--------------------------------------------\n");
1553 ast_cli(a->fd,"Name: %s\n",
1554 u_profile.name);
1555 ast_cli(a->fd,"Admin: %s\n",
1556 u_profile.flags & USER_OPT_ADMIN ?
1557 "true" : "false");
1558 ast_cli(a->fd,"Send Events: %s\n",
1559 u_profile.flags & USER_OPT_SEND_EVENTS ?
1560 "true" : "false");
1561 ast_cli(a->fd,"Echo Events: %s\n",
1562 u_profile.flags & USER_OPT_ECHO_EVENTS ?
1563 "true" : "false");
1564 ast_cli(a->fd,"Marked User: %s\n",
1565 u_profile.flags & USER_OPT_MARKEDUSER ?
1566 "true" : "false");
1567 ast_cli(a->fd,"Start Muted: %s\n",
1568 u_profile.flags & USER_OPT_STARTMUTED?
1569 "true" : "false");
1570 ast_cli(a->fd,"MOH When Empty: %s\n",
1571 u_profile.flags & USER_OPT_MUSICONHOLD ?
1572 "enabled" : "disabled");
1573 ast_cli(a->fd,"MOH Class: %s\n",
1574 ast_strlen_zero(u_profile.moh_class) ?
1575 "default" : u_profile.moh_class);
1576 ast_cli(a->fd,"Announcement: %s\n",
1577 u_profile.announcement);
1578 ast_cli(a->fd,"Quiet: %s\n",
1579 u_profile.flags & USER_OPT_QUIET ?
1580 "enabled" : "disabled");
1581 ast_cli(a->fd,"Hear Join: %s\n",
1582 u_profile.flags & USER_OPT_HEAR_OWN_JOIN_SOUND ?
1583 "enabled" : "disabled");
1584 ast_cli(a->fd,"Wait Marked: %s\n",
1585 u_profile.flags & USER_OPT_WAITMARKED ?
1586 "enabled" : "disabled");
1587 ast_cli(a->fd,"END Marked (All): %s\n",
1588 u_profile.flags & USER_OPT_ENDMARKED ?
1589 "enabled" : "disabled");
1590 ast_cli(a->fd,"END Marked (Any): %s\n",
1591 u_profile.flags & USER_OPT_ENDMARKEDANY ?
1592 "enabled" : "disabled");
1593 ast_cli(a->fd,"Drop_silence: %s\n",
1594 u_profile.flags & USER_OPT_DROP_SILENCE ?
1595 "enabled" : "disabled");
1596 ast_cli(a->fd,"Silence Threshold: %ums\n",
1597 u_profile.silence_threshold);
1598 ast_cli(a->fd,"Talking Threshold: %u\n",
1599 u_profile.talking_threshold);
1600 ast_cli(a->fd,"Denoise: %s\n",
1601 u_profile.flags & USER_OPT_DENOISE ?
1602 "enabled" : "disabled");
1603 ast_cli(a->fd,"Jitterbuffer: %s\n",
1604 u_profile.flags & USER_OPT_JITTERBUFFER ?
1605 "enabled" : "disabled");
1606 ast_cli(a->fd,"Talk Detect Events: %s\n",
1607 u_profile.flags & USER_OPT_TALKER_DETECT ?
1608 "enabled" : "disabled");
1609 ast_cli(a->fd,"DTMF Pass Through: %s\n",
1610 u_profile.flags & USER_OPT_DTMF_PASS ?
1611 "enabled" : "disabled");
1612 ast_cli(a->fd,"PIN: %s\n",
1613 ast_strlen_zero(u_profile.pin) ?
1614 "None" : u_profile.pin);
1615 ast_cli(a->fd,"Announce User Count: %s\n",
1616 u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNT ?
1617 "enabled" : "disabled");
1618 ast_cli(a->fd,"Announce join/leave: %s\n",
1620 u_profile.flags & USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW ?
1621 "enabled (with review)" : "enabled" : "disabled");
1622 ast_cli(a->fd,"Announce User Count all: %s\n",
1623 u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?
1624 "enabled" : "disabled");
1625 ast_cli(a->fd,"Text Messaging: %s\n",
1626 u_profile.flags & USER_OPT_TEXT_MESSAGING ?
1627 "enabled" : "disabled");
1628 ast_cli(a->fd,"Answer Channel: %s\n",
1629 u_profile.flags & USER_OPT_ANSWER_CHANNEL ?
1630 "true" : "false");
1631 ast_cli(a->fd, "\n");
1632
1633 return CLI_SUCCESS;
1634}
static char * complete_user_profile_name(const char *line, const char *word, int pos, int state)
const struct user_profile * conf_find_user_profile(struct ast_channel *chan, const char *user_profile_name, struct user_profile *result)
find a user profile given a user profile's name and store that profile in result structure.

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

◆ handle_cli_confbridge_show_user_profiles()

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

Definition at line 1494 of file conf_config_parser.c.

1495{
1496 struct ao2_iterator it;
1497 struct user_profile *u_profile;
1498 RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1499
1500 switch (cmd) {
1501 case CLI_INIT:
1502 e->command = "confbridge show profile users";
1503 e->usage =
1504 "Usage: confbridge show profile users\n";
1505 return NULL;
1506 case CLI_GENERATE:
1507 return NULL;
1508 }
1509
1510 if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1511 return NULL;
1512 }
1513
1514 ast_cli(a->fd,"--------- User Profiles -----------\n");
1515 ao2_lock(cfg->user_profiles);
1516 it = ao2_iterator_init(cfg->user_profiles, 0);
1517 while ((u_profile = ao2_iterator_next(&it))) {
1518 ast_cli(a->fd,"%s\n", u_profile->name);
1519 ao2_ref(u_profile, -1);
1520 }
1522 ao2_unlock(cfg->user_profiles);
1523
1524 return CLI_SUCCESS;
1525}

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

799{
800 struct conf_menu *menu;
801 if (!(menu = ao2_alloc(sizeof(*menu), menu_destructor))) {
802 return NULL;
803 }
804 ast_copy_string(menu->name, category, sizeof(menu->name));
805 return menu;
806}
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 899 of file conf_config_parser.c.

900{
901 const struct conf_menu *left = obj;
902 const struct conf_menu *right = arg;
903 const char *right_name = arg;
904 int cmp;
905
906 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
907 default:
908 case OBJ_POINTER:
909 right_name = right->name;
910 /* Fall through */
911 case OBJ_KEY:
912 cmp = strcasecmp(left->name, right_name);
913 break;
914 case OBJ_PARTIAL_KEY:
915 cmp = strncasecmp(left->name, right_name, strlen(right_name));
916 break;
917 }
918 return cmp ? 0 : CMP_MATCH;
919}

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

945{
946 struct conf_menu *menu = obj;
947 struct conf_menu_entry *entry = NULL;
948
949 while ((entry = AST_LIST_REMOVE_HEAD(&menu->entries, entry))) {
952 }
953}

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

Referenced by menu_alloc().

◆ menu_find()

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

Definition at line 808 of file conf_config_parser.c.

809{
810 return ao2_find(container, category, OBJ_KEY);
811}

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

922{
923 const struct conf_menu *menu = obj;
924 const char *name = obj;
925 int hash;
926
927 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
928 default:
929 case OBJ_POINTER:
930 name = menu->name;
931 /* Fall through */
932 case OBJ_KEY:
933 hash = ast_str_case_hash(name);
934 break;
935 case OBJ_PARTIAL_KEY:
936 /* Should never happen in hash callback. */
937 ast_assert(0);
938 hash = 0;
939 break;
940 }
941 return hash;
942}

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

2631{
2632 struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2633
2634 return conf_handle_dtmf(bridge_channel, pvt->user, &pvt->menu_entry, pvt->menu);
2635}
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 2617 of file conf_config_parser.c.

2618{
2619 struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2620 struct conf_menu_action *action = NULL;
2621
2622 ao2_cleanup(pvt->menu);
2623
2626 }
2627 ast_free(pvt);
2628}

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

2365{
2366 add_menu_entry(obj, var->name, var->value);
2367 return 0;
2368}
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 2337 of file conf_config_parser.c.

2338{
2339 struct conf_menu *dst_menu = obj;
2341 RAII_VAR(struct conf_menu *, src_menu, NULL, ao2_cleanup);
2342
2343 if (!cfg) {
2344 return 0;
2345 }
2346
2347 if (!(src_menu = ao2_find(cfg->menus, var->value, OBJ_KEY))) {
2348 return -1;
2349 }
2350
2351 if (conf_menu_profile_copy(dst_menu, src_menu)) {
2352 return -1;
2353 }
2354
2355 return 0;
2356}
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 2111 of file conf_config_parser.c.

2112{
2113 struct bridge_profile *b_profile = obj;
2114
2115 if (strcasecmp(var->name, "mixing_interval")) {
2116 return -1;
2117 }
2118 if (sscanf(var->value, "%30u", &b_profile->mix_interval) != 1) {
2119 return -1;
2120 }
2121 switch (b_profile->mix_interval) {
2122 case 10:
2123 case 20:
2124 case 40:
2125 case 80:
2126 return 0;
2127 default:
2128 return -1;
2129 }
2130}
unsigned int mix_interval
Definition: confbridge.h:237

References bridge_profile::mix_interval, and var.

Referenced by conf_load_config().

◆ remb_behavior_handler()

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

Definition at line 2179 of file conf_config_parser.c.

2180{
2181 struct bridge_profile *b_profile = obj;
2182
2183 if (strcasecmp(var->name, "remb_behavior")) {
2184 return -1;
2185 }
2186
2194 );
2195
2196 if (!strcasecmp(var->value, "average")) {
2198 } else if (!strcasecmp(var->value, "lowest")) {
2200 } else if (!strcasecmp(var->value, "highest")) {
2202 } else if (!strcasecmp(var->value, "average_all")) {
2204 } else if (!strcasecmp(var->value, "lowest_all")) {
2206 } else if (!strcasecmp(var->value, "highest_all")) {
2208 } else if (!strcasecmp(var->value, "force")) {
2210 } else {
2211 return -1;
2212 }
2213 return 0;
2214}
@ BRIDGE_OPT_REMB_BEHAVIOR_FORCE
Definition: confbridge.h:93
#define ast_clear_flag(p, flag)
Definition: utils.h:77
#define ast_set_flag(p, flag)
Definition: utils.h:70

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

Referenced by conf_load_config().

◆ sample_rate_handler()

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

Definition at line 2223 of file conf_config_parser.c.

2224{
2225 struct bridge_profile *b_profile = obj;
2226 unsigned int *slot;
2227
2228 if (!strcasecmp(var->name, "internal_sample_rate")) {
2229 slot = &b_profile->internal_sample_rate;
2230 if (!strcasecmp(var->value, "auto")) {
2231 *slot = 0;
2232 return 0;
2233 }
2234 } else if (!strcasecmp(var->name, "maximum_sample_rate")) {
2235 slot = &b_profile->maximum_sample_rate;
2236 if (!strcasecmp(var->value, "none")) {
2237 *slot = 0;
2238 return 0;
2239 }
2240 } else {
2241 return -1;
2242 }
2243
2244 return ast_parse_arg(var->value, PARSE_UINT32 | PARSE_IN_RANGE, slot, 8000, 192000);
2245}
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
Definition: main/config.c:3827
unsigned int maximum_sample_rate
Definition: confbridge.h:236
unsigned int internal_sample_rate
Definition: confbridge.h:235

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

Referenced by conf_load_config().

◆ set_sound()

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

Definition at line 1023 of file conf_config_parser.c.

1024{
1025 struct bridge_profile_sounds *sounds = b_profile->sounds;
1026 if (ast_strlen_zero(sound_file)) {
1027 return -1;
1028 }
1029
1030 if (!strcasecmp(sound_name, "sound_only_person")) {
1032 } else if (!strcasecmp(sound_name, "sound_only_one")) {
1033 ast_string_field_set(sounds, onlyone, sound_file);
1034 } else if (!strcasecmp(sound_name, "sound_has_joined")) {
1035 ast_string_field_set(sounds, hasjoin, sound_file);
1036 } else if (!strcasecmp(sound_name, "sound_has_left")) {
1037 ast_string_field_set(sounds, hasleft, sound_file);
1038 } else if (!strcasecmp(sound_name, "sound_kicked")) {
1039 ast_string_field_set(sounds, kicked, sound_file);
1040 } else if (!strcasecmp(sound_name, "sound_muted")) {
1041 ast_string_field_set(sounds, muted, sound_file);
1042 } else if (!strcasecmp(sound_name, "sound_unmuted")) {
1043 ast_string_field_set(sounds, unmuted, sound_file);
1044 } else if (!strcasecmp(sound_name, "sound_binaural_on")) {
1046 } else if (!strcasecmp(sound_name, "sound_binaural_off")) {
1048 } else if (!strcasecmp(sound_name, "sound_there_are")) {
1049 ast_string_field_set(sounds, thereare, sound_file);
1050 } else if (!strcasecmp(sound_name, "sound_other_in_party")) {
1052 } else if (!strcasecmp(sound_name, "sound_place_into_conference")) {
1053 static int deprecation_warning = 1;
1054 if (deprecation_warning) {
1055 ast_log(LOG_WARNING, "sound_place_into_conference is deprecated"
1056 " and unused. Use sound_begin for similar functionality.");
1057 deprecation_warning = 0;
1058 }
1060 } else if (!strcasecmp(sound_name, "sound_wait_for_leader")) {
1062 } else if (!strcasecmp(sound_name, "sound_leader_has_left")) {
1064 } else if (!strcasecmp(sound_name, "sound_get_pin")) {
1065 ast_string_field_set(sounds, getpin, sound_file);
1066 } else if (!strcasecmp(sound_name, "sound_invalid_pin")) {
1068 } else if (!strcasecmp(sound_name, "sound_locked")) {
1069 ast_string_field_set(sounds, locked, sound_file);
1070 } else if (!strcasecmp(sound_name, "sound_unlocked_now")) {
1072 } else if (!strcasecmp(sound_name, "sound_locked_now")) {
1074 } else if (!strcasecmp(sound_name, "sound_error_menu")) {
1076 } else if (!strcasecmp(sound_name, "sound_join")) {
1077 ast_string_field_set(sounds, join, sound_file);
1078 } else if (!strcasecmp(sound_name, "sound_leave")) {
1079 ast_string_field_set(sounds, leave, sound_file);
1080 } else if (!strcasecmp(sound_name, "sound_participants_muted")) {
1082 } else if (!strcasecmp(sound_name, "sound_participants_unmuted")) {
1084 } else if (!strcasecmp(sound_name, "sound_begin")) {
1085 ast_string_field_set(sounds, begin, sound_file);
1086 } else {
1087 return -1;
1088 }
1089
1090 return 0;
1091}
const ast_string_field binauralon
Definition: confbridge.h:224
const ast_string_field binauraloff
Definition: confbridge.h:224

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

Referenced by sound_option_handler().

◆ sound_option_handler()

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

Definition at line 2358 of file conf_config_parser.c.

2359{
2360 set_sound(var->name, var->value, obj);
2361 return 0;
2362}
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 956 of file conf_config_parser.c.

957{
958 const struct user_profile *left = obj;
959 const struct user_profile *right = arg;
960 const char *right_name = arg;
961 int cmp;
962
963 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
964 default:
965 case OBJ_POINTER:
966 right_name = right->name;
967 /* Fall through */
968 case OBJ_KEY:
969 cmp = strcasecmp(left->name, right_name);
970 break;
971 case OBJ_PARTIAL_KEY:
972 cmp = strncasecmp(left->name, right_name, strlen(right_name));
973 break;
974 }
975 return cmp ? 0 : CMP_MATCH;
976}

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

979{
980 const struct user_profile *u_profile = obj;
981 const char *name = obj;
982 int hash;
983
984 switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
985 default:
986 case OBJ_POINTER:
987 name = u_profile->name;
988 /* Fall through */
989 case OBJ_KEY:
990 hash = ast_str_case_hash(name);
991 break;
992 case OBJ_PARTIAL_KEY:
993 /* Should never happen in hash callback. */
994 ast_assert(0);
995 hash = 0;
996 break;
997 }
998 return hash;
999}

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

765{
766 struct user_profile *u_profile;
767
768 if (!(u_profile = ao2_alloc(sizeof(*u_profile), user_profile_destructor))) {
769 return NULL;
770 }
771
772 ast_copy_string(u_profile->name, category, sizeof(u_profile->name));
773
774 return u_profile;
775}

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

760{
761 return;
762}

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

778{
779 return ao2_find(container, category, OBJ_KEY);
780}

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

2217{
2218 struct user_profile *u_profile = obj;
2219
2220 return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
2221}

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

2371{
2374 RAII_VAR(struct conf_menu *, menu_profile, NULL, ao2_cleanup);
2375 /* We can only be called as a result of an aco_process_config so this is safe */
2376 struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
2377
2378 if (!cfg) {
2379 return 0;
2380 }
2381
2383 if (!bridge_profile) {
2385 if (!bridge_profile) {
2386 return -1;
2387 }
2388 ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_BRIDGE_PROFILE);
2391 }
2392
2394 if (!user_profile) {
2396 if (!user_profile) {
2397 return -1;
2398 }
2399 ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_USER_PROFILE);
2402 }
2403
2404 menu_profile = ao2_find(cfg->menus, DEFAULT_MENU_PROFILE, OBJ_KEY);
2405 if (!menu_profile) {
2406 menu_profile = menu_alloc(DEFAULT_MENU_PROFILE);
2407 if (!menu_profile) {
2408 return -1;
2409 }
2410 ast_log(AST_LOG_NOTICE, "Adding %s menu to app_confbridge\n", DEFAULT_MENU_PROFILE);
2412 ao2_link(cfg->menus, menu_profile);
2413 }
2414
2415 return 0;
2416}
#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 2132 of file conf_config_parser.c.

2133{
2134 struct bridge_profile *b_profile = obj;
2135
2136 if (strcasecmp(var->name, "video_mode")) {
2137 return -1;
2138 }
2139 if (!strcasecmp(var->value, "first_marked")) {
2140 ast_set_flags_to(b_profile,
2146 } else if (!strcasecmp(var->value, "last_marked")) {
2147 ast_set_flags_to(b_profile,
2153 } else if (!strcasecmp(var->value, "follow_talker")) {
2154 ast_set_flags_to(b_profile,
2160 } else if (!strcasecmp(var->value, "sfu")) {
2161 ast_set_flags_to(b_profile,
2167 } else if (!strcasecmp(var->value, "none")) {
2168 ast_clear_flag(b_profile,
2173 } else {
2174 return -1;
2175 }
2176 return 0;
2177}
#define ast_set_flags_to(p, flag, value)
Definition: utils.h:104

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

Referenced by conf_load_config().

Variable Documentation

◆ bridge_type

struct aco_type bridge_type
static

Definition at line 745 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ bridge_types

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

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

Referenced by conf_destroy_config(), and conf_load_config().

◆ confbridge_conf

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

Definition at line 838 of file conf_config_parser.c.

◆ confbridge_datastore

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

Definition at line 1116 of file conf_config_parser.c.

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

◆ general_type

struct aco_type general_type
static

Definition at line 831 of file conf_config_parser.c.

◆ menu_type

struct aco_type menu_type
static

Definition at line 813 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ menu_types

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

Definition at line 827 of file conf_config_parser.c.

Referenced by conf_load_config().

◆ user_type

struct aco_type user_type
static

Definition at line 782 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and verify_default_profiles().

◆ user_types

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

Definition at line 828 of file conf_config_parser.c.

Referenced by conf_load_config().