Setting Up a Standalone GSM Gateway with Raspberry Pi and Asterisk
Introduction
This blog post describes how to set up a standalone GSM gateway that:
- Can receive and make calls in a remote location, operating in standalone mode.
- Is easy to set up and maintain.
- Is budget-friendly, with minimal expenses beyond hardware.
Hardware
- SD Card
- Raspberry Pi 4B
- LTE Hat (Waveshare SIM7600E-H)
Software
- Debian-based OS for Raspberry Pi
- Asterisk as the VoIP Server
- Other essential Linux utilities
Installing the OS on Raspberry Pi
32-bit OS
Use the official RASPIOS Lite image: Download RASPIOS Lite 32-bit
To ensure 32-bit mode:
vim /boot/config.txt
# or
nano /boot/config.txt
Add:
arm_64bit=0
64-bit OS
⚠️ Asterisk is not available in the 64-bit repository by default.
Alternative approach:
- Install a 64-bit base system
- Add source repositories
- Build Asterisk from source
Installing Asterisk and Required Modules
Set Up the Basic System
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential libasound2-dev libsqlite3-dev autoconf automake git zsh screen vim asterisk asterisk-dev mosh libtool pkg-config
Optional (but essential): Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Compiling G.729 Codecs for ARM with BCG729
Based on “Compiling g729 codecs for ARM on Raspberry Pi B+ with bcg729”
Compiling the BCG729 Library
mkdir -p $HOME/src
cd $HOME/src
wget http://download-mirror.savannah.gnu.org/releases/linphone/plugins/sources/bcg729-1.0.2.tar.gz
tar xzf bcg729-1.0.2.tar.gz
cd bcg729-1.0.2
./configure --libdir=/lib
make
sudo make install
Compiling G.729 Codecs
cd $HOME/src
git clone git@github.com:arkadijs/asterisk-g72x.git
cd asterisk-g72x
./autogen.sh
DESTDIR=/usr/lib/asterisk/modules ./configure --with-bcg729
make
sudo make install
Test Modules in Asterisk
sudo systemctl restart asterisk
sudo asterisk -rvvv
asterisk*CLI> core show translation recalc 10
Installing Channel Drivers
Quectel & Simcom Modules
cd $HOME/src
# git clone git@github.com:IchthysMaranatha/asterisk-chan-quectel.git
cd asterisk-chan-quectel
autoupdate
./bootstrap
DESTDIR=/usr/lib/asterisk/modules ./configure --with-astversion=16.28.0
make
sudo make install
chan_dongle
for USB Modems
cd $HOME/src
git clone git@github.com:wdoekes/asterisk-chan-dongle.git
cd asterisk-chan-dongle
autoupdate
./bootstrap
DESTDIR=/usr/lib/asterisk/modules ./configure --with-astversion=16.28.0
make
sudo make install
Useful Links and Resources
- Help #253 - Timeout Issues
- Using Quectel Voice Over UAC
- chan_dongle Timeouts
- chan_quectel Overview
- Asterisk13 on Raspberry Pi
- Google Voice gvsip OAuth Guide
- Asterisk with chan_dongle on Arch Linux
Happy hacking! 🚀