mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2026-07-04 19:32:04 +00:00
bugfix: PAI header on incoming call was being put in From header of outbound call
This commit is contained in:
@@ -2,8 +2,20 @@ const Emitter = require('events');
|
||||
const {makeRtpEngineOpts} = require('./utils');
|
||||
const {forwardInDialogRequests} = require('drachtio-fn-b2b-sugar');
|
||||
const {SipError} = require('drachtio-srf');
|
||||
const {parseUri} = require('drachtio-srf');
|
||||
const debug = require('debug')('jambonz:sbc-outbound');
|
||||
|
||||
/**
|
||||
* this is to make sure the outgoing From has the number in the incoming From
|
||||
* and not the incoming PAI
|
||||
*/
|
||||
const createBLegFromHeader = (req) => {
|
||||
const from = req.getParsedHeader('From');
|
||||
const uri = parseUri(from.uri);
|
||||
if (uri && uri.user) return `sip:${uri.user}@localhost`;
|
||||
return 'sip:anonymous@localhost';
|
||||
};
|
||||
|
||||
class CallSession extends Emitter {
|
||||
constructor(logger, req, res) {
|
||||
super();
|
||||
@@ -86,6 +98,9 @@ class CallSession extends Emitter {
|
||||
passFailure: false,
|
||||
proxyRequestHeaders: ['all'],
|
||||
proxyResponseHeaders: ['all'],
|
||||
headers: {
|
||||
'From': createBLegFromHeader(this.req)
|
||||
},
|
||||
localSdpB: response.sdp,
|
||||
localSdpA: async(sdp, res) => {
|
||||
this.toTag = res.getParsedHeader('To').params.tag;
|
||||
|
||||
Reference in New Issue
Block a user