<?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 &#187; SIP</title>
	<atom:link href="http://www.teamforrest.com/blog/tag/sip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.teamforrest.com/blog</link>
	<description>Kamailio, Asterisk, VoIP, and IT Consulting</description>
	<lastBuildDate>Fri, 11 Mar 2011 04:48:24 +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>Explaining Sip Brute Force Attacks to Non-Techs</title>
		<link>http://www.teamforrest.com/blog/196/explaining-sip-brute-force-attacks/</link>
		<comments>http://www.teamforrest.com/blog/196/explaining-sip-brute-force-attacks/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 04:48:24 +0000</pubDate>
		<dc:creator>Fred Posner</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[brute force attack]]></category>
		<category><![CDATA[kamailio]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/blog/?p=196</guid>
		<description><![CDATA[Today we received a call from a federal employee investigating a “hack” on a client&#8217;s system. Basically, the client suffered a SIP Brute Force attack on their elastix system. Besides the shock of a call from the feds (why did &#8230; <a href="http://www.teamforrest.com/blog/196/explaining-sip-brute-force-attacks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today we received a call from a federal employee investigating a “hack” on a client&#8217;s system. Basically, the client suffered a SIP Brute Force attack on their elastix system. Besides the shock of a call from the feds (<a href="http://www.voiptechchat.com/voip/457/amazon-ec2-sip-brute-force-attacks-on-rise/">why did they ignore those Amazon attacks?</a>), the realization of explaining a sip attack to someone not familiar with SIP, telephony, networking, or servers posed a little challenge.</p>
<p>So, how do we start?</p>
<p><strong>First step</strong>: We will no longer use the words SIP, Brute, Force, and Attack. =)</p>
<p>What we&#8217;re talking about is a scheme to make expensive calls through your phone system. Of course, this isn&#8217;t true for all scenarios, but the vast majority simply want to make expensive calls on your dime.</p>
<p><strong>How does it work?</strong></p>
<p>The bad guys trick your phone system into thinking they are a valid user.</p>
<p><strong>How can they do that?</strong></p>
<p>When phones connect to your phone system, the system replies with different messages. Based on those messages, the bad guys can figure out phone names. Think of your phone system as the receptionist. An attempt might be similar to&#8230;</p>
<p style="padding-left: 30px;"><strong>Bad Guy</strong>: “Hi, is Alice there?”<br />
<strong>Receptionist:</strong> “No, there is no Alice here. You have the wrong number.”<br />
<strong>Bad Guy: </strong>“Hi, is Bob there?”<br />
<strong>Receptionist: </strong>“Yes, who may I say is calling?”</p>
<p>Basically, there&#8217;s a different response based on if that person exists in the company. Same thing with the phones. Once the Bad Guys find out phone names, they then use their computers to crack the phone password.</p>
<p>Once the password is detected, they connect their phone to your system and begin making calls.</p>
<p><strong>What can I do to stop this?</strong></p>
<p>If the person in charge of your phone system doesn&#8217;t understand what this attack is, you need to hire a consultant to help you and/or train your administrator. If you or your administrator understand this attack, then you need to make sure you are following the best practices for SIP security (<a href="http://www.voiptechchat.com/voip/263/7-easy-steps-to-better-sip-security">here&#8217;s a good link for asterisk best practices</a>).</p>
<p>If you&#8217;re running <a href="http://www.asterisk.org">asterisk</a>, you might wish to <a title="Automatically Block Failed SIP Peer Registrations" href="http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/">install a script that checks for attacks and blocks those connections</a>.</p>
<h3>Even better&#8230; consider <a href="http://www.kamailio.org">Kamailio</a>.</h3>
<p><a href="http://www.kamailio.org">Kamailio</a> (pronounced KAMA-ILLY-OH) is an open-source SIP proxy, registrar, application that is extremely robust and powerful. The software includes anti-flood features that really help protect your system and truly helps to minimize these annoying attacks.</p>
<p>Remember, the Internet is like a big city. Sure there&#8217;s great museums and entertainment, but there&#8217;s also bad, bad places filled with bad, bad people. If you&#8217;re going to leave your BMW unlocked in Hell&#8217;s Kitchen, don&#8217;t be surprised when it&#8217;s been taken around the block a few times.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/196/explaining-sip-brute-force-attacks/feed/</wfw:commentRss>
		<slash:comments>1</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>Fred Posner</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[VoIP]]></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, &#8230; <a href="http://www.teamforrest.com/blog/171/asterisk-no-matching-peer-found-block/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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; title: ; notranslate">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 05 SEP 2010</strong>):</p>
<pre class="brush: perl; title: ; notranslate">#!/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);
	}
	if ($line =~ m/\' failed for \'(.*?)\' – Wrong password/) {
		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; title: ; notranslate">*/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>57</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>Fred Posner</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[VoIP]]></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: And while we duck from @Merlyn&#8217;s criticisms (although we love his criticism), the basic usage is: perl [Whatever you named it].pl messages &#8230; <a href="http://www.teamforrest.com/blog/165/asterisk-failed-peer-sip-brute-force/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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; title: ; notranslate">#!/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>3</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>Fred Posner</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 &#8230; <a href="http://www.teamforrest.com/blog/158/sip-response-codes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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>Asterisk Consulting Services</title>
		<link>http://www.teamforrest.com/blog/119/asterisk-consulting-services/</link>
		<comments>http://www.teamforrest.com/blog/119/asterisk-consulting-services/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 12:38:30 +0000</pubDate>
		<dc:creator>Fred Posner</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SIP]]></category>
		<category><![CDATA[voicemail]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=119</guid>
		<description><![CDATA[Team Forrest offers Asterisk Consulting Services for a wide variety of VoIP, Call Center, and other Telephony Based needs. From small, family business to large Corporations, Team Forrest’s simple philosophy of “Help the Client” ensures we provide great service to &#8230; <a href="http://www.teamforrest.com/blog/119/asterisk-consulting-services/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-42 alignright" title="asterisk-by-digium" src="http://www.teamforrest.com/blog/wp-content/uploads/2008/12/asterisk-by-digium-300x245.gif" alt="Asterisk is a registered trademark of Digium" /></p>
<p>Team Forrest offers Asterisk Consulting Services for a wide variety of VoIP, Call Center, and other Telephony Based needs. From small, family business to large Corporations, Team Forrest’s simple philosophy of “Help the Client” ensures we provide great service to meet your needs.</p>
<h2>Asterisk Consulting</h2>
<p>From carrier services to traditional PBX services, Team Forrest’s Asterisk Consulting Service provides you the solution you need. Services include:</p>
<ul>
<li>IVR Development</li>
<li>Custom AGI Scripting / Programming</li>
<li>OpenSER Integration</li>
<li>Calling Card Systems</li>
<li>Call Center / Sales Queue Development</li>
<li>Call Recording (call spying, call barging, whisper, etc.)</li>
<li>Database Integration (Microsoft SQL MSSQL, MySQL, Oracle, etc.)</li>
<li>Custom Solutions</li>
</ul>
<h2>Emergency Asterisk Support</h2>
<p>When a problem comes along, we provide <strong>24/7 Emergency Support </strong>to bring your system back to life. Both new and existing clients benefit from our immediate support response.</p>
<p>For immediate support please <a href="/contact/">contact</a> us or call <strong>+1 (212) 937-7844</strong>.</p>
<h2>Remote and Onsite Support</h2>
<p>Team Forrest offers <strong>immediate</strong> remote assistance across the globe. Local, onsite service is also available, with quick response to Michigan, Florida, and New York locations.</p>
<h2>Asterisk? Ask us.</h2>
<p>With Team Forrest, you get professional consulting at a great price — <strong>increased productivity</strong> at a <strong>lower cost</strong>. To see how Team Forrest can help improve your communication needs, <a href="/contact">contact us</a>. We enjoy talking with clients and look forward to seeing how we can help you.</p>
<p>Asterisk, developed and released by <a href="http://www.digium.com">Digium, Inc.</a>, is the world’s leading open source telephony engine and tool kit. Asterisk empowers communication with it’s flexibility. Whether working as a simple office telephone system, a robust Call Center platform, or anything in-between, Asterisk provides advanced features at a very low deployment cost.  Asterisk is released as open source under the GNU General Public License (GPL), and it is available for download free of charge. Asterisk is the most popular open source software available, with the Asterisk Community being the top influencer in VoIP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/119/asterisk-consulting-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk Security Advisory AST-2009-002</title>
		<link>http://www.teamforrest.com/blog/108/asterisk-security-advisory-ast-2009-002/</link>
		<comments>http://www.teamforrest.com/blog/108/asterisk-security-advisory-ast-2009-002/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 19:52:55 +0000</pubDate>
		<dc:creator>Fred Posner</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=108</guid>
		<description><![CDATA[Digium announced today a Remote Crash Vulnerability in the SIP Channel Driver affecting recent versions of Asterisk 1.4 and 1.6 branches. The full Advisory can be read directly from the Asterisk Project Security Advisory: Description: When configured with pedantic=yes the &#8230; <a href="http://www.teamforrest.com/blog/108/asterisk-security-advisory-ast-2009-002/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.digium.com">Digium</a> announced today a Remote Crash Vulnerability in the SIP Channel Driver affecting recent versions of <a href="http://www.asterisk.org">Asterisk</a> 1.4 and 1.6 branches. The full Advisory can be read directly from the <a href="http://downloads.digium.com/pub/security/AST-2009-002.html">Asterisk Project Security Advisory</a>:</p>
<blockquote><p><strong>Description</strong>: When configured with pedantic=yes the SIP channel driver performs extra request URI checking on an INVITE received as a result of a SIP spiral. As part of this extra checking the headers from the outgoing SIP INVITE sent and the received SIP INVITE are compared. The code incorrectly assumes that the string for each header passed in will be non-NULL in all cases. This is incorrect because if no headers are present the value passed in will be NULL.</p>
<p>The values passed into the code are now checked to be non-NULL before being compared.</p>
<p><strong>Resolution</strong>: Upgrade to revision 174082 of the 1.4 branch, 174085 of the 1.6.0 branch, 174086 of the 1.6.1 branch, or one of the releases noted below.</p>
<p>The pedantic option in the SIP channel driver can also be turned off to prevent this issue from occurring.</p>
<p><strong>Affected Versions</strong></p>
<p>1.4.x (Versions 1.4.22, 1.4.23, 1.4.23.1)<br />
1.6.0.x (All versions prior to 1.6.0.6)<br />
1.6.1.x (All versions prior to 1.6.1.0-rc2)<br />
C.x.x (Only version C.2.3)</p></blockquote>
<p>If you need assistance in updating or reviewing your Asterisk installation, please <a href="http://www.teamforrest.com/contact">contact Team Forrest</a> today.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/108/asterisk-security-advisory-ast-2009-002/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using AGI to get Caller ID Name CNAM</title>
		<link>http://www.teamforrest.com/blog/89/using-agi-to-get-caller-id-name-cnam/</link>
		<comments>http://www.teamforrest.com/blog/89/using-agi-to-get-caller-id-name-cnam/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 19:13:53 +0000</pubDate>
		<dc:creator>Fred Posner</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[AGI]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[CNAM]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=89</guid>
		<description><![CDATA[Everyone has them — and here&#8217;s Team Forrest&#8217;s version of a Caller ID to Name (CNAM, CIDNAME, etc.) lookup using AnyWho, Google, and 411.com. The first file is the calleridname.pl: UPDATE April 4, 2009 — Frank (user comment) let us &#8230; <a href="http://www.teamforrest.com/blog/89/using-agi-to-get-caller-id-name-cnam/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Everyone has them — and here&#8217;s Team Forrest&#8217;s version of a Caller ID to Name (CNAM, CIDNAME, etc.) lookup using AnyWho, Google, and 411.com. The first file is the <a title="Download CallerIDName.zip" href="http://www.teamforrest.com/tf-downloads/calleridname.zip">calleridname.pl</a>: <span id="more-89"></span></p>
<p class="alert"><strong>UPDATE April 4, 2009 —</strong> Frank (user comment) let us know that AnyWho had changed their website. As a result the code has been updated. Thanks Frank!</p>
<p class="alert"><strong>UPDATE November 18, 2009 —</strong> Robert (user comment) let us know of another change. As a result the code has been updated. Thanks Robert!</p>
<pre>#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
$|=1;

my ($cidnum,$cidname,$npa,$nxx,$station,$name);

#----------------------------------------------------------------
# get asterisk initial info
#----------------------------------------------------------------

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

#----------------------------------------------------------------
# check if we have a caller id
#----------------------------------------------------------------

if ($ARGV[0]) {
		$cidnum = $ARGV[0];
	} else {
		print qq(VERBOSE &quot;ERROR: no callerid provided&quot; 2\n);
		exit(0);
}

#----------------------------------------------------------------
# check caller id and split into npa, nxx, and station
#----------------------------------------------------------------

if(substr($cidnum,0,1) eq '1'){
	$cidnum=substr($cidnum,1);
}

if(substr($cidnum,0,2) eq '+1'){
	$cidnum=substr($cidnum,2);
}

if ($cidnum =~ /^(\d{3})(\d{3})(\d{4})$/) {
		$npa = $1;
		$nxx = $2;
		$station = $3;
	} elsif ($cidnum =~/\&lt;(\d{3})(\d{3})(\d{4})\&gt;/) {
		$npa = $1;
		$nxx = $2;
		$station = $3;
	} else {
		print qq(VERBOSE &quot;ERROR: unable to parse caller id&quot; 2\n);
		exit(0);
}

print qq(VERBOSE &quot;STATUS: CID is $npa-$nxx-$station&quot; 2\n);

#----------------------------------------------------------------
# check npa, nxx, and station for cid name
# 1 = check. 0 = skip.
#----------------------------------------------------------------

my $AnyWho = '1' ;
my $Google = '1' ;
my $www411 = '1' ;

if ($AnyWho &gt; '0') {
		print qq(VERBOSE &quot;STATUS: checking AnyWho for name lookup&quot; 2\n);
		if ($name = &amp;anywho_lookup ($npa, $nxx, $station)) {
				$cidname = $name;
				print qq(SET VARIABLE CALLERID\(name\) &quot;$cidname&quot;\n);
				print qq(VERBOSE &quot;STATUS: AnyWho said name was $cidname &quot; 2\n);
				exit(0);
			} else {
				print qq(VERBOSE &quot;STATUS: unable to find name with AnyWho&quot; 2\n);
		}
	} else {
		print qq(VERBOSE &quot;STATUS: AnyWho lookup disabled&quot; 2\n);
}

if ($Google &gt; '0') {
		print qq(VERBOSE &quot;STATUS: checking Google for name lookup&quot; 2\n);
		if ($name = &amp;google_lookup ($npa, $nxx, $station)) {
				$cidname = $name;
				print qq(SET VARIABLE CALLERID\(name\) &quot;$cidname&quot;\n);
				print qq(VERBOSE &quot;STATUS: Google said name was $cidname &quot; 2\n);
				exit(0);
			} else {
				print qq(VERBOSE &quot;STATUS: unable to find name with Google&quot; 2\n);
		}
	} else {
		print qq(VERBOSE &quot;STATUS: Google lookup disabled&quot; 2\n);
}

if ($www411 &gt; '0') {
		print qq(VERBOSE &quot;STATUS: checking www411 for name lookup&quot; 2\n);
		if ($name = &amp;www411_lookup ($npa, $nxx, $station)) {
				$cidname = $name;
				print qq(SET VARIABLE CALLERID\(name\) &quot;$cidname&quot;\n);
				print qq(VERBOSE &quot;STATUS: www411 said name was $cidname &quot; 2\n);
				exit(0);
			} else {
				print qq(VERBOSE &quot;STATUS: unable to find name with www411&quot; 2\n);
		}
	} else {
		print qq(VERBOSE &quot;STATUS: www411 lookup disabled&quot; 2\n);
}

#----------------------------------------------------------------
# return results and exit
#----------------------------------------------------------------

print qq(SET VARIABLE CALLERID\(name\) &quot;$cidnum&quot;\n);
print qq(VERBOSE &quot;STATUS: Unknown name for $cidnum &quot; 2\n);
exit(0);

#----------------------------------------------------------------
# parse anywho
# http://whitepages.anywho.com/results.php?qnpa=$npa&amp;qnpanxx=$npa$nxx&amp;qnxx=$nxx&amp;qp=$nxx$station&amp;qstation=$station
# Find More Information for First Last&lt;/a&gt;
#----------------------------------------------------------------

sub anywho_lookup {
	my ($npa, $nxx, $station) = @_;
	my $ua = LWP::UserAgent-&gt;new( timeout =&gt; 45);
	my $URL = 'http://whitepages.anywho.com/results.php';
	$URL .= qq(?qnpa=$npa&amp;qnpanxx=$npa$nxx&amp;qnxx=$nxx&amp;qp=$nxx$station&amp;qstation=$station);
	$ua-&gt;agent('AsteriskAGIQuery/1');
	my $req = new HTTP::Request GET =&gt; $URL;
	my $res = $ua-&gt;request($req);
	if ($res-&gt;is_success()) {
		if ($res-&gt;content =~ /Find More Information for (.*)&lt;\/a&gt;/) {
			my $clidname = $1;
			return $clidname;
		}
	}
	return &quot;&quot;;
}

#----------------------------------------------------------------
# parse google
# http://www.google.com/search?rls=en&amp;q=phonebook:$npa$nxx$station
# &lt;td&gt;First Name&lt;td&gt;(&lt;b&gt;$npa
#----------------------------------------------------------------

sub google_lookup {
	my ($npa, $nxx, $station) = @_;
	my $ua = LWP::UserAgent-&gt;new( timeout =&gt; 45);
	my $URL = qq(http://www.google.com/search?rls=en&amp;q=phonebook:$npa$nxx$station&amp;ie=UTF-8&amp;oe=UTF-8);
	$ua-&gt;agent('AsteriskAGIQuery/1');
	my $req = new HTTP::Request GET =&gt; $URL;
	my $res = $ua-&gt;request($req);
	if ($res-&gt;is_success()) {
		if ($res-&gt;content =~ /&lt;td&gt;(.+)&lt;td&gt;\(&lt;b&gt;$npa/) {
			my $clidname = $1;
			return $clidname;
		}
	}
	return &quot;&quot;;
}

#----------------------------------------------------------------
# parse 411
# http://www.411.com/search/Reverse_Phone?phone=$npa$nxx$station
# View map, driving directions, and more&quot;&gt;Name&lt;/a&gt;
#----------------------------------------------------------------

sub www411_lookup {
	my ($npa, $nxx, $station) = @_;
	my $ua = LWP::UserAgent-&gt;new( timeout =&gt; 45);
	my $URL = qq(http://www.411.com/search/Reverse_Phone?phone=$npa$nxx$station);
	$ua-&gt;agent('AsteriskAGIQuery/1');
	my $req = new HTTP::Request GET =&gt; $URL;
	my $res = $ua-&gt;request($req);
	if ($res-&gt;is_success()) {
		if ($res-&gt;content =~ /View map, driving directions, and more\&quot;&gt;(.*)&lt;\/a&gt;/) {
			my $clidname = $1;
			if ($clidname eq &quot;Listing Detail&quot;) {
				if ($res-&gt;content =~ /Type: &lt;strong&gt;(.*)&lt;\/strong&gt;/) {
					$clidname = $1;
					if ($res-&gt;content =~ /Location: &lt;strong&gt;(.*)&lt;\/strong&gt;/) {
						$clidname = $clidname . &quot; $1&quot;;
					}
				}
			}
			return $clidname;
		}
	}
	return &quot;&quot;;
}
</pre>
<p>This perl script will work well as an AGI script — checking AnyWho, Google, and then 411 for a caller&#8217;s name or location. If all else fails, the callerid name is set as the callerid number.</p>
<p>The perl script was designed to only use the Internet with minimal installation; so it will work without a database, Perl Asterisk module, or locally hosted NPA / NXX (phone number to region) file.</p>
<p>Team Forrest recommends using a subroutine context to get the callerid when needed; calling the script with either a <strong>GoSub</strong> or <strong>GosubIf</strong> command, such as:</p>
<pre>exten =&gt; s,n,Gosub(cidname-lookup,s,1)
exten =&gt; s,n,dial(${PHONE},30,t)
...

...
[cidname-lookup]
exten =&gt; s,1,NoOp(looking up callerid name)
exten =&gt; s,n,GotoIf($["foo${CALLERID(NAME)}" = "foo" ]?getname)
exten =&gt; s,n,GotoIf($["${CALLERID(NAME)}" = "${CALLERID(NUM)}" ]?getname)
exten =&gt; s,n,NoOp(caller id name exists as ${CALLERID(NAME)})
exten =&gt; s,n,Return
exten =&gt; s,n(getname),AGI(calleridname.pl,${CALLERID(NUM)})
exten =&gt; s,n,NoOp(Caller ID Name is now ${CALLERID(NAME)})
exten =&gt; s,n,Return</pre>
<p>Enjoy the file (<a title="Download the script" href="http://www.teamforrest.com/tf-downloads/calleridname.zip">download here</a>) and remember, Team Forrest is here to assist you will all of your Asterisk, VoIP, or technical needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/89/using-agi-to-get-caller-id-name-cnam/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>VoIP Users Conference via SIP</title>
		<link>http://www.teamforrest.com/blog/33/voip-users-conference-via-sip/</link>
		<comments>http://www.teamforrest.com/blog/33/voip-users-conference-via-sip/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 19:29:49 +0000</pubDate>
		<dc:creator>Fred Posner</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[HD Voice]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=33</guid>
		<description><![CDATA[UPDATE — Got HD? You can now connect to the VoIP Users Conference in HD Quality thanks to ZiPDX The VoIP Users Conference gathers weekly on Fridays to discuss all things VoIP. Free, and open to the public, participants can &#8230; <a href="http://www.teamforrest.com/blog/33/voip-users-conference-via-sip/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="note"><strong>UPDATE —</strong> Got HD? You can now connect to the VoIP Users Conference in HD Quality thanks to <a href="http://www.zipdx.com">ZiPDX</a></p>
<p>The VoIP Users Conference gathers weekly on Fridays to discuss all things VoIP. Free, and open to the public, participants can listen live or download archived recordings.</p>
<p>There are three main ways to access the live conference:</p>
<ol>
<li>via SIP directly</li>
<li>via HiDef SIP directly</li>
<li>via PSTN (<em><strong>see below for the number</strong></em>)</li>
<li>via the <a href="http://www.talkshoe.com/talkshoe/web/userCreate1.jsp?pushNav=1">Talkshoe</a> client</li>
</ol>
<h2>VoIP Users Conference via SIP</h2>
<p>Recently, several participants experienced difficulties in connecting to the conference using SIP. The issue dealt with DTMF recognition and prevented the participant from entering the conference number and pin.</p>
<p>Thanks to the power of SIP, this problem can be circumvented using a SIP Header. Adding the SIP Header of <em>Subject: &lt;passcode&gt;22622&lt;/passcode&gt;&lt;pin&gt;YOURPIN&lt;/pin&gt;</em> will bypass the DTMF needs and enter you into the conference automatically.</p>
<p>Using <a href="http://www.asterisk.org">Asterisk</a>, a SIP Header can easily be added to your dialplan. For example, if you wanted to dial *10 to reach the VoIP Users Conference, you would modify your extensions.conf to contain something like:</p>
<pre>exten =&gt; *10,1,NoOp(VoIP Users Conference Fridays at 12pm EST. Replace YOURPIN with your talkshoe pin)
exten =&gt; *10,n,SIPAddHeader(Subject: &lt;passcode&gt;22622&lt;/passcode&gt;&lt;pin&gt;YOURPIN&lt;/pin&gt;)
exten =&gt; *10,n,Dial(<strong>SIP/talkshoe@vuc.onsip.com</strong>)</pre>
<h2>VoIP Users Conference via Hi Def SIP</h2>
<p>If you have an HD Voice / Wideband capable phone, you can connect directly to the conference using g722 at the following SIP URI:</p>
<ul>
<li>sip:200901@login.zipdx.com</li>
</ul>
<p>So, in Asterisk&#8217;s extensions.conf, it may look something like this:</p>
<pre>exten =&gt; *11,1,NoOp(VoIP Users Conference Fridays at 12pm EST. g722 connection)
exten =&gt; *11,n,Dial(<strong>SIP/200901@login.zipdx.com</strong>)</pre>
<p class="alert"><strong>REMEMBER!</strong> To use the wideband (g722) bridge, you need a wideband capable phone.</p>
<h2>PSTN, Talkshoe, and Web</h2>
<p>The VoIP Users Conference meets every Friday at 12pm Eastern Standard Time. More information can be found by following these links:</p>
<ul>
<li><a href="http://voipusersconference.org/">VoIP Users Conference</a></li>
<li><a href="http://www.talkshoe.com/talkshoe/web/talkCast.jsp?masterId=22622">Talkshoe</a></li>
<li>PSTN &#8211;&gt; Dial (724) 444-7444 and enter 22622# 1#</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/33/voip-users-conference-via-sip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk Dial Plan Basics</title>
		<link>http://www.teamforrest.com/blog/22/asterisk-dial-plan-basics/</link>
		<comments>http://www.teamforrest.com/blog/22/asterisk-dial-plan-basics/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 17:45:59 +0000</pubDate>
		<dc:creator>Fred Posner</dc:creator>
				<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[polycom]]></category>
		<category><![CDATA[SIP]]></category>

		<guid isPermaLink="false">http://www.teamforrest.com/?p=22</guid>
		<description><![CDATA[VoIP Insider has a great little article about basic dialplan building with Asterisk. It&#8217;s worth a read if Asterisk, VoIP, or PBX with Asterisk is on your mind. VoIP Insider is a blog from VoIP Supply.  VoIP Supply carries a &#8230; <a href="http://www.teamforrest.com/blog/22/asterisk-dial-plan-basics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>VoIP Insider has a great little article about <a href="http://blog.voipsupply.com/asterisk-news/asterisk-dial-plan-basics">basic dialplan building with Asterisk</a>. It&#8217;s worth a read if Asterisk, VoIP, or PBX with Asterisk is on your mind.</p>
<p>VoIP Insider is a blog from <a href="http://www.voipsupply.com/">VoIP Supply</a>.  VoIP Supply carries a variety of VoIP hardware, including Polycom SIP phones, Asterisk hardware, and pretty much any VoIP capable phone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.teamforrest.com/blog/22/asterisk-dial-plan-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

