Skip to end of metadata
Go to start of metadata

Icon

This page is being updated!

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

Icon

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

Icon

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:

yappcap Installation

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

sipp Installation

When the build completes, check the version:

Check sipp 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.

StarPy Installation

Install the Testsuite

Testsuite Installation

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.  

Ubuntu 20.04 (and possible others) do not include pip for python2, which also does not include python-twisted or python-construct.  The following method to add pip for python2 has been tested to work as of 10/21.

Install Prerequisites

 

All below is still in progress...

With the Test Suite checked out, we can begin to install its various prerequisites.

ASTTest Installation

  1. Enter the following:

  2. Verify that asttest was installed by doing the following:

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

  1. Perform the following:

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

  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.

     

  2. Verify that sipp is installed and configured correctly:

  3. When finished, return to the testsuite directory

PJSUA Installation

Icon

This step isn't needed if Asterisk was configured with --with-pjproject-bundled

 

  1. Enter the following:

  2. in the vim console, hit i and insert the following:

  3. Hit Esc, then type :wq to save and exit vim
  4. Continue the pjsip build process:

  5. Copy the pjsua executable:

  6. Verify that pjsua executes:

  7. Enter q to exit
  8. Install pjsua Python bindings

  9. Return to the testsuite directory:

Verify the Test Suite

Icon

If you haven't run make samples (which you shouldn't have, if you were following the instructions), you'll need to have an asterisk.conf file in /etc/asterisk before the Test Suite will work. Copy one over - it doesn't matter what is in it for now

  1. Enter the following:

  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)

  • No labels

16 Comments

  1. When installing on CentOS 6, I had to install these additional packages:

    1. libpcap-devel
    2. gcc-objc
    3. python-devel
    4. python-twisted
  2. Most of those make sense, but gcc-objc? Where did that come from?

    1. When making pjproject for pjsua, it barfed on not having a cc1obj.  A quick yum whatprovides told me it was in gcc-objc, which I installed, then it was happy.

       

  3. I had to go into pjsip-apps/build to make the pjsua app.

    make -C pjsip-apps/build pjsua

    (Both for the svn checkout as mentioned above and the asterisk-git version from Installing pjproject.)

    (P.S. Copying to /usr/sbin seems wrong, no need for the s.)

  4. I had to install python-setuptools and python-requests for Fedora

    Also needed autobahn installed via pip.  There's no Fedora package.

     

  5. On Ubuntu server 12.04, using apt-get to install python-requests installs a really old version of the library (0.8.3) that leads to test failures for some tests. Use easy_install to install it instead.

  6. There are now tests that require sipp 3.4.1

  7. git should be added to the list of prerequisites.

    1. Yes. I added it to the list. I also inserted a caveat for the SVN prerequisite in that SVN is only needed to complete the PJSUA Installation steps (as documented on this page). It is worth noting that it is possible to obtain the PJSIP source code without using SVN.

  8. Shouldn't the git clone commands pull from the anonymous gerrit URLs ( https://gerrit.asterisk.org/asterisk and https://gerrit.asterisk.org/testsuite)? It should be possible to run the testsuite without having a gerrit login.

    1. Good point. I updated the text to reflect this.

  9. On CentOS 6, after the initial prereq install, I found that doing a "yum install epel-release" made a large number of packages installable.

    I had to hand install sqlite-devel and gmime-devel.

    I had to yum install python-requests... and autobahn... although that didn't help run that last command,

    sudo make -C pjsip-apps/src/python install
    wherein during the compile of _pjsua.c, I see complaints about Python.h  and  structmember.h not being found, and the rest swiftly goes south after that.
    Any suggestions?
    1. Aaarggg! Got it. I needed to do a "yum install python-devel" !

      After that install, I was able to run the make successfully; but runtests.py -l says: "No handlers could be found for logger "asterisk.version"".. which I guess is ignorable.

      Many thanks!

       

       

  10. The instruction not ever working for all cases

    $ sudo cp pjsip-apps/bin/pjsua-x86_64-unknown-linux-gnu /usr/sbin/pjsua

     

    maybe, can try with

    $ sudo cp pjsip-apps/bin/pjsua-$(grep "export TARGET_NAME" ./build.mak | cut -f 2 --delimiter="="|xargs) /usr/sbin/pjsua

    is not a clean command but its works

  11. Centos 6, 32-bit, I had to install:

    python-setuptools PyYAML

    Additionally, I had to `make samples` in the asterisk directory, even though the Verify the Test Suite section says clearly not to do that.

  12. libsrtp is now on github: https://github.com/cisco/libsrtp.git

        wget https://github.com/cisco/libsrtp/archive/v1.6.0.tar.gz

        cd libsrtp-1.6.0

        ./configure CFLAGS=-fPIC --prefix=/usr

        make

        make runtest

        sudo make install