Sat Aug 6 00:39:58 2011

Asterisk developer's documentation


logger.c File Reference

Asterisk Logger. More...

#include "asterisk.h"
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <syslog.h>
#include "asterisk/logger.h"
#include "asterisk/lock.h"
#include "asterisk/options.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"

Go to the source code of this file.

Data Structures

struct  logchannel
struct  logchannels
struct  verb
struct  verbosers

Defines

#define FORMATL   "%-35.35s %-8.8s %-9.9s "
#define GETTID()   getpid()
#define LOG_BUF_INIT_SIZE   128
#define SYSLOG_NAMES
#define SYSLOG_NLEVELS   sizeof(syslog_level_map) / sizeof(int)
#define VERBOSE_BUF_INIT_SIZE   128

Enumerations

enum  logtypes { LOGTYPE_SYSLOG, LOGTYPE_FILE, LOGTYPE_CONSOLE }

Functions

static void _handle_SIGXFSZ (int sig)
void ast_backtrace (void)
void ast_log (int level, const char *file, int line, const char *function, const char *fmt,...)
 This is the standard logger function. Probably the only way you will invoke it would be something like this: ast_log(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.
static void ast_log_vsyslog (int level, const char *file, int line, const char *function, const char *fmt, va_list args)
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,...)
 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 close_logger (void)
static int handle_logger_reload (int fd, int argc, char *argv[])
static int handle_logger_rotate (int fd, int argc, char *argv[])
static int handle_logger_show_channels (int fd, int argc, char *argv[])
 CLI command to show logging system configuration.
int init_logger (void)
static void init_logger_chain (void)
static void log_buf_init (void)
int logger_reload (void)
 Reload logger without rotating log files.
static int make_components (char *s, int lineno)
static struct logchannelmake_logchannel (char *channel, char *components, int lineno)
int reload_logger (int rotate)
static void verbose_buf_init (void)

Variables

static struct ast_cli_entry cli_logger []
static int colors []
static char dateformat [256] = "%b %e %T"
static FILE * eventlog
static int filesize_reload_needed
static int global_logmask = -1
static struct sigaction handle_SIGXFSZ
static char hostname [MAXHOSTNAMELEN]
static char * levels []
static struct ast_threadstorage log_buf = { .once = PTHREAD_ONCE_INIT , .key_init = log_buf_init , }
struct {
   unsigned int   event_log:1
   unsigned int   queue_log:1
logfiles
static char logger_reload_help []
static char logger_rotate_help []
static char logger_show_channels_help []
static FILE * qlog
static int syslog_level_map []
static struct ast_threadstorage verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = verbose_buf_init , }


Detailed Description

Asterisk Logger.

Logging routines

Author:
Mark Spencer <markster@digium.com>

Definition in file logger.c.


Define Documentation

#define FORMATL   "%-35.35s %-8.8s %-9.9s "

Referenced by handle_logger_show_channels().

 
#define GETTID (  )     getpid()

Definition at line 83 of file logger.c.

Referenced by ast_log(), and ast_log_vsyslog().

#define LOG_BUF_INIT_SIZE   128

Definition at line 144 of file logger.c.

Referenced by ast_log().

#define SYSLOG_NAMES

Definition at line 50 of file logger.c.

#define SYSLOG_NLEVELS   sizeof(syslog_level_map) / sizeof(int)

Definition at line 64 of file logger.c.

Referenced by ast_log_vsyslog().

#define VERBOSE_BUF_INIT_SIZE   128

Definition at line 141 of file logger.c.

Referenced by ast_verbose().


Enumeration Type Documentation

enum logtypes

Enumerator:
LOGTYPE_SYSLOG 
LOGTYPE_FILE 
LOGTYPE_CONSOLE 

Definition at line 99 of file logger.c.

00100               {
00101    LOGTYPE_SYSLOG,
00102    LOGTYPE_FILE,
00103    LOGTYPE_CONSOLE,


Function Documentation

static void _handle_SIGXFSZ ( int  sig  )  [static]

Definition at line 582 of file logger.c.

00584 {
00585    /* Indicate need to reload */
00586    filesize_reload_needed = 1;

void ast_backtrace ( void   ) 

Definition at line 832 of file logger.c.

References ast_calloc, ast_free, ast_log(), ast_malloc, ast_utils_which(), free, offset, and S_OR.

00834 {
00835 #ifdef linux
00836 #  ifdef AST_DEVMODE
00837    int stackcount = 0, stackfr;
00838    void **addresses;
00839 #    if defined(HAVE_DLADDR) && defined(HAVE_BFD) && defined(BETTER_BACKTRACES)
00840    bfd *bfdobj;           /* bfd.h */
00841    Dl_info dli;           /* dlfcn.h */
00842    long allocsize;
00843    asymbol **syms = NULL; /* bfd.h */
00844    bfd_vma offset;        /* bfd.h */
00845    const char *lastslash;
00846    asection *section;
00847    const char *file, *func;
00848    unsigned int line;
00849    char address_str[128];
00850 #    else
00851    char **strings;
00852 #    endif
00853 
00854    if ((addresses = ast_calloc(MAX_BACKTRACE_FRAMES, sizeof(*addresses)))) {
00855       stackcount = backtrace(addresses, MAX_BACKTRACE_FRAMES);
00856 #    if defined(HAVE_DLADDR) && defined(HAVE_BFD) && defined(BETTER_BACKTRACES)
00857       ast_log(LOG_DEBUG, "Got %d backtrace record%c\n", stackcount, stackcount != 1 ? 's' : ' ');
00858       for (stackfr = 0; stackfr < stackcount; stackfr++) {
00859          int found = 0, symbolcount;
00860 
00861          if (!dladdr(addresses[stackfr], &dli)) {
00862             continue;
00863          }
00864 
00865          if (strcmp(dli.dli_fname, "asterisk") == 0) {
00866             char asteriskpath[256];
00867             if (!(dli.dli_fname = ast_utils_which("asterisk", asteriskpath, sizeof(asteriskpath)))) {
00868                /* This will fail to find symbols */
00869                ast_log(LOG_DEBUG, "Failed to find asterisk binary for debug symbols.\n");
00870                dli.dli_fname = "asterisk";
00871             }
00872          }
00873 
00874          lastslash = strrchr(dli.dli_fname, '/');
00875          if (  (bfdobj = bfd_openr(dli.dli_fname, NULL)) &&
00876                bfd_check_format(bfdobj, bfd_object) &&
00877                (allocsize = bfd_get_symtab_upper_bound(bfdobj)) > 0 &&
00878                (syms = ast_malloc(allocsize)) &&
00879                (symbolcount = bfd_canonicalize_symtab(bfdobj, syms))) {
00880 
00881             if (bfdobj->flags & DYNAMIC) {
00882                offset = addresses[stackfr] - dli.dli_fbase;
00883             } else {
00884                offset = addresses[stackfr] - (void *) 0;
00885             }
00886 
00887             for (section = bfdobj->sections; section; section = section->next) {
00888                if (  !bfd_get_section_flags(bfdobj, section) & SEC_ALLOC ||
00889                      section->vma > offset ||
00890                      section->size + section->vma < offset) {
00891                   continue;
00892                }
00893 
00894                if (!bfd_find_nearest_line(bfdobj, section, syms, offset - section->vma, &file, &func, &line)) {
00895                   continue;
00896                }
00897 
00898                /* Stack trace output */
00899                found++;
00900                lastslash = strrchr(file, '/');
00901 #      if __WORDSIZE == 32
00902                if (dli.dli_saddr == NULL) {
00903                   address_str[0] = '\0';
00904                } else {
00905                   snprintf(address_str, sizeof(address_str), " (%08lX+%lX)",
00906                      (unsigned long) dli.dli_saddr,
00907                      (unsigned long) (addresses[stackfr] - dli.dli_saddr));
00908                }
00909                ast_log(LOG_DEBUG, "#%d: [%08lX] %s:%u %s()%s\n", stackfr,
00910                   (unsigned long) addresses[stackfr],
00911                   lastslash ? lastslash + 1 : file, line,
00912                   S_OR(func, "???"),
00913                   address_str);
00914 #      elif __WORDSIZE == 64
00915                if (dli.dli_saddr == NULL) {
00916                   address_str[0] = '\0';
00917                } else {
00918                   snprintf(address_str, sizeof(address_str), " (%016lX+%lX)",
00919                      (unsigned long) dli.dli_saddr,
00920                      (unsigned long) (addresses[stackfr] - dli.dli_saddr));
00921                }
00922                ast_log(LOG_DEBUG, "#%d: [%016lX] %s:%u %s()%s\n", stackfr,
00923                   (unsigned long) addresses[stackfr],
00924                   lastslash ? lastslash + 1 : file, line,
00925                   S_OR(func, "???"),
00926                   address_str);
00927 #      endif
00928 
00929                break;
00930             }
00931          }
00932          if (bfdobj) {
00933             bfd_close(bfdobj);
00934             if (syms) {
00935                ast_free(syms);
00936             }
00937          }
00938 
00939          /* Default output, if we cannot find the information within BFD */
00940          if (!found) {
00941 #      if __WORDSIZE == 32
00942             if (dli.dli_saddr == NULL) {
00943                address_str[0] = '\0';
00944             } else {
00945                snprintf(address_str, sizeof(address_str), " (%08lX+%lX)",
00946                   (unsigned long) dli.dli_saddr,
00947                   (unsigned long) (addresses[stackfr] - dli.dli_saddr));
00948             }
00949             ast_log(LOG_DEBUG, "#%d: [%08lX] %s %s()%s\n", stackfr,
00950                (unsigned long) addresses[stackfr],
00951                lastslash ? lastslash + 1 : dli.dli_fname,
00952                S_OR(dli.dli_sname, "<unknown>"),
00953                address_str);
00954 #      elif __WORDSIZE == 64
00955             if (dli.dli_saddr == NULL) {
00956                address_str[0] = '\0';
00957             } else {
00958                snprintf(address_str, sizeof(address_str), " (%016lX+%lX)",
00959                   (unsigned long) dli.dli_saddr,
00960                   (unsigned long) (addresses[stackfr] - dli.dli_saddr));
00961             }
00962             ast_log(LOG_DEBUG, "#%d: [%016lX] %s %s()%s\n", stackfr,
00963                (unsigned long) addresses[stackfr],
00964                lastslash ? lastslash + 1 : dli.dli_fname,
00965                S_OR(dli.dli_sname, "<unknown>"),
00966                address_str);
00967 #      endif
00968          }
00969       }
00970 #    else /* !defined(HAVE_DLADDR) || !defined(HAVE_BFD) || !defined(BETTER_BACKTRACES) */
00971       if ((strings = backtrace_symbols(addresses, stackcount))) {
00972          ast_log(LOG_DEBUG, "Got %d backtrace record%c\n", stackcount, stackcount != 1 ? 's' : ' ');
00973          for (stackfr = 0; stackfr < stackcount ; stackfr++) {
00974 #      if __WORDSIZE == 32
00975             ast_log(LOG_DEBUG, "#%d: [%08X] %s\n", stackfr, (unsigned int)addresses[stackfr], strings[stackfr]);
00976 #      elif __WORDSIZE == 64
00977             ast_log(LOG_DEBUG, "#%d: [%016lX] %s\n", stackfr, (unsigned long)addresses[stackfr], strings[stackfr]);
00978 #      endif
00979          }
00980          free(strings);
00981       } else {
00982          ast_log(LOG_DEBUG, "Could not allocate memory for backtrace\n");
00983       }
00984 #    endif /* defined(HAVE_DLADDR) && defined(HAVE_BFD) && defined(BETTER_BACKTRACES) */
00985       free(addresses);
00986    }
00987 #  else /* !defined(AST_DEVMODE) */
00988    ast_log(LOG_WARNING, "Must run configure with '--enable-dev-mode' for stack backtraces.\n");
00989 #  endif /* defined(AST_DEVMODE) */
00990 #else /* ndef linux */
00991    ast_log(LOG_WARNING, "Inline stack backtraces are only available on the Linux platform.\n");
00992 #endif

void ast_log ( int  level,
const char *  file,
int  line,
const char *  function,
const char *  fmt,
  ... 
)

This is the standard logger function. Probably the only way you will invoke it would be something like this: ast_log(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.

Parameters:
level Type of log event
file Will be provided by the LOG_* macro
line Will be provided by the LOG_* macro
function Will be provided by the LOG_* macro
fmt This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-)

Definition at line 691 of file logger.c.

References __LOG_DEBUG, __LOG_EVENT, __LOG_VERBOSE, ast_console_puts_mutable(), ast_dynamic_str_thread_get(), ast_dynamic_str_thread_set(), ast_dynamic_str_thread_set_va, AST_DYNSTR_BUILD_FAILED, AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_localtime(), ast_log(), ast_log_vsyslog(), ast_strlen_zero(), ast_verbose(), COLOR_BRWHITE, colors, debug_filename, logchannel::disabled, errno, EVENT_FLAG_SYSTEM, eventlog, logchannel::filename, logchannel::fileptr, GETTID, ast_dynamic_str::len, levels, logchannel::list, log_buf, LOG_BUF_INIT_SIZE, LOG_EVENT, logfiles, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_SYSLOG, manager_event(), option_debug, option_verbose, reload_logger(), ast_dynamic_str::str, t, term_color(), term_filter_escapes(), term_strip(), and logchannel::type.

Referenced by __adsi_transmit_messages(), __agent_start_monitoring(), __ast_check_signature(), __ast_check_signature_bin(), __ast_cli_register(), __ast_cli_unregister(), __ast_context_create(), __ast_context_destroy(), __ast_decrypt_bin(), __ast_dsp_call_progress(), __ast_encrypt_bin(), __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_sign_bin(), __ast_smoother_feed(), __attempt_transmit(), __auto_congest(), __dahdi_exception(), __expire_registry(), __find_callno(), __iax2_poke_noanswer(), __login_exec(), __mgcp_xmit(), __oh323_destroy(), __oh323_new(), __oh323_rtp_create(), __oh323_update_info(), __say_init(), __schedule_action(), __send_lagrq(), __send_ping(), __set_address_from_contact(), __sip_ack(), __sip_autodestruct(), __sip_destroy(), __sip_pretend_ack(), __sip_reliable_xmit(), __sip_semi_ack(), __sip_xmit(), __transmit_response(), __unload_module(), _dahdi_get_index(), _enum_array_map(), _extension_match_core(), _macro_exec(), _while_exec(), accept_thread(), acf_channel_read(), acf_curl_exec(), acf_cut_exec(), acf_if(), acf_odbc_read(), acf_odbc_write(), acf_rand_exec(), acf_sort_exec(), acf_strftime(), acf_strptime(), ack_trans(), action_command(), action_getvar(), action_userevent(), action_waitevent(), add_agent(), add_calltoken_ignore(), add_codec_to_answer(), add_content(), add_extensions(), add_features_datastores(), add_header(), add_in_calls(), add_line(), add_out_calls(), add_pri(), add_realm_authentication(), add_sdp(), add_sip_domain(), add_to_interfaces(), admin_exec(), adsi_begin(), adsi_careful_send(), adsi_load_vmail(), adsi_process(), adsi_prog(), advanced_options(), ael2_semantic_check(), agent_answer(), agent_bridgedchannel(), agent_call(), agent_cont_sleep(), agent_fixup(), agent_get_base_channel(), agent_hangup(), agent_indicate(), agent_new(), agent_read(), agent_request(), agent_set_base_channel(), agent_write(), agentmonitoroutgoing_exec(), agi_debug_cli(), agi_exec(), agi_exec_full(), aji_act_hook(), aji_client_connect(), aji_client_info_handler(), aji_client_initialize(), aji_component_initialize(), aji_create_buddy(), aji_create_client(), aji_dinfo_handler(), aji_ditems_handler(), aji_find_version(), aji_handle_presence(), aji_handle_subscribe(), aji_load_config(), aji_recv_loop(), aji_register_approve_handler(), aji_register_query_handler(), aji_reload(), aji_send_exec(), aji_set_presence(), aji_status_exec(), alarmreceiver_exec(), alloc_sub(), alsa_call(), alsa_card_init(), alsa_hangup(), alsa_indicate(), alsa_new(), alsa_read(), alsa_request(), alsa_write(), announce_thread(), answer_call(), answer_sound(), anti_injection(), ao2_callback(), ao2_ref(), app_exec(), append_transaction(), appendcdruserfield_exec(), apply_option(), apply_outgoing(), aqm_exec(), array(), ast_add_extension2(), ast_add_hint(), ast_adsi_begin_download(), ast_adsi_get_cpeid(), ast_adsi_get_cpeinfo(), ast_adsi_load_session(), ast_adsi_transmit_message_full(), ast_agi_register(), ast_aji_create_chat(), ast_aji_invite_chat(), ast_aji_join_chat(), ast_aji_send(), ast_app_dtget(), ast_app_parse_options(), ast_append_ha(), ast_apply_ha(), ast_async_goto(), ast_audiohook_write_frame(), ast_autoservice_start(), ast_backtrace(), ast_best_codec(), ast_bridge_call(), ast_builtins_init(), ast_call_forward(), ast_carefulwrite(), ast_cdr_alloc(), ast_cdr_detach(), 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_channel_alloc(), ast_channel_bridge(), ast_channel_free(), ast_channel_inherit_variables(), ast_channel_make_compatible(), ast_channel_masquerade(), ast_channel_register(), ast_channel_setoption(), ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), ast_channel_unregister(), ast_check_timing(), ast_codec_choose(), ast_codec_get_len(), ast_codec_get_samples(), ast_config_engine_register(), ast_config_internal_load(), ast_context_verify_includes(), ast_control_streamfile(), ast_custom_function_register(), ast_db_del(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_device_state(), ast_device_state_changed_literal(), ast_device_state_engine_init(), ast_dial_run(), ast_do_masquerade(), ast_dsp_busydetect(), ast_dsp_call_progress(), ast_dsp_digitdetect(), ast_dsp_process(), ast_dsp_set_busy_pattern(), ast_dsp_silence(), ast_dtmf_stream(), ast_el_read_char(), ast_enable_packet_fragmentation(), ast_extension_close(), ast_filehelper(), ast_find_ourip(), ast_format_str_reduce(), ast_format_unregister(), ast_func_read(), ast_func_write(), ast_get_channel_tech(), ast_get_enum(), ast_get_group(), ast_get_ip_or_srv(), ast_get_txt(), ast_hangup(), ast_http_error(), ast_httpd_helper_thread(), ast_iax2_new(), ast_indicate_data(), ast_io_add(), ast_io_dump(), ast_io_remove(), ast_io_wait(), ast_ivr_menu_run_internal(), ast_jb_put(), ast_linear_stream(), ast_lock_path(), ast_log(), ast_lookup_iface(), ast_makesocket(), ast_manager_register_struct(), ast_manager_unregister(), ast_merge_contexts_and_delete(), ast_module_reload(), ast_moh_files_next(), ast_monitor_change_fname(), ast_monitor_start(), ast_monitor_stop(), ast_netsock_bindaddr(), ast_odbc_prepare_and_execute(), ast_odbc_request_obj(), ast_odbc_sanity_check(), ast_odbc_smart_execute(), ast_openstream_full(), ast_openvstream(), ast_ouraddrfor(), ast_parse_allow_disallow(), ast_parseable_goto(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), ast_pbx_start(), ast_pickup_call(), ast_playtones_start(), ast_process_pending_reloads(), ast_prod(), ast_pthread_create_stack(), ast_read_generator_actions(), ast_read_image(), ast_read_textfile(), ast_readaudio_callback(), ast_readconfig(), ast_readfile(), ast_readvideo_callback(), ast_record_review(), ast_register_application(), ast_register_feature(), ast_register_switch(), ast_remotecontrol(), ast_request(), ast_rtcp_new(), ast_rtcp_read(), ast_rtcp_write_rr(), ast_rtcp_write_sr(), ast_rtp_bridge(), ast_rtp_change_source(), ast_rtp_codec_setpref(), ast_rtp_early_bridge(), ast_rtp_make_compatible(), ast_rtp_new_source(), ast_rtp_new_with_bindaddr(), ast_rtp_proto_register(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_reload(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_continuation(), ast_rtp_senddigit_end_with_duration(), ast_rtp_settos(), ast_rtp_write(), 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_zh(), ast_say_enumeration_full_da(), ast_say_enumeration_full_de(), ast_say_enumeration_full_en(), ast_say_enumeration_full_he(), ast_say_number_full_da(), ast_say_number_full_de(), ast_say_number_full_en(), ast_say_number_full_en_GB(), ast_say_number_full_es(), ast_say_number_full_fr(), ast_say_number_full_gr(), ast_say_number_full_he(), ast_say_number_full_it(), ast_say_number_full_nl(), ast_say_number_full_no(), ast_say_number_full_pt(), ast_say_number_full_ru(), ast_say_number_full_se(), ast_say_number_full_zh(), ast_sched_add_variable(), ast_sched_del(), ast_sched_dump(), ast_sched_runq(), ast_sched_wait(), ast_sched_when(), ast_search_dns(), ast_senddigit_begin(), ast_set_priority(), ast_settimeout(), ast_sip_ouraddrfor(), ast_slinfactory_feed(), ast_smoother_read(), ast_softhangup_nolock(), ast_stopstream(), ast_str2tos(), ast_streamfile(), ast_translate_path_steps(), ast_translator_build_path(), ast_tryconnect(), ast_udptl_bridge(), ast_udptl_get_error_correction_scheme(), ast_udptl_get_far_max_datagram(), ast_udptl_get_local_max_datagram(), ast_udptl_new_with_bindaddr(), ast_udptl_offered_from_local(), ast_udptl_proto_register(), ast_udptl_read(), ast_udptl_reload(), ast_udptl_set_error_correction_scheme(), ast_udptl_set_far_max_datagram(), ast_udptl_set_local_max_datagram(), ast_udptl_settos(), ast_udptl_write(), ast_unload_resource(), ast_unlock_path(), ast_unregister_indication_country(), ast_verbose(), 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_inheritance_fixup(), audiohook_read_frame_both(), auth_exec(), authenticate(), authenticate_verify(), auto_congest(), autoservice_run(), available(), background_detect_exec(), base64_decode(), base64_encode(), base_encode(), bridge_native_loop(), bridge_p2p_loop(), bridge_p2p_rtp_write(), build_alias(), build_callno_limits(), build_channels(), build_conf(), build_device(), build_filename(), build_gateway(), build_mapping(), build_peer(), build_reply_digest(), build_route(), build_rpid(), build_transactions(), build_user(), builtin_atxfer(), builtin_automonitor(), builtin_blindtransfer(), bump_gains(), cache_get_callno_locked(), cache_lookup_internal(), cache_save_hint(), calc_cost(), calc_energy(), calc_metric(), calc_rxstamp(), calc_timestamp(), callback_deprecated(), callerid_feed(), callerid_feed_jp(), callerid_get_dtmf(), callerid_read(), callerid_write(), calltoken_required(), careful_write(), cb_events(), cdr_merge_vars(), chan_misdn_log(), chan_ringing(), chanavail_exec(), chandup(), channel_find_locked(), chanspy_exec(), check_access(), check_app_args(), check_auth(), check_availability(), check_beep(), check_break(), check_compat(), check_context_names(), check_continue(), check_day(), check_dow(), check_expr2_input(), check_for_conference(), check_goto(), check_header(), check_header_fmt(), check_includes(), check_key(), check_label(), check_month(), check_pendings(), check_post(), check_provisioning(), check_pval_item(), check_srcaddr(), check_timerange(), check_tx_freq(), check_user_full(), check_via(), checkmd5(), cleanup_connection(), clear_caller(), clear_dialed_interfaces(), clearcbone(), cleardisplay(), clearflag(), cleartimer(), cli_prompt(), close_mailbox(), compare_weight(), compile_script(), complete_context_add_extension(), complete_context_add_extension_deprecated(), complete_context_add_ignorepat(), complete_context_add_ignorepat_deprecated(), complete_context_add_include(), complete_context_add_include_deprecated(), complete_context_dont_include_deprecated(), complete_context_remove_extension(), complete_context_remove_extension_deprecated(), complete_context_remove_ignorepat(), complete_context_remove_ignorepat_deprecated(), complete_context_remove_include(), complete_dpreply(), complete_span_helper(), complete_transfer(), compress_subclass(), conf_add(), conf_del(), conf_exec(), conf_exec_warn(), conf_flush(), conf_queue_dtmf(), conf_run(), config_odbc(), config_pgsql(), config_text_file_load(), config_text_file_save(), connect_link(), connection_made(), console_autoanswer(), console_autoanswer_deprecated(), controlplayback_exec(), convertcap(), copy(), copy_header(), copy_message(), copy_via_headers(), count_exec(), create_addr(), create_addr_from_peer(), create_dirpath(), create_dtmf_frame(), create_followme_number(), create_jb(), create_queue_member(), 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_digit_end(), dahdi_disable_ec(), dahdi_enable_ec(), dahdi_encoder_framein(), dahdi_encoder_frameout(), dahdi_fake_event(), dahdi_fixup(), dahdi_func_write(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_link(), dahdi_new(), dahdi_open(), dahdi_pri_error(), dahdi_pri_message(), dahdi_r2_disconnect_call(), dahdi_r2_get_channel_category(), dahdi_r2_on_billing_pulse_received(), dahdi_r2_on_call_accepted(), dahdi_r2_on_call_disconnect(), dahdi_r2_on_call_init(), dahdi_r2_on_call_offered(), dahdi_r2_on_hardware_alarm(), dahdi_r2_on_line_blocked(), dahdi_r2_on_line_idle(), dahdi_r2_on_os_error(), dahdi_r2_on_protocol_error(), dahdi_r2_write_log(), dahdi_read(), dahdi_request(), dahdi_restart(), dahdi_ring_phone(), dahdi_sendtext(), dahdi_set_hook(), dahdi_setoption(), dahdi_show_channel(), dahdi_show_status(), dahdi_train_ec(), dahdi_translate(), dahdi_unlink(), dahdi_write(), dahdi_write_frame(), dbinit(), deadagi_exec(), decode_frame(), decode_length(), del_exec(), deltree_exec(), destroy_pval_item(), destroy_session(), destroy_trans(), determine_firstline_parts(), dictate_exec(), digitcollect(), digitdirect(), directory_exec(), disa_exec(), diskavail(), dns_parse_answer(), dnsmgr_init(), dnsmgr_refresh(), do_autokill(), do_cdr(), do_directory(), do_dtmf_local(), do_idle_thread(), do_message(), do_monitor(), do_parking_thread(), do_proxy_auth(), do_register(), do_register_expire(), do_reload(), do_say(), do_scheduler(), do_setnat(), do_state_change(), do_waiting(), donodelog(), dump_agents(), dump_queue(), dump_queue_members(), dundi_answer_entity(), dundi_answer_query(), dundi_decrypt(), dundi_discover(), dundi_encrypt(), dundi_error_output(), dundi_exec(), dundi_helper(), dundi_lookup_internal(), dundi_lookup_thread(), dundi_precache_full(), dundi_precache_internal(), dundi_precache_thread(), dundi_query(), dundi_query_thread(), dundi_rexmit(), dundi_send(), dundi_xmit(), dundifunc_read(), eagi_exec(), encode_open_type(), encrypt_frame(), enum_callback(), exec(), exec_exec(), exec_warn(), exec_zap(), execif_exec(), ext_cmp1(), extension_matches(), extenspy_exec(), external_rtp_create(), feature_exec_app(), feature_interpret(), feature_interpret_helper(), feature_request_and_dial(), features_alloc(), features_call(), features_new(), festival_exec(), filter(), finalize_content(), find_cache(), find_call(), find_call_locked(), find_conf(), find_conf_realtime(), find_desc(), find_line_by_instance(), find_line_by_name(), find_matching_endwhile(), find_or_create(), find_peer(), 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_reference(), find_transaction(), find_transcoders(), find_user(), findmeexec(), flash_exec(), fn_wrapper(), forkcdr_exec(), forward_message(), framein(), func_args(), func_channel_read(), func_channel_write_real(), func_check_sipdomain(), func_header_read(), func_inheritance_write(), function_agent(), function_autopatchup(), function_db_delete(), function_db_exists(), function_db_read(), function_db_write(), function_enum(), function_eval(), function_ilink(), function_realtime_read(), function_realtime_write(), function_sipchaninfo_read(), function_txtcidname(), g723_len(), g723_read(), g723_write(), g726_open(), g726_read(), g726_write(), g729_read(), g729_write(), generator_force(), generic_prepare(), get_alarms(), get_also_info(), get_button_template(), get_destination(), get_in_brackets(), get_input(), get_ip_and_port_from_sdp(), get_mohbyname(), get_range(), get_rdnis(), get_refer_info(), get_sip_pvt_byid_locked(), get_timerange(), get_token(), get_unused_callno(), get_wait_interval(), getdisplaybyname(), getflagbyname(), getkeybyname(), getproviderstate(), getstatebyname(), getsubbyname(), gosub_exec(), gosubif_exec(), goto_line(), goto_line_rel(), group_count_function_read(), group_function_write(), gsm_read(), gsm_seek(), gsm_write(), gsmtolin_framein(), gtalk_alloc(), gtalk_answer(), gtalk_call(), gtalk_create_candidates(), gtalk_create_member(), gtalk_digit(), gtalk_free_pvt(), gtalk_handle_dtmf(), gtalk_hangup_farend(), gtalk_indicate(), gtalk_invite(), gtalk_invite_response(), gtalk_is_accepted(), gtalk_is_answered(), gtalk_load_config(), gtalk_new(), gtalk_newcall(), gtalk_parser(), gtalk_request(), gtalk_rtp_read(), gtalk_sendhtml(), gtalk_show_channels(), gtalk_update_stun(), gtalk_write(), h263_open(), h263_read(), h263_write(), h264_open(), h264_read(), h264_write(), h323_gk_cycle(), handle_add_indication(), handle_alarms(), handle_call_token(), handle_capabilities_res_message(), handle_command_response(), handle_common_options(), handle_enbloc_call_message(), handle_error(), handle_exec(), handle_frame(), handle_getoption(), handle_hd_hf(), handle_init_event(), handle_invite_replaces(), handle_keypad_button_message(), handle_link_data(), handle_message(), handle_offhook_message(), handle_onhook_message(), handle_open_receive_channel_ack_message(), handle_playtones(), handle_recordfile(), handle_register_message(), handle_remote_data(), handle_remove_indication(), handle_request(), handle_request_bye(), handle_request_cancel(), handle_request_info(), handle_request_invite(), handle_request_notify(), handle_request_refer(), handle_request_register(), handle_request_subscribe(), handle_response(), handle_response_invite(), handle_response_peerpoke(), handle_response_refer(), handle_response_register(), handle_soft_key_event_message(), handle_statechange(), handle_stimulus_message(), handle_streamfile(), hangup_cause2sip(), hangup_connection(), hasvoicemail_exec(), http_root(), http_server_start(), iax2_ack_registry(), iax2_answer(), iax2_call(), iax2_canmatch(), iax2_destroy(), iax2_devicestate(), iax2_do_register(), iax2_exec(), iax2_exists(), iax2_fixup(), iax2_hangup(), iax2_indicate(), iax2_matchmore(), iax2_poke_peer(), iax2_prov_app(), iax2_provision(), iax2_read(), iax2_register(), iax2_request(), iax2_send(), iax2_transfer(), iax2_trunk_queue(), iax2_write(), iax_error_output(), iax_frame_wrap(), iax_park(), iax_park_thread(), iax_process_template(), iax_provision_reload(), iax_provision_version(), iax_template_parse(), ices_exec(), icesencode(), iftime(), ilbc_read(), ilbc_write(), ilbctolin_framein(), import_ch(), increase_call_count(), ind_load_module(), indexof(), init_acf_query(), init_app_class(), init_logger(), init_logger_chain(), init_manager(), init_req(), init_resp(), initialize_initreq(), inprocess_count(), inspect_module(), INTERNAL_OBJ(), invent_message(), io_grow(), is_our_turn(), isAnsweringMachine(), ivr_dispatch(), jb_error_output(), jb_get_and_deliver(), jb_put(), jb_warning_output(), join_queue(), jpeg_read_image(), jpeg_write_image(), language_read(), language_write(), last_message_index(), launch_monitor_thread(), launch_netscript(), launch_script(), launch_service(), leave_queue(), leave_voicemail(), linear_alloc(), linear_generator(), linear_release(), lintogsm_framein(), lintolpc10_framein(), lintoulaw(), listener(), load_config(), load_config_meetme(), load_dynamic_module(), load_module(), load_modules(), load_odbc_config(), load_pbx(), load_realtime_queue(), load_resource(), load_rpt_vars(), local_alloc(), local_answer(), local_attended_transfer(), local_call(), local_devicestate(), local_fixup(), local_new(), local_queue_frame(), local_setoption(), local_write(), log_events(), log_exec(), lookupblacklist_exec(), lookupcidname_exec(), lpc10tolin_framein(), macroif_exec(), main(), make_email_file(), make_integer(), make_str(), make_trunk(), masq_park_call(), math(), md5(), measurenoise(), meetme_cmd(), meetmemute(), memcpy_decrypt(), memcpy_encrypt(), metermaidstate(), mfcr2_get_context(), mfcr2_monitor(), mgcp_answer(), mgcp_call(), mgcp_fixup(), mgcp_hangup(), mgcp_indicate(), mgcp_new(), mgcp_postrequest(), mgcp_reload(), mgcp_request(), mgcp_rtp_read(), mgcp_senddigit_begin(), mgcp_senddigit_end(), mgcp_ss(), mgcp_write(), mgcpsock_read(), milliwatt_generate(), 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_request(), misdn_send_text(), misdn_set_opt_exec(), misdn_write(), mixmonitor_exec(), mixmonitor_thread(), mkif(), mkintf(), moh0_exec(), moh1_exec(), moh2_exec(), moh3_exec(), moh_alloc(), moh_class_destructor(), moh_files_generator(), moh_files_release(), moh_generate(), moh_read(), moh_register(), moh_release(), moh_scan_files(), moh_write(), mohalloc(), monjoin_dep_warning(), monmp3thread(), morsecode_exec(), mp3_exec(), mp3play(), mssql_connect(), my_dahdi_write(), my_load_module(), nbs_alloc(), nbs_call(), nbs_hangup(), nbs_new(), nbs_request(), nbs_xread(), nbs_xwrite(), NBScat_exec(), NBScatplay(), netconsole(), network_thread(), notify_extenstate_update(), notify_metermaids(), notify_new_message(), odbc_load_module(), odbc_obj_connect(), odbc_obj_disconnect(), odbc_register_class(), ogg_vorbis_open(), ogg_vorbis_read(), ogg_vorbis_rewrite(), ogg_vorbis_seek(), ogg_vorbis_tell(), ogg_vorbis_trunc(), ogg_vorbis_write(), oh323_alloc(), oh323_answer(), oh323_call(), oh323_destroy(), oh323_destroy_alias(), oh323_destroy_peer(), oh323_destroy_user(), 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_minus(), op_negate(), op_plus(), op_rem(), op_times(), open_mailbox(), openserial(), osp_auth(), osp_check_destination(), osp_create_provider(), osp_create_transaction(), osp_finish(), osp_get_policy(), osp_load(), osp_lookup(), osp_next(), osp_validate_token(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_indicate(), oss_new(), oss_request(), page_exec(), park_call_full(), park_exec(), park_space_reserve(), parkandannounce_exec(), parse(), parse_args(), parse_buffers_policy(), parse_config(), parse_cookies(), parse_gain_value(), parse_ie(), parse_moved_contact(), parse_naptr(), parse_register_contact(), parse_request(), parse_sip_options(), parse_srv(), parse_via(), pbx_builtin_background(), pbx_builtin_execiftime(), pbx_builtin_gotoif(), pbx_builtin_gotoiftime(), pbx_builtin_hangup(), pbx_builtin_importvar(), pbx_builtin_pushvar_helper(), pbx_builtin_saydate(), pbx_builtin_saynumber(), pbx_builtin_saytime(), pbx_builtin_serialize_variables(), pbx_builtin_setglobalvar(), pbx_builtin_setvar(), pbx_builtin_waitexten(), pbx_extension_helper(), pbx_find_extension(), pbx_load_config(), pbx_load_module(), pbx_load_users(), pbx_substitute_variables_helper_full(), pcm_read(), pcm_seek(), pcm_write(), peer_set_srcaddr(), peercnt_add(), peercnt_modify(), peercnt_remove(), pgsql_log(), pgsql_reconnect(), phone_answer(), phone_call(), phone_check_exception(), 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(), pickup_do(), pickup_exec(), pl_odtworz_plik(), play_greeting(), play_mailbox_owner(), play_message(), play_message_callerid(), play_message_category(), play_message_datetime(), play_message_duration(), play_record_review(), playback_exec(), playtones_alloc(), playtones_generator(), powerof(), pqm_exec(), precache_trans(), precache_transactions(), prep_email_sub_vars(), pri_create_spanmap(), pri_create_trunkgroup(), pri_dchannel(), pri_find_empty_chan(), pri_find_fixup_principle(), pri_fixup_principle(), pri_resolve_span(), printdigest(), privacy_exec(), process_ast_dsp(), process_cisco_dtmf(), process_clearcache(), process_dahdi(), process_message(), process_my_load_module(), process_opcode(), process_request_queue(), process_returncode(), process_rfc2833(), process_rfc3389(), process_sdp(), process_sdp_a_audio(), process_sdp_a_image(), process_sdp_c(), process_text_line(), process_via(), profile_set_param(), progress(), purge_old_messages(), ql_exec(), queue_exec(), queue_function_queuemembercount(), queue_function_queuememberlist(), queue_function_queuewaitingcount(), queue_member_count(), queue_reload_request(), queue_set_param(), queue_transfer_fixup(), quit_handler(), quote(), radius_log(), random_exec(), raw_hangup(), rbi_out(), read_agent_config(), read_config(), read_config_maps(), read_exec(), read_samples(), readfile_exec(), realtime_directory(), realtime_exec(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_pgsql(), realtime_update_exec(), rebuild_matrix(), receive_ademco_contact_id(), receive_digit(), receive_dtmf_digits(), receive_message(), record_exec(), refresh_list(), reg_source_db(), regex(), register_peer_exten(), register_request(), register_verify(), registry_rerequest(), reload(), reload_agents(), reload_config(), reload_firmware(), reload_followme(), reload_logger(), reload_queue_members(), reload_queues(), remove_by_peercallno(), remove_by_transfercallno(), remove_from_interfaces(), remove_from_queue(), replace_callno(), reply_digest(), reqprep(), reset_conf(), reset_global_eid(), respprep(), restart_monitor(), restore_conference(), restore_gains(), retrans_pkt(), retrydial_exec(), return_exec(), ring(), ring_entry(), ring_one(), rpt(), rpt_call(), rpt_do_lstats(), rpt_exec(), rpt_master(), rpt_tele_thread(), rpt_telemetry(), rqm_exec(), rr_dep_warning(), 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_number_full(), say_time(), saycharstr(), sayfile(), saynum(), scan_service(), scan_thread(), sched_delay_remove(), sched_thread(), schedule_delivery(), scheduled_destroy(), send_callerid(), send_delay(), send_digit_to_chan(), send_dtmf(), send_keypad_facility_exec(), send_packet(), send_request(), send_sound(), send_tone_burst(), send_trunk(), send_waveform_to_channel(), send_waveform_to_fd(), senddtmf_exec(), sendimage_exec(), sendmail(), sendpage(), sendtext_exec(), sendurl_exec(), session_do(), set(), set_actual_rxgain(), set_actual_txgain(), set_bridge_features_on_config(), set_config(), set_destination(), set_dtmf_payload(), set_format(), set_insecure_flags(), set_local_capabilities(), set_member_paused(), set_peer_capabilities(), set_peercnt_limit(), set_peercnt_limit_all_cb(), set_state(), set_timing(), set_ulimit(), setcallerid_exec(), setcallerid_pres_exec(), setcdruserfield_exec(), setflag(), setformat(), setrem(), settransfercapability_exec(), setup_dahdi(), setup_incoming_call(), setup_inheritable_audiohook(), setup_rtp_connection(), setup_transfer_datastore(), sha1(), show_channeltype(), show_channeltype_deprecated(), show_channeltypes(), show_dialplan_helper(), show_file_formats(), show_file_formats_deprecated(), showdisplay(), showkeys(), sip_addheader(), sip_alloc(), sip_alreadygone(), sip_answer(), sip_call(), sip_destroy(), sip_destroy_peer(), sip_destroy_user(), sip_devicestate(), sip_dtmfmode(), sip_dump_history(), sip_fixup(), sip_handle_t38_reinvite(), sip_hangup(), sip_indicate(), sip_new(), sip_notify(), sip_park(), sip_park_thread(), sip_poke_noanswer(), sip_poke_peer(), sip_read(), sip_reg_timeout(), sip_register(), sip_registry_destroy(), sip_request_call(), sip_reregister(), sip_rtp_read(), sip_set_rtp_peer(), sip_set_udptl_peer(), sip_sipredirect(), sip_write(), sipsock_read(), skel_exec(), skinny_call(), skinny_fixup(), skinny_hangup(), skinny_indicate(), skinny_new(), skinny_newcall(), skinny_register(), skinny_req_parse(), skinny_request(), skinny_rtp_read(), skinny_session(), skinny_ss(), skinny_write(), sla_add_trunk_to_station(), sla_build_station(), sla_build_trunk(), sla_handle_dial_state_event(), 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_process(), sms_readfile(), socket_process(), socket_read(), softhangup_exec(), sound_thread(), soundcard_init(), soundcard_writeframe(), spawn_dp_lookup(), spawn_mp3(), spawn_ras(), speex_get_wb_sz_at(), speex_samples(), speextolin_framein(), spy_generate(), sqlite_log(), ss_thread(), ssl_lock(), start_network_thread(), start_pri(), start_spying(), starttimer(), store_boost(), store_by_peercallno(), store_by_transfercallno(), store_config(), store_mixer(), store_next(), stub_ast_check_signature(), stub_ast_check_signature_bin(), stub_ast_encdec_bin(), stub_ast_key_get(), stub_ast_sign(), stub_ast_sign_bin(), stun_handle_packet(), subscript(), swap_subs(), system_exec_helper(), t38_get_rate(), tdd_feed(), tdd_new(), tds_load_module(), tds_log(), telem_lookup(), testclient_exec(), testserver_exec(), timed_read(), timeout_read(), timeout_write(), timing_read(), to_integer(), to_string(), tonepair_alloc(), tonepair_generator(), transfer_exec(), transmit_invite(), transmit_notify_with_mwi(), 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_trunk(), try_calling(), try_firmware(), try_load_key(), try_suggested_sip_codec(), try_transfer(), tryexec_exec(), tvfix(), udptl_build_packet(), unalloc_sub(), unload_module(), unwrap_timestamp(), update_call_counter(), update_common_options(), update_config(), update_header(), update_key(), update_max_nontrunk(), update_max_trunk(), update_odbc(), update_pgsql(), update_realtime_members(), update_registry(), upqm_exec(), uridecode(), uriencode(), used_blocks(), userevent_exec(), verbose_exec(), vm_authenticate(), vm_box_exists(), vm_change_password(), vm_exec(), vm_execmain(), vm_forwardoptions(), vm_intro(), vm_newuser(), vm_options(), vm_tempgreeting(), vox_read(), vox_write(), wait_file(), wait_file2(), wait_for_answer(), wait_for_winner(), wait_interval(), waitforring_exec(), waitforsilence_exec(), waitstream_core(), wav_close(), wav_read(), wav_seek(), wav_write(), write_header(), write_metadata(), write_stream(), writefile(), and zap_send_keypad_facility_exec().

00693 {
00694    struct logchannel *chan;
00695    struct ast_dynamic_str *buf;
00696    time_t t;
00697    struct tm tm;
00698    char date[256];
00699 
00700    va_list ap;
00701 
00702    if (!(buf = ast_dynamic_str_thread_get(&log_buf, LOG_BUF_INIT_SIZE)))
00703       return;
00704 
00705    if (AST_LIST_EMPTY(&logchannels))
00706    {
00707       /*
00708        * we don't have the logger chain configured yet,
00709        * so just log to stdout
00710       */
00711       if (level != __LOG_VERBOSE) {
00712          int res;
00713          va_start(ap, fmt);
00714          res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap);
00715          va_end(ap);
00716          if (res != AST_DYNSTR_BUILD_FAILED) {
00717             term_filter_escapes(buf->str);
00718             fputs(buf->str, stdout);
00719          }
00720       }
00721       return;
00722    }
00723 
00724    /* don't display LOG_DEBUG messages unless option_verbose _or_ option_debug
00725       are non-zero; LOG_DEBUG messages can still be displayed if option_debug
00726       is zero, if option_verbose is non-zero (this allows for 'level zero'
00727       LOG_DEBUG messages to be displayed, if the logmask on any channel
00728       allows it)
00729    */
00730    if (!option_verbose && !option_debug && (level == __LOG_DEBUG))
00731       return;
00732 
00733    /* Ignore anything that never gets logged anywhere */
00734    if (!(global_logmask & (1 << level)))
00735       return;
00736    
00737    /* Ignore anything other than the currently debugged file if there is one */
00738    if ((level == __LOG_DEBUG) && !ast_strlen_zero(debug_filename) && strcasecmp(debug_filename, file))
00739       return;
00740 
00741    time(&t);
00742    ast_localtime(&t, &tm, NULL);
00743    strftime(date, sizeof(date), dateformat, &tm);
00744 
00745    AST_LIST_LOCK(&logchannels);
00746 
00747    if (logfiles.event_log && level == __LOG_EVENT) {
00748       va_start(ap, fmt);
00749 
00750       fprintf(eventlog, "%s asterisk[%ld]: ", date, (long)getpid());
00751       vfprintf(eventlog, fmt, ap);
00752       fflush(eventlog);
00753 
00754       va_end(ap);
00755       AST_LIST_UNLOCK(&logchannels);
00756       return;
00757    }
00758 
00759    AST_LIST_TRAVERSE(&logchannels, chan, list) {
00760       if (chan->disabled)
00761          break;
00762       /* Check syslog channels */
00763       if (chan->type == LOGTYPE_SYSLOG && (chan->logmask & (1 << level))) {
00764          va_start(ap, fmt);
00765          ast_log_vsyslog(level, file, line, function, fmt, ap);
00766          va_end(ap);
00767       /* Console channels */
00768       } else if ((chan->logmask & (1 << level)) && (chan->type == LOGTYPE_CONSOLE)) {
00769          char linestr[128];
00770          char tmp1[80], tmp2[80], tmp3[80], tmp4[80];
00771 
00772          if (level != __LOG_VERBOSE) {
00773             int res;
00774             sprintf(linestr, "%d", line);
00775             ast_dynamic_str_thread_set(&buf, BUFSIZ, &log_buf,
00776                "[%s] %s[%ld]: %s:%s %s: ",
00777                date,
00778                term_color(tmp1, levels[level], colors[level], 0, sizeof(tmp1)),
00779                (long)GETTID(),
00780                term_color(tmp2, file, COLOR_BRWHITE, 0, sizeof(tmp2)),
00781                term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)),
00782                term_color(tmp4, function, COLOR_BRWHITE, 0, sizeof(tmp4)));
00783             /*filter to the console!*/
00784             term_filter_escapes(buf->str);
00785             ast_console_puts_mutable(buf->str);
00786             
00787             va_start(ap, fmt);
00788             res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap);
00789             va_end(ap);
00790             if (res != AST_DYNSTR_BUILD_FAILED)
00791                ast_console_puts_mutable(buf->str);
00792          }
00793       /* File channels */
00794       } else if ((chan->logmask & (1 << level)) && (chan->fileptr)) {
00795          int res;
00796          ast_dynamic_str_thread_set(&buf, BUFSIZ, &log_buf, 
00797             "[%s] %s[%ld] %s: ",
00798             date, levels[level], (long)GETTID(), file);
00799          res = fprintf(chan->fileptr, "%s", term_strip(buf->str, buf->str, strlen(buf->str) + 1));
00800          if (res <= 0 && !ast_strlen_zero(buf->str)) {   /* Error, no characters printed */
00801             fprintf(stderr,"**** Asterisk Logging Error: ***********\n");
00802             if (errno == ENOMEM || errno == ENOSPC) {
00803                fprintf(stderr, "Asterisk logging error: Out of disk space, can't log to log file %s\n", chan->filename);
00804             } else
00805                fprintf(stderr, "Logger Warning: Unable to write to log file '%s': %s (disabled)\n", chan->filename, strerror(errno));
00806             manager_event(EVENT_FLAG_SYSTEM, "LogChannel", "Channel: %s\r\nEnabled: No\r\nReason: %d - %s\r\n", chan->filename, errno, strerror(errno));
00807             chan->disabled = 1;  
00808          } else {
00809             int res;
00810             /* No error message, continue printing */
00811             va_start(ap, fmt);
00812             res = ast_dynamic_str_thread_set_va(&buf, BUFSIZ, &log_buf, fmt, ap);
00813             va_end(ap);
00814             if (res != AST_DYNSTR_BUILD_FAILED) {
00815                term_strip(buf->str, buf->str, buf->len);
00816                fputs(buf->str, chan->fileptr);
00817                fflush(chan->fileptr);
00818             }
00819          }
00820       }
00821    }
00822 
00823    AST_LIST_UNLOCK(&logchannels);
00824 
00825    if (filesize_reload_needed) {
00826       reload_logger(1);
00827       ast_log(LOG_EVENT,"Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
00828       if (option_verbose)
00829          ast_verbose("Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
00830    }

static void ast_log_vsyslog ( int  level,
const char *  file,
int  line,
const char *  function,
const char *  fmt,
va_list  args 
) [static]

Definition at line 662 of file logger.c.

References __LOG_DEBUG, __LOG_DTMF, __LOG_VERBOSE, GETTID, levels, s, SYSLOG_NLEVELS, and term_strip().

Referenced by ast_log().

00664 {
00665    char buf[BUFSIZ];
00666    char *s;
00667 
00668    if (level >= SYSLOG_NLEVELS) {
00669       /* we are locked here, so cannot ast_log() */
00670       fprintf(stderr, "ast_log_vsyslog called with bogus level: %d\n", level);
00671       return;
00672    }
00673    if (level == __LOG_VERBOSE) {
00674       snprintf(buf, sizeof(buf), "VERBOSE[%ld]: ", (long)GETTID());
00675       level = __LOG_DEBUG;
00676    } else if (level == __LOG_DTMF) {
00677       snprintf(buf, sizeof(buf), "DTMF[%ld]: ", (long)GETTID());
00678       level = __LOG_DEBUG;
00679    } else {
00680       snprintf(buf, sizeof(buf), "%s[%ld]: %s:%d in %s: ",
00681           levels[level], (long)GETTID(), file, line, function);
00682    }
00683    s = buf + strlen(buf);
00684    vsnprintf(s, sizeof(buf) - strlen(buf), fmt, args);
00685    term_strip(s, s, strlen(s) + 1);
00686    syslog(syslog_level_map[level], "%s", buf);

void ast_queue_log ( const char *  queuename,
const char *  callid,
const char *  agent,
const char *  event,
const char *  fmt,
  ... 
)

Definition at line 353 of file logger.c.

References AST_LIST_LOCK, AST_LIST_UNLOCK, and qlog.

Referenced by __login_exec(), action_agent_callback_login(), agent_logoff_maintenance(), aqm_exec(), handle_queue_add_member(), handle_queue_remove_member(), init_logger(), manager_add_queue_member(), manager_remove_queue_member(), ql_exec(), queue_exec(), queue_transfer_fixup(), reload_logger(), rna(), rqm_exec(), set_member_paused(), and wait_our_turn().

00355 {
00356    va_list ap;
00357    AST_LIST_LOCK(&logchannels);
00358    if (qlog) {
00359       va_start(ap, fmt);
00360       fprintf(qlog, "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
00361       vfprintf(qlog, fmt, ap);
00362       fprintf(qlog, "\n");
00363       va_end(ap);
00364       fflush(qlog);
00365    }
00366    AST_LIST_UNLOCK(&logchannels);

int ast_register_verbose ( void(*)(const char *string)  v  ) 

Definition at line 1040 of file logger.c.

References AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_malloc, logchannel::list, and verb.

Referenced by ast_makesocket(), main(), and show_console().

01042 {
01043    struct verb *verb;
01044 
01045    if (!(verb = ast_malloc(sizeof(*verb))))
01046       return -1;
01047 
01048    verb->verboser = v;
01049 
01050    AST_LIST_LOCK(&verbosers);
01051    AST_LIST_INSERT_HEAD(&verbosers, verb, list);
01052    AST_LIST_UNLOCK(&verbosers);
01053    
01054    return 0;

int ast_unregister_verbose ( void(*)(const char *string)  v  ) 

Definition at line 1056 of file logger.c.

References AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, free, logchannel::list, and verb::verboser.

Referenced by exit_now().

01058 {
01059    struct verb *cur;
01060 
01061    AST_LIST_LOCK(&verbosers);
01062    AST_LIST_TRAVERSE_SAFE_BEGIN(&verbosers, cur, list) {
01063       if (cur->verboser == v) {
01064          AST_LIST_REMOVE_CURRENT(&verbosers, list);
01065          free(cur);
01066          break;
01067       }
01068    }
01069    AST_LIST_TRAVERSE_SAFE_END
01070    AST_LIST_UNLOCK(&verbosers);
01071    
01072    return cur ? 0 : -1;

void ast_verbose ( 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 994 of file logger.c.

References ast_dynamic_str_thread_get(), ast_dynamic_str_thread_set_va, AST_DYNSTR_BUILD_FAILED, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_localtime(), ast_log(), ast_opt_timestamp, logchannel::list, LOG_VERBOSE, ast_dynamic_str::str, t, term_filter_escapes(), verbose_buf, VERBOSE_BUF_INIT_SIZE, and verb::verboser.

Referenced by __agent_start_monitoring(), __ast_format_register(), __ast_pbx_run(), __ast_play_and_record(), __ast_register_translator(), __dahdi_exception(), __login_exec(), __sip_destroy(), _macro_exec(), _while_exec(), accept_thread(), acf_odbc_read(), action_agent_callback_login(), add_codec_to_sdp(), add_noncodec_to_sdp(), add_realm_authentication(), add_sdp(), adsi_exec(), adsi_prog(), advanced_options(), agent_call(), agent_read(), agentmonitoroutgoing_exec(), agi_debug_cli(), aji_handle_presence(), aji_handle_subscribe(), aji_log_hook(), aji_recv_loop(), aji_register_query_handler(), aji_test(), alarmreceiver_exec(), alsa_answer(), alsa_call(), alsa_digit(), alsa_hangup(), alsa_indicate(), alsa_text(), append_mapping(), ast_add_extension2(), ast_aji_disconnect(), ast_app_has_voicemail(), ast_app_inboxcount(), ast_app_messagecount(), ast_bridge_call(), ast_cdr_free(), ast_cdr_unregister(), ast_channel_bridge(), ast_channel_register(), ast_channel_unregister(), ast_context_add_include2(), ast_context_add_switch2(), ast_custom_function_register(), ast_custom_function_unregister(), ast_dnsmgr_lookup(), ast_dnsmgr_release(), ast_format_unregister(), ast_frame_dump(), ast_get_srv(), ast_image_register(), ast_image_unregister(), ast_jb_destroy(), ast_log(), ast_manager_register_struct(), ast_manager_unregister(), ast_module_reload(), ast_moh_destroy(), ast_moh_start(), ast_netsock_bindaddr(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_pbx_run_app(), ast_record_review(), ast_register_application(), ast_register_feature(), ast_remotecontrol(), ast_rtcp_read(), ast_rtcp_write_rr(), ast_rtcp_write_sr(), ast_rtp_bridge(), ast_rtp_destroy(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_reload(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_continuation(), ast_rtp_senddigit_end_with_duration(), ast_say_enumeration_full_he(), ast_say_number_full_he(), ast_set_indication_country(), ast_set_priority(), ast_speech_register(), ast_speech_unregister(), ast_streamfile(), ast_udptl_read(), ast_udptl_reload(), ast_udptl_write(), ast_unregister_application(), ast_unregister_indication_country(), ast_unregister_translator(), async_wait(), attempt_reconnect(), attempt_thread(), attempt_transfer(), begin_dial(), bridge_p2p_rtp_write(), build_channels(), build_conf(), build_device(), build_gateway(), build_query(), builtin_automonitor(), builtin_blindtransfer(), builtin_disconnect(), channel_spy(), check_for_conference(), check_user_full(), check_via(), conf_exec(), conf_run(), config_odbc_prepare(), config_text_file_load(), config_text_file_save(), cpeid_exec(), create_jb(), dahdi_bridge(), dahdi_call(), dahdi_handle_dtmf(), dahdi_handle_event(), dahdi_hangup(), dahdi_pri_message(), dahdi_r2_on_call_accepted(), dahdi_r2_on_call_answered(), dahdi_r2_on_call_disconnect(), dahdi_r2_on_call_end(), dahdi_r2_on_call_init(), dahdi_r2_on_call_offered(), dahdi_r2_write_log(), dahdi_request(), dahdi_restart(), dahdi_softhangup_all(), database_increment(), del_exec(), deltree_exec(), destroy_all_channels(), dialout(), dnsmgr_refresh(), do_idle_thread(), do_monitor(), do_parking_thread(), do_register_auth(), do_waiting(), dumpchan_exec(), dundi_debug_output(), exec(), exit_now(), feature_request_and_dial(), find_command(), find_gtalk(), find_line_by_name(), find_subchannel_and_lock(), find_transcoders(), findmeexec(), flash_exec(), get_also_info(), get_destination(), get_input(), get_rdnis(), get_refer_info(), gtalk_do_reload(), gtalk_handle_dtmf(), h323_ep_hangup(), h323_reload(), handle_alarm_message(), handle_button_template_req_message(), handle_capabilities_res_message(), handle_command_response(), handle_enbloc_call_message(), handle_exec(), handle_frame(), handle_frame_ownerless(), handle_getoption(), handle_init_event(), handle_keypad_button_message(), handle_message(), handle_offhook_message(), handle_onhook_message(), handle_open_receive_channel_ack_message(), handle_register_message(), handle_request(), handle_request_info(), handle_request_invite(), handle_request_message(), handle_request_refer(), handle_request_register(), handle_request_subscribe(), handle_response(), handle_soft_key_event_message(), handle_stimulus_message(), handle_streamfile(), handle_verbose(), iax2_ack_registry(), iax2_bridge(), iax2_exec(), iax2_hangup(), iax2_prov_app(), iax_debug_output(), iax_provision_reload(), init_files_class(), init_logger(), initialize_initreq(), isAnsweringMachine(), ivr_demo_func(), jb_debug_output(), launch_script(), leave_voicemail(), list_route(), listener(), load_config(), load_module(), load_modules(), load_pbx(), load_resource(), load_rpt_vars(), log_events(), lookupcidname_exec(), main(), mdc1200_notify(), mgcp_answer(), mgcp_call(), mgcp_hangup(), mgcp_indicate(), mgcp_new(), mgcp_reload(), mgcp_request(), mgcp_ss(), mgcpsock_read(), misdn_bridge(), mixmonitor_ds_close_fs(), mixmonitor_thread(), moh_alloc(), moh_files_alloc(), moh_files_release(), moh_release(), netconsole(), notify_extenstate_update(), odbc_do_query(), odbc_init(), odbc_load_module(), odbc_log(), odbc_unload_module(), oh323_call(), oss_answer(), oss_call(), oss_digit_end(), oss_hangup(), oss_indicate(), oss_text(), park_call_full(), park_exec(), parkandannounce_exec(), parse(), parse_config(), parse_register_contact(), pbx_builtin_goto(), pbx_builtin_pushvar_helper(), pbx_builtin_setvar_helper(), pbx_builtin_waitexten(), pbx_extension_helper(), phone_check_exception(), phone_exception(), phone_hangup(), play_message_callerid(), play_record_review(), post_cdr(), pri_fixup_principle(), privacy_exec(), process_ast_dsp(), process_dahdi(), process_message(), process_sdp(), process_sdp_a_audio(), process_sdp_a_video(), queue_exec(), quit_handler(), random_exec(), read_exec(), realtime_exec(), receive_ademco_contact_id(), receive_dtmf_digits(), receive_message(), refresh_list(), reg_source_db(), reload(), reload_config(), reload_firmware(), reload_logger(), resend_response(), retrans_pkt(), ring_entry(), rna(), rpt(), run_agi(), run_ras(), say_periodic_announcement(), say_position(), send_cwcidspill(), send_request(), send_response(), send_tone_burst(), session_do(), set_config(), set_destination(), setformat(), settransfercapability_exec(), setup_dahdi(), setup_incoming_call(), sip_new(), sip_reload(), sip_scheddestroy(), sip_sendtext(), sipsock_read(), skinny_answer(), skinny_call(), skinny_hangup(), skinny_hold(), skinny_indicate(), skinny_new(), skinny_request(), skinny_reset_device(), skinny_session(), skinny_ss(), skinny_unhold(), sms_debug(), socket_process(), ss_thread(), start_network_thread(), stun_handle_packet(), stun_process_attr(), timeout_write(), timing_read(), transmit_callinfo(), transmit_connection_del(), transmit_connection_del_w_params(), transmit_displaymessage(), transmit_displaynotify(), transmit_displaypromptstatus(), transmit_modify_request(), transmit_notify_request(), transmit_notify_request_with_callerid(), transmit_register(), transmit_ringer_mode(), try_load_key(), unload_module(), update_registry(), verbose_exec(), vm_authenticate(), vm_execmain(), wait_for_answer(), wait_for_winner(), waitforring_exec(), waitforsilence_exec(), and write_metadata().

00996 {
00997    struct verb *v;
00998    struct ast_dynamic_str *buf;
00999    int res;
01000    va_list ap;
01001 
01002    if (ast_opt_timestamp) {
01003       time_t t;
01004       struct tm tm;
01005       char date[40];
01006       char *datefmt;
01007 
01008       time(&t);
01009       ast_localtime(&t, &tm, NULL);
01010       strftime(date, sizeof(date), dateformat, &tm);
01011       datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1);
01012       sprintf(datefmt, "%c[%s] %s", 127, date, fmt);
01013       fmt = datefmt;
01014    } else {
01015       char *tmp = alloca(strlen(fmt) + 2);
01016       sprintf(tmp, "%c%s", 127, fmt);
01017       fmt = tmp;
01018    }
01019 
01020    if (!(buf = ast_dynamic_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
01021       return;
01022 
01023    va_start(ap, fmt);
01024    res = ast_dynamic_str_thread_set_va(&buf, 0, &verbose_buf, fmt, ap);
01025    va_end(ap);
01026 
01027    if (res == AST_DYNSTR_BUILD_FAILED)
01028       return;
01029    
01030    /* filter out possibly hazardous escape sequences */
01031    term_filter_escapes(buf->str);
01032 
01033    AST_LIST_LOCK(&verbosers);
01034    AST_LIST_TRAVERSE(&verbosers, v, list)
01035       v->verboser(buf->str);
01036    AST_LIST_UNLOCK(&verbosers);
01037 
01038    ast_log(LOG_VERBOSE, "%s", buf->str + 1);

void close_logger ( void   ) 

Provided by logger.c

Definition at line 632 of file logger.c.

References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, eventlog, f, logchannel::list, and qlog.

Referenced by quit_handler().

00634 {
00635    struct logchannel *f;
00636 
00637    AST_LIST_LOCK(&logchannels);
00638 
00639    if (eventlog) {
00640       fclose(eventlog);
00641       eventlog = NULL;
00642    }
00643 
00644    if (qlog) {
00645       fclose(qlog);
00646       qlog = NULL;
00647    }
00648 
00649    AST_LIST_TRAVERSE(&logchannels, f, list) {
00650       if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
00651          fclose(f->fileptr);
00652          f->fileptr = NULL;
00653       }
00654    }
00655 
00656    closelog(); /* syslog */
00657 
00658    AST_LIST_UNLOCK(&logchannels);
00659 
00660    return;

static int handle_logger_reload ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 495 of file logger.c.

References ast_cli(), logger_reload(), and RESULT_FAILURE.

00497 {
00498    int result = logger_reload();
00499    if (result == RESULT_FAILURE)
00500       ast_cli(fd, "Failed to reload the logger\n");
00501    return result;

static int handle_logger_rotate ( int  fd,
int  argc,
char *  argv[] 
) [static]

Definition at line 503 of file logger.c.

References ast_cli(), reload_logger(), RESULT_FAILURE, and RESULT_SUCCESS.

00505 {
00506    if(reload_logger(1)) {
00507       ast_cli(fd, "Failed to reload the logger and rotate log files\n");
00508       return RESULT_FAILURE;
00509    }
00510    return RESULT_SUCCESS;

static int handle_logger_show_channels ( int  fd,
int  argc,
char *  argv[] 
) [static]

CLI command to show logging system configuration.

Definition at line 513 of file logger.c.

References __LOG_DEBUG, __LOG_DTMF, __LOG_ERROR, __LOG_EVENT, __LOG_NOTICE, __LOG_VERBOSE, __LOG_WARNING, ast_cli(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, logchannel::disabled, logchannel::filename, FORMATL, logchannel::list, logchannel::logmask, LOGTYPE_CONSOLE, LOGTYPE_SYSLOG, RESULT_SUCCESS, and logchannel::type.

00515 {
00516 #define FORMATL   "%-35.35s %-8.8s %-9.9s "
00517    struct logchannel *chan;
00518 
00519    ast_cli(fd,FORMATL, "Channel", "Type", "Status");
00520    ast_cli(fd, "Configuration\n");
00521    ast_cli(fd,FORMATL, "-------", "----", "------");
00522    ast_cli(fd, "-------------\n");
00523    AST_LIST_LOCK(&logchannels);
00524    AST_LIST_TRAVERSE(&logchannels, chan, list) {
00525       ast_cli(fd, FORMATL, chan->filename, chan->type==LOGTYPE_CONSOLE ? "Console" : (chan->type==LOGTYPE_SYSLOG ? "Syslog" : "File"),
00526          chan->disabled ? "Disabled" : "Enabled");
00527       ast_cli(fd, " - ");
00528       if (chan->logmask & (1 << __LOG_DEBUG)) 
00529          ast_cli(fd, "Debug ");
00530       if (chan->logmask & (1 << __LOG_DTMF)) 
00531          ast_cli(fd, "DTMF ");
00532       if (chan->logmask & (1 << __LOG_VERBOSE)) 
00533          ast_cli(fd, "Verbose ");
00534       if (chan->logmask & (1 << __LOG_WARNING)) 
00535          ast_cli(fd, "Warning ");
00536       if (chan->logmask & (1 << __LOG_NOTICE)) 
00537          ast_cli(fd, "Notice ");
00538       if (chan->logmask & (1 << __LOG_ERROR)) 
00539          ast_cli(fd, "Error ");
00540       if (chan->logmask & (1 << __LOG_EVENT)) 
00541          ast_cli(fd, "Event ");
00542       ast_cli(fd, "\n");
00543    }
00544    AST_LIST_UNLOCK(&logchannels);
00545    ast_cli(fd, "\n");
00546       
00547    return RESULT_SUCCESS;

int init_logger ( void   ) 

Provided by logger.c

Definition at line 593 of file logger.c.

References ast_cli_register_multiple(), ast_config_AST_LOG_DIR, ast_log(), ast_queue_log(), ast_verbose(), cli_logger, errno, EVENTLOG, eventlog, init_logger_chain(), LOG_ERROR, LOG_EVENT, logfiles, option_verbose, qlog, and QUEUELOG.

Referenced by main().

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

static void init_logger_chain ( void   )  [static]

Definition at line 284 of file logger.c.

References ast_calloc, ast_config_destroy(), ast_config_load(), ast_copy_string(), AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log(), ast_true(), ast_variable_browse(), ast_variable_retrieve(), errno, free, logchannel::list, LOG_WARNING, logfiles, LOGTYPE_CONSOLE, make_logchannel(), s, and var.

Referenced by init_logger(), and reload_logger().

00286 {
00287    struct logchannel *chan;
00288    struct ast_config *cfg;
00289    struct ast_variable *var;
00290    const char *s;
00291 
00292    /* delete our list of log channels */
00293    AST_LIST_LOCK(&logchannels);
00294    while ((chan = AST_LIST_REMOVE_HEAD(&logchannels, list)))
00295       free(chan);
00296    AST_LIST_UNLOCK(&logchannels);
00297    
00298    global_logmask = 0;
00299    errno = 0;
00300    /* close syslog */
00301    closelog();
00302    
00303    cfg = ast_config_load("logger.conf");
00304    
00305    /* If no config file, we're fine, set default options. */
00306    if (!cfg) {
00307       if (errno)
00308          fprintf(stderr, "Unable to open logger.conf: %s; default settings will be used.\n", strerror(errno));
00309       else
00310          fprintf(stderr, "Errors detected in logger.conf: see above; default settings will be used.\n");
00311       if (!(chan = ast_calloc(1, sizeof(*chan))))
00312          return;
00313       chan->type = LOGTYPE_CONSOLE;
00314       chan->logmask = 28; /*warning,notice,error */
00315       AST_LIST_LOCK(&logchannels);
00316       AST_LIST_INSERT_HEAD(&logchannels, chan, list);
00317       AST_LIST_UNLOCK(&logchannels);
00318       global_logmask |= chan->logmask;
00319       return;
00320    }
00321    
00322    if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
00323       if (ast_true(s)) {
00324          if (gethostname(hostname, sizeof(hostname) - 1)) {
00325             ast_copy_string(hostname, "unknown", sizeof(hostname));
00326             ast_log(LOG_WARNING, "What box has no hostname???\n");
00327          }
00328       } else
00329          hostname[0] = '\0';
00330    } else
00331       hostname[0] = '\0';
00332    if ((s = ast_variable_retrieve(cfg, "general", "dateformat")))
00333       ast_copy_string(dateformat, s, sizeof(dateformat));
00334    else
00335       ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat));
00336    if ((s = ast_variable_retrieve(cfg, "general", "queue_log")))
00337       logfiles.queue_log = ast_true(s);
00338    if ((s = ast_variable_retrieve(cfg, "general", "event_log")))
00339       logfiles.event_log = ast_true(s);
00340 
00341    AST_LIST_LOCK(&logchannels);
00342    var = ast_variable_browse(cfg, "logfiles");
00343    for (; var; var = var->next) {
00344       if (!(chan = make_logchannel(var->name, var->value, var->lineno)))
00345          continue;
00346       AST_LIST_INSERT_HEAD(&logchannels, chan, list);
00347       global_logmask |= chan->logmask;
00348    }
00349    AST_LIST_UNLOCK(&logchannels);
00350 
00351    ast_config_destroy(cfg);

static void log_buf_init ( void   )  [static]

Definition at line 143 of file logger.c.

00148 {

int logger_reload ( void   ) 

Reload logger without rotating log files.

Definition at line 488 of file logger.c.

References reload_logger(), RESULT_FAILURE, and RESULT_SUCCESS.

Referenced by handle_logger_reload().

00490 {
00491    if(reload_logger(0))
00492       return RESULT_FAILURE;
00493    return RESULT_SUCCESS;

static int make_components ( char *  s,
int  lineno 
) [static]

Definition at line 146 of file logger.c.

References __LOG_DEBUG, __LOG_DTMF, __LOG_ERROR, __LOG_EVENT, __LOG_NOTICE, __LOG_VERBOSE, __LOG_WARNING, ast_strip(), and ast_strlen_zero().

Referenced by make_logchannel().

00148 {
00149    char *w;
00150    int res = 0;
00151    char *stringp = s;
00152 
00153    while ((w = strsep(&stringp, ","))) {
00154       w = ast_strip(w);
00155       if (ast_strlen_zero(w)) {
00156          continue;
00157       }
00158       if (!strcasecmp(w, "error")) 
00159          res |= (1 << __LOG_ERROR);
00160       else if (!strcasecmp(w, "warning"))
00161          res |= (1 << __LOG_WARNING);
00162       else if (!strcasecmp(w, "notice"))
00163          res |= (1 << __LOG_NOTICE);
00164       else if (!strcasecmp(w, "event"))
00165          res |= (1 << __LOG_EVENT);
00166       else if (!strcasecmp(w, "debug"))
00167          res |= (1 << __LOG_DEBUG);
00168       else if (!strcasecmp(w, "verbose"))
00169          res |= (1 << __LOG_VERBOSE);
00170       else if (!strcasecmp(w, "dtmf"))
00171          res |= (1 << __LOG_DTMF);
00172       else {
00173          fprintf(stderr, "Logfile Warning: Unknown keyword '%s' at line %d of logger.conf\n", w, lineno);
00174       }
00175    }
00176 
00177    return res;

static struct logchannel* make_logchannel ( char *  channel,
char *  components,
int  lineno 
) [static]

Definition at line 179 of file logger.c.

References ast_calloc, ast_config_AST_LOG_DIR, ast_strlen_zero(), errno, logchannel::facility, free, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, and make_components().

Referenced by init_logger_chain().

00181 {
00182    struct logchannel *chan;
00183    char *facility;
00184 #ifndef SOLARIS
00185    CODE *cptr;
00186 #endif
00187 
00188    if (ast_strlen_zero(channel) || !(chan = ast_calloc(1, sizeof(*chan))))
00189       return NULL;
00190 
00191    if (!strcasecmp(channel, "console")) {
00192       chan->type = LOGTYPE_CONSOLE;
00193    } else if (!strncasecmp(channel, "syslog", 6)) {
00194       /*
00195       * syntax is:
00196       *  syslog.facility => level,level,level
00197       */
00198       facility = strchr(channel, '.');
00199       if(!facility++ || !facility) {
00200          facility = "local0";
00201       }
00202 
00203 #ifndef SOLARIS
00204       /*
00205       * Walk through the list of facilitynames (defined in sys/syslog.h)
00206       * to see if we can find the one we have been given
00207       */
00208       chan->facility = -1;
00209       cptr = facilitynames;
00210       while (cptr->c_name) {
00211          if (!strcasecmp(facility, cptr->c_name)) {
00212             chan->facility = cptr->c_val;
00213             break;
00214          }
00215          cptr++;
00216       }
00217 #else
00218       chan->facility = -1;
00219       if (!strcasecmp(facility, "kern")) 
00220          chan->facility = LOG_KERN;
00221       else if (!strcasecmp(facility, "USER")) 
00222          chan->facility = LOG_USER;
00223       else if (!strcasecmp(facility, "MAIL")) 
00224          chan->facility = LOG_MAIL;
00225       else if (!strcasecmp(facility, "DAEMON")) 
00226          chan->facility = LOG_DAEMON;
00227       else if (!strcasecmp(facility, "AUTH")) 
00228          chan->facility = LOG_AUTH;
00229       else if (!strcasecmp(facility, "SYSLOG")) 
00230          chan->facility = LOG_SYSLOG;
00231       else if (!strcasecmp(facility, "LPR")) 
00232          chan->facility = LOG_LPR;
00233       else if (!strcasecmp(facility, "NEWS")) 
00234          chan->facility = LOG_NEWS;
00235       else if (!strcasecmp(facility, "UUCP")) 
00236          chan->facility = LOG_UUCP;
00237       else if (!strcasecmp(facility, "CRON")) 
00238          chan->facility = LOG_CRON;
00239       else if (!strcasecmp(facility, "LOCAL0")) 
00240          chan->facility = LOG_LOCAL0;
00241       else if (!strcasecmp(facility, "LOCAL1")) 
00242          chan->facility = LOG_LOCAL1;
00243       else if (!strcasecmp(facility, "LOCAL2")) 
00244          chan->facility = LOG_LOCAL2;
00245       else if (!strcasecmp(facility, "LOCAL3")) 
00246          chan->facility = LOG_LOCAL3;
00247       else if (!strcasecmp(facility, "LOCAL4")) 
00248          chan->facility = LOG_LOCAL4;
00249       else if (!strcasecmp(facility, "LOCAL5")) 
00250          chan->facility = LOG_LOCAL5;
00251       else if (!strcasecmp(facility, "LOCAL6")) 
00252          chan->facility = LOG_LOCAL6;
00253       else if (!strcasecmp(facility, "LOCAL7")) 
00254          chan->facility = LOG_LOCAL7;
00255 #endif /* Solaris */
00256 
00257       if (0 > chan->facility) {
00258          fprintf(stderr, "Logger Warning: bad syslog facility in logger.conf\n");
00259          free(chan);
00260          return NULL;
00261       }
00262 
00263       chan->type = LOGTYPE_SYSLOG;
00264       snprintf(chan->filename, sizeof(chan->filename), "%s", channel);
00265       openlog("asterisk", LOG_PID, chan->facility);
00266    } else {
00267       if (!ast_strlen_zero(hostname)) {
00268          snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",
00269              channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel, hostname);
00270       } else {
00271          snprintf(chan->filename, sizeof(chan->filename), "%s/%s",
00272              channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel);
00273       }
00274       chan->fileptr = fopen(chan->filename, "a");
00275       if (!chan->fileptr) {
00276          /* Can't log here, since we're called with a lock */
00277          fprintf(stderr, "Logger Warning: Unable to open log file '%s': %s\n", chan->filename, strerror(errno));
00278       } 
00279       chan->type = LOGTYPE_FILE;
00280    }
00281    chan->logmask = make_components(components, lineno);
00282    return chan;

int reload_logger ( int   ) 

Provided by logger.c

Definition at line 368 of file logger.c.

References ast_config_AST_LOG_DIR, ast_copy_string(), AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log(), ast_queue_log(), ast_verbose(), errno, EVENT_FLAG_SYSTEM, eventlog, EVENTLOG, f, init_logger_chain(), logchannel::list, LOG_ERROR, LOG_EVENT, logfiles, manager_event(), option_verbose, qlog, and QUEUELOG.

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

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

static void verbose_buf_init ( void   )  [static]

Definition at line 140 of file logger.c.

00148 {


Variable Documentation

struct ast_cli_entry cli_logger[] [static]

Definition at line 568 of file logger.c.

Referenced by init_logger().

int colors[] [static]

Definition at line 130 of file logger.c.

Referenced by ast_log().

char dateformat[256] = "%b %e %T" [static]

Definition at line 87 of file logger.c.

unsigned int event_log

Definition at line 94 of file logger.c.

FILE* eventlog [static]

Definition at line 117 of file logger.c.

Referenced by ast_log(), close_logger(), init_logger(), and reload_logger().

int filesize_reload_needed [static]

Definition at line 89 of file logger.c.

int global_logmask = -1 [static]

Definition at line 90 of file logger.c.

struct sigaction handle_SIGXFSZ [static]

Initial value:

 {
   .sa_handler = _handle_SIGXFSZ,
   .sa_flags = SA_RESTART,
}

Definition at line 588 of file logger.c.

char hostname[MAXHOSTNAMELEN] [static]

Definition at line 97 of file logger.c.

Referenced by ast_remotecontrol(), cli_prompt(), iax2_register(), main(), netconsole(), set_destination(), and sip_register().

char* levels[] [static]

Definition at line 120 of file logger.c.

Referenced by ast_log(), and ast_log_vsyslog().

struct ast_threadstorage log_buf = { .once = PTHREAD_ONCE_INIT , .key_init = log_buf_init , } [static]

Definition at line 143 of file logger.c.

Referenced by ast_log().

struct { ... } logfiles [static]

Referenced by ast_log(), init_logger(), init_logger_chain(), and reload_logger().

char logger_reload_help[] [static]

Initial value:

"Usage: logger reload\n"
"       Reloads the logger subsystem state.  Use after restarting syslogd(8) if you are using syslog logging.\n"

Definition at line 556 of file logger.c.

char logger_rotate_help[] [static]

Initial value:

"Usage: logger rotate\n"
"       Rotates and Reopens the log files.\n"

Definition at line 560 of file logger.c.

char logger_show_channels_help[] [static]

Initial value:

"Usage: logger show channels\n"
"       List configured logger channels.\n"

Definition at line 564 of file logger.c.

FILE* qlog [static]

Definition at line 118 of file logger.c.

Referenced by ast_queue_log(), close_logger(), init_logger(), and reload_logger().

unsigned int queue_log

Definition at line 93 of file logger.c.

int syslog_level_map[] [static]

Definition at line 54 of file logger.c.

struct ast_threadstorage verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = verbose_buf_init , } [static]

Definition at line 140 of file logger.c.

Referenced by ast_verbose().


Generated on Sat Aug 6 00:39:59 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7