podchat-browser 12.9.19-snapshot.4 → 12.9.19

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/changelog.md CHANGED
@@ -5,7 +5,27 @@ to see complete list of changelog please visit [ChangeLog](http://gp.fanapsoft.i
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
- ## [12.9.18] 05-01-2025
8
+ ## [12.9.19] 30-05-2026
9
+
10
+ ### Added
11
+ - Added possibility to get the original data from threads cache
12
+ - Added method reInit
13
+ - Implemented dataChannel for multitrack calls
14
+ - Added new callType other than normal callType for single user calls
15
+ - Added method getKurentoPeersQualityMetrics
16
+ - Added method getJanusPeersQualityMetrics
17
+ - Added possibility to startSendDataChannel when needed
18
+
19
+ ### Fixed
20
+ - Improved REMOVE_CALL_PARTICIPANT event type 95
21
+ - Fixed bug in method forceJoin
22
+ - Fixed bugs in new contact methods
23
+
24
+ ### Changed
25
+ - Added uniqueId to new thread event
26
+ - Added field returnOriginalData to get originalData from cache
27
+
28
+ ## [12.9.18] 05-01-2026
9
29
 
10
30
  ### Added
11
31
 
@@ -42,7 +62,6 @@ to see complete list of changelog please visit [ChangeLog](http://gp.fanapsoft.i
42
62
 
43
63
  ### Added
44
64
 
45
-
46
65
  - Added optional in memory cache for getThreads
47
66
  - Added optional in memory cache for getHistory
48
67
  - Added cache for method getHistoryByMessageIdRange
@@ -1 +1 @@
1
- {"version":"12.9.19-snapshot.4","date":"۱۴۰۴/۱۲/۶","VersionInfo":"Release: false, Snapshot: true, Is For Test: true"}
1
+ {"version":"12.9.19","date":"۱۴۰۵/۳/۹","VersionInfo":"Release: true, Snapshot: false, Is For Test: false"}
@@ -471,7 +471,7 @@ function ChatCall(app, params) {
471
471
 
472
472
 
473
473
  function shouldNotProcessChatMessage(type, threadId) {
474
- 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, _constants.chatMessageVOTypes.RAISE_HAND, _constants.chatMessageVOTypes.LOWER_HAND, _constants.chatMessageVOTypes.SWITCH_TO_GROUP_CALL_REQUEST // chatMessageVOTypes.END_CALL
474
+ 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, _constants.chatMessageVOTypes.RAISE_HAND, _constants.chatMessageVOTypes.LOWER_HAND, _constants.chatMessageVOTypes.SWITCH_TO_GROUP_CALL_REQUEST, _constants.chatMessageVOTypes.CALL_PARTICIPANT_FORCE_JOINED // chatMessageVOTypes.END_CALL
475
475
  ];
476
476
 
477
477
  if ((!app.call.callStopQueue.callStarted || threadId != app.callsManager.currentCallId()) && restrictedMessageTypes.includes(type)) {
@@ -482,7 +482,7 @@ function ChatCall(app, params) {
482
482
  }
483
483
 
484
484
  this.handleChatMessages = function (chatMessage, type, messageContent, contentCount, threadId, uniqueId) {
485
- var _app$callsManager$get, _app$callsManager$get2;
485
+ var _app$callsManager$get, _app$callsManager$get2, _app$callsManager$get3;
486
486
 
487
487
  app.sdkParams.consoleLogging && console.debug("[SDK][CALL_MODULE][handleChatMessages]", "type:", type, "threadId:", threadId, "currentCallId:", app.callsManager.currentCallId(), "latestCallRequestId:", latestCallRequestId, "shouldNotProcessChatMessage:", shouldNotProcessChatMessage(type, threadId));
488
488
 
@@ -600,11 +600,6 @@ function ChatCall(app, params) {
600
600
 
601
601
  break;
602
602
 
603
- /**
604
- * Type 263 Force Join
605
- */
606
-
607
- case _constants.chatMessageVOTypes.FORCE_JOIN:
608
603
  /**
609
604
  * Type 74 Start Call (Start sender and receivers)
610
605
  */
@@ -784,7 +779,8 @@ function ChatCall(app, params) {
784
779
  app.chatEvents.fireEvent('callEvents', {
785
780
  type: 'CALL_PARTICIPANT_LEFT',
786
781
  callId: threadId,
787
- result: messageContent
782
+ result: messageContent,
783
+ uniqueId: uniqueId
788
784
  });
789
785
  }
790
786
 
@@ -817,16 +813,30 @@ function ChatCall(app, params) {
817
813
  */
818
814
 
819
815
  case _constants.chatMessageVOTypes.REMOVE_CALL_PARTICIPANT:
820
- if (app.store.messagesCallbacks[uniqueId]) {
821
- app.store.messagesCallbacks[uniqueId](_utility["default"].createReturnData(chatMessage.typeCode, chatMessage.ownerId, false, '', 0, messageContent, contentCount));
816
+ // if (app.store.messagesCallbacks[uniqueId]) {
817
+ // app.store.messagesCallbacks[uniqueId](Utility.createReturnData(chatMessage.typeCode, chatMessage.ownerId, false, '', 0, messageContent, contentCount));
818
+ // }
819
+ var raiseEventToClient1 = false;
820
+
821
+ if (app.call.currentCall()) {
822
+ if (app.callsManager.currentCallId() == threadId) {
823
+ raiseEventToClient1 = true;
824
+ }
825
+ } else if (messageContent && messageContent[0] && messageContent[0].userId && messageContent[0].userId == app.store.user.get().id) {
826
+ raiseEventToClient1 = true;
822
827
  }
823
828
 
824
- app.chatEvents.fireEvent('callEvents', {
825
- type: 'CALL_PARTICIPANT_REMOVED',
826
- callId: threadId,
827
- result: messageContent,
828
- uniqueId: uniqueId
829
- });
829
+ if (raiseEventToClient1) {
830
+ app.chatEvents.fireEvent('callEvents', {
831
+ type: 'CALL_PARTICIPANT_REMOVED',
832
+ callId: threadId,
833
+ result: messageContent,
834
+ uniqueId: uniqueId
835
+ });
836
+ }
837
+
838
+ if (app.callsManager.currentCallId() != threadId) return;
839
+ (_app$callsManager$get3 = app.callsManager.get(threadId)) === null || _app$callsManager$get3 === void 0 ? void 0 : _app$callsManager$get3.handleParticipantLeft(messageContent, threadId);
830
840
  break;
831
841
 
832
842
  /**
@@ -1229,6 +1239,52 @@ function ChatCall(app, params) {
1229
1239
  case _constants.chatMessageVOTypes.REMOVE_PERMISSION_FROM_CALL_PARTICIPANT:
1230
1240
  app.call.adminMethods.onRemoveCallParticipantsPermission(uniqueId, messageContent, chatMessage, threadId);
1231
1241
  break;
1242
+
1243
+ /**
1244
+ * Type 263 Force Join
1245
+ */
1246
+
1247
+ case _constants.chatMessageVOTypes.FORCE_JOIN:
1248
+ if (app.call.currentCall()) {
1249
+ app.chatEvents.fireEvent('callEvents', {
1250
+ type: 'FORCE_JOINED_ELSEWHERE',
1251
+ callId: threadId,
1252
+ message: 'User force joined elsewhere',
1253
+ uniqueId: uniqueId
1254
+ });
1255
+ app.call.currentCall().forceSilentClose();
1256
+ app.callsManager.removeItem(app.callsManager.currentCallId());
1257
+ return;
1258
+ }
1259
+
1260
+ if (!callRequestController.canProcessStartCall(threadId)) {
1261
+ app.chatEvents.fireEvent('callEvents', {
1262
+ type: 'CALL_STARTED_ELSEWHERE',
1263
+ callId: threadId,
1264
+ message: 'Call already started somewhere else..., aborting...',
1265
+ uniqueId: uniqueId
1266
+ });
1267
+ return;
1268
+ }
1269
+
1270
+ callRequestController.iRequestedCall = false;
1271
+ callRequestController.iAcceptedCall = false;
1272
+ processChatStartCallEvent(chatMessage, type, messageContent, contentCount, threadId, uniqueId);
1273
+ break;
1274
+
1275
+ /**
1276
+ * Type 264 A user has forceJoined
1277
+ */
1278
+
1279
+ case _constants.chatMessageVOTypes.CALL_PARTICIPANT_FORCE_JOINED:
1280
+ app.call.currentCall().updateParticipantsState();
1281
+ app.chatEvents.fireEvent('callEvents', {
1282
+ type: 'CALL_PARTICIPANT_FORCE_JOINED',
1283
+ callId: threadId,
1284
+ result: messageContent,
1285
+ uniqueId: uniqueId
1286
+ });
1287
+ break;
1232
1288
  }
1233
1289
  };
1234
1290
 
package/dist/node/chat.js CHANGED
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
10
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
15
 
12
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -1897,6 +1901,7 @@ function Chat(params) {
1897
1901
  case _constants.chatMessageVOTypes.RECEIVE_CALL_REQUEST:
1898
1902
  case _constants.chatMessageVOTypes.START_CALL:
1899
1903
  case _constants.chatMessageVOTypes.FORCE_JOIN:
1904
+ case _constants.chatMessageVOTypes.CALL_PARTICIPANT_FORCE_JOINED:
1900
1905
  case _constants.chatMessageVOTypes.START_CALL_INSTANT:
1901
1906
  case _constants.chatMessageVOTypes.END_CALL_REQUEST:
1902
1907
  case _constants.chatMessageVOTypes.END_CALL:
@@ -8958,9 +8963,126 @@ function Chat(params) {
8958
8963
  })), null, true, {});
8959
8964
  }
8960
8965
 
8961
- app.call.currentCall().sendCallData(params.jsonData);
8966
+ if (app.call.currentCall().sendCallData) app.call.currentCall().sendCallData(params.jsonData);
8967
+ };
8968
+
8969
+ publicized.startSendDataChannel = function (params, callback) {
8970
+ if (!app.call.currentCall()) {
8971
+ app.errorHandler.raiseError(app.errorHandler.getFilledErrorObject(_objectSpread(_objectSpread({}, _errorHandler.errorList.INVALID_CALLID), {}, {
8972
+ replacements: ['startSendDataChannel']
8973
+ })), callback, false, {});
8974
+ return;
8975
+ }
8976
+
8977
+ app.call.currentCall().startSendDataChannel();
8962
8978
  };
8963
8979
 
8980
+ publicized.getKurentoPeersQualityMetrics = /*#__PURE__*/function () {
8981
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(params, callback) {
8982
+ var parseData, metrics;
8983
+ return _regenerator["default"].wrap(function _callee$(_context) {
8984
+ while (1) {
8985
+ switch (_context.prev = _context.next) {
8986
+ case 0:
8987
+ if (app.call.currentCall()) {
8988
+ _context.next = 3;
8989
+ break;
8990
+ }
8991
+
8992
+ app.errorHandler.raiseError(app.errorHandler.getFilledErrorObject(_objectSpread(_objectSpread({}, _errorHandler.errorList.INVALID_CALLID), {}, {
8993
+ replacements: ['getKurentoPeersQualityMetrics']
8994
+ })), callback, false, {});
8995
+ return _context.abrupt("return");
8996
+
8997
+ case 3:
8998
+ parseData = params.parseData;
8999
+
9000
+ if (!app.call.currentCall().callServerController().isKurento()) {
9001
+ _context.next = 11;
9002
+ break;
9003
+ }
9004
+
9005
+ _context.next = 7;
9006
+ return app.call.currentCall().getPeersQualityMetrics(parseData);
9007
+
9008
+ case 7:
9009
+ metrics = _context.sent;
9010
+ callback && callback({
9011
+ hasEror: false,
9012
+ result: metrics
9013
+ });
9014
+ _context.next = 12;
9015
+ break;
9016
+
9017
+ case 11:
9018
+ app.errorHandler.raiseError(_errorHandler.errorList.CALL_SERVER_IS_NOT_KURENTO, callback, false, {});
9019
+
9020
+ case 12:
9021
+ case "end":
9022
+ return _context.stop();
9023
+ }
9024
+ }
9025
+ }, _callee);
9026
+ }));
9027
+
9028
+ return function (_x, _x2) {
9029
+ return _ref4.apply(this, arguments);
9030
+ };
9031
+ }();
9032
+
9033
+ publicized.getJanusPeersQualityMetrics = /*#__PURE__*/function () {
9034
+ var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(params, callback) {
9035
+ var parseData, metrics;
9036
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
9037
+ while (1) {
9038
+ switch (_context2.prev = _context2.next) {
9039
+ case 0:
9040
+ if (app.call.currentCall()) {
9041
+ _context2.next = 3;
9042
+ break;
9043
+ }
9044
+
9045
+ app.errorHandler.raiseError(app.errorHandler.getFilledErrorObject(_objectSpread(_objectSpread({}, _errorHandler.errorList.INVALID_CALLID), {}, {
9046
+ replacements: ['getJanusPeersQualityMetrics']
9047
+ })), callback, false, {});
9048
+ return _context2.abrupt("return");
9049
+
9050
+ case 3:
9051
+ parseData = params.parseData;
9052
+
9053
+ if (!app.call.currentCall().callServerController().isJanus()) {
9054
+ _context2.next = 11;
9055
+ break;
9056
+ }
9057
+
9058
+ _context2.next = 7;
9059
+ return app.call.currentCall().getJanusPeersQualityMetrics(parseData);
9060
+
9061
+ case 7:
9062
+ metrics = _context2.sent;
9063
+ callback && callback({
9064
+ hasEror: false,
9065
+ result: metrics
9066
+ });
9067
+ _context2.next = 12;
9068
+ break;
9069
+
9070
+ case 11:
9071
+ app.errorHandler.raiseError(_errorHandler.errorList.CALL_SERVER_IS_NOT_JANUS, callback, false, {});
9072
+
9073
+ case 12:
9074
+ case "end":
9075
+ return _context2.stop();
9076
+ }
9077
+ }
9078
+ }, _callee2);
9079
+ }));
9080
+
9081
+ return function (_x3, _x4) {
9082
+ return _ref5.apply(this, arguments);
9083
+ };
9084
+ }();
9085
+
8964
9086
  publicized.reInit = function (config) {
8965
9087
  app.messenger.stopChatPing();
8966
9088
  params.socketAddress = config.socketAddress;
@@ -452,17 +452,17 @@ function CallManager(_ref) {
452
452
  }
453
453
 
454
454
  function _callStop() {
455
- _callStop = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
455
+ _callStop = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
456
456
  var resetCurrentCallId,
457
457
  resetCameraPaused,
458
- _args9 = arguments;
459
- return _regenerator["default"].wrap(function _callee7$(_context9) {
458
+ _args10 = arguments;
459
+ return _regenerator["default"].wrap(function _callee8$(_context10) {
460
460
  while (1) {
461
- switch (_context9.prev = _context9.next) {
461
+ switch (_context10.prev = _context10.next) {
462
462
  case 0:
463
- resetCurrentCallId = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : true;
464
- resetCameraPaused = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : true;
465
- _context9.next = 4;
463
+ resetCurrentCallId = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : true;
464
+ resetCameraPaused = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : true;
465
+ _context10.next = 4;
466
466
  return config.users.destroy();
467
467
 
468
468
  case 4:
@@ -480,10 +480,10 @@ function CallManager(_ref) {
480
480
 
481
481
  case 9:
482
482
  case "end":
483
- return _context9.stop();
483
+ return _context10.stop();
484
484
  }
485
485
  }
486
- }, _callee7);
486
+ }, _callee8);
487
487
  }));
488
488
  return _callStop.apply(this, arguments);
489
489
  }
@@ -1439,26 +1439,90 @@ function CallManager(_ref) {
1439
1439
  } else {//Inquiry the call
1440
1440
  }
1441
1441
  },
1442
- destroy: function destroy() {
1442
+ getPeersQualityMetrics: function getPeersQualityMetrics() {
1443
+ var _arguments = arguments;
1443
1444
  return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
1445
+ var parsed, users, result, user;
1444
1446
  return _regenerator["default"].wrap(function _callee6$(_context8) {
1445
1447
  while (1) {
1446
1448
  switch (_context8.prev = _context8.next) {
1449
+ case 0:
1450
+ parsed = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : true;
1451
+ users = config.users.getAll();
1452
+ result = {};
1453
+ _context8.t0 = _regenerator["default"].keys(users);
1454
+
1455
+ case 4:
1456
+ if ((_context8.t1 = _context8.t0()).done) {
1457
+ _context8.next = 17;
1458
+ break;
1459
+ }
1460
+
1461
+ user = _context8.t1.value;
1462
+
1463
+ if (!users[user]) {
1464
+ _context8.next = 15;
1465
+ break;
1466
+ }
1467
+
1468
+ if (!users[user].videoTopicManager()) {
1469
+ _context8.next = 11;
1470
+ break;
1471
+ }
1472
+
1473
+ _context8.next = 10;
1474
+ return users[user].videoTopicManager().getPeerQualityMetrics(parsed);
1475
+
1476
+ case 10:
1477
+ result[users[user].user().videoTopicName] = _context8.sent;
1478
+
1479
+ case 11:
1480
+ if (!users[user].audioTopicManager()) {
1481
+ _context8.next = 15;
1482
+ break;
1483
+ }
1484
+
1485
+ _context8.next = 14;
1486
+ return users[user].audioTopicManager().getPeerQualityMetrics(parsed);
1487
+
1488
+ case 14:
1489
+ result[users[user].user().audioTopicName] = _context8.sent;
1490
+
1491
+ case 15:
1492
+ _context8.next = 4;
1493
+ break;
1494
+
1495
+ case 17:
1496
+ return _context8.abrupt("return", result);
1497
+
1498
+ case 18:
1499
+ case "end":
1500
+ return _context8.stop();
1501
+ }
1502
+ }
1503
+ }, _callee6);
1504
+ }))();
1505
+ },
1506
+ destroy: function destroy() {
1507
+ return (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
1508
+ return _regenerator["default"].wrap(function _callee7$(_context9) {
1509
+ while (1) {
1510
+ switch (_context9.prev = _context9.next) {
1447
1511
  case 0:
1448
1512
  config.isDestroyed = true;
1449
1513
  app.chatEvents.off('chatReady', config.onChatReadyUniqueId);
1450
- _context8.next = 4;
1514
+ _context9.next = 4;
1451
1515
  return app.call.deviceManager.onCallEnd();
1452
1516
 
1453
1517
  case 4:
1454
- return _context8.abrupt("return", callStop());
1518
+ return _context9.abrupt("return", callStop());
1455
1519
 
1456
1520
  case 5:
1457
1521
  case "end":
1458
- return _context8.stop();
1522
+ return _context9.stop();
1459
1523
  }
1460
1524
  }
1461
- }, _callee6);
1525
+ }, _callee7);
1462
1526
  }))();
1463
1527
  },
1464
1528
  isDestroyed: function isDestroyed() {
@@ -21,6 +21,9 @@ function CallServerManager(app) {
21
21
  isJanus: function isJanus() {
22
22
  return config.servers[config.currentServerIndex].toLowerCase().substr(0, 1) === 'j';
23
23
  },
24
+ isKurento: function isKurento() {
25
+ return config.servers[config.currentServerIndex].toLowerCase().substr(0, 1) === 'k';
26
+ },
24
27
  canChangeServer: function canChangeServer() {
25
28
  return config.currentServerIndex < config.servers.length - 1;
26
29
  },