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/dist/node/call.module.js
CHANGED
|
@@ -9,6 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
12
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
17
|
|
|
14
18
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -53,6 +57,8 @@ function ChatCall(params) {
|
|
|
53
57
|
callVideoMinWidth = params.callOptions && params.callOptions.hasOwnProperty('callVideo') && (0, _typeof2["default"])(params.callOptions.callVideo) === 'object' && params.callOptions.callVideo.hasOwnProperty('minWidth') ? params.callOptions.callVideo.minWidth : 320,
|
|
54
58
|
callVideoMinHeight = params.callOptions && params.callOptions.hasOwnProperty('callVideo') && (0, _typeof2["default"])(params.callOptions.callVideo) === 'object' && params.callOptions.callVideo.hasOwnProperty('minHeight') ? params.callOptions.callVideo.minHeight : 180,
|
|
55
59
|
currentCallParams = {},
|
|
60
|
+
requestedCallId = null,
|
|
61
|
+
acceptedCallId = null,
|
|
56
62
|
currentCallId = null,
|
|
57
63
|
latestCallRequestId = null,
|
|
58
64
|
//shouldReconnectCallTimeout = null,
|
|
@@ -78,8 +84,16 @@ function ChatCall(params) {
|
|
|
78
84
|
callRequestReceived: false,
|
|
79
85
|
callEstablishedInMySide: false,
|
|
80
86
|
callRequestTimeout: null,
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
iRequestedCall: false,
|
|
88
|
+
iAcceptedCall: false,
|
|
89
|
+
canProcessStartCall: function canProcessStartCall(callId) {
|
|
90
|
+
consoleLogging && console.log("[SDK] canProcessStartCall:", {
|
|
91
|
+
callId: callId
|
|
92
|
+
}, {
|
|
93
|
+
acceptedCallId: acceptedCallId
|
|
94
|
+
}, callRequestController.iAcceptedCall, callRequestController.iAcceptedCall && acceptedCallId == callId);
|
|
95
|
+
if (callRequestController.iAcceptedCall && acceptedCallId == callId || callRequestController.iRequestedCall && requestedCallId == callId) return true;
|
|
96
|
+
return false; //callRequestController.callRequestReceived && callRequestController.callEstablishedInMySide;
|
|
83
97
|
},
|
|
84
98
|
cameraPaused: true
|
|
85
99
|
},
|
|
@@ -617,8 +631,7 @@ function ChatCall(params) {
|
|
|
617
631
|
manager.watchAudioLevel();
|
|
618
632
|
}
|
|
619
633
|
|
|
620
|
-
config.state = peerStates.CONNECTED;
|
|
621
|
-
callRequestController.callEstablishedInMySide = true;
|
|
634
|
+
config.state = peerStates.CONNECTED; // callRequestController.callEstablishedInMySide = true;
|
|
622
635
|
|
|
623
636
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
624
637
|
type: 'CALL_STATUS',
|
|
@@ -1333,11 +1346,9 @@ function ChatCall(params) {
|
|
|
1333
1346
|
//params.typeCode,
|
|
1334
1347
|
pushMsgType: 3,
|
|
1335
1348
|
token: token
|
|
1336
|
-
};
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1349
|
+
}; // if (!callRequestController.callEstablishedInMySide) {
|
|
1350
|
+
// return;
|
|
1351
|
+
// }
|
|
1341
1352
|
|
|
1342
1353
|
if (params) {
|
|
1343
1354
|
if (typeof +params.callId === 'number' && params.callId > 0) {
|
|
@@ -1430,6 +1441,8 @@ function ChatCall(params) {
|
|
|
1430
1441
|
callStateController = {
|
|
1431
1442
|
createSessionInChat: function createSessionInChat(params) {
|
|
1432
1443
|
currentCallParams = params;
|
|
1444
|
+
callStopQueue.callStarted = true;
|
|
1445
|
+
this.startCall(params);
|
|
1433
1446
|
|
|
1434
1447
|
var callController = this,
|
|
1435
1448
|
totalRetries = 1,
|
|
@@ -1440,12 +1453,16 @@ function ChatCall(params) {
|
|
|
1440
1453
|
},
|
|
1441
1454
|
onResultCallback = function onResultCallback(res) {
|
|
1442
1455
|
if (res.done === 'TRUE') {
|
|
1443
|
-
callStopQueue.callStarted = true;
|
|
1444
|
-
|
|
1456
|
+
callStopQueue.callStarted = true; // callController.startCall(params);
|
|
1457
|
+
} else {
|
|
1458
|
+
endCall({
|
|
1459
|
+
callId: currentCallId
|
|
1460
|
+
});
|
|
1461
|
+
callStop(true, true);
|
|
1445
1462
|
}
|
|
1446
1463
|
/*else if (res.done === 'SKIP') {
|
|
1447
|
-
|
|
1448
|
-
|
|
1464
|
+
callStopQueue.callStarted = true;
|
|
1465
|
+
callController.startCall(params);
|
|
1449
1466
|
}*/
|
|
1450
1467
|
|
|
1451
1468
|
/*else {
|
|
@@ -1709,7 +1726,8 @@ function ChatCall(params) {
|
|
|
1709
1726
|
}
|
|
1710
1727
|
},
|
|
1711
1728
|
maybeReconnectAllTopics: function maybeReconnectAllTopics() {
|
|
1712
|
-
if (!callUsers || !Object.keys(callUsers).length
|
|
1729
|
+
if (!callUsers || !Object.keys(callUsers).length) //|| !callRequestController.callEstablishedInMySide
|
|
1730
|
+
return;
|
|
1713
1731
|
|
|
1714
1732
|
for (var i in callUsers) {
|
|
1715
1733
|
// let videoTopic = callUsers[i].videoTopicName, audioTopic = callUsers[i].audioTopicName;
|
|
@@ -2268,33 +2286,41 @@ function ChatCall(params) {
|
|
|
2268
2286
|
},
|
|
2269
2287
|
*/
|
|
2270
2288
|
callStop = function callStop() {
|
|
2271
|
-
var
|
|
2272
|
-
var
|
|
2273
|
-
|
|
2289
|
+
var resetCurrentCallId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2290
|
+
var resetCameraPaused = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2291
|
+
return new Promise(function (resolve, reject) {
|
|
2292
|
+
// callTopicHealthChecker.stopTopicsHealthCheck();
|
|
2293
|
+
_deviceManager["default"].mediaStreams().stopVideoInput();
|
|
2274
2294
|
|
|
2275
|
-
|
|
2276
|
-
_deviceManager["default"].mediaStreams().stopVideoInput();
|
|
2295
|
+
_deviceManager["default"].mediaStreams().stopAudioInput();
|
|
2277
2296
|
|
|
2278
|
-
|
|
2297
|
+
_deviceManager["default"].mediaStreams().stopScreenShareInput();
|
|
2279
2298
|
|
|
2280
|
-
|
|
2299
|
+
callStateController.removeAllCallParticipants();
|
|
2281
2300
|
|
|
2282
|
-
|
|
2301
|
+
if (callStopQueue.callStarted) {
|
|
2302
|
+
sendCallMessage({
|
|
2303
|
+
id: 'CLOSE'
|
|
2304
|
+
}, null, {});
|
|
2305
|
+
callStopQueue.callStarted = false;
|
|
2306
|
+
}
|
|
2283
2307
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2308
|
+
if (resetCameraPaused) callRequestController.cameraPaused = false; // callRequestController.iRequestedCall = false;
|
|
2309
|
+
// callRequestController.iAcceptedCall = false;
|
|
2310
|
+
//acceptedCallId = null;
|
|
2311
|
+
//requestedCallId = null;
|
|
2312
|
+
// callRequestController.callEstablishedInMySide = false;
|
|
2313
|
+
// callRequestController.callRequestReceived = false;
|
|
2290
2314
|
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2315
|
+
clearTimeout(callRequestController.callRequestTimeout); // if(resetCallOwner)
|
|
2316
|
+
// callRequestController.imCallOwner = false;
|
|
2317
|
+
|
|
2318
|
+
currentCallParams = {};
|
|
2319
|
+
if (resetCurrentCallId) currentCallId = null;
|
|
2320
|
+
setTimeout(function () {
|
|
2321
|
+
resolve(true);
|
|
2322
|
+
}, 2000);
|
|
2323
|
+
});
|
|
2298
2324
|
},
|
|
2299
2325
|
restartMediaOnKeyFrame = function restartMediaOnKeyFrame(userId, timeouts) {
|
|
2300
2326
|
if (callServerController.isJanus()) return;
|
|
@@ -2657,7 +2683,7 @@ function ChatCall(params) {
|
|
|
2657
2683
|
* Type 70 Send Call Request
|
|
2658
2684
|
*/
|
|
2659
2685
|
case _constants.chatMessageVOTypes.CALL_REQUEST:
|
|
2660
|
-
callRequestController.callRequestReceived = true;
|
|
2686
|
+
// callRequestController.callRequestReceived = true;
|
|
2661
2687
|
callReceived({
|
|
2662
2688
|
callId: messageContent.callId
|
|
2663
2689
|
}, function (r) {});
|
|
@@ -2734,7 +2760,7 @@ function ChatCall(params) {
|
|
|
2734
2760
|
|
|
2735
2761
|
|
|
2736
2762
|
latestCallRequestId = messageContent.callId; // }
|
|
2737
|
-
} else {
|
|
2763
|
+
} else if (callRequestController.iRequestedCall) {
|
|
2738
2764
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
2739
2765
|
type: 'PARTNER_RECEIVED_YOUR_CALL',
|
|
2740
2766
|
result: messageContent
|
|
@@ -2748,7 +2774,7 @@ function ChatCall(params) {
|
|
|
2748
2774
|
*/
|
|
2749
2775
|
|
|
2750
2776
|
case _constants.chatMessageVOTypes.START_CALL:
|
|
2751
|
-
if (!callRequestController.
|
|
2777
|
+
if (!callRequestController.canProcessStartCall(threadId)) {
|
|
2752
2778
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
2753
2779
|
type: 'CALL_STARTED_ELSEWHERE',
|
|
2754
2780
|
message: 'Call already started somewhere else..., aborting...'
|
|
@@ -2757,47 +2783,18 @@ function ChatCall(params) {
|
|
|
2757
2783
|
return;
|
|
2758
2784
|
}
|
|
2759
2785
|
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
2764
|
-
chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount));
|
|
2765
|
-
}
|
|
2766
|
-
|
|
2767
|
-
messageContent.callId = threadId;
|
|
2768
|
-
|
|
2769
|
-
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
2770
|
-
type: 'CALL_STARTED',
|
|
2771
|
-
result: messageContent
|
|
2772
|
-
});
|
|
2773
|
-
|
|
2774
|
-
if ((0, _typeof2["default"])(messageContent) === 'object' && messageContent.hasOwnProperty('chatDataDto') && !!messageContent.chatDataDto.kurentoAddress) {
|
|
2775
|
-
callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));
|
|
2776
|
-
startCallWebRTCFunctions({
|
|
2777
|
-
video: messageContent.clientDTO.video,
|
|
2778
|
-
mute: messageContent.clientDTO.mute,
|
|
2779
|
-
sendingTopic: messageContent.clientDTO.topicSend,
|
|
2780
|
-
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
2781
|
-
screenShare: messageContent.chatDataDto.screenShare,
|
|
2782
|
-
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
2783
|
-
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
2784
|
-
internalTurnAddress: messageContent.chatDataDto.internalTurnAddress,
|
|
2785
|
-
selfData: messageContent.clientDTO,
|
|
2786
|
-
clientsList: messageContent.otherClientDtoList,
|
|
2787
|
-
screenShareOwner: +messageContent.chatDataDto.screenShareUser,
|
|
2788
|
-
recordingOwner: +messageContent.chatDataDto.recordingUser
|
|
2789
|
-
}, function (callDivs) {
|
|
2790
|
-
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
2791
|
-
type: 'CALL_DIVS',
|
|
2792
|
-
result: callDivs
|
|
2793
|
-
});
|
|
2786
|
+
if (currentCallId) {
|
|
2787
|
+
endCall({
|
|
2788
|
+
callId: currentCallId
|
|
2794
2789
|
});
|
|
2790
|
+
callStop(true, false);
|
|
2791
|
+
setTimeout(function () {
|
|
2792
|
+
currentCallId = threadId;
|
|
2793
|
+
processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId);
|
|
2794
|
+
}, 5000);
|
|
2795
2795
|
} else {
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
message: 'Chat Data DTO is not present!',
|
|
2799
|
-
environmentDetails: getSDKCallDetails()
|
|
2800
|
-
});
|
|
2796
|
+
currentCallId = threadId;
|
|
2797
|
+
processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId);
|
|
2801
2798
|
}
|
|
2802
2799
|
|
|
2803
2800
|
break;
|
|
@@ -2904,7 +2901,7 @@ function ChatCall(params) {
|
|
|
2904
2901
|
*/
|
|
2905
2902
|
|
|
2906
2903
|
case _constants.chatMessageVOTypes.GROUP_CALL_REQUEST:
|
|
2907
|
-
callRequestController.callRequestReceived = true;
|
|
2904
|
+
// callRequestController.callRequestReceived = true;
|
|
2908
2905
|
callReceived({
|
|
2909
2906
|
callId: messageContent.callId
|
|
2910
2907
|
}, function (r) {});
|
|
@@ -3008,6 +3005,11 @@ function ChatCall(params) {
|
|
|
3008
3005
|
if (!correctedData.mute) {
|
|
3009
3006
|
callStateController.startParticipantAudio(correctedData.userId);
|
|
3010
3007
|
}
|
|
3008
|
+
|
|
3009
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3010
|
+
type: 'CALL_DIVS',
|
|
3011
|
+
result: generateCallUIList()
|
|
3012
|
+
});
|
|
3011
3013
|
}, 500);
|
|
3012
3014
|
};
|
|
3013
3015
|
|
|
@@ -3016,11 +3018,6 @@ function ChatCall(params) {
|
|
|
3016
3018
|
}
|
|
3017
3019
|
}
|
|
3018
3020
|
|
|
3019
|
-
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3020
|
-
type: 'CALL_DIVS',
|
|
3021
|
-
result: generateCallUIList()
|
|
3022
|
-
});
|
|
3023
|
-
|
|
3024
3021
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3025
3022
|
type: 'CALL_PARTICIPANT_JOINED',
|
|
3026
3023
|
result: messageContent
|
|
@@ -3195,14 +3192,18 @@ function ChatCall(params) {
|
|
|
3195
3192
|
*/
|
|
3196
3193
|
|
|
3197
3194
|
case _constants.chatMessageVOTypes.CALL_SESSION_CREATED:
|
|
3198
|
-
if
|
|
3195
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3196
|
+
// return;
|
|
3197
|
+
if (callRequestController.iRequestedCall) {
|
|
3198
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3199
|
+
type: 'CALL_SESSION_CREATED',
|
|
3200
|
+
result: messageContent
|
|
3201
|
+
}); // if(!requestedCallId) {
|
|
3199
3202
|
|
|
3200
|
-
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3201
|
-
type: 'CALL_SESSION_CREATED',
|
|
3202
|
-
result: messageContent
|
|
3203
|
-
});
|
|
3204
3203
|
|
|
3205
|
-
|
|
3204
|
+
requestedCallId = messageContent.callId;
|
|
3205
|
+
} // }
|
|
3206
|
+
|
|
3206
3207
|
|
|
3207
3208
|
break;
|
|
3208
3209
|
|
|
@@ -3303,7 +3304,8 @@ function ChatCall(params) {
|
|
|
3303
3304
|
*/
|
|
3304
3305
|
|
|
3305
3306
|
case _constants.chatMessageVOTypes.START_SCREEN_SHARE:
|
|
3306
|
-
if
|
|
3307
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3308
|
+
// return;
|
|
3307
3309
|
screenShareInfo.setIsStarted(true);
|
|
3308
3310
|
screenShareInfo.setOwner(messageContent.screenOwner.id);
|
|
3309
3311
|
|
|
@@ -3361,8 +3363,8 @@ function ChatCall(params) {
|
|
|
3361
3363
|
*/
|
|
3362
3364
|
|
|
3363
3365
|
case _constants.chatMessageVOTypes.DESTINED_RECORD_CALL:
|
|
3364
|
-
if
|
|
3365
|
-
|
|
3366
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3367
|
+
// return;
|
|
3366
3368
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
3367
3369
|
chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount));
|
|
3368
3370
|
}
|
|
@@ -3461,228 +3463,355 @@ function ChatCall(params) {
|
|
|
3461
3463
|
}
|
|
3462
3464
|
};
|
|
3463
3465
|
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
//params.typeCode,
|
|
3469
|
-
pushMsgType: 3,
|
|
3470
|
-
token: token
|
|
3471
|
-
},
|
|
3472
|
-
content = {
|
|
3473
|
-
creatorClientDto: {}
|
|
3474
|
-
};
|
|
3466
|
+
function processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId) {
|
|
3467
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
3468
|
+
chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount));
|
|
3469
|
+
}
|
|
3475
3470
|
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
content.type = callTypes[params.type.toUpperCase()];
|
|
3479
|
-
} else {
|
|
3480
|
-
content.type = 0x0; // Defaults to AUDIO Call
|
|
3481
|
-
}
|
|
3471
|
+
callStopQueue.callStarted = true;
|
|
3472
|
+
messageContent.callId = threadId;
|
|
3482
3473
|
|
|
3483
|
-
|
|
3484
|
-
|
|
3474
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3475
|
+
type: 'CALL_STARTED',
|
|
3476
|
+
result: messageContent
|
|
3477
|
+
});
|
|
3485
3478
|
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3479
|
+
if ((0, _typeof2["default"])(messageContent) === 'object' && messageContent.hasOwnProperty('chatDataDto') && !!messageContent.chatDataDto.kurentoAddress) {
|
|
3480
|
+
callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));
|
|
3481
|
+
startCallWebRTCFunctions({
|
|
3482
|
+
video: messageContent.clientDTO.video,
|
|
3483
|
+
mute: messageContent.clientDTO.mute,
|
|
3484
|
+
sendingTopic: messageContent.clientDTO.topicSend,
|
|
3485
|
+
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
3486
|
+
screenShare: messageContent.chatDataDto.screenShare,
|
|
3487
|
+
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
3488
|
+
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
3489
|
+
internalTurnAddress: messageContent.chatDataDto.internalTurnAddress,
|
|
3490
|
+
selfData: messageContent.clientDTO,
|
|
3491
|
+
clientsList: messageContent.otherClientDtoList,
|
|
3492
|
+
screenShareOwner: +messageContent.chatDataDto.screenShareUser,
|
|
3493
|
+
recordingOwner: +messageContent.chatDataDto.recordingUser
|
|
3494
|
+
}, function (callDivs) {
|
|
3495
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3496
|
+
type: 'CALL_DIVS',
|
|
3497
|
+
result: callDivs
|
|
3498
|
+
});
|
|
3499
|
+
});
|
|
3500
|
+
} else {
|
|
3501
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3502
|
+
type: 'CALL_ERROR',
|
|
3503
|
+
message: 'Chat Data DTO is not present!',
|
|
3504
|
+
environmentDetails: getSDKCallDetails()
|
|
3505
|
+
});
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3491
3508
|
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3509
|
+
this.startCall = /*#__PURE__*/function () {
|
|
3510
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params, callback) {
|
|
3511
|
+
var startCallData, content, i, tempInvitee;
|
|
3512
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3513
|
+
while (1) {
|
|
3514
|
+
switch (_context.prev = _context.next) {
|
|
3515
|
+
case 0:
|
|
3516
|
+
startCallData = {
|
|
3517
|
+
chatMessageVOType: _constants.chatMessageVOTypes.CALL_REQUEST,
|
|
3518
|
+
typeCode: generalTypeCode,
|
|
3519
|
+
//params.typeCode,
|
|
3520
|
+
pushMsgType: 3,
|
|
3521
|
+
token: token
|
|
3522
|
+
}, content = {
|
|
3523
|
+
creatorClientDto: {}
|
|
3524
|
+
};
|
|
3497
3525
|
|
|
3498
|
-
|
|
3499
|
-
|
|
3526
|
+
if (!params) {
|
|
3527
|
+
_context.next = 21;
|
|
3528
|
+
break;
|
|
3529
|
+
}
|
|
3500
3530
|
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
} else {
|
|
3507
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3508
|
-
code: 999,
|
|
3509
|
-
message: 'Invitees list is empty! Send an array of invitees to start a call with, Or send a Thread Id to start a call with current participants'
|
|
3510
|
-
});
|
|
3531
|
+
if (typeof params.type === 'string' && callTypes.hasOwnProperty(params.type.toUpperCase())) {
|
|
3532
|
+
content.type = callTypes[params.type.toUpperCase()];
|
|
3533
|
+
} else {
|
|
3534
|
+
content.type = 0x0; // Defaults to AUDIO Call
|
|
3535
|
+
}
|
|
3511
3536
|
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
}
|
|
3537
|
+
content.creatorClientDto.mute = params.mute && typeof params.mute === 'boolean' ? params.mute : false;
|
|
3538
|
+
content.mute = params.mute && typeof params.mute === 'boolean' ? params.mute : false;
|
|
3515
3539
|
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3540
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
3541
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3542
|
+
} else {
|
|
3543
|
+
content.creatorClientDto.clientType = callClientType.WEB;
|
|
3544
|
+
}
|
|
3519
3545
|
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
message: 'No params have been sent to start call!'
|
|
3525
|
-
});
|
|
3546
|
+
if (!(typeof +params.threadId === 'number' && +params.threadId > 0)) {
|
|
3547
|
+
_context.next = 10;
|
|
3548
|
+
break;
|
|
3549
|
+
}
|
|
3526
3550
|
|
|
3527
|
-
|
|
3528
|
-
|
|
3551
|
+
content.threadId = +params.threadId;
|
|
3552
|
+
_context.next = 17;
|
|
3553
|
+
break;
|
|
3529
3554
|
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3555
|
+
case 10:
|
|
3556
|
+
if (!(Array.isArray(params.invitees) && params.invitees.length)) {
|
|
3557
|
+
_context.next = 15;
|
|
3558
|
+
break;
|
|
3559
|
+
}
|
|
3534
3560
|
|
|
3535
|
-
|
|
3536
|
-
video: params.type == 'video',
|
|
3537
|
-
audio: !params.mute,
|
|
3538
|
-
closeStream: true
|
|
3539
|
-
}, function (result) {
|
|
3540
|
-
if (result.hasError) {
|
|
3541
|
-
callback && callback({
|
|
3542
|
-
hasError: true,
|
|
3543
|
-
errorCode: result.errorCode,
|
|
3544
|
-
errorMessage: result.errorMessage
|
|
3545
|
-
});
|
|
3546
|
-
return;
|
|
3547
|
-
}
|
|
3561
|
+
content.invitees = []; //params.invitees;
|
|
3548
3562
|
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
//Reject the call if participant didn't answer
|
|
3552
|
-
if (!callStopQueue.callStarted) {
|
|
3553
|
-
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3554
|
-
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3555
|
-
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3556
|
-
});
|
|
3563
|
+
for (i = 0; i < params.invitees.length; i++) {
|
|
3564
|
+
tempInvitee = params.invitees[i];
|
|
3557
3565
|
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3566
|
+
if (tempInvitee && typeof tempInvitee.idType === "string") {
|
|
3567
|
+
tempInvitee.idType = _constants.inviteeVOidTypes[tempInvitee.idType];
|
|
3568
|
+
content.invitees.push(tempInvitee);
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
_context.next = 17;
|
|
3573
|
+
break;
|
|
3574
|
+
|
|
3575
|
+
case 15:
|
|
3576
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3577
|
+
code: 999,
|
|
3578
|
+
message: 'Invitees list is empty! Send an array of invitees to start a call with, Or send a Thread Id to start a call with current participants'
|
|
3579
|
+
});
|
|
3580
|
+
|
|
3581
|
+
return _context.abrupt("return");
|
|
3582
|
+
|
|
3583
|
+
case 17:
|
|
3584
|
+
if (params.threadInfo && (params.threadInfo.metadata || params.threadInfo.uniqueName)) {
|
|
3585
|
+
content.createCallThreadRequest = params.threadInfo;
|
|
3586
|
+
}
|
|
3567
3587
|
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3588
|
+
startCallData.content = JSON.stringify(content);
|
|
3589
|
+
_context.next = 23;
|
|
3590
|
+
break;
|
|
3591
|
+
|
|
3592
|
+
case 21:
|
|
3593
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3594
|
+
code: 999,
|
|
3595
|
+
message: 'No params have been sent to start call!'
|
|
3596
|
+
});
|
|
3597
|
+
|
|
3598
|
+
return _context.abrupt("return");
|
|
3599
|
+
|
|
3600
|
+
case 23:
|
|
3601
|
+
// if(currentCallId) {
|
|
3602
|
+
// await callStop();
|
|
3603
|
+
// }
|
|
3604
|
+
callRequestController.cameraPaused = typeof params.cameraPaused === 'boolean' ? params.cameraPaused : false; // callRequestController.callRequestReceived = true;
|
|
3605
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3606
|
+
// callRequestController.imCallOwner = true;
|
|
3607
|
+
|
|
3608
|
+
callRequestController.iRequestedCall = true;
|
|
3609
|
+
|
|
3610
|
+
_deviceManager["default"].grantUserMediaDevicesPermissions({
|
|
3611
|
+
video: params.type == 'video',
|
|
3612
|
+
audio: !params.mute,
|
|
3613
|
+
closeStream: true
|
|
3614
|
+
}, function (result) {
|
|
3615
|
+
if (result.hasError) {
|
|
3616
|
+
callback && callback({
|
|
3617
|
+
hasError: true,
|
|
3618
|
+
errorCode: result.errorCode,
|
|
3619
|
+
errorMessage: result.errorMessage
|
|
3620
|
+
});
|
|
3621
|
+
return;
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
if (callNoAnswerTimeout) {
|
|
3625
|
+
callRequestController.callRequestTimeout = setTimeout(function (metaData) {
|
|
3626
|
+
//Reject the call if participant didn't answer
|
|
3627
|
+
if (!callStopQueue.callStarted) {
|
|
3628
|
+
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3629
|
+
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3630
|
+
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3631
|
+
});
|
|
3632
|
+
|
|
3633
|
+
metaData.callInstance.rejectCall({
|
|
3634
|
+
callId: metaData.currentCallId
|
|
3635
|
+
});
|
|
3636
|
+
}
|
|
3637
|
+
}, callNoAnswerTimeout, {
|
|
3638
|
+
callInstance: currentModuleInstance,
|
|
3639
|
+
currentCallId: currentCallId
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
chatMessaging.sendMessage(startCallData, {
|
|
3644
|
+
onResult: function onResult(result) {
|
|
3645
|
+
callback && callback(result);
|
|
3646
|
+
}
|
|
3647
|
+
});
|
|
3648
|
+
});
|
|
3649
|
+
|
|
3650
|
+
case 26:
|
|
3651
|
+
case "end":
|
|
3652
|
+
return _context.stop();
|
|
3653
|
+
}
|
|
3571
3654
|
}
|
|
3572
|
-
});
|
|
3573
|
-
});
|
|
3574
|
-
};
|
|
3655
|
+
}, _callee);
|
|
3656
|
+
}));
|
|
3575
3657
|
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
chatMessageVOType: _constants.chatMessageVOTypes.GROUP_CALL_REQUEST,
|
|
3579
|
-
typeCode: generalTypeCode,
|
|
3580
|
-
//params.typeCode,
|
|
3581
|
-
pushMsgType: 3,
|
|
3582
|
-
token: token
|
|
3583
|
-
},
|
|
3584
|
-
content = {
|
|
3585
|
-
creatorClientDto: {}
|
|
3658
|
+
return function (_x, _x2) {
|
|
3659
|
+
return _ref3.apply(this, arguments);
|
|
3586
3660
|
};
|
|
3661
|
+
}();
|
|
3662
|
+
|
|
3663
|
+
this.startGroupCall = /*#__PURE__*/function () {
|
|
3664
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(params, callback) {
|
|
3665
|
+
var startCallData, content, i, tempInvitee;
|
|
3666
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3667
|
+
while (1) {
|
|
3668
|
+
switch (_context2.prev = _context2.next) {
|
|
3669
|
+
case 0:
|
|
3670
|
+
startCallData = {
|
|
3671
|
+
chatMessageVOType: _constants.chatMessageVOTypes.GROUP_CALL_REQUEST,
|
|
3672
|
+
typeCode: generalTypeCode,
|
|
3673
|
+
//params.typeCode,
|
|
3674
|
+
pushMsgType: 3,
|
|
3675
|
+
token: token
|
|
3676
|
+
}, content = {
|
|
3677
|
+
creatorClientDto: {}
|
|
3678
|
+
};
|
|
3587
3679
|
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
content.type = 0x0; // Defaults to AUDIO Call
|
|
3593
|
-
}
|
|
3680
|
+
if (!params) {
|
|
3681
|
+
_context2.next = 20;
|
|
3682
|
+
break;
|
|
3683
|
+
}
|
|
3594
3684
|
|
|
3595
|
-
|
|
3685
|
+
if (typeof params.type === 'string' && callTypes.hasOwnProperty(params.type.toUpperCase())) {
|
|
3686
|
+
content.type = callTypes[params.type.toUpperCase()];
|
|
3687
|
+
} else {
|
|
3688
|
+
content.type = 0x0; // Defaults to AUDIO Call
|
|
3689
|
+
}
|
|
3596
3690
|
|
|
3597
|
-
|
|
3598
|
-
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3599
|
-
} else {
|
|
3600
|
-
content.creatorClientDto.clientType = callClientType.WEB;
|
|
3601
|
-
}
|
|
3691
|
+
content.creatorClientDto.mute = typeof params.mute === 'boolean' ? params.mute : false;
|
|
3602
3692
|
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3693
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
3694
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3695
|
+
} else {
|
|
3696
|
+
content.creatorClientDto.clientType = callClientType.WEB;
|
|
3697
|
+
}
|
|
3608
3698
|
|
|
3609
|
-
|
|
3610
|
-
|
|
3699
|
+
if (!(typeof +params.threadId === 'number' && params.threadId > 0)) {
|
|
3700
|
+
_context2.next = 9;
|
|
3701
|
+
break;
|
|
3702
|
+
}
|
|
3611
3703
|
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
}
|
|
3616
|
-
}
|
|
3617
|
-
} else {
|
|
3618
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3619
|
-
code: 999,
|
|
3620
|
-
message: 'Invitees list is empty! Send an array of invitees to start a call with, Or send a Thread Id to start a call with current participants'
|
|
3621
|
-
});
|
|
3704
|
+
content.threadId = +params.threadId;
|
|
3705
|
+
_context2.next = 16;
|
|
3706
|
+
break;
|
|
3622
3707
|
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3708
|
+
case 9:
|
|
3709
|
+
if (!Array.isArray(params.invitees)) {
|
|
3710
|
+
_context2.next = 14;
|
|
3711
|
+
break;
|
|
3712
|
+
}
|
|
3626
3713
|
|
|
3627
|
-
|
|
3628
|
-
content.createCallThreadRequest = params.threadInfo;
|
|
3629
|
-
}
|
|
3714
|
+
content.invitees = [];
|
|
3630
3715
|
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3634
|
-
code: 999,
|
|
3635
|
-
message: 'No params have been sent to start call!'
|
|
3636
|
-
});
|
|
3716
|
+
for (i = 0; i < params.invitees.length; i++) {
|
|
3717
|
+
tempInvitee = params.invitees[i];
|
|
3637
3718
|
|
|
3638
|
-
|
|
3639
|
-
|
|
3719
|
+
if (tempInvitee && typeof tempInvitee.idType === "string") {
|
|
3720
|
+
tempInvitee.idType = _constants.inviteeVOidTypes[tempInvitee.idType];
|
|
3721
|
+
content.invitees.push(tempInvitee);
|
|
3722
|
+
}
|
|
3723
|
+
}
|
|
3640
3724
|
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3644
|
-
callRequestController.imCallOwner = true;
|
|
3725
|
+
_context2.next = 16;
|
|
3726
|
+
break;
|
|
3645
3727
|
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
if (result.hasError) {
|
|
3652
|
-
callback && callback({
|
|
3653
|
-
hasError: true,
|
|
3654
|
-
errorCode: result.errorCode,
|
|
3655
|
-
errorMessage: result.errorMessage
|
|
3656
|
-
});
|
|
3657
|
-
return;
|
|
3658
|
-
}
|
|
3728
|
+
case 14:
|
|
3729
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3730
|
+
code: 999,
|
|
3731
|
+
message: 'Invitees list is empty! Send an array of invitees to start a call with, Or send a Thread Id to start a call with current participants'
|
|
3732
|
+
});
|
|
3659
3733
|
|
|
3660
|
-
|
|
3661
|
-
callRequestController.callRequestTimeout = setTimeout(function (metaData) {
|
|
3662
|
-
//Reject the call if participant didn't answer
|
|
3663
|
-
if (!callStopQueue.callStarted) {
|
|
3664
|
-
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3665
|
-
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3666
|
-
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3667
|
-
});
|
|
3734
|
+
return _context2.abrupt("return");
|
|
3668
3735
|
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3736
|
+
case 16:
|
|
3737
|
+
if (params.threadInfo && (params.threadInfo.title || params.threadInfo.description || params.threadInfo.metadata || params.threadInfo.uniqueName)) {
|
|
3738
|
+
content.createCallThreadRequest = params.threadInfo;
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
startCallData.content = JSON.stringify(content);
|
|
3742
|
+
_context2.next = 22;
|
|
3743
|
+
break;
|
|
3744
|
+
|
|
3745
|
+
case 20:
|
|
3746
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3747
|
+
code: 999,
|
|
3748
|
+
message: 'No params have been sent to start call!'
|
|
3749
|
+
});
|
|
3750
|
+
|
|
3751
|
+
return _context2.abrupt("return");
|
|
3752
|
+
|
|
3753
|
+
case 22:
|
|
3754
|
+
// if(currentCallId) {
|
|
3755
|
+
// await callStop();
|
|
3756
|
+
// }
|
|
3757
|
+
callRequestController.cameraPaused = typeof params.cameraPaused === 'boolean' ? params.cameraPaused : false; // callRequestController.callRequestReceived = true;
|
|
3758
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3759
|
+
// callRequestController.imCallOwner = true;
|
|
3760
|
+
|
|
3761
|
+
callRequestController.iRequestedCall = true;
|
|
3678
3762
|
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3763
|
+
_deviceManager["default"].grantUserMediaDevicesPermissions({
|
|
3764
|
+
video: params.type == 'video',
|
|
3765
|
+
audio: !params.mute,
|
|
3766
|
+
closeStream: true
|
|
3767
|
+
}, function (result) {
|
|
3768
|
+
if (result.hasError) {
|
|
3769
|
+
callback && callback({
|
|
3770
|
+
hasError: true,
|
|
3771
|
+
errorCode: result.errorCode,
|
|
3772
|
+
errorMessage: result.errorMessage
|
|
3773
|
+
});
|
|
3774
|
+
return;
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
if (callNoAnswerTimeout) {
|
|
3778
|
+
callRequestController.callRequestTimeout = setTimeout(function (metaData) {
|
|
3779
|
+
//Reject the call if participant didn't answer
|
|
3780
|
+
if (!callStopQueue.callStarted) {
|
|
3781
|
+
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3782
|
+
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3783
|
+
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3784
|
+
});
|
|
3785
|
+
|
|
3786
|
+
metaData.callInstance.rejectCall({
|
|
3787
|
+
callId: metaData.currentCallId
|
|
3788
|
+
});
|
|
3789
|
+
}
|
|
3790
|
+
}, callNoAnswerTimeout, {
|
|
3791
|
+
callInstance: currentModuleInstance,
|
|
3792
|
+
currentCallId: currentCallId
|
|
3793
|
+
});
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
chatMessaging.sendMessage(startCallData, {
|
|
3797
|
+
onResult: function onResult(result) {
|
|
3798
|
+
callback && callback(result);
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3801
|
+
});
|
|
3802
|
+
|
|
3803
|
+
case 25:
|
|
3804
|
+
case "end":
|
|
3805
|
+
return _context2.stop();
|
|
3806
|
+
}
|
|
3682
3807
|
}
|
|
3683
|
-
});
|
|
3684
|
-
});
|
|
3685
|
-
|
|
3808
|
+
}, _callee2);
|
|
3809
|
+
}));
|
|
3810
|
+
|
|
3811
|
+
return function (_x3, _x4) {
|
|
3812
|
+
return _ref4.apply(this, arguments);
|
|
3813
|
+
};
|
|
3814
|
+
}();
|
|
3686
3815
|
|
|
3687
3816
|
this.sendCallMetaData = function (params) {
|
|
3688
3817
|
sendCallMetaData({
|
|
@@ -3734,143 +3863,219 @@ function ChatCall(params) {
|
|
|
3734
3863
|
});
|
|
3735
3864
|
};
|
|
3736
3865
|
|
|
3737
|
-
this.acceptCall = function (
|
|
3738
|
-
var
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3866
|
+
this.acceptCall = /*#__PURE__*/function () {
|
|
3867
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(params, callback) {
|
|
3868
|
+
var acceptCallData, content;
|
|
3869
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
3870
|
+
while (1) {
|
|
3871
|
+
switch (_context3.prev = _context3.next) {
|
|
3872
|
+
case 0:
|
|
3873
|
+
acceptCallData = {
|
|
3874
|
+
chatMessageVOType: _constants.chatMessageVOTypes.ACCEPT_CALL,
|
|
3875
|
+
typeCode: generalTypeCode,
|
|
3876
|
+
//params.typeCode,
|
|
3877
|
+
pushMsgType: 3,
|
|
3878
|
+
token: token
|
|
3879
|
+
}, content = {};
|
|
3880
|
+
|
|
3881
|
+
if (!params) {
|
|
3882
|
+
_context3.next = 17;
|
|
3883
|
+
break;
|
|
3884
|
+
}
|
|
3746
3885
|
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
(0, _errorHandler.raiseError)(_errorHandler.errorList.INVALID_CALLID, callback, true, {});
|
|
3752
|
-
/*chatEvents.fireEvent('error', {
|
|
3753
|
-
code: 999,
|
|
3754
|
-
message: 'Invalid call id!'
|
|
3755
|
-
});*/
|
|
3886
|
+
if (!(typeof +params.callId === 'number' && params.callId > 0)) {
|
|
3887
|
+
_context3.next = 6;
|
|
3888
|
+
break;
|
|
3889
|
+
}
|
|
3756
3890
|
|
|
3757
|
-
|
|
3758
|
-
|
|
3891
|
+
acceptCallData.subjectId = +params.callId;
|
|
3892
|
+
_context3.next = 8;
|
|
3893
|
+
break;
|
|
3759
3894
|
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3895
|
+
case 6:
|
|
3896
|
+
(0, _errorHandler.raiseError)(_errorHandler.errorList.INVALID_CALLID, callback, true, {});
|
|
3897
|
+
/*chatEvents.fireEvent('error', {
|
|
3898
|
+
code: 999,
|
|
3899
|
+
message: 'Invalid call id!'
|
|
3900
|
+
});*/
|
|
3764
3901
|
|
|
3765
|
-
|
|
3766
|
-
content.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3767
|
-
} else {
|
|
3768
|
-
content.clientType = callClientType.WEB;
|
|
3769
|
-
}
|
|
3902
|
+
return _context3.abrupt("return");
|
|
3770
3903
|
|
|
3771
|
-
|
|
3904
|
+
case 8:
|
|
3905
|
+
content.mute = typeof params.mute === 'boolean' ? params.mute : false;
|
|
3906
|
+
content.video = typeof params.video === 'boolean' ? params.video : false;
|
|
3907
|
+
content.videoCall = content.video;
|
|
3908
|
+
callRequestController.cameraPaused = typeof params.cameraPaused === 'boolean' ? params.cameraPaused : callRequestController.cameraPaused;
|
|
3772
3909
|
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3779
|
-
code: 999,
|
|
3780
|
-
message: 'No params have been sent to accept the call!'
|
|
3781
|
-
});
|
|
3910
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
3911
|
+
content.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3912
|
+
} else {
|
|
3913
|
+
content.clientType = callClientType.WEB;
|
|
3914
|
+
}
|
|
3782
3915
|
|
|
3783
|
-
|
|
3784
|
-
}
|
|
3916
|
+
acceptCallData.content = JSON.stringify(content);
|
|
3785
3917
|
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
new Promise(function (resolve, reject) {
|
|
3790
|
-
if (callStopQueue.callStarted) {
|
|
3791
|
-
isMovingToNewCall = true; // callStop(false);
|
|
3918
|
+
if (params.joinCall) {// callRequestController.callRequestReceived = true;
|
|
3919
|
+
// currentCallId = params.callId;
|
|
3920
|
+
}
|
|
3792
3921
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
status: 'PROCESSING',
|
|
3796
|
-
result: {
|
|
3797
|
-
oldCall: currentCallId,
|
|
3798
|
-
newCall: params.callId
|
|
3799
|
-
}
|
|
3800
|
-
});
|
|
3922
|
+
_context3.next = 19;
|
|
3923
|
+
break;
|
|
3801
3924
|
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
callRequestController.imCallOwner = false;
|
|
3808
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3809
|
-
callRequestController.callRequestReceived = true;
|
|
3810
|
-
currentCallId = params.callId;
|
|
3925
|
+
case 17:
|
|
3926
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3927
|
+
code: 999,
|
|
3928
|
+
message: 'No params have been sent to accept the call!'
|
|
3929
|
+
});
|
|
3811
3930
|
|
|
3812
|
-
|
|
3813
|
-
type: 'CALL_SESSION_CREATED',
|
|
3814
|
-
result: {
|
|
3815
|
-
callId: params.callId
|
|
3816
|
-
}
|
|
3817
|
-
});
|
|
3818
|
-
}, 3500);
|
|
3819
|
-
} else {
|
|
3820
|
-
resolve(true);
|
|
3821
|
-
}
|
|
3822
|
-
}).then(function () {
|
|
3823
|
-
if (isMovingToNewCall) _eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3824
|
-
type: 'MOVING_TO_NEW_CALL',
|
|
3825
|
-
status: 'STARTING',
|
|
3826
|
-
result: {
|
|
3827
|
-
oldCall: currentCallId,
|
|
3828
|
-
newCall: params.callId
|
|
3829
|
-
}
|
|
3830
|
-
});
|
|
3931
|
+
return _context3.abrupt("return");
|
|
3831
3932
|
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
}
|
|
3933
|
+
case 19:
|
|
3934
|
+
// if(callRequestController.iAcceptedCall || callRequestController.iRequestedCall) {
|
|
3935
|
+
// await callStop();
|
|
3936
|
+
// }
|
|
3937
|
+
// if(currentCallId) {
|
|
3938
|
+
// endCall({callId: currentCallId});
|
|
3939
|
+
// }
|
|
3940
|
+
acceptedCallId = parseInt(params.callId);
|
|
3941
|
+
callRequestController.iAcceptedCall = true; // console.log("acceptCall: ", {acceptedCallId}, callRequestController.iAcceptedCall);
|
|
3942
|
+
// callRequestController.imCallOwner = false;
|
|
3943
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3944
|
+
// let isMovingToNewCall = false;
|
|
3845
3945
|
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3859
|
-
type: 'MOVING_TO_NEW_CALL',
|
|
3860
|
-
status: 'FAILED',
|
|
3861
|
-
result: {
|
|
3862
|
-
oldCall: currentCallId,
|
|
3863
|
-
newCall: params.callId
|
|
3946
|
+
_deviceManager["default"].grantUserMediaDevicesPermissions({
|
|
3947
|
+
video: params.video,
|
|
3948
|
+
audio: !params.mute,
|
|
3949
|
+
closeStream: true
|
|
3950
|
+
}, function (result) {
|
|
3951
|
+
if (result.hasError) {
|
|
3952
|
+
callback && callback({
|
|
3953
|
+
hasError: true,
|
|
3954
|
+
errorCode: result.errorCode,
|
|
3955
|
+
errorMessage: result.errorMessage
|
|
3956
|
+
});
|
|
3957
|
+
return;
|
|
3864
3958
|
}
|
|
3865
|
-
});
|
|
3866
|
-
}
|
|
3867
3959
|
|
|
3868
|
-
|
|
3960
|
+
chatMessaging.sendMessage(acceptCallData, {
|
|
3961
|
+
onResult: function onResult(result) {
|
|
3962
|
+
// if(!result.hasError && isMovingToNewCall) {
|
|
3963
|
+
// chatEvents.fireEvent("callEvents", {
|
|
3964
|
+
// type: 'MOVING_TO_NEW_CALL',
|
|
3965
|
+
// status: 'DONE',
|
|
3966
|
+
// result: {
|
|
3967
|
+
// oldCall: currentCallId,
|
|
3968
|
+
// newCall: params.callId
|
|
3969
|
+
// }
|
|
3970
|
+
// });
|
|
3971
|
+
// } else {
|
|
3972
|
+
// chatEvents.fireEvent("callEvents", {
|
|
3973
|
+
// type: 'MOVING_TO_NEW_CALL',
|
|
3974
|
+
// status: 'FAILED',
|
|
3975
|
+
// result: {
|
|
3976
|
+
// oldCall: currentCallId,
|
|
3977
|
+
// newCall: params.callId
|
|
3978
|
+
// }
|
|
3979
|
+
// });
|
|
3980
|
+
// }
|
|
3981
|
+
callback && callback(result);
|
|
3982
|
+
}
|
|
3983
|
+
});
|
|
3984
|
+
});
|
|
3985
|
+
/* new Promise((resolve, reject) => {
|
|
3986
|
+
if(callStopQueue.callStarted) {
|
|
3987
|
+
isMovingToNewCall = true;
|
|
3988
|
+
// callStop(false);
|
|
3989
|
+
chatEvents.fireEvent("callEvents", {
|
|
3990
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
3991
|
+
status: 'PROCESSING',
|
|
3992
|
+
result: {
|
|
3993
|
+
oldCall: currentCallId,
|
|
3994
|
+
newCall: params.callId
|
|
3995
|
+
}
|
|
3996
|
+
});
|
|
3997
|
+
endCall({callId: currentCallId});
|
|
3998
|
+
setTimeout(()=>{
|
|
3999
|
+
resolve(true);
|
|
4000
|
+
// callRequestController.imCallOwner = false;
|
|
4001
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
4002
|
+
// callRequestController.callRequestReceived = true;
|
|
4003
|
+
currentCallId = params.callId;
|
|
4004
|
+
chatEvents.fireEvent('callEvents', {
|
|
4005
|
+
type: 'CALL_SESSION_CREATED',
|
|
4006
|
+
result: {
|
|
4007
|
+
callId: params.callId
|
|
4008
|
+
}
|
|
4009
|
+
});
|
|
4010
|
+
}, 3500);
|
|
4011
|
+
} else {
|
|
4012
|
+
resolve(true);
|
|
4013
|
+
}
|
|
4014
|
+
}).then(()=>{
|
|
4015
|
+
if(isMovingToNewCall)
|
|
4016
|
+
chatEvents.fireEvent("callEvents", {
|
|
4017
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
4018
|
+
status: 'STARTING',
|
|
4019
|
+
result: {
|
|
4020
|
+
oldCall: currentCallId,
|
|
4021
|
+
newCall: params.callId
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
deviceManager.grantUserMediaDevicesPermissions({
|
|
4025
|
+
video: params.video,
|
|
4026
|
+
audio: !params.mute,
|
|
4027
|
+
closeStream: true
|
|
4028
|
+
}, function (result) {
|
|
4029
|
+
if (result.hasError) {
|
|
4030
|
+
callback && callback({
|
|
4031
|
+
hasError: true,
|
|
4032
|
+
errorCode: result.errorCode,
|
|
4033
|
+
errorMessage: result.errorMessage,
|
|
4034
|
+
});
|
|
4035
|
+
return;
|
|
4036
|
+
}
|
|
4037
|
+
|
|
4038
|
+
chatMessaging.sendMessage(acceptCallData, {
|
|
4039
|
+
onResult: function (result) {
|
|
4040
|
+
if(!result.hasError && isMovingToNewCall) {
|
|
4041
|
+
chatEvents.fireEvent("callEvents", {
|
|
4042
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
4043
|
+
status: 'DONE',
|
|
4044
|
+
result: {
|
|
4045
|
+
oldCall: currentCallId,
|
|
4046
|
+
newCall: params.callId
|
|
4047
|
+
}
|
|
4048
|
+
});
|
|
4049
|
+
} else {
|
|
4050
|
+
chatEvents.fireEvent("callEvents", {
|
|
4051
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
4052
|
+
status: 'FAILED',
|
|
4053
|
+
result: {
|
|
4054
|
+
oldCall: currentCallId,
|
|
4055
|
+
newCall: params.callId
|
|
4056
|
+
}
|
|
4057
|
+
});
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
callback && callback(result);
|
|
4061
|
+
}
|
|
4062
|
+
});
|
|
4063
|
+
});
|
|
4064
|
+
})*/
|
|
4065
|
+
|
|
4066
|
+
|
|
4067
|
+
case 22:
|
|
4068
|
+
case "end":
|
|
4069
|
+
return _context3.stop();
|
|
3869
4070
|
}
|
|
3870
|
-
}
|
|
3871
|
-
});
|
|
3872
|
-
});
|
|
3873
|
-
|
|
4071
|
+
}
|
|
4072
|
+
}, _callee3);
|
|
4073
|
+
}));
|
|
4074
|
+
|
|
4075
|
+
return function (_x5, _x6) {
|
|
4076
|
+
return _ref5.apply(this, arguments);
|
|
4077
|
+
};
|
|
4078
|
+
}();
|
|
3874
4079
|
|
|
3875
4080
|
this.rejectCall = this.cancelCall = function (params, callback) {
|
|
3876
4081
|
var rejectCallData = {
|
|
@@ -4123,9 +4328,9 @@ function ChatCall(params) {
|
|
|
4123
4328
|
});
|
|
4124
4329
|
};
|
|
4125
4330
|
|
|
4126
|
-
function calculateScreenSize(
|
|
4127
|
-
var
|
|
4128
|
-
quality =
|
|
4331
|
+
function calculateScreenSize(_ref6) {
|
|
4332
|
+
var _ref6$quality = _ref6.quality,
|
|
4333
|
+
quality = _ref6$quality === void 0 ? 3 : _ref6$quality;
|
|
4129
4334
|
var screenSize = window.screen,
|
|
4130
4335
|
qualities = [{
|
|
4131
4336
|
width: Math.round(screenSize.width / 3),
|
|
@@ -4740,7 +4945,9 @@ function ChatCall(params) {
|
|
|
4740
4945
|
if (params) {
|
|
4741
4946
|
if (Array.isArray(params.userIds) && params.userIds.length) {
|
|
4742
4947
|
for (var i in params.userIds) {
|
|
4743
|
-
|
|
4948
|
+
var user = callUsers[params.userIds[i]];
|
|
4949
|
+
if (!user || !user.video) continue;
|
|
4950
|
+
callStateController.activateParticipantStream(user.userId, 'video', 'receive', 'videoTopicName', callUsers[user.userId].topicSend, 'video');
|
|
4744
4951
|
}
|
|
4745
4952
|
|
|
4746
4953
|
callback && callback({
|
|
@@ -4843,9 +5050,9 @@ function ChatCall(params) {
|
|
|
4843
5050
|
}
|
|
4844
5051
|
};
|
|
4845
5052
|
|
|
4846
|
-
this.sendCallSticker = function (
|
|
4847
|
-
var
|
|
4848
|
-
sticker =
|
|
5053
|
+
this.sendCallSticker = function (_ref7, callback) {
|
|
5054
|
+
var _ref7$sticker = _ref7.sticker,
|
|
5055
|
+
sticker = _ref7$sticker === void 0 ? _constants.callStickerTypes.RAISE_HAND : _ref7$sticker;
|
|
4849
5056
|
var sendMessageParams = {
|
|
4850
5057
|
chatMessageVOType: _constants.chatMessageVOTypes.CALL_STICKER_SYSTEM_MESSAGE,
|
|
4851
5058
|
typeCode: generalTypeCode,
|
|
@@ -4871,8 +5078,8 @@ function ChatCall(params) {
|
|
|
4871
5078
|
});
|
|
4872
5079
|
};
|
|
4873
5080
|
|
|
4874
|
-
this.recallThreadParticipant = function (
|
|
4875
|
-
var invitees =
|
|
5081
|
+
this.recallThreadParticipant = function (_ref8, callback) {
|
|
5082
|
+
var invitees = _ref8.invitees;
|
|
4876
5083
|
var sendData = {
|
|
4877
5084
|
chatMessageVOType: _constants.chatMessageVOTypes.RECALL_THREAD_PARTICIPANT,
|
|
4878
5085
|
typeCode: generalTypeCode,
|
|
@@ -4909,10 +5116,10 @@ function ChatCall(params) {
|
|
|
4909
5116
|
|
|
4910
5117
|
this.deviceManager = _deviceManager["default"];
|
|
4911
5118
|
|
|
4912
|
-
this.resetCallStream = function (
|
|
4913
|
-
var userId =
|
|
4914
|
-
|
|
4915
|
-
streamType =
|
|
5119
|
+
this.resetCallStream = function (_ref9, callback) {
|
|
5120
|
+
var userId = _ref9.userId,
|
|
5121
|
+
_ref9$streamType = _ref9.streamType,
|
|
5122
|
+
streamType = _ref9$streamType === void 0 ? 'audio' : _ref9$streamType;
|
|
4916
5123
|
return new Promise(function (resolve, reject) {
|
|
4917
5124
|
if (userId === 'screenShare' || streamType === 'video') {
|
|
4918
5125
|
if (callUsers[userId]) {
|