Skip to content

Commit

Permalink
support referby with display name (#186)
Browse files Browse the repository at this point in the history
* support referby with display name

* update siprec client utils
  • Loading branch information
xquanluu authored Dec 11, 2024
1 parent 1cd526c commit a7d6cf5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 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
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a7d6cf5

Please sign in to comment.