| 1 |
Welcome to the world of telephone switch owners. Asterisk is a quite powerful |
| 2 |
and probably one of the feature-richest open-source PBXes out there. To get you |
| 3 |
a brief impression where to start tweaking, we've included this doc. (Thanks to |
| 4 |
Tzafrir Cohen for a proposal of this) |
| 5 |
|
| 6 |
File Locations |
| 7 |
============== |
| 8 |
See /etc/asterisk/asterisk.conf for pathnames. All the configuration is done |
| 9 |
from the *.conf files there. |
| 10 |
|
| 11 |
The astdatadir defaults to /usr/share/asterisk . This means that sounds |
| 12 |
reside at /usr/share/asterisk/sounds , music-on-hold files default to |
| 13 |
/usr/share/asterisk/moh ("directory=moh" in musiconhold.conf is relative to |
| 14 |
the astdatadir) and likewise for images. |
| 15 |
|
| 16 |
|
| 17 |
User, Groups, Permissions |
| 18 |
========================= |
| 19 |
By default the package will create user and group 'asterisk' and will run as |
| 20 |
them. It will run with real-time priority (-p) by default. It will also add |
| 21 |
itself to the group audio to enable the daemon to access sound cards and to |
| 22 |
the group dialout to access Zaptel devices. Running as root is disabled in |
| 23 |
/etc/init.d/asterisk for security reasons. |
| 24 |
|
| 25 |
To change those values you can edit /etc/default/asterisk. |
| 26 |
|
| 27 |
Alternatively, edit /etc/asterisk/asterisk.conf . |
| 28 |
|
| 29 |
init.d Script Commands |
| 30 |
====================== |
| 31 |
In addition to reload, that runs the asterisk CLI command 'reload' there |
| 32 |
are also extensions-reload ('extensions reload') and logger-reload |
| 33 |
('logger-reload') to load only parts of the configuration file. |
| 34 |
|
| 35 |
Asterisk supports a number of non-default parameters at startup. For debugging |
| 36 |
it is often useful to run 'asterisk -U asterisk -vvvgc' from the console. Add |
| 37 |
more -v for even higher verbosity. You can attach a remote console to a running |
| 38 |
asterisk daemon with 'asterisk -vcr'. When testing, make sure to use the "-U |
| 39 |
asterisk", or asterisk may write files with root ownership. In that case you |
| 40 |
might not be able to restart the daemon without altering permissions to the |
| 41 |
files first. |
| 42 |
|
| 43 |
Alternatively use '/etc/init.d/asterisk debug'. |
| 44 |
|
| 45 |
Asterisk is run with a umask of 007 by default, to allow writing |
| 46 |
group-owned voicemail files. To change this value, set the value if 'UMASK' |
| 47 |
in /etc/default/asterisk . |
| 48 |
|
| 49 |
Getting started with config and more features |
| 50 |
============================================= |
| 51 |
Of course the default config is far from a plug'n'play for every environment. |
| 52 |
You need to setup a proper dialplan in extensions.conf, remove the demo entries |
| 53 |
and maybe remove FreeWorldDialup too in case you don't participate there. For |
| 54 |
more info on how to setup a proper dialplan, fax, enum and configuration of |
| 55 |
asterisk, please checkout: |
| 56 |
|
| 57 |
https://docs.asterisk.org/Getting-Started/Beginning-Asterisk/ |
| 58 |
|
| 59 |
or more generally the GitHub-based documentation is build and hosted at: |
| 60 |
|
| 61 |
http://docs.asterisk.org |
| 62 |
|
| 63 |
or grab an older copy of the book for Asterisk 1.8: |
| 64 |
|
| 65 |
http://www.asteriskdocs.org/ (Asterisk Handbook) |
| 66 |
|
| 67 |
|
| 68 |
Open Files Limit |
| 69 |
================ |
| 70 |
Asterisk uses one file-handle (and sometimes more) per call. Hence if you |
| 71 |
have many simultaneous calls, you often bump into the per-process limit |
| 72 |
of 1024 file handles, and get the error: "Too man open files". |
| 73 |
|
| 74 |
To enlarge that limit, set: MAXFILES in /etc/default/asterisk . |
| 75 |
As all settings from there, apply it with: |
| 76 |
|
| 77 |
/etc/init.d/asterisk restart |
| 78 |
|
| 79 |
Or |
| 80 |
|
| 81 |
systemctl restart asterisk |
| 82 |
|
| 83 |
|
| 84 |
International Sound Files |
| 85 |
========================= |
| 86 |
This section is for those who use an alternative set of sound files |
| 87 |
rather than the default English ones recorded by Allison Smith. If you |
| 88 |
use those, and never needed to set LANGUAGE/language and such - all |
| 89 |
should work just fine. |
| 90 |
|
| 91 |
When Asterisk is asked to play 'some/file' it will search in the |
| 92 |
following places on a Debian system (in wish the datadir is set to |
| 93 |
/usr/share/asterisk) |
| 94 |
|
| 95 |
/usr/share/sounds/${LANG_FULL}/some/file.TYPE |
| 96 |
/usr/share/sounds/${LANG}/some/file.TYPE |
| 97 |
/usr/share/sounds/some/file.TYPE |
| 98 |
/usr/share/sounds/en/some/file.TYPE |
| 99 |
|
| 100 |
TYPE is "the best available type" - the one that will take least |
| 101 |
encoding/decoding effort. This is why you normally don't specify the |
| 102 |
type of file to play. |
| 103 |
|
| 104 |
LANG_FULL is a complete name of a language. For instance "fr_FR", |
| 105 |
"de_CH" or "en_US". |
| 106 |
|
| 107 |
LANG is just the "major language" part of FULL_LANG -- only up to the |
| 108 |
first "_", if any. So in the above examples we would get "fr", "de" and |
| 109 |
"en". |
| 110 |
|
| 111 |
If the language is not set, only the last two are searched. |
| 112 |
|
| 113 |
Thus various sound file packages place their files under |
| 114 |
/usr/share/sounds/asterisk/xx_YY_g_Foobar, |
| 115 |
for sound files of set Foobar of language 'xx' and country 'YY', |
| 116 |
being voices of gender g ('m' for male and 'f' for female). |
| 117 |
They also provide the alternatives 'asterisk-prompt-xx' and |
| 118 |
'asterisk-prompt-xx-yy' for the symlinks |
| 119 |
/usr/share/asterisk/sounds/xx and /usr/share/asterisk/sounds/xx_YY . |
| 120 |
|
| 121 |
If you have multiple such packages and want to change that selection, use: |
| 122 |
|
| 123 |
update-alternatives --config asterisk-prompt-xx |
| 124 |
|
| 125 |
Or: |
| 126 |
|
| 127 |
update-alternatives --config asterisk-prompt-xx-yy |
| 128 |
|
| 129 |
(TODO: document using an empty alternative directory for 'en' to have no |
| 130 |
fallback sounds) |
| 131 |
|
| 132 |
|
| 133 |
Voicemail |
| 134 |
========= |
| 135 |
Asterisk has two separate implementations of the voicemail system: the |
| 136 |
original app_voicemail, and the newer minivm. Minivm is more modular (you |
| 137 |
can define your own voicemail IVRs). Though it only supports the simple |
| 138 |
files-backed voicemail storage. |
| 139 |
|
| 140 |
Voicemail has three separate backends: the simple files-based storage, |
| 141 |
a database storage ("ODBC") and a mail-server-backed one (IMAP). The |
| 142 |
latter two have some advantages of their own, but are more complicated |
| 143 |
to set up. Originally those three were three build-time variants. One of |
| 144 |
them had to be selected at build time. |
| 145 |
|
| 146 |
As of Trixie (Asterisk 22), Debian provides two of the three variants as |
| 147 |
separate and conflicting sub-packages: asterisk-voicemail and |
| 148 |
asterisk-voicemail-odbcstorage. (Debian had previously provided another |
| 149 |
option with asterisk-voicemail-imapstorage since Wheezy (Asterisk 1.8) but |
| 150 |
the libc-client2007e library is no longer available so unable to build.) |
| 151 |
Each includes app_voicemail.so, though built with different options. |
| 152 |
|
| 153 |
Note that some previous versions (specifically the Squeeze 1.6.2 versions) |
| 154 |
included all three modules in the main package with different names. |
| 155 |
This required explicit 'noload' lines in /etc/asterisk/modules.conf . |
| 156 |
Those are no longer needed. Though you should make sure you have no |
| 157 |
leftover line 'noload => app_voicemail.so'. |
| 158 |
|
| 159 |
Also note that the debug information for the IMAP and ODBC voicemail |
| 160 |
modules has an incorrect name. This may mean that traces using them may |
| 161 |
have invalid information. |
| 162 |
|
| 163 |
|
| 164 |
Recommended and Suggested |
| 165 |
========================= |
| 166 |
Asterisk includes various optional modules. The package asterisk-modules |
| 167 |
includes most of them (you can disable their load using noload in |
| 168 |
/etc/asterisk/modules.conf) yet some are still in their own |
| 169 |
sub-packages. |
| 170 |
|
| 171 |
Recommended |
| 172 |
----------- |
| 173 |
* sox: |
| 174 |
Recommended as it is used by MoxMonitor - the default command for mixing |
| 175 |
the two recorded streams to a single audio file, and by |
| 176 |
app_voicemail/app_minivm to change gains of a mail message. |
| 177 |
|
| 178 |
* asterisk-voicemail: |
| 179 |
Seprated out to sub-packages as there are several implementations of |
| 180 |
app_voicemail (plain files storage, ODBC-interfaced database storage, |
| 181 |
IMAP-interfaced mail storage). Only one of those three could be |
| 182 |
installed. app_voicemail is normally expected to exist on an |
| 183 |
installation of Asterisk and hence it is recommended to include one of |
| 184 |
them. The simple file-based stoorage requires no extra setup, and hence |
| 185 |
is the default. |
| 186 |
|
| 187 |
* asterisk-moh-opsound-gsm: |
| 188 |
Some relatively long and not too annoying music files in a format |
| 189 |
readable to Asterisk should reside in /usr/share/asterisk/moh . Asterisk |
| 190 |
will then play them when putting a call on hold for whatever reason |
| 191 |
(extra tuning: musiconhold.conf). This package is one such example |
| 192 |
sounds set. It is recommended in order for Asterisk to properly function |
| 193 |
as an elevator. |
| 194 |
|
| 195 |
Suggested |
| 196 |
--------- |
| 197 |
* asterisk-doc: |
| 198 |
Extra documentation. Including the sample config files. |
| 199 |
|
| 200 |
* asterisk-dev: |
| 201 |
Can be used to build external modules. |
| 202 |
|
| 203 |
* asterisk-ooh323: |
| 204 |
chan_ooh323c.so. A module for support of the H.323 protocol. An |
| 205 |
alternative to chan_h323.so. Seems to be in better shape and has a much |
| 206 |
smaller dependency set. |
| 207 |
|
| 208 |
* asterisk-dahdi: |
| 209 |
chan_dahdi.so and anything else that depends on DAHDI (MeetMe, |
| 210 |
res_timing_dahdi, codec_dahdi, and such). You should install this if you |
| 211 |
have DAHDI support (kernel-level) on your system. |
| 212 |
|
| 213 |
|
| 214 |
Others |
| 215 |
------ |
| 216 |
* asterisk-h323: |
| 217 |
chan_h323.so. Maybe consider this instead of asterisk-ooh323, which |
| 218 |
upstream seems to prefer. |
| 219 |
|
| 220 |
* asterisk-mysql: |
| 221 |
Direct (non-ODBC) support for MySQL. |
| 222 |
|
| 223 |
* asterisk-mp3: |
| 224 |
Support for playing mp3 files |
| 225 |
|
| 226 |
* asterisk-mobile: |
| 227 |
chan_mobile: support for interfacing with bluetooth headsets/phones. Has |
| 228 |
its limitations. |
| 229 |
|
| 230 |
|
| 231 |
Missing Modules |
| 232 |
=============== |
| 233 |
The following modules are included in the source tree of Asterisk but |
| 234 |
were not built: |
| 235 |
|
| 236 |
* apps/app_fax.c: Disabled by default. Obsolete. res_fax does this now. |
| 237 |
* apps/app_ivrdemo.c: Disabled by default. Demo code. |
| 238 |
* apps/app_osplookup.c: osptk needed. |
| 239 |
* apps/app_rpt.c: Disabled by default. Not popular. Potential quality issues. |
| 240 |
* apps/app_saycounted.c: Disabled by default. |
| 241 |
* apps/app_skel.c: Disabled by default. Demo code. |
| 242 |
* channels/chan_misdn.c: mISDN (1.x) only included in Experimental. See |
| 243 |
package misdn-user. |
| 244 |
* channels/chan_nbs: NBS not included. Never packaged. Looks quite Asterisk |
| 245 |
specific and not really useful. |
| 246 |
* channels/chan_usbradio: Disabled by default. Not popular. Potential |
| 247 |
quality issues. |
| 248 |
* codecs/codec_ilbc.c: Disabled by default. Patent issues. |
| 249 |
* res/res_pktccops.c: Disabled by default. |
| 250 |
* res/res_timing_kqueue.c: Wrong kernel. |
| 251 |
|
| 252 |
You can compare that to the list of modules disabled by the Asterisk build |
| 253 |
system at build time, that is copied to |
| 254 |
/usr/share/doc/asterisk/menuselect.makeopts . |
| 255 |
|
| 256 |
|
| 257 |
Extra Channels |
| 258 |
============== |
| 259 |
This package includes and enables by default a number of rather not so |
| 260 |
popular protocols. Having them enabled by default means that any |
| 261 |
security volnurability in them may open your system to attacks |
| 262 |
for no good reason. |
| 263 |
|
| 264 |
Thus the following configuration files have been removed from the default |
| 265 |
set of configuration files installed to /etc/asterisk: |
| 266 |
* dundi.conf (DUNDi call routing, UDP port 4520) |
| 267 |
* unistim.conf (chan_unistim: UNISTIM voip protocol, UDP port 5000) |
| 268 |
|
| 269 |
If you do need any of those protocols, copy the sample file from |
| 270 |
/usr/share/asterisk/conf/samples/FILE.conf.sample to |
| 271 |
/etc/asterisk/FILE.conf and restart asterisk (or the specific module). |
| 272 |
|
| 273 |
|
| 274 |
Missing Documentation |
| 275 |
===================== |
| 276 |
AST.pdf and AST.txt cannot be included due to incompatible license. |
| 277 |
You can get their content from http://wiki.asterisk.org . The standard |
| 278 |
reference is included, as always in the "sample" configuration files and |
| 279 |
in the help from the Asterisk command-line prompt. |
| 280 |
|
| 281 |
|
| 282 |
DAHDI PtMP NT |
| 283 |
============= |
| 284 |
Short version: it doesn't work. |
| 285 |
|
| 286 |
This package includes an experimental patch to test the support for PtMP |
| 287 |
NT in chan_dahdi. This is needed to e.g. connect ISDN phones. Originally |
| 288 |
the code merely printed out "How cool would it be if someone implemented |
| 289 |
this mode!" and bailed out. This patch merely overrides it. |
| 290 |
|
| 291 |
At the moment it seems to provide at least basic support of ISDN phones |
| 292 |
(that is: of dialing out from a single ISDN phone). Likewise, on a |
| 293 |
loopback connection you can call from a TE port to the NT port but not |
| 294 |
vice versa. |
| 295 |
|
| 296 |
I figure that this would still be useful enough for some people, though. |
| 297 |
But in any case, please see http://bugs.digium.com/view.php?id=15048 . |
| 298 |
|
| 299 |
|
| 300 |
A Separate Instance |
| 301 |
=================== |
| 302 |
Upstream maintainers are not always so keen on helping users of binary |
| 303 |
packages. Sometimes a source build can be handy. However a simplistic |
| 304 |
'make install' from a source distribution may not play along nicely |
| 305 |
with your existing packages. As a workaround for that, Asterisk includes |
| 306 |
a script called 'live_ast' to "install" Asterisk under the build root |
| 307 |
itself. |
| 308 |
|
| 309 |
# For the sake of this example, I assume you work under /home/getafisk . |
| 310 |
# get a version of asterisk: tarball, svn, whatever |
| 311 |
svn co http://svn.asterisk.org/svn/asterisk/trunk asterisk-svn |
| 312 |
cd asterisk-svn |
| 313 |
|
| 314 |
# grab the script. It's already in 1.6.2 and trunk, but let's get the |
| 315 |
# latest: |
| 316 |
wget https://github.com/asterisk/asterisk/blob/master/contrib/scripts/live_ast |
| 317 |
chmod +x live_ast |
| 318 |
./live_ast conf-file |
| 319 |
# edit live/live.conf . Unrem 'LIVE_AST_FOR_SYSTEM=yes' |
| 320 |
./live_ast configure # ./configure |
| 321 |
./live_ast install # make; make install DESTDIR=$PWD/live |
| 322 |
./live_ast samples |
| 323 |
|
| 324 |
# As root: |
| 325 |
echo "DAEMON=/home/getafisk/live/asterisk" >> /etc/default/asterisk |
| 326 |
|
| 327 |
The last line makes your private copy the actual one to use. The magic |
| 328 |
is in /home/getafisk/live/etc/asterisk/asterisk.conf . If you need to |
| 329 |
update something in the source, just re-run the 'install' command. |
| 330 |
live/asterisk is a wrapper to that private copy of Asterisk. |
| 331 |
|
| 332 |
|
| 333 |
Enjoy your PBX! |