From 3f41676a3d7fa81863a402cd1dd100da2a4db310 Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 15 Oct 2026 12:18:47 +0200 Subject: [PATCH] Define acknowledged call termination and enable route tracing --- src/call/call_priv.h | 2 ++ src/call/call_proto.h | 4 ++++ tests/test_call.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/call/call_priv.h b/src/call/call_priv.h index 8e8c022a..ed55fc65 100644 --- a/src/call/call_priv.h +++ b/src/call/call_priv.h @@ -11,6 +11,8 @@ struct call_session { struct ll_entry ll; uint64_t call_id, group_id, peer_node_id; uint8_t role, state, reason; + uint8_t end_subcmd; + uint64_t end_started_tb; struct call_ctx *ctx; struct CONN_MGR_HANDLE *cm_handle; void *ring_timer, *invite_timer; diff --git a/src/call/call_proto.h b/src/call/call_proto.h index 29ef6898..190eb99a 100644 --- a/src/call/call_proto.h +++ b/src/call/call_proto.h @@ -21,6 +21,7 @@ enum { CALL_SUBCMD_BUSY = 0x05, /* {call_id:8} */ 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_MEDIA = 0x10, /* call_pkt_media + payload[] */ }; @@ -64,6 +65,7 @@ struct call_pkt_decline { uint8_t subcmd; uint64_t call_id; uint8_t reason; }; struct call_pkt_busy { uint8_t subcmd; uint64_t call_id; }; struct call_pkt_cancel { uint8_t subcmd; uint64_t call_id; }; struct call_pkt_hangup { uint8_t subcmd; uint64_t call_id; uint8_t reason; }; +struct call_pkt_end_ack { uint8_t subcmd; uint64_t call_id; }; struct call_pkt_media { uint8_t subcmd; /* CALL_SUBCMD_MEDIA */ @@ -93,6 +95,8 @@ struct call_pkt_media { #define CALL_NO_ROUTE_MAX_STRIKES 20 /* 20 × 300мс ≈ 6с без маршрута → fail-fast CONNECT_FAIL */ #define CALL_NO_TRAFFIC_TB 200000 /* 20с — нет входящих медиа → HANGUP */ #define CALL_TEARDOWN_DELAY_TB 5000 /* 500мс — задержка разрыва conn_mgr после завершения */ +#define CALL_END_RETRY_TB 3000 /* 300мс — повтор финальной команды до END_ACK */ +#define CALL_END_TIMEOUT_TB 200000 /* 20с — предел удержания завершённой сессии без END_ACK */ #define CALL_MAX_TX_FRAMES 750 /* 15с: 10с перебоя + 5с запаса */ #ifdef __cplusplus diff --git a/tests/test_call.c b/tests/test_call.c index 421e8c8b..32fece03 100644 --- a/tests/test_call.c +++ b/tests/test_call.c @@ -808,7 +808,7 @@ int main(int argc, char** argv) { if (getenv("UTUN_TEST_DEBUG")) { debug_set_category_level_by_name("call", "trace"); debug_set_category_level_by_name("bgp", "info"); - debug_set_category_level_by_name("etcp_route", "info"); + debug_set_category_level_by_name("etcp_route", "trace"); debug_set_category_level_by_name("member_sync", "info"); debug_set_category_level_by_name("chat_sync", "info"); }