XMPP Presence data not appearing

Get help with installing and running AsteriskNOW.

Moderators: Moderator, Support

XMPP Presence data not appearing

Postby tony2012 » Wed Mar 19, 2014 9:57 pm

Hello all,

I'm having some difficulty getting presence data for my XMPP buddies in Asterisk. My goal is to get Asterisk to integrate with ejabberd to route calls based on XMPP presence. Basically, my lab setup looks like this:

Asterisk 11.8.1 on CentOS 6.5 (installed as AsteriskNOW): IP 10.1.4.12
ejabberd on CentOS 6.5: IP 10.1.4.13

I have a user called tony2012 on my buddy list. I have a test dialplan extension that, when rung, uses JABBER_STATUS to try getting the presence information. However, it always returns with an error:

Code: Select all
[Mar 19 23:51:02] NOTICE[20662][C-00000002]: res_xmpp.c:1631 acf_jabberstatus_read: Resource (null) of buddy tony2012@10.1.4.13 was not found.


I believe the crux of this issue is that no presence information is appearing for my tony2012 buddy (I've truncated the output because I also have a gvoice XMPP connection:

Code: Select all
localhost*CLI> xmpp show buddies
Client: ejabberd
        Buddy:  tony2012@10.1.4.13
                Resource: 8251360241395287283122239
                        node: http://pidgin.im/
                        version: I22W7CegORwdbnu0ZiQwGpxr0Go=
                        Google Talk capable: no
                        Jingle capable: yes


Notice that there is nothing there about presence. However, I believe the Asterisk server is getting presence information, because when I change the presence in my IM client (Pidgin, but I've also gotten the same results with Adium), I get this:

Code: Select all
<--- XMPP received from 'ejabberd' --->
<presence from='tony2012@10.1.4.13/8251360241395287283122239' to='asterisk@10.1.4.13/asterisk-xmpp'><priority>1</priority><c xmlns='http://jabber.org/protocol/caps' node='http://pidgin.im/' hash='sha-1' ver='I22W7CegORwdbnu0ZiQwGpxr0Go='/><x xmlns='vcard-temp:x:update'><photo/></x></presence>
<------------->


So it would seem that I am actually getting presence data, but it's not showing up under the buddy when I run "xmpp show buddies" I'm sort of at a loss, as I've spent hours messing with this and confirmed, via the debug output below and pcaps, that the Asterisk box is getting the presence information. Additionally, I can successfully send messages to tony2012 via the JabberSend dialplan function. It's just the presence status that seems to be having issues.

My xmpp.conf is below. I've removed the information that isn't relevant (I also have gvoice set up). I can provide dialplan information as well, but I'm not sure if it's relevant just yet.

Code: Select all
[general]
        autoregister=yes
[ejabberd]
        type=client
        serverhost=10.1.4.13
        username=asterisk@10.1.4.13
        secret=*****CENSORED*****
        priority=2
        port=5222
        usetls=no
        usesasl=yes
        status=available
        statusmessage="It's Asterisk!"
        timeout=5


I'm definitely no Asterisk expert, and I'm certainly an XMPP noob, so any help is very greatly appreciated. I'm just at a bit of a loss here, and I don't know how to troubleshoot further. Thanks a lot!
tony2012
Newsterisk
 
Posts: 3
Joined: Wed Mar 19, 2014 8:59 pm

Re: XMPP Presence data not appearing

Postby tony2012 » Thu Mar 20, 2014 8:49 am

I was able to "fix" this by adding the resource to the JABBER_STATUS in my dialplan. My dialplan now looks like this:

Code: Select all
exten => 1004, 1, JabberSend(ejabberd,tony2012@10.1.4.13,Test)
                same => n, Set(JSTATUS=${JABBER_STATUS(ejabberd,tony2012@10.1.4.13/8251360241395287283122239)})


Notice that the resource is added to tony2012 with a /. However, the documentation for JABBER_STATUS (https://wiki.asterisk.org/wiki/display/AST/Function_JABBER_STATUS) clearly states that either are bare jid or a full jid can be used:
jid - Jabber ID of the buddy to receive message from. It can be a bare JID (username@domain) or a full JID (username@domain/resource).


Since the call doesn't seem to work with a bare jid, and only works with a full jid, I'm wondering if this is a bug that should be reported. However, I wanted to get the thoughts of this community before doing so. Thanks again!
tony2012
Newsterisk
 
Posts: 3
Joined: Wed Mar 19, 2014 8:59 pm

Re: XMPP Presence data not appearing

Postby malcolmd » Thu Mar 20, 2014 10:23 am

At the very least, it should be a documentation improvement.
Malcolm Davenport
Digium, Inc. | Senior Product Manager
malcolmd
Moves Like Spencer
 
Posts: 3019
Joined: Wed Aug 03, 2005 3:53 pm
Location: Huntsville, AL, US

Re: XMPP Presence data not appearing

Postby tony2012 » Thu Mar 20, 2014 11:20 am

I'm also noticing that, even with the full jid, the function is unable to report an offline status. For example, the user tony2012@10.1.4.13/Desktop goes offline/unavailable and Asterisk receives the presence update:

Code: Select all
<--- XMPP received from 'ejabberd' --->
<presence from='tony2012@10.1.4.13/Desktop' to='asterisk@10.1.4.13/asterisk-xmpp' type='unavailable'/>
<------------->

xmp
However, a call to JABBER_STATUS still fails:

Code: Select all
[Mar 20 13:18:43] NOTICE[23599][C-00000000]: res_xmpp.c:1631 acf_jabberstatus_read: Resource Desktop of buddy tony2012@10.1.4.13 was not found.
tony2012
Newsterisk
 
Posts: 3
Joined: Wed Mar 19, 2014 8:59 pm


Return to AsteriskNOW Support

Who is online

Users browsing this forum: No registered users and 1 guest