Class Index | File Index

## Classes

- _global_
- SIPml
- SIPml.Event
- SIPml.EventTarget
- SIPml.Session
- SIPml.Session.Call
- SIPml.Session.Configuration
- SIPml.Session.Event
- SIPml.Session.Message
- SIPml.Session.Publish
- SIPml.Session.Registration
- SIPml.Session.Subscribe
- SIPml.Stack
- SIPml.Stack.Configuration
- SIPml.Stack.Event

# Class SIPml.Session.Publish

Extends SIPml.Session.
Defined in: SIPml.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| SIPml.Session.Publish(session, configuration) SIP PUBLISH (for presence status publication) session class.You should never create an instance of this class by yourself.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| publish(content, contentType, configuration) Sends a SIP PUBLISH (for presence status publication) request.
| unpublish(configuration) Remove/unpublish presence data from the server.

Methods borrowed from class SIPml.Session:
  accept, getId, getRemoteFriendlyName, getRemoteUri, reject, setConfiguration
Methods borrowed from class SIPml.EventTarget:
  addEventListener, removeEventListener

Class Detail
SIPml.Session.Publish(session, configuration)
SIP PUBLISH (for presence status publication) session class.You should never create an instance of this class by yourself. Please use stack.newSession() function to create a new presence publication session.

    var session = stack.newSession('publish', {
                                expires: 200,
                                events_listener: { events: '*', listener: function(e){} },
                                sip_headers: [
                                              { name: 'Event', value: 'presence' } // very important
                                    ],
                                sip_caps: [
                                            { name: '+g.oma.sip-im', value: null },
                                            { name: '+audio', value: null },
                                            { name: 'language', value: '\"en,fr\"' }
                                    ]
                            });

Parameters:
{tsip_session} session
  Private session object.
{SIPml.Session.Configuration} configuration Optional
  Configuration value.

Since:
  version 1.1.0

Method Detail
{Integer, Integer} publish(content, contentType, configuration)
Sends a SIP PUBLISH (for presence status publication) request.

    var session = stack.newSession('publish');
    var contentType = 'application/pidf+xml';
    var content = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n' +
                    '<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\n' +
                        ' xmlns:im=\"urn:ietf:params:xml:ns:pidf:im\"' +
                 	    ' entity=\"sip:bob@example.com\">\n' +
                        '<tuple id=\"s8794\">\n' +
                        '<status>\n'+
                        '   <basic>open</basic>\n' +
                        '   <im:im>away</im:im>\n' +
                        '</status>\n' +
                        '<contact priority=\"0.8\">tel:+33600000000</contact>\n' +
                        '<note  xml:lang=\"fr\">Bonjour de Paris :)</note>\n' +
                        '</tuple>\n' +
       	            '</presence>';

    session.publish(content, contentType,{
        expires: 200,
        sip_caps: [
                                        { name: '+g.oma.sip-im' },
                                        { name: '+sip.ice' },
                                        { name: 'language', value: '\"en,fr\"' }
                                ],
        sip_headers: [
                                { name: 'Event', value: 'presence' },
                                { name: 'Organization', value: 'Doubango Telecom' }
                        ]
    });

Parameters:
{Object|String} content Optional
  The request content.
{String} contentType Optional
  The content type.
{SIPml.Session.Configuration} configuration Optional
  Configuration value.

Since:
  version 1.1.0

Throws:
{ERR_INVALID_PARAMETER_VALUE | ERR_NOT_READY}
  ERR_INVALID_PARAMETER_VALUE | ERR_NOT_READY

Returns:
  {Integer} 0 if successful; otherwise nonzero
  {Integer} 0 if successful; otherwise nonzero

See:
  unpublish

unpublish(configuration)
Remove/unpublish presence data from the server.

Parameters:
{SIPml.Session.Configuration} configuration Optional
  Configuration value.

Since:
  version 1.1.0

Throws:
{ERR_INVALID_PARAMETER_VALUE | ERR_NOT_READY}
  ERR_INVALID_PARAMETER_VALUE | ERR_NOT_READY

See:
  publish

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Sep 25 2013 03:40:14 GMT+0200 (CEST)