diff --git a/trunk/conf/push.gb28181.conf b/trunk/conf/push.gb28181.conf index b76887d98..cb2f848b2 100644 --- a/trunk/conf/push.gb28181.conf +++ b/trunk/conf/push.gb28181.conf @@ -3,7 +3,8 @@ listen 1935; max_connections 1000; daemon off; -pid ./objs/srs28181.pid +pid ./objs/srs28181.pid; +srs_log_file ./objs/srs28181.log; srs_log_tank console; stream_caster { enabled on; @@ -23,7 +24,7 @@ stream_caster { #服务器端编号 #设备端配置编号需要与该值一致,否则无法注册 - serial 34020000002020000001; + serial 34020000002000000001; #服务器端域 realm 3402000000; diff --git a/trunk/src/app/srs_app_gb28181.cpp b/trunk/src/app/srs_app_gb28181.cpp index b4d647ce1..46f7950ff 100644 --- a/trunk/src/app/srs_app_gb28181.cpp +++ b/trunk/src/app/srs_app_gb28181.cpp @@ -571,8 +571,7 @@ srs_error_t SrsGb28181Conn::do_cycle() pprint->elapse(); if ((err = trd->pull()) != srs_success) { - //srs_trace("pull faild %s")); - //return srs_error_wrap(err, "sip cycle"); + return srs_error_wrap(err, "gb28181conn cycle"); } srs_utime_t now = srs_get_system_time(); @@ -616,8 +615,11 @@ srs_error_t SrsGb28181Conn::do_cycle() } 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); + + 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); @@ -1188,12 +1190,11 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port, } srs_assert(conn != NULL); - if (conn->register_status == Srs28181Unkonw) - { - conn->serve(); - }else{ - srs_trace("gb28181: %s client is register", req->sip_auth_id.c_str()); - } + // if (conn->register_status == Srs28181Unkonw) + // { + // }else{ + // srs_trace("gb28181: %s client is register", req->sip_auth_id.c_str()); + // } send_status(req, from, fromlen); 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()) { SrsGb28181Conn* conn = fetch(req); 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; } if (conn->register_status == Srs28181Unkonw) { 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; } @@ -1247,14 +1248,14 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port, if (!conn){ 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; } if (conn->register_status == Srs28181Unkonw || conn->alive_status == Srs28181Unkonw) { 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; } @@ -1274,7 +1275,7 @@ srs_error_t SrsGb28181Caster::on_udp_bytes(string peer_ip, int peer_port, send_status(req, from, fromlen); 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; } diff --git a/trunk/src/protocol/srs_sip_stack.cpp b/trunk/src/protocol/srs_sip_stack.cpp index aed80de1e..e3031fd20 100644 --- a/trunk/src/protocol/srs_sip_stack.cpp +++ b/trunk/src/protocol/srs_sip_stack.cpp @@ -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()); } 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:")) { - srs_trace("sip: message head %s content=%s", phead, content.c_str()); + req->content_type = content; } else if (!strcasecmp(phead, "cseq:")) { std::vector 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:")){ req->user_agent = content; } + else if (!strcasecmp(phead, "max-forwards:")){ + req->max_forwards = strtoul(content.c_str(), NULL, 10); + } else { srs_trace("sip: unkonw message head %s content=%s", phead, content.c_str()); }