diff --git a/lib/call-session.js b/lib/call-session.js index 2bd859e..2403da0 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -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`);