Asterisk - The Open Source Telephony Project  GIT-master-4a4f1a5
options.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  * \brief Options provided by main asterisk program
21  */
22 
23 #ifndef _ASTERISK_OPTIONS_H
24 #define _ASTERISK_OPTIONS_H
25 
26 #include "asterisk/autoconfig.h"
27 
28 #if defined(__cplusplus) || defined(c_plusplus)
29 extern "C" {
30 #endif
31 
32 #define AST_CACHE_DIR_LEN 512
33 #define AST_FILENAME_MAX 80
34 #define AST_CHANNEL_NAME 80 /*!< Max length of an ast_channel name */
35 
36 
37 /*! \ingroup main_options */
39  /*! Allow \#exec in config files */
41  /*! Do not fork() */
43  /*! Keep quiet */
44  AST_OPT_FLAG_QUIET = (1 << 2),
45  /*! Console mode */
47  /*! Run in realtime Linux priority */
49  /*! Initialize keys for RSA authentication */
51  /*! Remote console */
52  AST_OPT_FLAG_REMOTE = (1 << 6),
53  /*! Execute an asterisk CLI command upon startup */
54  AST_OPT_FLAG_EXEC = (1 << 7),
55  /*! Don't use termcap colors */
57  /*! Are we fully started yet? */
59  /*! Trascode via signed linear */
61  /*! Invoke the stdexten using the legacy macro method. */
63  /*! Dump core on a seg fault */
65  /*! Cache sound files */
67  /*! Display timestamp in CLI verbose output */
69  /*! Cache media frames for performance */
71  /*! Reconnect */
73  /*! Transmit Silence during Record() and DTMF Generation */
75  /*! Suppress some warnings */
77  /*! Reference Debugging */
79  /*! Always fork, even if verbose or debug settings are non-zero */
81  /*! Disable log/verbose output to remote consoles */
82  AST_OPT_FLAG_MUTE = (1 << 22),
83  /*! There is a per-module debug setting */
85  /*! There is a per-module trace setting */
87  /*! Terminal colors should be adjusted for a light-colored background */
89  /*! Make the global Message channel an internal channel to suppress AMI events */
91  /*! Force black background */
93  /*! Hide remote console connect messages on console */
95  /*! Protect the configuration file path with a lock */
97  /*! Generic PLC */
99  /*! Generic PLC onm equal codecs */
101 };
102 
103 /*! These are the options that set by default when Asterisk starts */
104 #define AST_DEFAULT_OPTIONS (AST_OPT_FLAG_TRANSCODE_VIA_SLIN | AST_OPT_FLAG_CACHE_MEDIA_FRAMES)
105 
106 #define ast_opt_exec_includes ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
107 #define ast_opt_no_fork ast_test_flag(&ast_options, AST_OPT_FLAG_NO_FORK)
108 #define ast_opt_quiet ast_test_flag(&ast_options, AST_OPT_FLAG_QUIET)
109 #define ast_opt_console ast_test_flag(&ast_options, AST_OPT_FLAG_CONSOLE)
110 #define ast_opt_high_priority ast_test_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
111 #define ast_opt_init_keys ast_test_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS)
112 #define ast_opt_remote ast_test_flag(&ast_options, AST_OPT_FLAG_REMOTE)
113 #define ast_opt_exec ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC)
114 #define ast_opt_no_color ast_test_flag(&ast_options, AST_OPT_FLAG_NO_COLOR)
115 #define ast_fully_booted ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
116 #define ast_opt_transcode_via_slin ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
117 /*! Invoke the stdexten using the legacy macro method. */
118 #define ast_opt_stdexten_macro ast_test_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO)
119 #define ast_opt_dump_core ast_test_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE)
120 #define ast_opt_cache_record_files ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
121 #define ast_opt_cache_media_frames ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_MEDIA_FRAMES)
122 #define ast_opt_timestamp ast_test_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP)
123 #define ast_opt_reconnect ast_test_flag(&ast_options, AST_OPT_FLAG_RECONNECT)
124 #define ast_opt_transmit_silence ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
125 #define ast_opt_dont_warn ast_test_flag(&ast_options, AST_OPT_FLAG_DONT_WARN)
126 #define ast_opt_always_fork ast_test_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
127 #define ast_opt_mute ast_test_flag(&ast_options, AST_OPT_FLAG_MUTE)
128 #define ast_opt_dbg_module ast_test_flag(&ast_options, AST_OPT_FLAG_DEBUG_MODULE)
129 #define ast_opt_trace_module ast_test_flag(&ast_options, AST_OPT_FLAG_TRACE_MODULE)
130 #define ast_opt_light_background ast_test_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND)
131 #define ast_opt_force_black_background ast_test_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
132 #define ast_opt_hide_connect ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT)
133 #define ast_opt_lock_confdir ast_test_flag(&ast_options, AST_OPT_FLAG_LOCK_CONFIG_DIR)
134 #define ast_opt_generic_plc ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC)
135 #define ast_opt_ref_debug ast_test_flag(&ast_options, AST_OPT_FLAG_REF_DEBUG)
136 #define ast_opt_generic_plc_on_equal_codecs ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS)
137 #define ast_opt_hide_messaging_ami_events ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS)
138 
139 /*! Maximum log level defined by PJPROJECT. */
140 #define MAX_PJ_LOG_MAX_LEVEL 6
141 /*!
142  * Normal PJPROJECT active log level used by Asterisk.
143  *
144  * These levels are usually mapped to Error and
145  * Warning Asterisk log levels which shouldn't
146  * normally be suppressed.
147  */
148 #define DEFAULT_PJ_LOG_MAX_LEVEL 2
149 
150 /*!
151  * \brief Get maximum log level pjproject was compiled with.
152  *
153  * \details
154  * Determine the maximum log level the pjproject we are running
155  * with supports.
156  *
157  * When pjproject is initially loaded the default log level in
158  * effect is the maximum log level the library was compiled to
159  * generate. We must save this value off somewhere before we
160  * change it to what we want to use as the default level.
161  *
162  * \note This must be done before calling pj_init() so the level
163  * we want to use as the default level is in effect while the
164  * library initializes.
165  */
166 #define AST_PJPROJECT_INIT_LOG_LEVEL() \
167  do { \
168  if (ast_pjproject_max_log_level < 0) { \
169  ast_pjproject_max_log_level = pj_log_get_level(); \
170  } \
171  pj_log_set_level(ast_option_pjproject_log_level); \
172  } while (0)
173 
174 /*! Current linked pjproject maximum logging level */
175 extern int ast_pjproject_max_log_level;
176 
177 #define DEFAULT_PJPROJECT_CACHE_POOLS 1
178 
179 /*! Current pjproject pool caching enable */
181 
182 /*! Current pjproject logging level */
184 
185 extern struct ast_flags ast_options;
186 
187 extern int option_verbose;
188 extern int ast_option_maxfiles; /*!< Max number of open file handles (files, sockets) */
189 extern int option_debug; /*!< Debugging */
190 extern int option_trace; /*!< Debugging */
191 extern int ast_option_maxcalls; /*!< Maximum number of simultaneous channels */
192 extern unsigned int option_dtmfminduration; /*!< Minimum duration of DTMF (channel.c) in ms */
193 extern double ast_option_maxload;
194 #if defined(HAVE_SYSINFO)
195 extern long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
196 #endif
197 extern char ast_defaultlanguage[];
198 
199 extern struct timeval ast_startuptime;
200 extern struct timeval ast_lastreloadtime;
201 extern pid_t ast_mainpid;
202 
204 
205 extern int ast_language_is_prefix;
206 
207 extern int ast_option_rtpusedynamic;
208 extern unsigned int ast_option_rtpptdynamic;
209 
210 #if defined(__cplusplus) || defined(c_plusplus)
211 }
212 #endif
213 
214 #endif /* _ASTERISK_OPTIONS_H */
int ast_option_rtpusedynamic
Definition: options.c:88
int ast_option_maxfiles
Definition: options.c:81
int option_debug
Definition: options.c:69
int ast_pjproject_max_log_level
Definition: options.c:73
int ast_option_maxcalls
Definition: options.c:79
int ast_option_pjproject_log_level
Definition: options.c:74
double ast_option_maxload
Definition: options.c:77
unsigned int ast_option_rtpptdynamic
Definition: options.c:89
int option_verbose
Definition: options.c:67
struct ast_flags ast_options
Definition: options.c:61
unsigned int option_dtmfminduration
Definition: options.c:83
int ast_option_pjproject_cache_pools
Definition: options.c:75
long option_minmemfree
Definition: options.c:86
int option_trace
Definition: options.c:71
ast_option_flags
Definition: options.h:38
@ AST_OPT_FLAG_TRACE_MODULE
Definition: options.h:86
@ AST_OPT_FLAG_HIGH_PRIORITY
Definition: options.h:48
@ AST_OPT_FLAG_GENERIC_PLC
Definition: options.h:98
@ AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS
Definition: options.h:90
@ AST_OPT_FLAG_TRANSCODE_VIA_SLIN
Definition: options.h:60
@ AST_OPT_FLAG_HIDE_CONSOLE_CONNECT
Definition: options.h:94
@ AST_OPT_FLAG_EXEC_INCLUDES
Definition: options.h:40
@ AST_OPT_FLAG_NO_COLOR
Definition: options.h:56
@ AST_OPT_FLAG_DEBUG_MODULE
Definition: options.h:84
@ AST_OPT_FLAG_NO_FORK
Definition: options.h:42
@ AST_OPT_FLAG_REF_DEBUG
Definition: options.h:78
@ AST_OPT_FLAG_TRANSMIT_SILENCE
Definition: options.h:74
@ AST_OPT_FLAG_ALWAYS_FORK
Definition: options.h:80
@ AST_OPT_FLAG_QUIET
Definition: options.h:44
@ AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS
Definition: options.h:100
@ AST_OPT_FLAG_STDEXTEN_MACRO
Definition: options.h:62
@ AST_OPT_FLAG_MUTE
Definition: options.h:82
@ AST_OPT_FLAG_CACHE_MEDIA_FRAMES
Definition: options.h:70
@ AST_OPT_FLAG_TIMESTAMP
Definition: options.h:68
@ AST_OPT_FLAG_LOCK_CONFIG_DIR
Definition: options.h:96
@ AST_OPT_FLAG_EXEC
Definition: options.h:54
@ AST_OPT_FLAG_CACHE_RECORD_FILES
Definition: options.h:66
@ AST_OPT_FLAG_FULLY_BOOTED
Definition: options.h:58
@ AST_OPT_FLAG_INIT_KEYS
Definition: options.h:50
@ AST_OPT_FLAG_CONSOLE
Definition: options.h:46
@ AST_OPT_FLAG_DONT_WARN
Definition: options.h:76
@ AST_OPT_FLAG_FORCE_BLACK_BACKGROUND
Definition: options.h:92
@ AST_OPT_FLAG_LIGHT_BACKGROUND
Definition: options.h:88
@ AST_OPT_FLAG_REMOTE
Definition: options.h:52
@ AST_OPT_FLAG_DUMP_CORE
Definition: options.h:64
@ AST_OPT_FLAG_RECONNECT
Definition: options.h:72
char record_cache_dir[AST_CACHE_DIR_LEN]
Definition: options.c:96
int ast_language_is_prefix
The following variable controls the layout of localized sound files. If 0, use the historical layout ...
Definition: file.c:67
#define AST_CACHE_DIR_LEN
Definition: options.h:32
struct timeval ast_lastreloadtime
Definition: asterisk.c:337
struct timeval ast_startuptime
Definition: asterisk.c:336
pid_t ast_mainpid
Definition: asterisk.c:315
char ast_defaultlanguage[]
Definition: options.c:98
Structure used to handle boolean flags.
Definition: utils.h:199