[置顶] 【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"?> <Control> <CmdType>DeviceControl</CmdType> <SN>17298</SN> <DeviceID>34020000001320000001</DeviceID> <TeleBoot>Boot</TeleBoot> </Control>4.点击发送消息,右边对话框即可显示消息交互的过程。(图就不截了~)
二.业务时序图:
三.消息详解:
第一步,UAS-->UAC
设备控制命令同样是采用Message消息
Content-type头域为Application/MANSCDP+xml,设备状态查询命令采用MANSCDP协议格式,具体参见GBT28181国标。
请求命令包含命令类型(CmdType)、命令序列号(SN)、设备编码(DeviceID)
MESSAGE sip:34020000001320000001@3402000000 SIP/2.0 Call-ID: fac5d9915d7b4b64e46054bbbda3f29f@0.0.0.0 CSeq: 1 MESSAGE From: <sip:34020000002000000001@3402000000>;tag=58726327_53173353_c2be9be1-4121-42af-b4e2-e4896ab42120 To: <sip:34020000001320000001@3402000000> Max-Forwards: 70 Content-Type: Application/MANSCDP+xml Route: <sip:34020000001320000001@192.168.10.177:5061;line=9a1ca01668b5778;lr> Via: SIP/2.0/UDP 192.168.10.177:5060;branch=z9hG4bKc2be9be1-4121-42af-b4e2-e4896ab42120_53173353_18042259617961 Content-Length: 164 <?xml version="1.0"?> <Control> <CmdType>DeviceControl</CmdType> <SN>17298</SN> <DeviceID>34020000001320000001</DeviceID> <TeleBoot>Boot</TeleBoot> </Control>
第二步,UAC-->UAS
UAC收到请求后,立马返回200 0K响应
SIP/2.0 200 OK Via: SIP/2.0/UDP 192.168.10.177:5060;branch=z9hG4bKc2be9be1-4121-42af-b4e2-e4896ab42120_53173353_18042259617961 From: <sip:34020000002000000001@3402000000>;tag=58726327_53173353_c2be9be1-4121-42af-b4e2-e4896ab42120 To: <sip:34020000001320000001@3402000000>;tag=3874540817 Call-ID: fac5d9915d7b4b64e46054bbbda3f29f@0.0.0.0 CSeq: 1 MESSAGE User-Agent: eXosip/3.6.0 Content-Length: 0
第三步,UAC-->UAS
源设备响应服务器的设备远程启动请求,同样采用MANSCDP协议,返回状态相关信息
MESSAGE sip:34020000001320000001@192.168.10.177 SIP/2.0 Via: SIP/2.0/UDP 192.168.10.177:5061;rport=5061;branch=z9hG4bK3569164341;received=192.168.10.177 From: <sip:192.168.10.177:5060>;tag=3889968117 To: <sip:34020000001320000001@192.168.10.177> Call-ID: 2825372510 CSeq: 20 MESSAGE Content-Type: Application/MANSCDP+xml Max-Forwards: 70 User-Agent: eXosip/3.6.0 Content-Length: 162 <?xml version="1.0"?> <Response> <CmdType>DeviceControl</CmdType> <SN>17298</SN> <DeviceID>34020000001320000001</DeviceID> <Result>OK</Result> </Response>
第四步,UAS-->UAC
服务器收到响应后,立马返回200 OK响应,整个业务结束。
SIP/2.0 200 OK To: <sip:34020000001320000001@192.168.10.177>;tag=70215966_53173353_3fef6c77-3ced-484e-9fe7-8905f724c295 Via: SIP/2.0/UDP 192.168.10.177:5061;rport=5061;branch=z9hG4bK3569164341;received=192.168.10.177 CSeq: 20 MESSAGE Call-ID: 2825372510 From: <sip:192.168.10.177:5060>;tag=3889968117 Content-Length: 0