异常情况打印信息优化
parent
cd117ed228
commit
4c6c77be7a
|
@ -1,7 +1,10 @@
|
||||||
package com.genersoft.iot.vmp.conf;
|
package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd.AlarmQueryMessageHandler;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.utils.SystemInfoUtils;
|
import com.genersoft.iot.vmp.utils.SystemInfoUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -14,6 +17,8 @@ import java.util.Map;
|
||||||
@Component
|
@Component
|
||||||
public class SystemInfoTimerTask {
|
public class SystemInfoTimerTask {
|
||||||
|
|
||||||
|
private Logger logger = LoggerFactory.getLogger(SystemInfoTimerTask.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
|
||||||
|
@ -27,7 +32,7 @@ public class SystemInfoTimerTask {
|
||||||
Map<String, String> networkInterfaces = SystemInfoUtils.getNetworkInterfaces();
|
Map<String, String> networkInterfaces = SystemInfoUtils.getNetworkInterfaces();
|
||||||
redisCatchStorage.addNetInfo(networkInterfaces);
|
redisCatchStorage.addNetInfo(networkInterfaces);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
logger.error("[获取系统信息失败] {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,35 +2,23 @@ package com.genersoft.iot.vmp.conf;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.VersionPo;
|
import com.genersoft.iot.vmp.common.VersionPo;
|
||||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
import com.genersoft.iot.vmp.utils.JarFileUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class VersionInfo {
|
public class VersionInfo {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
VersionConfig config;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
GitUtil gitUtil;
|
GitUtil gitUtil;
|
||||||
@Autowired
|
|
||||||
JarFileUtils jarFileUtils;
|
|
||||||
|
|
||||||
public VersionPo getVersion() {
|
public VersionPo getVersion() {
|
||||||
VersionPo versionPo = new VersionPo();
|
VersionPo versionPo = new VersionPo();
|
||||||
Map<String,String> map=jarFileUtils.readJarFile();
|
|
||||||
versionPo.setGIT_Revision(gitUtil.getGitCommitId());
|
versionPo.setGIT_Revision(gitUtil.getGitCommitId());
|
||||||
versionPo.setCreate_By(map.get("Created-By"));
|
|
||||||
versionPo.setGIT_BRANCH(gitUtil.getBranch());
|
versionPo.setGIT_BRANCH(gitUtil.getBranch());
|
||||||
versionPo.setGIT_URL(gitUtil.getGitUrl());
|
versionPo.setGIT_URL(gitUtil.getGitUrl());
|
||||||
versionPo.setBUILD_DATE(gitUtil.getBuildDate());
|
versionPo.setBUILD_DATE(gitUtil.getBuildDate());
|
||||||
versionPo.setArtifactId(config.getArtifactId());
|
|
||||||
versionPo.setGIT_Revision_SHORT(gitUtil.getCommitIdShort());
|
versionPo.setGIT_Revision_SHORT(gitUtil.getCommitIdShort());
|
||||||
versionPo.setVersion(config.getVersion());
|
versionPo.setVersion(gitUtil.getBuildVersion());
|
||||||
versionPo.setProject(config.getDescription());
|
|
||||||
versionPo.setBuild_Jdk(map.get("Build-Jdk"));
|
|
||||||
|
|
||||||
return versionPo;
|
return versionPo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.auth;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.storager.impl.VideoManagerStorageImpl;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description:注册逻辑处理,当设备注册后触发逻辑。
|
|
||||||
* @author: swwheihei
|
|
||||||
* @date: 2020年5月8日 下午9:41:46
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class RegisterLogicHandler {
|
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(RegisterLogicHandler.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SIPCommander cmder;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private VideoManagerStorageImpl storager;
|
|
||||||
|
|
||||||
public void onRegister(Device device) {
|
|
||||||
// 只有第一次注册时调用查询设备信息,如需更新调用更新API接口
|
|
||||||
// // TODO 此处错误无法获取到通道
|
|
||||||
// Device device1 = storager.queryVideoDevice(device.getDeviceId());
|
|
||||||
// if (device.isFirsRegister()) {
|
|
||||||
// logger.info("[{}] 首次注册,查询设备信息以及通道信息", device.getDeviceId());
|
|
||||||
// try {
|
|
||||||
// Thread.sleep(100);
|
|
||||||
// cmder.deviceInfoQuery(device);
|
|
||||||
// Thread.sleep(100);
|
|
||||||
// cmder.catalogQuery(device, null);
|
|
||||||
// } catch (InterruptedException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -51,7 +51,6 @@ public class AlarmEventListener implements ApplicationListener<AlarmEvent> {
|
||||||
}
|
}
|
||||||
// 移除已关闭的连接
|
// 移除已关闭的连接
|
||||||
it.remove();
|
it.remove();
|
||||||
// e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,23 +3,15 @@ package com.genersoft.iot.vmp.gb28181.session;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.sip.ClientTransaction;
|
|
||||||
import javax.sip.Dialog;
|
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SipMsgInfo;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
||||||
import com.genersoft.iot.vmp.utils.SerializeUtils;
|
|
||||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
|
||||||
import gov.nist.javax.sip.message.SIPResponse;
|
import gov.nist.javax.sip.message.SIPResponse;
|
||||||
import gov.nist.javax.sip.stack.SIPDialog;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description:视频流session管理器,管理视频预览、预览回放的通信句柄
|
* @description:视频流session管理器,管理视频预览、预览回放的通信句柄
|
||||||
|
|
|
@ -13,11 +13,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
|
||||||
import com.genersoft.iot.vmp.utils.SerializeUtils;
|
|
||||||
import gov.nist.javax.sip.SIPConstants;
|
|
||||||
import gov.nist.javax.sip.SipProviderImpl;
|
import gov.nist.javax.sip.SipProviderImpl;
|
||||||
import gov.nist.javax.sip.SipStackImpl;
|
|
||||||
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
import gov.nist.javax.sip.message.MessageFactoryImpl;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -27,7 +23,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
import org.springframework.context.annotation.DependsOn;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
|
|
@ -661,12 +661,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
mediaListManager.removedChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream());
|
mediaListManager.removedChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream());
|
||||||
try {
|
try {
|
||||||
responseAck(serverTransaction, Response.TEMPORARILY_UNAVAILABLE, response.getMsg());
|
responseAck(serverTransaction, Response.TEMPORARILY_UNAVAILABLE, response.getMsg());
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -733,12 +729,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId);
|
mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InvalidArgumentException e) {
|
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage());
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (SipException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,23 +115,15 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
|
||||||
// 失败的回复
|
// 失败的回复
|
||||||
try {
|
try {
|
||||||
responseAck(serverTransaction, eventResult.statusCode, eventResult.msg);
|
responseAck(serverTransaction, eventResult.statusCode, eventResult.msg);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}, eventResult -> {
|
}, eventResult -> {
|
||||||
// 成功的回复
|
// 成功的回复
|
||||||
try {
|
try {
|
||||||
responseAck(serverTransaction, eventResult.statusCode);
|
responseAck(serverTransaction, eventResult.statusCode);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 录像控制: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,12 +217,8 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck(getServerTransaction(evt), Response.OK);
|
responseAck(getServerTransaction(evt), Response.OK);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("[命令发送失败] 国标级联 报警通知回复: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
Element deviceIdElement = rootElement.element("DeviceID");
|
Element deviceIdElement = rootElement.element("DeviceID");
|
||||||
String channelId = deviceIdElement.getText().toString();
|
String channelId = deviceIdElement.getText().toString();
|
||||||
|
|
|
@ -78,12 +78,8 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
deviceService.online(device);
|
deviceService.online(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 心跳回复: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,8 @@ public class MediaStatusNotifyMessageHandler extends SIPRequestProcessorParent i
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck(getServerTransaction(evt), Response.OK);
|
responseAck(getServerTransaction(evt), Response.OK);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 录像流推送完毕,回复200OK: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME);
|
CallIdHeader callIdHeader = (CallIdHeader)evt.getRequest().getHeader(CallIdHeader.NAME);
|
||||||
String NotifyType =getText(rootElement, "NotifyType");
|
String NotifyType =getText(rootElement, "NotifyType");
|
||||||
|
|
|
@ -59,12 +59,8 @@ public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implemen
|
||||||
logger.info("不支持alarm查询");
|
logger.info("不支持alarm查询");
|
||||||
try {
|
try {
|
||||||
responseAck(getServerTransaction(evt), Response.NOT_FOUND, "not support alarm query");
|
responseAck(getServerTransaction(evt), Response.NOT_FOUND, "not support alarm query");
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 alarm查询回复200OK: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,8 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem
|
||||||
// 回复无通道
|
// 回复无通道
|
||||||
cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0);
|
cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), 0);
|
||||||
}
|
}
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 目录查询: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class BroadcastResponseMessageHandler extends SIPRequestProcessorParent i
|
||||||
|
|
||||||
|
|
||||||
} catch (ParseException | SipException | InvalidArgumentException e) {
|
} catch (ParseException | SipException | InvalidArgumentException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 语音喊话: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,8 @@ public class ConfigDownloadResponseMessageHandler extends SIPRequestProcessorPar
|
||||||
msg.setKey(key);
|
msg.setKey(key);
|
||||||
msg.setData(json);
|
msg.setData(json);
|
||||||
deferredResultHolder.invokeAllResult(msg);
|
deferredResultHolder.invokeAllResult(msg);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 设备配置查询: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,12 +58,8 @@ public class DeviceControlResponseMessageHandler extends SIPRequestProcessorPare
|
||||||
msg.setKey(key);
|
msg.setKey(key);
|
||||||
msg.setData(json);
|
msg.setData(json);
|
||||||
deferredResultHolder.invokeAllResult(msg);
|
deferredResultHolder.invokeAllResult(msg);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 设备控制: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,12 +60,8 @@ public class DeviceStatusResponseMessageHandler extends SIPRequestProcessorParen
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck(getServerTransaction(evt), Response.OK);
|
responseAck(getServerTransaction(evt), Response.OK);
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 设备状态应答回复200OK: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
Element deviceIdElement = element.element("DeviceID");
|
Element deviceIdElement = element.element("DeviceID");
|
||||||
Element onlineElement = element.element("Online");
|
Element onlineElement = element.element("Online");
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (DocumentException e) {
|
} catch (DocumentException e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("xml解析异常: ", e);
|
||||||
} finally {
|
} finally {
|
||||||
taskQueueHandlerRun = false;
|
taskQueueHandlerRun = false;
|
||||||
}
|
}
|
||||||
|
@ -155,13 +155,9 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (SipException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
logger.error("[命令发送失败] 国标级联 国标录像: {}", e.getMessage());
|
||||||
} catch (InvalidArgumentException e) {
|
} finally {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
taskQueueHandlerRun = false;
|
taskQueueHandlerRun = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.transmit.event.timeout.impl;
|
package com.genersoft.iot.vmp.gb28181.transmit.event.timeout.impl;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.conf.SystemInfoTimerTask;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.timeout.ITimeoutProcessor;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -13,6 +16,8 @@ import javax.sip.header.CallIdHeader;
|
||||||
@Component
|
@Component
|
||||||
public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor {
|
public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor {
|
||||||
|
|
||||||
|
private Logger logger = LoggerFactory.getLogger(TimeoutProcessorImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SIPProcessorObserver processorObserver;
|
private SIPProcessorObserver processorObserver;
|
||||||
|
|
||||||
|
@ -36,7 +41,7 @@ public class TimeoutProcessorImpl implements InitializingBean, ITimeoutProcessor
|
||||||
sipSubscribe.removeErrorSubscribe(callId);
|
sipSubscribe.removeErrorSubscribe(callId);
|
||||||
sipSubscribe.removeOkSubscribe(callId);
|
sipSubscribe.removeOkSubscribe(callId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
logger.error("[超时事件失败]: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,6 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
|
||||||
try {
|
try {
|
||||||
gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId());
|
gBMap.put(streamPushExcelDto.getApp() + streamPushExcelDto.getStream(), streamPushExcelDto.getGbId());
|
||||||
}catch (IllegalArgumentException e) {
|
}catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
|
||||||
errorGBList.add(streamPushExcelDto.getGbId() + "(不同的app+stream使用了相同的国标ID)");
|
errorGBList.add(streamPushExcelDto.getGbId() + "(不同的app+stream使用了相同的国标ID)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
||||||
try {
|
try {
|
||||||
playMsgCallback.handler(responseSendItemMsg);
|
playMsgCallback.handler(responseSendItemMsg);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
logger.error("[REDIS消息处理异常] ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -17,49 +17,6 @@ public class GpsUtil {
|
||||||
public static BaiduPoint Wgs84ToBd09(String xx, String yy) {
|
public static BaiduPoint Wgs84ToBd09(String xx, String yy) {
|
||||||
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// Socket s = new Socket("api.map.baidu.com", 80);
|
|
||||||
// BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8"));
|
|
||||||
// OutputStream out = s.getOutputStream();
|
|
||||||
// StringBuffer sb = new StringBuffer("GET /ag/coord/convert?from=0&to=4");
|
|
||||||
// sb.append("&x=" + xx + "&y=" + yy);
|
|
||||||
// sb.append("&callback=BMap.Convertor.cbk_3976 HTTP/1.1\r\n");
|
|
||||||
// sb.append("User-Agent: Java/1.6.0_20\r\n");
|
|
||||||
// sb.append("Host: api.map.baidu.com:80\r\n");
|
|
||||||
// sb.append("Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n");
|
|
||||||
// sb.append("Connection: Close\r\n");
|
|
||||||
// sb.append("\r\n");
|
|
||||||
// out.write(sb.toString().getBytes());
|
|
||||||
// String json = "";
|
|
||||||
// String tmp = "";
|
|
||||||
// while ((tmp = br.readLine()) != null) {
|
|
||||||
// // logger.info(tmp);
|
|
||||||
// json += tmp;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// s.close();
|
|
||||||
// int start = json.indexOf("cbk_3976");
|
|
||||||
// int end = json.lastIndexOf("}");
|
|
||||||
// if (start != -1 && end != -1 && json.contains("\"x\":\"")) {
|
|
||||||
// json = json.substring(start, end);
|
|
||||||
// String[] point = json.split(",");
|
|
||||||
// String x = point[1].split(":")[1].replace("\"", "");
|
|
||||||
// String y = point[2].split(":")[1].replace("\"", "");
|
|
||||||
// BaiduPoint bdPoint= new BaiduPoint();
|
|
||||||
// bdPoint.setBdLng(new String(decode(x)));
|
|
||||||
// bdPoint.setBdLat(new String(decode(y)));
|
|
||||||
// return bdPoint;
|
|
||||||
// //return (new String(decode(x)) + "," + new String(decode(y)));
|
|
||||||
// } else {
|
|
||||||
// logger.info("gps坐标无效!!");
|
|
||||||
// }
|
|
||||||
// out.close();
|
|
||||||
// br.close();
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
double lng = Double.parseDouble(xx);
|
double lng = Double.parseDouble(xx);
|
||||||
double lat = Double.parseDouble(yy);
|
double lat = Double.parseDouble(yy);
|
||||||
Double[] gcj02 = Coordtransform.WGS84ToGCJ02(lng, lat);
|
Double[] gcj02 = Coordtransform.WGS84ToGCJ02(lng, lat);
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
|
|
||||||
public class IpUtil {
|
|
||||||
public static String getIpAddr(HttpServletRequest request) {
|
|
||||||
String ipAddress = null;
|
|
||||||
try {
|
|
||||||
ipAddress = request.getHeader("x-forwarded-for");
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getHeader("Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getHeader("WL-Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getRemoteAddr();
|
|
||||||
if (ipAddress.equals("127.0.0.1")) {
|
|
||||||
// 根据网卡取本机配置的IP
|
|
||||||
InetAddress inet = null;
|
|
||||||
try {
|
|
||||||
inet = InetAddress.getLocalHost();
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
ipAddress = inet.getHostAddress();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
|
|
||||||
if (ipAddress != null && ipAddress.length() > 15) { // "***.***.***.***".length()
|
|
||||||
// = 15
|
|
||||||
if (ipAddress.indexOf(",") > 0) {
|
|
||||||
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
ipAddress="";
|
|
||||||
}
|
|
||||||
// ipAddress = this.getRequest().getRemoteAddr();
|
|
||||||
|
|
||||||
return ipAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.utils;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.ClassUtils;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.jar.JarEntry;
|
|
||||||
import java.util.jar.JarFile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一个优秀的颓废程序猿
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class JarFileUtils {
|
|
||||||
private static Logger log = LoggerFactory.getLogger(JarFileUtils.class);
|
|
||||||
private static Map<String, String> map = new HashMap<>();
|
|
||||||
|
|
||||||
public Map<String, String> readJarFile() {
|
|
||||||
JarFile jarFile = null;
|
|
||||||
BufferedReader br = null;
|
|
||||||
try {
|
|
||||||
// 获取jar的运行路径,因linux下jar的路径为”file:/app/.../test.jar!/BOOT-INF/class!/“这种格式,所以需要去掉”file:“和”!/BOOT-INF/class!/“
|
|
||||||
String jarFilePath = ClassUtils.getDefaultClassLoader().getResource("").getPath().replace("!/BOOT-INF/classes!/", "");
|
|
||||||
if (jarFilePath.startsWith("file")) {
|
|
||||||
jarFilePath = jarFilePath.substring(5);
|
|
||||||
}
|
|
||||||
log.debug("jarFilePath:" + jarFilePath);
|
|
||||||
// 通过JarFile的getJarEntry方法读取META-INF/MANIFEST.MF
|
|
||||||
jarFile = new JarFile(jarFilePath);
|
|
||||||
JarEntry entry = jarFile.getJarEntry("META-INF/MANIFEST.MF");
|
|
||||||
log.info("读取的内容:" + entry.toString());
|
|
||||||
// 如果读取到MANIFEST.MF文件内容,则转换为string
|
|
||||||
if (entry != null) {
|
|
||||||
InputStream in = jarFile.getInputStream(entry);
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
br = new BufferedReader(new InputStreamReader(in));
|
|
||||||
String line = "";
|
|
||||||
while ((line = br.readLine()) != null) {
|
|
||||||
if (line != null && line.contains(":")) {
|
|
||||||
int index = line.indexOf(":");
|
|
||||||
map.put(line.substring(0, index).trim(), line.substring(index + 1, line.length()).trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.debug("读取MANIFEST.MF文件异常:" + e.getMessage());
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (null != br) {
|
|
||||||
br.close();
|
|
||||||
}
|
|
||||||
if (null != jarFile) {
|
|
||||||
jarFile.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.genersoft.iot.vmp.utils;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
public class SerializeUtils {
|
|
||||||
public static byte[] serialize(Object obj){
|
|
||||||
byte[] bytes = null;
|
|
||||||
try {
|
|
||||||
ByteArrayOutputStream baos=new ByteArrayOutputStream();;
|
|
||||||
ObjectOutputStream oos=new ObjectOutputStream(baos);
|
|
||||||
oos.writeObject(obj);
|
|
||||||
bytes=baos.toByteArray();
|
|
||||||
baos.close();
|
|
||||||
oos.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
public static Object deSerialize(byte[] bytes){
|
|
||||||
Object obj=null;
|
|
||||||
try {
|
|
||||||
ByteArrayInputStream bais=new ByteArrayInputStream(bytes);
|
|
||||||
ObjectInputStream ois=new ObjectInputStream(bais);
|
|
||||||
obj=ois.readObject();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -96,7 +96,7 @@ public class MediaController {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
logger.error("[线程休眠失败], {}", e.getMessage());
|
||||||
}
|
}
|
||||||
if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) {
|
if (useSourceIpAsStreamIp != null && useSourceIpAsStreamIp) {
|
||||||
String host = request.getHeader("Host");
|
String host = request.getHeader("Host");
|
||||||
|
|
Loading…
Reference in New Issue