Newer
Older
* Asterisk -- An open source telephony toolkit.
* Copyright (C) 1999 - 2005, Digium, Inc.
* Mark Spencer <markster@digium.com>
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/* Doxygenified Copyright Header */
/*!
* \mainpage Asterisk -- An Open Source Telephony Toolkit
*
* \par Developer Documentation for Asterisk
* This is the main developer documentation for Asterisk. It is
* generated by running "make progdocs".
* \par Additional documentation
* \arg \ref DevDoc
* \arg \ref ConfigFiles
*
* \section copyright Copyright and author
*
* Copyright (C) 1999 - 2005, Digium, Inc.
* Asterisk is a trade mark registered by Digium, Inc.
*
* \author Mark Spencer <markster@digium.com>
* Also see \ref AstCREDITS
*
* \section license License
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*
* \verbinclude LICENSE
*
*/
/*! \file
\brief Top level source file for Asterisk - the Open Source PBX. Implementation
of PBX core functions and CLI interface.
*/
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <sched.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/resource.h>
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
#if defined(__FreeBSD__) || defined( __NetBSD__ ) || defined(SOLARIS)
#include <netdb.h>
#endif
Kevin P. Fleming
committed
#include "asterisk.h"
Kevin P. Fleming
committed
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/cli.h"
#include "asterisk/channel.h"
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
#include "asterisk/callerid.h"
#include "asterisk/module.h"
#include "asterisk/image.h"
#include "asterisk/tdd.h"
#include "asterisk/term.h"
#include "asterisk/manager.h"
#include "asterisk/cdr.h"
Kevin P. Fleming
committed
#include "asterisk/pbx.h"
#include "asterisk/enum.h"
#include "asterisk/rtp.h"
#if defined(T38_SUPPORT)
#include "asterisk/udptl.h"
#endif
Kevin P. Fleming
committed
#include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/file.h"
#include "asterisk/io.h"
#include "asterisk/lock.h"
Kevin P. Fleming
committed
#include "asterisk/config.h"
Kevin P. Fleming
committed
#include "asterisk/version.h"
#include "asterisk/linkedlists.h"
Kevin P. Fleming
committed
#include "asterisk/devicestate.h"
Kevin P. Fleming
committed
#include "asterisk/doxyref.h" /* Doxygen documentation */
Kevin P. Fleming
committed
#include "defaults.h"
Mark Spencer
committed
#ifndef AF_LOCAL
#define AF_LOCAL AF_UNIX
#define PF_LOCAL PF_UNIX
#endif
#define AST_MAX_CONNECTS 128
#define NUM_MSGS 64
/*! \brief Welcome message when starting a CLI interface */
ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2006 Digium, Inc. and others.\n"); \
ast_verbose("Created by Mark Spencer <markster@digium.com>\n"); \
ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'show warranty' for details.\n"); \
ast_verbose("This is free software, with components licensed under the GNU General Public\n"); \
ast_verbose("License version 2 and other licenses; you are welcome to redistribute it under\n"); \
ast_verbose("certain conditions. Type 'show license' for details.\n"); \
ast_verbose("=========================================================================\n")
/*! \defgroup main_options
\brief Main configuration options from \ref Config_ast "asterisk.conf" or
the operating system command line when starting Asterisk
Some of them can be changed in the CLI
*/
/*! @{ */
Russell Bryant
committed
struct ast_flags ast_options = { AST_OPT_FLAG_TRANSCODE_VIA_SLIN };
Russell Bryant
committed
int option_verbose = 0; /*!< Verbosity level */
int option_debug = 0; /*!< Debug level */
double option_maxload = 0.0; /*!< Max load avg on system */
Russell Bryant
committed
int option_maxcalls = 0; /*!< Max number of active calls */
char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
char debug_filename[AST_FILENAME_MAX] = "";
static int ast_socket = -1; /*!< UNIX Socket for allowing remote control */
static int ast_consock = -1; /*!< UNIX Socket for controlling another asterisk */
Mark Spencer
committed
int ast_mainpid;
int fd; /*!< File descriptor */
int p[2]; /*!< Pipe */
pthread_t t; /*!< Thread of handler */
Russell Bryant
committed
struct ast_atexit {
void (*func)(void);
Russell Bryant
committed
AST_LIST_ENTRY(ast_atexit) list;
};
Russell Bryant
committed
static AST_LIST_HEAD_STATIC(atexits, ast_atexit);
static History *el_hist = NULL;
static EditLine *el = NULL;
static char *remotehostname;
char defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
static int ast_el_add_history(char *);
static int ast_el_read_history(char *);
static int ast_el_write_history(char *);
char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH];
char ast_config_AST_MODULE_DIR[AST_CONFIG_MAX_PATH];
char ast_config_AST_SPOOL_DIR[AST_CONFIG_MAX_PATH];
Kevin P. Fleming
committed
char ast_config_AST_MONITOR_DIR[AST_CONFIG_MAX_PATH];
Loading
Loading full blame...