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.
Files changed (2) hide show
  1. package/lib/srf.js +9 -7
  2. 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(msg, obj) {
32
- if (msg) Object.keys(msg.headers).forEach((h) => {
33
- if (!noncopyableHdrs.includes(h) && !obj[h]) obj[h] = msg.headers[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
- copyAllHeaders(req, opts.headers);
815
- possiblyRemoveHeaders(proxyRequestHeaders.slice(1), opts.headers);
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
- copyAllHeaders(uacRes, headers);
908
- possiblyRemoveHeaders(proxyResponseHeaders.slice(1), headers);
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drachtio-srf",
3
- "version": "4.5.29",
3
+ "version": "4.5.30",
4
4
  "description": "drachtio signaling resource framework",
5
5
  "main": "lib/srf.js",
6
6
  "types": "lib/@types/index.d.ts",