CallDeliveryReport: универсальный формат type/value и расширенные отчёты по звонкам

This commit is contained in:
AidarKC
2026-05-01 15:09:20 +03:00
parent 3061bf3d1e
commit bff403ea04
7 changed files with 281 additions and 24 deletions
+12 -11
View File
@@ -1171,8 +1171,6 @@ export class AuthService {
return this.runWriteLocked(key, async () => {
const user = await this.ensureChainInitializedForLineOps(cleanLogin, storagePwd);
const blockchainName = String(user?.blockchainName || `${cleanLogin}-${BCH_SUFFIX}`).trim();
const userLastGlobalNumber = Number(user?.serverLastGlobalNumber);
const userLastGlobalHash = normalizeHex32(user?.serverLastGlobalHash, ZERO64);
const ownerBlockchainName = owner;
const lineCode = root;
@@ -1182,17 +1180,14 @@ export class AuthService {
if (ownerBlockchainName !== blockchainName) {
throw new Error('Posting is allowed only to your own channels');
}
// Канал 0 оставляем как технический root-поток.
// Контент-публикации в него временно отключены (пишем только в именованные каналы).
if (lineCode === 0) {
throw new Error('Публикации в канал 0 временно отключены. Создайте отдельный канал.');
}
let rootHashHex = normalizeHex32(selector?.channelRootBlockHash, ZERO64);
if (lineCode === 0) {
rootHashHex = (
Number.isFinite(userLastGlobalNumber) &&
userLastGlobalNumber === 0 &&
userLastGlobalHash !== ZERO64
)
? userLastGlobalHash
: await this.resolveHeaderHashForBlockchain(blockchainName);
} else if (rootHashHex === ZERO64) {
if (rootHashHex === ZERO64) {
const ownChannels = await this.listOwnChannelsForBlockchain(cleanLogin, blockchainName);
const rootChannel = ownChannels.find((item) => item.rootBlockNumber === lineCode);
if (!rootChannel) throw new Error('Channel root not found');
@@ -1431,6 +1426,12 @@ export class AuthService {
return response.payload || {};
}
async sendCallDeliveryReport(payload = {}) {
const response = await this.ws.request('CallDeliveryReport', payload);
if (response.status !== 200) throw opError('CallDeliveryReport', response);
return response.payload || {};
}
async listContacts() {
const response = await this.ws.request('ListContacts', {});
if (response.status !== 200) throw opError('ListContacts', response);