Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GB: The camera's SIP-related information has been configured, but it cannot go online properly. #3300

Closed
hlmyq opened this issue Dec 12, 2022 · 6 comments · Fixed by #3315
Closed
Assignees
Labels
GB28181 For GB28181. TransByAI Translated by AI/GPT.
Milestone

Comments

@hlmyq
Copy link

hlmyq commented Dec 12, 2022

Description
Set up a server on the national standard camera.
image

Default SIP server ID:
34020000002000000001
SIP domain:
3402000000
Camera number:
34020000001320000001

Please describe your issue here:
I have configured the camera's SIP-related information, but it is unable to come online properly. What is the default password for SIP signaling access, and does it have any relation to the signaling password?

  1. SRS Version: xxxxxx
    SRS/5.0.107(Bee)

  2. SRS Log:

  • No packet capture available, but there are some server logs.
[2022-12-12 17:24:57.674][INFO][29882][9675v5sk] http flv live stream, vhost=__defaultVhost__, mount=[vhost]/[app]/[stream].flv
[2022-12-12 17:24:57.674][INFO][29882][9675v5sk] http: root mount to ./objs/nginx/html
[2022-12-12 17:24:57.674][INFO][29882][9675v5sk] server main cid=9675v5sk, pid=29882, ppid=21220, asprocess=0
[2022-12-12 17:24:57.674][INFO][29882][9675v5sk] RTMP listen at tcp://0.0.0.0:1935, fd=9
[2022-12-12 17:24:57.675][INFO][29882][9675v5sk] HTTP-API listen at tcp://0.0.0.0:1985, fd=10
[2022-12-12 17:24:57.675][INFO][29882][9675v5sk] HTTP-Server listen at tcp://0.0.0.0:8080, fd=11
[2022-12-12 17:24:57.675][INFO][29882][9675v5sk] GB-TCP listen at tcp://0.0.0.0:9990, fd=12
[2022-12-12 17:24:57.675][INFO][29882][9675v5sk] SIP-TCP listen at tcp://0.0.0.0:5060, fd=13
[2022-12-12 17:24:57.675][INFO][29882][9675v5sk] signal installed, reload=1, reopen=10, fast_quit=15, grace_quit=3
[2022-12-12 17:24:57.675][INFO][29882][9675v5sk] http: api mount /console to ./objs/nginx/html/console
[2022-12-12 17:24:57.676][INFO][29882][9675v5sk] rtc listen at udp://0.0.0.0:8100, fd=14
[2022-12-12 17:24:57.676][INFO][29882][1019d1j4] Hybrid cpu=0.00%,26MB
[2022-12-12 17:24:57.676][WARN][29882][ov340so8][22] use private address as ip: 192.168.2.252, ifname=eno1
[2022-12-12 17:24:57.676][INFO][29882][ov340so8] Startup query id=vid-2692y89, session=vid-507l8j9, eip=192.168.2.252, wait=300s
[2022-12-12 17:24:57.676][INFO][29882][8749387q] TCP: connection manager run, conns=0
[2022-12-12 17:24:57.677][INFO][29882][lu501uc8] GB: connection manager run, conns=0
[2022-12-12 17:24:57.677][INFO][29882][p4l0gduy] SRT: connection manager run, conns=0
[2022-12-12 17:24:57.678][INFO][29882][8464i990] UDP #14 LISTEN at 0.0.0.0:8100, SO_SNDBUF(default=212992, expect=10485760, actual=425984, r0=0), SO_RCVBUF(default=212992, expect=10485760, actual=425984, r0=0)
    1. SRS Config (Configuration):
- Default configuration, only changed the IP.
listen 1935;
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 192.168.43.xx;
    }
}

  • Replay (重现)

  • Please describe how to replay the bug? (重现Bug的步骤)

  1. xxxxxx
  2. xxxxxx
  3. xxxxxx
  • Expect (Expected Behavior)

  • Expect the camera to come online properly and be able to view images.

TRANS_BY_GPT3

@hlmyq
Copy link
Author

hlmyq commented Dec 13, 2022

Use go test, after starting, SRS exits directly.

./objs/srs_bench -sfu gb28181 -pr tcp://127.0.0.1:5060 -user 3402000000 -random 10   -server 34020000002000000001 -domain 3402000000 -sa avatar.aac   -sv avatar.h264 -fps 25
[trace] 2022/12/13 08:29:11.120818 Run benchmark with , publish(addr=tcp://127.0.0.1:5060,domain=3402000000,user=3402000000,deviceID=34020000001863576785,random=10,server=34020000002000000001,video=avatar.h264,fps=25,audio=avatar.aac)
[trace] 2022/12/13 08:29:11.121095 Send msg REGISTER sip:34020000002000000001@3402000000 SIP/2.0
Via: SIP/2.0/TCP 192.168.3.99:5060;branch=z9hG4bK_1409848158
CSeq: 101 REGISTER
From: <sip:34020000001863576785@3402000000>;tag=4274883343
To: <sip:34020000001863576785@3402000000>
Call-ID: 6127690212479478270
Contact: <sip:34020000001863576785@192.168.3.99:5060>
Max-Forwards: 70
Expires: 3600
User-Agent: GoSIP
Content-Length: 0

[trace] 2022/12/13 08:29:11.121372 Send REGISTER request, Call-ID=6127690212479478270, Expires=3600
[trace] 2022/12/13 08:29:11.121981 Register id=b9fe223d-312d-47ae-9934-268f98d79e43, response=0bea3ca3-8d34-474a-9aa9-ce7431b6201a
[trace] 2022/12/13 08:29:11.422141 Got INVITE request, Call-ID=10hhbrhzn9tym26v
[trace] 2022/12/13 08:29:11.422196 Send msg SIP/2.0 100 Trying
Via: SIP/2.0/TCP 192.168.43.252:5060;rport=5060;branch=z9hG4bKz5zn29;received=127.0.0.1
From: <sip:34020000002000000001@3402000000>;tag=SRS0fgv5qn2
To: <sip:34020000001863576785@3402000000>
Call-ID: 10hhbrhzn9tym26v
CSeq: 748 INVITE
Content-Length: 0

[trace] 2022/12/13 08:29:11.522460 Send msg SIP/2.0 200 OK
Via: SIP/2.0/TCP 192.168.43.252:5060;rport=5060;branch=z9hG4bKz5zn29;received=127.0.0.1
From: <sip:34020000002000000001@3402000000>;tag=SRS0fgv5qn2
To: <sip:34020000001863576785@3402000000>
Call-ID: 10hhbrhzn9tym26v
CSeq: 748 INVITE
Content-Length: 0

[trace] 2022/12/13 08:29:11.522553 Send INVITE response, Call-ID=10hhbrhzn9tym26v
[trace] 2022/12/13 08:29:11.522912 Invite id=d407cd16-e0c0-459b-99f0-d3cb57f3bb68, response=fab1bd9e-e62b-457e-87e4-37882e752a5c, y=0200005019, ssrc=200005019, mediaPort=9990
[trace] 2022/12/13 08:29:11.523030 PS: Media stream, tbn=90000, ssrc=200005019, pt=96, Video(avatar.h264, fps=25, rate=40960), Audio(avatar.aac, rate=44100, channels=Stereo(FL+FR))
[trace] 2022/12/13 08:29:11.523054 Send msg MESSAGE sip:34020000002000000001@3402000000 SIP/2.0
Via: SIP/2.0/TCP 192.168.3.99:5060;branch=z9hG4bK_1409848158, SIP/2.0/TCP 192.168.3.99:5060;branch=z9hG4bK_2120665396
CSeq: 102 MESSAGE
From: <sip:34020000001863576785@3402000000>;tag=2053561068
To: <sip:34020000002000000001@3402000000>
Call-ID: 18279428628258717145
Contact: <sip:34020000001863576785@192.168.3.99:5060>
Max-Forwards: 70
Expires: 3600
User-Agent: GoSIP
Content-Length: 163

<?xml version="1.0" encoding="GB2312"?>
<Notify>
<CmdType>Keepalive</CmdType>
<SN>103</SN>
<DeviceID>34020000001863576785</DeviceID>
<Status>OK</Status>
</Notify>
[trace] 2022/12/13 08:29:11.523109 Send MESSAGE request, Call-ID=18279428628258717145
[error] 2022/12/13 08:29:11.579306 SIP stack err transport.ConnectionError<connection_ptr=0xc0001aa400 source=127.0.0.1:5060 destination=127.0.0.1:38320 network=TCP> read failed: EOF
[trace] 2022/12/13 08:29:11.579317 Notify SIP stack to cancel
[trace] 2022/12/13 08:29:11.616351 Consume Video(samples=4096, dts=9000, ts=100.00) and Audio(samples=5120, dts=10448, ts=116.09)
[trace] 2022/12/13 08:29:11.616388 SIP protocol stack done

SRS log

 Session: Start timeout=60000ms, reinvite=5000ms, candidate=192.168.43.252, pip=192.168.43.252, output=rtmp://127.0.0.1/live/[stream]
[2022-12-13 08:29:11.121][INFO][6821][g2e1c989] SIP: Change device=34020000001863576785, state=Init->Registered
[2022-12-13 08:29:11.421][INFO][6821][g2e1c989] Session: Change device=34020000001863576785, state=Init->Connecting
[2022-12-13 08:29:11.421][INFO][6821][g2e1c989] SIP: Change device=34020000001863576785, state=Registered->Inviting
[2022-12-13 08:29:11.421][INFO][6821][g2e1c989] SIP: INVITE device=sip:34020000001863576785@3402000000, branch=z5zn29, tag=0fgv5qn2, call=10hhbrhzn9tym26v, ssrc=0200005019, sdp is v=0\r\no=34020000001863576785 0 0 IN IP4 192.168.43.252\r\ns=Play\r\nc=IN IP4 192.168.43.252\r\nt=0 0\r\nm=video 9990 TCP/RTP/AVP 96\r\na=recvonly\r\na=rtpmap:96 PS/90000\r\ny=0200005019\r\n
[2022-12-13 08:29:11.422][INFO][6821][g2e1c989] SIP: Change device=34020000001863576785, state=Inviting->Trying
[2022-12-13 08:29:11.522][INFO][6821][g2e1c989] SIP: Change device=34020000001863576785, state=Trying->Stable
[2022-12-13 08:29:11.523][INFO][6821][g2e1c989] PS: Reserved bytes for next loop, pos=12, left=20, total=32, bytes=[00 00 01 ba 44 00 04 46 54 01 09 c3 47 fe ff ff]
=================================================================
==6821==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x631000190800,0x631000190814) and [0x63100019080c, 0x631000190820) overlap
    #0 0x7f4cb027dffe  (/lib64/libasan.so.5+0x99ffe)
    #1 0x65e714 in SrsBuffer::read_bytes(char*, int) src/kernel/srs_kernel_buffer.cpp:238
    #2 0xc03c14 in SrsLazyGbMediaTcpConn::do_cycle() src/app/srs_app_gb28181.cpp:1448
    #3 0xc020d0 in SrsLazyGbMediaTcpConn::cycle() src/app/srs_app_gb28181.cpp:1316
    #4 0x8ef256 in SrsFastCoroutine::cycle() src/app/srs_app_st.cpp:285
    #5 0x8ef343 in SrsFastCoroutine::pfn(void*) src/app/srs_app_st.cpp:300
    #6 0xc21b69 in _st_thread_main /home/tmp/srs/trunk/objs/Platform-Linux-3.10.0-GCC9.3.1-SRS5-x86_64/st-srs/sched.c:380
    #7 0xc22463 in st_thread_create /home/tmp/srs/trunk/objs/Platform-Linux-3.10.0-GCC9.3.1-SRS5-x86_64/st-srs/sched.c:666
    #8 0x7f4caa919647  (<unknown module>)

0x631000190800 is located 0 bytes inside of 65535-byte region [0x631000190800,0x6310001a07ff)
allocated by thread T1 (srs-hybrid-2) here:
    #0 0x7f4cb02f256f in operator new[](unsigned long) (/lib64/libasan.so.5+0x10e56f)

Thread T1 (srs-hybrid-2) created by T0 here:
    #0 0x7f4cb021e471 in pthread_create (/lib64/libasan.so.5+0x3a471)
    #1 0xad1ff6 in SrsThreadPool::execute(std::string, SrsCplxError* (*)(void*), void*) src/app/srs_app_threads.cpp:676
    #2 0xc205f7 in run_in_thread_pool() src/main/srs_main_server.cpp:512
    #3 0xc200f2 in run_directly_or_daemon() src/main/srs_main_server.cpp:451
    #4 0xc1da25 in do_main(int, char**, char**) src/main/srs_main_server.cpp:240
    #5 0xc1dcd2 in main src/main/srs_main_server.cpp:251
    #6 0x7f4caeff0554 in __libc_start_main (/lib64/libc.so.6+0x22554)

0x63100019080c is located 12 bytes inside of 65535-byte region [0x631000190800,0x6310001a07ff)
allocated by thread T1 (srs-hybrid-2) here:
    #0 0x7f4cb02f256f in operator new[](unsigned long) (/lib64/libasan.so.5+0x10e56f)

SUMMARY: AddressSanitizer: memcpy-param-overlap (/lib64/libasan.so.5+0x99ffe) 
[2022-12-13 08:29:11.555][INFO][6821][g2e1c989] =================================================================
==6821==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x631000190800,0x631000190814) and [0x63100019080c, 0x631000190820) overlap
    #0 0x7f4cb027dffe  (/lib64/libasan.so.5+0x99ffe)
    #1 0x65e714 in SrsBuffer::read_bytes(char*, int) src/kernel/srs_kernel_buffer.cpp:238
    #2 0xc03c14 in SrsLazyGbMediaTcpConn::do_cycle() src/app/srs_app_gb28181.cpp:1448
    #3 0xc020d0 in SrsLazyGbMediaTcpConn::cycle() src/app/srs_app_gb28181.cpp:1316
    #4 0x8ef256 in SrsFastCoroutine::cycle() src/app/srs_app_st.cpp:285
    #5 0x8ef343 in SrsFastCoroutine::pfn(void*) src/app/srs_app_st.cpp:300
    #6 0xc21b69 in _st_thread_main /home/tmp/srs/trunk/objs/Platform-Linux-3.10.0-GCC9.3.1-SRS5-x86_64/st-srs/sched.c:380
    #7 0xc22463 in st_thread_create /home/tmp/srs/trunk/objs/Platform-Linux-3.10.0-GCC9.3.1-SRS5-x86_64/st-srs/sched.c:666
    #8 0x7f4caa919647  (<unknown module>)

0x631000190800 is located 0 bytes inside of 65535-byte region [0x631000190800,0x6310001a07ff)
allocated by thread T1 (srs-hybrid-2) here:
    #0 0x7f4cb02f256f in operator new[](unsigned long) (/lib64/libasan.so.5+0x10e56f)

Thread T1 (srs-hybrid-2) created by T0 here:
    #0 0x7f4cb021e471 in pthread_create (/lib64/libasan.so.5+0x3a471)
    #1 0xad1ff6 in SrsThreadPool::execute(std::string, SrsCplxError* (*)(void*), void*) src/app/srs_app_threads.cpp:676
    #2 0xc205f7 in run_in_thread_pool() src/main/srs_main_server.cpp:512
    #3 0xc200f2 in run_directly_or_daemon() src/main/srs_main_server.cpp:451
    #4 0xc1da25 in do_main(int, char**, char**) src/main/srs_main_server.cpp:240
    #5 0xc1dcd2 in main src/main/srs_main_server.cpp:251
    #6 0x7f4caeff0554 in __libc_start_main (/lib64/libc.so.6+0x22554)

0x63100019080c is located 12 bytes inside of 65535-byte region [0x631000190800,0x6310001a07ff)
allocated by thread T1 (srs-hybrid-2) here:
    #0 0x7f4cb02f256f in operator new[](unsigned long) (/lib64/libasan.so.5+0x10e56f)

SUMMARY: AddressSanitizer: memcpy-param-overlap (/lib64/libasan.so.5+0x99ffe) 

TRANS_BY_GPT3

@duiniuluantanqin
Copy link
Member

duiniuluantanqin commented Dec 14, 2022

The SIP server ID can currently be ignored. You should try switching to the gb-2016 version, as the 2011 version is currently not supported.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title srs5.0 gb28181 sip服务器id现在在哪里定义呢? GB: 配置了摄像头sip相关信息,无法正常上线 Dec 15, 2022
@winlinvip winlinvip self-assigned this Dec 15, 2022
@winlinvip winlinvip added the GB28181 For GB28181. label Dec 15, 2022
@winlinvip winlinvip added this to the 5.0 milestone Dec 15, 2022
@winlinvip
Copy link
Member

winlinvip commented Dec 15, 2022

srs-bench will cause SRS to crash because the packet is too small, and when reserved overlaps, memcpy cannot be used, memmove should be used instead.

srs_error_t SrsLazyGbMediaTcpConn::do_cycle() {
    uint32_t reserved = 0;
    for (;;) {
        uint16_t length = 0; // If it's 30
        if ((err = conn_->read_fully(buffer_ + reserved, length, NULL)) != srs_success) {

        reserved = b.left(); // If it's 20
        if (reserved) {
            b.read_bytes((char*)buffer_, reserved); // Crash here.
            pack_->media_reserved_++;
        }

When this situation occurs, b.read_bytes is actually memcpy, which copies the last 20 bytes of b (30 bytes) to the beginning, resulting in an overlap. It is equivalent to the following situation:

int length = 30;
char buffer[length];

char* p = buffer + 10;
int reserved = 20;
memcpy(buffer, p, reserved);

Solution: Changing it to memmove will solve the problem and support overlap.

Once again, thanks to @chen-guanghua for introducing the asan tool, which helped uncover many potential issues.

TRANS_BY_GPT3

@winlinvip winlinvip linked a pull request Dec 15, 2022 that will close this issue
@winlinvip
Copy link
Member

winlinvip commented Dec 15, 2022

@hlmyq What system is your SRS server running on? Ubuntu20? Or CentOS7? Did you compile SRS yourself?

TRANS_BY_GPT3

@hlmyq
Copy link
Author

hlmyq commented Dec 19, 2022 via email

@hlmyq
Copy link
Author

hlmyq commented Dec 19, 2022 via email

@winlinvip winlinvip changed the title GB: 配置了摄像头sip相关信息,无法正常上线 GB: The camera's SIP-related information has been configured, but it cannot go online properly. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GB28181 For GB28181. TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants