Thursday, October 02, 2008

Asterisk and Sneaky Plans

I want to make a small company which does customised installations of Jabber servers, and possibly Asterisk for small business - say, 30 or more people in the company.

Step one: Make me an RSS feed jabber bot, and viola: you have a recipe for a really slick communication tool integrated with existing other tools.

Some example scenarios:
Asterisk and a jabber bot watch people's status: if you are out to lunch according to pidgin (or your jabber client), route the calls intelligently to the next available person.

You could build service specific jabber bots / agents to do tasks coupled with another system - for instance, you could use it to ask "what price is a (barcode)" or "call Steve mobile" (asterisk locates the Steve you want and starts dialling, or perhaps finds the number from your CRM system).

More neatly, if you had, say, a stock level monitoring system or something else which could put out RSS, the Jabber bot could inform you "We are low on X".

Applications to target first:
* A Jabber bot that provides a neat interface to the assorted Google Data feeds (email, calendar)
* A Jabber bot that deals with RSS

... and then, you can start doing all sorts of neat things with inhouse systems - ie, SugarCRM or others.

Update
That was stupidly easy. See Interacting with Google Calender via Google Talk

1) Get XMPPHP
2) Do this:

<?php
require_once dirname(__FILE__) . '/external/xmpphp/XMPPHP/XMPP.php';
require_once dirname(__FILE__) . '/external/xmpphp/XMPPHP/Log.php';


$user = 'you@gmail.com';
$pass = 'password';
$url = dirname(__FILE__) . '/atom.xml';

// Or load from config
include 'config.php';


// And now the start

$feed = simplexml_load_file($url);
$feed->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');

$entries = $feed->xpath('//atom:entry');

if (empty($entries)) {
die();
}

$conn = new XMPPHP_XMPP('talk.google.com', 5222, $user, $pass, 'xmpphp', 'gmail.com', $printlog=true, $loglevel=LOGGING_INFO);
$conn->connect();
$conn->processUntil('session_start');
$conn->message($user, "New entries: " . count($entries));

$entries = $feed->xpath('//atom:entry');
foreach ($entries as $entry) {
$conn->message($user, (string)$entry->title . " by " . (string)$entry->author->name);
}
$conn->disconnect();

3) Set up a cron job or similar to message you every few hours. Viola.

No comments: