National standard 28181 intercom implementation

National standard 28181 intercom implementation

I. Introduction

First of all, the implementation of the national standard 28181 intercom is an extension of the wvp project. The push is implemented with the help of zlmediakit, so I would like to thank the two authors for the open source project. The github addresses of the two projects are posted below. This is the current implementation of The national standard 28181 protocol implements the best open source projects.

WVP-PRO github address

zlmediakit github address

My public network deployment address https://www.gbslink.top

Contact the author to ask for account password and source code:

v:17686791164 (same phone number)

qq:252657030

  • The effect is as follows

2. Deployment

Deployment reference wvp-pro-talk deployment

3. About public network intercom

During recent exchanges with some companies, we found that there is a demand for intercom on the public network. However, the 2016 national standard does not mandate that equipment must support intercom on the public network. Therefore, mainstream domestic manufacturers, such as Hikvision, Most devices actually do not support public network intercom, because their intercom data transmission mode only supports rtp/udp, and rtp/udp data packets cannot be transmitted across network segments. If used in a LAN, it will not affect the national standard intercom function. Yes, if this function is not available on the public network (if it is a newly purchased device in the past two years, you can contact the manufacturer through the Hikvision WeChat official account to see if there is an upgrade package for the corresponding model, so that the device can support the public network) Network intercom, PS: Why do I say this? Because I tried it myself, and I really got the upgrade package. After the upgrade, Hikvision’s equipment supports public network intercom. The upgraded voice data transmission mode is intercom sip signaling. After the negotiation is completed, the device side actively initiates the TCP link, and the platform side is TCP passive, so that you can talk back because a long link is established)

Dahua: Regarding the intercom of Dahua public network equipment, it is recommended to use Dahua TALK mode. This function is supported on the platform side. The intercom signaling mode will be automatically selected according to the manufacturer name. Dahua’s TALK mode is an extension of Dahua itself. For the national standard protocol, invite is actively initiated by the platform side. In addition, some Dahua devices can modify the data transmission mode by configuring the access module identification code, and can also support standard national standard intercom signaling, as follows: the first bit is changed to 4

Dahua identification code

4. Standard national standard intercom signaling

  • flow chart

Intercom process

  • Specific signaling description

    #广播通知 BroadCast
    #平台侧------->设备侧
    
    MESSAGE sip:34020000001110000001@3402000000 SIP/2.0
    From: <sip:34020000002000000001@3402000000>;tag=bccedfd000006
    To: <sip:34020000001110000001@3402000000>
    Content-Length: 176
    CSeq: 5 MESSAGE
    Route: <sip:34020000001110000001>
    Call-ID: 12345678900006
    Via: SIP/2.0/UDP 192.168.1.101:5060;wlsscid=377aa9afcf1b36f;branch=123133532300006
    Content-Type: Application/MANSCDP+xml
    Max-Forwards: 70
    
    <?xml version="1.0"?>
    <Notify>
    <CmdType>Broadcast</CmdType>
    <SN>17298</SN>
    <!--语音输入设备的设备编码-->
    <SourceID>34020000002000000001</SourceID>
    <!--语音输出设备的设备编码-->
    <TargetID>34020000001370000001</TargetID>
    </Notify>
    
    
    #设备测收到广播通知回复200 ok
    #设备测------>平台侧
    
    SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.1.101:5060;wlsscid=377aa9afcf1b36f;branch=123133532300006
    From: <sip:34020000002000000001@3402000000>;tag=bccedfd000006
    To: <sip:34020000001110000001@3402000000>;tag=880670885
    Call-ID: 12345678900006
    CSeq: 5 MESSAGE
    User-Agent: IP Camera
    Content-Length: 0
    
    
    #设备测主动发起invite
    #设备测------>平台侧
    
    INVITE sip:[email protected]:5060 SIP/2.0
    Via: SIP/2.0/UDP 192.168.1.64:5060;rport;branch=z9hG4bK1490643408
    From: <sip:[email protected]:5060>;tag=1499847265		//
    To: <sip:[email protected]:5060>
    Call-ID: 1420309512
    CSeq: 20 INVITE
    Contact: <sip:[email protected]:5060>
    Content-Type: application/sdp
    Max-Forwards: 70
    User-Agent: IP Camera
    # 媒体流发送者ID:发送方媒体流序列号,媒体流接收者ID:接收方媒体流序列号 
    Subject: 34020000002000000001:1,34020000001110000001:2		
    Content-Length:   214
    
    v=0
    o=34020000001110000001 2418 2418 IN IP4 192.168.1.64
    s=Play
    c=IN IP4 192.168.1.64
    t=0 0
    # 音频 端口  RTP-over-UDP 负载类型( 8-PCMA, 96-PS) 
    # 注意 这一步就是设备侧开的收语音流数据的端口
    # RTP/AVP传输模式是udp,这种只能在局域网对讲
    # TCP/RTP/AVP 这种才可以在公网对讲
    m=audio 15062 RTP/AVP 8 96		
    a=recvonly
    # RTP + 音频流: 负载类型 
    a=rtpmap:8 PCMA/8000			
    a=rtpmap:96 PS/90000
    # SSRC(同步信源标识符): SSRC值由媒体流发送设备所在的SIP监控域产生,作为媒体流的标识使用 
    y=0200000017	
    # v/编码格式/分辨率/帧率/码率类型/码率大小  a/编码格式/码率大小/采样率   
    #   								  G.711 / 64kbps / 8kHz
    f=v/a/1/8/1					
    
#平台侧回复invite ok
#平台侧------->设备侧
》》》》》》 IPC
SIP/2.0 200 OK
From: <sip:[email protected]:5060>;tag=1499847265
To: <sip:[email protected]:5060>;tag=1420309512
Call-ID: 1420309512
CSeq: 20 INVITE
User-Agent: General SIP UAS V1.0
Via: SIP/2.0/UDP 192.168.1.64:5060;rport;branch=z9hG4bK1490643408
Contact: <sip:[email protected]:5060>
Content-Type: application/SDP
Content-Length: 182

v=0
o=34020000002000000001 0 0 IN IP4 192.168.1.101
s=Play
c=IN IP4 192.168.1.101
t=0 0
# 这是我们平台侧开的端口,使用这个端口发送音频数据到设备
m=audio 8000 RTP/AVP 8		//  端口:8000
a=rtpmap:8 PCMA/8000		//rtpmap:8 PCMA及g711a  采样率:8000HZ
a=sendonly
y=0200000017
#设备测------>平台侧
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.64:5060;rport;branch=z9hG4bK106578989
From: <sip:[email protected]:5060>;tag=1499847265
To: <sip:[email protected]:5060>;tag=1420309512
Call-ID: 1420309512
CSeq: 20 ACK
Contact: <sip:[email protected]:5060>
Max-Forwards: 70
User-Agent: IP Camera
Content-Length: 0

#这一步过后我们就可以发送音频数据了
  • Turn off intercom
# 发送BYE信令
BYE sip:34020000001370000001@3402000000 SIP/2.0
From: <sip:34020000002000000001@3402000000>;tag=1420309512
To: <sip:34020000001370000001@3402000000>;tag=1499847265
CSeq: 2 BYE
Call-ID: 1420309512
Via: SIP/2.0/UDP 192.168.1.64:5060;branch=z9hG4bKee5c5d98-00007
Max-Forwards: 70
Content-Length: 0
# BYE ok
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.64:5060;branch=z9hG4bKee5c5d98-00007;received=192.168.1.101
From: <sip:34020000002000000001@3402000000>;tag=1420309512
To: <sip:34020000001370000001@3402000000>;tag=1499847265
Call-ID: 1420309512
CSeq: 2 BYE
User-Agent: IP Camera
Content-Length: 0

5. Dahua TALK intercom mode

  • flow chart

  • Specific signaling

    #主动发送invite到摄像机
    #平台侧------->设备侧
    INVITE sip:34020000001370000001@3402000000 SIP/2.0
    Via: SIP/2.0/UDP 192.168.32.33:14000;rport;branch=z9hG4bK7d0821ae
    From: <sip:34020000002000000033@3402000000>;tag=1752762308
    To: <sip:34020000001370000001@3402000000>
    Call-ID: 1949196054
    CSeq: 5 INVITE
    Content-Type: APPLICATION/SDP
    Contact: <sip:[email protected]:14000>
    Max-forwards: 70
    User-Agent: tiamaes
    Subject: 34020000001370000001:2,34020000002000000033:2
    Content-Length: 183
    
    v=0
    o=34020000002000000033 0 0 IN IP4 192.168.32.33
    s=Talk
    c=IN IP4 192.168.32.33
    t=0 0
    # 此处我们可以控制数据的传输方式  可以使用  TCP/RTP/AVP
    # 25000 是平台侧发送语音数据的端口
    m=audio 25000 TCP/RTP/AVP 8
    a=sendrecv
    a=rtpmap:8 PCMA/8000
    f=v/a/1/8/1
    y=0200000002
    
    
    #设备回复invite ok
    #设备测------>平台侧
    SIP/2.0 100 Trying
    Call-ID: 1949196054
    Content-Length: 0
    CSeq: 5 INVITE
    From: <sip:34020000002000000033@3402000000>;tag=1752762308
    To: <sip:34020000001370000001@3402000000>
    User-Agent: SIP UAS V3.0.0.1049939
    Via: SIP/2.0/UDP 192.168.32.33:14000;rport=14000;branch=z9hG4bK7d0821ae
    
    <!--接收到摄像机响应-->
    SIP/2.0 101 Dialog Establishment
    Call-ID: 1949196054
    Contact: <sip:[email protected]:5060>
    Content-Length: 0
    CSeq: 5 INVITE
    From: <sip:34020000002000000033@3402000000>;tag=1752762308
    To: <sip:34020000001370000001@3402000000>;tag=5aaf5dffc1105842785cdf093029bcf8
    User-Agent: SIP UAS V3.0.0.1049939
    Via: SIP/2.0/UDP 192.168.32.33:14000;rport=14000;branch=z9hG4bK7d0821ae
    
    <!--接收到摄像机响应-->
    SIP/2.0 200 OK
    Call-ID: 1949196054
    Contact: <sip:[email protected]:5060>
    Content-Length: 270
    Content-Type: application/sdp
    CSeq: 5 INVITE
    From: <sip:34020000002000000033@3402000000>;tag=1752762308
    To: <sip:34020000001370000001@3402000000>;tag=5aaf5dffc1105842785cdf093029bcf8
    User-Agent: SIP UAS V3.0.0.1049939
    Via: SIP/2.0/UDP 192.168.32.33:14000;rport=14000;branch=z9hG4bK7d0821ae
    
    v=0
    o=34020000001310000001 0 0 IN IP4 192.168.32.13
    s=Talk
    i=VCam Talk Session
    c=IN IP4 192.168.32.13
    t=0 0
    # 9712是设备测开的接收语音数据流的端口
    m=audio 9712 TCP/RTP/AVP 8	
    a=recvonly
    a=rtpmap:8 PCMA/8000/1
    m=audio 9712 TCP/RTP/AVP 8	
    a=sendonly
    a=rtpmap:8 PCMA/8000/1
    y=0200000002
    f=v/0/0/0/0/0a/0/0/0
    
    
    #发送ack到摄像机
    ACK sip:34020000001370000001@3402000000 SIP/2.0
    Via: SIP/2.0/UDP 192.168.32.33:14000;rport;branch=z9hG4bK6e554aa5
    From: <sip:34020000002000000033@3402000000>;tag=1752762308
    To: <sip:34020000001370000001@3402000000>;tag=5aaf5dffc1105842785cdf093029bcf8
    Call-ID: 1949196054
    CSeq: 5 ACK
    Contact: <sip:[email protected]:14000>
    Max-forwards: 70
    User-Agent: tiamaes
    Content-Length: 0
    # 这一步进行完就可以对讲了
    

    By comparing the national standard signaling and Dahua talk signaling, we can see that for the standard national standard intercom SIP signaling, invite is initiated by device testing. We have no way to control the data transmission mode, while Dahua's talk mode invite is the platform Initiated from the side, we can control whether the data transmission mode is udp or tcp (of course, the device must be tested to support the tcp transmission mode, otherwise it will be in vain)

6. Write at the end

  • About sip signaling

In the process of contacting everyone, most of them are new to the national standard protocol and the WVP platform, and may be unfamiliar with the SIP protocol and SDP message body, because most of them usually use the http protocol more, and request and respond once. There may be some resistance to the SIP protocol, which requires multiple requests and multiple responses in order to complete a function. I hope everyone will put aside their resistance and calm down to take a good look at the signaling. As long as everyone is willing to work hard and dig deeper. , this SIP signaling is actually not difficult. I will give you a few introductory reference materials. I hope everyone will take a look and use wireshark to capture packets for practical analysis.

SIP Getting Started Reference

Detailed explanation of SDP message body

  • About wvp

The wvp author uses a lot of design patterns and asynchronous programming in the code. If you have trouble reading the code, please learn design patterns and JUC programming.

  • at last

I hope to read the wvp and zlmediakit wikis several times. If you can't solve the problem, you can contact me. It's not limited to the intercom module. I can also help you troubleshoot other functions.

Guess you like

Origin blog.csdn.net/weixin_43162884/article/details/132231603