Commit e975618a73e242f0ab6e8379b1df1e53f205f353

Authored by Hu Chunming
1 parent 6958b5be

1.初始化 添加是否鉴权模式的日志

2.增加对200 类型的处理
bin/sip_server_cfg.xml
@@ -3,10 +3,10 @@ @@ -3,10 +3,10 @@
3 <Ua>SY_Sip_Server</Ua> 3 <Ua>SY_Sip_Server</Ua>
4 <Nonce>12345678</Nonce> 4 <Nonce>12345678</Nonce>
5 <Ip>192.168.60.179</Ip> 5 <Ip>192.168.60.179</Ip>
6 - <Port>15060</Port> 6 + <Port>5060</Port>
7 <SipId>34020000002000000002</SipId> 7 <SipId>34020000002000000002</SipId>
8 <SipRealm>3402000000</SipRealm> 8 <SipRealm>3402000000</SipRealm>
9 - <Password>sy123456</Password> 9 + <Password></Password>
10 <Timeout>1800</Timeout> 10 <Timeout>1800</Timeout>
11 <Expiry>3600</Expiry> 11 <Expiry>3600</Expiry>
12 <WsPort>9006</WsPort> 12 <WsPort>9006</WsPort>
sip/SipServer.cpp
@@ -96,6 +96,12 @@ bool SipServer::Init(ServerInfo* pInfo, WebSocketServer* pServer) { @@ -96,6 +96,12 @@ bool SipServer::Init(ServerInfo* pInfo, WebSocketServer* pServer) {
96 96
97 mInfo = *pInfo; 97 mInfo = *pInfo;
98 98
  99 + if (mInfo.isNoAuth()) {
  100 + LOG_INFO("do not need password");
  101 + } else {
  102 + LOG_INFO("need password");
  103 + }
  104 +
99 m_pWsServer = pServer; 105 m_pWsServer = pServer;
100 106
101 m_event_loop_thread = new std::thread(event_loop_thread, this); 107 m_event_loop_thread = new std::thread(event_loop_thread, this);
@@ -493,8 +499,9 @@ void SipServer::cacheClient(osip_uri_t *url, int expiry) { @@ -493,8 +499,9 @@ void SipServer::cacheClient(osip_uri_t *url, int expiry) {
493 RequestCatalog(client); 499 RequestCatalog(client);
494 } else if (type >= 131 && type <= 199) { 500 } else if (type >= 131 && type <= 199) {
495 RequestDeviceInfo(client); 501 RequestDeviceInfo(client);
496 - }  
497 - else { 502 + } else if (type >= 200 && type <= 299) {
  503 + RequestCatalog(client);
  504 + } else {
498 LOG_WARN("device type is not supported:{}",type); 505 LOG_WARN("device type is not supported:{}",type);
499 } 506 }
500 507
@@ -574,7 +581,7 @@ void SipServer::response_message(eXosip_event_t *evtp) { @@ -574,7 +581,7 @@ void SipServer::response_message(eXosip_event_t *evtp) {
574 581
575 } else if(!strcmp(CmdType, "Keepalive")){ 582 } else if(!strcmp(CmdType, "Keepalive")){
576 this->response_message_answer(evtp,200); 583 this->response_message_answer(evtp,200);
577 - // LOG_INFO("CmdType={},DeviceID={}", CmdType, DeviceID); 584 + LOG_INFO("CmdType={},DeviceID={}", CmdType, DeviceID);
578 std::lock_guard<std::mutex> l_c(m_client_map_mtx); 585 std::lock_guard<std::mutex> l_c(m_client_map_mtx);
579 auto it = mClientMap.find(DeviceID); 586 auto it = mClientMap.find(DeviceID);
580 if (it != mClientMap.end()) { 587 if (it != mClientMap.end()) {
@@ -873,9 +880,12 @@ void SipServer::cacheCatalog() { @@ -873,9 +880,12 @@ void SipServer::cacheCatalog() {
873 if (type >= 111 && type <= 130) { 880 if (type >= 111 && type <= 130) {
874 // NVR注册成功,立即请求设备目录 881 // NVR注册成功,立即请求设备目录
875 RequestCatalog(client); 882 RequestCatalog(client);
876 - }  
877 - else if (type >= 131 && type <= 199) { 883 + } else if (type >= 131 && type <= 199) {
878 RequestDeviceInfo(client); 884 RequestDeviceInfo(client);
  885 + } else if (type >= 200 && type <= 299) {
  886 + RequestCatalog(client);
  887 + } else {
  888 + LOG_WARN("device type is not supported:{}",type);
879 } 889 }
880 } 890 }
881 891