| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 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 |
#include "channelstorage.h" |
| 44 |
|
| 45 |
#include <sys/time.h> |
| 46 |
#include <sys/resource.h> |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
#define AST_MIN_DTMF_DURATION 80 |
| 51 |
|
| 52 |
#define DEFAULT_MONITOR_DIR DEFAULT_SPOOL_DIR "/monitor" |
| 53 |
#define DEFAULT_RECORDING_DIR DEFAULT_SPOOL_DIR "/recording" |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
struct ast_flags64 ast_options = { AST_DEFAULT_OPTIONS }; |
| 63 |
|
| 64 |
|
| 65 |
int ast_verb_sys_level; |
| 66 |
|
| 67 |
|
| 68 |
int option_verbose; |
| 69 |
|
| 70 |
int option_debug; |
| 71 |
|
| 72 |
int option_trace; |
| 73 |
|
| 74 |
int ast_pjproject_max_log_level = -1; |
| 75 |
int ast_option_pjproject_log_level; |
| 76 |
int ast_option_pjproject_cache_pools; |
| 77 |
|
| 78 |
double ast_option_maxload; |
| 79 |
|
| 80 |
int ast_option_maxcalls; |
| 81 |
|
| 82 |
int ast_option_maxfiles; |
| 83 |
|
| 84 |
unsigned int option_dtmfminduration = AST_MIN_DTMF_DURATION; |
| 85 |
#if defined(HAVE_SYSINFO) |
| 86 |
|
| 87 |
long option_minmemfree; |
| 88 |
#endif |
| 89 |
int ast_option_rtpusedynamic = 1; |
| 90 |
unsigned int ast_option_rtpptdynamic = 35; |
| 91 |
int ast_option_disable_remote_console_shell = 0; |
| 92 |
|
| 93 |
|
| 94 |
struct ast_eid ast_eid_default; |
| 95 |
|
| 96 |
|
| 97 |
char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR; |
| 98 |
|
| 99 |
char ast_defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE; |
| 100 |
|
| 101 |
struct _cfg_paths { |
| 102 |
char cache_dir[PATH_MAX]; |
| 103 |
char config_dir[PATH_MAX]; |
| 104 |
char module_dir[PATH_MAX]; |
| 105 |
char spool_dir[PATH_MAX]; |
| 106 |
char monitor_dir[PATH_MAX]; |
| 107 |
char recording_dir[PATH_MAX]; |
| 108 |
char var_dir[PATH_MAX]; |
| 109 |
char data_dir[PATH_MAX]; |
| 110 |
char log_dir[PATH_MAX]; |
| 111 |
char agi_dir[PATH_MAX]; |
| 112 |
char run_dir[PATH_MAX]; |
| 113 |
char key_dir[PATH_MAX]; |
| 114 |
|
| 115 |
char config_file[PATH_MAX]; |
| 116 |
char db_path[PATH_MAX]; |
| 117 |
char sbin_dir[PATH_MAX]; |
| 118 |
char pid_path[PATH_MAX]; |
| 119 |
char socket_path[PATH_MAX]; |
| 120 |
char run_user[PATH_MAX]; |
| 121 |
char run_group[PATH_MAX]; |
| 122 |
char system_name[128]; |
| 123 |
char ctl_perms[PATH_MAX]; |
| 124 |
char ctl_owner[PATH_MAX]; |
| 125 |
char ctl_group[PATH_MAX]; |
| 126 |
char ctl_file[PATH_MAX]; |
| 127 |
}; |
| 128 |
|
| 129 |
static struct _cfg_paths cfg_paths = { |
| 130 |
.cache_dir = DEFAULT_CACHE_DIR, |
| 131 |
.config_dir = DEFAULT_CONFIG_DIR, |
| 132 |
.module_dir = DEFAULT_MODULE_DIR, |
| 133 |
.spool_dir = DEFAULT_SPOOL_DIR, |
| 134 |
.monitor_dir = DEFAULT_MONITOR_DIR, |
| 135 |
.recording_dir = DEFAULT_RECORDING_DIR, |
| 136 |
.var_dir = DEFAULT_VAR_DIR, |
| 137 |
.data_dir = DEFAULT_DATA_DIR, |
| 138 |
.log_dir = DEFAULT_LOG_DIR, |
| 139 |
.agi_dir = DEFAULT_AGI_DIR, |
| 140 |
.run_dir = DEFAULT_RUN_DIR, |
| 141 |
.key_dir = DEFAULT_KEY_DIR, |
| 142 |
|
| 143 |
.config_file = DEFAULT_CONFIG_FILE, |
| 144 |
.db_path = DEFAULT_DB, |
| 145 |
.sbin_dir = DEFAULT_SBIN_DIR, |
| 146 |
.pid_path = DEFAULT_PID, |
| 147 |
.socket_path = DEFAULT_SOCKET, |
| 148 |
.ctl_file = "asterisk.ctl", |
| 149 |
}; |
| 150 |
|
| 151 |
const char *ast_config_AST_CACHE_DIR = cfg_paths.cache_dir; |
| 152 |
const char *ast_config_AST_CONFIG_DIR = cfg_paths.config_dir; |
| 153 |
const char *ast_config_AST_CONFIG_FILE = cfg_paths.config_file; |
| 154 |
const char *ast_config_AST_MODULE_DIR = cfg_paths.module_dir; |
| 155 |
const char *ast_config_AST_SPOOL_DIR = cfg_paths.spool_dir; |
| 156 |
const char *ast_config_AST_MONITOR_DIR = cfg_paths.monitor_dir; |
| 157 |
const char *ast_config_AST_RECORDING_DIR = cfg_paths.recording_dir; |
| 158 |
const char *ast_config_AST_VAR_DIR = cfg_paths.var_dir; |
| 159 |
const char *ast_config_AST_DATA_DIR = cfg_paths.data_dir; |
| 160 |
const char *ast_config_AST_LOG_DIR = cfg_paths.log_dir; |
| 161 |
const char *ast_config_AST_AGI_DIR = cfg_paths.agi_dir; |
| 162 |
const char *ast_config_AST_KEY_DIR = cfg_paths.key_dir; |
| 163 |
const char *ast_config_AST_RUN_DIR = cfg_paths.run_dir; |
| 164 |
const char *ast_config_AST_SBIN_DIR = cfg_paths.sbin_dir; |
| 165 |
|
| 166 |
const char *ast_config_AST_DB = cfg_paths.db_path; |
| 167 |
const char *ast_config_AST_PID = cfg_paths.pid_path; |
| 168 |
const char *ast_config_AST_SOCKET = cfg_paths.socket_path; |
| 169 |
const char *ast_config_AST_RUN_USER = cfg_paths.run_user; |
| 170 |
const char *ast_config_AST_RUN_GROUP = cfg_paths.run_group; |
| 171 |
const char *ast_config_AST_SYSTEM_NAME = cfg_paths.system_name; |
| 172 |
|
| 173 |
const char *ast_config_AST_CTL_PERMISSIONS = cfg_paths.ctl_perms; |
| 174 |
const char *ast_config_AST_CTL_OWNER = cfg_paths.ctl_owner; |
| 175 |
const char *ast_config_AST_CTL_GROUP = cfg_paths.ctl_group; |
| 176 |
const char *ast_config_AST_CTL = cfg_paths.ctl_file; |
| 177 |
|
| 178 |
|
| 179 |
static void set_ulimit(int value) |
| 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 |
} |
| 200 |
|
| 201 |
void set_asterisk_conf_path(const char *path) |
| 202 |
{ |
| 203 |
ast_copy_string(cfg_paths.config_file, path, sizeof(cfg_paths.config_file)); |
| 204 |
} |
| 205 |
|
| 206 |
void set_socket_path(const char *path) |
| 207 |
{ |
| 208 |
ast_copy_string(cfg_paths.socket_path, path, sizeof(cfg_paths.socket_path)); |
| 209 |
} |
| 210 |
|
| 211 |
void load_asterisk_conf(void) |
| 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 |
|
| 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 |
|
| 228 |
|
| 229 |
#ifdef REF_DEBUG |
| 230 |
|
| 231 |
|
| 232 |
ast_set2_flag64(&ast_options, 1, AST_OPT_FLAG_REF_DEBUG); |
| 233 |
#endif |
| 234 |
|
| 235 |
ast_set_default_eid(&ast_eid_default); |
| 236 |
|
| 237 |
cfg = ast_config_load2(ast_config_AST_CONFIG_FILE, "" , config_flags); |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
ast_clear_flag64(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES); |
| 242 |
|
| 243 |
|
| 244 |
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) { |
| 245 |
fprintf(stderr, "Unable to open specified master config file '%s', using built-in defaults\n", ast_config_AST_CONFIG_FILE); |
| 246 |
return; |
| 247 |
} |
| 248 |
|
| 249 |
for (v = ast_variable_browse(cfg, "files"); v; v = v->next) { |
| 250 |
if (!strcasecmp(v->name, "astctlpermissions")) { |
| 251 |
ast_copy_string(cfg_paths.ctl_perms, v->value, sizeof(cfg_paths.ctl_perms)); |
| 252 |
} else if (!strcasecmp(v->name, "astctlowner")) { |
| 253 |
ast_copy_string(cfg_paths.ctl_owner, v->value, sizeof(cfg_paths.ctl_owner)); |
| 254 |
} else if (!strcasecmp(v->name, "astctlgroup")) { |
| 255 |
ast_copy_string(cfg_paths.ctl_group, v->value, sizeof(cfg_paths.ctl_group)); |
| 256 |
} else if (!strcasecmp(v->name, "astctl")) { |
| 257 |
ast_copy_string(cfg_paths.ctl_file, v->value, sizeof(cfg_paths.ctl_file)); |
| 258 |
} |
| 259 |
} |
| 260 |
|
| 261 |
for (v = ast_variable_browse(cfg, "directories"); v; v = v->next) { |
| 262 |
if (!strcasecmp(v->name, "astcachedir")) { |
| 263 |
ast_copy_string(cfg_paths.cache_dir, v->value, sizeof(cfg_paths.cache_dir)); |
| 264 |
} else if (!strcasecmp(v->name, "astetcdir")) { |
| 265 |
ast_copy_string(cfg_paths.config_dir, v->value, sizeof(cfg_paths.config_dir)); |
| 266 |
} else if (!strcasecmp(v->name, "astspooldir")) { |
| 267 |
ast_copy_string(cfg_paths.spool_dir, v->value, sizeof(cfg_paths.spool_dir)); |
| 268 |
snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", v->value); |
| 269 |
snprintf(cfg_paths.recording_dir, sizeof(cfg_paths.recording_dir), "%s/recording", v->value); |
| 270 |
} else if (!strcasecmp(v->name, "astvarlibdir")) { |
| 271 |
ast_copy_string(cfg_paths.var_dir, v->value, sizeof(cfg_paths.var_dir)); |
| 272 |
if (!found.dbdir) { |
| 273 |
snprintf(cfg_paths.db_path, sizeof(cfg_paths.db_path), "%s/astdb", v->value); |
| 274 |
} |
| 275 |
} else if (!strcasecmp(v->name, "astdbdir")) { |
| 276 |
snprintf(cfg_paths.db_path, sizeof(cfg_paths.db_path), "%s/astdb", v->value); |
| 277 |
found.dbdir = 1; |
| 278 |
} else if (!strcasecmp(v->name, "astdatadir")) { |
| 279 |
ast_copy_string(cfg_paths.data_dir, v->value, sizeof(cfg_paths.data_dir)); |
| 280 |
if (!found.keydir) { |
| 281 |
snprintf(cfg_paths.key_dir, sizeof(cfg_paths.key_dir), "%s/keys", v->value); |
| 282 |
} |
| 283 |
} else if (!strcasecmp(v->name, "astkeydir")) { |
| 284 |
snprintf(cfg_paths.key_dir, sizeof(cfg_paths.key_dir), "%s/keys", v->value); |
| 285 |
found.keydir = 1; |
| 286 |
} else if (!strcasecmp(v->name, "astlogdir")) { |
| 287 |
ast_copy_string(cfg_paths.log_dir, v->value, sizeof(cfg_paths.log_dir)); |
| 288 |
} else if (!strcasecmp(v->name, "astagidir")) { |
| 289 |
ast_copy_string(cfg_paths.agi_dir, v->value, sizeof(cfg_paths.agi_dir)); |
| 290 |
} else if (!strcasecmp(v->name, "astrundir")) { |
| 291 |
snprintf(cfg_paths.pid_path, sizeof(cfg_paths.pid_path), "%s/%s", v->value, "asterisk.pid"); |
| 292 |
ast_copy_string(cfg_paths.run_dir, v->value, sizeof(cfg_paths.run_dir)); |
| 293 |
} else if (!strcasecmp(v->name, "astmoddir")) { |
| 294 |
ast_copy_string(cfg_paths.module_dir, v->value, sizeof(cfg_paths.module_dir)); |
| 295 |
} else if (!strcasecmp(v->name, "astsbindir")) { |
| 296 |
ast_copy_string(cfg_paths.sbin_dir, v->value, sizeof(cfg_paths.sbin_dir)); |
| 297 |
} |
| 298 |
} |
| 299 |
|
| 300 |
|
| 301 |
snprintf(cfg_paths.socket_path, sizeof(cfg_paths.socket_path), "%s/%s", |
| 302 |
ast_config_AST_RUN_DIR, ast_config_AST_CTL); |
| 303 |
|
| 304 |
for (v = ast_variable_browse(cfg, "options"); v; v = v->next) { |
| 305 |
|
| 306 |
if (!strcasecmp(v->name, "verbose")) { |
| 307 |
option_verbose_new = atoi(v->value); |
| 308 |
|
| 309 |
} else if (!strcasecmp(v->name, "timestamp")) { |
| 310 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP); |
| 311 |
|
| 312 |
} else if (!strcasecmp(v->name, "execincludes")) { |
| 313 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_EXEC_INCLUDES); |
| 314 |
|
| 315 |
} else if (!strcasecmp(v->name, "debug")) { |
| 316 |
option_debug_new = 0; |
| 317 |
if (sscanf(v->value, "%30d", &option_debug_new) != 1) { |
| 318 |
option_debug_new = ast_true(v->value) ? 1 : 0; |
| 319 |
} |
| 320 |
} else if (!strcasecmp(v->name, "trace")) { |
| 321 |
option_trace_new = 0; |
| 322 |
if (sscanf(v->value, "%30d", &option_trace_new) != 1) { |
| 323 |
option_trace_new = ast_true(v->value) ? 1 : 0; |
| 324 |
} |
| 325 |
} else if (!strcasecmp(v->name, "refdebug")) { |
| 326 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_REF_DEBUG); |
| 327 |
#if HAVE_WORKING_FORK |
| 328 |
|
| 329 |
} else if (!strcasecmp(v->name, "nofork")) { |
| 330 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK); |
| 331 |
|
| 332 |
} else if (!strcasecmp(v->name, "alwaysfork")) { |
| 333 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_ALWAYS_FORK); |
| 334 |
#endif |
| 335 |
|
| 336 |
} else if (!strcasecmp(v->name, "quiet")) { |
| 337 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET); |
| 338 |
|
| 339 |
} else if (!strcasecmp(v->name, "console")) { |
| 340 |
if (!ast_opt_remote) { |
| 341 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE); |
| 342 |
} |
| 343 |
|
| 344 |
} else if (!strcasecmp(v->name, "highpriority")) { |
| 345 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY); |
| 346 |
|
| 347 |
} else if (!strcasecmp(v->name, "initcrypto")) { |
| 348 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_INIT_KEYS); |
| 349 |
|
| 350 |
} else if (!strcasecmp(v->name, "nocolor")) { |
| 351 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_COLOR); |
| 352 |
|
| 353 |
} else if (!strcasecmp(v->name, "dontwarn")) { |
| 354 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_DONT_WARN); |
| 355 |
|
| 356 |
} else if (!strcasecmp(v->name, "dumpcore")) { |
| 357 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_DUMP_CORE); |
| 358 |
|
| 359 |
} else if (!strcasecmp(v->name, "cache_record_files")) { |
| 360 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_RECORD_FILES); |
| 361 |
#if !defined(LOW_MEMORY) |
| 362 |
|
| 363 |
} else if (!strcasecmp(v->name, "cache_media_frames")) { |
| 364 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_MEDIA_FRAMES); |
| 365 |
#endif |
| 366 |
|
| 367 |
} else if (!strcasecmp(v->name, "record_cache_dir")) { |
| 368 |
ast_copy_string(record_cache_dir, v->value, AST_CACHE_DIR_LEN); |
| 369 |
|
| 370 |
} else if (!strcasecmp(v->name, "transcode_via_sln")) { |
| 371 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN); |
| 372 |
|
| 373 |
} else if (!strcasecmp(v->name, "transmit_silence_during_record") || !strcasecmp(v->name, "transmit_silence")) { |
| 374 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE); |
| 375 |
} else if (!strcasecmp(v->name, "mindtmfduration")) { |
| 376 |
if (sscanf(v->value, "%30u", &option_dtmfminduration) != 1) { |
| 377 |
option_dtmfminduration = AST_MIN_DTMF_DURATION; |
| 378 |
} |
| 379 |
} else if (!strcasecmp(v->name, "rtp_use_dynamic")) { |
| 380 |
ast_option_rtpusedynamic = ast_true(v->value); |
| 381 |
|
| 382 |
|
| 383 |
} else if (!strcasecmp(v->name, "rtp_pt_dynamic")) { |
| 384 |
ast_parse_arg(v->value, PARSE_UINT32|PARSE_IN_RANGE, |
| 385 |
&ast_option_rtpptdynamic, 0, AST_RTP_PT_FIRST_DYNAMIC); |
| 386 |
} else if (!strcasecmp(v->name, "maxcalls")) { |
| 387 |
if ((sscanf(v->value, "%30d", &ast_option_maxcalls) != 1) || (ast_option_maxcalls < 0)) { |
| 388 |
ast_option_maxcalls = 0; |
| 389 |
} |
| 390 |
} else if (!strcasecmp(v->name, "maxload")) { |
| 391 |
double test[1]; |
| 392 |
|
| 393 |
if (getloadavg(test, 1) == -1) { |
| 394 |
ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n"); |
| 395 |
ast_option_maxload = 0.0; |
| 396 |
} else if ((sscanf(v->value, "%30lf", &ast_option_maxload) != 1) || (ast_option_maxload < 0.0)) { |
| 397 |
ast_option_maxload = 0.0; |
| 398 |
} |
| 399 |
|
| 400 |
} else if (!strcasecmp(v->name, "maxfiles")) { |
| 401 |
ast_option_maxfiles = atoi(v->value); |
| 402 |
if (!ast_opt_remote) { |
| 403 |
set_ulimit(ast_option_maxfiles); |
| 404 |
} |
| 405 |
|
| 406 |
} else if (!strcasecmp(v->name, "runuser")) { |
| 407 |
ast_copy_string(cfg_paths.run_user, v->value, sizeof(cfg_paths.run_user)); |
| 408 |
|
| 409 |
} else if (!strcasecmp(v->name, "rungroup")) { |
| 410 |
ast_copy_string(cfg_paths.run_group, v->value, sizeof(cfg_paths.run_group)); |
| 411 |
} else if (!strcasecmp(v->name, "systemname")) { |
| 412 |
ast_copy_string(cfg_paths.system_name, v->value, sizeof(cfg_paths.system_name)); |
| 413 |
} else if (!strcasecmp(v->name, "autosystemname")) { |
| 414 |
if (ast_true(v->value)) { |
| 415 |
if (!gethostname(hostname, sizeof(hostname) - 1)) { |
| 416 |
ast_copy_string(cfg_paths.system_name, hostname, sizeof(cfg_paths.system_name)); |
| 417 |
} else { |
| 418 |
if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)){ |
| 419 |
ast_copy_string(cfg_paths.system_name, "localhost", sizeof(cfg_paths.system_name)); |
| 420 |
} |
| 421 |
ast_log(LOG_ERROR, "Cannot obtain hostname for this system. Using '%s' instead.\n", ast_config_AST_SYSTEM_NAME); |
| 422 |
} |
| 423 |
} |
| 424 |
} else if (!strcasecmp(v->name, "languageprefix")) { |
| 425 |
ast_language_is_prefix = ast_true(v->value); |
| 426 |
} else if (!strcasecmp(v->name, "defaultlanguage")) { |
| 427 |
ast_copy_string(ast_defaultlanguage, v->value, MAX_LANGUAGE); |
| 428 |
} else if (!strcasecmp(v->name, "lockmode")) { |
| 429 |
if (!strcasecmp(v->value, "lockfile")) { |
| 430 |
ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE); |
| 431 |
} else if (!strcasecmp(v->value, "flock")) { |
| 432 |
ast_set_lock_type(AST_LOCK_TYPE_FLOCK); |
| 433 |
} else { |
| 434 |
ast_log(LOG_WARNING, "'%s' is not a valid setting for the lockmode option, " |
| 435 |
"defaulting to 'lockfile'\n", v->value); |
| 436 |
ast_set_lock_type(AST_LOCK_TYPE_LOCKFILE); |
| 437 |
} |
| 438 |
#if defined(HAVE_SYSINFO) |
| 439 |
} else if (!strcasecmp(v->name, "minmemfree")) { |
| 440 |
|
| 441 |
|
| 442 |
if ((sscanf(v->value, "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) { |
| 443 |
option_minmemfree = 0; |
| 444 |
} |
| 445 |
#endif |
| 446 |
} else if (!strcasecmp(v->name, "entityid")) { |
| 447 |
struct ast_eid tmp_eid; |
| 448 |
if (!ast_str_to_eid(&tmp_eid, v->value)) { |
| 449 |
ast_eid_default = tmp_eid; |
| 450 |
} else { |
| 451 |
ast_log(LOG_WARNING, "Invalid Entity ID '%s' provided\n", v->value); |
| 452 |
} |
| 453 |
} else if (!strcasecmp(v->name, "lightbackground")) { |
| 454 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_LIGHT_BACKGROUND); |
| 455 |
} else if (!strcasecmp(v->name, "forceblackbackground")) { |
| 456 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_FORCE_BLACK_BACKGROUND); |
| 457 |
} else if (!strcasecmp(v->name, "hideconnect")) { |
| 458 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT); |
| 459 |
} else if (!strcasecmp(v->name, "lockconfdir")) { |
| 460 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_LOCK_CONFIG_DIR); |
| 461 |
} else if (!strcasecmp(v->name, "stdexten")) { |
| 462 |
|
| 463 |
if (!strcasecmp(v->value, "gosub")) { |
| 464 |
ast_clear_flag64(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO); |
| 465 |
} else if (!strcasecmp(v->value, "macro")) { |
| 466 |
ast_set_flag64(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO); |
| 467 |
} else { |
| 468 |
ast_log(LOG_WARNING, |
| 469 |
"'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n", |
| 470 |
v->value); |
| 471 |
ast_clear_flag64(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO); |
| 472 |
} |
| 473 |
} else if (!strcasecmp(v->name, "live_dangerously")) { |
| 474 |
live_dangerously = ast_true(v->value); |
| 475 |
} else if (!strcasecmp(v->name, "hide_messaging_ami_events")) { |
| 476 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS); |
| 477 |
} else if (!strcasecmp(v->name, "sounds_search_custom_dir")) { |
| 478 |
ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM); |
| 479 |
} else if (!strcasecmp(v->name, "channel_storage_backend")) { |
| 480 |
internal_channel_set_current_storage_driver(v->value); |
| 481 |
} else if (!strcasecmp(v->name, "disable_remote_console_shell")) { |
| 482 |
ast_option_disable_remote_console_shell = ast_true(v->value); |
| 483 |
} |
| 484 |
} |
| 485 |
if (!ast_opt_remote) { |
| 486 |
pbx_live_dangerously(live_dangerously); |
| 487 |
astman_live_dangerously(live_dangerously); |
| 488 |
} |
| 489 |
|
| 490 |
option_debug += option_debug_new; |
| 491 |
option_trace += option_trace_new; |
| 492 |
option_verbose += option_verbose_new; |
| 493 |
|
| 494 |
ast_config_destroy(cfg); |
| 495 |
} |