<?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>The McKenzie&#039;s Blog... &#187; PBX</title>
	<atom:link href="http://www.uk-experience.com/category/technology/pbx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.uk-experience.com</link>
	<description>Our life in the UK...</description>
	<lastBuildDate>Fri, 23 Jul 2010 20:57:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Asterisk + Twitter = Call Monitor</title>
		<link>http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/</link>
		<comments>http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 10:01:16 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PBX]]></category>
		<category><![CDATA[Phones]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/</guid>
		<description><![CDATA[Why? Why not. I was wondering how else I could make use of Twitter for other things I thought &#8220;How could I use twitter with my Asterisk PABX?&#8221; Doing some Google searching showed I wasn&#8217;t the first to think of this (as if that would have happened). There are a few people doing various things [...]]]></description>
			<content:encoded><![CDATA[<p>Why? Why not. I was wondering how else I could make use of <a href="http://www.twitter.com/m1xzg" target="_blank">Twitter</a> for other things I thought &#8220;How could I use twitter with my <a href="http://www.asterisk.org" target="_blank">Asterisk PABX</a>?&#8221; Doing some Google searching showed I wasn&#8217;t the first to think of this (as if that would have happened). There are a few people doing various things with asterisk and twitter.</p>
<p>I didn&#8217;t really like much of what I found, or found it wasn&#8217;t really what I wanted to do with it .. so I decided to use some of that info and came up with something of my own.</p>
<p>The short story is this. When someone calls my Canadian number, my US Toll-Free number any number that ultimately rings the group of phones in the house, I will now get a direct message in <a href="http://www.twitter.com/m1xzg" target="_blank">Twitter</a> from a special account I setup for this purpose, which also sends a SMS to my phone (device notifications in twitter).</p>
<p>Read more by clicking below&#8230; Be warned! Thar be scripts and technical stuff in them thar parts</p>
<p><span id="more-266"></span><br />
Ok, so lets see what&#8217;s under the bonnet of this beast now.
</p>
<p>First, you&#8217;ll need an AGI script. Look, here&#8217;s one I prepared earlier &#8211; <strong>twitter.agi</strong></p>
<pre style="width: 85.55%; height: 106px">#!/bin/bash
# Background the curl process incase twitter doesn't respond. It will hang the dialplan.
curl -u username:PASSWORD -d text="$1" \
-d user="recipient" \
http://twitter.com/direct_messages/new.xml &amp;</pre>
<p>Put the script in /var/lib/asterisk/agi-bin. Don&#8217;t forget to chmod +x the script as well.</p>
<p>Pretty simple eh? The only things you&#8217;ll have to change in the script are</p>
<ul>
<li><strong>username</strong> = your twitter login name
</li>
<li><strong>PASSWORD</strong> = your twitter password
</li>
<li><strong>recipient</strong> = Who will get your direct message </li>
</ul>
<p>Ok, and to make it work in Asterisk I put this in the extensions.conf file for the exten that I wanted to monitor:</p>
<pre style="width: 97.76%; height: 89px">[home_phone]
exten =&gt; s,1,NoOp("This is my home phone context")
exten =&gt; s,n,Set(_DIDNUM="PUT YOUR DID NUM HERE")
exten =&gt; s,n,LookupCIDName
exten =&gt; s,n,AGI(twitter.agi|PBX: ${CALLERID(all)} just called on ${EXTEN})</pre>
<p>I&#8217;ve only shown the first bits of this context, after this is your normal context such as DIAL or whatever else you might now. I actually build in a few seconds of delay to allow the text message a chance to get to my phone before the phone rings. A sort of early warning system <img src='http://www.uk-experience.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The only thing here you need to change really is the value of <strong>_DIDNUM</strong> (notice the underscore in front of the var name, this isn&#8217;t strictly needed, but if you wish to use that variable else where in the context or exten it&#8217;s a good idea. Obviously you can change the message after the &#8220;pipe&#8221; in the AGI line to customize the message you are sent.</p>
<p>The one thing I have left to work out is what asterisk variable to use to actually get the DID number used to call into the PBX with. If I can get that that would make this so much easier and more flexible. If you know what that is please drop me a comment.</p>
<p>Well, that&#8217;s really about it. It&#8217;s not rocket science by any means, heck, it&#8217;s nothing at all but it works.</p>
<p><span class="sbmLink"></p>
<table cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td class="sbmText">Share this post : </td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to backflip" onmouseout="mOut(this)" href="http://www.backflip.com/add_page_pop.ihtml?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/backflip4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to blinkbits!" onmouseout="mOut(this)" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;source_url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to blogmemes" onmouseout="mOut(this)" href="http://www.blogmemes.net/post.php?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blogmemes4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to buddymark" onmouseout="mOut(this)" href="http://buddymarks.com/s_add_bookmark.php?bookmark_url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;bookmark_title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/buddymar4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to complore" onmouseout="mOut(this)" href="http://complore.com?q=node/add/flexinode-5&amp;url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/complore4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to del.icio.us" onmouseout="mOut(this)" href="http://del.icio.us/post?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to del.iri.ous!" onmouseout="mOut(this)" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;address=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to digg" onmouseout="mOut(this)" href="http://digg.com/submit?phase=2&amp;url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to dotnetkicks" onmouseout="mOut(this)" href="http://www.dotnetkicks.com/kick/?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to furl" onmouseout="mOut(this)" href="http://www.furl.net/store?s=f&amp;to=0&amp;u=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;ti=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to live" onmouseout="mOut(this)" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to magnolia!" onmouseout="mOut(this)" href="http://ma.gnolia.com/bookmarklet/add?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/magnolia4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to netvouz!" onmouseout="mOut(this)" href="http://netvouz.com/action/submitBookmark?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/netvouz4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to reddit!" onmouseout="mOut(this)" href="http://reddit.com/submit?url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to shadow" onmouseout="mOut(this)" href="http://www.shadows.com/bookmark/saveLink.rails?page=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/shadows6.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to spurl" onmouseout="mOut(this)" href="http://www.spurl.net/spurl.php?v=3&amp;url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to technorati!" onmouseout="mOut(this)" href="http://technorati.com/faves/?add=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to wists" onmouseout="mOut(this)" href="http://www.wists.com/?action=add&amp;url=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;title=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/wists9.png" border="0"/></a>
</td>
<td class="sbmDim" onmouseover="mOvr(this)" onmouseout="mOut(this)"><a class="sbmDim" onmouseover="mOvr(this)" title="Post it to yahoo!" onmouseout="mOut(this)" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/&amp;t=Asterisk + Twitter = Call Monitor" target="_blank"><img src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png" border="0"/></a></td>
</tr>
</tbody>
</table>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uk-experience.com/2008/06/13/asterisk-twitter-call-monitor/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
