Go to the source code of this file.
Defines | |
#define | DEFAULT_LANGUAGE "en" |
#define | AST_CONFIG_MAX_PATH 255 |
#define | AST_CONFIG_DIR ASTETCDIR |
#define | AST_RUN_DIR ASTVARRUNDIR |
#define | AST_SOCKET ASTVARRUNDIR "/asterisk.ctl" |
#define | AST_PID ASTVARRUNDIR "/asterisk.pid" |
#define | AST_MODULE_DIR ASTMODDIR |
#define | AST_SPOOL_DIR ASTSPOOLDIR |
#define | AST_VAR_DIR ASTVARLIBDIR |
#define | AST_DATA_DIR ASTDATADIR |
#define | AST_LOG_DIR ASTLOGDIR |
#define | AST_AGI_DIR ASTAGIDIR |
#define | AST_KEY_DIR ASTVARLIBDIR "/keys" |
#define | AST_DB ASTVARLIBDIR "/astdb" |
#define | AST_TMP_DIR ASTSPOOLDIR "/tmp" |
#define | AST_SYMBOLIC_NAME "asterisk" |
#define | AST_CONFIG_FILE ASTCONFPATH |
#define | AST_SOUNDS AST_DATA_DIR "/sounds" |
#define | AST_IMAGES AST_DATA_DIR "/images" |
Functions | |
int | load_modules (void) |
int | load_pbx (void) |
int | init_logger (void) |
void | close_logger (void) |
int | init_framer (void) |
int | reload_logger (int) |
int | term_init (void) |
int | astdb_init (void) |
|
Definition at line 29 of file asterisk.h. |
|
Definition at line 20 of file asterisk.h. Referenced by ast_save(). |
|
Definition at line 35 of file asterisk.h. |
|
Definition at line 19 of file asterisk.h. |
|
Definition at line 27 of file asterisk.h. |
|
Definition at line 31 of file asterisk.h. |
|
Definition at line 38 of file asterisk.h. |
|
Definition at line 30 of file asterisk.h. |
|
Definition at line 28 of file asterisk.h. |
|
Definition at line 24 of file asterisk.h. |
|
Definition at line 23 of file asterisk.h. |
|
Definition at line 21 of file asterisk.h. |
|
Definition at line 22 of file asterisk.h. |
|
Definition at line 37 of file asterisk.h. |
|
Definition at line 25 of file asterisk.h. |
|
Definition at line 33 of file asterisk.h. |
|
Definition at line 32 of file asterisk.h. |
|
Definition at line 26 of file asterisk.h. |
|
Definition at line 17 of file asterisk.h. |
|
Definition at line 418 of file db.c. References ast_cli_register(). Referenced by main(). 00419 { 00420 dbinit(); 00421 ast_cli_register(&cli_database_show); 00422 ast_cli_register(&cli_database_get); 00423 ast_cli_register(&cli_database_put); 00424 ast_cli_register(&cli_database_del); 00425 ast_cli_register(&cli_database_deltree); 00426 return 0; 00427 }
|
|
Definition at line 461 of file logger.c. References ast_mutex_lock, ast_mutex_unlock, and free. 00462 { 00463 struct msglist *m, *tmp; 00464 00465 ast_mutex_lock(&msglist_lock); 00466 m = list; 00467 while(m) { 00468 if (m->msg) { 00469 free(m->msg); 00470 } 00471 tmp = m->next; 00472 free(m); 00473 m = tmp; 00474 } 00475 list = last = NULL; 00476 msgcnt = 0; 00477 ast_mutex_unlock(&msglist_lock); 00478 return; 00479 }
|
|
Definition at line 800 of file frame.c. References ast_cli_register(). Referenced by main(). 00801 { 00802 #ifdef TRACE_FRAMES 00803 ast_cli_register(&cli_frame_stats); 00804 #endif 00805 ast_cli_register(&cli_show_codecs); 00806 ast_cli_register(&cli_show_codecs_audio); 00807 ast_cli_register(&cli_show_codecs_video); 00808 ast_cli_register(&cli_show_codecs_image); 00809 ast_cli_register(&cli_show_codec_n); 00810 return 0; 00811 }
|
|
Definition at line 429 of file logger.c. References ast_cli_register(), ast_config_AST_LOG_DIR, ast_log(), ast_verbose(), EVENTLOG, LOG_ERROR, LOG_EVENT, and option_verbose. Referenced by main(). 00430 { 00431 char tmp[256]; 00432 00433 /* auto rotate if sig SIGXFSZ comes a-knockin */ 00434 (void) signal(SIGXFSZ,(void *) handle_SIGXFSZ); 00435 00436 /* register the relaod logger cli command */ 00437 ast_cli_register(&reload_logger_cli); 00438 ast_cli_register(&rotate_logger_cli); 00439 00440 /* initialize queue logger */ 00441 queue_log_init(); 00442 00443 /* create the eventlog */ 00444 mkdir((char *)ast_config_AST_LOG_DIR, 0755); 00445 snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG); 00446 eventlog = fopen((char *)tmp, "a"); 00447 if (eventlog) { 00448 init_logger_chain(); 00449 ast_log(LOG_EVENT, "Started Asterisk Event Logger\n"); 00450 if (option_verbose) 00451 ast_verbose("Asterisk Event Logger Started %s\n",(char *)tmp); 00452 return 0; 00453 } else 00454 ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno)); 00455 00456 /* create log channels */ 00457 init_logger_chain(); 00458 return -1; 00459 }
|
|
Definition at line 371 of file loader.c. References ast_config_AST_MODULE_DIR, ast_destroy(), ast_load(), ast_load_resource(), ast_log(), AST_MODULE_CONFIG, ast_true(), ast_variable_browse(), ast_variable_retrieve(), ast_verbose(), COLOR_BRWHITE, LOG_DEBUG, LOG_WARNING, ast_variable::name, ast_variable::next, option_debug, option_quiet, option_verbose, term_color(), ast_variable::value, and VERBOSE_PREFIX_1. Referenced by main(). 00372 { 00373 struct ast_config *cfg; 00374 struct ast_variable *v; 00375 char tmp[80]; 00376 if (option_verbose) 00377 ast_verbose( "Asterisk Dynamic Loader Starting:\n"); 00378 cfg = ast_load(AST_MODULE_CONFIG); 00379 if (cfg) { 00380 /* Load explicitly defined modules */ 00381 v = ast_variable_browse(cfg, "modules"); 00382 while(v) { 00383 if (!strcasecmp(v->name, "load")) { 00384 if (option_debug && !option_verbose) 00385 ast_log(LOG_DEBUG, "Loading module %s\n", v->value); 00386 if (option_verbose) { 00387 ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, v->value, COLOR_BRWHITE, 0, sizeof(tmp))); 00388 fflush(stdout); 00389 } 00390 if (ast_load_resource(v->value)) { 00391 ast_log(LOG_WARNING, "Loading module %s failed!\n", v->value); 00392 if (cfg) 00393 ast_destroy(cfg); 00394 return -1; 00395 } 00396 } 00397 v=v->next; 00398 } 00399 } 00400 if (!cfg || ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) { 00401 /* Load all modules */ 00402 DIR *mods; 00403 struct dirent *d; 00404 int x; 00405 /* Make two passes. First, load any resource modules, then load the others. */ 00406 for (x=0;x<2;x++) { 00407 mods = opendir((char *)ast_config_AST_MODULE_DIR); 00408 if (mods) { 00409 while((d = readdir(mods))) { 00410 /* Must end in .so to load it. */ 00411 if ((strlen(d->d_name) > 3) && (x || !strncasecmp(d->d_name, "res_", 4)) && 00412 !strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") && 00413 !ast_resource_exists(d->d_name)) { 00414 /* It's a shared library -- Just be sure we're allowed to load it -- kinda 00415 an inefficient way to do it, but oh well. */ 00416 if (cfg) { 00417 v = ast_variable_browse(cfg, "modules"); 00418 while(v) { 00419 if (!strcasecmp(v->name, "noload") && 00420 !strcasecmp(v->value, d->d_name)) 00421 break; 00422 v = v->next; 00423 } 00424 if (v) { 00425 if (option_verbose) { 00426 ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name); 00427 fflush(stdout); 00428 } 00429 continue; 00430 } 00431 00432 } 00433 if (option_debug && !option_verbose) 00434 ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name); 00435 if (option_verbose) { 00436 ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, d->d_name, COLOR_BRWHITE, 0, sizeof(tmp))); 00437 fflush(stdout); 00438 } 00439 if (ast_load_resource(d->d_name)) { 00440 ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name); 00441 if (cfg) 00442 ast_destroy(cfg); 00443 return -1; 00444 } 00445 } 00446 } 00447 closedir(mods); 00448 } else { 00449 if (!option_quiet) 00450 ast_log(LOG_WARNING, "Unable to open modules directory %s.\n", (char *)ast_config_AST_MODULE_DIR); 00451 } 00452 } 00453 } 00454 ast_destroy(cfg); 00455 return 0; 00456 }
|
|
Definition at line 4898 of file pbx.c. References ast_cli_register(), AST_LIST_HEAD_INIT, ast_log(), ast_register_application(), ast_verbose(), LOG_ERROR, option_verbose, and VERBOSE_PREFIX_1. Referenced by main(). 04899 { 04900 int x; 04901 04902 /* Initialize the PBX */ 04903 if (option_verbose) { 04904 ast_verbose( "Asterisk PBX Core Initializing\n"); 04905 ast_verbose( "Registering builtin applications:\n"); 04906 } 04907 AST_LIST_HEAD_INIT(&globals); 04908 ast_cli_register(&show_applications_cli); 04909 ast_cli_register(&show_application_cli); 04910 ast_cli_register(&show_dialplan_cli); 04911 ast_cli_register(&show_switches_cli); 04912 04913 /* Register builtin applications */ 04914 for (x=0; x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) { 04915 if (option_verbose) 04916 ast_verbose( VERBOSE_PREFIX_1 "[%s]\n", builtins[x].name); 04917 if (ast_register_application(builtins[x].name, builtins[x].execute, builtins[x].synopsis, builtins[x].description)) { 04918 ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name); 04919 return -1; 04920 } 04921 } 04922 return 0; 04923 }
|
|
Definition at line 296 of file logger.c. References ast_config_AST_LOG_DIR, AST_CONFIG_MAX_PATH, ast_log(), ast_mutex_lock, ast_mutex_unlock, ast_verbose(), EVENTLOG, logchannel::filename, logchannel::fileptr, LOG_ERROR, LOG_EVENT, logchannel::next, and option_verbose. Referenced by ast_log(), and main(). 00297 { 00298 char old[AST_CONFIG_MAX_PATH] = ""; 00299 char new[AST_CONFIG_MAX_PATH]; 00300 struct logchannel *f; 00301 FILE *myf; 00302 00303 int x; 00304 ast_mutex_lock(&loglock); 00305 if (eventlog) 00306 fclose(eventlog); 00307 else 00308 rotate = 0; 00309 eventlog = NULL; 00310 00311 00312 00313 mkdir((char *)ast_config_AST_LOG_DIR, 0755); 00314 snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG); 00315 00316 if(rotate) { 00317 for(x=0;;x++) { 00318 snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, EVENTLOG,x); 00319 myf = fopen((char *)new, "r"); 00320 if(myf) 00321 fclose(myf); 00322 else 00323 break; 00324 } 00325 00326 /* do it */ 00327 if (rename(old,new)) 00328 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new); 00329 } 00330 00331 eventlog = fopen(old, "a"); 00332 00333 f = logchannels; 00334 while(f) { 00335 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { 00336 fclose(f->fileptr); 00337 f->fileptr = NULL; 00338 if(rotate) { 00339 strncpy(old, f->filename, sizeof(old) - 1); 00340 00341 for(x=0;;x++) { 00342 snprintf(new, sizeof(new), "%s.%d", f->filename, x); 00343 myf = fopen((char *)new, "r"); 00344 if (myf) { 00345 fclose(myf); 00346 } else { 00347 break; 00348 } 00349 } 00350 00351 /* do it */ 00352 if (rename(old,new)) 00353 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new); 00354 } 00355 } 00356 f = f->next; 00357 } 00358 00359 ast_mutex_unlock(&loglock); 00360 00361 queue_log_init(); 00362 00363 if (eventlog) { 00364 init_logger_chain(); 00365 ast_log(LOG_EVENT, "Restarted Asterisk Event Logger\n"); 00366 if (option_verbose) 00367 ast_verbose("Asterisk Event Logger restarted\n"); 00368 return 0; 00369 } else 00370 ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno)); 00371 init_logger_chain(); 00372 pending_logger_reload = 0; 00373 return -1; 00374 }
|
|
Definition at line 32 of file term.c. References ATTR_BRIGHT, ATTR_RESET, COLOR_BLACK, COLOR_BROWN, COLOR_WHITE, ESC, option_console, option_nocolor, and option_nofork. Referenced by main(). 00033 { 00034 char *term = getenv("TERM"); 00035 if (!term) 00036 return 0; 00037 if (!option_console || option_nocolor || !option_nofork) 00038 return 0; 00039 if (!strncasecmp(term, "linux", 5)) 00040 vt100compat = 1; else 00041 if (!strncasecmp(term, "xterm", 5)) 00042 vt100compat = 1; else 00043 if (!strncasecmp(term, "Eterm", 5)) 00044 vt100compat = 1; else 00045 if (!strncasecmp(term, "crt", 3)) 00046 vt100compat = 1; else 00047 if (!strncasecmp(term, "vt", 2)) 00048 vt100compat = 1; 00049 if (vt100compat) { 00050 /* Make commands show up in nice colors */ 00051 snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10); 00052 snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10); 00053 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC); 00054 } 00055 return 0; 00056 }
|