mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
feat: forward PAI from inbound call to dial outbound call (#280)
* feat: forward PAI from inbound call to dial outbound call * fix: review comment --------- Co-authored-by: Quan HL <quanluuhoang8@gmail.com>
This commit is contained in:
@@ -400,15 +400,19 @@ class TaskDial extends Task {
|
|||||||
let fqdn;
|
let fqdn;
|
||||||
|
|
||||||
if (!sbcAddress) throw new Error('no SBC found for outbound call');
|
if (!sbcAddress) throw new Error('no SBC found for outbound call');
|
||||||
|
this.headers = {
|
||||||
|
'X-Account-Sid': cs.accountSid,
|
||||||
|
...(req && req.has('X-CID') && {'X-CID': req.get('X-CID')}),
|
||||||
|
...(req && req.has('P-Asserted-Identity') && {'P-Asserted-Identity': req.get('P-Asserted-Identity')}),
|
||||||
|
// Put headers at the end to make sure opt.headers override all default behavior.
|
||||||
|
...this.headers
|
||||||
|
};
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
headers: req && req.has('X-CID') ? Object.assign(this.headers, {'X-CID': req.get('X-CID')}) : this.headers,
|
headers: this.headers,
|
||||||
proxy: `sip:${sbcAddress}`,
|
proxy: `sip:${sbcAddress}`,
|
||||||
callingNumber: this.callerId || req.callingNumber
|
callingNumber: this.callerId || req.callingNumber
|
||||||
};
|
};
|
||||||
opts.headers = {
|
|
||||||
...opts.headers,
|
|
||||||
'X-Account-Sid': cs.accountSid
|
|
||||||
};
|
|
||||||
|
|
||||||
const t = this.target.find((t) => t.type === 'teams');
|
const t = this.target.find((t) => t.type === 'teams');
|
||||||
if (t) {
|
if (t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user