Prerequisites
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...
/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_DEBUG,
DO_CRASH
andTEST_FRAMEWORK
and disableCOMPILE_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.
- Under Compiler Flags - Development, enable DONT_OPTIMIZE, MALLOC_DEBUG,
- 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.
Install Support Packages
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:
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), lksctp-tools (or libsctp1), and their associated development packages (-devel or -dev).
When the build completes, check the version:
If everything's OK, install it:
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.
Install the Testsuite
Install Prerequisites
There's a contrib/scripts/install_prereq
script but it assumes that the python
executable runs Python 2. If you're running on a system where Python 3 is the default (most are nowadays), you'll need to install the prerequisites yourself.
If your distribution doesn't provide packages for python2, you'll need to install them using pip.
With the Test Suite checked out, we can begin to install its various prerequisites.
ASTTest Installation
Enter the following:
Verify that asttest was installed by doing the following:
When finished, return to the Test Suite directory:
Third Party Libraries
The following needs to be installed:
- lua-devel
- lua
- python-twisted
- libpcap-devel
- python-yaml
- python-devel
- python-construct
StarPY Installation
StarPY is used as a wrapper around AMI for a large number of tests. It depends on Python twisted, which a number of the tests use as well.
Perform the following:
When finished, return to the testsuite directory:
SIPp Installation
For SIPp, we'll need to download the source and build it ourselves, as we'll want both pcap and openssl support. The current minimum version required is 3.4.1.
Enter the following:
By default, sipp is installed in /usr/local/bin. If you want it installed to /usr/bin, add '–prefix=/usr' to the configure command.
Verify that sipp is installed and configured correctly:
When finished, return to the testsuite directory
PJSUA Installation
Enter the following:
in the vim console, hit i and insert the following:
- Hit Esc, then type :wq to save and exit vim
Continue the pjsip build process:
Copy the pjsua executable:
Verify that pjsua executes:
- Enter q to exit
Install pjsua Python bindings
Return to the testsuite directory:
Verify the Test Suite
Enter the following:
- 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)