Sat Mar 24 23:26:53 2007

Asterisk developer's documentation


asterisk.h File Reference

Asterisk main include file. File version handling, generic pbx functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AST_CONFIG_MAX_PATH   255
#define ASTERISK_FILE_VERSION(file, version)
 Register/unregister a source code file with the core.
#define DEFAULT_LANGUAGE   "en"

Functions

void ast_channels_init (void)
void ast_register_file_version (const char *file, const char *version)
 Register the version of a source code file with the core.
int ast_set_priority (int)
void ast_unregister_file_version (const char *file)
 Unregister a source code file from the core.
int astdb_init (void)
void close_logger (void)
int dnsmgr_init (void)
void dnsmgr_reload (void)
void dnsmgr_start_refresh (void)
int init_framer (void)
int init_logger (void)
int load_modules (const int preload_only)
int load_pbx (void)
int reload_logger (int)
int term_init (void)

Variables

char ast_config_AST_AGI_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_CONFIG_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_CONFIG_FILE [AST_CONFIG_MAX_PATH]
char ast_config_AST_CTL [AST_CONFIG_MAX_PATH]
char ast_config_AST_CTL_GROUP [AST_CONFIG_MAX_PATH]
char ast_config_AST_CTL_OWNER [AST_CONFIG_MAX_PATH]
char ast_config_AST_CTL_PERMISSIONS [AST_CONFIG_MAX_PATH]
char ast_config_AST_DATA_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_DB [AST_CONFIG_MAX_PATH]
char ast_config_AST_KEY_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_LOG_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_MODULE_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_MONITOR_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_PID [AST_CONFIG_MAX_PATH]
char ast_config_AST_RUN_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_SOCKET [AST_CONFIG_MAX_PATH]
char ast_config_AST_SPOOL_DIR [AST_CONFIG_MAX_PATH]
char ast_config_AST_VAR_DIR [AST_CONFIG_MAX_PATH]


Detailed Description

Asterisk main include file. File version handling, generic pbx functions.

Definition in file asterisk.h.


Define Documentation

#define AST_CONFIG_MAX_PATH   255
 

Definition at line 23 of file asterisk.h.

Referenced by add_module(), build_filename(), csv_log(), file_ok_sel(), reload_logger(), vm_change_password(), and writefile().

#define ASTERISK_FILE_VERSION file,
version   ) 
 

Register/unregister a source code file with the core.

Parameters:
file the source file name
version the version string (typically a CVS revision keyword string)
This macro will place a file-scope constructor and destructor into the source of the module using it; this will cause the version of this file to registered with the Asterisk core (and unregistered) at the appropriate times.

Example:

 ASTERISK_FILE_VERSION(__FILE__, "\$Revision\$")

Note:
The dollar signs above have been protected with backslashes to keep SVN from modifying them in this file; under normal circumstances they would not be present and SVN would expand the Revision keyword into the file's revision number.

Definition at line 113 of file asterisk.h.

#define DEFAULT_LANGUAGE   "en"
 

Definition at line 21 of file asterisk.h.


Function Documentation

void ast_channels_init void   ) 
 

Definition at line 3785 of file channel.c.

References ast_cli_register(), and cli_show_channeltypes.

03786 {
03787    ast_cli_register(&cli_show_channeltypes);
03788 }

void ast_register_file_version const char *  file,
const char *  version
 

Register the version of a source code file with the core.

Parameters:
file the source file name
version the version string (typically a CVS revision keyword string)
Returns:
nothing
This function should not be called directly, but instead the ASTERISK_FILE_VERSION macro should be used to register a file with the core.

Definition at line 248 of file asterisk.c.

References AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_strdupa, ast_strip_quoted(), calloc, and list.

00249 {
00250    struct file_version *new;
00251    char *work;
00252    size_t version_length;
00253 
00254    work = ast_strdupa(version);
00255    work = ast_strip(ast_strip_quoted(work, "$", "$"));
00256    version_length = strlen(work) + 1;
00257 
00258    new = calloc(1, sizeof(*new) + version_length);
00259    if (!new)
00260       return;
00261 
00262    new->file = file;
00263    new->version = (char *) new + sizeof(*new);
00264    memcpy(new->version, work, version_length);
00265    AST_LIST_LOCK(&file_versions);
00266    AST_LIST_INSERT_HEAD(&file_versions, new, list);
00267    AST_LIST_UNLOCK(&file_versions);
00268 }

int ast_set_priority int  pri  ) 
 

We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy activity on it, this is a good thing.

Definition at line 790 of file asterisk.c.

References ast_log(), ast_verbose(), and LOG_WARNING.

Referenced by launch_script().

00791 {
00792    struct sched_param sched;
00793    memset(&sched, 0, sizeof(sched));
00794 #ifdef __linux__
00795    if (pri) {  
00796       sched.sched_priority = 10;
00797       if (sched_setscheduler(0, SCHED_RR, &sched)) {
00798          ast_log(LOG_WARNING, "Unable to set high priority\n");
00799          return -1;
00800       } else
00801          if (option_verbose)
00802             ast_verbose("Set to realtime thread\n");
00803    } else {
00804       sched.sched_priority = 0;
00805       if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
00806          ast_log(LOG_WARNING, "Unable to set normal priority\n");
00807          return -1;
00808       }
00809    }
00810 #else
00811    if (pri) {
00812       if (setpriority(PRIO_PROCESS, 0, -10) == -1) {
00813          ast_log(LOG_WARNING, "Unable to set high priority\n");
00814          return -1;
00815       } else
00816          if (option_verbose)
00817             ast_verbose("Set to high priority\n");
00818    } else {
00819       if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
00820          ast_log(LOG_WARNING, "Unable to set normal priority\n");
00821          return -1;
00822       }
00823    }
00824 #endif
00825    return 0;
00826 }

void ast_unregister_file_version const char *  file  ) 
 

Unregister a source code file from the core.

Parameters:
file the source file name
Returns:
nothing
This function should not be called directly, but instead the ASTERISK_FILE_VERSION macro should be used to automatically unregister the file when the module is unloaded.

Definition at line 270 of file asterisk.c.

References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, free, and list.

00271 {
00272    struct file_version *find;
00273 
00274    AST_LIST_LOCK(&file_versions);
00275    AST_LIST_TRAVERSE_SAFE_BEGIN(&file_versions, find, list) {
00276       if (!strcasecmp(find->file, file)) {
00277          AST_LIST_REMOVE_CURRENT(&file_versions, list);
00278          break;
00279       }
00280    }
00281    AST_LIST_TRAVERSE_SAFE_END;
00282    AST_LIST_UNLOCK(&file_versions);
00283    if (find)
00284       free(find);
00285 }

int astdb_init void   ) 
 

Definition at line 585 of file db.c.

References ast_cli_register(), ast_manager_register, cli_database_del, cli_database_deltree, cli_database_get, cli_database_put, cli_database_show, cli_database_showkey, dbinit(), EVENT_FLAG_SYSTEM, manager_dbget(), and manager_dbput().

void close_logger void   ) 
 

Definition at line 638 of file logger.c.

References ast_mutex_lock(), ast_mutex_unlock(), free, last, list, msglist::msg, msgcnt, and msglist::next.

00639 {
00640    struct msglist *m, *tmp;
00641 
00642    ast_mutex_lock(&msglist_lock);
00643    m = list;
00644    while(m) {
00645       if (m->msg) {
00646          free(m->msg);
00647       }
00648       tmp = m->next;
00649       free(m);
00650       m = tmp;
00651    }
00652    list = last = NULL;
00653    msgcnt = 0;
00654    ast_mutex_unlock(&msglist_lock);
00655    return;
00656 }

int dnsmgr_init void   ) 
 

Definition at line 285 of file dnsmgr.c.

References ast_cli_register(), AST_LIST_HEAD_INIT, ast_log(), cli_reload, cli_status, do_reload(), LOG_ERROR, sched, and sched_context_create().

00286 {
00287    sched = sched_context_create();
00288    if (!sched) {
00289       ast_log(LOG_ERROR, "Unable to create schedule context.\n");
00290       return -1;
00291    }
00292    AST_LIST_HEAD_INIT(&entry_list);
00293    ast_cli_register(&cli_reload);
00294    ast_cli_register(&cli_status);
00295    return do_reload(1);
00296 }

void dnsmgr_reload void   ) 
 

Definition at line 298 of file dnsmgr.c.

References do_reload().

Referenced by ast_module_reload().

00299 {
00300    do_reload(0);
00301 }

void dnsmgr_start_refresh void   ) 
 

Definition at line 194 of file dnsmgr.c.

References ast_sched_add_variable(), ast_sched_del(), master_refresh_info, refresh_list(), and sched.

00195 {
00196    if (refresh_sched > -1) {
00197       ast_sched_del(sched, refresh_sched);
00198       refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1);
00199    }
00200 }

int init_framer void   ) 
 

Definition at line 852 of file frame.c.

References ast_cli_register_multiple(), and my_clis.

00853 {
00854    ast_cli_register_multiple(my_clis, sizeof(my_clis)/sizeof(my_clis[0]) );
00855    return 0;   
00856 }

int init_logger void   ) 
 

Definition at line 597 of file logger.c.

References ast_cli_register(), ast_log(), ast_queue_log(), ast_verbose(), eventlog, EVENTLOG, handle_SIGXFSZ(), init_logger_chain(), LOG_ERROR, LOG_EVENT, logfiles, logger_show_channels_cli, option_verbose, qlog, QUEUELOG, reload_logger_cli, and rotate_logger_cli.

00598 {
00599    char tmp[256];
00600    int res = 0;
00601 
00602    /* auto rotate if sig SIGXFSZ comes a-knockin */
00603    (void) signal(SIGXFSZ,(void *) handle_SIGXFSZ);
00604 
00605    /* register the relaod logger cli command */
00606    ast_cli_register(&reload_logger_cli);
00607    ast_cli_register(&rotate_logger_cli);
00608    ast_cli_register(&logger_show_channels_cli);
00609 
00610    mkdir((char *)ast_config_AST_LOG_DIR, 0755);
00611   
00612    /* create log channels */
00613    init_logger_chain();
00614 
00615    /* create the eventlog */
00616    if (logfiles.event_log) {
00617       mkdir((char *)ast_config_AST_LOG_DIR, 0755);
00618       snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
00619       eventlog = fopen((char *)tmp, "a");
00620       if (eventlog) {
00621          ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
00622          if (option_verbose)
00623             ast_verbose("Asterisk Event Logger Started %s\n",(char *)tmp);
00624       } else {
00625          ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
00626          res = -1;
00627       }
00628    }
00629 
00630    if (logfiles.queue_log) {
00631       snprintf(tmp, sizeof(tmp), "%s/%s", (char *)ast_config_AST_LOG_DIR, QUEUELOG);
00632       qlog = fopen(tmp, "a");
00633       ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", "");
00634    }
00635    return res;
00636 }

int load_modules const int  preload_only  ) 
 

Definition at line 465 of file loader.c.

References __load_resource(), ast_config_destroy(), ast_config_load(), ast_log(), AST_MODULE_CONFIG, ast_variable_browse(), ast_verbose(), cfg, COLOR_BRWHITE, LOG_DEBUG, LOG_WARNING, ast_variable::name, ast_variable::next, option_debug, option_verbose, term_color(), ast_variable::value, and VERBOSE_PREFIX_1.

00466 {
00467    struct ast_config *cfg;
00468    struct ast_variable *v;
00469    char tmp[80];
00470 
00471    if (option_verbose) {
00472       if (preload_only)
00473          ast_verbose("Asterisk Dynamic Loader loading preload modules:\n");
00474       else
00475          ast_verbose("Asterisk Dynamic Loader Starting:\n");
00476    }
00477 
00478    cfg = ast_config_load(AST_MODULE_CONFIG);
00479    if (cfg) {
00480       int doload;
00481 
00482       /* Load explicitly defined modules */
00483       for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
00484          doload = 0;
00485 
00486          if (preload_only)
00487             doload = !strcasecmp(v->name, "preload");
00488          else
00489             doload = !strcasecmp(v->name, "load");
00490 
00491              if (doload) {
00492             if (option_debug && !option_verbose)
00493                ast_log(LOG_DEBUG, "Loading module %s\n", v->value);
00494             if (option_verbose) {
00495                ast_verbose(VERBOSE_PREFIX_1 "[%s]", term_color(tmp, v->value, COLOR_BRWHITE, 0, sizeof(tmp)));
00496                fflush(stdout);
00497             }
00498             if (__load_resource(v->value, cfg)) {
00499                ast_log(LOG_WARNING, "Loading module %s failed!\n", v->value);
00500                ast_config_destroy(cfg);
00501                return -1;
00502             }
00503          }
00504       }
00505    }
00506 
00507    if (preload_only) {
00508       ast_config_destroy(cfg);
00509       return 0;
00510    }
00511 
00512    if (!cfg || ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
00513       /* Load all modules */
00514       DIR *mods;
00515       struct dirent *d;
00516       int x;
00517 
00518       /* Loop through each order */
00519       for (x=0; x<sizeof(loadorder) / sizeof(loadorder[0]); x++) {
00520          mods = opendir((char *)ast_config_AST_MODULE_DIR);
00521          if (mods) {
00522             while((d = readdir(mods))) {
00523                /* Must end in .so to load it.  */
00524                if ((strlen(d->d_name) > 3) && 
00525                    (!loadorder[x] || !strncasecmp(d->d_name, loadorder[x], strlen(loadorder[x]))) && 
00526                    !strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
00527                   !ast_resource_exists(d->d_name)) {
00528                   /* It's a shared library -- Just be sure we're allowed to load it -- kinda
00529                      an inefficient way to do it, but oh well. */
00530                   if (cfg) {
00531                      v = ast_variable_browse(cfg, "modules");
00532                      while(v) {
00533                         if (!strcasecmp(v->name, "noload") &&
00534                             !strcasecmp(v->value, d->d_name)) 
00535                            break;
00536                         v = v->next;
00537                      }
00538                      if (v) {
00539                         if (option_verbose) {
00540                            ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
00541                            fflush(stdout);
00542                         }
00543                         continue;
00544                      }
00545                      
00546                   }
00547                   if (option_debug && !option_verbose)
00548                      ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
00549                   if (option_verbose) {
00550                      ast_verbose( VERBOSE_PREFIX_1 "[%s]", term_color(tmp, d->d_name, COLOR_BRWHITE, 0, sizeof(tmp)));
00551                      fflush(stdout);
00552                   }
00553                   if (__load_resource(d->d_name, cfg)) {
00554                      ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
00555                      if (cfg)
00556                         ast_config_destroy(cfg);
00557                      return -1;
00558                   }
00559                }
00560             }
00561             closedir(mods);
00562          } else {
00563             if (!option_quiet)
00564                ast_log(LOG_WARNING, "Unable to open modules directory %s.\n", (char *)ast_config_AST_MODULE_DIR);
00565          }
00566       }
00567    } 
00568    ast_config_destroy(cfg);
00569    return 0;
00570 }

int load_pbx void   ) 
 

Definition at line 6233 of file pbx.c.

References ast_cli_register_multiple(), AST_LIST_HEAD_INIT_NOLOCK, ast_log(), ast_register_application(), ast_verbose(), builtins, description, LOG_ERROR, name, option_verbose, pbx_cli, synopsis, and VERBOSE_PREFIX_1.

06234 {
06235    int x;
06236 
06237    /* Initialize the PBX */
06238    if (option_verbose) {
06239       ast_verbose( "Asterisk PBX Core Initializing\n");
06240       ast_verbose( "Registering builtin applications:\n");
06241    }
06242    AST_LIST_HEAD_INIT_NOLOCK(&globals);
06243    ast_cli_register_multiple(pbx_cli, sizeof(pbx_cli) / sizeof(pbx_cli[0]));
06244 
06245    /* Register builtin applications */
06246    for (x=0; x<sizeof(builtins) / sizeof(struct pbx_builtin); x++) {
06247       if (option_verbose)
06248          ast_verbose( VERBOSE_PREFIX_1 "[%s]\n", builtins[x].name);
06249       if (ast_register_application(builtins[x].name, builtins[x].execute, builtins[x].synopsis, builtins[x].description)) {
06250          ast_log(LOG_ERROR, "Unable to register builtin application '%s'\n", builtins[x].name);
06251          return -1;
06252       }
06253    }
06254    return 0;
06255 }

int reload_logger int   ) 
 

Definition at line 378 of file logger.c.

References ast_config_AST_LOG_DIR, AST_CONFIG_MAX_PATH, ast_mutex_lock(), logchannel::disabled, EVENT_FLAG_SYSTEM, eventlog, logchannel::filename, logchannel::fileptr, logchannels, manager_event(), and qlog.

Referenced by ast_log(), handle_logger_reload(), and handle_logger_rotate().

00379 {
00380    char old[AST_CONFIG_MAX_PATH] = "";
00381    char new[AST_CONFIG_MAX_PATH];
00382    int event_rotate = rotate, queue_rotate = rotate;
00383    struct logchannel *f;
00384    FILE *myf;
00385    int x, res = 0;
00386 
00387    ast_mutex_lock(&loglock);
00388    if (eventlog) 
00389       fclose(eventlog);
00390    else 
00391       event_rotate = 0;
00392    eventlog = NULL;
00393 
00394    if (qlog) 
00395       fclose(qlog);
00396    else 
00397       queue_rotate = 0;
00398    qlog = NULL;
00399 
00400    mkdir((char *)ast_config_AST_LOG_DIR, 0755);
00401 
00402    f = logchannels;
00403    while(f) {
00404       if (f->disabled) {
00405          f->disabled = 0;  /* Re-enable logging at reload */
00406          manager_event(EVENT_FLAG_SYSTEM, "LogChannel", "Channel: %s\r\nEnabled: Yes\r\n", f->filename);
00407       }
00408       if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
00409          fclose(f->fileptr);  /* Close file */
00410          f->fileptr = NULL;
00411          if(rotate) {
00412             ast_copy_string(old, f->filename, sizeof(old));
00413    
00414             for(x=0;;x++) {
00415                snprintf(new, sizeof(new), "%s.%d", f->filename, x);
00416                myf = fopen((char *)new, "r");
00417                if (myf) {
00418                   fclose(myf);
00419                } else {
00420                   break;
00421                }
00422             }
00423        
00424             /* do it */
00425             if (rename(old,new))
00426                fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new);
00427          }
00428       }
00429       f = f->next;
00430    }
00431 
00432    filesize_reload_needed = 0;
00433 
00434    init_logger_chain();
00435 
00436    if (logfiles.event_log) {
00437       snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, EVENTLOG);
00438       if (event_rotate) {
00439          for (x=0;;x++) {
00440             snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, EVENTLOG,x);
00441             myf = fopen((char *)new, "r");
00442             if (myf)    /* File exists */
00443                fclose(myf);
00444             else
00445                break;
00446          }
00447    
00448          /* do it */
00449          if (rename(old,new))
00450             ast_log(LOG_ERROR, "Unable to rename file '%s' to '%s'\n", old, new);
00451       }
00452 
00453       eventlog = fopen(old, "a");
00454       if (eventlog) {
00455          ast_log(LOG_EVENT, "Restarted Asterisk Event Logger\n");
00456          if (option_verbose)
00457             ast_verbose("Asterisk Event Logger restarted\n");
00458       } else {
00459          ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
00460          res = -1;
00461       }
00462    }
00463 
00464    if (logfiles.queue_log) {
00465       snprintf(old, sizeof(old), "%s/%s", (char *)ast_config_AST_LOG_DIR, QUEUELOG);
00466       if (queue_rotate) {
00467          for (x = 0; ; x++) {
00468             snprintf(new, sizeof(new), "%s/%s.%d", (char *)ast_config_AST_LOG_DIR, QUEUELOG, x);
00469             myf = fopen((char *)new, "r");
00470             if (myf)    /* File exists */
00471                fclose(myf);
00472             else
00473                break;
00474          }
00475    
00476          /* do it */
00477          if (rename(old, new))
00478             ast_log(LOG_ERROR, "Unable to rename file '%s' to '%s'\n", old, new);
00479       }
00480 
00481       qlog = fopen(old, "a");
00482       if (qlog) {
00483          ast_queue_log("NONE", "NONE", "NONE", "CONFIGRELOAD", "%s", "");
00484          ast_log(LOG_EVENT, "Restarted Asterisk Queue Logger\n");
00485          if (option_verbose)
00486             ast_verbose("Asterisk Queue Logger restarted\n");
00487       } else {
00488          ast_log(LOG_ERROR, "Unable to create queue log: %s\n", strerror(errno));
00489          res = -1;
00490       }
00491    }
00492    ast_mutex_unlock(&loglock);
00493 
00494    return res;
00495 }

int term_init void   ) 
 

Definition at line 74 of file term.c.

References option_console, option_nocolor, and option_nofork.

00075 {
00076    char *term = getenv("TERM");
00077    char termfile[256] = "";
00078    char buffer[512] = "";
00079    int termfd = -1, parseokay = 0, i;
00080 
00081    if (!term)
00082       return 0;
00083    if (!option_console || option_nocolor || !option_nofork)
00084       return 0;
00085 
00086    for (i=0 ;; i++) {
00087       if (termpath[i] == NULL) {
00088          break;
00089       }
00090       snprintf(termfile, sizeof(termfile), "%s/%c/%s", termpath[i], *term, term);
00091       termfd = open(termfile, O_RDONLY);
00092       if (termfd > -1) {
00093          break;
00094       }
00095    }
00096    if (termfd > -1) {
00097       int actsize = read(termfd, buffer, sizeof(buffer) - 1);
00098       short sz_names = convshort(buffer + 2);
00099       short sz_bools = convshort(buffer + 4);
00100       short n_nums   = convshort(buffer + 6);
00101 
00102       /* if ((sz_names + sz_bools) & 1)
00103          sz_bools++; */
00104 
00105       if (sz_names + sz_bools + n_nums < actsize) {
00106          /* Offset 13 is defined in /usr/include/term.h, though we do not
00107           * include it here, as it conflicts with include/asterisk/term.h */
00108          short max_colors = convshort(buffer + 12 + sz_names + sz_bools + 13 * 2);
00109          if (max_colors > 0) {
00110             vt100compat = 1;
00111          }
00112          parseokay = 1;
00113       }
00114       close(termfd);
00115    }
00116 
00117    if (!parseokay) {
00118       /* These comparisons should not be substrings nor case-insensitive, as
00119        * terminal types are very particular about how they treat suffixes and
00120        * capitalization.  For example, terminal type 'linux-m' does NOT
00121        * support color, while 'linux' does.  Not even all vt100* terminals
00122        * support color, either (e.g. 'vt100+fnkeys'). */
00123       if (!strcmp(term, "linux")) {
00124          vt100compat = 1;
00125       } else if (!strcmp(term, "xterm")) {
00126          vt100compat = 1;
00127       } else if (!strcmp(term, "xterm-color")) {
00128          vt100compat = 1;
00129       } else if (!strncmp(term, "Eterm", 5)) {
00130          /* Both entries which start with Eterm support color */
00131          vt100compat = 1;
00132       } else if (!strcmp(term, "vt100")) {
00133          vt100compat = 1;
00134       } else if (!strncmp(term, "crt", 3)) {
00135          /* Both crt terminals support color */
00136          vt100compat = 1;
00137       }
00138    }
00139 
00140    if (vt100compat) {
00141       /* Make commands show up in nice colors */
00142       snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10);
00143       snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10);
00144       snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC);
00145    }
00146    return 0;
00147 }


Variable Documentation

char ast_config_AST_AGI_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 221 of file asterisk.c.

Referenced by launch_script().

char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 213 of file asterisk.c.

Referenced by ast_ael_compile(), compile_script(), config_text_file_load(), config_text_file_save(), handle_save_dialplan(), ices_exec(), and vm_change_password().

char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH]
 

Definition at line 214 of file asterisk.c.

char ast_config_AST_CTL[AST_CONFIG_MAX_PATH]
 

Definition at line 232 of file asterisk.c.

char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH]
 

Definition at line 231 of file asterisk.c.

char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH]
 

Definition at line 230 of file asterisk.c.

char ast_config_AST_CTL_PERMISSIONS[AST_CONFIG_MAX_PATH]
 

Definition at line 229 of file asterisk.c.

char ast_config_AST_DATA_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 219 of file asterisk.c.

Referenced by build_filename(), and make_filename().

char ast_config_AST_DB[AST_CONFIG_MAX_PATH]
 

Definition at line 222 of file asterisk.c.

Referenced by dbinit().

char ast_config_AST_KEY_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 223 of file asterisk.c.

char ast_config_AST_LOG_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 220 of file asterisk.c.

Referenced by csv_log(), load_config(), load_module(), make_logchannel(), reload_logger(), testclient_exec(), testserver_exec(), and writefile().

char ast_config_AST_MODULE_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 215 of file asterisk.c.

Referenced by __load_resource(), add_module(), complete_fn(), and file_ok_sel().

char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 217 of file asterisk.c.

Referenced by ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), chanspy_exec(), and mixmonitor_exec().

char ast_config_AST_PID[AST_CONFIG_MAX_PATH]
 

Definition at line 224 of file asterisk.c.

char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 226 of file asterisk.c.

char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH]
 

Definition at line 225 of file asterisk.c.

char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 216 of file asterisk.c.

Referenced by conf_run(), dictate_exec(), hasvoicemail_internal(), load_module(), and play_mailbox_owner().

char ast_config_AST_VAR_DIR[AST_CONFIG_MAX_PATH]
 

Definition at line 218 of file asterisk.c.

Referenced by ast_linear_stream(), and reload_firmware().


Generated on Sat Mar 24 23:26:55 2007 for Asterisk - the Open Source PBX by  doxygen 1.4.6