mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
support send refer custom header to referhook (#981)
This commit is contained in:
@@ -2351,6 +2351,12 @@ Duration=${duration} `
|
||||
try {
|
||||
const to = parseUri(req.getParsedHeader('Refer-To').uri);
|
||||
const by = parseUri(req.getParsedHeader('Referred-By').uri);
|
||||
const customHeaders = Object.keys(req.headers)
|
||||
.filter((h) => h.toLowerCase().startsWith('x-'))
|
||||
.reduce((acc, h) => {
|
||||
acc[h] = req.get(h);
|
||||
return acc;
|
||||
}, {});
|
||||
const b3 = this.b3;
|
||||
const httpHeaders = b3 && {b3};
|
||||
const json = await this.requestor.request('verb:hook', this._referHook, {
|
||||
@@ -2363,6 +2369,7 @@ Duration=${duration} `
|
||||
referred_by_user: by.scheme === 'tel' ? by.number : by.user,
|
||||
referring_call_sid: this.callSid,
|
||||
referred_call_sid: null,
|
||||
...customHeaders
|
||||
}
|
||||
}, httpHeaders);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user