Skip to content

Commit

Permalink
support referby with display name
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu committed Dec 11, 2024
1 parent 1cd526c commit 2d6556b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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
Expand All @@ -1040,7 +1038,7 @@ Duration=${payload.duration} `
method: 'REFER',
headers: {
'Refer-To': `<${stringifyUri(uri)}>`,
'Referred-By': `<${stringifyUri(u)}>`,
'Referred-By': referredby,
...customHeaders
}
});
Expand Down

0 comments on commit 2d6556b

Please sign in to comment.