@softtynet/zca-js 2.3.4 → 2.3.5

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.
Files changed (123) hide show
  1. package/README.md +47 -11
  2. package/dist/apis/call/addUserGroupCall.d.ts +11 -0
  3. package/dist/apis/call/addUserGroupCall.js +48 -0
  4. package/dist/apis/call/answerAckVoiceCall.d.ts +5 -0
  5. package/dist/apis/call/answerAckVoiceCall.js +38 -0
  6. package/dist/apis/call/answerGroupCall.d.ts +10 -0
  7. package/dist/apis/call/answerGroupCall.js +45 -0
  8. package/dist/apis/call/answerVoiceCall.d.ts +11 -0
  9. package/dist/apis/call/answerVoiceCall.js +50 -0
  10. package/dist/apis/call/broadcastGroupCallState.d.ts +10 -0
  11. package/dist/apis/call/broadcastGroupCallState.js +45 -0
  12. package/dist/apis/call/cancelGroupCall.d.ts +10 -0
  13. package/dist/apis/call/cancelGroupCall.js +45 -0
  14. package/dist/apis/call/cancelVoiceCall.d.ts +1 -1
  15. package/dist/apis/call/cancelVoiceCall.js +5 -1
  16. package/dist/apis/call/createController.d.ts +7 -0
  17. package/dist/apis/call/createController.js +9 -0
  18. package/dist/apis/call/createRtcSession.d.ts +8 -0
  19. package/dist/apis/call/createRtcSession.js +10 -0
  20. package/dist/apis/call/endGroupCall.d.ts +10 -0
  21. package/dist/apis/call/endGroupCall.js +45 -0
  22. package/dist/apis/call/finishGroupCall.d.ts +12 -0
  23. package/dist/apis/call/finishGroupCall.js +47 -0
  24. package/dist/apis/call/getGroupCallState.d.ts +3 -0
  25. package/dist/apis/call/getGroupCallState.js +38 -0
  26. package/dist/apis/call/holdVoiceCall.d.ts +5 -0
  27. package/dist/apis/call/holdVoiceCall.js +34 -0
  28. package/dist/apis/call/joinGroupCall.d.ts +11 -0
  29. package/dist/apis/call/joinGroupCall.js +46 -0
  30. package/dist/apis/call/logEndVoiceCall.d.ts +8 -0
  31. package/dist/apis/call/logEndVoiceCall.js +46 -0
  32. package/dist/apis/call/notifyGroupCall.d.ts +9 -0
  33. package/dist/apis/call/notifyGroupCall.js +44 -0
  34. package/dist/apis/call/pingGroupCall.d.ts +10 -0
  35. package/dist/apis/call/pingGroupCall.js +45 -0
  36. package/dist/apis/call/requestAudioToVideoCall.d.ts +5 -0
  37. package/dist/apis/call/requestAudioToVideoCall.js +37 -0
  38. package/dist/apis/call/requestGroupCall.d.ts +9 -0
  39. package/dist/apis/call/requestGroupCall.js +46 -0
  40. package/dist/apis/call/requestShareScreenCall.d.ts +5 -0
  41. package/dist/apis/call/requestShareScreenCall.js +37 -0
  42. package/dist/apis/call/requestVoiceCall.d.ts +10 -0
  43. package/dist/apis/call/requestVoiceCall.js +47 -0
  44. package/dist/apis/call/ringRingGroupCall.d.ts +10 -0
  45. package/dist/apis/call/ringRingGroupCall.js +45 -0
  46. package/dist/apis/call/ringRingVoiceCall.d.ts +5 -0
  47. package/dist/apis/call/ringRingVoiceCall.js +38 -0
  48. package/dist/apis/call/sendRequestGroupCall.d.ts +11 -0
  49. package/dist/apis/call/sendRequestGroupCall.js +48 -0
  50. package/dist/apis/call/sendRequestVoiceCall.d.ts +11 -0
  51. package/dist/apis/call/sendRequestVoiceCall.js +51 -0
  52. package/dist/apis/call/sendVoiceCall.d.ts +8 -1
  53. package/dist/apis/call/sendVoiceCall.js +10 -8
  54. package/dist/apis/call/shareScreenGroupCall.d.ts +10 -0
  55. package/dist/apis/call/shareScreenGroupCall.js +45 -0
  56. package/dist/apis/call/unholdVoiceCall.d.ts +5 -0
  57. package/dist/apis/call/unholdVoiceCall.js +34 -0
  58. package/dist/apis/call/updateCallMediaState.d.ts +7 -0
  59. package/dist/apis/call/updateCallMediaState.js +61 -0
  60. package/dist/apis.d.ts +81 -0
  61. package/dist/apis.js +135 -0
  62. package/dist/call-engine/ZRTPPacketCodec.d.ts +262 -0
  63. package/dist/call-engine/ZRTPPacketCodec.js +506 -0
  64. package/dist/call-engine/ZaloCallController.d.ts +134 -0
  65. package/dist/call-engine/ZaloCallController.js +638 -0
  66. package/dist/call-engine/ZaloCallTransport.d.ts +83 -0
  67. package/dist/call-engine/ZaloCallTransport.js +233 -0
  68. package/dist/call-engine/ZaloRtcSession.d.ts +609 -0
  69. package/dist/call-engine/ZaloRtcSession.js +2931 -0
  70. package/dist/call-engine/ZaloSrtpSession.d.ts +80 -0
  71. package/dist/call-engine/ZaloSrtpSession.js +278 -0
  72. package/dist/call-engine/index.d.ts +18 -0
  73. package/dist/call-engine/index.js +24 -0
  74. package/dist/cjs/apis/call/addUserGroupCall.cjs +53 -0
  75. package/dist/cjs/apis/call/answerAckVoiceCall.cjs +43 -0
  76. package/dist/cjs/apis/call/answerGroupCall.cjs +50 -0
  77. package/dist/cjs/apis/call/answerVoiceCall.cjs +55 -0
  78. package/dist/cjs/apis/call/broadcastGroupCallState.cjs +50 -0
  79. package/dist/cjs/apis/call/cancelGroupCall.cjs +50 -0
  80. package/dist/cjs/apis/call/cancelVoiceCall.cjs +5 -1
  81. package/dist/cjs/apis/call/createController.cjs +14 -0
  82. package/dist/cjs/apis/call/createRtcSession.cjs +15 -0
  83. package/dist/cjs/apis/call/endGroupCall.cjs +50 -0
  84. package/dist/cjs/apis/call/finishGroupCall.cjs +52 -0
  85. package/dist/cjs/apis/call/getGroupCallState.cjs +43 -0
  86. package/dist/cjs/apis/call/holdVoiceCall.cjs +39 -0
  87. package/dist/cjs/apis/call/joinGroupCall.cjs +51 -0
  88. package/dist/cjs/apis/call/logEndVoiceCall.cjs +51 -0
  89. package/dist/cjs/apis/call/notifyGroupCall.cjs +49 -0
  90. package/dist/cjs/apis/call/pingGroupCall.cjs +50 -0
  91. package/dist/cjs/apis/call/requestAudioToVideoCall.cjs +42 -0
  92. package/dist/cjs/apis/call/requestGroupCall.cjs +51 -0
  93. package/dist/cjs/apis/call/requestShareScreenCall.cjs +42 -0
  94. package/dist/cjs/apis/call/requestVoiceCall.cjs +52 -0
  95. package/dist/cjs/apis/call/ringRingGroupCall.cjs +50 -0
  96. package/dist/cjs/apis/call/ringRingVoiceCall.cjs +43 -0
  97. package/dist/cjs/apis/call/sendRequestGroupCall.cjs +53 -0
  98. package/dist/cjs/apis/call/sendRequestVoiceCall.cjs +56 -0
  99. package/dist/cjs/apis/call/sendVoiceCall.cjs +10 -8
  100. package/dist/cjs/apis/call/shareScreenGroupCall.cjs +50 -0
  101. package/dist/cjs/apis/call/unholdVoiceCall.cjs +39 -0
  102. package/dist/cjs/apis/call/updateCallMediaState.cjs +66 -0
  103. package/dist/cjs/apis.cjs +135 -0
  104. package/dist/cjs/call-engine/ZRTPPacketCodec.cjs +525 -0
  105. package/dist/cjs/call-engine/ZaloCallController.cjs +643 -0
  106. package/dist/cjs/call-engine/ZaloCallTransport.cjs +239 -0
  107. package/dist/cjs/call-engine/ZaloRtcSession.cjs +2937 -0
  108. package/dist/cjs/call-engine/ZaloSrtpSession.cjs +287 -0
  109. package/dist/cjs/constants/protocol.cjs +1 -1
  110. package/dist/cjs/index.cjs +61 -11
  111. package/dist/cjs/models/CallEvent.cjs +95 -1
  112. package/dist/cjs/realtime/handlers/control.handler.cjs +17 -3
  113. package/dist/cjs/realtime/listener.cjs +19 -0
  114. package/dist/constants/protocol.d.ts +1 -1
  115. package/dist/constants/protocol.js +1 -1
  116. package/dist/index.d.ts +32 -4
  117. package/dist/index.js +2 -0
  118. package/dist/models/CallEvent.d.ts +15 -0
  119. package/dist/models/CallEvent.js +95 -1
  120. package/dist/realtime/handlers/control.handler.js +17 -3
  121. package/dist/realtime/listener.d.ts +5 -0
  122. package/dist/realtime/listener.js +19 -0
  123. package/package.json +2 -1
package/dist/apis.js CHANGED
@@ -6,10 +6,16 @@ import { addPollOptionsFactory } from "./apis/board/addPollOptions.js";
6
6
  import { addQuickMessageFactory } from "./apis/business/addQuickMessage.js";
7
7
  import { addReactionFactory } from "./apis/chat/addReaction.js";
8
8
  import { addUnreadMarkFactory } from "./apis/chat/addUnreadMark.js";
9
+ import { addUserGroupCallFactory } from "./apis/call/addUserGroupCall.js";
9
10
  import { addUserToGroupFactory } from "./apis/group/addUserToGroup.js";
10
11
  import { analyseGroupFactory } from "./apis/group/analyseGroup.js";
12
+ import { answerAckVoiceCallFactory } from "./apis/call/answerAckVoiceCall.js";
13
+ import { answerGroupCallFactory } from "./apis/call/answerGroupCall.js";
14
+ import { answerVoiceCallFactory } from "./apis/call/answerVoiceCall.js";
11
15
  import { blockUserFactory } from "./apis/friend/blockUser.js";
12
16
  import { blockViewFeedFactory } from "./apis/friend/blockViewFeed.js";
17
+ import { broadcastGroupCallStateFactory } from "./apis/call/broadcastGroupCallState.js";
18
+ import { cancelGroupCallFactory } from "./apis/call/cancelGroupCall.js";
13
19
  import { cancelPullMobileFactory } from "./apis/sync/cancelPullMobile.js";
14
20
  import { cancelVoiceCallFactory } from "./apis/call/cancelVoiceCall.js";
15
21
  import { changeAccountAvatarFactory } from "./apis/profile/changeAccountAvatar.js";
@@ -22,11 +28,13 @@ import { clearUnreadFriendRequestsFactory } from "./apis/friend/clearUnreadFrien
22
28
  import { createAutoReplyFactory } from "./apis/business/createAutoReply.js";
23
29
  import { createBankAccountFactory } from "./apis/business/createBankAccount.js";
24
30
  import { createCatalogFactory } from "./apis/business/createCatalog.js";
31
+ import { createControllerFactory } from "./apis/call/createController.js";
25
32
  import { createGroupFactory } from "./apis/group/createGroup.js";
26
33
  import { createNoteFactory } from "./apis/board/createNote.js";
27
34
  import { createPollFactory } from "./apis/board/createPoll.js";
28
35
  import { createProductCatalogFactory } from "./apis/business/createProductCatalog.js";
29
36
  import { createReminderFactory } from "./apis/board/createReminder.js";
37
+ import { createRtcSessionFactory } from "./apis/call/createRtcSession.js";
30
38
  import { decryptGidsFactory } from "./apis/auth/decryptGids.js";
31
39
  import { deleteAutoReplyFactory } from "./apis/business/deleteAutoReply.js";
32
40
  import { deleteAvatarFactory } from "./apis/profile/deleteAvatar.js";
@@ -43,11 +51,13 @@ import { editNoteFactory } from "./apis/board/editNote.js";
43
51
  import { editReminderFactory } from "./apis/board/editReminder.js";
44
52
  import { enableGroupLinkFactory } from "./apis/group/enableGroupLink.js";
45
53
  import { encryptGidsFactory } from "./apis/auth/encryptGids.js";
54
+ import { endGroupCallFactory } from "./apis/call/endGroupCall.js";
46
55
  import { endVoiceCallFactory } from "./apis/call/endVoiceCall.js";
47
56
  import { exportSessionFactory } from "./apis/auth/exportSession.js";
48
57
  import { fetchAccountInfoFactory } from "./apis/profile/fetchAccountInfo.js";
49
58
  import { findUserFactory } from "./apis/friend/findUser.js";
50
59
  import { findUserByUsernameFactory } from "./apis/friend/findUserByUsername.js";
60
+ import { finishGroupCallFactory } from "./apis/call/finishGroupCall.js";
51
61
  import { forwardMessageFactory } from "./apis/chat/forwardMessage.js";
52
62
  import { getAliasListFactory } from "./apis/friend/getAliasList.js";
53
63
  import { getAliasListV2Factory } from "./apis/friend/getAliasListV2.js";
@@ -85,6 +95,7 @@ import { getFriendsActivePCWebFactory } from "./apis/friend/getFriendsActivePCWe
85
95
  import { getFriendsEmojiStatusFactory } from "./apis/friend/getFriendsEmojiStatus.js";
86
96
  import { getFullAvatarFactory } from "./apis/profile/getFullAvatar.js";
87
97
  import { getGroupBlockedMemberFactory } from "./apis/group/getGroupBlockedMember.js";
98
+ import { getGroupCallStateFactory } from "./apis/call/getGroupCallState.js";
88
99
  import { getGroupChatHistoryFactory } from "./apis/group/getGroupChatHistory.js";
89
100
  import { getGroupCloudMessageJumpFactory } from "./apis/group/getGroupCloudMessageJump.js";
90
101
  import { getGroupCloudMessagePathFactory } from "./apis/group/getGroupCloudMessagePath.js";
@@ -149,15 +160,20 @@ import { getUnreadMarkFactory } from "./apis/chat/getUnreadMark.js";
149
160
  import { getUsageMyCloudFactory } from "./apis/zcloud/getUsageMyCloud.js";
150
161
  import { getUsageZCloudFactory } from "./apis/zcloud/getUsageZCloud.js";
151
162
  import { getUserInfoFactory } from "./apis/profile/getUserInfo.js";
163
+ import { holdVoiceCallFactory } from "./apis/call/holdVoiceCall.js";
152
164
  import { inviteUserToGroupsFactory } from "./apis/group/inviteUserToGroups.js";
165
+ import { joinGroupCallFactory } from "./apis/call/joinGroupCall.js";
153
166
  import { joinGroupInviteBoxFactory } from "./apis/group/joinGroupInviteBox.js";
154
167
  import { joinGroupLinkFactory } from "./apis/group/joinGroupLink.js";
155
168
  import { keepAliveFactory } from "./apis/auth/keepAlive.js";
156
169
  import { lastOnlineFactory } from "./apis/friend/lastOnline.js";
157
170
  import { leaveGroupFactory } from "./apis/group/leaveGroup.js";
158
171
  import { lockPollFactory } from "./apis/board/lockPoll.js";
172
+ import { logEndVoiceCallFactory } from "./apis/call/logEndVoiceCall.js";
159
173
  import { lostFocusFactory } from "./apis/auth/lostFocus.js";
174
+ import { notifyGroupCallFactory } from "./apis/call/notifyGroupCall.js";
160
175
  import { parseLinkFactory } from "./apis/chat/parseLink.js";
176
+ import { pingGroupCallFactory } from "./apis/call/pingGroupCall.js";
161
177
  import { preloadConversationsFactory } from "./apis/chat/preloadConversations.js";
162
178
  import { pullMobileFactory } from "./apis/sync/pullMobile.js";
163
179
  import { readContactTabFactory } from "./apis/friend/readContactTab.js";
@@ -173,10 +189,16 @@ import { removeQuickMessageFactory } from "./apis/business/removeQuickMessage.js
173
189
  import { removeReminderFactory } from "./apis/board/removeReminder.js";
174
190
  import { removeUnreadMarkFactory } from "./apis/chat/removeUnreadMark.js";
175
191
  import { removeUserFromGroupFactory } from "./apis/group/removeUserFromGroup.js";
192
+ import { requestAudioToVideoCallFactory } from "./apis/call/requestAudioToVideoCall.js";
193
+ import { requestGroupCallFactory } from "./apis/call/requestGroupCall.js";
194
+ import { requestShareScreenCallFactory } from "./apis/call/requestShareScreenCall.js";
176
195
  import { requestSyncFromPhoneFactory } from "./apis/sync/requestSyncFromPhone.js";
196
+ import { requestVoiceCallFactory } from "./apis/call/requestVoiceCall.js";
177
197
  import { resetHiddenConversPinFactory } from "./apis/chat/resetHiddenConversPin.js";
178
198
  import { reuseAvatarFactory } from "./apis/profile/reuseAvatar.js";
179
199
  import { reviewPendingMemberRequestFactory } from "./apis/group/reviewPendingMemberRequest.js";
200
+ import { ringRingGroupCallFactory } from "./apis/call/ringRingGroupCall.js";
201
+ import { ringRingVoiceCallFactory } from "./apis/call/ringRingVoiceCall.js";
180
202
  import { scanURLFactory } from "./apis/auth/scanURL.js";
181
203
  import { searchStickerFactory } from "./apis/sticker/searchSticker.js";
182
204
  import { sendBankCardFactory } from "./apis/chat/sendBankCard.js";
@@ -186,6 +208,8 @@ import { sendFriendRequestFactory } from "./apis/friend/sendFriendRequest.js";
186
208
  import { sendLinkFactory } from "./apis/chat/sendLink.js";
187
209
  import { sendMessageFactory } from "./apis/chat/sendMessage.js";
188
210
  import { sendReportFactory } from "./apis/chat/sendReport.js";
211
+ import { sendRequestGroupCallFactory } from "./apis/call/sendRequestGroupCall.js";
212
+ import { sendRequestVoiceCallFactory } from "./apis/call/sendRequestVoiceCall.js";
189
213
  import { sendSeenEventFactory } from "./apis/chat/sendSeenEvent.js";
190
214
  import { sendStickerFactory } from "./apis/chat/sendSticker.js";
191
215
  import { sendTypingEventFactory } from "./apis/chat/sendTypingEvent.js";
@@ -196,15 +220,18 @@ import { setHiddenConversationsFactory } from "./apis/chat/setHiddenConversation
196
220
  import { setMuteFactory } from "./apis/chat/setMute.js";
197
221
  import { setPinnedConversationsFactory } from "./apis/chat/setPinnedConversations.js";
198
222
  import { sharePollFactory } from "./apis/board/sharePoll.js";
223
+ import { shareScreenGroupCallFactory } from "./apis/call/shareScreenGroupCall.js";
199
224
  import { unblockUserFactory } from "./apis/friend/unblockUser.js";
200
225
  import { undoFactory } from "./apis/chat/undo.js";
201
226
  import { undoFriendRequestFactory } from "./apis/friend/undoFriendRequest.js";
202
227
  import { undoMultiMessageFactory } from "./apis/chat/undoMultiMessage.js";
228
+ import { unholdVoiceCallFactory } from "./apis/call/unholdVoiceCall.js";
203
229
  import { updateActiveStatusFactory } from "./apis/auth/updateActiveStatus.js";
204
230
  import { updateArchivedChatListFactory } from "./apis/chat/updateArchivedChatList.js";
205
231
  import { updateAutoDeleteChatFactory } from "./apis/chat/updateAutoDeleteChat.js";
206
232
  import { updateAutoReplyFactory } from "./apis/business/updateAutoReply.js";
207
233
  import { updateBankAccountFactory } from "./apis/business/updateBankAccount.js";
234
+ import { updateCallMediaStateFactory } from "./apis/call/updateCallMediaState.js";
208
235
  import { updateCatalogFactory } from "./apis/business/updateCatalog.js";
209
236
  import { updateGroupSettingsFactory } from "./apis/group/updateGroupSettings.js";
210
237
  import { updateHiddenConversPinFactory } from "./apis/chat/updateHiddenConversPin.js";
@@ -324,9 +351,36 @@ export class API {
324
351
  get call() {
325
352
  if (!this._domains.call) {
326
353
  const createNamespace = (api) => ({
354
+ get addUserGroupCall() { return api.addUserGroupCall; },
355
+ get answerAckVoiceCall() { return api.answerAckVoiceCall; },
356
+ get answerGroupCall() { return api.answerGroupCall; },
357
+ get answerVoiceCall() { return api.answerVoiceCall; },
358
+ get broadcastGroupCallState() { return api.broadcastGroupCallState; },
359
+ get cancelGroupCall() { return api.cancelGroupCall; },
327
360
  get cancelVoiceCall() { return api.cancelVoiceCall; },
361
+ get createController() { return api.createController; },
362
+ get createRtcSession() { return api.createRtcSession; },
363
+ get endGroupCall() { return api.endGroupCall; },
328
364
  get endVoiceCall() { return api.endVoiceCall; },
365
+ get finishGroupCall() { return api.finishGroupCall; },
366
+ get getGroupCallState() { return api.getGroupCallState; },
367
+ get holdVoiceCall() { return api.holdVoiceCall; },
368
+ get joinGroupCall() { return api.joinGroupCall; },
369
+ get logEndVoiceCall() { return api.logEndVoiceCall; },
370
+ get notifyGroupCall() { return api.notifyGroupCall; },
371
+ get pingGroupCall() { return api.pingGroupCall; },
372
+ get requestAudioToVideoCall() { return api.requestAudioToVideoCall; },
373
+ get requestGroupCall() { return api.requestGroupCall; },
374
+ get requestShareScreenCall() { return api.requestShareScreenCall; },
375
+ get requestVoiceCall() { return api.requestVoiceCall; },
376
+ get ringRingGroupCall() { return api.ringRingGroupCall; },
377
+ get ringRingVoiceCall() { return api.ringRingVoiceCall; },
378
+ get sendRequestGroupCall() { return api.sendRequestGroupCall; },
379
+ get sendRequestVoiceCall() { return api.sendRequestVoiceCall; },
329
380
  get sendVoiceCall() { return api.sendVoiceCall; },
381
+ get shareScreenGroupCall() { return api.shareScreenGroupCall; },
382
+ get unholdVoiceCall() { return api.unholdVoiceCall; },
383
+ get updateCallMediaState() { return api.updateCallMediaState; },
330
384
  });
331
385
  this._domains.call = createNamespace(this);
332
386
  }
@@ -586,18 +640,36 @@ export class API {
586
640
  get addUnreadMark() {
587
641
  return (this._cache.addUnreadMark ??= addUnreadMarkFactory(this.ctx, this));
588
642
  }
643
+ get addUserGroupCall() {
644
+ return (this._cache.addUserGroupCall ??= addUserGroupCallFactory(this.ctx, this));
645
+ }
589
646
  get addUserToGroup() {
590
647
  return (this._cache.addUserToGroup ??= addUserToGroupFactory(this.ctx, this));
591
648
  }
592
649
  get analyseGroup() {
593
650
  return (this._cache.analyseGroup ??= analyseGroupFactory(this.ctx, this));
594
651
  }
652
+ get answerAckVoiceCall() {
653
+ return (this._cache.answerAckVoiceCall ??= answerAckVoiceCallFactory(this.ctx, this));
654
+ }
655
+ get answerGroupCall() {
656
+ return (this._cache.answerGroupCall ??= answerGroupCallFactory(this.ctx, this));
657
+ }
658
+ get answerVoiceCall() {
659
+ return (this._cache.answerVoiceCall ??= answerVoiceCallFactory(this.ctx, this));
660
+ }
595
661
  get blockUser() {
596
662
  return (this._cache.blockUser ??= blockUserFactory(this.ctx, this));
597
663
  }
598
664
  get blockViewFeed() {
599
665
  return (this._cache.blockViewFeed ??= blockViewFeedFactory(this.ctx, this));
600
666
  }
667
+ get broadcastGroupCallState() {
668
+ return (this._cache.broadcastGroupCallState ??= broadcastGroupCallStateFactory(this.ctx, this));
669
+ }
670
+ get cancelGroupCall() {
671
+ return (this._cache.cancelGroupCall ??= cancelGroupCallFactory(this.ctx, this));
672
+ }
601
673
  get cancelPullMobile() {
602
674
  return (this._cache.cancelPullMobile ??= cancelPullMobileFactory(this.ctx, this));
603
675
  }
@@ -634,6 +706,9 @@ export class API {
634
706
  get createCatalog() {
635
707
  return (this._cache.createCatalog ??= createCatalogFactory(this.ctx, this));
636
708
  }
709
+ get createController() {
710
+ return (this._cache.createController ??= createControllerFactory(this.ctx, this));
711
+ }
637
712
  get createGroup() {
638
713
  return (this._cache.createGroup ??= createGroupFactory(this.ctx, this));
639
714
  }
@@ -649,6 +724,9 @@ export class API {
649
724
  get createReminder() {
650
725
  return (this._cache.createReminder ??= createReminderFactory(this.ctx, this));
651
726
  }
727
+ get createRtcSession() {
728
+ return (this._cache.createRtcSession ??= createRtcSessionFactory(this.ctx, this));
729
+ }
652
730
  get decryptGids() {
653
731
  return (this._cache.decryptGids ??= decryptGidsFactory(this.ctx, this));
654
732
  }
@@ -697,6 +775,9 @@ export class API {
697
775
  get encryptGids() {
698
776
  return (this._cache.encryptGids ??= encryptGidsFactory(this.ctx, this));
699
777
  }
778
+ get endGroupCall() {
779
+ return (this._cache.endGroupCall ??= endGroupCallFactory(this.ctx, this));
780
+ }
700
781
  get endVoiceCall() {
701
782
  return (this._cache.endVoiceCall ??= endVoiceCallFactory(this.ctx, this));
702
783
  }
@@ -712,6 +793,9 @@ export class API {
712
793
  get findUserByUsername() {
713
794
  return (this._cache.findUserByUsername ??= findUserByUsernameFactory(this.ctx, this));
714
795
  }
796
+ get finishGroupCall() {
797
+ return (this._cache.finishGroupCall ??= finishGroupCallFactory(this.ctx, this));
798
+ }
715
799
  get forwardMessage() {
716
800
  return (this._cache.forwardMessage ??= forwardMessageFactory(this.ctx, this));
717
801
  }
@@ -823,6 +907,9 @@ export class API {
823
907
  get getGroupBlockedMember() {
824
908
  return (this._cache.getGroupBlockedMember ??= getGroupBlockedMemberFactory(this.ctx, this));
825
909
  }
910
+ get getGroupCallState() {
911
+ return (this._cache.getGroupCallState ??= getGroupCallStateFactory(this.ctx, this));
912
+ }
826
913
  get getGroupChatHistory() {
827
914
  return (this._cache.getGroupChatHistory ??= getGroupChatHistoryFactory(this.ctx, this));
828
915
  }
@@ -1015,9 +1102,15 @@ export class API {
1015
1102
  get getUserInfo() {
1016
1103
  return (this._cache.getUserInfo ??= getUserInfoFactory(this.ctx, this));
1017
1104
  }
1105
+ get holdVoiceCall() {
1106
+ return (this._cache.holdVoiceCall ??= holdVoiceCallFactory(this.ctx, this));
1107
+ }
1018
1108
  get inviteUserToGroups() {
1019
1109
  return (this._cache.inviteUserToGroups ??= inviteUserToGroupsFactory(this.ctx, this));
1020
1110
  }
1111
+ get joinGroupCall() {
1112
+ return (this._cache.joinGroupCall ??= joinGroupCallFactory(this.ctx, this));
1113
+ }
1021
1114
  get joinGroupInviteBox() {
1022
1115
  return (this._cache.joinGroupInviteBox ??= joinGroupInviteBoxFactory(this.ctx, this));
1023
1116
  }
@@ -1036,12 +1129,21 @@ export class API {
1036
1129
  get lockPoll() {
1037
1130
  return (this._cache.lockPoll ??= lockPollFactory(this.ctx, this));
1038
1131
  }
1132
+ get logEndVoiceCall() {
1133
+ return (this._cache.logEndVoiceCall ??= logEndVoiceCallFactory(this.ctx, this));
1134
+ }
1039
1135
  get lostFocus() {
1040
1136
  return (this._cache.lostFocus ??= lostFocusFactory(this.ctx, this));
1041
1137
  }
1138
+ get notifyGroupCall() {
1139
+ return (this._cache.notifyGroupCall ??= notifyGroupCallFactory(this.ctx, this));
1140
+ }
1042
1141
  get parseLink() {
1043
1142
  return (this._cache.parseLink ??= parseLinkFactory(this.ctx, this));
1044
1143
  }
1144
+ get pingGroupCall() {
1145
+ return (this._cache.pingGroupCall ??= pingGroupCallFactory(this.ctx, this));
1146
+ }
1045
1147
  get preloadConversations() {
1046
1148
  return (this._cache.preloadConversations ??= preloadConversationsFactory(this.ctx, this));
1047
1149
  }
@@ -1087,9 +1189,21 @@ export class API {
1087
1189
  get removeUserFromGroup() {
1088
1190
  return (this._cache.removeUserFromGroup ??= removeUserFromGroupFactory(this.ctx, this));
1089
1191
  }
1192
+ get requestAudioToVideoCall() {
1193
+ return (this._cache.requestAudioToVideoCall ??= requestAudioToVideoCallFactory(this.ctx, this));
1194
+ }
1195
+ get requestGroupCall() {
1196
+ return (this._cache.requestGroupCall ??= requestGroupCallFactory(this.ctx, this));
1197
+ }
1198
+ get requestShareScreenCall() {
1199
+ return (this._cache.requestShareScreenCall ??= requestShareScreenCallFactory(this.ctx, this));
1200
+ }
1090
1201
  get requestSyncFromPhone() {
1091
1202
  return (this._cache.requestSyncFromPhone ??= requestSyncFromPhoneFactory(this.ctx, this));
1092
1203
  }
1204
+ get requestVoiceCall() {
1205
+ return (this._cache.requestVoiceCall ??= requestVoiceCallFactory(this.ctx, this));
1206
+ }
1093
1207
  get resetHiddenConversPin() {
1094
1208
  return (this._cache.resetHiddenConversPin ??= resetHiddenConversPinFactory(this.ctx, this));
1095
1209
  }
@@ -1099,6 +1213,12 @@ export class API {
1099
1213
  get reviewPendingMemberRequest() {
1100
1214
  return (this._cache.reviewPendingMemberRequest ??= reviewPendingMemberRequestFactory(this.ctx, this));
1101
1215
  }
1216
+ get ringRingGroupCall() {
1217
+ return (this._cache.ringRingGroupCall ??= ringRingGroupCallFactory(this.ctx, this));
1218
+ }
1219
+ get ringRingVoiceCall() {
1220
+ return (this._cache.ringRingVoiceCall ??= ringRingVoiceCallFactory(this.ctx, this));
1221
+ }
1102
1222
  get scanURL() {
1103
1223
  return (this._cache.scanURL ??= scanURLFactory(this.ctx, this));
1104
1224
  }
@@ -1126,6 +1246,12 @@ export class API {
1126
1246
  get sendReport() {
1127
1247
  return (this._cache.sendReport ??= sendReportFactory(this.ctx, this));
1128
1248
  }
1249
+ get sendRequestGroupCall() {
1250
+ return (this._cache.sendRequestGroupCall ??= sendRequestGroupCallFactory(this.ctx, this));
1251
+ }
1252
+ get sendRequestVoiceCall() {
1253
+ return (this._cache.sendRequestVoiceCall ??= sendRequestVoiceCallFactory(this.ctx, this));
1254
+ }
1129
1255
  get sendSeenEvent() {
1130
1256
  return (this._cache.sendSeenEvent ??= sendSeenEventFactory(this.ctx, this));
1131
1257
  }
@@ -1156,6 +1282,9 @@ export class API {
1156
1282
  get sharePoll() {
1157
1283
  return (this._cache.sharePoll ??= sharePollFactory(this.ctx, this));
1158
1284
  }
1285
+ get shareScreenGroupCall() {
1286
+ return (this._cache.shareScreenGroupCall ??= shareScreenGroupCallFactory(this.ctx, this));
1287
+ }
1159
1288
  get unblockUser() {
1160
1289
  return (this._cache.unblockUser ??= unblockUserFactory(this.ctx, this));
1161
1290
  }
@@ -1168,6 +1297,9 @@ export class API {
1168
1297
  get undoMultiMessage() {
1169
1298
  return (this._cache.undoMultiMessage ??= undoMultiMessageFactory(this.ctx, this));
1170
1299
  }
1300
+ get unholdVoiceCall() {
1301
+ return (this._cache.unholdVoiceCall ??= unholdVoiceCallFactory(this.ctx, this));
1302
+ }
1171
1303
  get updateActiveStatus() {
1172
1304
  return (this._cache.updateActiveStatus ??= updateActiveStatusFactory(this.ctx, this));
1173
1305
  }
@@ -1183,6 +1315,9 @@ export class API {
1183
1315
  get updateBankAccount() {
1184
1316
  return (this._cache.updateBankAccount ??= updateBankAccountFactory(this.ctx, this));
1185
1317
  }
1318
+ get updateCallMediaState() {
1319
+ return (this._cache.updateCallMediaState ??= updateCallMediaStateFactory(this.ctx, this));
1320
+ }
1186
1321
  get updateCatalog() {
1187
1322
  return (this._cache.updateCatalog ??= updateCatalogFactory(this.ctx, this));
1188
1323
  }
@@ -0,0 +1,262 @@
1
+ import { Buffer } from "node:buffer";
2
+ /**
3
+ * Các mã lệnh điều khiển UDP trong `zrtc::ZRTPPacket` (`_buildPacketInternal` @ `0x10015830c`)
4
+ */
5
+ export declare enum ZRTPControlCommand {
6
+ RelayPing = 2,
7
+ EndCall = 3,
8
+ Ping = 5,
9
+ InitCallCaller = 11,
10
+ InitCallCallee = 12,
11
+ RequestForward = 32,
12
+ InitZaviPing = 51
13
+ }
14
+ /**
15
+ * Sub-command cho gói tin điều khiển `RequestForward` (`cmd = 32` / `0x0020`, `byte[20]`)
16
+ * dùng để Ping/Pong kiểm tra kết nối 2 chiều qua máy chủ Relay và điều khiển Audio/Video.
17
+ */
18
+ export declare enum ZRTPForwardSubCommand {
19
+ OnMic = 5,
20
+ OffMic = 6,
21
+ OnCamera = 7,
22
+ OffCamera = 8,
23
+ OffCameraCallKit = 9,
24
+ VideoControl = 10,
25
+ Ping = 11,
26
+ Pong = 16,
27
+ PartnerSuspendVideo = 17
28
+ }
29
+ /**
30
+ * Loại gói tin Media qua máy chủ Relay:
31
+ * - Gửi đi (5-byte header `[type(1B)] + [routingToken(4B LE)] + [RTP/RTCP]`): `{3, 5, 7, 13, 15}`
32
+ * - Nhận về từ Relay (1-byte header `[type(1B)] + [RTP]`): `{4, 7, 14}`
33
+ * - Nhận về RTCP từ Relay (5-byte header `[type(1B)] + [routingToken(4B LE)] + [RTCP]`): `{5, 15}`
34
+ */
35
+ export declare enum ZRTPLegacyMediaType {
36
+ AudioRtp = 3,
37
+ IncomingAudioRtp = 4,
38
+ AudioRtcp = 5,
39
+ AudioFec = 7,
40
+ VideoRtp = 13,
41
+ IncomingVideoRtp = 14,
42
+ VideoRtcp = 15
43
+ }
44
+ /**
45
+ * Sub-command cho gói tin ZRTC Multiplexed Media (`byte[0] == 0x7f`, 9-byte header)
46
+ */
47
+ export declare enum ZRTCMediaSubCommand {
48
+ P2PPingRequest = 1,
49
+ P2PPingResponse = 2,
50
+ P2PInitCaller = 3,
51
+ P2PInitCallee = 4,
52
+ AudioRtp = 6,
53
+ AudioRtcp = 7,
54
+ VideoRtp = 8,
55
+ VideoRtcp = 9,
56
+ AudioFec = 10
57
+ }
58
+ export declare enum ZRTCRole {
59
+ Caller = 0,
60
+ Callee = 1
61
+ }
62
+ export type ZRTPInitCallRequestOptions = {
63
+ isCaller?: boolean;
64
+ seqNum?: number;
65
+ headerCallId?: number;
66
+ callId: number;
67
+ fromUid?: number;
68
+ toUid?: number;
69
+ flags?: number;
70
+ subFlags?: number;
71
+ sessId: string;
72
+ zrtcConfig?: string;
73
+ };
74
+ export type ZRTPInitCallResponseOptions = {
75
+ isCaller?: boolean;
76
+ seqNum?: number;
77
+ headerCallId?: number;
78
+ callId: number;
79
+ fromUid?: number;
80
+ toUid?: number;
81
+ flags?: number;
82
+ errorCode?: number;
83
+ routingToken: number;
84
+ sessId: string;
85
+ };
86
+ export type ZRTPPingRequestOptions = {
87
+ seqNum: number;
88
+ callId: number;
89
+ fromUid?: number;
90
+ toUid?: number;
91
+ elapsedMs: number | string;
92
+ minByteLength?: number;
93
+ };
94
+ export type ZRTPRelayPingRequestOptions = {
95
+ seqNum?: number;
96
+ callId?: number;
97
+ fromUid: number;
98
+ routingToken: number;
99
+ sessId: string;
100
+ };
101
+ export type ZRTPRequestForwardOptions = {
102
+ seqNum?: number;
103
+ seqId: number;
104
+ fromUid: number;
105
+ routingToken: number;
106
+ subCmd: ZRTPForwardSubCommand | number;
107
+ payload?: string | Buffer;
108
+ };
109
+ export type ZRTPEchoRequestOptions = {
110
+ seqNum: number;
111
+ callId: number;
112
+ fromUid?: number;
113
+ toUid?: number;
114
+ token: number;
115
+ };
116
+ export type ZRTPEndCallRequestOptions = {
117
+ seqNum?: number;
118
+ callId: number;
119
+ fromUid?: number;
120
+ toUid?: number;
121
+ routingToken?: number;
122
+ flags?: number;
123
+ };
124
+ export type ZRTPControlPacket = {
125
+ family: "control";
126
+ isResponse: boolean;
127
+ packetType: 1 | 2;
128
+ subType: number;
129
+ seqNum: number;
130
+ headerCallId: number;
131
+ fromUid: number;
132
+ toUid: number;
133
+ cmd: number;
134
+ flags: number;
135
+ callId?: number;
136
+ subFlags?: number;
137
+ errorCode?: number;
138
+ routingToken?: number;
139
+ sessId?: string;
140
+ zrtcConfig?: string;
141
+ pingString?: string;
142
+ forwardPayload?: Buffer;
143
+ echoToken?: number;
144
+ rawBody: Buffer;
145
+ };
146
+ export type ZRTPLegacyMediaPacket = {
147
+ family: "legacy_media";
148
+ mediaType: ZRTPLegacyMediaType;
149
+ isVideo: boolean;
150
+ isRtcp: boolean;
151
+ isFec: boolean;
152
+ routingId: number;
153
+ rtpPayload: Buffer;
154
+ };
155
+ export type ZRTCMultiplexedMediaPacket = {
156
+ family: "zrtc_media";
157
+ version: number;
158
+ role: ZRTCRole;
159
+ routingToken: number;
160
+ subCmd: ZRTCMediaSubCommand;
161
+ isVideo: boolean;
162
+ isRtcp: boolean;
163
+ isFec: boolean;
164
+ rtpPayload: Buffer;
165
+ };
166
+ export type ZRTCP2PPacket = {
167
+ family: "zrtc_p2p";
168
+ version: number;
169
+ role: ZRTCRole;
170
+ routingToken: number;
171
+ subCmd: number;
172
+ seqNum: number;
173
+ callId: number;
174
+ payload: Buffer;
175
+ };
176
+ export type ZRTPRawPacket = {
177
+ family: "raw";
178
+ raw: Buffer;
179
+ };
180
+ export type ParsedZRTPPacket = ZRTPControlPacket | ZRTPLegacyMediaPacket | ZRTCMultiplexedMediaPacket | ZRTCP2PPacket | ZRTPRawPacket;
181
+ /**
182
+ * Chuỗi codec Opus chuẩn được `ZaloCall` tạo trong `sendSignal 416`
183
+ */
184
+ export declare const DEFAULT_ZALO_AUDIO_CODEC: string;
185
+ /**
186
+ * Chuỗi codec Audio + Video H264 chuẩn cho cuộc gọi Video
187
+ */
188
+ export declare const DEFAULT_ZALO_VIDEO_CODEC: string;
189
+ export type ZrtcExtendDataOptions = {
190
+ rtpAddress: string;
191
+ rtcpAddress: string;
192
+ isVideo?: boolean;
193
+ srtpMode?: number;
194
+ srtpKey?: string;
195
+ platform?: number;
196
+ packetMode?: number;
197
+ };
198
+ /**
199
+ * Tạo cấu trúc `extendData` chuẩn xác theo `ZaloCall` (`sendSignal 416` / `answer 402`).
200
+ */
201
+ export declare function buildZrtcExtendData(options: ZrtcExtendDataOptions): Record<string, unknown>;
202
+ /**
203
+ * Rút gọn UID 64-bit dạng chuỗi của Zalo về `uint32` dùng trong header `ZRTPPacket`
204
+ */
205
+ export declare function uidToUint32(uid: string | number | undefined): number;
206
+ /**
207
+ * Đóng gói gói tin UDP `InitCall` (`0x01 0x7e`, `cmd = 11` cho Caller hoặc `12` cho Callee)
208
+ * gửi tới máy chủ `rtpaddr` của Zalo (`zrtc::ZRTPPacket::_buildPacketInternal` @ `0x10015830c`).
209
+ */
210
+ export declare function buildInitCallRequest(options: ZRTPInitCallRequestOptions): Buffer;
211
+ /**
212
+ * Đóng gói gói tin UDP phản hồi `InitCall` (`0x02 0x7e`, `cmd = 11 | 12`)
213
+ * khớp chính xác với `zrtc::ZRTPPacket::_parsePacketInternal` (`0x100158db8`)
214
+ * và `zrtc::CallController` (`0x100177920`).
215
+ */
216
+ export declare function buildInitCallResponse(options: ZRTPInitCallResponseOptions): Buffer;
217
+ /**
218
+ * Đóng gói gói tin UDP `Ping` (`0x01 0x01`, `cmd = 5`) gửi định kỳ tới máy chủ relay của Zalo.
219
+ */
220
+ export declare function buildPingRequest(options: ZRTPPingRequestOptions): Buffer;
221
+ /**
222
+ * Đóng gói gói tin UDP phản hồi `Ping` (`0x02 0x01`, `cmd = 5`).
223
+ */
224
+ export declare function buildPingResponse(options: ZRTPPingRequestOptions & {
225
+ errorCode?: number;
226
+ }): Buffer;
227
+ /**
228
+ * Đóng gói gói tin UDP `RequestPing` (`0x01 0x01`, `cmd = 2`) gửi tới máy chủ Relay Zalo
229
+ * (`zrtc::ZRTPPacket::initZRTPPacketRequestPing` @ `0x100157b88`).
230
+ */
231
+ export declare function buildRelayPingRequest(options: ZRTPRelayPingRequestOptions): Buffer;
232
+ /**
233
+ * Đóng gói gói tin UDP `RequestForward` (`0x01 0x01`, `cmd = 32` / `0x0020`)
234
+ * dùng cho Ping (`subCmd = 11`) / Pong (`subCmd = 16`) giữa 2 đầu qua máy chủ Relay
235
+ * (`zrtc::ZRTPPacket::initZRTPPacketRequestForward` @ `0x100157c4c`).
236
+ */
237
+ export declare function buildRequestForwardPacket(options: ZRTPRequestForwardOptions): Buffer;
238
+ /**
239
+ * Đóng gói gói tin UDP `Echo` (`cmd = 3`)
240
+ */
241
+ export declare function buildEchoRequest(options: ZRTPEchoRequestOptions): Buffer;
242
+ /**
243
+ * Đóng gói gói tin UDP `RequestEndCall` (`0x01 0x7e`, `cmd = 3`, 25 bytes)
244
+ * khớp với `zrtc::ZRTPPacket::initZRTPPacketRequestEndCall` (`0x100157b44`)
245
+ * và `_buildPacketInternal` (`0x10015830c`).
246
+ */
247
+ export declare function buildEndCallRequest(options: ZRTPEndCallRequestOptions): Buffer;
248
+ /**
249
+ * Bọc gói tin chuẩn WebRTC RTP/RTCP/SRTP vào khung 5-byte Legacy Media của Zalo
250
+ * (`byte[0]` in `{3, 5, 7, 13, 15}` + `routingId` 4B LE).
251
+ */
252
+ export declare function wrapLegacyMediaPacket(mediaType: ZRTPLegacyMediaType, routingId: number, rtpOrRtcpPayload: Buffer): Buffer;
253
+ /**
254
+ * Bọc gói tin chuẩn WebRTC RTP/RTCP/SRTP vào khung 9-byte ZRTC Multiplexed Media (`0x7f`)
255
+ * (`[0x7f, 0x00, role, routingToken(4B LE), subCmd(2B LE)] + [RTP/RTCP]`).
256
+ */
257
+ export declare function wrapZrtcMediaPacket(subCmd: ZRTCMediaSubCommand, routingToken: number, rtpOrRtcpPayload: Buffer, role?: ZRTCRole): Buffer;
258
+ /**
259
+ * Giải mã bất kỳ gói tin UDP `ZRTPPacket` nào nhận được từ máy chủ Relay Zalo hoặc Peer
260
+ * (`zrtc::ZRTPPacket::_parsePacketInternal` @ `0x1001589e8`).
261
+ */
262
+ export declare function parseZRTPPacket(buf: Buffer): ParsedZRTPPacket;