Skip to content

Build and Installation

Germán Luis Aracil Boned edited this page Jun 28, 2026 · 10 revisions

Build And Installation

This page documents the normal source build for GABPBX.

Do not edit generated configure or make scripts for a normal build. Use the standard build method.

Base Build

./configure
make menuselect
make
make install

For an already configured tree, this is also valid:

make install

make install builds pending objects first and then installs them.

For first-time lab installs only:

make samples

Be careful: make samples can overwrite existing files under /etc/gabpbx.

Parallel Build

Use lowercase -j:

make -j$(nproc)

Uppercase -J is not the GNU make parallel-build option.

Debian 13 Install Recipe

This recipe was validated on Debian 13 with source trees in /opt:

/opt/sofia-sip
/opt/gabpbx

Install the build tools and the common module dependencies used by a practical chan_sofia installation:

apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
  build-essential autoconf automake libtool-bin pkg-config git \
  libopus-dev libsrtp2-dev libspandsp-dev libpq-dev libxml2-dev \
  libsqlite3-dev libssl-dev zlib1g-dev uuid-dev libncurses-dev \
  libedit-dev libcurl4-openssl-dev libjansson-dev libspeex-dev \
  libspeexdsp-dev libogg-dev libvorbis-dev libasound2-dev libgsm1-dev \
  unixodbc-dev libldap2-dev libsnmp-dev

Verify the important dependencies:

for p in opus libsrtp2 spandsp libpq libxml-2.0 sqlite3 openssl zlib; do
  pkg-config --exists "$p" && echo "OK $p $(pkg-config --modversion "$p")"
done

Build and install Sofia-SIP first:

cd /opt/sofia-sip
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH

If the Sofia-SIP checkout is missing autotools auxiliary files such as compile, missing, install-sh, config.guess, or config.sub, generate them using the upstream bootstrap script:

./bootstrap.sh

Then build and install:

./configure --prefix=/usr/local
make -j$(nproc)
make install
ldconfig
pkg-config --modversion sofia-sip-ua

The expected Sofia-SIP package version from the validated Debian 13 build was:

1.13.17

Build and install GABPBX:

cd /opt/gabpbx
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
./configure
make menuselect.makeopts
menuselect/menuselect --enable chan_sofia menuselect.makeopts
menuselect/menuselect --enable codec_opus menuselect.makeopts
make -j$(nproc)
make install

Do not run make samples on a production server unless you intentionally want to overwrite existing configuration under /etc/gabpbx.

Verify installed binaries and modules:

gabpbx -V
find /usr/lib /usr/local/lib -path '*/gabpbx/modules/*' \( -name chan_sofia.so -o -name codec_opus.so \) -ls
ldd /usr/lib/gabpbx/modules/chan_sofia.so | grep -E 'sofia|not found'
ldd /usr/lib/gabpbx/modules/codec_opus.so | grep -E 'opus|not found'

Expected successful checks include:

GABpbx 1.3.1 (chan_sofia)
libsofia-sip-ua.so.0 => /usr/local/lib/libsofia-sip-ua.so.0
libopus.so.0 => /lib/x86_64-linux-gnu/libopus.so.0

Required Source File: default.exports

default.exports is required by module link rules when GNU ld version scripts are used. The file contains:

{
	local:
		*;
};

The rule in Makefile.rules calls:

build_tools/make_linker_version_script

That helper needs default.exports as the default symbol visibility script. If the file is missing, builds can fail with:

cp: cannot stat '/opt/gabpbx/default.exports': No such file or directory
make[1]: *** [Makefile.rules:134: chan_agent.so] Error 1

The repository must track default.exports. .gitignore should ignore generated *.exports files but explicitly allow the base file:

*.exports
!default.exports

chan_sofia Build

chan_sofia requires Sofia-SIP installed in the layout used by the current make rules:

/usr/local/include/sofia-sip-1.13
/usr/local/lib

Library:

lsofia-sip-ua

Install Sofia-SIP From Source

chan_sofia builds against Sofia-SIP's NUA API, which is not a distro package. GABPBX is built and tested against Sofia-SIP v1.13.17, published in garacil/sofia-sip (a fork of freeswitch/sofia-sip). Download and compile that release into /usr/local:

# download the v1.13.17 release source and build it
wget https://github.com/garacil/sofia-sip/archive/refs/tags/v1.13.17.tar.gz
tar xzf v1.13.17.tar.gz
cd sofia-sip-1.13.17
./bootstrap.sh            # generate ./configure (the release source ships without it)
./configure --prefix=/usr/local
make
make install
ldconfig

Or fetch the same release with git, if you prefer:

git clone https://github.com/garacil/sofia-sip.git
cd sofia-sip
git checkout v1.13.17     # the release chan_sofia is built + tested against
./bootstrap.sh            # only if ./configure is missing from the checkout
./configure --prefix=/usr/local
make && make install && ldconfig

If you already have a Sofia-SIP checkout elsewhere, build it from that path instead - only the install prefix (/usr/local) matters to the GABPBX build.

Missing Sofia-SIP Header Error

If Sofia-SIP is not installed, chan_sofia fails like this:

[CC] chan_sofia.c -> chan_sofia.o
chan_sofia.c:120:10: fatal error: sofia-sip/nua.h: No such file or directory
  120 | #include <sofia-sip/nua.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [/opt/gabpbx/Makefile.rules:108: chan_sofia.o] Error 1
make: *** [Makefile:369: channels] Error 2

This means the compiler cannot find Sofia-SIP headers. The missing header comes from Sofia-SIP's NUA API:

sofia-sip/nua.h

After installing Sofia-SIP, verify:

test -f /usr/local/include/sofia-sip-1.13/sofia-sip/nua.h
test -f /usr/local/lib/libsofia-sip-ua.so || test -f /usr/local/lib/libsofia-sip-ua.a
ldconfig -p | grep sofia-sip-ua

Then run the normal GABPBX build again:

cd /opt/gabpbx
./configure
make menuselect
make -j$(nproc)
make install

Inside make menuselect, enable chan_sofia before running the final build:

Channel Drivers -> chan_sofia

Runtime rule:

noload => chan_sip.so
load => chan_sofia.so

Do not load chan_sip and chan_sofia together.

Opus Build

codec_opus requires libopus and pkg-config.

Debian/Ubuntu package:

apt install libopus-dev pkg-config

Enable:

Codec Translators -> codec_opus

Verify after startup:

*CLI> module show like opus
*CLI> opus show

Other Common Optional Dependencies

Install only the libraries needed by the modules you select in menuselect. Common useful packages on Debian/Ubuntu:

apt install build-essential pkg-config ncurses-dev libssl-dev zlib1g-dev
apt install libxml2-dev libsqlite3-dev libpq-dev unixodbc-dev
apt install libopus-dev libsrtp2-dev libspandsp-dev
apt install libspeex-dev libspeexdsp-dev

Module mapping:

Dependency Used by
Sofia-SIP source installed to /usr/local chan_sofia
libopus-dev codec_opus
libsrtp2-dev and res_srtp.so SRTP/encryption
libspandsp-dev fax/T.38 support through SpanDSP modules
libpq-dev PostgreSQL realtime/CDR/CEL modules
unixodbc-dev ODBC realtime/CDR/CEL/function modules
libsqlite3-dev SQLite realtime/CDR modules
libspeex-dev, libspeexdsp-dev Speex codec and DSP functions

Useful Build Checks

test -f default.exports
test -d /usr/local/include/sofia-sip-1.13
test -f /usr/local/lib/libsofia-sip-ua.so || test -f /usr/local/lib/libsofia-sip-ua.a
pkg-config --libs opus

Runtime Verification

*CLI> core show version
*CLI> module show
*CLI> module show like sofia
*CLI> module show like opus
*CLI> sip show settings
*CLI> sip show peers

Debian 13 systemd Service

GABPBX can run under a native systemd unit on Debian 13. Install this file as /etc/systemd/system/gabpbx.service:

[Unit]
Description=GABPBX PBX
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
WorkingDirectory=/var/lib/gabpbx
RuntimeDirectory=gabpbx
RuntimeDirectoryMode=0755
ExecStart=/usr/sbin/gabpbx -f
ExecReload=/usr/sbin/gabpbx -rx 'core reload'
ExecStop=/usr/sbin/gabpbx -rx 'core stop now'
Restart=on-failure
RestartSec=5
TimeoutStopSec=30
LimitNOFILE=65536
LimitCORE=infinity

[Install]
WantedBy=multi-user.target

Enable and start it:

systemd-analyze verify /etc/systemd/system/gabpbx.service
systemctl daemon-reload
systemctl enable gabpbx
systemctl start gabpbx
systemctl status gabpbx

Useful service checks:

systemctl is-enabled gabpbx
systemctl is-active gabpbx
gabpbx -rx 'core show version'
journalctl -u gabpbx -n 40 --no-pager

Module loading is still controlled by GABPBX configuration. For chan_sofia, make sure modules.conf does not load chan_sip.so at the same time:

noload => chan_sip.so
load => chan_sofia.so

Clone this wiki locally