Sign inSign up

imansur/asterisk-pbx

By imansur

•Updated 3 months ago

Image
0

307

imansur/asterisk-pbx repository overview

⁠Asterisk 20 LTS Multi-Arch Docker Setup

This project provides an Asterisk 20 LTS Docker image, specifically compiled from source to ensure seamless compatibility across different architectures, including macOS (ARM64) and Linux (AMD64).

It natively integrates advanced and open-source codecs that are usually missing from standard Asterisk packages due to licensing or repository restrictions.

⁠📦 Features and Contents

⁠1. Custom Compiled Codecs

The image supports traditional G.711 codecs alongside specialized codecs designed for bandwidth and performance:

  • G.729A (via the BelledonneCommunications bcg729 open-source library)
  • Opus Codec (For High-Definition audio support)
  • H.264 & VP8 (Video Passthrough to support video calls)
  • Standard Codecs: G.711 (alaw/ulaw), G.722, Speex, etc.
⁠2. Networking and Debugging Tools

This container is not just an "empty Linux." It comes pre-installed with the most essential tools required for testing and debugging network or SIP traffic on a PBX server:

  • sngrep: Terminal-based concurrent SIP traffic analyzer (The most powerful tool for troubleshooting).
  • tcpdump: Network packet analyzer.
  • ping and net-tools (netstat): For connectivity checks.
  • curl: For API and HTTP testing.
  • vim and nano: Built-in editors for quick text and configuration changes inside the container.
  • procps: For process management (top, ps commands).

⁠🚀 Build Instructions

Open your terminal (macOS or Linux), navigate to the directory containing the Dockerfile, and run the following command:

docker build -t asterisk-pbx .

(Note: Because this process compiles Asterisk from source code (C), it may take 5-10 minutes depending on your processor speed.)


⁠🏃‍♂️ Run Instructions

Once the image is successfully built, you can start the server in the background (-d detached mode):

docker run -d --name asterisk-server -p 5060:5060/udp asterisk-pbx

By default, SIP traffic over UDP uses port 5060. That is why we map 5060:5060/udp. If necessary, you can also map RTP ports (e.g., 10000-10099/udp) by adding -p 10000-10099:10000-10099/udp to the command.


⁠⚙️ Configuration Files

In this project structure, Asterisk's core settings are read from the config/ directory located in your current path. During the Dockerfile build, all files inside your config/ folder (pjsip.conf, extensions.conf, modules.conf, etc.) are copied into the /etc/asterisk/ directory inside the image.

When you make a configuration change:

  1. Update your local files in the config/ directory.
  2. Rebuild the image using docker build -t asterisk-pbx ..
  3. Stop the old container and start a new one using the docker run ... command.

(Alternatively, for testing purposes, you can bind-mount the config/ directory using the -v flag so you don't have to rebuild every time: docker run -d --name asterisk-server -p 5060:5060/udp -v $(pwd)/config:/etc/asterisk asterisk-pbx)


⁠🛠 Useful Commands

To view real-time Asterisk logs:

docker logs -f asterisk-server

To enter the container and monitor SIP packets second-by-second with sngrep:

docker exec -it asterisk-server sngrep

To securely log into the Asterisk Command Line Interface (CLI):

docker exec -it asterisk-server asterisk -r

(Once inside the CLI, you can check the internal state of Asterisk using commands like pjsip show endpoints, core show codecs, etc.)

Tag summary

Content type

Image

Digest

sha256:3ae17b360…

Size

393.9 MB

Last updated

3 months ago

docker pull imansur/asterisk-pbx