Table of Contents
setSIPPresence()
wrtc.setSIPPresence() is used to publish your current presence status to SIP presence server.
Arguments
wrtc.setSIPPresence(available, activity, note, timo, raw)
- available - boolean, true: telephone available for calls, false: telephone unavailable for calls
- activity - string containing activity description according to RFC4480 section 3.2
- note - string containing free text description
- timo - (optional) seconds before status needs to be refreshed
- raw - (optional) string containing SIP message header and body (overrules all above arguments)
According to RFC4480 available describes if the phone is online or not, not the person's availability. Thus even if status is "away" available is still true as the phone is still online and working.
Returns
Nothing.
Events
None.
Example
wrtc.setSIPPresence(true, "unknown", "") reports you are available for calls. (Yes, RFC4480 states activity "unknown" is to describe you are available.)
wrtc.setSIPPresence(true, "away", "out for lunch, back 13:00") reports you are away from your phone. (Yes, RFC4480 states it should still be reported as available=true.)
wrtc.setSIPPresence(false, "", "") reports you are offline, not available.
More complex presence reports can be sent in raw format:
wrtc.setSIPPresence(true, “”, “”, 0, “Expires: 3600\r\nContent-Type: application/pidf+xml\r\nEvent: presence\r\nContent-Length: 535\r\n\r\n <?xml version='1.0' encoding='UTF-8'?><presence xmlns='urn:ietf:params:xml:ns:pidf' xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' xmlns:lt='urn:ietf:params:xml:ns:location-type' xmlns:caps='urn:ietf:params:xml:ns:pidf:caps' entity='sip:foo@bar.com'"><tuple id='t1'><status><basic>open</basic></status></tuple> <dm:person id='p1'><rpid:activities><rpid:on-the-phone/></rpid:activities><dm:note>On the phone</dm:note></dm:person></presence>”);