Commit e975618a73e242f0ab6e8379b1df1e53f205f353
1 parent
6958b5be
1.初始化 添加是否鉴权模式的日志
2.增加对200 类型的处理
Showing
2 changed files
with
17 additions
and
7 deletions
bin/sip_server_cfg.xml
... | ... | @@ -3,10 +3,10 @@ |
3 | 3 | <Ua>SY_Sip_Server</Ua> |
4 | 4 | <Nonce>12345678</Nonce> |
5 | 5 | <Ip>192.168.60.179</Ip> |
6 | - <Port>15060</Port> | |
6 | + <Port>5060</Port> | |
7 | 7 | <SipId>34020000002000000002</SipId> |
8 | 8 | <SipRealm>3402000000</SipRealm> |
9 | - <Password>sy123456</Password> | |
9 | + <Password></Password> | |
10 | 10 | <Timeout>1800</Timeout> |
11 | 11 | <Expiry>3600</Expiry> |
12 | 12 | <WsPort>9006</WsPort> | ... | ... |
sip/SipServer.cpp
... | ... | @@ -96,6 +96,12 @@ bool SipServer::Init(ServerInfo* pInfo, WebSocketServer* pServer) { |
96 | 96 | |
97 | 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 | 105 | m_pWsServer = pServer; |
100 | 106 | |
101 | 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 | 499 | RequestCatalog(client); |
494 | 500 | } else if (type >= 131 && type <= 199) { |
495 | 501 | RequestDeviceInfo(client); |
496 | - } | |
497 | - else { | |
502 | + } else if (type >= 200 && type <= 299) { | |
503 | + RequestCatalog(client); | |
504 | + } else { | |
498 | 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 | 581 | |
575 | 582 | } else if(!strcmp(CmdType, "Keepalive")){ |
576 | 583 | this->response_message_answer(evtp,200); |
577 | - // LOG_INFO("CmdType={},DeviceID={}", CmdType, DeviceID); | |
584 | + LOG_INFO("CmdType={},DeviceID={}", CmdType, DeviceID); | |
578 | 585 | std::lock_guard<std::mutex> l_c(m_client_map_mtx); |
579 | 586 | auto it = mClientMap.find(DeviceID); |
580 | 587 | if (it != mClientMap.end()) { |
... | ... | @@ -873,9 +880,12 @@ void SipServer::cacheCatalog() { |
873 | 880 | if (type >= 111 && type <= 130) { |
874 | 881 | // NVR注册成功,立即请求设备目录 |
875 | 882 | RequestCatalog(client); |
876 | - } | |
877 | - else if (type >= 131 && type <= 199) { | |
883 | + } else if (type >= 131 && type <= 199) { | |
878 | 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 | ... | ... |