Asterisk, and other worldly endeavours.

A blog by Leif Madsen

HowTo: Getting Jabber/XMPP notifications from your PBX

I just have to write up a quick post to show you JUST HOW SIMPLE it is to get interesting events from your PBX via Jabber. Right now I’m using it to notify me of anyone trying out my test ISN number, or whenever they join my conference bridge (good reminder if I lose track of time and forget that I scheduled some people to join my conference room).

This is based on Asterisk 1.4, although the same configuration should work on 1.6, but I like to try and give 1.4 examples where I can for those of you still running 1.4.

So the first thing you need to do is configure Asterisk to connect to a Jabber server. I like to use the Google Jabber servers since it saves me from setting one up 🙂 I have setup Google Apps as well so that I can use my own domain, but using a Gmail address should work just as well.

Configuring res_jabber (the Jabber module in Asterisk) is nice and easy. The main thing to notice is that I uncommented the ‘debug’ option as the default is to have a bunch of debugging on the console. Find below the entire jabber.conf file from /etc/asterisk based on the sample file, but with the required options uncommented for connecting to Note that I’ve created a Jabber account specifically for my Asterisk box, although I’m sure you could use an existing account if you wanted.

debug=no                                   ;;Turn on debugging by default.
;autoprune=yes                           ;;Auto remove users from buddy list.
;autoregister=yes                        ;;Auto register users from buddy list.

[asterisk]                                   ;;label
type=client                                 ;;Client or Component connection          ;;Route to server for example,
                                                ;;        ;;Username with optional roster.
secret=welcome                                    ;;Password
port=5222                                            ;;Port to use defaults to 5222
usetls=yes                                           ;;Use tls or not
usesasl=yes                                         ;;Use sasl or not                    ;;Manual addition of buddy to list.
statusmessage="I am available"               ;;Have custom status message for
;timeout=100                                        ;;Timeout on the message stack.

You’ll notice that I’ve added the buddy ‘’ manually. In order to be able to send messages to the ‘’ contact, I need to add them to the buddy list in the Asterisk memory. Once Asterisk goes to send a message via the JabberSend() application, then you will get an authorization request. Once the authorization has been granted, then you will be able to get messages.

Now that we have configured jabber.conf, lets reload the res_jabber module.

From the Asterisk CLI, run:

*CLI> module reload

Then we can verify we have connected to the server correctly by running:

*CLI> jabber show connected
Jabber Users and their status:
User: - Connected
Number of users: 1

And we can run jabber test to do a verification everything is OK:

*CLI> jabber test
Resource: linux918E72D1
version: 2.5.5
Jingle Capable: 0
Priority: 1
Status: 1

Oooh a working message stack!

Now that everything looks good to go, lets send a message over Jabber!

From the Dialplan, we need to use the JabberSend() application to send us some information. The example I’ll use will send a message whenever someone joins my conference room.

exten => 7070,1,Verbose(2,${CALLERID(all)} is joining the conference bridge.)
exten => 7070,n,JabberSend(asterisk,,${CALLERID(all)} is joining the conference bridge.)
exten => 7070,n,MeetMe(7070,d)
exten => 7070,n,Hangup()

The format for the JabberSend() application is as follows:

  • Jabber: the jabber configuration to use, this is the [name] you configured in jabber.conf
  • ScreenName: the screen name of the person you want to send an XMPP message to
  • Message: the message you want to send

And that should be pretty much it! Pretty simple eh?


Written by Leif Madsen

2009/07/17 at 10:47 pm

Posted in Asterisk

Tagged with , , , ,

9 Responses

Subscribe to comments with RSS.

  1. Doesn’t work – when I do “module reload” is responds “No such module ‘'”, and the commands after that fail as well. This is using Asterisk 1.4.22.


    2009/07/18 at 2:31 pm

    • You have to build the module for it to load. In order to build the module, you need to install the dependencies, such as iksemel. After you’ve installed the dependencies, you’ll need to re-run ./configure, followed by make install.

      Check out my website ( and look at the presentations section. In the latest IT360 presentation (Unusual Uses) you should find some information about the dependencies required to build the module.

      Additionally, I’m sure there is some good stuff on the voip-info wiki, or on other assorted sites found by Google.

      Leif Madsen

      2009/07/19 at 9:32 pm

    • Could have sworn I replied to this. Seems the my response got lost in the email reply functionality.

      The answer is that you haven’t built the module. You need to make sure you have the dependencies installed for it, like iksemel, and then recompile Asterisk, which then will build the module once dependencies have been satisfied.

      Leif Madsen

      2009/07/30 at 2:45 pm

  2. i have set up jabber and am able to send messages and make call through gtalk to my asterisk 1.6 server.. but is there any way i could receive a text message at my asterisk server from a gtalk buddy. Tried jabberreceive() but didnt work. Do i need to install ‘jabberreceive’ to use it?? jabbersend() works perfect for me .



    2009/12/30 at 12:57 am

    • Should have replied a long time ago, but the answer is that it looks like you’re trying to use a dialplan application that doesn’t exist (i.e. JabberReceive), when you need to use the dialplan function, which needs to be all uppercase, ie. JABBER_RECEIVE().

      Leif Madsen

      2010/10/08 at 8:00 am

  3. […] to Google Talk (do not confuse with Google Voice) to work, or, perhaps you are trying to send Jabber-based notifications from your Asterisk box and it’s not working, it might be because of a couple of missing […]

  4. Hey Leif
    Thanks for this info…it works for me for Asterisk 1.6

    I have small issue. How can I send this notification to multiple people.
    Thanks 🙂

    Shri Ram

    2011/05/12 at 8:09 am

  5. hey mate, just thought i’d leave a note here saying it works for asterisk- – thanks for your awesome blog

    Chris Mylonas

    2013/01/27 at 8:50 pm

    • Glad it still works for you! Might also want to check out the latest version of Asterisk: The Definitive Guide (4th edition) where we document it even more thoroughly for Asterisk 11. The Asterisk 1.8 versions can be found in the 3rd edition (

      Leif Madsen

      2013/01/27 at 10:32 pm

Comments are closed.

%d bloggers like this: