Page Contents
The Jabber module in Asterisk is available starting from the 1.4 series. Therefore, you can connect
Asterisk as a client (or component) to your Jabber server after you've upgraded to 1.4.
PHP script for sending jabber messages
I wrote the following PHP script to send a message via the jabber IM service to inform about an incoming call.To get it running you need:
- PHP: http://www.php.net
- Pear: http://pear.php.net
- class.jabber.php: http://cjphp.netflint.net/
To use it in extensions.conf:
exten => s,1,AGI,jabber.php ; Notify via jabber
exten => s,n,Wait,30 ; Wait thirty second
exten => s,n,Answer ; Answer the line
Have fun,
-mat-
#!/usr/bin/php -q
<?php
//error_reporting(E_ALL);
ini_set('display_errors', 0 );
ini_set('include_path', '.:/usr/share/pear');
require_once('class.jabber.php');
ob_implicit_flush(true);
set_time_limit(0);
$err=fopen("php://stderr","w");
$in = fopen("php://stdin","r");
while (!feof($in)) {
$temp = str_replace("\n","",fgets($in,4096));
$s = split(":",$temp);
$agi[str_replace("agi_","",$s[0])] = trim($s[1]);
if (($temp == "") || ($temp == "\n")) {
break;
}
}
$JABBER = new Jabber;
$JABBER->server = 'jabber.de.cw.net';
$JABBER->port = 5222;
$JABBER->username = 'asterisk';
$JABBER->password = 'xxxx';
$JABBER->resource = 'ClassJabberPHP';
$JABBER->Connect() or die('Could not connect!');
$JABBER->SendAuth() or die('Could not authenticate!');
$JABBER->SendPresence(NULL,NULL,'online');
// $JABBER->SendMessage('xxx@jabber.de.cw.net', 'chat', NULL, array( 'body' => 'Call from '.$agi['callerid'].' on '.$agi['dnid'] ));
$JABBER->SendMessage('xxx@jabber.de.cw.net', 'chat', NULL, array( 'body' => 'Call from '.htmlspecialchars($agi['callerid']).' on '.$agi['dnid'] ));
$JABBER->Disconnect();
fclose($in);
fclose($err);
?>
app_jabber - jabber client as asterisk application
This asterisk application is a jabber client for use in the dialplan (extensions.conf). It supports multiple jabber accounts, SSL, message send and receive.sample extensions.conf:
exten => 8013,1,Set(jid=arbeitszimmer/bef@arbeitszimmer)
exten => 8013,2,Set(JABBER_ACK_MSG=you are being called by ${CALLERIDNUM}.)
exten => 8013,3,JabberReceive(${jid},${JABBER_ACK_MSG})
exten => 8013,4,agi(speak.tcl,${JABBER_MSG})
exten => 8013,5,Set(JABBER_ACK_MSG="${JABBER_MSG}" read. please go ahead.)
exten => 8013,6,Goto(3)
exten => 8013,7,Hangup
arbeitszimmer is the name of the configuration section in jabber.conf and also the name of the jabber server (and as such the domain part of the JID).
This configuration is periodically trying to receive a message, which is then acknowledged after it has been read aloud by the festival spech synthesizer.
URL: http://fuhrmannek.de/projects/asterisk/app_jabber.bef
jabber.agi in Python
I've written a Jabber AGI script in Python. It is very simple, using sendxmpp to actually send the Jabber message. You also need pyst for this, which is an AGI interface Python module.
URL: http://www.unrealtower.org/asterisk
See also
- Asterisk call notification
- SER module Jabber
- Asterisk Speaks with Google Talk using jingle
- Asterisk Google Talk use the gtalk channel to interconnect Asterisk and Google Talk
- Asterisk CLI
- Asterisk SIP Messaging
- Asterisk presence
Go back to Asterisk
Page Changes
Jabber Client + SIP Support
Re: windows messenger live support?
windows messenger live support?
thank you very much !
I hate AIM & MSN & Y!. I prefer ICQ, but even that runs over AOL's network, so, the only real option is to use jabber, and hopefully even an in-house jabber server.
Keep up the great work.
We all look very forward to any possible new versions & features. Keep it up.
Awesome.
Peace.
Jason
Syntax error
Also, is there any way to test the script from the command line?