<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2172/18/9/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/Installing+the+Asterisk+Test+Suite">Installing the Asterisk Test Suite</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://wiki.asterisk.org/wiki/display/~mjordan">Matt Jordan</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <div>
<ul>
    <li><a href='#InstallingtheAsteriskTestSuite-Prerequisites'>Prerequisites</a></li>
    <li><a href='#InstallingtheAsteriskTestSuite-InstallAsteriskPrereqs'>Install Asterisk Prereqs</a></li>
<ul>
    <li><a href='#InstallingtheAsteriskTestSuite-ThirdPartyLibraries'>Third Party Libraries</a></li>
<ul>
    <li><a href='#InstallingtheAsteriskTestSuite-Installspandsp'>Install spandsp</a></li>
    <li><a href='#InstallingtheAsteriskTestSuite-Installlibsrtp'>Install libsrtp</a></li>
</ul>
</ul>
    <li><a href='#InstallingtheAsteriskTestSuite-InstallAsteriskTestSuitePrereqs'>Install Asterisk Test Suite Prereqs</a></li>
<ul>
    <li><a href='#InstallingtheAsteriskTestSuite-ASTTestInstallation'>ASTTest Installation</a></li>
    <li><a href='#InstallingtheAsteriskTestSuite-ThirdPartyLibraries'>Third Party Libraries</a></li>
<ul>
    <li><a href='#InstallingtheAsteriskTestSuite-StarPYInstallation'>StarPY Installation</a></li>
    <li><a href='#InstallingtheAsteriskTestSuite-SIPpInstallation'>SIPp Installation</a></li>
    <li><a href='#InstallingtheAsteriskTestSuite-PJSUAInstallation'>PJSUA Installation</a></li>
</ul>
</ul>
    <li><a href='#InstallingtheAsteriskTestSuite-VerifytheTestSuite'>Verify the Test Suite</a></li>
</ul></div>

<h1><a name="InstallingtheAsteriskTestSuite-Prerequisites"></a>Prerequisites</h1>

<ol>
        <li>A working knowledge of Linux, Subversion, and Asterisk.</li>
        <li>A Linux distribution.&nbsp; 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.&nbsp; Use common sense here.</li>
        <li>SVN is installed</li>
</ol>


<h1><a name="InstallingtheAsteriskTestSuite-InstallAsteriskPrereqs"></a>Install Asterisk Prereqs</h1>

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

<ol>
        <li>Open a terminal and enter the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd
# svn co http://svn.asterisk.org/svn/asterisk/trunk asterisk_trunk
# cd asterisk_trunk
# cd contrib
# cd scripts
# sudo ./install_prereq install</pre>
</div></div></li>
        <li>This will typically install a large number of Asterisk prerequisites.  When it is finished, you should see:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">######################################
## install completed successfully
######################################</pre>
</div></div>
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>As of the time writing this, install_prereq does not install the SQLite3 package.  If the Asterisk ./configure script fails, install sqlite-devel</td></tr></table></div></li>
        <li>Perform the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd ../../
# ./configure --enable-dev-mode
# make
# sudo make install
# asterisk -cvvvg</pre>
</div></div></li>
        <li>Verify that Asterisk starts.  On the Asterisk CLI, enter:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">CLI&gt; core stop now</pre>
</div></div>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>If installing Asterisk as a non-root user, Asterisk may not be able to find libasteriskssl.so.1.  Verify that the shared library was built and in /usr/lib.  If it is, activate the current library path by entering "sudo ldconfig"</td></tr></table></div></li>
</ol>


<h2><a name="InstallingtheAsteriskTestSuite-ThirdPartyLibraries"></a>Third Party Libraries</h2>

<h3><a name="InstallingtheAsteriskTestSuite-Installspandsp"></a>Install spandsp</h3>

<p>For fax support, you'll need spandsp.</p>

<ol>
        <li>Install libtiff
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># sudo yum install libtiff-devel</pre>
</div></div></li>
        <li>Download the spandsp source from <a href="http://soft-switch.org/downloads/spandsp" class="external-link" rel="nofollow">http://soft-switch.org/downloads/spandsp</a>.  Pick a recent revision.</li>
        <li>Assuming that you downloaded it to Downloads (we'll assume that this is spandsp-0.0.6):
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd ~/Downloads/
# tar -xzf spandsp-0.0.6
# cd spandsp-0.0.6
# ./configure
# make
# sudo make install</pre>
</div></div></li>
</ol>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>spandsp installs itself into /usr/local/lib.  If that isn't in your library include path, res_fax_spandsp will build but will not load, causing the fax tests to fail (typically with INIT failures).</td></tr></table></div>

<h3><a name="InstallingtheAsteriskTestSuite-Installlibsrtp"></a>Install libsrtp</h3>

<p>For SRTP, you'll need libsrtp.  To obtain that library, perform the following:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># wget http://srtp.sourceforge.net/srtp-1.4.2.tgz
# tar xvf srtp-1.4.2.tgz
# cd srtp
# ./configure CFLAGS=fPIC --prefix=/usr
# make
# make runtest
# sudo make install</pre>
</div></div>

<h1><a name="InstallingtheAsteriskTestSuite-InstallAsteriskTestSuitePrereqs"></a>Install Asterisk Test Suite Prereqs</h1>

<p>Check out the Asterisk Test Suite by doing the following:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd
# cd asterisk_trunk
# mkdir testsuite
# svn co http://svn.asterisk.org/svn/testsuite/asterisk/trunk testsuite
# cd testsuite</pre>
</div></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Currently, the Asterisk Test Suite <b>must</b> reside in a sub-directory in Asterisk.  Checking out the Test Suite into any other directory will cause it to not run.</td></tr></table></div>

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

<h2><a name="InstallingtheAsteriskTestSuite-ASTTestInstallation"></a>ASTTest Installation</h2>

<ol>
        <li>Enter the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd asttest
# make
# sudo make install</pre>
</div></div></li>
        <li>Verify that asttest was installed by doing the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># asttest
asttest: missing arguments -- specify at least one test directory
Usage:
 ....</pre>
</div></div></li>
        <li>When finished, return to the Test Suite directory:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd ..</pre>
</div></div></li>
</ol>


<h2><a name="InstallingtheAsteriskTestSuite-ThirdPartyLibraries"></a>Third Party Libraries</h2>

<p>The following needs to be installed:</p>
<ul>
        <li>lua-devel</li>
        <li>lua</li>
        <li>python-twisted</li>
        <li>libpcap-devel</li>
        <li>python-yaml</li>
</ul>


<h3><a name="InstallingtheAsteriskTestSuite-StarPYInstallation"></a>StarPY Installation</h3>

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

<ol>
        <li>Perform the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd addons
# make update
# cd starpy
# sudo python setup.py install</pre>
</div></div></li>
        <li>When finished, return to the testsuite directory:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">cd ../..</pre>
</div></div></li>
</ol>


<h3><a name="InstallingtheAsteriskTestSuite-SIPpInstallation"></a>SIPp Installation</h3>

<p>For SIPp, we'll need to download the source and build it ourselves, as we'll want both pcap and openssl support.</p>

<ol>
        <li>Enter the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># mkdir sipp
# cd sipp
# wget http://sipp.sourceforge.net/snapshots/sipp.2009-07-29.tar.gz
Resolving sipp.sourceforget.net...
Connecting to sipp.sourceforget.net
...
# tar zxvf sipp.2009-07-29.tar.gz
# cd sipp.svn
# make pcapplay_ossl
# sudo cp sipp /usr/bin</pre>
</div></div></li>
        <li>Verify that sipp is installed and configured correctly:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># sipp -v

SIPp v3.1-TLS-PCAP, version unknown, built ...</pre>
</div></div></li>
        <li>When finished, return to the testsuite directory
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd ../..</pre>
</div></div></li>
</ol>


<h3><a name="InstallingtheAsteriskTestSuite-PJSUAInstallation"></a>PJSUA Installation</h3>

<ol>
        <li>Enter the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject
# cd pjproject
# ./configure
# cp pjlib/include/pj/config_site_sample.h pjlib/include/pj/config_site.h
# vim pjlib/include/pj/config_site.h</pre>
</div></div></li>
        <li>in the vim console, hit <b>i</b> and insert the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># define PJ_HAS_IPV6 1</pre>
</div></div></li>
        <li>Hit <b>Esc</b>, then type <b>:wq</b> to save and exit vim</li>
        <li>Continue the pjsip build process:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># make dep
# make</pre>
</div></div></li>
        <li>Copy the pjsua executable:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd pjproject/pjsip-apps/bin
# sudo cp pjsua-x86_64-unknown-linux-gnu /usr/sbin/pjsua</pre>
</div></div></li>
        <li>Verify that pjsua executes:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># pjsua
...
You have 0 active call
&gt;&gt;&gt;</pre>
</div></div></li>
        <li>Enter <b>q</b> to exit</li>
        <li>Return to the testsuite directory:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># cd ~/asterisk_trunk/testsuite</pre>
</div></div></li>
</ol>


<h1><a name="InstallingtheAsteriskTestSuite-VerifytheTestSuite"></a>Verify the Test Suite</h1>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>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</td></tr></table></div>
<ol>
        <li>Enter the following:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false"># ./runtests.py -l</pre>
</div></div></li>
        <li>Verify that the tests are listed out, and that the required dependencies (that you care about, anyway) are true.</li>
</ol>


    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;" class="grey">
                        <a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
       <a href="https://wiki.asterisk.org/wiki/display/AST/Installing+the+Asterisk+Test+Suite">View Online</a>
              |
       <a href="https://wiki.asterisk.org/wiki/display/AST/Installing+the+Asterisk+Test+Suite?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>