Skip to end of metadata
Go to start of metadata
Icon

This information applies to Asterisk 10 and earlier versions. XMPP Support for Asterisk 11 has been completely rewritten

XMPP (Jabber) is an XML based protocol primarily for presence and messaging. It is an open standard and there are several open server implementations, such as ejabberd, jabberd(2), openfire, and others, as well as several open source clients, Psi, gajim, gaim etc. XMPP differs from other IM applications as it is immensly extendable. This allows us to easily integrate Asterisk with XMPP. The Asterisk XMPP Interface is provided by res_jabber.so.

res_jabber allows for Asterisk to connect to any XMPP (Jabber) server and is also used to provide the connection interface for chan_jingle and chan_gtalk.

Functions (JABBER_STATUS, JABBER_RECEIVE) and applications (JabberSend) are exposed to the dialplan.

You'll find examples of how to use these functions/applications hereafter. We assume that 'asterisk-xmpp' is properly configured in jabber.conf.

JabberSend

JabberSend sends an XMPP message to a buddy. Example:

extensions.ael
JABBER_STATUS
Icon

As of Asterisk 1.6.0, the corresponding application JabberStatus is still available, but marked as deprecated in favor of this function.

JABBER_STATUS stores the status of a buddy in a dialplan variable for further use. Here is an AEL example of how to use it:

extensions.ael
JABBER_RECEIVE

JABBER_RECEIVE waits (up to X seconds) for a XMPP message and returns its content. Used along with JabberSend (or SendText, provided it's implemented in the corresponding channel type), JABBER_RECEIVE helps Asterisk interact with users while calls flow through the dialplan.

JABBER_RECEIVE/JabberSend are not tied to the XMPP media modules chan_gtalk and chan_jingle, and can be used anywhere in the dialplan. In the following example, calls targeted to extension 1234 (be it accessed from SIP, DAHDI or whatever channel type) are controlled by user bob@domain.com. Asterisk notifies him that a call is coming, and asks him to take an action. This dialog takes place over an XMPP chat.

extensions.ael

When calling from a GoogleTalk or Jingle client, the CALLERID(name) is set to the XMPP id of the caller (i.e. his JID). In the following example, Asterisk chats back with the caller identified by the caller id. We also take advantage of the SendText implementation in chan_gtalk (available in chan_jingle, and chan_sip as well), to allow the caller to establish SIP calls from his GoogleTalk client:

extensions.ael

The maintainer of res_jabber is Philippe Sultan <philippe.sultan@gmail.com>.

  • No labels

3 Comments

  1. is there any plan to add raw-udp support?

    1. There's currently no immediate plans to add raw-udp support to the new chan_motif channel driver, I may do it in my spare time since it should be relatively easy.

      1. Hi Joshua,

        I hope you will get that spare time soon (smile) I was waiting for jingle audio support in Asterisk for long time.

        It works with jitsi like a charm, but not with Spark's jitsi-jingle plugin which is based on raw-udp transport.

        Thank you for the response.