Early versions of asterisk: 1.2, 1.4 and 1.6, symlinks

This commit is contained in:
Andrius Kairiukstis 2019-04-09 07:05:40 +02:00
parent dce641242a
commit 6781441751
31 changed files with 856 additions and 2 deletions

1
1.2.40 Symbolic link
View File

@ -0,0 +1 @@
centos7-1.2.40

1
1.4.44 Symbolic link
View File

@ -0,0 +1 @@
centos7-1.4.44

1
1.6.2.24 Symbolic link
View File

@ -0,0 +1 @@
centos7-1.6.2.24

1
11-slim Symbolic link
View File

@ -0,0 +1 @@
alpine-2.7-11.x

1
13-current Symbolic link
View File

@ -0,0 +1 @@
debian-stretch-slim-13-current

1
14-current Symbolic link
View File

@ -0,0 +1 @@
debian-stretch-slim-14-current

1
14-slim Symbolic link
View File

@ -0,0 +1 @@
alpine-3.6-14.x

1
15-current Symbolic link
View File

@ -0,0 +1 @@
debian-stretch-slim-15-current

1
15-slim Symbolic link
View File

@ -0,0 +1 @@
alpine-3.9-15.x

1
16-current Symbolic link
View File

@ -0,0 +1 @@
debian-buster-slim-16-current

View File

@ -0,0 +1,28 @@
# vim:set ft=dockerfile:
FROM alpine:3.9
MAINTAINER Andrius Kairiukstis <andrius@kairiukstis.com>
RUN apk add --update \
asterisk \
asterisk-sample-config \
&& asterisk -U asterisk \
&& sleep 5 \
&& pkill -9 asterisk \
&& pkill -9 astcanary \
&& sleep 2 \
&& rm -rf /var/run/asterisk/* \
&& mkdir -p /var/spool/asterisk/fax \
&& chown -R asterisk: /var/spool/asterisk/fax \
&& truncate -s 0 /var/log/asterisk/messages \
/var/log/asterisk/queue_log \
&& rm -rf /var/cache/apk/* \
/tmp/* \
/var/tmp/*
EXPOSE 5060/udp 5060/tcp
VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk
ADD docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

View File

@ -0,0 +1,28 @@
# vim:set ft=dockerfile:
FROM alpine:3.8
MAINTAINER Andrius Kairiukstis <andrius@kairiukstis.com>
RUN apk add --update \
asterisk \
asterisk-sample-config \
&& asterisk -U asterisk \
&& sleep 5 \
&& pkill -9 asterisk \
&& pkill -9 astcanary \
&& sleep 2 \
&& rm -rf /var/run/asterisk/* \
&& mkdir -p /var/spool/asterisk/fax \
&& chown -R asterisk: /var/spool/asterisk/fax \
&& truncate -s 0 /var/log/asterisk/messages \
/var/log/asterisk/queue_log \
&& rm -rf /var/cache/apk/* \
/tmp/* \
/var/tmp/*
EXPOSE 5060/udp 5060/tcp
VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk
ADD docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

View File

@ -0,0 +1,27 @@
#!/bin/sh
# run as user asterisk by default
ASTERISK_USER=${ASTERISK_USER:-asterisk}
ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}}
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 && \
addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \
adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${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,27 @@
#!/bin/sh
# run as user asterisk by default
ASTERISK_USER=${ASTERISK_USER:-asterisk}
ASTERISK_GROUP=${ASTERISK_GROUP:-${ASTERISK_USER}}
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 && \
addgroup -g ${ASTERISK_GID} ${ASTERISK_GROUP} && \
adduser -D -H -u ${ASTERISK_UID} -G ${ASTERISK_GROUP} ${ASTERISK_USER} \
|| exit
fi
chown -R ${ASTERISK_USER}: /var/log/asterisk \
/var/lib/asterisk \
/var/run/asterisk \
/var/spool/asterisk; \
exec ${COMMAND}

21
build-and-push.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# https://stackoverflow.com/questions/4000613/bash-for-each-directory
for DIR in *; do
if [ -d "${DIR}" ]; then
TAG=${DIR}
cd ${TAG}
docker build --pull --force-rm -t andrius/asterisk:${TAG} --file ./Dockerfile . && \
docker run -d --rm --name asterisk-${TAG} andrius/asterisk:${TAG} && \
sleep 5 && \
docker exec -ti asterisk-${TAG} sh -c 'cat /etc/iss*' && \
docker exec -ti asterisk-${TAG} sh -c 'asterisk -rx "core show version"; exit $?' && echo "ok $?" || echo "not ok" ; \
docker stop asterisk-${TAG}; \
docker push andrius/asterisk:${TAG}; \
docker rmi -f andrius/asterisk:${TAG}
cd ..
fi
done

View File

@ -6,7 +6,7 @@ cd ${TAG} && \
docker build --pull --force-rm -t andrius/asterisk:${TAG} --file ./Dockerfile . && \
docker run -d --rm --name asterisk-${TAG} andrius/asterisk:${TAG} && \
sleep 3 && \
docker exec -ti asterisk-${TAG} sh -c "cat /etc/iss*"; \
docker exec -ti asterisk-${TAG} sh -c "asterisk -rx 'core show version'"; \
docker exec -ti asterisk-${TAG} sh -c 'cat /etc/iss*' && \
docker exec -ti asterisk-${TAG} sh -c 'asterisk -rx "core show version"; exit $?' && echo "ok $?" || echo "not ok" ; \
docker stop asterisk-${TAG}; \
cd ..

17
centos7-1.2.40/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# vim:set ft=dockerfile:
FROM centos:7
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 1.2.40
ENV ASTERISK_ADDONS_VERSION 1.2.9
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", "-U", "asterisk", "-p"]

View File

@ -0,0 +1,78 @@
#!/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
yum -y install \
cpp \
gcc \
gcc-c++ \
make \
ncurses \
ncurses-devel \
libxml2 \
libxml2-devel \
openssl-devel \
newt-devel \
libuuid-devel \
net-snmp-devel \
xinetd \
tar \
libffi-devel \
sqlite-devel \
curl \
bison
mkdir -p /usr/src/asterisk \
/usr/src/asterisk/addons
cd /usr/src/asterisk/addons
curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-addons-${ASTERISK_ADDONS_VERSION}.tar.gz | tar --strip-components 1 -xz
cd /usr/src/asterisk
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 ))}
mkdir -p /etc/asterisk/ \
/var/spool/asterisk/fax
make -j ${JOBS} all
make install
# copy default configs
# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/
make samples
cd /usr/src/asterisk/addons
make -j ${JOBS} all
make install
# make samples
cd /usr/src/asterisk/addons/asterisk-ooh323c/
./configure
make -j ${JOBS} all
make install
make sample
chown -R asterisk:asterisk /etc/asterisk \
/var/*/asterisk \
/usr/*/asterisk
chmod -R 750 /var/spool/asterisk
cd /
rm -rf /usr/src/asterisk
yum -y clean all
rm -rf /var/cache/yum/*
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}

17
centos7-1.4.44/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# vim:set ft=dockerfile:
FROM centos:7
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 1.4.44
ENV ASTERISK_ADDONS_VERSION 1.4.13
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", "-U", "asterisk", "-p"]

View File

@ -0,0 +1,90 @@
#!/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
yum -y install \
cpp \
gcc \
gcc-c++ \
make \
ncurses \
ncurses-devel \
libxml2 \
libxml2-devel \
openssl-devel \
newt-devel \
libuuid-devel \
net-snmp-devel \
xinetd \
tar \
libffi-devel \
sqlite-devel \
curl \
bison
mkdir -p /usr/src/asterisk \
/usr/src/asterisk/addons
cd /usr/src/asterisk/addons
curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-addons-${ASTERISK_ADDONS_VERSION}.tar.gz | tar --strip-components 1 -xz
cd /usr/src/asterisk
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 ))}
mkdir -p /etc/asterisk/ \
/var/spool/asterisk/fax
./configure --libdir=/usr/lib64
make menuselect/menuselect menuselect-tree menuselect.makeopts
# we don't need any sounds in docker, they will be mounted as volume
menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect.makeopts
menuselect/menuselect --disable-category MENUSELECT_MOH menuselect.makeopts
menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS menuselect.makeopts
make -j ${JOBS} all
make install
# copy default configs
# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/
make samples
make dist-clean
# set runuser and rungroup
sed -i -E 's/^;(run)(user|group)/\1\2/' /etc/asterisk/asterisk.conf
sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk
cd /usr/src/asterisk/addons
./configure --libdir=/usr/lib64
make menuselect/menuselect menuselect-tree menuselect.makeopts
make -j ${JOBS} all
make install
make samples
chown -R asterisk:asterisk /etc/asterisk \
/var/*/asterisk \
/usr/*/asterisk \
/usr/lib64/asterisk
chmod -R 750 /var/spool/asterisk
cd /
rm -rf /usr/src/asterisk \
/usr/src/codecs
yum -y clean all
rm -rf /var/cache/yum/*
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 centos:7
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 1.6.2.24
ENV ASTERISK_ADDONS_VERSION 1.6.2.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"]

View File

@ -0,0 +1,96 @@
#!/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
yum -y install \
cpp \
gcc \
gcc-c++ \
make \
ncurses \
ncurses-devel \
libxml2 \
libxml2-devel \
openssl-devel \
newt-devel \
libuuid-devel \
net-snmp-devel \
xinetd \
tar \
libffi-devel \
sqlite-devel \
curl \
bison
mkdir -p /usr/src/asterisk \
/usr/src/asterisk/addons
cd /usr/src/asterisk/addons
curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-addons-${ASTERISK_ADDONS_VERSION}.tar.gz | tar --strip-components 1 -xz
cd /usr/src/asterisk
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 ))}
mkdir -p /etc/asterisk/ \
/var/spool/asterisk/fax
./configure --libdir=/usr/lib64
make menuselect/menuselect menuselect-tree menuselect.makeopts
# we don't need any sounds in docker, they will be mounted as volume
menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect.makeopts
menuselect/menuselect --disable-category MENUSELECT_MOH menuselect.makeopts
menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS menuselect.makeopts
make -j ${JOBS} all
make install
# copy default configs
# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/
make samples
make dist-clean
# set runuser and rungroup
sed -i -E 's/^;(run)(user|group)/\1\2/' /etc/asterisk/asterisk.conf
sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk
cd /usr/src/asterisk/addons
./configure --libdir=/usr/lib64
make menuselect/menuselect menuselect-tree menuselect.makeopts
# disable saycountpl
menuselect/menuselect --disable app_saycountpl
# enable ooh323
menuselect/menuselect --enable chan_ooh323 menuselect.makeopts
make -j ${JOBS} all
make install
make samples
chown -R asterisk:asterisk /etc/asterisk \
/var/*/asterisk \
/usr/*/asterisk \
/usr/lib64/asterisk
chmod -R 750 /var/spool/asterisk
cd /
rm -rf /usr/src/asterisk \
/usr/src/codecs
yum -y clean all
rm -rf /var/cache/yum/*
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:buster-slim
LABEL maintainer="Andrius Kairiukstis <k@andrius.mobi>"
ENV ASTERISK_VERSION 16-current
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,135 @@
#!/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 \
libsrtp2-dev \
libssl-dev \
libvorbis-dev \
libxml2-dev \
libxslt1-dev \
procps \
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
# enable ooh323
menuselect/menuselect --enable chan_ooh323 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.makeopts
menuselect/menuselect --disable-category MENUSELECT_MOH menuselect.makeopts
menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS menuselect.makeopts
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,24 @@
#!/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
chown -R ${ASTERISK_UID}:${ASTERISK_UID} /etc/asterisk \
/var/*/asterisk \
/usr/*/asterisk
fi
exec ${COMMAND}

1
edge Symbolic link
View File

@ -0,0 +1 @@
alpine-edge

1
latest Symbolic link
View File

@ -0,0 +1 @@
alpine-latest