debian versions

This commit is contained in:
Andrius Kairiukstis 2018-07-20 16:56:21 +02:00
parent 9e4dc7ee41
commit e83b1487f2
19 changed files with 1113 additions and 36 deletions

View File

@ -6,45 +6,20 @@ 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 is only:
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")
# Versions
and for `debian-15-latest`:
Based on Alpine linux:
- `docker pull andrius/asterisk:11.6.1` for Asterisk 11.x (stable release), on Alpine 2.6
- `docker pull andrius/asterisk:11` for Asterisk 11.x (stable release), on Alpine 2.7
- `docker pull andrius/asterisk:14` for Asterisk 14.x, on Alpine 3.6
- `docker pull andrius/asterisk:15.2.2` for Asterisk 15.2.2, on Alpine 3.7
- `docker pull andrius/asterisk:15` for Asterisk 15.x, on Alpine 3.8
- `docker pull andrius/asterisk:latest` for Asterisk 15.x, on Alpine latest
- `docker pull andrius/asterisk:edge` for latest Asterisk 15.x, based on Alpine edge
# What's missing
Only base Asterisk packages installed. If you want to add sounds, it's recommended to mount them as volume or data container, however you may install additional packages with `apk` command:
- asterisk-sounds-en
- asterisk-sounds-moh
- asterisk-alsa
- asterisk-srtp
- asterisk-curl
- asterisk-tds
- asterisk-mobile
- asterisk-dahdi
- asterisk-fax
- asterisk-speex
- asterisk-pgsql
- asterisk-odbc
[![](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")
# Custom UID/GID
By default, Asterisk will run as default user (asterisk) with UID and GID assigned by alpine linux, but it's possible to specify then through environment variables:
- `ASTERISK_UID`
- `ASTERISK_GID`
- `ASTERISK_GID` (note, GID is not supported in debian releases)
Default asterisk user will be re-created with new UID and GID
@ -65,7 +40,39 @@ It is possible to specifty other than asterisk user to start through environment
```bash
docker run -ti --rm -e ASTERISK_USER=root andrius/asterisk
```
# Database support
# Versions
## Based on Alpine linux:
- `docker pull andrius/asterisk:11.6.1` for Asterisk 11.x (stable release), Alpine 2.6
- `docker pull andrius/asterisk:11` for Asterisk 11.x (stable release), Alpine 2.7
- `docker pull andrius/asterisk:14` for Asterisk 14.x, Alpine 3.6
- `docker pull andrius/asterisk:15.2.2` for Asterisk 15.2.2, Alpine 3.7
- `docker pull andrius/asterisk:15` for Asterisk 15.x, Alpine 3.8
- `docker pull andrius/asterisk:latest` for Asterisk 15.x, Alpine latest
- `docker pull andrius/asterisk:edge` for latest Asterisk 15.x, based on Alpine edge
### What's missing
Only base Asterisk packages installed. If you want to add sounds, it's recommended to mount them as volume or data container, however you may install additional packages with `apk` command:
- asterisk-alsa - ALSA channel;
- asterisk-cdr-mysql - MySQL CDR;
- asterisk-chan-dongle - chan\_dongle, to manage calls and SMS through Huawei USB dongle;
- asterisk-curl - curl integration with Asterisk;
- asterisk-dahdi - DAHDI channel (ISDN BRI/PRI, FXO and FXS cards integration);
- asterisk-fax - support faxing
- asterisk-mobile - Use Bluetooth mobile phones as FXO devices;
- asterisk-odbc - ODBC support;
- asterisk-pgsql - PostgreSQL support;
- asterisk-sounds-en - sounds
- asterisk-sounds-moh - music on hold;
- asterisk-speex - Speex codec;
- asterisk-srtp - SRTP encryption;
- asterisk-tds - MS SQL support.
### Database support
By default, Asterisk PBX store CDR's to the CSV file, but also support databases. Refer Asterisk PBX documentation for ODBC support.
@ -78,10 +85,19 @@ RUN apk add --update less psqlodbc asterisk-odbc asterisk-pgsql \
And For MySQL:
```bash
RUN apk add --update psqlodbc asterisk-odbc \
&& apk add mysql-connector-odbc --update-cache --repository http://dl-4.alpinelinux.org/alpine/edge/testing/ --allow-untrusted \
&& rm -rf /var/cache/apk/*
```
For MySQL, `mysql-connector-odbc` should be downloaded from the official site and compiled
## Based on Debian linux:
debian-11.25.3 debian-12.8.2 debian-13-current debian-14-current debian-15-current
Debian Jessie:
- `docker pull andrius/asterisk:debian-11.25.3`
- `docker pull andrius/asterisk:debian-12.8.2`
Debian Stretch:
- `docker pull andrius/asterisk:debian-13-current`
- `docker pull andrius/asterisk:debian-14-current`
- `docker pull andrius/asterisk:debian-15-current`

16
debian-11.25.3/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 11.25.3
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"]

106
debian-11.25.3/build-asterisk.sh Executable file
View File

@ -0,0 +1,106 @@
#!/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 \
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 ${devpackages} autoconf build-essential
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}

16
debian-12.8.2/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 12.8.2
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"]

106
debian-12.8.2/build-asterisk.sh Executable file
View File

@ -0,0 +1,106 @@
#!/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 \
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 ${devpackages} autoconf build-essential
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

@ -0,0 +1,17 @@
# vim:set ft=dockerfile:
FROM debian:stretch-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 13-current
ENV OPUS_CODEC asterisk-13.0/x86-64/codec_opus-13.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,117 @@
#!/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 \
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
# 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 ${devpackages} autoconf build-essential
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

@ -0,0 +1,17 @@
# vim:set ft=dockerfile:
FROM debian:stretch-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 14-current
ENV OPUS_CODEC asterisk-14.0/x86-64/codec_opus-14.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,117 @@
#!/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 \
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
# 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 ${devpackages} autoconf build-essential
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

@ -0,0 +1,17 @@
# vim:set ft=dockerfile:
FROM debian:stretch-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 15-current
ENV OPUS_CODEC asterisk-15.0/x86-64/codec_opus-15.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,117 @@
#!/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 \
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
# 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 ${devpackages} autoconf build-essential
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

@ -23,5 +23,5 @@ fi
chown -R ${ASTERISK_USER}: /var/log/asterisk \
/var/lib/asterisk \
/var/run/asterisk \
/var/spool/asterisk; \
/var/spool/asterisk
exec ${COMMAND}