Define pending decision state for telephone busy warning

This commit is contained in:
evgeny committed 2026-10-19 14:46:47 +02:00
1 parent 7ed1a9b167
commit 6ad9c8c80b
3 files changed
+20 -4

No files matched your search

+3 -1
View File
@@ -4,13 +4,15 @@
#include "call.h"
#include "../../lib/ll_queue.h"
enum call_state { CALL_ST_IDLE, CALL_ST_OUTGOING, CALL_ST_RINGING, CALL_ST_ACTIVE, CALL_ST_ENDED };
enum call_state { CALL_ST_IDLE, CALL_ST_OUTGOING, CALL_ST_RINGING, CALL_ST_ACTIVE, CALL_ST_ENDED, CALL_ST_WAIT_DECISION };
enum call_role { CALL_ROLE_CALLER, CALL_ROLE_CALLEE };
struct call_video_transport;
struct call_session {
struct ll_entry ll;
uint64_t call_id, group_id, peer_node_id;
uint8_t role, state, reason;
uint8_t force; /* вызывающий подтвердил обход телефонной занятости */
uint64_t started_tb; /* неизменный deadline попытки, включая выбор продолжения */
uint8_t end_subcmd;
uint64_t end_started_tb;
struct call_ctx *ctx;
+4 -1
View File
@@ -22,6 +22,7 @@ enum {
CALL_SUBCMD_CANCEL = 0x06, /* {call_id:8} */
CALL_SUBCMD_HANGUP = 0x07, /* {call_id:8, reason:1} */
CALL_SUBCMD_END_ACK = 0x08, /* {call_id:8}: подтверждение HANGUP/CANCEL/DECLINE */
CALL_SUBCMD_PHONE_BUSY = 0x09, /* {call_id:8}: ожидание решения, не завершение */
CALL_SUBCMD_MEDIA = 0x10, /* call_pkt_media + payload[] */
};
@@ -56,6 +57,8 @@ struct call_pkt_invite {
uint64_t call_id;
uint64_t group_id;
uint8_t num_tracks;
uint8_t force; /* 1 = явно подтверждённое продолжение при телефонной занятости */
int64_t expires_us; /* Unix microseconds; устаревшая кодограмма не начинает вызов */
struct call_pkt_track tracks[1]; /* tracks[num_tracks] */
};
@@ -89,7 +92,7 @@ struct call_pkt_media {
#define CALL_OPUS_FRAME_SAMPLES (CALL_OPUS_SAMPLE_RATE * CALL_OPUS_FRAME_MS / 1000) /* 960 */
/* ── таймауты и ёмкости (timebase 0.1ms) ── */
#define CALL_RING_TIMEOUT_TB 450000 /* 45с — вызывающий: нет ответа → CANCEL */
#define CALL_RING_TIMEOUT_TB 600000 /* 60с от начала, включая ожидание решения */
#define CALL_INVITE_RETRY_TB 3000 /* 300мс — кодограмма INVITE (OUTGOING + RINGING) */
#define CALL_RING_DEAD_TB 20000 /* 2с — вызываемый: нет кодограммы → вызов сорван */
#define CALL_NO_ROUTE_MAX_STRIKES 20 /* 20 × 300мс ≈ 6с без маршрута → fail-fast CONNECT_FAIL */
+13 -2
View File
@@ -14,6 +14,7 @@
#include "../utun_instance.h"
#include "../routing_layer/topo_group.h"
#include "../radio/radio.h"
#include "../call/call.h"
#include "../../lib/mem.h"
#include "../../lib/ll_queue.h"
#include "../../lib/json_flat.h"
@@ -39,9 +40,19 @@ static uint8_t member_radio_flag(struct UTUN_INSTANCE* inst, const char* ch_id,
if (!inst || !inst->topo_groups || !ch_id || !ch_id[0]) return 0;
struct TOPO_GROUP* group = topo_groups_find(inst->topo_groups, strtoull(ch_id, NULL, 10));
if (!group || group->group_type != TOPO_GROUP_TYPE_CHAT) return 0;
if (node_id == inst->node_id) return group->radio_active ? CHAT_MEMBER_FLAG_RADIO : 0;
uint8_t status = 0, flags = 0;
if (node_id == inst->node_id) {
status = call_phone_status(inst);
flags = group->radio_active ? CHAT_MEMBER_FLAG_RADIO : 0;
}
struct TOPO_GROUP_NODE* node = topo_node_find_by_id(group, node_id);
return node && node->radio ? CHAT_MEMBER_FLAG_RADIO : 0;
if (node_id != inst->node_id && node) {
status = node->phone_status;
flags = node->radio ? CHAT_MEMBER_FLAG_RADIO : 0;
}
if (status & TOPO_FLAG_PHONE_KNOWN) flags |= CHAT_MEMBER_FLAG_PHONE_KNOWN;
if (status & TOPO_FLAG_PHONE_BUSY) flags |= CHAT_MEMBER_FLAG_PHONE_BUSY;
return flags;
}
/* ─── парсинг adm_tags в flags ─── */