Skip to content

Commit

Permalink
fix outbound info
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu committed Oct 10, 2023
1 parent f7bd1f2 commit 56910a0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/call-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,15 +861,17 @@ Duration=${payload.duration} `
}
}
else {
const response = await dlg.other.request({
method: 'INFO',
headers: req.headers,
body: req.body
});
res.send(response.status, {
headers: response.headers,
body: response.body
const immutableHdrs = ['via', 'from', 'to', 'call-id', 'cseq', 'max-forwards', 'content-length'];
const headers = {};
Object.keys(req.headers).forEach((h) => {
if (!immutableHdrs.includes(h)) headers[h] = req.headers[h];
});
const response = await dlg.other.request({method: 'INFO', headers, body: req.body});
const responseHeaders = {};
if (response.has('Content-Type')) {
Object.assign(responseHeaders, {'Content-Type': response.get('Content-Type')});
}
res.send(response.status, {headers: responseHeaders, body: response.body});
}
} catch (err) {
this.logger.info({err}, `Error handing INFO request on ${dlg.type} leg`);
Expand Down

0 comments on commit 56910a0

Please sign in to comment.