<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BarryODonovan.com &#187; asterisk</title>
	<atom:link href="http://www.barryodonovan.com/index.php/tag/asterisk/feed" rel="self" type="application/rss+xml" />
	<link>http://www.barryodonovan.com</link>
	<description>Thoughts, ramblings and rants...</description>
	<lastBuildDate>Wed, 18 Jan 2012 10:31:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Asterisk with SS7 via Wanpipe, Dahdi and libss7 – with ISUP SAM support</title>
		<link>http://www.barryodonovan.com/index.php/2012/01/12/asterisk-ss7-sam-support</link>
		<comments>http://www.barryodonovan.com/index.php/2012/01/12/asterisk-ss7-sam-support#comments</comments>
		<pubDate>Thu, 12 Jan 2012 08:05:08 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[My Links]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Recipes]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[asterisk chan_ss7]]></category>
		<category><![CDATA[chan_ss7]]></category>
		<category><![CDATA[dahdi ss7]]></category>
		<category><![CDATA[isup sam]]></category>
		<category><![CDATA[libss7]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[sam]]></category>
		<category><![CDATA[sangoma]]></category>
		<category><![CDATA[sangoma ss7]]></category>
		<category><![CDATA[ss7]]></category>
		<category><![CDATA[ss7 sam]]></category>
		<category><![CDATA[subsequent address message]]></category>
		<category><![CDATA[zaptel ss7]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/?p=385</guid>
		<description><![CDATA[A howto on installing Asterisk with SS7 supported via libss7 on Sangoma hardware along with support for ISUP SAM messages. <a href="http://www.barryodonovan.com/index.php/2012/01/12/asterisk-ss7-sam-support">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After much head banging in bringing up an SS7 link with SAM support, I am documented what worked here.</p>
<p>Firstly, what is <em>SAM support</em>? One end of an SS7 link initialises a new call by sending an <em>Initial Address Message (IAM)</em>. All SS7 software stacks support this and usually it&#8217;s enough. One case where it&#8217;s not enough is when one wants to address a phone number with more than the E.164 standard max length of 16  (usually to pass additional information tacked on the start, end of or even replacing an A or B number). In this scenario, SS7 uses a <em>Subsequent Address Message (SAM)</em> to send the additional digits. Most / all mainstream Asterisk SS7 software stacks do not support this.</p>
<p>The platform and software used is as follows:</p>
<ul>
<li>Ubuntu 10.04 LTS standard CLI install;</li>
<li>dahdi-linux-complete-2.4.0 from the archives (<a title="dahdi-linux-complete-2.4.0" href="http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.4.0+2.4.0.tar.gz">direct link</a>);</li>
<li>a patched version of libss7 supporting SAM via SVN (see below);</li>
<li>a patched version of chan-dahdi via SVN (see below);</li>
<li>Asterisk 1.6.0.28 from the archives (<a href="http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-1.6.0.28.tar.gz">direct link</a>);</li>
<li>Asterisk Addons 1.6.0.6 from the archives (<a href="http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-addons-1.6.0.6.tar.gz">direct link</a>);</li>
<li>Sangoma Wanpipe 3.5.24 (<a href="ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.5.24.tgz">direct link</a>).</li>
</ul>
<p><strong>Yes, I know some of the above are obsolete. Unfortunately it&#8217;s what&#8217;s required for everything to play nicely together. And, guess what, it works!</strong></p>
<h3>Before You Start</h3>
<p>Ensure you have all the necessary packages for building the packages:</p>
<pre>apt-get install build-essential libnewt-dev subversion    \
   libsqlite3-dev libsnmp-dev bison libtool flex          \
   autoconf2.13 libmysqlclient-dev</pre>
<p>You can assume the working directory is <em>/usr/local/src</em> in the following.</p>
<h3>Installing dahdi-linux-complete</h3>
<p>Download and extract dahdi-linux-complete into /usr/local/src. Then, in the same directory, create some symbolic links:</p>
<pre>ln -s dahdi-linux-complete-2.4.0+2.4.0/linux dahdi-linux
ln -s dahdi-linux-complete-2.4.0+2.4.0/tools dahdi-tools</pre>
<p>Now build dahdi-linux:</p>
<pre>cd dahdi-linux
make
make install</pre>
<p>Now move onto dahdi-tools:</p>
<pre>cd dahdi-tools
./configure
make menuconfig # (and select tools or accept defaults)
make
make install
make config</pre>
<h3>Installing libss7</h3>
<p>There is a patched version of Digium&#8217;s libss7 referred to as <em>Attila&#8217;s libss7 </em>available via SVN. Download and install it:</p>
<pre>svn co https://observer.router.hu/repos_pub/libss7/trunk alibss7
cd alibss7
make
make install</pre>
<h3>Installing Asterisk</h3>
<p>Download and extract the Asterisk 1.6.0.28 package reference above.</p>
<pre>cd asterisk-1.6.0.28</pre>
<p>Now this next bit <strong>is very important and easy to miss</strong> - you also need a patched version of chan_dahdi.c that is compatible with the patched version of libss7. This is also available from SVN:</p>
<pre>svn co https://observer.router.hu/repos_pub/chan_dahdi/trunk achan_dahdi</pre>
<p>Then copy it to your Asterisk source:</p>
<pre>cp achan_dahdi/chan_dahdi.c asterisk-1.6.0.28/channels/chan_dahdi.c</pre>
<p>Now continue with the Asterisk installation:</p>
<pre>./configure
make menuconfig
make
make install
make samples
make config</pre>
<h3>Install Asterisk Addons (optional)</h3>
<p>Download and unpack the above referenced add ons package and build and install:</p>
<pre>cd asterisk-addons-1.6.0.6
./configure
make menuconfig
make
make install
make samples</pre>
<h3>Sangoma Wanpipe</h3>
<p>I&#8217;m using one of Sangoma&#8217;s E1 / T1 interface cards and so I need Wanpipe also. I&#8217;m using version 3.5.24 and preceed as follows after unpacking:</p>
<pre>cd wanpipe-3.5.24./Setup install</pre>
<p>During the install, follow these prompts:</p>
<ul>
<li>select option 2 =&gt; Asterisk/Dahdi Support;</li>
<li>enter path /usr/local/src/dahdi-linux (for Zaptel path prompt);</li>
<li>select defaults for everything else;</li>
<li>you DO want to install start-up scripts;</li>
<li>you DO to configure wanpipe devices for DAHDI;</li>
<li>you DO want to generate /etc/asterisk/chan_dahdi.conf and:
<ul>
<li>select E1 / T1 as appropriate;</li>
<li>select line framing and encoding;</li>
<li>choose clock source;</li>
<li>select <em>Zaptel/Dahdi &#8211; PRI CPE</em> as signalling;</li>
<li>select <em>National ISDN 2</em> as switch type;</li>
<li>do not enable hardware DTMF detection;</li>
<li>use all channels;</li>
<li>select dial plan context as appropriate;</li>
</ul>
</li>
<li>and continue for other ports as necessary;</li>
<li>finally, choose Save cfg: Stop Asterisk &amp; Wanpipe now</li>
<li>you would like wanrouter to start on system boot;</li>
<li>and you would like to execute &#8216;dahdi_cfg&#8217; each time wanrouter starts.</li>
</ul>
<h3>Configuration Steps</h3>
<p>We now need to set various options in Wanpipe, Dahdi and Asterisk for SS7 as it&#8217;s PRI/ISDN by default.</p>
<p>Edit all <em>/etc/wanpipe/wanpipeX.conf</em> files as necessary and change:</p>
<pre> TDMV_DCHAN              = 16</pre>
<p>to</p>
<pre>TDMV_DCHAN              = 0</pre>
<p>Now edit <em>/etc/dahdi/system.conf</em> and change (for example):</p>
<pre>span=1,1,0,ccs,hdb3,crc4
bchan=1-15,17-31
echocanceller=mg2,1-15,17-31
hardhdlc=16</pre>
<p>to</p>
<pre>span=1,1,0,ccs,hdb3,crc4
bchan=2-31
echocanceller=mg2,2-31
mtp2=1</pre>
<p>which of course assumes signalling is on channel 1. If you have voice only links, you might need something like:</p>
<pre>span=1,0,0,ccs,hdb3,crc4bchan=1-31
echocanceller=mg2,2-31</pre>
<p>Lastly, we need to configure Asterisk. Replace lines such as:</p>
<pre>;Sangoma A102 port 1 [slot:4 bus:5 span:1]
switchtype=national
context=from-pstn
group=0
echocancel=yes
signalling=pri_cpe
channel =&gt;1-15,17-31</pre>
<p>with an appropriate configuration. Mine follows below with some edits and <strong>some important notes at the end</strong>:</p>
<pre>;Sangoma A102 port 1 [slot:4 bus:5 span:1]
switchtype=national
context=from-pstn
group=0
echocancel=yes

signaling=ss7
ss7type=itu
ss7_called_nai=dynamic
ss7_calling_nai=dynamic
ss7_internationalprefix=00
ss7_nationalprefix=0
ss7_subscriberprefix=
ss7_unknownprefix=
linkset=1
pointcode=1
adjpointcode=2
defaultdpc=3
networkindicator=national_spare
cicbeginswith=2
channel=2-31
sigchan=1</pre>
<ul>
<li>Set <em>pointcode, adjpointcode and defaultdpc</em> as appropriate;</li>
<li>set <em>networkindicator</em> as appropriate and ensure it matches the other end (you can see what you’re being sent and what you’re sending via <em>ss7 debug</em>;</li>
<li><em>cicsbeginwith</em> is normally 1 but the telco on my end are starting at 2 – this was <em>groping in the dark</em> diagnostics and issues such as no audio, CICs not in service when both sides claim they are, etc may point to misaligned CICs;</li>
<li>make sure you have configured <em>from-pstn</em> or the appropriate context in your<em>extensions.conf</em>.</li>
</ul>
<h3>Confirming Your Link Is Up</h3>
<p>Now start wanrouter <em>(/etc/init.d/wanrouter start)</em>; dahdi <em>(/etc/init.d/dahdi start);</em> and Asterisk <em>(/etc/init.d/asterisk start)</em>. You should see your link come up via logs available with the <em>dmesg</em> command. Launch the Asterisk console and check the status of your links:</p>
<pre>ast-deg1-1*CLI&gt; ss7 show cics 1
  CIC   DPC  DAHDI        STATE   BLOCKING
    2    3      2         Idle
    3    3      3         Idle
    4    3      4         Idle
    5    3      5         Idle
    6    3      6         Idle
    7    3      7         Idle
    8    3      8         Idle
    9    3      9         Idle
   10    3     10         Idle
   11    3     11         Idle
   12    3     12         Idle
   13    3     13         Idle
   14    3     14         Idle
   15    3     15         Idle
   16    3     16         Idle
   17    3     17         Idle
   18    3     18         Idle
   19    3     19         Idle
   20    3     20         Idle
   21    3     21         Idle
   22    3     22         Idle
   23    3     23         Idle
   24    3     24         Idle
   25    3     25         Idle
   26    3     26         Idle
   27    3     27         Idle
   28    3     28         Idle
   29    3     29         Idle
   30    3     30         Idle
   31    3     31         Idle</pre>
<p>You should now be okay to make test calls.</p>
<h3>Do You Need Professional Support / Consultancy?</h3>
<p>While I will try to respond to comments and questions on this blog, I don’t have the time to provide one on one assistance pro-bono. Professional consultancy on Asterisk and SS7 is available worldwide through my company, <a href="http://www.opensolutions.ie/">Open Solutions</a> with <a href="http://www.opensolutions.ie/about-us/contact">contact details here</a>.</p>
<h3>References</h3>
<p>For posterity, I have added Domjan Attila patched libss7 and chan_dahdi to GitHub:</p>
<ul>
<li><a href="https://github.com/barryo/attila-libss7">https://github.com/barryo/attila-libss7</a></li>
<li><a href="https://github.com/barryo/attila-libss7-chan_dahdi">https://github.com/barryo/attila-libss7-chan_dahdi</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2012/01/12/asterisk-ss7-sam-support/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk SIP Brute Force Attacks on the Rise</title>
		<link>http://www.barryodonovan.com/index.php/2010/09/17/asterisk-sip-brute-force-attacks</link>
		<comments>http://www.barryodonovan.com/index.php/2010/09/17/asterisk-sip-brute-force-attacks#comments</comments>
		<pubDate>Fri, 17 Sep 2010 10:54:44 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Recipes]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[brute force]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[sip attacks]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/?p=194</guid>
		<description><![CDATA[See my article on the company blog for a discussion on this, and a how to on using Fail2ban to help stop these attacks.]]></description>
			<content:encoded><![CDATA[<p>See my <a href="http://www.opensolutions.ie/blog/2010/09/sip-brute-force-attacks/">article on the company blog</a> for a discussion on this, and a how to on using Fail2ban to help stop these attacks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2010/09/17/asterisk-sip-brute-force-attacks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

