Building Asterisk: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
Recent changes to this doc: I am now using the pjsip library
* 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
* 2016-Jan-16 Asterisk 13.7
* 2015-Dec-10 Building on the new [[Vastra]].
* 2015-Dec-10 Building on the new [[Vastra]].
Line 8: Line 9:
* 2015-Apr-12 -- rebuilding the copy of Asterisk that runs my home PBX on [[Bellman]].
* 2015-Apr-12 -- rebuilding the copy of Asterisk that runs my home PBX on [[Bellman]].


=== Prerequisites ===
== 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 update && sudo apt-get -y upgrade
Line 16: Line 22:
   libncurses5-dev uuid-dev libjansson-dev libsqlite3-dev libspeex-dev python-gobject libresample1-dev libiksemel-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 \
   unixodbc unixodbc-bin unixodbc-dev libltdl-dev libmpg123-dev libmyodbc \
   uw-mailutils libc-client2007e-dev libssl-dev libpam0g-dev
   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,
For calendars, which I don't have working yet but all the same this is what you need,
Line 22: Line 28:
  sudo apt-get -y install libical-dev libgcal-dev davical libneon27-dev
  sudo apt-get -y install libical-dev libgcal-dev davical libneon27-dev


=== PJSIP ===
=== Developer option: Source download via version control ===
 
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.
Download the pjsip code from pjsip.org, unpack, or get the experimental svn version.
Line 39: Line 40:
  svn checkout http://svn.asterisk.org/svn/libpri/branches/1.4 libpri
  svn checkout http://svn.asterisk.org/svn/libpri/branches/1.4 libpri


==== Production code option: Pjproject download from site ====
=== PJSIP ===
 
cd ~/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://www.pjsip.org/release/2.4.5/pjproject-2.4.5.tar.bz2
 
==== Pjproject build ====
 
Video support
 
apt-get install libv4l-dev fswebcam qv4l2 v4l-utils
sdl
yuv
openh264
 
Suggested flags to configure the build:
 
cd pjproject-trunk
./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr CFLAGS='-O2 -DNDEBUG'
make dep
make -j 6
sudo make install
sudo ldconfig


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]]
More about [[PJSIP]]


Line 85: Line 65:
== Asterisk ==
== Asterisk ==


I use officially released code right now, not development releases.
Depending on my project I either build from development or released code.
You can git clone to get development trunk or use this.
Here is how to download the current release.


  wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
  wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz
  tar xzvf asterisk-13-current.tar.gz
  tar xzvf asterisk-14-current.tar.gz
  cd asterisk-13.7.0
  cd asterisk-14.3.0
   
   
  ./configure -with-imap=system
  ./configure -with-imap=system
Line 98: Line 78:
  # note items marked XXX will not be built because of missing dependencies
  # note items marked XXX will not be built because of missing dependencies
  make menuselect
  make menuselect
  # Using all the processor cores is MUCH FASTER... I have 8 on [[Bellman]] so I use them all
  # Building with all processor cores is FASTER... I have 8 on [[Bellman]] so I use them all
  make -j 8
  make -j 8
  sudo make install
  sudo make install
Line 104: Line 84:
  # sudo make progdocs # optionally...
  # sudo make progdocs # optionally...


If you are rebuilding (for example to add pjsip late in the game) then update.
== Packaging for Debian ==
(you can check in menuselect under 'resources' to make sure res-pjsip is included now)
 
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
   
   
  git fetch
  dh_make -f ../asterisk-13-current.tar.gz
./configure
make clean
# etc as above


== Packaging for Debian ==
# 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) ==
== Working with the Asterisk REST interface (ARI) ==
Line 118: Line 120:
[[Asterisk REST Interface]]
[[Asterisk REST Interface]]


[[Category: VOIP]]
[[Category: Telephones]]

Latest revision as of 15:49, 31 August 2022

  • 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