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_LOG_DIR ASTLOGDIR |
| #define | AST_AGI_DIR ASTAGIDIR |
| #define | AST_KEY_DIR ASTVARLIBDIR "/keys" |
| #define | AST_DB ASTVARLIBDIR "/astdb" |
| #define | AST_DATA_DIR ASTDATADIR |
| #define | AST_CONFIG_FILE ASTCONFPATH |
| #define | AST_SOUNDS ASTDATADIR "/sounds" |
| #define | AST_IMAGES ASTDATADIR "/images" |
Functions | |
| int | load_modules (void) |
| int | load_pbx (void) |
| int | init_logger (void) |
| int | init_framer (void) |
| int | reload_logger (int) |
| int | term_init (void) |
| int | astdb_init (void) |
|
|
Definition at line 28 of file asterisk.h. |
|
|
Definition at line 20 of file asterisk.h. Referenced by ast_save(). |
|
|
Definition at line 33 of file asterisk.h. |
|
|
Definition at line 19 of file asterisk.h. |
|
|
Definition at line 31 of file asterisk.h. |
|
|
Definition at line 30 of file asterisk.h. |
|
|
Definition at line 36 of file asterisk.h. |
|
|
Definition at line 29 of file asterisk.h. |
|
|
Definition at line 27 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 35 of file asterisk.h. Referenced by ast_say_date_with_format(). |
|
|
Definition at line 25 of file asterisk.h. |
|
|
Definition at line 26 of file asterisk.h. |
|
|
Definition at line 17 of file asterisk.h. |
|
|
Definition at line 415 of file db.c. References ast_cli_register(), cli_database_del, cli_database_deltree, cli_database_get, cli_database_put, and cli_database_show. Referenced by main().
00416 {
00417 dbinit();
00418 ast_cli_register(&cli_database_show);
00419 ast_cli_register(&cli_database_get);
00420 ast_cli_register(&cli_database_put);
00421 ast_cli_register(&cli_database_del);
00422 ast_cli_register(&cli_database_deltree);
00423 return 0;
00424 }
|
|
|
Definition at line 709 of file frame.c. References ast_cli_register(), cli_show_codec_n, cli_show_codecs, cli_show_codecs_audio, cli_show_codecs_image, and cli_show_codecs_video. Referenced by main().
00710 {
00711 #ifdef TRACE_FRAMES
00712 ast_cli_register(&cli_frame_stats);
00713 #endif
00714 ast_cli_register(&cli_show_codecs);
00715 ast_cli_register(&cli_show_codecs_audio);
00716 ast_cli_register(&cli_show_codecs_video);
00717 ast_cli_register(&cli_show_codecs_image);
00718 ast_cli_register(&cli_show_codec_n);
00719 return 0;
00720 }
|
|
|
Definition at line 355 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().
00355 {
00356 char tmp[256];
00357
00358 /* auto rotate if sig SIGXFSZ comes a-knockin */
00359 (void) signal(SIGXFSZ,(void *) handle_SIGXFSZ);
00360
00361 /* register the relaod logger cli command */
00362 ast_cli_register(&reload_logger_cli);
00363 ast_cli_register(&rotate_logger_cli);
00364
00365 /* create the eventlog */
00366 mkdir((char *)ast_config_AST_LOG_DIR, 0755);
00367 snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
00368 eventlog = fopen((char *)tmp, "a");
00369 if (eventlog) {
00370 init_logger_chain();
00371 ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
00372 if (option_verbose)
00373 ast_verbose("Asterisk Event Logger Started %s\n",(char *)tmp);
00374 return 0;
00375 } else
00376 ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
00377
00378 init_logger_chain();
00379
00380 /* create log channels */
00381 init_logger_chain();
00382 return -1;
00383 }
00384
|
|
|
Definition at line 339 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, option_debug, option_quiet, option_verbose, term_color(), and VERBOSE_PREFIX_1. Referenced by main().
00340 {
00341 struct ast_config *cfg;
00342 struct ast_variable *v;
00343 char tmp[80];
00344 if (option_verbose)
00345 ast_verbose( "Asterisk Dynamic Loader Starting:\n");
00346 cfg = ast_load(AST_MODULE_CONFIG);
00347 if (cfg) {
00348 /* Load explicitly defined modules */
00349 v = ast_variable_browse(cfg, "modules");
00350 while(v) {
00351 if (!strcasecmp(v->name, "load")) {
00352 if (option_debug && !option_verbose)
00353 ast_log(LOG_DEBUG, "Loading module %s\n", v->value);
00354 if (option_verbose) {
00355 ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, v->value, COLOR_BRWHITE, 0, sizeof(tmp)));
00356 fflush(stdout);
00357 }
00358 if (ast_load_resource(v->value)) {
00359 ast_log(LOG_WARNING, "Loading module %s failed!\n", v->value);
00360 if (cfg)
00361 ast_destroy(cfg);
00362 return -1;
00363 }
00364 }
00365 v=v->next;
00366 }
00367 }
00368 if (!cfg || ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
00369 /* Load all modules */
00370 DIR *mods;
00371 struct dirent *d;
00372 int x;
00373 /* Make two passes. First, load any resource modules, then load the others. */
00374 for (x=0;x<2;x++) {
00375 mods = opendir((char *)ast_config_AST_MODULE_DIR);
00376 if (mods) {
00377 while((d = readdir(mods))) {
00378 /* Must end in .so to load it. */
00379 if ((strlen(d->d_name) > 3) && (x || !strncasecmp(d->d_name, "res_", 4)) &&
00380 !strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
00381 !ast_resource_exists(d->d_name)) {
00382 /* It's a shared library -- Just be sure we're allowed to load it -- kinda
00383 an inefficient way to do it, but oh well. */
00384 if (cfg) {
00385 v = ast_variable_browse(cfg, "modules");
00386 while(v) {
00387 if (!strcasecmp(v->name, "noload") &&
00388 !strcasecmp(v->value, d->d_name))
00389 break;
00390 v = v->next;
00391 }
00392 if (v) {
00393 if (option_verbose) {
00394 ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
00395 fflush(stdout);
00396 }
00397 continue;
00398 }
00399
00400 }
00401 if (option_debug && !option_verbose)
00402 ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
00403 if (option_verbose) {
00404 ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, d->d_name, COLOR_BRWHITE, 0, sizeof(tmp)));
00405 fflush(stdout);
00406 }
00407 if (ast_load_resource(d->d_name)) {
00408 ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
00409 if (cfg)
00410 ast_destroy(cfg);
00411 return -1;
00412 }
00413 }
00414 }
00415 closedir(mods);
00416 } else {
00417 if (!option_quiet)
00418 ast_log(LOG_WARNING, "Unable to open modules directory %s.\n", (char *)ast_config_AST_MODULE_DIR);
00419 }
00420 }
00421 }
00422 ast_destroy(cfg);
00423 return 0;
00424 }
|
|
|
Definition at line 4560 of file pbx.c. Referenced by main().
04561 {
04562 int x;
04563 /* Initialize the PBX */
04564 if (option_verbose) {
04565 ast_verbose( "Asterisk PBX Core Initializing\n");
04566 ast_verbose( "Registering builtin applications:\n");
04567 }
04568 ast_cli_register(&show_applications_cli);
04569 ast_cli_register(&show_application_cli);
04570 ast_cli_register(&show_dialplan_cli);
04571 ast_cli_register(&show_switches_cli);
04572 for (x=0;x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
04573 if (option_verbose)
04574 ast_verbose( VERBOSE_PREFIX_1 "[%s]\n", builtins[x].name);
04575 if (ast_register_application(builtins[x].name, builtins[x].execute, builtins[x].synopsis, builtins[x].description)) {
04576 ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
04577 return -1;
04578 }
04579 }
04580 return 0;
04581 }
|
|
|
Definition at line 225 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, LOG_ERROR, LOG_EVENT, and option_verbose. Referenced by ast_log().
00225 {
00226 char old[AST_CONFIG_MAX_PATH];
00227 char new[AST_CONFIG_MAX_PATH];
00228 struct logchannel *f;
00229 FILE *myf;
00230
00231 int x;
00232 ast_mutex_lock(&loglock);
00233 if (eventlog)
00234 fclose(eventlog);
00235 else
00236 rotate = 0;
00237 eventlog = NULL;
00238
00239
00240
00241 mkdir((char *)ast_config_AST_LOG_DIR, 0755);
00242 snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
00243
00244 if(rotate) {
00245 for(x=0;;x++) {
00246 snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, EVENTLOG,x);
00247 myf = fopen((char *)new, "r");
00248 if(myf)
00249 fclose(myf);
00250 else
00251 break;
00252 }
00253
00254 /* do it */
00255 if (rename(old,new))
00256 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new);
00257 }
00258
00259 eventlog = fopen(old, "a");
00260
00261 f = logchannels;
00262 while(f) {
00263 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
00264 fclose(f->fileptr);
00265 f->fileptr = NULL;
00266 if(rotate) {
00267 strncpy(old, f->filename, sizeof(old));
00268
00269 for(x=0;;x++) {
00270 snprintf(new, sizeof(new), "%s.%d", f->filename, x);
00271 myf = fopen((char *)new, "r");
00272 if (myf) {
00273 fclose(myf);
00274 } else {
00275 break;
00276 }
00277 }
00278
00279 /* do it */
00280 if (rename(old,new))
00281 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new);
00282 }
00283 }
00284 f = f->next;
00285 }
00286
00287 ast_mutex_unlock(&loglock);
00288
00289 if (eventlog) {
00290 init_logger_chain();
00291 ast_log(LOG_EVENT, "Restarted Asterisk Event Logger\n");
00292 if (option_verbose)
00293 ast_verbose("Asterisk Event Logger restarted\n");
00294 return 0;
00295 } else
00296 ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
00297 init_logger_chain();
00298 pending_logger_reload = 0;
00299 return -1;
00300 }
00301
|
|
|
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, "crt", 3))
00044 vt100compat = 1; else
00045 if (!strncasecmp(term, "vt", 2))
00046 vt100compat = 1;
00047 if (vt100compat) {
00048 /* Make commands show up in nice colors */
00049 snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10);
00050 snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10);
00051 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC);
00052 }
00053 return 0;
00054 }
|
1.3.6-20040222