@subiz/wsclient 4.0.13 → 4.0.15
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/package.json +2 -2
- package/webrtc.js +12 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subiz/wsclient",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.15",
|
|
4
4
|
"main": "realtime.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node realtime.test.js"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"tape": "^5.6.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@subiz/flow": "^1.0
|
|
20
|
+
"@subiz/flow": "^1.1.0",
|
|
21
21
|
"request": "^2.88.2"
|
|
22
22
|
}
|
|
23
23
|
}
|
package/webrtc.js
CHANGED
|
@@ -270,16 +270,17 @@ function WebRTCConn(options) {
|
|
|
270
270
|
.then(() => {
|
|
271
271
|
readyToSendCandidateResolve[connId]()
|
|
272
272
|
let stream = streams[connId]
|
|
273
|
-
stream
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
273
|
+
stream &&
|
|
274
|
+
stream.getTracks().forEach((track) => {
|
|
275
|
+
let replaced = false
|
|
276
|
+
peer.getSenders().forEach((sender) => {
|
|
277
|
+
if (!sender.track) return
|
|
278
|
+
if (sender.track.kind != track.kind) return
|
|
279
|
+
sender.replaceTrack(track)
|
|
280
|
+
replaced = true
|
|
281
|
+
})
|
|
282
|
+
if (!replaced) peer.addTrack(track, stream)
|
|
280
283
|
})
|
|
281
|
-
if (!replaced) peer.addTrack(track, stream)
|
|
282
|
-
})
|
|
283
284
|
return peer.createAnswer()
|
|
284
285
|
})
|
|
285
286
|
.then((answer) =>
|
|
@@ -322,7 +323,7 @@ function WebRTCConn(options) {
|
|
|
322
323
|
}
|
|
323
324
|
})
|
|
324
325
|
|
|
325
|
-
this.makeCall = (number, fromnumber, streamPm, callid) => {
|
|
326
|
+
this.makeCall = (number, fromnumber, streamPm, callid, campaignid, outboundcallentryid) => {
|
|
326
327
|
if (!callid) callid = 'webcall-' + randomString(30)
|
|
327
328
|
let now = env.Date.now()
|
|
328
329
|
let call = {
|
|
@@ -347,7 +348,7 @@ function WebRTCConn(options) {
|
|
|
347
348
|
return rs({error: err})
|
|
348
349
|
}
|
|
349
350
|
|
|
350
|
-
let url = `${apiUrl}call?x-access-token=${access_token}&connection_id=${connId}&call_id=${callid}&number=${number}&from_number=${fromnumber}`
|
|
351
|
+
let url = `${apiUrl}call?x-access-token=${access_token}&connection_id=${connId}&call_id=${callid}&number=${number}&from_number=${fromnumber}&campaign_id=${campaignid}&outbound_call_entry_id=${outboundcallentryid}`
|
|
351
352
|
callAPI('post', url, undefined, (body, code) => {
|
|
352
353
|
if (code != 200) {
|
|
353
354
|
delete dialingRequest[callid]
|