|
@ -492,11 +492,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
|
|
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
|
|
// 查询设备是否存在
|
|
|
// 查询设备是否存在
|
|
|
Device device = storager.queryVideoDevice(deviceId); |
|
|
Device device = storager.queryVideoDevice(deviceId); |
|
|
if (device == null) { |
|
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(deviceId); |
|
|
logger.warn("处理DeviceInfo设备信息Message时未找到设备信息"); |
|
|
|
|
|
response404Ack(evt); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
Element rootElement = getRootElement(evt); |
|
|
Element rootElement = getRootElement(evt); |
|
|
String requestName = rootElement.getName(); |
|
|
String requestName = rootElement.getName(); |
|
|
Element deviceIdElement = rootElement.element("DeviceID"); |
|
|
Element deviceIdElement = rootElement.element("DeviceID"); |
|
@ -508,20 +505,20 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
if (requestName.equals("Query")) { |
|
|
if (requestName.equals("Query")) { |
|
|
logger.info("接收到DeviceInfo查询消息"); |
|
|
logger.info("接收到DeviceInfo查询消息"); |
|
|
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
|
|
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
|
|
String platformId = ((SipUri) fromHeader.getAddress().getURI()).getUser(); |
|
|
if (parentPlatform == null) { |
|
|
if (platformId == null) { |
|
|
|
|
|
response404Ack(evt); |
|
|
response404Ack(evt); |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
// 回复200 OK
|
|
|
// 回复200 OK
|
|
|
responseAck(evt); |
|
|
responseAck(evt); |
|
|
String sn = rootElement.element("SN").getText(); |
|
|
String sn = rootElement.element("SN").getText(); |
|
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); |
|
|
|
|
|
cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); |
|
|
cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
logger.debug("接收到DeviceInfo应答消息"); |
|
|
logger.debug("接收到DeviceInfo应答消息"); |
|
|
if (device == null) { |
|
|
if (device == null) { |
|
|
|
|
|
logger.warn("处理DeviceInfo设备信息Message时未找到设备信息"); |
|
|
|
|
|
response404Ack(evt); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -561,11 +558,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
|
|
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
|
|
// 查询设备是否存在
|
|
|
// 查询设备是否存在
|
|
|
Device device = storager.queryVideoDevice(deviceId); |
|
|
Device device = storager.queryVideoDevice(deviceId); |
|
|
if (device == null) { |
|
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(deviceId); |
|
|
logger.warn("处理DeviceInfo设备信息Message时未找到设备信息"); |
|
|
|
|
|
response404Ack(evt); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Element rootElement = getRootElement(evt); |
|
|
Element rootElement = getRootElement(evt); |
|
|
String name = rootElement.getName(); |
|
|
String name = rootElement.getName(); |
|
@ -574,13 +568,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
Element deviceListElement = rootElement.element("DeviceList"); |
|
|
Element deviceListElement = rootElement.element("DeviceList"); |
|
|
String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; |
|
|
String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; |
|
|
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
|
|
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); |
|
|
AddressImpl address = (AddressImpl) fromHeader.getAddress(); |
|
|
|
|
|
SipUri uri = (SipUri) address.getURI(); |
|
|
|
|
|
String platformId = uri.getUser(); |
|
|
|
|
|
// if (deviceListElement == null) { // 存在DeviceList则为响应 catalog, 不存在DeviceList则为查询请求
|
|
|
|
|
|
if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求
|
|
|
if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求
|
|
|
// TODO 后续将代码拆分
|
|
|
// TODO 后续将代码拆分
|
|
|
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); |
|
|
|
|
|
if (parentPlatform == null) { |
|
|
if (parentPlatform == null) { |
|
|
response404Ack(evt); |
|
|
response404Ack(evt); |
|
|
return; |
|
|
return; |
|
@ -634,6 +623,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if (device == null) { |
|
|
|
|
|
logger.warn("收到catalog设备目录列表请求时未找到设备信息"); |
|
|
|
|
|
response404Ack(evt); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
deviceListElement = getRootElement(evt, device.getCharset()).element("DeviceList"); |
|
|
deviceListElement = getRootElement(evt, device.getCharset()).element("DeviceList"); |
|
|
Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); |
|
|
Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); |
|
|
if (deviceListIterator != null) { |
|
|
if (deviceListIterator != null) { |
|
|