Transcript of Asterisk beginning to advanced part 3
1. Asterisk from beginning to advanced (part 3) Part 3 Used:
Debian 8 libreoffice Email: [email protected] License: GPLV3 Get
latest version of this slides and see Other projects and tutorials:
https://github.com/m-gh/
2. Start asteriskStart asterisk By default, starting Asterisk
will run it in the background: Command: root@localhost:/#asterisk
In order to connect to a running Asterisk process, you can attach a
remote console using the -r option: root@localhost:/#asterisk -r To
disconnect from a connected remote console, simply hit Ctrl+C: You
can start Asterisk in the foreground, with an attached root
console, using the -c option: root@localhost:/#asterisk -c
3. Adding Verbosity: Asterisk provides a number of mechanisms
to control the verbosity of its logging. One way in which this can
be controlled is through the command line parameter -v. For each -v
specified, Asterisk will increase the level of VERBOSE messages by
1. The following will create a console and set the VERBOSE message
level to 2: root@localhost:/#asterisk -c -v -v
root@localhost:/#asterisk -rvvv More Options There are many more
command line options available. For more information, use the -h
option: # asterisk -h Start asteriskStart asterisk
4. Asterisk Command Line InterfaceAsterisk Command Line
Interface What is the CLI? The Command Line Interface, or console
for Asterisk, serves a variety of purposes for an Asterisk
administrator. Obtaining information on Asterisk system components
Affecting system configuration Seeing log output, errors and
warnings in real-time Generating calls for testing Viewing embedded
help documentation such as for APIs, applications, functions and
module configuration
5. Connecting to the Asterisk CLIConnecting to the Asterisk CLI
There are two ways to connect to an Asterisk console, either a
foreground console when starting the Asterisk process (asterisk -c)
or by connecting to a remote console after Asterisk is already
running (asterisk -r).
6. File sizesFile sizes Files generated by various Asterisk
modules or core features may grow to significant sizes depending on
how you use Asterisk and the configuration of those sub- systems.
Systems that may generate large files are: Logging Reporting Audio
recording applications. The key is to know where these components
store their output and to have some mechanism in place to prevent
the files from growing.
7. It is in the interest of every Asterisk administrator to
perform due diligence for security concerns. Most security measures
are a matter of configuration and prevention, however for a
production system already running there are a few things to
consider in the context of maintenance. The Asterisk Security Event
Logger can generate log output for security events. You may want to
monitor these manually or have scripts and applications that take
action on these events or log messages. Be aware of security
vulnerability announcements. There are a few places these are
announced: http://www.asterisk.org/downloads/security-advisories.
SecuritySecurity
8. Backing up Asterisk DataBacking up Asterisk Data Backing up
Asterisk is not a complex task. Mostly, you just need to know where
the files are and then employ common tools for archiving and
storing those files somewhere. Files to consider for backup:
Asterisk configuration Asterisk internal DB Other database used by
Asterisk Asterisk logs and reports you might set up a cron job in
Linux to regularly perform that process and send the files
off-site. In general, use whatever backup processes you use for any
other Linux applications that you manage. Restoring a backup, in
most cases should be as simple as placing the files back in their
original locations and starting Asterisk.
9. LoggingLogging Logging in Asterisk is a powerful mechanism
that can be utilized to extract vital information from a running
system. Logging in Asterisk is configured in the logger.conf file.
See Logging Configuration page for more information.
10. Hangup and show channels in CLIHangup and show channels in
CLI newtonr-laptop*CLI> core show channels Channel Location
State Application(Data) SIP/6001-00000001 (None) Up
Playback(demo-congrats) 1 active channel newtonr-laptop*CLI>
channel request hangup SIP/6001-00000001 Requested Hangup on
channel 'SIP/6001-00000001' [May 2 09:51:19]
WARNING[7045][C-00000001]: app_playback.c:493 playback_exec:
Playback failed on SIP/6001-00000001 for demo- congrats
11. Asterisk ArchitectureAsterisk Architecture let's take a
look at the overall architecture of Asterisk. Asterisk a big
program with many components, with complex relationships. To be
able to use it, you don't have to know how everything relates in
extreme detail. Below is a simplified diagram intended to
illustrate the relationships of some major components to each other
and to entities outside Asterisk. It is useful to understand how a
component may relate to things outside Asterisk as Asterisk is not
typically operating without some connectivity or interaction with
other network devices or files on the local system.
12. Asterisk Architecture, The Big PictureAsterisk
Architecture, The Big Picture
13. Core & ModulesCore & Modules Asterisk has a core
that can interact with many modules. Modules called channel drivers
provide channels that follow Asterisk dialplan to execute
programmed behavior and facilitate communication between devices or
programs outside Asterisk. Channels often use bridging
infrastructure to interact with other channels. The Core The heart
of any Asterisk system is the core. The core loads and builds the
dialplan, which is the logic of any Asterisk system. The dialplan
contains a list of instructions that Asterisk should follow to know
how to handle incoming and outgoing calls on the system.
14. ModulesModules Modules is. From a logistical standpoint,
modules are typically files with a .so file extension, which live
in the Asterisk modules directory (which is typically
/usr/lib/asterisk/modules). When Asterisk starts up, it loads these
files and adds their functionality to the system. Asterisk modules
which are part of the core have a file name that look like
pbx_xxxxx.so.
15. ModulesModules A Few Module Examples chan_pjsip uses
res_pjsip and many other res_pjsip modules to provide a SIP stack
for SIP devices to interact with Asterisk and with each other
through Asterisk. app_voicemail provides traditional PBX-type
voicemail features. app_confbridge provides conference bridges with
many optional features. res_agi provides the Asterisk Gateway
Interface, an API that allows call control from external scripts
and programs.
16. Calls and ChannelsCalls and Channels the primary purpose of
Asterisk is being an engine for building Real Time Communication
systems and applications. In most but not all cases this means
you'll deal with the concept of "calls". Calls in telephony
terminology typically refer to one phone communicating with
(calling) another phone over a medium, such as a PSTN line. However
in the case of Asterisk a call typically references one or more
channels existing in Asterisk. Here are some example "calls". A
phone calling another phone through Asterisk. A phone calling many
phones at once through Asterisk. A phone calls an application or
the reverse happens. A local channel is created and interacts with
an application or another channel. Note that I primarily use phones
as an example, however you could refer to any channel or group of
channels as a call. It doesn't matter if the devices are phones or
something else, like an alarm system sensor or garage door
opener.
17. ChannelsChannels Channels are created by Asterisk using
Channel Drivers. Channels can be bridged to other channels and be
affected by applications and functions.
18. DialplanDialplan Dialplan is the one main method of
directing Asterisk behavior. Dialplan exists as text files (for
example extensions.conf) . Alternatively dialplan could be read
from a database. When writing dialplan, you will make heavy use of
applications and functions to affect channels, configuration and
features. Dialplan can also call out through other interfaces such
as AGI to receive call control instruction from external scripts
and programs.
19. Directory and File StructureDirectory and File Structure
The top level directories used by Asterisk can be configured in the
asterisk.conf configuration file. See
/etc/asterisk/asterisk.conf
20. Asterisk Configuration Files astetcdir => /etc/asterisk
This location is used to store and read Asterisk configuration
files. That is generally files with a .conf extension, but other
configuration types as well, for example .lua and .ael.
21. Asterisk ModulesAsterisk Modules astmoddir =>
/usr/lib/asterisk/modules Loadable modules in Shared Object format
(.so) installed by Asterisk or the user should go here.
22. Various LibrariesVarious Libraries astvarlibdir =>
/var/lib/asterisk Additional library elements and files containing
data used in runtime are put here.
23. Database DirectoryDatabase Directory astdbdir =>
/var/lib/asterisk This location is used to store the data file for
Asterisk's internal database. In Asterisk versions using the
SQLite3 database, the file will be named astdb.sqlite3. Asterisk
use SQLite3 as internal database.
24. Encryption KeysEncryption Keys astkeydir =>
/var/lib/asterisk When configuring key-based encryption, Asterisk
will look in the keys subdirectory of this location for the
necessary keys. Ehsan Khoshhal
25. System Data DirectorySystem Data Directory astdatadir =>
/var/lib/asterisk By default, Asterisk sounds are stored and read
from the sounds subdirectory at this location.
26. AGI(Asterisk Gateway Interface)AGI(Asterisk Gateway
Interface) DirectoryDirectory astagidir =>
/var/lib/asterisk/agi-bin When using various AGI applications,
Asterisk looks here for the AGI scripts by default.
27. Spool DirectoriesSpool Directories astspooldir =>
/var/spool/asterisk This directory is used for storing spool files
from various core and module- provided components of Asterisk. Most
of them use their own subdirectories, such as the following:
dictate meetme monitor outgoing recording system tmp Voicemail
Ehsan khoshhal, amir tavakoli
28. Running Process DirectoryRunning Process Directory
astrundir => /var/run/asterisk When Asterisk is running, you'll
see two files here, asterisk.ctl and asterisk.pid. That is the
control socket and the PID(Process ID) files for Asterisk. What is
the different between /var/run and /proc Ehsan khoshhal, amir
tavakoli, masoud bani.
29. Logging OutputLogging Output astlogdir =>
/var/log/asterisk When Asterisk is configured to provide log file
output, it will be stored in this directory.
30. System Binary DirectorySystem Binary Directory astsbindir
=> /usr/sbin By default, Asterisk looks in this directory for
any system binaries that it uses, if you move the Asterisk binary
itself or any others that it uses, you'll need to change this
location. /usr/sbin mean: Application that compiled from source or
installed by user or installed after install system by default
placed here. All system default packages and programs placed in
/bin and /sbin. /sbin stand for system (or superuser) binaries .
App placed in /sbin just run with root or sudoers.
31. aboutabout Email : [email protected] License : GPLV3 Other
project and tutorials: https://github.com/m-gh/ Get latest version
of this slides form: https://github.com/m-gh/