From a7d6cf5a314b99c0ac358d20c3d5bbe3906a8598 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:34:54 +0700 Subject: [PATCH] support referby with display name (#186) * support referby with display name * update siprec client utils --- lib/call-session.js | 8 +++----- package-lock.json | 15 ++++++++------- package.json | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/call-session.js b/lib/call-session.js index 04b131e..6ddd567 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -998,9 +998,7 @@ Duration=${payload.duration} ` if (!arr) { /* call transfer requested */ const {gateway} = this.req.locals; - const referredBy = req.getParsedHeader('Referred-By'); - if (!referredBy) return res.send(400); - const u = parseUri(referredBy.uri); + if (!req.has('Referred-By')) return res.send(400); const leaveReferToAlone = req.has('X-Refer-To-Leave-Untouched'); if (leaveReferToAlone) { this.logger.debug({referTo}, 'passing Refer-To header through untouched'); @@ -1030,7 +1028,7 @@ Duration=${payload.duration} ` // eslint-disable-next-line no-unused-vars const {via, from, to, 'call-id':callid, cseq, 'max-forwards':maxforwards, // eslint-disable-next-line no-unused-vars - 'content-length':contentlength, 'refer-to':_referto, 'referred-by':_referredby, + 'content-length':contentlength, 'refer-to':_referto, 'referred-by': referredby, // eslint-disable-next-line no-unused-vars 'X-Refer-To-Leave-Untouched': _leave, ...customHeaders @@ -1040,7 +1038,7 @@ Duration=${payload.duration} ` method: 'REFER', headers: { 'Refer-To': `<${stringifyUri(uri)}>`, - 'Referred-By': `<${stringifyUri(u)}>`, + 'Referred-By': referredby, ...customHeaders } }); diff --git a/package-lock.json b/package-lock.json index 2b504fa..9b8e604 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@jambonz/http-health-check": "^0.0.1", "@jambonz/realtimedb-helpers": "^0.8.8", "@jambonz/rtpengine-utils": "^0.4.4", - "@jambonz/siprec-client-utils": "^0.2.7", + "@jambonz/siprec-client-utils": "^0.2.9", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.10", "bent": "^7.3.12", @@ -1463,9 +1463,10 @@ } }, "node_modules/@jambonz/siprec-client-utils": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/@jambonz/siprec-client-utils/-/siprec-client-utils-0.2.7.tgz", - "integrity": "sha512-VztOToBfXnOphg/y6kO+lBYqoDH7X5Ci0daXT5zQ8v5NnaZw+UwxGeFPX3knIR3r5pmzUld0f2giFOuD4ZOF8w==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@jambonz/siprec-client-utils/-/siprec-client-utils-0.2.9.tgz", + "integrity": "sha512-C/1UOrAvQVG0iwiSMS0MC9VHRjhg3/sOjNna+eEjHjws1SHl8NrKBoDL8uOwLqOM2ccpbqCPH9GJAxo5OnOhww==", + "license": "MIT", "dependencies": { "sdp-transform": "^2.14.1", "uuid": "^8.3.2" @@ -7955,9 +7956,9 @@ } }, "@jambonz/siprec-client-utils": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/@jambonz/siprec-client-utils/-/siprec-client-utils-0.2.7.tgz", - "integrity": "sha512-VztOToBfXnOphg/y6kO+lBYqoDH7X5Ci0daXT5zQ8v5NnaZw+UwxGeFPX3knIR3r5pmzUld0f2giFOuD4ZOF8w==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@jambonz/siprec-client-utils/-/siprec-client-utils-0.2.9.tgz", + "integrity": "sha512-C/1UOrAvQVG0iwiSMS0MC9VHRjhg3/sOjNna+eEjHjws1SHl8NrKBoDL8uOwLqOM2ccpbqCPH9GJAxo5OnOhww==", "requires": { "sdp-transform": "^2.14.1", "uuid": "^8.3.2" diff --git a/package.json b/package.json index dc69ec0..0ffc7a2 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@jambonz/http-health-check": "^0.0.1", "@jambonz/realtimedb-helpers": "^0.8.8", "@jambonz/rtpengine-utils": "^0.4.4", - "@jambonz/siprec-client-utils": "^0.2.7", + "@jambonz/siprec-client-utils": "^0.2.9", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.10", "@jambonz/digest-utils": "^0.0.5",