This is an old revision of the document!


Alpine Linux latest-stable (written when latest-stable == 3.16.0)

Note about missing packages

Some Asterisk modules are unavailable due to the lack of available packages on Alpine Linux. These currently are:

  • beanstalk - Available as a package, but I'm not installing it :)
  • codec2 - Unavailable as a package, but the most recent commit does compile and install
  • iksemel (Jabber-specialised XML parser) - Unavailable as a package, most recent source simply doesn't compile, but version 1.4 does compile and install.
  • nbs (Network Broadcast Sound) - Unavailable as a package, compiling from source doesn't work without patching for musl.
  • osptk (Open Settlement Protocol) - Unavailable as a package (unsure why), couldn't be bothered finding source and seeing if it compiles.
  • radius - Installing freeradius-dev is not sufficient, and I'm not interested in figuring out what package is required for this one.
  • resample - Installing libresample-dev is apparently not sufficient, even though the install-prereqs script checks for the header file installed by that package before attempting to build from source.. I do not care enough.
  • vpb (Voicetronix) - Unavailable as a package, website is confusing, don't care enough.

Applications

  • app_jack is unavailable due to resample
  • app_osplookup is unavailable due to osptk

Call Detail Recording

  • cdr_beanstalkd is unavailable due to beanstalk
  • cdr_radius is unavailable due to radius

Channel Event Logging

  • cel_beanstalkd is unavailable due to beanstalk
  • cel_radius is unavailable due to radius

Channel Drivers

  • chan_misdn (ISDN BRI/PRI) is unavailable due to isdnnet, misdn and suppserv
  • chan_nbs (network broadcast sound) is unavailable due to nbs
  • chan_phone (linux telephony api) is unavailable due to ixjuser
  • chan_vpb (Voicetronix) is unavailable due to vpb

Resource Modules

  • res_corosync is unavailable due to corosync
  • res_timing_kqueue is unavailable due to kqueue

Install commands

Not exactly a ready-to-run script, more a log of all the commands I ran in the pursuit of sippies. During the menuconfig step, I enabled everything possible except for any deprecated modules that aren't enabled by default anyway.

install.sh
apk add -t pbx-build-deps alpine-sdk alsa-lib-dev asterisk-openrc \
                          binutils-dev bison bluez-dev bsd-compat-headers \
                          cmake curl-dev \
                          dahdi-linux dahdi-linux-dev dahdi-tools dahdi-tools-dev doxygen \
                          fftw-dev findutils flex freeradius-utils freetds-dev \
                          gmime-dev graphviz-dev gsm-dev \
                          ilbc-dev imap-dev \
                          jansson-dev \
                          libedit-dev libical-dev libpri-dev libresample libsamplerate-dev libsndfile-dev libsrtp-dev libtool libxml2-dev libxslt-dev libzip-dev \
                          lua-dev lua5.2-dev lua5.3-dev lua5.4-dev \
                          mariadb-connector-c-dev mariadb-dev mysql-client \
                          neon-dev net-snmp net-snmp-dev newt-dev \
                          openldap-clients openldap-dev openssl-dev opus-dev opusfile-dev \
                          pjproject-dev popt-dev portaudio-dev postgresql14-client postgresql14-dev \
                          spandsp spandsp-dev speex-dev speexdsp-dev sqlite sqlite-dev \
                          tar tiff-dev \
                          unbound-dev unixodbc-dev uriparser uriparser-dev util-linux-dev \
                          xmlstarlet
mkdir -p /usr/local/src/patches/asterisk /usr/local/src/dist/asterisk /usr/local/src/build/codec2
cd /usr/local/src/dist
git clone https://github.com/drowe67/codec2
git clone https://github.com/timothytylee/iksemel-1.4 iksemel
cd /usr/local/src/build/codec2
cmake /usr/local/src/dist/codec2
make -j5
make install
cd /usr/local/src/dist/iksemel
# not sure what the order of operations is supposed to be here because I ran autoupdate
#  but then got messages from autogen.sh about obsolete things I should fix with autoupdate..
autoupdate
./autogen.sh
./configure
# edit makefile here to remove all variables referencing the doc folder,
#  followed by removing the doc folder from SUBDIRS
#  otherwise make will error out because it wants to build the documentation
# TODO: make a patch for that
vi Makefile
make -j5
make install
cd /usr/local/src/patches/asterisk
wget https://git.alpinelinux.org/aports/plain/main/asterisk/10-musl-mutex-init.patch
wget https://git.alpinelinux.org/aports/plain/main/asterisk/20-musl-astmm-fix.patch
wget https://git.alpinelinux.org/aports/plain/main/asterisk/30-asterisk-mariadb.patch
wget https://git.alpinelinux.org/aports/plain/main/asterisk/40-asterisk-cdefs.patch
wget -O 50-usecallmanager-18.11.3.patch https://raw.githubusercontent.com/usecallmanagernz/patches/master/asterisk/cisco-usecallmanager-18.11.3.patch
cd /usr/local/src/dist/asterisk
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-18.11.3.tar.gz
cd /usr/local/src/build
tar xzf /usr/local/src/asterisk/dist/asterisk-18.11.3.tar.gz
mv asterisk-18.11.3 asterisk
cd /usr/local/src/build/asterisk
patch --strip=1 < /usr/local/src/patches/asterisk/10-musl-mutex-init.patch
patch --strip=1 < /usr/local/src/patches/asterisk/20-musl-astmm-fix.patch
patch --strip=1 < /usr/local/src/patches/asterisk/30-asterisk-mariadb.patch
patch --strip=1 < /usr/local/src/patches/asterisk/40-asterisk-cdefs.patch
patch --strip=1 < /usr/local/src/patches/asterisk/50-usecallmanager-18.11.3.patch
# Asterisk official documentation makes a big stink about how you should only use their bundled pjproject
#  otherwise you'll have instabilities and whatever, but their bundled pjproject doesn't build cleanly on Alpine
#  so they can stink up somewhere else.
CFLAGS="-DENABLE_SRTP_AES_GCM -DENABLE_SRTP_AES_256" ./configure --without-pjproject-bundled
make menuconfig
./contrib/scripts/get_mp3_source.sh
make -j9
make install samples
addgroup -S asterisk
adduser -S -D -h /var/lib/asterisk -s /sbin/nologin -G asterisk -g asterisk asterisk
addgroup -S dialout
addgroup asterisk dialout
chown -R asterisk:asterisk /run/asterisk
chown -R asterisk:asterisk /var/lib/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/spool/asterisk

Configuration

This part was initially extremely daunting. Not helping matters is that the fact that there are no pages online (that I could find) that discuss a viable minimal configuration for a recent Asterisk version. Apparently either nobody is starting fresh with Asterisk in 2022 or nobody is interested in writing about it. Further frustrating matters is that Asterisk's official wiki, a Confluence site, went down shortly after I began the process of setting Asterisk up.

modules.conf

I started here, and essentially trimmed the config file down to autoload=yes, because I disabled all modules in make menuconfig that I didn't want to actually use.

modules.conf
[modules]
autoload=yes

features.conf

I then went here, and I trimmed it down to just the things that seemed relevant.

features.conf
[general]
transferdigittimeout	=> 3
xfersound		= beep
xferfailsound		= beeperr
;pickupsound		= beep
;pickupfailsound	= beeperr
featuredigittimeout	= 1000
;recordingfailsound	= beeperr
atxfernoanswertimeout	= 15
atxferdropcall		= no
atxferloopdelay		= 10
atxfercallbackretries	= 2
transferdialattempts	= 3
transferretrysound	= beep
transferinvalidsound	= beeperr
 
atxferabort		= *1
atxfercomplete		= *2
atxferthreeway		= *3
atxferswap		= *4
pickupexten		= *8
 
[featuremap]
; requires two channels to be both answered and bridged, chan_local is needed w/ Answer in order to use them while RP is ringing or in progress
disconnect		=> *0 ;requires H or h
automon			=> *1 ;requires W or w
atxfer			=> *2 ;requires T or t
automixmon		=> *3 ;requires X or x
blindxfer		=> #1 ;requires T or t
parkcall		=> #72;requires X or x
 
[applicationmap]

Config files removed or just trimmed down inconsequentially

This section then is for config files I edited or deleted from what is installed with make samples.

I deleted the config files that were installed for all modules I explicitly removed:

  • app_skel.conf
  • cdr_adaptive_odbc.conf
  • cdr_beanstalkd.conf
  • cdr_odbc.conf
  • cdr_pgsql.conf
  • cdr_syslog.conf
  • cel_beanstalkd.conf
  • cel_odbc.conf
  • cel_pgsql.conf
  • func_odbc.conf
  • misdn.conf
  • osp.conf
  • oss.conf
  • res_odbc.conf
  • res_pgsql.conf
  • res_snmp.conf
  • sip.conf
  • sip_notify.conf
  • vpb.conf

And edited down the following:

codecs.conf
; custom CELT codec defs. one custom definition per sample rate.
;[celt44]
;type=celt
;samprate=44100
;framesize=480

;[opus]
;type=opus
;max_playback_rate=8000
;fec=no
;packet_loss=10
;complexity=10
;max_bandwidth=48000
;bitrate=auto
;application=voip
;cbr=no
;dtx=no
 
[plc]
genericplc				=> true
genericplc_on_equal_codecs		=> false
 
[silk8]
type					= silk
samprate				= 8000
maxbitrate				= 10000
fec					= true
packetloss_percentage			= 10
dtx					= false
 
[silk12]
type					= silk
samprate				= 12000
maxbitrate				= 12000
fec					= true
packetloss_percentage			= 10
dtx					= false
 
[silk16]
type					= silk
samprate				= 16000
maxbitrate				= 20000
fec					= true
packetloss_percentage			= 10
dtx					= false
 
[silk24]
type					= silk
samprate				= 24000
maxbitrate				= 30000
fec					= true
packetloss_percentage			= 10
dtx					= false
 
[speex]
vbr					=> true
quality					=> 3
complexity				=> 2
enhancement				=> true
vad					=> true
abr					=> 0
vbr_quality				=> 4
dtx					=> false
experimental_rtcp_feedback		=> false
preprocess				=> false
pp_vad					=> false
pp_agc					=> false
pp_agc_level				=> 8000
pp_denoise				=> false
pp_dereverb				=> false
pp_dereverb_decay			=> 0.4
pp_dereverb_level			=> 0.3
extconfig.conf
[settings]
; file.conf => driver,database[,table[,priority]]
;queues.conf => odbc,asterisk,ast_config
;extensions.conf => sqlite,asterisk,ast_config
;example => odbc,asterisk,alttable,1
;example => mysql,asterisk,alttable,2
;example2 => ldap,"dc=oxymium,dc=net",example2
;iaxusers => odbc,asterisk
;iaxpeers => odbc,asterisk
;sippeers => odbc,asterisk
;sipregs => odbc,asterisk ; (avoid sipregs if possible, e.g. by using a view)
;ps_endpoints => odbc,asterisk
;ps_auths => odbc,asterisk
;ps_aors => odbc,asterisk
;ps_domain_aliases => odbc,asterisk
;ps_endpoint_id_ips => odbc,asterisk
;ps_outbound_publishes => odbc,asterisk
;ps_inbound_publications = odbc,asterisk
;ps_asterisk_publications = odbc,asterisk
;voicemail => odbc,asterisk
;extensions => odbc,asterisk
;meetme => mysql,general
;queues => odbc,asterisk
;queue_members => odbc,asterisk
;queue_rules => odbc,asterisk
;acls => odbc,asterisk
;musiconhold => mysql,general
;musiconhold_entry => mysql,general
;queue_log => mysql,general
hep.conf
[general]
enabled = no
;capture_address = 1.2.3.4:1234
;capture_password = password
;capture_id = 1234
;uuid_type = call-id | channel
prometheus.conf
[general]
enabled                 = yes
core_metrics_enabled    = yes
uri                     = metrics
Navigation
  • Home