<?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>Tommy Bottens blog</title>
	<atom:link href="http://www.evilspurv.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evilspurv.net/blog</link>
	<description></description>
	<lastBuildDate>Sat, 27 Feb 2010 09:59:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ari &#8211; asterisk rickroll improved.</title>
		<link>http://www.evilspurv.net/blog/2010/02/ari-asterisk-rickroll-improved/</link>
		<comments>http://www.evilspurv.net/blog/2010/02/ari-asterisk-rickroll-improved/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 14:04:33 +0000</pubDate>
		<dc:creator>Tommy</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Useless]]></category>

		<guid isPermaLink="false">http://www.evilspurv.net/blog/?p=68</guid>
		<description><![CDATA[Since I do a bit of asterisk, I found the asterisk rickroll (http://unf.net/2009/12/asterisk-rick-roll.php) very funny. However, I did not like the way it was implemented. I came up with this solution while rewriting our dialplan in Lua.]]></description>
			<content:encoded><![CDATA[<p>Even though the idea is brilliant, I did not like the way <a href="http://unf.net/2009/12/asterisk-rick-roll.php" target="_blank">the original</a> was implemented. I came up with this solution while rewriting our company&#8217;s dialplan in Lua.</p>
<p>So naturally, you will need the pbx_lua interpreter. You also need the music by Rick Astley himself. A preformated .gsm file can be found <a href="http://nordix.evilspurv.net/free/rick.gsm" target="_self">here</a>. I use pbx_spool for .call files.</p>
<p><strong>extensions.lua:</strong></p>
<pre>function rickroll()
 app.answer()
 app.background("rick")
 sleep(math.random(180))
 file = io.open("/var/spool/asterisk/outgoing/rickroll" .. math.random(9999) .. ".call","w")
 file:write("Channel: SIP/" .. channel.CALLERID("num"):get() .."\nApplication: PlayBack\nData: rick\n")
 file:close()
end</pre>
<p>And then just assign it to some context:</p>
<pre>extensions = {
 some_context = {
 ["_X."] = rickroll;
 };</pre>
<p>So what does it do? It plays Rick Astleys &#8220;Never gonna let you down&#8221;. And then it waits random amount of seconds (0-180) before it calls back &#8211; and does the rickroll all over again. Thanks to Andy Goodwin for the inspiration, and Calle for the heads up.</p>
<p><strong>Caveats:</strong></p>
<ul>
<li>It does not check the caller ID. Call will be returned no matter what.</li>
<li>It uses random, not unique values for call-files. Possible race condition.</li>
<li>You can always use channel["CALLERID(num)"]:set(&#8220;value&#8221;) to change the callerid.</li>
</ul>
<p>But as an added bonus, it seems to work with most voicemails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evilspurv.net/blog/2010/02/ari-asterisk-rickroll-improved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://nordix.evilspurv.net/free/rick.gsm" length="355641" type="audio/x-gsm" />
		</item>
		<item>
		<title>Sending pdfs as fax with Asterisk.</title>
		<link>http://www.evilspurv.net/blog/2010/01/sending-pdfs-as-fax-with-asterisk/</link>
		<comments>http://www.evilspurv.net/blog/2010/01/sending-pdfs-as-fax-with-asterisk/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 08:41:30 +0000</pubDate>
		<dc:creator>Tommy</dc:creator>
				<category><![CDATA[Asterisk]]></category>

		<guid isPermaLink="false">http://www.evilspurv.net/blog/?p=60</guid>
		<description><![CDATA[There has been some confusion about how to send a fax from asterisk. This is a quick howto.
]]></description>
			<content:encoded><![CDATA[<p>To send a fax using asterisks send_fax you obviously need the app_fax loaded. It can only be compiled into source if you have spandsp libraries available.</p>
<p>An easy way of sending faxes is to use .call files. These files are flat text YAML-like files which tells asterisk to execute a call. It can be used for many purposes, but is most commonly used for callbacks and faxes. In our case, the following example will do:</p>
<pre>Channel: SIP/sip_out/87654321
CallerID: 12345678
Application: SendFAX
Data: /tmp/faxtest.tiff
SetVar: T38CALL=0</pre>
<p>Name this file something.call and place it in our asterisk spool directory, defaults to /var/spool/asterisk/outgoing/</p>
<p>The script that generates the file must specify the destination number at the end of &#8216;Channel&#8217;, and wherever the .tiff fax is located. To convert from .pdf to .tiff, use you can use ghostscript (gs):</p>
<pre>/usr/bin/gs -q -SDEVICE=tiffg4 -r203x98 -sPAPERSIZE=letter \
-sOutputFile=/somedir/send.tiff -dNOPAUSE -dBATCH -- /somedir/somepdf</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.evilspurv.net/blog/2010/01/sending-pdfs-as-fax-with-asterisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do not disturb for Asterisk</title>
		<link>http://www.evilspurv.net/blog/2009/12/do-not-disturb-for-asterisk/</link>
		<comments>http://www.evilspurv.net/blog/2009/12/do-not-disturb-for-asterisk/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 12:20:05 +0000</pubDate>
		<dc:creator>Tommy</dc:creator>
				<category><![CDATA[Asterisk]]></category>

		<guid isPermaLink="false">http://www.evilspurv.net/blog/?p=21</guid>
		<description><![CDATA[It is a common misconception (for some reason) that *78 and *79 is default for enable and disable do not disturb. This has to be configured in your dialplan like everything else:
[dnd]
; Enable DnD
exten =&#62; *78,1,Set(DB(SIP/DND/${CALLERID(num)})=1)
exten =&#62; *78,n,Playback(beep)
; Disable DnD
exten =&#62; *79,1,NoOp(${DB_DELETE(SIP/DND/${CALLERID(num)})})
exten =&#62; *79,n,Playback(beep)
And then include in your dial macro/sub:
exten =&#62; s,5,Set(LOCAL(dnd)=${DB("SIP/DND"/${ext})})
exten =&#62; s,6,Gosubif($[${dnd}]?8:7)
exten =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>It is a common misconception (for some reason) that *78 and *79 is default for enable and disable do not disturb. This has to be configured in your dialplan like everything else:</p>
<pre>[dnd]
; Enable DnD
exten =&gt; *78,1,Set(DB(SIP/DND/${CALLERID(num)})=1)
exten =&gt; *78,n,Playback(beep)
; Disable DnD
exten =&gt; *79,1,NoOp(${DB_DELETE(SIP/DND/${CALLERID(num)})})
exten =&gt; *79,n,Playback(beep)</pre>
<p>And then include in your dial macro/sub:</p>
<pre>exten =&gt; s,5,Set(LOCAL(dnd)=${DB("SIP/DND"/${ext})})
exten =&gt; s,6,Gosubif($[${dnd}]?8:7)
exten =&gt; s,7,Dial(${dev},10)
exten =&gt; s,8,Gosub(somewhere,s,1(${ext}))</pre>
<p>Note that you don&#8217;t really need to answer and play the beep file. It&#8217;s just a matter of taste.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evilspurv.net/blog/2009/12/do-not-disturb-for-asterisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All things cat</title>
		<link>http://www.evilspurv.net/blog/2009/12/all-things-cat/</link>
		<comments>http://www.evilspurv.net/blog/2009/12/all-things-cat/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 11:58:58 +0000</pubDate>
		<dc:creator>Tommy</dc:creator>
				<category><![CDATA[General Linux/Unix]]></category>
		<category><![CDATA[Useless]]></category>

		<guid isPermaLink="false">http://www.evilspurv.net/blog/?p=10</guid>
		<description><![CDATA[All systems administrators are well familiar with the concatenation tool &#8216;cat&#8217;, and some also know of the variants such as &#8216;tac&#8217;, &#8217;supercat&#8217; and even the improved cat &#8211; &#8216;dog&#8217;. A few more or less useful listing of concatenation tools:
cat - the basic concatenation tool.
supercat - Introduces coloring and can be used for syntax highlighting.
tac - [...]]]></description>
			<content:encoded><![CDATA[<p>All systems administrators are well familiar with the concatenation tool &#8216;cat&#8217;, and some also know of the variants such as &#8216;tac&#8217;, &#8217;supercat&#8217; and even the improved cat &#8211; &#8216;dog&#8217;. A few more or less useful listing of concatenation tools:</p>
<pre><a title="cat" href="http://en.wikipedia.org/wiki/Cat_%28Unix%29" target="_blank">cat</a> - the basic concatenation tool.
<a title="supercat" href="http://www.linuxjournal.com/node/1005732" target="_blank">supercat</a> - Introduces coloring and can be used for syntax highlighting.
<a title="tac" href="http://en.wikipedia.org/wiki/Tac_%28Unix%29" target="_blank">tac</a> - reverse cat.
<a title="dog" href="http://www.digipedia.pl/man/doc/view/dog.1.html" target="_blank">dog</a> - improved cat. Can fetch the newspaper (http streams)
<a title="hungrycat" href="http://jwilk.net/software/hungrycat.html" target="_blank">hungrycat</a> - Removes bytes as it concatenates leaving the file empty once completed.
<a title="ncat" href="http://kyne.com.au/~mark/software/ncat.1.php" target="_blank">ncat</a> - Network cat. A versatile network utility.
<a title="irccat" href="http://sourceforge.net/projects/irccat/" target="_blank">irccat</a> - concatenates and displays file contents on a IRC channel
<a title="barcat" href="http://www.theiling.de/projects/bar.html">barcat</a> - Not really a concatenation tool. Produces progress bar in a *NIX shell.
<a title="cryptcat" href="http://sourceforge.net/projects/cryptcat/" target="_blank">cryptcat</a> - A lightweight encrypted variant of netcat.
<a title="safecat" href="http://www.jeenyus.net/linux/software/safecat.html" target="_blank">safecat</a> - A "safe" variant of cat which does return codes correctly.

<a title="socat" href="http://www.dest-unreach.org/socat/" target="_blank">socat</a> - Socket concatenation. A versatile utility handling sockets. Thanks to Christian Bryn.</pre>
<p>And then there&#8217;s zcat and bzcat for concatenating compressed files.</p>
<p>Note that &#8216;dog&#8217; also escapes binary  by default which can be nice when handling data in stdout, but will cause errors when concatenating binary files into files, sockets or alike. On the other hand, &#8216;cat&#8217; will not escape leaving the terminal exposed. This has been exploited in several situations where a systems administrator would concatenate a log file containing malicious requests. When concatenating this to stdout, depending on your terminal, code can be executed.</p>
<p>If anyone knows about any other &#8216;cat&#8217;-like tools, please tell me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evilspurv.net/blog/2009/12/all-things-cat/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
