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.Subscribe

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

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

Method Summary
Method Attributes | Method Name and Description
--- | ---
| subscribe(to, configuration) Sends a SIP SUBSCRIBE (for presence status subscription) request.
| unsubscribe(configuration) Unsubscribe.

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

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

    var session = stack.newSession('subscribe', {
                    expires: 200,
                    events_listener: { events: '*', listener: function(e){} },
                    sip_headers: [
                                    { name: 'Event', value: 'presence' },
                                    { name: 'Accept', value: 'application/pidf+xml' }
                        ],
                    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} subscribe(to, configuration)
Sends a SIP SUBSCRIBE (for presence status subscription) request.

    var onEvent = function(e){
        if(e.type == 'i_notify'){
            // process incoming NOTIFY request
        }
    }
    var session = stack.newSession('subscribe', {
                    expires: 200,
                    events_listener: { events: '*', listener: onEvent },
                    sip_headers: [
                                    { name: 'Event', value: 'presence' },
                                    { name: 'Accept', value: 'application/pidf+xml' }
                        ],
                    sip_caps: [
                                { name: '+g.oma.sip-im', value: null },
                                { name: '+audio', value: null },
                                { name: 'language', value: '\"en,fr\"' }
                        ]
                });
    session.subscribe('johndoe'); // watch for johndoe's presence status

Parameters:
{String} to
  Destination name, uri, phone number or identifier (e.g. 'sip:johndoe@example.com' or 'johndoe' or '+33600000000').
{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

See:
  unsubscribe

{Integer} unsubscribe(configuration)
Unsubscribe.

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

Returns:
  {Integer} 0 if successful; otherwise nonzero

See:
  subscribe

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