1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix push.gb28181.conf, gb28181conn repeat call serve()

This commit is contained in:
xialixin 2020-03-20 10:38:38 +08:00
parent cbe9c1dabc
commit 8b4f84e336
3 changed files with 23 additions and 18 deletions

View file

@ -3,7 +3,8 @@
listen 1935; listen 1935;
max_connections 1000; max_connections 1000;
daemon off; daemon off;
pid ./objs/srs28181.pid pid ./objs/srs28181.pid;
srs_log_file ./objs/srs28181.log;
srs_log_tank console; srs_log_tank console;
stream_caster { stream_caster {
enabled on; enabled on;
@ -23,7 +24,7 @@ stream_caster {
#服务器端编号 #服务器端编号
#设备端配置编号需要与该值一致,否则无法注册 #设备端配置编号需要与该值一致,否则无法注册
serial 34020000002020000001; serial 34020000002000000001;
#服务器端域 #服务器端域
realm 3402000000; realm 3402000000;

View file

@ -571,8 +571,7 @@ srs_error_t SrsGb28181Conn::do_cycle()
pprint->elapse(); pprint->elapse();
if ((err = trd->pull()) != srs_success) { if ((err = trd->pull()) != srs_success) {
//srs_trace("pull faild %s")); return srs_error_wrap(err, "gb28181conn cycle");
//return srs_error_wrap(err, "sip cycle");
} }
srs_utime_t now = srs_get_system_time(); srs_utime_t now = srs_get_system_time();
@ -616,8 +615,11 @@ srs_error_t SrsGb28181Conn::do_cycle()
} }
if (pprint->can_print()) { if (pprint->can_print()) {
srs_trace("gb28181: client id=%s, status, druation reg=%u alive=%u invite=%u", srs_trace("gb28181: client id=%s, druation reg=%u alive=%u invite=%u",
session_id.c_str(), reg_duration, alive_duration, invite_duration); session_id.c_str(), reg_duration, alive_duration, invite_duration);
srs_trace("gb28181: client id=%s, status reg_status=%u alive_status=%u invite_status=%u",
session_id.c_str(), register_status, alive_status, invite_status);
} }
srs_usleep(1000 * 1000); srs_usleep(1000 * 1000);
@ -1188,12 +1190,11 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port,
} }
srs_assert(conn != NULL); srs_assert(conn != NULL);
if (conn->register_status == Srs28181Unkonw) // if (conn->register_status == Srs28181Unkonw)
{ // {
conn->serve(); // }else{
}else{ // srs_trace("gb28181: %s client is register", req->sip_auth_id.c_str());
srs_trace("gb28181: %s client is register", req->sip_auth_id.c_str()); // }
}
send_status(req, from, fromlen); send_status(req, from, fromlen);
conn->register_status = Srs28181RegisterOk; conn->register_status = Srs28181RegisterOk;
@ -1204,13 +1205,13 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port,
}else if (req->is_message()) { }else if (req->is_message()) {
SrsGb28181Conn* conn = fetch(req); SrsGb28181Conn* conn = fetch(req);
if (!conn){ if (!conn){
srs_trace("gb28181: %s client not found", req->sip_auth_id.c_str()); srs_trace("gb28181: %s client not registered", req->sip_auth_id.c_str());
return srs_success; return srs_success;
} }
if (conn->register_status == Srs28181Unkonw) { if (conn->register_status == Srs28181Unkonw) {
send_bye(req, from, fromlen); send_bye(req, from, fromlen);
srs_trace("gb28181: %s client not register", req->sip_auth_id.c_str()); srs_trace("gb28181: %s client not registered", req->sip_auth_id.c_str());
return srs_success; return srs_success;
} }
@ -1247,14 +1248,14 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port,
if (!conn){ if (!conn){
send_bye(req, from, fromlen); send_bye(req, from, fromlen);
srs_trace("gb28181: %s client not found", req->sip_auth_id.c_str()); srs_trace("gb28181: %s client not registered", req->sip_auth_id.c_str());
return srs_success; return srs_success;
} }
if (conn->register_status == Srs28181Unkonw || if (conn->register_status == Srs28181Unkonw ||
conn->alive_status == Srs28181Unkonw) { conn->alive_status == Srs28181Unkonw) {
send_bye(req, from, fromlen); send_bye(req, from, fromlen);
srs_trace("gb28181: %s client not register or alive", req->sip_auth_id.c_str()); srs_trace("gb28181: %s client not registered or not alive", req->sip_auth_id.c_str());
return srs_success; return srs_success;
} }
@ -1274,7 +1275,7 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port,
send_status(req, from, fromlen); send_status(req, from, fromlen);
if (!conn){ if (!conn){
srs_trace("gb28181: %s client not found", req->sip_auth_id.c_str()); srs_trace("gb28181: %s client not registered", req->sip_auth_id.c_str());
return srs_success; return srs_success;
} }

View file

@ -297,10 +297,10 @@ srs_error_t SrsSipStack::do_parse_request(SrsSipRequest* req, const char* recv_m
srs_trace("sip: message head %s content=%s", phead, content.c_str()); srs_trace("sip: message head %s content=%s", phead, content.c_str());
} }
else if (!strcasecmp(phead, "content-length:")) { else if (!strcasecmp(phead, "content-length:")) {
srs_trace("sip: message head %s content=%s", phead, content.c_str()); req->content_length = strtoul(content.c_str(), NULL, 10);
} }
else if (!strcasecmp(phead, "content-type:")) { else if (!strcasecmp(phead, "content-type:")) {
srs_trace("sip: message head %s content=%s", phead, content.c_str()); req->content_type = content;
} }
else if (!strcasecmp(phead, "cseq:")) { else if (!strcasecmp(phead, "cseq:")) {
std::vector<std::string> vec_seq = srs_string_split(content, " "); std::vector<std::string> vec_seq = srs_string_split(content, " ");
@ -331,6 +331,9 @@ srs_error_t SrsSipStack::do_parse_request(SrsSipRequest* req, const char* recv_m
else if (!strcasecmp(phead, "user-agent:")){ else if (!strcasecmp(phead, "user-agent:")){
req->user_agent = content; req->user_agent = content;
} }
else if (!strcasecmp(phead, "max-forwards:")){
req->max_forwards = strtoul(content.c_str(), NULL, 10);
}
else { else {
srs_trace("sip: unkonw message head %s content=%s", phead, content.c_str()); srs_trace("sip: unkonw message head %s content=%s", phead, content.c_str());
} }