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_sounds
bridge_profile_sounds_alloc (void)
static void bridge_profile_sounds_destroy_cb (void *obj)
static int bridge_template_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
static char * complete_bridge_profile_name (const char *line, const char *word, int pos, int state)
static char * complete_menu_name (const char *line, const char *word, int pos, int state)
static char * complete_user_profile_name (const char *line, const char *word, int pos, int state)
void conf_bridge_profile_copy (struct bridge_profile *dst, struct bridge_profile *src)
 copies a bridge profile
void conf_bridge_profile_destroy (struct bridge_profile *b_profile)
 Destroy a bridge profile found by 'conf_find_bridge_profile'.
void conf_destroy_config (void)
 destroy the information loaded from the confbridge.conf file
struct bridge_profileconf_find_bridge_profile (struct ast_channel *chan, const char *bridge_profile_name, struct bridge_profile *result)
 Find a bridge profile given a bridge profile's name and store that profile in result structure.
int conf_find_menu_entry_by_sequence (const char *dtmf_sequence, struct conf_menu *menu, struct conf_menu_entry *result)
 Finds a menu_entry in a menu structure matched by DTMF sequence.
struct user_profileconf_find_user_profile (struct ast_channel *chan, const char *user_profile_name, struct user_profile *result)
 find a user profile given a user profile's name and store that profile in result structure.
int conf_load_config (void)
 load confbridge.conf file
void conf_menu_entry_destroy (struct conf_menu_entry *menu_entry)
 Destroys and frees all the actions stored in a menu_entry structure.
static int conf_menu_profile_copy (struct conf_menu *dst, struct conf_menu *src)
int conf_reload_config (void)
 reload confbridge.conf file
int conf_set_menu_to_user (struct ast_channel *chan, struct confbridge_user *user, const char *menu_profile_name)
 find a menu profile given a menu profile's name and apply the menu in DTMF hooks.
static void conf_user_profile_copy (struct user_profile *dst, struct user_profile *src)
static void * confbridge_cfg_alloc (void)
static void confbridge_cfg_destructor (void *obj)
 CONFIG_INFO_STANDARD (cfg_info, cfg_handle, confbridge_cfg_alloc,.files=ACO_FILES(&confbridge_conf),.pre_apply_config=verify_default_profiles,)
static int copy_menu_entry (struct conf_menu_entry *dst, struct conf_menu_entry *src)
static void func_confbridge_data_destructor (struct func_confbridge_data *b_data)
static void func_confbridge_destroy_cb (void *data)
int func_confbridge_helper (struct ast_channel *chan, const char *cmd, char *data, const char *value)
static char * handle_cli_confbridge_show_bridge_profile (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_confbridge_show_bridge_profiles (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_confbridge_show_menu (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_confbridge_show_menus (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_confbridge_show_user_profile (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_confbridge_show_user_profiles (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void * menu_alloc (const char *category)
static int menu_cmp_cb (void *obj, void *arg, int flags)
static void menu_destructor (void *obj)
static void * menu_find (struct ao2_container *container, const char *category)
static int menu_hash_cb (const void *obj, const int flags)
static int menu_hook_callback (struct ast_bridge_channel *bridge_channel, void *hook_pvt)
static void menu_hook_destroy (void *hook_pvt)
static int menu_option_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
static int menu_template_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
static int mix_interval_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
static int 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 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 <dvossel@digium.com>

Definition in file conf_config_parser.c.


Function Documentation

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

References conf_menu_action::action, 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, 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_MUTE, conf_menu_action::playback_file, and conf_menu_action::priority.

Referenced by add_menu_entry().

01082 {
01083    struct conf_menu_action *menu_action = ast_calloc(1, sizeof(*menu_action));
01084 
01085    if (!menu_action) {
01086       return -1;
01087    }
01088    menu_action->id = id;
01089 
01090    switch (id) {
01091    case MENU_ACTION_NOOP:
01092    case MENU_ACTION_TOGGLE_MUTE:
01093    case MENU_ACTION_INCREASE_LISTENING:
01094    case MENU_ACTION_DECREASE_LISTENING:
01095    case MENU_ACTION_INCREASE_TALKING:
01096    case MENU_ACTION_DECREASE_TALKING:
01097    case MENU_ACTION_RESET_LISTENING:
01098    case MENU_ACTION_RESET_TALKING:
01099    case MENU_ACTION_ADMIN_TOGGLE_LOCK:
01100    case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
01101    case MENU_ACTION_PARTICIPANT_COUNT:
01102    case MENU_ACTION_ADMIN_KICK_LAST:
01103    case MENU_ACTION_LEAVE:
01104    case MENU_ACTION_SET_SINGLE_VIDEO_SRC:
01105    case MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC:
01106       break;
01107    case MENU_ACTION_PLAYBACK:
01108    case MENU_ACTION_PLAYBACK_AND_CONTINUE:
01109       if (!(ast_strlen_zero(databuf))) {
01110          ast_copy_string(menu_action->data.playback_file, databuf, sizeof(menu_action->data.playback_file));
01111       } else {
01112          ast_free(menu_action);
01113          return -1;
01114       }
01115       break;
01116    case MENU_ACTION_DIALPLAN_EXEC:
01117       if (!(ast_strlen_zero(databuf))) {
01118          AST_DECLARE_APP_ARGS(args,
01119             AST_APP_ARG(context);
01120             AST_APP_ARG(exten);
01121             AST_APP_ARG(priority);
01122          );
01123          AST_STANDARD_APP_ARGS(args, databuf);
01124          if (!ast_strlen_zero(args.context)) {
01125             ast_copy_string(menu_action->data.dialplan_args.context,
01126                args.context,
01127                sizeof(menu_action->data.dialplan_args.context));
01128          }
01129          if (!ast_strlen_zero(args.exten)) {
01130             ast_copy_string(menu_action->data.dialplan_args.exten,
01131                args.exten,
01132                sizeof(menu_action->data.dialplan_args.exten));
01133          }
01134          menu_action->data.dialplan_args.priority = 1; /* 1 by default */
01135          if (!ast_strlen_zero(args.priority) &&
01136             (sscanf(args.priority, "%30d", &menu_action->data.dialplan_args.priority) != 1)) {
01137             /* invalid priority */
01138             ast_free(menu_action);
01139             return -1;
01140          }
01141       } else {
01142          ast_free(menu_action);
01143          return -1;
01144       }
01145    };
01146 
01147    AST_LIST_INSERT_TAIL(&menu_entry->actions, menu_action, action);
01148 
01149    return 0;
01150 }

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

Definition at line 1152 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_MUTE, NULL, strsep(), and tmp().

Referenced by menu_option_handler().

01153 {
01154    struct conf_menu_entry *menu_entry = NULL, *cur = NULL;
01155    int res = 0;
01156    char *tmp_action_names = ast_strdupa(action_names);
01157    char *action = NULL;
01158    char *action_args;
01159    char *tmp;
01160    char buf[PATH_MAX];
01161    char *delimiter = ",";
01162 
01163    if (!(menu_entry = ast_calloc(1, sizeof(*menu_entry)))) {
01164       return -1;
01165    }
01166 
01167    for (;;) {
01168       char *comma;
01169       char *startbrace;
01170       char *endbrace;
01171       unsigned int action_len;
01172 
01173       if (ast_strlen_zero(tmp_action_names)) {
01174          break;
01175       }
01176       startbrace = strchr(tmp_action_names, '(');
01177       endbrace = strchr(tmp_action_names, ')');
01178       comma = strchr(tmp_action_names, ',');
01179 
01180       /* If the next action has brackets with comma delimited arguments in it,
01181        * make the delimeter ')' instead of a comma to preserve the argments */
01182       if (startbrace && endbrace && comma && (comma > startbrace && comma < endbrace)) {
01183          delimiter = ")";
01184       } else {
01185          delimiter = ",";
01186       }
01187 
01188       if (!(action = strsep(&tmp_action_names, delimiter))) {
01189          break;
01190       }
01191 
01192       action = ast_strip(action);
01193       if (ast_strlen_zero(action)) {
01194          continue;
01195       }
01196 
01197       action_len = strlen(action);
01198       ast_copy_string(menu_entry->dtmf, dtmf, sizeof(menu_entry->dtmf));
01199       if (!strcasecmp(action, "toggle_mute")) {
01200          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_TOGGLE_MUTE, NULL);
01201       } else if (!strcasecmp(action, "no_op")) {
01202          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_NOOP, NULL);
01203       } else if (!strcasecmp(action, "increase_listening_volume")) {
01204          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_INCREASE_LISTENING, NULL);
01205       } else if (!strcasecmp(action, "decrease_listening_volume")) {
01206          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DECREASE_LISTENING, NULL);
01207       } else if (!strcasecmp(action, "increase_talking_volume")) {
01208          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_INCREASE_TALKING, NULL);
01209       } else if (!strcasecmp(action, "reset_listening_volume")) {
01210          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_RESET_LISTENING, NULL);
01211       } else if (!strcasecmp(action, "reset_talking_volume")) {
01212          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_RESET_TALKING, NULL);
01213       } else if (!strcasecmp(action, "decrease_talking_volume")) {
01214          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DECREASE_TALKING, NULL);
01215       } else if (!strcasecmp(action, "admin_toggle_conference_lock")) {
01216          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_TOGGLE_LOCK, NULL);
01217       } else if (!strcasecmp(action, "admin_toggle_mute_participants")) {
01218          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS, NULL);
01219       } else if (!strcasecmp(action, "participant_count")) {
01220          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PARTICIPANT_COUNT, NULL);
01221       } else if (!strcasecmp(action, "admin_kick_last")) {
01222          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_ADMIN_KICK_LAST, NULL);
01223       } else if (!strcasecmp(action, "leave_conference")) {
01224          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_LEAVE, NULL);
01225       } else if (!strcasecmp(action, "set_as_single_video_src")) {
01226          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_SET_SINGLE_VIDEO_SRC, NULL);
01227       } else if (!strcasecmp(action, "release_as_single_video_src")) {
01228          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC, NULL);
01229       } else if (!strncasecmp(action, "dialplan_exec(", 14)) {
01230          ast_copy_string(buf, action, sizeof(buf));
01231          action_args = buf;
01232          if ((action_args = strchr(action, '('))) {
01233             action_args++;
01234          }
01235          /* it is possible that this argument may or may not
01236           * have a closing brace at this point, it all depends on if
01237           * comma delimited arguments were provided */
01238          if ((tmp = strchr(action, ')'))) {
01239             *tmp = '\0';
01240          }
01241          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_DIALPLAN_EXEC, action_args);
01242       } else if (action_len >= 21 && !strncasecmp(action, "playback_and_continue(", 22)) {
01243          ast_copy_string(buf, action, sizeof(buf));
01244          action_args = buf;
01245          if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
01246             *tmp = '\0';
01247             action_args++;
01248          }
01249          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK_AND_CONTINUE, action_args);
01250       } else if (action_len >= 8 && !strncasecmp(action, "playback(", 9)) {
01251          ast_copy_string(buf, action, sizeof(buf));
01252          action_args = buf;
01253          if ((action_args = strchr(action, '(')) && (tmp = strrchr(action_args, ')'))) {
01254             *tmp = '\0';
01255             action_args++;
01256          }
01257          res |= add_action_to_menu_entry(menu_entry, MENU_ACTION_PLAYBACK, action_args);
01258       }
01259    }
01260 
01261    /* if adding any of the actions failed, bail */
01262    if (res) {
01263       struct conf_menu_action *menu_action;
01264       while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
01265          ast_free(menu_action);
01266       }
01267       ast_free(menu_entry);
01268       return -1;
01269    }
01270 
01271    /* remove any list entry with an identical DTMF sequence for overrides */
01272    AST_LIST_TRAVERSE_SAFE_BEGIN(&menu->entries, cur, entry) {
01273       if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) {
01274          AST_LIST_REMOVE_CURRENT(entry);
01275          ast_free(cur);
01276          break;
01277       }
01278    }
01279    AST_LIST_TRAVERSE_SAFE_END;
01280 
01281    AST_LIST_INSERT_TAIL(&menu->entries, menu_entry, entry);
01282 
01283    return 0;
01284 }

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

Definition at line 1834 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().

01835 {
01836    struct user_profile *u_profile = obj;
01837 
01838    if (strcasecmp(var->name, "announce_user_count_all")) {
01839       return -1;
01840    }
01841    if (ast_true(var->value)) {
01842       u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
01843    } else if (ast_false(var->value)) {
01844       u_profile->flags = u_profile->flags & ~USER_OPT_ANNOUNCEUSERCOUNTALL;
01845    } else if (sscanf(var->value, "%30u", &u_profile->announce_user_count_all_after) == 1) {
01846       u_profile->flags = u_profile->flags | USER_OPT_ANNOUNCEUSERCOUNTALL;
01847    } else {
01848       return -1;
01849    }
01850    return 0;
01851 }

static AO2_GLOBAL_OBJ_STATIC ( cfg_handle   )  [static]

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

Definition at line 2315 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, and dtmf_menu_hook_pvt::user.

Referenced by conf_set_menu_to_user().

02316 {
02317    struct conf_menu_entry *menu_entry;
02318 
02319    SCOPED_AO2LOCK(menu_lock, menu);
02320    AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
02321       struct dtmf_menu_hook_pvt *pvt;
02322 
02323       if (!(pvt = ast_calloc(1, sizeof(*pvt)))) {
02324          return -1;
02325       }
02326       pvt->user = user;
02327       pvt->menu = ao2_bump(menu);
02328 
02329       if (copy_menu_entry(&pvt->menu_entry, menu_entry)) {
02330          menu_hook_destroy(pvt);
02331          return -1;
02332       }
02333 
02334       if (ast_bridge_dtmf_hook(&user->features, pvt->menu_entry.dtmf,
02335          menu_hook_callback, pvt, menu_hook_destroy, 0)) {
02336          menu_hook_destroy(pvt);
02337       }
02338    }
02339    strcpy(user->menu_name, menu->name); /* Safe */
02340 
02341    return 0;
02342 }

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

bridge profile container functions

Definition at line 703 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().

00704 {
00705    const struct bridge_profile *left = obj;
00706    const struct bridge_profile *right = arg;
00707    const char *right_name = arg;
00708    int cmp;
00709 
00710    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
00711    default:
00712    case OBJ_POINTER:
00713       right_name = right->name;
00714       /* Fall through */
00715    case OBJ_KEY:
00716       cmp = strcasecmp(left->name, right_name);
00717       break;
00718    case OBJ_PARTIAL_KEY:
00719       cmp = strncasecmp(left->name, right_name, strlen(right_name));
00720       break;
00721    }
00722    return cmp ? 0 : CMP_MATCH;
00723 }

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

Definition at line 725 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

00726 {
00727    const struct bridge_profile *b_profile = obj;
00728    const char *name = obj;
00729    int hash;
00730 
00731    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
00732    default:
00733    case OBJ_POINTER:
00734       name = b_profile->name;
00735       /* Fall through */
00736    case OBJ_KEY:
00737       hash = ast_str_case_hash(name);
00738       break;
00739    case OBJ_PARTIAL_KEY:
00740       /* Should never happen in hash callback. */
00741       ast_assert(0);
00742       hash = 0;
00743       break;
00744    }
00745    return hash;
00746 }

static void * bridge_profile_alloc ( const char *  category  )  [static]

Definition at line 572 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().

00573 {
00574    struct bridge_profile *b_profile;
00575 
00576    if (!(b_profile = ao2_alloc(sizeof(*b_profile), bridge_profile_destructor))) {
00577       return NULL;
00578    }
00579 
00580    if (!(b_profile->sounds = bridge_profile_sounds_alloc())) {
00581       ao2_ref(b_profile, -1);
00582       return NULL;
00583    }
00584 
00585    ast_copy_string(b_profile->name, category, sizeof(b_profile->name));
00586 
00587    return b_profile;
00588 }

static void bridge_profile_destructor ( void *  obj  )  [static]

Definition at line 566 of file conf_config_parser.c.

References ao2_cleanup, and bridge_profile::sounds.

Referenced by bridge_profile_alloc().

00567 {
00568    struct bridge_profile *b_profile = obj;
00569    ao2_cleanup(b_profile->sounds);
00570 }

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

Definition at line 590 of file conf_config_parser.c.

References ao2_find, and OBJ_KEY.

00591 {
00592    return ao2_find(container, category, OBJ_KEY);
00593 }

static struct bridge_profile_sounds * bridge_profile_sounds_alloc ( void   )  [static, read]

Definition at line 858 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().

00859 {
00860    struct bridge_profile_sounds *sounds = ao2_alloc(sizeof(*sounds), bridge_profile_sounds_destroy_cb);
00861 
00862    if (!sounds) {
00863       return NULL;
00864    }
00865    if (ast_string_field_init(sounds, 512)) {
00866       ao2_ref(sounds, -1);
00867       return NULL;
00868    }
00869 
00870    return sounds;
00871 }

static void bridge_profile_sounds_destroy_cb ( void *  obj  )  [static]

Bridge Profile Sounds functions

Definition at line 852 of file conf_config_parser.c.

References ast_string_field_free_memory, and sounds.

Referenced by bridge_profile_sounds_alloc().

00853 {
00854    struct bridge_profile_sounds *sounds = obj;
00855    ast_string_field_free_memory(sounds);
00856 }

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

Definition at line 1917 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, bridge_profile_sounds::leave, leave, bridge_profile_sounds::locked, bridge_profile_sounds::lockednow, bridge_profile_sounds::muted, muted, NULL, bridge_profile_sounds::onlyone, bridge_profile_sounds::onlyperson, bridge_profile_sounds::otherinparty, bridge_profile_sounds::participantsmuted, bridge_profile_sounds::participantsunmuted, bridge_profile_sounds::placeintoconf, bridge_profile::sounds, sounds, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, ast_variable::value, and bridge_profile_sounds::waitforleader.

Referenced by conf_load_config().

01918 {
01919    struct bridge_profile *b_profile = obj;
01920    struct bridge_profile_sounds *sounds = bridge_profile_sounds_alloc();
01921    struct bridge_profile_sounds *oldsounds = b_profile->sounds;
01922 
01923    if (!sounds) {
01924       return -1;
01925    }
01926    if (!(conf_find_bridge_profile(NULL, var->value, b_profile))) {
01927       ao2_ref(sounds, -1);
01928       return -1;
01929    }
01930    /* Using a bridge profile as a template is a little complicated due to the sounds. Since the sounds
01931     * structure of a dynamic profile will need to be altered, a completely new sounds structure must be
01932     * created instead of simply holding a reference to the one built by the config file. */
01933    ast_string_field_set(sounds, onlyperson, b_profile->sounds->onlyperson);
01934    ast_string_field_set(sounds, onlyone, b_profile->sounds->onlyone);
01935    ast_string_field_set(sounds, hasjoin, b_profile->sounds->hasjoin);
01936    ast_string_field_set(sounds, hasleft, b_profile->sounds->hasleft);
01937    ast_string_field_set(sounds, kicked, b_profile->sounds->kicked);
01938    ast_string_field_set(sounds, muted, b_profile->sounds->muted);
01939    ast_string_field_set(sounds, unmuted, b_profile->sounds->unmuted);
01940    ast_string_field_set(sounds, thereare, b_profile->sounds->thereare);
01941    ast_string_field_set(sounds, otherinparty, b_profile->sounds->otherinparty);
01942    ast_string_field_set(sounds, placeintoconf, b_profile->sounds->placeintoconf);
01943    ast_string_field_set(sounds, waitforleader, b_profile->sounds->waitforleader);
01944    ast_string_field_set(sounds, leaderhasleft, b_profile->sounds->leaderhasleft);
01945    ast_string_field_set(sounds, getpin, b_profile->sounds->getpin);
01946    ast_string_field_set(sounds, invalidpin, b_profile->sounds->invalidpin);
01947    ast_string_field_set(sounds, locked, b_profile->sounds->locked);
01948    ast_string_field_set(sounds, unlockednow, b_profile->sounds->unlockednow);
01949    ast_string_field_set(sounds, lockednow, b_profile->sounds->lockednow);
01950    ast_string_field_set(sounds, errormenu, b_profile->sounds->errormenu);
01951    ast_string_field_set(sounds, join, b_profile->sounds->join);
01952    ast_string_field_set(sounds, leave, b_profile->sounds->leave);
01953    ast_string_field_set(sounds, participantsmuted, b_profile->sounds->participantsmuted);
01954    ast_string_field_set(sounds, participantsunmuted, b_profile->sounds->participantsunmuted);
01955    ast_string_field_set(sounds, begin, b_profile->sounds->begin);
01956 
01957    ao2_ref(b_profile->sounds, -1); /* sounds struct copied over to it from the template by reference only. */
01958    ao2_ref(oldsounds, -1);    /* original sounds struct we don't need anymore */
01959    b_profile->sounds = sounds;     /* the new sounds struct that is a deep copy of the one from the template. */
01960 
01961    return 0;
01962 }

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

Definition at line 1437 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().

01438 {
01439    int which = 0;
01440    char *res = NULL;
01441    int wordlen = strlen(word);
01442    struct ao2_iterator i;
01443    struct bridge_profile *b_profile = NULL;
01444    RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup);
01445 
01446    if (!cfg) {
01447       return NULL;
01448    }
01449 
01450    i = ao2_iterator_init(cfg->bridge_profiles, 0);
01451    while ((b_profile = ao2_iterator_next(&i))) {
01452       if (!strncasecmp(b_profile->name, word, wordlen) && ++which > state) {
01453          res = ast_strdup(b_profile->name);
01454          ao2_ref(b_profile, -1);
01455          break;
01456       }
01457       ao2_ref(b_profile, -1);
01458    }
01459    ao2_iterator_destroy(&i);
01460 
01461    return res;
01462 }

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

Definition at line 1619 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().

01620 {
01621    int which = 0;
01622    char *res = NULL;
01623    int wordlen = strlen(word);
01624    struct ao2_iterator i;
01625    struct conf_menu *menu = NULL;
01626    RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup);
01627 
01628    if (!cfg) {
01629       return NULL;
01630    }
01631 
01632    i = ao2_iterator_init(cfg->menus, 0);
01633    while ((menu = ao2_iterator_next(&i))) {
01634       if (!strncasecmp(menu->name, word, wordlen) && ++which > state) {
01635          res = ast_strdup(menu->name);
01636          ao2_ref(menu, -1);
01637          break;
01638       }
01639       ao2_ref(menu, -1);
01640    }
01641    ao2_iterator_destroy(&i);
01642 
01643    return res;
01644 }

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

Definition at line 1286 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().

01287 {
01288    int which = 0;
01289    char *res = NULL;
01290    int wordlen = strlen(word);
01291    struct ao2_iterator i;
01292    struct user_profile *u_profile = NULL;
01293    RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup);
01294 
01295    if (!cfg) {
01296       return NULL;
01297    }
01298 
01299    i = ao2_iterator_init(cfg->user_profiles, 0);
01300    while ((u_profile = ao2_iterator_next(&i))) {
01301       if (!strncasecmp(u_profile->name, word, wordlen) && ++which > state) {
01302          res = ast_strdup(u_profile->name);
01303          ao2_ref(u_profile, -1);
01304          break;
01305       }
01306       ao2_ref(u_profile, -1);
01307    }
01308    ao2_iterator_destroy(&i);
01309 
01310    return res;
01311 }

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

References ao2_ref, and bridge_profile::sounds.

Referenced by conf_find_bridge_profile(), and join_conference_bridge().

02212 {
02213    *dst = *src;
02214    if (src->sounds) {
02215       ao2_ref(src->sounds, +1);
02216    }
02217 }

void conf_bridge_profile_destroy ( struct bridge_profile b_profile  ) 

Destroy a bridge profile found by 'conf_find_bridge_profile'.

Definition at line 2219 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().

02220 {
02221    if (b_profile->sounds) {
02222       ao2_ref(b_profile->sounds, -1);
02223       b_profile->sounds = NULL;
02224    }
02225 }

void conf_destroy_config ( void   ) 

destroy the information loaded from the confbridge.conf file

Definition at line 2382 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().

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

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

Parameters:
chan channel the bridge profile is requested for
bridge_profile_name name of the profile requested (optional)
result data 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:
bridge profile on success
NULL on failure

Definition at line 2227 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, and RAII_VAR.

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

02228 {
02229    struct bridge_profile *tmp2;
02230    struct ast_datastore *datastore = NULL;
02231    struct func_confbridge_data *b_data = NULL;
02232    RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup);
02233 
02234    if (chan && ast_strlen_zero(bridge_profile_name)) {
02235       ast_channel_lock(chan);
02236       datastore = ast_channel_datastore_find(chan, &confbridge_datastore, NULL);
02237       ast_channel_unlock(chan);
02238       if (datastore) {
02239          b_data = datastore->data;
02240          if (b_data->b_usable) {
02241             conf_bridge_profile_copy(result, &b_data->b_profile);
02242             return result;
02243          }
02244       }
02245    }
02246 
02247    if (!cfg) {
02248       return NULL;
02249    }
02250    if (ast_strlen_zero(bridge_profile_name)) {
02251       bridge_profile_name = DEFAULT_BRIDGE_PROFILE;
02252    }
02253    if (!(tmp2 = ao2_find(cfg->bridge_profiles, bridge_profile_name, OBJ_KEY))) {
02254       return NULL;
02255    }
02256    ao2_lock(tmp2);
02257    conf_bridge_profile_copy(result, tmp2);
02258    ao2_unlock(tmp2);
02259    ao2_ref(tmp2, -1);
02260 
02261    return result;
02262 }

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:
1 success, entry is found and stored in result
0 failure, no entry found for given DTMF sequence

Definition at line 2298 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().

02299 {
02300    struct conf_menu_entry *menu_entry = NULL;
02301 
02302    ao2_lock(menu);
02303    AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
02304       if (!strcasecmp(menu_entry->dtmf, dtmf_sequence)) {
02305          copy_menu_entry(result, menu_entry);
02306          ao2_unlock(menu);
02307          return 1;
02308       }
02309    }
02310    ao2_unlock(menu);
02311 
02312    return 0;
02313 }

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

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

Parameters:
chan channel the user profile is requested for
user_profile_name name of the profile requested (optional)
result data 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:
user profile on success
NULL on failure

Definition at line 2174 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, func_confbridge_data::u_profile, and func_confbridge_data::u_usable.

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

02175 {
02176    struct user_profile *tmp2;
02177    struct ast_datastore *datastore = NULL;
02178    struct func_confbridge_data *b_data = NULL;
02179    RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup);
02180 
02181    if (chan && ast_strlen_zero(user_profile_name)) {
02182       ast_channel_lock(chan);
02183       datastore = ast_channel_datastore_find(chan, &confbridge_datastore, NULL);
02184       ast_channel_unlock(chan);
02185       if (datastore) {
02186          b_data = datastore->data;
02187          if (b_data->u_usable) {
02188             conf_user_profile_copy(result, &b_data->u_profile);
02189             return result;
02190          }
02191       }
02192    }
02193 
02194    if (!cfg) {
02195       return NULL;
02196    }
02197    if (ast_strlen_zero(user_profile_name)) {
02198       user_profile_name = DEFAULT_USER_PROFILE;
02199    }
02200    if (!(tmp2 = ao2_find(cfg->user_profiles, user_profile_name, OBJ_KEY))) {
02201       return NULL;
02202    }
02203    ao2_lock(tmp2);
02204    conf_user_profile_copy(result, tmp2);
02205    ao2_unlock(tmp2);
02206    ao2_ref(tmp2, -1);
02207 
02208    return result;
02209 }

int conf_load_config ( void   ) 

load confbridge.conf file

Definition at line 2087 of file conf_config_parser.c.

References __stringify, ACO_EXACT, aco_info_init(), aco_option_register, aco_option_register_custom, aco_process_config(), ACO_PROCESS_ERROR, ACO_REGEX, announce_user_count_all_handler(), ARRAY_LEN, ast_cli_register_multiple(), 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, sound_option_handler(), USER_OPT_ADMIN, USER_OPT_ANNOUNCE_JOIN_LEAVE, USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW, USER_OPT_ANNOUNCEUSERCOUNT, USER_OPT_DENOISE, USER_OPT_DROP_SILENCE, USER_OPT_DTMF_PASS, USER_OPT_ENDMARKED, USER_OPT_JITTERBUFFER, USER_OPT_MARKEDUSER, USER_OPT_MUSICONHOLD, USER_OPT_NOONLYPERSON, USER_OPT_QUIET, USER_OPT_STARTMUTED, USER_OPT_TALKER_DETECT, USER_OPT_WAITMARKED, user_template_handler(), and video_mode_handler().

Referenced by load_module().

02088 {
02089    if (aco_info_init(&cfg_info)) {
02090       return -1;
02091    }
02092 
02093    /* User options */
02094    aco_option_register(&cfg_info, "type", ACO_EXACT, user_types, NULL, OPT_NOOP_T, 0, 0);
02095    aco_option_register(&cfg_info, "admin", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ADMIN);
02096    aco_option_register(&cfg_info, "marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_MARKEDUSER);
02097    aco_option_register(&cfg_info, "startmuted", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_STARTMUTED);
02098    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);
02099    aco_option_register(&cfg_info, "quiet", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_QUIET);
02100    aco_option_register_custom(&cfg_info, "announce_user_count_all", ACO_EXACT, user_types, "no", announce_user_count_all_handler, 0);
02101    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);
02102    /* Negative logic. Defaults to "yes" and evaluates with ast_false(). If !ast_false(), USER_OPT_NOONLYPERSON is cleared */
02103    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);
02104    aco_option_register(&cfg_info, "wait_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_WAITMARKED);
02105    aco_option_register(&cfg_info, "end_marked", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_ENDMARKED);
02106    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);
02107    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);
02108    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);
02109    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);
02110    aco_option_register(&cfg_info, "pin", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, pin));
02111    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));
02112    aco_option_register(&cfg_info, "announcement", ACO_EXACT, user_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct user_profile, announcement));
02113    aco_option_register(&cfg_info, "denoise", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_DENOISE);
02114    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);
02115    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));
02116    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));
02117    aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, user_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct user_profile, flags), USER_OPT_JITTERBUFFER);
02118    /* This option should only be used with the CONFBRIDGE dialplan function */
02119    aco_option_register_custom(&cfg_info, "template", ACO_EXACT, user_types, NULL, user_template_handler, 0);
02120 
02121 /* XXX ASTERISK-21271 need a user supplied bridge merge_priority to merge ConfBridges (default = 1, range 1-INT_MAX) */
02122    /* Bridge options */
02123    aco_option_register(&cfg_info, "type", ACO_EXACT, bridge_types, NULL, OPT_NOOP_T, 0, 0);
02124    aco_option_register(&cfg_info, "jitterbuffer", ACO_EXACT, bridge_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct bridge_profile, flags), USER_OPT_JITTERBUFFER);
02125    /* "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 */
02126    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);
02127    aco_option_register_custom(&cfg_info, "mixing_interval", ACO_EXACT, bridge_types, "20", mix_interval_handler, 0);
02128    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);
02129    aco_option_register_custom(&cfg_info, "video_mode", ACO_EXACT, bridge_types, NULL, video_mode_handler, 0);
02130    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);
02131    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);
02132    aco_option_register(&cfg_info, "max_members", ACO_EXACT, bridge_types, "0", OPT_UINT_T, 0, FLDSET(struct bridge_profile, max_members));
02133    aco_option_register(&cfg_info, "record_file", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_file));
02134    aco_option_register(&cfg_info, "record_options", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_options));
02135    aco_option_register(&cfg_info, "record_command", ACO_EXACT, bridge_types, NULL, OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, rec_command));
02136    aco_option_register(&cfg_info, "language", ACO_EXACT, bridge_types, "en", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct bridge_profile, language));
02137    aco_option_register_custom(&cfg_info, "^sound_", ACO_REGEX, bridge_types, NULL, sound_option_handler, 0);
02138    /* This option should only be used with the CONFBRIDGE dialplan function */
02139    aco_option_register_custom(&cfg_info, "template", ACO_EXACT, bridge_types, NULL, bridge_template_handler, 0);
02140 
02141    /* Menu options */
02142    aco_option_register(&cfg_info, "type", ACO_EXACT, menu_types, NULL, OPT_NOOP_T, 0, 0);
02143    aco_option_register_custom(&cfg_info, "template", ACO_EXACT, menu_types, NULL, menu_template_handler, 0);
02144    aco_option_register_custom(&cfg_info, "^[0-9A-D*#]+$", ACO_REGEX, menu_types, NULL, menu_option_handler, 0);
02145 
02146    if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
02147       goto error;
02148    }
02149 
02150    if (ast_cli_register_multiple(cli_confbridge_parser, ARRAY_LEN(cli_confbridge_parser))) {
02151       goto error;
02152    }
02153 
02154    return 0;
02155 error:
02156    conf_destroy_config();
02157    return -1;
02158 }

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

References conf_menu_action::action, 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().

02291 {
02292    struct conf_menu_action *menu_action = NULL;
02293    while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) {
02294       ast_free(menu_action);
02295    }
02296 }

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

Definition at line 1984 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().

01985 {
01986    /* Copy each menu item to the dst struct */
01987    struct conf_menu_entry *cur;
01988 
01989    AST_LIST_TRAVERSE(&src->entries, cur, entry) {
01990       struct conf_menu_entry *cpy;
01991 
01992       if (!(cpy = ast_calloc(1, sizeof(*cpy)))) {
01993          return -1;
01994       }
01995 
01996       if (copy_menu_entry(cpy, cur)) {
01997          conf_menu_entry_destroy(cpy);
01998          ast_free(cpy);
01999          return -1;
02000       }
02001       AST_LIST_INSERT_TAIL(&dst->entries, cpy, entry);
02002    }
02003 
02004    return 0;
02005 }

int conf_reload_config ( void   ) 

reload confbridge.conf file

Definition at line 2160 of file conf_config_parser.c.

References aco_process_config(), and ACO_PROCESS_ERROR.

Referenced by reload().

02161 {
02162    if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
02163       /* On a reload, just keep the config we already have in place. */
02164       return -1;
02165    }
02166    return 0;
02167 }

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:
chan channel the menu profile is requested for
user user profile the menu is being applied to
menu_profile_name name 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:
0 on success
-1 on failure

Definition at line 2344 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, dtmf_menu_hook_pvt::menu, NULL, OBJ_KEY, and RAII_VAR.

Referenced by confbridge_exec().

02345 {
02346    RAII_VAR(struct confbridge_cfg *, cfg, ao2_global_obj_ref(cfg_handle), ao2_cleanup);
02347    RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
02348 
02349    if (chan && ast_strlen_zero(menu_profile_name)) {
02350       struct ast_datastore *datastore;
02351       struct func_confbridge_data *b_data;
02352 
02353       ast_channel_lock(chan);
02354       datastore = ast_channel_datastore_find(chan, &confbridge_datastore, NULL);
02355       ast_channel_unlock(chan);
02356       if (datastore) {
02357          /* If a menu exists in the CONFBRIDGE function datastore, use it. */
02358          b_data = datastore->data;
02359          if (b_data->m_usable) {
02360             menu = ao2_bump(b_data->menu);
02361             return apply_menu_to_user(user, menu);
02362          }
02363       }
02364    }
02365 
02366    /* Otherwise, we need to get whatever menu profile is specified to use (or default). */
02367    if (!cfg) {
02368       return -1;
02369    }
02370 
02371    if (ast_strlen_zero(menu_profile_name)) {
02372       menu_profile_name = DEFAULT_MENU_PROFILE;
02373    }
02374 
02375    if (!(menu = ao2_find(cfg->menus, menu_profile_name, OBJ_KEY))) {
02376       return -1;
02377    }
02378 
02379    return apply_menu_to_user(user, menu);
02380 }

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

Definition at line 2169 of file conf_config_parser.c.

Referenced by conf_find_user_profile().

02170 {
02171    *dst = *src;
02172 }

void * confbridge_cfg_alloc ( void   )  [static]

Definition at line 1808 of file conf_config_parser.c.

References ao2_alloc, ao2_container_alloc, 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.

01809 {
01810    struct confbridge_cfg *cfg;
01811 
01812    if (!(cfg = ao2_alloc(sizeof(*cfg), confbridge_cfg_destructor))) {
01813       return NULL;
01814    }
01815 
01816    if (!(cfg->user_profiles = ao2_container_alloc(283, user_hash_cb, user_cmp_cb))) {
01817       goto error;
01818    }
01819 
01820    if (!(cfg->bridge_profiles = ao2_container_alloc(283, bridge_hash_cb, bridge_cmp_cb))) {
01821       goto error;
01822    }
01823 
01824    if (!(cfg->menus = ao2_container_alloc(283, menu_hash_cb, menu_cmp_cb))) {
01825       goto error;
01826    }
01827 
01828    return cfg;
01829 error:
01830    ao2_ref(cfg, -1);
01831    return NULL;
01832 }

static void confbridge_cfg_destructor ( void *  obj  )  [static]

Definition at line 1800 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().

01801 {
01802    struct confbridge_cfg *cfg = obj;
01803    ao2_cleanup(cfg->user_profiles);
01804    ao2_cleanup(cfg->bridge_profiles);
01805    ao2_cleanup(cfg->menus);
01806 }

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]

Definition at line 1964 of file conf_config_parser.c.

References conf_menu_action::action, 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().

01965 {
01966    struct conf_menu_action *menu_action;
01967    struct conf_menu_action *new_menu_action;
01968 
01969    ast_copy_string(dst->dtmf, src->dtmf, sizeof(dst->dtmf));
01970    AST_LIST_HEAD_INIT_NOLOCK(&dst->actions);
01971 
01972    AST_LIST_TRAVERSE(&src->actions, menu_action, action) {
01973       if (!(new_menu_action = ast_calloc(1, sizeof(*new_menu_action)))) {
01974          return -1;
01975       }
01976       memcpy(new_menu_action, menu_action, sizeof(*new_menu_action));
01977       AST_LIST_NEXT(new_menu_action, action) = NULL;
01978       AST_LIST_INSERT_TAIL(&dst->actions, new_menu_action, action);
01979    }
01980 
01981    return 0;
01982 }

static void func_confbridge_data_destructor ( struct func_confbridge_data b_data  )  [static]

static void func_confbridge_destroy_cb ( void *  data  )  [static]

Definition at line 956 of file conf_config_parser.c.

References func_confbridge_data_destructor().

00957 {
00958    struct func_confbridge_data *b_data = data;
00959    func_confbridge_data_destructor(b_data);
00960 };

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

Definition at line 966 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, 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(), and ast_variable::value.

00967 {
00968    struct ast_datastore *datastore;
00969    struct func_confbridge_data *b_data;
00970    char *parse;
00971    struct ast_variable tmpvar = { 0, };
00972    AST_DECLARE_APP_ARGS(args,
00973       AST_APP_ARG(type);
00974       AST_APP_ARG(option);
00975    );
00976 
00977    if (!chan) {
00978       ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);
00979       return -1;
00980    }
00981 
00982    /* parse all the required arguments and make sure they exist. */
00983    if (ast_strlen_zero(data)) {
00984       return -1;
00985    }
00986    parse = ast_strdupa(data);
00987    AST_STANDARD_APP_ARGS(args, parse);
00988    if (ast_strlen_zero(args.type) || ast_strlen_zero(args.option)) {
00989       return -1;
00990    }
00991 
00992    ast_channel_lock(chan);
00993    datastore = ast_channel_datastore_find(chan, &confbridge_datastore, NULL);
00994    if (!datastore) {
00995       datastore = ast_datastore_alloc(&confbridge_datastore, NULL);
00996       if (!datastore) {
00997          ast_channel_unlock(chan);
00998          return 0;
00999       }
01000       b_data = ast_calloc(1, sizeof(*b_data));
01001       if (!b_data) {
01002          ast_channel_unlock(chan);
01003          ast_datastore_free(datastore);
01004          return 0;
01005       }
01006       datastore->data = b_data;
01007       b_data->b_profile.sounds = bridge_profile_sounds_alloc();
01008       if (!b_data->b_profile.sounds) {
01009          ast_channel_unlock(chan);
01010          ast_datastore_free(datastore);
01011          return 0;
01012       }
01013       if (!(b_data->menu = menu_alloc("dialplan"))) {
01014          ast_channel_unlock(chan);
01015          ast_datastore_free(datastore);
01016          return 0;
01017       }
01018       ast_channel_datastore_add(chan, datastore);
01019    } else {
01020       b_data = datastore->data;
01021    }
01022    ast_channel_unlock(chan);
01023 
01024    /* SET(CONFBRIDGE(type,option)=value) */
01025    if (!value) {
01026       value = "";
01027    }
01028    tmpvar.name = args.option;
01029    tmpvar.value = value;
01030    tmpvar.file = "CONFBRIDGE";
01031    if (!strcasecmp(args.type, "bridge")) {
01032       if (!strcasecmp(args.option, "clear")) {
01033          b_data->b_usable = 0;
01034          conf_bridge_profile_destroy(&b_data->b_profile);
01035          memset(&b_data->b_profile, 0, sizeof(b_data->b_profile)) ;
01036          if (!(b_data->b_profile.sounds = bridge_profile_sounds_alloc())) {
01037             /* If this reallocation fails, the datastore has become unusable and must be destroyed. */
01038             ast_channel_lock(chan);
01039             ast_channel_datastore_remove(chan, datastore);
01040             ast_channel_unlock(chan);
01041             ast_datastore_free(datastore);
01042          }
01043          return 0;
01044       } else if (!aco_process_var(&bridge_type, "dialplan", &tmpvar, &b_data->b_profile)) {
01045          b_data->b_usable = 1;
01046          return 0;
01047       }
01048    } else if (!strcasecmp(args.type, "user")) {
01049       if (!strcasecmp(args.option, "clear")) {
01050          b_data->u_usable = 0;
01051          user_profile_destructor(&b_data->u_profile);
01052          memset(&b_data->u_profile, 0, sizeof(b_data->u_profile));
01053          return 0;
01054       } else if (!aco_process_var(&user_type, "dialplan", &tmpvar, &b_data->u_profile)) {
01055          b_data->u_usable = 1;
01056          return 0;
01057       }
01058    } else if (!strcasecmp(args.type, "menu")) {
01059       if (!strcasecmp(args.option, "clear")) {
01060          b_data->m_usable = 0;
01061          ao2_cleanup(b_data->menu);
01062          if (!(b_data->menu = menu_alloc("dialplan"))) {
01063             /* If this reallocation fails, the datastore has become unusable and must be destroyed */
01064             ast_channel_lock(chan);
01065             ast_channel_datastore_remove(chan, datastore);
01066             ast_channel_unlock(chan);
01067             ast_datastore_free(datastore);
01068          }
01069          return 0;
01070       } else if (!aco_process_var(&menu_type, "dialplan", &tmpvar, b_data->menu)) {
01071          b_data->m_usable = 1;
01072          return 0;
01073       }
01074    }
01075 
01076    ast_log(LOG_WARNING, "%s(%s,%s) cannot be set to '%s'. Invalid type, option, or value.\n",
01077       cmd, args.type, args.option, value);
01078    return -1;
01079 }

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

Definition at line 1497 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_RECORD_CONFERENCE, BRIDGE_OPT_RECORD_FILE_APPEND, BRIDGE_OPT_RECORD_FILE_TIMESTAMP, BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED, BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER, BRIDGE_OPT_VIDEO_SRC_LAST_MARKED, 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_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::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::sounds, tmp(), ast_cli_entry::usage, and ast_cli_args::word.

01498 {
01499    struct bridge_profile b_profile;
01500    char tmp[64];
01501 
01502    switch (cmd) {
01503    case CLI_INIT:
01504       e->command = "confbridge show profile bridge";
01505       e->usage =
01506          "Usage confbridge show profile bridge <profile name>\n";
01507       return NULL;
01508    case CLI_GENERATE:
01509       if (a->pos == 4) {
01510          return complete_bridge_profile_name(a->line, a->word, a->pos, a->n);
01511       }
01512       return NULL;
01513    }
01514 
01515    if (a->argc != 5) {
01516       return CLI_SHOWUSAGE;
01517    }
01518 
01519    if (!(conf_find_bridge_profile(NULL, a->argv[4], &b_profile))) {
01520       ast_cli(a->fd, "No conference bridge profile named '%s' found!\n", a->argv[4]);
01521       return CLI_SUCCESS;
01522    }
01523 
01524    ast_cli(a->fd,"--------------------------------------------\n");
01525    ast_cli(a->fd,"Name:                 %s\n", b_profile.name);
01526    ast_cli(a->fd,"Language:             %s\n", b_profile.language);
01527 
01528    if (b_profile.internal_sample_rate) {
01529       snprintf(tmp, sizeof(tmp), "%u", b_profile.internal_sample_rate);
01530    } else {
01531       ast_copy_string(tmp, "auto", sizeof(tmp));
01532    }
01533    ast_cli(a->fd,"Internal Sample Rate: %s\n", tmp);
01534 
01535    if (b_profile.mix_interval) {
01536       ast_cli(a->fd,"Mixing Interval:      %u\n", b_profile.mix_interval);
01537    } else {
01538       ast_cli(a->fd,"Mixing Interval:      Default 20ms\n");
01539    }
01540 
01541    ast_cli(a->fd,"Record Conference:    %s\n",
01542       b_profile.flags & BRIDGE_OPT_RECORD_CONFERENCE ?
01543       "yes" : "no");
01544 
01545    ast_cli(a->fd,"Record File Append:    %s\n",
01546       b_profile.flags & BRIDGE_OPT_RECORD_FILE_APPEND ?
01547       "yes" : "no");
01548 
01549    ast_cli(a->fd,"Record File Timestamp: %s\n",
01550       b_profile.flags & BRIDGE_OPT_RECORD_FILE_TIMESTAMP ?
01551       "yes" : "no");
01552 
01553    ast_cli(a->fd,"Record File:          %s\n",
01554       ast_strlen_zero(b_profile.rec_file) ? "Auto Generated" :
01555       b_profile.rec_file);
01556 
01557    ast_cli(a->fd,"Record Options:       %s\n",
01558       b_profile.rec_options);
01559 
01560    ast_cli(a->fd,"Record Command:       %s\n",
01561       b_profile.rec_command);
01562 
01563    if (b_profile.max_members) {
01564       ast_cli(a->fd,"Max Members:          %u\n", b_profile.max_members);
01565    } else {
01566       ast_cli(a->fd,"Max Members:          No Limit\n");
01567    }
01568 
01569    switch (b_profile.flags
01570       & (BRIDGE_OPT_VIDEO_SRC_LAST_MARKED | BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
01571          | BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER)) {
01572    case BRIDGE_OPT_VIDEO_SRC_LAST_MARKED:
01573       ast_cli(a->fd, "Video Mode:           last_marked\n");
01574       break;
01575    case BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED:
01576       ast_cli(a->fd, "Video Mode:           first_marked\n");
01577       break;
01578    case BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER:
01579       ast_cli(a->fd, "Video Mode:           follow_talker\n");
01580       break;
01581    case 0:
01582       ast_cli(a->fd, "Video Mode:           no video\n");
01583       break;
01584    default:
01585       /* Opps.  We have more than one video mode flag set. */
01586       ast_assert(0);
01587       break;
01588    }
01589 
01590    ast_cli(a->fd,"sound_only_person:    %s\n", conf_get_sound(CONF_SOUND_ONLY_PERSON, b_profile.sounds));
01591    ast_cli(a->fd,"sound_only_one:       %s\n", conf_get_sound(CONF_SOUND_ONLY_ONE, b_profile.sounds));
01592    ast_cli(a->fd,"sound_has_joined:     %s\n", conf_get_sound(CONF_SOUND_HAS_JOINED, b_profile.sounds));
01593    ast_cli(a->fd,"sound_has_left:       %s\n", conf_get_sound(CONF_SOUND_HAS_LEFT, b_profile.sounds));
01594    ast_cli(a->fd,"sound_kicked:         %s\n", conf_get_sound(CONF_SOUND_KICKED, b_profile.sounds));
01595    ast_cli(a->fd,"sound_muted:          %s\n", conf_get_sound(CONF_SOUND_MUTED, b_profile.sounds));
01596    ast_cli(a->fd,"sound_unmuted:        %s\n", conf_get_sound(CONF_SOUND_UNMUTED, b_profile.sounds));
01597    ast_cli(a->fd,"sound_there_are:      %s\n", conf_get_sound(CONF_SOUND_THERE_ARE, b_profile.sounds));
01598    ast_cli(a->fd,"sound_other_in_party: %s\n", conf_get_sound(CONF_SOUND_OTHER_IN_PARTY, b_profile.sounds));
01599    ast_cli(a->fd,"sound_place_into_conference: %s\n", conf_get_sound(CONF_SOUND_PLACE_IN_CONF, b_profile.sounds));
01600    ast_cli(a->fd,"sound_wait_for_leader:       %s\n", conf_get_sound(CONF_SOUND_WAIT_FOR_LEADER, b_profile.sounds));
01601    ast_cli(a->fd,"sound_leader_has_left:       %s\n", conf_get_sound(CONF_SOUND_LEADER_HAS_LEFT, b_profile.sounds));
01602    ast_cli(a->fd,"sound_get_pin:        %s\n", conf_get_sound(CONF_SOUND_GET_PIN, b_profile.sounds));
01603    ast_cli(a->fd,"sound_invalid_pin:    %s\n", conf_get_sound(CONF_SOUND_INVALID_PIN, b_profile.sounds));
01604    ast_cli(a->fd,"sound_locked:         %s\n", conf_get_sound(CONF_SOUND_LOCKED, b_profile.sounds));
01605    ast_cli(a->fd,"sound_unlocked_now:   %s\n", conf_get_sound(CONF_SOUND_UNLOCKED_NOW, b_profile.sounds));
01606    ast_cli(a->fd,"sound_lockednow:      %s\n", conf_get_sound(CONF_SOUND_LOCKED_NOW, b_profile.sounds));
01607    ast_cli(a->fd,"sound_error_menu:     %s\n", conf_get_sound(CONF_SOUND_ERROR_MENU, b_profile.sounds));
01608    ast_cli(a->fd,"sound_join:           %s\n", conf_get_sound(CONF_SOUND_JOIN, b_profile.sounds));
01609    ast_cli(a->fd,"sound_leave:          %s\n", conf_get_sound(CONF_SOUND_LEAVE, b_profile.sounds));
01610    ast_cli(a->fd,"sound_participants_muted:     %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_MUTED, b_profile.sounds));
01611    ast_cli(a->fd,"sound_participants_unmuted:     %s\n", conf_get_sound(CONF_SOUND_PARTICIPANTS_UNMUTED, b_profile.sounds));
01612    ast_cli(a->fd,"sound_begin:          %s\n", conf_get_sound(CONF_SOUND_BEGIN, b_profile.sounds));
01613    ast_cli(a->fd,"\n");
01614 
01615    conf_bridge_profile_destroy(&b_profile);
01616    return CLI_SUCCESS;
01617 }

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

Definition at line 1464 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.

01465 {
01466    struct ao2_iterator it;
01467    struct bridge_profile *b_profile;
01468    RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
01469 
01470    switch (cmd) {
01471    case CLI_INIT:
01472       e->command = "confbridge show profile bridges";
01473       e->usage =
01474          "Usage confbridge show profile bridges\n";
01475       return NULL;
01476    case CLI_GENERATE:
01477       return NULL;
01478    }
01479 
01480    if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
01481       return NULL;
01482    }
01483 
01484    ast_cli(a->fd,"--------- Bridge Profiles -----------\n");
01485    ao2_lock(cfg->bridge_profiles);
01486    it = ao2_iterator_init(cfg->bridge_profiles, 0);
01487    while ((b_profile = ao2_iterator_next(&it))) {
01488       ast_cli(a->fd,"%s\n", b_profile->name);
01489       ao2_ref(b_profile, -1);
01490    }
01491    ao2_iterator_destroy(&it);
01492    ao2_unlock(cfg->bridge_profiles);
01493 
01494    return CLI_SUCCESS;
01495 }

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

Definition at line 1679 of file conf_config_parser.c.

References conf_menu_action::action, 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_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.

01680 {
01681    RAII_VAR(struct conf_menu *, menu, NULL, ao2_cleanup);
01682    RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
01683    struct conf_menu_entry *menu_entry = NULL;
01684    struct conf_menu_action *menu_action = NULL;
01685 
01686    switch (cmd) {
01687    case CLI_INIT:
01688       e->command = "confbridge show menu";
01689       e->usage =
01690          "Usage confbridge show menu [<menu name>]\n";
01691       return NULL;
01692    case CLI_GENERATE:
01693       if (a->pos == 3) {
01694          return complete_menu_name(a->line, a->word, a->pos, a->n);
01695       }
01696       return NULL;
01697    }
01698 
01699    if (a->argc != 4) {
01700       return CLI_SHOWUSAGE;
01701    }
01702 
01703    if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
01704       return NULL;
01705    }
01706 
01707    if (!(menu = menu_find(cfg->menus, a->argv[3]))) {
01708       ast_cli(a->fd, "No conference menu named '%s' found!\n", a->argv[3]);
01709       return CLI_SUCCESS;
01710    }
01711    ao2_lock(menu);
01712 
01713    ast_cli(a->fd,"Name: %s\n", menu->name);
01714    AST_LIST_TRAVERSE(&menu->entries, menu_entry, entry) {
01715       int action_num = 0;
01716       ast_cli(a->fd, "%s=", menu_entry->dtmf);
01717       AST_LIST_TRAVERSE(&menu_entry->actions, menu_action, action) {
01718          if (action_num) {
01719             ast_cli(a->fd, ", ");
01720          }
01721          switch (menu_action->id) {
01722          case MENU_ACTION_TOGGLE_MUTE:
01723             ast_cli(a->fd, "toggle_mute");
01724             break;
01725          case MENU_ACTION_NOOP:
01726             ast_cli(a->fd, "no_op");
01727             break;
01728          case MENU_ACTION_INCREASE_LISTENING:
01729             ast_cli(a->fd, "increase_listening_volume");
01730             break;
01731          case MENU_ACTION_DECREASE_LISTENING:
01732             ast_cli(a->fd, "decrease_listening_volume");
01733             break;
01734          case MENU_ACTION_RESET_LISTENING:
01735             ast_cli(a->fd, "reset_listening_volume");
01736             break;
01737          case MENU_ACTION_RESET_TALKING:
01738             ast_cli(a->fd, "reset_talking_volume");
01739             break;
01740          case MENU_ACTION_INCREASE_TALKING:
01741             ast_cli(a->fd, "increase_talking_volume");
01742             break;
01743          case MENU_ACTION_DECREASE_TALKING:
01744             ast_cli(a->fd, "decrease_talking_volume");
01745             break;
01746          case MENU_ACTION_PLAYBACK:
01747             ast_cli(a->fd, "playback(%s)", menu_action->data.playback_file);
01748             break;
01749          case MENU_ACTION_PLAYBACK_AND_CONTINUE:
01750             ast_cli(a->fd, "playback_and_continue(%s)", menu_action->data.playback_file);
01751             break;
01752          case MENU_ACTION_DIALPLAN_EXEC:
01753             ast_cli(a->fd, "dialplan_exec(%s,%s,%d)",
01754                menu_action->data.dialplan_args.context,
01755                menu_action->data.dialplan_args.exten,
01756                menu_action->data.dialplan_args.priority);
01757             break;
01758          case MENU_ACTION_ADMIN_TOGGLE_LOCK:
01759             ast_cli(a->fd, "admin_toggle_conference_lock");
01760             break;
01761          case MENU_ACTION_ADMIN_TOGGLE_MUTE_PARTICIPANTS:
01762             ast_cli(a->fd, "admin_toggle_mute_participants");
01763             break;
01764          case MENU_ACTION_PARTICIPANT_COUNT:
01765             ast_cli(a->fd, "participant_count");
01766             break;
01767          case MENU_ACTION_ADMIN_KICK_LAST:
01768             ast_cli(a->fd, "admin_kick_last");
01769             break;
01770          case MENU_ACTION_LEAVE:
01771             ast_cli(a->fd, "leave_conference");
01772             break;
01773          case MENU_ACTION_SET_SINGLE_VIDEO_SRC:
01774             ast_cli(a->fd, "set_as_single_video_src");
01775             break;
01776          case MENU_ACTION_RELEASE_SINGLE_VIDEO_SRC:
01777             ast_cli(a->fd, "release_as_single_video_src");
01778             break;
01779          }
01780          action_num++;
01781       }
01782       ast_cli(a->fd,"\n");
01783    }
01784 
01785 
01786    ao2_unlock(menu);
01787    return CLI_SUCCESS;
01788 }

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

Definition at line 1646 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.

01647 {
01648    struct ao2_iterator it;
01649    struct conf_menu *menu;
01650    RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
01651 
01652    switch (cmd) {
01653    case CLI_INIT:
01654       e->command = "confbridge show menus";
01655       e->usage =
01656          "Usage confbridge show profile menus\n";
01657       return NULL;
01658    case CLI_GENERATE:
01659       return NULL;
01660    }
01661 
01662    if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
01663       return NULL;
01664    }
01665 
01666    ast_cli(a->fd,"--------- Menus -----------\n");
01667    ao2_lock(cfg->menus);
01668    it = ao2_iterator_init(cfg->menus, 0);
01669    while ((menu = ao2_iterator_next(&it))) {
01670       ast_cli(a->fd,"%s\n", menu->name);
01671       ao2_ref(menu, -1);
01672    }
01673    ao2_iterator_destroy(&it);
01674    ao2_unlock(cfg->menus);
01675 
01676    return CLI_SUCCESS;
01677 }

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

Definition at line 1345 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_DENOISE, USER_OPT_DROP_SILENCE, USER_OPT_DTMF_PASS, USER_OPT_ENDMARKED, USER_OPT_JITTERBUFFER, USER_OPT_MARKEDUSER, USER_OPT_MUSICONHOLD, USER_OPT_QUIET, USER_OPT_STARTMUTED, USER_OPT_TALKER_DETECT, USER_OPT_WAITMARKED, and ast_cli_args::word.

01346 {
01347    struct user_profile u_profile;
01348 
01349    switch (cmd) {
01350    case CLI_INIT:
01351       e->command = "confbridge show profile user";
01352       e->usage =
01353          "Usage confbridge show profile user [<profile name>]\n";
01354       return NULL;
01355    case CLI_GENERATE:
01356       if (a->pos == 4) {
01357          return complete_user_profile_name(a->line, a->word, a->pos, a->n);
01358       }
01359       return NULL;
01360    }
01361 
01362    if (a->argc != 5) {
01363       return CLI_SHOWUSAGE;
01364    }
01365 
01366    if (!(conf_find_user_profile(NULL, a->argv[4], &u_profile))) {
01367       ast_cli(a->fd, "No conference user profile named '%s' found!\n", a->argv[4]);
01368       return CLI_SUCCESS;
01369    }
01370 
01371    ast_cli(a->fd,"--------------------------------------------\n");
01372    ast_cli(a->fd,"Name:                    %s\n",
01373       u_profile.name);
01374    ast_cli(a->fd,"Admin:                   %s\n",
01375       u_profile.flags & USER_OPT_ADMIN ?
01376       "true" : "false");
01377    ast_cli(a->fd,"Marked User:             %s\n",
01378       u_profile.flags & USER_OPT_MARKEDUSER ?
01379       "true" : "false");
01380    ast_cli(a->fd,"Start Muted:             %s\n",
01381       u_profile.flags & USER_OPT_STARTMUTED?
01382       "true" : "false");
01383    ast_cli(a->fd,"MOH When Empty:          %s\n",
01384       u_profile.flags & USER_OPT_MUSICONHOLD ?
01385       "enabled" : "disabled");
01386    ast_cli(a->fd,"MOH Class:               %s\n",
01387       ast_strlen_zero(u_profile.moh_class) ?
01388       "default" : u_profile.moh_class);
01389    ast_cli(a->fd,"Announcement:            %s\n",
01390       u_profile.announcement);
01391    ast_cli(a->fd,"Quiet:                   %s\n",
01392       u_profile.flags & USER_OPT_QUIET ?
01393       "enabled" : "disabled");
01394    ast_cli(a->fd,"Wait Marked:             %s\n",
01395       u_profile.flags & USER_OPT_WAITMARKED ?
01396       "enabled" : "disabled");
01397    ast_cli(a->fd,"END Marked:              %s\n",
01398       u_profile.flags & USER_OPT_ENDMARKED ?
01399       "enabled" : "disabled");
01400    ast_cli(a->fd,"Drop_silence:            %s\n",
01401       u_profile.flags & USER_OPT_DROP_SILENCE ?
01402       "enabled" : "disabled");
01403    ast_cli(a->fd,"Silence Threshold:       %ums\n",
01404       u_profile.silence_threshold);
01405    ast_cli(a->fd,"Talking Threshold:       %ums\n",
01406       u_profile.talking_threshold);
01407    ast_cli(a->fd,"Denoise:                 %s\n",
01408       u_profile.flags & USER_OPT_DENOISE ?
01409       "enabled" : "disabled");
01410    ast_cli(a->fd,"Jitterbuffer:            %s\n",
01411       u_profile.flags & USER_OPT_JITTERBUFFER ?
01412       "enabled" : "disabled");
01413    ast_cli(a->fd,"Talk Detect Events:      %s\n",
01414       u_profile.flags & USER_OPT_TALKER_DETECT ?
01415       "enabled" : "disabled");
01416    ast_cli(a->fd,"DTMF Pass Through:       %s\n",
01417       u_profile.flags & USER_OPT_DTMF_PASS ?
01418       "enabled" : "disabled");
01419    ast_cli(a->fd,"PIN:                     %s\n",
01420       ast_strlen_zero(u_profile.pin) ?
01421       "None" : u_profile.pin);
01422    ast_cli(a->fd,"Announce User Count:     %s\n",
01423       u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNT ?
01424       "enabled" : "disabled");
01425    ast_cli(a->fd,"Announce join/leave:     %s\n",
01426       u_profile.flags & (USER_OPT_ANNOUNCE_JOIN_LEAVE | USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW) ?
01427       u_profile.flags & USER_OPT_ANNOUNCE_JOIN_LEAVE_REVIEW ?
01428       "enabled (with review)" : "enabled" : "disabled");
01429    ast_cli(a->fd,"Announce User Count all: %s\n",
01430       u_profile.flags & USER_OPT_ANNOUNCEUSERCOUNTALL ?
01431       "enabled" : "disabled");
01432       ast_cli(a->fd,"\n");
01433 
01434    return CLI_SUCCESS;
01435 }

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

Definition at line 1313 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.

01314 {
01315    struct ao2_iterator it;
01316    struct user_profile *u_profile;
01317    RAII_VAR(struct confbridge_cfg *, cfg, NULL, ao2_cleanup);
01318 
01319    switch (cmd) {
01320    case CLI_INIT:
01321       e->command = "confbridge show profile users";
01322       e->usage =
01323          "Usage confbridge show profile users\n";
01324       return NULL;
01325    case CLI_GENERATE:
01326       return NULL;
01327    }
01328 
01329    if (!(cfg = ao2_global_obj_ref(cfg_handle))) {
01330       return NULL;
01331    }
01332 
01333    ast_cli(a->fd,"--------- User Profiles -----------\n");
01334    ao2_lock(cfg->user_profiles);
01335    it = ao2_iterator_init(cfg->user_profiles, 0);
01336    while ((u_profile = ao2_iterator_next(&it))) {
01337       ast_cli(a->fd,"%s\n", u_profile->name);
01338       ao2_ref(u_profile, -1);
01339    }
01340    ao2_iterator_destroy(&it);
01341    ao2_unlock(cfg->user_profiles);
01342 
01343    return CLI_SUCCESS;
01344 }

static void * menu_alloc ( const char *  category  )  [static]

Definition at line 648 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().

00649 {
00650    struct conf_menu *menu;
00651    if (!(menu = ao2_alloc(sizeof(*menu), menu_destructor))) {
00652       return NULL;
00653    }
00654    ast_copy_string(menu->name, category, sizeof(menu->name));
00655    return menu;
00656 }

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

menu container functions

Definition at line 749 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().

00750 {
00751    const struct conf_menu *left = obj;
00752    const struct conf_menu *right = arg;
00753    const char *right_name = arg;
00754    int cmp;
00755 
00756    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
00757    default:
00758    case OBJ_POINTER:
00759       right_name = right->name;
00760       /* Fall through */
00761    case OBJ_KEY:
00762       cmp = strcasecmp(left->name, right_name);
00763       break;
00764    case OBJ_PARTIAL_KEY:
00765       cmp = strncasecmp(left->name, right_name, strlen(right_name));
00766       break;
00767    }
00768    return cmp ? 0 : CMP_MATCH;
00769 }

static void menu_destructor ( void *  obj  )  [static]

Definition at line 794 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().

00795 {
00796    struct conf_menu *menu = obj;
00797    struct conf_menu_entry *entry = NULL;
00798 
00799    while ((entry = AST_LIST_REMOVE_HEAD(&menu->entries, entry))) {
00800       conf_menu_entry_destroy(entry);
00801       ast_free(entry);
00802    }
00803 }

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

Definition at line 658 of file conf_config_parser.c.

References ao2_find, and OBJ_KEY.

Referenced by handle_cli_confbridge_show_menu().

00659 {
00660    return ao2_find(container, category, OBJ_KEY);
00661 }

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

Definition at line 771 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc().

00772 {
00773    const struct conf_menu *menu = obj;
00774    const char *name = obj;
00775    int hash;
00776 
00777    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
00778    default:
00779    case OBJ_POINTER:
00780       name = menu->name;
00781       /* Fall through */
00782    case OBJ_KEY:
00783       hash = ast_str_case_hash(name);
00784       break;
00785    case OBJ_PARTIAL_KEY:
00786       /* Should never happen in hash callback. */
00787       ast_assert(0);
00788       hash = 0;
00789       break;
00790    }
00791    return hash;
00792 }

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

Definition at line 2283 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().

02284 {
02285    struct dtmf_menu_hook_pvt *pvt = hook_pvt;
02286 
02287    return conf_handle_dtmf(bridge_channel, pvt->user, &pvt->menu_entry, pvt->menu);
02288 }

static void menu_hook_destroy ( void *  hook_pvt  )  [static]

Definition at line 2270 of file conf_config_parser.c.

References conf_menu_action::action, 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().

02271 {
02272    struct dtmf_menu_hook_pvt *pvt = hook_pvt;
02273    struct conf_menu_action *action = NULL;
02274 
02275    ao2_cleanup(pvt->menu);
02276 
02277    while ((action = AST_LIST_REMOVE_HEAD(&pvt->menu_entry.actions, action))) {
02278       ast_free(action);
02279    }
02280    ast_free(pvt);
02281 }

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

Definition at line 2034 of file conf_config_parser.c.

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

Referenced by conf_load_config().

02035 {
02036    add_menu_entry(obj, var->name, var->value);
02037    return 0;
02038 }

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

Definition at line 2007 of file conf_config_parser.c.

References aco_pending_config(), ao2_cleanup, ao2_find, conf_menu_profile_copy(), confbridge_cfg::menus, NULL, OBJ_KEY, RAII_VAR, and ast_variable::value.

Referenced by conf_load_config().

02008 {
02009    struct conf_menu *dst_menu = obj;
02010    struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
02011    RAII_VAR(struct conf_menu *, src_menu, NULL, ao2_cleanup);
02012 
02013    if (!cfg) {
02014       return 0;
02015    }
02016 
02017    if (!(src_menu = ao2_find(cfg->menus, var->value, OBJ_KEY))) {
02018       return -1;
02019    }
02020 
02021    if (conf_menu_profile_copy(dst_menu, src_menu)) {
02022       return -1;
02023    }
02024 
02025    return 0;
02026 }

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

Definition at line 1853 of file conf_config_parser.c.

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

Referenced by conf_load_config().

01854 {
01855    struct bridge_profile *b_profile = obj;
01856 
01857    if (strcasecmp(var->name, "mixing_interval")) {
01858       return -1;
01859    }
01860    if (sscanf(var->value, "%30u", &b_profile->mix_interval) != 1) {
01861       return -1;
01862    }
01863    switch (b_profile->mix_interval) {
01864    case 10:
01865    case 20:
01866    case 40:
01867    case 80:
01868       return 0;
01869    default:
01870       return -1;
01871    }
01872 }

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

Definition at line 873 of file conf_config_parser.c.

References ast_log, ast_string_field_set, ast_strlen_zero, bridge_profile_sounds::begin, 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, bridge_profile::sounds, sounds, bridge_profile_sounds::thereare, bridge_profile_sounds::unlockednow, bridge_profile_sounds::unmuted, and bridge_profile_sounds::waitforleader.

Referenced by sound_option_handler().

00874 {
00875    struct bridge_profile_sounds *sounds = b_profile->sounds;
00876    if (ast_strlen_zero(sound_file)) {
00877       return -1;
00878    }
00879 
00880    if (!strcasecmp(sound_name, "sound_only_person")) {
00881       ast_string_field_set(sounds, onlyperson, sound_file);
00882    } else if (!strcasecmp(sound_name, "sound_only_one")) {
00883       ast_string_field_set(sounds, onlyone, sound_file);
00884    } else if (!strcasecmp(sound_name, "sound_has_joined")) {
00885       ast_string_field_set(sounds, hasjoin, sound_file);
00886    } else if (!strcasecmp(sound_name, "sound_has_left")) {
00887       ast_string_field_set(sounds, hasleft, sound_file);
00888    } else if (!strcasecmp(sound_name, "sound_kicked")) {
00889       ast_string_field_set(sounds, kicked, sound_file);
00890    } else if (!strcasecmp(sound_name, "sound_muted")) {
00891       ast_string_field_set(sounds, muted, sound_file);
00892    } else if (!strcasecmp(sound_name, "sound_unmuted")) {
00893       ast_string_field_set(sounds, unmuted, sound_file);
00894    } else if (!strcasecmp(sound_name, "sound_there_are")) {
00895       ast_string_field_set(sounds, thereare, sound_file);
00896    } else if (!strcasecmp(sound_name, "sound_other_in_party")) {
00897       ast_string_field_set(sounds, otherinparty, sound_file);
00898    } else if (!strcasecmp(sound_name, "sound_place_into_conference")) {
00899       static int deprecation_warning = 1;
00900       if (deprecation_warning) {
00901          ast_log(LOG_WARNING, "sound_place_into_conference is deprecated"
00902             " and unused. Use sound_begin for similar functionality.");
00903          deprecation_warning = 0;
00904       }
00905       ast_string_field_set(sounds, placeintoconf, sound_file);
00906    } else if (!strcasecmp(sound_name, "sound_wait_for_leader")) {
00907       ast_string_field_set(sounds, waitforleader, sound_file);
00908    } else if (!strcasecmp(sound_name, "sound_leader_has_left")) {
00909       ast_string_field_set(sounds, leaderhasleft, sound_file);
00910    } else if (!strcasecmp(sound_name, "sound_get_pin")) {
00911       ast_string_field_set(sounds, getpin, sound_file);
00912    } else if (!strcasecmp(sound_name, "sound_invalid_pin")) {
00913       ast_string_field_set(sounds, invalidpin, sound_file);
00914    } else if (!strcasecmp(sound_name, "sound_locked")) {
00915       ast_string_field_set(sounds, locked, sound_file);
00916    } else if (!strcasecmp(sound_name, "sound_unlocked_now")) {
00917       ast_string_field_set(sounds, unlockednow, sound_file);
00918    } else if (!strcasecmp(sound_name, "sound_locked_now")) {
00919       ast_string_field_set(sounds, lockednow, sound_file);
00920    } else if (!strcasecmp(sound_name, "sound_error_menu")) {
00921       ast_string_field_set(sounds, errormenu, sound_file);
00922    } else if (!strcasecmp(sound_name, "sound_join")) {
00923       ast_string_field_set(sounds, join, sound_file);
00924    } else if (!strcasecmp(sound_name, "sound_leave")) {
00925       ast_string_field_set(sounds, leave, sound_file);
00926    } else if (!strcasecmp(sound_name, "sound_participants_muted")) {
00927       ast_string_field_set(sounds, participantsmuted, sound_file);
00928    } else if (!strcasecmp(sound_name, "sound_participants_unmuted")) {
00929       ast_string_field_set(sounds, participantsunmuted, sound_file);
00930    } else if (!strcasecmp(sound_name, "sound_begin")) {
00931       ast_string_field_set(sounds, begin, sound_file);
00932    } else {
00933       return -1;
00934    }
00935 
00936    return 0;
00937 }

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

Definition at line 2028 of file conf_config_parser.c.

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

Referenced by conf_load_config().

02029 {
02030    set_sound(var->name, var->value, obj);
02031    return 0;
02032 }

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

User profile container functions

Definition at line 806 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(), and load_objects().

00807 {
00808    const struct user_profile *left = obj;
00809    const struct user_profile *right = arg;
00810    const char *right_name = arg;
00811    int cmp;
00812 
00813    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
00814    default:
00815    case OBJ_POINTER:
00816       right_name = right->name;
00817       /* Fall through */
00818    case OBJ_KEY:
00819       cmp = strcasecmp(left->name, right_name);
00820       break;
00821    case OBJ_PARTIAL_KEY:
00822       cmp = strncasecmp(left->name, right_name, strlen(right_name));
00823       break;
00824    }
00825    return cmp ? 0 : CMP_MATCH;
00826 }

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

Definition at line 828 of file conf_config_parser.c.

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

Referenced by confbridge_cfg_alloc(), and load_objects().

00829 {
00830    const struct user_profile *u_profile = obj;
00831    const char *name = obj;
00832    int hash;
00833 
00834    switch (flags & (OBJ_POINTER | OBJ_KEY | OBJ_PARTIAL_KEY)) {
00835    default:
00836    case OBJ_POINTER:
00837       name = u_profile->name;
00838       /* Fall through */
00839    case OBJ_KEY:
00840       hash = ast_str_case_hash(name);
00841       break;
00842    case OBJ_PARTIAL_KEY:
00843       /* Should never happen in hash callback. */
00844       ast_assert(0);
00845       hash = 0;
00846       break;
00847    }
00848    return hash;
00849 }

static void * user_profile_alloc ( const char *  category  )  [static]

Definition at line 614 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().

00615 {
00616    struct user_profile *u_profile;
00617 
00618    if (!(u_profile = ao2_alloc(sizeof(*u_profile), user_profile_destructor))) {
00619       return NULL;
00620    }
00621 
00622    ast_copy_string(u_profile->name, category, sizeof(u_profile->name));
00623 
00624    return u_profile;
00625 }

static void user_profile_destructor ( void *  obj  )  [static]

Definition at line 609 of file conf_config_parser.c.

Referenced by func_confbridge_helper(), and user_profile_alloc().

00610 {
00611    return;
00612 }

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

Definition at line 627 of file conf_config_parser.c.

References ao2_find, and OBJ_KEY.

00628 {
00629    return ao2_find(container, category, OBJ_KEY);
00630 }

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

Definition at line 1910 of file conf_config_parser.c.

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

Referenced by conf_load_config().

01911 {
01912    struct user_profile *u_profile = obj;
01913 
01914    return conf_find_user_profile(NULL, var->value, u_profile) ? 0 : -1;
01915 }

static int verify_default_profiles ( void   )  [static]

Definition at line 2040 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.

02041 {
02042    RAII_VAR(struct user_profile *, user_profile, NULL, ao2_cleanup);
02043    RAII_VAR(struct bridge_profile *, bridge_profile, NULL, ao2_cleanup);
02044    RAII_VAR(struct conf_menu *, menu_profile, NULL, ao2_cleanup);
02045    struct confbridge_cfg *cfg = aco_pending_config(&cfg_info);
02046 
02047    if (!cfg) {
02048       return 0;
02049    }
02050 
02051    bridge_profile = ao2_find(cfg->bridge_profiles, DEFAULT_BRIDGE_PROFILE, OBJ_KEY);
02052    if (!bridge_profile) {
02053       bridge_profile = bridge_profile_alloc(DEFAULT_BRIDGE_PROFILE);
02054       if (!bridge_profile) {
02055          return -1;
02056       }
02057       ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_BRIDGE_PROFILE);
02058       aco_set_defaults(&bridge_type, DEFAULT_BRIDGE_PROFILE, bridge_profile);
02059       ao2_link(cfg->bridge_profiles, bridge_profile);
02060    }
02061 
02062    user_profile = ao2_find(cfg->user_profiles, DEFAULT_USER_PROFILE, OBJ_KEY);
02063    if (!user_profile) {
02064       user_profile = user_profile_alloc(DEFAULT_USER_PROFILE);
02065       if (!user_profile) {
02066          return -1;
02067       }
02068       ast_log(AST_LOG_NOTICE, "Adding %s profile to app_confbridge\n", DEFAULT_USER_PROFILE);
02069       aco_set_defaults(&user_type, DEFAULT_USER_PROFILE, user_profile);
02070       ao2_link(cfg->user_profiles, user_profile);
02071    }
02072 
02073    menu_profile = ao2_find(cfg->menus, DEFAULT_MENU_PROFILE, OBJ_KEY);
02074    if (!menu_profile) {
02075       menu_profile = menu_alloc(DEFAULT_MENU_PROFILE);
02076       if (!menu_profile) {
02077          return -1;
02078       }
02079       ast_log(AST_LOG_NOTICE, "Adding %s menu to app_confbridge\n", DEFAULT_MENU_PROFILE);
02080       aco_set_defaults(&menu_type, DEFAULT_MENU_PROFILE, menu_profile);
02081       ao2_link(cfg->menus, menu_profile);
02082    }
02083 
02084    return 0;
02085 }

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

Definition at line 1874 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, ast_variable::name, and ast_variable::value.

Referenced by conf_load_config().

01875 {
01876    struct bridge_profile *b_profile = obj;
01877 
01878    if (strcasecmp(var->name, "video_mode")) {
01879       return -1;
01880    }
01881    if (!strcasecmp(var->value, "first_marked")) {
01882       ast_set_flags_to(b_profile,
01883          BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
01884             | BRIDGE_OPT_VIDEO_SRC_LAST_MARKED
01885             | BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER,
01886          BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED);
01887    } else if (!strcasecmp(var->value, "last_marked")) {
01888       ast_set_flags_to(b_profile,
01889          BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
01890             | BRIDGE_OPT_VIDEO_SRC_LAST_MARKED
01891             | BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER,
01892          BRIDGE_OPT_VIDEO_SRC_LAST_MARKED);
01893    } else if (!strcasecmp(var->value, "follow_talker")) {
01894       ast_set_flags_to(b_profile,
01895          BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
01896             | BRIDGE_OPT_VIDEO_SRC_LAST_MARKED
01897             | BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER,
01898          BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER);
01899    } else if (!strcasecmp(var->value, "none")) {
01900       ast_clear_flag(b_profile,
01901          BRIDGE_OPT_VIDEO_SRC_FIRST_MARKED
01902             | BRIDGE_OPT_VIDEO_SRC_LAST_MARKED
01903             | BRIDGE_OPT_VIDEO_SRC_FOLLOW_TALKER);
01904    } else {
01905       return -1;
01906    }
01907    return 0;
01908 }


Variable Documentation

struct aco_type bridge_type [static]

Definition at line 595 of file conf_config_parser.c.

Referenced by filter_bridge_type_cb().

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

Definition at line 676 of file conf_config_parser.c.

Definition at line 1790 of file conf_config_parser.c.

struct aco_file confbridge_conf [static]

Initial value:

 {
   .filename = "confbridge.conf",
   .types = ACO_TYPES(&bridge_type, &user_type, &menu_type, &general_type),
}

Definition at line 688 of file conf_config_parser.c.

Initial value:

 {
   .type = "confbridge",
   .destroy = func_confbridge_destroy_cb
}

Definition at line 962 of file conf_config_parser.c.

struct aco_type general_type [static]

Definition at line 681 of file conf_config_parser.c.

struct aco_type menu_type [static]

Definition at line 663 of file conf_config_parser.c.

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

Definition at line 677 of file conf_config_parser.c.

struct aco_type user_type [static]

Definition at line 632 of file conf_config_parser.c.

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

Definition at line 678 of file conf_config_parser.c.


Generated on Thu Apr 16 06:30:20 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6