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

Extends SIPml.EventTarget.
Defined in: SIPml.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| SIPml.Stack(configuration) This is the root object used by any other object to make/receive calls, messages or manage presence.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| newSession(type, configuration) Create new SIP session.
| setConfiguration(configuration) Updates configuration values.
| start() Starts the SIP stack and connect the network transport to the WebSocket server without sending any SIP request.
| stop(timeout) Stops the SIP stack and disconnect the network transport from the WebSocket server.

Methods borrowed from class SIPml.EventTarget:
  addEventListener, removeEventListener

Class Detail
SIPml.Stack(configuration)
This is the root object used by any other object to make/receive calls, messages or manage presence. You have to create an instance of this class before anything else.

    var listenerFunc = function(e){
        console.info('stack event = ' + e.type);
        // Please check this link for more information on all supported events.
    }

    var o_stack = new SIPml.Stack({
            realm: 'example.org',
            impi: 'bob',
            impu: 'sip:bob@example.org',
            password: 'mysecret', // optional
            display_name: 'I Am Legend', // optional
            websocket_proxy_url: 'ws://192.168.0.10:5060', // optional
            outbound_proxy_url: 'udp://192.168.0.12:5060', // optional
            ice_servers: [{ url: 'stun:stun.l.google.com:19302'}, { url:'turn:user@numb.viagenie.ca', credential:'myPassword'}], // optional
            bandwidth: { audio:64, video:512 }, // optional
            video_size: { minWidth:640, minHeight:480, maxWidth:1920, maxHeight:1080 }, // optional
            enable_rtcweb_breaker: true, // optional
            enable_click2call: false, // optional
            events_listener: { events: '*', listener: listenerFunc }, //optional
            sip_headers: [ //optional
                {name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.0.89.0'},
                {name: 'Organization', value: 'Doubango Telecom'}
            ]
        }
    );

Parameters:
{SIPml.Stack.Configuration} configuration
  Configuration object. Could be updated later using setConfiguration.

Throws:
{ERR_INVALID_PARAMETER_VALUE|ERR_INVALID_PARAMETER_TYPE}
  ERR_INVALID_PARAMETER_VALUE | ERR_INVALID_PARAMETER_TYPE

See:
  setConfiguration

Method Detail
{SIPml.Session} newSession(type, configuration)
Create new SIP session.

    var o_registration = this.newSession('register', {
                expires: 200,
                sip_caps: [
                        {name: '+g.oma.sip-im'},
                        {name: '+audio'},
                        {name: 'language', value: '\"en,fr\"'}
                ],
                sip_headers: [
                        {name: 'What', value: 'Registration', session: false},
                        {name: 'Organization', value: 'Doubango Telecom', session: true}
                ]
            });
    o_registration.register();

    // or
    var o_audiovideo = this.newSession('call-audiovideo', {
                video_local: document.getElementById('video_local'), // <video id="video_local" .../>
                video_remote: document.getElementById('video_remote'), // <video id="video_remote" .../>
                audio_remote: document.getElementById('audio_remote'), // <audio id="audio_remote" .../>
                sip_caps: [
                        {name: '+g.oma.sip-im'},
                        {name: '+sip.ice'},
                        {name: 'language', value: '\"en,fr\"'}
                ],
                sip_headers: [
                        {name: 'What', value: 'Audio/Video call', session: false},
                        {name: 'Organization', value: 'Doubango Telecom', session: false}
                ]
            });
    o_audiovideo.call('alice'); // call alice

Parameters:
{String} type
  Session type. Supported values: 'register', 'call-audio', 'call-audiovideo', 'call-video', 'call-screenshare', 'message', 'subscribe' or 'publish'.
{SIPml.Session.Configuration} configuration Optional
  Anonymous object used to configure the newly created session.

Throws:
{ERR_INVALID_PARAMETER_VALUE}
  ERR_INVALID_PARAMETER_VALUE

Returns:
  {SIPml.Session} New session if successful; otherwise null.
  The session type would be SIPml.Session.Registration, SIPml.Session.Call or SIPml.Session.Message

{Integer} setConfiguration(configuration)
Updates configuration values.

    // add two new headers and change the proxy_url
    o_stack.setConfiguration({
        proxy_url: 'ws://192.168.0.10:5060',
        sip_headers: [
                {name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.0.89.0'},
                {name: 'Organization', value: 'Doubango Telecom'}
            ]
        }
    );

Parameters:
{SIPml.Stack.Configuration} configuration
  Configuration object value.

Returns:
  {Integer} 0 if successful; otherwise nonzero

{Integer} start()
Starts the SIP stack and connect the network transport to the WebSocket server without sending any SIP request. This function must be be called before any attempt to make or receive calls/messages. This function is asynchronous which means that the stack will not be immediately started after the call. Please check this link for more information on all supported events.

Throws:
{ERR_INVALID_STATE}
  ERR_INVALID_STATE

Returns:
  {Integer} 0 if successful; otherwise nonzero

{Integer} stop(timeout)
Stops the SIP stack and disconnect the network transport from the WebSocket server. This function will also hangup all calls and unregister the user from the SIP server. Please check this link for more information on all supported events.

Parameters:
{Integer} timeout Optional
  Optional parameter used to defined maximum time in milliseconds to take to stop the stack. Default value: 2000 millis

Throws:
{ERR_INVALID_STATE}
  ERR_INVALID_STATE

Returns:
  {Integer} 0 if successful; otherwise nonzero

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