JsSIP.Socket
interface for Node.js based on the websocket module.
The aim of this module is to provide JsSIP with WebSocket support when running in Node.js.
$ npm install jssip-node-websocket --save
- jssip >=
v2.0.0
- Node.js >=
v4.0.0
<v20.0.0
Since Node v20.0.0
the API for parsing URL has changed. To be compatible with Node v20.0.0
and previous versions you can use the following package:
const JsSIP = require('jssip');
const NodeWebSocket = require('jssip-node-websocket');
let socket = new NodeWebSocket('wss://foo.example.com');
let ua = new JsSIP.UA(
{
uri : 'sip:[email protected]',
password : 'xxxxxxxx',
display_name : 'Alice',
sockets : [ socket ]
});
The module exports a NodeWebSocket
class conforming with the JsSIP.Socket
interface.
url
(String): The WebSocket URL.options
(Object): An object with fieldsorigin
,headers
,requestOptions
andclientConfig
matching the same meaning and format of the parameters given to the websocket.W3CWebSocket class constructor.
var socket = new Socket('wss://foo.example.com',
{
origin : 'https://www.example.com',
requestOptions :
{
agent : new https.Agent({ rejectUnauthorized: false })
}
});
Iñaki Baz Castillo (@ibc at Github)