UA Configuration Parameters

JsSIP.UA requires a configuration object with mandatory and optional parameters. Example:

var socket = new JsSIP.WebSocketInterface(ws://sip-ws.example.com);

var configuration = {
  sockets  : [ socket ],
  uri      : 'sip:alice@example.com',
  password : 'superpassword'
};

var ua = new JsSIP.UA(configuration);

Full list of configuration parameters below:

Mandatory parameters

uri

SIP URI associated to the User Agent (String). This is a SIP address given to you by your provider.

uri: "sip:alice@example.com"

sockets

Set of JsSIP.Socket instances. This parameter can be expressed in multiple ways:

  • Single JsSIP.Socket instance.
  • Array of JsSIP.Socket instances.
  • Array of Objects defining a JsSIP.Socket instance with weight. Sockets with higher weight value are used prior to those with lower value.
sockets: socket
sockets: [
  socket1,
  socket2,
]
sockets: [
  {socket: socket1, weight: 10},
  {socket: socket2, weight: 1}
]

Optional parameters

authorization_jwt

JWT token (String) to use as authentication credential. If defined, every outgoing SIP request will contain a Authorization header using the Bearer scheme and the given value.

authorization_jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"

authorization_user

Username (String) to use when generating authentication credentials. If not defined the value in uri parameter is used.

authorization_user: "alice123"

connection_recovery_max_interval

Maximum interval (Number) in seconds between WebSocket reconnection attemps. Default value is 30.

connection_recovery_max_interval: 60

connection_recovery_min_interval

Minimum interval (Number) in seconds between WebSocket reconnection attempts. Default value is 2.

connection_recovery_min_interval: 4

contact_uri

String indicating the contact URI to be used in the Contact header field. The given URI host will be used as the Via header host parameter.

display_name

Descriptive name (String) to be shown to the called party when calling or sending IM messages. It must NOT be enclosed between double quotes even if the given name contains multi-byte symbols (JsSIP will always enclose the display_name value between double quotes).

display_name: "Alice ¶€ĸøĸø"

extra_headers

Array of custom SIP headers that will be added to every request and response.

extra_headers: [ "Foo: ABC", "Bar: XYZ" ]

instance_id

String indicating the UUID URI to be used as instance ID to identify the UA instance when using GRUU.

instance_id: "uuid:8f1fa16a-1165-4a96-8341-785b1ef24f12"
instance_id: "8f1fa16a-1165-4a96-8341-785b1ef24f12"

no_answer_timeout

Time (in seconds) (Integer) after which an incoming call is rejected if not answered. Default value is 60.

no_answer_timeout: 120

session_timers

Enable Session Timers (as per RFC 4028). Default value is true.

session_timers: false

session_timers_refresh_method

SIP method (String) to use for Session Timers refresh. Valid values are UPDATE or INVITE. Default value is UPDATE.

session_timers_refresh_method: 'invite'

session_timers_force_refresher

Whether JsSIP shall force to be refresher of session timers for outgoing calls.
When this is enabled JsSIP adds the “refresher=uac” parameter to the Session-Expires header in the initial INVITE.
Default value is false.

session_timers_force_refresher: true

password

SIP Authentication password (String).

The plain SIP password. JsSIP deletes this value from its internal memory after the first successful authentication and, instead, stores the resulting ha1 and realm.

password: "1234"

realm

SIP Authentication realm (String).

Just useful if plain SIP password is not given, so it also requires ha1 to be provided.

realm: "mydomain.com"

NOTE for Asterisk users: Asterisk always uses “asterisk” as realm.

ha1

SIP Authentication HA1 hash (String) for the Digest authentication.

If given (and plain SIP password is not given) the parameter realm is also required. Otherwise authentication is not feasible.

ha1: "270fe19ce3890bd85e105998b0a75cf0"

register

Indicate if JsSIP User Agent should register automatically when starting. Valid values are true and false (Boolean). Default value is true.

register: false

register_expires

Registration expiry time (in seconds) (Integer). Default value is 600.

register_expires: 300

registrar_server

Set the SIP registrar URI. Valid value is a SIP URI without username. Default value is null which means that the registrar URI is taken from the uri parameter (by removing the username).

registrar_server: 'sip:registrar.mydomain.com'

use_preloaded_route

If set to true every SIP initial request sent by JsSIP includes a Route header with the SIP URI associated to the WebSocket server as value. Some SIP Outbound Proxies require such a header. Valid values are true and false (Boolean). Default value is false.

user_agent

User-Agent header field value (String) present in SIP messages. By default “JsSIP” followed by the code version is set.