Asterisk - The Open Source Telephony Project  18.5.0
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 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 1255 of file conf_config_parser.c.

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, context, conf_menu_action::data, conf_menu_action::dialplan_args, exten, conf_menu_action::id, 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, and priority.

Referenced by add_menu_entry().

1256 {
1257  struct conf_menu_action *menu_action = ast_calloc(1, sizeof(*menu_action));
1258 
1259  if (!menu_action) {
1260  return -1;
1261  }
1262  menu_action->id = id;
1263 
1264  switch (id) {
1265  case MENU_ACTION_NOOP:
1278  case MENU_ACTION_LEAVE:
1281  break;
1282  case MENU_ACTION_PLAYBACK:
1284  if (!(ast_strlen_zero(databuf))) {
1285  ast_copy_string(menu_action->data.playback_file, databuf, sizeof(menu_action->data.playback_file));
1286  } else {
1287  ast_free(menu_action);
1288  return -1;
1289  }
1290  break;
1292  if (!(ast_strlen_zero(databuf))) {
1295  AST_APP_ARG(exten);
1297  );
1298  AST_STANDARD_APP_ARGS(args, databuf);
1299  if (!ast_strlen_zero(args.context)) {
1300  ast_copy_string(menu_action->data.dialplan_args.context,
1301  args.context,
1302  sizeof(menu_action->data.dialplan_args.context));
1303  }
1304  if (!ast_strlen_zero(args.exten)) {
1305  ast_copy_string(menu_action->data.dialplan_args.exten,
1306  args.exten,
1307  sizeof(menu_action->data.dialplan_args.exten));
1308  }
1309  menu_action->data.dialplan_args.priority = 1; /* 1 by default */
1310  if (!ast_strlen_zero(args.priority) &&
1311  (sscanf(args.priority, "%30d", &menu_action->data.dialplan_args.priority) != 1)) {
1312  /* invalid priority */
1313  ast_free(menu_action);
1314  return -1;
1315  }
1316  } else {
1317  ast_free(menu_action);
1318  return -1;
1319  }
1320  };
1321 
1322  AST_LIST_INSERT_TAIL(&menu_entry->actions, menu_action, action);
1323 
1324  return 0;
1325 }
static char exten[AST_MAX_EXTENSION]
Definition: chan_alsa.c:118
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
const char * args
struct conf_menu_action::@85 action
static int priority
#define ast_strlen_zero(foo)
Definition: strings.h:52
struct conf_menu_action::@84::@86 dialplan_args
char playback_file[PATH_MAX]
Definition: confbridge.h:123
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
#define ast_free(a)
Definition: astmm.h:182
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
union conf_menu_action::@84 data
enum conf_menu_action_id id
Definition: confbridge.h:121
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
enum queue_result id
Definition: app_queue.c:1507
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:116
struct conf_menu_entry::@87 actions
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_APP_ARG(name)
Define an application argument.

◆ add_menu_entry()

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

Definition at line 1327 of file conf_config_parser.c.

References conf_menu_entry::actions, add_action_to_menu_entry(), ast_calloc, ast_copy_string(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_strdupa, ast_strip(), ast_strlen_zero, buf, 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().

1328 {
1329  struct conf_menu_entry *menu_entry = NULL, *cur = NULL;
1330  int res = 0;
1331  char *tmp_action_names = ast_strdupa(action_names);
1332  char *action = NULL;
1333  char *action_args;
1334  char *tmp;
1335  char buf[PATH_MAX];
1336  char *delimiter = ",";
1337 
1338  if (!(menu_entry = ast_calloc(1, sizeof(*menu_entry)))) {
1339  return -1;
1340  }
1341 
1342  for (;;) {
1343  char *comma;
1344  char *startbrace;
1345  char *endbrace;
1346  unsigned int action_len;
1347 
1348  if (ast_strlen_zero(tmp_action_names)) {
1349  break;
1350  }
1351  startbrace = strchr(tmp_action_names, '(');
1352  endbrace = strchr(tmp_action_names, ')');
1353  comma = strchr(tmp_action_names, ',');
1354 
1355  /* If the next action has brackets with comma delimited arguments in it,
1356  * make the delimeter ')' instead of a comma to preserve the argments */
1357  if (startbrace && endbrace && comma && (comma > startbrace && comma < endbrace)) {
1358  delimiter = ")";
1359  } else {
1360  delimiter = ",";
1361  }
1362 
1363  if (!(action = strsep(&tmp_action_names, delimiter))) {
1364  break;
1365  }
1366 
1367  action = ast_strip(action);
1368  if (ast_strlen_zero(action)) {
1369  continue;
1370  }
1371 
1372  action_len = strlen(action);
1373  ast_copy_string(menu_entry->dtmf, dtmf, sizeof(menu_entry->dtmf));
1374  if (!strcasecmp(action, "toggle_mute")) {
1376  } else if (!strcasecmp(action, "toggle_binaural")) {
1378  } else if (!strcasecmp(action, "no_op")) {
1379  res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_NOOP, NULL);
1380  } else if (!strcasecmp(action, "increase_listening_volume")) {
1382  } else if (!strcasecmp(action, "decrease_listening_volume")) {
1384  } else if (!strcasecmp(action, "increase_talking_volume")) {
1386  } else if (!strcasecmp(action, "reset_listening_volume")) {
1388  } else if (!strcasecmp(action, "reset_talking_volume")) {
1390  } else if (!strcasecmp(action, "decrease_talking_volume")) {
1392  } else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
1394  } else if (!strcasecmp(action, "admin_toggle_mute_participants")) {
1396  } else if (!strcasecmp(action, "participant_count")) {
1398  } else if (!strcasecmp(action, "admin_kick_last")) {
1400  } else if (!strcasecmp(action, "leave_conference")) {
1401  res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_LEAVE, NULL);
1402  } else if (!strcasecmp(action, "set_as_single_video_src")) {
1404  } else if (!strcasecmp(action, "release_as_single_video_src")) {
1406  } else if (!strncasecmp(action, "dialplan_exec(", 14)) {
1407  ast_copy_string(buf, action, sizeof(buf));
1408  action_args = buf;
1409  if ((action_args = strchr(action, '('))) {
1410  action_args++;
1411  }
1412  /* it is possible that this argument may or may not
1413  * have a closing brace at this point, it all depends on if
1414  * comma delimited arguments were provided */
1415  if ((tmp = strchr(action, ')'))) {
1416  *tmp = '\0';
1417  }
1418  res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DIALPLAN_EXEC, action_args);
1419  } else if (action_len >= 21 && !strncasecmp(action, "playback_and_continue(", 22)) {
1420  ast_copy_string(buf, action, sizeof(buf));
1421  action_args = buf;
1422  if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1423  *tmp = '\0';
1424  action_args++;
1425  }
1426  res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK_AND_CONTINUE, action_args);
1427  } else if (action_len >= 8 && !strncasecmp(action, "playback(", 9)) {
1428  ast_copy_string(buf, action, sizeof(buf));
1429  action_args = buf;
1430  if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
1431  *tmp = '\0';
1432  action_args++;
1433  }
1434  res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, action_args);
1435  }
1436  }
1437 
1438  /* if adding any of the actions failed, bail */
1439  if (res) {
1440  struct conf_menu_action *menu_action;
1441  while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
1442  ast_free(menu_action);
1443  }
1444  ast_free(menu_entry);
1445  return -1;
1446  }
1447 
1448  /* remove any list entry with an identical DTMF sequence for overrides */
1450  if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) {
1452  ast_free(cur);
1453  break;
1454  }
1455  }
1457 
1458  AST_LIST_INSERT_TAIL(&menu->entries, menu_entry, entry);
1459 
1460  return 0;
1461 }
Definition: confbridge.h:136
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static int tmp()
Definition: bt_open.c:389
#define NULL
Definition: resample.c:96
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:614
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:138
#define ast_strlen_zero(foo)
Definition: strings.h:52
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Definition: strings.h:219
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:556
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:832
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
struct conf_menu::@89 entries
#define ast_free(a)
Definition: astmm.h:182
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
char * strsep(char **str, const char *delims)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
Definition: search.h:40
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:528
#define PATH_MAX
Definition: asterisk.h:40
struct conf_menu_entry::@87 actions
static int add_action_to_menu_entry(struct conf_menu_entry *menu_entry, enum conf_menu_action_id id, char *databuf)

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

References user_profile::announce_user_count_all_after, ast_false(), ast_true(), user_profile::flags, ast_variable::name, USER_OPT_ANNOUNCEUSERCOUNTALL, and ast_variable::value.

Referenced by conf_load_config().

2083 {
2084  struct user_profile *u_profile = obj;
2085 
2086  if (strcasecmp(var->name, "announce_user_count_all")) {
2087  return -1;
2088  }
2089  if (ast_true(var->value)) {
2090  u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2091  } else if (ast_false(var->value)) {
2092  u_profile->flags = u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNTALL;
2093  } else if (sscanf(var->value, "%30u", &u_profile->announce_user_count_all_after) == 1) {
2094  u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
2095  } else {
2096  return -1;
2097  }
2098  return 0;
2099 }
unsigned int announce_user_count_all_after
Definition: confbridge.h:158
unsigned int flags
Definition: confbridge.h:157
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
Definition: main/utils.c:1951
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
Definition: main/utils.c:1968

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

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

Referenced by conf_set_menu_to_user().

2628 {
2629  struct conf_menu_entry *menu_entry;
2630 
2631  SCOPED_AO2LOCK(menu_lock, menu);
2632  AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2633  struct dtmf_menu_hook_pvt *pvt;
2634 
2635  if (!(pvt = ast_calloc(1, sizeof(*pvt)))) {
2636  return -1;
2637  }
2638  pvt->user = user;
2639  pvt->menu = ao2_bump(menu);
2640 
2641  if (copy_menu_entry(&pvt->menu_entry, menu_entry)) {
2642  menu_hook_destroy(pvt);
2643  return -1;
2644  }
2645 
2646  if (ast_bridge_dtmf_hook(&user->features, pvt->menu_entry.dtmf,
2648  menu_hook_destroy(pvt);
2649  }
2650  }
2651  strcpy(user->menu_name, menu->name); /* Safe */
2652 
2653  return 0;
2654 }
static char user[512]
static int menu_hook_callback(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
Definition: confbridge.h:136
static void menu_hook_destroy(void *hook_pvt)
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:138
struct conf_menu * menu
#define ao2_bump(obj)
Definition: astobj2.h:491
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
struct conf_menu::@89 entries
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
Definition: lock.h:602
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
struct confbridge_user * user
struct ast_bridge_features features
Definition: confbridge.h:278
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:3245
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:148
char menu_name[MAX_PROFILE_NAME]
Definition: confbridge.h:275
Definition: search.h:40
struct conf_menu_entry menu_entry

◆ bridge_cmp_cb()

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

bridge profile container functions

Definition at line 847 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

848 {
849  const struct bridge_profile *left = obj;
850  const struct bridge_profile *right = arg;
851  const char *right_name = arg;
852  int cmp;
853 
854  switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
855  default:
856  case OBJ_POINTER:
857  right_name = right->name;
858  /* Fall through */
859  case OBJ_KEY:
860  cmp = strcasecmp(left->name, right_name);
861  break;
862  case OBJ_PARTIAL_KEY:
863  cmp = strncasecmp(left->name, right_name, strlen(right_name));
864  break;
865  }
866  return cmp ? 0 : CMP_MATCH;
867 }
#define OBJ_KEY
Definition: astobj2.h:1155
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:226
#define OBJ_POINTER
Definition: astobj2.h:1154
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1156
unsigned int flags
Definition: confbridge.h:231

◆ bridge_hash_cb()

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

Definition at line 869 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

870 {
871  const struct bridge_profile *b_profile = obj;
872  const char *name = obj;
873  int hash;
874 
875  switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
876  default:
877  case OBJ_POINTER:
878  name = b_profile->name;
879  /* Fall through */
880  case OBJ_KEY:
881  hash = ast_str_case_hash(name);
882  break;
883  case OBJ_PARTIAL_KEY:
884  /* Should never happen in hash callback. */
885  ast_assert(0);
886  hash = 0;
887  break;
888  }
889  return hash;
890 }
#define OBJ_KEY
Definition: astobj2.h:1155
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:226
#define OBJ_POINTER
Definition: astobj2.h:1154
#define ast_assert(a)
Definition: utils.h:695
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1156
unsigned int flags
Definition: confbridge.h:231
static const char name[]
Definition: cdr_mysql.c:74
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:1250

◆ bridge_profile_alloc()

static void * bridge_profile_alloc ( const char *  category)
static

Definition at line 716 of file conf_config_parser.c.

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().

717 {
718  struct bridge_profile *b_profile;
719 
720  if (!(b_profile = ao2_alloc(sizeof(*b_profile), bridge_profile_destructor))) {
721  return NULL;
722  }
723 
724  if (!(b_profile->sounds = bridge_profile_sounds_alloc())) {
725  ao2_ref(b_profile, -1);
726  return NULL;
727  }
728 
729  ast_copy_string(b_profile->name, category, sizeof(b_profile->name));
730 
731  return b_profile;
732 }
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:226
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
#define NULL
Definition: resample.c:96
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
static void bridge_profile_destructor(void *obj)
static struct bridge_profile_sounds * bridge_profile_sounds_alloc(void)

◆ bridge_profile_destructor()

static void bridge_profile_destructor ( void *  obj)
static

Definition at line 710 of file conf_config_parser.c.

References ao2_cleanup, and bridge_profile::sounds.

Referenced by bridge_profile_alloc().

711 {
712  struct bridge_profile *b_profile = obj;
713  ao2_cleanup(b_profile->sounds);
714 }
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

◆ bridge_profile_find()

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

Definition at line 734 of file conf_config_parser.c.

References ao2_find, and OBJ_KEY.

735 {
736  return ao2_find(container, category, OBJ_KEY);
737 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756

◆ bridge_profile_sounds_alloc()

static struct bridge_profile_sounds * bridge_profile_sounds_alloc ( void  )
static

Definition at line 1002 of file conf_config_parser.c.

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().

1003 {
1005 
1006  if (!sounds) {
1007  return NULL;
1008  }
1009  if (ast_string_field_init(sounds, 512)) {
1010  ao2_ref(sounds, -1);
1011  return NULL;
1012  }
1013 
1014  return sounds;
1015 }
#define NULL
Definition: resample.c:96
static void bridge_profile_sounds_destroy_cb(void *obj)
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:353
#define ao2_ref(o, delta)
Definition: astobj2.h:464
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411

◆ bridge_profile_sounds_destroy_cb()

static void bridge_profile_sounds_destroy_cb ( void *  obj)
static

Bridge Profile Sounds functions

Definition at line 996 of file conf_config_parser.c.

References ast_string_field_free_memory, and sounds.

Referenced by bridge_profile_sounds_alloc().

997 {
998  struct bridge_profile_sounds *sounds = obj;
1000 }
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:368

◆ bridge_template_handler()

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

Definition at line 2213 of file conf_config_parser.c.

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, leave, bridge_profile_sounds::leave, bridge_profile_sounds::locked, bridge_profile_sounds::lockednow, muted, 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, sounds, bridge_profile::sounds, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, ast_variable::value, and bridge_profile_sounds::waitforleader.

Referenced by conf_load_config().

2214 {
2215  struct bridge_profile *b_profile = obj;
2217  struct bridge_profile_sounds *oldsounds = b_profile->sounds;
2218 
2219  if (!sounds) {
2220  return -1;
2221  }
2222  if (!(conf_find_bridge_profile(NULL, var->value, b_profile))) {
2223  ao2_ref(sounds, -1);
2224  return -1;
2225  }
2226  /* Using a bridge profile as a template is a little complicated due to the sounds. Since the sounds
2227  * structure of a dynamic profile will need to be altered, a completely new sounds structure must be
2228  * created instead of simply holding a reference to the one built by the config file. */
2229  ast_string_field_set(sounds, onlyperson, b_profile->sounds->onlyperson);
2230  ast_string_field_set(sounds, onlyone, b_profile->sounds->onlyone);
2231  ast_string_field_set(sounds, hasjoin, b_profile->sounds->hasjoin);
2232  ast_string_field_set(sounds, hasleft, b_profile->sounds->hasleft);
2233  ast_string_field_set(sounds, kicked, b_profile->sounds->kicked);
2234  ast_string_field_set(sounds, muted, b_profile->sounds->muted);
2235  ast_string_field_set(sounds, unmuted, b_profile->sounds->unmuted);
2236  ast_string_field_set(sounds, thereare, b_profile->sounds->thereare);
2237  ast_string_field_set(sounds, otherinparty, b_profile->sounds->otherinparty);
2241  ast_string_field_set(sounds, getpin, b_profile->sounds->getpin);
2242  ast_string_field_set(sounds, invalidpin, b_profile->sounds->invalidpin);
2243  ast_string_field_set(sounds, locked, b_profile->sounds->locked);
2244  ast_string_field_set(sounds, unlockednow, b_profile->sounds->unlockednow);
2245  ast_string_field_set(sounds, lockednow, b_profile->sounds->lockednow);
2246  ast_string_field_set(sounds, errormenu, b_profile->sounds->errormenu);
2247  ast_string_field_set(sounds, join, b_profile->sounds->join);
2248  ast_string_field_set(sounds, leave, b_profile->sounds->leave);
2251  ast_string_field_set(sounds, begin, b_profile->sounds->begin);
2252 
2253  ao2_ref(b_profile->sounds, -1); /* sounds struct copied over to it from the template by reference only. */
2254  ao2_ref(oldsounds, -1); /* original sounds struct we don't need anymore */
2255  b_profile->sounds = sounds; /* the new sounds struct that is a deep copy of the one from the template. */
2256 
2257  return 0;
2258 }
const ast_string_field unlockednow
Definition: confbridge.h:222
const ast_string_field thereare
Definition: confbridge.h:222
const ast_string_field join
Definition: confbridge.h:222
const ast_string_field otherinparty
Definition: confbridge.h:222
static unsigned char leave[]
Definition: leave.h:12
static int muted
Definition: muted.c:82
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
const ast_string_field onlyone
Definition: confbridge.h:222
#define NULL
Definition: resample.c:96
const ast_string_field hasjoin
Definition: confbridge.h:222
const ast_string_field begin
Definition: confbridge.h:222
const ast_string_field errormenu
Definition: confbridge.h:222
#define ao2_ref(o, delta)
Definition: astobj2.h:464
const ast_string_field waitforleader
Definition: confbridge.h:222
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
const ast_string_field getpin
Definition: confbridge.h:222
const ast_string_field participantsmuted
Definition: confbridge.h:222
const ast_string_field leave
Definition: confbridge.h:222
const ast_string_field lockednow
Definition: confbridge.h:222
const ast_string_field participantsunmuted
Definition: confbridge.h:222
const ast_string_field unmuted
Definition: confbridge.h:222
const ast_string_field invalidpin
Definition: confbridge.h:222
const ast_string_field onlyperson
Definition: confbridge.h:222
const ast_string_field muted
Definition: confbridge.h:222
const ast_string_field leaderhasleft
Definition: confbridge.h:222
const ast_string_field kicked
Definition: confbridge.h:222
const ast_string_field locked
Definition: confbridge.h:222
static struct bridge_profile_sounds * bridge_profile_sounds_alloc(void)
const ast_string_field placeintoconf
Definition: confbridge.h:222
const ast_string_field hasleft
Definition: confbridge.h:222
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&#39;s name and store that profile in result structure...
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:514

◆ complete_bridge_profile_name()

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

Definition at line 1626 of file conf_config_parser.c.

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().

1627 {
1628  int which = 0;
1629  char *res = NULL;
1630  int wordlen = strlen(word);
1631  struct ao2_iterator i;
1632  struct bridge_profile *b_profile = NULL;
1634 
1635  if (!cfg) {
1636  return NULL;
1637  }
1638 
1639  i = ao2_iterator_init(cfg->bridge_profiles, 0);
1640  while ((b_profile = ao2_iterator_next(&i))) {
1641  if (!strncasecmp(b_profile->name, word, wordlen) && ++which > state) {
1642  res = ast_strdup(b_profile->name);
1643  ao2_ref(b_profile, -1);
1644  break;
1645  }
1646  ao2_ref(b_profile, -1);
1647  }
1649 
1650  return res;
1651 }
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:226
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
#define NULL
Definition: resample.c:96
#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:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
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:1841
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
short word

◆ complete_menu_name()

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

Definition at line 1858 of file conf_config_parser.c.

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().

1859 {
1860  int which = 0;
1861  char *res = NULL;
1862  int wordlen = strlen(word);
1863  struct ao2_iterator i;
1864  struct conf_menu *menu = NULL;
1866 
1867  if (!cfg) {
1868  return NULL;
1869  }
1870 
1871  i = ao2_iterator_init(cfg->menus, 0);
1872  while ((menu = ao2_iterator_next(&i))) {
1873  if (!strncasecmp(menu->name, word, wordlen) && ++which > state) {
1874  res = ast_strdup(menu->name);
1875  ao2_ref(menu, -1);
1876  break;
1877  }
1878  ao2_ref(menu, -1);
1879  }
1881 
1882  return res;
1883 }
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
#define NULL
Definition: resample.c:96
#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:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:148
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:1841
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
short word

◆ complete_user_profile_name()

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

Definition at line 1463 of file conf_config_parser.c.

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().

1464 {
1465  int which = 0;
1466  char *res = NULL;
1467  int wordlen = strlen(word);
1468  struct ao2_iterator i;
1469  struct user_profile *u_profile = NULL;
1471 
1472  if (!cfg) {
1473  return NULL;
1474  }
1475 
1476  i = ao2_iterator_init(cfg->user_profiles, 0);
1477  while ((u_profile = ao2_iterator_next(&i))) {
1478  if (!strncasecmp(u_profile->name, word, wordlen) && ++which > state) {
1479  res = ast_strdup(u_profile->name);
1480  ao2_ref(u_profile, -1);
1481  break;
1482  }
1483  ao2_ref(u_profile, -1);
1484  }
1486 
1487  return res;
1488 }
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
#define NULL
Definition: resample.c:96
#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:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
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:1841
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
short word

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

References ao2_ref, and bridge_profile::sounds.

Referenced by conf_find_bridge_profile(), and join_conference_bridge().

2524 {
2525  *dst = *src;
2526  if (src->sounds) {
2527  ao2_ref(src->sounds, +1);
2528  }
2529 }
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
#define ao2_ref(o, delta)
Definition: astobj2.h:464

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

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().

2532 {
2533  if (b_profile->sounds) {
2534  ao2_ref(b_profile->sounds, -1);
2535  b_profile->sounds = NULL;
2536  }
2537 }
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
#define NULL
Definition: resample.c:96
#define ao2_ref(o, delta)
Definition: astobj2.h:464

◆ conf_destroy_config()

void conf_destroy_config ( void  )

destroy the information loaded from the confbridge.conf file

Definition at line 2694 of file conf_config_parser.c.

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

Referenced by conf_load_config(), and unload_module().

2695 {
2697  aco_info_destroy(&cfg_info);
2699 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
static struct ast_cli_entry cli_confbridge_parser[]
#define ao2_global_obj_release(holder)
Definition: astobj2.h:865
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284

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

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

2540 {
2541  struct bridge_profile *tmp2;
2542  struct ast_datastore *datastore = NULL;
2543  struct func_confbridge_data *b_data = NULL;
2545 
2546  if (chan && ast_strlen_zero(bridge_profile_name)) {
2547  ast_channel_lock(chan);
2549  ast_channel_unlock(chan);
2550  if (datastore) {
2551  b_data = datastore->data;
2552  if (b_data->b_usable) {
2553  conf_bridge_profile_copy(result, &b_data->b_profile);
2554  return result;
2555  }
2556  }
2557  }
2558 
2559  if (!cfg) {
2560  return NULL;
2561  }
2562  if (ast_strlen_zero(bridge_profile_name)) {
2563  bridge_profile_name = DEFAULT_BRIDGE_PROFILE;
2564  }
2565  if (!(tmp2 = ao2_find(cfg->bridge_profiles, bridge_profile_name, OBJ_KEY))) {
2566  return NULL;
2567  }
2568  ao2_lock(tmp2);
2569  conf_bridge_profile_copy(result, tmp2);
2570  ao2_unlock(tmp2);
2571  ao2_ref(tmp2, -1);
2572 
2573  return result;
2574 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
#define OBJ_KEY
Definition: astobj2.h:1155
struct bridge_profile b_profile
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define ao2_unlock(a)
Definition: astobj2.h:730
Structure for a data store object.
Definition: datastore.h:68
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:2404
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
void conf_bridge_profile_copy(struct bridge_profile *dst, struct bridge_profile *src)
copies a bridge profile
#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:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
static const struct ast_datastore_info confbridge_datastore
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
static PGresult * result
Definition: cel_pgsql.c:88
#define DEFAULT_BRIDGE_PROFILE
Definition: confbridge.h:42

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

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

Referenced by action_playback_and_continue().

2611 {
2612  struct conf_menu_entry *menu_entry = NULL;
2613 
2614  ao2_lock(menu);
2615  AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
2616  if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {
2617  copy_menu_entry(result, menu_entry);
2618  ao2_unlock(menu);
2619  return 1;
2620  }
2621  }
2622  ao2_unlock(menu);
2623 
2624  return 0;
2625 }
Definition: confbridge.h:136
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:138
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
#define ao2_lock(a)
Definition: astobj2.h:718
struct conf_menu::@89 entries
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
Definition: search.h:40

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

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

2487 {
2488  struct user_profile *tmp2;
2489  struct ast_datastore *datastore = NULL;
2490  struct func_confbridge_data *b_data = NULL;
2492 
2493  if (chan && ast_strlen_zero(user_profile_name)) {
2494  ast_channel_lock(chan);
2496  ast_channel_unlock(chan);
2497  if (datastore) {
2498  b_data = datastore->data;
2499  if (b_data->u_usable) {
2500  conf_user_profile_copy(result, &b_data->u_profile);
2501  return result;
2502  }
2503  }
2504  }
2505 
2506  if (!cfg) {
2507  return NULL;
2508  }
2509  if (ast_strlen_zero(user_profile_name)) {
2510  user_profile_name = DEFAULT_USER_PROFILE;
2511  }
2512  if (!(tmp2 = ao2_find(cfg->user_profiles, user_profile_name, OBJ_KEY))) {
2513  return NULL;
2514  }
2515  ao2_lock(tmp2);
2516  conf_user_profile_copy(result, tmp2);
2517  ao2_unlock(tmp2);
2518  ao2_ref(tmp2, -1);
2519 
2520  return result;
2521 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
struct user_profile u_profile
#define OBJ_KEY
Definition: astobj2.h:1155
static void conf_user_profile_copy(struct user_profile *dst, struct user_profile *src)
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define ao2_unlock(a)
Definition: astobj2.h:730
Structure for a data store object.
Definition: datastore.h:68
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:2404
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
#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:911
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
static const struct ast_datastore_info confbridge_datastore
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
static PGresult * result
Definition: cel_pgsql.c:88
#define DEFAULT_USER_PROFILE
Definition: confbridge.h:41

◆ conf_load_config()

int conf_load_config ( void  )

load confbridge.conf file

Definition at line 2384 of file conf_config_parser.c.

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(), CHARFLDSET, conf_destroy_config(), DEFAULT_SILENCE_THRESHOLD, DEFAULT_TALKING_THRESHOLD, error(), FLDSET, language, menu_option_handler(), menu_template_handler(), mix_interval_handler(), NULL, OPT_BOOLFLAG_T, OPT_CHAR_ARRAY_T, OPT_NOOP_T, OPT_UINT_T, PARSE_DEFAULT, regcontext, remb_behavior_handler(), sound_option_handler(), timeout, 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_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(), and video_mode_handler().

Referenced by load_module().

2385 {
2386  if (aco_info_init(&cfg_info)) {
2387  return -1;
2388  }
2389 
2390  /* User options */
2391  aco_option_register(&cfg_info, "type", ACO_EXACT, user_types, NULL, OPT_NOOP_T, 0, 0);
2392  aco_option_register(&cfg_info, "admin", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ADMIN);
2393  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);
2394  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);
2395  aco_option_register(&cfg_info, "marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MARKEDUSER);
2396  aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
2397  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);
2398  aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
2399  aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
2400  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);
2401  /* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
2402  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);
2403  aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
2404  aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
2405  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);
2406  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);
2407  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);
2408  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);
2409  aco_option_register(&cfg_info, "pin", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, pin));
2410  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));
2411  aco_option_register(&cfg_info, "announcement", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, announcement));
2412  aco_option_register(&cfg_info, "denoise", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DENOISE);
2413  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);
2414  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));
2415  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));
2416  aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
2417  aco_option_register(&cfg_info, "timeout", ACO_EXACT, user_types, "0", OPT_UINT_T, 0, FLDSET(struct user_profile, timeout));
2418  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);
2419  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);
2420 
2421  /* This option should only be used with the CONFBRIDGE dialplan function */
2423 
2424 /* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
2425  /* Bridge options */
2426  aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
2427  aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
2428  /* "auto" will fail to parse as a uint, but we use PARSE_DEFAULT to set the value to 0 in that case, which is the value that auto resolves to */
2429  aco_option_register(&cfg_info, "internal_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, internal_sample_rate), 0);
2430  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);
2431  aco_option_register(&cfg_info, "maximum_sample_rate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, PARSE_DEFAULT, FLDSET(struct bridge_profile, maximum_sample_rate), 0);
2432  aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
2433  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);
2435  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);
2436  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);
2437  aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
2438  aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
2439  aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
2440  aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
2442  aco_option_register(&cfg_info, "language", ACO_EXACT, bridge_types, "en", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, language));
2444  aco_option_register(&cfg_info, "video_update_discard", ACO_EXACT, bridge_types, "2000", OPT_UINT_T, 0, FLDSET(struct bridge_profile, video_update_discard));
2445  aco_option_register(&cfg_info, "remb_send_interval", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_send_interval));
2446  aco_option_register_custom(&cfg_info, "remb_behavior", ACO_EXACT, bridge_types, "average", remb_behavior_handler, 0);
2447  aco_option_register(&cfg_info, "remb_estimated_bitrate", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, remb_estimated_bitrate));
2448  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);
2449  /* This option should only be used with the CONFBRIDGE dialplan function */
2451 
2452  /* Menu options */
2453  aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
2454  /* This option should only be used with the CONFBRIDGE dialplan function */
2456  aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
2457 
2458  if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
2459  goto error;
2460  }
2461 
2463  goto error;
2464  }
2465 
2466  return 0;
2467 error:
2469  return -1;
2470 }
static int mix_interval_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
static int sound_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
static int timeout
Definition: cdr_mysql.c:86
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
Type for a default handler that should do nothing.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
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.
Type for default option handler for bools (ast_true/ast_false) that are stored in a flag...
#define NULL
Definition: resample.c:96
static struct aco_type * menu_types[]
Type for default option handler for character array strings.
static int menu_option_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define __stringify(x)
Definition: asterisk.h:214
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define DEFAULT_TALKING_THRESHOLD
Definition: confbridge.h:46
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
Type for default option handler for unsigned integers.
static int video_mode_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 char language[MAX_LANGUAGE]
Definition: chan_alsa.c:117
static int announce_user_count_all_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Their was an error and no changes were applied.
static int user_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
void conf_destroy_config(void)
destroy the information loaded from the confbridge.conf file
static struct ast_cli_entry cli_confbridge_parser[]
static struct aco_type * user_types[]
static struct aco_type * bridge_types[]
static int remb_behavior_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:321
int error(const char *format,...)
Definition: utils/frame.c:999
#define DEFAULT_SILENCE_THRESHOLD
Definition: confbridge.h:49
static int menu_template_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)

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

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

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

2603 {
2604  struct conf_menu_action *menu_action = NULL;
2605  while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
2606  ast_free(menu_action);
2607  }
2608 }
struct conf_menu_action::@85 action
#define NULL
Definition: resample.c:96
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:832
#define ast_free(a)
Definition: astmm.h:182
struct conf_menu_entry::@87 actions

◆ conf_menu_profile_copy()

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

Definition at line 2280 of file conf_config_parser.c.

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().

2281 {
2282  /* Copy each menu item to the dst struct */
2283  struct conf_menu_entry *cur;
2284 
2285  AST_LIST_TRAVERSE(&src->entries, cur, entry) {
2286  struct conf_menu_entry *cpy;
2287 
2288  if (!(cpy = ast_calloc(1, sizeof(*cpy)))) {
2289  return -1;
2290  }
2291 
2292  if (copy_menu_entry(cpy, cur)) {
2294  ast_free(cpy);
2295  return -1;
2296  }
2297  AST_LIST_INSERT_TAIL(&dst->entries, cpy, entry);
2298  }
2299 
2300  return 0;
2301 }
Definition: confbridge.h:136
void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry)
Destroys and frees all the actions stored in a menu_entry structure.
static int copy_menu_entry(struct conf_menu_entry *dst, struct conf_menu_entry *src)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
struct conf_menu::@89 entries
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
#define ast_free(a)
Definition: astmm.h:182
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
Definition: search.h:40

◆ conf_reload_config()

int conf_reload_config ( void  )

reload confbridge.conf file

Definition at line 2472 of file conf_config_parser.c.

References aco_process_config(), and ACO_PROCESS_ERROR.

Referenced by reload().

2473 {
2474  if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
2475  /* On a reload, just keep the config we already have in place. */
2476  return -1;
2477  }
2478  return 0;
2479 }
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.
Their was an error and no changes were applied.

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

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

2657 {
2659  RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
2660 
2661  if (chan && ast_strlen_zero(menu_profile_name)) {
2662  struct ast_datastore *datastore;
2663  struct func_confbridge_data *b_data;
2664 
2665  ast_channel_lock(chan);
2667  ast_channel_unlock(chan);
2668  if (datastore) {
2669  /* If a menu exists in the CONFBRIDGE function datastore, use it. */
2670  b_data = datastore->data;
2671  if (b_data->m_usable) {
2672  menu = ao2_bump(b_data->menu);
2673  return apply_menu_to_user(user, menu);
2674  }
2675  }
2676  }
2677 
2678  /* Otherwise, we need to get whatever menu profile is specified to use (or default). */
2679  if (!cfg) {
2680  return -1;
2681  }
2682 
2683  if (ast_strlen_zero(menu_profile_name)) {
2684  menu_profile_name = DEFAULT_MENU_PROFILE;
2685  }
2686 
2687  if (!(menu = ao2_find(cfg->menus, menu_profile_name, OBJ_KEY))) {
2688  return -1;
2689  }
2690 
2691  return apply_menu_to_user(user, menu);
2692 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
struct conf_menu * menu
#define OBJ_KEY
Definition: astobj2.h:1155
static int apply_menu_to_user(struct confbridge_user *user, struct conf_menu *menu)
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
Structure for a data store object.
Definition: datastore.h:68
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:2404
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ao2_bump(obj)
Definition: astobj2.h:491
#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:911
static const struct ast_datastore_info confbridge_datastore
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define DEFAULT_MENU_PROFILE
Definition: confbridge.h:43

◆ conf_user_profile_copy()

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

Definition at line 2481 of file conf_config_parser.c.

Referenced by conf_find_user_profile().

2482 {
2483  *dst = *src;
2484 }

◆ confbridge_cfg_alloc()

void * confbridge_cfg_alloc ( void  )
static

Definition at line 2050 of file conf_config_parser.c.

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.

2051 {
2052  struct confbridge_cfg *cfg;
2053 
2054  if (!(cfg = ao2_alloc(sizeof(*cfg), confbridge_cfg_destructor))) {
2055  return NULL;
2056  }
2057 
2060  if (!cfg->user_profiles) {
2061  goto error;
2062  }
2063 
2066  if (!cfg->bridge_profiles) {
2067  goto error;
2068  }
2069 
2072  if (!cfg->menus) {
2073  goto error;
2074  }
2075 
2076  return cfg;
2077 error:
2078  ao2_ref(cfg, -1);
2079  return NULL;
2080 }
static int user_hash_cb(const void *obj, const int flags)
static int user_cmp_cb(void *obj, void *arg, int flags)
static int menu_hash_cb(const void *obj, const int flags)
struct ao2_container * bridge_profiles
#define NULL
Definition: resample.c:96
struct ao2_container * menus
#define ao2_ref(o, delta)
Definition: astobj2.h:464
static void confbridge_cfg_destructor(void *obj)
static int menu_cmp_cb(void *obj, void *arg, int flags)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Definition: astobj2.h:1310
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411
struct ao2_container * user_profiles
static int bridge_hash_cb(const void *obj, const int flags)
static int bridge_cmp_cb(void *obj, void *arg, int flags)
int error(const char *format,...)
Definition: utils/frame.c:999

◆ confbridge_cfg_destructor()

static void confbridge_cfg_destructor ( void *  obj)
static

Definition at line 2042 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

2043 {
2044  struct confbridge_cfg *cfg = obj;
2045  ao2_cleanup(cfg->user_profiles);
2047  ao2_cleanup(cfg->menus);
2048 }
struct ao2_container * bridge_profiles
struct ao2_container * menus
struct ao2_container * user_profiles
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

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

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().

2261 {
2262  struct conf_menu_action *menu_action;
2263  struct conf_menu_action *new_menu_action;
2264 
2265  ast_copy_string(dst->dtmf, src->dtmf, sizeof(dst->dtmf));
2267 
2268  AST_LIST_TRAVERSE(&src->actions, menu_action, action) {
2269  if (!(new_menu_action = ast_calloc(1, sizeof(*new_menu_action)))) {
2270  return -1;
2271  }
2272  memcpy(new_menu_action, menu_action, sizeof(*new_menu_action));
2273  AST_LIST_NEXT(new_menu_action, action) = NULL;
2274  AST_LIST_INSERT_TAIL(&dst->actions, new_menu_action, action);
2275  }
2276 
2277  return 0;
2278 }
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Definition: linkedlists.h:438
struct conf_menu_action::@85 action
#define NULL
Definition: resample.c:96
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:138
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
Definition: linkedlists.h:680
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
struct conf_menu_entry::@87 actions

◆ func_confbridge_data_destructor()

static void func_confbridge_data_destructor ( struct func_confbridge_data b_data)
static

Definition at line 1097 of file conf_config_parser.c.

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().

1098 {
1100  ao2_cleanup(b_data->menu);
1101  ast_free(b_data);
1102 }
struct conf_menu * menu
struct bridge_profile b_profile
void conf_bridge_profile_destroy(struct bridge_profile *b_profile)
Destroy a bridge profile found by &#39;conf_find_bridge_profile&#39;.
#define ast_free(a)
Definition: astmm.h:182
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

◆ func_confbridge_destroy_cb()

static void func_confbridge_destroy_cb ( void *  data)
static

Definition at line 1104 of file conf_config_parser.c.

References func_confbridge_data_destructor().

1105 {
1106  struct func_confbridge_data *b_data = data;
1108 };
static void func_confbridge_data_destructor(struct func_confbridge_data *b_data)

◆ func_confbridge_helper()

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

Definition at line 1115 of file conf_config_parser.c.

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(), conf_bridge_profile_destroy(), 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(), ast_variable::name, NULL, parse(), bridge_profile::sounds, type, func_confbridge_data::u_profile, func_confbridge_data::u_usable, user_profile_destructor(), value, and ast_variable::value.

1116 {
1117  struct ast_datastore *datastore;
1118  struct func_confbridge_data *b_data;
1119  char *parse;
1120  struct ast_variable tmpvar = { 0, };
1121  struct ast_variable template = {
1122  .name = "template",
1123  .file = "CONFBRIDGE"
1124  };
1126  AST_APP_ARG(type);
1127  AST_APP_ARG(option);
1128  );
1129 
1130  if (!chan) {
1131  ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
1132  return -1;
1133  }
1134 
1135  /* parse all the required arguments and make sure they exist. */
1136  if (ast_strlen_zero(data)) {
1137  return -1;
1138  }
1139  parse = ast_strdupa(data);
1140  AST_STANDARD_APP_ARGS(args, parse);
1141  if (ast_strlen_zero(args.type) || ast_strlen_zero(args.option)) {
1142  return -1;
1143  }
1144 
1145  ast_channel_lock(chan);
1147  if (!datastore) {
1149  if (!datastore) {
1150  ast_channel_unlock(chan);
1151  return 0;
1152  }
1153  b_data = ast_calloc(1, sizeof(*b_data));
1154  if (!b_data) {
1155  ast_channel_unlock(chan);
1156  ast_datastore_free(datastore);
1157  return 0;
1158  }
1159  datastore->data = b_data;
1161  if (!b_data->b_profile.sounds) {
1162  ast_channel_unlock(chan);
1163  ast_datastore_free(datastore);
1164  return 0;
1165  }
1166  if (!(b_data->menu = menu_alloc("dialplan"))) {
1167  ast_channel_unlock(chan);
1168  ast_datastore_free(datastore);
1169  return 0;
1170  }
1171  ast_channel_datastore_add(chan, datastore);
1172  } else {
1173  b_data = datastore->data;
1174  }
1175  ast_channel_unlock(chan);
1176 
1177  /* SET(CONFBRIDGE(type,option)=value) */
1178  if (!value) {
1179  value = "";
1180  }
1181  tmpvar.name = args.option;
1182  tmpvar.value = value;
1183  tmpvar.file = "CONFBRIDGE";
1184  if (!strcasecmp(args.type, "bridge")) {
1185  if (!strcasecmp(args.option, "clear")) {
1186  b_data->b_usable = 0;
1188  memset(&b_data->b_profile, 0, sizeof(b_data->b_profile)) ;
1189  if (!(b_data->b_profile.sounds = bridge_profile_sounds_alloc())) {
1190  /* If this reallocation fails, the datastore has become unusable and must be destroyed. */
1191  ast_channel_lock(chan);
1192  ast_channel_datastore_remove(chan, datastore);
1193  ast_channel_unlock(chan);
1194  ast_datastore_free(datastore);
1195  }
1196  return 0;
1197  }
1198 
1199  if (b_data && !b_data->b_usable && strcasecmp(args.option, "template")) {
1200  template.value = DEFAULT_BRIDGE_PROFILE;
1201  aco_process_var(&bridge_type, "dialplan", &template, &b_data->b_profile);
1202  }
1203 
1204  if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
1205  b_data->b_usable = 1;
1206  return 0;
1207  }
1208  } else if (!strcasecmp(args.type, "user")) {
1209  if (!strcasecmp(args.option, "clear")) {
1210  b_data->u_usable = 0;
1212  memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
1213  return 0;
1214  }
1215 
1216  if (b_data && !b_data->u_usable && strcasecmp(args.option, "template")) {
1217  template.value = DEFAULT_USER_PROFILE;
1218  aco_process_var(&user_type, "dialplan", &template, &b_data->u_profile);
1219  }
1220 
1221  if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
1222  b_data->u_usable = 1;
1223  return 0;
1224  }
1225  } else if (!strcasecmp(args.type, "menu")) {
1226  if (!strcasecmp(args.option, "clear")) {
1227  b_data->m_usable = 0;
1228  ao2_cleanup(b_data->menu);
1229  if (!(b_data->menu = menu_alloc("dialplan"))) {
1230  /* If this reallocation fails, the datastore has become unusable and must be destroyed */
1231  ast_channel_lock(chan);
1232  ast_channel_datastore_remove(chan, datastore);
1233  ast_channel_unlock(chan);
1234  ast_datastore_free(datastore);
1235  }
1236  return 0;
1237  }
1238 
1239  if (b_data && !b_data->m_usable && strcasecmp(args.option, "template")) {
1240  template.value = DEFAULT_MENU_PROFILE;
1241  aco_process_var(&menu_type, "dialplan", &template, &b_data->menu);
1242  }
1243 
1244  if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
1245  b_data->m_usable = 1;
1246  return 0;
1247  }
1248  }
1249 
1250  ast_log(LOG_WARNING, "%s(%s,%s) cannot be set to '%s'. Invalid type, option, or value.\n",
1251  cmd, args.type, args.option, value);
1252  return -1;
1253 }
static const char type[]
Definition: chan_ooh323.c:109
#define ast_channel_lock(chan)
Definition: channel.h:2945
struct conf_menu * menu
struct user_profile u_profile
static struct aco_type user_type
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
#define LOG_WARNING
Definition: logger.h:274
Structure for variables, used for configurations and for channel variables.
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
struct bridge_profile b_profile
Structure for a data store object.
Definition: datastore.h:68
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:2404
const char * args
static struct aco_type bridge_type
#define NULL
Definition: resample.c:96
int value
Definition: syslog.c:37
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:68
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_log
Definition: astobj2.c:42
static struct aco_type menu_type
void conf_bridge_profile_destroy(struct bridge_profile *b_profile)
Destroy a bridge profile found by &#39;conf_find_bridge_profile&#39;.
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
static const struct ast_datastore_info confbridge_datastore
static void * menu_alloc(const char *category)
#define ast_channel_unlock(chan)
Definition: channel.h:2946
static void parse(struct mgcp_request *req)
Definition: chan_mgcp.c:1872
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
void * data
Definition: datastore.h:70
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define DEFAULT_MENU_PROFILE
Definition: confbridge.h:43
#define DEFAULT_BRIDGE_PROFILE
Definition: confbridge.h:42
#define ast_datastore_alloc(info, uid)
Definition: datastore.h:89
#define DEFAULT_USER_PROFILE
Definition: confbridge.h:41
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.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2390
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
Definition: channel.c:2399
static void user_profile_destructor(void *obj)
static struct bridge_profile_sounds * bridge_profile_sounds_alloc(void)
#define AST_APP_ARG(name)
Define an application argument.

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

References ast_cli_args::argc, ast_cli_args::argv, 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, ast_cli_args::fd, bridge_profile::flags, bridge_profile::internal_sample_rate, bridge_profile::language, ast_cli_args::line, bridge_profile::max_members, bridge_profile::maximum_sample_rate, bridge_profile::mix_interval, ast_cli_args::n, bridge_profile::name, NULL, ast_cli_args::pos, 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, bridge_profile::video_update_discard, and ast_cli_args::word.

1687 {
1688  struct bridge_profile b_profile;
1689  char tmp[64];
1690 
1691  switch (cmd) {
1692  case CLI_INIT:
1693  e->command = "confbridge show profile bridge";
1694  e->usage =
1695  "Usage: confbridge show profile bridge <profile name>\n";
1696  return NULL;
1697  case CLI_GENERATE:
1698  if (a->pos == 4) {
1699  return complete_bridge_profile_name(a->line, a->word, a->pos, a->n);
1700  }
1701  return NULL;
1702  }
1703 
1704  if (a->argc != 5) {
1705  return CLI_SHOWUSAGE;
1706  }
1707 
1708  if (!(conf_find_bridge_profile(NULL, a->argv[4], &b_profile))) {
1709  ast_cli(a->fd, "No conference bridge profile named '%s' found!\n", a->argv[4]);
1710  return CLI_SUCCESS;
1711  }
1712 
1713  ast_cli(a->fd,"--------------------------------------------\n");
1714  ast_cli(a->fd,"Name: %s\n", b_profile.name);
1715  ast_cli(a->fd,"Language: %s\n", b_profile.language);
1716 
1717  if (b_profile.internal_sample_rate) {
1718  snprintf(tmp, sizeof(tmp), "%u", b_profile.internal_sample_rate);
1719  } else {
1720  ast_copy_string(tmp, "auto", sizeof(tmp));
1721  }
1722  ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
1723 
1724  if (b_profile.maximum_sample_rate) {
1725  snprintf(tmp, sizeof(tmp), "%u", b_profile.maximum_sample_rate);
1726  } else {
1727  ast_copy_string(tmp, "none", sizeof(tmp));
1728  }
1729  ast_cli(a->fd,"Maximum Sample Rate: %s\n", tmp);
1730 
1731  if (b_profile.mix_interval) {
1732  ast_cli(a->fd,"Mixing Interval: %u\n", b_profile.mix_interval);
1733  } else {
1734  ast_cli(a->fd,"Mixing Interval: Default 20ms\n");
1735  }
1736 
1737  ast_cli(a->fd,"Record Conference: %s\n",
1738  b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
1739  "yes" : "no");
1740 
1741  ast_cli(a->fd,"Record File Append: %s\n",
1742  b_profile.flags & BRIDGE_OPT_RECORD_FILE_APPEND ?
1743  "yes" : "no");
1744 
1745  ast_cli(a->fd,"Record File Timestamp: %s\n",
1746  b_profile.flags & BRIDGE_OPT_RECORD_FILE_TIMESTAMP ?
1747  "yes" : "no");
1748 
1749  ast_cli(a->fd,"Record File: %s\n",
1750  ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
1751  b_profile.rec_file);
1752 
1753  ast_cli(a->fd,"Record Options: %s\n",
1754  b_profile.rec_options);
1755 
1756  ast_cli(a->fd,"Record Command: %s\n",
1757  b_profile.rec_command);
1758 
1759  if (b_profile.max_members) {
1760  ast_cli(a->fd,"Max Members: %u\n", b_profile.max_members);
1761  } else {
1762  ast_cli(a->fd,"Max Members: No Limit\n");
1763  }
1764 
1765  ast_cli(a->fd,"Registration context: %s\n", b_profile.regcontext);
1766 
1767  switch (b_profile.flags
1773  ast_cli(a->fd, "Video Mode: last_marked\n");
1774  break;
1776  ast_cli(a->fd, "Video Mode: first_marked\n");
1777  break;
1779  ast_cli(a->fd, "Video Mode: follow_talker\n");
1780  break;
1782  ast_cli(a->fd, "Video Mode: sfu\n");
1783  break;
1784  case 0:
1785  ast_cli(a->fd, "Video Mode: no video\n");
1786  break;
1787  default:
1788  /* Opps. We have more than one video mode flag set. */
1789  ast_assert(0);
1790  break;
1791  }
1792 
1793  ast_cli(a->fd,"Video Update Discard: %u\n", b_profile.video_update_discard);
1794  ast_cli(a->fd,"REMB Send Interval: %u\n", b_profile.remb_send_interval);
1795 
1796  switch (b_profile.flags
1801  ast_cli(a->fd, "REMB Behavior: average\n");
1802  break;
1804  ast_cli(a->fd, "REMB Behavior: lowest\n");
1805  break;
1807  ast_cli(a->fd, "REMB Behavior: highest\n");
1808  break;
1810  ast_cli(a->fd, "REMB Behavior: average_all\n");
1811  break;
1813  ast_cli(a->fd, "REMB Behavior: lowest_all\n");
1814  break;
1816  ast_cli(a->fd, "REMB Behavior: highest_all\n");
1817  break;
1818  default:
1819  ast_assert(0);
1820  break;
1821  }
1822 
1823  ast_cli(a->fd,"Enable Events: %s\n",
1824  b_profile.flags & BRIDGE_OPT_ENABLE_EVENTS ?
1825  "yes" : "no");
1826 
1827  ast_cli(a->fd,"sound_only_person: %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
1828  ast_cli(a->fd,"sound_only_one: %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
1829  ast_cli(a->fd,"sound_has_joined: %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
1830  ast_cli(a->fd,"sound_has_left: %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));
1831  ast_cli(a->fd,"sound_kicked: %s\n", conf_get_sound(CONF_SOUND_KICKED, b_profile.sounds));
1832  ast_cli(a->fd,"sound_muted: %s\n", conf_get_sound(CONF_SOUND_MUTED, b_profile.sounds));
1833  ast_cli(a->fd,"sound_unmuted: %s\n", conf_get_sound(CONF_SOUND_UNMUTED, b_profile.sounds));
1834  ast_cli(a->fd,"sound_binaural_on: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_ON, b_profile.sounds));
1835  ast_cli(a->fd,"sound_binaural_off: %s\n", conf_get_sound(CONF_SOUND_BINAURAL_OFF, b_profile.sounds));
1836  ast_cli(a->fd,"sound_there_are: %s\n", conf_get_sound(CONF_SOUND_THERE_ARE, b_profile.sounds));
1837  ast_cli(a->fd,"sound_other_in_party: %s\n", conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, b_profile.sounds));
1838  ast_cli(a->fd,"sound_place_into_conference: %s\n", conf_get_sound(CONF_SOUND_PLACE_IN_CONF, b_profile.sounds));
1839  ast_cli(a->fd,"sound_wait_for_leader: %s\n", conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, b_profile.sounds));
1840  ast_cli(a->fd,"sound_leader_has_left: %s\n", conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, b_profile.sounds));
1841  ast_cli(a->fd,"sound_get_pin: %s\n", conf_get_sound(CONF_SOUND_GET_PIN, b_profile.sounds));
1842  ast_cli(a->fd,"sound_invalid_pin: %s\n", conf_get_sound(CONF_SOUND_INVALID_PIN, b_profile.sounds));
1843  ast_cli(a->fd,"sound_locked: %s\n", conf_get_sound(CONF_SOUND_LOCKED, b_profile.sounds));
1844  ast_cli(a->fd,"sound_unlocked_now: %s\n", conf_get_sound(CONF_SOUND_UNLOCKED_NOW, b_profile.sounds));
1845  ast_cli(a->fd,"sound_lockednow: %s\n", conf_get_sound(CONF_SOUND_LOCKED_NOW, b_profile.sounds));
1846  ast_cli(a->fd,"sound_error_menu: %s\n", conf_get_sound(CONF_SOUND_ERROR_MENU, b_profile.sounds));
1847  ast_cli(a->fd,"sound_join: %s\n", conf_get_sound(CONF_SOUND_JOIN, b_profile.sounds));
1848  ast_cli(a->fd,"sound_leave: %s\n", conf_get_sound(CONF_SOUND_LEAVE, b_profile.sounds));
1849  ast_cli(a->fd,"sound_participants_muted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, b_profile.sounds));
1850  ast_cli(a->fd,"sound_participants_unmuted: %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, b_profile.sounds));
1851  ast_cli(a->fd,"sound_begin: %s\n", conf_get_sound(CONF_SOUND_BEGIN, b_profile.sounds));
1852  ast_cli(a->fd,"\n");
1853 
1854  conf_bridge_profile_destroy(&b_profile);
1855  return CLI_SUCCESS;
1856 }
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...
const int argc
Definition: cli.h:160
static int tmp()
Definition: bt_open.c:389
Definition: cli.h:152
static char * complete_bridge_profile_name(const char *line, const char *word, int pos, int state)
#define ast_assert(a)
Definition: utils.h:695
#define NULL
Definition: resample.c:96
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
const char * line
Definition: cli.h:162
#define ast_strlen_zero(foo)
Definition: strings.h:52
const int fd
Definition: cli.h:159
const int n
Definition: cli.h:165
void conf_bridge_profile_destroy(struct bridge_profile *b_profile)
Destroy a bridge profile found by &#39;conf_find_bridge_profile&#39;.
const char *const * argv
Definition: cli.h:161
#define CLI_SHOWUSAGE
Definition: cli.h:45
char * command
Definition: cli.h:186
const char * word
Definition: cli.h:163
const char * usage
Definition: cli.h:177
#define CLI_SUCCESS
Definition: cli.h:44
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
const int pos
Definition: cli.h:164
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&#39;s name and store that profile in result structure...

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

References 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, ast_cli_args::fd, bridge_profile::name, NULL, RAII_VAR, and ast_cli_entry::usage.

1654 {
1655  struct ao2_iterator it;
1656  struct bridge_profile *b_profile;
1657  RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1658 
1659  switch (cmd) {
1660  case CLI_INIT:
1661  e->command = "confbridge show profile bridges";
1662  e->usage =
1663  "Usage: confbridge show profile bridges\n";
1664  return NULL;
1665  case CLI_GENERATE:
1666  return NULL;
1667  }
1668 
1669  if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1670  return NULL;
1671  }
1672 
1673  ast_cli(a->fd,"--------- Bridge Profiles -----------\n");
1674  ao2_lock(cfg->bridge_profiles);
1675  it = ao2_iterator_init(cfg->bridge_profiles, 0);
1676  while ((b_profile = ao2_iterator_next(&it))) {
1677  ast_cli(a->fd,"%s\n", b_profile->name);
1678  ao2_ref(b_profile, -1);
1679  }
1680  ao2_iterator_destroy(&it);
1681  ao2_unlock(cfg->bridge_profiles);
1682 
1683  return CLI_SUCCESS;
1684 }
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:226
Definition: cli.h:152
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
#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:911
const int fd
Definition: cli.h:159
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
#define CLI_SUCCESS
Definition: cli.h:44
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1841
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.

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

References conf_menu_entry::actions, ao2_cleanup, ao2_global_obj_ref, ao2_lock, ao2_unlock, ast_cli_args::argc, ast_cli_args::argv, 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::data, conf_menu_action::dialplan_args, conf_menu_entry::dtmf, ast_cli_args::fd, conf_menu_action::id, ast_cli_args::line, 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(), ast_cli_args::n, NULL, conf_menu_action::playback_file, ast_cli_args::pos, RAII_VAR, ast_cli_entry::usage, and ast_cli_args::word.

1919 {
1920  RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
1921  RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1922  struct conf_menu_entry *menu_entry = NULL;
1923  struct conf_menu_action *menu_action = NULL;
1924 
1925  switch (cmd) {
1926  case CLI_INIT:
1927  e->command = "confbridge show menu";
1928  e->usage =
1929  "Usage: confbridge show menu [<menu name>]\n";
1930  return NULL;
1931  case CLI_GENERATE:
1932  if (a->pos == 3) {
1933  return complete_menu_name(a->line, a->word, a->pos, a->n);
1934  }
1935  return NULL;
1936  }
1937 
1938  if (a->argc != 4) {
1939  return CLI_SHOWUSAGE;
1940  }
1941 
1942  if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1943  return NULL;
1944  }
1945 
1946  if (!(menu = menu_find(cfg->menus, a->argv[3]))) {
1947  ast_cli(a->fd, "No conference menu named '%s' found!\n", a->argv[3]);
1948  return CLI_SUCCESS;
1949  }
1950  ao2_lock(menu);
1951 
1952  ast_cli(a->fd,"Name: %s\n", menu->name);
1953  AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
1954  int action_num = 0;
1955  ast_cli(a->fd, "%s=", menu_entry->dtmf);
1956  AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
1957  if (action_num) {
1958  ast_cli(a->fd, ", ");
1959  }
1960  switch (menu_action->id) {
1962  ast_cli(a->fd, "toggle_mute");
1963  break;
1965  ast_cli(a->fd, "toggle_binaural");
1966  break;
1967  case MENU_ACTION_NOOP:
1968  ast_cli(a->fd, "no_op");
1969  break;
1971  ast_cli(a->fd, "increase_listening_volume");
1972  break;
1974  ast_cli(a->fd, "decrease_listening_volume");
1975  break;
1977  ast_cli(a->fd, "reset_listening_volume");
1978  break;
1980  ast_cli(a->fd, "reset_talking_volume");
1981  break;
1983  ast_cli(a->fd, "increase_talking_volume");
1984  break;
1986  ast_cli(a->fd, "decrease_talking_volume");
1987  break;
1988  case MENU_ACTION_PLAYBACK:
1989  ast_cli(a->fd, "playback(%s)", menu_action->data.playback_file);
1990  break;
1992  ast_cli(a->fd, "playback_and_continue(%s)", menu_action->data.playback_file);
1993  break;
1995  ast_cli(a->fd, "dialplan_exec(%s,%s,%d)",
1996  menu_action->data.dialplan_args.context,
1997  menu_action->data.dialplan_args.exten,
1998  menu_action->data.dialplan_args.priority);
1999  break;
2001  ast_cli(a->fd, "admin_toggle_conference_lock");
2002  break;
2004  ast_cli(a->fd, "admin_toggle_mute_participants");
2005  break;
2007  ast_cli(a->fd, "participant_count");
2008  break;
2010  ast_cli(a->fd, "admin_kick_last");
2011  break;
2012  case MENU_ACTION_LEAVE:
2013  ast_cli(a->fd, "leave_conference");
2014  break;
2016  ast_cli(a->fd, "set_as_single_video_src");
2017  break;
2019  ast_cli(a->fd, "release_as_single_video_src");
2020  break;
2021  }
2022  action_num++;
2023  }
2024  ast_cli(a->fd,"\n");
2025  }
2026 
2027 
2028  ao2_unlock(menu);
2029  return CLI_SUCCESS;
2030 }
static char * complete_menu_name(const char *line, const char *word, int pos, int state)
Definition: confbridge.h:136
const int argc
Definition: cli.h:160
Definition: cli.h:152
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define ao2_unlock(a)
Definition: astobj2.h:730
struct conf_menu_action::@85 action
#define NULL
Definition: resample.c:96
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
const char * line
Definition: cli.h:162
char dtmf[MAXIMUM_DTMF_FEATURE_STRING]
Definition: confbridge.h:138
#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:911
const int fd
Definition: cli.h:159
const int n
Definition: cli.h:165
#define ao2_lock(a)
Definition: astobj2.h:718
struct conf_menu_action::@84::@86 dialplan_args
const char *const * argv
Definition: cli.h:161
char playback_file[PATH_MAX]
Definition: confbridge.h:123
#define CLI_SHOWUSAGE
Definition: cli.h:45
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
char * command
Definition: cli.h:186
const char * word
Definition: cli.h:163
union conf_menu_action::@84 data
const char * usage
Definition: cli.h:177
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
#define CLI_SUCCESS
Definition: cli.h:44
enum conf_menu_action_id id
Definition: confbridge.h:121
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
static void * menu_find(struct ao2_container *container, const char *category)
const int pos
Definition: cli.h:164
Definition: search.h:40
struct conf_menu_entry::@87 actions

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

References 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, ast_cli_args::fd, conf_menu::name, NULL, RAII_VAR, and ast_cli_entry::usage.

1886 {
1887  struct ao2_iterator it;
1888  struct conf_menu *menu;
1889  RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1890 
1891  switch (cmd) {
1892  case CLI_INIT:
1893  e->command = "confbridge show menus";
1894  e->usage =
1895  "Usage: confbridge show profile menus\n";
1896  return NULL;
1897  case CLI_GENERATE:
1898  return NULL;
1899  }
1900 
1901  if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1902  return NULL;
1903  }
1904 
1905  ast_cli(a->fd,"--------- Menus -----------\n");
1906  ao2_lock(cfg->menus);
1907  it = ao2_iterator_init(cfg->menus, 0);
1908  while ((menu = ao2_iterator_next(&it))) {
1909  ast_cli(a->fd,"%s\n", menu->name);
1910  ao2_ref(menu, -1);
1911  }
1912  ao2_iterator_destroy(&it);
1913  ao2_unlock(cfg->menus);
1914 
1915  return CLI_SUCCESS;
1916 }
Definition: cli.h:152
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
#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:911
const int fd
Definition: cli.h:159
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
char * command
Definition: cli.h:186
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:148
const char * usage
Definition: cli.h:177
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
#define CLI_SUCCESS
Definition: cli.h:44
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1841
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.

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

References user_profile::announcement, ast_cli_args::argc, ast_cli_args::argv, 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(), ast_cli_args::fd, user_profile::flags, ast_cli_args::line, user_profile::moh_class, ast_cli_args::n, user_profile::name, NULL, user_profile::pin, ast_cli_args::pos, 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_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, USER_OPT_WAITMARKED, and ast_cli_args::word.

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

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

References 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, ast_cli_args::fd, user_profile::name, NULL, RAII_VAR, and ast_cli_entry::usage.

1491 {
1492  struct ao2_iterator it;
1493  struct user_profile *u_profile;
1494  RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
1495 
1496  switch (cmd) {
1497  case CLI_INIT:
1498  e->command = "confbridge show profile users";
1499  e->usage =
1500  "Usage: confbridge show profile users\n";
1501  return NULL;
1502  case CLI_GENERATE:
1503  return NULL;
1504  }
1505 
1506  if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
1507  return NULL;
1508  }
1509 
1510  ast_cli(a->fd,"--------- User Profiles -----------\n");
1511  ao2_lock(cfg->user_profiles);
1512  it = ao2_iterator_init(cfg->user_profiles, 0);
1513  while ((u_profile = ao2_iterator_next(&it))) {
1514  ast_cli(a->fd,"%s\n", u_profile->name);
1515  ao2_ref(u_profile, -1);
1516  }
1517  ao2_iterator_destroy(&it);
1518  ao2_unlock(cfg->user_profiles);
1519 
1520  return CLI_SUCCESS;
1521 }
Definition: cli.h:152
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_unlock(a)
Definition: astobj2.h:730
#define NULL
Definition: resample.c:96
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
#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:911
const int fd
Definition: cli.h:159
#define ao2_ref(o, delta)
Definition: astobj2.h:464
#define ao2_lock(a)
Definition: astobj2.h:718
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
#define CLI_SUCCESS
Definition: cli.h:44
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1841
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.

◆ menu_alloc()

static void * menu_alloc ( const char *  category)
static

Definition at line 792 of file conf_config_parser.c.

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

Referenced by func_confbridge_helper(), and verify_default_profiles().

793 {
794  struct conf_menu *menu;
795  if (!(menu = ao2_alloc(sizeof(*menu), menu_destructor))) {
796  return NULL;
797  }
798  ast_copy_string(menu->name, category, sizeof(menu->name));
799  return menu;
800 }
#define NULL
Definition: resample.c:96
static void menu_destructor(void *obj)
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:148
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401

◆ menu_cmp_cb()

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

menu container functions

Definition at line 893 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

894 {
895  const struct conf_menu *left = obj;
896  const struct conf_menu *right = arg;
897  const char *right_name = arg;
898  int cmp;
899 
900  switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
901  default:
902  case OBJ_POINTER:
903  right_name = right->name;
904  /* Fall through */
905  case OBJ_KEY:
906  cmp = strcasecmp(left->name, right_name);
907  break;
908  case OBJ_PARTIAL_KEY:
909  cmp = strncasecmp(left->name, right_name, strlen(right_name));
910  break;
911  }
912  return cmp ? 0 : CMP_MATCH;
913 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define OBJ_POINTER
Definition: astobj2.h:1154
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1156
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:148

◆ menu_destructor()

static void menu_destructor ( void *  obj)
static

Definition at line 938 of file conf_config_parser.c.

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

Referenced by menu_alloc().

939 {
940  struct conf_menu *menu = obj;
941  struct conf_menu_entry *entry = NULL;
942 
943  while ((entry = AST_LIST_REMOVE_HEAD(&menu->entries, entry))) {
945  ast_free(entry);
946  }
947 }
Definition: confbridge.h:136
void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry)
Destroys and frees all the actions stored in a menu_entry structure.
#define NULL
Definition: resample.c:96
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:832
struct conf_menu::@89 entries
#define ast_free(a)
Definition: astmm.h:182
Definition: search.h:40

◆ menu_find()

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

Definition at line 802 of file conf_config_parser.c.

References ao2_find, and OBJ_KEY.

Referenced by handle_cli_confbridge_show_menu().

803 {
804  return ao2_find(container, category, OBJ_KEY);
805 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756

◆ menu_hash_cb()

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

Definition at line 915 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

916 {
917  const struct conf_menu *menu = obj;
918  const char *name = obj;
919  int hash;
920 
921  switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
922  default:
923  case OBJ_POINTER:
924  name = menu->name;
925  /* Fall through */
926  case OBJ_KEY:
927  hash = ast_str_case_hash(name);
928  break;
929  case OBJ_PARTIAL_KEY:
930  /* Should never happen in hash callback. */
931  ast_assert(0);
932  hash = 0;
933  break;
934  }
935  return hash;
936 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define OBJ_POINTER
Definition: astobj2.h:1154
#define ast_assert(a)
Definition: utils.h:695
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1156
static const char name[]
Definition: cdr_mysql.c:74
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:148
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:1250

◆ menu_hook_callback()

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

Definition at line 2595 of file conf_config_parser.c.

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().

2596 {
2597  struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2598 
2599  return conf_handle_dtmf(bridge_channel, pvt->user, &pvt->menu_entry, pvt->menu);
2600 }
struct conf_menu * menu
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&#39;s DTMF menu, this function will get called to per...
struct confbridge_user * user
struct conf_menu_entry menu_entry

◆ menu_hook_destroy()

static void menu_hook_destroy ( void *  hook_pvt)
static

Definition at line 2582 of file conf_config_parser.c.

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().

2583 {
2584  struct dtmf_menu_hook_pvt *pvt = hook_pvt;
2585  struct conf_menu_action *action = NULL;
2586 
2587  ao2_cleanup(pvt->menu);
2588 
2589  while ((action = AST_LIST_REMOVE_HEAD(&pvt->menu_entry.actions, action))) {
2590  ast_free(action);
2591  }
2592  ast_free(pvt);
2593 }
struct conf_menu_action::@85 action
#define NULL
Definition: resample.c:96
struct conf_menu * menu
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:832
#define ast_free(a)
Definition: astmm.h:182
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
struct conf_menu_entry::@87 actions
struct conf_menu_entry menu_entry

◆ menu_option_handler()

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

Definition at line 2330 of file conf_config_parser.c.

References add_menu_entry(), ast_variable::name, and ast_variable::value.

Referenced by conf_load_config().

2331 {
2332  add_menu_entry(obj, var->name, var->value);
2333  return 0;
2334 }
static int add_menu_entry(struct conf_menu *menu, const char *dtmf, const char *action_names)

◆ menu_template_handler()

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

Definition at line 2303 of file conf_config_parser.c.

References ao2_cleanup, ao2_find, ao2_global_obj_ref, cfg_handle, conf_menu_profile_copy(), NULL, OBJ_KEY, RAII_VAR, and ast_variable::value.

Referenced by conf_load_config().

2304 {
2305  struct conf_menu *dst_menu = obj;
2307  RAII_VAR(struct conf_menu *, src_menu, NULL, ao2_cleanup);
2308 
2309  if (!cfg) {
2310  return 0;
2311  }
2312 
2313  if (!(src_menu = ao2_find(cfg->menus, var->value, OBJ_KEY))) {
2314  return -1;
2315  }
2316 
2317  if (conf_menu_profile_copy(dst_menu, src_menu)) {
2318  return -1;
2319  }
2320 
2321  return 0;
2322 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define NULL
Definition: resample.c:96
#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:911
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
static int conf_menu_profile_copy(struct conf_menu *dst, struct conf_menu *src)
static corosync_cfg_handle_t cfg_handle
Definition: res_corosync.c:284
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

◆ mix_interval_handler()

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

Definition at line 2101 of file conf_config_parser.c.

References bridge_profile::mix_interval, ast_variable::name, and ast_variable::value.

Referenced by conf_load_config().

2102 {
2103  struct bridge_profile *b_profile = obj;
2104 
2105  if (strcasecmp(var->name, "mixing_interval")) {
2106  return -1;
2107  }
2108  if (sscanf(var->value, "%30u", &b_profile->mix_interval) != 1) {
2109  return -1;
2110  }
2111  switch (b_profile->mix_interval) {
2112  case 10:
2113  case 20:
2114  case 40:
2115  case 80:
2116  return 0;
2117  default:
2118  return -1;
2119  }
2120 }
unsigned int mix_interval
Definition: confbridge.h:235

◆ remb_behavior_handler()

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

Definition at line 2169 of file conf_config_parser.c.

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, ast_variable::name, and ast_variable::value.

Referenced by conf_load_config().

2170 {
2171  struct bridge_profile *b_profile = obj;
2172 
2173  if (strcasecmp(var->name, "remb_behavior")) {
2174  return -1;
2175  }
2176 
2184  );
2185 
2186  if (!strcasecmp(var->value, "average")) {
2188  } else if (!strcasecmp(var->value, "lowest")) {
2190  } else if (!strcasecmp(var->value, "highest")) {
2192  } else if (!strcasecmp(var->value, "average_all")) {
2194  } else if (!strcasecmp(var->value, "lowest_all")) {
2196  } else if (!strcasecmp(var->value, "highest_all")) {
2198  } else if (!strcasecmp(var->value, "force")) {
2200  } else {
2201  return -1;
2202  }
2203  return 0;
2204 }
#define ast_set_flag(p, flag)
Definition: utils.h:70
#define ast_clear_flag(p, flag)
Definition: utils.h:77

◆ set_sound()

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

Definition at line 1017 of file conf_config_parser.c.

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, 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, sounds, bridge_profile::sounds, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, and bridge_profile_sounds::waitforleader.

Referenced by sound_option_handler().

1018 {
1019  struct bridge_profile_sounds *sounds = b_profile->sounds;
1020  if (ast_strlen_zero(sound_file)) {
1021  return -1;
1022  }
1023 
1024  if (!strcasecmp(sound_name, "sound_only_person")) {
1025  ast_string_field_set(sounds, onlyperson, sound_file);
1026  } else if (!strcasecmp(sound_name, "sound_only_one")) {
1027  ast_string_field_set(sounds, onlyone, sound_file);
1028  } else if (!strcasecmp(sound_name, "sound_has_joined")) {
1029  ast_string_field_set(sounds, hasjoin, sound_file);
1030  } else if (!strcasecmp(sound_name, "sound_has_left")) {
1031  ast_string_field_set(sounds, hasleft, sound_file);
1032  } else if (!strcasecmp(sound_name, "sound_kicked")) {
1033  ast_string_field_set(sounds, kicked, sound_file);
1034  } else if (!strcasecmp(sound_name, "sound_muted")) {
1035  ast_string_field_set(sounds, muted, sound_file);
1036  } else if (!strcasecmp(sound_name, "sound_unmuted")) {
1037  ast_string_field_set(sounds, unmuted, sound_file);
1038  } else if (!strcasecmp(sound_name, "sound_binaural_on")) {
1039  ast_string_field_set(sounds, binauralon, sound_file);
1040  } else if (!strcasecmp(sound_name, "sound_binaural_off")) {
1041  ast_string_field_set(sounds, binauraloff, sound_file);
1042  } else if (!strcasecmp(sound_name, "sound_there_are")) {
1043  ast_string_field_set(sounds, thereare, sound_file);
1044  } else if (!strcasecmp(sound_name, "sound_other_in_party")) {
1045  ast_string_field_set(sounds, otherinparty, sound_file);
1046  } else if (!strcasecmp(sound_name, "sound_place_into_conference")) {
1047  static int deprecation_warning = 1;
1048  if (deprecation_warning) {
1049  ast_log(LOG_WARNING, "sound_place_into_conference is deprecated"
1050  " and unused. Use sound_begin for similar functionality.");
1051  deprecation_warning = 0;
1052  }
1053  ast_string_field_set(sounds, placeintoconf, sound_file);
1054  } else if (!strcasecmp(sound_name, "sound_wait_for_leader")) {
1055  ast_string_field_set(sounds, waitforleader, sound_file);
1056  } else if (!strcasecmp(sound_name, "sound_leader_has_left")) {
1057  ast_string_field_set(sounds, leaderhasleft, sound_file);
1058  } else if (!strcasecmp(sound_name, "sound_get_pin")) {
1059  ast_string_field_set(sounds, getpin, sound_file);
1060  } else if (!strcasecmp(sound_name, "sound_invalid_pin")) {
1061  ast_string_field_set(sounds, invalidpin, sound_file);
1062  } else if (!strcasecmp(sound_name, "sound_locked")) {
1063  ast_string_field_set(sounds, locked, sound_file);
1064  } else if (!strcasecmp(sound_name, "sound_unlocked_now")) {
1065  ast_string_field_set(sounds, unlockednow, sound_file);
1066  } else if (!strcasecmp(sound_name, "sound_locked_now")) {
1067  ast_string_field_set(sounds, lockednow, sound_file);
1068  } else if (!strcasecmp(sound_name, "sound_error_menu")) {
1069  ast_string_field_set(sounds, errormenu, sound_file);
1070  } else if (!strcasecmp(sound_name, "sound_join")) {
1071  ast_string_field_set(sounds, join, sound_file);
1072  } else if (!strcasecmp(sound_name, "sound_leave")) {
1073  ast_string_field_set(sounds, leave, sound_file);
1074  } else if (!strcasecmp(sound_name, "sound_participants_muted")) {
1075  ast_string_field_set(sounds, participantsmuted, sound_file);
1076  } else if (!strcasecmp(sound_name, "sound_participants_unmuted")) {
1077  ast_string_field_set(sounds, participantsunmuted, sound_file);
1078  } else if (!strcasecmp(sound_name, "sound_begin")) {
1079  ast_string_field_set(sounds, begin, sound_file);
1080  } else {
1081  return -1;
1082  }
1083 
1084  return 0;
1085 }
const ast_string_field unlockednow
Definition: confbridge.h:222
const ast_string_field thereare
Definition: confbridge.h:222
const ast_string_field join
Definition: confbridge.h:222
const ast_string_field otherinparty
Definition: confbridge.h:222
static unsigned char leave[]
Definition: leave.h:12
#define LOG_WARNING
Definition: logger.h:274
static int muted
Definition: muted.c:82
struct bridge_profile_sounds * sounds
Definition: confbridge.h:236
const ast_string_field onlyone
Definition: confbridge.h:222
const ast_string_field hasjoin
Definition: confbridge.h:222
#define ast_strlen_zero(foo)
Definition: strings.h:52
const ast_string_field begin
Definition: confbridge.h:222
#define ast_log
Definition: astobj2.c:42
const ast_string_field errormenu
Definition: confbridge.h:222
const ast_string_field binauraloff
Definition: confbridge.h:222
const ast_string_field waitforleader
Definition: confbridge.h:222
static struct stasis_rest_handlers sounds
REST handler for /api-docs/sounds.json.
const ast_string_field getpin
Definition: confbridge.h:222
const ast_string_field participantsmuted
Definition: confbridge.h:222
const ast_string_field lockednow
Definition: confbridge.h:222
const ast_string_field binauralon
Definition: confbridge.h:222
const ast_string_field participantsunmuted
Definition: confbridge.h:222
const ast_string_field unmuted
Definition: confbridge.h:222
const ast_string_field invalidpin
Definition: confbridge.h:222
const ast_string_field onlyperson
Definition: confbridge.h:222
const ast_string_field leaderhasleft
Definition: confbridge.h:222
const ast_string_field kicked
Definition: confbridge.h:222
const ast_string_field locked
Definition: confbridge.h:222
const ast_string_field placeintoconf
Definition: confbridge.h:222
const ast_string_field hasleft
Definition: confbridge.h:222
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:514

◆ sound_option_handler()

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

Definition at line 2324 of file conf_config_parser.c.

References ast_variable::name, set_sound(), and ast_variable::value.

Referenced by conf_load_config().

2325 {
2326  set_sound(var->name, var->value, obj);
2327  return 0;
2328 }
static int set_sound(const char *sound_name, const char *sound_file, struct bridge_profile *b_profile)

◆ user_cmp_cb()

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

User profile container functions

Definition at line 950 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

951 {
952  const struct user_profile *left = obj;
953  const struct user_profile *right = arg;
954  const char *right_name = arg;
955  int cmp;
956 
957  switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
958  default:
959  case OBJ_POINTER:
960  right_name = right->name;
961  /* Fall through */
962  case OBJ_KEY:
963  cmp = strcasecmp(left->name, right_name);
964  break;
965  case OBJ_PARTIAL_KEY:
966  cmp = strncasecmp(left->name, right_name, strlen(right_name));
967  break;
968  }
969  return cmp ? 0 : CMP_MATCH;
970 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define OBJ_POINTER
Definition: astobj2.h:1154
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1156
unsigned int flags
Definition: confbridge.h:157
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153

◆ user_hash_cb()

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

Definition at line 972 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

973 {
974  const struct user_profile *u_profile = obj;
975  const char *name = obj;
976  int hash;
977 
978  switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
979  default:
980  case OBJ_POINTER:
981  name = u_profile->name;
982  /* Fall through */
983  case OBJ_KEY:
984  hash = ast_str_case_hash(name);
985  break;
986  case OBJ_PARTIAL_KEY:
987  /* Should never happen in hash callback. */
988  ast_assert(0);
989  hash = 0;
990  break;
991  }
992  return hash;
993 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define OBJ_POINTER
Definition: astobj2.h:1154
#define ast_assert(a)
Definition: utils.h:695
#define OBJ_PARTIAL_KEY
Definition: astobj2.h:1156
unsigned int flags
Definition: confbridge.h:157
static const char name[]
Definition: cdr_mysql.c:74
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153
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:1250

◆ user_profile_alloc()

static void * user_profile_alloc ( const char *  category)
static

Definition at line 758 of file conf_config_parser.c.

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

Referenced by verify_default_profiles().

759 {
760  struct user_profile *u_profile;
761 
762  if (!(u_profile = ao2_alloc(sizeof(*u_profile), user_profile_destructor))) {
763  return NULL;
764  }
765 
766  ast_copy_string(u_profile->name, category, sizeof(u_profile->name));
767 
768  return u_profile;
769 }
#define NULL
Definition: resample.c:96
#define ao2_alloc(data_size, destructor_fn)
Definition: astobj2.h:411
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
char name[MAX_PROFILE_NAME]
Definition: confbridge.h:153
static void user_profile_destructor(void *obj)

◆ user_profile_destructor()

static void user_profile_destructor ( void *  obj)
static

Definition at line 753 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and user_profile_alloc().

754 {
755  return;
756 }

◆ user_profile_find()

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

Definition at line 771 of file conf_config_parser.c.

References ao2_find, and OBJ_KEY.

772 {
773  return ao2_find(container, category, OBJ_KEY);
774 }
#define OBJ_KEY
Definition: astobj2.h:1155
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756

◆ user_template_handler()

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

Definition at line 2206 of file conf_config_parser.c.

References conf_find_user_profile(), NULL, and ast_variable::value.

Referenced by conf_load_config().

2207 {
2208  struct user_profile *u_profile = obj;
2209 
2210  return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
2211 }
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&#39;s name and store that profile in result structure.
#define NULL
Definition: resample.c:96

◆ verify_default_profiles()

static int verify_default_profiles ( void  )
static

Definition at line 2336 of file conf_config_parser.c.

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, DEFAULT_BRIDGE_PROFILE, DEFAULT_MENU_PROFILE, DEFAULT_USER_PROFILE, menu_alloc(), confbridge_cfg::menus, NULL, OBJ_KEY, RAII_VAR, user_profile_alloc(), and confbridge_cfg::user_profiles.

2337 {
2340  RAII_VAR(struct conf_menu *, menu_profile, NULL, ao2_cleanup);
2341  /* We can only be called as a result of an aco_process_config so this is safe */
2342  struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
2343 
2344  if (!cfg) {
2345  return 0;
2346  }
2347 
2349  if (!bridge_profile) {
2351  if (!bridge_profile) {
2352  return -1;
2353  }
2354  ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_BRIDGE_PROFILE);
2357  }
2358 
2360  if (!user_profile) {
2362  if (!user_profile) {
2363  return -1;
2364  }
2365  ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_USER_PROFILE);
2368  }
2369 
2370  menu_profile = ao2_find(cfg->menus, DEFAULT_MENU_PROFILE, OBJ_KEY);
2371  if (!menu_profile) {
2372  menu_profile = menu_alloc(DEFAULT_MENU_PROFILE);
2373  if (!menu_profile) {
2374  return -1;
2375  }
2376  ast_log(AST_LOG_NOTICE, "Adding %s menu to app_confbridge\n", DEFAULT_MENU_PROFILE);
2378  ao2_link(cfg->menus, menu_profile);
2379  }
2380 
2381  return 0;
2382 }
static struct aco_type user_type
#define OBJ_KEY
Definition: astobj2.h:1155
struct ao2_container * bridge_profiles
static struct aco_type bridge_type
#define NULL
Definition: resample.c:96
#define AST_LOG_NOTICE
Definition: logger.h:268
struct ao2_container * menus
#define ast_log
Definition: astobj2.c:42
static struct aco_type menu_type
static void * bridge_profile_alloc(const char *category)
void * aco_pending_config(struct aco_info *info)
Get pending config changes.
#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:911
static void * user_profile_alloc(const char *category)
struct ao2_container * user_profiles
static void * menu_alloc(const char *category)
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1756
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define DEFAULT_MENU_PROFILE
Definition: confbridge.h:43
#define DEFAULT_BRIDGE_PROFILE
Definition: confbridge.h:42
#define DEFAULT_USER_PROFILE
Definition: confbridge.h:41
#define ao2_link(container, obj)
Definition: astobj2.h:1549

◆ video_mode_handler()

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

Definition at line 2122 of file conf_config_parser.c.

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, ast_variable::name, and ast_variable::value.

Referenced by conf_load_config().

2123 {
2124  struct bridge_profile *b_profile = obj;
2125 
2126  if (strcasecmp(var->name, "video_mode")) {
2127  return -1;
2128  }
2129  if (!strcasecmp(var->value, "first_marked")) {
2130  ast_set_flags_to(b_profile,
2136  } else if (!strcasecmp(var->value, "last_marked")) {
2137  ast_set_flags_to(b_profile,
2143  } else if (!strcasecmp(var->value, "follow_talker")) {
2144  ast_set_flags_to(b_profile,
2150  } else if (!strcasecmp(var->value, "sfu")) {
2151  ast_set_flags_to(b_profile,
2157  } else if (!strcasecmp(var->value, "none")) {
2158  ast_clear_flag(b_profile,
2163  } else {
2164  return -1;
2165  }
2166  return 0;
2167 }
#define ast_set_flags_to(p, flag, value)
Definition: utils.h:104
#define ast_clear_flag(p, flag)
Definition: utils.h:77

Variable Documentation

◆ bridge_type

struct aco_type bridge_type
static

Definition at line 739 of file conf_config_parser.c.

◆ bridge_types

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

Definition at line 820 of file conf_config_parser.c.

◆ cli_confbridge_parser

struct ast_cli_entry cli_confbridge_parser[]
static

Definition at line 2032 of file conf_config_parser.c.

◆ confbridge_conf

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

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

◆ general_type

struct aco_type general_type
static

Definition at line 825 of file conf_config_parser.c.

◆ menu_type

struct aco_type menu_type
static

Definition at line 807 of file conf_config_parser.c.

◆ menu_types

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

Definition at line 821 of file conf_config_parser.c.

◆ user_type

struct aco_type user_type
static

Definition at line 776 of file conf_config_parser.c.

◆ user_types

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

Definition at line 822 of file conf_config_parser.c.