From b68116eedf52b865d5cda617026cdb7a3e9a57b6 Mon Sep 17 00:00:00 2001 From: evgeny Date: Mon, 19 Oct 2026 14:54:01 +0200 Subject: [PATCH] Expose phone busy event to desktop call interface --- tools/chatgui/src/callwindow.h | 3 ++- tools/chatgui/transport/gui_bridge.h | 1 + tools/chatgui/transport/gui_bridge_impl.cpp | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/chatgui/src/callwindow.h b/tools/chatgui/src/callwindow.h index d7187c26..5227a1dd 100644 --- a/tools/chatgui/src/callwindow.h +++ b/tools/chatgui/src/callwindow.h @@ -18,7 +18,7 @@ class CallVideoWindow; class CallWindow : public QWidget { Q_OBJECT public: - enum State { Outgoing, Ringing, Incoming, Active, Ended }; + enum State { Outgoing, Ringing, Incoming, Active, Ended, WaitDecision }; explicit CallWindow(QWidget* parent = nullptr); ~CallWindow() override; @@ -78,6 +78,7 @@ private: QLabel* m_connectionLabel; QLabel* m_statsLabel; QPushButton* m_acceptBtn; + QPushButton* m_continueBtn; /* явное разрешение начать вызов занятого телефона */ QPushButton* m_declineBtn; QPushButton* m_hangupBtn; QPushButton* m_muteBtn; diff --git a/tools/chatgui/transport/gui_bridge.h b/tools/chatgui/transport/gui_bridge.h index 309503d5..cd000219 100644 --- a/tools/chatgui/transport/gui_bridge.h +++ b/tools/chatgui/transport/gui_bridge.h @@ -201,6 +201,7 @@ void gui_bridge_set_call_incoming_cb(gui_call_incoming_fn cb); /* Callback для звонкового события с call_id (ringing/accepted) */ typedef void (*gui_call_id_fn)(uint64_t call_id); void gui_bridge_set_call_ringing_cb(gui_call_id_fn cb); +void gui_bridge_set_call_phone_busy_cb(gui_call_id_fn cb); void gui_bridge_set_call_accepted_cb(gui_call_id_fn cb); /* Callback для завершения/отклонения звонка (вызывается из GUI-потока) */ diff --git a/tools/chatgui/transport/gui_bridge_impl.cpp b/tools/chatgui/transport/gui_bridge_impl.cpp index fac34be9..a6717d3a 100644 --- a/tools/chatgui/transport/gui_bridge_impl.cpp +++ b/tools/chatgui/transport/gui_bridge_impl.cpp @@ -58,6 +58,7 @@ static gui_local_event_fn g_local_invite_cb = nullptr; static gui_local_event_fn g_local_delivery_cb = nullptr; static gui_call_incoming_fn g_call_incoming_cb = nullptr; static gui_call_id_fn g_call_ringing_cb = nullptr; +static gui_call_id_fn g_call_phone_busy_cb = nullptr; static gui_call_id_fn g_call_accepted_cb = nullptr; static gui_call_ended_fn g_call_ended_cb = nullptr; static gui_call_ended_fn g_call_declined_cb = nullptr; @@ -375,6 +376,12 @@ void GuiBridgeReceiver::processPost(int eventType, QByteArray data) { if (g_call_ringing_cb) g_call_ringing_cb(callId); } break; + case CHAT_EVT_CALL_PHONE_BUSY: + if (dlen == 9) { + uint64_t callId; memcpy(&callId, d, 8); + if (g_call_phone_busy_cb) g_call_phone_busy_cb(callId); + } else DEBUG_WARN(DEBUG_CATEGORY_CALL, "gui_bridge: invalid PHONE_BUSY bytes=%d", dlen); + break; case GUI_EVT_CALL_ACCEPTED: if (dlen >= 8) { uint64_t callId; memcpy(&callId, d, 8); @@ -604,6 +611,7 @@ void gui_bridge_set_call_incoming_cb(gui_call_incoming_fn cb) { void gui_bridge_set_call_ringing_cb(gui_call_id_fn cb) { g_call_ringing_cb = cb; } +void gui_bridge_set_call_phone_busy_cb(gui_call_id_fn cb) { g_call_phone_busy_cb = cb; } void gui_bridge_set_call_accepted_cb(gui_call_id_fn cb) { g_call_accepted_cb = cb;