<?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>AdmiNirvana &#187; Asterisk</title>
	<atom:link href="http://www.briandowney.net/blog/category/asterisk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.briandowney.net/blog</link>
	<description>Technical musings of an entrepreneur.</description>
	<lastBuildDate>Fri, 20 Jan 2012 02:55:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Fortigate &amp; SIP/VoIP</title>
		<link>http://www.briandowney.net/blog/2011/03/30/fortigate-sipvoip/</link>
		<comments>http://www.briandowney.net/blog/2011/03/30/fortigate-sipvoip/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 22:19:34 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Trixbox]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[fortigate]]></category>
		<category><![CDATA[ipsec]]></category>
		<category><![CDATA[register]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[tcp]]></category>
		<category><![CDATA[udp]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=201</guid>
		<description><![CDATA[Today I resolved a three week long saga of having issues with SIP hardphone registrations to an Asterisk box, and it was so obscure I feel posting the solution will be a favor to the world. The set up is an Asterisk 1.6 server sitting in a /24 subnet.   Four Fortigate 50B firewall appliances are [...]]]></description>
			<content:encoded><![CDATA[<p>Today I resolved a three week long saga of having issues with SIP hardphone registrations to an Asterisk box, and it was so obscure I feel posting the solution will be a favor to the world.</p>
<p>The set up is an Asterisk 1.6 server sitting in a /24 subnet.   Four Fortigate 50B firewall appliances are in use, with point-to-point IPSec VPN tunnels all connecting three remote sites back to the main site which houses the Asterisk box used for SIP registration and PBX/Outcalling operations.   Each site has its own /24 subnet, and network communication  works perfectly.</p>
<p>We use <a title="Aastra Corporate Site" href="http://www.aastra.com">Aastra </a>desk phones, specifically the <a title="Aastra 9480i" href="http://www.aastra.com/aastra-9480i.htm">x480i</a> line.   We have two older 480i phones, one of which has been working perfectly fine over an existing IPSec tunnel for a few years.   All the newer phones are the newer 9480i line, which has a completely different OS and Firmware, otherwise the form factor is identical to the older models.</p>
<p>Recently I added a few remote extensions, and strangely enough I could not get these particular endpoints to register with the Asterisk server.   The initial REGISTER message from the Aastra would make it to the Asterisk server, the Asterisk server would respond with the &#8220;401 Unauthorized&#8221; message, and it would die there.   No further communication.</p>
<p>Initially I deemed it due to <a title="UDP Fragmentation" href="http://blog.tmcnet.com/third-screen/2009/03/udp_fragmentation_breaks_sip_in_todays_ip-pbxs.html">UDP Fragmentation</a>, which is a common SIP problem.   However further analysis showed the packets to be quite small already (only 500 bytes), so reluctantly I switched the endpoints to TCP for all SIP communication and the problem disappeared.</p>
<p>However, doing this only resulted in a different issue.   TCP/SIP is <a href="http://www.russellbryant.net/blog/2008/01/18/new-sip-features-for-asterisk-16/">still experimental</a> in Asterisk 1.6, and I found out in a hurry.  In only a few days I ran into a chan_sip.so deadlock situation&#8211;particularly around the TLS code.  Ultimately this deadlock bug would bring down the entire PBX, terminating all calls immediately.   Definitely not production-ready, so back to UDP/SIP I went.</p>
<p>After doing some low-level packet sniffing and diagnosis on the wire today, I found that the &#8220;401 Unauthorized&#8221; message was indeed never making it past the local interface on the Asterisk-facing Fortigate.   This flew against what I thought was happening&#8211;my initial impression was that the REGISTER message from the Aastra endpoint was too large with the authentication information, thus fragmenting and getting thrown out.  Cue scratching head here.</p>
<p>Finally, out of curiosity I started Googling around for Fortigate/IPSec/SIP issues&#8211;somewhat doubtful that was the actual cause (remember, we&#8217;d had a remote 480i working for years already), when I<a href="http://fonality.com/trixbox/node/27323"> ran across this post</a> at Fonality.</p>
<p>Just for kicks, made the changes suggested in the thread&#8230; namely:</p>
<pre>config system settings
 set sip-helper disable
 set sip-nat-trace disable

Config system session-helper
 show</pre>
<p>(look for the SIP entry, and):</p>
<pre>delete &lt;num&gt;</pre>
<p>Where &lt;num&gt; is the SIP entry number.  Rebooted both sides, and lo and behold the phones registered!</p>
<p>Turns out the Fortigate is doing fixup on the SIP protocol for NAT purposes, but they do it rather stupidly.   They look to see if is a protocol match by looking at the UDP, protocol number, and port, and if it matches the Fortigate paints some special sauce on the packet which breaks the outbound &#8220;401&#8243; messages.   Good going guys.</p>
<p>Which leads to the question, why was the older Aastra 480i working all this time?   My only guess is that there were some SIP protocol changes between the different OS and Firmware revisions of the 480i and 9480i, the earlier of which snuck past the Fortigate&#8217;s markup attempts; but this is just a hunch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2011/03/30/fortigate-sipvoip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Trixbox, VPNs, NAT, and the 20 second dropping issue</title>
		<link>http://www.briandowney.net/blog/2008/10/24/trixbox-vpns-nat-and-the-20-second-dropping-issue/</link>
		<comments>http://www.briandowney.net/blog/2008/10/24/trixbox-vpns-nat-and-the-20-second-dropping-issue/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 16:30:14 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tlf]]></category>
		<category><![CDATA[Trixbox]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://www.briandowney.net/blog/?p=116</guid>
		<description><![CDATA[I usually don&#8217;t like to cross-post between blogs, but this problem seems prevalent enough that it needs more exposure.   We&#8217;ve solved it at TLF, and here&#8217;s how: http://www.thelinuxfix.com/blog/2008/10/24/trixbox-vpns-and-the-20-second-issue/]]></description>
			<content:encoded><![CDATA[<p>I usually don&#8217;t like to cross-post between blogs, but this problem seems prevalent enough that it needs more exposure.   We&#8217;ve solved it at TLF, and here&#8217;s how:</p>
<p><a href="http://www.thelinuxfix.com/blog/2008/10/24/trixbox-vpns-and-the-20-second-issue/">http://www.thelinuxfix.com/blog/2008/10/24/trixbox-vpns-and-the-20-second-issue/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.briandowney.net/blog/2008/10/24/trixbox-vpns-nat-and-the-20-second-dropping-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

