ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.47k stars 5.35k forks source link

GB28181: Does not support Registersip:SIP server encoding@ip address port SIP/2.0 registration method. #3549

Open Bigflyingcrab opened 1 year ago

Bigflyingcrab commented 1 year ago

Note: Please read FAQ before file an issue, see #2716

Description

Please description your issue here

  1. SRS Version: 6.0

  2. SRS Log:

2023-05-23 11:03:19.371][INFO][805727][3f7nssn4] SIP: Change device=34020000001320000001, state=Init->Bye
[2023-05-23 11:03:19.672][INFO][805727][3f7nssn4] GB: before dispose resource(GBS)(0x7f89640fcd20), conns=14, zombies=0, ign=0, inz=0, ind=0
[2023-05-23 11:03:19.672][INFO][805727][3f7nssn4] client finished.
[2023-05-23 11:03:19.672][ERROR][805727][3f7nssn4][4] SIP: Receive err code=1007(SocketRead)(Socket read data failed) : parse message : parse message : grow buffer : read bytes : read
thread [805727][3f7nssn4]: do_cycle() [./src/app/srs_app_gb28181.cpp:1077][errno=4]
thread [805727][3f7nssn4]: parse_message() [./src/protocol/srs_protocol_http_conn.cpp:103][errno=4]
thread [805727][3f7nssn4]: parse_message_imp() [./src/protocol/srs_protocol_http_conn.cpp:153][errno=4]
thread [805727][3f7nssn4]: grow() [./src/protocol/srs_protocol_stream.cpp:162][errno=4]
thread [805727][3f7nssn4]: read() [./src/protocol/srs_protocol_st.cpp:566][errno=4](Interrupted system call)
[2023-05-23 11:03:19.672][ERROR][805727][3f7nssn4][4] SIP: Send err code=1070(StThreadInterrupt)(ST thread is interrupted) : pull : interrupted
thread [805727][3f7nssn4]: do_cycle() [./src/app/srs_app_gb28181.cpp:1162][errno=4]
thread [805727][3f7nssn4]: interrupt() [./src/app/srs_app_st.cpp:257][errno=11](Interrupted system call)
[2023-05-23 11:03:19.672][INFO][805727][3f7nssn4] GB: before dispose resource(GB-SIP-TCP)(0x7f89641070e0), conns=14, zombies=1, ign=0, inz=0, ind=0
[2023-05-23 11:03:19.672][ERROR][805727][3f7nssn4][4] serve error code=1070(StThreadInterrupt)(ST thread is interrupted) : pull : interrupted
thread [805727][3f7nssn4]: do_cycle() [./src/app/srs_app_gb28181.cpp:951][errno=4]
thread [805727][3f7nssn4]: interrupt() [./src/app/srs_app_st.cpp:257][errno=11](Interrupted system call)
[2023-05-23 11:03:19.672][INFO][805727][9bgf922e] GB: clear zombies=2 resources, conns=14, removing=0, unsubs=0
[2023-05-23 11:03:19.672][INFO][805727][3f7nssn4] GB: disposing #0 resource(GBS)(0x7f89640fcd20), conns=14, disposing=2, zombies=0
[2023-05-23 11:03:19.672][INFO][805727][3f7nssn4] GB: disposing #1 resource(GB-SIP-TCP)(0x7f89641070e0), conns=13, disposing=2, zombies=0
  1. SRS Config:
# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
srs_log_tank        console;
#srs_log_file        ./objs/srs.log;
daemon              off;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
stream_caster {
    enabled on;
    caster gb28181;
    output rtmp://127.0.0.1/live/[stream];
    listen 9000;
    sip {
        enabled on;
        listen 5060;
        # @see https://ossrs.net/lts/zh-cn/docs/v5/doc/gb28181#config-candidate
        candidate $CANDIDATE;
    }
}
stats {
    network 0;
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    candidate $CANDIDATE;
}
vhost __defaultVhost__ {
    hls {
        enabled         off;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc off;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp off;
    }

    play{
        gop_cache_max_frames 2500;
    }
}

Replay

Please describe how to replay the bug?

Step 1: The device cannot be successfully registered to SRS.

According to the explanation in section J.1.1 of the national standard GB28181 2016 protocol, the data header requested during registration should be: "Registersip:SIP server code@destination domain name or IP address port SIP/2.0". However, currently SRS 6.0 only supports the format: "Registersip:SIP server code@destination domain name SIP/2.0". If the device connects to SRS using the format "Registersip:SIP server code@IP address port SIP/2.0", an error will occur.

Expect

We hope to add the registration method "Registersip:SIP server code@IP address port SIP/2.0" to improve the compatibility of SRS with GB28181.

TRANS_BY_GPT3

winlinvip commented 1 year ago

Need to confirm if it is really caused by this formatting issue. I didn't see any error logs indicating this reason. I remember that the address problem with Register would print error logs.

TRANS_BY_GPT3

Bigflyingcrab commented 1 year ago

Indeed, that is the reason. I captured the entire request process and extracted the data from the client accessing SRS. Then, I conducted a simple socket test. After changing the address port of @.*** to the SIP server encoding @ domain name format, I was able to successfully connect to SRS.

                ***@***.***

---- Original Email Reply ----

---- Sender ----

        ***@***.***>

---- Date Sent ----

---- June 10, 2023 19:23 ----

---- Recipient ----

        ***@***.***>

---- CC (Carbon Copy) ----

        ***@***.***>
        ,

        ***@***.***>

---- Subject ----

---- Re: [ossrs/srs] GB28181: Does not support @.*** address port SIP/2.0 registration method. (Issue #3549) ----


It needs to be confirmed whether it is really the format issue that caused this. I didn't see any error logs indicating this reason. I remember that there would be error logs printed for Register address issues.

—Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread. Message ID: @.***

TRANS_BY_GPT3

geiliwanghaichao commented 1 year ago

@winlinvip I also encountered the same problem. May I ask when will this issue be fixed?

TRANS_BY_GPT3

winlinvip commented 6 months ago

Do not ask me or anyone else when to fix this issue, ask yourself because it's an open source project.