修复级联的通道查询以及设备信息查询
parent
810dceea88
commit
c33bf822cc
|
@ -74,5 +74,8 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> {
|
||||||
device.setOnline(1);
|
device.setOnline(1);
|
||||||
// 处理上线监听
|
// 处理上线监听
|
||||||
storager.updateDevice(device);
|
storager.updateDevice(device);
|
||||||
|
|
||||||
|
// TODO 上线添加订阅
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,6 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
|
||||||
logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID());
|
logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID());
|
||||||
sipCommanderFroPlatform.register(parentPlatform, null, okEvent);
|
sipCommanderFroPlatform.register(parentPlatform, null, okEvent);
|
||||||
}
|
}
|
||||||
}, config.getRegisterTimeInterval(), config.getRegisterTimeInterval());//十五秒后再次发起注册
|
}, config.getRegisterTimeInterval()* 1000, config.getRegisterTimeInterval()* 1000);//十五秒后再次发起注册
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Vector;
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
|
public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class);
|
private final static Logger logger = LoggerFactory.getLogger(InviteRequestProcessor.class);
|
||||||
|
|
||||||
private SIPCommanderFroPlatform cmderFroPlatform;
|
private SIPCommanderFroPlatform cmderFroPlatform;
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -326,6 +326,7 @@ public class ZLMHttpHookListener {
|
||||||
String streamId = json.getString("stream");
|
String streamId = json.getString("stream");
|
||||||
String app = json.getString("app");
|
String app = json.getString("app");
|
||||||
|
|
||||||
|
// TODO 如果在给上级推流,也不停止。
|
||||||
if ("rtp".equals(app)){
|
if ("rtp".equals(app)){
|
||||||
JSONObject ret = new JSONObject();
|
JSONObject ret = new JSONObject();
|
||||||
ret.put("code", 0);
|
ret.put("code", 0);
|
||||||
|
|
|
@ -26,7 +26,9 @@ public interface PlatformChannelMapper {
|
||||||
|
|
||||||
@Insert("<script> "+
|
@Insert("<script> "+
|
||||||
"INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" +
|
"INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" +
|
||||||
"<foreach collection='channelReducesToAdd' item='item' separator=','> ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )</foreach>" +
|
"<foreach collection='channelReducesToAdd' item='item' separator=','>" +
|
||||||
|
" ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )" +
|
||||||
|
"</foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
|
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: local
|
Binary file not shown.
Loading…
Reference in New Issue