asterisk 16.0.0-rc3 (debian version)

This commit is contained in:
Andrius Kairiukstis 2018-09-22 11:40:09 +02:00
parent 73b80b7016
commit ac5a0df155
27 changed files with 553 additions and 6 deletions

View File

@ -6,7 +6,11 @@ The smallest Docker image with Asterisk PBX https://hub.docker.com/r/andrius/ast
This image is based on Alpine Linux image, which is only a 5MB image, and contains
[Asterisk PBX](http://www.asterisk.org/get-started/features).
Total size of this image for `latest` tag is [![](https://images.microbadger.com/badges/image/andrius/asterisk.svg)](https://microbadger.com/images/andrius/asterisk "Get your own image badge on microbadger.com"), and for `debian-15-latest` [![](https://images.microbadger.com/badges/image/andrius/asterisk:debian-15-latest.svg)](https://microbadger.com/images/andrius/asterisk:debian-15-latest "Get your own image badge on microbadger.com").
Total size of this image for `latest` tag (Alpine-based) is:
[![](https://images.microbadger.com/badges/image/andrius/asterisk.svg)](https://microbadger.com/images/andrius/asterisk "Get your own image badge on microbadger.com")
And for `debian-15-current` [![](https://images.microbadger.com/badges/image/andrius/asterisk:debian-15-current.svg)](https://microbadger.com/images/andrius/asterisk:debian-15-current "Get your own image badge on microbadger.com").
# Custom UID/GID

16
debian-10.12.4/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
# vim:set ft=dockerfile:
FROM debian:jessie-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 10.12.4
COPY build-asterisk.sh /
RUN /build-asterisk.sh
EXPOSE 5060/udp 5060/tcp
VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "asterisk", "-p"]

119
debian-10.12.4/build-asterisk.sh Executable file
View File

@ -0,0 +1,119 @@
#!/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 -y --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 \
portaudio19-dev \
unixodbc \
unixodbc-bin \
unixodbc-dev \
odbcinst \
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

View File

@ -0,0 +1,25 @@
#!/bin/sh
# run as user asterisk by default
ASTERISK_USER=${ASTERISK_USER:-asterisk}
if [ "$1" = "" ]; then
COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf"
else
COMMAND="$@"
fi
if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then
# recreate user and group for asterisk
# if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders
deluser asterisk && \
adduser --gecos "" --no-create-home --uid ${ASTERISK_UID} --disabled-password ${ASTERISK_USER} \
|| exit
fi
chown -R ${ASTERISK_USER}: /var/log/asterisk \
/var/lib/asterisk \
/var/run/asterisk \
/var/spool/asterisk; \
exec ${COMMAND}

View File

@ -17,6 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i
build-essential \
ca-certificates \
curl \
file \
libcurl4-openssl-dev \
libedit-dev \
libgsm1-dev \
@ -100,7 +101,19 @@ rm -rf /usr/src/asterisk \
# remove *-dev packages
devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs`
DEBIAN_FRONTEND=noninteractive apt-get --yes purge ${devpackages} autoconf build-essential
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

View File

@ -17,6 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i
build-essential \
ca-certificates \
curl \
file \
libcurl4-openssl-dev \
libedit-dev \
libgsm1-dev \
@ -100,7 +101,19 @@ rm -rf /usr/src/asterisk \
# remove *-dev packages
devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs`
DEBIAN_FRONTEND=noninteractive apt-get --yes purge ${devpackages} autoconf build-essential
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

View File

@ -17,6 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i
build-essential \
ca-certificates \
curl \
file \
libcurl4-openssl-dev \
libedit-dev \
libgsm1-dev \
@ -111,7 +112,19 @@ rm -rf /usr/src/asterisk \
# remove *-dev packages
devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs`
DEBIAN_FRONTEND=noninteractive apt-get --yes purge ${devpackages} autoconf build-essential
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

View File

@ -17,6 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i
build-essential \
ca-certificates \
curl \
file \
libcurl4-openssl-dev \
libedit-dev \
libgsm1-dev \
@ -111,7 +112,19 @@ rm -rf /usr/src/asterisk \
# remove *-dev packages
devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs`
DEBIAN_FRONTEND=noninteractive apt-get --yes purge ${devpackages} autoconf build-essential
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

View File

@ -17,6 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-i
build-essential \
ca-certificates \
curl \
file \
libcurl4-openssl-dev \
libedit-dev \
libgsm1-dev \
@ -111,7 +112,19 @@ rm -rf /usr/src/asterisk \
# remove *-dev packages
devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs`
DEBIAN_FRONTEND=noninteractive apt-get --yes purge ${devpackages} autoconf build-essential
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

View File

@ -0,0 +1,17 @@
# vim:set ft=dockerfile:
FROM debian:stretch-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 16.0.0-rc3
ENV OPUS_CODEC asterisk-16.0/x86-64/codec_opus-16.0_current-x86_64
COPY build-asterisk.sh /
RUN /build-asterisk.sh
EXPOSE 5060/udp 5060/tcp
VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "asterisk", "-p"]

View File

@ -0,0 +1,145 @@
FROM centos:6
MAINTAINER Andrius Kairiukstis <andrius@kairiukstis.com>
RUN yum -y install gcc gcc-c++ cpp ncurses ncurses-devel libxml2 libxml2-devel openssl-devel \
newt-devel libuuid-devel net-snmp-devel xinetd tar libffi-devel sqlite-devel curl bison supervisor \
&& mkdir /tmp/asterisk \
&& curl -sf -o /tmp/asterisk.tar.gz -L http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-11.6-current.tar.gz \
&& tar -xzf /tmp/asterisk.tar.gz -C /tmp/asterisk --strip-components=1 \
&& cd /tmp/asterisk \
&& ./configure --libdir=/usr/lib64 \
&& make menuselect \
&& menuselect/menuselect \
--disable-all \
--disable-category MENUSELECT_ADDONS \
--disable-category MENUSELECT_APPS \
--disable-category MENUSELECT_BRIDGES \
--disable-category MENUSELECT_CDR \
--disable-category MENUSELECT_CEL \
--disable-category MENUSELECT_CHANNELS \
--enable-category MENUSELECT_CODECS \
--enable-category MENUSELECT_FORMATS \
--disable-category MENUSELECT_FUNCS \
--disable-category MENUSELECT_PBX \
--disable-category MENUSELECT_RES \
--disable-category MENUSELECT_TESTS \
--disable-category MENUSELECT_UTILS \
--disable-category MENUSELECT_AGIS \
--disable-category MENUSELECT_EMBED \
--enable-category MENUSELECT_CORE_SOUNDS \
--enable-category MENUSELECT_MOH \
--enable-category MENUSELECT_EXTRA_SOUNDS \
--disable-category MENUSELECT_TESTS \
--enable-category MENUSELECT_OPTS_app_voicemail \
--enable func_module \
--enable LOADABLE_MODULES \
--enable FILE_STORAGE \
--disable codec_dahdi \
--enable app_dial \
--enable app_exec \
--enable app_originate \
--enable app_verbose \
--enable chan_sip \
--enable pbx_config \
--enable res_agi \
--enable res_convert \
--enable res_musiconhold \
--enable res_timing_timerfd \
--disable BUILD_NATIVE \
menuselect.makeopts \
&& make config \
&& make \
&& make install \
&& mkdir -p /var/lib/asterisk/phoneprov \
&& make samples \
&& make dist-clean \
&& sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk \
&& cd .. \
&& rm /tmp/asterisk.tar.gz \
&& rm -rf /tmp/asterisk \
&& yum -y clean all \
&& rm -rf /var/cache/yum/*
# RUN yum -y update \
# && yum -y install epel-release \
# && yum -y install kernel-headers gcc gcc-c++ cpp ncurses ncurses-devel libxml2 libxml2-devel sqlite sqlite-devel \
# mysql-devel openssl-devel newt-devel kernel-devel libuuid-devel net-snmp-devel xinetd tar libffi-devel \
# curl pcre-devel bison mysql-devel ngrep tmux \
# && mkdir /tmp/asterisk \
# && curl -sf -o /tmp/asterisk.tar.gz -L http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-11.6-current.tar.gz \
# && tar -xzf /tmp/asterisk.tar.gz -C /tmp/asterisk --strip-components=1 \
# && cd /tmp/asterisk \
# && ./configure --libdir=/usr/lib64 \
# && make menuselect \
# && menuselect/menuselect \
# --disable-category MENUSELECT_ADDONS \
# --disable-category MENUSELECT_APPS \
# --disable-category MENUSELECT_BRIDGES \
# --disable-category MENUSELECT_CDR \
# --disable-category MENUSELECT_CEL \
# --disable-category MENUSELECT_CHANNELS \
# --enable-category MENUSELECT_CODECS \
# --enable-category MENUSELECT_FORMATS \
# --disable-category MENUSELECT_FUNCS \
# --disable-category MENUSELECT_PBX \
# --disable-category MENUSELECT_RES \
# --disable-category MENUSELECT_TESTS \
# --disable-category MENUSELECT_OPTS_app_voicemail \
# --disable-category MENUSELECT_UTILS \
# --disable-category MENUSELECT_AGIS \
# --disable-category MENUSELECT_EMBED \
# --disable-category MENUSELECT_CORE_SOUNDS \
# --disable-category MENUSELECT_MOH \
# --disable-category MENUSELECT_EXTRA_SOUNDS \
# --enable app_controlplayback \
# --enable app_dial \
# --enable app_exec \
# --enable app_originate \
# --enable app_queue \
# --enable app_record \
# --enable app_senddtmf \
# --enable app_stasis \
# --enable app_verbose \
# --enable app_waituntil \
# --enable chan_sip \
# --enable pbx_config \
# --enable pbx_realtime \
# --enable res_agi \
# --enable res_ari \
# --enable res_ari_channels \
# --enable res_ari_events \
# --enable res_ari_playbacks \
# --enable res_ari_recordings \
# --enable res_ari_sounds \
# --enable res_ari_device_states \
# --enable res_realtime \
# --enable res_rtp_asterisk \
# --enable res_rtp_multicast \
# --enable res_stasis \
# --enable res_stasis_answer \
# --enable res_stasis_device_state \
# --enable res_stasis_playback \
# --enable res_stasis_recording \
# --enable res_stun_monitor \
# --enable res_timing_timerfd \
# --enable func_callcompletion \
# --enable func_callerid \
# --disable BUILD_NATIVE \
# menuselect.makeopts \
# && make config \
# && make \
# && make install \
# && mkdir -p /var/lib/asterisk/phoneprov \
# && make samples \
# && make dist-clean \
# && sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk \
# && cd .. \
# && rm /tmp/asterisk.tar.gz \
# && rm -rf /tmp/asterisk \
# && yum -y clean all \
# && rm -rf /var/cache/yum/*
#
# CMD asterisk -fvvvvv

View File

@ -0,0 +1,131 @@
#!/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 -y --no-install-recommends --no-install-suggests \
autoconf \
binutils-dev \
build-essential \
ca-certificates \
curl \
file \
libcurl4-openssl-dev \
libedit-dev \
libgsm1-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 \
portaudio19-dev \
unixodbc \
unixodbc-bin \
unixodbc-dev \
odbcinst \
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 \
--with-jansson-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
# codecs
# menuselect/menuselect --enable codec_opus menuselect.makeopts
# menuselect/menuselect --enable codec_silk 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
# Install opus, for some reason menuselect option above does not working
mkdir -p /usr/src/codecs/opus \
&& cd /usr/src/codecs/opus \
&& curl -vsL http://downloads.digium.com/pub/telephony/codec_opus/${OPUS_CODEC}.tar.gz | tar --strip-components 1 -xz \
&& cp *.so /usr/lib/asterisk/modules/ \
&& cp codec_opus_config-en_US.xml /var/lib/asterisk/documentation/
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

View File

@ -0,0 +1,25 @@
#!/bin/sh
# run as user asterisk by default
ASTERISK_USER=${ASTERISK_USER:-asterisk}
if [ "$1" = "" ]; then
COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf"
else
COMMAND="$@"
fi
if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then
# recreate user and group for asterisk
# if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders
deluser asterisk && \
adduser --gecos "" --no-create-home --uid ${ASTERISK_UID} --disabled-password ${ASTERISK_USER} \
|| exit
fi
chown -R ${ASTERISK_USER}: /var/log/asterisk \
/var/lib/asterisk \
/var/run/asterisk \
/var/spool/asterisk; \
exec ${COMMAND}