Asterisk - The Open Source Telephony Project
18.5.0
|
chan_misdn configuration management More...
#include "asterisk.h"
#include "chan_misdn_config.h"
#include "asterisk/config.h"
#include "asterisk/channel.h"
#include "asterisk/lock.h"
#include "asterisk/pbx.h"
#include "asterisk/strings.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Data Structures | |
union | misdn_cfg_pt |
struct | misdn_cfg_spec |
struct | msn_list |
Macros | |
#define | CLI_ERROR(name, value, section) |
#define | GEN_CFG 1 |
#define | NO_DEFAULT "<>" |
#define | NONE 0 |
#define | NUM_GEN_ELEMENTS (sizeof(gen_spec) / sizeof(struct misdn_cfg_spec)) |
#define | NUM_PORT_ELEMENTS (sizeof(port_spec) / sizeof(struct misdn_cfg_spec)) |
#define | PORT_CFG 2 |
Enumerations | |
enum | misdn_cfg_type { MISDN_CTYPE_STR, MISDN_CTYPE_INT, MISDN_CTYPE_BOOL, MISDN_CTYPE_BOOLINT, MISDN_CTYPE_MSNLIST, MISDN_CTYPE_ASTGROUP, MISDN_CTYPE_ASTNAMEDGROUP } |
Functions | |
static void | _build_general_config (struct ast_variable *v) |
static void | _build_port_config (struct ast_variable *v, char *cat) |
static int | _enum_array_map (void) |
static void | _fill_defaults (void) |
static void | _free_general_cfg (void) |
static void | _free_msn_list (struct msn_list *iter) |
static void | _free_port_cfg (void) |
static int | _parse (union misdn_cfg_pt *dest, const char *value, enum misdn_cfg_type type, int boolint_def) |
static int | get_cfg_position (const char *name, int type) |
void | misdn_cfg_destroy (void) |
void | misdn_cfg_get (int port, enum misdn_cfg_elements elem, void *buf, int bufsize) |
void | misdn_cfg_get_config_string (int port, enum misdn_cfg_elements elem, char *buf, int bufsize) |
void | misdn_cfg_get_desc (enum misdn_cfg_elements elem, void *buf, int bufsize, void *buf_default, int bufsize_default) |
enum misdn_cfg_elements | misdn_cfg_get_elem (const char *name) |
void | misdn_cfg_get_name (enum misdn_cfg_elements elem, void *buf, int bufsize) |
int | misdn_cfg_get_next_port (int port) |
int | misdn_cfg_get_next_port_spin (int port) |
void | misdn_cfg_get_ports_string (char *ports) |
Generate a comma separated list of all active ports. More... | |
int | misdn_cfg_init (int this_max_ports, int reload) |
int | misdn_cfg_is_group_method (char *group, enum misdn_cfg_method meth) |
int | misdn_cfg_is_msn_valid (int port, char *msn) |
int | misdn_cfg_is_port_valid (int port) |
static void | misdn_cfg_lock (void) |
void | misdn_cfg_reload (void) |
static void | misdn_cfg_unlock (void) |
void | misdn_cfg_update_ptp (void) |
struct ast_jb_conf * | misdn_get_global_jbconf () |
Variables | |
static ast_mutex_t | config_mutex |
static struct ast_jb_conf | default_jbconf |
static const struct misdn_cfg_spec | gen_spec [] |
static union misdn_cfg_pt * | general_cfg |
static struct ast_jb_conf | global_jbconf |
static int * | map |
static int | max_ports |
static union misdn_cfg_pt ** | port_cfg |
static const struct misdn_cfg_spec | port_spec [] |
static const char | ports_description [] |
static int * | ptp |
chan_misdn configuration management
Definition in file misdn_config.c.
Definition at line 442 of file misdn_config.c.
Referenced by _build_general_config(), and _build_port_config().
#define GEN_CFG 1 |
Definition at line 47 of file misdn_config.c.
Referenced by _build_general_config(), get_cfg_position(), and misdn_cfg_get_elem().
#define NO_DEFAULT "<>" |
Definition at line 44 of file misdn_config.c.
Referenced by _fill_defaults(), and misdn_cfg_get_desc().
#define NONE 0 |
Definition at line 45 of file misdn_config.c.
Referenced by __sip_alloc(), __sip_autodestruct(), extensionstate_update(), handle_request_subscribe(), handle_response_notify(), show_channels_cb(), show_chanstats_cb(), sip_show_channel(), sip_show_history(), state_notify_build_xml(), and transmit_state_notify().
#define NUM_GEN_ELEMENTS (sizeof(gen_spec) / sizeof(struct misdn_cfg_spec)) |
Definition at line 49 of file misdn_config.c.
Referenced by _enum_array_map(), _fill_defaults(), _free_general_cfg(), get_cfg_position(), and misdn_cfg_init().
#define NUM_PORT_ELEMENTS (sizeof(port_spec) / sizeof(struct misdn_cfg_spec)) |
Definition at line 50 of file misdn_config.c.
Referenced by _enum_array_map(), _fill_defaults(), _free_port_cfg(), get_cfg_position(), and misdn_cfg_init().
#define PORT_CFG 2 |
Definition at line 48 of file misdn_config.c.
Referenced by _build_port_config(), get_cfg_position(), and misdn_cfg_get_elem().
enum misdn_cfg_type |
Enumerator | |
---|---|
MISDN_CTYPE_STR | |
MISDN_CTYPE_INT | |
MISDN_CTYPE_BOOL | |
MISDN_CTYPE_BOOLINT | |
MISDN_CTYPE_MSNLIST | |
MISDN_CTYPE_ASTGROUP | |
MISDN_CTYPE_ASTNAMEDGROUP |
Definition at line 65 of file misdn_config.c.
|
static |
Definition at line 1032 of file misdn_config.c.
References _parse(), ast_jb_read_conf(), misdn_cfg_spec::boolint_def, CLI_ERROR, GEN_CFG, get_cfg_position(), global_jbconf, ast_variable::name, ast_variable::next, misdn_cfg_spec::type, and ast_variable::value.
Referenced by misdn_cfg_init().
|
static |
Definition at line 1045 of file misdn_config.c.
References _parse(), ast_strdupa, misdn_cfg_spec::boolint_def, BUFFERSIZE, CLI_ERROR, end, get_cfg_position(), max_ports, ast_variable::name, ast_variable::next, PORT_CFG, ptp, strsep(), tmp(), misdn_cfg_spec::type, type, and ast_variable::value.
Referenced by misdn_cfg_init().
|
static |
Definition at line 447 of file misdn_config.c.
References ast_log, LOG_WARNING, map, MISDN_CFG_FIRST, MISDN_CFG_LAST, MISDN_CFG_PTP, MISDN_GEN_FIRST, MISDN_GEN_LAST, NUM_GEN_ELEMENTS, and NUM_PORT_ELEMENTS.
Referenced by misdn_cfg_init().
|
static |
Definition at line 1168 of file misdn_config.c.
References _parse(), misdn_cfg_pt::any, NO_DEFAULT, NUM_GEN_ELEMENTS, NUM_PORT_ELEMENTS, and type.
Referenced by misdn_cfg_init().
|
static |
Definition at line 560 of file misdn_config.c.
References misdn_cfg_pt::any, ast_free, and NUM_GEN_ELEMENTS.
Referenced by misdn_cfg_destroy(), and misdn_cfg_init().
|
static |
Definition at line 515 of file misdn_config.c.
References ast_free, msn_list::msn, and msn_list::next.
Referenced by _free_port_cfg().
|
static |
Definition at line 524 of file misdn_config.c.
References _free_msn_list(), misdn_cfg_pt::any, ast_free, ast_unref_namedgroups(), map, max_ports, MISDN_CFG_GROUPNAME, MISDN_CTYPE_ASTNAMEDGROUP, MISDN_CTYPE_MSNLIST, misdn_cfg_pt::ml, misdn_cfg_pt::namgrp, NUM_PORT_ELEMENTS, str, and type.
Referenced by misdn_cfg_destroy(), and misdn_cfg_init().
|
static |
Definition at line 952 of file misdn_config.c.
References ast_calloc, ast_free, ast_get_group(), ast_get_namedgroups(), ast_malloc, ast_strdupa, ast_true(), misdn_cfg_pt::grp, len(), MISDN_CTYPE_ASTGROUP, MISDN_CTYPE_ASTNAMEDGROUP, MISDN_CTYPE_BOOL, MISDN_CTYPE_BOOLINT, MISDN_CTYPE_INT, MISDN_CTYPE_MSNLIST, MISDN_CTYPE_STR, misdn_cfg_pt::ml, msn_list::msn, misdn_cfg_pt::namgrp, msn_list::next, misdn_cfg_pt::num, misdn_cfg_pt::str, strsep(), and tmp().
Referenced by _build_general_config(), _build_port_config(), and _fill_defaults().
|
static |
Definition at line 484 of file misdn_config.c.
References GEN_CFG, NUM_GEN_ELEMENTS, NUM_PORT_ELEMENTS, and PORT_CFG.
Referenced by _build_general_config(), _build_port_config(), and misdn_cfg_get_elem().
void misdn_cfg_destroy | ( | void | ) |
Definition at line 1187 of file misdn_config.c.
References _free_general_cfg(), _free_port_cfg(), ast_free, ast_mutex_destroy, map, misdn_cfg_lock(), misdn_cfg_unlock(), and ptp.
Referenced by unload_module().
void misdn_cfg_get | ( | int | port, |
enum misdn_cfg_elements | elem, | ||
void * | buf, | ||
int | bufsize | ||
) |
Definition at line 569 of file misdn_config.c.
References ast_copy_string(), ast_log, LOG_WARNING, map, misdn_cfg_is_port_valid(), MISDN_CFG_LAST, misdn_cfg_lock(), MISDN_CFG_PTP, misdn_cfg_unlock(), MISDN_CTYPE_ASTNAMEDGROUP, MISDN_CTYPE_STR, misdn_cfg_pt::namgrp, NULL, ptp, S_OR, str, and type.
Referenced by add_in_calls(), add_out_calls(), cb_events(), debug_numtype(), dialtone_indicate(), load_module(), misdn_add_number_prefix(), misdn_call(), misdn_cfg_update_ptp(), misdn_check_l2l1(), misdn_get_connected_line(), misdn_request(), misdn_set_opt_exec(), misdn_write(), process_ast_dsp(), read_config(), reload(), reload_config(), update_config(), and update_ec_config().
void misdn_cfg_get_config_string | ( | int | port, |
enum misdn_cfg_elements | elem, | ||
char * | buf, | ||
int | bufsize | ||
) |
Definition at line 805 of file misdn_config.c.
References ast_free, ast_log, ast_print_group(), ast_print_namedgroups(), ast_str_create, BUFFERSIZE, LOG_WARNING, map, MISDN_CFG_FIRST, misdn_cfg_is_port_valid(), MISDN_CFG_LAST, misdn_cfg_lock(), MISDN_CFG_PTP, misdn_cfg_unlock(), MISDN_CTYPE_ASTGROUP, MISDN_CTYPE_ASTNAMEDGROUP, MISDN_CTYPE_BOOL, MISDN_CTYPE_BOOLINT, MISDN_CTYPE_INT, MISDN_CTYPE_MSNLIST, MISDN_CTYPE_STR, MISDN_GEN_FIRST, MISDN_GEN_LAST, misdn_cfg_pt::ml, msn_list::msn, name, msn_list::next, ptp, str, and type.
Referenced by handle_cli_misdn_show_config().
void misdn_cfg_get_desc | ( | enum misdn_cfg_elements | elem, |
void * | buf, | ||
int | bufsize, | ||
void * | buf_default, | ||
int | bufsize_default | ||
) |
Definition at line 681 of file misdn_config.c.
References ast_copy_string(), misdn_cfg_spec::def, desc, misdn_cfg_spec::elem, map, MISDN_CFG_FIRST, MISDN_CFG_GROUPNAME, MISDN_CFG_LAST, MISDN_GEN_FIRST, MISDN_GEN_LAST, NO_DEFAULT, NULL, and ports_description.
Referenced by show_config_description().
enum misdn_cfg_elements misdn_cfg_get_elem | ( | const char * | name | ) |
Definition at line 634 of file misdn_config.c.
References misdn_cfg_spec::elem, GEN_CFG, get_cfg_position(), MISDN_CFG_FIRST, MISDN_CFG_GROUPNAME, and PORT_CFG.
Referenced by handle_cli_misdn_show_config().
void misdn_cfg_get_name | ( | enum misdn_cfg_elements | elem, |
void * | buf, | ||
int | bufsize | ||
) |
Definition at line 655 of file misdn_config.c.
References ast_copy_string(), misdn_cfg_spec::elem, map, MISDN_CFG_FIRST, MISDN_CFG_GROUPNAME, MISDN_CFG_LAST, MISDN_CFG_PTP, MISDN_GEN_FIRST, MISDN_GEN_LAST, name, and NULL.
Referenced by complete_show_config(), and show_config_description().
int misdn_cfg_get_next_port | ( | int | port | ) |
Definition at line 929 of file misdn_config.c.
References map, max_ports, MISDN_CFG_GROUPNAME, misdn_cfg_lock(), misdn_cfg_unlock(), and str.
Referenced by complete_show_config(), handle_cli_misdn_show_config(), handle_cli_misdn_show_ports_stats(), handle_cli_misdn_show_stacks(), load_module(), misdn_cfg_get_next_port_spin(), misdn_check_l2l1(), misdn_new(), misdn_request(), and update_name().
int misdn_cfg_get_next_port_spin | ( | int | port | ) |
Definition at line 946 of file misdn_config.c.
References misdn_cfg_get_next_port().
Referenced by misdn_request().
void misdn_cfg_get_ports_string | ( | char * | ports | ) |
Generate a comma separated list of all active ports.
Definition at line 779 of file misdn_config.c.
References map, max_ports, MISDN_CFG_GROUPNAME, misdn_cfg_lock(), misdn_cfg_unlock(), ptp, str, and tmp().
Referenced by load_module().
int misdn_cfg_init | ( | int | this_max_ports, |
int | reload | ||
) |
Definition at line 1203 of file misdn_config.c.
References _build_general_config(), _build_port_config(), _enum_array_map(), _fill_defaults(), _free_general_cfg(), _free_port_cfg(), ast_calloc, ast_category_browse(), ast_config_destroy(), ast_config_load2(), ast_log, ast_mutex_init, ast_variable_browse(), config, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, global_jbconf, LOG_WARNING, map, max_ports, misdn_cfg_lock(), misdn_cfg_unlock(), MISDN_GEN_LAST, NULL, NUM_GEN_ELEMENTS, NUM_PORT_ELEMENTS, and ptp.
Referenced by load_module(), and misdn_cfg_reload().
int misdn_cfg_is_group_method | ( | char * | group, |
enum misdn_cfg_method | meth | ||
) |
Definition at line 744 of file misdn_config.c.
References map, max_ports, method, METHOD_ROUND_ROBIN, METHOD_STANDARD, METHOD_STANDARD_DEC, MISDN_CFG_GROUPNAME, misdn_cfg_lock(), MISDN_CFG_METHOD, misdn_cfg_unlock(), misdn_cfg_pt::str, and str.
Referenced by misdn_request().
int misdn_cfg_is_msn_valid | ( | int | port, |
char * | msn | ||
) |
Definition at line 712 of file misdn_config.c.
References ast_extension_match(), ast_log, LOG_WARNING, map, misdn_cfg_is_port_valid(), misdn_cfg_lock(), MISDN_CFG_MSNS, misdn_cfg_unlock(), misdn_cfg_pt::ml, msn_list::msn, and msn_list::next.
Referenced by misdn_is_msn_valid().
int misdn_cfg_is_port_valid | ( | int | port | ) |
Definition at line 737 of file misdn_config.c.
References map, max_ports, MISDN_CFG_GROUPNAME, and str.
Referenced by handle_cli_misdn_show_config(), misdn_cfg_get(), misdn_cfg_get_config_string(), misdn_cfg_is_msn_valid(), and misdn_cfg_update_ptp().
|
inlinestatic |
Definition at line 505 of file misdn_config.c.
References ast_mutex_lock.
Referenced by misdn_cfg_destroy(), misdn_cfg_get(), misdn_cfg_get_config_string(), misdn_cfg_get_next_port(), misdn_cfg_get_ports_string(), misdn_cfg_init(), misdn_cfg_is_group_method(), misdn_cfg_is_msn_valid(), and misdn_cfg_update_ptp().
void misdn_cfg_reload | ( | void | ) |
Definition at line 1182 of file misdn_config.c.
References misdn_cfg_init().
Referenced by reload_config().
|
inlinestatic |
Definition at line 510 of file misdn_config.c.
References ast_mutex_unlock.
Referenced by misdn_cfg_destroy(), misdn_cfg_get(), misdn_cfg_get_config_string(), misdn_cfg_get_next_port(), misdn_cfg_get_ports_string(), misdn_cfg_init(), misdn_cfg_is_group_method(), misdn_cfg_is_msn_valid(), and misdn_cfg_update_ptp().
void misdn_cfg_update_ptp | ( | void | ) |
Definition at line 1113 of file misdn_config.c.
References ast_log, ast_strlen_zero, BUFFERSIZE, end, errno, LOG_WARNING, max_ports, misdn_cfg_get(), misdn_cfg_is_port_valid(), misdn_cfg_lock(), misdn_cfg_unlock(), MISDN_GEN_MISDN_INIT, NULL, and ptp.
Referenced by load_module(), and reload_config().
struct ast_jb_conf* misdn_get_global_jbconf | ( | void | ) |
Definition at line 1271 of file misdn_config.c.
References global_jbconf.
Referenced by misdn_new().
|
static |
Definition at line 440 of file misdn_config.c.
|
static |
Global jitterbuffer configuration - by default, jb is disabled
Definition at line 54 of file misdn_config.c.
|
static |
Definition at line 391 of file misdn_config.c.
|
static |
Definition at line 434 of file misdn_config.c.
|
static |
Definition at line 63 of file misdn_config.c.
Referenced by _build_general_config(), misdn_cfg_init(), and misdn_get_global_jbconf().
|
static |
Definition at line 438 of file misdn_config.c.
Referenced by _enum_array_map(), _free_port_cfg(), ast_realtime_append_mapping(), ast_realtime_is_mapping_defined(), build_mapping(), clear_config_maps(), dundi_show_mappings(), find_engine(), handle_cli_core_show_config_mappings(), last_message_index(), mark_mappings(), misdn_cfg_destroy(), misdn_cfg_get(), misdn_cfg_get_config_string(), misdn_cfg_get_desc(), misdn_cfg_get_name(), misdn_cfg_get_next_port(), misdn_cfg_get_ports_string(), misdn_cfg_init(), misdn_cfg_is_group_method(), misdn_cfg_is_msn_valid(), misdn_cfg_is_port_valid(), and prune_mappings().
|
static |
Definition at line 432 of file misdn_config.c.
Referenced by _build_port_config(), _free_port_cfg(), misdn_cfg_get_next_port(), misdn_cfg_get_ports_string(), misdn_cfg_init(), misdn_cfg_is_group_method(), misdn_cfg_is_port_valid(), and misdn_cfg_update_ptp().
|
static |
Definition at line 430 of file misdn_config.c.
|
static |
Definition at line 102 of file misdn_config.c.
|
static |
Definition at line 99 of file misdn_config.c.
Referenced by misdn_cfg_get_desc().
|
static |
Definition at line 436 of file misdn_config.c.
Referenced by _build_port_config(), misdn_cfg_destroy(), misdn_cfg_get(), misdn_cfg_get_config_string(), misdn_cfg_get_ports_string(), misdn_cfg_init(), misdn_cfg_update_ptp(), misdn_lib_init(), reload(), and stack_init().