drachtio-srf 4.5.1 → 4.5.2

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 +11 -1
  2. package/package.json +1 -1
package/lib/srf.js CHANGED
@@ -25,6 +25,8 @@ DialogState.Cancelled = 'cancelled';
25
25
  DialogDirection.Initiator = 'initiator';
26
26
  DialogDirection.Recipient = 'recipient';
27
27
 
28
+ const sleepFor = async(ms) => await new Promise((resolve) => setTimeout(resolve, ms));
29
+
28
30
  const noncopyableHdrs = ['via', 'from', 'to', 'call-id', 'cseq', 'contact', 'content-length', 'content-type'];
29
31
  function copyAllHeaders(msg, obj) {
30
32
  if (msg) Object.keys(msg.headers).forEach((h) => {
@@ -835,7 +837,15 @@ class Srf extends Emitter {
835
837
 
836
838
  if (remoteSdpB && remoteSdpB === sdpB) {
837
839
  // called again with same remote SDP, return previous result
838
- return translatedRemoteSdpB ;
840
+ if (translatedRemoteSdpB) return translatedRemoteSdpB;
841
+
842
+ /* race condition: we are still producing the translatedSdp from 183 */
843
+ await sleepFor(100);
844
+ if (translatedRemoteSdpB) return translatedRemoteSdpB;
845
+ await sleepFor(500);
846
+ if (translatedRemoteSdpB) return translatedRemoteSdpB;
847
+ await sleepFor(1000);
848
+ return translatedRemoteSdpB;
839
849
  }
840
850
 
841
851
  remoteSdpB = sdpB ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drachtio-srf",
3
- "version": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "description": "drachtio signaling resource framework",
5
5
  "main": "lib/srf.js",
6
6
  "scripts": {