drachtio-srf 4.5.27 → 4.5.28
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 +18 -2
- package/package.json +1 -1
- package/test/b2b.js +1 -1
- package/test/scenarios/uac-cancel.xml +1 -0
package/lib/srf.js
CHANGED
|
@@ -871,15 +871,31 @@ class Srf extends Emitter {
|
|
|
871
871
|
res.send(500);
|
|
872
872
|
}
|
|
873
873
|
else {
|
|
874
|
-
req.on('cancel', () => {
|
|
874
|
+
req.on('cancel', (cancelReq) => {
|
|
875
875
|
debug('createB2BUA: received CANCEL from A party, sending CANCEL to B');
|
|
876
876
|
res.send(487) ;
|
|
877
|
-
uacReq.cancel(
|
|
877
|
+
uacReq.cancel({
|
|
878
|
+
headers: copyUASHeaderToUACForOnlyCancel(cancelReq)
|
|
879
|
+
}
|
|
880
|
+
) ;
|
|
878
881
|
});
|
|
879
882
|
}
|
|
880
883
|
cbRequest(err, uacReq);
|
|
881
884
|
}
|
|
882
885
|
|
|
886
|
+
/* Special for Cancel request, we just forward hardcoded list of headers here*/
|
|
887
|
+
function copyUASHeaderToUACForOnlyCancel(uasReq) {
|
|
888
|
+
const headers = {};
|
|
889
|
+
if (!uasReq) {
|
|
890
|
+
return headers;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
['Reason', 'X-Reason']
|
|
894
|
+
.forEach((hdr) => { if (uasReq.has(hdr)) headers[hdr] = uasReq.get(hdr);}) ;
|
|
895
|
+
|
|
896
|
+
return headers ;
|
|
897
|
+
}
|
|
898
|
+
|
|
883
899
|
/* get headers from response on uac (B) leg and ready them for inclusion on our response on uas (A) leg */
|
|
884
900
|
function copyUACHeadersToUAS(uacRes) {
|
|
885
901
|
const headers = {};
|
package/package.json
CHANGED
package/test/b2b.js
CHANGED