Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Warning

This page is being updated!

Prerequisites

  1. A working knowledge of Linux, Subversion, and Asterisk.
  2. A Linux distribution.  This guide does not assume a lot has been installed on the machine in question; however, some things may be needed on your distribution that were already installed for this guide.  Use common sense here.
  3. Git is installed.
  4. SVN is installed (only needed for the PJSUA Installation step).

Install Asterisk Prereqs

Most developers create an Asterisk work directory like ~/source/asterisk or /usr/src/asterisk then in that directory, clone the Asterisk, Testsuite and support repositories.  I'll assume /usr/src/asterisk in the rest of these instructions and that your tree looks (or will look) like...

No Format
/usr/src/asterisk/
	asterisk/		The asterisk repository cloned from https://gerrit/asterisk.org/asterisk
	testsuite/		The testsuite repository clones from https://gerrit/asterisk.org/testsuite 

If you don't already have the Asterisk source tree checked out and all of its prerequisites installed, please visit Installing Asterisk From Source.

Make sure you're using a supported version of libsrtp.  See "Installing libsrtp" for more information.

Install Asterisk

 Make sure you can actually build and install Asterisk at least once before proceeding.  Once you can, you'll need to follow a few more steps to configure Asterisk and rebuild it for testing:

  • Add --enable-dev-mode and optionally, --disable-binary-modules to your ./configure command line.  Disabling the binary modules just prevents the need to download the external codecs and res_digium_phone.
  • In menuselect...
    • Under Compiler Flags - Development,  enable DONT_OPTIMIZE, MALLOC_DEBUGDO_CRASH and TEST_FRAMEWORK and disable COMPILE_DOUBLE
    • Make sure all modules are enabled.  You don't need the Test Modules though.  If you enter Test Modules and press F7, you can quickly disable all modules.
  • Build and install Asterisk and the development header files.
    • make
    • sudo make install
    • sudo make install-headers

The testsuite needs the sample configuration files installed but before you do that, make sure you've saved the contents of /etc/asterisk if you've customized any files.  Once you're sure you don't need anything in /etc/asterisk...

  • sudo make samples

Do NOT start Asterisk at this time.  The Testsuite will start and stop it for each test.

Info

If you want to see how the Jenkins CI process configures Asterisk for testing, check out tests/CI/buildAsterisk.sh in the Asterisk source tree.

Install Support Packages

Note

The Testsuite is Python based but not yet fully compatible with Python 3. If you have Python 3 installed, make sure you also have a working Python 2 installation before proceeding. I'll assume you do and the executable is called python2.

The Testsuite needs several support packages to be installed:

yappcap

yappcap is a Python library that allows the Testsuite to capture packets on an interface.  Only a few tests actually use but it should be installed nonetheless:

Code Block
titleyappcap Installation
languagebash
$ cd /usr/src/asterisk
$ git clone https://github.com/asterisk/yappcap.git
$ cd yappcap
$ make
$ sudo make install
# If your default Python installation is Python 3, run the makes with PYTHON=python2
$ make PYTHON=python2
$ sudo make PYTHON=python2 install

sipp

sipp is a SIP simulation tool that is relied on heavily by the Testsuite.  Most distributions have up to date versions of the tool available.  If it's version 3.5.0 or greater, simple use your distro's package manager to install it and skip the rest of the sipp instructions.  Otherwise download, build and install it yourself.  You'll need to install openssl, libsrtp (or libsrtp2), libpcap, gsl (or libgsl), and their associated development packages (-devel or -dev).

Code Block
titlesipp Installation
languagebash
$ cd /usr/src/asterisk
$ git clone https://github.com/SIPp/sipp.git
$ cd sipp
$ git checkout v3.6.0   ## This is the latest version we KNOW works.
$ ./build.sh --prefix=/usr --with-openssl --with-pcap --with-rtpstream --with-sctp --with-gsl CFLAGS=-w

When the build completes, check the version:

Code Block
titleCheck sipp version
languagebash
 $ ./sipp -v

 SIPp v3.6.0-TLS-SCTP-PCAP-RTPSTREAM.


 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as
 published by the Free Software Foundation; either version 2 of
 the License, or (at your option) any later version.
...

If everything's OK, install it:

Code Block
$ sudo make install

StarPy

StarPy is a Python + Twisted protocol that provides access to the Asterisk PBX's Manager Interface (AMI).  It's actually bundled as part of the Testsuite but it's easier to install it separately.

Code Block
titleStarPy Installation
languagebash
$ cd /usr/src/asterisk
$ git clone https://github.com/asterisk/starpy.git
$ cd sipp
$ git checkout v3.6.0   ## This is the latest version we KNOW works.
$ ./build.sh --prefix=/usr --with-openssl --with-pcap --with-rtpstream --with-sctp --with-gsl CFLAGS=-w

 

 

In order to make sure that all of the current Asterisk prerequisites are installed and set up, we will first check-out Asterisk and make sure that we can build and run Asterisk outside of the control of Bamboo.

...

  1. Enter the following:

    Code Block
    bash
    bash
    $ ./runtests.py -l
    
  2. Verify that the tests are listed out, and that the required dependencies (that you care about, anyway) are true.

StarPy is a Python + Twisted protocol that provides access to the Asterisk PBX's Manager Interface (AMI)