podchat-browser 12.7.2-snapshot.2 → 12.7.2-snapshot.20
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/dist/node/call.module.js +615 -403
- package/dist/node/chat.js +62 -29
- package/dist/node/lib/constants.js +1 -0
- package/dist/node/lib/store/eventEmitter.js +24 -0
- package/dist/node/lib/store/index.js +16 -0
- package/dist/node/lib/store/threads.js +121 -0
- package/dist/node/messaging.module.js +28 -9
- package/dist/podchat-browser-bundle.js +594 -187
- package/examples/index.html +7 -3
- package/package.json +2 -2
- package/src/call.module.js +228 -108
- package/src/chat.js +143 -36
- package/src/lib/constants.js +1 -0
- package/src/lib/store/eventEmitter.js +16 -0
- package/src/lib/store/index.js +9 -0
- package/src/lib/store/threads.js +99 -0
- package/src/messaging.module.js +22 -6
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) {
|
|
@@ -1709,7 +1720,8 @@ function ChatCall(params) {
|
|
|
1709
1720
|
}
|
|
1710
1721
|
},
|
|
1711
1722
|
maybeReconnectAllTopics: function maybeReconnectAllTopics() {
|
|
1712
|
-
if (!callUsers || !Object.keys(callUsers).length
|
|
1723
|
+
if (!callUsers || !Object.keys(callUsers).length) //|| !callRequestController.callEstablishedInMySide
|
|
1724
|
+
return;
|
|
1713
1725
|
|
|
1714
1726
|
for (var i in callUsers) {
|
|
1715
1727
|
// let videoTopic = callUsers[i].videoTopicName, audioTopic = callUsers[i].audioTopicName;
|
|
@@ -2268,33 +2280,41 @@ function ChatCall(params) {
|
|
|
2268
2280
|
},
|
|
2269
2281
|
*/
|
|
2270
2282
|
callStop = function callStop() {
|
|
2271
|
-
var
|
|
2272
|
-
var
|
|
2273
|
-
|
|
2283
|
+
var resetCurrentCallId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2284
|
+
var resetCameraPaused = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2285
|
+
return new Promise(function (resolve, reject) {
|
|
2286
|
+
// callTopicHealthChecker.stopTopicsHealthCheck();
|
|
2287
|
+
_deviceManager["default"].mediaStreams().stopVideoInput();
|
|
2274
2288
|
|
|
2275
|
-
|
|
2276
|
-
_deviceManager["default"].mediaStreams().stopVideoInput();
|
|
2289
|
+
_deviceManager["default"].mediaStreams().stopAudioInput();
|
|
2277
2290
|
|
|
2278
|
-
|
|
2291
|
+
_deviceManager["default"].mediaStreams().stopScreenShareInput();
|
|
2279
2292
|
|
|
2280
|
-
|
|
2293
|
+
callStateController.removeAllCallParticipants();
|
|
2281
2294
|
|
|
2282
|
-
|
|
2295
|
+
if (callStopQueue.callStarted) {
|
|
2296
|
+
sendCallMessage({
|
|
2297
|
+
id: 'CLOSE'
|
|
2298
|
+
}, null, {});
|
|
2299
|
+
callStopQueue.callStarted = false;
|
|
2300
|
+
}
|
|
2283
2301
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2302
|
+
if (resetCameraPaused) callRequestController.cameraPaused = false; // callRequestController.iRequestedCall = false;
|
|
2303
|
+
// callRequestController.iAcceptedCall = false;
|
|
2304
|
+
//acceptedCallId = null;
|
|
2305
|
+
//requestedCallId = null;
|
|
2306
|
+
// callRequestController.callEstablishedInMySide = false;
|
|
2307
|
+
// callRequestController.callRequestReceived = false;
|
|
2290
2308
|
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2309
|
+
clearTimeout(callRequestController.callRequestTimeout); // if(resetCallOwner)
|
|
2310
|
+
// callRequestController.imCallOwner = false;
|
|
2311
|
+
|
|
2312
|
+
currentCallParams = {};
|
|
2313
|
+
if (resetCurrentCallId) currentCallId = null;
|
|
2314
|
+
setTimeout(function () {
|
|
2315
|
+
resolve(true);
|
|
2316
|
+
}, 2000);
|
|
2317
|
+
});
|
|
2298
2318
|
},
|
|
2299
2319
|
restartMediaOnKeyFrame = function restartMediaOnKeyFrame(userId, timeouts) {
|
|
2300
2320
|
if (callServerController.isJanus()) return;
|
|
@@ -2635,7 +2655,7 @@ function ChatCall(params) {
|
|
|
2635
2655
|
|
|
2636
2656
|
|
|
2637
2657
|
function shouldNotProcessChatMessage(type, threadId) {
|
|
2638
|
-
var restrictedMessageTypes = [_constants.chatMessageVOTypes.MUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.UNMUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.CALL_PARTICIPANT_JOINED, _constants.chatMessageVOTypes.REMOVE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.RECONNECT, _constants.chatMessageVOTypes.TURN_OFF_VIDEO_CALL, _constants.chatMessageVOTypes.TURN_ON_VIDEO_CALL, _constants.chatMessageVOTypes.DESTINED_RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL_STARTED, _constants.chatMessageVOTypes.END_RECORD_CALL, _constants.chatMessageVOTypes.TERMINATE_CALL, _constants.chatMessageVOTypes.CALL_STICKER_SYSTEM_MESSAGE // chatMessageVOTypes.END_CALL
|
|
2658
|
+
var restrictedMessageTypes = [_constants.chatMessageVOTypes.MUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.UNMUTE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.CALL_PARTICIPANT_JOINED, _constants.chatMessageVOTypes.REMOVE_CALL_PARTICIPANT, _constants.chatMessageVOTypes.RECONNECT, _constants.chatMessageVOTypes.TURN_OFF_VIDEO_CALL, _constants.chatMessageVOTypes.TURN_ON_VIDEO_CALL, _constants.chatMessageVOTypes.DESTINED_RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL, _constants.chatMessageVOTypes.RECORD_CALL_STARTED, _constants.chatMessageVOTypes.END_RECORD_CALL, _constants.chatMessageVOTypes.TERMINATE_CALL, _constants.chatMessageVOTypes.CALL_STICKER_SYSTEM_MESSAGE, _constants.chatMessageVOTypes.CALL_RECORDING_FAILED // chatMessageVOTypes.END_CALL
|
|
2639
2659
|
];
|
|
2640
2660
|
|
|
2641
2661
|
if (!callStopQueue.callStarted && restrictedMessageTypes.includes(type)) {
|
|
@@ -2657,7 +2677,7 @@ function ChatCall(params) {
|
|
|
2657
2677
|
* Type 70 Send Call Request
|
|
2658
2678
|
*/
|
|
2659
2679
|
case _constants.chatMessageVOTypes.CALL_REQUEST:
|
|
2660
|
-
callRequestController.callRequestReceived = true;
|
|
2680
|
+
// callRequestController.callRequestReceived = true;
|
|
2661
2681
|
callReceived({
|
|
2662
2682
|
callId: messageContent.callId
|
|
2663
2683
|
}, function (r) {});
|
|
@@ -2748,7 +2768,7 @@ function ChatCall(params) {
|
|
|
2748
2768
|
*/
|
|
2749
2769
|
|
|
2750
2770
|
case _constants.chatMessageVOTypes.START_CALL:
|
|
2751
|
-
if (!callRequestController.
|
|
2771
|
+
if (!callRequestController.canProcessStartCall(threadId)) {
|
|
2752
2772
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
2753
2773
|
type: 'CALL_STARTED_ELSEWHERE',
|
|
2754
2774
|
message: 'Call already started somewhere else..., aborting...'
|
|
@@ -2757,47 +2777,18 @@ function ChatCall(params) {
|
|
|
2757
2777
|
return;
|
|
2758
2778
|
}
|
|
2759
2779
|
|
|
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
|
-
});
|
|
2780
|
+
if (currentCallId) {
|
|
2781
|
+
endCall({
|
|
2782
|
+
callId: currentCallId
|
|
2794
2783
|
});
|
|
2784
|
+
callStop(true, false);
|
|
2785
|
+
setTimeout(function () {
|
|
2786
|
+
currentCallId = threadId;
|
|
2787
|
+
processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId);
|
|
2788
|
+
}, 5000);
|
|
2795
2789
|
} else {
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
message: 'Chat Data DTO is not present!',
|
|
2799
|
-
environmentDetails: getSDKCallDetails()
|
|
2800
|
-
});
|
|
2790
|
+
currentCallId = threadId;
|
|
2791
|
+
processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId);
|
|
2801
2792
|
}
|
|
2802
2793
|
|
|
2803
2794
|
break;
|
|
@@ -2904,7 +2895,7 @@ function ChatCall(params) {
|
|
|
2904
2895
|
*/
|
|
2905
2896
|
|
|
2906
2897
|
case _constants.chatMessageVOTypes.GROUP_CALL_REQUEST:
|
|
2907
|
-
callRequestController.callRequestReceived = true;
|
|
2898
|
+
// callRequestController.callRequestReceived = true;
|
|
2908
2899
|
callReceived({
|
|
2909
2900
|
callId: messageContent.callId
|
|
2910
2901
|
}, function (r) {});
|
|
@@ -3008,6 +2999,11 @@ function ChatCall(params) {
|
|
|
3008
2999
|
if (!correctedData.mute) {
|
|
3009
3000
|
callStateController.startParticipantAudio(correctedData.userId);
|
|
3010
3001
|
}
|
|
3002
|
+
|
|
3003
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3004
|
+
type: 'CALL_DIVS',
|
|
3005
|
+
result: generateCallUIList()
|
|
3006
|
+
});
|
|
3011
3007
|
}, 500);
|
|
3012
3008
|
};
|
|
3013
3009
|
|
|
@@ -3016,11 +3012,6 @@ function ChatCall(params) {
|
|
|
3016
3012
|
}
|
|
3017
3013
|
}
|
|
3018
3014
|
|
|
3019
|
-
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3020
|
-
type: 'CALL_DIVS',
|
|
3021
|
-
result: generateCallUIList()
|
|
3022
|
-
});
|
|
3023
|
-
|
|
3024
3015
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3025
3016
|
type: 'CALL_PARTICIPANT_JOINED',
|
|
3026
3017
|
result: messageContent
|
|
@@ -3195,14 +3186,17 @@ function ChatCall(params) {
|
|
|
3195
3186
|
*/
|
|
3196
3187
|
|
|
3197
3188
|
case _constants.chatMessageVOTypes.CALL_SESSION_CREATED:
|
|
3198
|
-
if
|
|
3189
|
+
// if(!callRequestController.callEstablishedInMySide)
|
|
3190
|
+
// return;
|
|
3191
|
+
if (!callRequestController.iRequestedCall) return;
|
|
3199
3192
|
|
|
3200
3193
|
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3201
3194
|
type: 'CALL_SESSION_CREATED',
|
|
3202
3195
|
result: messageContent
|
|
3203
|
-
});
|
|
3196
|
+
}); // if(!requestedCallId) {
|
|
3197
|
+
|
|
3204
3198
|
|
|
3205
|
-
|
|
3199
|
+
requestedCallId = messageContent.callId; // }
|
|
3206
3200
|
|
|
3207
3201
|
break;
|
|
3208
3202
|
|
|
@@ -3441,232 +3435,374 @@ function ChatCall(params) {
|
|
|
3441
3435
|
chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount, uniqueId));
|
|
3442
3436
|
}
|
|
3443
3437
|
|
|
3438
|
+
break;
|
|
3439
|
+
|
|
3440
|
+
/**
|
|
3441
|
+
* Type 230 CALL_RECORDING_FAILED
|
|
3442
|
+
*/
|
|
3443
|
+
|
|
3444
|
+
case _constants.chatMessageVOTypes.CALL_RECORDING_FAILED:
|
|
3445
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
3446
|
+
chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount, uniqueId));
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3450
|
+
type: 'CALL_RECORDING_FAILED',
|
|
3451
|
+
result: messageContent
|
|
3452
|
+
});
|
|
3453
|
+
|
|
3444
3454
|
break;
|
|
3445
3455
|
}
|
|
3446
3456
|
};
|
|
3447
3457
|
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
//params.typeCode,
|
|
3453
|
-
pushMsgType: 3,
|
|
3454
|
-
token: token
|
|
3455
|
-
},
|
|
3456
|
-
content = {
|
|
3457
|
-
creatorClientDto: {}
|
|
3458
|
-
};
|
|
3458
|
+
function processChatStartCallEvent(type, messageContent, contentCount, threadId, uniqueId) {
|
|
3459
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
3460
|
+
chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount));
|
|
3461
|
+
}
|
|
3459
3462
|
|
|
3460
|
-
|
|
3461
|
-
if (typeof params.type === 'string' && callTypes.hasOwnProperty(params.type.toUpperCase())) {
|
|
3462
|
-
content.type = callTypes[params.type.toUpperCase()];
|
|
3463
|
-
} else {
|
|
3464
|
-
content.type = 0x0; // Defaults to AUDIO Call
|
|
3465
|
-
}
|
|
3463
|
+
messageContent.callId = threadId;
|
|
3466
3464
|
|
|
3467
|
-
|
|
3468
|
-
|
|
3465
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3466
|
+
type: 'CALL_STARTED',
|
|
3467
|
+
result: messageContent
|
|
3468
|
+
});
|
|
3469
3469
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3470
|
+
if ((0, _typeof2["default"])(messageContent) === 'object' && messageContent.hasOwnProperty('chatDataDto') && !!messageContent.chatDataDto.kurentoAddress) {
|
|
3471
|
+
callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));
|
|
3472
|
+
startCallWebRTCFunctions({
|
|
3473
|
+
video: messageContent.clientDTO.video,
|
|
3474
|
+
mute: messageContent.clientDTO.mute,
|
|
3475
|
+
sendingTopic: messageContent.clientDTO.topicSend,
|
|
3476
|
+
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
3477
|
+
screenShare: messageContent.chatDataDto.screenShare,
|
|
3478
|
+
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
3479
|
+
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
3480
|
+
internalTurnAddress: messageContent.chatDataDto.internalTurnAddress,
|
|
3481
|
+
selfData: messageContent.clientDTO,
|
|
3482
|
+
clientsList: messageContent.otherClientDtoList,
|
|
3483
|
+
screenShareOwner: +messageContent.chatDataDto.screenShareUser,
|
|
3484
|
+
recordingOwner: +messageContent.chatDataDto.recordingUser
|
|
3485
|
+
}, function (callDivs) {
|
|
3486
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3487
|
+
type: 'CALL_DIVS',
|
|
3488
|
+
result: callDivs
|
|
3489
|
+
});
|
|
3490
|
+
});
|
|
3491
|
+
} else {
|
|
3492
|
+
_eventsModule.chatEvents.fireEvent('callEvents', {
|
|
3493
|
+
type: 'CALL_ERROR',
|
|
3494
|
+
message: 'Chat Data DTO is not present!',
|
|
3495
|
+
environmentDetails: getSDKCallDetails()
|
|
3496
|
+
});
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3475
3499
|
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3500
|
+
this.startCall = /*#__PURE__*/function () {
|
|
3501
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params, callback) {
|
|
3502
|
+
var startCallData, content, i, tempInvitee;
|
|
3503
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
3504
|
+
while (1) {
|
|
3505
|
+
switch (_context.prev = _context.next) {
|
|
3506
|
+
case 0:
|
|
3507
|
+
startCallData = {
|
|
3508
|
+
chatMessageVOType: _constants.chatMessageVOTypes.CALL_REQUEST,
|
|
3509
|
+
typeCode: generalTypeCode,
|
|
3510
|
+
//params.typeCode,
|
|
3511
|
+
pushMsgType: 3,
|
|
3512
|
+
token: token
|
|
3513
|
+
}, content = {
|
|
3514
|
+
creatorClientDto: {}
|
|
3515
|
+
};
|
|
3481
3516
|
|
|
3482
|
-
|
|
3483
|
-
|
|
3517
|
+
if (!params) {
|
|
3518
|
+
_context.next = 21;
|
|
3519
|
+
break;
|
|
3520
|
+
}
|
|
3484
3521
|
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
} else {
|
|
3491
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3492
|
-
code: 999,
|
|
3493
|
-
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'
|
|
3494
|
-
});
|
|
3522
|
+
if (typeof params.type === 'string' && callTypes.hasOwnProperty(params.type.toUpperCase())) {
|
|
3523
|
+
content.type = callTypes[params.type.toUpperCase()];
|
|
3524
|
+
} else {
|
|
3525
|
+
content.type = 0x0; // Defaults to AUDIO Call
|
|
3526
|
+
}
|
|
3495
3527
|
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
}
|
|
3528
|
+
content.creatorClientDto.mute = params.mute && typeof params.mute === 'boolean' ? params.mute : false;
|
|
3529
|
+
content.mute = params.mute && typeof params.mute === 'boolean' ? params.mute : false;
|
|
3499
3530
|
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3531
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
3532
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3533
|
+
} else {
|
|
3534
|
+
content.creatorClientDto.clientType = callClientType.WEB;
|
|
3535
|
+
}
|
|
3503
3536
|
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
message: 'No params have been sent to start call!'
|
|
3509
|
-
});
|
|
3537
|
+
if (!(typeof +params.threadId === 'number' && +params.threadId > 0)) {
|
|
3538
|
+
_context.next = 10;
|
|
3539
|
+
break;
|
|
3540
|
+
}
|
|
3510
3541
|
|
|
3511
|
-
|
|
3512
|
-
|
|
3542
|
+
content.threadId = +params.threadId;
|
|
3543
|
+
_context.next = 17;
|
|
3544
|
+
break;
|
|
3513
3545
|
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3546
|
+
case 10:
|
|
3547
|
+
if (!(Array.isArray(params.invitees) && params.invitees.length)) {
|
|
3548
|
+
_context.next = 15;
|
|
3549
|
+
break;
|
|
3550
|
+
}
|
|
3518
3551
|
|
|
3519
|
-
|
|
3520
|
-
video: params.type == 'video',
|
|
3521
|
-
audio: !params.mute,
|
|
3522
|
-
closeStream: true
|
|
3523
|
-
}, function (result) {
|
|
3524
|
-
if (result.hasError) {
|
|
3525
|
-
callback && callback({
|
|
3526
|
-
hasError: true,
|
|
3527
|
-
errorCode: result.errorCode,
|
|
3528
|
-
errorMessage: result.errorMessage
|
|
3529
|
-
});
|
|
3530
|
-
return;
|
|
3531
|
-
}
|
|
3552
|
+
content.invitees = []; //params.invitees;
|
|
3532
3553
|
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
//Reject the call if participant didn't answer
|
|
3536
|
-
if (!callStopQueue.callStarted) {
|
|
3537
|
-
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3538
|
-
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3539
|
-
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3540
|
-
});
|
|
3554
|
+
for (i = 0; i < params.invitees.length; i++) {
|
|
3555
|
+
tempInvitee = params.invitees[i];
|
|
3541
3556
|
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3557
|
+
if (tempInvitee && typeof tempInvitee.idType === "string") {
|
|
3558
|
+
tempInvitee.idType = _constants.inviteeVOidTypes[tempInvitee.idType];
|
|
3559
|
+
content.invitees.push(tempInvitee);
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
_context.next = 17;
|
|
3564
|
+
break;
|
|
3565
|
+
|
|
3566
|
+
case 15:
|
|
3567
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3568
|
+
code: 999,
|
|
3569
|
+
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'
|
|
3570
|
+
});
|
|
3571
|
+
|
|
3572
|
+
return _context.abrupt("return");
|
|
3573
|
+
|
|
3574
|
+
case 17:
|
|
3575
|
+
if (params.threadInfo && (params.threadInfo.metadata || params.threadInfo.uniqueName)) {
|
|
3576
|
+
content.createCallThreadRequest = params.threadInfo;
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
startCallData.content = JSON.stringify(content);
|
|
3580
|
+
_context.next = 23;
|
|
3581
|
+
break;
|
|
3582
|
+
|
|
3583
|
+
case 21:
|
|
3584
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3585
|
+
code: 999,
|
|
3586
|
+
message: 'No params have been sent to start call!'
|
|
3587
|
+
});
|
|
3588
|
+
|
|
3589
|
+
return _context.abrupt("return");
|
|
3590
|
+
|
|
3591
|
+
case 23:
|
|
3592
|
+
// if(currentCallId) {
|
|
3593
|
+
// await callStop();
|
|
3594
|
+
// }
|
|
3595
|
+
callRequestController.cameraPaused = typeof params.cameraPaused === 'boolean' ? params.cameraPaused : false; // callRequestController.callRequestReceived = true;
|
|
3596
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3597
|
+
// callRequestController.imCallOwner = true;
|
|
3551
3598
|
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3599
|
+
callRequestController.iRequestedCall = true;
|
|
3600
|
+
|
|
3601
|
+
_deviceManager["default"].grantUserMediaDevicesPermissions({
|
|
3602
|
+
video: params.type == 'video',
|
|
3603
|
+
audio: !params.mute,
|
|
3604
|
+
closeStream: true
|
|
3605
|
+
}, function (result) {
|
|
3606
|
+
if (result.hasError) {
|
|
3607
|
+
callback && callback({
|
|
3608
|
+
hasError: true,
|
|
3609
|
+
errorCode: result.errorCode,
|
|
3610
|
+
errorMessage: result.errorMessage
|
|
3611
|
+
});
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
if (callNoAnswerTimeout) {
|
|
3616
|
+
callRequestController.callRequestTimeout = setTimeout(function (metaData) {
|
|
3617
|
+
//Reject the call if participant didn't answer
|
|
3618
|
+
if (!callStopQueue.callStarted) {
|
|
3619
|
+
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3620
|
+
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3621
|
+
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3622
|
+
});
|
|
3623
|
+
|
|
3624
|
+
metaData.callInstance.rejectCall({
|
|
3625
|
+
callId: metaData.currentCallId
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
}, callNoAnswerTimeout, {
|
|
3629
|
+
callInstance: currentModuleInstance,
|
|
3630
|
+
currentCallId: currentCallId
|
|
3631
|
+
});
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3634
|
+
chatMessaging.sendMessage(startCallData, {
|
|
3635
|
+
onResult: function onResult(result) {
|
|
3636
|
+
callback && callback(result);
|
|
3637
|
+
}
|
|
3638
|
+
});
|
|
3639
|
+
});
|
|
3640
|
+
|
|
3641
|
+
case 26:
|
|
3642
|
+
case "end":
|
|
3643
|
+
return _context.stop();
|
|
3644
|
+
}
|
|
3555
3645
|
}
|
|
3556
|
-
});
|
|
3557
|
-
});
|
|
3558
|
-
};
|
|
3646
|
+
}, _callee);
|
|
3647
|
+
}));
|
|
3559
3648
|
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
chatMessageVOType: _constants.chatMessageVOTypes.GROUP_CALL_REQUEST,
|
|
3563
|
-
typeCode: generalTypeCode,
|
|
3564
|
-
//params.typeCode,
|
|
3565
|
-
pushMsgType: 3,
|
|
3566
|
-
token: token
|
|
3567
|
-
},
|
|
3568
|
-
content = {
|
|
3569
|
-
creatorClientDto: {}
|
|
3649
|
+
return function (_x, _x2) {
|
|
3650
|
+
return _ref3.apply(this, arguments);
|
|
3570
3651
|
};
|
|
3652
|
+
}();
|
|
3653
|
+
|
|
3654
|
+
this.startGroupCall = /*#__PURE__*/function () {
|
|
3655
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(params, callback) {
|
|
3656
|
+
var startCallData, content, i, tempInvitee;
|
|
3657
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
3658
|
+
while (1) {
|
|
3659
|
+
switch (_context2.prev = _context2.next) {
|
|
3660
|
+
case 0:
|
|
3661
|
+
startCallData = {
|
|
3662
|
+
chatMessageVOType: _constants.chatMessageVOTypes.GROUP_CALL_REQUEST,
|
|
3663
|
+
typeCode: generalTypeCode,
|
|
3664
|
+
//params.typeCode,
|
|
3665
|
+
pushMsgType: 3,
|
|
3666
|
+
token: token
|
|
3667
|
+
}, content = {
|
|
3668
|
+
creatorClientDto: {}
|
|
3669
|
+
};
|
|
3571
3670
|
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
content.type = 0x0; // Defaults to AUDIO Call
|
|
3577
|
-
}
|
|
3671
|
+
if (!params) {
|
|
3672
|
+
_context2.next = 20;
|
|
3673
|
+
break;
|
|
3674
|
+
}
|
|
3578
3675
|
|
|
3579
|
-
|
|
3676
|
+
if (typeof params.type === 'string' && callTypes.hasOwnProperty(params.type.toUpperCase())) {
|
|
3677
|
+
content.type = callTypes[params.type.toUpperCase()];
|
|
3678
|
+
} else {
|
|
3679
|
+
content.type = 0x0; // Defaults to AUDIO Call
|
|
3680
|
+
}
|
|
3580
3681
|
|
|
3581
|
-
|
|
3582
|
-
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3583
|
-
} else {
|
|
3584
|
-
content.creatorClientDto.clientType = callClientType.WEB;
|
|
3585
|
-
}
|
|
3682
|
+
content.creatorClientDto.mute = typeof params.mute === 'boolean' ? params.mute : false;
|
|
3586
3683
|
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3684
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
3685
|
+
content.creatorClientDto.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3686
|
+
} else {
|
|
3687
|
+
content.creatorClientDto.clientType = callClientType.WEB;
|
|
3688
|
+
}
|
|
3592
3689
|
|
|
3593
|
-
|
|
3594
|
-
|
|
3690
|
+
if (!(typeof +params.threadId === 'number' && params.threadId > 0)) {
|
|
3691
|
+
_context2.next = 9;
|
|
3692
|
+
break;
|
|
3693
|
+
}
|
|
3595
3694
|
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
}
|
|
3600
|
-
}
|
|
3601
|
-
} else {
|
|
3602
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3603
|
-
code: 999,
|
|
3604
|
-
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'
|
|
3605
|
-
});
|
|
3695
|
+
content.threadId = +params.threadId;
|
|
3696
|
+
_context2.next = 16;
|
|
3697
|
+
break;
|
|
3606
3698
|
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3699
|
+
case 9:
|
|
3700
|
+
if (!Array.isArray(params.invitees)) {
|
|
3701
|
+
_context2.next = 14;
|
|
3702
|
+
break;
|
|
3703
|
+
}
|
|
3610
3704
|
|
|
3611
|
-
|
|
3612
|
-
content.createCallThreadRequest = params.threadInfo;
|
|
3613
|
-
}
|
|
3705
|
+
content.invitees = [];
|
|
3614
3706
|
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3618
|
-
code: 999,
|
|
3619
|
-
message: 'No params have been sent to start call!'
|
|
3620
|
-
});
|
|
3707
|
+
for (i = 0; i < params.invitees.length; i++) {
|
|
3708
|
+
tempInvitee = params.invitees[i];
|
|
3621
3709
|
|
|
3622
|
-
|
|
3623
|
-
|
|
3710
|
+
if (tempInvitee && typeof tempInvitee.idType === "string") {
|
|
3711
|
+
tempInvitee.idType = _constants.inviteeVOidTypes[tempInvitee.idType];
|
|
3712
|
+
content.invitees.push(tempInvitee);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3624
3715
|
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3628
|
-
callRequestController.imCallOwner = true;
|
|
3716
|
+
_context2.next = 16;
|
|
3717
|
+
break;
|
|
3629
3718
|
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
if (result.hasError) {
|
|
3636
|
-
callback && callback({
|
|
3637
|
-
hasError: true,
|
|
3638
|
-
errorCode: result.errorCode,
|
|
3639
|
-
errorMessage: result.errorMessage
|
|
3640
|
-
});
|
|
3641
|
-
return;
|
|
3642
|
-
}
|
|
3719
|
+
case 14:
|
|
3720
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3721
|
+
code: 999,
|
|
3722
|
+
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'
|
|
3723
|
+
});
|
|
3643
3724
|
|
|
3644
|
-
|
|
3645
|
-
callRequestController.callRequestTimeout = setTimeout(function (metaData) {
|
|
3646
|
-
//Reject the call if participant didn't answer
|
|
3647
|
-
if (!callStopQueue.callStarted) {
|
|
3648
|
-
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3649
|
-
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3650
|
-
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3651
|
-
});
|
|
3725
|
+
return _context2.abrupt("return");
|
|
3652
3726
|
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
}
|
|
3727
|
+
case 16:
|
|
3728
|
+
if (params.threadInfo && (params.threadInfo.title || params.threadInfo.description || params.threadInfo.metadata || params.threadInfo.uniqueName)) {
|
|
3729
|
+
content.createCallThreadRequest = params.threadInfo;
|
|
3730
|
+
}
|
|
3731
|
+
|
|
3732
|
+
startCallData.content = JSON.stringify(content);
|
|
3733
|
+
_context2.next = 22;
|
|
3734
|
+
break;
|
|
3662
3735
|
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3736
|
+
case 20:
|
|
3737
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3738
|
+
code: 999,
|
|
3739
|
+
message: 'No params have been sent to start call!'
|
|
3740
|
+
});
|
|
3741
|
+
|
|
3742
|
+
return _context2.abrupt("return");
|
|
3743
|
+
|
|
3744
|
+
case 22:
|
|
3745
|
+
// if(currentCallId) {
|
|
3746
|
+
// await callStop();
|
|
3747
|
+
// }
|
|
3748
|
+
callRequestController.cameraPaused = typeof params.cameraPaused === 'boolean' ? params.cameraPaused : false; // callRequestController.callRequestReceived = true;
|
|
3749
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3750
|
+
// callRequestController.imCallOwner = true;
|
|
3751
|
+
|
|
3752
|
+
callRequestController.iRequestedCall = true;
|
|
3753
|
+
|
|
3754
|
+
_deviceManager["default"].grantUserMediaDevicesPermissions({
|
|
3755
|
+
video: params.type == 'video',
|
|
3756
|
+
audio: !params.mute,
|
|
3757
|
+
closeStream: true
|
|
3758
|
+
}, function (result) {
|
|
3759
|
+
if (result.hasError) {
|
|
3760
|
+
callback && callback({
|
|
3761
|
+
hasError: true,
|
|
3762
|
+
errorCode: result.errorCode,
|
|
3763
|
+
errorMessage: result.errorMessage
|
|
3764
|
+
});
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
|
|
3768
|
+
if (callNoAnswerTimeout) {
|
|
3769
|
+
callRequestController.callRequestTimeout = setTimeout(function (metaData) {
|
|
3770
|
+
//Reject the call if participant didn't answer
|
|
3771
|
+
if (!callStopQueue.callStarted) {
|
|
3772
|
+
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3773
|
+
type: "CALL_NO_ANSWER_TIMEOUT",
|
|
3774
|
+
message: "[CALL_SESSION_CREATED] Call request timed out, No answer"
|
|
3775
|
+
});
|
|
3776
|
+
|
|
3777
|
+
metaData.callInstance.rejectCall({
|
|
3778
|
+
callId: metaData.currentCallId
|
|
3779
|
+
});
|
|
3780
|
+
}
|
|
3781
|
+
}, callNoAnswerTimeout, {
|
|
3782
|
+
callInstance: currentModuleInstance,
|
|
3783
|
+
currentCallId: currentCallId
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
chatMessaging.sendMessage(startCallData, {
|
|
3788
|
+
onResult: function onResult(result) {
|
|
3789
|
+
callback && callback(result);
|
|
3790
|
+
}
|
|
3791
|
+
});
|
|
3792
|
+
});
|
|
3793
|
+
|
|
3794
|
+
case 25:
|
|
3795
|
+
case "end":
|
|
3796
|
+
return _context2.stop();
|
|
3797
|
+
}
|
|
3666
3798
|
}
|
|
3667
|
-
});
|
|
3668
|
-
});
|
|
3669
|
-
|
|
3799
|
+
}, _callee2);
|
|
3800
|
+
}));
|
|
3801
|
+
|
|
3802
|
+
return function (_x3, _x4) {
|
|
3803
|
+
return _ref4.apply(this, arguments);
|
|
3804
|
+
};
|
|
3805
|
+
}();
|
|
3670
3806
|
|
|
3671
3807
|
this.sendCallMetaData = function (params) {
|
|
3672
3808
|
sendCallMetaData({
|
|
@@ -3718,143 +3854,219 @@ function ChatCall(params) {
|
|
|
3718
3854
|
});
|
|
3719
3855
|
};
|
|
3720
3856
|
|
|
3721
|
-
this.acceptCall = function (
|
|
3722
|
-
var
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3857
|
+
this.acceptCall = /*#__PURE__*/function () {
|
|
3858
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(params, callback) {
|
|
3859
|
+
var acceptCallData, content;
|
|
3860
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
3861
|
+
while (1) {
|
|
3862
|
+
switch (_context3.prev = _context3.next) {
|
|
3863
|
+
case 0:
|
|
3864
|
+
acceptCallData = {
|
|
3865
|
+
chatMessageVOType: _constants.chatMessageVOTypes.ACCEPT_CALL,
|
|
3866
|
+
typeCode: generalTypeCode,
|
|
3867
|
+
//params.typeCode,
|
|
3868
|
+
pushMsgType: 3,
|
|
3869
|
+
token: token
|
|
3870
|
+
}, content = {};
|
|
3871
|
+
|
|
3872
|
+
if (!params) {
|
|
3873
|
+
_context3.next = 17;
|
|
3874
|
+
break;
|
|
3875
|
+
}
|
|
3730
3876
|
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
(0, _errorHandler.raiseError)(_errorHandler.errorList.INVALID_CALLID, callback, true, {});
|
|
3736
|
-
/*chatEvents.fireEvent('error', {
|
|
3737
|
-
code: 999,
|
|
3738
|
-
message: 'Invalid call id!'
|
|
3739
|
-
});*/
|
|
3877
|
+
if (!(typeof +params.callId === 'number' && params.callId > 0)) {
|
|
3878
|
+
_context3.next = 6;
|
|
3879
|
+
break;
|
|
3880
|
+
}
|
|
3740
3881
|
|
|
3741
|
-
|
|
3742
|
-
|
|
3882
|
+
acceptCallData.subjectId = +params.callId;
|
|
3883
|
+
_context3.next = 8;
|
|
3884
|
+
break;
|
|
3743
3885
|
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3886
|
+
case 6:
|
|
3887
|
+
(0, _errorHandler.raiseError)(_errorHandler.errorList.INVALID_CALLID, callback, true, {});
|
|
3888
|
+
/*chatEvents.fireEvent('error', {
|
|
3889
|
+
code: 999,
|
|
3890
|
+
message: 'Invalid call id!'
|
|
3891
|
+
});*/
|
|
3748
3892
|
|
|
3749
|
-
|
|
3750
|
-
content.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3751
|
-
} else {
|
|
3752
|
-
content.clientType = callClientType.WEB;
|
|
3753
|
-
}
|
|
3893
|
+
return _context3.abrupt("return");
|
|
3754
3894
|
|
|
3755
|
-
|
|
3895
|
+
case 8:
|
|
3896
|
+
content.mute = typeof params.mute === 'boolean' ? params.mute : false;
|
|
3897
|
+
content.video = typeof params.video === 'boolean' ? params.video : false;
|
|
3898
|
+
content.videoCall = content.video;
|
|
3899
|
+
callRequestController.cameraPaused = typeof params.cameraPaused === 'boolean' ? params.cameraPaused : callRequestController.cameraPaused;
|
|
3756
3900
|
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
_eventsModule.chatEvents.fireEvent('error', {
|
|
3763
|
-
code: 999,
|
|
3764
|
-
message: 'No params have been sent to accept the call!'
|
|
3765
|
-
});
|
|
3901
|
+
if (params.clientType && typeof params.clientType === 'string' && callClientType[params.clientType.toUpperCase()] > 0) {
|
|
3902
|
+
content.clientType = callClientType[params.clientType.toUpperCase()];
|
|
3903
|
+
} else {
|
|
3904
|
+
content.clientType = callClientType.WEB;
|
|
3905
|
+
}
|
|
3766
3906
|
|
|
3767
|
-
|
|
3768
|
-
}
|
|
3907
|
+
acceptCallData.content = JSON.stringify(content);
|
|
3769
3908
|
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
new Promise(function (resolve, reject) {
|
|
3774
|
-
if (callStopQueue.callStarted) {
|
|
3775
|
-
isMovingToNewCall = true; // callStop(false);
|
|
3909
|
+
if (params.joinCall) {// callRequestController.callRequestReceived = true;
|
|
3910
|
+
// currentCallId = params.callId;
|
|
3911
|
+
}
|
|
3776
3912
|
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
status: 'PROCESSING',
|
|
3780
|
-
result: {
|
|
3781
|
-
oldCall: currentCallId,
|
|
3782
|
-
newCall: params.callId
|
|
3783
|
-
}
|
|
3784
|
-
});
|
|
3913
|
+
_context3.next = 19;
|
|
3914
|
+
break;
|
|
3785
3915
|
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
callRequestController.imCallOwner = false;
|
|
3792
|
-
callRequestController.callEstablishedInMySide = true;
|
|
3793
|
-
callRequestController.callRequestReceived = true;
|
|
3794
|
-
currentCallId = params.callId;
|
|
3916
|
+
case 17:
|
|
3917
|
+
_eventsModule.chatEvents.fireEvent('error', {
|
|
3918
|
+
code: 999,
|
|
3919
|
+
message: 'No params have been sent to accept the call!'
|
|
3920
|
+
});
|
|
3795
3921
|
|
|
3796
|
-
|
|
3797
|
-
type: 'CALL_SESSION_CREATED',
|
|
3798
|
-
result: {
|
|
3799
|
-
callId: params.callId
|
|
3800
|
-
}
|
|
3801
|
-
});
|
|
3802
|
-
}, 3500);
|
|
3803
|
-
} else {
|
|
3804
|
-
resolve(true);
|
|
3805
|
-
}
|
|
3806
|
-
}).then(function () {
|
|
3807
|
-
if (isMovingToNewCall) _eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3808
|
-
type: 'MOVING_TO_NEW_CALL',
|
|
3809
|
-
status: 'STARTING',
|
|
3810
|
-
result: {
|
|
3811
|
-
oldCall: currentCallId,
|
|
3812
|
-
newCall: params.callId
|
|
3813
|
-
}
|
|
3814
|
-
});
|
|
3922
|
+
return _context3.abrupt("return");
|
|
3815
3923
|
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
}
|
|
3924
|
+
case 19:
|
|
3925
|
+
// if(callRequestController.iAcceptedCall || callRequestController.iRequestedCall) {
|
|
3926
|
+
// await callStop();
|
|
3927
|
+
// }
|
|
3928
|
+
// if(currentCallId) {
|
|
3929
|
+
// endCall({callId: currentCallId});
|
|
3930
|
+
// }
|
|
3931
|
+
acceptedCallId = parseInt(params.callId);
|
|
3932
|
+
callRequestController.iAcceptedCall = true; // console.log("acceptCall: ", {acceptedCallId}, callRequestController.iAcceptedCall);
|
|
3933
|
+
// callRequestController.imCallOwner = false;
|
|
3934
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3935
|
+
// let isMovingToNewCall = false;
|
|
3829
3936
|
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
_eventsModule.chatEvents.fireEvent("callEvents", {
|
|
3843
|
-
type: 'MOVING_TO_NEW_CALL',
|
|
3844
|
-
status: 'FAILED',
|
|
3845
|
-
result: {
|
|
3846
|
-
oldCall: currentCallId,
|
|
3847
|
-
newCall: params.callId
|
|
3937
|
+
_deviceManager["default"].grantUserMediaDevicesPermissions({
|
|
3938
|
+
video: params.video,
|
|
3939
|
+
audio: !params.mute,
|
|
3940
|
+
closeStream: true
|
|
3941
|
+
}, function (result) {
|
|
3942
|
+
if (result.hasError) {
|
|
3943
|
+
callback && callback({
|
|
3944
|
+
hasError: true,
|
|
3945
|
+
errorCode: result.errorCode,
|
|
3946
|
+
errorMessage: result.errorMessage
|
|
3947
|
+
});
|
|
3948
|
+
return;
|
|
3848
3949
|
}
|
|
3849
|
-
});
|
|
3850
|
-
}
|
|
3851
3950
|
|
|
3852
|
-
|
|
3951
|
+
chatMessaging.sendMessage(acceptCallData, {
|
|
3952
|
+
onResult: function onResult(result) {
|
|
3953
|
+
// if(!result.hasError && isMovingToNewCall) {
|
|
3954
|
+
// chatEvents.fireEvent("callEvents", {
|
|
3955
|
+
// type: 'MOVING_TO_NEW_CALL',
|
|
3956
|
+
// status: 'DONE',
|
|
3957
|
+
// result: {
|
|
3958
|
+
// oldCall: currentCallId,
|
|
3959
|
+
// newCall: params.callId
|
|
3960
|
+
// }
|
|
3961
|
+
// });
|
|
3962
|
+
// } else {
|
|
3963
|
+
// chatEvents.fireEvent("callEvents", {
|
|
3964
|
+
// type: 'MOVING_TO_NEW_CALL',
|
|
3965
|
+
// status: 'FAILED',
|
|
3966
|
+
// result: {
|
|
3967
|
+
// oldCall: currentCallId,
|
|
3968
|
+
// newCall: params.callId
|
|
3969
|
+
// }
|
|
3970
|
+
// });
|
|
3971
|
+
// }
|
|
3972
|
+
callback && callback(result);
|
|
3973
|
+
}
|
|
3974
|
+
});
|
|
3975
|
+
});
|
|
3976
|
+
/* new Promise((resolve, reject) => {
|
|
3977
|
+
if(callStopQueue.callStarted) {
|
|
3978
|
+
isMovingToNewCall = true;
|
|
3979
|
+
// callStop(false);
|
|
3980
|
+
chatEvents.fireEvent("callEvents", {
|
|
3981
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
3982
|
+
status: 'PROCESSING',
|
|
3983
|
+
result: {
|
|
3984
|
+
oldCall: currentCallId,
|
|
3985
|
+
newCall: params.callId
|
|
3986
|
+
}
|
|
3987
|
+
});
|
|
3988
|
+
endCall({callId: currentCallId});
|
|
3989
|
+
setTimeout(()=>{
|
|
3990
|
+
resolve(true);
|
|
3991
|
+
// callRequestController.imCallOwner = false;
|
|
3992
|
+
// callRequestController.callEstablishedInMySide = true;
|
|
3993
|
+
// callRequestController.callRequestReceived = true;
|
|
3994
|
+
currentCallId = params.callId;
|
|
3995
|
+
chatEvents.fireEvent('callEvents', {
|
|
3996
|
+
type: 'CALL_SESSION_CREATED',
|
|
3997
|
+
result: {
|
|
3998
|
+
callId: params.callId
|
|
3999
|
+
}
|
|
4000
|
+
});
|
|
4001
|
+
}, 3500);
|
|
4002
|
+
} else {
|
|
4003
|
+
resolve(true);
|
|
4004
|
+
}
|
|
4005
|
+
}).then(()=>{
|
|
4006
|
+
if(isMovingToNewCall)
|
|
4007
|
+
chatEvents.fireEvent("callEvents", {
|
|
4008
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
4009
|
+
status: 'STARTING',
|
|
4010
|
+
result: {
|
|
4011
|
+
oldCall: currentCallId,
|
|
4012
|
+
newCall: params.callId
|
|
4013
|
+
}
|
|
4014
|
+
});
|
|
4015
|
+
deviceManager.grantUserMediaDevicesPermissions({
|
|
4016
|
+
video: params.video,
|
|
4017
|
+
audio: !params.mute,
|
|
4018
|
+
closeStream: true
|
|
4019
|
+
}, function (result) {
|
|
4020
|
+
if (result.hasError) {
|
|
4021
|
+
callback && callback({
|
|
4022
|
+
hasError: true,
|
|
4023
|
+
errorCode: result.errorCode,
|
|
4024
|
+
errorMessage: result.errorMessage,
|
|
4025
|
+
});
|
|
4026
|
+
return;
|
|
4027
|
+
}
|
|
4028
|
+
|
|
4029
|
+
chatMessaging.sendMessage(acceptCallData, {
|
|
4030
|
+
onResult: function (result) {
|
|
4031
|
+
if(!result.hasError && isMovingToNewCall) {
|
|
4032
|
+
chatEvents.fireEvent("callEvents", {
|
|
4033
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
4034
|
+
status: 'DONE',
|
|
4035
|
+
result: {
|
|
4036
|
+
oldCall: currentCallId,
|
|
4037
|
+
newCall: params.callId
|
|
4038
|
+
}
|
|
4039
|
+
});
|
|
4040
|
+
} else {
|
|
4041
|
+
chatEvents.fireEvent("callEvents", {
|
|
4042
|
+
type: 'MOVING_TO_NEW_CALL',
|
|
4043
|
+
status: 'FAILED',
|
|
4044
|
+
result: {
|
|
4045
|
+
oldCall: currentCallId,
|
|
4046
|
+
newCall: params.callId
|
|
4047
|
+
}
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
callback && callback(result);
|
|
4052
|
+
}
|
|
4053
|
+
});
|
|
4054
|
+
});
|
|
4055
|
+
})*/
|
|
4056
|
+
|
|
4057
|
+
|
|
4058
|
+
case 22:
|
|
4059
|
+
case "end":
|
|
4060
|
+
return _context3.stop();
|
|
3853
4061
|
}
|
|
3854
|
-
}
|
|
3855
|
-
});
|
|
3856
|
-
});
|
|
3857
|
-
|
|
4062
|
+
}
|
|
4063
|
+
}, _callee3);
|
|
4064
|
+
}));
|
|
4065
|
+
|
|
4066
|
+
return function (_x5, _x6) {
|
|
4067
|
+
return _ref5.apply(this, arguments);
|
|
4068
|
+
};
|
|
4069
|
+
}();
|
|
3858
4070
|
|
|
3859
4071
|
this.rejectCall = this.cancelCall = function (params, callback) {
|
|
3860
4072
|
var rejectCallData = {
|
|
@@ -4107,9 +4319,9 @@ function ChatCall(params) {
|
|
|
4107
4319
|
});
|
|
4108
4320
|
};
|
|
4109
4321
|
|
|
4110
|
-
function calculateScreenSize(
|
|
4111
|
-
var
|
|
4112
|
-
quality =
|
|
4322
|
+
function calculateScreenSize(_ref6) {
|
|
4323
|
+
var _ref6$quality = _ref6.quality,
|
|
4324
|
+
quality = _ref6$quality === void 0 ? 3 : _ref6$quality;
|
|
4113
4325
|
var screenSize = window.screen,
|
|
4114
4326
|
qualities = [{
|
|
4115
4327
|
width: Math.round(screenSize.width / 3),
|
|
@@ -4827,9 +5039,9 @@ function ChatCall(params) {
|
|
|
4827
5039
|
}
|
|
4828
5040
|
};
|
|
4829
5041
|
|
|
4830
|
-
this.sendCallSticker = function (
|
|
4831
|
-
var
|
|
4832
|
-
sticker =
|
|
5042
|
+
this.sendCallSticker = function (_ref7, callback) {
|
|
5043
|
+
var _ref7$sticker = _ref7.sticker,
|
|
5044
|
+
sticker = _ref7$sticker === void 0 ? _constants.callStickerTypes.RAISE_HAND : _ref7$sticker;
|
|
4833
5045
|
var sendMessageParams = {
|
|
4834
5046
|
chatMessageVOType: _constants.chatMessageVOTypes.CALL_STICKER_SYSTEM_MESSAGE,
|
|
4835
5047
|
typeCode: generalTypeCode,
|
|
@@ -4855,8 +5067,8 @@ function ChatCall(params) {
|
|
|
4855
5067
|
});
|
|
4856
5068
|
};
|
|
4857
5069
|
|
|
4858
|
-
this.recallThreadParticipant = function (
|
|
4859
|
-
var invitees =
|
|
5070
|
+
this.recallThreadParticipant = function (_ref8, callback) {
|
|
5071
|
+
var invitees = _ref8.invitees;
|
|
4860
5072
|
var sendData = {
|
|
4861
5073
|
chatMessageVOType: _constants.chatMessageVOTypes.RECALL_THREAD_PARTICIPANT,
|
|
4862
5074
|
typeCode: generalTypeCode,
|
|
@@ -4893,10 +5105,10 @@ function ChatCall(params) {
|
|
|
4893
5105
|
|
|
4894
5106
|
this.deviceManager = _deviceManager["default"];
|
|
4895
5107
|
|
|
4896
|
-
this.resetCallStream = function (
|
|
4897
|
-
var userId =
|
|
4898
|
-
|
|
4899
|
-
streamType =
|
|
5108
|
+
this.resetCallStream = function (_ref9, callback) {
|
|
5109
|
+
var userId = _ref9.userId,
|
|
5110
|
+
_ref9$streamType = _ref9.streamType,
|
|
5111
|
+
streamType = _ref9$streamType === void 0 ? 'audio' : _ref9$streamType;
|
|
4900
5112
|
return new Promise(function (resolve, reject) {
|
|
4901
5113
|
if (userId === 'screenShare' || streamType === 'video') {
|
|
4902
5114
|
if (callUsers[userId]) {
|