<?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>TEAM FORREST Blog</title>
	<atom:link href="http://www.teamforrest.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.teamforrest.com/blog</link>
	<description>Asterisk, VoIP, and IT Consulting</description>
	<lastBuildDate>Thu, 27 May 2010 19:07:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Use ENUM to Save Real MONey</title>
		<link>http://www.teamforrest.com/blog/177/use-enum-to-save-real-money/</link>
		<comments>http://www.teamforrest.com/blog/177/use-enum-to-save-real-money/#comments</comments>
		<pubDate>Thu, 27 May 2010 19:07:58 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[lookup]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=177</guid>
		<description><![CDATA[Ok — it almost rhymed. ENUM (read the wiki) refers to the mapping of telephone numbers to internet addresses. Think of it almost as reverse DNS for your phone number. Although there are many methods of integrating ENUM into your system, our current &#8220;favorite&#8221; is ENUMPlus.org. From their website: ENUM sources are very segregated and [...]]]></description>
			<content:encoded><![CDATA[<p>Ok — it almost rhymed.</p>
<p>ENUM (<a href="http://en.wikipedia.org/wiki/ENUM">read the wiki</a>) refers to the mapping of telephone numbers to internet addresses. Think of it almost as reverse DNS for your phone number. Although there are many methods of integrating ENUM into your system, our current &#8220;favorite&#8221; is <a href="http://enumplus.org/">ENUMPlus.org</a>.</p>
<p>From their website:</p>
<blockquote><p>ENUM sources are very segregated and there was no global repository &#8211; until now. ENUMPlus queries all of the top ENUM lookup sources and returns the most accurate result with minimal overhead; meaning you only need to specify one source. ENUMPlus allows you to offload all of the query processing to our powerful servers so you don&#8217;t have to waste time and precious resources.</p></blockquote>
<p>Integrating ENUMplus into <a href="http://www.teamforrest.com/blog/tag/asterisk/">Asterisk</a> can be very quick and there&#8217;s a few choices/methods of going about it. You can choose to use their php scripts, go <a href="http://enumplus.org/wiki/index.php/AsteriskConfiguration16">direct from the dialplan</a>, or run your own lookup script. Here, we&#8217;ve chosen to write our own lookup script that basically does the following:</p>
<ol>
<li>Checks ENUMplus.org for a result (with a 2 second timeout)</li>
<li>Sets a variable of ENUMRESULT and returns to dialplan</li>
<li>The dialplan then evaluates that variable, and if a sip value is provided calls the number directly via SIP.</li>
</ol>
<p>Here&#8217;s an example dialplan:</p>
<pre class="brush: plain;">exten =&gt; _X.,1,Set(CALLTO=${EXTEN})
exten =&gt; _X.,n,Goto(out,1)
exten =&gt; out,1,AGI(enumcheck.pl,${CALLTO})
exten =&gt; out,n,GotoIf($[&quot;${ENUMRESULT}&quot; = &quot;FAIL&quot;]?pstn)
exten =&gt; out,n,GotoIf($[${ISNULL(${ENUMRESULT})}]?pstn)
exten =&gt; out,n,Dial(${ENUMRESULT},55)
exten =&gt; out,n,GotoIf($[&quot;${DIALSTATUS}&quot; = &quot;CHANUNAVAIL&quot; ]?pstn)
exten =&gt; out,n,GotoIf($[&quot;${DIALSTATUS}&quot; = &quot;CONGESTION&quot; ]?pstn)
exten =&gt; out,n,GotoIf($[&quot;${DIALSTATUS}&quot; = &quot;BUSY&quot; ]?busy)
exten =&gt; out,n,Hangup()
exten =&gt; out,n(pstn),Dial(SIP/${CALLTO}@yourprovider); or DAHDI, etc.
exten =&gt; out,n,GotoIf($[&quot;${DIALSTATUS}&quot; = &quot;CHANUNAVAIL&quot; ]?busy)
exten =&gt; out,n,GotoIf($[&quot;${DIALSTATUS}&quot; = &quot;CONGESTION&quot; ]?busy)
exten =&gt; out,n,GotoIf($[&quot;${DIALSTATUS}&quot; = &quot;BUSY&quot; ]?busy)
exten =&gt; out,n,Hangup()
exten =&gt; out,n(busy),Busy(5)
exten =&gt; out,n,Hangup()</pre>
<p>And here&#8217;s the script:</p>
<pre class="brush: perl;">#!/usr/bin/perl -w
use strict;
$|=1;
my ($phone, $url, $apikey, $result, @sip);

while(&lt;STDIN&gt;) {
	chomp;
	last unless length($_);
}

if ($ARGV[0]) {
	$phone = &amp;URLEncode($ARGV[0]);
} else {
	&amp;setvar(&quot;ENUMRESULT&quot;, &quot;FAIL&quot;);
	&amp;printverbose(&quot;enumlookup: No CALLTO received.&quot;,2);
	exit(0);
}

#Get via WEB
$apikey = &quot;REPLACE WITH YOUR KEY&quot;;
$url = &quot;http://enumplus.org/api&quot;;

$result = qx(curl -m 2 -s -d 'key=$apikey' $url/$phone);

if ($result) {
	if ($result =~ /SIP/i) {
		@sip = split(/\|/, $result);
		&amp;setvar(&quot;ENUMRESULT&quot;, $sip[0]);
		&amp;printverbose(&quot;enumlookup: $sip[0]&quot;,2);
	} else {
		&amp;setvar(&quot;ENUMRESULT&quot;, &quot;FAIL&quot;);
		&amp;printverbose(&quot;enumlookup: No sip address found.&quot;,2);
	}
} else {
	&amp;setvar(&quot;ENUMRESULT&quot;, &quot;FAIL&quot;);
	&amp;printverbose(&quot;enumlookup: Timeout or error&quot;,2);
}

sub URLEncode {
   my $theURL = $_[0];
   $theURL =~ s/([\W])/&quot;%&quot; . uc(sprintf(&quot;%2.2x&quot;,ord($1)))/eg;
   return $theURL;
}

sub setvar {
	my ($var, $val) = @_;
	print STDOUT &quot;SET VARIABLE $var \&quot;$val\&quot; \n&quot;;
	while(&lt;STDIN&gt;) {
		m/200 result=1/ &amp;&amp; last;
	}
	return;
}

sub printverbose {
	my ($var, $val) = @_;
	print STDOUT &quot;VERBOSE \&quot;$var\&quot; $val\n&quot;;
	while(&lt;STDIN&gt;) {
		m/200 result=1/ &amp;&amp; last;
	}
	return;
}</pre>
<p>Happy Coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/177/use-enum-to-save-real-money/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Automatically Block Failed SIP Peer Registrations</title>
		<link>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/</link>
		<comments>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 12:54:33 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[brute force attack]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=171</guid>
		<description><![CDATA[Previously we posted a little script for quickly checking your asterisk log for failed peer registrations. Building on that script, and with the use of iptables and cron, you can easily (and automatically) block flooding traffic from your system. Iptables, a linux command line program to filter IP traffic, provides high level packet filtering before [...]]]></description>
			<content:encoded><![CDATA[<p>Previously we posted <a href="http://www.teamforrest.com/blog/165/asterisk-failed-peer-sip-brute-force/">a little script for quickly checking your asterisk log for failed peer registrations</a>. Building on that script, and with the use of <strong>iptables</strong> and <strong>cron</strong>, you can easily (and automatically) block flooding traffic from your system. Iptables, a linux command line program to filter IP traffic, provides high level packet filtering before the traffic can be used to corrupt a program. Cron, the linux time scheduler, enables you to automatically run commands at scheduled time periods.</p>
<h2>Set up IP Tables</h2>
<p>We will not be discussing the intricacies of iptables in this post. There are excellent tutorials on iptables, and with most things linux, help is only a google away. To help identify the traffic blocked as asterisk related, a new chain will be created appropriately called&#8230; asterisk.</p>
<p>Here&#8217;s how to add the new chain:</p>
<pre class="brush: plain;">iptables -N asterisk
iptables -A INPUT -j asterisk
iptables -A FORWARD -j asterisk</pre>
<p>This will help identify hosts blocked for failed registrations.</p>
<h2>Asterisk&#8217;s Log for Failed Registrations</h2>
<p>In most cases of a sip flood attack, the host attempts registration to Asterisk. These hosts are identified in the Asterisk log (<strong>/var/log/messages</strong>) as &#8220;No matching peer found.&#8221; The following perl script scans /var/log/messages for these patterns, strips the IP address, and puts the IP address into an array.</p>
<p>After the file has been read, the IP addresses are counted (each count is a failed attempt), compared against the existing blocked hosts, and new occurrences are blocked. With this script we are blocking any host after the 4th failed attempt.</p>
<p>Here&#8217;s the script (<strong>last updated 21 APR 2010</strong>):</p>
<pre class="brush: perl;">#!/usr/bin/perl -w
use strict;
use warnings;
my (@failhost);
my %currblocked;
my %addblocked;
my $action;

open (MYINPUTFILE, &quot;/var/log/asterisk/messages&quot;) or die &quot;\n&quot;, $!, &quot;Does log file file exist\?\n\n&quot;;

while (&lt;MYINPUTFILE&gt;) {
	my ($line) = $_;
	chomp($line);
	if ($line =~ m/\' failed for \'(.*?)\' - No matching peer found/) {
		push(@failhost,$1);
	}
}

my $blockedhosts = `/sbin/iptables -n -L asterisk`;

while ($blockedhosts =~ /(.*)/g) {
	my ($line2) = $1;
	chomp($line2);
	if ($line2 =~ m/(\d+\.\d+\.\d+\.\d+)(\s+)/) {
		$currblocked{ $1 } = 'blocked';
	}
}

while (my ($key, $value) = each(%currblocked)){
	print $key . &quot;\n&quot;;
}

if (@failhost) {
	&amp;count_unique(@failhost);
	while (my ($ip, $count) = each(%addblocked)) {
		if (exists $currblocked{ $ip }) {
			print &quot;$ip already blocked\n&quot;;
		} else {
			$action = `/sbin/iptables -I asterisk -s $ip -j DROP`;
			print &quot;$ip blocked. $count attempts.\n&quot;;
		}
	}
} else {
	print &quot;no failed registrations.\n&quot;;
}

sub count_unique {
    my @array = @_;
    my %count;
    map { $count{$_}++ } @array;
    map {($addblocked{ $_ } = ${count{$_}})} sort keys(%count);
}</pre>
<h2>Schedule the script with cron</h2>
<p>The final step is to schedule your script to run every X minutes in cron. We&#8217;ve chosen to run our script every 2 minutes, but you can change this to 1 minute or any other time period you choose. Just remember&#8230; you can receive thousands of attempts within 2 minutes.</p>
<p>If you have named your script check-failed-regs.pl and placed it in your /usr/local/bin directory, your cron statement would look like this:</p>
<pre class="brush: plain;">*/2 * * * * perl /usr/local/bin/check-failed-regs.pl &amp;&gt; /dev/null</pre>
<p>Questions? Comments? We love feedback. Or, <a href="/contact.html">contact us</a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Perl Script for Asterisk Failed Peer Registrations</title>
		<link>http://www.teamforrest.com/blog/165/asterisk-failed-peer-sip-brute-force/</link>
		<comments>http://www.teamforrest.com/blog/165/asterisk-failed-peer-sip-brute-force/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 18:46:57 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[brute force attack]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=165</guid>
		<description><![CDATA[I guess this might be better titled as the Quick and Dirty Perl Script&#8230; but here we go: #!/usr/bin/perl -w use strict; use warnings; my (@failhost); open (MYINPUTFILE, &#34;/var/log/asterisk/$ARGV[0]&#34;) or die &#34;\n&#34;, $!, &#34;Does log file file exist\?\n\n&#34;; while (&#60;MYINPUTFILE&#62;) { my ($line) = $_; chomp($line); if ($line =~ m/\' failed for \'(.*?)\' - No [...]]]></description>
			<content:encoded><![CDATA[<p>I guess this might be better titled as the <del datetime="2010-04-12T19:23:51+00:00">Quick and</del> Dirty Perl Script&#8230; but here we go:</p>
<pre class="brush: perl;">#!/usr/bin/perl -w
use strict;
use warnings;
my (@failhost);

open (MYINPUTFILE, &quot;/var/log/asterisk/$ARGV[0]&quot;) or die &quot;\n&quot;, $!, &quot;Does log file file exist\?\n\n&quot;;

while (&lt;MYINPUTFILE&gt;) {
	my ($line) = $_;
	chomp($line);
	if ($line =~ m/\' failed for \'(.*?)\' - No matching peer found/) {
		push(@failhost,$1);
	}
}

if (@failhost) {
	&amp;count_unique(@failhost);
} else {
	print &quot;no failed registrations.\n&quot;;
}

sub count_unique {
    my @array = @_;
    my %count;
    map { $count{$_}++ } @array;

	#print them out:

    map {print &quot;$_ = ${count{$_}}\n&quot;} sort keys(%count);

}</pre>
<p>And while we duck from @<a href="http://twitter.com/merlyn">Merlyn&#8217;s</a> criticisms (although we love his criticism), the basic usage is:</p>
<p>perl [Whatever you named it].pl messages<br />
<em> or</em> perl [Whatever you named it].pl messages.1</p>
<p><b>Results look like:</b></p>
<p>184.73.53.22 = 13586<br />
64.76.45.100 = 9895<br />
78.46.87.14 = 9960</p>
<p>Or &#8220;no failed registrations.&#8221; if you have no failed attempts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/165/asterisk-failed-peer-sip-brute-force/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Vulnerability Assessment and Scans</title>
		<link>http://www.teamforrest.com/blog/162/vulnerability-assessment-and-scans/</link>
		<comments>http://www.teamforrest.com/blog/162/vulnerability-assessment-and-scans/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 01:02:59 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[vulnerability assessment]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=162</guid>
		<description><![CDATA[Vulnerability scanning and assessment identifies security risks within your network. Team Forrest highly recommends proactive, routine scanning to help assess, react, and improve your network security. Utilizing a variety of techniques, applications, and tools, Team Forrest remotely examines your network over the public Internet. identified weaknesses and vulnerabilities are assessed for risk and detailed, with [...]]]></description>
			<content:encoded><![CDATA[<p>Vulnerability scanning and assessment identifies security risks within your network. Team Forrest highly recommends proactive, routine scanning to help assess, react, and improve your network security.</p>
<p>Utilizing a variety of techniques, applications, and tools, Team Forrest remotely examines your network over the public Internet. identified weaknesses and vulnerabilities are assessed for risk and detailed, with recommendations, to the customer.</p>
<h2>What is a Vulnerability Scan?</h2>
<p>A vulnerability scan assesses computer systems, networks, and applications for weaknesses. Vulnerability Scans are recommended (and may be required) for any business conducting e-commerce, hosting a server with a publicly accessible IP Address, or allowing remote access to company assets. Team Forrest recommends a comprehensive scan, including:</p>
<ol>
<li>Checking for vulnerabilities of remote systems</li>
<li>Checking for misconfiguration of remote systems, software, and services</li>
<li>Checking commonly used passwords</li>
<li>Checking Denial of Service sensitivity</li>
<li>Checking for Web Vulnerability (such as SQL Injection)</li>
</ol>
<h2>How does a Vulnerability Assessment Work?</h2>
<p>Team Forrest performs the scan remotely, accessing your network over the Public Internet. There is nothing for you to do and no software will need to be installed. Our servers will simply assess your network remotely.</p>
<p>Once the scan completes, Team Forrest provides a detailed assessment including identified risks and vulnerabilities, as well as their severity level. Team Forrest also provides recommendations and assisting in correcting any identified flaws or vulnerabilities.</p>
<p>For more information on a Team Forrest Vulnerability Scan / Assessment, <strong>please call 888-295-0025</strong> or <a href="/contact.html">contact us</a> for details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/162/vulnerability-assessment-and-scans/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Firefox 3.6.2 Corrects Vulnerability</title>
		<link>http://www.teamforrest.com/blog/160/firefox-3-6-2-corrects-vulnerability/</link>
		<comments>http://www.teamforrest.com/blog/160/firefox-3-6-2-corrects-vulnerability/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 12:27:46 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=160</guid>
		<description><![CDATA[If you’re running Firefox 3.6, Mozilla strongly recommends you update to version 3.6.2. The new version corrects a critical security hole allowing an attacker to crash your browser and/or run arbitrary code on your machine. For more information, check out the post at VoIP Tech Chat.]]></description>
			<content:encoded><![CDATA[<p>If you’re running Firefox 3.6, Mozilla strongly recommends you update to version 3.6.2. The new version corrects a critical security hole allowing an attacker to crash your browser and/or run arbitrary code on your machine.</p>
<p>For more information, check out the post at <a href="http://www.voiptechchat.com/tech/408/got-firefox-upgrade-to-3-6-2/">VoIP Tech Chat</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/160/firefox-3-6-2-corrects-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SIP Response Codes</title>
		<link>http://www.teamforrest.com/blog/158/sip-response-codes/</link>
		<comments>http://www.teamforrest.com/blog/158/sip-response-codes/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 18:15:27 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=158</guid>
		<description><![CDATA[The Session Initiation Protocol (SIP) is widely used to control VoIP, Video Calls, and other multimedia communication over a newtork. SIP uses design elements similar to HTTP requests/responses (although they are not 1 to 1). Following is a list of SIP Response Codes: Information SIP Responses &#8211; 1xx Informational responses, indicate that the server contacted [...]]]></description>
			<content:encoded><![CDATA[<p>The Session Initiation Protocol (SIP) is widely used to control VoIP, Video Calls, and other multimedia communication over a newtork. SIP uses design elements similar to HTTP requests/responses (although they are not 1 to 1).</p>
<p>Following is a list of SIP Response Codes: <span id="more-158"></span></p>
<h2>Information SIP Responses &#8211; 1xx</h2>
<p><em>Informational responses, indicate that the server contacted is performing some further action and does not yet have a definitive response. A server sends a 1xx response if it expects to take more than 200 ms to obtain a final response.<br />
</em></p>
<ul>
<li>100 Trying</li>
<li>180 Ringing</li>
<li>181 Call Is Being Forwarded</li>
<li>182 Queued</li>
<li>183 Session Progress</li>
</ul>
<h2>Successful SIP Responses &#8211; 2xx</h2>
<p><em>The action was successfully received, understood, and accepted.<br />
</em></p>
<ul>
<li>200 OK</li>
<li>202 Accepted (request understood, but cannot be processed)</li>
</ul>
<h2>Redirection SIP Responses &#8211; 3xx</h2>
<p><em>Further action needs to be taken in order to complete the request.<br />
</em></p>
<ul>
<li>300 Multiple Choices</li>
<li>301 Moved Permanently</li>
<li>302 Moved Temporarily</li>
<li>305 Use Proxy</li>
<li>380 Alternative Service</li>
</ul>
<h2>Client Error SIP Responses &#8211; 4xx</h2>
<p><em>The request contains bad syntax or cannot be fulfilled at the server.<br />
</em></p>
<ul>
<li>400 Bad Request</li>
<li>401 Unauthorized (Used only by registrars or user agents. Proxies will/should use 407)</li>
<li>402 Payment Required</li>
<li>403 Forbidden</li>
<li>404 Not Found</li>
<li>405 Method Not Allowed</li>
<li>406 Not Acceptable</li>
<li>407 Proxy Authentication Required</li>
<li>408 Request Timeout</li>
<li>409 Conflict</li>
<li>410 Gone (The user is not available here but once was)</li>
<li>412 Conditional Request Failed</li>
<li>413 Request Entity Too Large</li>
<li>414 Request-URI Too Long</li>
<li>415 Unsupported Media Type</li>
<li>416 Unsupported URI Scheme</li>
<li>417 Unknown Resource-Priority</li>
<li>420 Bad Extension</li>
<li>421 Extension Required</li>
<li>422 Session Interval Too Small</li>
<li>423 Interval Too Brief</li>
<li>424 Bad Location Information</li>
<li>428 Use Identity Header</li>
<li>429 Provide Referrer Identity</li>
<li>433 Anonymity Disallowed</li>
<li>436 Bad Identity-Info</li>
<li>437 Unsupported Certificate</li>
<li>438 Invalid Identity Header</li>
<li>480 Temporarily Unavailable</li>
<li>481 Call Leg/Transaction Does Not Exist</li>
<li>482 Loop Detected</li>
<li>483 Too Many Hops</li>
<li>484 Address Incomplete</li>
<li>485 Ambiguous</li>
<li>486 Busy Here</li>
<li>487 Request Terminated</li>
<li>488 Not Acceptable Here</li>
<li>489 Bad Event</li>
<li>491 Request Pending</li>
<li>493 Undecipherable (Could not decrypt S/MIME body part)</li>
<li>494 Security Agreement Required</li>
</ul>
<h2>Server Error SIP Responses &#8211; 5xx</h2>
<p><em>The server failed to fulfill an apparently valid request.<br />
</em></p>
<ul>
<li>500 Server Internal Error</li>
<li>501 Not Implemented (SIP request method is not implemented at the server)</li>
<li>502 Bad Gateway</li>
<li>503 Service Unavailable</li>
<li>504 Server Time-out</li>
<li>505 Version Not Supported (The server does not support the version of the SIP protocol used)</li>
<li>513 Message Too Large</li>
<li>580 Precondition Failure</li>
</ul>
<h2>Global Failure SIP Responses &#8211; 6xx</h2>
<p><em>The request cannot be fulfilled at any server.<br />
</em></p>
<ul>
<li>600 Busy Everywhere</li>
<li>603 Decline</li>
<li>604 Does Not Exist Anywhere</li>
<li>606 Not Acceptable</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/158/sip-response-codes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Integrating Fax for Asterisk</title>
		<link>http://www.teamforrest.com/blog/156/integrating-fax-for-asterisk/</link>
		<comments>http://www.teamforrest.com/blog/156/integrating-fax-for-asterisk/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 03:08:41 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[fax]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=156</guid>
		<description><![CDATA[Asterisk provides an open-source solution for IP Telephony (aka VoIP). Customizing your telephone system to increase productivity remains one of Asterisk’s greatest features. Today, we will look at using Asterisk to replace your need for a fax machine. Benefits Store faxes electronically Reduce printing costs Share faxes via email Requirements Server running Asterisk (32 bit [...]]]></description>
			<content:encoded><![CDATA[<p>Asterisk provides an open-source solution for IP Telephony (aka VoIP). Customizing your telephone system to increase productivity remains one of Asterisk’s greatest features. Today, we will look at using Asterisk to replace your need for a fax machine.</p>
<h3>Benefits</h3>
<ul>
<li>Store faxes electronically</li>
<li>Reduce printing costs</li>
<li>Share faxes via email</li>
</ul>
<h3>Requirements</h3>
<ul>
<li>Server running Asterisk (32 bit compatibility needed)</li>
<li>Fax for Asterisk Software Add-on</li>
</ul>
<h2>Step One: Get the Fax for Asterisk Software License</h2>
<p>First, choose the licensing based on your needs. If you will only need to support 1 simultaneous fax <span id="more-156"></span> “session,” you may be interested in the Free Fax For Asterisk License. Digium provides the Free Fax for Asterisk software at no cost, limited one per installation of Asterisk. You can combine the Free Fax for Asterisk license with the paid Fax for Asterisk licensing if you will need additional simultaneous fax sessions.</p>
<p><em>For example, you can download and install Free Fax for Asterisk providing your system one (1) fax session. If you find you need additional simultaneous sessions, simply purchase a paid license (currently $39.99 per session).</em></p>
<p>To get the Fax for Asterisk software, go to the <a href="http://store.digium.com/">Digium Store</a>. Once “purchased” you will receive your license via email.</p>
<h2>Step Two: Download and Install the Fax for Asterisk Software</h2>
<p>Once you’ve received your license, there are many small steps needed to download, register, and install the software.</p>
<ul>
<li>Download and run the registration software (outgoing network traffic to TCP port 443 (SSL) must be allowed)</li>
</ul>
<pre>cd /root
wget http://downloads.digium.com/pub/register/x86-32/register
chmod 500 /root/register
/root/register</pre>
<ul>
<li>Complete the registration</li>
<li> Go to <a href="http://www.digium.com/en/docs/FAX/faa-download.php">http://www.digium.com/en/docs/FAX/faa-download.php</a> and discover which files to download</li>
<li> Download both the <strong>res_fax</strong> and <strong>res_fax_digium files</strong></li>
<li> Untar the res_fax file and copy it to the source file directory (<em>example res_fax-1.6.0_1.0.3-x86_32.tar.gz</em>)</li>
</ul>
<pre>tar xzvf res_fax-1.6.0_1.0.3-x86_32.tar.gz
cp /root/res_fax-1.6.0_1.0.3-x86_32/res_fax.so /usr/lib/asterisk/modules</pre>
<ul>
<li>Untar and install the res_fax_digium software (<em>example res_fax_digium-1.6.0_1.0.3-pentium4m_32.tar.gz</em>)</li>
</ul>
<pre>tar xzvf res_fax_digium-1.6.0_1.0.3-pentium4m_32.tar.gz
cp /root/res_fax_digium-1.6.0_1.0.3-pentium4m_32/res_fax_digium.so /usr/lib/asterisk/modules</pre>
<ul>
<li>Make a directory for your fax files</li>
</ul>
<pre>mkdir /var/spool/asterisk/fax</pre>
<h2>Step Three: Test if the Software Installed Correctly</h2>
<p>Restart asterisk and test if that the fax module has loaded:</p>
<pre>asterisk -rx "restart now"
asterisk -r
*CLI&gt; fax show stats</pre>
<p>If the software installed successfully, you should see something similar to:</p>
<pre>Fax Statistics:
---------------

Current Sessions     : 0
Transmit Attempts    : 0
Receive Attempts     : 0
Completed Faxes      : 0
Failed Faxes         : 0
*CLI&gt;
Digium T.38
Licensed Channels    : 1
Max Concurrent       : 0
Success              : 0
Canceled             : 0
No Fax               : 0
Partial              : 0
Negotiation Failed   : 0
Train Failure        : 0
Protocol Error       : 0
IO Partial           : 0
IO Fail              : 0
*CLI&gt;
Digium G.711
Licensed Channels    : 1
Max Concurrent       : 1
Success              : 0
Switched to T.38     : 0
Canceled             : 0
No Fax               : 0
Partial              : 0
Negotiation Failed   : 0
Train Failure        : 0
Protocol Error       : 0
IO Partial           : 0
IO Fail              : 0</pre>
<h2>Step Four: Make a dialplan</h2>
<p>Make a dialplan that fits your needs. Here’s an example for sending and receiving:</p>
<pre>[inboundfax]
exten =&gt; s,1,NoOp(**** FAX RECEIVED from ${CALLERID(num)} ${STRFTIME(${EPOCH},,%c)} ****)
exten =&gt; s,n,Set(FAXOPT(ecm)=yes)
exten =&gt; s,n,Set(FILENAME=fax-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten =&gt; s,n,Set(FAXFILE=${FILENAME}.tif)
exten =&gt; s,n,Set(FAXOPT(ecm)=yes)
exten =&gt; s,n,Set(FAXOPT(headerinfo)=Received by MYCOMPANY ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M)})
exten =&gt; s,n,Set(FAXOPT(localstationid)=5555551212)
exten =&gt; s,n,Set(FAXOPT(maxrate)=14400)
exten =&gt; s,n,Set(FAXOPT(minrate)=2400)
exten =&gt; s,n,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten =&gt; s,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
exten =&gt; s,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
exten =&gt; s,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
exten =&gt; s,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
exten =&gt; s,n,NoOp(**** RECEIVING FAX : ${FAXFILE} ****)
exten =&gt; s,n,ReceiveFAX(/var/spool/asterisk/fax/${FAXFILE})
exten =&gt; s,n,Hangup()
exten =&gt; h,1,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})

[outboundfax]
exten =&gt; s,1,NoOp(send a fax)
exten =&gt; s,n,Set(FAXOPT(filename)=${FAXFILE})
exten =&gt; s,n,Set(FAXOPT(ecm)=yes)
exten =&gt; s,n,Set(FAXOPT(headerinfo)=Fax from MYCOMPANY +1 555 555 1212)
exten =&gt; s,n,Set(FAXOPT(localstationid)=15555551212)
exten =&gt; s,n,Set(FAXOPT(maxrate)=14400)
exten =&gt; s,n,Set(FAXOPT(minrate)=2400)
exten =&gt; s,n,SendFAX(/tmp/${FAXFILE},d)
exten =&gt; h,1,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})</pre>
<h2>Step Five: Test</h2>
<p>How do you test? Simple point an incoming number to inboundfax,s,1 and watch the magic happen. Faxes will be saved to /var/spool/asterisk/fax/ in tiff format.</p>
<h2>But Wait! There&#8217;s More!</h2>
<p>Sure, you could stop there, but wouldn’t it be neat to automatically email the received fax in pdf format? Using an AGI script, you can simply convert the tiff file into pdf format, attach it to an email, and off it goes!</p>
<p>Now, there are literally a thousand ways to do this. You can write your AGI scripts in the programming language of your choice; every language has it’s pros and cons. In our example, we’re going to demonstrate this process using a Perl script.</p>
<h2>Install the Pre-reqs</h2>
<p>You will want to install ghostscript to help convert the graphic files. On a centos install, this is as easy as typing <strong>yum -y install ghostscript</strong>. If you are using a different build you can install how you like or download the code directly from <a href="http://www.ghostscript.com/">http://www.ghostscript.com/</a>.</p>
<p>For the Perl pre-reqs, you will want to install a few packages from CPAN (to send mail and use smtp authentication):</p>
<pre>perl -MCPAN -e shell
install MIME::Lite
install MIME::Base64
install Authen::SASL</pre>
<p>Next create your perl script. In this case, call it <strong>receivedfax.pl</strong> and place it in /var/lib/asterisk/agi-bin:</p>
<pre>#!/usr/bin/perl
use strict;
use MIME::Lite;

my ($msg,$stdinresult);

# $ARGV[0] = msgfrom, $ARGV[1] = msgto, $ARGV[2] = cidnum, $ARGV[3] = filename,
chomp($stdinresult = <stdin>);

if ($#ARGV != 3) {
	print qq(VERBOSE "FAIL: 4 Arguments needed" 2\n);
	chomp($stdinresult = <stdin>);
	exit(0);
}

system("tiff2ps -a /var/spool/asterisk/fax/$ARGV[3].tif | ps2pdf13 -sPAPERSIZE=letter - > /var/spool/asterisk/fax/$ARGV[3].pdf");

$msg = MIME::Lite->new(
	From => "$ARGV[0]",
	To => "$ARGV[1]",
	Subject => "FAX from $ARGV[2]",
	Type => 'multipart/mixed'
);

$msg->attach(
	Type => 'TEXT',
	Data => "Greetings.\n\nYou have received a fax from $ARGV[2]. (attached)\n\nSincerely,\nCOMPANY NAME\n\n"
);

$msg->attach(
	Type => 'image/pdf',
	Path => "/var/spool/asterisk/fax/$ARGV[3].pdf",
	Filename => "$ARGV[3].pdf",
	Disposition => 'attachment'
);

MIME::Lite->send('smtp', 'SMTP.SERVER.COM', Timeout=>60,
	AuthUser=>'MAILUSER', AuthPass=>'PASSWORD');

$msg->send;

system("rm -f /var/spool/asterisk/fax/$ARGV[3].pdf");

#example: receivedfax.pl "asterisk@mydomain.com" "JohnDoe@mydomain.com" 55512345678 fax-20091115-170217</pre>
<p>Then, modify your dialplan to run the AGI script:</p>
<pre>[inboundfax]
exten => s,1,NoOp(**** FAX RECEIVED from ${CALLERID(num)} ${STRFTIME(${EPOCH},,%c)} ****)
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,Set(FILENAME=fax-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => s,n,Set(FAXFILE=${FILENAME}.tif)
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,Set(FAXOPT(headerinfo)=Received by MYCOMPANY ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M)})
exten => s,n,Set(FAXOPT(localstationid)=5555551212)
exten => s,n,Set(FAXOPT(maxrate)=14400)
exten => s,n,Set(FAXOPT(minrate)=2400)
exten => s,n,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten => s,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
exten => s,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
exten => s,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
exten => s,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
exten => s,n,NoOp(**** RECEIVING FAX : ${FAXFILE} ****)
exten => s,n,ReceiveFAX(/var/spool/asterisk/fax/${FAXFILE})
exten => s,n,Hangup()
exten => h,1,GotoIf($["${FAXOPT(ecm)}" = "no" ]?end)
exten => h,n,AGI(receivedfax.pl,from@domain.com,to@domain.com,${CALLERID(num)},${FILENAME})
exten => h,n(end),NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)}) </pre>
<p>You can even create a similar script to transform a pdf into a tiff file and send via outbound fax:</p>
<pre>#!/usr/bin/perl -w
use strict;
use warnings;
sub random_name_generator($);

# usage: faxout.pl number filename
# example: faxout.pl 5555551212 myfax.pdf

if ($#ARGV != 1) {
	print qq(FAIL: 2 Arguments needed\n);
	exit(0);
}

my ($callto,$pdfname,$callfile,$filename);

$callto = $ARGV[0];
$pdfname = $ARGV[1];

my $tifname = $pdfname;
$tifname =~ s/.pdf/.tif/i;

system("gs -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -sOutputFile=$tifname $pdfname");

if ($callto) {
	$filename = &#038;random_name_generator(12).".call";
	open (MYFILE, ">>/tmp/$filename") or die $!;
	$callfile = "Channel: Local/$callto\@outboundialcontext\n";
	$callfile = $callfile . "MaxRetries: 1\n";
	$callfile = $callfile . "RetryTime: 60\n";
	$callfile = $callfile . "WaitTime: 60\n";
	$callfile = $callfile . "Archive: yes\n";
	$callfile = $callfile . "Context: outboundfax\n";
	$callfile = $callfile . "Extension: s\n";
	$callfile = $callfile . "Priority: 1\n";
	$callfile = $callfile . "Set: FAXFILE=$tifname\n";
	print MYFILE $callfile;
	close (MYFILE);
	system("mv /tmp/$filename /var/spool/asterisk/outgoing");
}

sub random_name_generator($) {
	my ($namelength, $randomstring, @chars);
	$namelength = shift;
	@chars = ('a'..'z','A'..'Z','0'..'9');
	foreach (1..$namelength) {
		$randomstring .= $chars[rand @chars];
	}
	return $randomstring;
}</pre>
<p>Happy Coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/156/integrating-fax-for-asterisk/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>New! Human Resources Consulting</title>
		<link>http://www.teamforrest.com/blog/152/new-human-resources-consulting/</link>
		<comments>http://www.teamforrest.com/blog/152/new-human-resources-consulting/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 19:29:30 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[consulting]]></category>
		<category><![CDATA[human resources]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=152</guid>
		<description><![CDATA[Team Forrest proudly announces the launch of our Human Resources Consulting Services. Team Forrest now provides HR Consulting Services to both existing and new businesses. Whether you’re looking to streamline your existing needs or need a complete HR package, Team Forrest is here to help. Human Resources Consulting Strong Human resources policies and procedures provides a [...]]]></description>
			<content:encoded><![CDATA[<p>Team Forrest proudly announces the launch of our Human Resources Consulting Services. Team Forrest now provides <a href="http://www.teamforrest.com/human-resources.html">HR Consulting Services</a> to both existing and new businesses. Whether you’re looking to streamline your existing needs or need a complete HR package, Team Forrest is here to help.</p>
<h2><a href="http://www.teamforrest.com/human-resources.html">Human Resources Consulting</a></h2>
<p>Strong Human resources policies and procedures provides a great defense against expensive lawsuits and complaints. Our professional HR Consultants use their experience and knowledge to evaluate your existing procedures and correct potential liability. From training to policy development, strong Human Resources policies provide a level of protection for both your employees and company.</p>
<p>We look forward to working with you and helping your business.</p>
<p>For more information about our new services, please visit the <a href="http://www.teamforrest.com/human-resources.html">Human Resources</a> page or <a href="http://www.teamforrest.com/contact.html">contact</a> us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/152/new-human-resources-consulting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Skype for Asterisk Public Beta</title>
		<link>http://www.teamforrest.com/blog/136/skype-for-asterisk-public-beta/</link>
		<comments>http://www.teamforrest.com/blog/136/skype-for-asterisk-public-beta/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 20:14:30 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[Digium]]></category>
		<category><![CDATA[Skype]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=136</guid>
		<description><![CDATA[VoIP Tech Chat posted an article about Digium&#8217;s public Beta launch of Skype for Asterisk. They wrote the article in a Billy Mays style: Limited Time Offer &#8211; Skype for Asterisk Public Beta]]></description>
			<content:encoded><![CDATA[<p>VoIP Tech Chat posted an article about Digium&#8217;s public Beta launch of Skype for Asterisk.</p>
<p>They wrote the article in a Billy Mays style:</p>
<p><a href="http://www.voiptechchat.com/voip/303/skype-for-asterisk-beta-limited-time-offer/">Limited Time Offer &#8211; Skype for Asterisk Public Beta</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/136/skype-for-asterisk-public-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zero-day Flaw in Firefox 3.5</title>
		<link>http://www.teamforrest.com/blog/128/zero-day-firefox/</link>
		<comments>http://www.teamforrest.com/blog/128/zero-day-firefox/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 16:57:26 +0000</pubDate>
		<dc:creator>Team Forrest</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=128</guid>
		<description><![CDATA[Update On 7/16/2009, Firefox released version 3.5.1 to address the issue. Read Update Below! Mozilla.com released details today on a critical JavaScript vulnerability in the latest version of the popular Firefox 3.5 Web Browser. The vulnerability allows execution of code on the client (or target) system simply by visiting a website. No patch is currently [...]]]></description>
			<content:encoded><![CDATA[<p class="alert"><strong>Update</strong> On 7/16/2009, Firefox released version 3.5.1 to address the issue. <strong>Read Update Below!</strong></p>
<p>Mozilla.com released details today on a critical JavaScript vulnerability in the latest version of the popular Firefox 3.5 Web Browser. The vulnerability allows execution of code on the client (or target) system simply by visiting a website.</p>
<p>No patch is currently available for the flaw and several organizations (such as Scurnia, The Sans Institute, and the United States Computer Emergency Response Team) are recommending the complete disabling of JavaScript in Firefox (see below). Additionally, The Sans Institute is recommending the use of the NoScript Firefox plugin (that enables javascript only from white-listed sites).</p>
<h4>Additional information:</h4>
<ul>
<li><a href="http://blog.mozilla.com/security/2009/07/14/critical-javascript-vulnerability-in-firefox-35/">Mozilla Security Blog Post</a></li>
<li><a href="http://secunia.com/advisories/35798/">Secunia.com Advisory</a></li>
<li><a href="http://www.us-cert.gov/current/">United States Computer Emergency Response Team</a></li>
<li><a href="http://noscript.net/">NoScript Plugin</a></li>
</ul>
<h3>How to Disable the Javascript Engine in Firefox:</h3>
<ol>
<li>Enter <strong><em>about:config</em></strong> in the browser’s location bar.</li>
<li>Type <strong><em>jit</em></strong> in the Filter box at the top of the config editor.</li>
<li><strong>Double-click</strong> the line containing <em>javascript.options.jit.content</em> <strong>setting the value to false</strong>.</li>
</ol>
<p>Mozilla advises that disabling the JIT will result in decreased JavaScript performance and is only recommended as a temporary security measure.  Once users have been received the security update containing the fix for this issue, they should restore the JIT repeating the process above and setting the <em>javascript.options.jit.content </em>value to <em>true</em>.</p>
<h4>Update — 7/16/2009</h4>
<p>Firefox has introduced version 3.5.1 to address the security risk, as <a href="https://developer.mozilla.org/devnews/index.php/2009/07/16/firefox-3-5-1-update-is-now-available-for-download/">posted</a> on their developer blog:</p>
<blockquote>
<h3>Firefox 3.5.1 update is now available for download</h3>
<p>As part of the Mozilla Corporation’s ongoing security and stability process, Firefox 3.5.1 is now available for Windows, Mac, and Linux users as a free download from <a href="http://www.firefox.com">www.firefox.com</a>.</p>
<p>We strongly recommend that all Firefox 3.5 users upgrade to this latest release. If you already have Firefox 3.5, you will receive an automated update notification within 24 to 48 hours. This update can also be applied manually by selecting “Check for Updates…” from the Help menu.</p>
<p>For a list of changes and more information, please see the <a href="http://www.mozilla.com/firefox/3.5.1/releasenotes/">Firefox 3.5.1 release notes</a>.</p>
<p>Please note: If you’re still using Firefox 2.0.0.x, this version is no longer supported and contains known security vulnerabilities. Please upgrade to Firefox 3.5 by downloading Firefox 3.5.1 from <a href="http://www.www.firefox.com">www.firefox.com</a>.</p>
<h6>This entry was posted by beltzner on Thursday, July 16th, 2009 at 6:34 pm.</h6>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/128/zero-day-firefox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
