Top level source file for Asterisk - the Open Source PBX. Implementation of PBX core functions and CLI interface. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include <sys/time.h>
#include <fcntl.h>
#include <signal.h>
#include <sched.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <ctype.h>
#include <sys/resource.h>
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
#include <sys/sysinfo.h>
#include <regex.h>
#include "asterisk/paths.h"
#include "asterisk/network.h"
#include "asterisk/cli.h"
#include "asterisk/channel.h"
#include "asterisk/features.h"
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
#include "asterisk/callerid.h"
#include "asterisk/image.h"
#include "asterisk/tdd.h"
#include "asterisk/term.h"
#include "asterisk/manager.h"
#include "asterisk/cdr.h"
#include "asterisk/cel.h"
#include "asterisk/pbx.h"
#include "asterisk/enum.h"
#include "asterisk/http.h"
#include "asterisk/udptl.h"
#include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/file.h"
#include "asterisk/io.h"
#include "editline/histedit.h"
#include "asterisk/config.h"
#include "asterisk/ast_version.h"
#include "asterisk/linkedlists.h"
#include "asterisk/devicestate.h"
#include "asterisk/module.h"
#include "asterisk/dsp.h"
#include "asterisk/buildinfo.h"
#include "asterisk/xmldoc.h"
#include "asterisk/poll-compat.h"
#include "asterisk/ccss.h"
#include "asterisk/test.h"
#include "asterisk/aoc.h"
#include "../defaults.h"
Go to the source code of this file.
Data Structures | |
struct | _cfg_paths |
struct | ast_atexit |
struct | atexits |
struct | console |
struct | file_version |
struct | file_versions |
struct | profile_data |
struct | profile_entry |
struct | thread_list |
struct | thread_list_t |
Macros | |
#define | AF_LOCAL AF_UNIX |
#define | AST_MAX_CONNECTS 128 |
#define | ASTERISK_PROMPT "*CLI> " |
#define | ASTERISK_PROMPT2 "%s*CLI> " |
#define | DEFINE_PROFILE_MIN_MAX_VALUES |
#define | EL_BUF_SIZE 512 |
#define | FORMAT "%-25.25s %-40.40s\n" |
#define | MAX_HISTORY_COMMAND_LENGTH 256 |
#define | NUM_MSGS 64 |
#define | PF_LOCAL PF_UNIX |
#define | WELCOME_MESSAGE |
Welcome message when starting a CLI interface. More... | |
Enumerations | |
enum | shutdown_nice_t { NOT_SHUTTING_DOWN = -2, SHUTTING_DOWN = -1, SHUTDOWN_FAST, SHUTDOWN_NORMAL, SHUTDOWN_NICE, SHUTDOWN_REALLY_NICE } |
Functions | |
static void | __ast_unregister_atexit (void(*func)(void)) |
static void | __quit_handler (int num) |
static void | __remote_quit_handler (int num) |
static void | _child_handler (int sig) |
static void | _hup_handler (int num) |
static void | _null_sig_handler (int sig) |
NULL handler so we can collect the child exit status. More... | |
static void | _urg_handler (int num) |
Urgent handler. More... | |
int | ast_add_profile (const char *name, uint64_t scale) |
allocates a counter with a given name and scale. More... | |
static int | ast_all_zeros (char *s) |
static int | ast_cli_display_match_list (char **matches, int len, int max) |
char * | ast_complete_source_filename (const char *partial, int n) |
void | ast_console_puts (const char *string) |
void | ast_console_puts_mutable (const char *string, int level) |
log the string to the console, and all attached console clients More... | |
void | ast_console_toggle_loglevel (int fd, int level, int state) |
enable or disable a logging level to a specified console More... | |
void | ast_console_toggle_mute (int fd, int silent) |
mute or unmute a console from logging More... | |
static int | ast_el_add_history (char *) |
static int | ast_el_initialize (void) |
static int | ast_el_read_char (EditLine *editline, char *cp) |
static int | ast_el_read_history (char *) |
static int | ast_el_sort_compare (const void *i1, const void *i2) |
static char ** | ast_el_strtoarr (char *buf) |
static int | ast_el_write_history (char *) |
const char * | ast_file_version_find (const char *file) |
Find version for given module name. More... | |
static int | ast_makesocket (void) |
int64_t | ast_mark (int i, int startstop) |
static void | ast_network_puts (const char *string) |
write the string to all attached console clients More... | |
static void | ast_network_puts_mutable (const char *string, int level) |
log the string to all attached console clients More... | |
int64_t | ast_profile (int i, int64_t delta) |
static void | ast_readconfig (void) |
int | ast_register_atexit (void(*func)(void)) |
Register a function to be executed before Asterisk exits. More... | |
int | ast_register_cleanup (void(*func)(void)) |
Register a function to be executed before Asterisk gracefully exits. More... | |
void | ast_register_file_version (const char *file, const char *version) |
Register the version of a source code file with the core. More... | |
void | ast_register_thread (char *name) |
static void | ast_remotecontrol (char *data) |
void | ast_replace_sigchld (void) |
Replace the SIGCHLD handler. More... | |
static void | ast_run_atexits (int run_cleanups) |
int | ast_safe_system (const char *s) |
Safely spawn an external program while closing file descriptors. More... | |
int | ast_set_priority (int pri) |
We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy activity on it, this is a good thing. More... | |
static int | ast_tryconnect (void) |
void | ast_unregister_atexit (void(*func)(void)) |
Unregister a function registered with ast_register_atexit(). More... | |
void | ast_unregister_file_version (const char *file) |
Unregister a source code file from the core. More... | |
void | ast_unregister_thread (void *id) |
void | ast_unreplace_sigchld (void) |
Restore the SIGCHLD handler. More... | |
static int | can_safely_quit (shutdown_nice_t niceness, int restart) |
static void | canary_exit (void) |
static void * | canary_thread (void *unused) |
static char * | cli_complete (EditLine *editline, int ch) |
static char * | cli_prompt (EditLine *editline) |
static void | console_verboser (const char *s) |
static void | consolehandler (char *s) |
static void | destroy_match_list (char **match_list, int matches) |
static void | env_init (void) |
static int | fdprint (int fd, const char *s) |
static int | fdsend (int fd, const char *s) |
static const char * | fix_header (char *outbuf, int maxout, const char *s, char *cmp) |
static char * | handle_abort_shutdown (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_bang (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_clear_profile (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_restart_gracefully (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_restart_now (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_restart_when_convenient (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_show_profile (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_show_settings (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Give an overview of core settings. More... | |
static char * | handle_show_sysinfo (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Give an overview of system statistics. More... | |
static char * | handle_show_threads (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_show_version_files (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to list module versions. More... | |
static char * | handle_stop_gracefully (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_stop_now (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_stop_when_convenient (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_version (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void * | listener (void *unused) |
int | main (int argc, char *argv[]) |
static void | main_atexit (void) |
static void * | monitor_sig_flags (void *unused) |
static void * | netconsole (void *vconsole) |
static void | network_verboser (const char *s) |
static void | print_intro_message (const char *runuser, const char *rungroup) |
static void | quit_handler (int num, shutdown_nice_t niceness, int restart) |
static __inline uint64_t | rdtsc (void) |
static int | read_credentials (int fd, char *buffer, size_t size, struct console *con) |
read() function supporting the reception of user credentials. More... | |
static void | really_quit (int num, shutdown_nice_t niceness, int restart) |
static int | register_atexit (void(*func)(void), int is_cleanup) |
static int | remoteconsolehandler (char *s) |
static void | run_startup_commands (void) |
static void | set_icon (char *text) |
static void | set_title (char *text) |
Set an X-term or screen title. More... | |
static void | set_ulimit (int value) |
Set maximum open files. More... | |
static int | show_cli_help (void) |
static char * | show_license (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | show_version (void) |
static char * | show_warranty (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Variables | |
static char * | _argv [256] |
struct ast_flags | ast_compat = { 0 } |
const char * | ast_config_AST_AGI_DIR = cfg_paths.agi_dir |
const char * | ast_config_AST_CONFIG_DIR = cfg_paths.config_dir |
const char * | ast_config_AST_CONFIG_FILE = cfg_paths.config_file |
static char | ast_config_AST_CTL [PATH_MAX] = "asterisk.ctl" |
static char | ast_config_AST_CTL_GROUP [PATH_MAX] = "\0" |
static char | ast_config_AST_CTL_OWNER [PATH_MAX] = "\0" |
static char | ast_config_AST_CTL_PERMISSIONS [PATH_MAX] |
const char * | ast_config_AST_DATA_DIR = cfg_paths.data_dir |
const char * | ast_config_AST_DB = cfg_paths.db_path |
const char * | ast_config_AST_KEY_DIR = cfg_paths.key_dir |
const char * | ast_config_AST_LOG_DIR = cfg_paths.log_dir |
const char * | ast_config_AST_MODULE_DIR = cfg_paths.module_dir |
const char * | ast_config_AST_MONITOR_DIR = cfg_paths.monitor_dir |
const char * | ast_config_AST_PID = cfg_paths.pid_path |
const char * | ast_config_AST_RUN_DIR = cfg_paths.run_dir |
const char * | ast_config_AST_RUN_GROUP = cfg_paths.run_group |
const char * | ast_config_AST_RUN_USER = cfg_paths.run_user |
const char * | ast_config_AST_SOCKET = cfg_paths.socket_path |
const char * | ast_config_AST_SPOOL_DIR = cfg_paths.spool_dir |
const char * | ast_config_AST_SYSTEM_NAME = cfg_paths.system_name |
const char * | ast_config_AST_VAR_DIR = cfg_paths.var_dir |
static int | ast_consock = -1 |
struct ast_eid | ast_eid_default |
Global EID. More... | |
unsigned int | ast_FD_SETSIZE |
struct timeval | ast_lastreloadtime |
pid_t | ast_mainpid |
struct ast_flags | ast_options = { AST_DEFAULT_OPTIONS } |
static int | ast_socket = -1 |
struct timeval | ast_startuptime |
static struct atexits | atexits = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, 1 } , } |
static char | canary_filename [128] |
static int | canary_pid = 0 |
static struct _cfg_paths | cfg_paths |
static struct sigaction | child_handler |
static struct ast_cli_entry | cli_asterisk [] |
static struct ast_cli_entry | cli_asterisk_shutdown [] |
Shutdown Asterisk CLI commands. More... | |
struct console | consoles [AST_MAX_CONNECTS] |
static pthread_t | consolethread = AST_PTHREADT_NULL |
char | defaultlanguage [MAX_LANGUAGE] = DEFAULT_LANGUAGE |
static EditLine * | el |
static History * | el_hist |
static struct file_versions | file_versions = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, 1 } , } |
static struct sigaction | hup_handler |
static struct sigaction | ignore_sig_handler |
static const char | license_lines [] |
static pthread_t | lthread |
static pthread_t | mon_sig_flags |
static int | multi_thread_safe |
static struct sigaction | null_sig_handler |
int | option_debug |
int | option_maxcalls |
int | option_maxfiles |
double | option_maxload |
long | option_minmemfree |
int | option_verbose |
static struct profile_data * | prof_data |
static struct ast_str * | prompt = NULL |
static char | randompool [256] |
char | record_cache_dir [AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR |
static char * | remotehostname |
static int | restartnow |
static unsigned int | safe_system_level = 0 |
Keep track of how many threads are currently trying to wait*() on a child process. More... | |
static ast_mutex_t | safe_system_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, 1 } |
static struct sigaction | safe_system_prev_handler |
static shutdown_nice_t | shuttingdown = NOT_SHUTTING_DOWN |
static int | sig_alert_pipe [2] = { -1, -1 } |
struct { | |
unsigned int need_quit:1 | |
unsigned int need_quit_handler:1 | |
unsigned int need_reload:1 | |
} | sig_flags |
static struct thread_list | thread_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, 1 } , } |
static struct sigaction | urg_handler |
static const char | warranty_lines [] |
Top level source file for Asterisk - the Open Source PBX. Implementation of PBX core functions and CLI interface.
Definition in file asterisk.c.
#define AF_LOCAL AF_UNIX |
Definition at line 154 of file asterisk.c.
Referenced by ast_makesocket(), ast_tryconnect(), and listener().
#define AST_MAX_CONNECTS 128 |
Definition at line 158 of file asterisk.c.
Referenced by ast_console_toggle_loglevel(), ast_console_toggle_mute(), ast_makesocket(), ast_network_puts(), ast_network_puts_mutable(), and listener().
#define ASTERISK_PROMPT "*CLI> " |
Definition at line 2257 of file asterisk.c.
Referenced by cli_prompt().
#define ASTERISK_PROMPT2 "%s*CLI> " |
Definition at line 2259 of file asterisk.c.
Referenced by cli_prompt().
#define DEFINE_PROFILE_MIN_MAX_VALUES |
Definition at line 791 of file asterisk.c.
Referenced by handle_clear_profile(), and handle_show_profile().
#define EL_BUF_SIZE 512 |
Referenced by ast_el_read_char().
#define FORMAT "%-25.25s %-40.40s\n" |
Referenced by handle_show_version_files().
#define MAX_HISTORY_COMMAND_LENGTH 256 |
Definition at line 2802 of file asterisk.c.
Referenced by ast_el_add_history(), and ast_el_read_history().
#define NUM_MSGS 64 |
Definition at line 159 of file asterisk.c.
#define PF_LOCAL PF_UNIX |
Definition at line 155 of file asterisk.c.
Referenced by ast_makesocket(), and ast_tryconnect().
#define WELCOME_MESSAGE |
Welcome message when starting a CLI interface.
Definition at line 162 of file asterisk.c.
Referenced by ast_el_read_char(), and print_intro_message().
enum shutdown_nice_t |
Enumerator | |
---|---|
NOT_SHUTTING_DOWN | |
SHUTTING_DOWN | |
SHUTDOWN_FAST | |
SHUTDOWN_NORMAL | |
SHUTDOWN_NICE | |
SHUTDOWN_REALLY_NICE |
Definition at line 283 of file asterisk.c.
|
static |
Definition at line 965 of file asterisk.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_atexit::func, and ast_atexit::list.
Referenced by ast_unregister_atexit(), and register_atexit().
|
static |
Definition at line 1864 of file asterisk.c.
References errno, sig_alert_pipe, and sig_flags.
Referenced by main().
|
static |
Definition at line 1877 of file asterisk.c.
References sig_flags.
Referenced by ast_remotecontrol().
|
static |
Definition at line 1592 of file asterisk.c.
|
static |
Definition at line 1571 of file asterisk.c.
References _argv, errno, restartnow, sig_alert_pipe, and sig_flags.
|
static |
NULL handler so we can collect the child exit status.
Definition at line 1028 of file asterisk.c.
|
static |
Urgent handler.
Called by soft_hangup to interrupt the poll, read, or other system call. We don't actually need to do anything though. Remember: Cannot EVER ast_log from within a signal handler
Definition at line 1561 of file asterisk.c.
int ast_add_profile | ( | const char * | name, |
uint64_t | scale | ||
) |
allocates a counter with a given name and scale.
support for event profiling
Definition at line 710 of file asterisk.c.
References ast_calloc, ast_realloc, ast_strdup, profile_data::e, profile_data::entries, profile_entry::events, profile_entry::mark, profile_data::max_size, profile_entry::name, prof_data, profile_entry::scale, and profile_entry::value.
Referenced by extension_match_core().
|
static |
Definition at line 1924 of file asterisk.c.
Referenced by ast_el_read_history(), consolehandler(), and remoteconsolehandler().
|
static |
Definition at line 2594 of file asterisk.c.
References ast_el_sort_compare(), ast_free, and ast_get_termcols().
Referenced by cli_complete().
char* ast_complete_source_filename | ( | const char * | partial, |
int | n | ||
) |
Definition at line 357 of file asterisk.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdup, len(), and ast_atexit::list.
Referenced by handle_verbose().
void ast_console_puts | ( | const char * | string | ) |
write the string to the console, and all attached console clients
Definition at line 1222 of file asterisk.c.
References ast_network_puts().
void ast_console_puts_mutable | ( | const char * | string, |
int | level | ||
) |
log the string to the console, and all attached console clients
Definition at line 1199 of file asterisk.c.
References ast_network_puts_mutable().
Referenced by init_logger_chain(), logger_print_normal(), and make_logchannel().
void ast_console_toggle_loglevel | ( | int | fd, |
int | level, | ||
int | state | ||
) |
enable or disable a logging level to a specified console
enables or disables logging of a specified level to the console fd specifies the index of the console receiving the level change level specifies the index of the logging level being toggled state indicates whether logging will be on or off (0 for off, 1 for on)
Definition at line 1136 of file asterisk.c.
References AST_MAX_CONNECTS, consoles, console::levels, and NUMLOGLEVELS.
Referenced by handle_logger_set_level().
void ast_console_toggle_mute | ( | int | fd, |
int | silent | ||
) |
mute or unmute a console from logging
Definition at line 1159 of file asterisk.c.
References ast_cli(), AST_MAX_CONNECTS, consoles, mute, and console::mute.
Referenced by handle_logger_mute().
|
static |
Definition at line 2804 of file asterisk.c.
References ast_el_initialize(), ast_strdupa, ast_strip(), el, el_hist, and MAX_HISTORY_COMMAND_LENGTH.
Referenced by ast_el_read_history(), consolehandler(), and remoteconsolehandler().
|
static |
Definition at line 2767 of file asterisk.c.
References cli_complete(), cli_prompt(), el, and el_hist.
Referenced by ast_el_add_history(), ast_el_read_history(), ast_el_write_history(), ast_remotecontrol(), and main().
|
static |
Definition at line 2296 of file asterisk.c.
References ast_consock, ast_opt_exec, ast_opt_mute, ast_opt_reconnect, ast_poll, ast_tryconnect(), EL_BUF_SIZE, errno, fdsend(), quit_handler(), SHUTDOWN_FAST, sig_flags, term_quit(), and WELCOME_MESSAGE.
Referenced by ast_remotecontrol(), and main().
|
static |
Definition at line 2825 of file asterisk.c.
References ast_all_zeros(), ast_el_add_history(), ast_el_initialize(), el, el_hist, f, and MAX_HISTORY_COMMAND_LENGTH.
Referenced by ast_remotecontrol(), and main().
|
static |
Definition at line 2584 of file asterisk.c.
Referenced by ast_cli_display_match_list().
|
static |
Definition at line 2536 of file asterisk.c.
References AST_CLI_COMPLETE_EOF, ast_realloc, ast_strdup, destroy_match_list(), and strsep().
Referenced by cli_complete().
|
static |
Definition at line 2815 of file asterisk.c.
References ast_el_initialize(), el, and el_hist.
Referenced by really_quit().
const char* ast_file_version_find | ( | const char * | file | ) |
Find version for given module name.
file | Module name (i.e. chan_sip.so) |
Definition at line 376 of file asterisk.c.
References AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_atexit::list.
Referenced by manager_modulecheck().
|
static |
Definition at line 1460 of file asterisk.c.
References AF_LOCAL, ast_config_AST_CTL_GROUP, ast_config_AST_CTL_OWNER, ast_config_AST_CTL_PERMISSIONS, ast_config_AST_SOCKET, ast_copy_string(), ast_log(), AST_MAX_CONNECTS, ast_pthread_create_background, ast_register_verbose(), ast_strlen_zero(), consoles, errno, listener(), LOG_WARNING, lthread, network_verboser(), and PF_LOCAL.
Referenced by main().
int64_t ast_mark | ( | int | i, |
int | startstop | ||
) |
Definition at line 775 of file asterisk.c.
References profile_data::e, profile_data::entries, profile_entry::events, profile_entry::mark, prof_data, rdtsc(), profile_entry::scale, and profile_entry::value.
Referenced by __ast_pthread_mutex_lock(), and extension_match_core().
|
static |
write the string to all attached console clients
Definition at line 1209 of file asterisk.c.
References AST_MAX_CONNECTS, consoles, and fdprint().
Referenced by ast_console_puts().
|
static |
log the string to all attached console clients
Definition at line 1182 of file asterisk.c.
References AST_MAX_CONNECTS, consoles, fdprint(), levels, and mute.
Referenced by ast_console_puts_mutable(), and network_verboser().
int64_t ast_profile | ( | int | i, |
int64_t | delta | ||
) |
Definition at line 740 of file asterisk.c.
References profile_data::e, profile_data::entries, profile_entry::events, prof_data, profile_entry::scale, and profile_entry::value.
|
static |
Definition at line 3042 of file asterisk.c.
References _cfg_paths::agi_dir, AST_CACHE_DIR_LEN, AST_COMPAT_APP_SET, AST_COMPAT_DELIM_PBX_REALTIME, AST_COMPAT_DELIM_RES_AGI, ast_config_AST_CONFIG_FILE, ast_config_AST_CTL, ast_config_AST_CTL_GROUP, ast_config_AST_CTL_OWNER, ast_config_AST_CTL_PERMISSIONS, ast_config_AST_SYSTEM_NAME, ast_config_destroy(), ast_config_load2(), ast_copy_string(), ast_eid_default, ast_language_is_prefix, AST_LOCK_TYPE_FLOCK, AST_LOCK_TYPE_LOCKFILE, ast_log(), AST_OPT_FLAG_ALWAYS_FORK, AST_OPT_FLAG_CACHE_RECORD_FILES, AST_OPT_FLAG_CONSOLE, AST_OPT_FLAG_DONT_WARN, AST_OPT_FLAG_DUMP_CORE, AST_OPT_FLAG_EXEC_INCLUDES, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT, AST_OPT_FLAG_HIGH_PRIORITY, AST_OPT_FLAG_INIT_KEYS, AST_OPT_FLAG_LIGHT_BACKGROUND, AST_OPT_FLAG_LOCK_CONFIG_DIR, AST_OPT_FLAG_NO_COLOR, AST_OPT_FLAG_NO_FORK, AST_OPT_FLAG_QUIET, AST_OPT_FLAG_TIMESTAMP, AST_OPT_FLAG_TRANSCODE_VIA_SLIN, AST_OPT_FLAG_TRANSMIT_SILENCE, ast_opt_override_config, ast_opt_remote, ast_set2_flag, ast_set_default_eid(), ast_set_lock_type(), ast_str_to_eid(), ast_strlen_zero(), ast_true(), ast_variable_browse(), ast_verbose(), cfg_paths, config, _cfg_paths::config_dir, CONFIG_FLAG_NOREALTIME, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, _cfg_paths::data_dir, _cfg_paths::db_path, DEFAULT_AGI_DIR, DEFAULT_CONFIG_DIR, DEFAULT_CONFIG_FILE, DEFAULT_DATA_DIR, DEFAULT_DB, DEFAULT_KEY_DIR, DEFAULT_LOG_DIR, DEFAULT_MODULE_DIR, DEFAULT_PID, DEFAULT_RUN_DIR, DEFAULT_SOCKET, DEFAULT_SPOOL_DIR, DEFAULT_VAR_DIR, defaultlanguage, getloadavg(), hostname, _cfg_paths::key_dir, live_dangerously, _cfg_paths::log_dir, LOG_ERROR, LOG_WARNING, MAX_LANGUAGE, MAXHOSTNAMELEN, _cfg_paths::module_dir, _cfg_paths::monitor_dir, ast_variable::name, ast_variable::next, pbx_live_dangerously(), _cfg_paths::pid_path, _cfg_paths::run_dir, _cfg_paths::run_group, _cfg_paths::run_user, set_ulimit(), _cfg_paths::socket_path, _cfg_paths::spool_dir, _cfg_paths::system_name, ast_variable::value, _cfg_paths::var_dir, and version.
Referenced by main().
int ast_register_atexit | ( | void(*)(void) | func | ) |
Register a function to be executed before Asterisk exits.
func | The callback function to use. |
0 | on success. |
-1 | on error. |
Definition at line 998 of file asterisk.c.
References ast_atexit::func, and register_atexit().
Referenced by __init_manager(), ast_aoc_cli_init(), ast_builtins_init(), ast_cc_init(), ast_cdr_engine_init(), ast_cel_engine_init(), ast_channels_init(), ast_data_init(), ast_event_init(), ast_features_init(), ast_file_init(), ast_http_init(), ast_image_init(), ast_indications_init(), ast_pbx_init(), ast_stun_init(), ast_test_init(), ast_timing_init(), ast_tps_init(), ast_udptl_init(), ast_utils_init(), ast_xmldoc_load_documentation(), astdb_init(), astobj2_init(), dnsmgr_init(), do_reload(), init_framer(), load_module(), load_pbx(), main(), and register_config_cli().
int ast_register_cleanup | ( | void(*)(void) | func | ) |
Register a function to be executed before Asterisk gracefully exits.
func | The callback function to use. |
0 | on success. |
-1 | on error. |
Definition at line 1003 of file asterisk.c.
References ast_atexit::func, and register_atexit().
Referenced by ast_autoservice_init().
void ast_register_file_version | ( | const char * | file, |
const char * | version | ||
) |
Register the version of a source code file with the core.
file | the source file name |
version | the version string (typically a SVN revision keyword string) |
This function should not be called directly, but instead the ASTERISK_FILE_VERSION macro should be used to register a file with the core.
Definition at line 318 of file asterisk.c.
References ast_calloc, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdupa, ast_strip(), ast_strip_quoted(), and ast_atexit::list.
void ast_register_thread | ( | char * | name | ) |
Definition at line 401 of file asterisk.c.
References ast_assert, ast_calloc, AST_RWLIST_INSERT_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_atexit::list, multi_thread_safe, and name.
Referenced by dummy_start().
|
static |
Definition at line 2852 of file asterisk.c.
References __remote_quit_handler(), ast_alloca, ast_consock, ast_el_initialize(), ast_el_read_char(), ast_el_read_history(), ast_log(), ast_opt_exec, ast_opt_mute, ast_poll, ast_strlen_zero(), ast_verbose(), el, el_hist, errno, fdsend(), hostname, LOG_ERROR, LOG_WARNING, prefix, remoteconsolehandler(), remotehostname, sig_flags, strsep(), and version.
Referenced by main().
void ast_replace_sigchld | ( | void | ) |
Replace the SIGCHLD handler.
Normally, Asterisk has a SIGCHLD handler that is cleaning up all zombie processes from forking elsewhere in Asterisk. However, if you want to wait*() on the process to retrieve information about it's exit status, then this signal handler needs to be temporarily replaced.
Code that executes this function must call ast_unreplace_sigchld() after it is finished doing the wait*().
Definition at line 1047 of file asterisk.c.
References ast_mutex_lock, ast_mutex_unlock, null_sig_handler, safe_system_level, safe_system_lock, and safe_system_prev_handler.
Referenced by ast_safe_fork(), and ast_safe_system().
|
static |
Definition at line 951 of file asterisk.c.
References ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_atexit::func, ast_atexit::is_cleanup, and ast_atexit::list.
Referenced by really_quit().
int ast_safe_system | ( | const char * | s | ) |
Safely spawn an external program while closing file descriptors.
Definition at line 1077 of file asterisk.c.
References ast_close_fds_above_n(), ast_log(), ast_opt_high_priority, ast_replace_sigchld(), ast_set_priority(), ast_unreplace_sigchld(), errno, LOG_WARNING, status, WEXITSTATUS, and WIFEXITED.
Referenced by add_email_attachment(), alarmreceiver_exec(), ast_monitor_stop(), consolehandler(), mixmonitor_thread(), notify_message(), process_text_line(), remoteconsolehandler(), rotate_file(), run_externnotify(), sendmail(), sendpage(), system_exec_helper(), and vm_change_password_shell().
int ast_set_priority | ( | int | ) |
We set ourselves to a high priority, that we might pre-empt everything else. If your PBX has heavy activity on it, this is a good thing.
Provided by asterisk.c
Definition at line 1650 of file asterisk.c.
References ast_log(), ast_verbose(), LOG_WARNING, sched_setscheduler, and setpriority.
Referenced by app_exec(), ast_safe_system(), canary_thread(), icesencode(), launch_script(), main(), mp3play(), NBScatplay(), send_waveform_to_fd(), spawn_mp3(), and spawn_ras().
|
static |
Definition at line 1534 of file asterisk.c.
References AF_LOCAL, ast_config_AST_SOCKET, ast_copy_string(), errno, and PF_LOCAL.
Referenced by ast_el_read_char(), and main().
void ast_unregister_atexit | ( | void(*)(void) | func | ) |
Unregister a function registered with ast_register_atexit().
func | The callback function to unregister. |
Definition at line 1008 of file asterisk.c.
References __ast_unregister_atexit(), AST_LIST_LOCK, AST_LIST_UNLOCK, and ast_atexit::func.
Referenced by do_reload(), and unload_module().
void ast_unregister_file_version | ( | const char * | file | ) |
Unregister a source code file from the core.
file | the source file name |
This function should not be called directly, but instead the ASTERISK_FILE_VERSION macro should be used to automatically unregister the file when the module is unloaded.
Definition at line 339 of file asterisk.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_atexit::list.
void ast_unregister_thread | ( | void * | id | ) |
Definition at line 416 of file asterisk.c.
References ast_free, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_atexit::list.
Referenced by dummy_start().
void ast_unreplace_sigchld | ( | void | ) |
Restore the SIGCHLD handler.
This function is called after a call to ast_replace_sigchld. It restores the SIGCHLD handler that cleans up any zombie processes.
Definition at line 1062 of file asterisk.c.
References ast_mutex_lock, ast_mutex_unlock, safe_system_level, safe_system_lock, and safe_system_prev_handler.
Referenced by ast_safe_fork_cleanup(), and ast_safe_system().
|
static |
Definition at line 1696 of file asterisk.c.
References ast_begin_shutdown(), ast_cdr_engine_term(), ast_mutex_lock, ast_mutex_unlock, ast_opt_console, ast_undestroyed_channels(), ast_verbose(), NOT_SHUTTING_DOWN, safe_system_lock, SHUTDOWN_NICE, SHUTDOWN_NORMAL, SHUTDOWN_REALLY_NICE, SHUTTING_DOWN, and shuttingdown.
Referenced by quit_handler().
|
static |
|
static |
Definition at line 3318 of file asterisk.c.
References ast_log(), ast_set_priority(), ast_tvnow(), canary_filename, and LOG_WARNING.
Referenced by main().
|
static |
Definition at line 2642 of file asterisk.c.
References AST_CLI_COMPLETE_EOF, ast_cli_completion_matches(), ast_cli_display_match_list(), ast_el_strtoarr(), ast_free, ast_malloc, ast_opt_remote, ast_realloc, fdsend(), and if().
Referenced by ast_el_initialize().
|
static |
Definition at line 2397 of file asterisk.c.
References ast_config_AST_SYSTEM_NAME, ast_localtime(), ast_opt_remote, ast_str_append(), ast_str_buffer(), ast_str_create(), ast_str_reset(), ast_str_set(), ast_strftime(), ast_tvnow(), ASTERISK_PROMPT, ASTERISK_PROMPT2, COLOR_BLACK, COLOR_WHITE, getloadavg(), hostname, ast_atexit::list, MAXHOSTNAMELEN, remotehostname, and term_color_code().
Referenced by ast_el_initialize().
|
static |
Definition at line 1899 of file asterisk.c.
References ast_opt_console, AST_PTHREADT_NULL, consolethread, fix_header(), VERBOSE_PREFIX_1, VERBOSE_PREFIX_2, VERBOSE_PREFIX_3, and VERBOSE_PREFIX_4.
Referenced by print_intro_message().
|
static |
Definition at line 1934 of file asterisk.c.
References ast_all_zeros(), ast_el_add_history(), ast_safe_system(), and term_end().
Referenced by main().
|
static |
|
static |
Definition at line 3381 of file asterisk.c.
References ast_build_date, ast_build_hostname, ast_build_kernel, ast_build_machine, ast_build_os, ast_build_user, ast_config_AST_SYSTEM_NAME, ast_get_version(), and setenv().
Referenced by main().
|
static |
Definition at line 1022 of file asterisk.c.
Referenced by ast_network_puts(), ast_network_puts_mutable(), listener(), and netconsole().
|
static |
Definition at line 1016 of file asterisk.c.
Referenced by ast_el_read_char(), ast_remotecontrol(), and cli_complete().
|
static |
Definition at line 1882 of file asterisk.c.
References COLOR_GRAY, and term_color().
Referenced by console_verboser().
|
static |
Definition at line 2130 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cancel_shutdown(), ast_mutex_lock, ast_mutex_unlock, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NOT_SHUTTING_DOWN, safe_system_lock, SHUTDOWN_FAST, shuttingdown, and ast_cli_entry::usage.
|
static |
Definition at line 2162 of file asterisk.c.
References CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, and ast_cli_entry::usage.
|
static |
Definition at line 839 of file asterisk.c.
References CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, DEFINE_PROFILE_MIN_MAX_VALUES, profile_data::e, profile_entry::events, profile_entry::name, prof_data, ast_cli_entry::usage, and profile_entry::value.
|
static |
Definition at line 2090 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, quit_handler(), SHUTDOWN_NICE, and ast_cli_entry::usage.
|
static |
Definition at line 2070 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, quit_handler(), SHUTDOWN_NORMAL, and ast_cli_entry::usage.
|
static |
Definition at line 2110 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, quit_handler(), SHUTDOWN_REALLY_NICE, and ast_cli_entry::usage.
|
static |
Definition at line 804 of file asterisk.c.
References ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, DEFINE_PROFILE_MIN_MAX_VALUES, profile_data::e, profile_data::entries, profile_entry::events, ast_cli_args::fd, profile_data::max_size, profile_entry::name, prof_data, profile_entry::scale, ast_cli_entry::usage, and profile_entry::value.
|
static |
Give an overview of core settings.
Definition at line 436 of file asterisk.c.
References ast_active_channels(), ast_build_date, ast_build_kernel, ast_build_machine, ast_build_os, ast_build_user, AST_BUILDOPTS, ast_cli(), ast_config_AST_AGI_DIR, ast_config_AST_CONFIG_DIR, ast_config_AST_CONFIG_FILE, ast_config_AST_DATA_DIR, ast_config_AST_DB, ast_config_AST_KEY_DIR, ast_config_AST_LOG_DIR, ast_config_AST_MODULE_DIR, ast_config_AST_PID, ast_config_AST_RUN_DIR, ast_config_AST_RUN_GROUP, ast_config_AST_RUN_USER, ast_config_AST_SPOOL_DIR, ast_config_AST_SYSTEM_NAME, ast_config_AST_VAR_DIR, ast_eid_default, ast_eid_to_str(), ast_get_version(), ast_language_is_prefix, ast_lastreloadtime, ast_localtime(), AST_OPT_FLAG_EXEC_INCLUDES, AST_OPT_FLAG_GENERIC_PLC, AST_OPT_FLAG_TRANSCODE_VIA_SLIN, AST_OPT_FLAG_TRANSMIT_SILENCE, ast_realtime_enabled(), ast_startuptime, ast_strftime(), ast_test_flag, check_cdr_enabled(), check_manager_enabled(), check_webmanager_enabled(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, defaultlanguage, ast_cli_args::fd, S_OR, and ast_cli_entry::usage.
|
static |
Give an overview of system statistics.
Definition at line 593 of file asterisk.c.
References ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, len(), and ast_cli_entry::usage.
|
static |
Definition at line 521 of file asterisk.c.
References ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_atexit::list, and ast_cli_entry::usage.
|
static |
CLI command to list module versions.
Definition at line 868 of file asterisk.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_strdup, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, FORMAT, ast_atexit::list, ast_cli_args::n, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 2030 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, quit_handler(), SHUTDOWN_NICE, and ast_cli_entry::usage.
|
static |
Definition at line 2011 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, quit_handler(), SHUTDOWN_NORMAL, and ast_cli_entry::usage.
|
static |
Definition at line 2050 of file asterisk.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, quit_handler(), SHUTDOWN_REALLY_NICE, and ast_cli_entry::usage.
|
static |
Definition at line 1980 of file asterisk.c.
References ast_cli_args::argc, ast_build_date, ast_build_hostname, ast_build_machine, ast_build_os, ast_build_user, ast_cli(), ast_get_version(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, and ast_cli_entry::usage.
|
static |
Definition at line 1383 of file asterisk.c.
References AF_LOCAL, ast_log(), AST_MAX_CONNECTS, ast_opt_hide_connect, ast_poll, ast_pthread_create_detached_background, ast_socket, ast_verb, consoles, errno, console::fd, fdprint(), console::gid, len(), LOG_ERROR, LOG_WARNING, console::mute, netconsole(), and console::uid.
Referenced by ast_makesocket().
int main | ( | int | argc, |
char * | argv[] | ||
) |
< Result from the module load subsystem
Definition at line 3415 of file asterisk.c.
References __ast_mm_init_phase_1(), __ast_mm_init_phase_2(), __quit_handler(), _argv, ARRAY_LEN, ast_alaw_init(), ast_aoc_cli_init(), ast_autoservice_init(), ast_builtins_init(), ast_cc_init(), ast_cdr_engine_init(), ast_cel_engine_init(), ast_channels_init(), ast_clear_flag, ast_cli_perms_init(), ast_cli_register_multiple(), ast_close_fds_above_n(), ast_config_AST_PID, ast_config_AST_RUN_DIR, ast_config_AST_RUN_GROUP, ast_config_AST_RUN_USER, ast_config_AST_SOCKET, ast_copy_string(), ast_data_init(), ast_device_state_engine_init(), ast_dsp_init(), ast_el_initialize(), ast_el_read_char(), ast_el_read_history(), ast_enum_init(), ast_event_init(), ast_fd_init(), ast_FD_SETSIZE, ast_FDMAX, ast_features_init(), ast_file_init(), ast_http_init(), ast_image_init(), ast_indications_init(), ast_language_is_prefix, ast_lastreloadtime, ast_log(), ast_makesocket(), ast_opt_always_fork, ast_opt_console, ast_opt_dump_core, ast_opt_exec, AST_OPT_FLAG_ALWAYS_FORK, AST_OPT_FLAG_CACHE_RECORD_FILES, AST_OPT_FLAG_CONSOLE, AST_OPT_FLAG_DUMP_CORE, AST_OPT_FLAG_EXEC, AST_OPT_FLAG_EXEC_INCLUDES, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND, AST_OPT_FLAG_FULLY_BOOTED, AST_OPT_FLAG_HIGH_PRIORITY, AST_OPT_FLAG_INIT_KEYS, AST_OPT_FLAG_LIGHT_BACKGROUND, AST_OPT_FLAG_MUTE, AST_OPT_FLAG_NO_COLOR, AST_OPT_FLAG_NO_FORK, AST_OPT_FLAG_OVERRIDE_CONFIG, AST_OPT_FLAG_QUIET, AST_OPT_FLAG_RECONNECT, AST_OPT_FLAG_REMOTE, AST_OPT_FLAG_TIMESTAMP, ast_opt_high_priority, ast_opt_no_fork, ast_opt_remote, ast_pbx_init(), ast_process_pending_reloads(), ast_pthread_create_detached, ast_readconfig(), ast_register_atexit(), ast_remotecontrol(), ast_select(), ast_set_flag, ast_set_priority(), ast_ssl_init(), ast_startuptime, ast_strdupa, ast_strlen_zero(), ast_stun_init(), ast_term_init(), ast_test_flag, ast_test_init(), ast_timing_init(), ast_tps_init(), ast_tryconnect(), ast_tvnow(), ast_udptl_init(), ast_ulaw_init(), ast_utils_init(), ast_verbose(), ast_xmldoc_load_documentation(), astdb_init(), astobj2_init(), callerid_init(), canary_exit(), canary_filename, canary_pid, canary_thread(), cfg_paths, COLOR_BLACK, COLOR_BRWHITE, _cfg_paths::config_file, consolehandler(), consolethread, dnsmgr_init(), dnsmgr_start_refresh(), el, el_hist, env_init(), errno, EVENT_FLAG_SYSTEM, f, FD_SET, FD_ZERO, hostname, ignore_sig_handler, init_framer(), init_logger(), init_manager(), load_modules(), load_pbx(), LOG_WARNING, main_atexit(), manager_event, MAXHOSTNAMELEN, mon_sig_flags, monitor_sig_flags(), multi_thread_safe, print_intro_message(), quit_handler(), randompool, read_config_maps(), register_config_cli(), run_startup_commands(), set_icon(), set_title(), show_cli_help(), show_version(), SHUTDOWN_FAST, sig_alert_pipe, sig_flags, _cfg_paths::socket_path, tdd_init(), term_color(), term_end(), term_quit(), and threadstorage_init().
|
static |
Definition at line 3410 of file asterisk.c.
References ARRAY_LEN, and ast_cli_unregister_multiple().
Referenced by main().
|
static |
Definition at line 3292 of file asterisk.c.
References ast_module_reload(), ast_poll, AST_PTHREADT_NULL, consolethread, quit_handler(), SHUTDOWN_NORMAL, sig_alert_pipe, and sig_flags.
Referenced by main().
|
static |
Definition at line 1295 of file asterisk.c.
References ast_cli_command_multiple_full(), ast_copy_string(), ast_get_version(), ast_log(), ast_opt_hide_connect, ast_poll, ast_verb, errno, console::fd, fdprint(), console::gid, hostname, inbuf(), LOG_ERROR, LOG_WARNING, MAXHOSTNAMELEN, console::p, read_credentials(), and console::uid.
Referenced by listener().
|
static |
Definition at line 1229 of file asterisk.c.
References __LOG_VERBOSE, and ast_network_puts_mutable().
Referenced by ast_makesocket().
|
static |
Definition at line 3393 of file asterisk.c.
References ast_opt_console, ast_opt_exec, ast_opt_remote, ast_register_verbose(), ast_verbose(), console_verboser(), and WELCOME_MESSAGE.
Referenced by main().
|
static |
Definition at line 1687 of file asterisk.c.
References can_safely_quit(), and really_quit().
Referenced by ast_el_read_char(), handle_restart_gracefully(), handle_restart_now(), handle_restart_when_convenient(), handle_stop_gracefully(), handle_stop_now(), handle_stop_when_convenient(), main(), monitor_sig_flags(), and remoteconsolehandler().
|
static |
|
static |
read() function supporting the reception of user credentials.
fd | Socket file descriptor. |
buffer | Receive buffer. |
size | 'buffer' size. |
con | Console structure to set received credentials |
-1 | on error |
the | number of bytes received on success. |
Definition at line 1246 of file asterisk.c.
References console::gid, len(), and console::uid.
Referenced by netconsole().
|
static |
Called when exiting is certain.
Definition at line 1763 of file asterisk.c.
References _argv, ast_active_channels(), ast_config_AST_PID, ast_config_AST_SOCKET, ast_debug, ast_el_write_history(), ast_module_shutdown(), ast_opt_console, ast_opt_exec, ast_opt_remote, AST_PTHREADT_NULL, ast_run_atexits(), ast_strlen_zero(), ast_verbose(), clean_time_zones(), close_logger(), consolethread, el, el_hist, EVENT_FLAG_SYSTEM, lthread, manager_event, mon_sig_flags, restartnow, SHUTDOWN_NICE, sig_alert_pipe, and term_quit().
Referenced by quit_handler().
|
static |
Definition at line 979 of file asterisk.c.
References __ast_unregister_atexit(), ast_calloc, AST_LIST_INSERT_HEAD, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_atexit::func, ast_atexit::is_cleanup, and ast_atexit::list.
Referenced by ast_register_atexit(), and ast_register_cleanup().
|
static |
Definition at line 1952 of file asterisk.c.
References ast_all_zeros(), ast_el_add_history(), ast_safe_system(), quit_handler(), and SHUTDOWN_FAST.
Referenced by ast_remotecontrol().
|
static |
Definition at line 3353 of file asterisk.c.
References ast_config_destroy(), ast_config_load2(), ast_true(), ast_variable_browse(), CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, ast_variable::name, ast_variable::next, and ast_variable::value.
Referenced by main().
|
static |
|
static |
|
static |
Set maximum open files.
Definition at line 1613 of file asterisk.c.
References ast_log(), errno, LOG_NOTICE, LOG_WARNING, and value.
Referenced by ast_readconfig().
|
static |
Definition at line 3003 of file asterisk.c.
References ast_get_version().
Referenced by main().
|
static |
Definition at line 2239 of file asterisk.c.
References ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, and ast_cli_entry::usage.
|
static |
Definition at line 2997 of file asterisk.c.
References ast_get_version().
Referenced by main().
|
static |
Definition at line 2202 of file asterisk.c.
References ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, and ast_cli_entry::usage.
|
static |
Definition at line 282 of file asterisk.c.
Referenced by _hup_handler(), main(), and really_quit().
const char* ast_config_AST_AGI_DIR = cfg_paths.agi_dir |
Definition at line 264 of file asterisk.c.
Referenced by handle_show_settings(), and launch_script().
const char* ast_config_AST_CONFIG_DIR = cfg_paths.config_dir |
Definition at line 256 of file asterisk.c.
Referenced by action_createconfig(), ast_module_reload(), compile_script(), config_text_file_load(), handle_cli_dialplan_save(), handle_show_settings(), ices_exec(), launch_script(), lua_read_extensions_file(), make_fn(), message_template_parse_filebody(), pbx_load_module(), setup_filestack(), and while().
const char* ast_config_AST_CONFIG_FILE = cfg_paths.config_file |
Definition at line 257 of file asterisk.c.
Referenced by ast_readconfig(), handle_show_settings(), and launch_script().
|
static |
Definition at line 278 of file asterisk.c.
Referenced by ast_readconfig().
|
static |
Definition at line 277 of file asterisk.c.
Referenced by ast_makesocket(), and ast_readconfig().
|
static |
Definition at line 276 of file asterisk.c.
Referenced by ast_makesocket(), and ast_readconfig().
|
static |
Definition at line 275 of file asterisk.c.
Referenced by ast_makesocket(), and ast_readconfig().
const char* ast_config_AST_DATA_DIR = cfg_paths.data_dir |
Definition at line 262 of file asterisk.c.
Referenced by ast_linear_stream(), ast_xmldoc_load_documentation(), build_filename(), handle_show_settings(), launch_script(), make_filename(), moh_scan_files(), reload_firmware(), setup_privacy_args(), and static_callback().
const char* ast_config_AST_DB = cfg_paths.db_path |
Definition at line 268 of file asterisk.c.
Referenced by dbinit(), and handle_show_settings().
const char* ast_config_AST_KEY_DIR = cfg_paths.key_dir |
Definition at line 265 of file asterisk.c.
Referenced by crypto_load(), handle_cli_keys_init(), handle_show_settings(), launch_script(), and osp_create_provider().
const char* ast_config_AST_LOG_DIR = cfg_paths.log_dir |
Definition at line 263 of file asterisk.c.
Referenced by apply_general_options(), astobj2_init(), csv_log(), dahdi_r2_set_context(), handle_show_settings(), init_logger(), launch_script(), load_config(), load_module(), logger_queue_init(), logger_queue_restart(), make_logchannel(), OpenHistory(), reload_logger(), testclient_exec(), testserver_exec(), write_history(), and writefile().
const char* ast_config_AST_MODULE_DIR = cfg_paths.module_dir |
Definition at line 258 of file asterisk.c.
Referenced by complete_fn(), handle_show_settings(), launch_script(), load_dynamic_module(), and load_modules().
const char* ast_config_AST_MONITOR_DIR = cfg_paths.monitor_dir |
Definition at line 260 of file asterisk.c.
Referenced by ast_monitor_change_fname(), ast_monitor_start(), chanspy_exec(), extenspy_exec(), launch_script(), and mixmonitor_exec().
const char* ast_config_AST_PID = cfg_paths.pid_path |
Definition at line 269 of file asterisk.c.
Referenced by handle_show_settings(), main(), and really_quit().
const char* ast_config_AST_RUN_DIR = cfg_paths.run_dir |
Definition at line 266 of file asterisk.c.
Referenced by handle_show_settings(), launch_script(), and main().
const char* ast_config_AST_RUN_GROUP = cfg_paths.run_group |
Definition at line 272 of file asterisk.c.
Referenced by action_coresettings(), handle_show_settings(), and main().
const char* ast_config_AST_RUN_USER = cfg_paths.run_user |
Definition at line 271 of file asterisk.c.
Referenced by action_coresettings(), handle_show_settings(), and main().
const char* ast_config_AST_SOCKET = cfg_paths.socket_path |
Definition at line 270 of file asterisk.c.
Referenced by ast_makesocket(), ast_tryconnect(), ast_var_Config(), main(), and really_quit().
const char* ast_config_AST_SPOOL_DIR = cfg_paths.spool_dir |
Definition at line 259 of file asterisk.c.
Referenced by app_exec(), conf_run(), dictate_exec(), filename_parse(), handle_show_settings(), launch_script(), load_module(), sms_nextoutgoing(), and sms_writefile().
const char* ast_config_AST_SYSTEM_NAME = cfg_paths.system_name |
Definition at line 273 of file asterisk.c.
Referenced by __ast_channel_alloc_ap(), action_coresettings(), ast_readconfig(), ast_str_retrieve_variable(), cli_prompt(), env_init(), handle_show_settings(), manager_set_defaults(), realtime_update_peer(), and reload_config().
const char* ast_config_AST_VAR_DIR = cfg_paths.var_dir |
Definition at line 261 of file asterisk.c.
Referenced by ael2_semantic_check(), handle_show_settings(), and launch_script().
|
static |
UNIX Socket for controlling another asterisk
Definition at line 198 of file asterisk.c.
Referenced by ast_el_read_char(), and ast_remotecontrol().
struct ast_eid ast_eid_default |
Global EID.
This is set in asterisk.conf, or determined automatically by taking the mac address of an Ethernet interface on the system.
Definition at line 192 of file asterisk.c.
Referenced by aji_devstate_cb(), aji_handle_pubsub_event(), aji_mwi_cb(), aji_publish_device_state(), aji_publish_mwi(), ast_event_append_eid(), ast_event_cb(), ast_readconfig(), ast_str_retrieve_variable(), evt_event_deliver_cb(), handle_show_settings(), and set_config().
struct timeval ast_lastreloadtime |
Definition at line 219 of file asterisk.c.
Referenced by action_corestatus(), ast_module_reload(), ast_var_Config(), handle_show_settings(), handle_showuptime(), and main().
pid_t ast_mainpid |
Definition at line 199 of file asterisk.c.
Referenced by safe_append(), and scan_service().
|
static |
UNIX Socket for allowing remote control
Definition at line 197 of file asterisk.c.
Referenced by listener().
struct timeval ast_startuptime |
Definition at line 218 of file asterisk.c.
Referenced by action_corestatus(), ast_var_Config(), handle_show_settings(), handle_showcalls(), handle_showuptime(), and main().
|
static |
|
static |
Definition at line 297 of file asterisk.c.
Referenced by canary_thread(), and main().
|
static |
Definition at line 296 of file asterisk.c.
Referenced by canary_exit(), and main().
|
static |
Definition at line 254 of file asterisk.c.
Referenced by ast_readconfig(), and main().
|
static |
Definition at line 1607 of file asterisk.c.
|
static |
Definition at line 2278 of file asterisk.c.
|
static |
Shutdown Asterisk CLI commands.
Definition at line 2269 of file asterisk.c.
struct console consoles[AST_MAX_CONNECTS] |
Definition at line 225 of file asterisk.c.
Referenced by ast_console_toggle_loglevel(), ast_console_toggle_mute(), ast_makesocket(), ast_network_puts(), ast_network_puts_mutable(), and listener().
|
static |
Definition at line 294 of file asterisk.c.
Referenced by console_verboser(), main(), monitor_sig_flags(), and really_quit().
char defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE |
Definition at line 227 of file asterisk.c.
Referenced by __ast_channel_alloc_ap(), ast_readconfig(), and handle_show_settings().
|
static |
Definition at line 222 of file asterisk.c.
Referenced by __ast_internal_context_destroy(), ast_add_extension2_lockopt(), ast_el_add_history(), ast_el_initialize(), ast_el_read_history(), ast_el_write_history(), ast_remotecontrol(), handle_cli_dialplan_save(), main(), really_quit(), and show_dialplan_helper().
|
static |
Definition at line 221 of file asterisk.c.
Referenced by ast_el_add_history(), ast_el_initialize(), ast_el_read_history(), ast_el_write_history(), ast_remotecontrol(), main(), and really_quit().
|
static |
|
static |
Definition at line 1587 of file asterisk.c.
|
static |
Definition at line 1037 of file asterisk.c.
Referenced by main().
|
static |
Definition at line 2220 of file asterisk.c.
|
static |
Definition at line 1234 of file asterisk.c.
Referenced by ast_makesocket(), and really_quit().
|
static |
Definition at line 295 of file asterisk.c.
Referenced by main(), and really_quit().
|
static |
Definition at line 298 of file asterisk.c.
Referenced by ast_register_thread(), and main().
unsigned int need_quit |
Definition at line 305 of file asterisk.c.
unsigned int need_quit_handler |
Definition at line 306 of file asterisk.c.
unsigned int need_reload |
Definition at line 304 of file asterisk.c.
|
static |
Definition at line 1032 of file asterisk.c.
Referenced by ast_replace_sigchld().
|
static |
Definition at line 705 of file asterisk.c.
Referenced by ast_add_profile(), ast_mark(), ast_profile(), handle_clear_profile(), and handle_show_profile().
|
static |
Definition at line 2395 of file asterisk.c.
Referenced by auth_exec(), handle_speechrecognize(), minivm_accmess_exec(), and pw_cb().
|
static |
Definition at line 300 of file asterisk.c.
Referenced by main().
char record_cache_dir[AST_CACHE_DIR_LEN] = DEFAULT_TMP_DIR |
Definition at line 195 of file asterisk.c.
Referenced by ast_writefile().
|
static |
Definition at line 223 of file asterisk.c.
Referenced by ast_remotecontrol(), and cli_prompt().
|
static |
Definition at line 293 of file asterisk.c.
Referenced by _hup_handler(), and really_quit().
|
static |
Keep track of how many threads are currently trying to wait*() on a child process.
Definition at line 1044 of file asterisk.c.
Referenced by ast_replace_sigchld(), and ast_unreplace_sigchld().
|
static |
Definition at line 1041 of file asterisk.c.
Referenced by ast_replace_sigchld(), ast_unreplace_sigchld(), can_safely_quit(), and handle_abort_shutdown().
|
static |
Definition at line 1045 of file asterisk.c.
Referenced by ast_replace_sigchld(), and ast_unreplace_sigchld().
|
static |
Definition at line 292 of file asterisk.c.
Referenced by can_safely_quit(), and handle_abort_shutdown().
|
static |
Definition at line 302 of file asterisk.c.
Referenced by __quit_handler(), _hup_handler(), main(), monitor_sig_flags(), and really_quit().
struct { ... } sig_flags |
Referenced by __quit_handler(), __remote_quit_handler(), _hup_handler(), ast_el_read_char(), ast_remotecontrol(), main(), and monitor_sig_flags().
|
static |
|
static |
Definition at line 1566 of file asterisk.c.
|
static |
Definition at line 2177 of file asterisk.c.