drachtio-srf 4.5.29 → 4.5.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/srf.js +9 -7
- package/package.json +1 -1
package/lib/srf.js
CHANGED
|
@@ -28,9 +28,9 @@ DialogDirection.Recipient = 'recipient';
|
|
|
28
28
|
const sleepFor = async(ms) => await new Promise((resolve) => setTimeout(resolve, ms));
|
|
29
29
|
|
|
30
30
|
const noncopyableHdrs = ['via', 'from', 'to', 'call-id', 'cseq', 'contact', 'content-length', 'content-type'];
|
|
31
|
-
function copyAllHeaders(
|
|
32
|
-
if (
|
|
33
|
-
if (!noncopyableHdrs.includes(h) && !obj[h]) obj[h] =
|
|
31
|
+
function copyAllHeaders(headers, obj) {
|
|
32
|
+
if (headers) Object.keys(headers).forEach((h) => {
|
|
33
|
+
if (!noncopyableHdrs.includes(h) && !obj[h]) obj[h] = headers[h];});
|
|
34
34
|
}
|
|
35
35
|
function possiblyRemoveHeaders(hdrList, obj) {
|
|
36
36
|
hdrList.forEach((h) => {
|
|
@@ -811,8 +811,9 @@ class Srf extends Emitter {
|
|
|
811
811
|
|
|
812
812
|
// pass specified headers on to the B leg
|
|
813
813
|
if (proxyRequestHeaders[0] === 'all') {
|
|
814
|
-
|
|
815
|
-
possiblyRemoveHeaders(proxyRequestHeaders.slice(1),
|
|
814
|
+
const reqHeaders = req.headers;
|
|
815
|
+
possiblyRemoveHeaders(proxyRequestHeaders.slice(1), reqHeaders);
|
|
816
|
+
copyAllHeaders(reqHeaders, opts.headers);
|
|
816
817
|
}
|
|
817
818
|
else proxyRequestHeaders.forEach((hdr) => { if (req.has(hdr)) opts.headers[hdr] = req.get(hdr);}) ;
|
|
818
819
|
|
|
@@ -904,8 +905,9 @@ class Srf extends Emitter {
|
|
|
904
905
|
}
|
|
905
906
|
|
|
906
907
|
if (proxyResponseHeaders[0] === 'all') {
|
|
907
|
-
|
|
908
|
-
possiblyRemoveHeaders(
|
|
908
|
+
const resHeaders = uacRes.headers;
|
|
909
|
+
possiblyRemoveHeaders(proxyRequestHeaders.slice(1), resHeaders);
|
|
910
|
+
copyAllHeaders(resHeaders, headers);
|
|
909
911
|
}
|
|
910
912
|
else {
|
|
911
913
|
proxyResponseHeaders.forEach((hdr) => {
|