语音对讲广播模式和TALK模式

2024-08-17 08:29:57 浏览数 (2)

一、标准国标对讲信令

1.1 流程图
1.2 交互信令描述
1.2.1 广播通知 BroadCast
代码语言:javascript复制
#平台侧------->设备侧

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>
1.2.2 设备侧收到广播通知回复
代码语言:javascript复制
#设备侧------>平台侧

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
1.2.3 设备侧主动发起invite
代码语言:javascript复制
#设备侧------>平台侧

INVITE sip:34020000002000000001@192.168.1.101:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.64:5060;rport;branch=z9hG4bK1490643408
From: <sip:34020000001110000001@192.168.1.64:5060>;tag=1499847265        //
To: <sip:34020000002000000001@192.168.1.101:5060>
Call-ID: 1420309512
CSeq: 20 INVITE
Contact: <sip:34020000001110000001@192.168.1.64: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                    
1.2.4 平台侧回复invite ok
代码语言:javascript复制
#平台侧------->设备侧
》》》》》》 IPC
SIP/2.0 200 OK
From: <sip:34020000001110000001@192.168.1.64:5060>;tag=1499847265
To: <sip:34020000002000000001@192.168.1.101: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:34020000002000000001@192.168.1.101: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
1.2.5 设备侧回复ACK
代码语言:javascript复制
#设备测------>平台侧
ACK sip:34020000002000000001@192.168.1.101:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.64:5060;rport;branch=z9hG4bK106578989
From: <sip:34020000001110000001@192.168.1.64:5060>;tag=1499847265
To: <sip:34020000002000000001@192.168.1.101:5060>;tag=1420309512
Call-ID: 1420309512
CSeq: 20 ACK
Contact: <sip:34020000001110000001@192.168.1.64:5060>
Max-Forwards: 70
User-Agent: IP Camera
Content-Length: 0

#这一步过后我们就可以发送音频数据了
————————————————

                            版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
                        
原文链接:https://blog.csdn.net/weixin_43162884/article/details/132231603
1.2.6 关闭对讲
代码语言:javascript复制
# 发送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
代码语言:javascript复制
# 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

二、大华TALK对讲模式

2.1 流程图
2.2 交互信令描述
2.2.1 主动发送invite到摄像机
代码语言:javascript复制
#平台侧------->设备侧
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:34020000002000000033@192.168.32.33: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
2.2.2 设备回复invite ok
代码语言:javascript复制
#设备测------>平台侧
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:34020000001180005001@192.168.32.13: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:34020000001180005001@192.168.32.13: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
2.2.3 平台发送ack到设备
代码语言:javascript复制
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:34020000002000000033@192.168.32.33:14000>
Max-forwards: 70
User-Agent: tiamaes
Content-Length: 0
# 这一步进行完就可以对讲了

0 人点赞