Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Data Structures | Macros | Functions | Variables
options.c File Reference

Symbols related to asterisk.conf options and paths. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/app.h"
#include "asterisk/config.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/paths.h"
#include "asterisk/pbx.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/strings.h"
#include "asterisk/utils.h"
#include "../defaults.h"
#include "channelstorage.h"
#include <sys/time.h>
#include <sys/resource.h>
Include dependency graph for options.c:

Go to the source code of this file.

Data Structures

struct  _cfg_paths
 

Macros

#define AST_MIN_DTMF_DURATION   80
 
#define DEFAULT_MONITOR_DIR   DEFAULT_SPOOL_DIR "/monitor"
 
#define DEFAULT_RECORDING_DIR   DEFAULT_SPOOL_DIR "/recording"
 

Functions

void load_asterisk_conf (void)
 
void set_asterisk_conf_path (const char *path)
 
void set_socket_path (const char *path)
 
static void set_ulimit (int value)
 Set maximum open files. More...
 

Variables

const char * ast_config_AST_AGI_DIR = cfg_paths.agi_dir
 
const char * ast_config_AST_CACHE_DIR = cfg_paths.cache_dir
 
const char * ast_config_AST_CONFIG_DIR = cfg_paths.config_dir
 
const char * ast_config_AST_CONFIG_FILE = cfg_paths.config_file
 
const char * ast_config_AST_CTL = cfg_paths.ctl_file
 
const char * ast_config_AST_CTL_GROUP = cfg_paths.ctl_group
 
const char * ast_config_AST_CTL_OWNER = cfg_paths.ctl_owner
 
const char * ast_config_AST_CTL_PERMISSIONS = cfg_paths.ctl_perms
 
const char * ast_config_AST_DATA_DIR = cfg_paths.data_dir
 
const char * ast_config_AST_DB = cfg_paths.db_path
 
const char * ast_config_AST_KEY_DIR = cfg_paths.key_dir
 
const char * ast_config_AST_LOG_DIR = cfg_paths.log_dir
 
const char * ast_config_AST_MODULE_DIR = cfg_paths.module_dir
 
const char * ast_config_AST_MONITOR_DIR = cfg_paths.monitor_dir
 
const char * ast_config_AST_PID = cfg_paths.pid_path
 
const char * ast_config_AST_RECORDING_DIR = cfg_paths.recording_dir
 
const char * ast_config_AST_RUN_DIR = cfg_paths.run_dir
 
const char * ast_config_AST_RUN_GROUP = cfg_paths.run_group
 
const char * ast_config_AST_RUN_USER = cfg_paths.run_user
 
const char * ast_config_AST_SBIN_DIR = cfg_paths.sbin_dir
 
const char * ast_config_AST_SOCKET = cfg_paths.socket_path
 
const char * ast_config_AST_SPOOL_DIR = cfg_paths.spool_dir
 
const char * ast_config_AST_SYSTEM_NAME = cfg_paths.system_name
 
const char * ast_config_AST_VAR_DIR = cfg_paths.var_dir
 
char ast_defaultlanguage [MAX_LANGUAGE] = DEFAULT_LANGUAGE
 
struct ast_eid ast_eid_default
 Global EID. More...
 
int ast_option_maxcalls
 
int ast_option_maxfiles
 
double ast_option_maxload
 
int ast_option_pjproject_cache_pools
 
int ast_option_pjproject_log_level
 
unsigned int ast_option_rtpptdynamic = 35
 
int ast_option_rtpusedynamic = 1
 
struct ast_flags ast_options = { AST_DEFAULT_OPTIONS }
 
int ast_pjproject_max_log_level = -1
 
int ast_verb_sys_level
 
static struct _cfg_paths cfg_paths
 
int option_debug
 
unsigned int option_dtmfminduration = AST_MIN_DTMF_DURATION
 
long option_minmemfree
 
int option_trace
 
int option_verbose
 
char record_cache_dir [AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR
 

Detailed Description

Symbols related to asterisk.conf options and paths.

Author
Corey Farrell git@c.nosp@m.fwar.nosp@m.e.com

Definition in file options.c.

Macro Definition Documentation

◆ AST_MIN_DTMF_DURATION

#define AST_MIN_DTMF_DURATION   80

Default minimum DTMF digit length - 80ms

Definition at line 50 of file options.c.

◆ DEFAULT_MONITOR_DIR

#define DEFAULT_MONITOR_DIR   DEFAULT_SPOOL_DIR "/monitor"

Definition at line 52 of file options.c.

◆ DEFAULT_RECORDING_DIR

#define DEFAULT_RECORDING_DIR   DEFAULT_SPOOL_DIR "/recording"

Definition at line 53 of file options.c.

Function Documentation

◆ load_asterisk_conf()

void load_asterisk_conf ( void  )

Definition at line 211 of file options.c.

212{
213 struct ast_config *cfg;
214 struct ast_variable *v;
215 char hostname[MAXHOSTNAMELEN] = "";
216 struct ast_flags config_flags = { CONFIG_FLAG_NOREALTIME };
217 struct {
218 unsigned int dbdir:1;
219 unsigned int keydir:1;
220 } found = { 0, 0 };
221 /* Default to false for security */
222 int live_dangerously = 0;
223 int option_debug_new = 0;
224 int option_trace_new = 0;
225 int option_verbose_new = 0;
226
227 /* init with buildtime config */
228#ifdef REF_DEBUG
229 /* The REF_DEBUG compiler flag is now only used to enable refdebug by default.
230 * Support for debugging reference counts is always compiled in. */
232#endif
233
235
236 cfg = ast_config_load2(ast_config_AST_CONFIG_FILE, "" /* core, can't reload */, config_flags);
237
238 /* If AST_OPT_FLAG_EXEC_INCLUDES was previously enabled with -X turn it off now.
239 * Using #exec from other configs requires that it be enabled from asterisk.conf. */
241
242 /* no asterisk.conf? no problem, use buildtime config! */
244 fprintf(stderr, "Unable to open specified master config file '%s', using built-in defaults\n", ast_config_AST_CONFIG_FILE);
245 return;
246 }
247
248 for (v = ast_variable_browse(cfg, "files"); v; v = v->next) {
249 if (!strcasecmp(v->name, "astctlpermissions")) {
251 } else if (!strcasecmp(v->name, "astctlowner")) {
253 } else if (!strcasecmp(v->name, "astctlgroup")) {
255 } else if (!strcasecmp(v->name, "astctl")) {
257 }
258 }
259
260 for (v = ast_variable_browse(cfg, "directories"); v; v = v->next) {
261 if (!strcasecmp(v->name, "astcachedir")) {
263 } else if (!strcasecmp(v->name, "astetcdir")) {
265 } else if (!strcasecmp(v->name, "astspooldir")) {
267 snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", v->value);
268 snprintf(cfg_paths.recording_dir, sizeof(cfg_paths.recording_dir), "%s/recording", v->value);
269 } else if (!strcasecmp(v->name, "astvarlibdir")) {
271 if (!found.dbdir) {
272 snprintf(cfg_paths.db_path, sizeof(cfg_paths.db_path), "%s/astdb", v->value);
273 }
274 } else if (!strcasecmp(v->name, "astdbdir")) {
275 snprintf(cfg_paths.db_path, sizeof(cfg_paths.db_path), "%s/astdb", v->value);
276 found.dbdir = 1;
277 } else if (!strcasecmp(v->name, "astdatadir")) {
279 if (!found.keydir) {
280 snprintf(cfg_paths.key_dir, sizeof(cfg_paths.key_dir), "%s/keys", v->value);
281 }
282 } else if (!strcasecmp(v->name, "astkeydir")) {
283 snprintf(cfg_paths.key_dir, sizeof(cfg_paths.key_dir), "%s/keys", v->value);
284 found.keydir = 1;
285 } else if (!strcasecmp(v->name, "astlogdir")) {
287 } else if (!strcasecmp(v->name, "astagidir")) {
289 } else if (!strcasecmp(v->name, "astrundir")) {
290 snprintf(cfg_paths.pid_path, sizeof(cfg_paths.pid_path), "%s/%s", v->value, "asterisk.pid");
292 } else if (!strcasecmp(v->name, "astmoddir")) {
294 } else if (!strcasecmp(v->name, "astsbindir")) {
296 }
297 }
298
299 /* Combine astrundir and astctl settings. */
300 snprintf(cfg_paths.socket_path, sizeof(cfg_paths.socket_path), "%s/%s",
302
303 for (v = ast_variable_browse(cfg, "options"); v; v = v->next) {
304 /* verbose level (-v at startup) */
305 if (!strcasecmp(v->name, "verbose")) {
306 option_verbose_new = atoi(v->value);
307 /* whether or not to force timestamping in CLI verbose output. (-T at startup) */
308 } else if (!strcasecmp(v->name, "timestamp")) {
310 /* whether or not to support #exec in config files */
311 } else if (!strcasecmp(v->name, "execincludes")) {
313 /* debug level (-d at startup) */
314 } else if (!strcasecmp(v->name, "debug")) {
315 option_debug_new = 0;
316 if (sscanf(v->value, "%30d", &option_debug_new) != 1) {
317 option_debug_new = ast_true(v->value) ? 1 : 0;
318 }
319 } else if (!strcasecmp(v->name, "trace")) {
320 option_trace_new = 0;
321 if (sscanf(v->value, "%30d", &option_trace_new) != 1) {
322 option_trace_new = ast_true(v->value) ? 1 : 0;
323 }
324 } else if (!strcasecmp(v->name, "refdebug")) {
326#if HAVE_WORKING_FORK
327 /* Disable forking (-f at startup) */
328 } else if (!strcasecmp(v->name, "nofork")) {
330 /* Always fork, even if verbose or debug are enabled (-F at startup) */
331 } else if (!strcasecmp(v->name, "alwaysfork")) {
333#endif
334 /* Run quietly (-q at startup ) */
335 } else if (!strcasecmp(v->name, "quiet")) {
337 /* Run as console (-c at startup, implies nofork) */
338 } else if (!strcasecmp(v->name, "console")) {
339 if (!ast_opt_remote) {
341 }
342 /* Run with high priority if the O/S permits (-p at startup) */
343 } else if (!strcasecmp(v->name, "highpriority")) {
345 /* Initialize RSA auth keys (IAX2) (-i at startup) */
346 } else if (!strcasecmp(v->name, "initcrypto")) {
348 /* Disable ANSI colors for console (-c at startup) */
349 } else if (!strcasecmp(v->name, "nocolor")) {
351 /* Disable some usage warnings for picky people :p */
352 } else if (!strcasecmp(v->name, "dontwarn")) {
354 /* Dump core in case of crash (-g) */
355 } else if (!strcasecmp(v->name, "dumpcore")) {
357 /* Cache recorded sound files to another directory during recording */
358 } else if (!strcasecmp(v->name, "cache_record_files")) {
360#if !defined(LOW_MEMORY)
361 /* Cache media frames for performance */
362 } else if (!strcasecmp(v->name, "cache_media_frames")) {
364#endif
365 /* Specify cache directory */
366 } else if (!strcasecmp(v->name, "record_cache_dir")) {
368 /* Build transcode paths via SLINEAR, instead of directly */
369 } else if (!strcasecmp(v->name, "transcode_via_sln")) {
371 /* Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated on a channel */
372 } else if (!strcasecmp(v->name, "transmit_silence_during_record") || !strcasecmp(v->name, "transmit_silence")) {
374 } else if (!strcasecmp(v->name, "mindtmfduration")) {
375 if (sscanf(v->value, "%30u", &option_dtmfminduration) != 1) {
377 }
378 } else if (!strcasecmp(v->name, "rtp_use_dynamic")) {
380 /* http://www.iana.org/assignments/rtp-parameters
381 * RTP dynamic payload types start at 96 normally; extend down to 0 */
382 } else if (!strcasecmp(v->name, "rtp_pt_dynamic")) {
385 } else if (!strcasecmp(v->name, "maxcalls")) {
386 if ((sscanf(v->value, "%30d", &ast_option_maxcalls) != 1) || (ast_option_maxcalls < 0)) {
388 }
389 } else if (!strcasecmp(v->name, "maxload")) {
390 double test[1];
391
392 if (getloadavg(test, 1) == -1) {
393 ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n");
394 ast_option_maxload = 0.0;
395 } else if ((sscanf(v->value, "%30lf", &ast_option_maxload) != 1) || (ast_option_maxload < 0.0)) {
396 ast_option_maxload = 0.0;
397 }
398 /* Set the maximum amount of open files */
399 } else if (!strcasecmp(v->name, "maxfiles")) {
400 ast_option_maxfiles = atoi(v->value);
401 if (!ast_opt_remote) {
403 }
404 /* What user to run as */
405 } else if (!strcasecmp(v->name, "runuser")) {
407 /* What group to run as */
408 } else if (!strcasecmp(v->name, "rungroup")) {
410 } else if (!strcasecmp(v->name, "systemname")) {
412 } else if (!strcasecmp(v->name, "autosystemname")) {
413 if (ast_true(v->value)) {
414 if (!gethostname(hostname, sizeof(hostname) - 1)) {
416 } else {
419 }
420 ast_log(LOG_ERROR, "Cannot obtain hostname for this system. Using '%s' instead.\n", ast_config_AST_SYSTEM_NAME);
421 }
422 }
423 } else if (!strcasecmp(v->name, "languageprefix")) {
425 } else if (!strcasecmp(v->name, "defaultlanguage")) {
427 } else if (!strcasecmp(v->name, "lockmode")) {
428 if (!strcasecmp(v->value, "lockfile")) {
430 } else if (!strcasecmp(v->value, "flock")) {
432 } else {
433 ast_log(LOG_WARNING, "'%s' is not a valid setting for the lockmode option, "
434 "defaulting to 'lockfile'\n", v->value);
436 }
437#if defined(HAVE_SYSINFO)
438 } else if (!strcasecmp(v->name, "minmemfree")) {
439 /* specify the minimum amount of free memory to retain. Asterisk should stop accepting new calls
440 * if the amount of free memory falls below this watermark */
441 if ((sscanf(v->value, "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
443 }
444#endif
445 } else if (!strcasecmp(v->name, "entityid")) {
446 struct ast_eid tmp_eid;
447 if (!ast_str_to_eid(&tmp_eid, v->value)) {
448 ast_eid_default = tmp_eid;
449 } else {
450 ast_log(LOG_WARNING, "Invalid Entity ID '%s' provided\n", v->value);
451 }
452 } else if (!strcasecmp(v->name, "lightbackground")) {
454 } else if (!strcasecmp(v->name, "forceblackbackground")) {
456 } else if (!strcasecmp(v->name, "hideconnect")) {
458 } else if (!strcasecmp(v->name, "lockconfdir")) {
460 } else if (!strcasecmp(v->name, "stdexten")) {
461 /* Choose how to invoke the extensions.conf stdexten */
462 if (!strcasecmp(v->value, "gosub")) {
464 } else if (!strcasecmp(v->value, "macro")) {
466 } else {
468 "'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n",
469 v->value);
471 }
472 } else if (!strcasecmp(v->name, "live_dangerously")) {
474 } else if (!strcasecmp(v->name, "hide_messaging_ami_events")) {
476 } else if (!strcasecmp(v->name, "sounds_search_custom_dir")) {
478 } else if (!strcasecmp(v->name, "channel_storage_backend")) {
480 }
481 }
482 if (!ast_opt_remote) {
485 }
486
487 option_debug += option_debug_new;
488 option_trace += option_trace_new;
489 option_verbose += option_verbose_new;
490
492}
int getloadavg(double *list, int nelem)
#define ast_log
Definition: astobj2.c:42
int internal_channel_set_current_storage_driver(const char *driver_name)
Definition: channel.c:7984
#define MAX_LANGUAGE
Definition: channel.h:174
static int live_dangerously
Set to true (non-zero) to globally allow all dangerous AMI actions to run.
Definition: manager.c:200
void astman_live_dangerously(int new_live_dangerously)
Enable/disable the inclusion of 'dangerous' configurations outside of the ast_config_AST_CONFIG_DIR.
Definition: manager.c:2447
int ast_option_rtpusedynamic
Definition: options.c:89
int ast_option_maxfiles
Definition: options.c:82
int option_debug
Definition: options.c:70
int ast_option_maxcalls
Definition: options.c:80
double ast_option_maxload
Definition: options.c:78
unsigned int ast_option_rtpptdynamic
Definition: options.c:90
int option_verbose
Definition: options.c:68
struct ast_flags ast_options
Definition: options.c:62
unsigned int option_dtmfminduration
Definition: options.c:84
long option_minmemfree
Definition: options.c:87
int option_trace
Definition: options.c:72
@ AST_OPT_FLAG_HIGH_PRIORITY
Definition: options.h:49
@ AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS
Definition: options.h:93
@ AST_OPT_FLAG_TRANSCODE_VIA_SLIN
Definition: options.h:61
@ AST_OPT_FLAG_HIDE_CONSOLE_CONNECT
Definition: options.h:97
@ AST_OPT_FLAG_EXEC_INCLUDES
Definition: options.h:41
@ AST_OPT_FLAG_NO_COLOR
Definition: options.h:57
@ AST_OPT_FLAG_NO_FORK
Definition: options.h:43
@ AST_OPT_FLAG_REF_DEBUG
Definition: options.h:81
@ AST_OPT_FLAG_TRANSMIT_SILENCE
Definition: options.h:75
@ AST_OPT_FLAG_ALWAYS_FORK
Definition: options.h:83
@ AST_OPT_FLAG_QUIET
Definition: options.h:45
@ AST_OPT_FLAG_STDEXTEN_MACRO
Definition: options.h:63
@ AST_OPT_FLAG_CACHE_MEDIA_FRAMES
Definition: options.h:71
@ AST_OPT_FLAG_TIMESTAMP
Definition: options.h:69
@ AST_OPT_FLAG_LOCK_CONFIG_DIR
Definition: options.h:99
@ AST_OPT_FLAG_CACHE_RECORD_FILES
Definition: options.h:67
@ AST_OPT_FLAG_INIT_KEYS
Definition: options.h:51
@ AST_OPT_FLAG_CONSOLE
Definition: options.h:47
@ AST_OPT_FLAG_DONT_WARN
Definition: options.h:77
@ AST_OPT_FLAG_FORCE_BLACK_BACKGROUND
Definition: options.h:95
@ AST_OPT_FLAG_LIGHT_BACKGROUND
Definition: options.h:91
@ AST_OPT_FLAG_DUMP_CORE
Definition: options.h:65
@ AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM
Definition: options.h:79
@ AST_LOCK_TYPE_LOCKFILE
@ AST_LOCK_TYPE_FLOCK
void ast_set_lock_type(enum AST_LOCK_TYPE type)
Set the type of locks used by ast_lock_path()
Definition: main/app.c:2609
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
Definition: main/config.c:3541
#define CONFIG_STATUS_FILEMISSING
@ CONFIG_FLAG_NOREALTIME
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
Definition: main/config.c:4047
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
Definition: extconf.c:1289
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
Definition: extconf.c:1215
#define LOG_ERROR
#define LOG_WARNING
static char hostname[MAXHOSTNAMELEN]
Definition: logger.c:116
#define MAXHOSTNAMELEN
Definition: network.h:69
static struct _cfg_paths cfg_paths
Definition: options.c:129
char record_cache_dir[AST_CACHE_DIR_LEN]
Definition: options.c:97
#define AST_MIN_DTMF_DURATION
Definition: options.c:50
const char * ast_config_AST_RUN_DIR
Definition: options.c:163
char ast_defaultlanguage[MAX_LANGUAGE]
Definition: options.c:99
const char * ast_config_AST_SYSTEM_NAME
Definition: options.c:171
struct ast_eid ast_eid_default
Global EID.
Definition: options.c:94
const char * ast_config_AST_CONFIG_FILE
Definition: options.c:153
static void set_ulimit(int value)
Set maximum open files.
Definition: options.c:179
const char * ast_config_AST_CTL
Definition: options.c:176
#define ast_opt_remote
Definition: options.h:115
int ast_language_is_prefix
The following variable controls the layout of localized sound files. If 0, use the historical layout ...
Definition: file.c:67
#define AST_CACHE_DIR_LEN
Definition: options.h:32
void pbx_live_dangerously(int new_live_dangerously)
Enable/disable the execution of 'dangerous' functions from external protocols (AMI,...
#define AST_RTP_PT_FIRST_DYNAMIC
Definition: rtp_engine.h:92
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition: utils.c:2199
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
char system_name[128]
Definition: options.c:122
char monitor_dir[PATH_MAX]
Definition: options.c:106
char ctl_perms[PATH_MAX]
Definition: options.c:123
char run_dir[PATH_MAX]
Definition: options.c:112
char config_dir[PATH_MAX]
Definition: options.c:103
char log_dir[PATH_MAX]
Definition: options.c:110
char key_dir[PATH_MAX]
Definition: options.c:113
char pid_path[PATH_MAX]
Definition: options.c:118
char sbin_dir[PATH_MAX]
Definition: options.c:117
char spool_dir[PATH_MAX]
Definition: options.c:105
char recording_dir[PATH_MAX]
Definition: options.c:107
char var_dir[PATH_MAX]
Definition: options.c:108
char ctl_group[PATH_MAX]
Definition: options.c:125
char run_group[PATH_MAX]
Definition: options.c:121
char data_dir[PATH_MAX]
Definition: options.c:109
char ctl_owner[PATH_MAX]
Definition: options.c:124
char socket_path[PATH_MAX]
Definition: options.c:119
char ctl_file[PATH_MAX]
Definition: options.c:126
char cache_dir[PATH_MAX]
Definition: options.c:102
char db_path[PATH_MAX]
Definition: options.c:116
char run_user[PATH_MAX]
Definition: options.c:120
char module_dir[PATH_MAX]
Definition: options.c:104
char agi_dir[PATH_MAX]
Definition: options.c:111
An Entity ID is essentially a MAC address, brief and unique.
Definition: utils.h:813
Structure used to handle boolean flags.
Definition: utils.h:199
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
void ast_set_default_eid(struct ast_eid *eid)
Fill in an ast_eid with the default eid of this machine.
Definition: utils.c:3001
#define ast_set2_flag(p, value, flag)
Definition: utils.h:94
#define ast_clear_flag(p, flag)
Definition: utils.h:77
#define ast_set_flag(p, flag)
Definition: utils.h:70
int ast_str_to_eid(struct ast_eid *eid, const char *s)
Convert a string into an EID.
Definition: utils.c:3077

References _cfg_paths::agi_dir, AST_CACHE_DIR_LEN, ast_clear_flag, ast_config_AST_CONFIG_FILE, ast_config_AST_CTL, ast_config_AST_RUN_DIR, ast_config_AST_SYSTEM_NAME, ast_config_destroy(), ast_config_load2(), ast_copy_string(), ast_defaultlanguage, ast_eid_default, ast_language_is_prefix, AST_LOCK_TYPE_FLOCK, AST_LOCK_TYPE_LOCKFILE, ast_log, AST_MIN_DTMF_DURATION, AST_OPT_FLAG_ALWAYS_FORK, AST_OPT_FLAG_CACHE_MEDIA_FRAMES, AST_OPT_FLAG_CACHE_RECORD_FILES, AST_OPT_FLAG_CONSOLE, AST_OPT_FLAG_DONT_WARN, AST_OPT_FLAG_DUMP_CORE, AST_OPT_FLAG_EXEC_INCLUDES, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT, AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS, AST_OPT_FLAG_HIGH_PRIORITY, AST_OPT_FLAG_INIT_KEYS, AST_OPT_FLAG_LIGHT_BACKGROUND, AST_OPT_FLAG_LOCK_CONFIG_DIR, AST_OPT_FLAG_NO_COLOR, AST_OPT_FLAG_NO_FORK, AST_OPT_FLAG_QUIET, AST_OPT_FLAG_REF_DEBUG, AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM, AST_OPT_FLAG_STDEXTEN_MACRO, AST_OPT_FLAG_TIMESTAMP, AST_OPT_FLAG_TRANSCODE_VIA_SLIN, AST_OPT_FLAG_TRANSMIT_SILENCE, ast_opt_remote, ast_option_maxcalls, ast_option_maxfiles, ast_option_maxload, ast_option_rtpptdynamic, ast_option_rtpusedynamic, ast_options, ast_parse_arg(), AST_RTP_PT_FIRST_DYNAMIC, ast_set2_flag, ast_set_default_eid(), ast_set_flag, ast_set_lock_type(), ast_str_to_eid(), ast_strlen_zero(), ast_true(), ast_variable_browse(), astman_live_dangerously(), _cfg_paths::cache_dir, cfg_paths, _cfg_paths::config_dir, CONFIG_FLAG_NOREALTIME, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, _cfg_paths::ctl_file, _cfg_paths::ctl_group, _cfg_paths::ctl_owner, _cfg_paths::ctl_perms, _cfg_paths::data_dir, _cfg_paths::db_path, getloadavg(), hostname, internal_channel_set_current_storage_driver(), _cfg_paths::key_dir, live_dangerously, _cfg_paths::log_dir, LOG_ERROR, LOG_WARNING, MAX_LANGUAGE, MAXHOSTNAMELEN, _cfg_paths::module_dir, _cfg_paths::monitor_dir, ast_variable::name, ast_variable::next, option_debug, option_dtmfminduration, option_minmemfree, option_trace, option_verbose, PARSE_IN_RANGE, PARSE_UINT32, pbx_live_dangerously(), _cfg_paths::pid_path, record_cache_dir, _cfg_paths::recording_dir, _cfg_paths::run_dir, _cfg_paths::run_group, _cfg_paths::run_user, _cfg_paths::sbin_dir, set_ulimit(), _cfg_paths::socket_path, _cfg_paths::spool_dir, _cfg_paths::system_name, ast_variable::value, and _cfg_paths::var_dir.

Referenced by main().

◆ set_asterisk_conf_path()

void set_asterisk_conf_path ( const char *  path)

Definition at line 201 of file options.c.

202{
204}
char config_file[PATH_MAX]
Definition: options.c:115

References ast_copy_string(), cfg_paths, and _cfg_paths::config_file.

Referenced by main().

◆ set_socket_path()

void set_socket_path ( const char *  path)

Definition at line 206 of file options.c.

207{
209}

References ast_copy_string(), cfg_paths, and _cfg_paths::socket_path.

Referenced by main().

◆ set_ulimit()

static void set_ulimit ( int  value)
static

Set maximum open files.

Definition at line 179 of file options.c.

180{
181 struct rlimit l = {0, 0};
182
183 if (value <= 0) {
184 ast_log(LOG_WARNING, "Unable to change max files open to invalid value %i\n",value);
185 return;
186 }
187
188 l.rlim_cur = value;
189 l.rlim_max = value;
190
191 if (setrlimit(RLIMIT_NOFILE, &l)) {
192 ast_log(LOG_WARNING, "Unable to disable core size resource limit: %s\n",strerror(errno));
193 return;
194 }
195
196 ast_log(LOG_NOTICE, "Setting max files open to %d\n",value);
197
198 return;
199}
#define LOG_NOTICE
int errno
int value
Definition: syslog.c:37

References ast_log, errno, LOG_NOTICE, LOG_WARNING, and value.

Referenced by load_asterisk_conf().

Variable Documentation

◆ ast_config_AST_AGI_DIR

const char* ast_config_AST_AGI_DIR = cfg_paths.agi_dir

Definition at line 161 of file options.c.

Referenced by ast_str_retrieve_variable(), handle_show_settings(), and launch_script().

◆ ast_config_AST_CACHE_DIR

const char* ast_config_AST_CACHE_DIR = cfg_paths.cache_dir

◆ ast_config_AST_CONFIG_DIR

const char* ast_config_AST_CONFIG_DIR = cfg_paths.config_dir

Definition at line 152 of file options.c.

◆ ast_config_AST_CONFIG_FILE

const char* ast_config_AST_CONFIG_FILE = cfg_paths.config_file

Definition at line 153 of file options.c.

Referenced by handle_show_settings(), launch_script(), and load_asterisk_conf().

◆ ast_config_AST_CTL

const char* ast_config_AST_CTL = cfg_paths.ctl_file

Definition at line 176 of file options.c.

Referenced by load_asterisk_conf().

◆ ast_config_AST_CTL_GROUP

const char* ast_config_AST_CTL_GROUP = cfg_paths.ctl_group

Definition at line 175 of file options.c.

Referenced by ast_makesocket().

◆ ast_config_AST_CTL_OWNER

const char* ast_config_AST_CTL_OWNER = cfg_paths.ctl_owner

Definition at line 174 of file options.c.

Referenced by ast_makesocket().

◆ ast_config_AST_CTL_PERMISSIONS

const char* ast_config_AST_CTL_PERMISSIONS = cfg_paths.ctl_perms

Definition at line 173 of file options.c.

Referenced by ast_makesocket().

◆ ast_config_AST_DATA_DIR

const char* ast_config_AST_DATA_DIR = cfg_paths.data_dir

◆ ast_config_AST_DB

const char* ast_config_AST_DB = cfg_paths.db_path

Definition at line 166 of file options.c.

Referenced by ast_str_retrieve_variable(), db_open(), and handle_show_settings().

◆ ast_config_AST_KEY_DIR

const char* ast_config_AST_KEY_DIR = cfg_paths.key_dir

◆ ast_config_AST_LOG_DIR

const char* ast_config_AST_LOG_DIR = cfg_paths.log_dir

◆ ast_config_AST_MODULE_DIR

const char* ast_config_AST_MODULE_DIR = cfg_paths.module_dir

◆ ast_config_AST_MONITOR_DIR

const char* ast_config_AST_MONITOR_DIR = cfg_paths.monitor_dir

Definition at line 156 of file options.c.

Referenced by chanspy_exec(), extenspy_exec(), filename_parse(), and launch_script().

◆ ast_config_AST_PID

const char* ast_config_AST_PID = cfg_paths.pid_path

Definition at line 167 of file options.c.

Referenced by asterisk_daemon(), handle_show_settings(), and really_quit().

◆ ast_config_AST_RECORDING_DIR

const char* ast_config_AST_RECORDING_DIR = cfg_paths.recording_dir

◆ ast_config_AST_RUN_DIR

const char* ast_config_AST_RUN_DIR = cfg_paths.run_dir

◆ ast_config_AST_RUN_GROUP

const char* ast_config_AST_RUN_GROUP = cfg_paths.run_group

◆ ast_config_AST_RUN_USER

const char* ast_config_AST_RUN_USER = cfg_paths.run_user

◆ ast_config_AST_SBIN_DIR

const char* ast_config_AST_SBIN_DIR = cfg_paths.sbin_dir

Definition at line 164 of file options.c.

Referenced by ast_str_retrieve_variable(), and asterisk_daemon().

◆ ast_config_AST_SOCKET

const char* ast_config_AST_SOCKET = cfg_paths.socket_path

Definition at line 168 of file options.c.

Referenced by ast_makesocket(), ast_tryconnect(), ast_var_Config(), main(), and really_quit().

◆ ast_config_AST_SPOOL_DIR

const char* ast_config_AST_SPOOL_DIR = cfg_paths.spool_dir

◆ ast_config_AST_SYSTEM_NAME

const char* ast_config_AST_SYSTEM_NAME = cfg_paths.system_name

◆ ast_config_AST_VAR_DIR

const char* ast_config_AST_VAR_DIR = cfg_paths.var_dir

Definition at line 158 of file options.c.

◆ ast_defaultlanguage

char ast_defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE

◆ ast_eid_default

struct ast_eid ast_eid_default

◆ cfg_paths

struct _cfg_paths cfg_paths
static

Definition at line 129 of file options.c.

Referenced by load_asterisk_conf(), set_asterisk_conf_path(), and set_socket_path().

◆ record_cache_dir

char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR

Definition at line 97 of file options.c.

Referenced by ast_writefile(), and load_asterisk_conf().