Socket
Socket
Sign inDemoInstall

jssip

Package Overview
Dependencies
7
Maintainers
2
Versions
179
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.9.4 to 3.10.0

185

CHANGELOG.md
CHANGELOG
=========
### 3.10.0
* Fix typescript typings (#648).
* New UA config param 'extra_headers' (#774).
### 3.9.4
* Dialog/RequestSender: Avoid circular dependency (#788).

@@ -11,6 +16,4 @@ * Fixed REFER NOTIFY parsing in accordance to RFC 3515 section 2.4.5 (#767).

### 3.9.3
* UA: Add TS types for 'newOptions' event (closes #777).

@@ -21,3 +24,2 @@

* Dialog/RequestSender: Fix reference to undefined method (#787).

@@ -28,3 +30,2 @@

* Fix RTCSession 'confirmed' event type description (#770). Thanks @stefang42.

@@ -35,3 +36,2 @@

* Enable custom From-Header for outbound Message (#753). Thanks @gebsl.

@@ -42,3 +42,2 @@

* RTCSession: Fix for overlapping invites while refreshing session (PR #734). Credits to @makstheimba.

@@ -50,3 +49,2 @@

* RTCSession: allow SDP renegotiation before ICE gathering is completed. Credits to @markusatm.

@@ -57,3 +55,2 @@

* Add support for sending and responding to SIP OPTIONS. Credits to @simonlindberg.

@@ -64,3 +61,2 @@

* ReferSubscriber: fix, case sensitivity.

@@ -71,3 +67,2 @@

* RTCSession: allow overriding the Referred-By header on REFER. Credits to @jp1987.

@@ -78,3 +73,2 @@

* RTCSession: allow sending DTMFs if 1XX was received. Credits to @BlindChickens.

@@ -85,3 +79,2 @@

* Use a proper Logger class (fix from previous release)

@@ -92,3 +85,2 @@

* Use a proper Logger class.

@@ -99,3 +91,2 @@

* Registrator: Enhance Contact matching in Register 2XX reponse. Credits to @stefang42.

@@ -106,3 +97,2 @@

* WebSocketInterface: Fix values of UA.disconnected event (#701). Credits to @kkozlik.

@@ -113,3 +103,2 @@

* Support 2 bytes long UTF-8 chars in the SDP (#693). Credits to santa.lajos@gmail.com.

@@ -120,3 +109,2 @@

* RTCSession: close media stream even if session is in terminated (#683). Credits to @kkozlik.

@@ -127,3 +115,2 @@

* Enable custom From-Header for outbound calls (#677). Thanks @fabrykowski.

@@ -134,3 +121,2 @@

* Make authorization_jwt writable (#676). Thanks @fabrykowski.

@@ -141,3 +127,2 @@

* Add missing typescript definitions. Thanks @fabrykowski.

@@ -148,3 +133,2 @@

* RTCSession: Properly use RTCDtmf sender enqueue (#674). Thanks @ikq for reportig and testing.

@@ -155,3 +139,2 @@

* UA configuration option 'session_timers_force_refresher' (#671). Credits to @kkozlik.

@@ -162,3 +145,2 @@

* RTCsession: Fix, missing progress event for empty provisional responses. Credits to @stefang42.

@@ -169,3 +151,2 @@

* RTCSession: Fix, in dialog request processing error does not take the seesion into a failed state. Thanks @stefang42 for reportig.

@@ -175,3 +156,2 @@

* RTCSession: Fix, fire progress after setRemoteDescription. Credits to @wangduanduan.

@@ -181,3 +161,2 @@

* RTCSession: handle incoming BYE in WAITING_FOR_ANSWER state. #665. Credits to @karstenluedtke.

@@ -187,3 +166,2 @@

* Registrator: improve expires maths. Credits to Roman Shpount.

@@ -193,3 +171,2 @@

* Registrator: improve expires maths. Credits to Roman Shpount.

@@ -199,3 +176,2 @@

* JsSIP.d.ts: import and export in two steps. #651. Credits to @ashlanderDesign.

@@ -205,3 +181,2 @@

* Fix request cseq upon 491 response (#653). Credits to @mattdimeo.

@@ -212,3 +187,2 @@ * UA: Allow to change authorization_user (#652). Credits to @jose-lopes.

* RTCSession: force gather candidates when iceRestart is true (#641). Credits to @jose-lopes.

@@ -219,3 +193,2 @@ * Fix crash if the request does not have Content-Type header (#650). Credits to @hxl-dy

* Fix Via 'port' parser (#642).

@@ -225,3 +198,2 @@

* Export Socket interface (#637).

@@ -231,3 +203,2 @@

* Typescript typings (#627).

@@ -237,3 +208,2 @@

* Clone optional objects (#625). Credits to @acharlop.

@@ -244,3 +214,2 @@ * RTCSession: fix, allow initial INVITE no SDP/offer (#624). Credits to @mgoodenUK.

* Transactions: destroy transaction in Timer I after terminating. Thanks Juha Heinanen for reporting the issue.

@@ -250,3 +219,2 @@

* RTCSession: disable remote hold state when receiving an INVITE without SDP (#613). Credits to @RobyMcAndrew.

@@ -257,3 +225,2 @@

* RequestSender: fix Authorization header addition for jwt use.

@@ -264,3 +231,2 @@

* Add `authorization_jwt` configuration parameter (#610). Credits to @voicenter.

@@ -271,3 +237,2 @@

* RTCSession: don't relay on 'icecandidate' event with null candidate (#598). Thanks @skanizaj.

@@ -278,3 +243,2 @@

* RTCSession: honor BYE while in WAITING_FOR_ACK state (#597). Thanks @Egorikhin.

@@ -285,3 +249,2 @@

* Added NOTIFY to allowed methods (#593). Credits to @ikq.

@@ -292,3 +255,2 @@

* Move connection recovery defaults to Constants (#593). Credits to @KraftyKraft.

@@ -299,3 +261,2 @@

* Add referred-by header to refer messages (#572). Credits to @swysor.

@@ -306,3 +267,2 @@

* Fix NameAddrHeader `display_name` handling (#573). Credits to @nicketson.

@@ -313,3 +273,2 @@

* Add `.babelrc` into `.npmignore` (related to #489).

@@ -321,3 +280,2 @@ * Update deps.

* Add debugging logs in DigestAuthentication.js (related to #561).

@@ -329,3 +287,2 @@ * Update deps.

* Registrator: Don't check Contact header if final response is not 2XX (#558). Thanks @ikq for reporting.

@@ -337,3 +294,2 @@ * Update deps.

* Registrator. Support multiple entries in the same Contact header field (#544).

@@ -344,3 +300,2 @@

* RTCSession: fire 'sdp' event on renegotiation (#543).

@@ -351,3 +306,2 @@

* UA: new 'sipEvent' event for out of dialog NOTIFY requests.

@@ -358,3 +312,2 @@

* InviteClientTransaction: Add full route set to ACK and CANCEL requests. Thanks @nicketson.

@@ -366,3 +319,2 @@ * RTCSession: switch to tracks from deprecated stream API. Thanks @nicketson.

* Fix typos thanks to the [LGTM](https://lgtm.com/projects/g/versatica/JsSIP/alerts/?mode=list) project.

@@ -374,3 +326,2 @@ * Update deps.

* Remove `webrtc-adapter` dependency. It's up to the application developer whether to include it into his application or not.

@@ -382,3 +333,2 @@ * Update dependencies.

* Revert previous release. Requires a mayor version upgrade for such a cosmetic change.

@@ -389,3 +339,2 @@

* Close #521, #534. RTCSession: Fix 'connection' event order on outgoing calls.

@@ -396,3 +345,2 @@

* Update deps.

@@ -404,3 +352,2 @@ * Add missing `error` in 'getusermediafailed' event (thanks @jonastelzio).

* Close #519. Parser: Do not overwrite unknwon header fields. Thanks @rprinz08.

@@ -411,3 +358,2 @@

* Include the NPM **events** dependency for those who don't use **browserify** but **webpack**.

@@ -418,3 +364,2 @@

* RTCSession: Add Contact header to REFER request. Thanks Julien Royer for reporting.

@@ -425,3 +370,2 @@

* Fix #511. Add missing payload on 'UA:disconnected' event.

@@ -432,3 +376,2 @@

* Fix regression (#509): ua.call() not working if stream is given.

@@ -439,3 +382,2 @@

* RTCSession: custom local description trigger support

@@ -446,3 +388,2 @@

* RTCSession: prefer promises over callbacks for readability.

@@ -453,3 +394,2 @@

* Config: #494. Switch Socket check order. Thanks 'Igor Kolosov'.

@@ -460,3 +400,2 @@

* RTCSession: Fix #492. Add missing log line for RTCPeerConnection error.

@@ -467,3 +406,2 @@

* Remove wrong NPM dependencies.

@@ -474,3 +412,2 @@

* Fix parsing of NOTIFY bodies during a REFER transaction (fixes #493).

@@ -481,3 +418,2 @@

* Config: new configuration parameter 'user_agent'

@@ -490,3 +426,2 @@ * RTCSession/Info: Fix. Call session.sendRequest() with the correct parameters

* Fix #482 and cleanup Registrator.js

@@ -497,3 +432,2 @@

* Produce ES5 tree and expose it as main in package.json (related to #472)

@@ -505,3 +439,2 @@ * Fix #481. ReferSubscriber: properly access RTCSession non-public attributes

* RTCSession: emit 'sdp' event before creating offer/answer

@@ -512,3 +445,2 @@

* DigestAuthentication: fix 'auth-int' qop authentication

@@ -520,3 +452,2 @@ * DigestAuthentication: add tests

* New UA configuration parameter 'session_timers_refresh_method'. Thanks @michelepra

@@ -527,3 +458,2 @@

* Fix improper call to userMediaSucceeded. Thanks @iclems

@@ -534,3 +464,2 @@

* Registrator: add missing getter. Thanks Martin Ekblom.

@@ -541,3 +470,2 @@

* Fix #473. Typo. Thanks @ikq.

@@ -548,3 +476,2 @@

* Use promise chaining to prevent PeerConnection state race conditions. Thanks @davies147

@@ -555,3 +482,2 @@

* Fix #421. Fire RTCSession 'peerconnection' event as soon as its created

@@ -562,3 +488,2 @@

* Fix typo. Thanks @michelepra.

@@ -569,3 +494,2 @@

* Tests: enable test-UA-no-WebRTC tests.

@@ -578,3 +502,2 @@ * WebSocketInterface: uppercase the via_transport attribute.

* WebSocketInterface: Add 'via_transport' setter.

@@ -585,3 +508,2 @@

* Fix typo on ES6 transpiling.

@@ -592,3 +514,2 @@

* ES6 transpiling. Modernize full JsSIP code.

@@ -599,3 +520,2 @@

* Dialog: ACK to initial INVITE could have lower CSeq than current remote_cseq.

@@ -606,3 +526,2 @@

* RTCSession: process INFO in early state.

@@ -613,3 +532,2 @@

* Fix #457. Properly retrieve ReferSubscriber. Thanks @btaens.

@@ -620,3 +538,2 @@

* Fix #457. Support NOTIFY requests to REFER subscriptions without Event id parameter.

@@ -627,3 +544,2 @@

* Update dependencies.

@@ -634,3 +550,2 @@

* `Registrator`: Don't send a Register request if another is on progress. Thanks to Paul Grebenc.

@@ -641,3 +556,2 @@

* `UA`: Add `registrationExpiring` event (#442). Credits to @danjenkins.

@@ -648,3 +562,2 @@

* `RTCSession`: Emit "peerconnection" also for incoming calls.

@@ -655,3 +568,2 @@

* Emit SDP before new `RTCSessionDescription`. Thanks to @StarLeafRob.

@@ -662,3 +574,2 @@

* Generic SIP INFO support.

@@ -669,3 +580,2 @@

* Fix #431. Fix UA's `disconnect` event by properly providing an object with all the documente fields (thanks @nicketson for reporting it).

@@ -676,3 +586,2 @@

* Fix #428. Don't use `pranswer` for early media. Instead create an `answer` and do a workaround when the 200 arrives.

@@ -683,3 +592,2 @@

* Update deps.

@@ -691,3 +599,2 @@ * Add more debug logs into `RTCSession` class.

* Update deps.

@@ -699,3 +606,2 @@ * If ICE fails, terminate the session with status code 408.

* Fix #426. Properly emit DTMF events.

@@ -706,3 +612,2 @@

* Fix #418. Incorrect socket status on failure.

@@ -713,3 +618,2 @@

* Close #419. Allow sending the DTMF 'R' key. Used to report a hook flash.

@@ -720,3 +624,2 @@

* Remove `rtcninja` dependency. Instead use `webrtc-adapter`.

@@ -732,3 +635,2 @@ * `RTCSession:`: Remove `RTCPeerConnection` event wrappers. The app can access them via `session.connection`.

* Improve library logs.

@@ -739,3 +641,2 @@

* Update dependencies.

@@ -746,3 +647,2 @@

* Fix #400. Corrupt NPM packege.

@@ -753,3 +653,2 @@

* Fix #385. No CANCEL request sent for authenticated requests.

@@ -760,3 +659,2 @@

* Fix `gulp-header` dependency version.

@@ -767,3 +665,2 @@

* Export `JsSIP.WebSocketInterface`.

@@ -774,3 +671,2 @@

* New 'contact_uri' configuration parameter.

@@ -786,3 +682,2 @@ * Remove Node websocket dependency.

* Update dependencies.

@@ -793,3 +688,2 @@

* `RTCSession`: new event on('sdp') to allow SDP modifications.

@@ -800,3 +694,2 @@

* `RTCSession`: Allow multiple calls to `refer()` at the same time.

@@ -807,3 +700,2 @@

* `UA`: `set()` allows changing user's display name.

@@ -815,3 +707,2 @@ * Ignore SDP answer in received ACK retransmissions (fix [367](https://github.com/versatica/JsSIP/issues/367)).

* `RTCSession`: Also emit `peerconnection` event for incoming INVITE without SDP.

@@ -822,3 +713,2 @@

* `RTCSession/ReferSubscriber`: Fix typo that breaks exposed API.

@@ -829,3 +719,2 @@

* `RTCSession`: Make `refer()` method to return the corresponding instance of `ReferSubscriber` so the app can set and manage as many events as desired on it.

@@ -836,3 +725,2 @@

* Add INFO method to allowed methods list

@@ -844,3 +732,2 @@ * Add SIP Code 424 RFC 6442

* Apply changes of 0.7.16 also to browserified files under `dist/` folder.

@@ -851,3 +738,2 @@

* Fix [337](https://github.com/versatica/JsSIP/issues/337). Consistenly indicate registration status through events.

@@ -858,3 +744,2 @@

* Emit UA 'connected' event before sending REGISTER on transport connection

@@ -866,3 +751,2 @@ * Fix [355](https://github.com/versatica/JsSIP/pull/355 ). call to non existent `parsed.error` function. Thanks Stéphane Alnet @shimaore

* Fix sips URI scheme parsing rule.

@@ -873,3 +757,2 @@

* Fix. Don't lowercase URI parameter values. Thanks to Alexandr Dubovikov @adubovikov

@@ -880,3 +763,2 @@

* Accept new `UA` configuration parameters `ha1` and `realm` to avoid plain SIP password handling ([issue 353](https://github.com/versatica/JsSIP/issues/353)).

@@ -888,3 +770,2 @@ * New `UA.set()` and `UA.get()` methods to set and retrieve computed configuration parameters in runtime.

* Fix typo ("iceconnetionstatechange" => "iceconnectionstatechange"). Thanks to Vertika Srivastava.

@@ -895,3 +776,2 @@

* Make `gulp` run on Node 4.0.X and 5.0.X.

@@ -902,3 +782,2 @@

* `UA`: Add `set(parameter, value)` method to change a configuration setting in runtime (currently just "password" is implemented).

@@ -909,3 +788,2 @@

* `RTCSession`: Add `resetLocalMedia()` method to reset the session local MediaStream by enabling both its audio and video tracks (unless the remote peer is on hold).

@@ -916,3 +794,2 @@

* `RTCSession`: Add "sending" event to outgoing, a good chance for the app to mangle the INVITE or its SDP offer.

@@ -923,3 +800,2 @@

* Update dependencies.

@@ -931,3 +807,2 @@ * Improve gulpfile.js.

* Don't ask for `getUserMedia` in `RTCSession.answer()` if no `mediaConstraints` are provided.

@@ -938,3 +813,2 @@

* Allow rejecting an in-dialog INVITE or UPDATE message.

@@ -945,3 +819,2 @@

* FIX properly restart UA if start() is called while closing.

@@ -952,3 +825,2 @@

* Update dependencies.

@@ -959,3 +831,2 @@

* Update dependencies.

@@ -966,3 +837,2 @@

* Add REFER support.

@@ -973,3 +843,2 @@

* Don't keep URI params&headers in the registrar server URI.

@@ -981,3 +850,2 @@ * `RTCSession` emits `peerconnection` for outgoing calls once the `RTCPeerConnection` is created and before the SDP offer is generated (good chance to create a `RTCDataChannel` without requiring renegotiation).

* Add callback to `update` and `reinvite` events.

@@ -988,3 +856,2 @@

* Added a parser for Reason header.

@@ -995,3 +862,2 @@

* Fix array iteration in `URI#toString()` to avoid Array prototype mangling by devil libraries such as Ember.

@@ -1002,3 +868,2 @@

* Auto-register on transport connection before emitting the event.

@@ -1009,3 +874,2 @@

* Update "rtcninja" dependencie.

@@ -1016,3 +880,2 @@

* Don't terminate SIP dialog if processing of 183 with SDP fails.

@@ -1024,3 +887,2 @@ * Update dependencies.

* Update "rtcninja" dependency.

@@ -1031,3 +893,2 @@

* Update "rtcninja" dependency.

@@ -1038,3 +899,2 @@

* RTCSession: Fix Invite Server transaction destruction.

@@ -1045,3 +905,2 @@

* RTCSession: Handle session timers before emitting "accepted".

@@ -1053,3 +912,2 @@ * Fix issue with latest version of browserify.

* Fix double "disconnected" event in some cases.

@@ -1060,3 +918,2 @@

* Don't iterate arrays with (for...in) to avoid problems with evil JS libraries that add stuff into the Array prototype.

@@ -1067,3 +924,2 @@

* Be more flexible receiving DTMF INFO bodies.

@@ -1074,3 +930,2 @@

* Update dependencies.

@@ -1081,3 +936,2 @@

* Terminate the call with a proper BYE/CANCEL/408/500 if request timeout, transport error or dialog error happens.

@@ -1089,3 +943,2 @@ * Fix "rtcninja" dependency problem.

* `RTCSession`: Improve `isReadyToReOffer()`.

@@ -1096,3 +949,2 @@

* `RTCSession`: Avoid calling hold()/unhold/renegotiate() if an outgoing renegotiation is not yet finished (return false).

@@ -1105,3 +957,2 @@ * `RTCSession`: Add `options` and `done` arguments to hold()/unhold/renegotiate().

* `RTCSession:` Emit `iceconnetionstatechange` event.

@@ -1113,3 +964,2 @@ * Update "rtcninja" dependency to 0.4.0.

* `RTCSession:` Include initially given `rtcOfferConstraints` in `sendReinvite()` and `sendUpdate()`.

@@ -1120,3 +970,2 @@

* Properly keep mute local audio/video if remote is on hold, and keep it even if we re-offer. Also fix SDP direction attributes in re-offers according to current local and remote "hold" status.

@@ -1127,3 +976,2 @@

* Update "rtcninja" dependency to 0.3.3.

@@ -1134,3 +982,2 @@

* Fix "Session-Expires" default value to 90 seconds.

@@ -1141,3 +988,2 @@

* Update "rtcninja" dependency to 0.3.2.

@@ -1148,3 +994,2 @@

* Don't reply 405 "Method Not Supported" to re-INVITE even if the UA's "newRTCSession" event is not set.

@@ -1156,3 +1001,2 @@ * `RTCSession`: Allow extraHeaders in `renegotiate()`.

* `RTCSession`: Don't ask for `getUserMedia()` in outgoing calls if `mediaConstraints` is `{audio:false, video:false}`. It is user's responsability to, in that case, provide `offerToReceiveAudio/Video` in `rtcOfferConstraints`.

@@ -1163,3 +1007,2 @@

* ' UA.call()': Return the `RTCSession` instance.

@@ -1171,3 +1014,2 @@ * ' UA.sendMessage()': Return the `Message` instance.

* `RTCSession`: Don't process SDPs in retranmissions of 200 OK during reINVITE/UDATE.

@@ -1180,3 +1022,2 @@ * `RTCSession`: Emit 'reinvite' when a reINVITE is received.

* `RTCSession`: Don't override `this.data` on `answer()` (unless `options.data` is given).

@@ -1187,3 +1028,2 @@

* `RTCSession#connect()`: Add `rtcAnswerContraints` options for later incoming reINVITE or UPDATE with SDP offer.

@@ -1197,3 +1037,2 @@ * `RTCSession#answer()`: Add `rtcOfferConstraints` options for later incoming reINVITE without SDP offer.

* Bug fix. Properly cancel when only '100 trying' has been received.

@@ -1204,3 +1043,2 @@

* Bug fix: Do not set "Content-Type: application/sdp" in body-less UPDATE requests.

@@ -1211,3 +1049,2 @@

* Support for [Session Timers](https://tools.ietf.org/html/rfc4028).

@@ -1218,3 +1055,2 @@

* [debug](https://github.com/visionmedia/debug) module.

@@ -1229,3 +1065,2 @@ * [rtcninja](https://github.com/ibc/rtcninja.js) module.

* JsSIP runs in Node!

@@ -1236,3 +1071,2 @@ * The internal design of JsSIP has also been modified, becoming a real Node project in which the "browser version" (`jssip-0.5.0.js` or `jssip-0.5.0.min.js`) is generated with [browserify](http://browserify.org). This also means that the browser version can be loaded with AMD or CommonJS loaders.

* [(3b1ee11)](https://github.com/versatica/JsSIP/commit/3b1ee11) Fix references to 'this'.

@@ -1243,3 +1077,2 @@

* [(ca7702e)](https://github.com/versatica/JsSIP/commit/ca7702e) Fix #257. RTCMediaHandler: fire onIceCompleted() on next tick to avoid events race conditions in Firefox 33.

@@ -1249,3 +1082,2 @@

* This version is included into the [Bower](https://bower.io/) registry which means `$ bower install jssip`.

@@ -1256,3 +1088,2 @@

* (https://jssip.net/documentation/0.4.x/api/session) Hold/Unhold implementation

@@ -1295,3 +1126,2 @@ * (https://jssip.net/documentation/0.4.x/api/session) Mute/Unmute implementation

### 0.3.0
-------------------------------

@@ -1376,3 +1206,2 @@ * [(fea1326)](https://github.com/versatica/JsSIP/commit/fea1326) Don't validate configuration.password against SIP URI password BNF grammar (fix #74).

* [(24e32c0)](https://github.com/versatica/JsSIP/commit/24e32c0d16ff5fcefd2319fc445a59d6fc2bcb59) UA configuration `password` parameter is now optional.

@@ -1391,3 +1220,2 @@ * [(ffe7af6)](https://github.com/versatica/JsSIP/commit/ffe7af6276915695af9fd00db281af51fec2714f) Bug fix: UA configuration `display_name` parameter.

* First stable release with full website and documentation.

@@ -1399,4 +1227,3 @@ * Refactored sessions, message and events API.

* First release. No documentation.

28

lib-es5/Config.js

@@ -50,2 +50,4 @@ "use strict";

connection_recovery_min_interval: JsSIP_C.CONNECTION_RECOVERY_MIN_INTERVAL,
// Global extra headers, to be added to every request and response
extra_headers: null,

@@ -246,2 +248,28 @@ /*

}
},
extra_headers: function extra_headers(_extra_headers) {
var _extraHeaders = [];
if (Array.isArray(_extra_headers) && _extra_headers.length) {
var _iterator2 = _createForOfIteratorHelper(_extra_headers),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var header = _step2.value;
if (typeof header === 'string') {
_extraHeaders.push(header);
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
} else {
return;
}
return _extraHeaders;
}

@@ -248,0 +276,0 @@ }

@@ -70,5 +70,10 @@ "use strict";

this.body = body;
this.extraHeaders = Utils.cloneArray(extraHeaders); // Fill the Common SIP Request Headers.
this.extraHeaders = Utils.cloneArray(extraHeaders);
if (this.ua.configuration.extra_headers) {
this.extraHeaders = this.extraHeaders.concat(this.ua.configuration.extra_headers);
} // Fill the Common SIP Request Headers.
// Route.
if (params.route_set) {

@@ -664,2 +669,7 @@ this.setHeader('route', params.route_set);

extraHeaders = Utils.cloneArray(extraHeaders);
if (this.ua.configuration.extra_headers) {
extraHeaders = extraHeaders.concat(this.ua.configuration.extra_headers);
}
var response = "SIP/2.0 ".concat(code, " ").concat(reason, "\r\n");

@@ -824,2 +834,19 @@

response += "CSeq: ".concat(this.cseq, " ").concat(this.method, "\r\n");
if (this.ua.configuration.extra_headers) {
var _iterator12 = _createForOfIteratorHelper(this.ua.configuration.extra_headers),
_step12;
try {
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
var header = _step12.value;
response += "".concat(header.trim(), "\r\n");
}
} catch (err) {
_iterator12.e(err);
} finally {
_iterator12.f();
}
}
response += "Content-Length: ".concat(0, "\r\n\r\n");

@@ -826,0 +853,0 @@ this.transport.send(response);

@@ -44,2 +44,5 @@ const Utils = require('./Utils');

// Global extra headers, to be added to every request and response
extra_headers : null,
/*

@@ -312,2 +315,24 @@ * Host address.

}
},
extra_headers(extra_headers)
{
const _extraHeaders = [];
if (Array.isArray(extra_headers) && extra_headers.length)
{
for (const header of extra_headers)
{
if (typeof header === 'string')
{
_extraHeaders.push(header);
}
}
}
else
{
return;
}
return _extraHeaders;
}

@@ -314,0 +339,0 @@ }

@@ -5,3 +5,3 @@ export const USER_AGENT: string

export enum causes {
export declare enum causes {
CONNECTION_ERROR = 'Connection Error',

@@ -55,3 +55,3 @@ REQUEST_TIMEOUT = 'Request Timeout',

export enum DTMF_TRANSPORT {
export declare enum DTMF_TRANSPORT {
INFO = 'INFO',

@@ -58,0 +58,0 @@ RFC2833 = 'RFC2833',

@@ -1,2 +0,1 @@

/// <reference types="node" />
import {EventEmitter} from 'events'

@@ -3,0 +2,0 @@

@@ -1,3 +0,2 @@

/// <reference types="node" />
import {EventEmitter} from 'events'
import {EventEmitter, Listener} from 'events'

@@ -17,3 +16,3 @@ import {IncomingRequest, IncomingResponse, OutgoingRequest} from './SIPMessage'

export enum SessionDirection {
export declare enum SessionDirection {
INCOMING = 'incoming',

@@ -23,3 +22,3 @@ OUTGOING = 'outgoing',

export enum Originator {
export declare enum Originator {
LOCAL = 'local',

@@ -183,3 +182,2 @@ REMOTE = 'remote',

// listener
export type AnyListener = (...args: any[]) => void;
export type PeerConnectionListener = (event: PeerConnectionEvent) => void;

@@ -230,7 +228,7 @@ export type ConnectingListener = (event: ConnectingEvent) => void;

'icecandidate': IceCandidateListener;
'getusermediafailed': AnyListener;
'peerconnection:createofferfailed': AnyListener;
'peerconnection:createanswerfailed': AnyListener;
'peerconnection:setlocaldescriptionfailed': AnyListener;
'peerconnection:setremotedescriptionfailed': AnyListener;
'getusermediafailed': Listener;
'peerconnection:createofferfailed': Listener;
'peerconnection:createanswerfailed': Listener;
'peerconnection:setlocaldescriptionfailed': Listener;
'peerconnection:setremotedescriptionfailed': Listener;
}

@@ -237,0 +235,0 @@

@@ -39,2 +39,7 @@ const sdp_transform = require('sdp-transform');

if (this.ua.configuration.extra_headers)
{
this.extraHeaders = this.extraHeaders.concat(this.ua.configuration.extra_headers);
}
// Fill the Common SIP Request Headers.

@@ -601,2 +606,7 @@

if (this.ua.configuration.extra_headers)
{
extraHeaders = extraHeaders.concat(this.ua.configuration.extra_headers);
}
let response = `SIP/2.0 ${code} ${reason}\r\n`;

@@ -744,2 +754,11 @@

response += `CSeq: ${this.cseq} ${this.method}\r\n`;
if (this.ua.configuration.extra_headers)
{
for (const header of this.ua.configuration.extra_headers)
{
response += `${header.trim()}\r\n`;
}
}
response += `Content-Length: ${0}\r\n\r\n`;

@@ -746,0 +765,0 @@

@@ -1,6 +0,5 @@

/// <reference types="node" />
import {EventEmitter} from 'events'
import {EventEmitter, Listener} from 'events'
import {DisconnectEvent, Socket, WeightedSocket} from './WebSocketInterface'
import {AnswerOptions, AnyListener, Originator, RTCSession, RTCSessionEventMap, TerminateOptions} from './RTCSession'
import {AnswerOptions, Originator, RTCSession, RTCSessionEventMap, TerminateOptions} from './RTCSession'
import {IncomingRequest, IncomingResponse, OutgoingRequest} from './SIPMessage'

@@ -47,2 +46,3 @@ import {Message, SendMessageOptions} from './Message'

user_agent?: string;
extra_headers?: string[];
}

@@ -128,3 +128,3 @@

registrationFailed: RegistrationFailedListener;
registrationExpiring: AnyListener;
registrationExpiring: Listener;
newRTCSession: RTCSessionListener;

@@ -131,0 +131,0 @@ newMessage: MessageListener;

@@ -5,3 +5,3 @@ {

"description": "the Javascript SIP library",
"version": "3.9.4",
"version": "3.10.0",
"homepage": "https://jssip.net",

@@ -31,4 +31,4 @@ "contributors": [

"dependencies": {
"@types/events": "^3.0.0",
"@types/debug": "^4.1.7",
"@types/node": "^18.11.7",
"debug": "^4.3.1",

@@ -35,0 +35,0 @@ "events": "^3.3.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc