#include "asterisk.h"
#include <syslog.h>
#include "asterisk/_private.h"
#include "asterisk/paths.h"
#include "asterisk/logger.h"
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/term.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/manager.h"
#include "asterisk/threadstorage.h"
#include "asterisk/strings.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include <signal.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <execinfo.h>

Go to the source code of this file.
Data Structures | |
| struct | logchannel |
| struct | logchannels |
| struct | logmsg |
| struct | logmsgs |
| struct | verb |
| struct | verbosers |
Defines | |
| #define | FORMATL "%-35.35s %-8.8s %-9.9s " |
| #define | GETTID() getpid() |
| #define | LOG_BUF_INIT_SIZE 256 |
| #define | MAX_BACKTRACE_FRAMES 20 |
| #define | VERBOSE_BUF_INIT_SIZE 256 |
Enumerations | |
| enum | logmsgtypes { LOGMSG_NORMAL = 0, LOGMSG_VERBOSE } |
| enum | logtypes { LOGTYPE_SYSLOG, LOGTYPE_FILE, LOGTYPE_CONSOLE } |
| enum | rotatestrategy { SEQUENTIAL = 1 << 0, ROTATE = 1 << 1, TIMESTAMP = 1 << 2 } |
Functions | |
| void | __ast_verbose (const char *file, int line, const char *func, const char *fmt,...) |
| This works like ast_log, but prints verbose messages to the console depending on verbosity level set. ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing"); This will print the message to the console if the verbose level is set to a level >= 3 Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important. VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined. | |
| void | __ast_verbose_ap (const char *file, int line, const char *func, const char *fmt, va_list ap) |
| static void | __init_log_buf (void) |
| static void | __init_verbose_buf (void) |
| static void | _handle_SIGXFSZ (int sig) |
| void | ast_backtrace (void) |
| struct ast_bt * | ast_bt_create (void) |
| void * | ast_bt_destroy (struct ast_bt *bt) |
| int | ast_bt_get_addresses (struct ast_bt *bt) |
| void | ast_child_verbose (int level, const char *fmt,...) |
| void | ast_log (int level, const char *file, int line, const char *function, const char *fmt,...) |
| send log messages to syslog and/or the console | |
| static void | ast_log_vsyslog (struct logmsg *msg) |
| int | ast_logger_register_level (const char *name) |
| Register a new logger level. | |
| void | ast_logger_unregister_level (const char *name) |
| Unregister a previously registered logger level. | |
| void | ast_queue_log (const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...) |
| int | ast_register_verbose (void(*v)(const char *string)) |
| int | ast_unregister_verbose (void(*v)(const char *string)) |
| void | ast_verbose (const char *fmt,...) |
| void | close_logger (void) |
| static char * | handle_logger_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static char * | handle_logger_rotate (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static char * | handle_logger_set_level (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| static char * | handle_logger_show_channels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| CLI command to show logging system configuration. | |
| int | init_logger (void) |
| static void | init_logger_chain (int locked) |
| static void | logger_print_normal (struct logmsg *logmsg) |
| Print a normal log message to the channels. | |
| static void | logger_queue_init (void) |
| int | logger_reload (void) |
| Reload the logger module without rotating log files (also used from loader.c during a full Asterisk reload). | |
| static void * | logger_thread (void *data) |
| Actual logging thread. | |
| static unsigned int | make_components (const char *s, int lineno) |
| static struct logchannel * | make_logchannel (const char *channel, const char *components, int lineno) |
| static int | reload_logger (int rotate) |
| static int | rotate_file (const char *filename) |
| static void | update_logchannels (void) |
Variables | |
| static struct ast_cli_entry | cli_logger [] |
| static int | close_logger_thread = 0 |
| static const int | colors [32] |
| Colors used in the console for logging. | |
| static char | dateformat [256] = "%b %e %T" |
| static char | exec_after_rotate [256] = "" |
| static int | filesize_reload_needed |
| static unsigned int | global_logmask = 0xFFFF |
| static struct sigaction | handle_SIGXFSZ |
| static char | hostname [MAXHOSTNAMELEN] |
| static char * | levels [32] |
| Logging channels used in the Asterisk logging system. | |
| static struct ast_threadstorage | log_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_log_buf , .custom_init = NULL , } |
| static ast_cond_t | logcond |
| struct { | |
| unsigned int queue_adaptive_realtime:1 | |
| unsigned int queue_log:1 | |
| unsigned int queue_log_to_file:1 | |
| } | logfiles |
| static pthread_t | logthread = AST_PTHREADT_NULL |
| static FILE * | qlog |
| static char | queue_log_name [256] = QUEUELOG |
| static int | queuelog_init |
| static struct ast_threadstorage | verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_verbose_buf , .custom_init = NULL , } |
Logging routines
Definition in file logger.c.
| #define FORMATL "%-35.35s %-8.8s %-9.9s " |
Referenced by handle_logger_show_channels().
| #define VERBOSE_BUF_INIT_SIZE 256 |
| enum logmsgtypes |
Definition at line 122 of file logger.c.
00122 { 00123 LOGMSG_NORMAL = 0, 00124 LOGMSG_VERBOSE, 00125 };
| enum logtypes |
Definition at line 93 of file logger.c.
00093 { 00094 LOGTYPE_SYSLOG, 00095 LOGTYPE_FILE, 00096 LOGTYPE_CONSOLE, 00097 };
| enum rotatestrategy |
Definition at line 79 of file logger.c.
00079 { 00080 SEQUENTIAL = 1 << 0, /* Original method - create a new file, in order */ 00081 ROTATE = 1 << 1, /* Rotate all files, such that the oldest file has the highest suffix */ 00082 TIMESTAMP = 1 << 2, /* Append the epoch timestamp onto the end of the archived file */ 00083 } rotatestrategy = SEQUENTIAL;
| void __ast_verbose | ( | const char * | file, | |
| int | line, | |||
| const char * | func, | |||
| const char * | fmt, | |||
| ... | ||||
| ) |
This works like ast_log, but prints verbose messages to the console depending on verbosity level set. ast_verbose(VERBOSE_PREFIX_3 "Whatever %s is happening\n", "nothing"); This will print the message to the console if the verbose level is set to a level >= 3 Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important. VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined.
Send a verbose message (based on verbose level)
Definition at line 1293 of file logger.c.
References __ast_verbose_ap().
01294 { 01295 va_list ap; 01296 01297 va_start(ap, fmt); 01298 __ast_verbose_ap(file, line, func, fmt, ap); 01299 va_end(ap); 01300 }
| void __ast_verbose_ap | ( | const char * | file, | |
| int | line, | |||
| const char * | func, | |||
| const char * | fmt, | |||
| va_list | ap | |||
| ) |
Definition at line 1257 of file logger.c.
References __LOG_VERBOSE, AST_DYNSTR_BUILD_FAILED, ast_localtime(), ast_log(), ast_opt_timestamp, ast_str_buffer(), ast_str_set_va(), ast_str_thread_get(), ast_strftime(), ast_tvnow(), verbose_buf, and VERBOSE_BUF_INIT_SIZE.
Referenced by __ast_verbose(), and ast_verbose().
01258 { 01259 struct ast_str *buf = NULL; 01260 int res = 0; 01261 01262 if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE))) 01263 return; 01264 01265 if (ast_opt_timestamp) { 01266 struct timeval now; 01267 struct ast_tm tm; 01268 char date[40]; 01269 char *datefmt; 01270 01271 now = ast_tvnow(); 01272 ast_localtime(&now, &tm, NULL); 01273 ast_strftime(date, sizeof(date), dateformat, &tm); 01274 datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1); 01275 sprintf(datefmt, "%c[%s] %s", 127, date, fmt); 01276 fmt = datefmt; 01277 } else { 01278 char *tmp = alloca(strlen(fmt) + 2); 01279 sprintf(tmp, "%c%s", 127, fmt); 01280 fmt = tmp; 01281 } 01282 01283 /* Build string */ 01284 res = ast_str_set_va(&buf, 0, fmt, ap); 01285 01286 /* If the build failed then we can drop this allocated message */ 01287 if (res == AST_DYNSTR_BUILD_FAILED) 01288 return; 01289 01290 ast_log(__LOG_VERBOSE, file, line, func, "%s", ast_str_buffer(buf)); 01291 }
| static void _handle_SIGXFSZ | ( | int | sig | ) | [static] |
Definition at line 863 of file logger.c.
00864 { 00865 /* Indicate need to reload */ 00866 filesize_reload_needed = 1; 00867 }
| void ast_backtrace | ( | void | ) |
Definition at line 1227 of file logger.c.
References ast_bt::addresses, ast_bt_create(), ast_bt_destroy(), ast_debug, ast_log(), free, LOG_DEBUG, LOG_WARNING, and ast_bt::num_frames.
01228 { 01229 #ifdef HAVE_BKTR 01230 struct ast_bt *bt; 01231 int i = 0; 01232 char **strings; 01233 01234 if (!(bt = ast_bt_create())) { 01235 ast_log(LOG_WARNING, "Unable to allocate space for backtrace structure\n"); 01236 return; 01237 } 01238 01239 if ((strings = backtrace_symbols(bt->addresses, bt->num_frames))) { 01240 ast_debug(1, "Got %d backtrace record%c\n", bt->num_frames, bt->num_frames != 1 ? 's' : ' '); 01241 for (i = 3; i < bt->num_frames - 2; i++) { 01242 ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]); 01243 } 01244 01245 /* MALLOC_DEBUG will erroneously report an error here, unless we undef the macro. */ 01246 #undef free 01247 free(strings); 01248 } else { 01249 ast_debug(1, "Could not allocate memory for backtrace\n"); 01250 } 01251 ast_bt_destroy(bt); 01252 #else 01253 ast_log(LOG_WARNING, "Must run configure with '--with-execinfo' for stack backtraces.\n"); 01254 #endif 01255 }
| struct ast_bt* ast_bt_create | ( | void | ) | [read] |
Definition at line 1194 of file logger.c.
References ast_bt::alloced, ast_bt_get_addresses(), ast_calloc, ast_log(), and LOG_ERROR.
Referenced by ast_backtrace().
01195 { 01196 struct ast_bt *bt = ast_calloc(1, sizeof(*bt)); 01197 if (!bt) { 01198 ast_log(LOG_ERROR, "Unable to allocate memory for backtrace structure!\n"); 01199 return NULL; 01200 } 01201 01202 bt->alloced = 1; 01203 01204 ast_bt_get_addresses(bt); 01205 01206 return bt; 01207 }
| void* ast_bt_destroy | ( | struct ast_bt * | bt | ) |
Definition at line 1216 of file logger.c.
References ast_bt::alloced, and ast_free.
Referenced by ast_backtrace().
| int ast_bt_get_addresses | ( | struct ast_bt * | bt | ) |
Definition at line 1209 of file logger.c.
References ast_bt::addresses, AST_MAX_BT_FRAMES, and ast_bt::num_frames.
Referenced by __ast_cond_timedwait(), __ast_cond_wait(), __ast_pthread_mutex_lock(), __ast_pthread_mutex_trylock(), __ast_rwlock_rdlock(), __ast_rwlock_timedrdlock(), __ast_rwlock_timedwrlock(), __ast_rwlock_tryrdlock(), __ast_rwlock_trywrlock(), __ast_rwlock_wrlock(), and ast_bt_create().
01210 { 01211 bt->num_frames = backtrace(bt->addresses, AST_MAX_BT_FRAMES); 01212 01213 return 0; 01214 }
| void ast_child_verbose | ( | int | level, | |
| const char * | fmt, | |||
| ... | ||||
| ) |
Definition at line 410 of file logger.c.
References ast_free, ast_malloc, and option_verbose.
Referenced by launch_script().
00411 { 00412 char *msg = NULL, *emsg = NULL, *sptr, *eptr; 00413 va_list ap, aq; 00414 int size; 00415 00416 /* Don't bother, if the level isn't that high */ 00417 if (option_verbose < level) { 00418 return; 00419 } 00420 00421 va_start(ap, fmt); 00422 va_copy(aq, ap); 00423 if ((size = vsnprintf(msg, 0, fmt, ap)) < 0) { 00424 va_end(ap); 00425 va_end(aq); 00426 return; 00427 } 00428 va_end(ap); 00429 00430 if (!(msg = ast_malloc(size + 1))) { 00431 va_end(aq); 00432 return; 00433 } 00434 00435 vsnprintf(msg, size + 1, fmt, aq); 00436 va_end(aq); 00437 00438 if (!(emsg = ast_malloc(size * 2 + 1))) { 00439 ast_free(msg); 00440 return; 00441 } 00442 00443 for (sptr = msg, eptr = emsg; ; sptr++) { 00444 if (*sptr == '"') { 00445 *eptr++ = '\\'; 00446 } 00447 *eptr++ = *sptr; 00448 if (*sptr == '\0') { 00449 break; 00450 } 00451 } 00452 ast_free(msg); 00453 00454 fprintf(stdout, "verbose \"%s\" %d\n", emsg, level); 00455 fflush(stdout); 00456 ast_free(emsg); 00457 }
| void ast_log | ( | int | level, | |
| const char * | file, | |||
| int | line, | |||
| const char * | function, | |||
| const char * | fmt, | |||
| ... | ||||
| ) |
send log messages to syslog and/or the console
Used for sending a log message This is the standard logger function. Probably the only way you will invoke it would be something like this: ast_log(AST_LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?\n", "flux capacitor", 10); where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to. These are implemented as macros, that will provide the function with the needed arguments.
Definition at line 1098 of file logger.c.
References __LOG_DEBUG, __LOG_VERBOSE, ast_calloc_with_stringfields, ast_cond_signal, AST_DYNSTR_BUILD_FAILED, ast_free, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_localtime(), AST_PTHREADT_NULL, AST_RWLIST_EMPTY, ast_str_buffer(), ast_str_set_va(), ast_str_thread_get(), ast_strftime(), ast_string_field_set, ast_tvnow(), GETTID, logmsg::level, levels, logmsg::line, logchannel::list, log_buf, LOG_BUF_INIT_SIZE, logcond, logger_print_normal(), LOGMSG_NORMAL, LOGMSG_VERBOSE, logthread, option_debug, option_verbose, logmsg::process_id, term_filter_escapes(), and logmsg::type.
Referenced by __adsi_transmit_messages(), __agent_start_monitoring(), __analog_handle_event(), __analog_ss_thread(), __ast_answer(), __ast_bridge_technology_register(), __ast_channel_alloc_ap(), __ast_cli_register(), __ast_cli_unregister(), __ast_custom_function_register(), __ast_data_register(), __ast_data_unregister(), __ast_dsp_call_progress(), __ast_format_register(), __ast_http_load(), __ast_pbx_run(), __ast_play_and_record(), __ast_queue_frame(), __ast_read(), __ast_register_translator(), __ast_request_and_dial(), __ast_smoother_feed(), __ast_string_field_init(), __ast_udptl_reload(), __ast_verbose_ap(), __attempt_transmit(), __auto_congest(), __dahdi_exception(), __find_callno(), __iax2_poke_noanswer(), __init_manager(), __mgcp_xmit(), __oh323_destroy(), __oh323_new(), __oh323_rtp_create(), __oh323_update_info(), __set_address_from_contact(), __sip_autodestruct(), __sip_pretend_ack(), __sip_reliable_xmit(), __sip_xmit(), __transmit_response(), __unload_module(), _ast_odbc_request_obj2(), _ast_sockaddr_from_sin(), _ast_sockaddr_port(), _ast_sockaddr_set_port(), _ast_sockaddr_to_sin(), _enum_array_map(), _extension_match_core(), _get_mohbyname(), _lookup_timer(), _macro_exec(), _moh_register(), _sip_tcp_helper_thread(), _while_exec(), accept_thread(), access_counter_file(), acf_channel_read(), acf_curl_helper(), acf_curlopt_helper(), acf_curlopt_write(), acf_cut_exec(), acf_cut_exec2(), acf_faxopt_read(), acf_faxopt_write(), acf_iaxvar_write(), acf_if(), acf_isexten_exec(), acf_jabberreceive_read(), acf_jabberstatus_read(), acf_mailbox_exists(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_sort_exec(), acf_sprintf(), acf_strftime(), acf_strptime(), acf_transaction_write(), ack_trans(), action_bridge(), action_command(), action_getvar(), action_hangup(), add_agent(), add_agi_cmd(), add_calltoken_ignore(), add_cc_call_info_to_response(), add_cfg_entry(), add_codec_to_answer(), add_content(), add_email_attachment(), add_event_to_list(), add_exten_to_pattern_tree(), add_extensions(), add_features_datastores(), add_header(), add_ie(), add_in_calls(), add_line(), add_out_calls(), add_pri_lockopt(), add_publish_event(), add_realm_authentication(), add_redirect(), add_rt_multi_cfg_entry(), add_sdp(), add_sip_domain(), add_subscribe_event(), add_to_agi(), add_user_extension(), admin_exec(), adsi_begin(), adsi_careful_send(), adsi_process(), adsi_prog(), advanced_options(), ael2_print(), aes_helper(), agent_answer(), agent_call(), agent_fixup(), agent_get_base_channel(), agent_indicate(), agent_new(), agent_read(), agent_request(), agent_set_base_channel(), agentmonitoroutgoing_exec(), agi_exec_full(), aji_act_hook(), aji_client_connect(), aji_client_info_handler(), aji_create_buddy(), aji_create_client(), aji_delete_node_list(), aji_devstate_cb(), aji_dinfo_handler(), aji_ditems_handler(), aji_find_version(), aji_handle_message(), aji_handle_presence(), aji_handle_pubsub_error(), aji_handle_pubsub_event(), aji_handle_subscribe(), aji_initialize(), aji_join_exec(), aji_leave_exec(), aji_load_config(), aji_mwi_cb(), aji_pruneregister(), aji_recv(), aji_recv_loop(), aji_register_approve_handler(), aji_register_query_handler(), aji_reload(), aji_send_exec(), aji_send_raw_chat(), aji_sendgroup_exec(), aji_set_group_presence(), aji_set_presence(), aji_start_sasl(), aji_status_exec(), alarmreceiver_exec(), alloc_expr_node(), alloc_resampler(), alloc_sub(), alsa_card_init(), alsa_indicate(), alsa_new(), alsa_read(), alsa_request(), alsa_write(), analog_answer(), analog_attempt_transfer(), analog_available(), analog_call(), analog_exception(), analog_get_index(), analog_handle_init_event(), analog_hangup(), analog_request(), analog_ss_thread(), analogsub_to_dahdisub(), announce_thread(), answer_call(), anti_injection(), aoc_append_ie(), aoc_parse_ie(), app_exec(), append_ie(), apply_general_options(), apply_option(), apply_outgoing(), aqm_exec(), ast_add_extension2_lockopt(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_load_session(), ast_adsi_transmit_message_full(), ast_agi_register(), ast_agi_send(), ast_agi_unregister(), ast_ais_clm_load_module(), ast_ais_clm_unload_module(), ast_ais_evt_load_module(), ast_ais_evt_unload_module(), ast_aji_create_chat(), ast_aji_invite_chat(), ast_alaw_init(), ast_aoc_create(), ast_aoc_decode(), ast_aoc_encode(), ast_app_dtget(), ast_app_group_match_get_count(), ast_app_run_macro(), ast_append_ha(), ast_async_goto(), ast_audiohook_write_frame(), ast_autoservice_start(), ast_backtrace(), ast_best_codec(), ast_bridge_call(), ast_bridge_timelimit(), ast_bt_create(), ast_calendar_register(), ast_call_forward(), ast_careful_fwrite(), ast_carefulwrite(), ast_cc_get_param(), ast_cc_set_param(), ast_cdr_alloc(), ast_cdr_end(), ast_cdr_engine_init(), ast_cdr_merge(), ast_cdr_register(), ast_cdr_serialize_variables(), ast_cdr_setvar(), ast_cdr_submit_batch(), ast_cel_fill_record(), ast_cel_get_ama_flag_name(), ast_channel_audiohook_count_by_source(), ast_channel_audiohook_count_by_source_running(), ast_channel_bridge(), ast_channel_destructor(), ast_channel_log(), ast_channel_make_compatible_helper(), ast_channel_masquerade(), ast_channel_queryoption(), ast_channel_register(), ast_channel_setoption(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), ast_check_signature(), ast_check_signature_bin(), ast_check_timing2(), ast_cli_perms_init(), ast_codec_get_len(), ast_codec_get_samples(), ast_config_engine_register(), ast_config_internal_load(), ast_connected_line_build_data(), ast_connected_line_parse_data(), ast_context_find_or_create(), ast_context_remove_extension_callerid2(), ast_context_verify_includes(), ast_data_get(), ast_data_retrieve(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_decrypt_bin(), ast_device_state_engine_init(), ast_do_masquerade(), ast_dsp_call_progress(), ast_dsp_noise(), ast_dsp_process(), ast_dsp_silence(), ast_dtmf_stream(), ast_el_read_char(), ast_enable_distributed_devstate(), ast_enable_packet_fragmentation(), ast_encrypt_bin(), ast_event_cb(), ast_event_check_subscriber(), ast_event_get_cached(), ast_event_get_ie_pltype(), ast_event_get_ie_type_name(), ast_event_get_type_name(), ast_event_new(), ast_event_queue(), ast_event_queue_and_cache(), ast_event_subscribe_new(), ast_extension_close(), ast_fax_log(), ast_fax_state_to_str(), ast_filehelper(), ast_find_ourip(), ast_format_str_reduce(), ast_format_unregister(), ast_framehook_attach(), ast_func_read(), ast_func_read2(), ast_func_write(), ast_get_encoded_char(), ast_get_enum(), ast_get_group(), ast_handle_cc_control_frame(), ast_hangup(), ast_heap_create(), ast_http_send(), ast_iax2_new(), ast_include_new(), ast_indicate_data(), ast_io_remove(), ast_ivr_menu_run_internal(), ast_jb_put(), ast_linear_stream(), ast_lock_path_flock(), ast_lock_path_lockfile(), ast_logger_register_level(), ast_makesocket(), ast_manager_register_struct(), ast_manager_unregister(), ast_module_reload(), ast_moh_files_next(), ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), ast_netsock_bindaddr(), ast_netsock_set_qos(), ast_odbc_direct_execute(), ast_odbc_find_table(), ast_odbc_prepare_and_execute(), ast_odbc_sanity_check(), ast_odbc_smart_execute(), ast_openstream_full(), ast_openvstream(), ast_ouraddrfor(), ast_parse_allow_disallow(), ast_parse_digest(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), ast_pbx_start(), ast_pickup_call(), ast_pktccops_gate_alloc(), ast_playtones_start(), ast_process_pending_reloads(), ast_prod(), ast_pthread_create_detached_stack(), ast_pthread_create_stack(), ast_queue_cc_frame(), ast_read_image(), ast_read_textfile(), ast_readaudio_callback(), ast_readconfig(), ast_readfile(), ast_readvideo_callback(), ast_record_review(), ast_redirecting_build_data(), ast_redirecting_parse_data(), ast_register_application2(), ast_register_feature(), ast_register_switch(), ast_remotecontrol(), ast_request(), ast_rtcp_read(), ast_rtcp_write_rr(), ast_rtcp_write_sr(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_continuation(), ast_rtp_dtmf_end_with_duration(), ast_rtp_engine_register2(), ast_rtp_glue_register2(), ast_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_new(), ast_rtp_new(), ast_rtp_read(), ast_rtp_write(), ast_safe_fork(), ast_safe_system(), ast_say_date_with_format_da(), ast_say_date_with_format_de(), ast_say_date_with_format_en(), ast_say_date_with_format_es(), ast_say_date_with_format_fr(), ast_say_date_with_format_gr(), ast_say_date_with_format_he(), ast_say_date_with_format_it(), ast_say_date_with_format_nl(), ast_say_date_with_format_pl(), ast_say_date_with_format_pt(), ast_say_date_with_format_th(), ast_say_date_with_format_vi(), ast_say_date_with_format_zh(), ast_say_enumeration_full_he(), ast_say_number_full_pt(), ast_say_number_full_ur(), ast_say_number_full_zh(), ast_sched_del(), ast_sched_runq(), ast_sched_thread_create(), ast_search_dns(), ast_security_event_report(), ast_set_cc_offer_timer(), ast_set_cc_recall_timer(), ast_set_ccbs_available_timer(), ast_set_ccnr_available_timer(), ast_set_owners_and_peers(), ast_set_priority(), ast_set_qos(), ast_sign_bin(), ast_sip_ouraddrfor(), ast_slinfactory_feed(), ast_smoother_read(), ast_sockaddr_hash(), ast_sockaddr_parse(), ast_sockaddr_resolve(), ast_sockaddr_split_hostport(), ast_sockaddr_stringify_fmt(), ast_speech_register(), ast_srtp_change_source(), ast_srtp_policy_alloc(), ast_srtp_protect(), ast_srtp_unprotect(), ast_stopstream(), ast_str_substitute_variables_full(), ast_streamfile(), ast_stun_request(), ast_taskprocessor_get(), ast_taskprocessor_name(), ast_taskprocessor_push(), ast_tcptls_client_create(), ast_tcptls_client_start(), ast_tcptls_server_read(), ast_tcptls_server_root(), ast_tcptls_server_start(), ast_tcptls_server_write(), ast_tls_read_conf(), ast_tps_init(), ast_translate_path_steps(), ast_translator_build_path(), ast_tryconnect(), ast_udptl_bridge(), ast_udptl_new_with_bindaddr(), ast_udptl_proto_register(), ast_udptl_read(), ast_udptl_write(), ast_ulaw_init(), ast_unload_resource(), ast_unlock_path_flock(), ast_unlock_path_lockfile(), ast_wait_for_output(), ast_waitfor_nandfds(), ast_waitfordigit_full(), ast_write(), ast_writefile(), ast_writestream(), ast_yyerror(), async_wait(), asyncgoto_exec(), attempt_reconnect(), attempt_thread(), attempt_transfer(), audiohook_read_frame_both(), auth_credentials(), auth_exec(), auth_http_callback(), authenticate(), authenticate_reply(), authenticate_verify(), autoservice_run(), background_detect_exec(), base64_helper(), base_encode(), birdbath(), blr_ebl(), blr_txt(), board_setup(), bridge_array_add(), bridge_call_thread(), bridge_exec(), bridge_make_compatible(), bridge_p2p_rtp_write(), build_alias(), build_calendar(), build_callno_limits(), build_channels(), build_conf(), build_device(), build_event_channel(), build_filename(), build_gateway(), build_mapping(), build_parkinglot(), build_peer(), build_route(), build_user(), builtin_atxfer(), builtin_automixmonitor(), builtin_automonitor(), builtin_blindtransfer(), bump_gains(), cache_get_callno_locked(), calc_cost(), calc_metric(), calculate_far_max_ifp(), calculate_local_max_datagram(), caldav_add_event(), caldav_get_events_between(), caldav_load_calendar(), caldav_request(), caldav_write_event(), calendar_busy_exec(), calendar_devstate_change(), calendar_event_notify(), calendar_event_read(), calendar_join_attendees(), calendar_query_exec(), calendar_query_result_exec(), calendar_write_exec(), callerid_feed(), callerid_feed_jp(), callerid_get_dtmf(), callerid_read(), callerid_write(), callerpres_read(), callerpres_write(), canary_thread(), canmatch(), careful_write(), cb_events(), cc_available(), cc_caller_requested(), cc_esc_publish_handler(), cc_handle_publish_error(), cccancel_exec(), cdata(), cdr_handler(), cdr_merge_vars(), chan_misdn_log(), chan_ringing(), chanavail_exec(), channel_admin_exec(), channel_revert(), channel_spy(), channel_steer(), channel_to_session(), chanspy_exec(), check_abstract_reference(), check_access(), check_app_args(), check_auth(), check_break(), check_compat(), check_context_names(), check_continue(), check_day(), check_dow(), check_event_type(), check_expr2_input(), check_for_conference(), check_freq_ic706(), check_goto(), check_header(), check_includes(), check_key(), check_label(), check_macro_returns(), check_month(), check_password(), check_post(), check_pval_item(), check_rtp_timeout(), check_srcaddr(), check_switch_expr(), check_timerange(), check_tx_freq(), check_user_full(), check_vars(), check_via(), cleanup_connection(), clear_caller(), clearcbone(), cleardisplay(), clearflag(), cleartimer(), cli_fax_show_session(), cli_fax_show_sessions(), close_call(), close_client(), close_mailbox(), collect_function_digits(), commit_exec(), compile_script(), complete_dialplan_add_extension(), complete_dialplan_add_ignorepat(), complete_dialplan_add_include(), complete_dialplan_remove_extension(), complete_dialplan_remove_ignorepat(), complete_dialplan_remove_include(), complete_span_helper(), complete_transfer(), compose_func_args(), compress_subclass(), conf_add(), conf_del(), conf_exec(), conf_flush(), conf_queue_dtmf(), conf_run(), confbridge_exec(), config_curl(), config_device(), config_function_read(), config_handler(), config_ldap(), config_line(), config_load(), config_module(), config_odbc(), config_parse_variables(), config_pgsql(), config_text_file_load(), connect_link(), connectedline_read(), connectedline_write(), connection_made(), console_autoanswer(), console_cmd(), console_indicate(), console_request(), console_video_start(), context_merge(), controlplayback_exec(), convertcap(), cops_connect(), cops_gate_cmd(), cops_sendmsg(), copy(), copy_header(), copy_message(), copy_rules(), copy_via_headers(), count_exec(), count_lines(), create_addr(), create_dirpath(), create_jb(), create_match_char_tree(), create_new_socket(), create_queue_member(), create_video_frame(), create_vmaccount(), crement_function_read(), crypto_load(), csv_log(), csv_quote(), custom_log(), custom_prepare(), cut_internal(), dahdi_accept_r2_call_exec(), dahdi_answer(), dahdi_ast_cause_to_r2_cause(), dahdi_bridge(), dahdi_call(), dahdi_callwait(), dahdi_confmute(), dahdi_decoder_framein(), dahdi_decoder_frameout(), dahdi_digit_begin(), dahdi_disable_ec(), dahdi_enable_ec(), dahdi_encoder_framein(), dahdi_encoder_frameout(), dahdi_fake_event(), dahdi_func_write(), dahdi_get_index(), dahdi_handle_dtmfup(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_link(), dahdi_new(), dahdi_new_pri_nobch_channel(), dahdi_open(), dahdi_pri_error(), dahdi_pri_message(), dahdi_r2_disconnect_call(), dahdi_r2_get_channel_category(), dahdi_r2_get_link(), dahdi_r2_on_call_accepted(), dahdi_r2_on_call_init(), dahdi_r2_on_call_offered(), dahdi_r2_on_line_blocked(), dahdi_r2_on_line_idle(), dahdi_r2_on_os_error(), dahdi_r2_on_protocol_error(), dahdi_r2_set_context(), dahdi_r2_write_log(), dahdi_read(), dahdi_request(), dahdi_restart(), dahdi_ring_phone(), dahdi_send_callrerouting_facility_exec(), dahdi_sendtext(), dahdi_set_hook(), dahdi_setoption(), dahdi_show_channel(), dahdi_ss7_error(), dahdi_status_data_provider_get(), dahdi_test_timer(), dahdi_timer_set_rate(), dahdi_train_ec(), dahdi_translate(), dahdi_version_data_provider_get(), dahdi_write(), dahdi_write_frame(), dahdiras_exec(), dahdiscan_exec(), data_channels_provider_handler(), data_result_generate(), data_result_generate_node(), data_search_generate(), data_structure_compatible(), dbinit(), deadagi_exec(), dec_init(), del_exec(), delete_old_messages(), destroy_curl(), destroy_odbc(), destroy_pgsql(), destroy_pval_item(), destroy_session(), destroy_trans(), determine_starting_point(), device2chan(), device_state_cb(), devstate_cache_cb(), devstate_change_collector_cb(), devstate_write(), dial_exec_full(), dial_handle_playtones(), dialgroup_read(), dialgroup_write(), dialog_ref_debug(), dictate_exec(), digitcollect(), digitdirect(), directory_exec(), disa_exec(), disable_jack_hook(), disable_t38(), diskavail(), dispatch_thread_handler(), display_last_error(), dns_parse_answer(), dnsmgr_init(), dnsmgr_refresh(), do_autokill(), do_dtmf_local(), do_forward(), do_idle_thread(), do_magic_pickup(), do_monitor(), do_notify(), do_pktccops(), do_register(), do_reload(), do_say(), do_scheduler(), do_waiting(), donodelog(), dump_queue(), dump_queue_members(), dundi_answer_entity(), dundi_answer_query(), dundi_discover(), dundi_encrypt(), dundi_error_output(), dundi_exec(), dundi_helper(), dundi_lookup_internal(), dundi_precache_full(), dundi_precache_internal(), dundi_prop_precache(), dundi_query(), dundi_query_read(), dundi_result_read(), dundi_rexmit(), dundi_send(), dundi_xmit(), dundifunc_read(), duplicate_pseudo(), eagi_exec(), ebl_callback(), enable_jack_hook(), encode_open_type(), endelm(), enum_callback(), enum_query_read(), enum_result_read(), event_channel_destroy(), eventhandler(), evt_event_deliver_cb(), ewscal_load_calendar(), exchangecal_get_events_between(), exchangecal_load_calendar(), exchangecal_request(), exchangecal_write_event(), exec(), exec_exec(), execif_exec(), exists(), ext_cmp1(), extension_matches(), extenspy_exec(), external_rtp_create(), extstate_read(), fax_generator_generate(), fax_rate_str_to_int(), fax_session_new(), fbuf_append(), feature_exec_app(), feature_request_and_dial(), festival_exec(), fetch_icalendar(), ffmpeg_decode(), ffmpeg_encode(), file2format(), file_read(), file_write(), filter(), finalize_content(), find_account(), find_cache(), find_call_locked(), find_conf(), find_conf_realtime(), find_desc(), find_desc_usb(), find_details(), find_engine(), find_line_by_instance(), find_matching_endwhile(), find_or_create(), find_or_create_details(), find_pval_goto_item(), find_queue_by_name_rt(), find_sdp(), find_speeddial_by_instance(), find_subchannel_and_lock(), find_subchannel_by_instance_reference(), find_subchannel_by_name(), find_subchannel_by_reference(), find_table(), find_transaction(), find_transcoders(), findmeexec(), finish_bookmark(), flash_exec(), flush_telem(), fn_wrapper(), forkcdr_exec(), forward_message(), framein(), func_args(), func_channel_read(), func_channel_write_real(), func_channels_read(), func_check_sipdomain(), func_header_read(), func_inheritance_write(), function_agent(), function_autopatchup(), function_cop(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_eval(), function_eval2(), function_fieldnum_helper(), function_ilink(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), function_remote(), function_sipchaninfo_read(), function_sippeer(), function_txtcidname(), g719read(), g719write(), g723_len(), g723_read(), g723_write(), g726_read(), g726_write(), g729_read(), g729_write(), generic_execute(), generic_fax_exec(), generic_http_callback(), generic_prepare(), get_agi_cmd(), get_alarms(), get_also_info(), get_button_template(), get_canmatch_exten(), get_crypto_attrib(), get_destination(), get_domain(), get_ewscal_ids_for(), get_input(), get_ip_and_port_from_sdp(), get_lock(), get_mem_set(), get_member_penalty(), get_params(), get_range(), get_rdnis(), get_refer_info(), get_timerange(), get_to_address(), get_token(), get_unused_callno(), getdisplaybyname(), getflagbyname(), getkeybyname(), getstatebyname(), getsubbyname(), gosub_exec(), gosubif_exec(), goto_exten(), goto_line(), goto_line_rel(), group_count_function_read(), group_function_write(), gsm_read(), gsm_seek(), gsm_write(), gsmtolin_framein(), gtalk_alloc(), gtalk_call(), gtalk_create_candidates(), gtalk_create_member(), gtalk_free_pvt(), gtalk_handle_dtmf(), gtalk_hangup_farend(), gtalk_invite(), gtalk_is_accepted(), gtalk_is_answered(), gtalk_load_config(), gtalk_new(), gtalk_newcall(), gtalk_parser(), gtalk_request(), gtalk_sendhtml(), gtalk_sendtext(), gtalk_show_channels(), gtalk_update_externip(), gtalk_update_stun(), gtalk_write(), gui_init(), h261_decap(), h263_decap(), h263_encap(), h263_open(), h263_read(), h263_write(), h263p_decap(), h263p_encap(), h264_decap(), h264_encap(), h264_open(), h264_read(), h264_write(), handle_alarms(), handle_call_token(), handle_callforward_button(), handle_capabilities_res_message(), handle_cc_subscribe(), handle_clear_alarms(), handle_cli_agi_add_cmd(), handle_cli_h323_cycle_gk(), handle_cli_indication_add(), handle_cli_indication_remove(), handle_command_response(), handle_common_options(), handle_devstate_change(), handle_enbloc_call_message(), handle_error(), handle_exec(), handle_getoption(), handle_gosub(), handle_hd_hf(), handle_incoming(), handle_init_event(), handle_input(), handle_invite_replaces(), handle_jack_audio(), handle_keypad_button_message(), handle_link_data(), handle_message(), handle_mousedown(), handle_offhook_message(), handle_onhook_message(), handle_open_receive_channel_ack_message(), handle_options(), handle_orig(), handle_playtones(), handle_pri_service_generic(), handle_recordfile(), handle_register_message(), handle_remote_data(), handle_remote_dtmf_digit(), handle_request(), handle_request_bye(), handle_request_do(), handle_request_info(), handle_request_invite(), handle_request_notify(), handle_request_options(), handle_request_publish(), handle_request_register(), handle_request_subscribe(), handle_response(), handle_response_invite(), handle_response_notify(), handle_response_peerpoke(), handle_response_publish(), handle_response_refer(), handle_response_register(), handle_response_subscribe(), handle_response_update(), handle_soft_key_event_message(), handle_stimulus_message(), handle_t38_options(), handle_tcptls_connection(), handle_transfer_button(), handle_updates(), HandleCallIncoming(), HandleCallOutgoing(), hidthread(), hint_read(), http_post_callback(), iax2_ack_registry(), iax2_bridge(), iax2_call(), iax2_canmatch(), iax2_devicestate(), iax2_do_register(), iax2_dup_variable_datastore(), iax2_exec(), iax2_exists(), iax2_fixup(), iax2_hangup(), iax2_matchmore(), iax2_poke_peer(), iax2_prov_app(), iax2_read(), iax2_register(), iax2_request(), iax2_send(), iax2_trunk_queue(), iax_error_output(), iax_frame_wrap(), iax_park(), iax_park_thread(), iax_process_template(), iax_provision_reload(), iax_template_parse(), ic706_pltocode(), ical_load_calendar(), icalendar_add_event(), icalendar_update_events(), ices_exec(), icesencode(), iconv_read(), iftime(), ilbc_read(), ilbc_write(), ilbctolin_framein(), import_ch(), in_band_indication(), increase_call_count(), init_acf_query(), init_app_class(), init_jack_data(), init_req(), init_resp(), init_timing_thread(), initialize_cc_max_requests(), inotify_daemon(), insert_penaltychange(), inspect_module(), internal_ao2_ref(), INTERNAL_OBJ(), invent_message(), is_valid_dtmf(), isAnsweringMachine(), isexten_function_read(), ivr_dispatch(), jack_hook_callback(), jack_hook_write(), jb_error_output(), jb_get_and_deliver(), jb_warning_output(), jingle_alloc(), jingle_call(), jingle_create_candidates(), jingle_create_member(), jingle_digit(), jingle_free_pvt(), jingle_handle_dtmf(), jingle_hangup_farend(), jingle_indicate(), jingle_is_answered(), jingle_load_config(), jingle_new(), jingle_newcall(), jingle_parser(), jingle_request(), jingle_sendhtml(), jingle_sendtext(), jingle_show_channels(), jingle_write(), join_conference_bridge(), join_queue(), jpeg_read_image(), jpeg_write_image(), key_call(), Keyfavorite(), keypad_cfg_read(), keypad_pick_up(), keypad_setup(), keypad_toggle(), kickptt(), kp_match_area(), kqueue_timer_open(), launch_asyncagi(), launch_ha_netscript(), launch_monitor_thread(), launch_netscript(), launch_script(), launch_service(), ldap_loadentry(), ldap_reconnect(), leave_voicemail(), linear_alloc(), linear_generator(), linear_release(), linkcount(), linkset_addsigchan(), lintogsm_framein(), lintolpc10_framein(), lintoulaw(), listener(), listfilter(), load_column_config(), load_config(), load_config_meetme(), load_indications(), load_module(), load_modules(), load_moh_classes(), load_odbc_config(), load_or_reload_lua_stuff(), load_pbx(), load_pktccops_config(), load_realtime_queue(), load_resource(), load_resource_list(), load_rpt_vars(), load_tech_calendars(), load_values_config(), local_alloc(), local_answer(), local_ast_moh_start(), local_call(), local_devicestate(), local_dtmf_helper(), local_fixup(), local_new(), local_queue_frame(), local_setoption(), local_write(), log_exec(), log_jack_status(), login_exec(), lookup_iface(), lpc10tolin_framein(), lua_find_extension(), lua_get_state(), lua_read_extensions_file(), macroif_exec(), main(), make_email_file(), make_number(), make_str(), make_trunk(), manage_parkinglot(), manager_log(), manager_modulecheck(), manager_show_dialplan_helper(), manager_sipnotify(), map_video_codec(), masq_park_call(), matchmore(), math(), md5(), measurenoise(), meetmemute(), memcpy_decrypt(), memcpy_encrypt(), message_template_build(), message_template_parse_emailbody(), message_template_parse_filebody(), mfcr2_monitor(), mgcp_call(), mgcp_fixup(), mgcp_indicate(), mgcp_new(), mgcp_reload(), mgcp_request(), mgcp_rtp_read(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_ss(), mgcp_write(), mgcpsock_read(), milliwatt_generate(), minivm_accmess_exec(), minivm_account_func_read(), minivm_counter_func_read(), minivm_counter_func_write(), minivm_delete_exec(), minivm_greet_exec(), minivm_mwi_exec(), minivm_notify_exec(), minivm_record_exec(), misdn_answer(), misdn_bridge(), misdn_call(), misdn_cfg_get(), misdn_cfg_get_config_string(), misdn_cfg_init(), misdn_cfg_is_msn_valid(), misdn_cfg_update_ptp(), misdn_check_l2l1(), misdn_digit_end(), misdn_facility_exec(), misdn_hangup(), misdn_indication(), misdn_new(), misdn_request(), misdn_send_text(), misdn_set_opt_exec(), misdn_write(), mixmonitor_exec(), mixmonitor_thread(), mkif(), mkintf(), moh_alloc(), moh_class_destructor(), moh_files_generator(), moh_files_release(), moh_generate(), moh_release(), moh_scan_files(), mohalloc(), monmp3thread(), morsecode_exec(), mp3_exec(), mp3play(), mpeg4_decode(), mssql_connect(), multicast_rtp_write(), multicast_send_control_packet(), multiplexed_bridge_create(), multiplexed_nudge(), multiplexed_thread_function(), mute_add_audiohook(), mute_fragment(), mwi_send_init(), mwi_send_process_buffer(), mwi_send_process_event(), mwi_sub_event_cb(), mwi_thread(), my_all_subchannels_hungup(), my_callwait(), my_dial_digits(), my_distinctive_ring(), my_dsp_set_digitmode(), my_get_callerid(), my_handle_dchan_exception(), my_handle_dtmfup(), my_handle_link_exception(), my_handle_notify_message(), my_is_dialing(), my_is_off_hook(), my_new_pri_ast_channel(), my_new_ss7_ast_channel(), my_pri_open_media(), my_send_callerid(), my_set_cadence(), my_set_waitingfordt(), my_ss7_set_loopback(), my_start_cid_detect(), my_wink(), my_x_handler(), nbs_alloc(), nbs_call(), nbs_hangup(), nbs_new(), nbs_request(), nbs_xwrite(), NBScat_exec(), NBScatplay(), netconsole(), new_find_extension(), notify_new_message(), odbc_load_module(), odbc_log(), odbc_obj_connect(), odbc_obj_disconnect(), odbc_register_class(), odbc_release_obj2(), ogg_vorbis_open(), ogg_vorbis_read(), ogg_vorbis_rewrite(), ogg_vorbis_seek(), ogg_vorbis_tell(), ogg_vorbis_trunc(), ogg_vorbis_write(), oh323_alloc(), oh323_call(), oh323_digit_begin(), oh323_digit_end(), oh323_fixup(), oh323_hangup(), oh323_indicate(), oh323_read(), oh323_request(), oh323_rtp_read(), oh323_set_rtp_peer(), oh323_write(), old_milliwatt_exec(), onevent(), op_colon(), op_div(), op_eq(), op_eqtilde(), op_func(), op_minus(), op_negate(), op_plus(), op_rem(), op_times(), open_mailbox(), open_stream(), OpenHistory(), openserial(), originate_exec(), osp_auth(), osp_check_destination(), osp_create_callid(), osp_create_provider(), osp_create_transaction(), osp_create_uuid(), osp_load(), osp_lookup(), osp_next(), osp_uuid2str(), osp_validate_token(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_indicate(), oss_new(), oss_request(), page_exec(), park_call_exec(), park_call_full(), park_exec_full(), park_space_reserve(), parkandannounce_exec(), parse(), parse_apps(), parse_args(), parse_buffers_policy(), parse_config(), parse_cookies(), parse_empty_options(), parse_events(), parse_gain_value(), parse_ie(), parse_minse(), parse_moved_contact(), parse_naptr(), parse_options(), parse_register_contact(), parse_request(), parse_session_expires(), parse_srv(), parse_tag(), parse_tone_zone(), ParseBookmark(), parsing(), party_id_build_data(), party_id_write(), party_name_build_data(), party_name_write(), party_number_build_data(), party_number_write(), party_subaddress_build_data(), pbx_builtin_background(), pbx_builtin_execiftime(), pbx_builtin_gotoif(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_importvar(), pbx_builtin_pushvar_helper(), pbx_builtin_saynumber(), pbx_builtin_serialize_variables(), pbx_builtin_setvar(), pbx_builtin_setvar_multiple(), pbx_builtin_waitexten(), pbx_exec(), pbx_extension_helper(), pbx_find_extension(), pbx_load_config(), pbx_load_module(), pbx_load_users(), pbx_parseable_goto(), pbx_substitute_variables_helper_full(), pcm_read(), pcm_seek(), pcm_write(), peek_read(), peer_iphash_cb(), peer_set_srcaddr(), peercnt_add(), pgsql_log(), pgsql_reconnect(), phase_e_handler(), phone_call(), phone_digit_end(), phone_exception(), phone_hangup(), phone_indicate(), phone_mini_packet(), phone_new(), phone_read(), phone_request(), phone_setup(), phone_write(), phone_write_buf(), phoneprov_callback(), pickup_do(), pickup_exec(), pickupchan_exec(), pidf_validate_presence(), pidf_validate_tuple(), pitchshift_helper(), pktccops_add_ippool(), play_message(), play_message_category(), play_message_datetime(), play_message_in_bridged_call(), play_moh_exec(), play_record_review(), playback_exec(), playtones_alloc(), playtones_generator(), policy_set_suite(), pop_exec(), post_raw(), powerof(), pp_each_extension_helper(), pqm_exec(), precache_trans(), precache_transactions(), prep_email_sub_vars(), prepare_pri(), pri_active_dchan_index(), pri_check_restart(), pri_create_spanmap(), pri_create_trunkgroup(), pri_dchannel(), pri_find_dchan(), pri_fixup_principle(), pri_resolve_span(), pri_send_callrerouting_facility_exec(), pri_ss_thread(), privacy_exec(), private_enum_init(), proc_422_rsp(), proc_session_timer(), process_ast_dsp(), process_cn_rfc3389(), process_crypto(), process_dahdi(), process_dtmf_rfc2833(), process_echocancel(), process_message_callback(), process_opcode(), process_request(), process_returncode(), process_sdp(), process_sdp_a_audio(), process_sdp_c(), process_sdp_o(), process_text_line(), profile_set_param(), progress(), proxy_update(), pthread_timer_set_rate(), purge_old_messages(), pvalCheckType(), pvalGlobalsAddStatement(), pvalTopLevAddObject(), pw_cb(), ql_exec(), queue_exec(), queue_function_exists(), queue_function_memberpenalty_read(), queue_function_memberpenalty_write(), queue_function_qac(), queue_function_qac_dep(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_function_var(), queue_reload_request(), queue_set_param(), queue_transfer_fixup(), queue_voice_frame(), quote(), radio_tune(), radius_log(), rbi_out(), rcv_mac_addr(), rcvfax_exec(), read_agent_config(), read_config(), read_config_maps(), read_exec(), read_password_from_file(), read_pipe(), read_samples(), readexten_exec(), readfile_exec(), readmimefile(), realtime_curl(), realtime_destroy_handler(), realtime_directory(), realtime_exec(), realtime_handler(), realtime_ldap_base_ap(), realtime_multi_curl(), realtime_multi_handler(), realtime_multi_ldap(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_peer(), realtime_pgsql(), realtime_require_handler(), realtime_store_handler(), realtime_update2_handler(), realtime_update_handler(), realtime_user(), realtimefield_read(), receive_digit(), receive_message(), receivefax_exec(), receivefax_t38_init(), record_exec(), redirecting_read(), redirecting_write(), refresh_list(), reg_source_db(), regex(), register_exten(), register_group(), register_group_feature(), register_peer_exten(), register_verify(), registry_rerequest(), reload(), reload_config(), reload_firmware(), reload_followme(), reload_logger(), reload_module(), reload_queue_members(), reload_queue_rules(), reload_queues(), reload_single_member(), reload_single_queue(), remote_bridge_loop(), remove_by_peercallno(), remove_by_transfercallno(), remove_from_queue(), replace(), replace_callno(), reply_digest(), require_curl(), require_odbc(), require_pgsql(), res_srtp_new(), resample_frame(), reset_conf(), resolve_first(), restart_monitor(), restart_pktc_thread(), restart_session_timer(), restore_conference(), restore_gains(), retrans_pkt(), retreive_memory(), retrydial_exec(), return_exec(), revert_fax_buffers(), rollback_exec(), rotate_file(), rpt(), rpt_call(), rpt_do_lstats(), rpt_do_stats(), rpt_exec(), rpt_manager_do_stats(), rpt_master(), rpt_push_alt_macro(), rpt_tele_thread(), rpt_telemetry(), rqm_exec(), rt_handle_member_record(), rtp_reload(), run_agi(), run_externnotify(), run_ras(), s_streamwait3(), safe_append(), save_conference(), save_to_folder(), say_date(), say_date_with_format(), say_datetime(), say_datetime_from_now(), say_init_mode(), say_number_full(), say_time(), saycharstr(), saycountedadj_exec(), saycountednoun_exec(), sayfile(), saynum(), scan_service(), scan_thread(), schedule(), scheduled_destroy(), sdl_setup(), select_entry(), send_callerid(), send_client(), send_delay(), send_dtmf(), send_ews_request_and_parse(), send_request(), send_retransmit(), send_select_output(), send_tone_burst(), send_usb_txt(), send_waveform_to_channel(), send_waveform_to_fd(), senddtmf_exec(), sendfax_exec(), sendfax_t38_init(), sendimage_exec(), sendkenwood(), sendmail(), sendpage(), sendtext_exec(), sendurl_exec(), serial_remote_io(), session_do(), set(), set_active(), set_bridge_features_on_config(), set_config(), set_ctcss_mode_ic706(), set_destination(), set_fax_t38_caps(), set_format(), set_freq_ic706(), set_full_cmd(), set_ic706(), set_insecure_flags(), set_member_paused(), set_member_penalty(), set_mode_ic706(), set_moh_exec(), set_offset_ic706(), set_state(), set_ulimit(), set_var(), setcallerid_pres_exec(), setdtr(), setflag(), setformat(), setrem(), setup_dahdi_int(), setup_incoming_call(), setup_privacy_args(), setup_rtp_connection(), setup_srtp(), setup_transfer_datastore(), sha1(), shared_read(), shared_write(), shell_helper(), shift_pop(), show_dialplan_helper(), showdisplay(), showkeys(), sig_pri_call(), sig_pri_chan_alarm_notify(), sig_pri_digit_begin(), sig_pri_get_orig_dialstring(), sig_pri_handle_hold(), sig_pri_handle_subcmds(), sig_pri_hangup(), sig_pri_indicate(), sig_pri_new_ast_channel(), sig_pri_request(), sig_pri_start_pri(), sig_ss7_add_sigchan(), sig_ss7_answer(), sig_ss7_call(), sig_ss7_hangup(), sip_addheader(), sip_alloc(), sip_call(), sip_cc_monitor_suspend(), sip_cli_notify(), sip_dtmfmode(), sip_dump_history(), sip_fixup(), sip_hangup(), sip_indicate(), sip_new(), sip_park(), sip_park_thread(), sip_pidf_validate(), sip_poke_noanswer(), sip_poke_peer(), sip_queryoption(), sip_read(), sip_reg_timeout(), sip_register(), sip_request_call(), sip_reregister(), sip_scheddestroy(), sip_sendhtml(), sip_setoption(), sip_sipredirect(), sip_st_alloc(), sip_subscribe_mwi(), sip_tcptls_write(), sip_threadinfo_create(), sip_write(), sipsock_read(), siren14read(), siren14write(), siren7read(), siren7write(), skel_exec(), skinny_call(), skinny_fixup(), skinny_indicate(), skinny_new(), skinny_newcall(), skinny_register(), skinny_req_parse(), skinny_request(), skinny_ss(), skinny_transfer(), skinny_write(), sla_add_trunk_to_station(), sla_build_station(), sla_build_trunk(), sla_load_config(), sla_queue_event_conf(), sla_state(), sla_station_exec(), sla_trunk_exec(), slinear_read(), slinear_write(), smdi_load(), smdi_msg_read(), smdi_msg_retrieve_read(), smdi_read(), smdi_toggle_mwi(), smoother_frame_feed(), sms_exec(), sms_generate(), sms_handleincoming(), sms_log(), sms_messagerx2(), sms_process(), sms_readfile(), sms_writefile(), sndfax_exec(), socket_process(), socket_process_meta(), socket_read(), softhangup_exec(), soundcard_init(), soundcard_writeframe(), span_message(), spandsp_fax_new(), spandsp_fax_start(), spandsp_fax_write(), spandsp_log(), spawn_dp_lookup(), spawn_mp3(), speex_get_wb_sz_at(), speex_read(), speex_samples(), speex_write(), speextolin_framein(), spy_generate(), sqlite_log(), srv_datastore_setup(), srv_query_read(), srv_result_read(), ss7_handle_cqm(), ss7_linkset(), ss7_start_call(), ssl_lock(), ssl_verify(), start_moh_exec(), start_monitor_exec(), start_network_thread(), start_rtp(), start_session_timer(), start_spying(), start_stream(), startelm(), starttimer(), statpost(), stop_session_timer(), store_boost(), store_by_peercallno(), store_by_transfercallno(), store_config(), store_config_core(), store_curl(), store_digit(), store_mixer(), store_odbc(), store_pgsql(), store_rxcdtype(), store_rxdemod(), store_rxsdtype(), store_tone_zone_ring_cadence(), store_txmixa(), store_txmixb(), store_txtoctype(), str_to_agent_policy(), str_to_monitor_policy(), stun_monitor_request(), stun_start_monitor(), stun_stop_monitor(), subscribe_event_destroy(), subscript(), substitute_escapes(), swap_subs(), switch_video_out(), sysinfo_helper(), syslog_log(), system_exec_helper(), t38_tx_packet_handler(), tdd_feed(), tdd_new(), tds_error_handler(), tds_load_module(), tds_log(), tds_message_handler(), telem_lookup(), testclient_exec(), testserver_exec(), timed_read(), timeout_read(), timeout_write(), timerfd_timer_ack(), timerfd_timer_close(), timerfd_timer_disable_continuous(), timerfd_timer_enable_continuous(), timerfd_timer_get_event(), timerfd_timer_open(), timerfd_timer_set_rate(), timezone_add(), to_number(), to_string(), tonepair_alloc(), tonepair_generator(), tps_processing_function(), tps_taskprocessor_destroy(), tps_taskprocessor_pop(), transfer_exec(), TransferCallStep1(), transmit(), transmit_audio(), transmit_cc_notify(), transmit_invite(), transmit_refer(), transmit_register(), transmit_request_with_auth(), transmit_response(), transmit_response_using_temp(), transmit_response_with_auth(), transmit_response_with_sdp(), transmit_response_with_t38_sdp(), transmit_state_notify(), transmit_t38(), try_calling(), try_firmware(), try_load_key(), try_suggested_sip_codec(), try_transfer(), tryexec_exec(), turn_on_off(), tvfix(), txt_callback(), unalloc_sub(), unistim_answer(), unistim_call(), unistim_do_senddigit(), unistim_fixup(), unistim_hangup(), unistim_indicate(), unistim_new(), unistim_request(), unistim_rtp_read(), unistim_senddigit_end(), unistim_sendtext(), unistim_ss(), unistim_write(), unistimsock_read(), unload_module(), unlock_read(), unref_mansession(), unregister_exten(), unshift_push(), update2_curl(), update2_ldap(), update2_odbc(), update2_pgsql(), update2_prepare(), update_call_counter(), update_common_options(), update_config(), update_curl(), update_header(), update_key(), update_ldap(), update_modem_bits(), update_odbc(), update_pgsql(), update_registry(), update_scoreboard(), update_stats(), upqm_exec(), uridecode(), uriencode(), usbradio_fixup(), usbradio_indicate(), usbradio_new(), usbradio_read(), usbradio_request(), usbradio_text(), usbradio_write(), used_blocks(), userevent_exec(), verbose_exec(), vm_authenticate(), vm_box_exists(), vm_change_password(), vm_check_password_shell(), vm_exec(), vm_execmain(), vm_intro(), vm_newuser(), vm_options(), vmsayname_exec(), vox_read(), vox_write(), wait_file(), wait_file2(), wait_for_answer(), wait_for_winner(), wait_interval(), wait_moh_exec(), waitfor_exec(), waitforring_exec(), waitstream_core(), waituntil_exec(), wav_close(), wav_read(), wav_seek(), wav_write(), write_byte(), write_cdr(), write_header(), write_history(), write_password_to_file(), write_stream(), writefile(), xmldoc_build_field(), xmldoc_get_syntax_fun(), xmldoc_string_cleanup(), xmldoc_string_wrap(), xpmr_config(), yyerror(), and yyparse().
01099 { 01100 struct logmsg *logmsg = NULL; 01101 struct ast_str *buf = NULL; 01102 struct ast_tm tm; 01103 struct timeval now = ast_tvnow(); 01104 int res = 0; 01105 va_list ap; 01106 char datestring[256]; 01107 01108 if (!(buf = ast_str_thread_get(&log_buf, LOG_BUF_INIT_SIZE))) 01109 return; 01110 01111 if (AST_RWLIST_EMPTY(&logchannels)) { 01112 /* 01113 * we don't have the logger chain configured yet, 01114 * so just log to stdout 01115 */ 01116 if (level != __LOG_VERBOSE) { 01117 int result; 01118 va_start(ap, fmt); 01119 result = ast_str_set_va(&buf, BUFSIZ, fmt, ap); /* XXX BUFSIZ ? */ 01120 va_end(ap); 01121 if (result != AST_DYNSTR_BUILD_FAILED) { 01122 term_filter_escapes(ast_str_buffer(buf)); 01123 fputs(ast_str_buffer(buf), stdout); 01124 } 01125 } 01126 return; 01127 } 01128 01129 /* don't display LOG_DEBUG messages unless option_verbose _or_ option_debug 01130 are non-zero; LOG_DEBUG messages can still be displayed if option_debug 01131 is zero, if option_verbose is non-zero (this allows for 'level zero' 01132 LOG_DEBUG messages to be displayed, if the logmask on any channel 01133 allows it) 01134 */ 01135 if (!option_verbose && !option_debug && (level == __LOG_DEBUG)) 01136 return; 01137 01138 /* Ignore anything that never gets logged anywhere */ 01139 if (level != __LOG_VERBOSE && !(global_logmask & (1 << level))) 01140 return; 01141 01142 /* Build string */ 01143 va_start(ap, fmt); 01144 res = ast_str_set_va(&buf, BUFSIZ, fmt, ap); 01145 va_end(ap); 01146 01147 /* If the build failed, then abort and free this structure */ 01148 if (res == AST_DYNSTR_BUILD_FAILED) 01149 return; 01150 01151 /* Create a new logging message */ 01152 if (!(logmsg = ast_calloc_with_stringfields(1, struct logmsg, res + 128))) 01153 return; 01154 01155 /* Copy string over */ 01156 ast_string_field_set(logmsg, message, ast_str_buffer(buf)); 01157 01158 /* Set type */ 01159 if (level == __LOG_VERBOSE) { 01160 logmsg->type = LOGMSG_VERBOSE; 01161 } else { 01162 logmsg->type = LOGMSG_NORMAL; 01163 } 01164 01165 /* Create our date/time */ 01166 ast_localtime(&now, &tm, NULL); 01167 ast_strftime(datestring, sizeof(datestring), dateformat, &tm); 01168 ast_string_field_set(logmsg, date, datestring); 01169 01170 /* Copy over data */ 01171 logmsg->level = level; 01172 logmsg->line = line; 01173 ast_string_field_set(logmsg, level_name, levels[level]); 01174 ast_string_field_set(logmsg, file, file); 01175 ast_string_field_set(logmsg, function, function); 01176 logmsg->process_id = (long) GETTID(); 01177 01178 /* If the logger thread is active, append it to the tail end of the list - otherwise skip that step */ 01179 if (logthread != AST_PTHREADT_NULL) { 01180 AST_LIST_LOCK(&logmsgs); 01181 AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list); 01182 ast_cond_signal(&logcond); 01183 AST_LIST_UNLOCK(&logmsgs); 01184 } else { 01185 logger_print_normal(logmsg); 01186 ast_free(logmsg); 01187 } 01188 01189 return; 01190 }
| static void ast_log_vsyslog | ( | struct logmsg * | msg | ) | [static] |
Definition at line 874 of file logger.c.
References ast_syslog_priority_from_loglevel(), logmsg::file, logmsg::function, logmsg::level, levels, logmsg::line, logmsg::message, logmsg::process_id, and term_strip().
Referenced by logger_print_normal().
00875 { 00876 char buf[BUFSIZ]; 00877 int syslog_level = ast_syslog_priority_from_loglevel(msg->level); 00878 00879 if (syslog_level < 0) { 00880 /* we are locked here, so cannot ast_log() */ 00881 fprintf(stderr, "ast_log_vsyslog called with bogus level: %d\n", msg->level); 00882 return; 00883 } 00884 00885 snprintf(buf, sizeof(buf), "%s[%ld]: %s:%d in %s: %s", 00886 levels[msg->level], msg->process_id, msg->file, msg->line, msg->function, msg->message); 00887 00888 term_strip(buf, buf, strlen(buf) + 1); 00889 syslog(syslog_level, "%s", buf); 00890 }
| int ast_logger_register_level | ( | const char * | name | ) |
Register a new logger level.
| name | The name of the level to be registered |
| -1 | if an error occurs | |
| non-zero | level to be used with ast_log for sending messages to this level |
Definition at line 1364 of file logger.c.
References ARRAY_LEN, ast_debug, ast_log(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, available(), levels, LOG_WARNING, and update_logchannels().
Referenced by ast_cc_init(), and load_module().
01365 { 01366 unsigned int level; 01367 unsigned int available = 0; 01368 01369 AST_RWLIST_WRLOCK(&logchannels); 01370 01371 for (level = 0; level < ARRAY_LEN(levels); level++) { 01372 if ((level >= 16) && !available && !levels[level]) { 01373 available = level; 01374 continue; 01375 } 01376 01377 if (levels[level] && !strcasecmp(levels[level], name)) { 01378 ast_log(LOG_WARNING, 01379 "Unable to register dynamic logger level '%s': a standard logger level uses that name.\n", 01380 name); 01381 AST_RWLIST_UNLOCK(&logchannels); 01382 01383 return -1; 01384 } 01385 } 01386 01387 if (!available) { 01388 ast_log(LOG_WARNING, 01389 "Unable to register dynamic logger level '%s'; maximum number of levels registered.\n", 01390 name); 01391 AST_RWLIST_UNLOCK(&logchannels); 01392 01393 return -1; 01394 } 01395 01396 levels[available] = ast_strdup(name); 01397 01398 AST_RWLIST_UNLOCK(&logchannels); 01399 01400 ast_debug(1, "Registered dynamic logger level '%s' with index %d.\n", name, available); 01401 01402 update_logchannels(); 01403 01404 return available; 01405 }
| void ast_logger_unregister_level | ( | const char * | name | ) |
Unregister a previously registered logger level.
| name | The name of the level to be unregistered |
Definition at line 1407 of file logger.c.
References ARRAY_LEN, ast_debug, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, free, levels, and update_logchannels().
Referenced by load_module(), and unload_module().
01408 { 01409 unsigned int found = 0; 01410 unsigned int x; 01411 01412 AST_RWLIST_WRLOCK(&logchannels); 01413 01414 for (x = 16; x < ARRAY_LEN(levels); x++) { 01415 if (!levels[x]) { 01416 continue; 01417 } 01418 01419 if (strcasecmp(levels[x], name)) { 01420 continue; 01421 } 01422 01423 found = 1; 01424 break; 01425 } 01426 01427 if (found) { 01428 /* take this level out of the global_logmask, to ensure that no new log messages 01429 * will be queued for it 01430 */ 01431 01432 global_logmask &= ~(1 << x); 01433 01434 free(levels[x]); 01435 levels[x] = NULL; 01436 AST_RWLIST_UNLOCK(&logchannels); 01437 01438 ast_debug(1, "Unregistered dynamic logger level '%s' with index %d.\n", name, x); 01439 01440 update_logchannels(); 01441 } else { 01442 AST_RWLIST_UNLOCK(&logchannels); 01443 } 01444 }
| void ast_queue_log | ( | const char * | queuename, | |
| const char * | callid, | |||
| const char * | agent, | |||
| const char * | event, | |||
| const char * | fmt, | |||
| ... | ||||
| ) |
Definition at line 459 of file logger.c.
References args, AST_APP_ARG, ast_check_realtime(), AST_DECLARE_APP_ARGS, ast_localtime(), AST_NONSTANDARD_APP_ARGS, ast_realtime_require_field(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_store_realtime(), ast_strftime(), ast_tvnow(), logfiles, logger_queue_init(), qlog, RQ_CHAR, S_OR, and SENTINEL.
Referenced by aqm_exec(), find_queue_by_name_rt(), handle_queue_add_member(), handle_queue_remove_member(), logger_queue_init(), login_exec(), manager_add_queue_member(), manager_queue_log_custom(), manager_remove_queue_member(), ql_exec(), queue_exec(), queue_transfer_fixup(), reload_logger(), rna(), rqm_exec(), rt_handle_member_record(), set_member_paused(), set_member_penalty(), try_calling(), update_realtime_members(), and wait_our_turn().
00460 { 00461 va_list ap; 00462 struct timeval tv; 00463 struct ast_tm tm; 00464 char qlog_msg[8192]; 00465 int qlog_len; 00466 char time_str[30]; 00467 00468 if (!queuelog_init) { 00469 queuelog_init = 1; 00470 logger_queue_init(); 00471 } 00472 00473 if (ast_check_realtime("queue_log")) { 00474 tv = ast_tvnow(); 00475 ast_localtime(&tv, &tm, NULL); 00476 ast_strftime(time_str, sizeof(time_str), "%F %T.%6q", &tm); 00477 va_start(ap, fmt); 00478 vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap); 00479 va_end(ap); 00480 if (logfiles.queue_adaptive_realtime) { 00481 AST_DECLARE_APP_ARGS(args, 00482 AST_APP_ARG(data)[5]; 00483 ); 00484 AST_NONSTANDARD_APP_ARGS(args, qlog_msg, '|'); 00485 /* Ensure fields are large enough to receive data */ 00486 ast_realtime_require_field("queue_log", "data1", RQ_CHAR, strlen(S_OR(args.data[0], "")), 00487 "data2", RQ_CHAR, strlen(S_OR(args.data[1], "")), 00488 "data3", RQ_CHAR, strlen(S_OR(args.data[2], "")), 00489 "data4", RQ_CHAR, strlen(S_OR(args.data[3], "")), 00490 "data5", RQ_CHAR, strlen(S_OR(args.data[4], "")), 00491 SENTINEL); 00492 00493 /* Store the log */ 00494 ast_store_realtime("queue_log", "time", time_str, 00495 "callid", callid, 00496 "queuename", queuename, 00497 "agent", agent, 00498 "event", event, 00499 "data1", S_OR(args.data[0], ""), 00500 "data2", S_OR(args.data[1], ""), 00501 "data3", S_OR(args.data[2], ""), 00502 "data4", S_OR(args.data[3], ""), 00503 "data5", S_OR(args.data[4], ""), 00504 SENTINEL); 00505 } else { 00506 ast_store_realtime("queue_log", "time", time_str, 00507 "callid", callid, 00508 "queuename", queuename, 00509 "agent", agent, 00510 "event", event, 00511 "data", qlog_msg, 00512 SENTINEL); 00513 } 00514 00515 if (!logfiles.queue_log_to_file) { 00516 return; 00517 } 00518 } 00519 00520 if (qlog) { 00521 va_start(ap, fmt); 00522 qlog_len = snprintf(qlog_msg, sizeof(qlog_msg), "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event); 00523 vsnprintf(qlog_msg + qlog_len, sizeof(qlog_msg) - qlog_len, fmt, ap); 00524 va_end(ap); 00525 AST_RWLIST_RDLOCK(&logchannels); 00526 if (qlog) { 00527 fprintf(qlog, "%s\n", qlog_msg); 00528 fflush(qlog); 00529 } 00530 AST_RWLIST_UNLOCK(&logchannels); 00531 } 00532 }
| int ast_register_verbose | ( | void(*)(const char *string) | v | ) |
Definition at line 1314 of file logger.c.
References ast_malloc, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::list, and verb::verboser.
Referenced by ast_makesocket(), and main().
01315 { 01316 struct verb *verb; 01317 01318 if (!(verb = ast_malloc(sizeof(*verb)))) 01319 return -1; 01320 01321 verb->verboser = v; 01322 01323 AST_RWLIST_WRLOCK(&verbosers); 01324 AST_RWLIST_INSERT_HEAD(&verbosers, verb, list); 01325 AST_RWLIST_UNLOCK(&verbosers); 01326 01327 return 0; 01328 }
| int ast_unregister_verbose | ( | void(*)(const char *string) | v | ) |
Definition at line 1330 of file logger.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::list, and verb::verboser.
01331 { 01332 struct verb *cur; 01333 01334 AST_RWLIST_WRLOCK(&verbosers); 01335 AST_RWLIST_TRAVERSE_SAFE_BEGIN(&verbosers, cur, list) { 01336 if (cur->verboser == v) { 01337 AST_RWLIST_REMOVE_CURRENT(list); 01338 ast_free(cur); 01339 break; 01340 } 01341 } 01342 AST_RWLIST_TRAVERSE_SAFE_END; 01343 AST_RWLIST_UNLOCK(&verbosers); 01344 01345 return cur ? 0 : -1; 01346 }
| void ast_verbose | ( | const char * | fmt, | |
| ... | ||||
| ) |
Definition at line 1305 of file logger.c.
References __ast_verbose_ap().
01306 { 01307 va_list ap; 01308 01309 va_start(ap, fmt); 01310 __ast_verbose_ap("", 0, "", fmt, ap); 01311 va_end(ap); 01312 }
| void close_logger | ( | void | ) |
Provided by logger.c
Definition at line 1061 of file logger.c.
References ast_cond_signal, AST_LIST_LOCK, AST_LIST_UNLOCK, AST_PTHREADT_NULL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, close_logger_thread, f, logchannel::fileptr, logchannel::list, logcond, logthread, and qlog.
Referenced by quit_handler().
01062 { 01063 struct logchannel *f = NULL; 01064 01065 /* Stop logger thread */ 01066 AST_LIST_LOCK(&logmsgs); 01067 close_logger_thread = 1; 01068 ast_cond_signal(&logcond); 01069 AST_LIST_UNLOCK(&logmsgs); 01070 01071 if (logthread != AST_PTHREADT_NULL) 01072 pthread_join(logthread, NULL); 01073 01074 AST_RWLIST_WRLOCK(&logchannels); 01075 01076 if (qlog) { 01077 fclose(qlog); 01078 qlog = NULL; 01079 } 01080 01081 AST_RWLIST_TRAVERSE(&logchannels, f, list) { 01082 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { 01083 fclose(f->fileptr); 01084 f->fileptr = NULL; 01085 } 01086 } 01087 01088 closelog(); /* syslog */ 01089 01090 AST_RWLIST_UNLOCK(&logchannels); 01091 01092 return; 01093 }
| static char* handle_logger_reload | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 730 of file logger.c.
References ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, reload_logger(), and ast_cli_entry::usage.
00731 { 00732 switch (cmd) { 00733 case CLI_INIT: 00734 e->command = "logger reload"; 00735 e->usage = 00736 "Usage: logger reload\n" 00737 " Reloads the logger subsystem state. Use after restarting syslogd(8) if you are using syslog logging.\n"; 00738 return NULL; 00739 case CLI_GENERATE: 00740 return NULL; 00741 } 00742 if (reload_logger(0)) { 00743 ast_cli(a->fd, "Failed to reload the logger\n"); 00744 return CLI_FAILURE; 00745 } 00746 return CLI_SUCCESS; 00747 }
| static char* handle_logger_rotate | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 749 of file logger.c.
References ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, reload_logger(), and ast_cli_entry::usage.
00750 { 00751 switch (cmd) { 00752 case CLI_INIT: 00753 e->command = "logger rotate"; 00754 e->usage = 00755 "Usage: logger rotate\n" 00756 " Rotates and Reopens the log files.\n"; 00757 return NULL; 00758 case CLI_GENERATE: 00759 return NULL; 00760 } 00761 if (reload_logger(1)) { 00762 ast_cli(a->fd, "Failed to reload the logger and rotate log files\n"); 00763 return CLI_FAILURE; 00764 } 00765 return CLI_SUCCESS; 00766 }
| static char* handle_logger_set_level | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
Definition at line 768 of file logger.c.
References ast_cli_args::argc, ast_cli_args::argv, ARRAY_LEN, ast_cli(), ast_console_toggle_loglevel(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_true(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, levels, and ast_cli_entry::usage.
00769 { 00770 int x; 00771 int state; 00772 int level = -1; 00773 00774 switch (cmd) { 00775 case CLI_INIT: 00776 e->command = "logger set level {DEBUG|NOTICE|WARNING|ERROR|VERBOSE|DTMF} {on|off}"; 00777 e->usage = 00778 "Usage: logger set level {DEBUG|NOTICE|WARNING|ERROR|VERBOSE|DTMF} {on|off}\n" 00779 " Set a specific log level to enabled/disabled for this console.\n"; 00780 return NULL; 00781 case CLI_GENERATE: 00782 return NULL; 00783 } 00784 00785 if (a->argc < 5) 00786 return CLI_SHOWUSAGE; 00787 00788 AST_RWLIST_WRLOCK(&logchannels); 00789 00790 for (x = 0; x < ARRAY_LEN(levels); x++) { 00791 if (levels[x] && !strcasecmp(a->argv[3], levels[x])) { 00792 level = x; 00793 break; 00794 } 00795 } 00796 00797 AST_RWLIST_UNLOCK(&logchannels); 00798 00799 state = ast_true(a->argv[4]) ? 1 : 0; 00800 00801 if (level != -1) { 00802 ast_console_toggle_loglevel(a->fd, level, state); 00803 ast_cli(a->fd, "Logger status for '%s' has been set to '%s'.\n", levels[level], state ? "on" : "off"); 00804 } else 00805 return CLI_SHOWUSAGE; 00806 00807 return CLI_SUCCESS; 00808 }
| static char* handle_logger_show_channels | ( | struct ast_cli_entry * | e, | |
| int | cmd, | |||
| struct ast_cli_args * | a | |||
| ) | [static] |
CLI command to show logging system configuration.
Definition at line 811 of file logger.c.
References ARRAY_LEN, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, logchannel::disabled, ast_cli_args::fd, logchannel::filename, FORMATL, levels, logchannel::list, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_SYSLOG, logchannel::type, and ast_cli_entry::usage.
00812 { 00813 #define FORMATL "%-35.35s %-8.8s %-9.9s " 00814 struct logchannel *chan; 00815 switch (cmd) { 00816 case CLI_INIT: 00817 e->command = "logger show channels"; 00818 e->usage = 00819 "Usage: logger show channels\n" 00820 " List configured logger channels.\n"; 00821 return NULL; 00822 case CLI_GENERATE: 00823 return NULL; 00824 } 00825 ast_cli(a->fd, FORMATL, "Channel", "Type", "Status"); 00826 ast_cli(a->fd, "Configuration\n"); 00827 ast_cli(a->fd, FORMATL, "-------", "----", "------"); 00828 ast_cli(a->fd, "-------------\n"); 00829 AST_RWLIST_RDLOCK(&logchannels); 00830 AST_RWLIST_TRAVERSE(&logchannels, chan, list) { 00831 unsigned int level; 00832 00833 ast_cli(a->fd, FORMATL, chan->filename, chan->type == LOGTYPE_CONSOLE ? "Console" : (chan->type == LOGTYPE_SYSLOG ? "Syslog" : "File"), 00834 chan->disabled ? "Disabled" : "Enabled"); 00835 ast_cli(a->fd, " - "); 00836 for (level = 0; level < ARRAY_LEN(levels); level++) { 00837 if ((chan->logmask & (1 << level)) && levels[level]) { 00838 ast_cli(a->fd, "%s ", levels[level]); 00839 } 00840 } 00841 ast_cli(a->fd, "\n"); 00842 } 00843 AST_RWLIST_UNLOCK(&logchannels); 00844 ast_cli(a->fd, "\n"); 00845 00846 return CLI_SUCCESS; 00847 }
| int init_logger | ( | void | ) |
Provided by logger.c
Definition at line 1038 of file logger.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_cond_destroy, ast_cond_init, ast_config_AST_LOG_DIR, ast_mkdir(), ast_pthread_create, cli_logger, handle_SIGXFSZ, init_logger_chain(), logcond, logger_thread(), and logthread.
Referenced by main().
01039 { 01040 /* auto rotate if sig SIGXFSZ comes a-knockin */ 01041 sigaction(SIGXFSZ, &handle_SIGXFSZ, NULL); 01042 01043 /* start logger thread */ 01044 ast_cond_init(&logcond, NULL); 01045 if (ast_pthread_create(&logthread, NULL, logger_thread, NULL) < 0) { 01046 ast_cond_destroy(&logcond); 01047 return -1; 01048 } 01049 01050 /* register the logger cli commands */ 01051 ast_cli_register_multiple(cli_logger, ARRAY_LEN(cli_logger)); 01052 01053 ast_mkdir(ast_config_AST_LOG_DIR, 0777); 01054 01055 /* create log channels */ 01056 init_logger_chain(0 /* locked */); 01057 01058 return 0; 01059 }
| static void init_logger_chain | ( | int | locked | ) | [static] |
Definition at line 291 of file logger.c.
References __LOG_ERROR, __LOG_NOTICE, __LOG_WARNING, ast_calloc, ast_config_AST_LOG_DIR, ast_config_destroy(), ast_config_load2(), ast_copy_string(), ast_free, AST_RWLIST_INSERT_HEAD, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_true(), ast_variable_browse(), ast_variable_retrieve(), CONFIG_STATUS_FILEINVALID, errno, ast_variable::lineno, logchannel::list, logfiles, logchannel::logmask, LOGTYPE_CONSOLE, make_logchannel(), ast_variable::name, ast_variable::next, qlog, ROTATE, SEQUENTIAL, TIMESTAMP, logchannel::type, ast_variable::value, and var.
Referenced by init_logger(), and reload_logger().
00292 { 00293 struct logchannel *chan; 00294 struct ast_config *cfg; 00295 struct ast_variable *var; 00296 const char *s; 00297 struct ast_flags config_flags = { 0 }; 00298 00299 if (!(cfg = ast_config_load2("logger.conf", "logger", config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) { 00300 return; 00301 } 00302 00303 /* delete our list of log channels */ 00304 if (!locked) { 00305 AST_RWLIST_WRLOCK(&logchannels); 00306 } 00307 while ((chan = AST_RWLIST_REMOVE_HEAD(&logchannels, list))) { 00308 ast_free(chan); 00309 } 00310 global_logmask = 0; 00311 if (!locked) { 00312 AST_RWLIST_UNLOCK(&logchannels); 00313 } 00314 00315 errno = 0; 00316 /* close syslog */ 00317 closelog(); 00318 00319 /* If no config file, we're fine, set default options. */ 00320 if (!cfg) { 00321 if (errno) { 00322 fprintf(stderr, "Unable to open logger.conf: %s; default settings will be used.\n", strerror(errno)); 00323 } else { 00324 fprintf(stderr, "Errors detected in logger.conf: see above; default settings will be used.\n"); 00325 } 00326 if (!(chan = ast_calloc(1, sizeof(*chan)))) { 00327 return; 00328 } 00329 chan->type = LOGTYPE_CONSOLE; 00330 chan->logmask = __LOG_WARNING | __LOG_NOTICE | __LOG_ERROR; 00331 if (!locked) { 00332 AST_RWLIST_WRLOCK(&logchannels); 00333 } 00334 AST_RWLIST_INSERT_HEAD(&logchannels, chan, list); 00335 global_logmask |= chan->logmask; 00336 if (!locked) { 00337 AST_RWLIST_UNLOCK(&logchannels); 00338 } 00339 return; 00340 } 00341 00342 if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) { 00343 if (ast_true(s)) { 00344 if (gethostname(hostname, sizeof(hostname) - 1)) { 00345 ast_copy_string(hostname, "unknown", sizeof(hostname)); 00346 fprintf(stderr, "What box has no hostname???\n"); 00347 } 00348 } else 00349 hostname[0] = '\0'; 00350 } else 00351 hostname[0] = '\0'; 00352 if ((s = ast_variable_retrieve(cfg, "general", "dateformat"))) 00353 ast_copy_string(dateformat, s, sizeof(dateformat)); 00354 else 00355 ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat)); 00356 if ((s = ast_variable_retrieve(cfg, "general", "queue_log"))) { 00357 logfiles.queue_log = ast_true(s); 00358 } 00359 if ((s = ast_variable_retrieve(cfg, "general", "queue_log_to_file"))) { 00360 logfiles.queue_log_to_file = ast_true(s); 00361 } 00362 if ((s = ast_variable_retrieve(cfg, "general", "queue_log_name"))) { 00363 ast_copy_string(queue_log_name, s, sizeof(queue_log_name)); 00364 } 00365 if ((s = ast_variable_retrieve(cfg, "general", "exec_after_rotate"))) { 00366 ast_copy_string(exec_after_rotate, s, sizeof(exec_after_rotate)); 00367 } 00368 if ((s = ast_variable_retrieve(cfg, "general", "rotatestrategy"))) { 00369 if (strcasecmp(s, "timestamp") == 0) { 00370 rotatestrategy = TIMESTAMP; 00371 } else if (strcasecmp(s, "rotate") == 0) { 00372 rotatestrategy = ROTATE; 00373 } else if (strcasecmp(s, "sequential") == 0) { 00374 rotatestrategy = SEQUENTIAL; 00375 } else { 00376 fprintf(stderr, "Unknown rotatestrategy: %s\n", s); 00377 } 00378 } else { 00379 if ((s = ast_variable_retrieve(cfg, "general", "rotatetimestamp"))) { 00380 rotatestrategy = ast_true(s) ? TIMESTAMP : SEQUENTIAL; 00381 fprintf(stderr, "rotatetimestamp option has been deprecated. Please use rotatestrategy instead.\n"); 00382 } 00383 } 00384 00385 if (!locked) { 00386 AST_RWLIST_WRLOCK(&logchannels); 00387 } 00388 var = ast_variable_browse(cfg, "logfiles"); 00389 for (; var; var = var->next) { 00390 if (!(chan = make_logchannel(var->name, var->value, var->lineno))) { 00391 continue; 00392 } 00393 AST_RWLIST_INSERT_HEAD(&logchannels, chan, list); 00394 global_logmask |= chan->logmask; 00395 } 00396 if (qlog) { 00397 char tmp[4096]; 00398 fclose(qlog); 00399 snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name); 00400 qlog = fopen(tmp, "a"); 00401 } 00402 00403 if (!locked) { 00404 AST_RWLIST_UNLOCK(&logchannels); 00405 } 00406 00407 ast_config_destroy(cfg); 00408 }
| static void logger_print_normal | ( | struct logmsg * | logmsg | ) | [static] |
Print a normal log message to the channels.
Definition at line 893 of file logger.c.
References __LOG_VERBOSE, ast_console_puts_mutable(), ast_log_vsyslog(), AST_RWLIST_EMPTY, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdupa, ast_string_field_set, ast_strlen_zero(), ast_verb, COLOR_BRWHITE, colors, logmsg::date, logchannel::disabled, errno, EVENT_FLAG_SYSTEM, logmsg::file, logchannel::filename, logchannel::fileptr, logmsg::function, logmsg::level, logmsg::level_name, logmsg::line, logchannel::list, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, manager_event, logmsg::message, logmsg::process_id, reload_logger(), term_color(), term_strip(), logchannel::type, and verb::verboser.
Referenced by ast_log(), and logger_thread().
00894 { 00895 struct logchannel *chan = NULL; 00896 char buf[BUFSIZ]; 00897 struct verb *v = NULL; 00898 00899 if (logmsg->level == __LOG_VERBOSE) { 00900 char *tmpmsg = ast_strdupa(logmsg->message + 1); 00901 /* Iterate through the list of verbosers and pass them the log message string */ 00902 AST_RWLIST_RDLOCK(&verbosers); 00903 AST_RWLIST_TRAVERSE(&verbosers, v, list) 00904 v->verboser(logmsg->message); 00905 AST_RWLIST_UNLOCK(&verbosers); 00906 ast_string_field_set(logmsg, message, tmpmsg); 00907 } 00908 00909 AST_RWLIST_RDLOCK(&logchannels); 00910 00911 if (!AST_RWLIST_EMPTY(&logchannels)) { 00912 AST_RWLIST_TRAVERSE(&logchannels, chan, list) { 00913 /* If the channel is disabled, then move on to the next one */ 00914 if (chan->disabled) 00915 continue; 00916 /* Check syslog channels */ 00917 if (chan->type == LOGTYPE_SYSLOG && (chan->logmask & (1 << logmsg->level))) { 00918 ast_log_vsyslog(logmsg); 00919 /* Console channels */ 00920 } else if (chan->type == LOGTYPE_CONSOLE && (chan->logmask & (1 << logmsg->level))) { 00921 char linestr[128]; 00922 char tmp1[80], tmp2[80], tmp3[80], tmp4[80]; 00923 00924 /* If the level is verbose, then skip it */ 00925 if (logmsg->level == __LOG_VERBOSE) 00926 continue; 00927 00928 /* Turn the numerical line number into a string */ 00929 snprintf(linestr, sizeof(linestr), "%d", logmsg->line); 00930 /* Build string to print out */ 00931 snprintf(buf, sizeof(buf), "[%s] %s[%ld]: %s:%s %s: %s", 00932 logmsg->date, 00933 term_color(tmp1, logmsg->level_name, colors[logmsg->level], 0, sizeof(tmp1)), 00934 logmsg->process_id, 00935 term_color(tmp2, logmsg->file, COLOR_BRWHITE, 0, sizeof(tmp2)), 00936 term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)), 00937 term_color(tmp4, logmsg->function, COLOR_BRWHITE, 0, sizeof(tmp4)), 00938 logmsg->message); 00939 /* Print out */ 00940 ast_console_puts_mutable(buf, logmsg->level); 00941 /* File channels */ 00942 } else if (chan->type == LOGTYPE_FILE && (chan->logmask & (1 << logmsg->level))) { 00943 int res = 0; 00944 00945 /* If no file pointer exists, skip it */ 00946 if (!chan->fileptr) { 00947 continue; 00948 } 00949 00950 /* Print out to the file */ 00951 res = fprintf(chan->fileptr, "[%s] %s[%ld] %s: %s", 00952 logmsg->date, logmsg->level_name, logmsg->process_id, logmsg->file, term_strip(buf, logmsg->message, BUFSIZ)); 00953 if (res <= 0 && !ast_strlen_zero(logmsg->message)) { 00954 fprintf(stderr, "**** Asterisk Logging Error: ***********\n"); 00955 if (errno == ENOMEM || errno == ENOSPC) 00956 fprintf(stderr, "Asterisk logging error: Out of disk space, can't log to log file %s\n", chan->filename); 00957 else 00958 fprintf(stderr, "Logger Warning: Unable to write to log file '%s': %s (disabled)\n", chan->filename, strerror(errno)); 00959 manager_event(EVENT_FLAG_SYSTEM, "LogChannel", "Channel: %s\r\nEnabled: No\r\nReason: %d - %s\r\n", chan->filename, errno, strerror(errno)); 00960 chan->disabled = 1; 00961 } else if (res > 0) { 00962 fflush(chan->fileptr); 00963 } 00964 } 00965 } 00966 } else if (logmsg->level != __LOG_VERBOSE) { 00967 fputs(logmsg->message, stdout); 00968 } 00969 00970 AST_RWLIST_UNLOCK(&logchannels); 00971 00972 /* If we need to reload because of the file size, then do so */ 00973 if (filesize_reload_needed) { 00974 reload_logger(-1); 00975 ast_verb(1, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n"); 00976 } 00977 00978 return; 00979 }
| static void logger_queue_init | ( | void | ) | [static] |
Definition at line 1020 of file logger.c.
References ast_check_realtime(), ast_queue_log(), ast_realtime_require_field(), ast_unload_realtime(), logfiles, RQ_CHAR, RQ_DATETIME, and SENTINEL.
Referenced by ast_queue_log().
01021 { 01022 /* Preloaded modules are up. */ 01023 ast_unload_realtime("queue_log"); 01024 if (logfiles.queue_log && ast_check_realtime("queue_log")) { 01025 if (!ast_realtime_require_field("queue_log", 01026 "time", RQ_DATETIME, 26, "data1", RQ_CHAR, 20, 01027 "data2", RQ_CHAR, 20, "data3", RQ_CHAR, 20, 01028 "data4", RQ_CHAR, 20, "data5", RQ_CHAR, 20, SENTINEL)) { 01029 logfiles.queue_adaptive_realtime = 1; 01030 } else { 01031 logfiles.queue_adaptive_realtime = 0; 01032 } 01033 } 01034 01035 ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", ""); 01036 }
| int logger_reload | ( | void | ) |
Reload the logger module without rotating log files (also used from loader.c during a full Asterisk reload).
Reload logger without rotating log files.
Definition at line 722 of file logger.c.
References reload_logger(), RESULT_FAILURE, and RESULT_SUCCESS.
00723 { 00724 if (reload_logger(0)) { 00725 return RESULT_FAILURE; 00726 } 00727 return RESULT_SUCCESS; 00728 }
| static void* logger_thread | ( | void * | data | ) | [static] |
Actual logging thread.
Definition at line 982 of file logger.c.
References ast_cond_wait, ast_free, AST_LIST_EMPTY, AST_LIST_FIRST, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_LOCK, AST_LIST_NEXT, AST_LIST_UNLOCK, close_logger_thread, logchannel::list, logcond, logger_print_normal(), and logchannel::next.
Referenced by init_logger().
00983 { 00984 struct logmsg *next = NULL, *msg = NULL; 00985 00986 for (;;) { 00987 /* We lock the message list, and see if any message exists... if not we wait on the condition to be signalled */ 00988 AST_LIST_LOCK(&logmsgs); 00989 if (AST_LIST_EMPTY(&logmsgs)) { 00990 if (close_logger_thread) { 00991 break; 00992 } else { 00993 ast_cond_wait(&logcond, &logmsgs.lock); 00994 } 00995 } 00996 next = AST_LIST_FIRST(&logmsgs); 00997 AST_LIST_HEAD_INIT_NOLOCK(&logmsgs); 00998 AST_LIST_UNLOCK(&logmsgs); 00999 01000 /* Otherwise go through and process each message in the order added */ 01001 while ((msg = next)) { 01002 /* Get the next entry now so that we can free our current structure later */ 01003 next = AST_LIST_NEXT(msg, list); 01004 01005 /* Depending on the type, send it to the proper function */ 01006 logger_print_normal(msg); 01007 01008 /* Free the data since we are done */ 01009 ast_free(msg); 01010 } 01011 01012 /* If we should stop, then stop */ 01013 if (close_logger_thread) 01014 break; 01015 } 01016 01017 return NULL; 01018 }
| static unsigned int make_components | ( | const char * | s, | |
| int | lineno | |||
| ) | [static] |
Definition at line 214 of file logger.c.
References ARRAY_LEN, ast_skip_blanks(), ast_strdupa, levels, and strsep().
Referenced by make_logchannel(), and update_logchannels().
00215 { 00216 char *w; 00217 unsigned int res = 0; 00218 char *stringp = ast_strdupa(s); 00219 unsigned int x; 00220 00221 while ((w = strsep(&stringp, ","))) { 00222 w = ast_skip_blanks(w); 00223 00224 if (!strcmp(w, "*")) { 00225 res = 0xFFFFFFFF; 00226 break; 00227 } else for (x = 0; x < ARRAY_LEN(levels); x++) { 00228 if (levels[x] && !strcasecmp(w, levels[x])) { 00229 res |= (1 << x); 00230 break; 00231 } 00232 } 00233 } 00234 00235 return res; 00236 }
| static struct logchannel* make_logchannel | ( | const char * | channel, | |
| const char * | components, | |||
| int | lineno | |||
| ) | [static, read] |
Definition at line 238 of file logger.c.
References ast_calloc, ast_config_AST_LOG_DIR, ast_copy_string(), ast_free, ast_strlen_zero(), ast_syslog_facility(), logchannel::components, errno, logchannel::facility, logchannel::filename, logchannel::fileptr, logchannel::lineno, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, make_components(), and logchannel::type.
Referenced by init_logger_chain().
00239 { 00240 struct logchannel *chan; 00241 char *facility; 00242 00243 if (ast_strlen_zero(channel) || !(chan = ast_calloc(1, sizeof(*chan) + strlen(components) + 1))) 00244 return NULL; 00245 00246 strcpy(chan->components, components); 00247 chan->lineno = lineno; 00248 00249 if (!strcasecmp(channel, "console")) { 00250 chan->type = LOGTYPE_CONSOLE; 00251 } else if (!strncasecmp(channel, "syslog", 6)) { 00252 /* 00253 * syntax is: 00254 * syslog.facility => level,level,level 00255 */ 00256 facility = strchr(channel, '.'); 00257 if (!facility++ || !facility) { 00258 facility = "local0"; 00259 } 00260 00261 chan->facility = ast_syslog_facility(facility); 00262 00263 if (chan->facility < 0) { 00264 fprintf(stderr, "Logger Warning: bad syslog facility in logger.conf\n"); 00265 ast_free(chan); 00266 return NULL; 00267 } 00268 00269 chan->type = LOGTYPE_SYSLOG; 00270 ast_copy_string(chan->filename, channel, sizeof(chan->filename)); 00271 openlog("asterisk", LOG_PID, chan->facility); 00272 } else { 00273 if (!ast_strlen_zero(hostname)) { 00274 snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s", 00275 channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel, hostname); 00276 } else { 00277 snprintf(chan->filename, sizeof(chan->filename), "%s/%s", 00278 channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel); 00279 } 00280 if (!(chan->fileptr = fopen(chan->filename, "a"))) { 00281 /* Can't log here, since we're called with a lock */ 00282 fprintf(stderr, "Logger Warning: Unable to open log file '%s': %s\n", chan->filename, strerror(errno)); 00283 } 00284 chan->type = LOGTYPE_FILE; 00285 } 00286 chan->logmask = make_components(chan->components, lineno); 00287 00288 return chan; 00289 }
| static int reload_logger | ( | int | rotate | ) | [static] |
Definition at line 624 of file logger.c.
References ast_check_realtime(), ast_config_AST_LOG_DIR, ast_log(), ast_mkdir(), ast_queue_log(), ast_realtime_require_field(), AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_unload_realtime(), ast_verb, logchannel::disabled, errno, EVENT_FLAG_SYSTEM, f, logchannel::filename, logchannel::fileptr, init_logger_chain(), logchannel::list, LOG_ERROR, logfiles, manager_event, qlog, rotate_file(), RQ_CHAR, RQ_DATETIME, and SENTINEL.
Referenced by handle_logger_reload(), handle_logger_rotate(), logger_print_normal(), and logger_reload().
00625 { 00626 char old[PATH_MAX] = ""; 00627 int queue_rotate = rotate; 00628 struct logchannel *f; 00629 int res = 0; 00630 00631 AST_RWLIST_WRLOCK(&logchannels); 00632 00633 if (qlog) { 00634 if (rotate < 0) { 00635 /* Check filesize - this one typically doesn't need an auto-rotate */ 00636 if (ftello(qlog) > 0x40000000) { /* Arbitrarily, 1 GB */ 00637 fclose(qlog); 00638 qlog = NULL; 00639 } else { 00640 queue_rotate = 0; 00641 } 00642 } else { 00643 fclose(qlog); 00644 qlog = NULL; 00645 } 00646 } else { 00647 queue_rotate = 0; 00648 } 00649 00650 ast_mkdir(ast_config_AST_LOG_DIR, 0777); 00651 00652 AST_RWLIST_TRAVERSE(&logchannels, f, list) { 00653 if (f->disabled) { 00654 f->disabled = 0; /* Re-enable logging at reload */ 00655 manager_event(EVENT_FLAG_SYSTEM, "LogChannel", "Channel: %s\r\nEnabled: Yes\r\n", f->filename); 00656 } 00657 if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) { 00658 int rotate_this = 0; 00659 if (ftello(f->fileptr) > 0x40000000) { /* Arbitrarily, 1 GB */ 00660 /* Be more proactive about rotating massive log files */ 00661 rotate_this = 1; 00662 } 00663 fclose(f->fileptr); /* Close file */ 00664 f->fileptr = NULL; 00665 if (rotate || rotate_this) { 00666 rotate_file(f->filename); 00667 } 00668 } 00669 } 00670 00671 filesize_reload_needed = 0; 00672 00673 init_logger_chain(1 /* locked */); 00674 00675 if (logfiles.queue_log) { 00676 do { 00677 ast_unload_realtime("queue_log"); 00678 if (ast_check_realtime("queue_log")) { 00679 if (!ast_realtime_require_field("queue_log", 00680 "time", RQ_DATETIME, 26, "data1", RQ_CHAR, 20, 00681 "data2", RQ_CHAR, 20, "data3", RQ_CHAR, 20, 00682 "data4", RQ_CHAR, 20, "data5", RQ_CHAR, 20, SENTINEL)) { 00683 logfiles.queue_adaptive_realtime = 1; 00684 } else { 00685 logfiles.queue_adaptive_realtime = 0; 00686 } 00687 00688 if (!logfiles.queue_log_to_file) { 00689 /* Skip the following section */ 00690 break; 00691 } 00692 } 00693 if (qlog) { 00694 fclose(qlog); 00695 qlog = NULL; 00696 } 00697 snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name); 00698 if (queue_rotate) { 00699 rotate_file(old); 00700 } 00701 00702 qlog = fopen(old, "a"); 00703 if (qlog) { 00704 AST_RWLIST_UNLOCK(&logchannels); 00705 ast_queue_log("NONE", "NONE", "NONE", "CONFIGRELOAD", "%s", ""); 00706 AST_RWLIST_WRLOCK(&logchannels); 00707 ast_verb(1, "Asterisk Queue Logger restarted\n"); 00708 } else { 00709 ast_log(LOG_ERROR, "Unable to create queue log: %s\n", strerror(errno)); 00710 res = -1; 00711 } 00712 } while (0); 00713 } 00714 00715 AST_RWLIST_UNLOCK(&logchannels); 00716 00717 return res; 00718 }
| static int rotate_file | ( | const char * | filename | ) | [static] |
Definition at line 534 of file logger.c.
References ARRAY_LEN, ast_channel_release(), ast_dummy_channel_alloc(), ast_log(), ast_safe_system(), ast_strlen_zero(), LOG_WARNING, pbx_builtin_setvar_helper(), pbx_substitute_variables_helper(), ROTATE, SEQUENTIAL, and TIMESTAMP.
Referenced by reload_logger().
00535 { 00536 char old[PATH_MAX]; 00537 char new[PATH_MAX]; 00538 int x, y, which, found, res = 0, fd; 00539 char *suffixes[4] = { "", ".gz", ".bz2", ".Z" }; 00540 00541 switch (rotatestrategy) { 00542 case SEQUENTIAL: 00543 for (x = 0; ; x++) { 00544 snprintf(new, sizeof(new), "%s.%d", filename, x); 00545 fd = open(new, O_RDONLY); 00546 if (fd > -1) 00547 close(fd); 00548 else 00549 break; 00550 } 00551 if (rename(filename, new)) { 00552 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", filename, new); 00553 res = -1; 00554 } else { 00555 filename = new; 00556 } 00557 break; 00558 case TIMESTAMP: 00559 snprintf(new, sizeof(new), "%s.%ld", filename, (long)time(NULL)); 00560 if (rename(filename, new)) { 00561 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", filename, new); 00562 res = -1; 00563 } else { 00564 filename = new; 00565 } 00566 break; 00567 case ROTATE: 00568 /* Find the next empty slot, including a possible suffix */ 00569 for (x = 0; ; x++) { 00570 found = 0; 00571 for (which = 0; which < ARRAY_LEN(suffixes); which++) { 00572 snprintf(new, sizeof(new), "%s.%d%s", filename, x, suffixes[which]); 00573 fd = open(new, O_RDONLY); 00574 if (fd > -1) { 00575 close(fd); 00576 found = 1; 00577 break; 00578 } 00579 } 00580 if (!found) { 00581 break; 00582 } 00583 } 00584 00585 /* Found an empty slot */ 00586 for (y = x; y > 0; y--) { 00587 for (which = 0; which < ARRAY_LEN(suffixes); which++) { 00588 snprintf(old, sizeof(old), "%s.%d%s", filename, y - 1, suffixes[which]); 00589 fd = open(old, O_RDONLY); 00590 if (fd > -1) { 00591 /* Found the right suffix */ 00592 close(fd); 00593 snprintf(new, sizeof(new), "%s.%d%s", filename, y, suffixes[which]); 00594 if (rename(old, new)) { 00595 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new); 00596 res = -1; 00597 } 00598 break; 00599 } 00600 } 00601 } 00602 00603 /* Finally, rename the current file */ 00604 snprintf(new, sizeof(new), "%s.0", filename); 00605 if (rename(filename, new)) { 00606 fprintf(stderr, "Unable to rename file '%s' to '%s'\n", filename, new); 00607 res = -1; 00608 } 00609 } 00610 00611 if (!ast_strlen_zero(exec_after_rotate)) { 00612 struct ast_channel *c = ast_dummy_channel_alloc(); 00613 char buf[512]; 00614 pbx_builtin_setvar_helper(c, "filename", filename); 00615 pbx_substitute_variables_helper(c, exec_after_rotate, buf, sizeof(buf)); 00616 if (ast_safe_system(buf) == -1) { 00617 ast_log(LOG_WARNING, "error executing '%s'\n", buf); 00618 } 00619 c = ast_channel_release(c); 00620 } 00621 return res; 00622 }
| static void update_logchannels | ( | void | ) | [static] |
Definition at line 1348 of file logger.c.
References AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::components, logchannel::lineno, logchannel::list, logchannel::logmask, and make_components().
Referenced by ast_logger_register_level(), and ast_logger_unregister_level().
01349 { 01350 struct logchannel *cur; 01351 01352 AST_RWLIST_WRLOCK(&logchannels); 01353 01354 global_logmask = 0; 01355 01356 AST_RWLIST_TRAVERSE(&logchannels, cur, list) { 01357 cur->logmask = make_components(cur->components, cur->lineno); 01358 global_logmask |= cur->logmask; 01359 } 01360 01361 AST_RWLIST_UNLOCK(&logchannels); 01362 }
struct ast_cli_entry cli_logger[] [static] |
int close_logger_thread = 0 [static] |
const int colors[32] [static] |
Colors used in the console for logging.
Definition at line 171 of file logger.c.
Referenced by logger_print_normal().
char dateformat[256] = "%b %e %T" [static] |
char exec_after_rotate[256] = "" [static] |
int filesize_reload_needed [static] |
unsigned int global_logmask = 0xFFFF [static] |
struct sigaction handle_SIGXFSZ [static] |
Initial value:
{
.sa_handler = _handle_SIGXFSZ,
.sa_flags = SA_RESTART,
}
Definition at line 869 of file logger.c.
Referenced by init_logger().
char hostname[MAXHOSTNAMELEN] [static] |
Definition at line 91 of file logger.c.
Referenced by app_exec(), ast_readconfig(), ast_remotecontrol(), cli_prompt(), iax2_register(), main(), netconsole(), set_destination(), sip_subscribe_mwi(), and tds_load_module().
char* levels[32] [static] |
Logging channels used in the Asterisk logging system.
The first 16 levels are reserved for system usage, and the remaining levels are reserved for usage by dynamic levels registered via ast_logger_register_level.
Definition at line 160 of file logger.c.
Referenced by ast_log(), ast_log_vsyslog(), ast_logger_register_level(), ast_logger_unregister_level(), ast_network_puts_mutable(), handle_logger_set_level(), handle_logger_show_channels(), and make_components().
struct ast_threadstorage log_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_log_buf , .custom_init = NULL , } [static] |
ast_cond_t logcond [static] |
Definition at line 144 of file logger.c.
Referenced by ast_log(), close_logger(), init_logger(), and logger_thread().
struct { ... } logfiles [static] |
Referenced by ast_queue_log(), init_logger_chain(), logger_queue_init(), and reload_logger().
pthread_t logthread = AST_PTHREADT_NULL [static] |
Definition at line 143 of file logger.c.
Referenced by ast_log(), close_logger(), and init_logger().
FILE* qlog [static] |
Definition at line 147 of file logger.c.
Referenced by ast_queue_log(), close_logger(), init_logger_chain(), and reload_logger().
| unsigned int queue_adaptive_realtime |
char queue_log_name[256] = QUEUELOG [static] |
| unsigned int queue_log_to_file |
int queuelog_init [static] |
struct ast_threadstorage verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_verbose_buf , .custom_init = NULL , } [static] |
1.5.9