ossrs / srs

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

GB28181: UDP SIP, Unable to receive response after registration #3895

Closed anyan131 closed 7 months ago

anyan131 commented 7 months ago

Describe the bug I am using the GB28181 feature of SRS and encountered an issue. I did not receive a response from SRS after my device sent a REGISTER sip message. Please help me identify the problem.

Version 5.0

Expected behavior Hope to register and push audio and video data normally

Screenshots This is the content sent by my device, which I captured using tcpdump

    192.168.1.192.15060 > 192.168.1.160.sip: SIP, length: 506
    REGISTER sip:11010800491310000001@1101080049 SIP/2.0
    Via: SIP/2.0/UDP 192.168.1.192:15060;rport;branch=z9hG4bK65659cb3
    From: <sip:11010800491310000067@1101080049>;tag=28e5f689
    To: <sip:11010800491310000067@1101080049>
    Contact: <sip:11010800491310000067@192.168.1.192:15060>
    Call-ID: 76F2EB766DBD5352@192.168.1.192
    CSeq: 1 REGISTER
    Max-Forwards: 70
    Expires: 3600
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
    User-Agent: EasySIP AGENT 2.0
    Content-Length: 0

15:54:50.085627 IP (tos 0x0, ttl 64, id 22647, offset 0, flags [DF], proto UDP (17), length 534)
    192.168.1.192.15060 > 192.168.1.160.sip: SIP, length: 506
    REGISTER sip:11010800491310000001@1101080049 SIP/2.0
    Via: SIP/2.0/UDP 192.168.1.192:15060;rport;branch=z9hG4bK65659cc8
    From: <sip:11010800491310000067@1101080049>;tag=28e5f689
    To: <sip:11010800491310000067@1101080049>
    Contact: <sip:11010800491310000067@192.168.1.192:15060>
    Call-ID: 76F2EB766DBD5352@192.168.1.192
    CSeq: 2 REGISTER
    Max-Forwards: 70
    Expires: 3600
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
    User-Agent: EasySIP AGENT 2.0
    Content-Length: 0

15:55:21.083289 IP (tos 0x0, ttl 64, id 23275, offset 0, flags [DF], proto UDP (17), length 534)
    192.168.1.192.15060 > 192.168.1.160.sip: SIP, length: 506
    REGISTER sip:11010800491310000001@1101080049 SIP/2.0
    Via: SIP/2.0/UDP 192.168.1.192:15060;rport;branch=z9hG4bK65659ce7
    From: <sip:11010800491310000067@1101080049>;tag=28e5f689
    To: <sip:11010800491310000067@1101080049>
    Contact: <sip:11010800491310000067@192.168.1.192:15060>
    Call-ID: 76F2EB766DBD5352@192.168.1.192
    CSeq: 3 REGISTER
    Max-Forwards: 70
    Expires: 3600
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
    User-Agent: EasySIP AGENT 2.0
    Content-Length: 0

15:55:30.144918 IP (tos 0x0, ttl 64, id 24103, offset 0, flags [DF], proto UDP (17), length 531)
    192.168.1.192.15060 > 192.168.1.160.sip: SIP, length: 503
    REGISTER sip:11010800491310000001@1101080049 SIP/2.0
    Via: SIP/2.0/UDP 192.168.1.192:15060;rport;branch=z9hG4bK65659cf0
    From: <sip:11010800491310000067@1101080049>;tag=28e5f689
    To: <sip:11010800491310000067@1101080049>
    Contact: <sip:11010800491310000067@192.168.1.192:15060>
    Call-ID: 76F2EB766DBD5352@192.168.1.192
    CSeq: 4 REGISTER
    Max-Forwards: 70
    Expires: 0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
    User-Agent: EasySIP AGENT 2.0
    Content-Length: 0

This is my gb28181.conf file

listen 1945;
max_connections 1000;
daemon off;
srs_log_tank console;

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;
    }
}

http_server {
    enabled on;
    listen 8080;
    dir ./objs/nginx/html;
}

http_api {
    enabled on;
    listen 1985;
}
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__ {
    rtc {
        enabled on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp on;
    }
    http_remux {
        enabled on;
        mount [vhost]/[app]/[stream].flv;
    }
    hls {
        enabled on;
    }
}

Additional context Add any other context about the problem here.

thank you very much indeed

winlinvip commented 7 months ago

Please post the complete SRS log; without the log, troubleshooting is not possible.

TRANS_BY_GPT4

winlinvip commented 7 months ago

Please describe the steps to reproduce the issue, detailing the actions taken that lead to the problem occurring.

TRANS_BY_GPT4

anyan131 commented 7 months ago

I may have identified the issue; I captured packets using Wireshark and noticed that the problem lies with the SDK I'm using to send SIP protocol messages. It's using UDP instead of TCP to send the signaling.

TRANS_BY_GPT4

winlinvip commented 7 months ago

The GB of SRS currently does not support UDP; it only supports TCP. Please refer to the product documentation for details. UDP support is not planned for the future because UDP can experience packet loss in network environments, making it unreliable.

TRANS_BY_GPT4