Question:
I seem to be unable to set any rich presence.. all I get back is
<code xmlns="urn:cisco:cup:presence:soap">120</code>
<message xmlns="urn:cisco:cup:presence:soap">Failed to set presence data</message>
<fix xmlns="urn:cisco:cup:presence:soap">Ensure the presence data is valid</fix>
Here's what I'm trying to send
<presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:rp="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:ce="urn:cisco:params:xml:ns:pidf:rpid" xmlns:so="urn:cisco:params:xml:ns:pidf:source" xmlns:sc="urn:ietf:params:xml:ns:pidf:servcaps" entity="lsste@nxodev.intra"><ce:person id="lsste"></ce:person><tuple id="cisco-pws"><so:source>Presence Web Service</so:source><status><basic>closed</basic></status><activities><busy/></activities><sc:servcaps><sc:audio>true</sc:audio></sc:servcaps></tuple></presence>
Which is sent over the wire as follows
POST http://chdevcimp105.nxodev.intra:8082/presence-service/soap HTTP/1.1
Content-Type: text/xml; charset=utf-8
VsDebuggerCausalityData: uIDPo1jvkPX6F1hEuDK9B0oO6gEAAAAAkmX6hrc5XkqofRlhAUr7YmyVnaMCxe9LmUMF66dJi04ACQAA
SOAPAction: "urn:cisco:cup:presence:soap/setPresence"
Host: chdevcimp105.nxodev.intra:8082
Content-Length: 1248
Expect: 100-continue
Accept-Encoding: gzip, deflate
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:session-key xmlns:h="urn:cisco:cup:presence:soap" xmlns="urn:cisco:cup:presence:soap">548b06f6-dd-38312d92-6ca4-2</h:session-key></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><setPresence xmlns="urn:cisco:cup:presence:soap"><presenceType>RICH_PRESENCE</presenceType><presenceInfo><richPresence xsi:type="xsd:string"><presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:rp="urn:ietf:params:xml:ns:pidf:rpid" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:ce="urn:cisco:params:xml:ns:pidf:rpid" xmlns:so="urn:cisco:params:xml:ns:pidf:source" xmlns:sc="urn:ietf:params:xml:ns:pidf:servcaps" entity="lsste@nxodev.intra"><ce:person id="lsste"></ce:person><tuple id="cisco-pws"><so:source>Presence Web Service</so:source><status><basic>closed</basic></status><activities><busy /></activities><sc:servcaps><sc:audio>true</sc:audio></sc:servcaps></tuple></presence></richPresence><override>true</override></presenceInfo><expiration>3600</expiration></setPresence></s:Body></s:Envelope>
Answer with Discussions:
I've only glanced at this briefly, but you might want to try this change:
<rp:activities>
<rp:busy/>
</rp:activities>
===========
Will give it a try later on.
Do you know which logfile would contain the server side on this so I could get some additional info as to what presence doesn't like? I looked through the log categories in RTMT but found nothing that screamed "this is the cup api" to me.
===========
Should it really be rp:activities? I had a look at what is returned when I query the status
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cup="urn:cisco:cup:presence:soap">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<cup:getPolledPresenceResponse>
<cup:presenceResponse>
<cup:presenceType>RICH_PRESENCE</cup:presenceType>
<richPresenceList xmlns="urn:cisco:cup:presence:soap">
<presence entity="sip:lsste@nxodev.intra" xmlns="urn:ietf:params:xml:ns:pidf">
<person xmlns="urn:cisco:params:xml:ns:pidf:rpid" id="lsste">
<activities>
<away/>
<phone-status>unavailable</phone-status>
<im-status>available</im-status>
</activities>
</person>
<tuple xmlns="urn:ietf:params:xml:ns:pidf" id="Jabberjabber_1081">
<status>
<basic>open</basic>
</status>
<servcaps xmlns="urn:ietf:params:xml:ns:pidf:servcaps">
<type>text/plain</type>
<type>application/x-cisco-cupc+xml</type>
<text>true</text>
</servcaps>
</tuple>
</presence>
</richPresenceList>
</cup:presenceResponse>
</cup:getPolledPresenceResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
so it seems the activities need to go into person. So I moved the activity up into the person and sent this
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:session-key xmlns:h="urn:cisco:cup:presence:soap" xmlns="urn:cisco:cup:presence:soap">5491aad2-322-465318f1-6c3d-1</h:session-key></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><setPresence xmlns="urn:cisco:cup:presence:soap"><presenceType>RICH_PRESENCE</presenceType><presenceInfo><richPresence xsi:type="xsd:string"><presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:ce="urn:cisco:params:xml:ns:pidf:rpid" xmlns:so="urn:cisco:params:xml:ns:pidf:source" xmlns:sc="urn:ietf:params:xml:ns:pidf:servcaps" entity="lsste@nxodev.intra"><ce:person id="lsste"><ce:activities><ce:busy /></ce:activities></ce:person><tuple id="cisco-pws"><so:source>Presence Web Service</so:source><status><basic>closed</basic></status><sc:servcaps><sc:audio>true</sc:audio></sc:servcaps></tuple></presence></richPresence><override>true</override></presenceInfo><expiration>3600</expiration></setPresence></s:Body></s:Envelope>
You also see I removed some of the namespaces that are never used
For better readability, this is the string I'm sending in the richPresence field:
<presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:ce="urn:cisco:params:xml:ns:pidf:rpid" xmlns:so="urn:cisco:params:xml:ns:pidf:source" xmlns:sc="urn:ietf:params:xml:ns:pidf:servcaps" entity="lsste@nxodev.intra"><ce:person id="lsste"><ce:activities><ce:busy/></ce:activities></ce:person><tuple id="cisco-pws"><so:source>Presence Web Service</so:source><status><basic>closed</basic></status><sc:servcaps><sc:audio>true</sc:audio></sc:servcaps></tuple></presence>
If I compare this to the status I'm getting, the namespaces seem correct. Then I rewrote just to be on the safe side to not declare the namespaces before:
<presence xmlns="urn:ietf:params:xml:ns:pidf" entity="sip:lsste@nxodev.intra"><person xmlns="urn:cisco:params:xml:ns:pidf:rpid" id="lsste"><activities><busy/></activities></person><tuple xmlns="urn:ietf:params:xml:ns:pidf" id="pws-override"><status><basic>open</basic></status><servcaps xmlns="urn:ietf:params:xml:ns:pidf:servcaps"><audio>true</audio></servcaps></tuple></presence>
I also noted that there seem to be different values for tuple id.. I tried cisco-pws, pws-override, but both failed. I also changed the entity from username@domain to sip:username@domain as that's what is returned to me when I query rich presence. Still.. nothing I've tried works.
==============
Yes, you're right about activities. For what it's worth, here's an example from the IM & Presence documentation:
https://developer.cisco.com/fileMedia/download/a2ce9071-4c3b-4ad5-adaa-095153ea1b4c
<presence from='cupuser@cisco.com/composed'>
<c hash='sha-1' node='http://cisco.com/cup/caps' ver='uyV+h3Zn3t9eUgEvEULLrTGjzlc=' xmlns='http://jabber.org/protocol/caps'/>
<priority>127</priority>
<presence entity='sip:cupuser@cisco.com' xmlns='urn:ietf:params:xml:ns:pidf'>
<person id='cupuser' xmlns='urn:cisco:params:xml:ns:pidf:rpid'>
<activities>
<available/>
<phone-status>unavailable</phone-status>
<im-status>available</im-status>
</activities>
</person>
<display-name xmlns='urn:ietf:params:xml:ns:pidf:cipid'>yasong@cisco.com</displayname>
<tuple id='JabberJabber MomentIM' xmlns='urn:ietf:params:xml:ns:pidf'>
<status>
<basic>open</basic>
</status>
<servcaps xmlns='urn:ietf:params:xml:ns:pidf:servcaps'>
<type>text/plain</type>
<type>application/x-cisco-cupc+xml</type>
<text>true</text>
</servcaps>
</tuple>
</presence>
</presence>
================
That's an on the phone with active jabber though... and set by Jabber. If the developer guide for 10.5 is to be trusted, I'm supposed to use pws-override. The doc is really insufficient with regards to custom presence.. not only does it give clearly broken samples, it doesn't list possible values for the tuplie id and when they should be used. Take the sample on page 90 in the 10.5 dev guide (you linked to it): it defines a namespace cisco that's never used, and the example on page 91 is invalid XML. The example you posted is invalid XML as well.. <display-name> and </displayname> do not match and of course, neither version does work.
What's missing is some working example and a matrix that shows when you need to use which settings. E.g. you want to set on-the-phone if the user is offline, you want the same if it is online, you want to set online for a user that is not online, and interactions with the server side and jabber (what is needed to override jabber if jabber is online).
================
May I ask, what language and library are you using to send the presence stanza? If it's something I can download, I can experiment with it for a while.
Also, you can find examples in the ietf spec:
RFC 4480 - RPID: Rich Presence Extensions to the Presence Information Data Format (PIDF)
===============
It's c#.. I basically added my own stub (add reference) and took it from there. I can upload the code (minus credentials).. it's really a play project at this point, nothing that cannot be shown publicly.
===============
Sure, if you don't mind, just attached a sanitized version.
Here's another sample rich presence status:
<?xml version="1.0" encoding="UTF-8"?>
<body xmlns="http://jabber.org/protocol/httpbind"
xmlns:stream="http://etherx.jabber.org/streams">
<presence from="test@testjabber.com/composed" to="test@testjabber.com">
<show>dnd</show>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1"
node="http://cisco.com/cup/caps" ver="L0mwOaX6n8VnczsxLk2dMU2QzAg=" />
<status>hello world1</status>
<priority>127</priority>
<presence xmlns="urn:ietf:params:xml:ns:pidf"
entity="sip:test@testjabber.com">
<person xmlns="urn:cisco:params:xml:ns:pidf:rpid" id="test03">
<activities>
<dnd />
<phone-status>available</phone-status>
<im-status>available</im-status>
</activities>
<class>manual</class>
<note>hello world1</note>
</person>
<tuple id="Jabberjabber_22958">
<status>
<basic>open</basic>
</status>
<servcaps xmlns="urn:ietf:params:xml:ns:pidf:servcaps">
<type>text/plain</type>
<type>application/x-cisco-cupc+xml</type>
<text>true</text>
</servcaps>
</tuple>
<tuple
id="8e60c594-c50e-e904-dcaf-a710e4ed980f-c0c70fb3-7a0c-3097-9b8f-b1e5690c0183">
<status>
<basic>open</basic>
</status>
<sc:servcaps xmlns:sc="urn:ietf:params:xml:ns:pidf:servcaps">
<sc:audio>true</sc:audio>
</sc:servcaps>
<contact
priority="0.8">sip:1003@192.168.1.1:5060;dpkid=c0c70fb3-7a0c-3097-9b8f-b1e5690c0183;npkid=8e60c594-c50e-e904-dcaf-a710e4ed980f</contact>
<model>unknown</model>
<timestamp>2014-10-11T12:42:45Z</timestamp>
<activities>
<dnd />
</activities>
<model>Cisco-CSF/9.4.1</model>
<deviceID>F0DEF1633D47</deviceID>
</tuple>
<tuple id="Jabber.8532787391450256">
<status>
<basic>open</basic>
</status>
<servcaps xmlns="urn:ietf:params:xml:ns:pidf:servcaps">
<type>text/plain</type>
<type>application/x-cisco-cupc+xml</type>
<text>true</text>
</servcaps>
<note>hello world</note>
</tuple>
<tuple id="Jabber.6158784090075642">
<status>
<basic>open</basic>
</status>
<servcaps xmlns="urn:ietf:params:xml:ns:pidf:servcaps">
<type>text/plain</type>
<type>application/x-cisco-cupc+xml</type>
<text>true</text>
</servcaps>
<note>Some Note Goes Here</note>
</tuple>
</presence>
</presence>
</body>
=================
I uploaded my code to Github: https://github.com/ssteiner/CUPTest .
I have two goals here.. one is set "on the phone" for a jabber user that may or not be online (online in jabber) (integration with another telephony system).. and the other is pretent to be an active user, and set presence state. The user should not be able to receive IMs, but can receive calls, and can be "on the phone". I also should be able to set custom presence state for those users that I fully control (and where no actual user will ever log in with jabber, jabber mobile, etc).
==================
If anybody is interested.. I got it working now. I moved from SOAP to rest (what a pain to implement the object model.. ), and I can now successfully set rich presence. Some of the xamples given here do work.. I think it was a combination between incorrect XML, and the xml formatting that wcf does by default (and I haven't found a way to disable it.. as I moved to rest, I've given up on the soap part and the doc states that REST is the future for the API).
==================
I am interested your work. How can I test your project?
==================
Well, you can't really (unless somebody higher up decides we open up some our work.. not that I'd mind.. I think it would be great to have some ready-to-use libs so we can focus on writing great solutions, not on the plumbing that goes with it), but if it helps I could send you a few working documents to set rich presence.
==================
So have you managed to do what you needed to do with regards to rich presence?
==================
Do you know if you can set the Location too?
==================
Very good question. I'm afraid I don't know either. I have an extensive documentation here about the presence schema data, but that was made prior to the addition of the location feature.
I'd imagine the location also uses PIDFs but we'd need an up-to-date documentation to see where it goes.
Perhaps somebody from Cisco can help here?
One reverse engineering idea: register for presence state notification, and look at how the PIDF changes as you change the location in Jabber. Given that custom status and notes are part of the PIDF, I'd expect the location to be a field there as well.
Comments
0 comments
Please sign in to leave a comment.