2

I am currently writing an application in java using the the JAIN SIP library, I've been trying for the past couple of days to implement presence using SUBSCRIBE and NOTIFY messages. I currently have NOTIFY messages which has a content type of "message/sipfrag;version=2.0", and need this to be XML and PIDF.

I'm aware I need to use an event header with "presence", and also a content type header.

Are there any places I can go to where there is information on this or are there any other specific headers or classes and/or methods needed to make this work? I already have a client which I can make calls on, but need to implement presence now.

Jordan.J.D
  • 7,999
  • 11
  • 48
  • 78

2 Answers2

1

FYI, rfc3863 only defines the basic structure/semantics of a presence document. PIDF establishes a rudimentary presence document to be a status - with optional contact info, and other info (defined per the PIDF schema). PIDF does not really prescribe presence protocol. For those you need to review [RFC3265][1] and the details of the presence event package [RFC3856][2]. If we stick to a non-IMS network, the usual call-flow involves:

  1. SIP registration to the SIP/REGISTRAR user-agent-server (UAS) accessible to the client. This also establishes the presence-entities (presentity) AoR (Address of Record) - who you are and how you can be reached - i.e. assuming you want to be contacted.

  2. SIP:PUBLISH - with 3 very key parts. Firstly, an 'Event' header indicating support for the presence package, the content-type appropriately set to PIDF MIME-type and the correct body.

    PUBLISH sip:bob@example.org SIP/2.0 ... Event: presence Content-type: application/pidf+xml Content-length: xyz

    open

Once you have successfully published, you can then try a SUBSCRIBE method - to try and obtain status of another presence entity (e.g. user jane@example.org). For a SIP SUBSCRIBE the minimal is defining an appropriate presentities SIP/URI and specifying the correct 'event-package'. Look closely at the indicated RFCs - 3265 / 3856 will help guide you on basic behavior.

Best of luck. [1]: https://www.rfc-editor.org/rfc/rfc3265#section-4 [2]: https://www.rfc-editor.org/rfc/rfc3856#section-5

Community
  • 1
  • 1
gto406
  • 589
  • 3
  • 9
0

There is more than one way to do presence in SIP. If you are sure PIDF is used then you should just use the RFC as reference https://www.ietf.org/rfc/rfc3863.txt. JSIP will work just fine as far as the SIP headers go, it will construct and parse the SIP messages correctly. The actual SIP message content parsing/construction is responsibility of the app. Jitsi is an open source client that has presence if you want to peek at some example code, but it may be totally different from your case.

Vladimir Ralev
  • 1,371
  • 9
  • 18
  • Thank you very much for the reply, I really appreciate it. I hoped this was the case, I am currently receiving a message with a content type of "message/sipfrag;version=2.0". Do you know of anyway how I can get XML and PIDF instead. Once I have that, I should be okay. Thanks again. – user3279210 Mar 31 '14 at 14:14
  • Also, do I need to use PUBLISH messages to achieve presence? Or can it be achieved using SUBSCRIBE and NOTIFY? – user3279210 Mar 31 '14 at 14:15
  • When you say you receive a message with content type "..." that implies a remote party sends this message. To change it you must configure the remote party to use the correct Content-Type, not JSIP. Or do I misunderstand something? You may need to use PUBLISH and you may need HTTP for presence or you can go ahead and do custom presence protocol, it really depends on the circumstances. – Vladimir Ralev Mar 31 '14 at 14:19