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 } });