120 lines
3.0 KiB
Bash
Executable File
120 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
PROGNAME=$(basename $0)
|
|
|
|
if test -z ${ASTERISK_VERSION}; then
|
|
echo "${PROGNAME}: ASTERISK_VERSION required" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set -ex
|
|
|
|
useradd --system asterisk
|
|
|
|
apt-get update -qq
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends --no-install-suggests \
|
|
autoconf \
|
|
binutils-dev \
|
|
build-essential \
|
|
ca-certificates \
|
|
curl \
|
|
file \
|
|
libcurl4-openssl-dev \
|
|
libedit-dev \
|
|
libgsm1-dev \
|
|
libjansson-dev \
|
|
libogg-dev \
|
|
libpopt-dev \
|
|
libresample1-dev \
|
|
libspandsp-dev \
|
|
libspeex-dev \
|
|
libspeexdsp-dev \
|
|
libsqlite3-dev \
|
|
libsrtp0-dev \
|
|
libssl-dev \
|
|
libvorbis-dev \
|
|
libxml2-dev \
|
|
libxslt1-dev \
|
|
odbcinst \
|
|
portaudio19-dev \
|
|
unixodbc \
|
|
unixodbc-bin \
|
|
unixodbc-dev \
|
|
uuid \
|
|
uuid-dev \
|
|
xmlstarlet
|
|
|
|
apt-get purge -y --auto-remove
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
mkdir -p /usr/src/asterisk
|
|
cd /usr/src/asterisk
|
|
|
|
curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \
|
|
curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \
|
|
curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz
|
|
|
|
# 1.5 jobs per core works out okay
|
|
: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))}
|
|
|
|
./configure --with-resample --with-pjproject-bundled
|
|
make menuselect/menuselect menuselect-tree menuselect.makeopts
|
|
|
|
# disable BUILD_NATIVE to avoid platform issues
|
|
menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts
|
|
|
|
# enable good things
|
|
menuselect/menuselect --enable BETTER_BACKTRACES menuselect.makeopts
|
|
|
|
# # download more sounds
|
|
# for i in CORE-SOUNDS-EN MOH-OPSOUND EXTRA-SOUNDS-EN; do
|
|
# for j in ULAW ALAW G722 GSM SLN16; do
|
|
# menuselect/menuselect --enable $i-$j menuselect.makeopts
|
|
# done
|
|
# done
|
|
|
|
# we don't need any sounds in docker, they will be mounted as volume
|
|
menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS
|
|
menuselect/menuselect --disable-category MENUSELECT_MOH
|
|
menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS
|
|
|
|
make -j ${JOBS} all
|
|
make install
|
|
|
|
# copy default configs
|
|
# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/
|
|
make samples
|
|
|
|
# set runuser and rungroup
|
|
sed -i -E 's/^;(run)(user|group)/\1\2/' /etc/asterisk/asterisk.conf
|
|
|
|
mkdir -p /etc/asterisk/ \
|
|
/var/spool/asterisk/fax
|
|
|
|
chown -R asterisk:asterisk /etc/asterisk \
|
|
/var/*/asterisk \
|
|
/usr/*/asterisk
|
|
chmod -R 750 /var/spool/asterisk
|
|
|
|
cd /
|
|
rm -rf /usr/src/asterisk \
|
|
/usr/src/codecs
|
|
|
|
# remove *-dev packages
|
|
devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs`
|
|
DEBIAN_FRONTEND=noninteractive apt-get --yes purge \
|
|
autoconf \
|
|
build-essential \
|
|
bzip2 \
|
|
cpp \
|
|
m4 \
|
|
make \
|
|
patch \
|
|
perl \
|
|
perl-modules \
|
|
pkg-config \
|
|
xz-utils \
|
|
${devpackages}
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
exec rm -f /build-asterisk.sh
|