Wed Aug 18 22:34:26 2010

Asterisk developer's documentation


logger.c File Reference

Asterisk Logger. More...

#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/paths.h"
#include <signal.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <execinfo.h>
#include <syslog.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"

Go to the source code of this file.

Data Structures

struct  logchannel
struct  logchannels
struct  logmsg
struct  logmsgs
struct  verb
struct  verbosers

Defines

#define _ASTERISK_LOGGER_H
#define FORMATL   "%-35.35s %-8.8s %-9.9s "
#define GETTID()   getpid()
#define LOG_BUF_INIT_SIZE   256
#define MAX_BACKTRACE_FRAMES   20
#define SYSLOG_NAMES
#define SYSLOG_NLEVELS   sizeof(syslog_level_map) / sizeof(int)
#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)
void ast_backtrace (void)
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,...)
 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.
static void ast_log_vsyslog (int level, const char *file, int line, const char *function, char *str, long pid)
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.
static int handle_SIGXFSZ (int sig)
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_print_verbose (struct logmsg *logmsg)
 Print a verbose message to the verbosers.
int logger_reload (void)
 Reload logger without rotating log files.
static void * logger_thread (void *data)
 Actual logging thread.
static int make_components (const char *s, int lineno)
static struct logchannelmake_logchannel (const char *channel, const char *components, int lineno)
static int reload_logger (int rotate)
static int rotate_file (const char *filename)

Variables

static struct ast_cli_entry cli_logger []
static int close_logger_thread = 0
static int colors []
 Colors used in the console for logging.
static char dateformat [256] = "%b %e %T"
static FILE * eventlog
static char exec_after_rotate [256] = ""
static int filesize_reload_needed
static int global_logmask = -1
static char hostname [MAXHOSTNAMELEN]
static char * levels []
 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   event_log:1
   unsigned int   queue_log:1
logfiles
static pthread_t logthread = AST_PTHREADT_NULL
static FILE * qlog
static char queue_log_name [256] = QUEUELOG
static int syslog_level_map []
static struct ast_threadstorage verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_verbose_buf , .custom_init = NULL , }


Detailed Description

Asterisk Logger.

Logging routines

Author:
Mark Spencer <markster@digium.com>

Definition in file logger.c.


Define Documentation

#define _ASTERISK_LOGGER_H

Definition at line 33 of file logger.c.

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

Referenced by handle_logger_show_channels().

 
#define GETTID (  )     getpid()

Definition at line 85 of file logger.c.

Referenced by ast_log().

#define LOG_BUF_INIT_SIZE   256

Definition at line 178 of file logger.c.

Referenced by ast_log().

#define MAX_BACKTRACE_FRAMES   20

Definition at line 46 of file logger.c.

#define SYSLOG_NAMES

Definition at line 49 of file logger.c.

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

Definition at line 63 of file logger.c.

Referenced by ast_log_vsyslog().

#define VERBOSE_BUF_INIT_SIZE   256

Definition at line 175 of file logger.c.

Referenced by __ast_verbose_ap().


Enumeration Type Documentation

enum logmsgtypes

Enumerator:
LOGMSG_NORMAL 
LOGMSG_VERBOSE 

Definition at line 127 of file logger.c.

00128                  {
00129    LOGMSG_NORMAL = 0,
00130    LOGMSG_VERBOSE,

enum logtypes

Enumerator:
LOGTYPE_SYSLOG 
LOGTYPE_FILE 
LOGTYPE_CONSOLE 

Definition at line 109 of file logger.c.

00110               {
00111    LOGTYPE_SYSLOG,
00112    LOGTYPE_FILE,
00113    LOGTYPE_CONSOLE,

enum rotatestrategy

Enumerator:
SEQUENTIAL 
ROTATE 
TIMESTAMP 

Definition at line 96 of file logger.c.

00097                     {
00098    SEQUENTIAL = 1 << 0,     /* Original method - create a new file, in order */
00099    ROTATE = 1 << 1,         /* Rotate all files, such that the oldest file has the highest suffix */
00100    TIMESTAMP = 1 << 2,      /* Append the epoch timestamp onto the end of the archived file */


Function Documentation

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 1290 of file logger.c.

References __ast_verbose_ap().

01292 {
01293    va_list ap;
01294    va_start(ap, fmt);
01295    __ast_verbose_ap(file, line, func, fmt, ap);
01296    va_end(ap);

void __ast_verbose_ap ( const char *  file,
int  line,
const char *  func,
const char *  fmt,
va_list  ap 
)

Definition at line 1234 of file logger.c.

References __LOG_VERBOSE, ast_calloc, ast_cond_signal(), AST_DYNSTR_BUILD_FAILED, ast_free, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_localtime(), ast_log(), ast_opt_timestamp, AST_PTHREADT_NULL, ast_str_set_va(), ast_str_thread_get(), ast_strftime(), ast_tvnow(), buf, logchannel::list, logcond, logger_print_verbose(), LOGMSG_VERBOSE, logthread, verbose_buf, and VERBOSE_BUF_INIT_SIZE.

Referenced by __ast_verbose(), and ast_verbose().

01236 {
01237    struct logmsg *logmsg = NULL;
01238    struct ast_str *buf = NULL;
01239    int res = 0;
01240 
01241    if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
01242       return;
01243 
01244    if (ast_opt_timestamp) {
01245       struct timeval now;
01246       struct ast_tm tm;
01247       char date[40];
01248       char *datefmt;
01249 
01250       now = ast_tvnow();
01251       ast_localtime(&now, &tm, NULL);
01252       ast_strftime(date, sizeof(date), dateformat, &tm);
01253       datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1);
01254       sprintf(datefmt, "%c[%s] %s", 127, date, fmt);
01255       fmt = datefmt;
01256    } else {
01257       char *tmp = alloca(strlen(fmt) + 2);
01258       sprintf(tmp, "%c%s", 127, fmt);
01259       fmt = tmp;
01260    }
01261 
01262    /* Build string */
01263    res = ast_str_set_va(&buf, 0, fmt, ap);
01264 
01265    /* If the build failed then we can drop this allocated message */
01266    if (res == AST_DYNSTR_BUILD_FAILED)
01267       return;
01268 
01269    if (!(logmsg = ast_calloc(1, sizeof(*logmsg) + res + 1)))
01270       return;
01271 
01272    strcpy(logmsg->str, buf->str);
01273 
01274    ast_log(__LOG_VERBOSE, file, line, func, "%s", logmsg->str + 1);
01275 
01276    /* Set type */
01277    logmsg->type = LOGMSG_VERBOSE;
01278    
01279    /* Add to the list and poke the thread if possible */
01280    if (logthread != AST_PTHREADT_NULL) {
01281       AST_LIST_LOCK(&logmsgs);
01282       AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list);
01283       ast_cond_signal(&logcond);
01284       AST_LIST_UNLOCK(&logmsgs);
01285    } else {
01286       logger_print_verbose(logmsg);
01287       ast_free(logmsg);
01288    }

static void __init_log_buf ( void   )  [static]

Definition at line 177 of file logger.c.

00182 {

static void __init_verbose_buf ( void   )  [static]

Definition at line 174 of file logger.c.

00182 {

void ast_backtrace ( void   ) 

Definition at line 1207 of file logger.c.

References ast_bt_create(), ast_bt_destroy(), ast_debug, ast_log(), free, and LOG_WARNING.

01209 {
01210 #ifdef HAVE_BKTR
01211    struct ast_bt *bt;
01212    int i = 0;
01213    char **strings;
01214 
01215    if (!(bt = ast_bt_create())) {
01216       ast_log(LOG_WARNING, "Unable to allocate space for backtrace structure\n");
01217       return;
01218    }
01219 
01220    if ((strings = backtrace_symbols(bt->addresses, bt->num_frames))) {
01221       ast_debug(1, "Got %d backtrace record%c\n", bt->num_frames, bt->num_frames != 1 ? 's' : ' ');
01222       for (i = 0; i < bt->num_frames; i++) {
01223          ast_log(LOG_DEBUG, "#%d: [%p] %s\n", i, bt->addresses[i], strings[i]);
01224       }
01225       free(strings);
01226    } else {
01227       ast_debug(1, "Could not allocate memory for backtrace\n");
01228    }
01229    ast_bt_destroy(bt);
01230 #else
01231    ast_log(LOG_WARNING, "Must run configure with '--with-execinfo' for stack backtraces.\n");
01232 #endif

struct ast_bt* ast_bt_create ( void   ) 

Definition at line 1174 of file logger.c.

References ast_bt_get_addresses(), ast_calloc, ast_log(), and LOG_ERROR.

Referenced by ast_backtrace().

01176 {
01177    struct ast_bt *bt = ast_calloc(1, sizeof(*bt));
01178    if (!bt) {
01179       ast_log(LOG_ERROR, "Unable to allocate memory for backtrace structure!\n");
01180       return NULL;
01181    }
01182 
01183    bt->alloced = 1;
01184 
01185    ast_bt_get_addresses(bt);
01186 
01187    return bt;

void* ast_bt_destroy ( struct ast_bt *  bt  ) 

Definition at line 1196 of file logger.c.

References ast_free.

Referenced by ast_backtrace().

01198 {
01199    if (bt->alloced) {
01200       ast_free(bt);
01201    }
01202 
01203    return NULL;

int ast_bt_get_addresses ( struct ast_bt *  bt  ) 

Definition at line 1189 of file logger.c.

Referenced by ast_bt_create().

01191 {
01192    bt->num_frames = backtrace(bt->addresses, AST_MAX_BT_FRAMES);
01193 
01194    return 0;

void ast_child_verbose ( int  level,
const char *  fmt,
  ... 
)

Definition at line 411 of file logger.c.

References ast_free, ast_malloc, msg, and option_verbose.

Referenced by launch_script().

00413 {
00414    char *msg = NULL, *emsg = NULL, *sptr, *eptr;
00415    va_list ap, aq;
00416    int size;
00417 
00418    /* Don't bother, if the level isn't that high */
00419    if (option_verbose < level) {
00420       return;
00421    }
00422 
00423    va_start(ap, fmt);
00424    va_copy(aq, ap);
00425    if ((size = vsnprintf(msg, 0, fmt, ap)) < 0) {
00426       va_end(ap);
00427       va_end(aq);
00428       return;
00429    }
00430    va_end(ap);
00431 
00432    if (!(msg = ast_malloc(size + 1))) {
00433       va_end(aq);
00434       return;
00435    }
00436 
00437    vsnprintf(msg, size + 1, fmt, aq);
00438    va_end(aq);
00439 
00440    if (!(emsg = ast_malloc(size * 2 + 1))) {
00441       ast_free(msg);
00442       return;
00443    }
00444 
00445    for (sptr = msg, eptr = emsg; ; sptr++) {
00446       if (*sptr == '"') {
00447          *eptr++ = '\\';
00448       }
00449       *eptr++ = *sptr;
00450       if (*sptr == '\0') {
00451          break;
00452       }
00453    }
00454    ast_free(msg);
00455 
00456    fprintf(stdout, "verbose \"%s\" %d\n", emsg, level);
00457    fflush(stdout);
00458    ast_free(emsg);

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

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.

Parameters:
level Type of log event
file Will be provided by the AST_LOG_* macro
line Will be provided by the AST_LOG_* macro
function Will be provided by the AST_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 1085 of file logger.c.

References __LOG_DEBUG, __LOG_VERBOSE, ast_calloc, ast_cond_signal(), ast_copy_string(), 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_set_va(), ast_str_thread_get(), ast_strftime(), ast_tvnow(), buf, GETTID, logchannel::list, log_buf, LOG_BUF_INIT_SIZE, logcond, logger_print_normal(), LOGMSG_NORMAL, logthread, option_debug, option_verbose, and term_filter_escapes().

Referenced by __adsi_transmit_messages(), __agent_start_monitoring(), __ao2_callback(), __ao2_ref(), __ast_answer(), __ast_channel_alloc_ap(), __ast_check_signature(), __ast_check_signature_bin(), __ast_cli_register(), __ast_cli_unregister(), __ast_custom_function_register(), __ast_decrypt_bin(), __ast_encrypt_bin(), __ast_format_register(), __ast_pbx_run(), __ast_play_and_record(), __ast_queue_frame(), __ast_read(), __ast_register_translator(), __ast_request_and_dial(), __ast_rtp_reload(), __ast_sign_bin(), __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_destroy(), __sip_pretend_ack(), __sip_reliable_xmit(), __sip_xmit(), __transmit_response(), __unload_module(), _ast_adsi_get_cpeid(), _ast_adsi_get_cpeinfo(), _ast_adsi_load_session(), _ast_adsi_transmit_message_full(), _dsp_init(), _enum_array_map(), _extension_match_core(), _get_mohbyname(), _macro_exec(), _moh_register(), _sip_tcp_helper_thread(), _while_exec(), accept_thread(), access_counter_file(), acf_channel_read(), acf_curl_exec(), acf_cut_exec(), acf_iaxvar_write(), acf_if(), acf_isexten_exec(), acf_jabberstatus_read(), acf_mailbox_exists(), acf_meetme_info(), acf_odbc_read(), acf_odbc_write(), acf_sort_exec(), acf_strftime(), acf_strptime(), ack_trans(), action_bridge(), action_command(), action_getvar(), action_login(), add_agent(), add_agi_cmd(), add_calltoken_ignore(), add_cfg_entry(), add_codec_to_answer(), add_email_attachment(), add_exten_to_pattern_tree(), add_features_datastores(), add_header(), add_in_calls(), add_line(), add_out_calls(), add_realm_authentication(), add_redirect(), add_rt_multi_cfg_entry(), add_sdp(), add_sip_domain(), add_to_agi(), add_user_extension(), admin_exec(), adsi_begin(), adsi_careful_send(), adsi_process(), adsi_prog(), advanced_options(), agent_answer(), agent_call(), agent_fixup(), agent_get_base_channel(), agent_hangup(), 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_dinfo_handler(), aji_ditems_handler(), aji_find_version(), aji_handle_presence(), aji_handle_subscribe(), aji_initialize(), aji_load_config(), aji_pruneregister(), aji_recv(), aji_recv_loop(), aji_register_approve_handler(), aji_register_query_handler(), aji_reload(), aji_send_exec(), 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(), announce_thread(), answer_call(), anti_injection(), app_exec(), apply_general_options(), apply_option(), apply_outgoing(), aqm_exec(), ast_add_extension2_lockopt(), ast_agi_register(), ast_agi_send(), ast_agi_unregister(), ast_aji_create_chat(), ast_aji_invite_chat(), ast_aji_join_chat(), ast_aji_send_chat(), ast_alaw_init(), ast_app_dtget(), ast_append_ha(), ast_async_goto(), ast_audiohook_write_frame(), ast_autoservice_start(), ast_backtrace(), ast_best_codec(), ast_bridge_call(), ast_bridge_call_thread(), ast_bt_create(), ast_call_forward(), ast_careful_fwrite(), ast_carefulwrite(), 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_channel_audiohook_count_by_source(), ast_channel_audiohook_count_by_source_running(), ast_channel_bridge(), ast_channel_free(), 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_timing(), ast_codec_get_len(), ast_codec_get_samples(), ast_config_engine_register(), ast_config_internal_load(), ast_context_find_or_create(), ast_context_remove_extension_callerid2(), ast_context_verify_includes(), ast_db_get(), ast_db_gettree(), ast_db_put(), ast_device_state_engine_init(), ast_do_masquerade(), ast_dsp_busydetect(), 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_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_feature_request_and_dial(), ast_filehelper(), ast_find_ourip(), ast_format_str_reduce(), ast_format_unregister(), ast_func_read(), ast_func_write(), ast_get_encoded_char(), ast_get_enum(), ast_get_group(), ast_get_indication_zone(), ast_get_ip_or_srv(), ast_hangup(), ast_heap_create(), ast_http_uri_link(), 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_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_netsock_set_qos(), ast_odbc_direct_execute(), ast_odbc_find_table(), 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_park_call_full(), ast_parse_allow_disallow(), 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_detached_stack(), ast_pthread_create_stack(), ast_read_image(), ast_read_textfile(), ast_readaudio_callback(), ast_readconfig(), ast_readfile(), ast_readvideo_callback(), ast_record_review(), 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_bridge(), ast_rtp_codec_setpref(), ast_rtp_early_bridge(), ast_rtp_get_qosvalue(), ast_rtp_make_compatible(), ast_rtp_new_with_bindaddr(), ast_rtp_proto_register(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_continuation(), ast_rtp_senddigit_end(), 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_zh(), ast_say_enumeration_full_he(), ast_say_number_full_pt(), ast_say_number_full_zh(), ast_sched_del(), ast_sched_runq(), ast_search_dns(), ast_set_priority(), ast_sip_ouraddrfor(), ast_slinfactory_feed(), ast_smoother_read(), ast_speech_register(), ast_stopstream(), 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_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_unregister_indication_country(), 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_exec(), authenticate(), authenticate_reply(), authenticate_verify(), autoservice_run(), available(), background_detect_exec(), base64_decode(), base64_encode(), base_encode(), birdbath(), blr_ebl(), blr_txt(), board_setup(), bridge_exec(), bridge_native_loop(), build_alias(), build_callno_limits(), build_channels(), build_conf(), build_device(), build_filename(), build_gateway(), build_mapping(), build_parkinglot(), build_peer(), build_reply_digest(), build_route(), build_rpid(), 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(), callerid_feed(), callerid_feed_jp(), callerid_get_dtmf(), callerid_read(), callerid_write(), callerpres_write(), canary_thread(), canmatch(), careful_write(), cb_events(), cb_extensionstate(), cdr_handler(), cdr_merge_vars(), chan_misdn_log(), chan_ringing(), chanavail_exec(), chandup(), channel_admin_exec(), channel_revert(), channel_spy(), channel_steer(), channel_to_session(), chanspy_exec(), check_access(), check_auth(), check_compat(), check_for_conference(), check_freq_ic706(), check_header(), check_key(), check_password(), check_post(), check_rtp_timeout(), check_srcaddr(), check_tx_freq(), check_user_full(), check_vars(), check_via(), cleanup_connection(), clear_caller(), clearcbone(), cleardisplay(), clearflag(), cleartimer(), close_call(), close_client(), close_mailbox(), collect_function_digits(), 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(), config_curl(), config_function_read(), config_handler(), config_ldap(), config_module(), config_odbc(), config_pgsql(), config_text_file_load(), connect_link(), connection_made(), console_autoanswer(), console_cmd(), console_indicate(), console_request(), console_video_start(), context_merge(), controlplayback_exec(), convertcap(), copy(), copy_header(), copy_message(), copy_rules(), copy_via_headers(), count_exec(), create_addr(), create_dirpath(), create_jb(), create_match_char_tree(), create_queue_member(), create_video_frame(), create_vmaccount(), crypto_load(), csv_log(), csv_quote(), custom_log(), custom_prepare(), cut_internal(), dahdi_answer(), 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_get_index(), dahdi_handle_dtmfup(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_link(), dahdi_new(), dahdi_open(), dahdi_pri_error(), dahdi_pri_message(), dahdi_read(), dahdi_request(), dahdi_restart(), dahdi_ring_phone(), dahdi_sendtext(), dahdi_set_hook(), dahdi_setoption(), dahdi_show_channel(), dahdi_test_timer(), dahdi_timer_set_rate(), dahdi_train_ec(), dahdi_translate(), dahdi_write(), dahdi_write_frame(), dahdiras_exec(), dbinit(), deadagi_exec(), dec_init(), del_exec(), destroy_curl(), destroy_odbc(), destroy_pgsql(), destroy_session(), destroy_trans(), device_state_cb(), devstate_cache_cb(), devstate_change_collector_cb(), devstate_write(), dial_exec_full(), dialgroup_read(), dialgroup_write(), dialog_ref(), dictate_exec(), digitcollect(), digitdirect(), directory_exec(), disa_exec(), disable_jack_hook(), diskavail(), dispatch_thread_handler(), display_last_error(), dns_parse_answer(), dnsmgr_init(), dnsmgr_refresh(), do_autokill(), do_directory(), do_dtmf_local(), do_forward(), do_idle_thread(), do_monitor(), do_register(), do_reload(), do_say(), do_scheduler(), do_timelimit(), do_waiting(), donodelog(), dump_agents(), 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_query(), dundi_query_read(), dundi_result_read(), dundi_rexmit(), dundi_send(), dundi_xmit(), dundifunc_read(), eagi_exec(), ebl_callback(), enable_jack_hook(), encode_open_type(), enum_callback(), enum_query_read(), enum_result_read(), eventhandler(), exec(), exec_exec(), execif_exec(), exists(), ext_cmp1(), extenspy_exec(), external_rtp_create(), extstate_read(), fax_generator_generate(), fbuf_append(), feature_exec_app(), festival_exec(), ffmpeg_decode(), ffmpeg_encode(), file_read(), filter(), find_account(), find_cache(), find_call_locked(), find_conf(), find_conf_realtime(), find_desc(), find_desc_usb(), find_line_by_instance(), find_matching_endwhile(), find_or_create(), find_parkinglot(), 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_transcoders(), findmeexec(), finish_bookmark(), flash_exec(), flush_telem(), fn_wrapper(), forkcdr_exec(), forward_message(), framein(), func_args(), func_channel_read(), func_channel_write(), 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_ilink(), function_realtime_read(), function_realtime_readdestroy(), function_realtime_store(), function_realtime_write(), function_remote(), function_sipchaninfo_read(), function_sippeer(), function_txtcidname(), g723_len(), g723_read(), g723_write(), g726_read(), g726_write(), g729_read(), g729_write(), generic_execute(), generic_prepare(), get_agi_cmd(), get_alarms(), get_also_info(), get_button_template(), get_canmatch_exten(), get_destination(), get_in_brackets(), 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_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_sendhtml(), gtalk_show_channels(), 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_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_playtones(), 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_register(), handle_request_subscribe(), handle_response(), handle_response_invite(), handle_response_notify(), handle_response_peerpoke(), handle_response_refer(), handle_response_register(), handle_soft_key_event_message(), handle_stimulus_message(), handle_t38_options(), handle_tcptls_connection(), handle_transfer_button(), handle_updates(), HandleCallIncoming(), HandleCallOutgoing(), hidthread(), hint_read(), httpd_helper_thread(), iax2_ack_registry(), 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(), ices_exec(), icesencode(), iconv_read(), iftime(), ilbc_read(), ilbc_write(), ilbctolin_framein(), import_ch(), in_band_indication(), increase_call_count(), ind_load_module(), init_acf_query(), init_app_class(), init_jack_data(), init_logger(), init_req(), init_resp(), init_timing_thread(), insert_penaltychange(), inspect_module(), 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_show_channels(), jingle_write(), jpeg_read_image(), jpeg_write_image(), key_call(), Keyfavorite(), keypad_cfg_read(), keypad_pick_up(), keypad_setup(), keypad_toggle(), kickptt(), kp_match_area(), launch_asyncagi(), launch_monitor_thread(), launch_netscript(), launch_script(), launch_service(), ldap_loadentry(), ldap_reconnect(), leave_voicemail(), linear_alloc(), linear_generator(), linear_release(), linkcount(), lintogsm_framein(), lintolpc10_framein(), lintoulaw(), listener(), load_column_config(), load_config(), load_config_meetme(), load_dynamic_module(), load_module(), load_modules(), load_moh_classes(), load_odbc_config(), load_or_reload_lua_stuff(), load_pbx(), load_realtime_queue(), load_resource(), load_rpt_vars(), load_values_config(), local_alloc(), local_answer(), local_ast_moh_start(), local_call(), local_devicestate(), local_dtmf_helper(), local_fixup(), local_new(), local_write(), log_exec(), log_jack_status(), logger_print_normal(), 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_modulecheck(), manager_show_dialplan_helper(), 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(), 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_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(), mute_fragment(), mwi_send_thread(), mwi_sub_event_cb(), mwi_thread(), 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(), 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(), OpenHistory(), openserial(), osp_check_destination(), osp_create_provider(), osp_load(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), oss_indicate(), oss_new(), oss_request(), page_exec(), park_call_exec(), park_exec_full(), park_space_reserve(), parkandannounce_exec(), parkinglot_addref(), parkinglot_unref(), parse(), parse_args(), parse_config(), parse_cookies(), parse_gain_value(), parse_ie(), parse_minse(), parse_naptr(), parse_options(), parse_register_contact(), parse_session_expires(), parse_srv(), ParseBookmark(), parsing(), 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(), 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(), 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(), pop_exec(), post_raw(), powerof(), pp_each_extension_exec(), pqm_exec(), precache_trans(), precache_transactions(), prep_email_sub_vars(), pri_create_spanmap(), pri_create_trunkgroup(), pri_dchannel(), pri_fixup_principle(), pri_resolve_span(), privacy_exec(), private_enum_init(), proc_422_rsp(), proc_session_timer(), process_ast_dsp(), process_dahdi(), process_echocancel(), process_message_callback(), process_opcode(), process_request(), process_request_queue(), process_returncode(), process_rfc2833(), process_rfc3389(), 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(), pw_cb(), ql_exec(), queue_exec(), 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_pipe(), read_samples(), readexten_exec(), readfile_exec(), realtime_curl(), realtime_destroy_handler(), realtime_directory(), realtime_handler(), realtime_ldap_base_ap(), realtime_multi_curl(), realtime_multi_handler(), realtime_multi_ldap(), realtime_multi_odbc(), realtime_multi_pgsql(), realtime_odbc(), realtime_pgsql(), realtime_require_handler(), realtime_store_handler(), realtime_update_handler(), receive_digit(), receive_message(), record_exec(), refresh_list(), regex(), register_exten(), register_group(), register_group_feature(), register_peer_exten(), register_verify(), registry_rerequest(), reload(), reload_agents(), reload_config(), reload_firmware(), reload_followme(), reload_logger(), reload_queue_members(), reload_queue_rules(), reload_queues(), remove_by_peercallno(), remove_by_transfercallno(), remove_from_queue(), replace_callno(), reply_digest(), require_curl(), require_odbc(), require_pgsql(), resample_frame(), reset_conf(), restart_monitor(), restart_session_timer(), restore_conference(), restore_gains(), retrans_pkt(), retreive_memory(), retrydial_exec(), return_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_socket(), 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(), sayfile(), saynum(), scan_service(), scan_thread(), schedule(), scheduled_destroy(), sdl_setup(), select_entry(), send_callerid(), send_client(), send_delay(), send_dtmf(), send_request(), send_retransmit(), send_select_output(), send_tone_burst(), send_usb_txt(), send_waveform_to_channel(), send_waveform_to_fd(), senddtmf_exec(), 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_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(), setup_incoming_call(), setup_privacy_args(), setup_rtp_connection(), setup_transfer_datastore(), sha1(), shared_read(), shared_write(), shell_helper(), show_dialplan_helper(), showdisplay(), showkeys(), sip_addheader(), sip_alloc(), sip_call(), sip_cli_notify(), sip_dtmfmode(), sip_dump_history(), sip_fixup(), sip_hangup(), sip_indicate(), sip_new(), sip_park(), sip_park_thread(), sip_parse_host(), sip_poke_noanswer(), sip_poke_peer(), sip_queryoption(), sip_read(), sip_reg_timeout(), sip_register(), sip_request_call(), sip_reregister(), sip_rtp_read(), sip_scheddestroy(), sip_sendhtml(), sip_sipredirect(), sip_st_alloc(), sip_tcptls_write(), sip_threadinfo_create(), sip_write(), sipsock_read(), 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_messagerx2(), sms_process(), sms_readfile(), sndfax_exec(), socket_process(), socket_process_meta(), socket_read(), softhangup_exec(), soundcard_init(), soundcard_writeframe(), span_message(), spawn_dp_lookup(), spawn_mp3(), speex_get_wb_sz_at(), speex_read(), speex_samples(), speex_write(), speextolin_framein(), spy_generate(), sqlite_log(), ss_thread(), ssl_lock(), start_moh_exec(), start_monitor_exec(), start_network_thread(), start_pri(), start_rtp(), start_session_timer(), start_spying(), start_stream(), starttimer(), static_callback(), 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_txmixa(), store_txmixb(), store_txtoctype(), stub_ast_key_get(), subscript(), substitute_escapes(), swap_subs(), switch_video_out(), sysinfo_helper(), 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(), 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_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_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(), unregister_exten(), update_call_counter(), update_common_options(), update_config(), update_curl(), update_header(), update_key(), update_ldap(), update_odbc(), update_pgsql(), update_registry(), update_scoreboard(), 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(), 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_stream(), writefile(), and xpmr_config().

01087 {
01088    struct logmsg *logmsg = NULL;
01089    struct ast_str *buf = NULL;
01090    struct ast_tm tm;
01091    struct timeval now = ast_tvnow();
01092    int res = 0;
01093    va_list ap;
01094 
01095    if (!(buf = ast_str_thread_get(&log_buf, LOG_BUF_INIT_SIZE)))
01096       return;
01097 
01098    if (AST_RWLIST_EMPTY(&logchannels)) {
01099       /*
01100        * we don't have the logger chain configured yet,
01101        * so just log to stdout
01102        */
01103       if (level != __LOG_VERBOSE) {
01104          int result;
01105          va_start(ap, fmt);
01106          result = ast_str_set_va(&buf, BUFSIZ, fmt, ap); /* XXX BUFSIZ ? */
01107          va_end(ap);
01108          if (result != AST_DYNSTR_BUILD_FAILED) {
01109             term_filter_escapes(buf->str);
01110             fputs(buf->str, stdout);
01111          }
01112       }
01113       return;
01114    }
01115    
01116    /* don't display LOG_DEBUG messages unless option_verbose _or_ option_debug
01117       are non-zero; LOG_DEBUG messages can still be displayed if option_debug
01118       is zero, if option_verbose is non-zero (this allows for 'level zero'
01119       LOG_DEBUG messages to be displayed, if the logmask on any channel
01120       allows it)
01121    */
01122    if (!option_verbose && !option_debug && (level == __LOG_DEBUG))
01123       return;
01124 
01125    /* Ignore anything that never gets logged anywhere */
01126    if (!(global_logmask & (1 << level)))
01127       return;
01128    
01129    /* Build string */
01130    va_start(ap, fmt);
01131    res = ast_str_set_va(&buf, BUFSIZ, fmt, ap);
01132    va_end(ap);
01133 
01134    /* If the build failed, then abort and free this structure */
01135    if (res == AST_DYNSTR_BUILD_FAILED)
01136       return;
01137 
01138    /* Create a new logging message */
01139    if (!(logmsg = ast_calloc(1, sizeof(*logmsg) + res + 1)))
01140       return;
01141 
01142    /* Copy string over */
01143    strcpy(logmsg->str, buf->str);
01144 
01145    /* Set type to be normal */
01146    logmsg->type = LOGMSG_NORMAL;
01147 
01148    /* Create our date/time */
01149    ast_localtime(&now, &tm, NULL);
01150    ast_strftime(logmsg->date, sizeof(logmsg->date), dateformat, &tm);
01151 
01152    /* Copy over data */
01153    logmsg->level = level;
01154    logmsg->line = line;
01155    ast_copy_string(logmsg->file, file, sizeof(logmsg->file));
01156    ast_copy_string(logmsg->function, function, sizeof(logmsg->function));
01157    logmsg->process_id = (long) GETTID();
01158 
01159    /* If the logger thread is active, append it to the tail end of the list - otherwise skip that step */
01160    if (logthread != AST_PTHREADT_NULL) {
01161       AST_LIST_LOCK(&logmsgs);
01162       AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list);
01163       ast_cond_signal(&logcond);
01164       AST_LIST_UNLOCK(&logmsgs);
01165    } else {
01166       logger_print_normal(logmsg);
01167       ast_free(logmsg);
01168    }
01169 
01170    return;

static void ast_log_vsyslog ( int  level,
const char *  file,
int  line,
const char *  function,
char *  str,
long  pid 
) [static]

Definition at line 832 of file logger.c.

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

Referenced by logger_print_normal().

00834 {
00835    char buf[BUFSIZ];
00836 
00837    if (level >= SYSLOG_NLEVELS) {
00838       /* we are locked here, so cannot ast_log() */
00839       fprintf(stderr, "ast_log_vsyslog called with bogus level: %d\n", level);
00840       return;
00841    }
00842 
00843    if (level == __LOG_VERBOSE) {
00844       snprintf(buf, sizeof(buf), "VERBOSE[%ld]: %s", pid, str);
00845       level = __LOG_DEBUG;
00846    } else if (level == __LOG_DTMF) {
00847       snprintf(buf, sizeof(buf), "DTMF[%ld]: %s", pid, str);
00848       level = __LOG_DEBUG;
00849    } else {
00850       snprintf(buf, sizeof(buf), "%s[%ld]: %s:%d in %s: %s",
00851           levels[level], pid, file, line, function, str);
00852    }
00853 
00854    term_strip(buf, buf, strlen(buf) + 1);
00855    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 460 of file logger.c.

References ast_check_realtime(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_store_realtime(), qlog, and SENTINEL.

Referenced by agent_logoff_maintenance(), aqm_exec(), handle_queue_add_member(), handle_queue_remove_member(), init_logger(), 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(), update_realtime_members(), and wait_our_turn().

00462 {
00463    va_list ap;
00464    char qlog_msg[8192];
00465    int qlog_len;
00466    char time_str[16];
00467 
00468    if (ast_check_realtime("queue_log")) {
00469       va_start(ap, fmt);
00470       vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap);
00471       va_end(ap);
00472       snprintf(time_str, sizeof(time_str), "%ld", (long)time(NULL));
00473       ast_store_realtime("queue_log", "time", time_str, 
00474                   "callid", callid, 
00475                   "queuename", queuename, 
00476                   "agent", agent, 
00477                   "event", event,
00478                   "data", qlog_msg,
00479                   SENTINEL);
00480    } else {
00481       if (qlog) {
00482          va_start(ap, fmt);
00483          qlog_len = snprintf(qlog_msg, sizeof(qlog_msg), "%ld|%s|%s|%s|%s|", (long)time(NULL), callid, queuename, agent, event);
00484          vsnprintf(qlog_msg + qlog_len, sizeof(qlog_msg) - qlog_len, fmt, ap);
00485          va_end(ap);
00486       }
00487       AST_RWLIST_RDLOCK(&logchannels);
00488       if (qlog) {
00489          fprintf(qlog, "%s\n", qlog_msg);
00490          fflush(qlog);
00491       }
00492       AST_RWLIST_UNLOCK(&logchannels);
00493    }

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

Definition at line 1309 of file logger.c.

References ast_malloc, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, logchannel::list, and verb.

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

01311 {
01312    struct verb *verb;
01313 
01314    if (!(verb = ast_malloc(sizeof(*verb))))
01315       return -1;
01316 
01317    verb->verboser = v;
01318 
01319    AST_RWLIST_WRLOCK(&verbosers);
01320    AST_RWLIST_INSERT_HEAD(&verbosers, verb, list);
01321    AST_RWLIST_UNLOCK(&verbosers);
01322    
01323    return 0;

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

Definition at line 1325 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.

Referenced by exit_now().

01327 {
01328    struct verb *cur;
01329 
01330    AST_RWLIST_WRLOCK(&verbosers);
01331    AST_RWLIST_TRAVERSE_SAFE_BEGIN(&verbosers, cur, list) {
01332       if (cur->verboser == v) {
01333          AST_RWLIST_REMOVE_CURRENT(list);
01334          ast_free(cur);
01335          break;
01336       }
01337    }
01338    AST_RWLIST_TRAVERSE_SAFE_END;
01339    AST_RWLIST_UNLOCK(&verbosers);
01340    
01341    return cur ? 0 : -1;

void ast_verbose ( const char *  fmt,
  ... 
)

Definition at line 1301 of file logger.c.

References __ast_verbose_ap().

01303 {
01304    va_list ap;
01305    va_start(ap, fmt);
01306    __ast_verbose_ap("", 0, "", fmt, ap);
01307    va_end(ap);

void close_logger ( void   ) 

Provided by logger.c

Definition at line 1043 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, eventlog, f, logchannel::list, logcond, logthread, and qlog.

Referenced by quit_handler().

01045 {
01046    struct logchannel *f = NULL;
01047 
01048    /* Stop logger thread */
01049    AST_LIST_LOCK(&logmsgs);
01050    close_logger_thread = 1;
01051    ast_cond_signal(&logcond);
01052    AST_LIST_UNLOCK(&logmsgs);
01053 
01054    if (logthread != AST_PTHREADT_NULL)
01055       pthread_join(logthread, NULL);
01056 
01057    AST_RWLIST_WRLOCK(&logchannels);
01058 
01059    if (eventlog) {
01060       fclose(eventlog);
01061       eventlog = NULL;
01062    }
01063 
01064    if (qlog) {
01065       fclose(qlog);
01066       qlog = NULL;
01067    }
01068 
01069    AST_RWLIST_TRAVERSE(&logchannels, f, list) {
01070       if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
01071          fclose(f->fileptr);
01072          f->fileptr = NULL;
01073       }
01074    }
01075 
01076    closelog(); /* syslog */
01077 
01078    AST_RWLIST_UNLOCK(&logchannels);
01079 
01080    return;

static char* handle_logger_reload ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 689 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.

00691 {
00692    switch (cmd) {
00693    case CLI_INIT:
00694       e->command = "logger reload";
00695       e->usage = 
00696          "Usage: logger reload\n"
00697          "       Reloads the logger subsystem state.  Use after restarting syslogd(8) if you are using syslog logging.\n";
00698       return NULL;
00699    case CLI_GENERATE:
00700       return NULL;
00701    }
00702    if (reload_logger(0)) {
00703       ast_cli(a->fd, "Failed to reload the logger\n");
00704       return CLI_FAILURE;
00705    }
00706    return CLI_SUCCESS;

static char* handle_logger_rotate ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 708 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.

00710 {
00711    switch (cmd) {
00712    case CLI_INIT:
00713       e->command = "logger rotate";
00714       e->usage = 
00715          "Usage: logger rotate\n"
00716          "       Rotates and Reopens the log files.\n";
00717       return NULL;
00718    case CLI_GENERATE:
00719       return NULL;   
00720    }
00721    if (reload_logger(1)) {
00722       ast_cli(a->fd, "Failed to reload the logger and rotate log files\n");
00723       return CLI_FAILURE;
00724    } 
00725    return CLI_SUCCESS;

static char* handle_logger_set_level ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
) [static]

Definition at line 727 of file logger.c.

References ast_cli_args::argc, ast_cli_args::argv, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, ast_cli_entry::command, levels, NUMLOGLEVELS, and ast_cli_entry::usage.

00729 {
00730    int x;
00731    int state;
00732    int level = -1;
00733 
00734    switch (cmd) {
00735    case CLI_INIT:
00736       e->command = "logger set level";
00737       e->usage = 
00738          "Usage: logger set level\n"
00739          "       Set a specific log level to enabled/disabled for this console.\n";
00740       return NULL;
00741    case CLI_GENERATE:
00742       return NULL;
00743    }
00744 
00745    if (a->argc < 5)
00746       return CLI_SHOWUSAGE;
00747 
00748    for (x = 0; x <= NUMLOGLEVELS; x++) {
00749       if (!strcasecmp(a->argv[3], levels[x])) {
00750          level = x;
00751          break;
00752       }
00753    }
00754 
00755    state = ast_true(a->argv[4]) ? 1 : 0;
00756 
00757    if (level != -1) {
00758       ast_console_toggle_loglevel(a->fd, level, state);
00759       ast_cli(a->fd, "Logger status for '%s' has been set to '%s'.\n", levels[level], state ? "on" : "off");
00760    } else
00761       return CLI_SHOWUSAGE;
00762 
00763    return CLI_SUCCESS;

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 766 of file logger.c.

References __LOG_DEBUG, __LOG_DTMF, __LOG_ERROR, __LOG_EVENT, __LOG_NOTICE, __LOG_VERBOSE, __LOG_WARNING, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, chan, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, FORMATL, logchannel::list, LOGTYPE_CONSOLE, LOGTYPE_SYSLOG, and ast_cli_entry::usage.

00768 {
00769 #define FORMATL   "%-35.35s %-8.8s %-9.9s "
00770    struct logchannel *chan;
00771    switch (cmd) {
00772    case CLI_INIT:
00773       e->command = "logger show channels";
00774       e->usage = 
00775          "Usage: logger show channels\n"
00776          "       List configured logger channels.\n";
00777       return NULL;
00778    case CLI_GENERATE:
00779       return NULL;   
00780    }
00781    ast_cli(a->fd, FORMATL, "Channel", "Type", "Status");
00782    ast_cli(a->fd, "Configuration\n");
00783    ast_cli(a->fd, FORMATL, "-------", "----", "------");
00784    ast_cli(a->fd, "-------------\n");
00785    AST_RWLIST_RDLOCK(&logchannels);
00786    AST_RWLIST_TRAVERSE(&logchannels, chan, list) {
00787       ast_cli(a->fd, FORMATL, chan->filename, chan->type == LOGTYPE_CONSOLE ? "Console" : (chan->type == LOGTYPE_SYSLOG ? "Syslog" : "File"),
00788          chan->disabled ? "Disabled" : "Enabled");
00789       ast_cli(a->fd, " - ");
00790       if (chan->logmask & (1 << __LOG_DEBUG)) 
00791          ast_cli(a->fd, "Debug ");
00792       if (chan->logmask & (1 << __LOG_DTMF)) 
00793          ast_cli(a->fd, "DTMF ");
00794       if (chan->logmask & (1 << __LOG_VERBOSE)) 
00795          ast_cli(a->fd, "Verbose ");
00796       if (chan->logmask & (1 << __LOG_WARNING)) 
00797          ast_cli(a->fd, "Warning ");
00798       if (chan->logmask & (1 << __LOG_NOTICE)) 
00799          ast_cli(a->fd, "Notice ");
00800       if (chan->logmask & (1 << __LOG_ERROR)) 
00801          ast_cli(a->fd, "Error ");
00802       if (chan->logmask & (1 << __LOG_EVENT)) 
00803          ast_cli(a->fd, "Event ");
00804       ast_cli(a->fd, "\n");
00805    }
00806    AST_RWLIST_UNLOCK(&logchannels);
00807    ast_cli(a->fd, "\n");
00808       
00809    return CLI_SUCCESS;

static int handle_SIGXFSZ ( int  sig  )  [static]

Definition at line 825 of file logger.c.

Referenced by init_logger().

00827 {
00828    /* Indicate need to reload */
00829    filesize_reload_needed = 1;
00830    return 0;

int init_logger ( void   ) 

Provided by logger.c

Definition at line 999 of file logger.c.

References ast_cli_register_multiple(), ast_cond_destroy(), ast_cond_init(), ast_config_AST_LOG_DIR, ast_log(), ast_mkdir(), ast_pthread_create, ast_queue_log(), ast_verb, cli_logger, errno, EVENTLOG, eventlog, handle_SIGXFSZ(), init_logger_chain(), LOG_ERROR, LOG_EVENT, logcond, logfiles, logger_thread(), logthread, and qlog.

Referenced by main().

01001 {
01002    char tmp[256];
01003    int res = 0;
01004 
01005    /* auto rotate if sig SIGXFSZ comes a-knockin */
01006    (void) signal(SIGXFSZ, (void *) handle_SIGXFSZ);
01007 
01008    /* start logger thread */
01009    ast_cond_init(&logcond, NULL);
01010    if (ast_pthread_create(&logthread, NULL, logger_thread, NULL) < 0) {
01011       ast_cond_destroy(&logcond);
01012       return -1;
01013    }
01014 
01015    /* register the logger cli commands */
01016    ast_cli_register_multiple(cli_logger, sizeof(cli_logger) / sizeof(struct ast_cli_entry));
01017 
01018    ast_mkdir(ast_config_AST_LOG_DIR, 0777);
01019   
01020    /* create log channels */
01021    init_logger_chain(0 /* locked */);
01022 
01023    /* create the eventlog */
01024    if (logfiles.event_log) {
01025       snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
01026       eventlog = fopen(tmp, "a");
01027       if (eventlog) {
01028          ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
01029          ast_verb(1, "Asterisk Event Logger Started %s\n", tmp);
01030       } else {
01031          ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
01032          res = -1;
01033       }
01034    }
01035 
01036    if (logfiles.queue_log) {
01037       snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
01038       qlog = fopen(tmp, "a");
01039       ast_queue_log("NONE", "NONE", "NONE", "QUEUESTART", "%s", "");
01040    }
01041    return res;

static void init_logger_chain ( int  locked  )  [static]

Definition at line 315 of file logger.c.

References ast_calloc, 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(), chan, config_flags, errno, logchannel::list, logfiles, LOGTYPE_CONSOLE, make_logchannel(), ROTATE, s, SEQUENTIAL, TIMESTAMP, and var.

Referenced by init_logger(), and reload_logger().

00317 {
00318    struct logchannel *chan;
00319    struct ast_config *cfg;
00320    struct ast_variable *var;
00321    const char *s;
00322    struct ast_flags config_flags = { 0 };
00323 
00324    if (!(cfg = ast_config_load2("logger.conf", "logger", config_flags)))
00325       return;
00326 
00327    /* delete our list of log channels */
00328    if (!locked)
00329       AST_RWLIST_WRLOCK(&logchannels);
00330    while ((chan = AST_RWLIST_REMOVE_HEAD(&logchannels, list)))
00331       ast_free(chan);
00332    if (!locked)
00333       AST_RWLIST_UNLOCK(&logchannels);
00334    
00335    global_logmask = 0;
00336    errno = 0;
00337    /* close syslog */
00338    closelog();
00339    
00340    /* If no config file, we're fine, set default options. */
00341    if (!cfg) {
00342       if (errno)
00343          fprintf(stderr, "Unable to open logger.conf: %s; default settings will be used.\n", strerror(errno));
00344       else
00345          fprintf(stderr, "Errors detected in logger.conf: see above; default settings will be used.\n");
00346       if (!(chan = ast_calloc(1, sizeof(*chan))))
00347          return;
00348       chan->type = LOGTYPE_CONSOLE;
00349       chan->logmask = 28; /*warning,notice,error */
00350       if (!locked)
00351          AST_RWLIST_WRLOCK(&logchannels);
00352       AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);
00353       if (!locked)
00354          AST_RWLIST_UNLOCK(&logchannels);
00355       global_logmask |= chan->logmask;
00356       return;
00357    }
00358    
00359    if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {
00360       if (ast_true(s)) {
00361          if (gethostname(hostname, sizeof(hostname) - 1)) {
00362             ast_copy_string(hostname, "unknown", sizeof(hostname));
00363             fprintf(stderr, "What box has no hostname???\n");
00364          }
00365       } else
00366          hostname[0] = '\0';
00367    } else
00368       hostname[0] = '\0';
00369    if ((s = ast_variable_retrieve(cfg, "general", "dateformat")))
00370       ast_copy_string(dateformat, s, sizeof(dateformat));
00371    else
00372       ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat));
00373    if ((s = ast_variable_retrieve(cfg, "general", "queue_log")))
00374       logfiles.queue_log = ast_true(s);
00375    if ((s = ast_variable_retrieve(cfg, "general", "event_log")))
00376       logfiles.event_log = ast_true(s);
00377    if ((s = ast_variable_retrieve(cfg, "general", "queue_log_name")))
00378       ast_copy_string(queue_log_name, s, sizeof(queue_log_name));
00379    if ((s = ast_variable_retrieve(cfg, "general", "exec_after_rotate")))
00380       ast_copy_string(exec_after_rotate, s, sizeof(exec_after_rotate));
00381    if ((s = ast_variable_retrieve(cfg, "general", "rotatestrategy"))) {
00382       if (strcasecmp(s, "timestamp") == 0)
00383          rotatestrategy = TIMESTAMP;
00384       else if (strcasecmp(s, "rotate") == 0)
00385          rotatestrategy = ROTATE;
00386       else if (strcasecmp(s, "sequential") == 0)
00387          rotatestrategy = SEQUENTIAL;
00388       else
00389          fprintf(stderr, "Unknown rotatestrategy: %s\n", s);
00390    } else {
00391       if ((s = ast_variable_retrieve(cfg, "general", "rotatetimestamp"))) {
00392          rotatestrategy = ast_true(s) ? TIMESTAMP : SEQUENTIAL;
00393          fprintf(stderr, "rotatetimestamp option has been deprecated.  Please use rotatestrategy instead.\n");
00394       }
00395    }
00396 
00397    if (!locked)
00398       AST_RWLIST_WRLOCK(&logchannels);
00399    var = ast_variable_browse(cfg, "logfiles");
00400    for (; var; var = var->next) {
00401       if (!(chan = make_logchannel(var->name, var->value, var->lineno)))
00402          continue;
00403       AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);
00404       global_logmask |= chan->logmask;
00405    }
00406    if (!locked)
00407       AST_RWLIST_UNLOCK(&logchannels);
00408 
00409    ast_config_destroy(cfg);

static void logger_print_normal ( struct logmsg logmsg  )  [static]

Print a normal log message to the channels.

Definition at line 858 of file logger.c.

References __LOG_EVENT, __LOG_VERBOSE, ast_console_puts_mutable(), ast_log(), ast_log_vsyslog(), AST_RWLIST_EMPTY, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strlen_zero(), ast_verb, buf, chan, COLOR_BRWHITE, colors, logmsg::date, errno, EVENT_FLAG_SYSTEM, eventlog, logmsg::file, logmsg::function, logmsg::level, levels, logmsg::line, logchannel::list, LOG_EVENT, logfiles, LOGTYPE_CONSOLE, LOGTYPE_FILE, LOGTYPE_SYSLOG, manager_event, logmsg::process_id, reload_logger(), logmsg::str, term_color(), and term_strip().

Referenced by ast_log(), and logger_thread().

00860 {
00861    struct logchannel *chan = NULL;
00862    char buf[BUFSIZ];
00863 
00864    AST_RWLIST_RDLOCK(&logchannels);
00865 
00866    if (logfiles.event_log && logmsg->level == __LOG_EVENT) {
00867       fprintf(eventlog, "%s asterisk[%ld]: %s", logmsg->date, (long)getpid(), logmsg->str);
00868       fflush(eventlog);
00869       AST_RWLIST_UNLOCK(&logchannels);
00870       return;
00871    }
00872 
00873    if (!AST_RWLIST_EMPTY(&logchannels)) {
00874       AST_RWLIST_TRAVERSE(&logchannels, chan, list) {
00875          /* If the channel is disabled, then move on to the next one */
00876          if (chan->disabled)
00877             continue;
00878          /* Check syslog channels */
00879          if (chan->type == LOGTYPE_SYSLOG && (chan->logmask & (1 << logmsg->level))) {
00880             ast_log_vsyslog(logmsg->level, logmsg->file, logmsg->line, logmsg->function, logmsg->str, logmsg->process_id);
00881          /* Console channels */
00882          } else if (chan->type == LOGTYPE_CONSOLE && (chan->logmask & (1 << logmsg->level))) {
00883             char linestr[128];
00884             char tmp1[80], tmp2[80], tmp3[80], tmp4[80];
00885 
00886             /* If the level is verbose, then skip it */
00887             if (logmsg->level == __LOG_VERBOSE)
00888                continue;
00889 
00890             /* Turn the numerical line number into a string */
00891             snprintf(linestr, sizeof(linestr), "%d", logmsg->line);
00892             /* Build string to print out */
00893             snprintf(buf, sizeof(buf), "[%s] %s[%ld]: %s:%s %s: %s",
00894                 logmsg->date,
00895                 term_color(tmp1, levels[logmsg->level], colors[logmsg->level], 0, sizeof(tmp1)),
00896                 logmsg->process_id,
00897                 term_color(tmp2, logmsg->file, COLOR_BRWHITE, 0, sizeof(tmp2)),
00898                 term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)),
00899                 term_color(tmp4, logmsg->function, COLOR_BRWHITE, 0, sizeof(tmp4)),
00900                 logmsg->str);
00901             /* Print out */
00902             ast_console_puts_mutable(buf, logmsg->level);
00903          /* File channels */
00904          } else if (chan->type == LOGTYPE_FILE && (chan->logmask & (1 << logmsg->level))) {
00905             int res = 0;
00906 
00907             /* If no file pointer exists, skip it */
00908             if (!chan->fileptr) {
00909                continue;
00910             }
00911 
00912             /* Print out to the file */
00913             res = fprintf(chan->fileptr, "[%s] %s[%ld] %s: %s",
00914                      logmsg->date, levels[logmsg->level], logmsg->process_id, logmsg->file, term_strip(buf, logmsg->str, BUFSIZ));
00915             if (res <= 0 && !ast_strlen_zero(logmsg->str)) {
00916                fprintf(stderr, "**** Asterisk Logging Error: ***********\n");
00917                if (errno == ENOMEM || errno == ENOSPC)
00918                   fprintf(stderr, "Asterisk logging error: Out of disk space, can't log to log file %s\n", chan->filename);
00919                else
00920                   fprintf(stderr, "Logger Warning: Unable to write to log file '%s': %s (disabled)\n", chan->filename, strerror(errno));
00921                manager_event(EVENT_FLAG_SYSTEM, "LogChannel", "Channel: %s\r\nEnabled: No\r\nReason: %d - %s\r\n", chan->filename, errno, strerror(errno));
00922                chan->disabled = 1;
00923             } else if (res > 0) {
00924                fflush(chan->fileptr);
00925             }
00926          }
00927       }
00928    } else if (logmsg->level != __LOG_VERBOSE) {
00929       fputs(logmsg->str, stdout);
00930    }
00931 
00932    AST_RWLIST_UNLOCK(&logchannels);
00933 
00934    /* If we need to reload because of the file size, then do so */
00935    if (filesize_reload_needed) {
00936       reload_logger(-1);
00937       ast_log(LOG_EVENT, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
00938       ast_verb(1, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
00939    }
00940 
00941    return;

static void logger_print_verbose ( struct logmsg logmsg  )  [static]

Print a verbose message to the verbosers.

Definition at line 944 of file logger.c.

References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, logchannel::list, logmsg::str, and verb::verboser.

Referenced by __ast_verbose_ap(), and logger_thread().

00946 {
00947    struct verb *v = NULL;
00948 
00949    /* Iterate through the list of verbosers and pass them the log message string */
00950    AST_RWLIST_RDLOCK(&verbosers);
00951    AST_RWLIST_TRAVERSE(&verbosers, v, list)
00952       v->verboser(logmsg->str);
00953    AST_RWLIST_UNLOCK(&verbosers);
00954 
00955    return;

int logger_reload ( void   ) 

Reload logger without rotating log files.

Definition at line 682 of file logger.c.

References reload_logger(), RESULT_FAILURE, and RESULT_SUCCESS.

00684 {
00685    if(reload_logger(0))
00686       return RESULT_FAILURE;
00687    return RESULT_SUCCESS;

static void* logger_thread ( void *  data  )  [static]

Actual logging thread.

Definition at line 958 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, logmsgs::lock, logcond, logger_print_normal(), logger_print_verbose(), LOGMSG_NORMAL, LOGMSG_VERBOSE, msg, and logchannel::next.

Referenced by init_logger().

00960 {
00961    struct logmsg *next = NULL, *msg = NULL;
00962 
00963    for (;;) {
00964       /* We lock the message list, and see if any message exists... if not we wait on the condition to be signalled */
00965       AST_LIST_LOCK(&logmsgs);
00966       if (AST_LIST_EMPTY(&logmsgs)) {
00967          if (close_logger_thread) {
00968             break;
00969          } else {
00970             ast_cond_wait(&logcond, &logmsgs.lock);
00971          }
00972       }
00973       next = AST_LIST_FIRST(&logmsgs);
00974       AST_LIST_HEAD_INIT_NOLOCK(&logmsgs);
00975       AST_LIST_UNLOCK(&logmsgs);
00976 
00977       /* Otherwise go through and process each message in the order added */
00978       while ((msg = next)) {
00979          /* Get the next entry now so that we can free our current structure later */
00980          next = AST_LIST_NEXT(msg, list);
00981 
00982          /* Depending on the type, send it to the proper function */
00983          if (msg->type == LOGMSG_NORMAL)
00984             logger_print_normal(msg);
00985          else if (msg->type == LOGMSG_VERBOSE)
00986             logger_print_verbose(msg);
00987 
00988          /* Free the data since we are done */
00989          ast_free(msg);
00990       }
00991 
00992       /* If we should stop, then stop */
00993       if (close_logger_thread)
00994          break;
00995    }
00996 
00997    return NULL;

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

Definition at line 180 of file logger.c.

References __LOG_DEBUG, __LOG_DTMF, __LOG_ERROR, __LOG_EVENT, __LOG_NOTICE, __LOG_VERBOSE, __LOG_WARNING, ast_skip_blanks(), ast_strdupa, and strsep().

Referenced by make_logchannel().

00182 {
00183    char *w;
00184    int res = 0;
00185    char *stringp = ast_strdupa(s);
00186 
00187    while ((w = strsep(&stringp, ","))) {
00188       w = ast_skip_blanks(w);
00189       if (!strcasecmp(w, "error")) 
00190          res |= (1 << __LOG_ERROR);
00191       else if (!strcasecmp(w, "warning"))
00192          res |= (1 << __LOG_WARNING);
00193       else if (!strcasecmp(w, "notice"))
00194          res |= (1 << __LOG_NOTICE);
00195       else if (!strcasecmp(w, "event"))
00196          res |= (1 << __LOG_EVENT);
00197       else if (!strcasecmp(w, "debug"))
00198          res |= (1 << __LOG_DEBUG);
00199       else if (!strcasecmp(w, "verbose"))
00200          res |= (1 << __LOG_VERBOSE);
00201       else if (!strcasecmp(w, "dtmf"))
00202          res |= (1 << __LOG_DTMF);
00203       else {
00204          fprintf(stderr, "Logfile Warning: Unknown keyword '%s' at line %d of logger.conf\n", w, lineno);
00205       }
00206    }
00207 
00208    return res;

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

Definition at line 210 of file logger.c.

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

Referenced by init_logger_chain().

00212 {
00213    struct logchannel *chan;
00214    char *facility;
00215 #ifndef SOLARIS
00216    CODE *cptr;
00217 #endif
00218 
00219    if (ast_strlen_zero(channel) || !(chan = ast_calloc(1, sizeof(*chan))))
00220       return NULL;
00221 
00222    if (!strcasecmp(channel, "console")) {
00223       chan->type = LOGTYPE_CONSOLE;
00224    } else if (!strncasecmp(channel, "syslog", 6)) {
00225       /*
00226       * syntax is:
00227       *  syslog.facility => level,level,level
00228       */
00229       facility = strchr(channel, '.');
00230       if (!facility++ || !facility) {
00231          facility = "local0";
00232       }
00233 
00234 #ifndef SOLARIS
00235       /*
00236       * Walk through the list of facilitynames (defined in sys/syslog.h)
00237       * to see if we can find the one we have been given
00238       */
00239       chan->facility = -1;
00240       cptr = facilitynames;
00241       while (cptr->c_name) {
00242          if (!strcasecmp(facility, cptr->c_name)) {
00243             chan->facility = cptr->c_val;
00244             break;
00245          }
00246          cptr++;
00247       }
00248 #else
00249       chan->facility = -1;
00250       if (!strcasecmp(facility, "kern")) 
00251          chan->facility = LOG_KERN;
00252       else if (!strcasecmp(facility, "USER")) 
00253          chan->facility = LOG_USER;
00254       else if (!strcasecmp(facility, "MAIL")) 
00255          chan->facility = LOG_MAIL;
00256       else if (!strcasecmp(facility, "DAEMON")) 
00257          chan->facility = LOG_DAEMON;
00258       else if (!strcasecmp(facility, "AUTH")) 
00259          chan->facility = LOG_AUTH;
00260       else if (!strcasecmp(facility, "SYSLOG")) 
00261          chan->facility = LOG_SYSLOG;
00262       else if (!strcasecmp(facility, "LPR")) 
00263          chan->facility = LOG_LPR;
00264       else if (!strcasecmp(facility, "NEWS")) 
00265          chan->facility = LOG_NEWS;
00266       else if (!strcasecmp(facility, "UUCP")) 
00267          chan->facility = LOG_UUCP;
00268       else if (!strcasecmp(facility, "CRON")) 
00269          chan->facility = LOG_CRON;
00270       else if (!strcasecmp(facility, "LOCAL0")) 
00271          chan->facility = LOG_LOCAL0;
00272       else if (!strcasecmp(facility, "LOCAL1")) 
00273          chan->facility = LOG_LOCAL1;
00274       else if (!strcasecmp(facility, "LOCAL2")) 
00275          chan->facility = LOG_LOCAL2;
00276       else if (!strcasecmp(facility, "LOCAL3")) 
00277          chan->facility = LOG_LOCAL3;
00278       else if (!strcasecmp(facility, "LOCAL4")) 
00279          chan->facility = LOG_LOCAL4;
00280       else if (!strcasecmp(facility, "LOCAL5")) 
00281          chan->facility = LOG_LOCAL5;
00282       else if (!strcasecmp(facility, "LOCAL6")) 
00283          chan->facility = LOG_LOCAL6;
00284       else if (!strcasecmp(facility, "LOCAL7")) 
00285          chan->facility = LOG_LOCAL7;
00286 #endif /* Solaris */
00287 
00288       if (0 > chan->facility) {
00289          fprintf(stderr, "Logger Warning: bad syslog facility in logger.conf\n");
00290          ast_free(chan);
00291          return NULL;
00292       }
00293 
00294       chan->type = LOGTYPE_SYSLOG;
00295       snprintf(chan->filename, sizeof(chan->filename), "%s", channel);
00296       openlog("asterisk", LOG_PID, chan->facility);
00297    } else {
00298       if (!ast_strlen_zero(hostname)) {
00299          snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",
00300              channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel, hostname);
00301       } else {
00302          snprintf(chan->filename, sizeof(chan->filename), "%s/%s",
00303              channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel);
00304       }
00305       chan->fileptr = fopen(chan->filename, "a");
00306       if (!chan->fileptr) {
00307          /* Can't log here, since we're called with a lock */
00308          fprintf(stderr, "Logger Warning: Unable to open log file '%s': %s\n", chan->filename, strerror(errno));
00309       } 
00310       chan->type = LOGTYPE_FILE;
00311    }
00312    chan->logmask = make_components(components, lineno);
00313    return chan;

static int reload_logger ( int  rotate  )  [static]

Definition at line 581 of file logger.c.

References ast_config_AST_LOG_DIR, ast_log(), ast_mkdir(), ast_queue_log(), AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, errno, EVENT_FLAG_SYSTEM, EVENTLOG, eventlog, f, init_logger_chain(), logchannel::list, LOG_ERROR, LOG_EVENT, logfiles, manager_event, qlog, and rotate_file().

Referenced by handle_logger_reload(), handle_logger_rotate(), logger_print_normal(), and logger_reload().

00583 {
00584    char old[PATH_MAX] = "";
00585    int event_rotate = rotate, queue_rotate = rotate;
00586    struct logchannel *f;
00587    int res = 0;
00588    struct stat st;
00589 
00590    AST_RWLIST_WRLOCK(&logchannels);
00591 
00592    if (eventlog) {
00593       if (rotate < 0) {
00594          /* Check filesize - this one typically doesn't need an auto-rotate */
00595          snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
00596          if (stat(old, &st) != 0 || st.st_size > 0x40000000) { /* Arbitrarily, 1 GB */
00597             fclose(eventlog);
00598             eventlog = NULL;
00599          } else
00600             event_rotate = 0;
00601       } else {
00602          fclose(eventlog);
00603          eventlog = NULL;
00604       }
00605    } else
00606       event_rotate = 0;
00607 
00608    if (qlog) {
00609       if (rotate < 0) {
00610          /* Check filesize - this one typically doesn't need an auto-rotate */
00611          snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
00612          if (stat(old, &st) != 0 || st.st_size > 0x40000000) { /* Arbitrarily, 1 GB */
00613             fclose(qlog);
00614             qlog = NULL;
00615          } else
00616             queue_rotate = 0;
00617       } else {
00618          fclose(qlog);
00619          qlog = NULL;
00620       }
00621    } else 
00622       queue_rotate = 0;
00623 
00624    ast_mkdir(ast_config_AST_LOG_DIR, 0777);
00625 
00626    AST_RWLIST_TRAVERSE(&logchannels, f, list) {
00627       if (f->disabled) {
00628          f->disabled = 0;  /* Re-enable logging at reload */
00629          manager_event(EVENT_FLAG_SYSTEM, "LogChannel", "Channel: %s\r\nEnabled: Yes\r\n", f->filename);
00630       }
00631       if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
00632          fclose(f->fileptr);  /* Close file */
00633          f->fileptr = NULL;
00634          if (rotate)
00635             rotate_file(f->filename);
00636       }
00637    }
00638 
00639    filesize_reload_needed = 0;
00640 
00641    init_logger_chain(1 /* locked */);
00642 
00643    if (logfiles.event_log) {
00644       snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
00645       if (event_rotate)
00646          rotate_file(old);
00647 
00648       eventlog = fopen(old, "a");
00649       if (eventlog) {
00650          ast_log(LOG_EVENT, "Restarted Asterisk Event Logger\n");
00651          ast_verb(1, "Asterisk Event Logger restarted\n");
00652       } else {
00653          ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
00654          res = -1;
00655       }
00656    }
00657 
00658    if (logfiles.queue_log) {
00659       snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
00660       if (queue_rotate)
00661          rotate_file(old);
00662 
00663       qlog = fopen(old, "a");
00664       if (qlog) {
00665          AST_RWLIST_UNLOCK(&logchannels);
00666          ast_queue_log("NONE", "NONE", "NONE", "CONFIGRELOAD", "%s", "");
00667          AST_RWLIST_WRLOCK(&logchannels);
00668          ast_log(LOG_EVENT, "Restarted Asterisk Queue Logger\n");
00669          ast_verb(1, "Asterisk Queue Logger restarted\n");
00670       } else {
00671          ast_log(LOG_ERROR, "Unable to create queue log: %s\n", strerror(errno));
00672          res = -1;
00673       }
00674    }
00675 
00676    AST_RWLIST_UNLOCK(&logchannels);
00677 
00678    return res;

static int rotate_file ( const char *  filename  )  [static]

Definition at line 495 of file logger.c.

References ARRAY_LEN, ast_channel_alloc, ast_channel_free(), ast_log(), ast_safe_system(), ast_strlen_zero(), buf, LOG_WARNING, pbx_builtin_setvar_helper(), pbx_substitute_variables_helper(), ROTATE, SEQUENTIAL, and TIMESTAMP.

Referenced by reload_logger().

00497 {
00498    char old[PATH_MAX];
00499    char new[PATH_MAX];
00500    int x, y, which, found, res = 0, fd;
00501    char *suffixes[4] = { "", ".gz", ".bz2", ".Z" };
00502 
00503    switch (rotatestrategy) {
00504    case SEQUENTIAL:
00505       for (x = 0; ; x++) {
00506          snprintf(new, sizeof(new), "%s.%d", filename, x);
00507          fd = open(new, O_RDONLY);
00508          if (fd > -1)
00509             close(fd);
00510          else
00511             break;
00512       }
00513       if (rename(filename, new)) {
00514          fprintf(stderr, "Unable to rename file '%s' to '%s'\n", filename, new);
00515          res = -1;
00516       }
00517       break;
00518    case TIMESTAMP:
00519       snprintf(new, sizeof(new), "%s.%ld", filename, (long)time(NULL));
00520       if (rename(filename, new)) {
00521          fprintf(stderr, "Unable to rename file '%s' to '%s'\n", filename, new);
00522          res = -1;
00523       }
00524       break;
00525    case ROTATE:
00526       /* Find the next empty slot, including a possible suffix */
00527       for (x = 0; ; x++) {
00528          found = 0;
00529          for (which = 0; which < ARRAY_LEN(suffixes); which++) {
00530             snprintf(new, sizeof(new), "%s.%d%s", filename, x, suffixes[which]);
00531             fd = open(new, O_RDONLY);
00532             if (fd > -1) {
00533                close(fd);
00534                found = 1;
00535                break;
00536             }
00537          }
00538          if (!found) {
00539             break;
00540          }
00541       }
00542 
00543       /* Found an empty slot */
00544       for (y = x; y > 0; y--) {
00545          for (which = 0; which < ARRAY_LEN(suffixes); which++) {
00546             snprintf(old, sizeof(old), "%s.%d%s", filename, y - 1, suffixes[which]);
00547             fd = open(old, O_RDONLY);
00548             if (fd > -1) {
00549                /* Found the right suffix */
00550                close(fd);
00551                snprintf(new, sizeof(new), "%s.%d%s", filename, y, suffixes[which]);
00552                if (rename(old, new)) {
00553                   fprintf(stderr, "Unable to rename file '%s' to '%s'\n", old, new);
00554                   res = -1;
00555                }
00556                break;
00557             }
00558          }
00559       }
00560 
00561       /* Finally, rename the current file */
00562       snprintf(new, sizeof(new), "%s.0", filename);
00563       if (rename(filename, new)) {
00564          fprintf(stderr, "Unable to rename file '%s' to '%s'\n", filename, new);
00565          res = -1;
00566       }
00567    }
00568 
00569    if (!ast_strlen_zero(exec_after_rotate)) {
00570       struct ast_channel *c = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Logger/rotate");
00571       char buf[512];
00572       pbx_builtin_setvar_helper(c, "filename", filename);
00573       pbx_substitute_variables_helper(c, exec_after_rotate, buf, sizeof(buf));
00574       if (ast_safe_system(buf) == -1) {
00575          ast_log(LOG_WARNING, "error executing '%s'\n", buf);
00576       }
00577       ast_channel_free(c);
00578    }
00579    return res;


Variable Documentation

struct ast_cli_entry cli_logger[] [static]

Definition at line 818 of file logger.c.

Referenced by init_logger().

int close_logger_thread = 0 [static]

Definition at line 147 of file logger.c.

Referenced by close_logger(), and logger_thread().

int colors[] [static]

Colors used in the console for logging.

Definition at line 164 of file logger.c.

Referenced by logger_print_normal().

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

Definition at line 88 of file logger.c.

Referenced by build_device().

unsigned int event_log

Definition at line 104 of file logger.c.

FILE* eventlog [static]

Definition at line 149 of file logger.c.

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

char exec_after_rotate[256] = "" [static]

Definition at line 91 of file logger.c.

int filesize_reload_needed [static]

Definition at line 93 of file logger.c.

int global_logmask = -1 [static]

Definition at line 94 of file logger.c.

char hostname[MAXHOSTNAMELEN] [static]

Definition at line 107 of file logger.c.

Referenced by app_exec(), ast_readconfig(), ast_remotecontrol(), cli_prompt(), iax2_register(), netconsole(), set_destination(), sip_register(), and tds_load_module().

char* levels[] [static]

Logging channels used in the Asterisk logging system.

Definition at line 153 of file logger.c.

Referenced by ast_console_toggle_loglevel(), ast_log_vsyslog(), ast_network_puts_mutable(), handle_logger_set_level(), and logger_print_normal().

struct ast_threadstorage log_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_log_buf , .custom_init = NULL , } [static]

Definition at line 177 of file logger.c.

Referenced by ast_log().

ast_cond_t logcond [static]

Definition at line 146 of file logger.c.

Referenced by __ast_verbose_ap(), ast_log(), close_logger(), init_logger(), and logger_thread().

struct { ... } logfiles [static]

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

pthread_t logthread = AST_PTHREADT_NULL [static]

Definition at line 145 of file logger.c.

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

FILE* qlog [static]

Definition at line 150 of file logger.c.

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

unsigned int queue_log

Definition at line 103 of file logger.c.

char queue_log_name[256] = QUEUELOG [static]

Definition at line 90 of file logger.c.

int syslog_level_map[] [static]

Definition at line 53 of file logger.c.

struct ast_threadstorage verbose_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_verbose_buf , .custom_init = NULL , } [static]

Definition at line 174 of file logger.c.

Referenced by __ast_verbose_ap().


Generated on Wed Aug 18 22:34:26 2010 for Asterisk - the Open Source PBX by  doxygen 1.4.7