@subiz/wsclient 4.0.2 → 4.0.3

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/package.json +1 -1
  2. package/webrtc.js +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/wsclient",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "main": "realtime.js",
5
5
  "scripts": {
6
6
  "test": "node realtime.test.js"
package/webrtc.js CHANGED
@@ -150,21 +150,22 @@ function WebRTCConn(options) {
150
150
  }
151
151
  })
152
152
 
153
- Object.keys(calls, (callid) => {
153
+ Object.keys(calls).map((callid) => {
154
154
  let call = calls[callid]
155
- if (endRequest[callid] && call && call.status != 'ended') {
156
- calls[callid] = Object.assign({}, call, {
157
- call_id: callid,
158
- ended: endRequest[callid],
159
- status: 'ended',
160
- hangup_code: 'cancel',
161
- })
162
- }
155
+ if (!endRequest[callid]) return
156
+ if (!call || call.status == 'ended') return
157
+ calls[callid] = Object.assign({}, call, {
158
+ call_id: callid,
159
+ ended: endRequest[callid],
160
+ status: 'ended',
161
+ hangup_code: 'cancel',
162
+ })
163
163
  })
164
164
  return calls
165
165
  }
166
166
 
167
167
  let call = activeCalls[callid]
168
+ if (!call && dialingRequest[callid]) call = dialingRequest[callid]
168
169
  if (endRequest[callid] && call && call.status != 'ended') {
169
170
  return Object.assign({}, call, {
170
171
  call_id: callid,
@@ -173,7 +174,6 @@ function WebRTCConn(options) {
173
174
  hangup_code: 'cancel',
174
175
  })
175
176
  }
176
- if (!call && dialingRequest[callid]) return dialingRequest[callid]
177
177
  return call
178
178
  }
179
179