Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and push

on:
push:
branches: [master]
paths:
- Dockerfile
- .github/workflows/build_and_push.yml
tags:
- "*"
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm
tags: ${{ secrets.DOCKERHUB_USERNAME }}/asterisk-rpi:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
21 changes: 21 additions & 0 deletions .github/workflows/dockerhub_description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Update Docker Hub Description
on:
push:
branches:
- master
paths:
- README.md
- .github/workflows/dockerhub_description.yml

jobs:
update-description:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update repo description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.DOCKERHUB_USERNAME }}/asterisk-rpi
short-description: ${{ github.event.repository.description }}
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
FROM debian:buster

LABEL maintainer="Radroxxx <[email protected]>"

ENV ASTERISK_VERSION certified/13.21-cert4
ENV ASTERIS_VERSION_DONGLE 13.21
ENV ASTERISK_VERSION certified/13.21-cert6
ENV ASTERISK_VERSION_DONGLE 13.21
ENV DEBIAN_FRONTEND=noninteractive

RUN set -x \
Expand All @@ -16,7 +14,7 @@ RUN set -x \
&& cd /usr/local/src/asterisk \
&& yes | contrib/scripts/install_prereq install \
&& contrib/scripts/install_prereq test \
&& ./bootstrap.sh && ./configure \
&& ./bootstrap.sh && ./configure --with-pjproject-bundled \
&& make menuselect.makeopts \
&& menuselect/menuselect --disable BUILD_NATIVE --disable-all \
--enable chan_bridge_media \
Expand Down Expand Up @@ -48,6 +46,7 @@ RUN set -x \
--enable format_ogg_vorbis \
--enable format_h264 \
--enable format_h263 \
--enable func_base64 \
--enable func_callerid \
--enable func_cdr \
--enable func_channel \
Expand Down Expand Up @@ -181,24 +180,26 @@ RUN set -x \
&& make clean \
# Install chan-dongle
&& cd /usr/local/src/chan-dongle \
&& ./bootstrap && ./configure --with-astversion=${ASTERIS_VERSION_DONGLE} \
&& ./bootstrap && ./configure --with-astversion=${ASTERISK_VERSION_DONGLE} \
&& make all \
&& make install \
&& make distclean \
# Postinstall
&& addgroup --system --gid 1000 asterisk \
&& adduser --system --uid 1000 --ingroup asterisk --quiet -home /var/lib/asterisk --no-create-home --disabled-login --gecos "Asterisk PBX daemon" asterisk \
&& chown -R asterisk:asterisk /var/*/asterisk \
&& chown -R asterisk:dialout /var/*/asterisk \
&& chmod -R 750 /var/spool/asterisk \
# Optional packages
&& apt-get install -y --no-install-recommends sendemail libnet-ssleay-perl libio-socket-ssl-perl \
&& rm -rf /var/lib/apt/lists/*

EXPOSE 5038 8088 5060/udp 5061/udp 5062/udp
EXPOSE 5060/udp 5061/udp 5062/udp

STOPSIGNAL SIGTERM

WORKDIR /var/lib/asterisk/
HEALTHCHECK --interval=5s --timeout=10s --retries=3 CMD /usr/sbin/asterisk -rx "core show sysinfo"
HEALTHCHECK --interval=10s --timeout=10s --retries=3 CMD /usr/sbin/asterisk -rx "core show sysinfo"

ENTRYPOINT ["/usr/sbin/asterisk","-f","-n","-Uasterisk","-Gasterisk"]
ENTRYPOINT ["/usr/sbin/asterisk","-f","-n","-Uasterisk","-Gdialout"]

CMD ["-v"]
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# asterisk
Asterisk + chan_dongle in docker.
# Asterisk + chan_dongle

[![Build and push](https://github.com/dec0dos/asterisk-docker/actions/workflows/build_and_push.yml/badge.svg)](https://github.com/dec0dos/asterisk-docker/actions/workflows/build_and_push.yml)

This repository contains docker configuration and provides images for [Asterisk](https://www.asterisk.org/) with [chan_dongle](https://github.com/wdoekes/asterisk-chan-dongle).

Docker repository: [dec0dos/asterisk-rpi](https://hub.docker.com/r/dec0dos/asterisk-rpi)

GitHub repository: [dec0dos/asterisk-docker](https://github.com/dec0dos/asterisk-docker/)

# Basic usage

## Using images from hub.docker.com

Dockerhub contains docker images with compiled binaries for the following platforms: amd64, arm64, armv7.

To start container run the following command:

```sh
docker run -dit --name asterisk --volume /etc/asterisk:/etc/asterisk --network host --device /dev/ttyUSB0:/dev/ttyUSB0 --device /dev/ttyUSB1:/dev/ttyUSB1 --device /dev/ttyUSB2:/dev/ttyUSB2 --device /dev/ttyUSB3:/dev/ttyUSB3 --device /dev/ttyUSB4:/dev/ttyUSB4 --restart unless-stopped dec0dos/asterisk-rpi:latest
```

where:

- `/etc/asterisk` is a directory with asterisk configuration.
- `--device /dev/ttyUSBX:/dev/ttyUSBX` is a path to the USB devices of Huawei UMTS card

## Build yourself

To build the image locally run:

```sh
docker build -t asterisk https://raw.githubusercontent.com/dec0dos/asterisk-docker/master/Dockerfile
```