UA Configuration Parameters
JsSIP.UA
requires a configuration object with mandatory and optional parameters. Example:
var configuration = {
'ws_servers': 'ws://sip-ws.example.com',
'uri': 'sip:alice@example.com',
'password': 'superpassword'
};
var coolPhone = new JsSIP.UA(configuration);
Full list of configuration parameters below:
- Mandatory Parameters
- Optional Parameters
- authorization_user
- connection_recovery_max_interval
- connection_recovery_min_interval
- display_name
- hack_ip_in_contact
- hack_via_tcp
- hack_via_ws
- instance_id
- no_answer_timeout
- session_timers NEW in 0.6.x
- node_websocket_options
- password
- register
- register_expires
- registrar_server
- use_preloaded_route
- node_websocket_options NEW in 0.6.x
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"
ws_servers
Set of WebSocket URIs to connect to. If not specified ports 80 and 443 are taken for non secure WebSocket connections and connections over SSL/TLS, respectively. This parameter can be expressed in multiple ways:
- Single
String
to define a single WebSocket URI. Array
ofStrings
to define multiple WebSocket URIs.Array
ofObjects
to define multiple WebSocket URIs with weight. URIs with higher weight value are used prior to those with lower value.
ws_servers: "ws://sip-ws.example.com"
ws_servers: "wss://sip-ws.example.com:8443/sip?KEY=1234"
ws_servers: [
"ws://sip-ws-1.example.com",
"ws://sip-ws-2.example.com",
]
ws_servers: [
{ws_uri: "ws://sip-ws-1.example.com", weight: 10},
{ws_uri: "ws://sip-ws-2.example.com", weight: 1}
]
Optional parameters
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
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 ¶€ĸøĸø"
hack_ip_in_contact
Set a random IP address as the host value in the Contact header field and Via sent-by parameter. Useful for SIP registrars not allowing domain names in the Contact URI. Valid values are true
and false
(Boolean
). Default value is a false
.
hack_ip_in_contact: true
hack_via_tcp
Set Via transport parameter in outgoing SIP requests to “TCP”. Useful when traversing SIP nodes that are not ready to parse Via headers with “WS” or “WSS” value in a Via header. Valid values are true
and false
(Boolean
). Default value is false
.
hack_via_tcp: true
hack_via_ws
When connecting to a secure WebSocket server (“wss://”) force “WS” as Via transport value instead of “WSS”. Useful when traversing HTTP/WebSocket proxies that act as TLS tunnels. Valid values are true
and false
(Boolean
). Default value is false
.
hack_via_ws: true
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
node_websocket_options
An (Object
) with options for the Node websocket
module (the W3CWebSocket
constructor). Valid keys are origin
, headers
, requestOptions
and clientConfig
.
This parameter is just used when running JsSIP in Node.
node_websocket_options: {
origin: "http://myweb.com",
}
password
SIP Authentication password (String
).
password: "1234"
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
.
ws_servers: "ws://example.org/sip-ws"
use_preloaded_route: true
The Route header will look like Route: <sip:example.org;lr;transport=ws>
ws_servers: "wss://example.org:8443"
use_preloaded_route: true
The Route header will look like Route: <sip:example.org:8443;lr;transport=ws>
node_websocket_options
When running in Node, JsSIP uses the Node websocket library as WebSocket client. node_websocket_options
is an Object
with the following fields:
origin
headers
requestOptions
clientConfig
Those fields match the same meaning and format of the same paramters given to the websocket.W3CWebSocket class constructor.