For an application we develop we need the presence information of the users we are listing. Can an Application User query the presence status of a given list of users?
All examples I see are based on a login of an End User
Answer with discussions:
I'm afraid you Need an end user session. It doesn't matter which end user though.. there's also no Need to have a contact list contining the users you are interested in.
The way I'm designing my application is that I have one application user with the necessary rights, and a dummy user (presence enabled) that I'm using to get the presence of other users.
By the way, if you don't Need to get the state just once, I'd recommend you use the subscribe mechanism so that CUP will give you a heads-up if something has changed and you only Need to extract data whenever something has changed (and you'd get those notifications in real-time, rather than on a fixed polling schedule). The subscribe mechanism will also get you the initial state after subscription (well, it gets you a notificatoin that something has changed, and then you query the subscribed presence and get the initial states).
The only commands you can Ron for an app user is Login/logout and endpoint Registration commands (that you Need Prior to making a subscription).
if I poll, I get UNKNOWN status in the first poll, the 2nd returns the correct status :-(
If I create a dummy user, is there a way to not allow any user to add dummy user as contact? I am currently using source codes that download from Cisco DevNet: UC Manager IM & Presence APIs - Web Services Reference Application
Hmm.. I never bothered to check. But would it be a big problem? That's one user that just remains green and that you cannot call.. and if needed, you could set your presence capabilities so that you can't IM it either (not sure if it takes.. but with rich presence, you can give the server your capabilities)
Oh, yeah, there is a way. You can have different data sources in Jabber. There's UDS (CUCM endusers) and there's EDI (LDAP).. we're doing the latter, so we're not hitting any CUCM endusers. So my monitoring end user in CUCM cannot be monitored because users only see the users from LDAP. But if you're doing UDS.. I'd imagine the user would show up.
We use UDS for our clients to search contacts. I will look at the search result to see there are any differences between UDS and LDAP users to filter them out. Thank you for your helpful information.
I use the useLdapAuth flag to distinguish UDS and EDI users. So far it is good.
Currently I use dummy user to poll presence’s of other contacts, but I have to poll periodically. Is there a way to implement so that dummy user can be notified upon contact’s status changes? Please let me know!
Of course you can. Instead of polling, you need to host your own webserver that answers requests. Then you register this using the registerEndpoint (example 59 in the dev guide). And then you subscribe for presence updates of the user's you're interested in (example 63 in the dev guide).
Then CIMP will send an HTTP request to your webserver whenever there's some presence state change in one of the contacts you subscribed for (you can update the subscription at any time.. add new contacts, remove contacts). CIMP will just get you the subscription ID, so you need to store your session information. Then you do extract the subscribed presence (example 68), and you'll get all the presence state changes that have happened.
Be mindful that those updates are queued. Say you get a notification because the state of userA has changed. And then you don't immediately extract the subscribed presence. If the state of userB now changes, you won't get another update.. but if you extract the subscribed presence, you'll get both the state of userA AND user B. That can be crucial if you have a network interruption.. say the update from CIMP to your app makes it, but then you cannot extract the subscribed presence. CIMP will now queue the updates, and wait for your app to extract them. This behavior is not documented, but this is how things work. So, I've even added a maintenance command to manually request subscribed presence to my app.. just in case things stop working because somewhere my app couldn't extract a subscribed presence after getting a notification.
Note that you could also use SIP/SIMPLE to subscribe to presence state updates.. but of course that requires that you have a sip library (there's plenty around.. but I've never used one so I can't recommend one). Curiously, the dev guide doesn't mention XMPP which would seem the most natural way to subscribe for presence state updates (the matrix .net lib works fine with xmpp in a Finesse environment.. I'm using it).
I followed your steps and implemented as following:
- Login application user.
- RegisterEndPoint for this application user with CALLBACK_URL as my web service (I already tested this by making request, it worked)
- Login dummy user.
- Subscribed two contacts for the presence.
- Changed presences of subscribed contacts couple times, but I don't see any notification came to my service.
My CALLBACK_URL: http://mywebserver:7070/callbacklistener
What did I do wrong? Where is the starting point to debug?
I do log in the end user before registering the endpoint, but that shouldn't matter given that the endpoint registering takes the app user session key.
One thing I initially had.. is your webserver reachable from your CIMP? With the uri you provided (I see it's no FQDN... I tend to use IP addresses so no DNS resolution could interfere with event delivery)
Also.. I take it that the presence state changes to make it to other clients, right? I upgraded my lab recently and one user somehow got stuck... the presence state change would enver show on any other client and also not make it to my app.. I had to do a switchover to get things back to normal. Seeing each other's presence properly is the first step to knowing that you don't have an underlying issue with the presence engine.
Next thing you can do is change the log level of the cisco sip proxy and presence engine to debug, run the test again, and then extract those log files and see if you spot mywebserver's address.. you should see some connection attempts.
If you run a virtualized environment, you could also sniff the CIMP's connection.. you should see connections to port 7070 on your webserver instantly after you change the presence.
I will do your suggestion and also look at the source codes (downloaded from Cisco website) in more detail to see why it does not work. Thank you very much for your help!
You can also use CAXL if what you're building is a web application, and then simply monitor the presence events. You still need an end user to do the monitoring. Just create a dummy end user and add everyone to the roster. Then bind the presence event to a function, sit back, and watch the presence updates come in. If you want to actively query presence, there's a method to get presence, too.
Please sign in to leave a comment.