Building Asterisk

From Wildsong
Revision as of 19:11, 12 March 2017 by Brian Wilson (talk | contribs) (Brian Wilson moved page Building Asterisk 13 to Building Asterisk)
Jump to navigationJump to search
  • 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.

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

PJSIP

The PJSIP upgrade for SIP for Asterisk is done using plproject. I have built it but not using it yet. Read about it here: https://wiki.asterisk.org/wiki/display/AST/Building+and+Installing+pjproject

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

Now builds as part of Asterisk, so I removed the separate build instructions. Still not using it. 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-13-current.tar.gz
tar xzvf asterisk-13-current.tar.gz
cd asterisk-13.9.1

./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

I need to build packages for easier deployment. I don't want to build on Bellman (a production machine), I want to build on a build machine, create a DPKG file, copy the DPKG to Bellman and install it.

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