diff --git a/lib/call-session.js b/lib/call-session.js index ca108ea..9b8549c 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -1146,7 +1146,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 @@ -1158,9 +1158,7 @@ Duration=${payload.duration} ` const arr = /context-(.*)/.exec(uri.user); if (!arr) { /* call transfer requested */ - 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); /* delete contact if it was there from feature server */ delete customHeaders['contact']; @@ -1169,7 +1167,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 e211836..1d39234 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@jambonz/mw-registrar": "0.2.7", "@jambonz/realtimedb-helpers": "^0.8.9", "@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", "cidr-matcher": "^2.1.1", @@ -628,9 +628,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" diff --git a/package.json b/package.json index 3af6baf..07a5b30 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@jambonz/http-health-check": "^0.0.1", "@jambonz/mw-registrar": "0.2.7", "@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", "cidr-matcher": "^2.1.1",