From 32d74fff6214e277321b7200515c4de87daea947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Kozl=C3=ADk?= Date: Tue, 29 Nov 2022 15:54:35 +0100 Subject: [PATCH 1/2] Allow to not send `Expires` header in REGISTER request --- lib/Config.js | 2 +- lib/Registrator.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Config.js b/lib/Config.js index 67ae638a8..dafb3a5d9 100644 --- a/lib/Config.js +++ b/lib/Config.js @@ -275,7 +275,7 @@ const checks = { { const value = Number(register_expires); - if (value > 0) + if (value >= 0) { return value; } diff --git a/lib/Registrator.js b/lib/Registrator.js index 2c889741e..304231483 100644 --- a/lib/Registrator.js +++ b/lib/Registrator.js @@ -49,7 +49,7 @@ module.exports = class Registrator // Contents of the sip.instance Contact header parameter. this._sipInstance = `""`; - + this._contact += `;reg-id=${this._reg_id}`; this._contact += `;+sip.instance=${this._sipInstance}`; } @@ -107,7 +107,7 @@ module.exports = class Registrator extraHeaders.push(`Contact: \ ${this._contact};expires=${this._expires}${this._extraContactParams}`); - extraHeaders.push(`Expires: ${this._expires}`); + if (this._expires) extraHeaders.push(`Expires: ${this._expires}`); const request = new SIPMessage.OutgoingRequest( JsSIP_C.REGISTER, this._registrar, this._ua, { From 76422bc25cad8fc2b91df12eec367494fb2eb4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Kozl=C3=ADk?= Date: Wed, 30 Nov 2022 09:44:14 +0100 Subject: [PATCH 2/2] Remove expires also from contact --- lib/Registrator.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Registrator.js b/lib/Registrator.js index 304231483..564969142 100644 --- a/lib/Registrator.js +++ b/lib/Registrator.js @@ -104,9 +104,10 @@ module.exports = class Registrator } const extraHeaders = this._extraHeaders.slice(); + let contactValue = `${this._contact}${this._extraContactParams}`; - extraHeaders.push(`Contact: \ -${this._contact};expires=${this._expires}${this._extraContactParams}`); + if (this._expires) contactValue = `${this._contact};expires=${this._expires}${this._extraContactParams}`; + extraHeaders.push(`Contact: ${contactValue}`); if (this._expires) extraHeaders.push(`Expires: ${this._expires}`); const request = new SIPMessage.OutgoingRequest(