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().
00356 {
00357 char tmp[256];
00358
00359 /* auto rotate if sig SIGXFSZ comes a-knockin */
00360 (void) signal(SIGXFSZ,(void *) handle_SIGXFSZ);
00361
00362 /* register the relaod logger cli command */
00363 ast_cli_register(&reload_logger_cli);
00364 ast_cli_register(&rotate_logger_cli);
00365
00366 /* create the eventlog */
00367 mkdir((char *)ast_config_AST_LOG_DIR, 0755);
00368 snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
00369 eventlog = fopen((char *)tmp, "a");
00370 if (eventlog) {
00371 init_logger_chain();
00372 ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
00373 if (option_verbose)
00374 ast_verbose("Asterisk Event Logger Started %s\n",(char *)tmp);
00375 return 0;
00376 } else
00377 ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
00378
00379 init_logger_chain();
00380
00381 /* create log channels */
00382 init_logger_chain();
00383 return -1;
00384 }
|
|
|
Definition at line 338 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().
00339 {
00340 struct ast_config *cfg;
00341 struct ast_variable *v;
00342 char tmp[80];
00343 if (option_verbose)
00344 ast_verbose( "Asterisk Dynamic Loader Starting:\n");
00345 cfg = ast_load(AST_MODULE_CONFIG);
00346 if (cfg) {
00347 /* Load explicitly defined modules */
00348 v = ast_variable_browse(cfg, "modules");
00349 while(v) {
00350 if (!strcasecmp(v->name, "load")) {
00351 if (option_debug && !option_verbose)
00352 ast_log(LOG_DEBUG, "Loading module %s\n", v->value);
00353 if (option_verbose) {
00354 ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, v->value, COLOR_BRWHITE, 0, sizeof(tmp)));
00355 fflush(stdout);
00356 }
00357 if (ast_load_resource(v->value)) {
00358 ast_log(LOG_WARNING, "Loading module %s failed!\n", v->value);
00359 if (cfg)
00360 ast_destroy(cfg);
00361 return -1;
00362 }
00363 }
00364 v=v->next;
00365 }
00366 }
00367 if (!cfg || ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
00368 /* Load all modules */
00369 DIR *mods;
00370 struct dirent *d;
00371 int x;
00372 /* Make two passes. First, load any resource modules, then load the others. */
00373 for (x=0;x<2;x++) {
00374 mods = opendir((char *)ast_config_AST_MODULE_DIR);
00375 if (mods) {
00376 while((d = readdir(mods))) {
00377 /* Must end in .so to load it. */
00378 if ((strlen(d->d_name) > 3) && (x || !strncasecmp(d->d_name, "res_", 4)) &&
00379 !strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
00380 !ast_resource_exists(d->d_name)) {
00381 /* It's a shared library -- Just be sure we're allowed to load it -- kinda
00382 an inefficient way to do it, but oh well. */
00383 if (cfg) {
00384 v = ast_variable_browse(cfg, "modules");
00385 while(v) {
00386 if (!strcasecmp(v->name, "noload") &&
00387 !strcasecmp(v->value, d->d_name))
00388 break;
00389 v = v->next;
00390 }
00391 if (v) {
00392 if (option_verbose) {
00393 ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
00394 fflush(stdout);
00395 }
00396 continue;
00397 }
00398
00399 }
00400 if (option_debug && !option_verbose)
00401 ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
00402 if (option_verbose) {
00403 ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, d->d_name, COLOR_BRWHITE, 0, sizeof(tmp)));
00404 fflush(stdout);
00405 }
00406 if (ast_load_resource(d->d_name)) {
00407 ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
00408 if (cfg)
00409 ast_destroy(cfg);
00410 return -1;
00411 }
00412 }
00413 }
00414 closedir(mods);
00415 } else {
00416 if (!option_quiet)
00417 ast_log(LOG_WARNING, "Unable to open modules directory %s.\n", (char *)ast_config_AST_MODULE_DIR);
00418 }
00419 }
00420 }
00421 ast_destroy(cfg);
00422 return 0;
00423 }
|
|
|
Definition at line 4550 of file pbx.c. Referenced by main().
04551 {
04552 int x;
04553 /* Initialize the PBX */
04554 if (option_verbose) {
04555 ast_verbose( "Asterisk PBX Core Initializing\n");
04556 ast_verbose( "Registering builtin applications:\n");
04557 }
04558 ast_cli_register(&show_applications_cli);
04559 ast_cli_register(&show_application_cli);
04560 ast_cli_register(&show_dialplan_cli);
04561 ast_cli_register(&show_switches_cli);
04562 for (x=0;x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
04563 if (option_verbose)
04564 ast_verbose( VERBOSE_PREFIX_1 "[%s]\n", builtins[x].name);
04565 if (ast_register_application(builtins[x].name, builtins[x].execute, builtins[x].synopsis, builtins[x].description)) {
04566 ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
04567 return -1;
04568 }
04569 }
04570 return 0;
04571 }
|
|
|
Definition at line 223 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.
00224 {
00225 char old[AST_CONFIG_MAX_PATH];
00226 char new[AST_CONFIG_MAX_PATH];
00227 struct logchannel *f;
00228 FILE *myf;
00229
00230 int x;
00231
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 return -1;
00299 }
|
|
|
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.5