cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Please note that Remote Expert Mobile announced end-of-life and support will end on February 28, 2022.
900
Views
3
Helpful
3
Replies
Highlighted
Beginner

Jabber Presence Data

Can I retrieve timecard data on how long a Jabber profile is holding a certain presence status.

I want more granularity than just the Red Yellow Green presence.

I want to see how long a user has been in a particular status like "On a call" or has a custom status.

Everyone's tags (5)
3 REPLIES 3
Highlighted
Cisco Employee

Re: Jabber Presence Data

Hi Robert,

On researching this it appears that CUP and IM & Presence do not provide that information. Even in the XMPP specification, there's no indication that duration of a presence status is ever returned. 

In which case, the duration can only be determined by observing when the status changes, and implies that application is continuously watching/tracking the user's presence.

Thanks,

Smita Upadhya

Highlighted
Beginner

Re: Jabber Presence Data

Thanks Smita,

Is the instantaneous presence status returned on one of the servers?

If I did have a presence watcher/recorder app, where and how could I gather this information?

Best,

Robert Moreton

Highlighted
Cisco Employee

Re: Jabber Presence Data

Hi Robert,

There are a number of ways to gather presence information.  There's a good example that comes with the CAXL SDK called presencequickcontactsexample.html.  Here's a snippet from that example, which handles presence and updates to the presence status.  It binds the "entityCreated" event, which you can use to calculate the start time of a presence status.  It binds the "primaryPresenceChanged" event to a function, which is called when the presence changes for a subscribed contact (you have to subscribe first).

What you'd have to do in order to poll the presence is to note the presence when "entityCreated" is triggered, and save that time.  You only do this once, when you first subscribe to that contact.

Then when you want to poll the presence use contact.getPrimaryPresence(); for that subscribed contact, and calculate how long it has remained at that presence.  When the presence changes, it will trigger the "primaryPresenceChanged" event, and you reset the time.

Note that the example is for quick contacts (contacts you define on the fly, not from your roster), but the principle is the same, and you can apply it to roster contacts, too.

Does that answer your questions?

                /**

                * Here we bind the 'entityCreated' event on the EntitySet.

                * This event is triggered when subscribing to a JID(s).

                * The event is passed the jabberwerx.Entity that was created

                * and is retrieved from the event data.

                *

                * The 'primaryPresenceChanged' event is bound on

                * the entity to track any changes in presence. This event is

                * triggered when the presence of a enitiy changes and is passed

                * a jabberwerx.Presence object if connected,  null if the

                * entity goes offline.

                */

               client.entitySet.event("entityCreated").bind(function(evt) {

                   var qcontact = evt.data;

                   _roster._updateRosterItem(qcontact);

                   qcontact.event("primaryPresenceChanged").bind(function(evt) {

                       _roster._updateRosterItem(qcontact);

                    });

               });

This widget could not be displayed.