<?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>mark.bockenstedt.net &#187; XMPP</title>
	<atom:link href="http://mark.bockenstedt.net/tag/xmpp/feed/" rel="self" type="application/rss+xml" />
	<link>http://mark.bockenstedt.net</link>
	<description>Tech Tips, How-To's, and Miscellaneous Geekery</description>
	<lastBuildDate>Tue, 19 May 2009 03:05:39 +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>Laconica, XMPP, SMS, Oh My!</title>
		<link>http://mark.bockenstedt.net/2008/09/22/laconica-xmpp-sms-oh-my/</link>
		<comments>http://mark.bockenstedt.net/2008/09/22/laconica-xmpp-sms-oh-my/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 15:15:00 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Laconica]]></category>
		<category><![CDATA[SMS]]></category>
		<category><![CDATA[XMPP]]></category>

		<guid isPermaLink="false">http://mark.bockenstedt.net/?p=399</guid>
		<description><![CDATA[Last Monday&#8217;s post was a bunch of directions on how to install Laconica on your own server. What the directions failed to mention was how to set up the good stuff &#8211; XMPP, SMS, and posting via email. Today I&#8217;ll go over how to get XMPP and SMS running. SMS Populate carriers table If you [...]]]></description>
			<content:encoded><![CDATA[<p>Last Monday&#8217;s post was a bunch of directions on <a href="http://mark.bockenstedt.net/2008/09/15/how-to-install-laconica/">how to install Laconica</a> on your own server. What the directions failed to mention was how to set up the good stuff &#8211; XMPP, SMS, and posting via email. Today I&#8217;ll go over how to get XMPP and SMS running.</p>
<h3>SMS</h3>
<p><strong>Populate carriers table</strong></p>
<p>If you look in the db folder, you&#8217;ll find a file called carrier.sql. If you run that against the laconica database you created for the install, all the providers in the file (58 in all) will be available to select in the SMS tab of your instance. I actually reduce the number to 16 because most of them are international services.</p>
<p>How SMS works is the Laconica server will fire off an email to your carrier&#8217;s gateway, which then should be delivered as an SMS. Not all carriers play well with this (I&#8217;m looking at you, US Cellular) so your mileage may vary in terms of results. I&#8217;ve already got a confirmation that AT&amp;T works.</p>
<p>If carriers are missing from the table and you know the carrier&#8217;s gateway, it&#8217;s really easy to add them to the options. Simply create a new record in the sms_carrier table and fill in the name and email pattern.</p>
<p><strong>Try it out</strong></p>
<p>Head to the Settings -&gt; SMS tab of your instance, enter your phone number, select your carrier, and hit the Add button. You should receive an SMS with a confirmation code, which you&#8217;ll have to enter in the new box that appears. Once you do that, your phone should be prime for receiving SMS to your phone.</p>
<p><strong>SMS is one-way</strong></p>
<p>What I mean by that is you can only receive notifications through SMS &#8211; you can&#8217;t post updates to the service (yet). This simplifies matters because admins won&#8217;t have to worry about setting up all the SMS inbound boxes and all that. For now, this will work.</p>
<h3>XMPP</h3>
<p>This is where things get ugly. If you&#8217;ve already got a Jabber/XMPP server, you&#8217;re golden. If not&#8230; get one.</p>
<p><strong>Configuration</strong></p>
<p><em>If you already have an XMPP server, you can do this now. Otherwise, install one and come back to this.</em></p>
<p>Head back to the trusty config.php file and scroll down to the XMPP section and you&#8217;ll find a plethora of options regarding XMPP. If you have a server, fill in the appropriate values and you should be good to go.</p>
<p><strong>Choosing a Server<br />
</strong></p>
<p>You can probably use whatever server you want to for this, provided it does the job. I chose to use Openfire, a bloated Java server. Frankly, I had no reasons behind the choice other than it worked after some configuration. All directions henceforth will be specific to Openfire.</p>
<p><strong>Installation</strong></p>
<p>Before I jump into the juicy details, bookmark the <a href="http://www.igniterealtime.org/projects/openfire/documentation.jsp" target="_blank">Openfire Documentation</a> page. It will become your best friend.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sun-java6-bin sun-java6-jre sun-java6-jdk
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.igniterealtime.org<span style="color: #000000; font-weight: bold;">/</span>downloadServlet?<span style="color: #007800;">filename</span>=openfire<span style="color: #000000; font-weight: bold;">/</span>openfire_3_6_0a.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzvf</span> downloadServlet?<span style="color: #007800;">filename</span>=openfire<span style="color: #000000; font-weight: bold;">/</span>openfire_3_6_0a.tar.gz</pre></div></div>

<p>The next step is to set up the database. I&#8217;m going to assume you&#8217;re using MySQL, but you can use any of the following: DB2, HSQLDB, MySQL, Oracle, PostgreSQL, SQLServer, or SyBase. I&#8217;ll also assume you&#8217;ve created a database to hold Openfire info (database named openfire).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>openfire<span style="color: #000000; font-weight: bold;">/</span>resources<span style="color: #000000; font-weight: bold;">/</span>database
mysql <span style="color: #660033;">-u</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>db_user<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #660033;">-p</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>db_pass<span style="color: #7a0874; font-weight: bold;">&#93;</span> openfire <span style="color: #000000; font-weight: bold;">&amp;</span>lt; openfire_mysql.sql</pre></div></div>

<p><strong>Start Server</strong></p>
<p>Now it&#8217;s time to kick this bad boy off and see if it works:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>openfire
.<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>openfire start</pre></div></div>

<p>If it complains of not being able to find a JVM, try doing this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--config</span> java</pre></div></div>

<p>and select a different JVM. The JVM installed from above is at <code>/usr/lib/jvm/java-6-sun/jre/bin/java</code> so that&#8217;s what I selected. I have no idea if that impacts the rest of the system at all.<br />
OK, so now your server should be running. Time to set it up.</p>
<p><strong>Setup</strong></p>
<p>If you were able to run the server without incident, point your browser to port 9090 on the server you installed Openfire on. Follow the on-screen prompts. I screwed the pooch and didn&#8217;t take screenshots of the process.</p>
<p><strong>Create an update user</strong></p>
<p>Go into the Users/Groups page in your Openfire Admin Console (OAC) and create a new user and give it a password. I named my user update, but the name is arbitrary.</p>
<p><strong>Update the Laconica config</strong></p>
<p>If you&#8217;re just installing an XMPP server, you need to make sure to tell Laconica about your new Openfire user. Here&#8217;s what my XMPP config looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'enabled'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'bockenstedt.net'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'server'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'bockenstedt.net'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'port'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5222</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'update'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'encryption'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resource'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'xmpphp'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xmpp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'public'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'imbuddy@bockenstedt.net'</span><span style="color: #339933;">;</span></pre></div></div>

<p>Simply change the above fields where appropriate and Laconica should be informed about your XMPP buddy. I dont&#8217; know what the last line is for, so if anyone can clue me in, please do via a comment or email. If you look now, your update user should be offline in the OAC.</p>
<p><strong>Unleash the daemons</strong></p>
<p>This is the step that tripped me up. In the scripts directory there are a number of handlers and daemons that need to be running in order for everything to work properly. There&#8217;s also a handy little shell script that executes all the necessary daemons. You can run all the daemons at once by typing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>startdaemons.sh</pre></div></div>

<p>For some reason, I got errors when the script tried to open the files so I just started the daemons manually.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php xmppdaemon.php
php jabberqueuehandler.php
php publicqueuehandler.php
php xmppconfirmhandler.php
php smsqueuehandler.php
php ombqueuehandler.php</pre></div></div>

<p>That should do it for getting the daemons running. If you look in your OAC again, your update user should be online.</p>
<p><strong>Open ports</strong></p>
<p>The final step is to open a few ports to outside access so users can communicate with your XMPP server. You need to open 5222, 5223, and 5296 for traffic to flow properly. If you&#8217;re going to need OAC access outside of your firewall, you have to open port 9090.</p>
<p><strong>Caveats</strong></p>
<p>Using the above methods, I was able to connect my Gmail account with the XMPP server and send updates successfully. However, another user who is using an afilliate Google account (ie john@doe.com signed up through Gmail) was unable to connect to the server.</p>
<h3  class="related_post_title"><h2>Related Posts</h2></h3><ul class="related_post"><li><a href="http://mark.bockenstedt.net/2008/11/05/backup-your-gmail-with-gmail-backup/" title="Backup Your Gmail With&#8230; Gmail Backup">Backup Your Gmail With&#8230; Gmail Backup</a></li><li><a href="http://mark.bockenstedt.net/2008/11/04/how-to-use-gmail-as-an-email-backup-service/" title="How To Use Gmail as an Email Backup Service">How To Use Gmail as an Email Backup Service</a></li><li><a href="http://mark.bockenstedt.net/2008/09/15/how-to-install-laconica/" title="How To Install Laconica">How To Install Laconica</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://mark.bockenstedt.net/2008/09/22/laconica-xmpp-sms-oh-my/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
