podchat-browser 12.7.2-snapshot.8 → 12.7.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.
- package/_buildInfo.js +20 -0
- package/dist/node/buildConfig.json +1 -0
- package/dist/node/call.module.js +621 -414
- package/dist/node/chat.js +27 -46
- package/dist/node/events.module.js +2 -4
- package/dist/node/messaging.module.js +3 -2
- package/dist/podchat-browser-bundle.js +2054 -1410
- package/examples/index.html +18 -2
- package/package.json +10 -11
- package/src/buildConfig.json +1 -0
- package/src/call.module.js +239 -123
- package/src/chat.js +92 -124
- package/src/events.module.js +1 -3
- package/src/messaging.module.js +3 -2
- package/dist/node/lib/logger.js +0 -35
- package/src/lib/logger.js +0 -34
package/src/call.module.js
CHANGED
|
@@ -54,6 +54,8 @@ function ChatCall(params) {
|
|
|
54
54
|
? params.callOptions.callVideo.minHeight
|
|
55
55
|
: 180,
|
|
56
56
|
currentCallParams = {},
|
|
57
|
+
requestedCallId = null,
|
|
58
|
+
acceptedCallId = null,
|
|
57
59
|
currentCallId = null,
|
|
58
60
|
latestCallRequestId = null,
|
|
59
61
|
//shouldReconnectCallTimeout = null,
|
|
@@ -79,8 +81,25 @@ function ChatCall(params) {
|
|
|
79
81
|
callRequestReceived: false,
|
|
80
82
|
callEstablishedInMySide: false,
|
|
81
83
|
callRequestTimeout: null,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
|
|
85
|
+
iRequestedCall: false,
|
|
86
|
+
iAcceptedCall: false,
|
|
87
|
+
|
|
88
|
+
canProcessStartCall: function (callId) {
|
|
89
|
+
consoleLogging && console.log(
|
|
90
|
+
"[SDK] canProcessStartCall:",
|
|
91
|
+
{callId},
|
|
92
|
+
{acceptedCallId},
|
|
93
|
+
callRequestController.iAcceptedCall,
|
|
94
|
+
callRequestController.iAcceptedCall && acceptedCallId == callId
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
if(callRequestController.iAcceptedCall && acceptedCallId == callId
|
|
98
|
+
|| callRequestController.iRequestedCall && requestedCallId == callId)
|
|
99
|
+
return true;
|
|
100
|
+
|
|
101
|
+
return false;
|
|
102
|
+
//callRequestController.callRequestReceived && callRequestController.callEstablishedInMySide;
|
|
84
103
|
},
|
|
85
104
|
cameraPaused: true
|
|
86
105
|
},
|
|
@@ -600,7 +619,7 @@ function ChatCall(params) {
|
|
|
600
619
|
manager.watchAudioLevel();
|
|
601
620
|
}
|
|
602
621
|
config.state = peerStates.CONNECTED;
|
|
603
|
-
callRequestController.callEstablishedInMySide = true;
|
|
622
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
604
623
|
chatEvents.fireEvent('callEvents', {
|
|
605
624
|
type: 'CALL_STATUS',
|
|
606
625
|
errorCode: 7000,
|
|
@@ -1335,9 +1354,9 @@ function ChatCall(params) {
|
|
|
1335
1354
|
token: token
|
|
1336
1355
|
};
|
|
1337
1356
|
|
|
1338
|
-
if (!callRequestController.callEstablishedInMySide) {
|
|
1339
|
-
|
|
1340
|
-
}
|
|
1357
|
+
// if (!callRequestController.callEstablishedInMySide) {
|
|
1358
|
+
// return;
|
|
1359
|
+
// }
|
|
1341
1360
|
|
|
1342
1361
|
if (params) {
|
|
1343
1362
|
if (typeof +params.callId === 'number' && params.callId > 0) {
|
|
@@ -1434,7 +1453,11 @@ function ChatCall(params) {
|
|
|
1434
1453
|
|
|
1435
1454
|
callStateController = {
|
|
1436
1455
|
createSessionInChat: function (params) {
|
|
1456
|
+
|
|
1437
1457
|
currentCallParams = params;
|
|
1458
|
+
callStopQueue.callStarted = true;
|
|
1459
|
+
this.startCall(params);
|
|
1460
|
+
|
|
1438
1461
|
let callController = this,
|
|
1439
1462
|
totalRetries = 1,
|
|
1440
1463
|
message = {
|
|
@@ -1445,8 +1468,13 @@ function ChatCall(params) {
|
|
|
1445
1468
|
onResultCallback = function (res) {
|
|
1446
1469
|
if (res.done === 'TRUE') {
|
|
1447
1470
|
callStopQueue.callStarted = true;
|
|
1448
|
-
callController.startCall(params);
|
|
1449
|
-
}
|
|
1471
|
+
// callController.startCall(params);
|
|
1472
|
+
} else {
|
|
1473
|
+
endCall({callId: currentCallId});
|
|
1474
|
+
callStop( true, true);
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
/*else if (res.done === 'SKIP') {
|
|
1450
1478
|
callStopQueue.callStarted = true;
|
|
1451
1479
|
callController.startCall(params);
|
|
1452
1480
|
}*/
|
|
@@ -1706,7 +1734,7 @@ function ChatCall(params) {
|
|
|
1706
1734
|
}
|
|
1707
1735
|
},
|
|
1708
1736
|
maybeReconnectAllTopics: function (){
|
|
1709
|
-
if(!callUsers || !Object.keys(callUsers).length
|
|
1737
|
+
if(!callUsers || !Object.keys(callUsers).length) //|| !callRequestController.callEstablishedInMySide
|
|
1710
1738
|
return;
|
|
1711
1739
|
|
|
1712
1740
|
for(let i in callUsers) {
|
|
@@ -2261,37 +2289,49 @@ function ChatCall(params) {
|
|
|
2261
2289
|
},
|
|
2262
2290
|
*/
|
|
2263
2291
|
|
|
2264
|
-
callStop = function (
|
|
2292
|
+
callStop = function (resetCurrentCallId = true, resetCameraPaused = true) {
|
|
2265
2293
|
|
|
2266
|
-
|
|
2294
|
+
return new Promise((resolve, reject) => {
|
|
2295
|
+
// callTopicHealthChecker.stopTopicsHealthCheck();
|
|
2267
2296
|
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2297
|
+
deviceManager.mediaStreams().stopVideoInput();
|
|
2298
|
+
deviceManager.mediaStreams().stopAudioInput();
|
|
2299
|
+
deviceManager.mediaStreams().stopScreenShareInput();
|
|
2271
2300
|
|
|
2272
|
-
|
|
2301
|
+
callStateController.removeAllCallParticipants();
|
|
2273
2302
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2303
|
+
if (callStopQueue.callStarted) {
|
|
2304
|
+
sendCallMessage({
|
|
2305
|
+
id: 'CLOSE'
|
|
2306
|
+
}, null, {});
|
|
2307
|
+
callStopQueue.callStarted = false;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
if(resetCameraPaused)
|
|
2311
|
+
callRequestController.cameraPaused = false;
|
|
2312
|
+
|
|
2313
|
+
// callRequestController.iRequestedCall = false;
|
|
2314
|
+
// callRequestController.iAcceptedCall = false;
|
|
2315
|
+
//acceptedCallId = null;
|
|
2316
|
+
//requestedCallId = null;
|
|
2280
2317
|
|
|
2281
|
-
|
|
2282
|
-
callRequestController.
|
|
2318
|
+
// callRequestController.callEstablishedInMySide = false;
|
|
2319
|
+
// callRequestController.callRequestReceived = false;
|
|
2320
|
+
clearTimeout(callRequestController.callRequestTimeout);
|
|
2283
2321
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
clearTimeout(callRequestController.callRequestTimeout);
|
|
2322
|
+
// if(resetCallOwner)
|
|
2323
|
+
// callRequestController.imCallOwner = false;
|
|
2287
2324
|
|
|
2288
|
-
|
|
2289
|
-
callRequestController.imCallOwner = false;
|
|
2325
|
+
currentCallParams = {};
|
|
2290
2326
|
|
|
2291
|
-
|
|
2327
|
+
if(resetCurrentCallId)
|
|
2328
|
+
currentCallId = null;
|
|
2292
2329
|
|
|
2293
|
-
|
|
2294
|
-
|
|
2330
|
+
|
|
2331
|
+
setTimeout(()=>{
|
|
2332
|
+
resolve(true)
|
|
2333
|
+
}, 2000);
|
|
2334
|
+
})
|
|
2295
2335
|
},
|
|
2296
2336
|
|
|
2297
2337
|
restartMediaOnKeyFrame = function (userId, timeouts) {
|
|
@@ -2656,7 +2696,7 @@ function ChatCall(params) {
|
|
|
2656
2696
|
* Type 70 Send Call Request
|
|
2657
2697
|
*/
|
|
2658
2698
|
case chatMessageVOTypes.CALL_REQUEST:
|
|
2659
|
-
callRequestController.callRequestReceived = true;
|
|
2699
|
+
// callRequestController.callRequestReceived = true;
|
|
2660
2700
|
callReceived({
|
|
2661
2701
|
callId: messageContent.callId
|
|
2662
2702
|
}, function (r) {
|
|
@@ -2676,7 +2716,6 @@ function ChatCall(params) {
|
|
|
2676
2716
|
// if(!currentCallId ) {
|
|
2677
2717
|
latestCallRequestId = messageContent.callId;
|
|
2678
2718
|
// }
|
|
2679
|
-
|
|
2680
2719
|
} else {
|
|
2681
2720
|
chatEvents.fireEvent('callEvents', {
|
|
2682
2721
|
type: 'PARTNER_RECEIVED_YOUR_CALL',
|
|
@@ -2732,7 +2771,7 @@ function ChatCall(params) {
|
|
|
2732
2771
|
// if(!currentCallId ) {
|
|
2733
2772
|
latestCallRequestId = messageContent.callId;
|
|
2734
2773
|
// }
|
|
2735
|
-
} else {
|
|
2774
|
+
} else if(callRequestController.iRequestedCall) {
|
|
2736
2775
|
chatEvents.fireEvent('callEvents', {
|
|
2737
2776
|
type: 'PARTNER_RECEIVED_YOUR_CALL',
|
|
2738
2777
|
result: messageContent
|
|
@@ -2745,7 +2784,7 @@ function ChatCall(params) {
|
|
|
2745
2784
|
* Type 74 Start Call (Start sender and receivers)
|
|
2746
2785
|
*/
|
|
2747
2786
|
case chatMessageVOTypes.START_CALL:
|
|
2748
|
-
if(!callRequestController.
|
|
2787
|
+
if(!callRequestController.canProcessStartCall(threadId)) {
|
|
2749
2788
|
chatEvents.fireEvent('callEvents', {
|
|
2750
2789
|
type: 'CALL_STARTED_ELSEWHERE',
|
|
2751
2790
|
message: 'Call already started somewhere else..., aborting...'
|
|
@@ -2753,50 +2792,16 @@ function ChatCall(params) {
|
|
|
2753
2792
|
return;
|
|
2754
2793
|
}
|
|
2755
2794
|
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
messageContent.callId = threadId;
|
|
2764
|
-
chatEvents.fireEvent('callEvents', {
|
|
2765
|
-
type: 'CALL_STARTED',
|
|
2766
|
-
result: messageContent
|
|
2767
|
-
});
|
|
2768
|
-
|
|
2769
|
-
if (typeof messageContent === 'object'
|
|
2770
|
-
&& messageContent.hasOwnProperty('chatDataDto')
|
|
2771
|
-
&& !!messageContent.chatDataDto.kurentoAddress) {
|
|
2772
|
-
|
|
2773
|
-
callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));
|
|
2774
|
-
|
|
2775
|
-
startCallWebRTCFunctions({
|
|
2776
|
-
video: messageContent.clientDTO.video,
|
|
2777
|
-
mute: messageContent.clientDTO.mute,
|
|
2778
|
-
sendingTopic: messageContent.clientDTO.topicSend,
|
|
2779
|
-
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
2780
|
-
screenShare: messageContent.chatDataDto.screenShare,
|
|
2781
|
-
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
2782
|
-
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
2783
|
-
internalTurnAddress: messageContent.chatDataDto.internalTurnAddress,
|
|
2784
|
-
selfData: messageContent.clientDTO,
|
|
2785
|
-
clientsList: messageContent.otherClientDtoList,
|
|
2786
|
-
screenShareOwner: +messageContent.chatDataDto.screenShareUser,
|
|
2787
|
-
recordingOwner: +messageContent.chatDataDto.recordingUser
|
|
2788
|
-
}, function (callDivs) {
|
|
2789
|
-
chatEvents.fireEvent('callEvents', {
|
|
2790
|
-
type: 'CALL_DIVS',
|
|
2791
|
-
result: callDivs
|
|
2792
|
-
});
|
|
2793
|
-
});
|
|
2795
|
+
if(currentCallId) {
|
|
2796
|
+
endCall({callId: currentCallId});
|
|
2797
|
+
callStop( true, false);
|
|
2798
|
+
setTimeout(()=>{
|
|
2799
|
+
currentCallId = threadId;
|
|
2800
|
+
processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId);
|
|
2801
|
+
}, 5000);
|
|
2794
2802
|
} else {
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
message: 'Chat Data DTO is not present!',
|
|
2798
|
-
environmentDetails: getSDKCallDetails()
|
|
2799
|
-
});
|
|
2803
|
+
currentCallId = threadId;
|
|
2804
|
+
processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId);
|
|
2800
2805
|
}
|
|
2801
2806
|
|
|
2802
2807
|
break;
|
|
@@ -2898,7 +2903,7 @@ function ChatCall(params) {
|
|
|
2898
2903
|
* Type 91 Send Group Call Request
|
|
2899
2904
|
*/
|
|
2900
2905
|
case chatMessageVOTypes.GROUP_CALL_REQUEST:
|
|
2901
|
-
callRequestController.callRequestReceived = true;
|
|
2906
|
+
// callRequestController.callRequestReceived = true;
|
|
2902
2907
|
callReceived({
|
|
2903
2908
|
callId: messageContent.callId
|
|
2904
2909
|
}, function (r) {});
|
|
@@ -3000,15 +3005,15 @@ function ChatCall(params) {
|
|
|
3000
3005
|
if(!correctedData.mute) {
|
|
3001
3006
|
callStateController.startParticipantAudio(correctedData.userId);
|
|
3002
3007
|
}
|
|
3008
|
+
|
|
3009
|
+
chatEvents.fireEvent('callEvents', {
|
|
3010
|
+
type: 'CALL_DIVS',
|
|
3011
|
+
result: generateCallUIList()
|
|
3012
|
+
});
|
|
3003
3013
|
}, 500)
|
|
3004
3014
|
}
|
|
3005
3015
|
}
|
|
3006
3016
|
|
|
3007
|
-
chatEvents.fireEvent('callEvents', {
|
|
3008
|
-
type: 'CALL_DIVS',
|
|
3009
|
-
result: generateCallUIList()
|
|
3010
|
-
});
|
|
3011
|
-
|
|
3012
3017
|
chatEvents.fireEvent('callEvents', {
|
|
3013
3018
|
type: 'CALL_PARTICIPANT_JOINED',
|
|
3014
3019
|
result: messageContent
|
|
@@ -3188,20 +3193,18 @@ function ChatCall(params) {
|
|
|
3188
3193
|
* Type 111 Kafka Call Session Created
|
|
3189
3194
|
*/
|
|
3190
3195
|
case chatMessageVOTypes.CALL_SESSION_CREATED:
|
|
3191
|
-
if(!callRequestController.callEstablishedInMySide)
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
if(!currentCallId)
|
|
3200
|
-
currentCallId = messageContent.callId;
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
//currentCallId = messageContent.callId;
|
|
3196
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3197
|
+
// return;
|
|
3198
|
+
if(callRequestController.iRequestedCall) {
|
|
3199
|
+
chatEvents.fireEvent('callEvents', {
|
|
3200
|
+
type: 'CALL_SESSION_CREATED',
|
|
3201
|
+
result: messageContent
|
|
3202
|
+
});
|
|
3204
3203
|
|
|
3204
|
+
// if(!requestedCallId) {
|
|
3205
|
+
requestedCallId = messageContent.callId;
|
|
3206
|
+
}
|
|
3207
|
+
// }
|
|
3205
3208
|
break;
|
|
3206
3209
|
|
|
3207
3210
|
/**
|
|
@@ -3308,8 +3311,8 @@ function ChatCall(params) {
|
|
|
3308
3311
|
* Type 123 Start Screen Share
|
|
3309
3312
|
*/
|
|
3310
3313
|
case chatMessageVOTypes.START_SCREEN_SHARE:
|
|
3311
|
-
if(!callRequestController.callEstablishedInMySide)
|
|
3312
|
-
|
|
3314
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3315
|
+
// return;
|
|
3313
3316
|
|
|
3314
3317
|
screenShareInfo.setIsStarted(true);
|
|
3315
3318
|
screenShareInfo.setOwner(messageContent.screenOwner.id);
|
|
@@ -3365,8 +3368,8 @@ function ChatCall(params) {
|
|
|
3365
3368
|
* Type 126 Destinated Record Call Request
|
|
3366
3369
|
*/
|
|
3367
3370
|
case chatMessageVOTypes.DESTINED_RECORD_CALL:
|
|
3368
|
-
if(!callRequestController.callEstablishedInMySide)
|
|
3369
|
-
|
|
3371
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3372
|
+
// return;
|
|
3370
3373
|
|
|
3371
3374
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
3372
3375
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
@@ -3462,7 +3465,53 @@ function ChatCall(params) {
|
|
|
3462
3465
|
}
|
|
3463
3466
|
}
|
|
3464
3467
|
|
|
3465
|
-
|
|
3468
|
+
function processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId){
|
|
3469
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
3470
|
+
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
callStopQueue.callStarted = true;
|
|
3474
|
+
messageContent.callId = threadId;
|
|
3475
|
+
chatEvents.fireEvent('callEvents', {
|
|
3476
|
+
type: 'CALL_STARTED',
|
|
3477
|
+
result: messageContent
|
|
3478
|
+
});
|
|
3479
|
+
|
|
3480
|
+
if (typeof messageContent === 'object'
|
|
3481
|
+
&& messageContent.hasOwnProperty('chatDataDto')
|
|
3482
|
+
&& !!messageContent.chatDataDto.kurentoAddress) {
|
|
3483
|
+
|
|
3484
|
+
callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));
|
|
3485
|
+
|
|
3486
|
+
startCallWebRTCFunctions({
|
|
3487
|
+
video: messageContent.clientDTO.video,
|
|
3488
|
+
mute: messageContent.clientDTO.mute,
|
|
3489
|
+
sendingTopic: messageContent.clientDTO.topicSend,
|
|
3490
|
+
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
3491
|
+
screenShare: messageContent.chatDataDto.screenShare,
|
|
3492
|
+
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
3493
|
+
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
3494
|
+
internalTurnAddress: messageContent.chatDataDto.internalTurnAddress,
|
|
3495
|
+
selfData: messageContent.clientDTO,
|
|
3496
|
+
clientsList: messageContent.otherClientDtoList,
|
|
3497
|
+
screenShareOwner: +messageContent.chatDataDto.screenShareUser,
|
|
3498
|
+
recordingOwner: +messageContent.chatDataDto.recordingUser
|
|
3499
|
+
}, function (callDivs) {
|
|
3500
|
+
chatEvents.fireEvent('callEvents', {
|
|
3501
|
+
type: 'CALL_DIVS',
|
|
3502
|
+
result: callDivs
|
|
3503
|
+
});
|
|
3504
|
+
});
|
|
3505
|
+
} else {
|
|
3506
|
+
chatEvents.fireEvent('callEvents', {
|
|
3507
|
+
type: 'CALL_ERROR',
|
|
3508
|
+
message: 'Chat Data DTO is not present!',
|
|
3509
|
+
environmentDetails: getSDKCallDetails()
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
|
|
3514
|
+
this.startCall = async function (params, callback) {
|
|
3466
3515
|
let startCallData = {
|
|
3467
3516
|
chatMessageVOType: chatMessageVOTypes.CALL_REQUEST,
|
|
3468
3517
|
typeCode: generalTypeCode, //params.typeCode,
|
|
@@ -3528,10 +3577,15 @@ function ChatCall(params) {
|
|
|
3528
3577
|
return;
|
|
3529
3578
|
}
|
|
3530
3579
|
|
|
3580
|
+
// if(currentCallId) {
|
|
3581
|
+
// await callStop();
|
|
3582
|
+
// }
|
|
3583
|
+
|
|
3531
3584
|
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : false;
|
|
3532
|
-
callRequestController.callRequestReceived = true;
|
|
3533
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3534
|
-
callRequestController.imCallOwner = true;
|
|
3585
|
+
// callRequestController.callRequestReceived = true;
|
|
3586
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3587
|
+
// callRequestController.imCallOwner = true;
|
|
3588
|
+
callRequestController.iRequestedCall = true;
|
|
3535
3589
|
|
|
3536
3590
|
deviceManager.grantUserMediaDevicesPermissions({
|
|
3537
3591
|
video: params.type == 'video',
|
|
@@ -3571,7 +3625,7 @@ function ChatCall(params) {
|
|
|
3571
3625
|
});
|
|
3572
3626
|
};
|
|
3573
3627
|
|
|
3574
|
-
this.startGroupCall = function (params, callback) {
|
|
3628
|
+
this.startGroupCall = async function (params, callback) {
|
|
3575
3629
|
let startCallData = {
|
|
3576
3630
|
chatMessageVOType: chatMessageVOTypes.GROUP_CALL_REQUEST,
|
|
3577
3631
|
typeCode: generalTypeCode, //params.typeCode,
|
|
@@ -3637,10 +3691,15 @@ function ChatCall(params) {
|
|
|
3637
3691
|
return;
|
|
3638
3692
|
}
|
|
3639
3693
|
|
|
3694
|
+
// if(currentCallId) {
|
|
3695
|
+
// await callStop();
|
|
3696
|
+
// }
|
|
3697
|
+
|
|
3640
3698
|
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : false;
|
|
3641
|
-
callRequestController.callRequestReceived = true;
|
|
3642
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3643
|
-
callRequestController.imCallOwner = true;
|
|
3699
|
+
// callRequestController.callRequestReceived = true;
|
|
3700
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3701
|
+
// callRequestController.imCallOwner = true;
|
|
3702
|
+
callRequestController.iRequestedCall = true;
|
|
3644
3703
|
|
|
3645
3704
|
deviceManager.grantUserMediaDevicesPermissions({
|
|
3646
3705
|
video: params.type == 'video',
|
|
@@ -3659,7 +3718,7 @@ function ChatCall(params) {
|
|
|
3659
3718
|
if(callNoAnswerTimeout) {
|
|
3660
3719
|
callRequestController.callRequestTimeout = setTimeout( function(metaData) {
|
|
3661
3720
|
//Reject the call if participant didn't answer
|
|
3662
|
-
if(!callStopQueue.callStarted
|
|
3721
|
+
if(!callStopQueue.callStarted) {
|
|
3663
3722
|
chatEvents.fireEvent("callEvents", {
|
|
3664
3723
|
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3665
3724
|
message: "[CALL_SESSION_CREATED] Call request timed out, No answer",
|
|
@@ -3726,7 +3785,7 @@ function ChatCall(params) {
|
|
|
3726
3785
|
});
|
|
3727
3786
|
};
|
|
3728
3787
|
|
|
3729
|
-
this.acceptCall = function (params, callback) {
|
|
3788
|
+
this.acceptCall = async function (params, callback) {
|
|
3730
3789
|
let acceptCallData = {
|
|
3731
3790
|
chatMessageVOType: chatMessageVOTypes.ACCEPT_CALL,
|
|
3732
3791
|
typeCode: generalTypeCode, //params.typeCode,
|
|
@@ -3763,8 +3822,8 @@ function ChatCall(params) {
|
|
|
3763
3822
|
acceptCallData.content = JSON.stringify(content);
|
|
3764
3823
|
|
|
3765
3824
|
if(params.joinCall) {
|
|
3766
|
-
callRequestController.callRequestReceived = true;
|
|
3767
|
-
currentCallId = params.callId;
|
|
3825
|
+
// callRequestController.callRequestReceived = true;
|
|
3826
|
+
// currentCallId = params.callId;
|
|
3768
3827
|
}
|
|
3769
3828
|
} else {
|
|
3770
3829
|
chatEvents.fireEvent('error', {
|
|
@@ -3774,12 +3833,64 @@ function ChatCall(params) {
|
|
|
3774
3833
|
return;
|
|
3775
3834
|
}
|
|
3776
3835
|
|
|
3777
|
-
callRequestController.
|
|
3778
|
-
|
|
3836
|
+
// if(callRequestController.iAcceptedCall || callRequestController.iRequestedCall) {
|
|
3837
|
+
// await callStop();
|
|
3838
|
+
// }
|
|
3839
|
+
|
|
3840
|
+
// if(currentCallId) {
|
|
3841
|
+
// endCall({callId: currentCallId});
|
|
3842
|
+
// }
|
|
3779
3843
|
|
|
3780
|
-
|
|
3844
|
+
acceptedCallId = parseInt(params.callId);
|
|
3845
|
+
callRequestController.iAcceptedCall = true;
|
|
3846
|
+
// console.log("acceptCall: ", {acceptedCallId}, callRequestController.iAcceptedCall);
|
|
3847
|
+
// callRequestController.imCallOwner = false;
|
|
3848
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3781
3849
|
|
|
3782
|
-
|
|
3850
|
+
// let isMovingToNewCall = false;
|
|
3851
|
+
|
|
3852
|
+
deviceManager.grantUserMediaDevicesPermissions({
|
|
3853
|
+
video: params.video,
|
|
3854
|
+
audio: !params.mute,
|
|
3855
|
+
closeStream: true
|
|
3856
|
+
}, function (result) {
|
|
3857
|
+
if (result.hasError) {
|
|
3858
|
+
callback && callback({
|
|
3859
|
+
hasError: true,
|
|
3860
|
+
errorCode: result.errorCode,
|
|
3861
|
+
errorMessage: result.errorMessage,
|
|
3862
|
+
});
|
|
3863
|
+
return;
|
|
3864
|
+
}
|
|
3865
|
+
|
|
3866
|
+
chatMessaging.sendMessage(acceptCallData, {
|
|
3867
|
+
onResult: function (result) {
|
|
3868
|
+
// if(!result.hasError && isMovingToNewCall) {
|
|
3869
|
+
// chatEvents.fireEvent("callEvents", {
|
|
3870
|
+
// type: 'MOVING_TO_NEW_CALL',
|
|
3871
|
+
// status: 'DONE',
|
|
3872
|
+
// result: {
|
|
3873
|
+
// oldCall: currentCallId,
|
|
3874
|
+
// newCall: params.callId
|
|
3875
|
+
// }
|
|
3876
|
+
// });
|
|
3877
|
+
// } else {
|
|
3878
|
+
// chatEvents.fireEvent("callEvents", {
|
|
3879
|
+
// type: 'MOVING_TO_NEW_CALL',
|
|
3880
|
+
// status: 'FAILED',
|
|
3881
|
+
// result: {
|
|
3882
|
+
// oldCall: currentCallId,
|
|
3883
|
+
// newCall: params.callId
|
|
3884
|
+
// }
|
|
3885
|
+
// });
|
|
3886
|
+
// }
|
|
3887
|
+
|
|
3888
|
+
callback && callback(result);
|
|
3889
|
+
}
|
|
3890
|
+
});
|
|
3891
|
+
});
|
|
3892
|
+
|
|
3893
|
+
/* new Promise((resolve, reject) => {
|
|
3783
3894
|
if(callStopQueue.callStarted) {
|
|
3784
3895
|
isMovingToNewCall = true;
|
|
3785
3896
|
// callStop(false);
|
|
@@ -3794,9 +3905,9 @@ function ChatCall(params) {
|
|
|
3794
3905
|
endCall({callId: currentCallId});
|
|
3795
3906
|
setTimeout(()=>{
|
|
3796
3907
|
resolve(true);
|
|
3797
|
-
callRequestController.imCallOwner = false;
|
|
3798
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3799
|
-
callRequestController.callRequestReceived = true;
|
|
3908
|
+
// callRequestController.imCallOwner = false;
|
|
3909
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3910
|
+
// callRequestController.callRequestReceived = true;
|
|
3800
3911
|
currentCallId = params.callId;
|
|
3801
3912
|
chatEvents.fireEvent('callEvents', {
|
|
3802
3913
|
type: 'CALL_SESSION_CREATED',
|
|
@@ -3858,7 +3969,7 @@ function ChatCall(params) {
|
|
|
3858
3969
|
}
|
|
3859
3970
|
});
|
|
3860
3971
|
});
|
|
3861
|
-
})
|
|
3972
|
+
})*/
|
|
3862
3973
|
};
|
|
3863
3974
|
|
|
3864
3975
|
this.rejectCall = this.cancelCall = function (params, callback) {
|
|
@@ -4704,12 +4815,17 @@ function ChatCall(params) {
|
|
|
4704
4815
|
if (params) {
|
|
4705
4816
|
if (Array.isArray(params.userIds) && params.userIds.length) {
|
|
4706
4817
|
for( let i in params.userIds) {
|
|
4818
|
+
let user = callUsers[params.userIds[i]];
|
|
4819
|
+
|
|
4820
|
+
if(!user || !user.video)
|
|
4821
|
+
continue;
|
|
4822
|
+
|
|
4707
4823
|
callStateController.activateParticipantStream(
|
|
4708
|
-
|
|
4824
|
+
user.userId,
|
|
4709
4825
|
'video',
|
|
4710
4826
|
'receive',
|
|
4711
4827
|
'videoTopicName',
|
|
4712
|
-
callUsers[
|
|
4828
|
+
callUsers[user.userId].topicSend,
|
|
4713
4829
|
'video'
|
|
4714
4830
|
);
|
|
4715
4831
|
}
|