Asterisk - The Open Source Telephony Project  21.4.1
options.c
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2018, CFWare, LLC
5  *
6  * Corey Farrell <git@cfware.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  *
21  * \brief Symbols related to asterisk.conf options and paths.
22  *
23  * \author Corey Farrell <git@cfware.com>
24  */
25 
26 /*** MODULEINFO
27  <support_level>core</support_level>
28  ***/
29 
30 #include "asterisk.h"
31 #include "asterisk/_private.h"
32 #include "asterisk/app.h"
33 #include "asterisk/config.h"
34 #include "asterisk/logger.h"
35 #include "asterisk/options.h"
36 #include "asterisk/paths.h"
37 #include "asterisk/pbx.h"
38 #include "asterisk/rtp_engine.h"
39 #include "asterisk/strings.h"
40 #include "asterisk/utils.h"
41 
42 #include "../defaults.h"
43 
44 #include <sys/time.h>
45 #include <sys/resource.h>
46 
47 
48 /*! Default minimum DTMF digit length - 80ms */
49 #define AST_MIN_DTMF_DURATION 80
50 
51 #define DEFAULT_MONITOR_DIR DEFAULT_SPOOL_DIR "/monitor"
52 #define DEFAULT_RECORDING_DIR DEFAULT_SPOOL_DIR "/recording"
53 
54 /*! \defgroup main_options Main Configuration Options
55  * \brief Main configuration options from asterisk.conf or OS command line on starting Asterisk.
56  * \arg \ref asterisk.conf "Config_ast"
57  * \note Some of them can be changed in the CLI
58  */
59 /*! @{ */
60 
61 struct ast_flags ast_options = { AST_DEFAULT_OPTIONS };
62 
63 /*! Maximum active system verbosity level. */
65 
66 /*! Verbosity level */
68 /*! Debug level */
70 /*! Trace level */
72 /*! Default to -1 to know if we have read the level from pjproject yet. */
76 /*! Max load avg on system */
78 /*! Max number of active calls */
80 /*! Max number of open file handles (files, sockets) */
82 /*! Minimum duration of DTMF. */
84 #if defined(HAVE_SYSINFO)
85 /*! Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
87 #endif
88 int ast_option_rtpusedynamic = 1;
89 unsigned int ast_option_rtpptdynamic = 35;
90 
91 /*! @} */
92 
94 
95 /* XXX tmpdir is a subdir of the spool directory, and no way to remap it */
96 char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR;
97 
98 char ast_defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
99 
100 struct _cfg_paths {
101  char cache_dir[PATH_MAX];
102  char config_dir[PATH_MAX];
103  char module_dir[PATH_MAX];
104  char spool_dir[PATH_MAX];
105  char monitor_dir[PATH_MAX];
106  char recording_dir[PATH_MAX];
107  char var_dir[PATH_MAX];
108  char data_dir[PATH_MAX];
109  char log_dir[PATH_MAX];
110  char agi_dir[PATH_MAX];
111  char run_dir[PATH_MAX];
112  char key_dir[PATH_MAX];
113 
114  char config_file[PATH_MAX];
115  char db_path[PATH_MAX];
116  char sbin_dir[PATH_MAX];
117  char pid_path[PATH_MAX];
118  char socket_path[PATH_MAX];
119  char run_user[PATH_MAX];
120  char run_group[PATH_MAX];
121  char system_name[128];
122  char ctl_perms[PATH_MAX];
123  char ctl_owner[PATH_MAX];
124  char ctl_group[PATH_MAX];
125  char ctl_file[PATH_MAX];
126 };
127 
128 static struct _cfg_paths cfg_paths = {
129  .cache_dir = DEFAULT_CACHE_DIR,
130  .config_dir = DEFAULT_CONFIG_DIR,
131  .module_dir = DEFAULT_MODULE_DIR,
132  .spool_dir = DEFAULT_SPOOL_DIR,
133  .monitor_dir = DEFAULT_MONITOR_DIR,
134  .recording_dir = DEFAULT_RECORDING_DIR,
135  .var_dir = DEFAULT_VAR_DIR,
136  .data_dir = DEFAULT_DATA_DIR,
137  .log_dir = DEFAULT_LOG_DIR,
138  .agi_dir = DEFAULT_AGI_DIR,
139  .run_dir = DEFAULT_RUN_DIR,
140  .key_dir = DEFAULT_KEY_DIR,
141 
142  .config_file = DEFAULT_CONFIG_FILE,
143  .db_path = DEFAULT_DB,
144  .sbin_dir = DEFAULT_SBIN_DIR,
145  .pid_path = DEFAULT_PID,
146  .socket_path = DEFAULT_SOCKET,
147  .ctl_file = "asterisk.ctl",
148 };
149 
150 const char *ast_config_AST_CACHE_DIR = cfg_paths.cache_dir;
151 const char *ast_config_AST_CONFIG_DIR = cfg_paths.config_dir;
152 const char *ast_config_AST_CONFIG_FILE = cfg_paths.config_file;
153 const char *ast_config_AST_MODULE_DIR = cfg_paths.module_dir;
154 const char *ast_config_AST_SPOOL_DIR = cfg_paths.spool_dir;
155 const char *ast_config_AST_MONITOR_DIR = cfg_paths.monitor_dir;
156 const char *ast_config_AST_RECORDING_DIR = cfg_paths.recording_dir;
157 const char *ast_config_AST_VAR_DIR = cfg_paths.var_dir;
158 const char *ast_config_AST_DATA_DIR = cfg_paths.data_dir;
159 const char *ast_config_AST_LOG_DIR = cfg_paths.log_dir;
160 const char *ast_config_AST_AGI_DIR = cfg_paths.agi_dir;
161 const char *ast_config_AST_KEY_DIR = cfg_paths.key_dir;
162 const char *ast_config_AST_RUN_DIR = cfg_paths.run_dir;
163 const char *ast_config_AST_SBIN_DIR = cfg_paths.sbin_dir;
164 
165 const char *ast_config_AST_DB = cfg_paths.db_path;
166 const char *ast_config_AST_PID = cfg_paths.pid_path;
167 const char *ast_config_AST_SOCKET = cfg_paths.socket_path;
168 const char *ast_config_AST_RUN_USER = cfg_paths.run_user;
169 const char *ast_config_AST_RUN_GROUP = cfg_paths.run_group;
170 const char *ast_config_AST_SYSTEM_NAME = cfg_paths.system_name;
171 
172 const char *ast_config_AST_CTL_PERMISSIONS = cfg_paths.ctl_perms;
173 const char *ast_config_AST_CTL_OWNER = cfg_paths.ctl_owner;
174 const char *ast_config_AST_CTL_GROUP = cfg_paths.ctl_group;
175 const char *ast_config_AST_CTL = cfg_paths.ctl_file;
176 
177 /*! \brief Set maximum open files */
178 static void set_ulimit(int value)
179 {
180  struct rlimit l = {0, 0};
181 
182  if (value <= 0) {
183  ast_log(LOG_WARNING, "Unable to change max files open to invalid value %i\n",value);
184  return;
185  }
186 
187  l.rlim_cur = value;
188  l.rlim_max = value;
189 
190  if (setrlimit(RLIMIT_NOFILE, &l)) {
191  ast_log(LOG_WARNING, "Unable to disable core size resource limit: %s\n",strerror(errno));
192  return;
193  }
194 
195  ast_log(LOG_NOTICE, "Setting max files open to %d\n",value);
196 
197  return;
198 }
199 
200 void set_asterisk_conf_path(const char *path)
201 {
202  ast_copy_string(cfg_paths.config_file, path, sizeof(cfg_paths.config_file));
203 }
204 
205 void set_socket_path(const char *path)
206 {
207  ast_copy_string(cfg_paths.socket_path, path, sizeof(cfg_paths.socket_path));
208 }
209 
210 void load_asterisk_conf(void)
211 {
212  struct ast_config *cfg;
213  struct ast_variable *v;
214  char hostname[MAXHOSTNAMELEN] = "";
215  struct ast_flags config_flags = { CONFIG_FLAG_NOREALTIME };
216  struct {
217  unsigned int dbdir:1;
218  unsigned int keydir:1;
219  } found = { 0, 0 };
220  /* Default to false for security */
221  int live_dangerously = 0;
222  int option_debug_new = 0;
223  int option_trace_new = 0;
224  int option_verbose_new = 0;
225 
226  /* init with buildtime config */
227 #ifdef REF_DEBUG
228  /* The REF_DEBUG compiler flag is now only used to enable refdebug by default.
229  * Support for debugging reference counts is always compiled in. */
230  ast_set2_flag(&ast_options, 1, AST_OPT_FLAG_REF_DEBUG);
231 #endif
232 
234 
235  cfg = ast_config_load2(ast_config_AST_CONFIG_FILE, "" /* core, can't reload */, config_flags);
236 
237  /* If AST_OPT_FLAG_EXEC_INCLUDES was previously enabled with -X turn it off now.
238  * Using #exec from other configs requires that it be enabled from asterisk.conf. */
239  ast_clear_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES);
240 
241  /* no asterisk.conf? no problem, use buildtime config! */
242  if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
243  fprintf(stderr, "Unable to open specified master config file '%s', using built-in defaults\n", ast_config_AST_CONFIG_FILE);
244  return;
245  }
246 
247  for (v = ast_variable_browse(cfg, "files"); v; v = v->next) {
248  if (!strcasecmp(v->name, "astctlpermissions")) {
249  ast_copy_string(cfg_paths.ctl_perms, v->value, sizeof(cfg_paths.ctl_perms));
250  } else if (!strcasecmp(v->name, "astctlowner")) {
251  ast_copy_string(cfg_paths.ctl_owner, v->value, sizeof(cfg_paths.ctl_owner));
252  } else if (!strcasecmp(v->name, "astctlgroup")) {
253  ast_copy_string(cfg_paths.ctl_group, v->value, sizeof(cfg_paths.ctl_group));
254  } else if (!strcasecmp(v->name, "astctl")) {
255  ast_copy_string(cfg_paths.ctl_file, v->value, sizeof(cfg_paths.ctl_file));
256  }
257  }
258 
259  for (v = ast_variable_browse(cfg, "directories"); v; v = v->next) {
260  if (!strcasecmp(v->name, "astcachedir")) {
261  ast_copy_string(cfg_paths.cache_dir, v->value, sizeof(cfg_paths.cache_dir));
262  } else if (!strcasecmp(v->name, "astetcdir")) {
263  ast_copy_string(cfg_paths.config_dir, v->value, sizeof(cfg_paths.config_dir));
264  } else if (!strcasecmp(v->name, "astspooldir")) {
265  ast_copy_string(cfg_paths.spool_dir, v->value, sizeof(cfg_paths.spool_dir));
266  snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", v->value);
267  snprintf(cfg_paths.recording_dir, sizeof(cfg_paths.recording_dir), "%s/recording", v->value);
268  } else if (!strcasecmp(v->name, "astvarlibdir")) {
269  ast_copy_string(cfg_paths.var_dir, v->value, sizeof(cfg_paths.var_dir));
270  if (!found.dbdir) {
271  snprintf(cfg_paths.db_path, sizeof(cfg_paths.db_path), "%s/astdb", v->value);
272  }
273  } else if (!strcasecmp(v->name, "astdbdir")) {
274  snprintf(cfg_paths.db_path, sizeof(cfg_paths.db_path), "%s/astdb", v->value);
275  found.dbdir = 1;
276  } else if (!strcasecmp(v->name, "astdatadir")) {
277  ast_copy_string(cfg_paths.data_dir, v->value, sizeof(cfg_paths.data_dir));
278  if (!found.keydir) {
279  snprintf(cfg_paths.key_dir, sizeof(cfg_paths.key_dir), "%s/keys", v->value);
280  }
281  } else if (!strcasecmp(v->name, "astkeydir")) {
282  snprintf(cfg_paths.key_dir, sizeof(cfg_paths.key_dir), "%s/keys", v->value);
283  found.keydir = 1;
284  } else if (!strcasecmp(v->name, "astlogdir")) {
285  ast_copy_string(cfg_paths.log_dir, v->value, sizeof(cfg_paths.log_dir));
286  } else if (!strcasecmp(v->name, "astagidir")) {
287  ast_copy_string(cfg_paths.agi_dir, v->value, sizeof(cfg_paths.agi_dir));
288  } else if (!strcasecmp(v->name, "astrundir")) {
289  snprintf(cfg_paths.pid_path, sizeof(cfg_paths.pid_path), "%s/%s", v->value, "asterisk.pid");
290  ast_copy_string(cfg_paths.run_dir, v->value, sizeof(cfg_paths.run_dir));
291  } else if (!strcasecmp(v->name, "astmoddir")) {
292  ast_copy_string(cfg_paths.module_dir, v->value, sizeof(cfg_paths.module_dir));
293  } else if (!strcasecmp(v->name, "astsbindir")) {
294  ast_copy_string(cfg_paths.sbin_dir, v->value, sizeof(cfg_paths.sbin_dir));
295  }
296  }
297 
298  /* Combine astrundir and astctl settings. */
299  snprintf(cfg_paths.socket_path, sizeof(cfg_paths.socket_path), "%s/%s",
300  ast_config_AST_RUN_DIR, ast_config_AST_CTL);
301 
302  for (v = ast_variable_browse(cfg, "options"); v; v = v->next) {
303  /* verbose level (-v at startup) */
304  if (!strcasecmp(v->name, "verbose")) {
305  option_verbose_new = atoi(v->value);
306  /* whether or not to force timestamping in CLI verbose output. (-T at startup) */
307  } else if (!strcasecmp(v->name, "timestamp")) {
308  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP);
309  /* whether or not to support #exec in config files */
310  } else if (!strcasecmp(v->name, "execincludes")) {
311  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_EXEC_INCLUDES);
312  /* debug level (-d at startup) */
313  } else if (!strcasecmp(v->name, "debug")) {
314  option_debug_new = 0;
315  if (sscanf(v->value, "%30d", &option_debug_new) != 1) {
316  option_debug_new = ast_true(v->value) ? 1 : 0;
317  }
318  } else if (!strcasecmp(v->name, "trace")) {
319  option_trace_new = 0;
320  if (sscanf(v->value, "%30d", &option_trace_new) != 1) {
321  option_trace_new = ast_true(v->value) ? 1 : 0;
322  }
323  } else if (!strcasecmp(v->name, "refdebug")) {
324  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_REF_DEBUG);
325 #if HAVE_WORKING_FORK
326  /* Disable forking (-f at startup) */
327  } else if (!strcasecmp(v->name, "nofork")) {
328  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK);
329  /* Always fork, even if verbose or debug are enabled (-F at startup) */
330  } else if (!strcasecmp(v->name, "alwaysfork")) {
331  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_ALWAYS_FORK);
332 #endif
333  /* Run quietly (-q at startup ) */
334  } else if (!strcasecmp(v->name, "quiet")) {
335  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET);
336  /* Run as console (-c at startup, implies nofork) */
337  } else if (!strcasecmp(v->name, "console")) {
338  if (!ast_opt_remote) {
339  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
340  }
341  /* Run with high priority if the O/S permits (-p at startup) */
342  } else if (!strcasecmp(v->name, "highpriority")) {
343  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);
344  /* Initialize RSA auth keys (IAX2) (-i at startup) */
345  } else if (!strcasecmp(v->name, "initcrypto")) {
346  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INIT_KEYS);
347  /* Disable ANSI colors for console (-c at startup) */
348  } else if (!strcasecmp(v->name, "nocolor")) {
349  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_COLOR);
350  /* Disable some usage warnings for picky people :p */
351  } else if (!strcasecmp(v->name, "dontwarn")) {
352  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DONT_WARN);
353  /* Dump core in case of crash (-g) */
354  } else if (!strcasecmp(v->name, "dumpcore")) {
355  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DUMP_CORE);
356  /* Cache recorded sound files to another directory during recording */
357  } else if (!strcasecmp(v->name, "cache_record_files")) {
358  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_RECORD_FILES);
359 #if !defined(LOW_MEMORY)
360  /* Cache media frames for performance */
361  } else if (!strcasecmp(v->name, "cache_media_frames")) {
362  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_MEDIA_FRAMES);
363 #endif
364  /* Specify cache directory */
365  } else if (!strcasecmp(v->name, "record_cache_dir")) {
366  ast_copy_string(record_cache_dir, v->value, AST_CACHE_DIR_LEN);
367  /* Build transcode paths via SLINEAR, instead of directly */
368  } else if (!strcasecmp(v->name, "transcode_via_sln")) {
369  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN);
370  /* Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated on a channel */
371  } else if (!strcasecmp(v->name, "transmit_silence_during_record") || !strcasecmp(v->name, "transmit_silence")) {
372  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
373  } else if (!strcasecmp(v->name, "mindtmfduration")) {
374  if (sscanf(v->value, "%30u", &option_dtmfminduration) != 1) {
376  }
377  } else if (!strcasecmp(v->name, "rtp_use_dynamic")) {
378  ast_option_rtpusedynamic = ast_true(v->value);
379  /* http://www.iana.org/assignments/rtp-parameters
380  * RTP dynamic payload types start at 96 normally; extend down to 0 */
381  } else if (!strcasecmp(v->name, "rtp_pt_dynamic")) {
382  ast_parse_arg(v->value, PARSE_UINT32|PARSE_IN_RANGE,
383  &ast_option_rtpptdynamic, 0, AST_RTP_PT_FIRST_DYNAMIC);
384  } else if (!strcasecmp(v->name, "maxcalls")) {
385  if ((sscanf(v->value, "%30d", &ast_option_maxcalls) != 1) || (ast_option_maxcalls < 0)) {
387  }
388  } else if (!strcasecmp(v->name, "maxload")) {
389  double test[1];
390 
391  if (getloadavg(test, 1) == -1) {
392  ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n");
393  ast_option_maxload = 0.0;
394  } else if ((sscanf(v->value, "%30lf", &ast_option_maxload) != 1) || (ast_option_maxload < 0.0)) {
395  ast_option_maxload = 0.0;
396  }
397  /* Set the maximum amount of open files */
398  } else if (!strcasecmp(v->name, "maxfiles")) {
399  ast_option_maxfiles = atoi(v->value);
400  if (!ast_opt_remote) {
402  }
403  /* What user to run as */
404  } else if (!strcasecmp(v->name, "runuser")) {
405  ast_copy_string(cfg_paths.run_user, v->value, sizeof(cfg_paths.run_user));
406  /* What group to run as */
407  } else if (!strcasecmp(v->name, "rungroup")) {
408  ast_copy_string(cfg_paths.run_group, v->value, sizeof(cfg_paths.run_group));
409  } else if (!strcasecmp(v->name, "systemname")) {
410  ast_copy_string(cfg_paths.system_name, v->value, sizeof(cfg_paths.system_name));
411  } else if (!strcasecmp(v->name, "autosystemname")) {
412  if (ast_true(v->value)) {
413  if (!gethostname(hostname, sizeof(hostname) - 1)) {
414  ast_copy_string(cfg_paths.system_name, hostname, sizeof(cfg_paths.system_name));
415  } else {
416  if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)){
417  ast_copy_string(cfg_paths.system_name, "localhost", sizeof(cfg_paths.system_name));
418  }
419  ast_log(LOG_ERROR, "Cannot obtain hostname for this system. Using '%s' instead.\n", ast_config_AST_SYSTEM_NAME);
420  }
421  }
422  } else if (!strcasecmp(v->name, "languageprefix")) {
424  } else if (!strcasecmp(v->name, "defaultlanguage")) {
425  ast_copy_string(ast_defaultlanguage, v->value, MAX_LANGUAGE);
426  } else if (!strcasecmp(v->name, "lockmode")) {
427  if (!strcasecmp(v->value, "lockfile")) {
428  ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
429  } else if (!strcasecmp(v->value, "flock")) {
430  ast_set_lock_type(AST_LOCK_TYPE_FLOCK);
431  } else {
432  ast_log(LOG_WARNING, "'%s' is not a valid setting for the lockmode option, "
433  "defaulting to 'lockfile'\n", v->value);
434  ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE);
435  }
436 #if defined(HAVE_SYSINFO)
437  } else if (!strcasecmp(v->name, "minmemfree")) {
438  /* specify the minimum amount of free memory to retain. Asterisk should stop accepting new calls
439  * if the amount of free memory falls below this watermark */
440  if ((sscanf(v->value, "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
441  option_minmemfree = 0;
442  }
443 #endif
444  } else if (!strcasecmp(v->name, "entityid")) {
445  struct ast_eid tmp_eid;
446  if (!ast_str_to_eid(&tmp_eid, v->value)) {
447  ast_eid_default = tmp_eid;
448  } else {
449  ast_log(LOG_WARNING, "Invalid Entity ID '%s' provided\n", v->value);
450  }
451  } else if (!strcasecmp(v->name, "lightbackground")) {
452  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LIGHT_BACKGROUND);
453  } else if (!strcasecmp(v->name, "forceblackbackground")) {
454  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
455  } else if (!strcasecmp(v->name, "hideconnect")) {
456  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT);
457  } else if (!strcasecmp(v->name, "lockconfdir")) {
458  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LOCK_CONFIG_DIR);
459  } else if (!strcasecmp(v->name, "stdexten")) {
460  /* Choose how to invoke the extensions.conf stdexten */
461  if (!strcasecmp(v->value, "gosub")) {
462  ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
463  } else if (!strcasecmp(v->value, "macro")) {
464  ast_set_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
465  } else {
466  ast_log(LOG_WARNING,
467  "'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n",
468  v->value);
469  ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
470  }
471  } else if (!strcasecmp(v->name, "live_dangerously")) {
472  live_dangerously = ast_true(v->value);
473  } else if (!strcasecmp(v->name, "hide_messaging_ami_events")) {
474  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS);
475  } else if (!strcasecmp(v->name, "sounds_search_custom_dir")) {
476  ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM);
477  }
478  }
479  if (!ast_opt_remote) {
480  pbx_live_dangerously(live_dangerously);
481  astman_live_dangerously(live_dangerously);
482  }
483 
484  option_debug += option_debug_new;
485  option_trace += option_trace_new;
486  option_verbose += option_verbose_new;
487 
488  ast_config_destroy(cfg);
489 }
struct ast_variable * next
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:3850
int ast_option_maxfiles
Definition: options.c:81
Asterisk main include file. File version handling, generic pbx functions.
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
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
Definition: main/config.c:3827
unsigned int option_dtmfminduration
Definition: options.c:83
String manipulation functions.
int option_debug
Definition: options.c:69
#define AST_DEFAULT_OPTIONS
Definition: options.h:106
int ast_pjproject_max_log_level
Definition: options.c:73
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:3321
Structure for variables, used for configurations and for channel variables.
int option_verbose
Definition: options.c:67
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
double ast_option_maxload
Definition: options.c:77
#define AST_RTP_PT_FIRST_DYNAMIC
Definition: rtp_engine.h:92
#define AST_MIN_DTMF_DURATION
Definition: options.c:49
An Entity ID is essentially a MAC address, brief and unique.
Definition: utils.h:813
int ast_option_maxcalls
Definition: options.c:79
#define MAX_LANGUAGE
Definition: channel.h:172
Utility functions.
Configuration File Parser.
long option_minmemfree
Definition: options.c:86
Asterisk file paths, configured in asterisk.conf.
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
int ast_str_to_eid(struct ast_eid *eid, const char *s)
Convert a string into an EID.
Definition: utils.c:3077
int ast_option_pjproject_log_level
Definition: options.c:74
Core PBX routines and definitions.
int ast_verb_sys_level
Definition: options.c:64
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
Definition: utils.c:2199
int ast_option_pjproject_cache_pools
Definition: options.c:75
void pbx_live_dangerously(int new_live_dangerously)
Enable/disable the execution of 'dangerous' functions from external protocols (AMI, etc.).
Support for logging to various files, console and syslog Configuration in file logger.conf.
Prototypes for public functions only of internal interest,.
Structure used to handle boolean flags.
Definition: utils.h:199
static int live_dangerously
Set to true (non-zero) to globally allow all dangerous AMI actions to run.
Definition: manager.c:1658
static void set_ulimit(int value)
Set maximum open files.
Definition: options.c:178
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:425
Options provided by main asterisk program.
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
Definition: extconf.c:1289
Pluggable RTP Architecture.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_eid ast_eid_default
Global EID.
Definition: options.c:93
int option_trace
Definition: options.c:71