Building Asterisk

From Wildsong
Jump to navigationJump to search
  • 2017-Mar-12 release build 14.3.0 on Debian Jessie (8.6)
  • 2016-Jun-08 trunk build 13.10
  • 2016-Feb-04 Asterisk 13.7.1
  • 2016-Jan-16 Asterisk 13.7
  • 2015-Dec-10 Building on the new Vastra.
  • 2015-Jun-23 Adding XMPP support.
  • 2015-Jun -- Both vastra2 and bellman have been upgraded to Debian 8 and Asterisk 13.4 (trunk on Bellman)
  • 2015-Apr-11 -- Working on my Mac in the Novato public library using the Wildsong PBX virtualbox as my build environment.
  • 2015-Apr-12 -- rebuilding the copy of Asterisk that runs my home PBX on Bellman.

Docker is coming...

2017-03 this is probably the last time I will be building Asterisk from sources, I plan on starting to use Asterisk in Docker once I have this version running.

Prerequisites

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install build-essential subversion git ncurses-dev \
 libncurses5 libxml2 libxml2-dev doxygen libcurl4-openssl-dev \
 libncurses5-dev uuid-dev libjansson-dev libsqlite3-dev libspeex-dev python-gobject libresample1-dev libiksemel-dev\
 unixodbc unixodbc-bin unixodbc-dev libltdl-dev libmpg123-dev libmyodbc \
 libc-client2007e-dev libssl-dev libpam0g-dev

For calendars, which I don't have working yet but all the same this is what you need,

sudo apt-get -y install libical-dev libgcal-dev davical libneon27-dev

Developer option: Source download via version control

Download the pjsip code from pjsip.org, unpack, or get the experimental svn version. Likewise the asterisk code.

cd ~/src/asterisk/
svn checkout http://svn.pjsip.org/repos/pjproject/trunk pjproject-trunk
svn checkout http://svn.asterisk.org/svn/asterisk/trunk asterisk-trunk
git clone git://git.asterisk.org/dahdi/linux dahdi-linux
git clone git://git.asterisk.org/dahdi/tools dahdi-tools
svn checkout http://svn.asterisk.org/svn/libpri/branches/1.4 libpri

PJSIP

When I upgraded to the beta of 14 I switched from SIP to PJSIP. Now builds as part of Asterisk, so I removed the separate build instructions. More about PJSIP

Dahdi

Dahdi is the part of Asterisk that supports the PSTN hardware. You used to need Dahdi for MeetMe, which I am not using. There are two folders, dahdi-linux and dahdi-tools. Currently I only install Dahdi if I need the support for a PCI card.

sudo apt-get install   linux-headers-`uname -r`
cd dahdi-linux
make -j 6 all
sudo make install
sudo make config
cd ../dahdi-tools
autoconf
./configure
make -j 6
sudo make install

Asterisk

Depending on my project I either build from development or released code. Here is how to download the current release.

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz
tar xzvf asterisk-14-current.tar.gz
cd asterisk-14.3.0

./configure -with-imap=system
# in add-ons turn on format-mp3 if you do this you need the next step
./contrib/scripts/get_mp3_source.sh
# I turn off a bunch of things I will never use
# note items marked XXX will not be built because of missing dependencies
make menuselect
# Building with all processor cores is FASTER... I have 8 on Bellman so I use them all
make -j 8
sudo make install
# sudo make samples  # optionally... installs all those files into /etc/asterisk/
# sudo make progdocs # optionally...

Packaging for Debian

At one point I was trying to build Debian packages. I gave up on that. Here are my old notes.

I grabbed Debian sources for asterisk with git, and used the debian directory there as the source for the package builds.

See https://www.debian.org/doc/manuals/maint-guide/first.en.html

sudo apt-get install -y debhelper
sudo apt-get install -y dh-make devscripts

sudo apt-get install -y dahdi-source
sudo apt-get install -y dh-systemd libreadline-dev
sudo apt-get install -y libgsm1-dev libtonezone-dev portaudio19-dev
sudo apt-get install -y libpri-dev libss7-dev libvpb-dev 
sudo apt-get install -y libcap2-dev libspandsp-dev libopenr2-dev libresample1-dev
sudo apt-get install -y libsrtp-dev libpjproject-dev libsrtp0-dev binutils-dev
sudo apt-get install -y dh-autoreconf libnewt-dev libsqlite0-dev
sudo apt-get install -y libsqlite-dev libspeexdsp-dev libpopt-dev 
sudo apt-get install -y libfreeradius-client-dev freetds-dev libvorbis-dev
sudo apt-get install -y libogg-dev libgmime-2.6-dev liblua5.1-0-dev
sudo apt-get install -y libspeexdsp-dev libpopt-dev

dh_make -f ../asterisk-13-current.tar.gz
  1. Find build dependencies, don't need this because we don't care about the source package.
dpkg-depcheck -d ./configure

# Build only binary packages and don't sign them
dpkg-buildpackage -us -uc -c -j8

Working with the Asterisk REST interface (ARI)

Asterisk REST Interface