From 12040639c849a79d76045415ed056a9d3debff04 Mon Sep 17 00:00:00 2001 From: Hu Chunming <2657262686@qq.com> Date: Fri, 28 Jun 2024 16:20:26 +0800 Subject: [PATCH] 未注册但是发保活信息的设备,令其重新注册 --- sip/SipServer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sip/SipServer.cpp b/sip/SipServer.cpp index 663d850..7442d91 100644 --- a/sip/SipServer.cpp +++ b/sip/SipServer.cpp @@ -555,7 +555,7 @@ void SipServer::response_message(eXosip_event_t *evtp) { return; } - // std::cout << CmdType << std::endl; + LOG_INFO("CmdType={},DeviceID={}", CmdType, DeviceID); if(!strcmp(CmdType, "Catalog")) { this->response_message_answer(evtp,200); @@ -580,13 +580,15 @@ void SipServer::response_message(eXosip_event_t *evtp) { m_device_map[info.id] = info; } else if(!strcmp(CmdType, "Keepalive")){ - this->response_message_answer(evtp,200); - LOG_INFO("CmdType={},DeviceID={}", CmdType, DeviceID); std::lock_guard l_c(m_client_map_mtx); auto it = mClientMap.find(DeviceID); if (it != mClientMap.end()) { + response_message_answer(evtp,200); it->second->updateHeartBeat(Utools::get_cur_time_ms()); return ; + } else { + // 未注册设备发保活信息,超过设备的最大超时次数后,设备将进行初始注册 + response_message_answer(evtp,408); } }else{ this->response_message_answer(evtp,200); -- libgit2 0.21.4