@subiz/wsclient 4.0.5 → 4.0.6
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 +1 -1
- package/webrtc.js +6 -3
package/package.json
CHANGED
package/webrtc.js
CHANGED
|
@@ -4,9 +4,9 @@ const servers = {
|
|
|
4
4
|
iceServers: [{urls: ['stun:stun.l.google.com:19302?transport=tcp']}],
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
// let connId = 'webrtc' +
|
|
7
|
+
// let connId = 'webrtc' + randomString(20)
|
|
8
8
|
// env = {RTCPeerConnection, RTCIceCandidate, RTCSessionDescription, setTimeout, setInterval, jsonify, parseJSON}
|
|
9
|
-
//
|
|
9
|
+
// set env._is_webrtc_local to true for local testing
|
|
10
10
|
function WebRTCConn(options) {
|
|
11
11
|
let {apiUrl, access_token, accid, agid, connId, realtime, callAPI, env, onTrack, onEvent} = options
|
|
12
12
|
if (!apiUrl) {
|
|
@@ -318,10 +318,13 @@ function WebRTCConn(options) {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
this.answerCall = (callid, stream) => {
|
|
321
|
+
console.log('1')
|
|
321
322
|
let call = activeCalls[callid]
|
|
322
|
-
if (
|
|
323
|
+
if (call && call.status == 'ended') return Promise.resolve({error: 'call_ended'})
|
|
323
324
|
let now = env.Date.now()
|
|
325
|
+
console.log('2', answerRequest[callid])
|
|
324
326
|
if (answerRequest[callid]) return Promise.resolve({body: call})
|
|
327
|
+
console.log('3')
|
|
325
328
|
answerRequest[callid] = now
|
|
326
329
|
publish({type: 'call_ringing', data: {call_info: {call_id: callid}}}) // fake dialing
|
|
327
330
|
return new env.Promise((rs) => {
|