[置顶] 【GBT28181开发:SIP协议实践】之设备状态查询

下面学习的是设备状态查询的流程,和设备信息、设备目录的流程差不多,主要是描述的协议字段不同,模拟SPVMN系统向源设备查询其当前状态,记录下交互的消息,详细研究了下:

转载请注明出处:http://blog.csdn.net/longlong530


一.环境搭建:

环境准备:http://blog.csdn.net/longlong530/article/details/9176989

UAC(模拟IPC):

IP:192.168.10.177(同事人不在~,直接用自己的机子模拟了下)

Port:5061


UAS(模拟SIP服务器):

IP:192.168.10.177

Port:5060


SPVMN操作过程:
1.先选择调测设备类型
2.打开UAC.exe完成注册( http://blog.csdn.net/longlong530/article/details/9179513)
3.点击设备状态查询,会在左边的文本框中显示xml。
<?xml version="1.0"?>
<Query>
<CmdType>DeviceStatus</CmdType>
<SN>248</SN>
<DeviceID>34020000001320000001</DeviceID>
</Query>
4.点击发送消息,右边对话框即可显示消息交互的过程。(图就不截了~)

二.业务时序图:

[置顶] 【GBT28181开发:SIP协议实践】之设备状态查询_第1张图片

三.消息详解:

第一步,UAS-->UAC
设备 状态查询命令同样是采用Message消息
Content-type头域为Application/MANSCDP+xml,设备状态查询命令采用MANSCDP协议格式,具体参见GBT28181国标。
请求命令包含命令类型(CmdType)、命令序列号(SN)、设备编码(DeviceID)

MESSAGE sip:34020000001320000001@3402000000 SIP/2.0
Call-ID: [email protected]
CSeq: 1 MESSAGE
From: <sip:34020000002000000001@3402000000>;tag=57058243_53173353_0c91e50f-6103-4d3e-8dc3-2c3e9967bd21
To: <sip:34020000001320000001@3402000000>
Max-Forwards: 70
Content-Type: Application/MANSCDP+xml
Route: <sip:[email protected]:5061;line=9a1ca01668b5778;lr>
Via: SIP/2.0/UDP 192.168.10.177:5060;branch=z9hG4bK0c91e50f-6103-4d3e-8dc3-2c3e9967bd21_53173353_15796557400494
Content-Length: 130

<?xml version="1.0"?>
<Query>
<CmdType>DeviceStatus</CmdType>
<SN>248</SN>
<DeviceID>34020000001320000001</DeviceID>
</Query>

第二步,UAC-->UAS
UAC收到请求后,立马返回200 0K响应
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.177:5060;branch=z9hG4bK0c91e50f-6103-4d3e-8dc3-2c3e9967bd21_53173353_15796557400494
From: <sip:34020000002000000001@3402000000>;tag=57058243_53173353_0c91e50f-6103-4d3e-8dc3-2c3e9967bd21
To: <sip:34020000001320000001@3402000000>;tag=3987530258
Call-ID: [email protected]
CSeq: 1 MESSAGE
User-Agent: eXosip/3.6.0
Content-Length: 0

第三步,UAC-->UAS
源设备响应服务器的设备状态查询请求,同样采用MANSCDP协议,返回 状态相关信息
MESSAGE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.10.177:5061;rport=5061;branch=z9hG4bK3477261004;received=192.168.10.177
From: <sip:192.168.10.177:5060>;tag=3230985338
To: <sip:[email protected]>
Call-ID: 80728334
CSeq: 20 MESSAGE
Content-Type: Application/MANSCDP+xml
Max-Forwards: 70
User-Agent: eXosip/3.6.0
Content-Length: 427

<?xml version="1.0"?>
<Response>
<CmdType>DeviceStatus</CmdType>
<SN>248</SN>
<DeviceID>34020000001320000001</DeviceID>
<Result>OK</Result>
<Online>ONLINE</Online>
<Status>OK</Status>
<Encode>ON</Encode>
<Record>OFF</Record>
<DeviceTime>2013-06-26T16:23:32</DeviceTime>
<Alarmstatus Num="1">
<Item>
<DeviceID>34020000001320000001</DeviceID>
<DutyStatus>OFFDUTY</DutyStatus>
</Item>
</Alarmstatus>
</Response>

第四步,UAS-->UAC
服务器收到响应后,立马返回200 OK响应,整个 状态查询业务结束。
SIP/2.0 200 OK
To: <sip:[email protected]>;tag=69826386_53173353_9353aed9-b18c-47a4-8eec-44bf2eabda3f
Via: SIP/2.0/UDP 192.168.10.177:5061;rport=5061;branch=z9hG4bK3477261004;received=192.168.10.177
CSeq: 20 MESSAGE
Call-ID: 80728334
From: <sip:192.168.10.177:5060>;tag=3230985338
Content-Length: 0


你可能感兴趣的:(SIP,设备状态查询)